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

How can I launch rviz on a remote machine ?

asked 2016-10-04 21:19:19 -0500

elpidiovaldez gravatar image

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=:0in my 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/   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:

  <machine name="thetisx" address="thetis" env-loader="/opt/ros/kinetic/" user="fred"/>

  <include file="$(find freenect_launch)/launch/freenect.launch"/>

  <node machine="thetisx" pkg="rviz" type="rviz" name="Zen" output="screen">


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 file not work and how can I launch rviz remotely ?

edit retag flag offensive close merge delete


I would also like to know an answer to this. I tried both setting the display and the -X option when I ssh in.

shoemakerlevy9 gravatar image shoemakerlevy9  ( 2016-12-05 11:12:53 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2016-10-05 04:03:51 -0500

rastaxe gravatar image

Try ssh fred@thetis -X

edit flag offensive delete link more



Thanks, but -X makes no difference. The crucial thing is to set DISPLAY. I already know how to run rviz remotely via ssh. I want to run it remotely from a launch file. That should work by setting DISPLAY in the for the remote machine, but it doesn't.

elpidiovaldez gravatar image elpidiovaldez  ( 2016-10-05 23:20:54 -0500 )edit

answered 2021-09-23 02:15:16 -0500

li9i gravatar image

updated 2021-09-23 02:17:28 -0500

What I do and works is this:

user_remote@zen $ roslaunch pkg launcher.launch

where you can either remove the launch of rviz in launcher.launch or keep it since it doesn't make a difference

and then

user_local@thetis $ export ROS_MASTER_URI=http://zen:11311

user_local@thetis $ rosrun rviz rviz

See for more. Both machines need to know each other by IP and hostname for this to work.

edit flag offensive delete link more

Question Tools



Asked: 2016-10-04 21:19:19 -0500

Seen: 4,772 times

Last updated: Sep 23 '21