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

Failed to contact master at [localhost:11311]

asked 2012-11-10 08:47:15 -0500

Tung Nguyen gravatar image

updated 2014-01-28 17:14:13 -0500

ngrennan gravatar image

Hi everybody,

This is the first time i'm here, so if my question is too dumb to you, please forgive me. I'm on track "Understanding Nodes" in the beginner tutorials. After changing the name of the turtlesim node via:

$ rosrun turtlesim turtlesim_node __name:=my_turtle

I opened a new terminal and run:

rosnode list

and the results are:

/my_turtle
/turtlesim
/rosout

which is undesired, since the turtlesim node had been changed to my_turtle. The ROS folks knew about it and suggested us to update ROS_HOSTNAME and i did:

$ export ROS_HOSTNAME=localhost
$ export ROS_MASTER_URI=http://localhost:11311

Now not only the problem is still not solved, but another one also occurs. I can't even run the turtlesim node which is previously valid:

$ rosrun turtlesim turtlesim_node

Here is what's wrong:

[ERROR] [1352578402.235275857]: [registerPublisher] Failed to contact master at [localhost:11311].  Retrying...

It looks like the ROS_MASTER_URI has been updated unexpectedly! The main problem now is i don't know how to set it back to default.

Most of you have completed the tutorials and some of you must have stuck on this. So, please share with me how you tackle the problem! I really appreciate that.

edit retag flag offensive close merge delete

Comments

1

Hi, can you ping the localhost ? If not check your Hosts-file in /etc/hosts and may reconfigure it to default. Also it is not realy needed to make use of the ROS_HOSTNAME settings, so may do not use this command for the next time.

tlinder gravatar image tlinder  ( 2012-11-10 10:23:51 -0500 )edit

Also, where/how did you change the hostname and uri? If for some reason you have different settings in different terminals this would cause communication issues as well. To chech type echo $ROS_HOSTNAME and echo $ROS_MASTER_URI in all the terminals that you are using.

SL Remy gravatar image SL Remy  ( 2012-11-11 04:05:22 -0500 )edit

@trinighost: I changed it in the export double command above. Yes, now it returns localhost:11311 for the ROS_MASTER_URI query. Please, help me!

Tung Nguyen gravatar image Tung Nguyen  ( 2012-11-11 19:40:40 -0500 )edit

@tlinder: Yes, i still can ping the host. Yes, i will be careful next time. For this time, i tried to change the hostname to my System name, IP address but things still doesn't work!

Tung Nguyen gravatar image Tung Nguyen  ( 2012-11-11 20:32:00 -0500 )edit

@felix k: No, now it even doesn't make it to the master. ERROR: Unable to communicate with master! Nothing is running yet.

Tung Nguyen gravatar image Tung Nguyen  ( 2012-11-11 21:33:27 -0500 )edit

@michikarg: Yep, I check self-ping but i didn't work. So i try Name Resolution as suggested and changed the Hostname and associated Master URI to the System name and the IP address. But nothing seemed to be a good choice so far!

Tung Nguyen gravatar image Tung Nguyen  ( 2012-11-11 21:33:37 -0500 )edit

4 Answers

Sort by ยป oldest newest most voted
2

answered 2012-11-11 20:15:57 -0500

felix k gravatar image

Are you sure your /turtlesim node isn't still running? Check via rosnode cleanup or pgrep turtlesim_node.

And: you set ROS_MASTER_URI to localhost, and the turtlesim_node is trying to reach localhost. I don't see it having changed?

edit flag offensive delete link more
15

answered 2012-11-11 22:02:32 -0500

Tung Nguyen gravatar image

Oh, i see it now! My mistake. I closed the window containing the roscore command, so there's no master initialized at all. Hence the trouble.

Thank you all for tolerating my silliness!

edit flag offensive delete link more
2

answered 2012-11-11 20:38:04 -0500

michikarg gravatar image

Did you check all the steps at:

http://www.ros.org/wiki/ROS/NetworkSetup

Also i had some trouble with some entries in the /etc/hosts file since the entries there usually overwrite the information from the DNS/DHCP Server. If you have some entries there, you can make a backup of your /etc/hosts file and delete every entry except the following:

127.0.0.1   localhost

At least this was the cause for a similar problem in a network with non-static IP addresses....

edit flag offensive delete link more
0

answered 2022-02-14 12:47:08 -0500

I recently had this problem when trying MoveIt Setup Assistant

The error message was like yours:

Failed to contact master at [localhost:11311]. Retrying...

But when I went to another terminal and typed rostopic list, I was able to see the /rosout topic, so there was definitely a roscore running, which is expected, since I launched MoveIT using roslaunch (which automatically launches roscore):

roslaunch moveit_setup_assistant setup_assistant.launch --screen

So I remembered that I recently installed some MoveIt packages, but did not upgrade the whole system.

So I just upgraded, and after that, everything went fine with the MoveIt Setup Assistant:

sudo apt-get update && sudo apt-get upgrade

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2012-11-10 08:47:15 -0500

Seen: 100,167 times

Last updated: Feb 14 '22