ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How can I transform the jpg/bmp picture to a ROS .pgm map

asked 2021-03-20 04:05:06 -0600

alex_zt gravatar image

updated 2021-03-20 08:59:12 -0600

gvdhoorn gravatar image

I have a map of school's square generated by a GPS measuring instrument. The size of the square is 71.27m * 59.98m actually and is 71.27mm * 59.98mm in the CAD diagram.

And now I want to use this map as the navigation map based on ROS. The resolution unit of pgm map in ROS is usually 0.05m/pixel. However, the resolution of the .jpg picture is 144dpi*144dpi.

How can I transform the jpg/bmp picture to a ROS .pgm map? I know this transformation must properly be scaled so that one pixel in my map matches the resolution setting in AMCL. I have tried to make the change by Photoshop but failed.

So can you tell me the details about the change?

image description image description

Thank you.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-03-21 01:52:36 -0600

miura gravatar image

I will present an idea assuming that the package you are using is "map_server".

The image format is not pgm, and the resolution is different, both of which I think can be solved by setting the yaml file.

image : Path to the image file containing the occupancy data; can be absolute, or relative to the location of the YAML file

resolution : Resolution of the map, meters / pixel

Example

image: xxx.jpg
resolution: 0.00001763888 # 0.024m/inch / 144dpi
origin: [0.0, 0.0, 0.0].
occupied_thresh: 0.65
free_thresh: 0.196
negate: 0
edit flag offensive delete link more

Comments

Thank you for presenting the idea. i have try this.

But map_server tell the wrong.

Have you try this method before?

alex_zt gravatar image alex_zt  ( 2021-03-28 21:58:06 -0600 )edit

@alex_zt I've done "image: xxx.png" before, and I've changed the resolution, though not as small as 0.00001763888. If you have a problem that has never been posted on ROS ANSWERS, why don't you create a question? Depending on the nature of the problem, we may be able to help.

miura gravatar image miura  ( 2021-03-29 07:04:07 -0600 )edit
1

Ok, sir. Thank you. I will create this question

alex_zt gravatar image alex_zt  ( 2021-03-29 21:20:20 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2021-03-20 03:58:57 -0600

Seen: 712 times

Last updated: Mar 21 '21