Skip to content

Commit

Permalink
Fix confidence interval calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarBLG committed Oct 1, 2023
1 parent 77118a8 commit f6b2a5a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion EVC/LX/level_crossing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void update_lx()
for (auto it=level_crossings.begin(); it!=level_crossings.end(); ) {
if (!it->lx_protected) {
if (it->svl_replaced && d_minsafefront(it->start) < it->start.min+it->length) inform_lx = true;
if (V_est == 0 && it->stop && d_estfront > it->start.est-it->stoplength) {
if (!it->svl_replaced && V_est == 0 && it->stop && d_estfront > it->start.est-it->stoplength) {
it->svl_replaced = distance::from_odometer(d_estfront_dir[odometer_orientation == -1]);
calculate_SvL();
}
Expand Down
10 changes: 2 additions & 8 deletions EVC/Position/distance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,17 +147,11 @@ confidence_data confidence_data::basic()
}
dist_base d_maxsafe(const dist_base &d, const confidence_data &conf)
{
if (d > conf.ref)
return conf.ref + (d-conf.ref)*1.01 + conf.locacc;
else
return conf.ref + (d-conf.ref)*0.99 + conf.locacc;
return d + std::abs(d-conf.ref)*0.01 + conf.locacc;
}
dist_base d_minsafe(const dist_base &d, const confidence_data &conf)
{
if (d > conf.ref)
return conf.ref + (d-conf.ref)*0.99 - conf.locacc;
else
return conf.ref + (d-conf.ref)*1.01 - conf.locacc;
return d - std::abs(d-conf.ref)*0.01 + conf.locacc;
}
dist_base d_maxsafefront(const confidence_data &conf)
{
Expand Down

0 comments on commit f6b2a5a

Please sign in to comment.