上一节介绍了cartographer中的OdometryData数据相关转换。
本节将介绍陀螺仪Imu数据转换为cartographer中的ImuData数据。还有cartographer中的ImuData数据和Ros的sensor_msgs::Imu数据相互转换,方便引入Rosbag进行储存和读取。
目录
1:ImuData数据类型
【imu_data.h】中查看数据结构:
//时间
common::Time time;
//线加速度
Eigen::Vector3d linear_acceleration;
//角速度
Eigen::Vector3d angular_velocity;
2:Imu数据转换cartographer数据
cartographer::sensor::ImuData GetImuData()
{
cartographer::sensor::ImuData imu_data;
//计算
//线加速度(含重力)
acc[0] = *((float *)&handle_buf[22]);
acc[1] = *((float *)&handle_buf[26]);
acc[2] = *((float *)&handle_buf[30]);
//角速度(陀螺仪I的输出)
gyo[0] = *((float *)&handle_buf[82]);
gyo[1] = *((float *)&handle_buf[86]);
gyo[2] = *((float *)&handle_buf[90]);

1574

被折叠的 条评论
为什么被折叠?



