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

roslaunch on slave

asked 2015-08-25 17:12:08 -0500

rbaleksandar gravatar image

updated 2015-08-25 17:23:12 -0500

Hi!

I'm having difficulties running a node using roslaunch on a slave machine. I need it for the launch-prefix that allows me to run a node with superuser privileges (my node is written in C++ for doing that easier then with Python) in order to access a GPIO on my Rasperry Pi 2 using the wiringPi library. Here's the setups:

MASTER (Debian Jessie with Indigo):

Inside .bashrc:

export ROS_IP=192.168.1.101
export ROS_MASTER_URI=http://192.168.1.101:11311
source /opt/ros/indigo/setup.bash
source ~/catkin_ws/devel/setup.bash

SLAVE (Raspbian Wheezy with Indigo):

Inside .bashrc:

export ROS_IP=192.168.1.102
export ROS_MASTER_URI=http://192.168.1.101:11311
source /opt/ros/indigo/setup.bash
source ~/catkin_ws/devel/setup.bash

Using rosrun everything works fine. I tried launching a subscriber/publisher on my master and then started a publisher/subscriber on my slave. Roscore on the slave didn't start since the master's running roscore was detected (which is what is expected in this situation) and the node launched transmitting/receiving messages to/from the master.

roslaunch however doesn't understand what ROS_MASTER_URI is hence the need to use the <machine/> tag inside the launch file of my slave's node. Here is what I have (after multiple tries):

<launch>
<!--  <machine name="raspberry" address="localhost" env-loader="/opt/ros/indigo/env.sh"/> -->
  <machine name="raspberry" address="192.168.1.102" env-loader="/opt/ros/indigo/env.sh"/>

  <node machine="raspberry" pkg="blinky" name="blinky" type="blinky" launch-prefix="sudo"/>

</launch>

And of course it doesn't work...Here is the error:

... logging to /home/pi/.ros/log/a01e59f0-4b65-11e5-8f91-5442496dee48/roslaunch-raspberrypi-5408.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.1.102:33999/

SUMMARY

PARAMETERS * /rosdistro: indigo * /rosversion: 1.11.13

NODES / blinky (blinky/blinky)

ROS_MASTER_URI=http://192.168.1.101:11311

core service [/rosout] found process[blinky-1]: started with pid [5423] [FATAL] [1440540133.302859881]: ROS_MASTER_URI is not defined in the environment. Either type the following or (preferrably) add this to your ~/.bashrc file in order set up your local machine as a ROS master:

export ROS_MASTER_URI=http://localhost:11311

then, type 'roscore' in another shell to actually launch the master program. [blinky-1] process has died [pid 5423, exit code 139, cmd sudo /home/pi/catkin_ws/devel/lib/blinky/blinky __name:=blinky __log:=/home/pi/.ros/log/a01e59f0-4b65-11e5-8f91-5442496dee48/blinky-1.log]. log file: /home/pi/.ros/log/a01e59f0-4b65-11e5-8f91-5442496dee48/blinky-1*.log all processes on machine have died, roslaunch will exit shutting down processing monitor... ... shutting down processing monitor complete done

