Gazebo | Ignition | Community
Ask Your Question
1

Can you render a camera in headless mode?

asked 2021-06-08 01:12:53 -0600

jdekarske gravatar image

(version 9.18.0)

I'm trying to run a simulation in a Docker container in which the output of a camera (libgazebo_ros_camera) can be accessed externally. Everything works fine when my display is mounted to the container.

I receive this if I do not mount my display.

[Err] [RenderEngine.cc:742] Can't open display: 
[Wrn] [RenderEngine.cc:88] Unable to create X window. Rendering will be disabled
[Wrn] [RenderEngine.cc:291] Cannot initialize render engine since render path type is NONE. Ignore this warning ifrendering has been turned off on purpose.

This page is pretty clear that cameras won't render in headless mode. So, this may be a dumb question, but I vaguely remember accomplishing this before.

Any other ideas would be great!

edit retag flag offensive close merge delete

Comments

Not sure, if this is the same case, but some time ago I needed to use GPU version of a laser scanner (gpu_ray sensor). In order to make it work, I needed to use vcl software to emulate virtual X-window. However, if camera is part of visualisation GUI, it may not help...

m.bahno gravatar imagem.bahno ( 2021-06-09 09:01:16 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-05-23 19:51:07 -0600

jdekarske gravatar image

Figured it out nearly a year later :)

I needed to use a dummy xserver to convince gazebo that there was a display to render to:

/usr/bin/Xorg -noreset +extension GLX +extension RANDR +extension RENDER -logfile ./xdummy.log -config /etc/X11/dummy-xorg.conf :1

dummy-xorg.conf

# This xorg configuration file is meant to be used by xpra
# to start a dummy X11 server.
# For details, please see:
# https://xpra.org/Xdummy.html

Section "ServerFlags"
  Option "DontVTSwitch" "true"
  Option "AllowMouseOpenFail" "true"
  Option "PciForceNone" "true"
  Option "AutoEnableDevices" "false"
  Option "AutoAddDevices" "false"
EndSection

Section "InputDevice"
  Identifier "dummy_mouse"
  Option "CorePointer" "true"
  Driver "void"
EndSection

Section "InputDevice"
  Identifier "dummy_keyboard"
  Option "CoreKeyboard" "true"
  Driver "void"
EndSection

Section "Device"
  Identifier "dummy_videocard"
  Driver "dummy"
  Option "ConstantDPI" "true"
  #VideoRam 4096000
  #VideoRam 256000
  VideoRam 192000
EndSection

Section "Monitor"
  Identifier "dummy_monitor"
  HorizSync   5.0 - 1000.0
  VertRefresh 5.0 - 200.0
  #This can be used to get a specific DPI, but only for the default resolution:
  #DisplaySize 508 317
  #NOTE: the highest modes will not work without increasing the VideoRam
  # for the dummy video card.
  Modeline "32768x32768" 15226.50 32768 35800 39488 46208 32768 32771 32781 32953
  Modeline "32768x16384" 7516.25 32768 35544 39192 45616 16384 16387 16397 16478
  Modeline "16384x8192" 2101.93 16384 16416 24400 24432 8192 8390 8403 8602
  Modeline "8192x4096" 424.46 8192 8224 9832 9864 4096 4195 4202 4301
  Modeline "5496x1200" 199.13 5496 5528 6280 6312 1200 1228 1233 1261
  Modeline "5280x1080" 169.96 5280 5312 5952 5984 1080 1105 1110 1135
  Modeline "5280x1200" 191.40 5280 5312 6032 6064 1200 1228 1233 1261
  Modeline "5120x3200" 199.75 5120 5152 5904 5936 3200 3277 3283 3361
  Modeline "4800x1200" 64.42 4800 4832 5072 5104 1200 1229 1231 1261
  Modeline "3840x2880" 133.43 3840 3872 4376 4408 2880 2950 2955 3025
  Modeline "3840x2560" 116.93 3840 3872 4312 4344 2560 2622 2627 2689
  Modeline "3840x2048" 91.45 3840 3872 4216 4248 2048 2097 2101 2151
  Modeline "3840x1080" 100.38 3840 3848 4216 4592 1080 1081 1084 1093
  Modeline "3600x1200" 106.06 3600 3632 3984 4368 1200 1201 1204 1214
  Modeline "3288x1080" 39.76 3288 3320 3464 3496 1080 1106 1108 1135
  Modeline "2048x2048" 49.47 2048 2080 2264 2296 2048 2097 2101 2151
  Modeline "2048x1536" 80.06 2048 2104 2312 2576 1536 1537 1540 1554
  Modeline "2560x1600" 47.12 2560 2592 2768 2800 1600 1639 1642 1681
  Modeline "2560x1440" 42.12 2560 2592 2752 2784 1440 1475 1478 1513
  Modeline "1920x1440" 69.47 1920 1960 2152 2384 1440 1441 1444 1457
  Modeline "1920x1200" 26.28 1920 1952 2048 2080 1200 1229 1231 1261
  Modeline "1920x1080" 23.53 1920 1952 2040 2072 1080 1106 1108 1135
  Modeline "1680x1050" 20.08 1680 1712 1784 1816 1050 1075 1077 1103
  Modeline "1600x1200" 22.04 1600 1632 1712 1744 1200 1229 1231 1261
  Modeline "1600x900" 33.92 1600 1632 1760 1792 900 921 924 946
  Modeline "1440x900" 30.66 1440 1472 1584 1616 900 921 924 946
  ModeLine "1366x768" 72.00 1366 1414 1446 1494  768 771 777 803
  Modeline "1280x1024 ...
(more)
edit flag offensive delete link more

Comments

Xvfb is much easier to use. xvfb-run -a gazebo and that's it. It also doesn't need root privileges and doesn't need a real display connected.

peci1 gravatar imagepeci1 ( 2022-07-05 16:57:59 -0600 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2021-06-08 01:12:53 -0600

Seen: 193 times

Last updated: May 23