0
$\begingroup$

Rosanswers logo

Hello,

I have two computers on a local network. First of them has Ubuntu 18.04 as OS, ROS Melodic installed and connected to the network with an Ethernet cable. The other one has Windows 10 as OS, ROS Noetic installed and connected to the same network with WIFI. I want to publish some message from the computer with Ubuntu into the other one with Windows 10 running a master with "roscore". To achieve this, i have changed ROS_MASTER_URI, ROS_IP and ROS_HOSTNAME to ones of the computer with Windows 10 from ".bashrc" using:

export ROS_HOSTNAME

export ROS_MASTER_URI

export ROS_IP

Then, i started my ros master in the computer with Windows 10 using the command "roscore" and then, in the terminal of PC with Ubuntu, i entered:

/usr/bin/python /home/theUser/catkin_ws/src/myProject/scripts/RosPublisher.py

to run my publisher code written in Python. Which will initialize my node with:

rospy.init_node("thePublisher", anonymous = True)

then, prepare and publish my message.

After, running my code i got the following error:

Unable to register with master node [http://computer:11311]: master may not be running yet. Will keep trying.

Then, when i want to check topics with "rostopic list" i see:

ERROR: Unable to communicate with master!

Can you help me with this issue please?

Thanks in advance.

P.S. For setting ROS_HOSTNAME, ROS_MASTER_URI and ROS_IP, i used simply "set ROS_HOSTNAME", "set ROS_MASTER_URI" and "set ROS_IP" in my cmd terminal (created by using steps specified there: link text)


Originally posted by mericgeren on ROS Answers with karma: 26 on 2023-05-25

Post score: 0


Original comments

Comment by chased11 on 2023-05-26:
Did you set ROS_IP to the IP of the system that terminal is in or the IP of machine running master? I’ve seen users set the ROS_IP the same for both machines, which is wrong.

Comment by mericgeren on 2023-05-27:
On both systems my ROS_HOSTNAME, ROS_MASTER_URI and ROS_IP is set to ones of the system running ROS master. Could you explain what do you mean when you say setting the same ROS_IP for both machines is wrong? Do you say i should set ROS_IP of each system to their own IP or you say i should set my ROS_IP of each system to IP of the other system?

Thanky for the support you have offered.

Comment by gvdhoorn on 2023-05-28:\

Do you say i should set ROS_IP of each system to their own IP

yes.

On both systems my ROS_HOSTNAME, [..] and ROS_IP [..]

there's no need to set both ROS_HOSTNAME and ROS_IP.

If you have working DNS, set ROS_HOSTNAME. If not, set ROS_IP.

ROS_HOSTNAME and ROS_IP tell your ROS nodes about the IP configuration of the PC you set them on, not of the master.

Only ROS_MASTER_URI should "point" to where roscore is running.

(think about it: why would there be three configuration variables all containing the exact same information?)

Comment by mericgeren on 2023-05-29:
Thank you gvdhoom and chased11 so much for your kind help.

After setting only ROS_IP and ROS_MASTER_URI for each device (ROS_IPs set to their own ips for each device and ROS_MASTER_URI is set to http://(ip address of master):11311 for each device) i am able to connect to ros master from the other computer and can subscribe to the topic from there.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Thank you gvdhoom and chased11 so much for your kind help.

After setting only ROS_IP and ROS_MASTER_URI for each device (ROS_IPs set to their own ips for each device and ROS_MASTER_URI is set to http://(ip address of master):11311 for each device) i am able to connect to ros master from the other computer and can subscribe to the topic from there.


Originally posted by mericgeren with karma: 26 on 2023-05-29

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.