Skip to content

Commit

Permalink
Merge pull request IntelRealSense#2777 from ev-mp/imu_spec
Browse files Browse the repository at this point in the history
Adjust IMU rates to spec
  • Loading branch information
dorodnic committed Nov 28, 2018
2 parents 05802bb + 450b990 commit bb458b7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 53 deletions.
23 changes: 3 additions & 20 deletions src/ds5/ds5-factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -622,11 +622,7 @@ namespace librealsense
std::vector<stream_interface*> streams = { _depth_stream.get() , _left_ir_stream.get() , _right_ir_stream.get()};
std::vector<stream_interface*> mm_streams = { _fisheye_stream.get(),
_accel_stream.get(),
_gyro_stream.get(),
_gpio_streams[0].get(),
_gpio_streams[1].get(),
_gpio_streams[2].get(),
_gpio_streams[3].get()};
_gyro_stream.get()};

if (frame.frame->supports_frame_metadata(RS2_FRAME_METADATA_FRAME_COUNTER))
{
Expand Down Expand Up @@ -663,11 +659,7 @@ namespace librealsense
std::vector<stream_interface*> streams = { _depth_stream.get() , _left_ir_stream.get() , _right_ir_stream.get() };
std::vector<stream_interface*> mm_streams = { _fisheye_stream.get(),
_accel_stream.get(),
_gyro_stream.get(),
_gpio_streams[0].get(),
_gpio_streams[1].get(),
_gpio_streams[2].get(),
_gpio_streams[3].get()};
_gyro_stream.get()};

if (!frame.frame->supports_frame_metadata(RS2_FRAME_METADATA_FRAME_COUNTER))
{
Expand All @@ -694,11 +686,7 @@ namespace librealsense
std::vector<stream_interface*> streams = { _depth_stream.get() , _left_ir_stream.get() , _right_ir_stream.get(), _color_stream.get() };
std::vector<stream_interface*> mm_streams = { _fisheye_stream.get(),
_accel_stream.get(),
_gyro_stream.get(),
_gpio_streams[0].get(),
_gpio_streams[1].get(),
_gpio_streams[2].get(),
_gpio_streams[3].get()};
_gyro_stream.get()};

if (frame.frame->supports_frame_metadata(RS2_FRAME_METADATA_FRAME_COUNTER))
{
Expand All @@ -714,8 +702,6 @@ namespace librealsense
std::vector<stream_interface*> streams = { _depth_stream.get() , _left_ir_stream.get() , _right_ir_stream.get(), _color_stream.get() };
// TODO - A proper matcher for High-FPS sensor is required
std::vector<stream_interface*> mm_streams = { _accel_stream.get(), _gyro_stream.get()};
for (auto i=0; i<4; i++)
mm_streams.emplace_back(_gpio_streams[i].get());

if (frame.frame->supports_frame_metadata(RS2_FRAME_METADATA_FRAME_COUNTER))
{
Expand All @@ -730,9 +716,6 @@ namespace librealsense
{
// TODO - A proper matcher for High-FPS sensor is required
std::vector<stream_interface*> mm_streams = { _accel_stream.get(), _gyro_stream.get()};
for (auto i=0; i<4; i++)
mm_streams.emplace_back(_gpio_streams[i].get());
return matcher_factory::create(RS2_MATCHER_DEFAULT, mm_streams);
}

}
20 changes: 0 additions & 20 deletions src/ds5/ds5-motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ namespace librealsense
assign_stream(_owner->_accel_stream, p);
if (p->get_stream_type() == RS2_STREAM_GYRO)
assign_stream(_owner->_gyro_stream, p);
if (p->get_stream_type() == RS2_STREAM_GPIO)
assign_stream(_owner->_gpio_streams[p->get_stream_index()-1], p);

//set motion intrinsics
if (p->get_stream_type() == RS2_STREAM_ACCEL || p->get_stream_type() == RS2_STREAM_GYRO)
Expand Down Expand Up @@ -179,15 +177,6 @@ namespace librealsense
}

static const char* custom_sensor_fw_ver = "5.6.0.0";
if (camera_fw_version >= firmware_version(custom_sensor_fw_ver))
{
static const std::vector<std::pair<std::string, stream_profile>> custom_sensor_profiles =
{{std::string("custom"), { RS2_STREAM_GPIO, 1, 1, 1, 1, RS2_FORMAT_GPIO_RAW}},
{std::string("custom"), { RS2_STREAM_GPIO, 2, 1, 1, 1, RS2_FORMAT_GPIO_RAW}},
{std::string("custom"), { RS2_STREAM_GPIO, 3, 1, 1, 1, RS2_FORMAT_GPIO_RAW}},
{std::string("custom"), { RS2_STREAM_GPIO, 4, 1, 1, 1, RS2_FORMAT_GPIO_RAW}}};
std::copy(custom_sensor_profiles.begin(), custom_sensor_profiles.end(), std::back_inserter(sensor_name_and_hid_profiles));
}

auto hid_ep = std::make_shared<ds5_hid_sensor>(this, ctx->get_backend().create_hid_device(all_hid_infos.front()),
std::unique_ptr<frame_timestamp_reader>(new ds5_iio_hid_timestamp_reader()),
Expand Down Expand Up @@ -266,9 +255,6 @@ namespace librealsense
{
using namespace ds;

for (auto i = 0; i < 4; i++)
_gpio_streams[i] = std::make_shared<stream>(RS2_STREAM_GPIO, i+1);

_tm1_eeprom_raw = [this]() { return get_tm1_eeprom_raw(); };
_tm1_eeprom = [this]() { return get_tm1_eeprom(); };

Expand All @@ -288,12 +274,6 @@ namespace librealsense
register_stream_to_extrinsic_group(*_gyro_stream, 0);
register_stream_to_extrinsic_group(*_accel_stream, 0);

for (auto i = 0; i < 4; i++)
{
environment::get_instance().get_extrinsics_graph().register_same_extrinsics(*_accel_stream, *_gpio_streams[i]);
register_stream_to_extrinsic_group(*_gpio_streams[i], 0);
}

// Try to add hid endpoint
auto hid_ep = create_hid_device(ctx, group.hid_devices, _fw_version);
if (hid_ep)
Expand Down
16 changes: 3 additions & 13 deletions src/ds5/ds5-motion.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,38 +45,28 @@ namespace librealsense

// Bandwidth parameters from BOSCH BMI 055 spec. used by D435i
std::vector<std::pair<std::string, stream_profile>> sensor_name_and_hid_profiles =
{{"gyro_3d", {RS2_STREAM_GYRO, 0, 1, 1, 100, RS2_FORMAT_MOTION_RAW}},
{"gyro_3d", {RS2_STREAM_GYRO, 0, 1, 1, 200, RS2_FORMAT_MOTION_RAW}},
{{"gyro_3d", {RS2_STREAM_GYRO, 0, 1, 1, 200, RS2_FORMAT_MOTION_RAW}},
{"gyro_3d", {RS2_STREAM_GYRO, 0, 1, 1, 400, RS2_FORMAT_MOTION_RAW}},
{"gyro_3d", {RS2_STREAM_GYRO, 0, 1, 1, 100, RS2_FORMAT_MOTION_XYZ32F}},
{"gyro_3d", {RS2_STREAM_GYRO, 0, 1, 1, 200, RS2_FORMAT_MOTION_XYZ32F}},
{"gyro_3d", {RS2_STREAM_GYRO, 0, 1, 1, 400, RS2_FORMAT_MOTION_XYZ32F}},
{"accel_3d", {RS2_STREAM_ACCEL, 0, 1, 1, 63, RS2_FORMAT_MOTION_RAW}},
{"accel_3d", {RS2_STREAM_ACCEL, 0, 1, 1, 125, RS2_FORMAT_MOTION_RAW}},
{"accel_3d", {RS2_STREAM_ACCEL, 0, 1, 1, 250, RS2_FORMAT_MOTION_RAW}},
{"accel_3d", {RS2_STREAM_ACCEL, 0, 1, 1, 500, RS2_FORMAT_MOTION_RAW}},
{"accel_3d", {RS2_STREAM_ACCEL, 0, 1, 1, 63, RS2_FORMAT_MOTION_XYZ32F}},
{"accel_3d", {RS2_STREAM_ACCEL, 0, 1, 1, 125, RS2_FORMAT_MOTION_XYZ32F}},
{"accel_3d", {RS2_STREAM_ACCEL, 0, 1, 1, 250, RS2_FORMAT_MOTION_XYZ32F}},
{"accel_3d", {RS2_STREAM_ACCEL, 0, 1, 1, 500, RS2_FORMAT_MOTION_XYZ32F}},
{"HID Sensor Class Device: Gyroscope", { RS2_STREAM_GYRO, 0, 1, 1, 1000, RS2_FORMAT_MOTION_XYZ32F}},
{"HID Sensor Class Device: Accelerometer", { RS2_STREAM_ACCEL, 0, 1, 1, 1000, RS2_FORMAT_MOTION_XYZ32F}},
{"HID Sensor Class Device: Custom", { RS2_STREAM_ACCEL, 0, 1, 1, 1000, RS2_FORMAT_MOTION_XYZ32F}}};

// The frequency selector is vendor and model-specific
std::map<rs2_stream, std::map<unsigned, unsigned>> fps_and_sampling_frequency_per_rs2_stream =
{{RS2_STREAM_ACCEL, {{63, 1},
{125, 2},
{250, 3},
{500, 5}}},
{RS2_STREAM_GYRO, {{100, 1},
{200, 2},
{250, 3}}},
{RS2_STREAM_GYRO, {{200, 2},
{400, 4}}}};

protected:
std::shared_ptr<stream_interface> _fisheye_stream;
std::shared_ptr<stream_interface> _accel_stream;
std::shared_ptr<stream_interface> _gyro_stream;
std::shared_ptr<stream_interface> _gpio_streams[4];
};
}
3 changes: 3 additions & 0 deletions wrappers/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ else() # Some other windows version
endif()

pybind11_add_module(pybackend2 SHARED ${RAW_RS_CPP} ${RAW_RS_HPP})
if(USE_EXTERNAL_USB)
add_dependencies(pybackend2 libusb)
endif()
target_link_libraries(pybackend2 PRIVATE ${LIBUSB1_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
set_target_properties(pybackend2 PROPERTIES
VERSION ${REALSENSE_VERSION_STRING}
Expand Down

0 comments on commit bb458b7

Please sign in to comment.