drake

Render with RgbdSensor on server


How can I use RgbdSensor for rendering on a server? Can I somehow use a virtual display?

By default, I'm getting the following:

RuntimeError: error: ERROR: In vtkXOpenGLRenderWindow.cxx, line 459: vtkXOpenGLRenderWindow (0x62da2426f640): bad X server connection. DISPLAY=


Solution

  • I use pyvirtualdisplay in the manipulation repo:

        # Setup a virtual display if needed (for simulating cameras)
        if scenario.cameras and sys.platform == "linux" and os.getenv("DISPLAY") is None:
            from pyvirtualdisplay import Display
    
            virtual_display = Display(visible=0, size=(1400, 900))
            virtual_display.start()
    

    If necessary, you might also need to apt install xvfb.