feat: add support for publishing raw color MJPG images

This commit is contained in:
slz
2026-05-07 11:44:05 +08:00
parent 9b69bbfa57
commit fc7e255141
2 changed files with 51 additions and 4 deletions
@@ -39,6 +39,7 @@
#include <diagnostic_updater/diagnostic_updater.hpp>
#include <sensor_msgs/msg/camera_info.hpp>
#include <sensor_msgs/msg/compressed_image.hpp>
#include <camera_info_manager/camera_info_manager.hpp>
#include <image_publisher/image_publisher.hpp>
@@ -498,6 +499,10 @@ class OBCameraNode {
bool setupFormatConvertType(OBFormat format);
bool setupFormatConvertType(OBFormat format, ob::FormatConvertFilter& filter);
bool hasCompressedImageSubscriber(const stream_index_pair& stream_index) const;
void publishCompressedColorImage(const std::shared_ptr<ob::Frame>& frame,
const stream_index_pair& stream_index,
const rclcpp::Time& timestamp, const std::string& frame_id);
orbbec_camera_msgs::msg::IMUInfo createIMUInfo(const stream_index_pair& stream_index);
@@ -586,6 +591,8 @@ class OBCameraNode {
std::map<stream_index_pair, int> rotation_stream_;
std::map<stream_index_pair, std::string> stream_name_;
std::map<stream_index_pair, std::shared_ptr<image_publisher>> image_publishers_;
std::map<stream_index_pair, rclcpp::Publisher<sensor_msgs::msg::CompressedImage>::SharedPtr>
compressed_image_publishers_;
std::map<stream_index_pair, rclcpp::Publisher<sensor_msgs::msg::CameraInfo>::SharedPtr>
camera_info_publishers_;
std::map<stream_index_pair, bool> frame_info_logged_;