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 imagetlinder ( 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 imageSL 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 imageTung 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 imageTung 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 imageTung 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 imageTung Nguyen ( 2012-11-11 21:33:37 -0500 )edit

3 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
11

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

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

Seen: 46,287 times

Last updated: Nov 11 '12