Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

realsense2: add enable_depth flag to disable publishing point clouds #339

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/plugins/realsense2/realsense2_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Realsense2Thread::init()
laser_power_ = config->get_float_or_default((cfg_prefix + "laser_power").c_str(), -1);

cfg_use_switch_ = config->get_bool_or_default((cfg_prefix + "use_switch").c_str(), true);
enable_depth_ = config->get_bool_or_default((cfg_prefix + "enable_depth").c_str(), false);

//rgb image path
rgb_path_ =
Expand Down Expand Up @@ -143,14 +144,10 @@ Realsense2Thread::loop()
}
}

if (cfg_use_switch_) {
read_switch();
}

if (enable_camera_ && !depth_enabled_) {
if (enable_camera_ && enable_depth_ && !depth_enabled_) {
enable_depth_stream();
return;
} else if (!enable_camera_ && depth_enabled_) {
} else if ((!enable_camera_ || !enable_depth_) && depth_enabled_) {
disable_depth_stream();
return;
} else if (!depth_enabled_) {
Expand Down
1 change: 1 addition & 0 deletions src/plugins/realsense2/realsense2_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class Realsense2Thread : public fawkes::Thread,
bool camera_running_ = false;
bool enable_camera_ = true;
bool depth_enabled_ = false;
bool enable_depth_ = false;
uint restart_after_num_errors_;
uint error_counter_ = 0;

Expand Down