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

Messages not received on master when the talker runs from startup

asked 2018-07-03 03:39:31 -0600

rahul_b gravatar image

updated 2018-07-03 05:18:13 -0600

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:

Configuration on the machine which acts as master:

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-07-04 05:22:57 -0600

rahul_b gravatar image

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.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2018-07-03 03:39:31 -0600

Seen: 409 times

Last updated: Jul 04 '18