feat(imu): add is_ets flag for imu

This commit is contained in:
kalman 2019-03-22 19:15:09 +08:00
parent 06ff521d43
commit 239c855c18
2 changed files with 4 additions and 1 deletions

View File

@ -72,6 +72,8 @@ struct ImuSegment {
std::uint32_t frame_id; std::uint32_t frame_id;
std::uint64_t timestamp; std::uint64_t timestamp;
std::uint8_t flag; std::uint8_t flag;
// Is external time source
bool is_ets;
std::int16_t temperature; std::int16_t temperature;
std::int16_t accel[3]; std::int16_t accel[3];
std::int16_t gyro[3]; std::int16_t gyro[3];

View File

@ -55,7 +55,8 @@ struct ImuData {
void unpack_imu_segment(const ImuData &imu, ImuSegment *seg) { void unpack_imu_segment(const ImuData &imu, ImuSegment *seg) {
seg->frame_id = imu.frame_id; seg->frame_id = imu.frame_id;
seg->timestamp = imu.timestamp; seg->timestamp = imu.timestamp;
seg->flag = imu.flag; seg->flag = imu.flag & 0b0011;
seg->is_ets = (imu.flag & 0b0100 == 0b0100);
seg->temperature = imu.temperature; seg->temperature = imu.temperature;
seg->accel[0] = (seg->flag == 1) ? imu.accel_or_gyro[0] : 0; seg->accel[0] = (seg->flag == 1) ? imu.accel_or_gyro[0] : 0;
seg->accel[1] = (seg->flag == 1) ? imu.accel_or_gyro[1] : 0; seg->accel[1] = (seg->flag == 1) ? imu.accel_or_gyro[1] : 0;