Fix mjv_moveCamera argument mismatch for MuJoCo 3.x compatibility
Intro
Robotics developer working with ROS 2 and MuJoCo simulation for manipulators/mobile robots.
My setup
OS: Ubuntu
ROS 2 Version: ROS 2 (Humble / Iron / Rolling)
MuJoCo Version: 3.11.0 (C API)
Package: mujoco_ros2_control
What's happening? What did you expect?
Compilation fails in mujoco_rendering.cpp when building against MuJoCo 3.11.0 because mjv_moveCamera is called with 6 arguments instead of 5. error: cannot convert 'mjvScene*' to 'mjvCamera*' 204 | mjv_moveCamera(mj_model_, action, dx / height, dy / height, &mjv_scn_, &mjv_cam_); note: initializing argument 5 of 'void mjv_moveCamera(const mjModel*, int, mjtNum, mjtNum, mjvCamera*)'
Steps for reproduction
Minimal model for reproduction
//
Code required for reproduction
mjv_moveCamera(mj_model_, action, dx / height, dy / height, &mjv_cam_); mjv_moveCamera(mj_model_, mjMOUSE_ZOOM, 0, -0.05 * yoffset, &mjv_cam_);
Confirmations
- [x] I searched the latest documentation thoroughly before posting.
- [x] I searched previous Issues and Discussions, I am certain this has not been raised before.
The extra argument was removed in version 3.11. See our release notes.
https://mujoco.readthedocs.io/en/stable/changelog.html#version-3-11-0-july-27-2026