Skip to content

Commit 11314e8

Browse files
committed
Add more debug log
1 parent 25cf0c7 commit 11314e8

File tree

5 files changed

+45
-7
lines changed

5 files changed

+45
-7
lines changed

README.MD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ The following launch parameters are available:
241241
recognized as USB 2.0.
242242
It is recommended to set this parameter to `false` when using a USB 2.0 connection to avoid unnecessary resets.
243243

244+
**IMPORTANT**: *Please carefully read the instructions regarding software filtering settings at [this link](https://www.orbbec.com/docs/g330-use-depth-post-processing-blocks/). If you are uncertain, do not modify these settings.*
244245
## Depth work mode switch:
245246

246247
- Before starting the camera, depth work mode (depth_work_mode) can be configured for the corresponding xxx.launch

include/orbbec_camera/utils.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ bool isOpenNIDevice(int pid);
5757

5858
OBMultiDeviceSyncMode OBSyncModeFromString(const std::string &mode);
5959

60+
std::string OBSyncModeToString(const OBMultiDeviceSyncMode &mode);
61+
62+
std::ostream &operator<<(std::ostream &os, const OBMultiDeviceSyncMode &rhs);
63+
6064
OB_SAMPLE_RATE sampleRateFromString(std::string &sample_rate);
6165

6266
std::string sampleRateToString(const OB_SAMPLE_RATE &sample_rate);

src/ob_camera_node.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,6 @@ void OBCameraNode::getParameters() {
142142
ir_exposure_ = nh_private_.param<int>("ir_exposure_", -1);
143143
enable_ir_long_exposure_ = nh_private_.param<bool>("enable_ir_long_exposure", false);
144144
sync_mode_str_ = nh_private_.param<std::string>("sync_mode", "standalone");
145-
std::transform(sync_mode_str_.begin(), sync_mode_str_.end(), sync_mode_str_.begin(), ::toupper);
146-
sync_mode_ = OBSyncModeFromString(sync_mode_str_);
147145
depth_delay_us_ = nh_private_.param<int>("depth_delay_us", 0);
148146
color_delay_us_ = nh_private_.param<int>("color_delay_us", 0);
149147
trigger2image_delay_us_ = nh_private_.param<int>("trigger2image_delay_us", 0);
@@ -199,7 +197,7 @@ void OBCameraNode::getParameters() {
199197
sequence_id_filter_id_ = nh_private_.param<int>("sequence_id_filter_id", -1);
200198
threshold_filter_max_ = nh_private_.param<int>("threshold_filter_max", -1);
201199
threshold_filter_min_ = nh_private_.param<int>("threshold_filter_min", -1);
202-
noise_removal_filter_min_diff_ = nh_private_.param<int>("noise_removal_filter_min_diff", 250);
200+
noise_removal_filter_min_diff_ = nh_private_.param<int>("noise_removal_filter_min_diff", 256);
203201
noise_removal_filter_max_size_ = nh_private_.param<int>("noise_removal_filter_max_size", 80);
204202
spatial_filter_alpha_ = nh_private_.param<float>("spatial_filter_alpha", -1.0);
205203
spatial_filter_diff_threshold_ = nh_private_.param<int>("spatial_filter_diff_threshold", -1);

src/ros_setup.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,19 +125,25 @@ void OBCameraNode::setupDevices() {
125125
if (!device_preset_.empty()) {
126126
device_->loadPreset(device_preset_.c_str());
127127
}
128-
if (sync_mode_ != OB_MULTI_DEVICE_SYNC_MODE_FREE_RUN) {
128+
if (!sync_mode_str_.empty() &&
129+
device_->isPropertySupported(OB_PROP_SYNC_SIGNAL_TRIGGER_OUT_BOOL,
130+
OB_PERMISSION_READ_WRITE)) {
129131
auto sync_config = device_->getMultiDeviceSyncConfig();
132+
ROS_INFO_STREAM("current sync mode: " << sync_config.syncMode);
133+
std::transform(sync_mode_str_.begin(), sync_mode_str_.end(), sync_mode_str_.begin(),
134+
::toupper);
135+
sync_mode_ = OBSyncModeFromString(sync_mode_str_);
130136
sync_config.syncMode = sync_mode_;
131137
sync_config.depthDelayUs = depth_delay_us_;
132138
sync_config.colorDelayUs = color_delay_us_;
133139
sync_config.trigger2ImageDelayUs = trigger2image_delay_us_;
134140
sync_config.triggerOutDelayUs = trigger_out_delay_us_;
135141
sync_config.triggerOutEnable = trigger_out_enabled_;
136142
device_->setMultiDeviceSyncConfig(sync_config);
137-
if (device_->isPropertySupported(OB_PROP_SYNC_SIGNAL_TRIGGER_OUT_BOOL,
138-
OB_PERMISSION_READ_WRITE)) {
139-
}
143+
sync_config = device_->getMultiDeviceSyncConfig();
144+
ROS_INFO_STREAM("set sync mode to " << sync_config.syncMode);
140145
}
146+
141147
auto depth_sensor = device_->getSensor(OB_SENSOR_DEPTH);
142148
device_->setBoolProperty(OB_PROP_DEPTH_AUTO_EXPOSURE_BOOL, enable_ir_auto_exposure_);
143149
device_->setBoolProperty(OB_PROP_COLOR_AUTO_EXPOSURE_BOOL, enable_color_auto_exposure_);
@@ -244,6 +250,8 @@ void OBCameraNode::setupDevices() {
244250
if (noise_removal_filter_min_diff_ != -1 && noise_removal_filter_max_size_ != -1) {
245251
params.disp_diff = noise_removal_filter_min_diff_;
246252
params.max_size = noise_removal_filter_max_size_;
253+
ROS_INFO_STREAM("set NoiseRemovalFilter disp_diff to " << noise_removal_filter_min_diff_);
254+
ROS_INFO_STREAM("set NoiseRemovalFilter max_size to " << noise_removal_filter_max_size_);
247255
noise_removal_filter->setFilterParams(params);
248256
}
249257
} else if (filter_name == "HDRMerge" && enable_hdr_merge_) {
@@ -255,6 +263,7 @@ void OBCameraNode::setupDevices() {
255263
hdr_config.exposure_2 = hdr_merge_exposure_2_;
256264
hdr_config.gain_1 = hdr_merge_gain_1_;
257265
hdr_config.gain_2 = hdr_merge_gain_2_;
266+
hdr_config.enable = true;
258267
ROS_INFO_STREAM("set HDRMerge exposure_1 to " << hdr_merge_exposure_1_);
259268
ROS_INFO_STREAM("set HDRMerge exposure_2 to " << hdr_merge_exposure_2_);
260269
ROS_INFO_STREAM("set HDRMerge gain_1 to " << hdr_merge_gain_1_);

src/utils.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,32 @@ OBMultiDeviceSyncMode OBSyncModeFromString(const std::string &mode) {
456456
}
457457
}
458458

459+
std::string OBSyncModeToString(const OBMultiDeviceSyncMode &mode) {
460+
switch (mode) {
461+
case OBMultiDeviceSyncMode::OB_MULTI_DEVICE_SYNC_MODE_FREE_RUN:
462+
return "FREE_RUN";
463+
case OBMultiDeviceSyncMode::OB_MULTI_DEVICE_SYNC_MODE_STANDALONE:
464+
return "STANDALONE";
465+
case OBMultiDeviceSyncMode::OB_MULTI_DEVICE_SYNC_MODE_PRIMARY:
466+
return "PRIMARY";
467+
case OBMultiDeviceSyncMode::OB_MULTI_DEVICE_SYNC_MODE_SECONDARY:
468+
return "SECONDARY";
469+
case OBMultiDeviceSyncMode::OB_MULTI_DEVICE_SYNC_MODE_SECONDARY_SYNCED:
470+
return "SECONDARY_SYNCED";
471+
case OBMultiDeviceSyncMode::OB_MULTI_DEVICE_SYNC_MODE_SOFTWARE_TRIGGERING:
472+
return "SOFTWARE_TRIGGERING";
473+
case OBMultiDeviceSyncMode::OB_MULTI_DEVICE_SYNC_MODE_HARDWARE_TRIGGERING:
474+
return "HARDWARE_TRIGGERING";
475+
default:
476+
return "FREE_RUN";
477+
}
478+
}
479+
480+
std::ostream &operator<<(std::ostream &os, const OBMultiDeviceSyncMode &rhs) {
481+
os << OBSyncModeToString(rhs);
482+
return os;
483+
}
484+
459485
OB_SAMPLE_RATE sampleRateFromString(std::string &sample_rate) {
460486
// covert to lower case
461487
std::transform(sample_rate.begin(), sample_rate.end(), sample_rate.begin(), ::tolower);

0 commit comments

Comments
 (0)