eclipse-sumo / sumo

Eclipse SUMO is an open source, highly portable, microscopic and continuous traffic simulation package designed to handle large networks. It allows for intermodal simulation including pedestrians and comes with a large set of tools for scenario creation.
https://eclipse.dev/sumo
Eclipse Public License 2.0
2.58k stars 1.44k forks source link

inconsistent stop flags between setting and retrieving stops #7452

Closed namdre closed 4 years ago

namdre commented 4 years ago

when calling setStop (or replaceStop). the flags are:

TRACI_CONST int STOP_DEFAULT = 0x00;
TRACI_CONST int STOP_PARKING = 0x01;
TRACI_CONST int STOP_TRIGGERED = 0x02;
TRACI_CONST int STOP_CONTAINER_TRIGGERED = 0x04;
TRACI_CONST int STOP_BUS_STOP = 0x08;
TRACI_CONST int STOP_CONTAINER_STOP = 0x10; (16)
TRACI_CONST int STOP_CHARGING_STATION = 0x20; (32)
TRACI_CONST int STOP_PARKING_AREA = 0x40; (64)
TRACI_CONST int STOP_OVERHEAD_WIRE = 0x80; (128)

However, when calling getNextStops, the result flags are shifted by one bit to accommodate the "reached" bit.

reached = 1
parking = 2
triggered = 4
containerTriggered = 8
busstop = 16
containerstop = 32
chargingstation = 64
parkingarea = 128

This makes it very inconvenient to re-use results from getNextStops for calling setStop.

namdre commented 4 years ago

solution: add new method getStops(vehID, limit) rather than adding the limit argument to getNextStops. new method returns better flags

namdre commented 4 years ago
namdre commented 4 years ago

False alarm: legacy behavior is already handed by traci-server.

getStops can live without a reached flag because the 'arrival' attribute can be checked (INVALID_DOUBLE when not yet reached).