Skip to main content
Version: 10

Adjusting the Simulated Camera Resolution

By default, MoveIt Pro ships its example simulation configurations with modest camera resolutions so the stack runs smoothly on machines without a lot of available CPU. If your machine can spare the rendering cost, you can increase the resolution of the simulated cameras for sharper images and point clouds.

This guide uses the lab_sim robot configuration package as an example.

Edit the MuJoCo scene

Camera resolution in MuJoCo is set in two places inside the scene file. For lab_sim, that file is:

src/lab_sim/description/scene.xml

1. Camera sensor resolution

Each <camera> element has a resolution attribute (width height, in pixels):

<camera
name="scene_camera"
fovy="58"
mode="fixed"
resolution="640 480"
...
/>

Change the two numbers to your desired resolution (for example, 1280 720).

2. Offscreen render buffer

MuJoCo uses one offscreen framebuffer for all non-lidar cameras. Set it to exactly the same width and height as each camera:

<visual>
<global offwidth="640" offheight="480" />
...
</visual>

If the dimensions differ, the MuJoCo hardware plugin fails initialization and reports the camera and framebuffer mismatch.

Apply the change

Restart the MoveIt Pro backend to pick up the new scene file. The wrist and scene cameras will now publish images at the higher resolution.

Performance

Higher camera resolutions cost more time per render (camera rendering is GPU-accelerated through EGL when a GPU driver is available, and falls back to CPU software rendering otherwise) and increase ROS message bandwidth. If sim feels sluggish, drop the resolution back down or reduce the camera publish rate (render_publish_rate parameter on the MujocoSystem hardware plugin).

Image quality

Simulated cameras render with shadows and anti-aliasing disabled by default, regardless of what the scene file asks for. Both are per-fragment work paid for once per camera on every render tick, and a render tick blocks every camera topic — point clouds included — for as long as it runs. On CPU software rendering they dominate that cost.

These defaults take precedence over the MJCF <quality> element and any shadow-casting lights in the scene. Re-enable them on the MujocoSystem hardware plugin when RGB fidelity matters more than render latency:

<param name="camera_shadows">true</param>
<param name="camera_offsamples">4</param>

camera_shadows accepts a boolean. camera_offsamples accepts an integer from 0 through 4, where 0 disables multisampling. Invalid explicit values cause the MujocoSystem hardware plugin to fail initialization and report the offending parameter.

Shadows affect only the appearance of RGB images — they cannot change depth images or point clouds. Anti-aliasing is mostly cosmetic too, but because the graphics driver decides how to resolve a multisampled depth buffer, turning it on or off can shift point cloud depth slightly at object edges on some drivers. If you re-enable it and depend on point cloud precision, re-check that your perception Behaviors still perform as expected.