27#include <GLFW/glfw3.h>
28#include <mujoco/mujoco.h>
30#include <hardware_interface/hardware_info.hpp>
31#include <rclcpp/node.hpp>
32#include <rclcpp/publisher.hpp>
33#include <rclcpp/rclcpp.hpp>
34#include <sensor_msgs/msg/camera_info.hpp>
35#include <sensor_msgs/msg/image.hpp>
46 std::string frame_name;
47 std::string info_topic;
48 std::string image_topic;
49 std::string depth_topic;
54 std::vector<uint8_t> image_buffer;
55 std::vector<float> depth_buffer;
56 std::vector<float> depth_buffer_flipped;
58 sensor_msgs::msg::Image image;
59 sensor_msgs::msg::Image depth_image;
60 sensor_msgs::msg::CameraInfo camera_info;
62 rclcpp::Publisher<sensor_msgs::msg::Image>::SharedPtr image_pub;
63 rclcpp::Publisher<sensor_msgs::msg::Image>::SharedPtr depth_image_pub;
64 rclcpp::Publisher<sensor_msgs::msg::CameraInfo>::SharedPtr camera_info_pub;
82 explicit MujocoCameras(rclcpp::Node::SharedPtr node, std::recursive_mutex* sim_mutex, mjData* mujoco_data,
83 mjModel* mujoco_model,
double camera_publish_rate);
114 rclcpp::Node::SharedPtr node_;
117 std::recursive_mutex* sim_mutex_{
nullptr };
121 mjData* mj_camera_data_;
124 double camera_publish_rate_;
132 std::vector<CameraData> cameras_;
135 std::thread rendering_thread_;
136 std::atomic_bool publish_images_;
Wraps MuJoCo cameras for publishing ROS 2 RGB-D streams.
Definition mujoco_cameras.hpp:71
void register_cameras(const hardware_interface::HardwareInfo &hardware_info)
Parses camera information from the mujoco model.
Definition mujoco_cameras.cpp:40
void close()
Stops the camera processing thread and closes the relevant objects, call before shutdown.
Definition mujoco_cameras.cpp:144
void init()
Starts the image processing thread in the background.
Definition mujoco_cameras.cpp:131
This structure stores information about hardware defined in a robot's URDF.
Definition hardware_info.hpp:106
Definition mujoco_cameras.hpp:41