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

Error: unable to communicate with master!

asked 2012-09-17 08:16:29 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Doing the tutorials everything was fine until half way tutorial 5: Understanding Nodes part 1.6. At the step of using this command: $ rosrun turtlesim turtlesim_node __name:=my_turtle The name wasn't changed to "my_turtle", but as insisted by the tutorial this could happen because something going on with the rosnetworksetup so I did the following:

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

Now it doesnt work at all anymore and it gives the error: unable to communicate with master! leave alone that I can change the name of turtlesim_node.

What can I do about it to fix this, or at least undo what I did?! And what exactly should I fill in for "localhost" and "http://localhost:11311" and where can I find these things?

Many thanks!

edit retag flag offensive close merge delete

Comments

Did you start a new roscore in the shell where you set the master to localhost?

jdlangs gravatar image jdlangs  ( 2012-09-17 10:40:21 -0600 )edit

what exactly do you mean with the shell? yess I tried the code roscore again after setting the master to localhost, but my question is very newbie: what should I fill in for "localhost" and "http://localhost:11311" literally, and where can i find this information

artifmed gravatar image artifmed  ( 2012-09-17 11:06:11 -0600 )edit
1

"localhost" is what should be there. Linux knows it means "this" computer. And a new shell is created every time a new terminal window is opened. You can set the environment variables at the end of the .bashrc file in your home folder, as prasanna said and they will be there for every new shell.

jdlangs gravatar image jdlangs  ( 2012-09-17 12:38:38 -0600 )edit

5 Answers

Sort by ยป oldest newest most voted
5

answered 2012-09-17 11:08:57 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Try setting the environmental variables in the main .bashrc file. (If you use the $ export command it will be modified only for that particular terminal tab and also you will have repeat each and every time). Enter

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

as last two lines in the .bashrc and do . .bashrc on a terminal. Then open a new terminal and run roscore on a terminal tab and rosrun turtlesim turtlesim_node __name:=my_turtle on another. Now it should definitely work. Hope this helps!

edit flag offensive delete link more
2

answered 2012-09-17 11:29:58 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Also take a look at this: http://www.ros.org/wiki/ROS/NetworkSetup

edit flag offensive delete link more
0

answered 2015-06-02 10:37:08 -0600

p_mukherjee gravatar image

to open .bashrc just type - gedit ~/.bashrc then add this line source ~/custom_bash/.bash_rosws

edit flag offensive delete link more
0

answered 2012-09-17 11:40:04 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

@prasanna, thanks but: which code brings me to the .bashrc file (literally) and I assume I should put the following code in literally: "export ROS_HOSTNAME=localhost export ROS_MASTER_URI=http://localhost:11311"

@hi michikarg, that link is where my troubles started! as described

edit flag offensive delete link more

Comments

2

gedit ~/.bashrc should take you to .bashrc file. After editing save and close. Open a shell(ctrl+t) and do ". ~/.bashrc". Open a new shell (ctrl+n) and run roscore followed by whatever on subsequent shells.

prasanna.kumar gravatar image prasanna.kumar  ( 2012-09-17 18:42:07 -0600 )edit

Thanks my connection/master works again. however the name of turtlesim is still not changed to my_turtle after doing $ rosrun turtlesim turtlesim_node __name:=my_turtle

artifmed gravatar image artifmed  ( 2012-09-17 20:31:02 -0600 )edit

the tutorial says this: Note: If you still see /turtlesim in the list, it might mean that you don't have $ROS_HOSTNAME environment variable defined as described in Network Setup - Single Machine Configuration. but that was what got me in that connection problem without solving the problem!

artifmed gravatar image artifmed  ( 2012-09-17 20:31:43 -0600 )edit

You are making mistakes somewhere. I tried now and it worked for me. Check if you are running everything on new shells after doing . ~/.bashrc.

prasanna.kumar gravatar image prasanna.kumar  ( 2012-09-18 02:30:27 -0600 )edit
0

answered 2015-06-02 09:09:42 -0600

madmarc gravatar image

Hi, What if the port 11311 isn't reachable from an external box ? :)

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-09-17 08:16:29 -0600

Seen: 52,846 times

Last updated: Jun 02 '15