ros2_control - humble
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
mujoco_ros2_control::ROS2ControlGlfwAdapter Class Reference
Inheritance diagram for mujoco_ros2_control::ROS2ControlGlfwAdapter:
Inheritance graph
[legend]
Collaboration diagram for mujoco_ros2_control::ROS2ControlGlfwAdapter:
Collaboration graph
[legend]

Public Member Functions

 ROS2ControlGlfwAdapter (std::atomic< bool > &step_requested)
 

Protected Member Functions

void OnKey (int key, int scancode, int act) override
 

Detailed Description

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.


The documentation for this class was generated from the following file: