记录以下这几天的工作,对imu的标定。
这里用到的方法是基于ROS的,用rosbag录制包,然后用工具去计算。
所以前提就是你一定要能通过ros获取imu数据,并且信息的类型最好是sensor_msgs/Imu,因为我之前的代码ros发布的不是这个类型,没办法计算。
1.随机误差
首先需要安装imu_utils imu_utils安装地址
imu_utils依赖code_utils,要先安装code_utils再安装imu_utils。
imu_utils的安装教程网上很多这里就不再赘述。假设到现在已经安装成功。
1.打开imu的ros节点,用指令rostopic list 查看是否存在你的imu topic.
2.记录imu信息,这个过程要保持imu静止不动至少2个小时。
指令:rosbag record topic名字 -o imu.bag
3.在imu_utils文件下的launch文件目录下添加一个launch文件,我这里添加的是 imu.launch,并把以下代码复制进文件,代码中的/IMU_data改成自己imu的topic。
<launch>
<node pkg="imu_utils" type="imu_an" name="imu_an" output="screen">
<param name="imu_topic" type="string" value= "/IMU_data"/>
<param name="imu_name" type="string" value= "imutest"/>
<param name="data_save_path" type="string" value= "$(find imu_utils)/data/"/>
<param name="max_time_min" type="int" value= "120"/>
<param name="max_cluster" type="int" value= "100"/>
</node>
</launch>
之后执行一下指令:
roslaunch imu_utils imu.launch
4.新开一个命令端口,记得开启ros。回放录制了两个小时的imu数据。
rosbag play -r 200 imu.bag
这里的imu.bag替换成自己的bag文件名。
在执行3的命令端口等待一段时间,自动结束之后会在imu_utils文件下的data文件目录下生成一个imutest_imu_param.yaml的文件,文件中有16个数据,表示陀螺仪和加速度计的高斯白噪声和随机游走误差,到现在随机误差标定结束。
2.确定误差
首先安装imu_tk:imu_tk网址
假设到现在已经安装成功。
- 录制ros包,同样的打开imu数据。用rosbag record命令记录imu 信息,这里不一样的是在记录的过程中,要多imu进行一定的操作。
输入指令
rosbag record topic名字 -o imu.bag
输入指令之后执行一下操作,这里是github上的原文。我测试的时候,首先静止50s以上,然后做各种旋转,每次旋转之后静止5s左右,一共做的次数在36到50之间 ,仅供参考。
Left the IMU static for 50 seconds. Rotate the IMU and then lay it in a different attitude. Wait for at least 1 seconds. Have you rotated the IMU 36 ~ 50 times? If not, go back to step 2. Done.
- 开始标定输入指令
rosrun imu_tk imu_calib_node bag名字 topic名字
成功之后会生成两个文件imu_acc.calib和imu_gyro.calib.
其中的参数分别表示加速度计和陀螺仪的非对齐误差、biase、scale。
如果执行过程中出现gnuplot: not found的错误,安装一下就好
sudo apt-get install gunplot