0
$\begingroup$

Rosanswers logo

Hi, I have a detection node acting as a talker (det_talker.py) on one Ubuntu 16.04 machine and another node acting as a listener (det_listener.py). I intend to run the listener on master (an Ubuntu 14.04 machine) to receive the messages being sent from the talker. When I run the talker from a terminal followed by the listener on the master, I can see the messages being received on the master.

However, when I run the same talker node by putting the necessary commands for sourcing the setup.bash file as well as configuring the IP for the master in a bash script and run this script from startup (by adding the script in Startup Applications), I cannot see any messages on the master.

Configuration on the machine with the talker node:

  • ROS_MASTER_URI = http://ubuntu14_ip:11311
  • ROS_IP = ubuntu16_ip

Configuration on the machine which acts as master:

  • ROS_MASTER_URI = http://ubuntu14_ip:11311
  • ROS_IP = ubuntu14_ip

I have tried changing the ROS_IP on master to ubuntu16_ip but the result is still the same. The script I am using to run the detection node from system startup looks like follows:

#!/bin/bash
cd /home/rahul
export ROS_MASTER_URI = http://ubuntu14_ip:11311
source ./catkin_ws/devel/setup.bash
cd catkin_ws
rosrun detection_node det_talker.py

I have tried running this bash script from a terminal; it runs successfully and I can see the messages on master when I run the det_listener.py node. Only when I run it from startup, there are no messages (the node does run, however).

Furthermore, I can see on the master that the node is running because it shows the node when I run rosnode list and rostopic list commands. I should also mention that Ubuntu 16 has Kinetic and Ubuntu 14 is running an Indigo version of ROS. The reason why I think different versions should not pose a problem because I can indeed get the messages when executing the node from terminal.

My question is how do I get the messages to be received on the master by running the talker from startup. Thanks.

Edit: A cross-post on SO is here.


Originally posted by rahul_b on ROS Answers with karma: 16 on 2018-07-03

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I added the IP and name of the master (ubuntu14) in /etc/hosts file on the node machine (ubuntu16) and vice versa. When I restarted both machines and ran the node again from startup, I can receive the messages on the master.

A side note: If someone (like me) is trying to do a similar task with run multiple nodes, make sure to add the IPs and names of all the nodes in /etc/hosts of the master AND that all the nodes have distinct names since it is not possible for the master to resolve between nodes having same names.


Originally posted by rahul_b with karma: 16 on 2018-07-04

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.