Intel® RealSense™ Cross Platform API
Intel Realsense Cross-platform API
ds5-motion.h
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2015 Intel Corporation. All Rights Reserved.
3 
4 #pragma once
5 
6 #include "ds5-device.h"
7 
8 namespace librealsense
9 {
10  class ds5_motion : public virtual ds5_device
11  {
12  public:
13  std::shared_ptr<hid_sensor> create_hid_device(std::shared_ptr<context> ctx,
14  const std::vector<platform::hid_device_info>& all_hid_infos,
15  const firmware_version& camera_fw_version);
16 
17  ds5_motion(std::shared_ptr<context> ctx,
18  const platform::backend_device_group& group);
19 
21 
22  std::shared_ptr<auto_exposure_mechanism> register_auto_exposure_options(uvc_sensor* uvc_ep,
24 
25  private:
26  friend class ds5_fisheye_sensor;
27  friend class ds5_hid_sensor;
28 
29  uint8_t _fisheye_device_idx = -1;
30  uint8_t _motion_module_device_idx = -1;
31 
32  lazy<std::vector<uint8_t>> _tm1_eeprom_raw;
33  lazy<ds::tm1_eeprom> _tm1_eeprom;
34  lazy<ds::imu_intrinsics> _accel_intrinsics;
35  lazy<ds::imu_intrinsics> _gyro_intrinsics;
36  std::shared_ptr<lazy<rs2_extrinsics>> _fisheye_to_imu;
37 
38  ds::tm1_eeprom get_tm1_eeprom() const;
39  std::vector<uint8_t> get_tm1_eeprom_raw() const;
40 
41  lazy<std::vector<uint8_t>> _fisheye_calibration_table_raw;
42  //std::shared_ptr<lazy<rs2_extrinsics>> _depth_to_fisheye;
43 
44  // Bandwidth parameters from BOSCH BMI 055 spec'
45  std::vector<std::pair<std::string, stream_profile>> sensor_name_and_hid_profiles =
46  {{"gyro_3d", {RS2_STREAM_GYRO, 0, 1, 1, 200, RS2_FORMAT_MOTION_RAW}},
47  {"gyro_3d", {RS2_STREAM_GYRO, 0, 1, 1, 400, RS2_FORMAT_MOTION_RAW}},
48  {"gyro_3d", {RS2_STREAM_GYRO, 0, 1, 1, 1000, RS2_FORMAT_MOTION_RAW}},
49  {"gyro_3d", {RS2_STREAM_GYRO, 0, 1, 1, 200, RS2_FORMAT_MOTION_XYZ32F}},
50  {"gyro_3d", {RS2_STREAM_GYRO, 0, 1, 1, 400, RS2_FORMAT_MOTION_XYZ32F}},
51  {"gyro_3d", {RS2_STREAM_GYRO, 0, 1, 1, 1000, RS2_FORMAT_MOTION_XYZ32F}},
52  {"accel_3d", {RS2_STREAM_ACCEL, 0, 1, 1, 125, RS2_FORMAT_MOTION_RAW}},
53  {"accel_3d", {RS2_STREAM_ACCEL, 0, 1, 1, 250, RS2_FORMAT_MOTION_RAW}},
54  {"accel_3d", {RS2_STREAM_ACCEL, 0, 1, 1, 500, RS2_FORMAT_MOTION_RAW}},
55  {"accel_3d", {RS2_STREAM_ACCEL, 0, 1, 1, 1000, RS2_FORMAT_MOTION_RAW}},
56  {"accel_3d", {RS2_STREAM_ACCEL, 0, 1, 1, 125, RS2_FORMAT_MOTION_XYZ32F}},
57  {"accel_3d", {RS2_STREAM_ACCEL, 0, 1, 1, 250, RS2_FORMAT_MOTION_XYZ32F}},
58  {"accel_3d", {RS2_STREAM_ACCEL, 0, 1, 1, 500, RS2_FORMAT_MOTION_XYZ32F}},
59  {"accel_3d", {RS2_STREAM_ACCEL, 0, 1, 1, 1000, RS2_FORMAT_MOTION_XYZ32F}},
60  {"HID Sensor Class Device: Gyroscope", { RS2_STREAM_GYRO, 0, 1, 1, 1000, RS2_FORMAT_MOTION_XYZ32F}} ,
61  {"HID Sensor Class Device: Accelerometer", { RS2_STREAM_ACCEL, 0, 1, 1, 1000, RS2_FORMAT_MOTION_XYZ32F}},
62  {"HID Sensor Class Device: Custom", { RS2_STREAM_ACCEL, 0, 1, 1, 1000, RS2_FORMAT_MOTION_XYZ32F}}};
63 
64  std::map<rs2_stream, std::map<unsigned, unsigned>> fps_and_sampling_frequency_per_rs2_stream =
65  {{RS2_STREAM_ACCEL, {{125, 1},
66  {250, 2},
67  {500, 5},
68  {1000, 10}}},
69  {RS2_STREAM_GYRO, {{200, 1},
70  {400, 4},
71  {1000, 10}}}};
72 
73  protected:
74  std::shared_ptr<stream_interface> _fisheye_stream;
75  std::shared_ptr<stream_interface> _accel_stream;
76  std::shared_ptr<stream_interface> _gyro_stream;
77  std::shared_ptr<stream_interface> _gpio_streams[4];
78  };
79 }
Definition: rs_sensor.h:71
Definition: types.h:269
std::shared_ptr< stream_interface > _gyro_stream
Definition: ds5-motion.h:76
Definition: rs_sensor.h:44
Definition: ds5-motion.h:10
friend class ds5_hid_sensor
Definition: ds5-motion.h:27
Definition: ds5-device.h:16
Definition: algo.h:16
Definition: ds5-private.h:273
std::shared_ptr< auto_exposure_mechanism > register_auto_exposure_options(uvc_sensor *uvc_ep, const platform::extension_unit *fisheye_xu)
Definition: rs_sensor.h:72
rs2_stream
Streams are different types of data provided by RealSense devices.
Definition: rs_sensor.h:37
Definition: rs_sensor.h:45
Definition: types.h:674
friend class ds5_fisheye_sensor
Definition: ds5-motion.h:26
const platform::extension_unit fisheye_xu
Definition: ds5-private.h:83
std::shared_ptr< stream_interface > _gpio_streams[4]
Definition: ds5-motion.h:77
Motion device intrinsics: scale, bias, and variances.
Definition: rs_types.h:68
ds5_motion(std::shared_ptr< context > ctx, const platform::backend_device_group &group)
std::shared_ptr< stream_interface > _accel_stream
Definition: ds5-motion.h:75
rs2_motion_device_intrinsic get_motion_intrinsics(rs2_stream) const
std::shared_ptr< stream_interface > _fisheye_stream
Definition: ds5-motion.h:74
Definition: sensor.h:174
std::shared_ptr< hid_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)