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

Fix bug with depth scale before starting device #3113

Merged
merged 1 commit into from
Jan 30, 2019
Merged
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
6 changes: 3 additions & 3 deletions src/ds5/ds5-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ namespace librealsense
explicit ds5_depth_sensor(ds5_device* owner,
std::shared_ptr<platform::uvc_device> uvc_device,
std::unique_ptr<frame_timestamp_reader> timestamp_reader)
: uvc_sensor(ds::DEPTH_STEREO, uvc_device, move(timestamp_reader), owner), _owner(owner), _depth_units(0)
: uvc_sensor(ds::DEPTH_STEREO, uvc_device, move(timestamp_reader), owner), _owner(owner), _depth_units(-1)
{}

rs2_intrinsics get_intrinsics(const stream_profile& profile) const override
Expand Down Expand Up @@ -166,7 +166,7 @@ namespace librealsense
return results;
}

float get_depth_scale() const override { return _depth_units; }
float get_depth_scale() const override { if (_depth_units < 0) _depth_units = get_option(RS2_OPTION_DEPTH_UNITS).query(); return _depth_units; }

void set_depth_scale(float val){ _depth_units = val; }

Expand All @@ -193,7 +193,7 @@ namespace librealsense
}
protected:
const ds5_device* _owner;
std::atomic<float> _depth_units;
mutable std::atomic<float> _depth_units;
float _stereo_baseline_mm;
};

Expand Down