3 #include <geometry_msgs/msg/pose_stamped.hpp>
4 #include <geometry_msgs/msg/transform_stamped.hpp>
5 #include <geometry_msgs/msg/twist_stamped.hpp>
6 #include <rclcpp/rclcpp.hpp>
7 #include <tf2_ros/transform_broadcaster.h>
9 #include <mujoco/mjdata.h>
10 #include <mujoco/mjmodel.h>
11 #include <mujoco/mjtnum.h>
12 #include <mujoco/mjvisualize.h>
41 void reset(
const mjModel * m,
int plugin_id);
48 void compute(
const mjModel * m, mjData * d,
int plugin_id);
65 const std::string & frame_id,
66 const std::string & pose_topic_name,
67 const std::string & vel_topic_name,
70 const std::string & tf_child_frame_id);
80 rclcpp::Node::SharedPtr
nh_;
83 rclcpp::Publisher<geometry_msgs::msg::PoseStamped>::SharedPtr
pose_pub_;
86 rclcpp::Publisher<geometry_msgs::msg::TwistStamped>::SharedPtr
vel_pub_;
89 std::unique_ptr<tf2_ros::TransformBroadcaster>
tf_br_;
Plugin to publish topics or broadcast TF of pose and velocity of the body.
static void RegisterPlugin()
Register plugin.
std::string frame_id_
Frame ID of topics header or TF parent.
std::string vel_topic_name_
Topic name of velocity.
std::string tf_child_frame_id_
Child frame ID for TF.
rclcpp::Node::SharedPtr nh_
ROS node handle.
void reset(const mjModel *m, int plugin_id)
Reset.
PosePublisher(PosePublisher &&)=default
Copy constructor.
std::string pose_topic_name_
Topic name of pose.
rclcpp::Publisher< geometry_msgs::msg::PoseStamped >::SharedPtr pose_pub_
ROS publisher for pose.
int publish_skip_
Iteration interval to skip ROS publish.
std::unique_ptr< tf2_ros::TransformBroadcaster > tf_br_
TF broadcaster.
static PosePublisher * Create(const mjModel *m, mjData *d, int plugin_id)
Create an instance.
void compute(const mjModel *m, mjData *d, int plugin_id)
Compute.
bool output_tf_
Whether to broadcast TF.
rclcpp::Publisher< geometry_msgs::msg::TwistStamped >::SharedPtr vel_pub_
ROS publisher for velocity.
int sim_cnt_
Iteration count of simulation.