16.9.0
Description
Abstract
This pull request adds support for the Transverse Mercator coordinate system in scenario_simulator_v2. The implementation introduces a configuration-based approach to select between MGRS and Transverse Mercator projectors while maintaining backward compatibility with existing maps.
Background
TIER IV has started using the Transverse Mercator coordinate system. Previously, scenario_simulator_v2 only supported MGRS (Military Grid Reference System) using lanelet::projection::MGRSProjector from autoware_lanelet2_extension. This limitation prevented the use of maps created with the Transverse Mercator projection system.
Details
Key Changes
-
Configuration-based Projector Selection: Implemented a
map_projector_info.yamlconfiguration file parser that allows selection between different coordinate systems based on theprojector_typefield. -
LaneletLoader Enhancement: Enhanced the
LaneletLoader::load()function insimulation/traffic_simulator/src/lanelet_wrapper/lanelet_loader.cppto:- Parse
map_projector_info.yamlconfiguration files - Support both "MGRS" and "TransverseMercator" projector types
- Implement
produceTransverseMercatorProjector()function to create TransverseMercatorProjector instances with proper origin and scale factor configuration - Maintain backward compatibility by defaulting to MGRS when no configuration file is present
- Parse
-
Dependency Addition: Added
yaml-cppdependency to bothCMakeLists.txtandpackage.xmlfor YAML configuration file parsing. -
Code Refactoring: Refactored
HdMapUtilsto use the newLaneletLoader::load()method instead of directly instantiating projectors. -
Tests chagnes:
LaneletLoader::load()throws exception if empty lanelet is provided. RefactoredHdMapUtils, which usesLaneletLoader::load(), caused the need to change the tests, which expect HdMapUtils to handle empty maps.
- Two tests that tested empty map interaction were removed
- The test was added to test whether the exception is correctly thrown when passing an empty map.
Configuration Format
The map_projector_info.yaml file should be located in the same directory as the map file and follow this format:
projector_type: "TransverseMercator" # or "MGRS"
vertical_datum: WGS84 # ignored by scenario_simulator_v2
map_origin:
latitude: 35.61836750154
longitude: 139.78066608243
scale_factor: 0.9996 # Optional, defaults to 0.9996Error Handling
- Throws
SIMULATION_ERRORfor unsupported projector types - Provides detailed error messages for missing mandatory configuration fields
- Handles YAML parsing errors
Backward Compatibility
- If no
map_projector_info.yamlfile exists, the system defaults to MGRS projector - Existing maps without configuration files continue to work without modification
References
Known Limitations
- Currently only supports MGRS and TransverseMercator projector types. Other projection systems will result in an exception.
- The
map_projector_info.yamlfile must be located in the same directory as the map file. - Scale factor for TransverseMercator defaults to 0.9996 if not specified in the configuration.