ros2_control - kilted
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
mujoco_ros2_control_plugins::FreeJointStatePublisherPlugin Class Reference

Plugin that publishes the pose and velocity of every MuJoCo free-joint body (or a user-selected subset) to a single topic, in a user-selectable reference frame. More...

#include <free_joint_state_publisher_plugin.hpp>

Inheritance diagram for mujoco_ros2_control_plugins::FreeJointStatePublisherPlugin:
Inheritance graph
[legend]
Collaboration diagram for mujoco_ros2_control_plugins::FreeJointStatePublisherPlugin:
Collaboration graph
[legend]

Public Member Functions

bool init (rclcpp::Node::SharedPtr node, const mjModel *model, mjData *data) override
 Initialize the plugin.
 
void update_write (const mjModel *model, mjData *data) 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 cleanup () override
 Cleanup the plugin.
 
- Public Member Functions inherited from mujoco_ros2_control_plugins::MuJoCoROS2ControlPluginBase
virtual void update_read (const mjModel *, mjData *)
 Called once per read() cycle, on the control thread, before the state is handed to ros2_control. Default does nothing.
 
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.
 
virtual void on_reset (mjData *)
 Called after a world reset (ResetWorld service or UI reset). Default does nothing.
 

Detailed Description

Plugin that publishes the pose and velocity of every MuJoCo free-joint body (or a user-selected subset) to a single topic, in a user-selectable reference frame.

Publishes mujoco_ros2_control_msgs/msg/FreeJointStateArray on the configurable topic parameter.

Parameters

frame_id - Name of the MuJoCo body every published pose/twist is expressed relative to. Empty (the default) means the world frame. body_names - Names of the free-joint bodies to publish. Empty (the default) means every free-joint body in the model. topic - Output topic name. Defaults to "free_joint_states". publish_rate - Publish frequency in Hz. Defaults to 50.0.

Frame semantics

When frame_id names another body, poses are expressed relative to that body's current world pose, and twists are rotated into that body's current world orientation without subtracting the reference body's own velocity.

Member Function Documentation

◆ cleanup()

void mujoco_ros2_control_plugins::FreeJointStatePublisherPlugin::cleanup ( )
overridevirtual

◆ init()

bool mujoco_ros2_control_plugins::FreeJointStatePublisherPlugin::init ( rclcpp::Node::SharedPtr  node,
const mjModel *  model,
mjData *  data 
)
overridevirtual

Initialize the plugin.

Parameters
nodeShared pointer to the ROS 2 node for accessing parameters
modelPointer to the MuJoCo model
dataPointer 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.

◆ update_write()

void mujoco_ros2_control_plugins::FreeJointStatePublisherPlugin::update_write ( const mjModel *  model,
mjData *  data 
)
overridevirtual

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
modelPointer to the MuJoCo model
dataPointer 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 files: