Skip to content

Commit

Permalink
prevent incoherent position in routing to stop on first edge ref #15563
Browse files Browse the repository at this point in the history
Signed-off-by: m-kro <[email protected]>
  • Loading branch information
m-kro committed Oct 10, 2024
1 parent bce4730 commit e1e0512
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/microsim/MSBaseVehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ MSBaseVehicle::reroute(SUMOTime t, const std::string& info, SUMOAbstractRouter<M
std::set<int> jumps;

if (myParameter->via.size() == 0) {
double firstPos = -1;
double lastPos = -1;
double firstPos = INVALID_DOUBLE;
double lastPos = INVALID_DOUBLE;
stops = getStopEdges(firstPos, lastPos, jumps);
if (stops.size() > 0) {
double sourcePos = onInit ? 0 : getPositionOnLane();
Expand Down Expand Up @@ -1586,8 +1586,12 @@ MSBaseVehicle::getStopEdges(double& firstPos, double& lastPos, std::set<int>& ju
}
}
prev = &stop;
if (firstPos < 0) {
firstPos = stopPos;
if (firstPos == INVALID_DOUBLE) {
if (stop.parkingarea != nullptr && stop.edge == myRoute->begin()) {
firstPos = MAX2(0., stopPos);
} else {
firstPos = stopPos;
}
}
lastPos = stopPos;
if (stop.pars.jump >= 0) {
Expand Down

0 comments on commit e1e0512

Please sign in to comment.