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

[map_server in Noetic]Map_server could not open testmap.yaml error has occured!!

asked 2022-10-19 05:00:54 -0500

donguri gravatar image

updated 2023-06-18 10:06:24 -0500

lucasw gravatar image

I wrote my question because I have looked at past ROSAnswers and could not find a solution.

Also, 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 use map_server to create a global cost map and reflect it in Rviz.

And finally, we would like to have a real robot running within the global cost map we have created.

[I did]

I gitclone navigation from the following site to Ubuntu 20.04.

https://github.com/ros-planning/navigation

I am trying to get the "testmap.yaml" in "home/catkin_ws/src/navigation/map_server/test" to work.

So I ran the following code and got the following error.

$rosrun map_server map_server testmap.yaml
[ERROR] [1666166341.180193818]: Map_server could not open testmap.yaml.

I also thought maybe the address was not set up correctly so I ran the following code and got the following message.

$rosrun map_server test testmap.yaml
[rosrun] Couldn't find executable named test below /home/usr/catkin_ws/src/navigation/map_server
[rosrun] Found the following, but they're either not files,
[rosrun] or not executable:
[rosrun]   /home/usr/catkin_ws/src/navigation/map_server/test

The testmap.yaml is as follows. I have not changed anything since gitclone because I wanted to test run it.

image: testmap.png
resolution: 0.1
origin: [2.0, 3.0, 1.0]
negate: 0
occupied_thresh: 0.65
free_thresh: 0.196

I expect the following message to appear.

[INFO][3698178.3892394] Laoding map from image "testmap.png"
[INFO][3698178.3892498] Read a XXX X XXX map @ 0.050m/cell

Please let me know if you have any solutions to these problems. Also, what do I have to do for the message I expect to get?

Thank you.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2022-10-19 18:16:13 -0500

Mike Scheutzow gravatar image

updated 2022-10-19 18:20:10 -0500

  • your testmap.png file needs to be in the same directory as testmap.yaml
  • if you use rosrun as a beginner, your current directory in the Terminal should be where the testmap.yaml file is located. (Later on, you can put the map in a ros package, but that takes more work to set up.)
  • have you installed ros-noetic-map-server from apt? You should do so.
edit flag offensive delete link more

Comments

testmap.png and testmap.yaml are in the same directory.

I moved the current directory of the terminal to the location where the testmap.yaml file is located and ran rosrun again using all three methods, but the same error occurred.

$ cd catkin_ws/src/navigation/map_server/test/

Method 1.
$ rosrun map_server map_server testmap.yaml
[ERROR] [1666234839.837396681]: [registerPublisher] Failed to contact master at [localhost:11311].  Retrying...

Method 2.
$ rosrun map_server testmap.yaml
[rosrun] Couldn't find executable named testmap.yaml below /home/usr/catkin_ws/src/navigation/map_server
[rosrun] Found the following, but they're either not files,
[rosrun] or not executable:
[rosrun]   /home/usr/catkin_ws/src/navigation/map_server/test/testmap.yaml
donguri gravatar image donguri  ( 2022-10-19 22:28:42 -0500 )edit

I continue.

Method 3.
$ rosrun testmap.yaml
Usage: rosrun [--prefix cmd] [--debug] PACKAGE EXECUTABLE [ARGS]
  rosrun will locate PACKAGE and try to find
  an executable named EXECUTABLE in the PACKAGE tree.
  If it finds it, it will run it with ARGS.

When I run sudo apt-get ros-noetic-map-server I get the following error

E: 不正な操作(It means Illegal operation in Japanese.) ros-noetic-map-server
donguri gravatar image donguri  ( 2022-10-19 22:43:12 -0500 )edit

Sorry! I solved!!!

Thank you, Mike Scheutzow!!!!!!!!!!!

I forgot to activate roscore. I solved the problem by starting roscore, going to the location where the yaml file is located, and running rosrun map_server map_server testmap.yaml.

donguri gravatar image donguri  ( 2022-10-19 23:26:04 -0500 )edit

The correct command is:

sudo apt-get install ros-noetic-map-server
Mike Scheutzow gravatar image Mike Scheutzow  ( 2022-10-20 08:26:20 -0500 )edit

Thank you, Mike Scheutzow! I made a mistake. Thank you for correction.

donguri gravatar image donguri  ( 2022-10-21 04:56:39 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2022-10-19 05:00:54 -0500

Seen: 261 times

Last updated: Oct 19 '22