Remote ROSlaunch

asked 2022-03-14 04:05:56 -0500

yxtay gravatar image

Hi, I cannot ros launch my program remotely. My intention is to perform a server client action on two different machines, with the remote machine being the master. I have tried to manually ssh the remote machine, start the server node, then run the client locally, and it works fine.

I want to do this process remotely, and have done the following:

  1. Ensure the two machines can communicate with each other. http://wiki.ros.org/ROS/NetworkSetup
  2. Setup a RSA ssh key for passwordless login
  3. Setup an environment script in my remote machine under /opt/ros/melodic/env.sh

#!/bin/bash

source /opt/ros/melodic/setup.bash
source /home/weston/catkin_ws/devel/setup.bash
export ROS_MASTER_URI=http://10.10.0.20:1131/
exec "$@"
  1. Setup my launch file in my local machine (point 4)

<launch>
   <machine name="xi" address="10.10.0.20" env-loader="/opt/ros/melodic/env.sh" user="xi" />
   <node name="lift_server" pkg="peripheral_camera_lift" type="lift_server" output="screen">
      <param name="uart_port" value="/dev/ttyUSB0" />
   </node>
</launch>

My local machine has ip 10.10.0.197 and hostname set at 10.10.0.197, while remote machine has ip 10.10.0.20 and hostname set at 10.10.0.20.

My local machine .bashrc set at

export ROS_MASTER_URI=http://10.10.0.20:11311
export ROS_IP=10.10.0.197
export ROS_HOST_NAME=10.10.0.197

and remote machine .bashrc set at

export ROS_MASTER_URI=http://10.10.0.20:11311 
export ROS_HOSTNAME=10.10.0.20

Also, I noticed I have to run roscore on the remote machine manually, else the ros launch will result in error saying cannot contact host, which is I do not think should be the case. And assuming I run roscore on the remote machine, this is what appears:

$ roslaunch peripheral_camera_lift camera_lift_remote.launch 
... logging to /home/evas/.ros/log/4bbca158-0460-11e8-a707-00044beb0c50/roslaunch-evas-VAPOR-17-PRO-10938.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://10.10.0.197:37843/

SUMMARY
========

PARAMETERS
 * /lift_server/uart_port: /dev/ttyUSB0
 * /rosdistro: melodic
 * /rosversion: 1.14.12

NODES
  /
    lift_server (peripheral_camera_lift/lift_server)

ROS_MASTER_URI=http://10.10.0.20:11311

process[lift_server-1]: started with pid [10962]
Specified uart port of the lift: /dev/ttyUSB0
open: No such file or directory
open: No such file or directory
Failed to initialize lift
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::lock_error> >'
  what():  boost: mutex lock failed in pthread_mutex_lock: Invalid argument
[lift_server-1] process has died [pid 10962, exit code -6, cmd /home/evas/catkin_ws/devel/lib/peripheral_camera_lift/lift_server __name:=lift_server __log:=/home/evas/.ros/log/4bbca158-0460-11e8-a707-00044beb0c50/lift_server-1.log].
log file: /home/evas/.ros/log/4bbca158-0460-11e8-a707-00044beb0c50/lift_server-1*.log
all processes on machine have died, roslaunch will exit
shutting down processing monitor...
... shutting down processing monitor complete
done

It looks like the program did not run remotely. Any help will be appreciated, thanks!

edit retag flag offensive close merge delete