Skip to content

Feat: Add PCD to MGRS conversion service (/convert_mgrs) - #24

Open
sanchithb wants to merge 1 commit into
JokerJohn:mainfrom
sanchithb:main
Open

Feat: Add PCD to MGRS conversion service (/convert_mgrs)#24
sanchithb wants to merge 1 commit into
JokerJohn:mainfrom
sanchithb:main

Conversation

@sanchithb

Copy link
Copy Markdown

Overview This PR introduces a new ROS service to convert the final generated Point Cloud Data (PCD) map from local UTM coordinates to the Military Grid Reference System (MGRS).

Key Changes

  • New ROS Service (/convert_mgrs): Added a service in MSMapping that triggers the conversion of final_map_lidar.pcd and outputs the result as final_map_lidar_mgrs.pcd.

  • Coordinate Conversion Module: Introduced utm_to_mgrs_converter.cpp/h to handle robust transformations using GeographicLib.

  • Accurate Altitude Adjustments: Integrated GeographicLib::Geoid (egm2008-1) to convert heights from ellipsoid to orthometric during the transformation process.

  • Point-by-Point Processing: The converter reads the input PCD file, translates local UTM points to global UTM (using map origin offsets), calculates latitude/longitude, and converts them down to high-precision MGRS coordinates.

Credits: https://github.com/leo-drive/pc_utm_to_mgrs_converter

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c770ea09ad

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

gnss_stat_utm.y = point.y + map_origin_northing;
gnss_stat_utm.z = point.z + map_origin_height;
gnss_stat_utm.coordinate_system = CoordinateSystem::UTM;
gnss_stat_utm.zone = 35;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Make the UTM zone configurable

When the map origin is in any UTM zone other than 35, the service reverses the configured easting/northing through zone 35 and then emits an MGRS code for the wrong part of the world, so the converted map is geographically displaced. Since common/Northing and common/Easting are configurable but the zone/hemisphere are not, load these with the origin parameters or derive them from a lat/lon origin instead of hard-coding this value.

Useful? React with 👍 / 👎.

Comment on lines +1159 to +1160
std::string input_pcd = saveDirectory + sequence + "/final_map_lidar.pcd";
std::string output_pcd = saveDirectory + sequence + "/final_map_lidar_mgrs.pcd";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the separator in the saved-map path

When save_directory is configured without a trailing slash, including the LoadRosParams default, DataSaver normalizes the base path before writing final_map_lidar.pcd, but this service concatenates the raw saveDirectory and sequence. In that configuration /save_map writes under <base>/<sequence>/... while /convert_mgrs looks under <base><sequence>/..., so conversion fails even though the map was saved successfully.

Useful? React with 👍 / 👎.

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.

1 participant