How can I launch rviz on a remote machine ?
I have a launch file that is meant to kick off freenect on a robot(zen) and rviz on a desktop computer(thetis). I understand that rviz is graphical and needs to use thetis' screen. After some googling I discovered a recommendation saying that I could do this by placing export DISPLAY=:0
in my env.sh file (on thetis). Sadly it does not work.
The launch file starts promisingly and produces:
started roslaunch server http://zen:40724/
remote[thetis-0] starting roslaunch
remote[thetis-0]: creating ssh connection to thetis:22, user[paul]
launching remote roslaunch child with command: [env ROS_MASTER_URI=http://zen:11311 /opt/ros/kinetic/env.sh roslaunch -c thetis-0 -u http://zen:40724/ --run_id d0af37a2-8a9c-11e6-9197-247703b09b04]
remote[thetis-0]: ssh connection created
But later it reports:
[thetis-0]: [Zen-1] process has died [pid 8018, exit code -6, cmd /opt/ros/kinetic/lib/rviz/rviz __name:=Zen __log:=/home/paul/.ros/log/d0af37a2-8a9c-11e6-9197-247703b09b04/Zen-1.log].
log file: /home/paul/.ros/log/d0af37a2-8a9c-11e6-9197-247703b09b04/Zen-1*.log
[thetis-0]: all processes on machine have died, roslaunch will exit
remote[thetis-0]: QXcbConnection: Could not connect to display
[Zen-1] process has died [pid 8018, exit code -6, cmd /opt/ros/kinetic/lib/rviz/rviz __name:=Zen __log:=/home/paul/.ros/log/d0af37a2-8a9c-11e6-9197-247703b09b04/Zen-1.log].
log file: /home/paul/.ros/log/d0af37a2-8a9c-11e6-9197-247703b09b04/Zen-1*.log
My launch file is:
<launch>
<machine name="thetisx" address="thetis" env-loader="/opt/ros/kinetic/env.sh" user="fred"/>
<include file="$(find freenect_launch)/launch/freenect.launch"/>
<node machine="thetisx" pkg="rviz" type="rviz" name="Zen" output="screen">
</node>
</launch>
Doing some investigation, I discovered that if, from zen, I do:
ssh fred@thetis
password: *****
rosrun rviz rviz
I get a failure and core dump saying QXcbConnection: Could not connect to display
However if I do:
ssh fred@thetis
password: *****
export DISPLAY=:0
rosrun rviz rviz
then rviz successfully appears on the remote machine.
So why does putting export DISPLAY=:0
in the env.sh file not work and how can I launch rviz remotely ?
I would also like to know an answer to this. I tried both setting the display and the -X option when I ssh in.