Setting map_server resolution correctly to syncronize stageros and Rviz maps
Our goal is to drive a nonholonomic robot around in a given map. We use the navigation_stage package in the navigation_tutorials stack.
Now follows a description what causes our problem: If the robot is moving a certain distance, its position is different in the Rviz-map and the map in stageros.
We guess it's the wrong set resolution parameter from the map_server inside our launch file which causes the problem:
<launch>
...
<!-- Run the map server (section inside the launch file) -->
<node name="map_server" pkg="map_server" type="map_server" args="$(find Navigo)/world/our_world.pgm 0.12"/>
...
</launch>
The definition of this resolution parameter is: Resolution of the map, meters/pixel
Therefore we measured the corridor width, which is 1.85m, and the same spot inside the given our_world.pgm file which has 36pixels.
This leads to a resolution of:
1.85m/36pixels = 0.0514
But if we set this value instead of the 0.12 in our launch file, our robot is much to large inside the Rviz map.
The question is how to find the correct value or if there is another way of "sycronizing" these map resolutions. Do we have to change some parameters inside the world file or the Rviz our_world.vcg file?
Here is our our_world.world file:
define block model
(
size [0.5 0.5 0.5]
gui_nose 0
)
define topurg ranger
(
sensor(
range [ 0.0 5.0 ]
fov 240
samples 666.7
)
# generic model properties
color "black"
size [ 0.05 0.05 0.07 ]
)
define erratic position
(
#size [0.415 0.392 0.25]
size [0.656 0.43 0.25]
origin [-0.05 0 0 0]
gui_nose 1
drive "car"
wheelbase 0.35
topurg(pose [ 0.2375 0.000 0 0.150 ])
)
define floorplan model
(
# sombre, sensible, artistic
color "gray30"
# most maps will need a bounding box
boundary 1
gui_nose 0
gui_grid 0
gui_outline 0
gripper_return 0
fiducial_return 0
laser_return 1
)
# set the resolution of the underlying raytrace model in meters
resolution 0.02
interval_sim 100 # simulation timestep in milliseconds
window
(
size [ 745.000 448.000 ]
#rotate [ 0.000 -1.560 ]
rotate [0.0 0.0]
#scale 28.806
scale 5.0
)
# load an environment bitmap
floorplan
(
name "our_world"
bitmap "our_world.pgm"
size [54.0 58.7 0.5]
pose [20 28 0 6]
)
# throw in a robot
erratic( pose [34.5 16 0 90.0] name "car" color "blue")
block( pose [ -33 37 0 180.000 ] color "red") # An obstacle for testing