Provides a map using sonars Mapping Driver plugin. More...

Provides a map using sonars Mapping Driver plugin.

This driver is a very simple start to have the robot mapping its own environment. It works with an occupancy grid map, using the player_map_data_t data type. this driver subscribes to odometry position2d and sonar device, every 100milliseconds puts an occupied line on the map, based on the endpoint of the sonar ray.

this plugin driver uses

Configuration requests
provides ["map:0"] requires ["position2d:0" "sonar:0"]
Configuration file options
  • width (integer) map width in pixels, defaults to 0 if not specified.
  • height (integer) map height in pixels, defaults to 0 if not specified.
  • startx (integer) initial global robot x position in pixels
  • starty (integer) initial global robot y position in pixels
  • scale (float) pixels/meter, the stage has a 16 meter map with a 0.028 scale, so 1 meter is (int) 1/0.028 = 36 pixels
  • sonartreshold (float) sonar data above the treshold is ignored. this is the most simple way to account for maximum range readings due to reflections. for a stage simulated pioneer robot the sonar range is 5 meters, so treshold should be less than 5. defaults to 1 if not specified.

The following configuration file illustrates the use of the driver in a stage simulated world (here map width height and resolution were taken from the world file for an easy comparison of the stage world with the map):

  name "stage"
  provides ["simulation:0" ]
  plugin "libstageplugin"

  # load the named file into the simulator
  worldfile ""	

# Create a Stage driver and attach position2d and laser interfaces 
# to the model "robot1"
  name "stage"
  provides ["position2d:0" "sonar:0" "laser:0"]
  model "robot1" 

  name "gridmap"
  provides ["map:0"]
  requires ["position2d:0" "sonar:0"]
  plugin ""
  width 809
  height 689
  startx 0
  starty 0
  scale 0.028
  treshold 4.5