When trying to use a launchfile to launch ROS nodes on two seperate machines, the remote PC cannot find the files I want to launch. I have also installed both packages on both machines for testing purpouses. The files is can be launched on both PC's, but when I try to launch them remotely, they're not found.
I have looked at a lot of other people using ROS on two machines, but I cannot seem to find any solution to this problem. Any suggestions/help is appreciated. All necessary files is listed below.
EDIT: I have tried launching the turtlesim teleop node on the remote PC, a node that is native in ROS. This works with no problem, so the problem lies in custom made nodes.
Main launch file
<launch>
<include file="$(find r18dv_tf_publisher)/hosts/hosts.machine" />
<node machine="tegra_a" pkg="r18dv_tf_publisher" type="tf_broadcaster" name="tf_broadcaster" />
<node machine="tegra_b" pkg="r18dv_simple_heading_controller" type="r18dv_simple_heading_controller_node" name="heading_controller" output="screen" />
</launch>
hosts.machine
<launch>
<machine name="tegra_a" address="10.42.0.28" env-loader="/opt/ros/kinetic/env.sh" />
<machine name="tegra_b" address="10.42.0.29" env-loader="/opt/ros/kinetic/env.sh" />
</launch>
The file structure is identical on the two machines, and both env.sh files is located at the same location.
env.sh on tegra_a
#!/usr/bin/env sh
# generated from catkin/cmake/templates/env.sh.in
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"
export ROS_WS=/home/nvidia/catkin_ws
export ROS_KINETIC=/etc/ros/kinetic
source $ROS_WS/devel/setup.bash
source $ROS_KINETIC/setup.bash
export PATH=$ROS_ROOT/bin:$PATH
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$ROS_WS
export ROS_MASTER_URI=http://10.42.0.28:11311/
export ROS_HOSTNAME=10.42.0.28
exec "$@"
env.sh on tegra_b
#!/usr/bin/env sh
# generated from catkin/cmake/templates/env.sh.in
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"
export ROS_WS=/home/nvidia/catkin_ws
export ROS_KINETIC=/etc/ros/kinetic
source $ROS_WS/devel/setup.bash
source $ROS_KINETIC/setup.bash
export PATH=$ROS_ROOT/bin:$PATH
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$ROS_WS
export ROS_MASTER_URI=http://10.42.0.28:11311/
export ROS_HOSTNAME=10.42.0.29
exec "$@"
Output when launching the launchfile
nvidia@nvidia:/opt/ros/kinetic$ roslaunch r18dv_tf_publisher test_launch.launch
... logging to /home/nvidia/.ros/log/3dfcc3a4-fba0-11e7-8f39-00044b8da45f/roslaunch-nvidia-8089.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://10.42.0.28:33233/
remote[10.42.0.29-0] starting roslaunch
remote[10.42.0.29-0]: creating ssh connection to 10.42.0.29:22
/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://10.42.0.28:11311/ /opt/ros/kinetic/env.sh roslaunch -c 10.42.0.29-0 -u http://10.42.0.28:33233/ --run_id 3dfcc3a4-fba0-11e7-8f39-00044b8da45f]
remote[10.42.0.29-0]: ssh connection created
SUMMARY
========
PARAMETERS
* /rosdistro: kinetic
* /rosversion: 1.12.12
MACHINES
* tegra_a
* tegra_b
NODES
/
heading_controller (r18dv_simple_heading_controller/r18dv_simple_heading_controller_node)
tf_broadcaster (r18dv_tf_publisher/tf_broadcaster)
auto-starting new master
process[master]: started with pid [8104]
ROS_MASTER_URI=http://10.42.0.28:11311/
setting /run_id to 3dfcc3a4-fba0-11e7-8f39-00044b8da45f
process[rosout-1]: started with pid [8117]
started core service [/rosout]
process[tf_broadcaster-2]: started with pid [8128]
[10.42.0.29-0]: launching nodes...
[10.42.0.29-0]: ROS_MASTER_URI=http://10.42.0.28:11311/
[10.42.0.29-0]: ERROR: cannot launch node of type [r18dv_simple_heading_controller/r18dv_simple_heading_controller_node]: can't locate node [r18dv_simple_heading_controller_node] in package [r18dv_simple_heading_controller]
[10.42.0.29-0]: ... done launching nodes
I found the solution myself. I posted it on ROS's answers forum: https://answers.ros.org/question/280193/files-not-found-when-launching-from-remote-pc/