资讯详情

使用PX4的ECL进行多传感器数据融合的后处理

文章目录

      • 写在前边
      • 入门
      • 下一步工作

写在前边

  • ecl是开源无人机项目PX4使用算法库,使用ekf(扩展卡尔曼滤波)imu各种传感器的数据集成等
  • 然而ecl不提供数据后处理功能
  • 能使用ecl多传感器数据集成的后处理非常必要,便于参数调试和二次开发调试,缩短开发周期,降低开发成本
  • 鉴于上述作者fork了ecl该项目增加了后处理功能
  • 添加后处理功能的基本原则是尽量不改变ecl事实上,任何代码都没有更改任何代码文件
  • 事实上,整个变化只是在CMakeLists.txt下面的行添加到中间
add_subdirectory(airdata) add_subdirectory(EKF) #  add_subdirectory(geo) add_subdirectory(geo_lookup) add_subdirectory(main) # 这一行是新添加的 
  • 可见一个叫做main添加和和的文件夹ekf以及test等的同级目录,这个文件夹中包含了生成后处理程序所需要的CMakeLists.txt还有所有的代码文件ekf则使用add_subdirectory(EKF) #这一行生成的动态库
  • 点击此处前往本项目github仓库

入门

克隆、生成、编译和操作可以按照以下步骤完成。

  1. clone 项目到当地仓库
git clone https://github.com/akstuki/PX4-ECL.git 
  1. 建议新建目录build,这样会更干净
mkdir build/ cd build/ 
  1. 生成项目(生成makefile文件)
$ cmake .. -- The CXX compiler identification is GNU 7.4.0 -- Check for working CXX compiler: /usr/bin/c  .exe -- Check for working CXX compiler: /usr/bin/c  .exe -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- build type is RelWithDebInfo -- PX4 ECL: Very lightweight Estimation & Control Library v1.9.0-rc1-496-g5ca644e -- Configuring done -- Generating done -- Build files have been written to: /cygdrive/f/1-own/0-code/0alforithmCode/px4/ecl/PX4-ECL/build 
  1. 编译生成可操作文件
$ make Scanning dependencies of target matrix [  2%] Completed 'matrix' [ 21%] Built target matrix Scanning dependencies of target prebuild_targets [ 21%] Built target prebuild_targets [ 26%] Built target ecl_airdata [ 31%] Built target ecl_geo_lookup [ 36%] Built target ecl_geo [ 89%] Built target ecl_EKF Scanning dependencies of target postEcl [ 92%] Building CXX object main/CMakeFiles/postEcl.dir/main.cpp.o [ 94%] Building CXX object main/CMakeFiles/postEcl.dir/csvparser.cpp.o [ 97%] Building CXX object main/CMakeFiles/postEcl.dir/PostEkf.cpp.o [100%] Linking CXX executable postEcl.exe [100%] Built target postEcl 
ol start="5">
  • 运行程序(程序仅仅需要一个参数,就是px4的日志文件)
  • $ ./postEcl.exe 09_26_14_sensor_combined_0.csv
    start ecl main...
    47634158: reset position to last known position
    47634158: reset velocity to zero
    51113397: mag yaw fusion numerical error - covariance reset
    51534173: EKF aligned, (baro hgt, IMU buf: 12, OBS buf: 9)
    57718962: mag yaw fusion numerical error - covariance reset
    baro hgt timeout - reset to baro
    67032581: mag yaw fusion numerical error - covariance reset
    68114987: reset position to last known position
    68114987: reset velocity to zero
    68114987: stopping navigation
    baro hgt timeout - reset to baro
    baro hgt timeout - reset to baro
    84041372: reset position to last known position
    84041372: reset velocity to zero
    84041372: stopping navigation
    finished.
    
    1. 可以看到程序运行结束后生成一个输出文件ecloutput.csv,包含ekf的所有状态
    $ ls -l
    总用量 6848
    -rwxrwxr-x+ 1 xiaoqiang xiaoqiang 1492459 9月  29 2018 09_26_14_sensor_combined_0.csv
    -rwxrw-r--+ 1 xiaoqiang xiaoqiang    1025 1月   4 22:37 cmake_install.cmake
    drwxrwxr-x+ 1 xiaoqiang xiaoqiang       0 1月   5 21:51 CMakeFiles
    -rwxrw-r--+ 1 xiaoqiang xiaoqiang 2612997 1月   5 22:08 ecloutput.csv
    -rwxrw-r--+ 1 xiaoqiang xiaoqiang    7687 1月   5 21:50 Makefile
    -rwxrwxr-x+ 1 xiaoqiang xiaoqiang 2889190 1月   5 21:52 postEcl.exe
    

    下一步工作

    • 添加更多数据格式的支持框架
    • 添加参数配置接口 (或许以配置文件方式)
    • 另外,可以将CMakeList.txt放到外层,把ecl以external的方式导入(本项目暂时不考虑这种方式)

    标签: px3981传感器

    锐单商城拥有海量元器件数据手册IC替代型号,打造 电子元器件IC百科大全!

    锐单商城 - 一站式电子元器件采购平台