ros-roslaunch啟動多臺機器ros節點
兩臺電腦,分別為p11和p12,環境均為ubuntu16.04,launch程式碼如下
<launch>
<machine name="p12" address="p12" env-loader="/home/nvidia/setup.sh" user="nvidia"/>
<machine name="p11" address="p11" env-loader="/home/nvidia/setup.sh" user="nvidia"/>
<node machine="p12" name="test_node" pkg="projection" type ="test_node" output="screen">
</node>
</launch>
On p12, the /home/nvidia/setup.sh :
#!/usr/bin/env bash
#export p11=192.168.10.37
#export p12=192.168.10.54
#export fangli0=192.168.10.42
export ROS_IP=p12
export ROS_MASTER_URI=p11:11311
export ROSLAUNCH_SSH_UNKNOWN=1
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH} :/usr/lib
export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:/usr/local/lib/pkgconfig/
export ROS_MASTER_URI=http://p11:11311
#export ROS_IP=192.168.10.54
export ROS_HOSTNAME=p12
# for lanemarking_liuli
export LD_LIBRARY_PATH=/home/nvidia/Liuchao/local/lib:${LD_LIBRARY_PATH}
#. /home/nvidia/setup.sh
source /home/nvidia/.bashrc
source /opt/ros/kinetic/setup.bash
source /home/nvidia/fangli/perception/code/perception_ros/devel/setup.bash
exec "[email protected]"
attention please:
ROS has a flaw (feature?) in that it uses a library to so SSH, rather than the usual SSH client. This library does not support the default key algorithm used by the typical SSH client. This means that even though you can SSH to the remote machine, ROS cannot, because the key algorithm isn’t supported.
The fix is to remove the stored key in ~/.ssh/known_hosts, then SSH again to the remote machine, specifying the -oHostKeyAlgorithms=’ssh-rsa’ command-line option to force the use of the the RSA algorithm. Once this is done ROS can connect to the remote machine.
http://answers.ros.org/question/244060/roslaunch-ssh-known_host-errors-cannot-launch-remote-nodes/?answer=244064#post-id-244064