mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-10-04 20:17:47 +08:00
Merge branch 'lyrical' into v2/develop
This commit is contained in:
@@ -139,9 +139,9 @@ class CameraExampleNode : public rclcpp::Node {
|
||||
"/camera/device_status", 10,
|
||||
std::bind(&CameraExampleNode::deviceStatusCallback, this, std::placeholders::_1));
|
||||
|
||||
while (rclcpp::ok()) {
|
||||
rclcpp::spin_some(shared_from_this());
|
||||
}
|
||||
rclcpp::executors::SingleThreadedExecutor executor;
|
||||
executor.add_node(shared_from_this());
|
||||
executor.spin();
|
||||
}
|
||||
|
||||
// Feature 7: Set Color AE ROI
|
||||
|
||||
Regular → Executable
+18
-3
@@ -1,8 +1,17 @@
|
||||
#include <rclcpp/rclcpp.hpp>
|
||||
#include <sensor_msgs/msg/image.hpp>
|
||||
|
||||
#if __has_include(<message_filters/subscriber.hpp>)
|
||||
#include <message_filters/subscriber.hpp>
|
||||
#include <message_filters/sync_policies/approximate_time.hpp>
|
||||
#include <message_filters/synchronizer.hpp>
|
||||
#elif __has_include(<message_filters/subscriber.h>)
|
||||
#include <message_filters/subscriber.h>
|
||||
#include <message_filters/sync_policies/approximate_time.h>
|
||||
#include <message_filters/synchronizer.h>
|
||||
#include <rclcpp/rclcpp.hpp>
|
||||
#include <sensor_msgs/msg/image.hpp>
|
||||
#else
|
||||
#error "No compatible message_filters headers found"
|
||||
#endif
|
||||
|
||||
#if __has_include(<cv_bridge/cv_bridge.hpp>)
|
||||
#include <cv_bridge/cv_bridge.hpp>
|
||||
@@ -79,13 +88,19 @@ class ImageSyncNode : public rclcpp::Node {
|
||||
rclcpp::QoS qos{rclcpp::KeepLast(queue_size_)};
|
||||
qos.reliable();
|
||||
|
||||
#ifdef ORBBEC_MESSAGE_FILTERS_USES_RCLCPP_QOS
|
||||
const rclcpp::QoS qos_prof = qos;
|
||||
#else
|
||||
const rmw_qos_profile_t qos_prof = qos.get_rmw_qos_profile();
|
||||
#endif
|
||||
|
||||
if (sync_topics_.size() == 1) {
|
||||
single_sub_ = this->create_subscription<Image>(
|
||||
sync_topics_.front(), qos,
|
||||
[this](const ImageConstPtr msg) { this->handle_synced_images({msg}); });
|
||||
} else {
|
||||
for (size_t i = 0; i < sync_topics_.size(); ++i) {
|
||||
subscribers_[i].subscribe(this, sync_topics_[i], qos.get_rmw_qos_profile());
|
||||
subscribers_[i].subscribe(this, sync_topics_[i], qos_prof);
|
||||
}
|
||||
create_synchronizer();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user