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

running ros on multiple machines

asked 2018-01-23 00:41:12 -0500

tr gravatar image

updated 2018-01-23 00:48:17 -0500

I have a Desktop and Raspberry Pi 3 connected via LAN cable. Both have static ip addresses assigned to them and host names have been added too.

On Desktop:

user@desktop:$ cat /etc/hosts
127.0.0.1   localhost
127.0.1.1   desktop
192.168.100.1   raspberrypi

On the Raspberry Pi:

pi@pi-desktop:$ cat /etc/hosts
127.0.0.1    localhost
127.0.1.1    pi-desktop
192.168.100.2    rosmaster

PublicKey Authentication is setup and I can ssh from the Desktop into the Raspberry Pi and vice-versa. Next the following variables were set:

On Desktop:

user@desktop:$ export ROS_MASTER_URI=http://192.168.100.2:11311
user@desktop:$ export ROS_IP=192.168.100.2

On Raspberry Pi:

pi@pi-desktop:$ export ROS_MASTER_URI=http://192.168.100.2:11311
pi@pi-desktop:$ export ROS_IP=192.168.100.1

Then I launched a talker node on Raspberry Pi and a listener node on the Desktop. I was able to hear/subscribe to the topic published by talker node. So far so good. Next goal was to write a launch file to launch the talker node on Raspberry Pi. The launch file looks like below:

<launch>
  <machine name="pi" address="raspberrypi" env-loader="/opt/ros/kinetic/env.sh" user="pi"/>

  <node machine="pi" name="pi_talker" pkg="rospy_tutorials" type="talker.py" />

</launch>

On launching this file, I get the following error :

user@desktop:~/ros_ws/src$ roslaunch ssh.launch 
... logging to /home/user/.ros/log/7f2d7002-ff6b-11e7-8dde-74d435d12cf4/roslaunch-desktop-12695.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://192.168.100.2:34265/
remote[raspberrypi-0] starting roslaunch
remote[raspberrypi-0]: creating ssh connection to raspberrypi:22, user[pi]
/usr/lib/python2.7/dist-packages/Crypto/Cipher/blockalgo.py:141: FutureWarning: CTR mode needs counter parameter, not IV
  self._cipher = factory.new(key, *args, **kwargs)
launching remote roslaunch child with command: [env ROS_MASTER_URI=http://192.168.100.2:11311 /opt/ros/kinetic/env.sh roslaunch -c raspberrypi-0 -u http://192.168.100.2:34265/ --run_id 7f2d7002-ff6b-11e7-8dde-74d435d12cf4]
remote[raspberrypi-0]: ssh connection created

SUMMARY
========

PARAMETERS
 * /rosdistro: kinetic
 * /rosversion: 1.12.7

MACHINES
 * pi

NODES
  /
    pi_talker (rospy_tutorials/talker.py)

ROS_MASTER_URI=http://192.168.100.2:11311

core service [/rosout] found
error launching on [raspberrypi-0, uri http://pi-desktop:45385/]: Name or service not known
Launch of the following nodes most likely failed: rospy_tutorials/talker.py

I felt that this may be due to the reason that location of the catkin_workspace on Raspberry Pi is not supplied anywhere. The workspace is located on /user/pi/catkin_workspace on Raspberry Pi. I added the line

source /home/pi/catkin_ws/devel/setup.bash

to env.sh file on RPi (since path to this file is supplied in launch file). So now env.sh looks like:

#!/usr/bin/env sh
# generated from catkin/cmake/templates/env.sh.in
source /home/pi/catkin_ws/devel/setup.bash

if [ $# -eq 0 ] ; then
  /bin/echo "Usage: env.sh COMMANDS"
  /bin/echo "Calling env.sh without ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-05-25 06:04:57 -0500

I don't know if this is still up to date but i had a pretty similiar problem.

I didn't have any host-names in my host file but I added the host-name of the raspberry pi. The only difference was that i wrote the same host-name on my desktop as it is in the hosts file on the raspberry. So your hosts file on Desktop should look like this:

user@desktop:$ cat /etc/hosts
127.0.0.1   localhost
127.0.1.1   desktop
192.168.100.1   pi-desktop
edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2018-01-23 00:41:12 -0500

Seen: 1,129 times

Last updated: Jan 23 '18