|
18 | 18 | #include "lanelet2_extension/utility/query.hpp"
|
19 | 19 | #include "lanelet2_extension/utility/utilities.hpp"
|
20 | 20 | #include "map_loader/lanelet2_map_loader_node.hpp"
|
| 21 | +#include "map_projection_loader/load_info_from_lanelet2_map.hpp" |
21 | 22 | #include "motion_utils/resample/resample.hpp"
|
22 | 23 | #include "motion_utils/trajectory/conversion.hpp"
|
23 | 24 | #include "obstacle_avoidance_planner/node.hpp"
|
|
28 | 29 | #include "tier4_autoware_utils/geometry/geometry.hpp"
|
29 | 30 | #include "tier4_autoware_utils/ros/parameter.hpp"
|
30 | 31 |
|
| 32 | +#include <geography_utils/lanelet2_projector.hpp> |
31 | 33 | #include <mission_planner/mission_planner_plugin.hpp>
|
32 | 34 | #include <pluginlib/class_loader.hpp>
|
33 | 35 | #include <tier4_autoware_utils/ros/marker_helper.hpp>
|
@@ -331,14 +333,17 @@ void StaticCenterlineOptimizerNode::load_map(const std::string & lanelet2_input_
|
331 | 333 | // load map by the map_loader package
|
332 | 334 | map_bin_ptr_ = [&]() -> HADMapBin::ConstSharedPtr {
|
333 | 335 | // load map
|
334 |
| - tier4_map_msgs::msg::MapProjectorInfo map_projector_info; |
335 |
| - map_projector_info.projector_type = tier4_map_msgs::msg::MapProjectorInfo::MGRS; |
| 336 | + const auto map_projector_info = load_info_from_lanelet2_map(lanelet2_input_file_path); |
336 | 337 | const auto map_ptr =
|
337 | 338 | Lanelet2MapLoaderNode::load_map(lanelet2_input_file_path, map_projector_info);
|
338 | 339 | if (!map_ptr) {
|
339 | 340 | return nullptr;
|
340 | 341 | }
|
341 | 342 |
|
| 343 | + // NOTE: generate map projector for lanelet::write(). |
| 344 | + // Without this, lat/lon of the generated LL2 map will be wrong. |
| 345 | + map_projector_ = geography_utils::get_lanelet2_projector(map_projector_info); |
| 346 | + |
342 | 347 | // NOTE: The original map is stored here since the various ids in the lanelet map will change
|
343 | 348 | // after lanelet::utils::overwriteLaneletCenterline, and saving map will fail.
|
344 | 349 | original_map_ptr_ =
|
@@ -750,7 +755,7 @@ void StaticCenterlineOptimizerNode::save_map(
|
750 | 755 | RCLCPP_INFO(get_logger(), "Updated centerline in map.");
|
751 | 756 |
|
752 | 757 | // save map with modified center line
|
753 |
| - lanelet::write(lanelet2_output_file_path, *original_map_ptr_); |
| 758 | + lanelet::write(lanelet2_output_file_path, *original_map_ptr_, *map_projector_); |
754 | 759 | RCLCPP_INFO(get_logger(), "Saved map.");
|
755 | 760 | }
|
756 | 761 | } // namespace static_centerline_optimizer
|
0 commit comments