# Map transformation from Pixel to world coordinates

Hey Guys,

I need some help with the following problem.I have a map of a room. In this map I draw circle for the starting position of the robot and save this as an additional svg file which I can parse for the starting Position of the robot. Then I transform the pixel coordinates to real world coordinates with help of yaml file of the map (resolution and origin parameters). The problem is the trasnformation is wrong the real world coordinates don´t match with pixel coordinates. I use this formula for the transformation: pose.x / resolution + CenterOfOrigin[pixels] = cell_x

Here are the parameters of the yaml-File:

resolution: 0.050000
origin: [-50.000000, -50.000000, 0.000000]
negate: 0
occupied_thresh: 0.65
free_thresh: 0.196


I got a map of the room this map is 1984x1984 Pixel. Therefore (cell_x-50/0.05)*0.05=pose_x. I used the formula and used these pixel-coordinates for reference:

x=988
y=985


So I got this real worlds coordinates:

x_real= -0.6
y_real= -0.75


The x-real coordinate seems to be fine in rviz I checked the position and it was at x_real=-0.55, but the y_real was wrong rviz showed me for this coordinate y_real=-0.05. But then I should have used another CenterOfOrigin for the y-coordinate. So maybe someone could tell me what I missed with the transformation ? I add the map as a file map_room

kind regards

Rex

edit retag close merge delete

pixel_x * res - origin_x = real_x