|
Mujoco KDL Wrapper
0.3.18
MuJoCo + KDL bridge for robot kinematics and dynamics
|
#include <camera_ros.hpp>
Public Member Functions | |
| CameraRosPublisher (rclcpp::Node &node, const mjModel *model, CameraConf conf) | |
| bool | wants_frame (double sim_t) const |
| void | publish (const std::uint8_t *rgb, double sim_t) |
| const sensor_msgs::msg::CameraInfo & | camera_info () const |
Publishes an already-rendered RGB frame as sensor_msgs/Image plus its CameraInfo.
A frame sink, not a renderer: it creates no node, no executor and no thread, and never touches mjModel or mjData after construction. Call it from the thread that rendered the frame - render once, hand the same buffer to whatever else consumes it.
Intrinsics are read from the model's cam_fovy at construction, so the published K is the one MuJoCo rendered with. Pixels are published exactly as rendered: a MuJoCo camera looks along its -Z with +Y up, so frame_id must name a frame already rotated into the ROS optical convention, or every pose a consumer estimates comes out rotated.
CameraRosPublisher pub(*node, model, conf); if (pub.wants_frame(t) && render_rgb(&vr, model, data, rgb.data())) pub.publish(rgb.data(), t);
Definition at line 47 of file camera_ros.hpp.
| mj_kdl::CameraRosPublisher::CameraRosPublisher | ( | rclcpp::Node & | node, |
| const mjModel * | model, | ||
| CameraConf | conf ) |
|
inline |
The CameraInfo published alongside every frame; built once, only its stamp changes.
Definition at line 59 of file camera_ros.hpp.
Referenced by TEST_F().
| void mj_kdl::CameraRosPublisher::publish | ( | const std::uint8_t * | rgb, |
| double | sim_t ) |
One top-down RGB frame, width * height * 3 bytes, stamped with the sim time it shows.
| bool mj_kdl::CameraRosPublisher::wants_frame | ( | double | sim_t | ) | const |
Due by rate, and somebody is subscribed to the image topic. No frame is touched.
Referenced by TEST_F().