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

[map_server in Noetic]I want to display images on rviz.

asked 2022-10-21 04:54:48 -0500

donguri gravatar image

updated 2023-06-18 10:27:23 -0500

lucasw gravatar image

I have recently started learning ROS and would appreciate any pointers as to what I may be doing wrong.

[I want to do]

I want to make the robot move autonomously by taking a map out of google map around the current location and treating it as a global costmap.

[I did]

I could create a global costmap with map_server and paste it on rviz. However, the global costmap I created is a black and white image file, and I feel it is very difficult to see.

So I would like to display the original color map on top of the black and white image that I made into a global costmap.

However, when I look up the image display in rviz, I can only find the realsense display method. How can I do just display the image on rviz?

Also, I am following these steps to output a global costmap on rviz. how do I put it together as a launch file?

terminal 1
$ roscore

terminal 2
$ cd catkin_ws/src/navigation/map_server/test/
$ rosrun map_server map_server testmap.yaml

terminal 3
$ rviz

I found this launch file in a question that another person was asking.

<launch>

  <arg name="map_file" default="$(find map_server)/testmap.yaml"/>

  <!-- Run the map server -->
  <node name="map_server" pkg="map_server" type="map_server" args="$(arg map_file)" />

</launch>

However, when I start it, I get the following Error.

[ERROR] [1666345202.480212495]: Map_server could not open /home/aaaa/catkin_ws/src/navigation/map_server/testmap.yaml.
[map_server-1] process has died [pid 5484, exit code 255, cmd /home/aaaa/catkin_ws/devel/lib/map_server/map_server /home/aaaa/catkin_ws/src/navigation/map_server/testmap.yaml __name:=map_server __log:=/home/aaaa/.ros/log/fad6ddc4-5123-11ed-a45d-d3b5005eb4d7/map_server-1.log].
log file: /home/aaaa/.ros/log/fad6ddc4-5123-11ed-a45d-d3b5005eb4d7/map_server-1*.log

Sorry for the two questions.

I have no idea what is causing this. I hope someone can tell me what is going on.

Thank you.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-10-21 06:27:53 -0500

Let me start with the launch file. Hopefully, you have saved your map inside the folder named "test" in the map_server package. Note that and change your launch file as follows.

`<launch>

<arg name="map_file" default="$(find map_server)/test/testmap.yaml"/>

<node name="map_server" pkg="map_server" type="map_server" args="$(arg map_file)"/>

</launch>`

Now to change the color of the map, add the map in rviz, select the topic as global costmap and change the color scheme

edit flag offensive delete link more

Comments

Thank you, SAYOOJ P RAVEENDRAN!

I can confirm that the launch file worked fine.

Now I would like to ask about adding color images.

My question was not explained well enough. Sorry about that.

What I want to do is.

  1. Obtain ColorMap.png from GoogleMap.
  2. From the ColorMap.png, get CostMap.png with buildings in black and others in white.
  3. Paste CostMap.png into rviz and make it global costmap.
  4. If CostMap.png is just pasted, it is difficult to see, so we want to be able to display the ColorMap from the top. (In ColorMap.png, white lines in the road are visible, but in CostMap.png, they are not. Because, if we want the robot to run on the white line, CostMap.png cannot distinguish where the white line is).

To do this, I would like to paste a CostMap.png on the rviz in addition to the global costmap.

donguri gravatar image donguri  ( 2022-10-21 20:27:34 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2022-10-21 04:54:48 -0500

Seen: 144 times

Last updated: Oct 21 '22