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

Need help publishing to ROS topics from a 2nd machine

asked 2017-07-09 21:31:41 -0600

Ryan_F gravatar image

updated 2017-07-10 13:45:14 -0600

I just added a 2nd machine to my ROS network and went through all of the appropriate tutorials on making sure the two could ping each other ( http://wiki.ros.org/ROS/NetworkSetup#... ). On my second machine i have exported the master URI and can echo ros topics running on the master just fine. When i try to publish onto a new topic from the second machine, the master can see the new topic exists, but if i try to echo it the master is unable to receive any information.

This forum seemed to address my exact problem, ( http://answers.ros.org/question/90536... ). They suggest adding the master computer to the etc/host file on the 2nd machine. My problem now is that i can't seem to properly edit the etc/host files! Can anyone provide a good tutorial on how to do this? I have tried several different ways and i'm sure i'm not doing it properly. <--edit 7/10/17: I'm led to believe this is not the real issue. See edit below

Thanks!

EDIT: Okay i have editing the /etc/host file and can now successfully ping the host machine from the 2nd machine via its alias. I can also export ROS_MASTER_URI=alias:11311 and can access the ROS network from the 2nd machine. Still have the same problem though: 2nd publishes to a new topic, master sees new topic, but when master echoes new topic nothing is received

edit retag flag offensive close merge delete

Comments

"My problem now is that i can't seem to properly edit the etc/host files!"

Can you elaborate? How are you trying to edit /etc/hosts? What happens?

Ed Venator gravatar image Ed Venator  ( 2017-07-09 23:19:44 -0600 )edit

I think i got it to work since i can now ping the master from the 2nd machine via its alias, and can also export ROS_MASTER_URI using the master alias. So editing the /etc/hosts file may not be my problem anymore. I will update my question to reflect this. Thanks

Ryan_F gravatar image Ryan_F  ( 2017-07-10 13:40:09 -0600 )edit

You need to edit the /etc/hosts file for both machines!

gstavrinos gravatar image gstavrinos  ( 2017-07-11 01:23:07 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2017-07-11 14:00:39 -0600

Ryan_F gravatar image

My problem turned out to be that i was exporting the wrong ROS_IP address on the 2nd machine.

After editing the /etc/hosts file on the 2nd machine to include the host machine, and exporting the ROS_MASTER_URI=http://hostalias:11311 (on the machine not running roscore) you need to export the proper ROS_IP's on BOTH machines so ROS knows where to listen. To do this:

  1. Identify the IP address of each machine
  2. export ROS_IP=ipaddress of each machine in any terminal you use to communicate with ROS. Make sure that you are exporting the IP address of the respective machine. My problem was that i was exporting the host computer's IP address in both machines!

After taking those steps you should be able to both publish, and subscribe to topics from a 2nd machine.

Hope that helps!

edit flag offensive delete link more
1

answered 2017-07-10 01:03:29 -0600

In order to be sure that your machines can communicate successfully, I would advice to also export the ROS_IP parameter in each machine's .bashrc.

Regarding your question on how to edit the /etc/hosts file, it is simple as just running: sudo nano /etc/hosts

edit flag offensive delete link more

Comments

I always export the proper IP in every terminal i open. I have also made sure i reset the DNS after and i still have the same issue. 2nd machine publishes to a new topic, master sees the new topic but when "echoed" nothing is received. 2nd machine can also ping master via its alias.

Ryan_F gravatar image Ryan_F  ( 2017-07-10 13:39:10 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-07-09 21:31:41 -0600

Seen: 1,371 times

Last updated: Jul 11 '17