![]() |
ros2_control - humble
|


Public Member Functions | |
| ROS2ControlGlfwAdapter (std::atomic< bool > &step_requested) | |
Protected Member Functions | |
| void | OnKey (int key, int scancode, int act) override |
GlfwAdapter subclass that overrides right-arrow-key handling so that a single simulation step is driven exclusively by the ROS control loop rather than by MuJoCo's built-in viewer.
When the simulation is paused, MuJoCo's default GlfwAdapter advances the physics by one step (mj_step) on each right-arrow press or key-repeat event. This class suppresses that native behaviour and instead sets step_requested_, which the ROS control loop polls to advance the simulation. This ensures that ros2_controller read/update/write cycles are executed for every step and that controller state remains consistent with the physics.
All other keys are forwarded to the parent class unchanged so that the rest of the MuJoCo viewer UI (play/pause, reset, rendering options, etc.) works as normal.