19 #include "../l500/l500-private.h" 61 std::shared_ptr<sensor_base>
sensor,
70 return _owner->get_motion_intrinsics(stream);
78 for (
auto p : results)
82 assign_stream(_owner->_accel_stream,
p);
84 assign_stream(_owner->_gyro_stream,
p);
91 auto st =
p->get_stream_type();
92 motion->set_intrinsics([
this,
st]() {
return get_motion_intrinsics(
st); });
109 :
synthetic_sensor(
"Wide FOV Camera", sensor, device, fisheye_fourcc_to_rs2_format, fisheye_fourcc_to_rs2_stream),
116 *_owner->_fisheye_calibration_table_raw,
126 for (
auto p : results)
130 assign_stream(_owner->_fisheye_stream,
p);
135 std::weak_ptr<ds5_fisheye_sensor> wp =
137 video->set_intrinsics([
profile, wp]()
141 return sp->get_intrinsics(
profile);
152 auto uvc_raw_sensor = As<uvc_sensor, sensor_base>(get_raw_sensor());
153 return uvc_raw_sensor;
171 const std::vector<platform::hid_device_info>& all_hid_infos,
174 if (all_hid_infos.empty())
176 LOG_WARNING(
"No HID info provided, IMU is disabled");
180 static const char* custom_sensor_fw_ver =
"5.6.0.0";
184 auto enable_global_time_option = std::shared_ptr<global_time_option>(
new global_time_option());
187 std::vector<odr> accel_fps_rates;
188 std::map<unsigned, unsigned> fps_and_frequency_map;
194 for (
auto&& elem : accel_fps_rates)
199 fps_and_sampling_frequency_per_rs2_stream[
RS2_STREAM_ACCEL] = fps_and_frequency_map;
201 auto raw_hid_ep = std::make_shared<hid_sensor>(ctx->get_backend().create_hid_device(all_hid_infos.front()),
204 fps_and_sampling_frequency_per_rs2_stream,
205 sensor_name_and_hid_profiles,
208 auto hid_ep = std::make_shared<ds5_hid_sensor>(
"Motion Module", raw_hid_ep,
this,
this);
213 std::shared_ptr<enable_motion_correction> mm_correct_opt =
nullptr;
220 mm_correct_opt = std::make_shared<enable_motion_correction>(hid_ep.get(),
227 hid_ep->register_processing_block(
230 [&, mm_correct_opt]() {
return std::make_shared<acceleration_transform>(_mm_calib, mm_correct_opt);
233 hid_ep->register_processing_block(
236 [&, mm_correct_opt]() {
return std::make_shared<gyroscope_transform>(_mm_calib, mm_correct_opt);
243 std::make_shared<motion_module_temperature_option>(*raw_hid_ep));
251 auto uvc_raw_sensor = As<uvc_sensor, sensor_base>(ep->
get_raw_sensor());
254 auto exposure_option = std::make_shared<uvc_xu_option<uint16_t>>(*uvc_raw_sensor,
258 auto ae_state = std::make_shared<auto_exposure_state>();
259 auto auto_exposure = std::make_shared<auto_exposure_mechanism>(*gain_option, *exposure_option, *ae_state);
261 auto auto_exposure_option = std::make_shared<enable_auto_exposure_option>(ep,
269 std::make_shared<auto_exposure_mode_option>(auto_exposure,
272 std::map<float, std::string>{{0.f,
"Static"},
273 {1.f,
"Anti-Flicker"},
276 std::make_shared<auto_exposure_step_option>(auto_exposure,
280 std::make_shared<auto_exposure_antiflicker_rate_option>(auto_exposure,
283 std::map<float, std::string>{{50.f,
"50Hz"},
287 std::make_shared<auto_disabling_control>(
289 auto_exposure_option));
292 std::make_shared<auto_disabling_control>(
294 auto_exposure_option));
296 ep->register_processing_block(
299 [auto_exposure_option]() {
300 return std::make_shared<auto_exposure_processor>(
RS2_STREAM_FISHEYE, *auto_exposure_option);
315 std::vector<platform::hid_device_info> hid_infos = group.
hid_devices;
317 if (!hid_infos.empty())
320 _pid =
static_cast<uint16_t>(strtoul(hid_infos.front().pid.data(),
nullptr, 16));
358 bool fe_dev_present = (fisheye_infos.size() == 1);
363 if (!(fe_dev_present | fe_capability))
return;
366 if (fe_dev_present ^ fe_capability)
368 <<
"Inconsistent HW/FW setup, FW FishEye capability = " << fe_capability
369 <<
", FishEye devices " << std::dec << fisheye_infos.size()
370 <<
" while expecting " << fe_capability);
374 return _mm_calib->get_fisheye_calib_raw();
378 auto&& backend = ctx->get_backend();
380 auto enable_global_time_option = std::shared_ptr<global_time_option>(
new global_time_option());
381 auto raw_fisheye_ep = std::make_shared<uvc_sensor>(
"FishEye Sensor", backend.create_uvc_device(fisheye_infos.front()),
383 auto fisheye_ep = std::make_shared<ds5_fisheye_sensor>(raw_fisheye_ep,
this,
this);
391 fisheye_ep->set_roi_method(std::make_shared<fisheye_auto_exposure_roi_method>(fisheye_auto_exposure));
396 std::make_shared<uvc_pu_option>(*raw_fisheye_ep.get(),
402 "Exposure time of Fisheye camera"));
467 calib_id = *
reinterpret_cast<uint16_t*
>(raw.data());
470 catch(
const std::exception&)
473 LOG_WARNING(
"IMU Calibration is not available, default intrinsic and extrinsic will be used.");
476 std::shared_ptr<mm_calib_parser> prs =
nullptr;
480 prs = std::make_shared<dm_v2_imu_calib_parser>(raw,
_pid,
valid);
break;
482 prs = std::make_shared<tm1_imu_calib_parser>(raw);
break;
484 prs = std::make_shared<l500_imu_calib_parser>(raw,
valid);
break;
487 << ((valid)?
"device is not calibrated" :
"invalid calib type "),
512 return (*_calib_parser)->get_intrinsic(stream);
517 return (*_calib_parser)->get_extrinsic_to(stream);
522 auto fe_calib_table = (*(ds::check_calib<ds::tm1_eeprom>(*_imu_eeprom_raw))).calibration_table.calib_model.fe_calibration;
523 uint8_t* fe_calib_ptr =
reinterpret_cast<uint8_t*
>(&fe_calib_table);
fisheye_auto_exposure_roi_method(std::shared_ptr< auto_exposure_mechanism > auto_exposure)
static const textual_icon lock
std::shared_ptr< md_attribute_parser_base > make_rs400_sensor_ts_parser(std::shared_ptr< md_attribute_parser_base > frame_ts_parser, std::shared_ptr< md_attribute_parser_base > sensor_ts_parser)
A helper function to create a specialized parser for RS4xx sensor timestamp.
std::shared_ptr< lazy< ds::imu_intrinsic > > _accel_intrinsic
ds5_fisheye_sensor(std::shared_ptr< sensor_base > sensor, device *device, ds5_motion *owner)
firmware_version _fw_version
std::shared_ptr< hw_monitor > _hw_monitor
GLuint const GLchar * name
optional_value< uint8_t > _motion_module_device_idx
std::shared_ptr< uvc_sensor > get_raw_sensor()
static const float ae_step_default_value
rs2_intrinsics get_intrinsics(const stream_profile &profile) const override
std::shared_ptr< sensor_base > get_raw_sensor() const
constexpr size_t tm1_eeprom_size
bool val_in_range(const T &val, const std::initializer_list< T > &list)
std::shared_ptr< lazy< rs2_extrinsics > > _depth_to_imu
const std::map< uint32_t, rs2_format > fisheye_fourcc_to_rs2_format
virtual stream_profiles init_stream_profiles() override
std::shared_ptr< stream_interface > _gyro_stream
void register_same_extrinsics(const stream_interface &from, const stream_interface &to)
GLsizei const GLchar *const * string
const std::map< uint32_t, rs2_stream > fisheye_fourcc_to_rs2_stream
rs2_motion_device_intrinsic get_motion_intrinsics(rs2_stream stream) const
lazy< std::vector< uint8_t > > _fisheye_calibration_table_raw
rs2_extrinsics get_extrinsic(rs2_stream)
const uint16_t RS400_IMU_PID
std::shared_ptr< time_diff_keeper > _tf_keeper
static const std::map< IMU_OUTPUT_DATA_RATES, unsigned > hid_fps_translation
void register_extrinsics(const stream_interface &from, const stream_interface &to, std::weak_ptr< lazy< rs2_extrinsics >> extr)
void initialize_fisheye_sensor(std::shared_ptr< context > ctx, const platform::backend_device_group &group)
optional_value< uint8_t > _fisheye_device_idx
lazy< std::shared_ptr< mm_calib_parser > > _calib_parser
constexpr size_t fisheye_calibration_table_size
uint32_t rs_fourcc(const T a, const T b, const T c, const T d)
std::shared_ptr< stream_interface > _depth_stream
const uint8_t FISHEYE_EXPOSURE
rs2_intrinsics get_intrinsic_by_resolution(const vector< uint8_t > &raw_data, calibration_table_id table_id, uint32_t width, uint32_t height)
stream_profiles init_stream_profiles() override
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.
ds::d400_caps _device_capabilities
std::shared_ptr< auto_exposure_mechanism > register_auto_exposure_options(synthetic_sensor *ep, const platform::extension_unit *fisheye_xu)
const uint16_t L515_IMU_TABLE
std::shared_ptr< hw_monitor > _hw_monitor
std::vector< std::shared_ptr< stream_profile_interface >> stream_profiles
rs2_stream
Streams are different types of data provided by RealSense devices.
static const std::string accel_sensor_name
static environment & get_instance()
int add_sensor(const std::shared_ptr< sensor_interface > &sensor_base)
extrinsics_graph & get_extrinsics_graph()
std::shared_ptr< auto_exposure_mechanism > _auto_exposure
ds5_hid_sensor(std::string name, std::shared_ptr< sensor_base > sensor, device *device, ds5_motion *owner)
Cross-stream extrinsics: encodes the topology describing how the different devices are oriented...
mm_calib_handler(std::shared_ptr< hw_monitor > hw_monitor, uint16_t pid)
const ds5_motion * _owner
const uint16_t RS435I_PID
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...
const std::vector< uint8_t > get_fisheye_calib_raw()
std::vector< uint8_t > get_imu_eeprom_raw() const
const char * rs2_stream_to_string(rs2_stream stream)
stream_profile to_profile(const stream_profile_interface *sp)
const platform::extension_unit fisheye_xu
std::shared_ptr< lazy< ds::imu_intrinsic > > _gyro_intrinsic
stream_profiles init_stream_profiles() override
typename::boost::move_detail::remove_reference< T >::type && move(T &&t) BOOST_NOEXCEPT
const ds5_motion * _owner
void register_stream_to_extrinsic_group(const stream_interface &stream, uint32_t groupd_index)
ds::imu_intrinsic get_intrinsic(rs2_stream)
Motion device intrinsics: scale, bias, and variances.
lazy< std::vector< uint8_t > > _imu_eeprom_raw
#define offsetof(STRUCTURE, FIELD)
uint32_t sensor_timestamp
constexpr size_t eeprom_imu_table_size
std::shared_ptr< md_attribute_parser_base > make_additional_data_parser(Attribute St::*attribute)
A utility function to create additional_data parser.
std::vector< platform::uvc_device_info > filter_by_mi(const std::vector< platform::uvc_device_info > &devices, uint32_t mi)
ds5_motion(std::shared_ptr< context > ctx, const platform::backend_device_group &group)
std::vector< platform::uvc_device_info > filter_device_by_capability(const std::vector< platform::uvc_device_info > &devices, d400_caps caps)
std::vector< uint8_t > get_imu_eeprom_raw_l515() const
std::shared_ptr< mm_calib_handler > _mm_calib
std::shared_ptr< stream_interface > _accel_stream
std::shared_ptr< md_attribute_parser_base > make_hid_header_parser(Attribute St::*attribute, attrib_modifyer mod=nullptr)
A utility function to create HID metadata header parser.
const uint16_t RS430I_PID
rs2_frame_metadata_value
Per-Frame-Metadata is the set of read-only properties that might be exposed for each individual frame...
rs2_motion_device_intrinsic get_motion_intrinsics(rs2_stream) const
std::shared_ptr< synthetic_sensor > create_hid_device(std::shared_ptr< context > ctx, const std::vector< platform::hid_device_info > &all_hid_infos, const firmware_version &camera_fw_version)
std::string to_string(T value)
rs2_motion_device_intrinsic create_motion_intrinsics(imu_intrinsic data)