ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Inverted Initial Localization in Nav2 for Ackermann Vehicle - Front and Rear Ends Misaligned in RViz

asked 2023-05-23 15:15:39 -0500

Vini71 gravatar image

While implementing SLAM with Nav2 on my Ackermann-style truck robot, I've run into an issue where the initial localization starts with my vehicle facing in the opposite direction (x orientation reversed). Specifically, the truck's front bumper and rear end are inverted in the RViz visualization, leading to mislocalization when the vehicle starts moving.

This issue is demonstrated in this video: lnverted Localization Rviz, I highlight the misalignment by adding an obstacle in Gazebo. The obstacle in front of the truck incorrectly appears at the rear end in RViz due to this localization error.

I am unsure how to address this problem. Could the solution involve inverting a specific TF in the Xacro file related to the IMU origin, or should I consider another possible solution?

Any assistance in resolving this inverted localization issue would be greatly appreciated.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2023-05-23 18:22:58 -0500

updated 2023-05-23 18:23:30 -0500

It could be caused by your TF tree being wrong (if for some reason your URDF and the SDF don't align) but I'm thinking the more likely case if you use the standard URDF/SDF setups is that your footprint is actually what's wrong. The origin of the points that you use to define your footprint should be the base_link. For mobile robots, that's typically the center of rotation or for ackermann vehicles its the center of the rear axle (typically). For articulated trucks, you'd have to check the convention, but I imagine its the same.

It might just be that your footprint itself visualized in rviz is incorrectly defined relative to a coordinate system causing it to appear offset.

edit flag offensive delete link more


Thank you once again for sharing your insightful observations, Steve! I plan to thoroughly review them in the coming week

Vini71 gravatar image Vini71  ( 2023-05-24 22:40:55 -0500 )edit

Steve, I fixed pose localization errors by aligning my robot's SDF with REP 103. However, the planner could only be triggered via the terminal, with planning and localization issues persisting.

Switching from binary to a source-based NAV2 setup for ros2 galactic, working over the tb3 example, replacing it by an Ackermann Model mini racecar video, localization and planning with rviz2 have finally worked.

However, I'm unsure how to handle scaling up to real truck dimensions and a higher lidar position. Could you guide me on which specific config files and parameters to adjust, related to lidar height, range, and field of view, to avoid "robot out of boundaries" and similar errors, since just oversizing the costmap is not enough to mitigate this error?

Vini71 gravatar image Vini71  ( 2023-06-25 19:51:35 -0500 )edit

Question Tools

1 follower


Asked: 2023-05-23 15:15:39 -0500

Seen: 64 times

Last updated: May 23