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

ssh rviz: cannot connect to X server

asked 2016-06-13 05:09:39 -0500

yongqi gravatar image

updated 2016-06-13 05:12:58 -0500

hi, I am using indigo in ubuntu14.04.2. I am trying to connect my desktop computer(zyq.local) and another computer(thinker.local). I can ping them from each one, and I have set the hostname and host_master_uri like this: in my desktop computer:

export ROS_HOSTNAME=zyq.local
export ROS_MASTER_URI=http://thinker.local:11311

in another:

export ROS_HOSTNAME=thinker.local

then I login the robot computer through ssh

ssh thinker.local -l think
roscore &
roslaunch rbx1_bringup fake_pi_robot.launch

after this I open another terminal in my desktop computer an connect robot computer again

ssh thinker.local -l think
rosrun rviz rviz -d `rospack find rbx1_nav`/sim.rviz

now error occurs:rviz: cannot connect to X server I do not why, two computers can ping each other. Thanks.

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
2

answered 2016-06-13 07:20:17 -0500

By default a ssh connection does not allow any graphical interface to be displayed. To allow this you have to add the -X argument to the connection.

It should be something like

ssh -X thinker.local -l think

Then you will be able to open any GUI.

Regards,

edit flag offensive delete link more

Comments

thanks, it works.I have another question.When I control the robot through desktop computer without ssh like thiszyq@zyq:~$ rosrun rviz rviz -drospack find rbx1_nav/sim.rviz, it told me [rospack] Error: package 'rbx1_nav' not found. But I have set the HOSTNAME and URI, what should I do thanks

yongqi gravatar image yongqi  ( 2016-06-13 09:42:33 -0500 )edit

This is because probably you don't have the rbx1_nav package on your desktop computer. Maybe just run rviz rosrun rviz rviz and then add the displays manually

Mario Garzon gravatar image Mario Garzon  ( 2016-06-13 12:16:01 -0500 )edit

no, I don't have this package. But I have it in my robot computer, I want to add the displays manually on my desktop computer while don't use ssh. Can this be achieved? If not, I don't know what is the HOST_MASTER_URI used for(I have set it http://thinker.local:11311 ). Thanks very much.

yongqi gravatar image yongqi  ( 2016-06-13 18:45:47 -0500 )edit

Yes, you can manually add the displays in your desktop computer. The ROS_MASTER_URI variable is used to tell ROS that the roscore is running on your robot computer, and therefore being able to read the topics on that computer.

Mario Garzon gravatar image Mario Garzon  ( 2016-06-14 06:45:02 -0500 )edit

Thanks a lot

yongqi gravatar image yongqi  ( 2016-06-14 19:03:36 -0500 )edit

hello,I have got the same issue, and after I used the command 'ssh -X .....', the issue was still here. What could be the issue ? Can you please help me?

Dhuzi gravatar image Dhuzi  ( 2023-03-29 02:15:13 -0500 )edit
2

answered 2016-06-13 07:18:33 -0500

JohnDoe2991 gravatar image

You forgot to enable X11 Forwarding. Try to use

ssh -X thinker.local -l think
rosrun rviz rviz -d `rospack find rbx1_nav`/sim.rviz

Note: -X (upper case) enables X11 Forwarding whereas -x (lower case) disables it.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-06-13 05:09:39 -0500

Seen: 4,293 times

Last updated: Jun 13 '16