# Map scaling between Stage and RViz

I'm trying to simulate a custom map in stage using RViz to send goals to the simulated robot. I recorded the map using a Turtlebot and the map scale is 0.05 according to the .yaml file. When I open RViz and take a look at the laser scan I see that the distance measured is scaled incorrectly as you can see in the screenshot.

I also set the map resolution to 0.05 in the stage world file:

define block model
(
size [0.5 0.5 0.5]
gui_nose 0
)

define topurg ranger
(
sensor(
range [ 0.0  30.0 ]
fov 270.25
samples 1081
)

# generic model properties
color "black"
size [ 0.05 0.05 0.1 ]
)

define erratic position
(
#size [0.415 0.392 0.25]
size [0.35 0.35 0.25]
origin [-0.05 0 0 0]
gui_nose 1
drive "diff"
topurg(pose [ 0.050 0.000 0 0.000 ])
)

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.05

interval_sim 100  # simulation timestep in milliseconds

window
(
size [ 745.000 448.000 ]

#rotate [ 0.000 0.0 ]
scale 10
)

floorplan
(
name "cave"
size [51.2 62.4 0.5]
pose [-25.7 31.2  0 00.000 ]
bitmap "bitmaps/dks4e.png"
)

# throw in a robot
erratic( pose [ -20.00000 13.8 0.000000 0 ] name "era" color "blue")


This is the .yaml file:

image: dks4e.png
resolution: 0.050000
origin: [-34.600000, -13.800000, 0.000000]
negate: 0
occupied_thresh: 0.65
free_thresh: 0.196


The resolution of dks4e.png file is 1024x1248 pixels. So which value do I need to edit to get the scaling between Stage and RViz right?

edit retag close merge delete

I don't really see anything wrong with this file you posted, the values of 51.2 and 62.4 look like they should work to me.

( 2015-01-07 16:10:33 -0500 )edit

Sort by » oldest newest most voted

I believe that the pose in .world file should be (-9.0, 17.4) = (-34.6+51.2/2, -13.8+62.4/2). How did you come to your numbers? Furthermore, do you have a black border around the image file? (otherwise stage trims part of the image). I recently ran into same problem, so I summarized all that I found about it in this post

more