ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org
Ask Your Question
0

roslaunch node on slave from master

asked 2022-07-06 07:35:22 -0500

dualsbiker gravatar image

Hey there, I'm using ROS Noetic on my Ubuntu 20 host pc and ROS Melodic on my raspberrypi slave machine. I try to start a node on slave via roslaunch running on master. Roscore is running on master. If I run roslaunch directly on the slave it, works fine. When I do roslaunch on master I get errors.

This is the launch file on master:

<launch>
    <machine name="raspberrypi" address="192.168.1.37" env-loader="/opt/ros/melodic/env.sh" user="pi" password="***"/>
    <node machine="raspberrypi" pkg="adc_mcc172" name="adc_mcc172" type="adc_mcc172_node.py"/>
</launch>

This is the launch file on slave:

<launch>
    <node pkg="adc_mcc172" type="adc_mcc172_node.py" name="adc_mcc172" output="screen" respawn="true" respawn_delay="30" >
    some params for device config
    </node>
</launch>

This is bashrc on master:

export ROS_MASTER_URI=http://192.168.1.99:11311
export ROS_IP=192.168.1.99

This is bashrc on slave:

export ROS_MASTER_URI=http://192.168.1.99:11311
export ROS_IP=192.168.1.37
export ROS_HOSTNAME=$ROS_IP

I hope that someone has THE idea for this problem. I have no more ideas.

Thanks a lot

Basti

# # #

I get the following output on master when I do roslaunch on master:

started roslaunch server http://192.168.1.99:41385/
remote[192.168.1.37-0] starting roslaunch
remote[192.168.1.37-0]: creating ssh connection to 192.168.1.37:22, user[pi]
launching remote roslaunch child with command: [env ROS_MASTER_URI=http://192.168.1.99:11311 
/opt/ros/melodic/env.sh roslaunch -c 192.168.1.37-0 -u http://192.168.1.99:41385/ --run_id 48a903fc-fc55-11ec-84a9-c517f1bf5fd1 --sigint-timeout 15.0 --sigterm-timeout 2.0]
remote[192.168.1.37-0]: ssh connection created

SUMMARY
========

PARAMETERS
* /rosdistro: noetic
* /rosversion: 1.15.14

MACHINES
* raspberrypi

NODES
/
adc_mcc172 (adc_mcc172/adc_mcc172_node.py)

ROS_MASTER_URI=http://192.168.1.99:11311

[192.168.1.37-0]: launching nodes...
[192.168.1.37-0]: ROS_MASTER_URI=http://192.168.1.99:11311
[192.168.1.37-0]: ERROR: cannot launch node of type [adc_mcc172/adc_mcc172_node.py]: adc_mcc172
ROS path [0]=/opt/ros/melodic/share/ros
ROS path [1]=/opt/ros/melodic/share
[192.168.1.37-0]: ... done launching nodes

The error comes from slave machine. I can find it in the ~/.ros/log/ folders.

This is the log-file from slave:

[roslaunch][INFO] 2022-07-06 11:59:14,826: roslaunch starting with args ['/opt/ros/melodic/bin/roslaunch', '-c', '192.168.1.37-0', '-u', 'http://192.168.1.99:41385/', '--run_id', '48a903fc-fc55-11ec-84a9-c517f1bf5fd1', '--sigint-timeout', '15.0', '--sigterm-timeout', '2.0']
[roslaunch][INFO] 2022-07-06 11:59:14,827: roslaunch env is {'ROS_DISTRO': 'melodic', 'XDG_SESSION_TYPE': 'tty', 'SSH_CLIENT': '192.168.1.99 44942 22', 'LOGNAME': 'pi', 'USER': 'pi', 'HOME': '/home/pi', 'PATH': '/opt/ros/melodic/bin:/usr/local/bin:/usr/bin:/bin:/usr/games', 'CMAKE_PREFIX_PATH': '/opt/ros/melodic', 'LD_LIBRARY_PATH': '/opt/ros/melodic/lib', 'LANG': 'en_GB.UTF-8', 'SHELL': '/bin/bash', 'SHLVL': '0', 'ROS_LOG_FILENAME': '/home/pi/.ros/log/48a903fc-fc55-11ec-84a9-c517f1bf5fd1/roslaunch-raspberrypi-14959.log', 'ROS_MASTER_URI': 'http://192.168.1.99:11311', 'XDG_SESSION_CLASS': 'user', 'XDG_RUNTIME_DIR': '/run/user/1000', 'PYTHONPATH': '/opt/ros/melodic/lib/python2 ...
(more)
edit retag flag offensive close merge delete

Comments

Is adc_mcc172 installed on your RPi? If it isn't: that's the problem.

If it is: is it available as part of the main installation (ie: in /opt/ros/...) or in a workspace built from source?

If the latter: that's likely why it isn't working.

You've specced /opt/ros/melodic/env.sh as your env-loader. That file will only let you use packages located in /opt/ros/melodic/... (as is confirmed by the error message: it only lists two paths under /opt/ros as part of the ROS path).

Anything in a custom workspace will not be 'visible'.

gvdhoorn gravatar image gvdhoorn  ( 2022-07-07 00:10:21 -0500 )edit

Ahaaa, yes adc_mcc172 is a node written by me and built via catkin simple in workspace. Do you think, that it woul solve the issue, when I put the path to ros path variable?

dualsbiker gravatar image dualsbiker  ( 2022-07-07 00:20:44 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-07-13 01:04:07 -0500

dualsbiker gravatar image

I solved the issue. The problem was, that the bashrc is not called by shh commands. I wrote my own env-loader and put all the config stuff in it. I put it to the workspace on the slave and changed the launch file on master.

This is the env-loader on slave:

#!/usr/bin/bash

source /opt/ros/melodic/setup.bash
source /home/pi/bob_ws/install/setup.bash
export ROS_MASTER_URI=http://192.168.1.99:11311
export ROS_IP=192.168.1.37
export ROS_HOSTNAME=$ROS_IP
export PATH="/opt/ros/melodic/share:$PATH"
export ROS_PACKAGE_PATH=/home/pi/bob_ws/install/share:$ROS_PACKAGE_PATH

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
exec "$@"

This is the part in launch file on master:

<machine name="raspberrypi" address="192.168.1.37" env-loader="/home/pi/bob_ws/src/adc_mcc172/scripts/env.sh" user="pi" password="***"/>
<node machine="raspberrypi" pkg="adc_mcc172" name="adc_mcc172" type="adc_mcc172_node.py"/>
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2022-07-06 07:35:22 -0500

Seen: 55 times

Last updated: Jul 13