-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
more map shifting fixes #791
Conversation
…t-map option to scenario build.
map_offset = self._scenario.road_network.net_offset | ||
assert len(map_offset) == 2 | ||
front_bumper_pos[0] += map_offset[0] | ||
front_bumper_pos[1] += map_offset[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To confirm, the reason why these are no longer needs is because when building the scenario, it is already using the shifted map thus traffic vehicle coordinates are shifted when built? Please correct me if otherwise.
This part is also somewhat needed when running third-party simulators that add traffic directly to sumo right? if so, it is possible to have a configurable option in sumo_traffic_simulation to control shift coordinates or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, actually the reason is that, as of PR #727 , Sumo is started with the shifted map (thanks to the update to the --net-file
parameter in _base_sumo_load_params()
in sumo_traffic_simulation.py
), so its coordinate system matches the coordinate system in use within Smarts. Vehicle locations coming from Sumo via Traci will be relative to the shifted/offset map already.
However, any third-party simulator that is adding vehicles to Sumo directly (outside of Smarts) may not know about the fact that the scenario map was shifted before Sumo was started. If they were to try to add vehicles to the map via Traci using the original coordinate system, things would seem off to them. So that's what necessitated adding the option to prevent map shifting entirely (i.e., not here, but where the scenario is built) in such situations.
Fixed bug where the positions of Sumo vehicles were incorrectly being shifted. After PR #727, they no longer needed to be shifted because the map being used by Sumo now matches the map in the
SumoRoadNetwork
object.However, this also exposes a potential problem for external / third-party simulators that might add vehicles directly to Sumo because they may not know about the map shifting and so still have their coordinate systems relative to the unshfited/offset map. So this PR also adds the
--allow-offset-map
option toscl scenario build
to support not auto-shifting maps. Now, maps are only potentially shifted when scenarios are built (as opposed to being auto-shifted wheneverSumoRoadNetwork
opens an offsetmap.net.xml
file), and this flag can override that at scenario build time if desired/required.Also, similar to PR #727, use the possibly-shifted road network map if one has been auto-generated for traffic generation.
Closes #790