Skip to content

Use to_quat in lanelet2_global_planner to convert heading to quaternion representation

Description

This MR closes #755 (closed). This changes the quaternion calculation to in the Lanelet2GlobalPlannerNode::current_pose_cb to use the new to_quat method in the motion_common library rather than the current more computationally expensive calculation process. This should also fix the issue that was reported in #755 (closed) regarding incorrect quaternion calculations.

Notes for reviewer

To test this:

  1. Run the tests to make sure that no tests fail due to the changes
  2. Launch the AVP demo using the following instructions: https://autowarefoundation.gitlab.io/autoware.auto/AutowareAuto/avpdemo.html

It is a little hard to tell the different just from reviewing the demo so I have inserted what I believe to be the defining difference between the thye two implementations:

[lanelet2_global_planner_node_exe-14] [ERROR] [1614320126.688395031] [planning.lanelet2_global_planner_node]: new method
[lanelet2_global_planner_node_exe-14] [ERROR] [1614320126.688454812] [planning.lanelet2_global_planner_node]: x:0 y:0 z:0.993107 w:-0.11721
[lanelet2_global_planner_node_exe-14] [ERROR] [1614320126.688475193] [planning.lanelet2_global_planner_node]: old method
[lanelet2_global_planner_node_exe-14] [ERROR] [1614320126.688486651] [planning.lanelet2_global_planner_node]: x:0 y:0 z:-0.993107 w:0.11721

The above debugoutput shows the new method (this MR) vs. the existing method. There is a clear difference in the signs of the z and w components of the quaternion.

Additionally, I noticed that in the original method for to_quat the decltype casts were swapped. While this doesn't have any effect on the outcome I made a fix to mitigate any confusion.

Pre-review checklist for the author before submitting for review

Every developer is encouraged to be familiar with our contributor guidelines.

  1. MR title and description help a friendly human understand the problem solved
  2. Sensible notes for the reviewer added to the section above to facilitate review
  3. MR fits the criteria of a "small change" listed below
  4. "WIP" or "Draft" removed from the MR title
  5. MR has a link to the original issue in the description, if it exists
  6. If the source branch is on a fork, MR is configured to allow commits from developers with access to push to the target branch
  7. Target branch set correctly. Default: master
  8. MR assigned to a capable reviewer. Default: @JWhitleyWork
What is meant by a "small change"?

This is a template with a trimmed-down checklist for small MRs. Use it when no new functions, classes or other things that require testing have been added.

Examples are changes to documentation only, a fix for an off-by-one error, improving the CI, or changing log messages to be more informative. When in doubt, use the regular template.

Checklist for the reviewer

Only the reviewer is allowed to make changes in this section!

Mark all the items that are done, and cross out items not applicable to this MR.

  1. Basic checks
    1. The MR title describes what is being done on the ticket
    2. The MR does not require additional tests or documentation to be written
    3. The first commit has a proper commit message to be used as a basis for the squashed commit created at the very end
  2. Code correctness
    1. The problem/feature is solved (reproducibly)
    2. The solution is performant enough for the use case in mind
    3. Any disabled lints inside the code or at the package level are justified
  3. Open work
    1. Any added source-code comment about future work refers to a follow-up GitLab issue explicitly; e.g., // TODO #551 refactor code below

If the MR provides an improvement, don't hesitate to add a 👍 emoji for a neat line of code or a "Thanks for implementing this" comment. This will reward the MR author and prevent the review from being only about what still needs to be improved.

Post-review checklist for the author

After receiving approval:

  1. All checkboxes in the MR checklist are checked or crossed out. Syntax example: 1. [ ] ~~this item crossed out~~
  2. Assign MR to maintainer with sufficient rights to merge. Default: @JWhitleyWork
Edited by Joshua Whitley

Merge request reports