Robotics StackExchange | Archived questions

communication using ROS failed

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

PC ip:192.168.1.165
Laptop ip:192.168.1.118
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.

Asked by LeonSun on 2019-06-10 10:20:24 UTC

Comments

Answers

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.


Update:

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

Asked by jayess on 2019-06-10 12:36:30 UTC

Comments

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

Asked by LeonSun on 2019-06-10 19:57:20 UTC

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.

Asked by david.hodo on 2019-06-10 21:58:50 UTC

Comments