mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-10-04 20:17:47 +08:00
Implementing flip function for data stream.
This commit is contained in:
@@ -334,6 +334,7 @@ class OBCameraNode {
|
|||||||
ob::FormatConvertFilter format_convert_filter_;
|
ob::FormatConvertFilter format_convert_filter_;
|
||||||
|
|
||||||
std::map<stream_index_pair, bool> enable_stream_;
|
std::map<stream_index_pair, bool> enable_stream_;
|
||||||
|
std::map<stream_index_pair, bool> flip_stream_;
|
||||||
std::map<stream_index_pair, std::string> stream_name_;
|
std::map<stream_index_pair, std::string> stream_name_;
|
||||||
std::map<stream_index_pair, image_transport::Publisher> image_publishers_;
|
std::map<stream_index_pair, image_transport::Publisher> image_publishers_;
|
||||||
std::map<stream_index_pair, rclcpp::Publisher<sensor_msgs::msg::CameraInfo>::SharedPtr>
|
std::map<stream_index_pair, rclcpp::Publisher<sensor_msgs::msg::CameraInfo>::SharedPtr>
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ def generate_launch_description():
|
|||||||
DeclareLaunchArgument('color_fps', default_value='30'),
|
DeclareLaunchArgument('color_fps', default_value='30'),
|
||||||
DeclareLaunchArgument('color_format', default_value='RGB'),
|
DeclareLaunchArgument('color_format', default_value='RGB'),
|
||||||
DeclareLaunchArgument('enable_color', default_value='true'),
|
DeclareLaunchArgument('enable_color', default_value='true'),
|
||||||
DeclareLaunchArgument('flip_color', default_value='false'),
|
|
||||||
DeclareLaunchArgument('color_qos', default_value='default'),
|
DeclareLaunchArgument('color_qos', default_value='default'),
|
||||||
DeclareLaunchArgument('color_camera_info_qos', default_value='default'),
|
DeclareLaunchArgument('color_camera_info_qos', default_value='default'),
|
||||||
DeclareLaunchArgument('enable_color_auto_exposure', default_value='true'),
|
DeclareLaunchArgument('enable_color_auto_exposure', default_value='true'),
|
||||||
|
|||||||
@@ -149,6 +149,29 @@ void OBCameraNode::setupDevices() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (const auto &stream_index : IMAGE_STREAMS) {
|
||||||
|
if (enable_stream_[stream_index]) {
|
||||||
|
OBPropertyID mirrorPropertyID = OB_PROP_DEPTH_MIRROR_BOOL;
|
||||||
|
if(stream_index == COLOR){
|
||||||
|
mirrorPropertyID = OB_PROP_COLOR_MIRROR_BOOL;
|
||||||
|
} else if(stream_index == DEPTH) {
|
||||||
|
mirrorPropertyID = OB_PROP_DEPTH_MIRROR_BOOL;
|
||||||
|
} else if(stream_index == INFRA0) {
|
||||||
|
mirrorPropertyID = OB_PROP_IR_MIRROR_BOOL;
|
||||||
|
|
||||||
|
} else if(stream_index == INFRA1) {
|
||||||
|
mirrorPropertyID = OB_PROP_IR_MIRROR_BOOL;
|
||||||
|
}
|
||||||
|
else if(stream_index == INFRA2) {
|
||||||
|
mirrorPropertyID = OB_PROP_IR_RIGHT_MIRROR_BOOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(device_->isPropertySupported(mirrorPropertyID, OB_PERMISSION_WRITE)) {
|
||||||
|
device_->setBoolProperty(mirrorPropertyID, flip_stream_[stream_index]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
device_->setBoolProperty(OB_PROP_DEPTH_SOFT_FILTER_BOOL, enable_soft_filter_);
|
device_->setBoolProperty(OB_PROP_DEPTH_SOFT_FILTER_BOOL, enable_soft_filter_);
|
||||||
device_->setBoolProperty(OB_PROP_COLOR_AUTO_EXPOSURE_BOOL, enable_color_auto_exposure_);
|
device_->setBoolProperty(OB_PROP_COLOR_AUTO_EXPOSURE_BOOL, enable_color_auto_exposure_);
|
||||||
device_->setBoolProperty(OB_PROP_IR_AUTO_EXPOSURE_BOOL, enable_ir_auto_exposure_);
|
device_->setBoolProperty(OB_PROP_IR_AUTO_EXPOSURE_BOOL, enable_ir_auto_exposure_);
|
||||||
@@ -374,6 +397,8 @@ void OBCameraNode::getParameters() {
|
|||||||
setAndGetNodeParameter(fps_[stream_index], param_name, IMAGE_FPS);
|
setAndGetNodeParameter(fps_[stream_index], param_name, IMAGE_FPS);
|
||||||
param_name = "enable_" + stream_name_[stream_index];
|
param_name = "enable_" + stream_name_[stream_index];
|
||||||
setAndGetNodeParameter(enable_stream_[stream_index], param_name, false);
|
setAndGetNodeParameter(enable_stream_[stream_index], param_name, false);
|
||||||
|
param_name = "flip_" + stream_name_[stream_index];
|
||||||
|
setAndGetNodeParameter(flip_stream_[stream_index], param_name, false);
|
||||||
param_name = camera_name_ + "_" + stream_name_[stream_index] + "_frame_id";
|
param_name = camera_name_ + "_" + stream_name_[stream_index] + "_frame_id";
|
||||||
std::string default_frame_id = camera_name_ + "_" + stream_name_[stream_index] + "_frame";
|
std::string default_frame_id = camera_name_ + "_" + stream_name_[stream_index] + "_frame";
|
||||||
setAndGetNodeParameter(frame_id_[stream_index], param_name, default_frame_id);
|
setAndGetNodeParameter(frame_id_[stream_index], param_name, default_frame_id);
|
||||||
|
|||||||
Reference in New Issue
Block a user