ir-mcl icon indicating copy to clipboard operation
ir-mcl copied to clipboard

Trajectories shifted with respect to the map in visualization

Open mgiberna opened this issue 1 year ago • 1 comments

Hello, first of all thank you for your great work. I am trying to run a global localization experiment on a dataset of mine, and I followed your instructions (https://github.com/PRBonn/ir-mcl/blob/main/PREPARE_DATA.md and https://github.com/PRBonn/ir-mcl/blob/dev/tools/INSTRUCTIONS.md) in order to prepare the data as requested. Specifically, given a ROS bag, the groud truth trajectories and a map (.pgm), I converted the BAG in a .json file using your tool, I converted the map in .npy format using a simple script, and finally I obtained the remaining files (b2l.txt and lidar_info.json).

Once I tried running the global localization, I can see that the ground-truth trajectory and odometry poses are shifted with respect to the map on the visualization interface:

IRMCL_visualization

Actually, I believe that the map frame origin has been placed in its center, while the trajectories still keep their origins as set during the data recording. On the other side, everything is working correctly, being able to successfully localize the robot, i.e. following the ground-truth trajectory, as well as correctly compute the localization and heading errors. Therefore, I believe it is just a visualization problem, but I cannot figure out how to solve it.

So, is there a way to align the map with the trajectories' frames?

Thank you very much in advance.

mgiberna avatar Jan 31 '24 09:01 mgiberna

Hi, thanks for your question!

Regarding the map visualization, I use a very simple way to achieve it. I just extract each occupied point and shift it to a global coordinate according to the map's origin and the map's resolution (in my case is 0.05m). Then I plot these occupied points as scatter using matplotlib.

Your problem looks just like the visualized occupied points are not aligned to the global coordinate. Please check the visualization class at https://github.com/PRBonn/ir-mcl/blob/main/mcl/visualizer.py .

I hope it is useful to you!

KuangHaofei avatar Mar 01 '24 10:03 KuangHaofei