update imu callback

This commit is contained in:
Borong Yuan
2023-07-17 23:35:03 +08:00
parent 0b4f5d2925
commit d391f237eb
+2 -5
View File
@@ -477,10 +477,8 @@ bool CameraDepthAI::init(const std::string & calibrationFolder, const std::strin
{ {
imuLocalTransform_ = this->getLocalTransform() * imuLocalTransform_; imuLocalTransform_ = this->getLocalTransform() * imuLocalTransform_;
UINFO("IMU local transform = %s", imuLocalTransform_.prettyPrint().c_str()); UINFO("IMU local transform = %s", imuLocalTransform_.prettyPrint().c_str());
device_->getOutputQueue("imu", 50, false)->addCallback([this](std::shared_ptr<dai::ADatatype> callback) { device_->getOutputQueue("imu", 50, false)->addCallback([this](const std::shared_ptr<dai::ADatatype> data) {
if(dynamic_cast<dai::IMUData*>(callback.get()) != nullptr) auto imuData = std::dynamic_pointer_cast<dai::IMUData>(data);
{
dai::IMUData* imuData = static_cast<dai::IMUData*>(callback.get());
auto imuPackets = imuData->packets; auto imuPackets = imuData->packets;
for(auto& imuPacket : imuPackets) for(auto& imuPacket : imuPackets)
@@ -504,7 +502,6 @@ bool CameraDepthAI::init(const std::string & calibrationFolder, const std::strin
gyroBuffer_.emplace_hint(gyroBuffer_.end(), std::make_pair(gyroStamp, cv::Vec3f(gyroValues.x, gyroValues.y, gyroValues.z))); gyroBuffer_.emplace_hint(gyroBuffer_.end(), std::make_pair(gyroStamp, cv::Vec3f(gyroValues.x, gyroValues.y, gyroValues.z)));
} }
} }
}
}); });
} }
leftQueue_ = device_->getOutputQueue("rectified_left", 8, false); leftQueue_ = device_->getOutputQueue("rectified_left", 8, false);