ORB-SLAM3/ORB-SLAM3-UESTC/Workspace/Application/IMUDriver/main.cpp

18 lines
508 B
C++

#include <IMUReader.h>
#include <stdio.h>
int main() {
// 创建 IMUReader 实例
IMUReader imuReader("/dev/ttyUSB0");
// orb-slam read cam
while(1){
IMUData data;
int status = imuReader.ReadData(data);
printf("Acc=%f,%f,%f, Gyro=%f,%f,%f\n",data.accelX,data.accelY,data.accelZ,
data.gyroX,data.gyroY,data.gyroZ);
// 30FPS
std::this_thread::sleep_for(std::chrono::milliseconds(33));
}
return 0;
}