Skip to content
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

feat(geography_utils): add projection in geography_utils #4833

Merged

Conversation

kminoda
Copy link
Contributor

@kminoda kminoda commented Aug 31, 2023

Description

Main idea: Unify latlon <-> xy conversion in the whole system using lanelet2 projector

  • geography_utils: added a general project_forward/reverse function based on lanelet2 projector
  • gnss_poser: remove convert.hpp and use project_forward instead
  • default_ad_api: use project_reverse instead

Related links

None

Tests performed

  • confirmed that all the test passes in geography_utils
  • using the logging_simulator, I confirmed that
    • localization works the same as before
    • the output of gnss_poser is the same as before
    • the output of default_ad_api ( /api/vehicle/kinematics ) is the same as before
    • (please be aware that the original altitude of sample-map-rosbag is wrong, as it is not either WGS84 nor EGM)

Notes for reviewers

None

Interface changes

None

Effects on system behavior

None

Pre-review checklist for the PR author

The PR author must check the checkboxes below when creating the PR.

In-review checklist for the PR reviewers

The PR reviewers must check the checkboxes below before approval.

  • The PR follows the pull request guidelines.
  • The PR has been properly tested.
  • The PR has been reviewed by the code owners.

Post-review checklist for the PR author

The PR author must check the checkboxes below before merging.

  • There are no open discussions or they are tracked via tickets.
  • The PR is ready for merge.

After all checkboxes are checked, anyone who has write access can merge the PR.

Summary by CodeRabbit

  • New Feature: Added functionality for coordinate projection between geographic and local Cartesian coordinates using the Lanelet2 projector. This allows for unified conversion throughout the system.
  • New Feature: Introduced a new header file projection.hpp in the geography_utils module, defining functions for coordinate projection.
  • New Feature: Added unit tests for the geography_utils module to verify the correctness of coordinate conversion.
  • Bug Fix: Removed unnecessary #include statements and dependencies in various files.
  • Refactor: Replaced the convert function in the GNSSPoser class with a call to geography_utils::project_forward for latitude/longitude to Cartesian coordinate conversion.
  • Chore: Updated the package manifest file to include new dependencies (geographic_msgs and geometry_msgs).

kminoda and others added 25 commits August 18, 2023 16:29
Signed-off-by: kminoda <[email protected]>
Signed-off-by: kminoda <[email protected]>
Signed-off-by: kminoda <[email protected]>
Signed-off-by: kminoda <[email protected]>
Signed-off-by: kminoda <[email protected]>
Signed-off-by: kminoda <[email protected]>
Signed-off-by: kminoda <[email protected]>
Signed-off-by: kminoda <[email protected]>
Signed-off-by: kminoda <[email protected]>
Signed-off-by: kminoda <[email protected]>
Signed-off-by: kminoda <[email protected]>
@github-actions github-actions bot added type:documentation Creating or refining documentation. (auto-assigned) component:sensing Data acquisition from sensors, drivers, preprocessing. (auto-assigned) component:system System design and integration. (auto-assigned) component:common Common packages from the autoware-common repository. (auto-assigned) labels Aug 31, 2023
@kminoda kminoda changed the title feat: use lanelet2_projector feat(geography_utils): add projection in geography_utils Aug 31, 2023
@kminoda kminoda marked this pull request as ready for review September 4, 2023 06:24
Copy link
Contributor

@isamu-takagi isamu-takagi left a comment

Choose a reason for hiding this comment

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

LGTM (default_ad_api)

@github-actions
Copy link

github-actions bot commented Sep 4, 2023

Image description CodeRabbit

Walkthrough

The changes include the addition of a new file for projection functions in the geography_utils library, the introduction of a new header file defining conversion functions between geographic and local coordinates, the addition of dependencies in the package manifest file, updates to test cases and unit tests, and modifications to the gnss_poser module to use the geography_utils functions for coordinate conversion.

Changes

