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

Running a launch file on remote node

asked 2017-02-21 08:04:06 -0500

Ethan gravatar image

Hello all,

I'm trying to use a Raspberry Pi 3 as a ROS node, publishing a topic containing a point-cloud, generated by an Orbbec Astra RGBD camera.

The Raspberry Pi 3 is running Ubuntu Mate Xenial, with ROS Kinetic installed, and Orbbec's ROS packages (ros_camera_astra and ros_camera_launch) cloned and built. I can happily use roslaunch astra_launch astra.launch to run up a local ROS master and node, publishing the point cloud (amongst other data).

The machine I want to use as a master is running Ubuntu Trusty, with ROS indigo installed. It also has Orbbec's ROS packages installed, and can successfully roslaunch astra_launch astra.launch. My goal is to run the Astra node on the Pi 3, and view the published data in Rviz on the master machine. This is the launch file I am attempting to use on the master machine:

<launch>
  <node name="rviz" pkg="rviz" type="rviz" />
  <group>
    <machine name="pi" address="pi.local" user="ethan" env-loader="/opt/ros/kinetic/env.sh" default="true" />
    <include file="$(find astra_launch)/launch/astra.launch" />
  </group>
</launch>

I can ping and passwordlessly ssh into pi.local from the master, so the networking seems happy. However, the output I get from attempting to launch the above launch file is:

