|
| bool | init (rclcpp::Node::SharedPtr node, const mjModel *, mjData *) override |
| | Initialize the plugin.
|
| |
| void | update_write (const mjModel *, mjData *) override |
| | Called once per write() cycle, on the control thread, after the hardware interface has staged the controller commands and right before they are sent to the simulation.
|
| |
| void | update_read (const mjModel *, mjData *data) override |
| | Called once per read() cycle, on the control thread, before the state is handed to ros2_control. Default does nothing.
|
| |
| void | on_reset (mjData *) override |
| | Called after a world reset (ResetWorld service or UI reset). Default does nothing.
|
| |
| void | cleanup () override |
| | Cleanup the plugin.
|
| |
| virtual void | update (const mjModel *, mjData *) |
| | Same as update_write(). Default does nothing.
|
| |
| virtual void | pre_step (mjData *) |
| | Called immediately before every simulation step on the physics thread. Default does nothing.
|
| |
|
|
static constexpr double | kReadOverride = 42.0 |
| |
◆ cleanup()
| void external_plugin_test::TestPlugin::cleanup |
( |
| ) |
|
|
inlineoverridevirtual |
◆ init()
| bool external_plugin_test::TestPlugin::init |
( |
rclcpp::Node::SharedPtr |
node, |
|
|
const mjModel * |
model, |
|
|
mjData * |
data |
|
) |
| |
|
inlineoverridevirtual |
Initialize the plugin.
- Parameters
-
| node | Shared pointer to the ROS 2 node for accessing parameters |
| model | Pointer to the MuJoCo model |
| data | Pointer to the MuJoCo data |
- Returns
- true if initialization was successful
- Note
- This method will be called once when the plugin is loaded. It can be used to read parameters, set up publishers/subscribers, etc. The node will be a child of the main mujoco_ros2_control node, so parameters should be namespaced accordingly.
Implements mujoco_ros2_control_plugins::MuJoCoROS2ControlPluginBase.
◆ on_reset()
| void external_plugin_test::TestPlugin::on_reset |
( |
mjData * |
| ) |
|
|
inlineoverridevirtual |
◆ update_read()
| void external_plugin_test::TestPlugin::update_read |
( |
const mjModel * |
, |
|
|
mjData * |
|
|
) |
| |
|
inlineoverridevirtual |
Called once per read() cycle, on the control thread, before the state is handed to ros2_control. Default does nothing.
Only the control state fields of data are valid (time, qpos, qvel, act, qfrc_actuator, sensordata, ctrl), all from the same physics step. Derived quantities (e.g. site_xpos) are stale: call mj_kinematics() or similar on data if needed. Changes to the control state fields are what ros2_control reads.
- Parameters
-
| model | Pointer to the MuJoCo model |
| data | Scratch data holding the latest control state, modify it in place |
Reimplemented from mujoco_ros2_control_plugins::MuJoCoROS2ControlPluginBase.
◆ update_write()
| void external_plugin_test::TestPlugin::update_write |
( |
const mjModel * |
model, |
|
|
mjData * |
data |
|
) |
| |
|
inlineoverridevirtual |
Called once per write() cycle, on the control thread, after the hardware interface has staged the controller commands and right before they are sent to the simulation.
Plugins run in order and can read and rewrite ctrl/qfrc_applied. The default forwards to the deprecated update() so plugins that still override it keep working.
- Parameters
-
| model | Pointer to the MuJoCo model |
| data | Pointer to a recent snapshot (not the live mj_data_) |
Reimplemented from mujoco_ros2_control_plugins::MuJoCoROS2ControlPluginBase.
The documentation for this class was generated from the following file:
- mujoco_ros2_control/mujoco_ros2_control_tests/src/test_plugin.cpp