Fix push motion datas in callback

This commit is contained in:
John Zhao 2018-11-07 17:11:44 +08:00
parent bb2f0e4dd1
commit 41610fd714

View File

@ -36,7 +36,6 @@ void Motions::SetMotionCallback(motion_callback_t callback) {
if (motion_callback_) {
channels_->SetImuCallback([this](const ImuPacket &packet) {
if (!motion_callback_ && !motion_datas_enabled_) {
LOG(WARNING) << "";
return;
}
for (auto &&seg : packet.segments) {
@ -57,7 +56,9 @@ void Motions::SetMotionCallback(motion_callback_t callback) {
std::lock_guard<std::mutex> _(mtx_datas_);
motion_data_t data = {imu};
motion_datas_.push_back(data);
if (motion_datas_enabled_) {
motion_datas_.push_back(data);
}
motion_callback_(data);
}