23#include <condition_variable>
29#include <mujoco/mujoco.h>
31#include <rclcpp/node.hpp>
32#include <rclcpp/publisher.hpp>
33#include <realtime_tools/realtime_publisher.hpp>
34#include <sensor_msgs/msg/laser_scan.hpp>
36#include <mujoco_ros2_control_plugins/mujoco_ros2_control_plugins_base.hpp>
51 std::string frame_name;
55 double angle_increment;
61 std::vector<int> sensor_indexes;
64 std::vector<mjtNum> raw_data;
67 std::string laserscan_topic;
68 sensor_msgs::msg::LaserScan laser_scan_msg;
69 rclcpp::Publisher<sensor_msgs::msg::LaserScan>::SharedPtr scan_pub_raw;
70 std::unique_ptr<realtime_tools::RealtimePublisher<sensor_msgs::msg::LaserScan>> scan_pub;
80class [[deprecated(
"We recommend using the 3d Lidar plugin instead."
85 bool init(rclcpp::Node::SharedPtr node,
const mjModel* model, mjData* data)
override;
86 void update_write(
const mjModel* model, mjData* data)
override;
97 bool register_sensor(
const std::string& lidar_name,
const mjModel* model);
115 static std::pair<std::string, int> parse_lidar_name(
const std::string& sensor_name);
117 rclcpp::Node::SharedPtr node_;
118 const mjModel* model_{
nullptr };
119 double publish_rate_{ 5.0 };
120 rclcpp::Time last_publish_time_{ 0, 0, RCL_ROS_TIME };
122 std::vector<RangefinderLidarData> lidar_sensors_;
Base class for MuJoCo ROS 2 control plugins.
Definition mujoco_ros2_control_plugins_base.hpp:52
Plugin wrapper for MuJoCo rangefinder-based lidar sensors.
Definition rangefinder_lidar_plugin.hpp:83
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 con...
Definition rangefinder_lidar_plugin.cpp:194
void cleanup() override
Cleanup the plugin.
Definition rangefinder_lidar_plugin.cpp:225
bool init(rclcpp::Node::SharedPtr node, const mjModel *model, mjData *data) override
Initialize the plugin.
Definition rangefinder_lidar_plugin.cpp:49
Definition mujoco_ros2_control_plugins_base.hpp:22
Per-lidar bookkeeping for a single named group of MuJoCo rangefinder sensors.
Definition rangefinder_lidar_plugin.hpp:49