Ask Your Question
1

Two machines one ROS master connection rejected

asked 2015-03-31 18:49:54 -0500

luketheduke gravatar image

updated 2015-04-01 10:32:32 -0500

Hi, I am trying to view Kinect data in RVIZ on a remote client in ROS. I have exported the ROS_MASTER_URI to set to the machine with the roscore running but it won't send back any data. Rviz gives this error:

[ WARN] [1427845377.406032758]: ROS_HOSTNAME / ROS_IP is set to only allow local connections, so a requested connection to 'lukas-Inspiron-N7010' is being rejected.

How can I fix this? Both machines are running Ubuntu 14.04 with Indigo. I followed this tutorial and I couldn't get them talking to each other although I can see the topics being published with rostopic echo. All help is appreciated. Thanks, luketheduke

edit retag flag offensive close merge delete

Comments

1

Have you set ROS_IP to the IP of the interface connected to the other computer?

BennyRe gravatar image BennyRe  ( 2015-04-01 00:51:45 -0500 )edit

So if bot is the computer I am running the roscore on, I should set the ROS_IP of the other computer to that of bot?

luketheduke gravatar image luketheduke  ( 2015-04-01 07:09:05 -0500 )edit
1

No. Set it to the IP of your computer.

BennyRe gravatar image BennyRe  ( 2015-04-01 08:29:26 -0500 )edit

OK! That clarifies it. I'll try it soon here when I get a minute. Another quick question: do I have to set these every time I boot or are they saved? Thanks, luketheduke

luketheduke gravatar image luketheduke  ( 2015-04-01 10:32:09 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
3

answered 2015-04-02 01:58:41 -0500

BennyRe gravatar image

Set the environment variable ROS_IPon your machine to the IP of your computer. If you have more than one network interfaces take the interface that connects to the network of the robot.

If you want to set this variable persistently append the export statement to your .bashrc.

edit flag offensive delete link more

Comments

This doesn't work for me. I have a robot at 192.168.0.1 (with rosmaster running) and a laptop at 192.168.0.222. They can ping and communicate successfully

Robot has variables: ROS_IP=192.168.0.1 and ROS_MASTER_URI=http://192.168.0.1:11311 Laptop has variables: ROS_IP=192.168.0.222 and ROS_MASTER_URI=http://192.168.0.1:1311

But when launching rviz I also get [ WARN] [1573849670.099213432]: ROS_HOSTNAME / ROS_IP is set to only allow local connections, so a requested connection to '192.168.0.1' is being rejected.

jbb55 gravatar image jbb55  ( 2019-11-15 14:46:12 -0500 )edit
0

answered 2019-11-15 16:24:11 -0500

jbb55 gravatar image

What solved it for me:

On the laptop, ROS_HOSTNAME wasn't set (nothing in .bashrc). After launching rviz on the laptop, I looked at the environmental variables again, and saw that something had set ROS_HOSTNAME=localhost, which seems to have the effect of causing it to reject remote connections.

Solution: on the laptop, set ROS_HOSTNAME=$ROS_IP (I added this to .bachrc, after ROS_IP=<ip addr of laptop>). Then remote connections are accepted.

edit flag offensive delete link more

Comments

ROS_HOSTNAME should be a hostname, not an IP address (which ROS_IP is). Also, if both ROS_HOSTNAME and ROS_IP are set, ROS_HOSTNAME will take precedence. See the Environment Variables page on the wiki

jayess gravatar image jayess  ( 2019-11-16 12:14:48 -0500 )edit

@jayess can you clarify why launching rviz would result in the ROS_HOSTNAME variable getting set when it wasn't set before launching it?

In other words:

printenv | grep ROS # ROS_IP and ROS_MASTER_URI are set, ROS_HOSTNAME is not present
rviz # launches rviz
# control-C to stop rviz
printenv | grep ROS # now, ROS_HOSTNAME is set to localhost
jbb55 gravatar image jbb55  ( 2019-11-16 12:45:11 -0500 )edit

Not sure about rviz setting any environment variables. Perhaps you should create a question about that

jayess gravatar image jayess  ( 2019-11-16 15:11:18 -0500 )edit

Your Answer

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

Add Answer

Question Tools

2 followers

Stats

Asked: 2015-03-31 18:49:54 -0500

Seen: 1,853 times

Last updated: Nov 15 '19