Fix TL_NEXT_SWITCH and TL_PHASE_DURATION type mismatch in trafficlights map#29
Open
tonmoy-TS wants to merge 1 commit into
Open
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8
traci.trafficlights.getNextSwitch()andgetPhaseDuration()both resolve throughgetUniversal(), which looks up a type-reader function for each variable ID inRETURN_VALUE_FUNC.trafficlights.TL_NEXT_SWITCHandTL_PHASE_DURATIONare double-typed per the SUMO TraCI wire protocol, but were mapped toreadInt, corrupting the returned values (as reported in #8).This changes only those two map entries from
readInttoreadDouble.TL_CURRENT_PHASE(a genuine integer) and the othertrafficlightsgetters are untouched.Credit to @bjyurkovich for the original diagnosis and workaround in #8, and to @tonmoy-TS for confirming it and identifying that
getPhaseDurationhas the same issue. This PR fixes the root cause (the type mapping) instead of adding a duplicate wrapper function.