0
$\begingroup$

Rosanswers logo

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 arguments is not supported anymore. Instead spawn a subshell and source a setup file manually."
  exit 1
fi

# ensure to not use different shell type which was set before
CATKIN_SHELL=sh

# source setup.sh from same directory as this file
_CATKIN_SETUP_DIR=$(cd "`dirname "$0"`" > /dev/null && pwd)
. "$_CATKIN_SETUP_DIR/setup.sh"
exec "$@"

and then launched the file. The error persists even then. Could someone point out what is missing/wrong here ?


Originally posted by tr on ROS Answers with karma: 1 on 2018-01-23

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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

Originally posted by tomcreutz with karma: 16 on 2018-05-25

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.