Add min depth and max depth limit

This commit is contained in:
Joe Dong
2024-07-17 10:37:58 +08:00
parent e9f053f47f
commit 08037f1289
2 changed files with 13 additions and 1 deletions
@@ -270,7 +270,7 @@ class OBCameraNode {
std::shared_ptr<GetBool::Response>& response); std::shared_ptr<GetBool::Response>& response);
void getLdpMeasureDistanceCallback(const std::shared_ptr<GetInt32::Request>& request, void getLdpMeasureDistanceCallback(const std::shared_ptr<GetInt32::Request>& request,
std::shared_ptr<GetInt32::Response>& response); std::shared_ptr<GetInt32::Response>& response);
bool toggleSensor(const stream_index_pair& stream_index, bool enabled, std::string& msg); bool toggleSensor(const stream_index_pair& stream_index, bool enabled, std::string& msg);
@@ -550,5 +550,7 @@ class OBCameraNode {
uint8_t* rgb_point_cloud_buffer_ = nullptr; uint8_t* rgb_point_cloud_buffer_ = nullptr;
uint32_t rgb_point_cloud_buffer_size_ = 0; uint32_t rgb_point_cloud_buffer_size_ = 0;
bool enable_3d_reconstruction_mode_ = false; bool enable_3d_reconstruction_mode_ = false;
int min_depth_limit_ = 0;
int max_depth_limit_ = 0;
}; };
} // namespace orbbec_camera } // namespace orbbec_camera
+10
View File
@@ -155,6 +155,14 @@ void OBCameraNode::setupDevices() {
device_->setBoolProperty(OB_PROP_DEVICE_USB3_REPEAT_IDENTIFY_BOOL, device_->setBoolProperty(OB_PROP_DEVICE_USB3_REPEAT_IDENTIFY_BOOL,
retry_on_usb3_detection_failure_); retry_on_usb3_detection_failure_);
} }
if (max_depth_limit_ > 0 &&
device_->isPropertySupported(OB_PROP_MAX_DEPTH_INT, OB_PERMISSION_READ_WRITE)) {
device_->setIntProperty(OB_PROP_MAX_DEPTH_INT, max_depth_limit_);
}
if (min_depth_limit_ > 0 &&
device_->isPropertySupported(OB_PROP_MIN_DEPTH_INT, OB_PERMISSION_READ_WRITE)) {
device_->setIntProperty(OB_PROP_MIN_DEPTH_INT, min_depth_limit_);
}
if (laser_energy_level_ != -1 && if (laser_energy_level_ != -1 &&
device_->isPropertySupported(OB_PROP_LASER_ENERGY_LEVEL_INT, OB_PERMISSION_READ_WRITE)) { device_->isPropertySupported(OB_PROP_LASER_ENERGY_LEVEL_INT, OB_PERMISSION_READ_WRITE)) {
RCLCPP_INFO_STREAM(logger_, "Setting laser energy level to " << laser_energy_level_); RCLCPP_INFO_STREAM(logger_, "Setting laser energy level to " << laser_energy_level_);
@@ -1001,6 +1009,8 @@ void OBCameraNode::getParameters() {
if (enable_3d_reconstruction_mode_) { if (enable_3d_reconstruction_mode_) {
laser_on_off_mode_ = 1; // 0 off, 1 on-off, 1 off-on laser_on_off_mode_ = 1; // 0 off, 1 on-off, 1 off-on
} }
setAndGetNodeParameter<int>(min_depth_limit_, "min_depth_limit", 0);
setAndGetNodeParameter<int>(max_depth_limit_, "max_depth_limit", 0);
} }
void OBCameraNode::setupTopics() { void OBCameraNode::setupTopics() {