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

Revision history [back]

click to hide/show revision 1
initial version

My answer to this is to use the existing linux system to do this: systemd. Basically do the following:

On the target machine, the machine you want to run remote nodes on, do the following:

  1. Make sure the nodes you want to run are on the remote machine already and it's already built on that machine.
  2. Make a bash script that executes ros2 launch and sources the right install directory. We'll call this remote_ros.sh. This is a script because you might want to do other things with this.
  3. Make a remote_ros.service file that runs the remote_ros.sh script. This can be setup to start on boot or not.

On the local machine, the machine you want to launch remote nodes on, do the following:

  1. Make a launch script that SSHes into the remote machine and executes systemctl stop remote_ros and/or systemctl start remote_ros. This can be done with the ExecuteProcess launch action.

Stop will kill the nodes and start will bring them up. If you don't want to stop the nodes, I believe start is a NOOP if they are already running.

I think this solution is more straight forward than the others presented and ideally the service just runs all the time, but you can always kill it with the systemctl stop command.