Skip to content

Fix TL_NEXT_SWITCH and TL_PHASE_DURATION type mismatch in trafficlights map#29

Open
tonmoy-TS wants to merge 1 commit into
pipeacosta:masterfrom
tonmoy-TS:fix/trafficlights-next-switch-phase-duration-type
Open

Fix TL_NEXT_SWITCH and TL_PHASE_DURATION type mismatch in trafficlights map#29
tonmoy-TS wants to merge 1 commit into
pipeacosta:masterfrom
tonmoy-TS:fix/trafficlights-next-switch-phase-duration-type

Conversation

@tonmoy-TS

Copy link
Copy Markdown

Fixes #8

traci.trafficlights.getNextSwitch() and getPhaseDuration() both resolve through getUniversal(), which looks up a type-reader function for each variable ID in RETURN_VALUE_FUNC.trafficlights. TL_NEXT_SWITCH and TL_PHASE_DURATION are double-typed per the SUMO TraCI wire protocol, but were mapped to readInt, corrupting the returned values (as reported in #8).

This changes only those two map entries from readInt to readDouble. TL_CURRENT_PHASE (a genuine integer) and the other trafficlights getters are untouched.

Credit to @bjyurkovich for the original diagnosis and workaround in #8, and to @tonmoy-TS for confirming it and identifying that getPhaseDuration has the same issue. This PR fixes the root cause (the type mapping) instead of adding a duplicate wrapper function.

…ts map

traci.trafficlights.getNextSwitch() and getPhaseDuration() both resolve
through getUniversal(), which looks up a type-reader function for each
variable ID in RETURN_VALUE_FUNC.trafficlights. TL_NEXT_SWITCH and
TL_PHASE_DURATION are double-typed per the SUMO TraCI wire protocol, but
were mapped to 'readInt', corrupting the returned values.

Fixes pipeacosta#8. See discussion and the affected-variable diagnosis in the issue
thread, including confirmation from @bjyurkovich and @tonmoy-TS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

trafficlights.getNextSwitch function problem in traci4matlab

1 participant