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

communication using ROS failed

asked 2019-06-10 10:20:24 -0600

LeonSun gravatar image

updated 2019-06-10 21:20:42 -0600

jayess gravatar image

I try to set up a network between my PC and my Laptop.

PC ip:
Laptop ip:
PC hostname: Leon-PC
Latop hostname: Leon-Laptop

I have changed the /etc/hosts files in both computers to make sure the hostname of PC and Laptop can be recognized by the computers. And I can ping PC successfully on my Laptop and vise versa. Then I change the both files ~/.bashrc in two computers. In the PC, I set ROS_HOSTNAME=leon-PC and ROS_MASTER_URI=https://leon-PC:11311 In the Laptop, I set ROS_HOSTNAME=leon-PC and ROS_MASTER_URI=https://leon-PC:11311

The setting used to be working in a good condition and I can run roscore on PC when running other nodes in Laptop and the messages can be received by two computers. But days later, I turn on the same setting and someting strange happens, after running roscore and some nodes on PC, I can run rviz on my Laptop and sub to the rostopuc published by the PC, but when I run nodes in Laptop, it give out

unable to contact to my own server at [http://leon-PC:34099]

and the port 34099 changes every time I run the node, I dont konw where the bug is and whether the port matters for the rviz running successfully on my Laptop is contacting to [http:leon-PC:11311] which is exactly the string being set in the ~/.bashrc in both computers.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2019-06-10 12:36:30 -0600

jayess gravatar image

updated 2019-06-10 21:20:04 -0600

Unless you're using static IP addresses, it sounds like the leases on your IP addresses may have run out. Double check the IP addresses on both devices and confirm that they haven't changed. If they have changed, consider using static IP addresses instead of dynamically assigned ones.


Please note that being able to ping is necessary but not sufficient. Please see the network setup guide.

edit flag offensive delete link more


I am using static IP and as I said, I can ping PC through Laptop and vise versa.

LeonSun gravatar image LeonSun  ( 2019-06-10 19:57:20 -0600 )edit

answered 2019-06-10 21:58:50 -0600

updated 2019-06-10 21:59:06 -0600

ROS_HOSTNAME should be your local hostname, not the name of the master you're trying to connect to. In your example on the PC, you should set ROS_HOSTNAME=Leon-PC and on the laptop you should set ROS_HOSTNAME=Leon-Laptop.

edit flag offensive delete link more

Question Tools


Asked: 2019-06-10 10:20:24 -0600

Seen: 279 times

Last updated: Jun 10 '19