Fix push motion datas in callback
This commit is contained in:
parent
bb2f0e4dd1
commit
41610fd714
|
@ -36,7 +36,6 @@ void Motions::SetMotionCallback(motion_callback_t callback) {
|
||||||
if (motion_callback_) {
|
if (motion_callback_) {
|
||||||
channels_->SetImuCallback([this](const ImuPacket &packet) {
|
channels_->SetImuCallback([this](const ImuPacket &packet) {
|
||||||
if (!motion_callback_ && !motion_datas_enabled_) {
|
if (!motion_callback_ && !motion_datas_enabled_) {
|
||||||
LOG(WARNING) << "";
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (auto &&seg : packet.segments) {
|
for (auto &&seg : packet.segments) {
|
||||||
|
@ -57,7 +56,9 @@ void Motions::SetMotionCallback(motion_callback_t callback) {
|
||||||
|
|
||||||
std::lock_guard<std::mutex> _(mtx_datas_);
|
std::lock_guard<std::mutex> _(mtx_datas_);
|
||||||
motion_data_t data = {imu};
|
motion_data_t data = {imu};
|
||||||
|
if (motion_datas_enabled_) {
|
||||||
motion_datas_.push_back(data);
|
motion_datas_.push_back(data);
|
||||||
|
}
|
||||||
|
|
||||||
motion_callback_(data);
|
motion_callback_(data);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user