pixhawk编译过程

好久没有编译过PIXHAWK了,由于项目需要,又买了一个pixhawk2,由于每次编译都会出现新的问题,这次写帖子将过程记录下来。

环境:WIN10+Ubuntu16.04 64位(VMware Workstation 12 Pro虚拟机)。

基本按照pixhawk的Devguide里面给的步骤,将遇到的问题和解决方法给出,希望能帮助到遇到这些问题的同学。

使用下列命令将用户加入dialout用户组:

sudo usermod -a -G dialout $USER

然后,下载并运行工具链安装脚本:

为简便起见,我使用wget命令行下载。

wget https://raw.githubusercontent.com/PX4/Devguide/master/build_scripts/ubuntu_sim_nuttx.sh
source ubuntu_sim_nuttx.sh

待一串提示完成之后,即完成工具链安装。

之后是下载并编译代码:

mkdir -p ~/src
cd ~/src
git clone https://github.com/PX4/Firmware.git

然后更新子模块(官网的文档以前有这一步,但不知为何,现在将这一步去掉了,加入该步可以在编译时更省时并免且排错时更容易):

cd Firmware
git submodule update --init --recursivemake posix jmavsim

编译通过后会弹出jmavsim的界面仿真界面

但是题主的老弹出Gyro和Accel fail的错误,据说是因为电脑配置太差,虚拟机太慢所致( ˇ?ˇ ),所以建议大家有条件还是用单独的机子装Ubuntu玩。

然后编译V2固件,为pixhawk一代用的标准固件:

make px4fmu-v2_default

