No go map server - FontysAtWork/ESA-PROJ GitHub Wiki
One requirement is that we can "tell" the robot what areas it cannot go into. These are called no-go zones. We want to continue using the current navigation stack, this means we want to use a costmap to mark the no-go zones. For more information about the costmap structure see the Costmaps page. In our case we would like the following structure:
We want to enter (draw) no-go zones from the GUI. These should then be dynamically added to the costmap of the robot. Because the GUI uses pixel coordinates it would be nice to create an interface which accepts "drawing" pixel based.
ROS offers three different types of costmap: static, obstacles and inflation. From these the static costmap is the most suitable because it accepts a map as its input source. We already know how to work with maps (both in the GUI and navigation stack) and a map is in essence (in c++) an array of pixels. This would give the following structure:
ROS however doesn't have a node with this implementation. For this reason we create our own node (nogo_zone_map_server). This node supports drawing lines and squares on a map. It then publishes the map at a preset interval.
~<name>/clear
(std_msgs/Empty)
Clear all pixels of the map (set their value to -1).
~<name>/drawline
(nogo_zone_map_server/Line)
Draw a line on the map.
~<name>/drawsquare
(nogo_zone_map_server/Square)
Draw as square on the map.
~<name>/map
(nav_msgs/OccupancyGrid)
The map containing the keep-out zones.
~map_width
(default: 1000)
Width of the map in pixels.
~map_height
(default: 1000)
Height of the map in pixels.
~map_resolution
(default: 0.01)
Resolution of the map in meters per pixel.
~publish_interval
(default: 1)
Publish interval of the map in seconds.
These messages have been moved into their own package named nogo-zone-map-server-msg. This is a package to provide these messages to all packages that need them.
x1
X coordinate of the first point on the map.
y1
Y coordinate of the first point on the map.
x2
X coordinate of the second point on the map.
y2
Y coordinate of the second point on the map.
gradient
Gradient of the line (-1: empty space, 0: passable map area, 100: obstacle)
x
X coordinate of the square top-left on the map.
y
Y coordinate of the square top-left on the map.
Width
Width of the square.
Height
Height of the square
gradient
Gradient of the square(-1: empty space, 0: passable map area, 100: obstacle)