Setting up ROS_MASTER_URI to localhost will not allow me to run nodes in "slave mode" (that is - remote master's roscore will be worth jack squat on my RPi2). I'm missing something but what exactly I cannot tell. I checked and double checked the network setup article, the documentation on ROS_IP, ROS_MASTER_URI, roslaunch etc.

edit retag flag offensive close merge delete

Comments

Are you able to launch a node on master machine from a launch file? I am able to launch a node on the slave but not on the host, using ROS Indigo .

zweistein gravatar image zweistein  ( 2015-10-27 07:29:26 -0500 )edit

I have resolved my problem weeks ago. I found a neat way to surpass the superuser privilege restriction by tinkering with the wiringPi library, which is the much better solution. Thanks for posting an answer though. Will check it out whenever I get the time.

rbaleksandar gravatar image rbaleksandar  ( 2015-10-27 08:15:20 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-10-27 07:57:02 -0500

updated 2015-10-27 07:57:26 -0500

I'm working with a desktop (host machine) and a laptop (slave) both with Ubuntu 14.04 and ROS Indigo. I can launch a node on the slave from the host via a launch file.

On salve in /opt/ros/indigo/salve_env.sh:

export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:/home/user_salve/workspace/src
. /home/user_slave/workspace/devel/setup.sh
exec "$@"

in /home/user_slave/workspace/devel/setup.sh added at the end:

export ROS_MASTER_URI=http://host_IP:11311
export ROS_HOSTNAME=salve_IP

On host in /opt/ros/indigo/host_env.sh similarly load the setup from devel folder on host. (This might be wrong, details at the end of post). I added to the end of the file /home/user_host/workspace/devel/setup.sh:

export ROS_MASTER_URI=http://localhost:11311
export ROS_HOSTNAME=host_IP

Finally, I start a core on my host machine and launch this file:

<!-- mode:xml -->
<launch>
  <!-- This assumes roscore is running on this machine -->
  <env name="ROS_MASTER_URI" value="http://host_IP:11311"/>
  <machine name="desktop" address="host_IP" password="***" env-loader="/opt/ros/indigo/host_env.sh" default="true"/>
  <machine name="laptop" address="slave_IP" password="***" env-loader="/opt/ros/indigo/slave_env.sh"/>
 <!-- Web Camera controller node -->
 <node machine="laptop" pkg="uvc_camera" type="uvc_camera_node" name="uvc_camera" output="screen" respawn="true">
    <param name="width" type="int" value="1280" />
    <param name="height" type="int" value="720" />
    <param name="fps" type="int" value="15" />
    <param name="frame" type="string" value="wide_stereo" />
    <param name="auto_focus" type="bool" value="False" />
    <param name="focus_absolute" type="int" value="0" />  
    <param name="device" type="string" value="/dev/video1" />
    <param name="camera_info_url" type="string" value="file://$(find uvc_camera)/example.yaml" />
  </node>

 <!-- CAMERA NODES -->
 <node  machine="desktop"  pkg="viewpoint_estimation" type="viewpoint_estimation" name="viewpoint_estimation" output="screen" respawn="true">
    <param name=" calibration_file" type="string" value="$(find mobile_robot_system)/config/ost1280x720ML.txt" />
 </node> 
</launch>

The node on the salve starts and I can see the images from a web camera, but the node on the host doesn't start, and the error message is:

SUMMARY
========
PARAMETERS
 * /rosdistro: indigo
 * /rosversion: 1.11.13
 * /uvc_camera/auto_focus: False
 * /uvc_camera/camera_info_url: file:///home/elod...
 * /uvc_camera/device: /dev/video1
 * /uvc_camera/focus_absolute: 0
 * /uvc_camera/fps: 15
 * /uvc_camera/frame: wide_stereo
 * /uvc_camera/height: 720
 * /uvc_camera/width: 1280
 * /viewpoint_estimation/calibration_file: /home/elod/TE_wor...
MACHINES
 * desktop
 * laptop
NODES
  /
    uvc_camera (uvc_camera/uvc_camera_node)
    viewpoint_estimation (viewpoint_estimation/viewpoint_estimation)
ROS_MASTER_URI=http://localhost:11311
core service [/rosout] found
ERROR: cannot launch node of type [viewpoint_estimation/viewpoint_estimation]: can't locate node [viewpoint_estimation] in package [viewpoint_estimation]
[slave_IP-0]: launching nodes...
[slave_IP-0]: ROS_MASTER_URI=http://host_IP:11311
[slave_IP-0]: process[uvc_camera-1]: started with pid [8773]
[slave_IP-0]: ... done launching nodes

By hand I can run the node on host, but while I double tab for auto-fill the name of the pkg I get the following error:

 rosrun view[rospack] Warning: error while crawling /home/user_host: boost::filesystem::status: Permission denied: "/home/user_host/.gvfs"
point_estimation
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-08-25 17:12:08 -0500

Seen: 6,007 times

Last updated: Oct 27 '15