cons->min= lim.min;
cons->max= lim.max;
} else {
- cons->max= -lim.min + tra->detectable;
- cons->min= -lim.max + tra->detectable;
+ cons->max= -lim.min + ceil(tra->detectable * MARGIN_TRAINLENGTH);
+ cons->min= -lim.max + ceil(tra->detectable * MARGIN_TRAINLENGTH);
}
cons->lastdetect= u->lastdetect;
cons->hardend= u->t.seg;
* so we must instead extend our idea of the length of the train.
*/
- int tail_walkback= MARGIN_NOSE + tail_length(tra) + tra->detectable;
+ int tail_walkback= MARGIN_NOSE + tail_length(tra) +
+ ceil(tra->detectable * MARGIN_TRAINLENGTH);
int tail_advance_delaydist= MARGIN_TAIL;
int effective_into_fdet= tra->maxinto - tra->uncertainty;
newfdet.remain= tra->maxinto;
newfdet.backwards= !tra->foredetect->tr_backwards;
- c.distance= tra->detectable + tra->uncertainty;
+ c.distance= ceil(tra->detectable * MARGIN_TRAINLENGTH) + tra->uncertainty;
c.nextseg= reverse_nextseg;
c.getmovpos= 0;
c.trackend= reverse_trackend;
* foremost reference possibility, plus ->head, plus MARGIN_NOSE
* (and if it is not stationary it may own more). It owns the
* track backwards from the rearmost reference possibility for
- * ->detectable plus ->tail plus MARGIN_NOSE.
+ * ceil(->detectable * MARGIN_TRAINLENGTH) + ->tail + MARGIN_NOSE.
*/
unsigned
backwards:1, /* train is moving backwards wrt its own front and back */
#define MARGIN_SPEED 1.2 /*ratio*/
#define MARGIN_AUTOPOINTTIME 500 /*ms*/
#define UNMARGIN_ROUNDING 1e-4 /* mm/ms; for 1s, leads to max err of 100um */
+#define MARGIN_TRAINLENGTH 1.05
#define MARGIN_STOPTIME 240 /*ms*/
#define MARGIN_POLARISETIME 120 /*ms*/