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

How to create waypoints for nav2 based on saved .pgm map?

asked 2022-03-13 06:52:43 -0500

sdudiak01 gravatar image

I need to create a set of waypoints for my robot to go through and perform a specific task. My plan was to manually map my environment, than save it using nav2_map_server, generate an array of waypoints based on .pgm file and pass them to NavigateThroughPoses action server. However waypoints based just on .pgm file just do not work for obvious reasons (differnt origins and scale). Does anyone here have any idea on how to transform those waypoints into my robot's frame of reference? I am using Ubuntu 20.4 and ROS2:Galactic

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-03-15 03:49:54 -0500

ljaniec gravatar image

Did you try (Python Simple Commander)[https://navigation.ros.org... and it's goThroughPoses() or followWaypoints()? It's nice and easy Python API to Nav2 stack, it seems suitable to your needs.

You can try to calculate your waypoints based on your init_pose (you should know real-world coordinates and coordinates on the PGM map), chosen points on the map (pixels (x,y)) and a resolution of your map (it's meter/pixel, defined in *.YAML) with correct set of translations.

There are some sources I have found, both ROS1 and ROS2, maybe they will help you:

edit flag offensive delete link more

Comments

1

Thanks! I totally forgot about the .yaml file generated alongside the picture. Based on this file it is possible to get real-world coordinates of selected waypoints

sdudiak01 gravatar image sdudiak01  ( 2022-03-15 04:12:12 -0500 )edit

If it was enough, please accept the answer so others could see it :)

ljaniec gravatar image ljaniec  ( 2022-03-15 04:26:18 -0500 )edit

Question Tools

Stats

Asked: 2022-03-13 06:52:43 -0500

Seen: 1,008 times

Last updated: Mar 15 '22