26 #define MM_TO_METER 1/1000 27 #define MIN_ALGO_VERSION 115 31 using namespace ivcam2;
39 if (response_vec.empty())
54 if (expected_size > response_vec.size() ||
58 to_string() <<
"Calibration data invalid, number of resolutions is: " << num_of_resolutions <<
59 ", expected size: " << expected_size <<
" , actual size: " << response_vec.size() );
65 librealsense::copy(&resolutions_depth_table_output, resolutions_depth_table_ptr, expected_size);
67 return resolutions_depth_table_output;
82 std::make_shared< l500_temperature_options >(
this,
84 "Laser Driver temperature" ) );
88 std::make_shared< l500_temperature_options >(
this,
90 "Mems Controller temperature" ) );
94 std::make_shared< l500_temperature_options >(
this,
96 "DSP controller temperature" ) );
100 std::make_shared< l500_temperature_options >(
this,
102 "Avalanche Photo Diode temperature" ) );
106 std::make_shared< l500_temperature_options >(
this,
108 "Humidity temperature" ) );
112 std::make_shared< nest_option >(
this,
"Noise estimation" ) );
125 raw_depth_sensor.get_notifications_processor(),
126 std::make_shared<l500_notification_decoder>());
167 std::vector<tagged_profile>
tags;
171 int width = usb3mode ? 640 : 320;
172 int height = usb3mode ? 480 : 240;
183 std::vector<std::shared_ptr<matcher>> depth_matchers;
187 for (
auto&
s : streams)
189 depth_matchers.push_back(std::make_shared<identity_matcher>(
s->get_unique_id(),
s->get_stream_type()));
191 std::vector<std::shared_ptr<matcher>> matchers;
192 matchers.push_back(std::make_shared<timestamp_composite_matcher>(depth_matchers));
194 return std::make_shared<timestamp_composite_matcher>(matchers);
205 _user_callback(user_callback),
206 _user_requests(user_requests) {}
212 _user_callback->on_frame( f );
226 return std::find_if(_user_requests.begin(), _user_requests.end(), [&](std::shared_ptr<stream_profile_interface> sp)
228 return stream_profiles_equal(frame->
get_stream().get(), sp.get());
229 }) != _user_requests.end();
241 vl->get_width() == vr->get_width() &&
242 vl->get_height() == vr->get_height() &&
243 vl->get_stream_type() == vr->get_stream_type();
253 std::map<uint32_t, rs2_format> l500_depth_fourcc_to_rs2_format_map,
254 std::map<uint32_t, rs2_stream> l500_depth_fourcc_to_rs2_stream_map
259 l500_depth_fourcc_to_rs2_format_map,
260 l500_depth_fourcc_to_rs2_stream_map )
281 const int algo_version_address = 0xa0020bd8;
286 throw std::runtime_error(
"Invalid result size!");
314 table.params.model = RS2_DSM_CORRECTION_AOT;
315 table.params.h_scale = table.params.v_scale = 1.;
328 if( ! getenv(
"RS2_AC_IGNORE_LIMITERS" ))
330 AC_LOG( ERROR,
"Ignoring (RS2_AC_IGNORE_LIMITERS) " << e.
what() );
337 table.params.timestamp = mktime( gmtime( &t ) );
340 AC_LOG(
INFO,
"Overriding DSM : " << table.params );
348 AC_LOG(
INFO,
"Depth sensor calibration has been reset" );
384 to_string() <<
"Gain trim FW command failed: size expected: " <<
sizeof(
uint8_t)
385 <<
" , size received: " <<
res.size());
388 int gtr =
static_cast<int>(
res[0]);
393 return ((apd == 9) && (gtr == 0) && (laser_power == max_laser_power));
399 const int baseline_address = 0xa00e0868;
404 throw std::runtime_error(
"Invalid result size!");
406 auto data = (
float*)
res.data();
413 if (
intrin.resolution.num_of_resolutions < 1)
415 throw std::runtime_error(
"Invalid intrinsics!");
417 auto znorm =
intrin.resolution.intrinsic_resolution[0].world.znorm;
423 using namespace ivcam2;
425 return intrinsic.orient.depth_offset;
430 std::lock_guard<std::recursive_mutex>
lock(_mtx);
433 if (has_metadata_ts(frame))
442 LOG_WARNING(
"UVC metadata payloads are not available for stream " 444 <<
". Please refer to installation chapter for details.");
445 one_time_note =
true;
447 return _backup_timestamp_reader->get_frame_timestamp(frame);
453 std::lock_guard<std::recursive_mutex>
lock(_mtx);
456 if (has_metadata_fc(frame))
458 auto md = (
byte*)(
f->additional_data.metadata_blob.data());
460 return ((
int*)md)[7];
463 return _backup_timestamp_reader->get_frame_counter(frame);
468 std::lock_guard<std::recursive_mutex>
lock(_mtx);
469 one_time_note =
false;
470 _backup_timestamp_reader->reset();
476 std::lock_guard<std::recursive_mutex>
lock(_mtx);
484 res.push_back(std::make_shared<temporal_filter>());
541 LOG_DEBUG(
"Depth and IR usb tproc granularity and TRB threshold updated.");
544 LOG_WARNING(
"FAILED TO UPDATE depth usb tproc granularity and TRB threshold. performance and stability maybe impacted on certain platforms.");
549 LOG_DEBUG(
"Default host performance mode, Depth/IR/Confidence usb tproc granularity and TRB threshold not changed");
585 vl->get_width() == vr->get_width() &&
586 vl->get_height() == vr->get_height();
596 auto is_rgb_requested
599 []( std::shared_ptr< stream_profile_interface >
const & sp )
602 if( is_rgb_requested )
612 []( std::shared_ptr< stream_profile_interface >
const & sp ) {
617 AC_LOG( ERROR,
"Depth input stream profiles do not contain depth!" );
620 auto requested_depth_profile
624 auto color_profiles =
color_sensor.get_stream_profiles();
625 auto rgb_profile = std::find_if(
626 color_profiles.begin(),
627 color_profiles.end(),
628 [&]( std::shared_ptr< stream_profile_interface >
const & sp )
632 && vsp->get_framerate() == requested_depth_profile->get_framerate()
634 && vsp->get_width() == 1280
635 && vsp->get_height() == 720;
637 if( rgb_profile == color_profiles.end() )
640 "Can't find color stream corresponding to depth; AC will not work" );
653 = std::find_if( requests.begin(),
655 []( std::shared_ptr< stream_profile_interface >
const & sp ) {
661 = std::find_if( requests.begin(),
663 []( std::shared_ptr< stream_profile_interface >
const & sp ) {
672 if( ! is_ir_requested && is_ir_needed )
674 auto user_request = std::find_if(requests.begin(), requests.end(), [](std::shared_ptr<stream_profile_interface> sp)
677 if (user_request == requests.end())
678 throw std::runtime_error(
to_string() <<
"input stream_profiles is invalid");
684 auto corresponding_ir = std::find_if(sp.begin(), sp.end(), [&](std::shared_ptr<stream_profile_interface> sp)
690 if (corresponding_ir == sp.end())
691 throw std::runtime_error(
to_string() <<
"can't find ir stream corresponding to user request");
697 auto dp = std::find_if( requests.begin(),
699 []( std::shared_ptr< stream_profile_interface > sp ) {
714 LOG_ERROR(
"Exception caught in l500_depth_sensor::open" );
rs2_sensor_mode get_resolution_from_width_height(int width, int height)
std::shared_ptr< hw_monitor > _hw_monitor
static const textual_icon lock
virtual void register_option(rs2_option id, std::shared_ptr< option > option)
const uint8_t L500_ERROR_REPORTING
float get_max_usable_depth_range() const override
bool stream_profiles_equal(stream_profile_interface *l, stream_profile_interface *r)
static const double TIMESTAMP_USEC_TO_MSEC
rs2_stream get_stream_type() const override
frame_callback_ptr _user_callback
uint8_t num_of_resolutions
void open(const stream_profiles &requests) override
void start_temperatures_reader()
std::shared_ptr< rs2_frame_callback > frame_callback_ptr
l500_depth(std::shared_ptr< context > ctx, const platform::backend_device_group &group)
stream_profiles get_stream_profiles(int tag=profile_tag::PROFILE_TAG_ANY) const override
Video DSM (Digital Sync Module) parameters for calibration (same layout as in FW ac_depth_params) Thi...
virtual l500_color_sensor * get_color_sensor()=0
std::shared_ptr< stream_profile_interface > is_color_sensor_needed() const
void register_same_extrinsics(const stream_interface &from, const stream_interface &to)
static processing_blocks get_l500_recommended_proccesing_blocks()
bool supports_option(rs2_option id) const override
bool is_user_requested_frame(frame_interface *frame)
platform::usb_spec _usb_mode
rs2_host_perf_mode
values for RS2_OPTION_HOST_PERFORMANCE option.
virtual option_range get_range() const =0
option & get_option(rs2_option id) override
ivcam2::intrinsic_depth get_intrinsic() const override
std::shared_ptr< stream_interface > _depth_stream
virtual float query() const =0
void open(const stream_profiles &requests) override
std::shared_ptr< ivcam2::ac_trigger > _autocal
stream_profiles _user_requests
std::vector< tagged_profile > get_profiles_tags() const override
std::shared_ptr< stream_interface > _confidence_stream
stream_profiles _user_requests
firmware_version _fw_version
l500_depth_sensor(l500_device *owner, std::shared_ptr< uvc_sensor > uvc_sensor, std::map< uint32_t, rs2_format > l500_depth_sourcc_to_rs2_format_map, std::map< uint32_t, rs2_stream > l500_depth_sourcc_to_rs2_stream_map)
resolutions_depth resolution
stream_profiles get_debug_stream_profiles() const override
void start(frame_callback_ptr callback) override
bool is_max_range_preset() const
std::shared_ptr< stream_interface > _ir_stream
l500_depth_sensor & get_depth_sensor()
GLint GLsizei GLsizei height
uint32_t laser_power_mode
void reset_calibration() override
float max_usable_range(float nest)
void do_after_delay(std::function< void()> action, int milliseconds=2000)
void override_intrinsics(rs2_intrinsics const &intr) override
lazy< ivcam2::intrinsic_depth > _calib_table
std::shared_ptr< md_attribute_parser_base > make_uvc_header_parser(Attribute St::*attribute, attrib_modifyer mod=nullptr)
A utility function to create UVC metadata header parser.
uvc_sensor & get_raw_depth_sensor()
void write_fw_table(hw_monitor &hwm, uint16_t const table_id, T const &table, uint16_t const version=0x0100)
frame_filter(frame_callback_ptr user_callback, const stream_profiles &user_requests)
std::vector< std::shared_ptr< stream_profile_interface >> stream_profiles
float read_baseline() const override
bool is_streaming() const override
static environment & get_instance()
#define AC_LOG(TYPE, MSG)
extrinsics_graph & get_extrinsics_graph()
ivcam2::intrinsic_depth read_intrinsics_table() const
bool stream_profiles_correspond(stream_profile_interface *l, stream_profile_interface *r)
GLenum GLenum GLsizei void * table
void validate_dsm_params(struct rs2_dsm_params const &dsm_params)
Cross-stream extrinsics: encodes the topology describing how the different devices are oriented...
action_delayer _action_delayer
static const uint16_t this_version
void stop_temperatures_reader()
virtual std::shared_ptr< stream_profile_interface > get_stream() const =0
GLuint GLfloat GLfloat GLfloat x1
void set(float value) override
std::shared_ptr< md_attribute_parser_base > make_attribute_parser(Attribute S::*attribute, Flag flag, unsigned long long offset, attrib_modifyer mod=nullptr)
A helper function to create a specialized attribute parser. Return it as a pointer to a base-class...
void override_dsm_params(rs2_dsm_params const &dsm_params) override
std::shared_ptr< polling_error_handler > _polling_error_handler
const char * what() const noexceptoverride
void on_frame(rs2_frame *f) override
void start(frame_callback_ptr callback) override
void register_stream_to_extrinsic_group(const stream_interface &stream, uint32_t groupd_index)
void read_fw_table(hw_monitor &hwm, int table_id, T *ptable, table_header *pheader=nullptr, std::function< void() > init=nullptr)
auto group_multiple_fw_calls(synthetic_sensor &s, T action) -> decltype(action())
virtual uint32_t get_framerate() const =0
#define offsetof(STRUCTURE, FIELD)
l500_device *const _owner
const platform::extension_unit depth_xu
float get_depth_offset() const
static const int MAX_NUM_OF_DEPTH_RESOLUTIONS
static const int table_id
stream_profiles _validator_requests
uint32_t sensor_timestamp
void override_extrinsics(rs2_extrinsics const &extr) override
rs2_dsm_params get_dsm_params() const override
std::shared_ptr< matcher > create_matcher(const frame_holder &frame) const override
ivcam2::extended_temperatures get_temperatures() const
struct rs2_frame rs2_frame
void copy(void *dst, void const *src, size_t size)
std::string to_string(T value)
rs2_timestamp_domain
Specifies the clock in relation to which the frame timestamp was measured.