imu_utils標定程序

本文详细介绍了如何安装imu_utils库,设置WS工作空间,下载并构建项目,录制rosbag数据,配置imu校准参数,以及使用rosbag快速播放来校准imu。最后,步骤涉及查看校准结果。
摘要由CSDN通过智能技术生成

imu_utils標定程序

1. 安裝

step1:
sudo apt-get install libdw-dev

step2:建立WS文件夾


export TARTGET_WS_DIR=/home/hao/Documents/WKS_Current/camera_imu_calib/imu_utils_workspace
mkdir -p $TARTGET_WS_DIR/src

step3: download

export TARTGET_WS_DIR=/home/hao/Documents/WKS_Current/camera_imu_calib/imu_utils_workspace

# remove the previous files

cd $TARTGET_WS_DIR/src

git clone https://github.com/gaowenliang/code_utils
git clone https://github.com/gaowenliang/imu_utils


 


step4:build
 

export TARTGET_WS_DIR=/home/hao/Documents/WKS_Current/camera_imu_calib/imu_utils_workspace
cd $TARTGET_WS_DIR
catkin_make

運行-----------------------------------------------------------------------------------------------------------------

step1:確保imu正確發佈

#!/bin/bash

#rostopic hz /mavros/imu/data_raw

rostopic echo /mavros/imu/data_raw

step2:錄製rosbag,一般說是最少120分鐘,但是目前imu_utils的源代碼默認你錄製200分鐘,能錄久一點就錄久一點

export TARTGET_PROJECT_DIR=/home/hao/Documents/WKS_Current/camera_imu_calib
export TARTGET_WS_DIR=$TARTGET_PROJECT_DIR/imu_utils_workspace

export IMU_TOPIC=/mavros/imu/data_raw
export BAG_PATH=$TARTGET_PROJECT_DIR/rosbag/imu.bag
rosbag record $IMU_TOPIC -O $BAG_PATH


#rm $BAG_PATH
#rm $USB_BAG_PATH

# record at least 2 hours
rosbag record $IMU_TOPIC -O $BAG_PATH

step3:
修改以下的launch
imu_utils/launch/xsens.launch
將max_time_min修改成你錄製的時間長(分鐘)。不能長於你錄製的時間,否則會一直等待資料。

<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_topic" type="string" value= "/mavros/imu/data_raw"/>
        <param name="imu_name" type="string" value= "xsens"/>
        <param name="data_save_path" type="string" value= "$(find imu_utils)/data/"/>
<!--         <param name="max_time_min" type="int" value= "200"/> -->
        <param name="max_time_min" type="int" value= "150"/>
        <param name="max_cluster" type="int" value= "100"/>
    </node>
</launch>

step4 運行標定程序,運行後會開始等待rosbag的資料

#!/bin/bash


export TARTGET_WS_DIR=/home/hao/Documents/WKS_Current/camera_imu_calib/imu_utils_workspace



source $TARTGET_WS_DIR/devel/setup.bash

#默認imu topic是/imu/data
#如果rosbag裏記錄的不是,就要修改
#imu_utils_workspace/src/imu_utils/launch/xsens.launch

#https://blog.csdn.net/qq_49959714/article/details/129211822
# 此处可能会一直出现wait for imu data
# 这时需要修改xsens_driver.launch文件中的max_time_min的值,这个值改为小于自己的bag持续时间。
roslaunch imu_utils xsens.launch

#尽快执行rosbag play -r 200 test_imu_2020_20xx-xx-xx-xx-xx-xx.bag,
# 程序进入bag读取,并计算allan方差。当bag包加速回放完毕后,执行launch的窗口仍然会显示wait for imu data.,
# 等待一段时间计算,计算完毕后会显示计算结果。

step5 運行rosbag,速度200倍

#!/bin/bash

export TARTGET_PROJECT_DIR=/home/hao/Documents/WKS_Current/camera_imu_calib
export TARTGET_WS_DIR=$TARTGET_PROJECT_DIR/imu_utils_workspace


export NEW_IMU_BAG=$TARTGET_PROJECT_DIR/rosbag/imu_0325_wheeltec.bag
#---------------------------------------------------------------

export IMU_TOPIC=/mavros/imu/data_raw

#export BAG_PATH=$TARTGET_PROJECT_DIR/rosbag/imu_0320_short.bag
#export BAG_PATH=$TARTGET_PROJECT_DIR/rosbag/imu_0320_long.bag

# speed x 200
rosbag play -r 200 $NEW_IMU_BAG

因爲rosbag的播放速度是200倍,運行時間就幾分鐘,如果20分鐘內沒有出結果,大概率是launch文件max_time_min寫的比rosbag的大,導致程序一直在等待資料

step 6 查看結果

#!/bin/bash


export TARTGET_WS_DIR=/home/hao/Documents/WKS_Current/camera_imu_calib/imu_utils_workspace
source $TARTGET_WS_DIR/devel/setup.bash
# imu标定内参参数将保存在imu_utils/data目录下的xsens_imu_param.yaml文件中
cat $TARTGET_WS_DIR/src/imu_utils/data/xsens_imu_param.yaml

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值