题主在编译V2固件时,遇到如下问题:

  • 创建编译目录的权限问题

    处理方法如下:修改src目录的权限

    sudo chmod -R 777 src
  • python的em模块以及catkin_pkg包找不到

    经检查是因为题主之前用anaconda装了python3.5,默认的用的python3.5,而pixhawk中的包貌似用的python2,将默认的改为python2.7,修改方法将.bashrc中的python路径改为python2.7的即可。
    并安装对应的pip和python-empy。

    注意,安装pip时,按照官网给出的方法通过下载get-pip.py,然后安装,下载时速度很慢。可以用apt安装,代码如下:

    sudo apt-get install python-pip

    以上两个问题处理之后,可以编译通过,由于题主用的pixhawk2,所以使用

    make px4fmu-v3_default upload
    

      编译并上传代码
    用usb线将pixhawk2和电脑usb口连接,即可完成编译并上传,如无错误,输出如下:

    [email protected]:~/src/Firmware$ make px4fmu-v3_default upload
    [  0%] Built target git_genmsg
    [  0%] Built target mixer_gen
    [  0%] Built target git_nuttx
    [  0%] Built target git_gencpp
    [  1%] Built target git_matrix
    [  1%] Built target git_uavcan
    [  1%] Built target git_mavlink
    [  2%] Built target git_ecl
    [  2%] Built target libuavcan_dsdlc
    [  3%] Built target ver_gen
    [  3%] Built target airframes_xml
    [  3%] Built target parameters_xml
    [  3%] Built target nuttx_copy_px4fmu-v3
    [  4%] Built target nuttx_copy_px4io-v2
    [  5%] Built target px4fmu-v3-nuttx_patch_00001-REJECTED-add-math.h.patch
    [  5%] Built target px4io-v2-nuttx_patch_00001-REJECTED-add-math.h.patch
    [  5%] Built target px4fmu-v3-nuttx_patch_00002-REJECTED-fix-shadow-wanings.patch
    [  5%] Built target px4io-v2-nuttx_patch_00002-REJECTED-fix-shadow-wanings.patch
    [  5%] Built target px4io-v2-nuttx_patch_00003-REJECTED-add-var-expansion-in-nsh-parse.patch
    [  5%] Built target px4fmu-v3-nuttx_patch_00003-REJECTED-add-var-expansion-in-nsh-parse.patch
    [  5%] Built target px4io-v2-nuttx_patch_00004-REJECTED-avoid-export-copy-with-export-insitu.patch
    [  5%] Built target px4fmu-v3-nuttx_patch_00004-REJECTED-avoid-export-copy-with-export-insitu.patch
    [  5%] Built target px4io-v2-nuttx_patch_00005-REJECTED-support-c++11.patch
    [  5%] Built target px4fmu-v3-nuttx_patch_00005-REJECTED-support-c++11.patch
    [  5%] Built target px4io-v2-nuttx_patch_00006-REJECTED-cstdint-fix.patch
    [  5%] Built target px4fmu-v3-nuttx_patch_00006-REJECTED-cstdint-fix.patch
    [  5%] Built target px4io-v2-nuttx_patch_00007-REJECTED-silence-jobserver-warnings.patch
    [  6%] Built target px4io-v2-nuttx_patch_00008-REJECTED-static-assert-fix.patch
    [  6%] Built target px4fmu-v3-nuttx_patch_00007-REJECTED-silence-jobserver-warnings.patch
    [  6%] Built target px4io-v2-nuttx_patch_00009-REJECTED-ctype-fix-shadow-wanings.patch
    [  6%] Built target px4fmu-v3-nuttx_patch_00008-REJECTED-static-assert-fix.patch
    [  6%] Built target px4io-v2-nuttx_patch_00010-BACKPORT-stm32-flash-F4-dcache-corruption-fix-no-HSI-on.patch
    [  6%] Built target px4io-v2-nuttx_patch_00011-BACKPORT-priority-restoration-fix.patch
    [  7%] Built target px4fmu-v3-nuttx_patch_00009-REJECTED-ctype-fix-shadow-wanings.patch
    [  7%] Built target px4io-v2-nuttx_patch_00012-BACKPORT-stack-coloration-overreach-fix.patch
    [  7%] Built target px4fmu-v3-nuttx_patch_00010-BACKPORT-stm32-flash-F4-dcache-corruption-fix-no-HSI-on.patch
    [  7%] Built target px4io-v2-nuttx_patch_00013-BACKPORT-stm32-serial-dma-hotfix.patch
    [  7%] Built target px4fmu-v3-nuttx_patch_00011-BACKPORT-priority-restoration-fix.patch
    [  7%] Built target px4io-v2-nuttx_patch_00014-BACKPORT-i2c-hotfix.patch
    [  7%] Built target px4fmu-v3-nuttx_patch_00012-BACKPORT-stack-coloration-overreach-fix.patch
    [  8%] Built target px4io-v2-nuttx_patch_00015-BACKPORT-stm32f7-DTCM.patch
    [  8%] Built target px4fmu-v3-nuttx_patch_00013-BACKPORT-stm32-serial-dma-hotfix.patch
    [  8%] Built target px4io-v2-nuttx_patch_00016-BACKPORT-fix-CRTSCTS-defines.patch
    [  8%] Built target px4io-v2-nuttx_patch_00017-BACKPORT-cdcacm.patch
    [  8%] Built target px4fmu-v3-nuttx_patch_00014-BACKPORT-i2c-hotfix.patch
    [  8%] Built target px4io-v2-nuttx_patch_00018-BACKPORT-stm32-serial-break.patch
    [  8%] Built target px4fmu-v3-nuttx_patch_00015-BACKPORT-stm32f7-DTCM.patch
    [  8%] Built target px4io-v2-nuttx_patch_00019-BACKPORT-stm32-rcc-keep-HSI-on.patch
    [  8%] Built target px4fmu-v3-nuttx_patch_00016-BACKPORT-fix-CRTSCTS-defines.patch
    [  8%] Built target px4io-v2-nuttx_patch_00020-BACKPORT-ramtron-CONFIG-prefix.patch
    [  9%] Built target px4fmu-v3-nuttx_patch_00017-BACKPORT-cdcacm.patch
    [  9%] Built target px4io-v2-nuttx_patch_00021-BACKPORT-stm32f3x-add-BKP.patch
    [  9%] Built target px4fmu-v3-nuttx_patch_00018-BACKPORT-stm32-serial-break.patch
    [  9%] Built target px4io-v2-nuttx_patch_00022-BACKPORT-stm32-bkp-reference-fix.patch
    [  9%] Built target px4fmu-v3-nuttx_patch_00019-BACKPORT-stm32-rcc-keep-HSI-on.patch
    [ 10%] Built target px4io-v2-nuttx_patch_00023-BACKPORT-stm32f7-bkp-reference-fix.patch
    [ 10%] Built target px4fmu-v3-nuttx_patch_00020-BACKPORT-ramtron-CONFIG-prefix.patch
    [ 10%] Built target px4io-v2-nuttx_patch_00024-BACKPORT-stm32f7-serial-dma-hotfix.patch
    [ 10%] Built target px4fmu-v3-nuttx_patch_00021-BACKPORT-stm32f3x-add-BKP.patch
    [ 10%] Built target px4io-v2-nuttx_patch_00025-BACKPORT-add-set-ex-to-nsh.patch
    [ 10%] Built target px4fmu-v3-nuttx_patch_00022-BACKPORT-stm32-bkp-reference-fix.patch
    [ 10%] Built target px4io-v2-nuttx_patch_00026-BACKPORT-stm32fX-serial-fix-freezing.patch
    [ 10%] Built target px4fmu-v3-nuttx_patch_00023-BACKPORT-stm32f7-bkp-reference-fix.patch
    [ 10%] Built target px4io-v2-nuttx_patch_00027-BACKPORT-stm32-sdio-1-bit-and-16G-fix.patch
    [ 10%] Built target px4fmu-v3-nuttx_patch_00024-BACKPORT-stm32f7-serial-dma-hotfix.patch
    [ 10%] Built target px4io-v2-nuttx_patch_00030-BACKPORT-fix-arm-none-eabi-gcc-7-warnings-nuttx.patch
    [ 11%] Built target px4fmu-v3-nuttx_patch_00025-BACKPORT-add-set-ex-to-nsh.patch
    [ 11%] Built target px4io-v2-nuttx_patch_00031-BACKPORT-fix-arm-none-eabi-gcc-7-warnings-apps.patch
    [ 11%] Built target px4io-v2-nuttx_patch_90000-PENDING-wip-inflight-to-upstream.patch
    [ 11%] Built target px4fmu-v3-nuttx_patch_00026-BACKPORT-stm32fX-serial-fix-freezing.patch
    [ 11%] Built target nuttx_patch_px4io-v2
    [ 11%] Built target px4fmu-v3-nuttx_patch_00027-BACKPORT-stm32-sdio-1-bit-and-16G-fix.patch
    [ 11%] Built target nuttx_configure_px4io-v2
    [ 11%] Built target px4fmu-v3-nuttx_patch_00030-BACKPORT-fix-arm-none-eabi-gcc-7-warnings-nuttx.patch
    [ 11%] Built target nuttx_export_px4io-v2
    [ 11%] Built target px4fmu-v3-nuttx_patch_00031-BACKPORT-fix-arm-none-eabi-gcc-7-warnings-apps.patch
    [ 11%] Built target io_prebuild_targets
    [ 11%] Built target px4fmu-v3-nuttx_patch_90000-PENDING-wip-inflight-to-upstream.patch
    [ 11%] Built target nuttx_patch_px4fmu-v3
    [ 11%] Built target nuttx_configure_px4fmu-v3
    [ 11%] Built target nuttx_export_px4fmu-v3
    [ 11%] Built target prebuild_targets
    [ 23%] Built target msg_gen
    [ 23%] Built target generate_topic_listener
    [ 24%] Built target platforms__common
    [ 24%] Built target drivers__airspeed
    [ 24%] Built target drivers__blinkm
    [ 28%] Built target px4io-v2
    [ 29%] Built target drivers__bmi160
    [ 29%] Built target drivers__bmp280
    [ 31%] Built target drivers__boards__px4fmu-v2
    [ 32%] Built target drivers__camera_trigger
    [ 32%] Built target drivers__bst
    [ 33%] Built target drivers__device
    [ 33%] Built target drivers__ets_airspeed
    [ 33%] Built target drivers__hott
    [ 33%] Built target drivers__frsky_telemetry
    [ 34%] Built target drivers__hmc5883
    [ 35%] Built target drivers__gps
    [ 35%] Built target drivers__iridiumsbd
    [ 36%] Built target drivers__hott__hott_telemetry
    [ 36%] Built target drivers__hott__hott_sensors
    [ 36%] Built target drivers__l3gd20
    [ 36%] Built target drivers__led
    [ 36%] Built target drivers__lsm303d
    [ 37%] Built target drivers__lis3mdl
    [ 38%] Built target drivers__ll40ls
    [ 38%] Built target drivers__mb12xx
    [ 38%] Built target drivers__mkblctrl
    [ 39%] Built target drivers__mpu6000
    [ 39%] Built target drivers__ms4525_airspeed
    [ 40%] Built target drivers__mpu9250
    [ 41%] Built target drivers__ms5525_airspeed
    [ 41%] Built target drivers__oreoled
    [ 41%] Built target drivers__ms5611
    [ 41%] Built target drivers__pwm_out_sim
    [ 42%] Built target drivers__pwm_input
    [ 42%] Built target drivers__px4flow
    [ 42%] Built target drivers__px4fmu
    [ 42%] Built target lib__led
    [ 42%] Built target drivers__sf0x
    [ 43%] Built target drivers__px4io
    [ 44%] Built target drivers__sdp3x_airspeed
    [ 44%] Built target drivers__sf1xx
    [ 44%] Built target drivers__srf02
    [ 44%] Built target drivers__stm32__adc
    [ 44%] Built target drivers__snapdragon_rc_pwm
    [ 45%] Built target drivers__stm32
    [ 46%] Built target drivers__stm32__tone_alarm
    [ 46%] Built target drivers__tap_esc
    [ 47%] Built target drivers__trone
    [ 48%] Built target drivers__vmount
    [ 49%] Built target modules__sensors
    [ 49%] Built target systemcmds__config
    [ 49%] Built target systemcmds__bl_update
    [ 49%] Built target systemcmds__esc_calib
    [ 50%] Built target systemcmds__dumpfile
    [ 50%] Built target systemcmds__hardfault_log
    [ 50%] Built target systemcmds__led_control
    [ 51%] Built target systemcmds__mixer
    [ 51%] Built target systemcmds__motor_ramp
    [ 51%] Built target systemcmds__mtd
    [ 51%] Built target systemcmds__perf
    [ 52%] Built target systemcmds__param
    [ 52%] Built target systemcmds__nshterm
    [ 52%] Built target systemcmds__pwm
    [ 52%] Built target systemcmds__reboot
    [ 53%] Built target systemcmds__sd_bench
    [ 53%] Built target systemcmds__top
    [ 53%] Built target systemcmds__ver
    [ 54%] Built target systemcmds__topic_listener
    [ 55%] Built target drivers__sf0x__sf0x_tests
    [ 55%] Built target drivers__test_ppm
    [ 55%] Built target lib__controllib__controllib_test
    [ 56%] Built target modules__commander__commander_tests
    [ 56%] Built target modules__unit_test
    [ 56%] Built target modules__mc_pos_control__mc_pos_control_tests
    [ 57%] Built target modules__mavlink__mavlink_tests
    [ 57%] Built target modules__uORB__uORB_tests
    [ 57%] Built target modules__gpio_led
    [ 58%] Built target modules__uORB
    [ 60%] Built target modules__commander
    [ 61%] Built target modules__land_detector
    [ 62%] Built target modules__load_mon
    [ 66%] Built target systemcmds__tests
    [ 66%] Built target platforms__nuttx
    [ 66%] Built target modules__camera_feedback
    [ 67%] Built target modules__mavlink
    [ 69%] Built target modules__navigator
    [ 69%] Built target modules__attitude_estimator_q
    [ 69%] Built target modules__ekf2
    [ 70%] Built target modules__position_estimator_inav
    [ 71%] Built target modules__local_position_estimator
    [ 71%] Built target lib__external_lgpl
    [ 71%] Built target modules__mc_att_control
    [ 72%] Built target modules__mc_pos_control
    [ 75%] Built target lib__ecl
    [ 76%] Built target modules__vtol_att_control
    [ 77%] Built target modules__logger
    [ 77%] Built target modules__sdlog2
    [ 77%] Built target modules__dataman
    [ 78%] Built target modules__systemlib__param
    [ 79%] Built target modules__systemlib__mixer
    [ 81%] Built target lib__controllib
    [ 81%] Built target lib__conversion
    [ 83%] Built target modules__systemlib
    [ 84%] Built target df_driver_framework
    [ 84%] Built target lib__geo
    [ 85%] Built target lib__geo_lookup
    [ 85%] Built target lib__launchdetection
    [ 86%] Built target lib__mathlib
    [ 86%] Built target lib__mathlib__math__filter
    [ 86%] Built target lib__runway_takeoff
    [ 87%] Built target lib__tailsitter_recovery
    [ 87%] Built target lib__version
    [ 87%] Built target lib__terrain_estimation
    [ 87%] Built target examples__rover_steering_control
    [ 87%] Built target platforms__nuttx__px4_layer
    [ 87%] Built target modules__bottle_drop
    [ 88%] Built target examples__segway
    [ 89%] Built target examples__fixedwing_control
    [ 89%] Built target examples__px4_mavlink_debug
    [ 90%] Built target examples__px4_simple_app
    [ 90%] Built target examples__px4_daemon_app
    [ 90%] Built target fw_io
    [ 90%] Built target examples__hwtest
    [ 90%] Built target examples__ekf_att_pos_estimator
    [ 90%] Built target drivers__rgbled
    [ 90%] Built target modules__fw_att_control
    [ 91%] Built target modules__fw_pos_control_l1
    [ 92%] Built target modules__events
    [ 92%] Built target modules__gnd_pos_control
    [ 92%] Built target modules__gnd_att_control
    [ 92%] Built target lib__DriverFramework__framework
    [ 96%] Built target uavcan
    [ 97%] Built target romfs
    [ 97%] Built target uavcan_stm32_driver
    [100%] Built target modules__uavcan
    [100%] Built target firmware_nuttx
    [100%] uploading /home/spy/src/Firmware/build_px4fmu-v3_default/src/firmware/nuttx/px4fmu-v3_default.px4
    Loaded firmware for 9,0, size: 1492196 bytes, waiting for the bootloader...
    If the board does not respond within 1-2 seconds, unplug and re-plug the USB connector.
    Attempting reboot on /dev/serial/by-id/usb-3D_Robotics_PX4_FMU_v2.x_0-if00 with baudrate=57600...
    If the board does not respond, unplug and re-plug the USB connector.
    Found board 9,0 bootloader rev 5 on /dev/serial/by-id/usb-3D_Robotics_PX4_BL_FMU_v2.x_0-if00
    ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff type: ????
    idtype: =FF
    vid: ffffffff
    pid: ffffffff
    coa: //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8=
    
    sn: 005000253036510b31353833
    chip: 20016419
    family: STM32F42x
    revision: 3
    flash 2080768
    
    Erase  : [====================] 100.0% (timeout: 7 seconds)
    Program: [====================] 100.0%
    Verify : [====================] 100.0%
    Rebooting.
    
    [100%] Built target upload

    over,编译完工。

 

  