... logging to /home/ethan/.ros/log/5ec6008c-f836-11e6-8d11-d0509948ac7c/roslaunch-ethan-desktop-15179.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://ethan-desktop:43663/
remote[pi.local-0] starting roslaunch
remote[pi.local-0]: creating ssh connection to pi.local:22, user[ethan]
launching remote roslaunch child with command: [env ROS_MASTER_URI=http://ethan-desktop:11311 /opt/ros/kinetic/env.sh roslaunch -c pi.local-0 -u http://ethan-desktop:43663/ --run_id 5ec6008c-f836-11e6-8d11-d0509948ac7c]
remote[pi.local-0]: ssh connection created

SUMMARY
========

PARAMETERS
 * /camera/camera_nodelet_manager/num_worker_threads: 4
 * /camera/depth_rectify_depth/interpolation: 0
 * /camera/depth_registered_rectify_depth/interpolation: 0
 * /camera/driver/auto_exposure: True
 * /camera/driver/auto_white_balance: True
 * /camera/driver/bootorder: 0
 * /camera/driver/color_depth_synchronization: False
 * /camera/driver/depth_camera_info_url: 
 * /camera/driver/depth_frame_id: camera_depth_opti...
 * /camera/driver/depth_registration: True
 * /camera/driver/device_id: #1
 * /camera/driver/devnums: 1
 * /camera/driver/rgb_camera_info_url: 
 * /camera/driver/rgb_frame_id: camera_rgb_optica...
 * /rosdistro: indigo
 * /rosversion: 1.11.20

MACHINES
 * pi

NODES
  /camera/
    camera_nodelet_manager (nodelet/nodelet)
    depth_metric (nodelet/nodelet)
    depth_metric_rect (nodelet/nodelet)
    depth_points (nodelet/nodelet)
    depth_rectify_depth (nodelet/nodelet)
    depth_registered_hw_metric_rect (nodelet/nodelet)
    depth_registered_metric (nodelet/nodelet)
    depth_registered_rectify_depth (nodelet/nodelet)
    driver (nodelet/nodelet)
    points_xyzrgb_hw_registered (nodelet/nodelet)
    rgb_rectify_color (nodelet/nodelet)
  /
    camera_base_link (tf/static_transform_publisher)
    camera_base_link1 (tf/static_transform_publisher)
    camera_base_link2 (tf/static_transform_publisher)
    camera_base_link3 (tf/static_transform_publisher)
    rviz (rviz/rviz)

auto-starting new master
process[master]: started with pid [15202]
ROS_MASTER_URI=http://ethan-desktop:11311

setting /run_id to 5ec6008c-f836-11e6-8d11-d0509948ac7c
process[rosout-1]: started with pid [15215]
started core service [/rosout]
process[rviz-2]: started with pid [15230]
error launching on [pi.local-0, uri http://pi:57893/]: Name or service not known
Launch of the following nodes most likely failed: nodelet/nodelet, nodelet/nodelet, nodelet/nodelet, nodelet/nodelet, nodelet/nodelet, nodelet/nodelet, nodelet/nodelet, nodelet/nodelet, nodelet/nodelet, nodelet/nodelet, nodelet/nodelet, tf/static_transform_publisher, tf/static_transform_publisher, tf/static_transform_publisher, tf/static_transform_publisher

Any suggestions? Possibly an ... (more)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
6

answered 2017-02-21 08:38:09 -0500

Ethan gravatar image

Ok, solved it.

So the env-loader="/opt/ros/kinetic/env.sh" in my launch file was telling the ROS to run the default ROS setup on the remote machine (pi). Two problems with this: firstly, my workspace (~/catkin_ws) was not in ROS_PACKAGE_PATH, and secondly, the remote was using the hostname pi, rather than pi.local, as our office DHCP/DNS server refers to the pi machine as. To solve these problems, I created the following at ~/catkin_ws/env.sh on the pi:

#!/bin/bash
source /opt/ros/kinetic/setup.bash
source /home/ethan/catkin_ws/devel/setup.bash
export ROS_HOSTNAME="pi.local"
exec "$@"

And modified the launch file on the master to read env-loader="/home/ethan/catkin_ws/env.sh"

So now, when pi is used as a remote, first the ROS installation and my workspace are added to the ROS_PACKAGE_PATH, then the ROS_HOSTNAME environment variable is manually set to pi.local.

Everything works now. Hopefully this will be of use to someone.

edit flag offensive delete link more

Comments

Thanks for reporting how you solved it.

A note: you only need to source the 'top-most' workspace, so in your case that would be $HOME/catkin_ws. Sourcing the Kinetic distribution setup.bash is not needed (provided that you had it sourced when you built your ws, but you probably had).

gvdhoorn gravatar image gvdhoorn  ( 2017-02-21 08:59:06 -0500 )edit

Thank you for reporting your solution! It's very helpful.

robotpan gravatar image robotpan  ( 2018-02-27 17:06:45 -0500 )edit

I have a similar setup and my master (my laptop) wont even find the launch file on the pi. It tries to find the launch file on my local workspace and fails. Is it necessary to have all the same packages as on pi on my local pc (master) as well?

jaiswalharsh gravatar image jaiswalharsh  ( 2020-07-30 05:52:49 -0500 )edit

Hi, when you say It tries to find the launch file on my local workspace and fails, what's telling you that?

Do you have the same launch file layout as above? i.e.:

<group>
  <machine name="pi" address="pi.local" user="ethan" env-loader="/opt/ros/kinetic/env.sh" default="true" />
  <include file="$(find astra_launch)/launch/astra.launch" />
</group>

Obviously replacing name, address, user, and the launch file with the one you want.

Ethan gravatar image Ethan  ( 2020-07-30 06:04:06 -0500 )edit

my master (my laptop) wont even find the launch file on the pi. It tries to find the launch file on my local workspace and fails. Is it necessary to have all the same packages as on pi on my local pc (master) as well?

From wiki/roslaunch/XML:

Substitution args are currently resolved on the local machine. In other words, environment variables and ROS package paths will be set to their values in your current environment, even for remotely launched processes.

gvdhoorn gravatar image gvdhoorn  ( 2020-07-30 07:27:54 -0500 )edit

See this answer for a workaround in the case where the package/node/launch file is ONLY available on remote

Rufus gravatar image Rufus  ( 2021-02-10 03:25:20 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2017-02-21 08:04:06 -0500

Seen: 5,074 times

Last updated: Feb 21 '17