File Summary
common/geography_utils/CMakeLists.txt Adds a new file projection.cpp to the geography_utils library.
common/geography_utils/include/geography_utils/height.hpp Removes unnecessary #include statements.
common/geography_utils/include/geography_utils/projection.hpp Introduces a new header file defining conversion functions between geographic and local coordinates.
common/geography_utils/package.xml Adds two dependencies (geographic_msgs and geometry_msgs) in the package manifest file.
common/geography_utils/src/projection.cpp Adds functions for projecting geographic coordinates to local coordinates and vice versa.
common/geography_utils/test/test_geography_utils.cpp Modifies test cases and initializes Google Test in the main function.
common/geography_utils/test/test_height.cpp Updates test case names.
common/geography_utils/test/test_projection.cpp Adds unit tests for the geography_utils module.
sensing/gnss_poser/CMakeLists.txt Removes the convert.hpp header file from the gnss_poser module.
sensing/gnss_poser/include/gnss_poser/convert.hpp Removes the gnss_poser/convert.hpp file containing coordinate conversion functions.
sensing/gnss_poser/include/gnss_poser/gnss_poser_core.hpp Removes unnecessary #include statements and functions from the GNSSPoser class.
sensing/gnss_poser/src/gnss_poser_core.cpp Replaces the convert function with a call to geography_utils::project_forward for coordinate conversion.

🐇📜 "In the land of code, changes abound,
Geography and coordinates, newly found.
Dependencies added, tests now run,
Conversion functions, old ones undone.
The rabbit hops, reviewing with glee,
Ensuring the code is as it should be."


Uplevel your code reviews with CodeRabbit Pro

CodeRabbit Pro

If you like this project, please support us by purchasing the Pro version. The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, CodeRabbit Pro is free for open source projects.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Image description CodeRabbit

Commits Files that changed from the base of the PR and between 9ac0ea4 and 2097712 commits.
Files selected (15)
  • common/geography_utils/CMakeLists.txt (1)
  • common/geography_utils/include/geography_utils/height.hpp (1)
  • common/geography_utils/include/geography_utils/projection.hpp (1)
  • common/geography_utils/package.xml (1)
  • common/geography_utils/src/projection.cpp (1)
  • common/geography_utils/test/test_geography_utils.cpp (2)
  • common/geography_utils/test/test_height.cpp (6)
  • common/geography_utils/test/test_projection.cpp (1)
  • sensing/gnss_poser/CMakeLists.txt (1)
  • sensing/gnss_poser/include/gnss_poser/convert.hpp (1)
  • sensing/gnss_poser/include/gnss_poser/gnss_poser_core.hpp (2)
  • sensing/gnss_poser/src/gnss_poser_core.cpp (3)
  • system/default_ad_api/package.xml (1)
  • system/default_ad_api/src/vehicle.cpp (3)
  • system/default_ad_api/src/vehicle.hpp (3)
Files skipped from review due to trivial changes (6)
  • common/geography_utils/include/geography_utils/height.hpp
  • common/geography_utils/test/test_height.cpp
  • common/geography_utils/test/test_projection.cpp
  • system/default_ad_api/package.xml
  • system/default_ad_api/src/vehicle.hpp
  • sensing/gnss_poser/include/gnss_poser/convert.hpp (diff too large)
Review comments generated (14)
  • Review: 10
  • LGTM: 4

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

gps_point.altitude = nav_sat_fix_msg_ptr->altitude;
geometry_msgs::msg::Point position = geography_utils::project_forward(gps_point, projector_info_);
position.z = geography_utils::convert_height(
gps_point.altitude, gps_point.latitude, gps_point.longitude, MapProjectorInfo::Message::WGS84,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
gps_point.altitude, gps_point.latitude, gps_point.longitude, MapProjectorInfo::Message::WGS84,
position.z, gps_point.latitude, gps_point.longitude, MapProjectorInfo::Message::WGS84,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you, fixed in 34273a8

Signed-off-by: kminoda <[email protected]>
@kminoda kminoda enabled auto-merge (squash) September 4, 2023 09:41
@kminoda kminoda merged commit d339c09 into autowarefoundation:main Sep 4, 2023
20 of 24 checks passed
@kminoda kminoda deleted the feat/gnss_poser/use_lanelet2_projector branch September 26, 2023 01:36
@kminoda kminoda restored the feat/gnss_poser/use_lanelet2_projector branch September 26, 2023 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:common Common packages from the autoware-common repository. (auto-assigned) component:sensing Data acquisition from sensors, drivers, preprocessing. (auto-assigned) component:system System design and integration. (auto-assigned) tag:run-build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants