好久没有编译过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 --recursive
make 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口连接,即可完成编译并上传,如无错误,输出如下:

    spy@ubuntu:~/src/Firmware$ make px4fmu-v3_default upload
    [ %] Built target git_genmsg
    [ %] Built target mixer_gen
    [ %] Built target git_nuttx
    [ %] Built target git_gencpp
    [ %] Built target git_matrix
    [ %] Built target git_uavcan
    [ %] Built target git_mavlink
    [ %] Built target git_ecl
    [ %] Built target libuavcan_dsdlc
    [ %] Built target ver_gen
    [ %] Built target airframes_xml
    [ %] Built target parameters_xml
    [ %] Built target nuttx_copy_px4fmu-v3
    [ %] Built target nuttx_copy_px4io-v2
    [ %] Built target px4fmu-v3-nuttx_patch_00001-REJECTED-add-math.h.patch
    [ %] Built target px4io-v2-nuttx_patch_00001-REJECTED-add-math.h.patch
    [ %] Built target px4fmu-v3-nuttx_patch_00002-REJECTED-fix-shadow-wanings.patch
    [ %] Built target px4io-v2-nuttx_patch_00002-REJECTED-fix-shadow-wanings.patch
    [ %] Built target px4io-v2-nuttx_patch_00003-REJECTED-add-var-expansion-in-nsh-parse.patch
    [ %] Built target px4fmu-v3-nuttx_patch_00003-REJECTED-add-var-expansion-in-nsh-parse.patch
    [ %] Built target px4io-v2-nuttx_patch_00004-REJECTED-avoid-export-copy-with-export-insitu.patch
    [ %] Built target px4fmu-v3-nuttx_patch_00004-REJECTED-avoid-export-copy-with-export-insitu.patch
    [ %] Built target px4io-v2-nuttx_patch_00005-REJECTED-support-c++.patch
    [ %] Built target px4fmu-v3-nuttx_patch_00005-REJECTED-support-c++.patch
    [ %] Built target px4io-v2-nuttx_patch_00006-REJECTED-cstdint-fix.patch
    [ %] Built target px4fmu-v3-nuttx_patch_00006-REJECTED-cstdint-fix.patch
    [ %] Built target px4io-v2-nuttx_patch_00007-REJECTED-silence-jobserver-warnings.patch
    [ %] Built target px4io-v2-nuttx_patch_00008-REJECTED-static-assert-fix.patch
    [ %] Built target px4fmu-v3-nuttx_patch_00007-REJECTED-silence-jobserver-warnings.patch
    [ %] Built target px4io-v2-nuttx_patch_00009-REJECTED-ctype-fix-shadow-wanings.patch
    [ %] Built target px4fmu-v3-nuttx_patch_00008-REJECTED-static-assert-fix.patch
    [ %] Built target px4io-v2-nuttx_patch_00010-BACKPORT-stm32-flash-F4-dcache-corruption-fix-no-HSI-on.patch
    [ %] Built target px4io-v2-nuttx_patch_00011-BACKPORT-priority-restoration-fix.patch
    [ %] Built target px4fmu-v3-nuttx_patch_00009-REJECTED-ctype-fix-shadow-wanings.patch
    [ %] Built target px4io-v2-nuttx_patch_00012-BACKPORT-stack-coloration-overreach-fix.patch
    [ %] Built target px4fmu-v3-nuttx_patch_00010-BACKPORT-stm32-flash-F4-dcache-corruption-fix-no-HSI-on.patch
    [ %] Built target px4io-v2-nuttx_patch_00013-BACKPORT-stm32-serial-dma-hotfix.patch
    [ %] Built target px4fmu-v3-nuttx_patch_00011-BACKPORT-priority-restoration-fix.patch
    [ %] Built target px4io-v2-nuttx_patch_00014-BACKPORT-i2c-hotfix.patch
    [ %] Built target px4fmu-v3-nuttx_patch_00012-BACKPORT-stack-coloration-overreach-fix.patch
    [ %] Built target px4io-v2-nuttx_patch_00015-BACKPORT-stm32f7-DTCM.patch
    [ %] Built target px4fmu-v3-nuttx_patch_00013-BACKPORT-stm32-serial-dma-hotfix.patch
    [ %] Built target px4io-v2-nuttx_patch_00016-BACKPORT-fix-CRTSCTS-defines.patch
    [ %] Built target px4io-v2-nuttx_patch_00017-BACKPORT-cdcacm.patch
    [ %] Built target px4fmu-v3-nuttx_patch_00014-BACKPORT-i2c-hotfix.patch
    [ %] Built target px4io-v2-nuttx_patch_00018-BACKPORT-stm32-serial-break.patch
    [ %] Built target px4fmu-v3-nuttx_patch_00015-BACKPORT-stm32f7-DTCM.patch
    [ %] Built target px4io-v2-nuttx_patch_00019-BACKPORT-stm32-rcc-keep-HSI-on.patch
    [ %] Built target px4fmu-v3-nuttx_patch_00016-BACKPORT-fix-CRTSCTS-defines.patch
    [ %] Built target px4io-v2-nuttx_patch_00020-BACKPORT-ramtron-CONFIG-prefix.patch
    [ %] Built target px4fmu-v3-nuttx_patch_00017-BACKPORT-cdcacm.patch
    [ %] Built target px4io-v2-nuttx_patch_00021-BACKPORT-stm32f3x-add-BKP.patch
    [ %] Built target px4fmu-v3-nuttx_patch_00018-BACKPORT-stm32-serial-break.patch
    [ %] Built target px4io-v2-nuttx_patch_00022-BACKPORT-stm32-bkp-reference-fix.patch
    [ %] Built target px4fmu-v3-nuttx_patch_00019-BACKPORT-stm32-rcc-keep-HSI-on.patch
    [ %] Built target px4io-v2-nuttx_patch_00023-BACKPORT-stm32f7-bkp-reference-fix.patch
    [ %] Built target px4fmu-v3-nuttx_patch_00020-BACKPORT-ramtron-CONFIG-prefix.patch
    [ %] Built target px4io-v2-nuttx_patch_00024-BACKPORT-stm32f7-serial-dma-hotfix.patch
    [ %] Built target px4fmu-v3-nuttx_patch_00021-BACKPORT-stm32f3x-add-BKP.patch
    [ %] Built target px4io-v2-nuttx_patch_00025-BACKPORT-add-set-ex-to-nsh.patch
    [ %] Built target px4fmu-v3-nuttx_patch_00022-BACKPORT-stm32-bkp-reference-fix.patch
    [ %] Built target px4io-v2-nuttx_patch_00026-BACKPORT-stm32fX-serial-fix-freezing.patch
    [ %] Built target px4fmu-v3-nuttx_patch_00023-BACKPORT-stm32f7-bkp-reference-fix.patch
    [ %] Built target px4io-v2-nuttx_patch_00027-BACKPORT-stm32-sdio--bit-and-16G-fix.patch
    [ %] Built target px4fmu-v3-nuttx_patch_00024-BACKPORT-stm32f7-serial-dma-hotfix.patch
    [ %] Built target px4io-v2-nuttx_patch_00030-BACKPORT-fix-arm-none-eabi-gcc--warnings-nuttx.patch
    [ %] Built target px4fmu-v3-nuttx_patch_00025-BACKPORT-add-set-ex-to-nsh.patch
    [ %] Built target px4io-v2-nuttx_patch_00031-BACKPORT-fix-arm-none-eabi-gcc--warnings-apps.patch
    [ %] Built target px4io-v2-nuttx_patch_90000-PENDING-wip-inflight-to-upstream.patch
    [ %] Built target px4fmu-v3-nuttx_patch_00026-BACKPORT-stm32fX-serial-fix-freezing.patch
    [ %] Built target nuttx_patch_px4io-v2
    [ %] Built target px4fmu-v3-nuttx_patch_00027-BACKPORT-stm32-sdio--bit-and-16G-fix.patch
    [ %] Built target nuttx_configure_px4io-v2
    [ %] Built target px4fmu-v3-nuttx_patch_00030-BACKPORT-fix-arm-none-eabi-gcc--warnings-nuttx.patch
    [ %] Built target nuttx_export_px4io-v2
    [ %] Built target px4fmu-v3-nuttx_patch_00031-BACKPORT-fix-arm-none-eabi-gcc--warnings-apps.patch
    [ %] Built target io_prebuild_targets
    [ %] Built target px4fmu-v3-nuttx_patch_90000-PENDING-wip-inflight-to-upstream.patch
    [ %] Built target nuttx_patch_px4fmu-v3
    [ %] Built target nuttx_configure_px4fmu-v3
    [ %] Built target nuttx_export_px4fmu-v3
    [ %] Built target prebuild_targets
    [ %] Built target msg_gen
    [ %] Built target generate_topic_listener
    [ %] Built target platforms__common
    [ %] Built target drivers__airspeed
    [ %] Built target drivers__blinkm
    [ %] Built target px4io-v2
    [ %] Built target drivers__bmi160
    [ %] Built target drivers__bmp280
    [ %] Built target drivers__boards__px4fmu-v2
    [ %] Built target drivers__camera_trigger
    [ %] Built target drivers__bst
    [ %] Built target drivers__device
    [ %] Built target drivers__ets_airspeed
    [ %] Built target drivers__hott
    [ %] Built target drivers__frsky_telemetry
    [ %] Built target drivers__hmc5883
    [ %] Built target drivers__gps
    [ %] Built target drivers__iridiumsbd
    [ %] Built target drivers__hott__hott_telemetry
    [ %] Built target drivers__hott__hott_sensors
    [ %] Built target drivers__l3gd20
    [ %] Built target drivers__led
    [ %] Built target drivers__lsm303d
    [ %] Built target drivers__lis3mdl
    [ %] Built target drivers__ll40ls
    [ %] Built target drivers__mb12xx
    [ %] Built target drivers__mkblctrl
    [ %] Built target drivers__mpu6000
    [ %] Built target drivers__ms4525_airspeed
    [ %] Built target drivers__mpu9250
    [ %] Built target drivers__ms5525_airspeed
    [ %] Built target drivers__oreoled
    [ %] Built target drivers__ms5611
    [ %] Built target drivers__pwm_out_sim
    [ %] Built target drivers__pwm_input
    [ %] Built target drivers__px4flow
    [ %] Built target drivers__px4fmu
    [ %] Built target lib__led
    [ %] Built target drivers__sf0x
    [ %] Built target drivers__px4io
    [ %] Built target drivers__sdp3x_airspeed
    [ %] Built target drivers__sf1xx
    [ %] Built target drivers__srf02
    [ %] Built target drivers__stm32__adc
    [ %] Built target drivers__snapdragon_rc_pwm
    [ %] Built target drivers__stm32
    [ %] Built target drivers__stm32__tone_alarm
    [ %] Built target drivers__tap_esc
    [ %] Built target drivers__trone
    [ %] Built target drivers__vmount
    [ %] Built target modules__sensors
    [ %] Built target systemcmds__config
    [ %] Built target systemcmds__bl_update
    [ %] Built target systemcmds__esc_calib
    [ %] Built target systemcmds__dumpfile
    [ %] Built target systemcmds__hardfault_log
    [ %] Built target systemcmds__led_control
    [ %] Built target systemcmds__mixer
    [ %] Built target systemcmds__motor_ramp
    [ %] Built target systemcmds__mtd
    [ %] Built target systemcmds__perf
    [ %] Built target systemcmds__param
    [ %] Built target systemcmds__nshterm
    [ %] Built target systemcmds__pwm
    [ %] Built target systemcmds__reboot
    [ %] Built target systemcmds__sd_bench
    [ %] Built target systemcmds__top
    [ %] Built target systemcmds__ver
    [ %] Built target systemcmds__topic_listener
    [ %] Built target drivers__sf0x__sf0x_tests
    [ %] Built target drivers__test_ppm
    [ %] Built target lib__controllib__controllib_test
    [ %] Built target modules__commander__commander_tests
    [ %] Built target modules__unit_test
    [ %] Built target modules__mc_pos_control__mc_pos_control_tests
    [ %] Built target modules__mavlink__mavlink_tests
    [ %] Built target modules__uORB__uORB_tests
    [ %] Built target modules__gpio_led
    [ %] Built target modules__uORB
    [ %] Built target modules__commander
    [ %] Built target modules__land_detector
    [ %] Built target modules__load_mon
    [ %] Built target systemcmds__tests
    [ %] Built target platforms__nuttx
    [ %] Built target modules__camera_feedback
    [ %] Built target modules__mavlink
    [ %] Built target modules__navigator
    [ %] Built target modules__attitude_estimator_q
    [ %] Built target modules__ekf2
    [ %] Built target modules__position_estimator_inav
    [ %] Built target modules__local_position_estimator
    [ %] Built target lib__external_lgpl
    [ %] Built target modules__mc_att_control
    [ %] Built target modules__mc_pos_control
    [ %] Built target lib__ecl
    [ %] Built target modules__vtol_att_control
    [ %] Built target modules__logger
    [ %] Built target modules__sdlog2
    [ %] Built target modules__dataman
    [ %] Built target modules__systemlib__param
    [ %] Built target modules__systemlib__mixer
    [ %] Built target lib__controllib
    [ %] Built target lib__conversion
    [ %] Built target modules__systemlib
    [ %] Built target df_driver_framework
    [ %] Built target lib__geo
    [ %] Built target lib__geo_lookup
    [ %] Built target lib__launchdetection
    [ %] Built target lib__mathlib
    [ %] Built target lib__mathlib__math__filter
    [ %] Built target lib__runway_takeoff
    [ %] Built target lib__tailsitter_recovery
    [ %] Built target lib__version
    [ %] Built target lib__terrain_estimation
    [ %] Built target examples__rover_steering_control
    [ %] Built target platforms__nuttx__px4_layer
    [ %] Built target modules__bottle_drop
    [ %] Built target examples__segway
    [ %] Built target examples__fixedwing_control
    [ %] Built target examples__px4_mavlink_debug
    [ %] Built target examples__px4_simple_app
    [ %] Built target examples__px4_daemon_app
    [ %] Built target fw_io
    [ %] Built target examples__hwtest
    [ %] Built target examples__ekf_att_pos_estimator
    [ %] Built target drivers__rgbled
    [ %] Built target modules__fw_att_control
    [ %] Built target modules__fw_pos_control_l1
    [ %] Built target modules__events
    [ %] Built target modules__gnd_pos_control
    [ %] Built target modules__gnd_att_control
    [ %] Built target lib__DriverFramework__framework
    [ %] Built target uavcan
    [ %] Built target romfs
    [ %] Built target uavcan_stm32_driver
    [%] Built target modules__uavcan
    [%] Built target firmware_nuttx
    [%] uploading /home/spy/src/Firmware/build_px4fmu-v3_default/src/firmware/nuttx/px4fmu-v3_default.px4
    Loaded firmware for ,, size: bytes, waiting for the bootloader...
    If the board does not respond within - 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=...
    If the board does not respond, unplug and re-plug the USB connector.
    Found board , bootloader rev 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:
    family: STM32F42x
    revision:
    flash Erase : [====================] 100.0% (timeout: seconds)
    Program: [====================] 100.0%
    Verify : [====================] 100.0%
    Rebooting. [%] Built target upload

    over,编译完工。

 

  

[pixhawk笔记]1-编译过程的更多相关文章

  1. Vue学习笔记:编译过程

    碰到是否有template选项时,会询问是否要对template进行编译: 在template编译(渲染成UI)有一个过程.模板通过编译生成AST,再由AST生成Vue的渲染函数,渲染函数结合数据生成 ...

  2. [pixhawk笔记]4-如何写一个简单的应用程序

    本文主要内容来自于:https://dev.px4.io/en/tutorials/tutorial_hello_sky.html,并对文档中的部分问题进行更正. 本文假设已经建立好开发环境并能正确编 ...

  3. 笔记:C 编译过程

    笔记:C 编译过程 参考了 编译器的工作过程 1 C 编译过程 配置 确定标准库和头文件位置 确定依赖关系 头文件的预编译 预处理 编译 连接 F4NNIU 2018-06-12 编译器的工作过程 h ...

  4. C语言笔记——简介与编译过程初探

    序言 从今天起,详细说说C语言.这一年多,在大多数语言和技术之间转了一大圈,终于看清楚了事实,决心静下心来好好学学C语言.初学者会认为C语言是个入门用的东西,没有必要深入研究.但对计算机领域再稍加了解 ...

  5. 【嵌入式开发】gcc 学习笔记(一) - 编译C程序 及 编译过程

    一. C程序编译过程 编译过程简介 : C语言的源文件 编译成 可执行文件需要四个步骤, 预处理 (Preprocessing) 扩展宏, 编译 (compilation) 得到汇编语言, 汇编 (a ...

  6. gcc 学习笔记(一) - 编译C程序 及 编译过程

    一. C程序编译过程 编译过程简介 : C语言的源文件 编译成 可执行文件需要四个步骤, 预处理 (Preprocessing) 扩展宏, 编译 (compilation) 得到汇编语言, 汇编 (a ...

  7. asp.net原理笔记----页面控件类型,页面状况和asp.net编译过程

    通过查看asp.net的整个生命周期之后 了解到在aspx的页面生命周期中 调用了BuildControlTree()方法生成页面控件树 之后再调用Rend()方法根据控件树生成html返回 aspx ...

  8. Hadoop源码编译过程

    一.           为什么要编译Hadoop源码 Hadoop是使用Java语言开发的,但是有一些需求和操作并不适合使用java,所以就引入了本地库(Native Libraries)的概念,通 ...

  9. 在linux使用make编译ArduPilot for Pixhawk/PX4 ArduPilot 编译环境搭建

    Building ArduPilot for Pixhawk/PX4 on Linux with Make 使用Make编译 ArduPilot for Pixhawk 2, Pixhawk and ...

随机推荐

  1. (转)servlet setCharacterEncoding setContentType

    转自:http://blog.csdn.net/fancylovejava/article/details/7700683 编码中的setCharacterEncoding 理解 1.pageEnco ...

  2. python进阶九_网络编程

    Python网络编程一 一.一些基本概念 在Python网络编程这一节中会涉及到非常多网络相关的术语.对于一些最主要的概念,如TCP/IP,Socket等等不再赘述,不明确的能够自己去查一查,对于一些 ...

  3. CopyOnWriteArrayList分析

    ArrayList是比较常用的一个可变大小的数组集合,但是是不能同步的.如果多个线程同时访问一个ArrayList实例,其中至少一个线程从结构上修改了列表,那么它必须保持外部同步.一般通过加锁对象进行 ...

  4. poj 2752 Seek the Name, Seek the Fame (KMP纯模版)

    Seek the Name, Seek the Fame Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 13840   Ac ...

  5. Sublime text 3 快捷键:

    Ctrl+Shift+[  选中代码,按下快捷键,折叠代码. Ctrl+Shift+]  选中代码,按下快捷键,展开代码.  Ctrl+Shift+P:打开命令面板 Ctrl+P:打开搜索框,搜索项目 ...

  6. HDU4267(2012年长春站)

    这道题真的是好题,让我对线段树有了全新的认识,至少让我真正感受到了线段树的神奇. 题意是就是线段树区间更新,单点询问的问题,不过这个题好就好在它的区间更新的点并不连续! adding c to eac ...

  7. java的list去重

    Set<EmployeeInfoDTO> empSet = new HashSet<EmployeeInfoDTO>(empListAll);List<EmployeeI ...

  8. 穿透Session 0 隔离(一)

    服务(Service)对于大家来说一定不会陌生,它是Windows 操作系统重要的组成部分.我们可以把服务想像成一种特殊的应用程序,它随系统的“开启-关闭”而“开始-停止”其工作内容,在这期间无需任何 ...

  9. 修改jquery.automeplete,使其支持value匹配

    原生只会去匹配label,可在实际使用中,可能需要匹配的值并不需要显示在label中,经过添加一个matchType属性解决 1.加入matchType选项,并默认为原生匹配 $.widget(&qu ...

  10. Taylor series

    w用有限来表达无限,由已知到未知,化未知为已知. https://en.wikipedia.org/wiki/Taylor_series The Greek philosopher Zeno cons ...