miss serial_number in ImuData

This commit is contained in:
Kalman 2018-08-03 19:31:36 +08:00
parent 614227a85c
commit b139fd21c3
2 changed files with 7 additions and 4 deletions

View File

@ -441,9 +441,11 @@ struct MYNTEYE_API ImgData {
* IMU data.
*/
struct MYNTEYE_API ImuData {
/** Imu serial number */
std::uint32_t serial_number;
/** accel or gyro flag:1 for accel,2 for gyro,3 for both */
std::uint8_t flag;
/** IMU timestamp in 0.01ms */
/** IMU timestamp in 1us */
std::uint64_t timestamp;
/** IMU accelerometer data for 3-axis: X, Y, Z. */
double accel[3];

View File

@ -47,18 +47,19 @@ void Motions::SetMotionCallback(motion_callback_t callback) {
// static_cast<uint32_t>(-seg.offset) > packet.timestamp) {
// LOG(WARNING) << "Imu timestamp offset is incorrect";
// }
imu->serial_number = seg.serial_number;
imu->timestamp = seg.timestamp;
imu->flag = seg.flag;
imu->temperature = seg.temperature / 326.8f + 25;
if(imu->flag == 1) {
if (imu->flag == 1) {
imu->accel[0] = seg.aceel_or_gyro[0] * 12.f / 0x10000;
imu->accel[1] = seg.aceel_or_gyro[1] * 12.f / 0x10000;
imu->accel[2] = seg.aceel_or_gyro[2] * 12.f / 0x10000;
imu->gyro[0] = 0;
imu->gyro[1] = 0;
imu->gyro[2] = 0;
} else if(imu->flag == 2) {
} else if (imu->flag == 2) {
imu->accel[0] = 0;
imu->accel[1] = 0;
imu->accel[2] = 0;
@ -68,7 +69,7 @@ void Motions::SetMotionCallback(motion_callback_t callback) {
} else {
imu->Reset();
}
std::lock_guard<std::mutex> _(mtx_datas_);
motion_data_t data = {imu};
motion_datas_.push_back(data);