How to convert between world coordiantes and grid coordinates

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to convert between world coordiantes and grid coordinates

emontero
This post was updated on .
Hello.

I am mapping with RTAB-Map, I save the map in 2D with rosrun map_server map_saver -f my_map_1 map:=/rtabmap/proj_map.

After complete mapping, I perform localization rosrun realsense2_camera opensource_tracking_tk_localization.launch 

Now, I am implementing a path planning algorithm, and I need to get the robot location in (x, y) coordinates within the map. Also, where the origin of the map is into a grid of cells, and the actual width of the map created.

I want to know if I must subscribe to some topic and get the information I need for the path planning, in this case I am using the A* algorithm with inputs like start node and goal node.

This is the .yaml file and the poses.txt file that I have obtained.

Ubuntu 18.04
D435 Realsense camera





 
Reply | Threaded
Open this post in threaded view
|

Re: How to convert between world coordiantes and grid coordinates

matlabbe
Administrator
Hi,

you need the map, its parameters (resolution, origin) and the current position of the robot (through TF /map -> /base_link). With those info, you can know in which cell you are, and you can translate any cell position into a metric position. If you do grid-based A* planning, you don't need the pose-graph, unless I didn't understand exactly what is your planning approach.

See also http://wiki.ros.org/global_planner?distro=noetic

cheers,
Mathieu