Search code examples
opencvrosdijkstra

How to upload an image of a map on ROS using OpenCV?


I need to apply Dijkstra's algorithm using ROS and Opencv. I have been given a png file and I need to convert it into an occupancy grid.

Map

I've tried searching online but didn't find anything that fits my case.

(Also, if anyone knows any good beginner tutorials on ROS then I would be very grateful)


Solution

  • Since you have the pic file (usually in png format), you create the yaml file which may look like

    image: map.png
    resolution: 0.1
    origin: [0.0, 0.0, 0.0]
    occupied_thresh: 0.65
    free_thresh: 0.196
    negate: 0
    

    You can read the details here

    Then start roscore and try

    rosrun map_server map_server mymap.yaml
    

    Be careful with the paths (use the same folder for both)