How to get a collision-free path in a known map with move_base?
Hi everyone,
I would like to use the global planner only to compute a collision-free path from pose A to pose B for a rectangular robot from a .png map (To be precise, I mean a nav_msgs/Path Message). I ran a map server using:
rosrun map_server map_server map.yml
where map.yml
is:
image: 1st_Floor.png
resolution: 0.1
origin: [0.0, 0.0, 0.0]
occupied_thresh: 0.65
free_thresh: 0.196
negate: 0
I used the information on this page: http://wiki.ros.org/map_server. Now I would like map_server to publish on a global_costmap
, as shown there: http://wiki.ros.org/move_base, which in turn should publish on a global_planner
.
I don't really understand how to initialize costmap_2d
and global_planner
and what other things I should do.
Can anybody tell me what I am supposed to do? Basically, I would like to do something similar to what is shown on the global_planner documentation page.
[EDIT]
I tried David Lu's answer:
1st console:
roslauch my_planner.launch
2nd console:
rosrun map_server map_server map.yml
Finally, I get:
1st console:
...
[ INFO] [1532441256.591719189]: Using plugin "static_layer"
[ INFO] [1532441256.603717786]: Requesting the map...
[ INFO] [1532441410.809228149]: Resizing costmap to 942 X 850 at 0.100000 m/pix
[ INFO] [1532441410.908177209]: Received a 942 X 850 map at 0.100000 m/pix
2nd console:
[ INFO] [1532441410.480988502]: Loading map from image "./1st_Floor.png"
[ INFO] [1532441410.500530096]: Read a 942 X 850 map @ 0.100 m/cell
It seems OK but when I use rosservice call /gp/make_plan "..."
, I get the following error:
ERROR: transport error completing service call: unable to receive data from sender, check sender's logs for details
and in 1st console:
[gp-2] process has died [pid 14912, exit code -11, cmd /opt/ros/kinetic/lib/global_planner/planner __name:=gp __log:=/home/loic/.ros/log/5cecac24-8f4e-11e8-83cf-843a4b9cdf04/gp-2.log].
[EDIT 2]
I tried with a white map to be sure that the start and goal poses are on the map but that didn't work, so I think something is missing for the planner to work properly. Any idea?