5.8 Using Webots Remotely (Linux)In the Unix environments it is very common to start an application on a remote computer, over the network, for example using the ssh command. With ssh it is also possible to redirect the application's GUI and graphics output (and input) across the network. This useful Unix feature can be used to start Webots jobs remotely on a computer cluster, as explained below. 5.8.1 Using X11 ForwardingHere is the usual way to start webots on a remote computer using ssh:
It is also possible to start Webots minimized by adding the --minimize flag to the command line. Then it is possible to maximize the Webots icon at any time to verify that the remote simulation is doing what is expected:
Note that Webots PRO does automatically enable the Fast mode when its window is minimized (iconized). So with Webots PRO the simulation is faster when the window is minimized, because the 3D graphics is left out and almost no network bandwidth is used for X11. 5.8.2 Hanging Up SafelyThe problem with the above approach is that terminating the ssh session also kills the remote jobs. So in this case it will kill the remote Webots job and this is often unwanted. Fortunately it is possible to overcome this problem by using the nohup command and by connecting Webots to the X11 server of the remote host. In this approach ssh must be called without the -X (X11 forwarding) option and Webots must be called from the nohup command. The nohup causes the Webots to ignore the HUP (hangup) signal, and keeps it running after the user has logged out. Here is the procedure:
With nohup, output that would normally go to the terminal goes to a file called nohup.out. At this point it may become useful to redirect Webots console output to the nohup.out file (or to another file), in order to examine it later on. This can be achieved by defining the WEBOTS_STDOUT and WEBOTS_STDERR environment variables. When these variables are defined, the simulation output is redirected to Webots standard stdout and sterr streams. For example:
With the nohup approach, the decision to terminate the job is usually made in the Supervisor code according to simulation specific critera. The wb_supervisor_simulation_quit() function can be used to automatically terminate Webots. 5.8.3 Using a Virtual Frame BufferSometimes Webots will be unable to connect to an X11 server on the remote computer. This may be because the remote computer is not running any X11 server, or because the X11 server was started by another user and therefore it does not authorise a connection from a different user. It may also be possible that the remote computer has no graphics card installed (headless). It is possible to overcome these problems by connecting webots to a virtual frame buffer. The Xvfb command (virtual framebuffer X server for X Version 11) is exactly what is needed: it's an X server that can run on machines with no display hardware. So here is how to start a webots job on a remote computer without X11 server and to log out without killing the job:
5.8.4 Using CamerasThe X11 server connection is required because Webots depends on OpenGL for various aspects of the simulation, in particular for computing the images of the simulated Camera devices. Like the rendering of Webots main 3D view, the OpenGL computation of the Camera images does actually takes place on the computer used as X11 server (DISPLAY environment variable). So when Cameras are used it becomes particularly important to choose wisely which computer (remote or local ?) is used as X11 server, e.g. it is advisable to use a computer with an accelerated OpenGL graphics card. ![]() ^ page top ^ |
| E-mail to webmaster | Last updated: | Copyright © 2010 Cyberbotics Ltd. |