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

launch file to run multiple nodes in two machines: problem with environment file

asked 2015-01-21 02:10:23 -0500

altella gravatar image

updated 2015-01-21 16:10:18 -0500

Hello all;

Following this good tutorial, link tutorial,

I have made a roslaunch file to start diferent nodes, locally and remotely in a Raspberry Pi. My launch file is:

<!-- at_robot_system.launch -->

<launch>
    <machine name="at_robot_server" address="192.168.0.20" user="alberto" password="altella" env-loader="/home/alberto/at_robot_server_ros_env.sh"/>
    <machine name="at_robot" address="192.168.0.21" user="pi" password="raspberry" env-loader="/home/pi/at_robot_ros_env.sh"/>

    <group ns="at_robot_server">
        <node machine="at_robot_server" pkg="at_robot_server" name="KeyController_node" type="KeyController" output="screen">
            <param name="loop_rate" value="20" type="int"/>
            <param name="up_key" value="56" type="int"/>
            <param name="down_key" value="50" type="int"/>
            <param name="left_key" value="52" type="int"/>
            <param name="right_key" value="54" type="int"/>
        </node>
        <node machine="at_robot" name="image_view" pkg="image_view" type="image_view" respawn="false" output="screen">
            <remap from="image" to="/image_raw"/>
            <param name="autosize" value="true"/>
        </node>
    </group>

    <group ns="at_robot">
        <node machine="at_robot" pkg="uvc_camera" type="uvc_camera_node" name="uvc_camera" output="screen">
            <param name="device" value="/dev/video0"/>  
            <param name="width" value="640"/>
            <param name="height" value="480"/>
            <param name="format" value="jpeg"/>
            <param name="fps" value="30"/>
            <param name="auto_focus" value="False"/>
            <param name="focus_absolute" value="0"/>
        </node>
        <node machine="at_robot" pkg="at_robot" type="KeyControlClient_node" name="KeyControlClient" output="screen">
            <param name="motor_motion_time" value="100" type="int"/>
        </node> 
    </group>

</launch>

Both sections of the launch file work independently when launched locally. But running this launch file, I have the following error, which I can not understand, beacuse all the files exist and are checked with right persmissions:

alberto@alberto-pc:~$ roslaunch at_robot_server at_robot_system.launch
... logging to /home/alberto/.ros/log/99a32f48-a0f1-11e4-855a-080027cab213/roslaunch-alberto-VirtualBox-3229.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.0.20:52403/
remote[192.168.0.21-0] starting roslaunch
remote[192.168.0.21-0]: creating ssh connection to 192.168.0.21:22, user[pi]
launching remote roslaunch child with command: [env ROS_MASTER_URI=http://localhost:11311 /home/pi/at_robot_ros_env.sh roslaunch -c 192.168.0.21-0 -u http://192.168.0.20:52403/ --run_id 99a32f48-a0f1-11e4-855a-080027cab213]
remote[192.168.0.21-0]: ssh connection created
remote[192.168.0.21-0]: env: /home/pi/at_robot_ros_env.sh: No such file or directory

[192.168.0.21-0] process has died
remote roslaunch failed to launch: at_robot
alberto@alberto-pc:~$

My environment sh files are as follows:

#!/bin/sh

export ROS_IP=192.168.0.20
export ROS_MASTER_URI=http://localhost:11311
export ROSLAUNCH_SSH_UNKNOWN=1
. /home/alberto/at_robot_ws/devel/setup.sh
exec "@"

Is there any error? Would it be better to use bash?

Could anyone give a hint? Thank you very much in advance,

Alberto

edit retag flag offensive close merge delete

Comments

I have used dos2unix tool with the sh files, just in case. Now I have this error:

remote[192.168.0.21-0]: /home/pi/at_robot_ros_env.sh: 6: exec: @: not found

What does it mean?

altella gravatar image altella  ( 2015-01-21 16:08:26 -0500 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2015-01-21 16:21:18 -0500

ahendrix gravatar image

the last line in your environment loader should be:

exec "$@"

Note that you're missing the $

edit flag offensive delete link more

Comments

I will test it this evening, but you are right... it seems to be the problem. I´ll let you know.

altella gravatar image altella  ( 2015-01-22 01:43:42 -0500 )edit

Ecactly, that was de problem. Thank you very much for the tip. I am not experienced in bash or sh, what does the instructions "." and "exec "$"" exactly mean?

altella gravatar image altella  ( 2015-01-23 02:16:56 -0500 )edit

. is a synonym for source. exec is the same as the exec() system call in C. "$@" expands to all of the positional arguments to the script.

This causes the script to set up the environment, and then execute the arguments as a new command.

ahendrix gravatar image ahendrix  ( 2015-01-23 14:46:13 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2015-01-21 02:10:23 -0500

Seen: 4,072 times

Last updated: Jan 21 '15