时间: 2024-10-08 11:45:17

pixhawk编译过程的相关文章

2.4、uboot配置和编译过程详解

2.4.1.uboot主Makefile分析1 2.4.1.1.uboot version分析 (1)uboot版本号分为3个级别: VERSION:主版本号 PATCHLEVEL:次版本号 SUBLEVEL:再次版本号 EXTRAVERSION:另外附加的版本信息 这四个用.隔开共同构成了最终的版本号. (2)Makefile中版本号最终生成了一个变量U_BOOT_VERSION,这个变量记录了Makefile中配置的版本号 (3)include/version_autogenerated.h

FFmpeg在Linux下安装编译过程

转载请把头部出处链接和尾部二维码一起转载,本文出自:http://blog.csdn.net/hejjunlin/article/details/52402759 今天介绍下FFmpeg在Linux下安装编译过程,用的是CentOS, 总体过程比较顺利,就是在ffmpeg等的时间稍长点.没什么技术难点.仅当记录. 关于FFmpeg FFmpeg是一个开源免费跨平台的视频和音频流方案,属于自由软件,采用LGPL或GPL许可证(依据你选择的组件).它提供了录制.转换以及流化音视频的完整解决方案.它包

编译过程中,termcap.h 文件找不到路径 licli.a终于生成

编译过程中,termcap.h      文件找不到路径 查看是linux  源码下找不到termcap.h文件 安装了所有关于*cap*的源码包也不起作用 今天终于解决了这个问题,搜termcap.h  发现一篇文章,如下 ----------------------------------------------------------------------------------------- 安装minicom2.3出现termcap.h错误解决方法 2010-05-06 17:12:

GCC与编译过程

GCC与编译过程   GCC(GNU Compiler Colletion),GUN编译器套装,是一套由GNU开发的编程语言编译器.Linux系统下的GCC编译器实际上是调用其他不同的工具来完成预处理.编译.汇编和链接工作. 一.编译过程 在计算机的眼里,只有1和0.不幸的是,我们用C语言写出来的代码,计算机无法直接看明白.所以一个程序如果需要被计算机执行,那么就必须翻译成能被计算机读懂并执行的1和0.实现这一结果的过程,我们称之为编译. 编译包括以下步骤:预处理.编译.汇编和链接.具体过程如下

Hive SQL的编译过程

Hive是基于Hadoop的一个数据仓库系统,在各大公司都有广泛的应用.美团数据仓库也是基于Hive搭建,每天执行近万次的Hive ETL计算流程,负责每天数百GB的数据存储和分析.Hive的稳定性和性能对我们的数据分析非常关键. 在几次升级Hive的过程中,我们遇到了一些大大小小的问题.通过向社区的咨询和自己的努力,在解决这些问题的同时我们对Hive将SQL编译为MapReduce的过程有了比较深入的理解.对这一过程的理解不仅帮助我们解决了一些Hive的bug,也有利于我们优化Hive SQL

C程序编译过程浅析【转】

转自:http://blog.csdn.net/koudaidai/article/details/8092647 前几天看了<程序员的自我修养——链接.装载与库>中的第二章“编译和链接”,主要根据其中的内容简单总结一下C程序编译的过程吧. 我现在一般都是用gcc,所以自然以GCC编译hellworld为例,简单总结如下. hello.c源代码如下: ?[Copy to clipboard] C 1 2 3 4 5 6 [c] view plaincopy <span style=&qu

Windows下Caffe在GPU编译过程

Windows下Caffe在GPU编译过程 GeForce8800 GTS512: cc=1.1 CUDA6.5 问题一: src/caffe/layers/conv_layer.cu(20): error : too few arguments in function call Error in in conv_layer.cu :forward_gpu_gemm needs the argument skip_im2col #1962 解决: https://github.com/BVLC/

【转】 Apk文件及其编译过程

Apk文件概述 Android系统中的应用程序安装包都是以apk为后缀名,其实apk是Android Package的缩写,即android安装包. 注:apk包文件其实就是标准的zip文件,可以直接用解压缩软件解开.Apk包中的内容 解压缩一个apk文件后,目录结构一般如下: *.apk ├-res │ ├+layout │ └+drawable ├-META-INF │ ├-MANIFEST.MF │ ├-CERT.SF │ └-CERT.RSA ├-resources.arsc ├-cla

C语言的编译过程、安装gcc编译器以及设置环境变量

以我对C语言编译过程的了解,我用了一点时间画了一个图,提供给大家参考一下,希望有些能对您的问题提上帮助. 前几天刚初步学习了C语言的编译过程,感触挺深的.在C语言中头文件其实起了一个很大的作用. 1.头文件可以不需要编译 2.可以查看具体的声明 3.头文件加上实现文件的o文件提交给使用者即可 ,不需要知道源代码 4..o文件预先编译,所以整个项目编译时,会大大提高编译的时间 . 5.当一个文件(A.c文件)依赖于头文件(b.h)时 ,如果b.c编译之后形成的b.o文件重新编译后,a.o的文件不需