ros2_control - iron
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
mujoco_ros2_control::MujocoCameras Class Reference

Wraps MuJoCo cameras for publishing ROS 2 RGB-D streams. More...

#include <mujoco_cameras.hpp>

Public Types

using GlfwInitFn = std::function< int()>
 

Public Member Functions

 MujocoCameras (rclcpp::Node::SharedPtr node, std::recursive_mutex *sim_mutex, mjData *mujoco_data, mjModel *mujoco_model, double camera_publish_rate)
 Constructs a new MujocoCameras wrapper object.
 
void init (GlfwInitFn glfw_init_fn=glfwInit)
 Starts the image processing thread in the background.
 
void close ()
 Stops the camera processing thread and closes the relevant objects, call before shutdown.
 
void register_cameras (const hardware_interface::HardwareInfo &hardware_info)
 Parses camera information from the mujoco model.
 

Detailed Description

Wraps MuJoCo cameras for publishing ROS 2 RGB-D streams.

Member Typedef Documentation

◆ GlfwInitFn

using mujoco_ros2_control::MujocoCameras::GlfwInitFn = std::function<int()>

Signature of the GLFW initializer; injectable for testing.

Constructor & Destructor Documentation

◆ MujocoCameras()

mujoco_ros2_control::MujocoCameras::MujocoCameras ( rclcpp::Node::SharedPtr  node,
std::recursive_mutex *  sim_mutex,
mjData *  mujoco_data,
mjModel *  mujoco_model,
double  camera_publish_rate 
)
explicit

Constructs a new MujocoCameras wrapper object.

Parameters
nodeWill be used to construct image publishers
sim_mutexProvides synchronized access to the mujoco_data object for rendering
mujoco_dataMuJoCo data for the simulation
mujoco_modelMuJoCo model for the simulation
camera_publish_rateThe rate to publish all camera images, for now all images are published at the same rate.

Member Function Documentation

◆ init()

void mujoco_ros2_control::MujocoCameras::init ( GlfwInitFn  glfw_init_fn = glfwInit)

Starts the image processing thread in the background.

Does nothing when no cameras have been registered. The background thread will initialize its own offscreen GLFW context for rendering images that is separate from the Simulate application, as the context must be created in the running thread.

Parameters
glfw_init_fnCallable used to initialize GLFW; defaults to ::glfwInit. Override in tests to simulate a display-capable environment without a real GPU.

The documentation for this class was generated from the following files: