px4官网提供了一个批处理方式搭建px4开发环境,十分好用,按照官网步骤

1 sudo usermod -a -G dialout $USER

2 登出再登入使命令生效

3下载几个脚本,不需要每个都下,几个脚本是包含关系下面会细说:

ubuntu_sim_common_deps.sh: Common Dependencies, jMAVSim simulator 这个脚本可以生成需要的依赖关系以及耳熟能详的qt、git、cmake、pyulog、pip、python等以及安装JMAVSim软件,

ubuntu_sim.sh: ubuntu_sim_common_deps.sh + Gazebo8 simulator. 这个脚本包含了上个脚本,再次基础上安装了Gazebo8。意思就是如果运行了这个脚本,那么就不用运行第一个脚本了,如果运行了第一个脚本,在运行这个脚本时不会重复安装,比较好用。以下依次类推

: ubuntu_sim.sh + NuttX tools. 包含了上个脚本,gcc就是在这个脚本中安装的,这个脚本用的时间比较长,主要是gcc安装地址连不上,后来翻墙解决的。

: ubuntu_sim_common_deps.sh + ROS/Gazebo and MAVROS.主要是安装了ROS和Gazebo

4到下载的文件夹下运行下面的命令:

source ubuntu_sim_nuttx.sh

5重启电脑

6下载QGC,在下面的链接中下载老的版本,之所以下载老的版本新的版本连不上pixhawk(极大可能是串口没设对,小部分可能就是版本问题,回头解决这个问题),下了个3.0.1版本可以直接连,但是该版本需要先插入pixhawk才能工作:

https://docs.qgroundcontrol.com/en/releases/release_notes.html

我下的是.AppImage,下载后对QGC添加执行操作授权即下面第一句,下面第二句是打开QGC,以后都可以直接输入第二句打开

chmod +x ./QGroundControl.AppImage
./QGroundControl.AppImage  (or double click)

7编译和上传

使用命令行编译和上传,这里要注意pixhawk的版本之前按照官网直接输入了v4结果出现了board ID和firmware ID不匹配的问题:

cd Firmware
make px4fmu-v2_default
make px4fmu-v4_default upload

用qt编译并上传:

(1)首先得进行如下操作,这是官网给的,但是不对,可以编译但不能上传给,参考

https://blog.csdn.net/oqqenvy12/article/details/52035127?_t=t进行修改

cd ~/src/Firmware
mkdir ../Firmware-build
cd ../Firmware-build
cmake ../Firmware -G "CodeBlocks - Unix Makefiles"

摘录该网页的原话:

提个醒: 按照官网上面最后一行的命令,当前使用Qt编译得到的将是build px4 ,因为默认的编译指令是make posix_sitl_default,这不是大家所期待的结果。

解决方案:对于,Pixhawk硬件,将最后一行改成
cmake ../Firmware -G "CodeBlocks - Unix Makefiles" -DCONFIG=nuttx_px4fmu-v2_default

其他例如使用FMUv4的用户请根据需求进行替换。

修改后,打开qt,通过 File -> Open File or Project -> Select the CMakeLists.txt file加载工程,其中Cmakelists是firmware下的那个。在项目的运行标签菜单中添加upload,添加后直接点绿色的按钮即运行键

下面是ubuntu_sim_common_deps.sh脚本:

#!/bin/bash## Bash script for setting up a PX4 development environment on Ubuntu LTS (16.04).
## It can be used for installing simulators (only) or for installing the preconditions for Snapdragon Flight or Raspberry Pi.
##
## Installs:
## - Common dependencies and tools for all targets (including: Ninja build system, Qt Creator, pyulog)
## - FastRTPS and FastCDR
## - jMAVSim simulator dependencies
## - PX4/Firmware source (to ~/src/Firmware/)# Preventing sudo timeout https://serverfault.com/a/833888
trap "exit" INT TERM; trap "kill 0" EXIT; sudo -v || exit $?; sleep 1; while true; do sleep 60; sudo -nv; done 2>/dev/null &# Ubuntu Config
echo "We must first remove modemmanager"
sudo apt-get remove modemmanager -y# Common dependencies
echo "Installing common dependencies"
sudo apt-get update -y
sudo apt-get install git zip qtcreator cmake build-essential genromfs ninja-build -y
# Required python packages
sudo apt-get install python-argparse python-empy python-toml python-numpy python-dev python-pip -y
sudo -H pip install --upgrade pip
sudo -H pip install pandas jinja2 pyserial
# optional python tools
sudo -H pip install pyulog# Install FastRTPS 1.5.0 and FastCDR-1.0.7
fastrtps_dir=$HOME/eProsima_FastRTPS-1.5.0-Linux
echo "Installing FastRTPS to: $fastrtps_dir"
if [ -d "$fastrtps_dir" ]
thenecho " FastRTPS already installed."
elsepushd .cd ~wget http://www.eprosima.com/index.php/component/ars/repository/eprosima-fast-rtps/eprosima-fast-rtps-1-5-0/eprosima_fastrtps-1-5-0-linux-tar-gz -O eprosima_fastrtps-1-5-0-linux.tar.gztar -xzf eprosima_fastrtps-1-5-0-linux.tar.gz eProsima_FastRTPS-1.5.0-Linux/tar -xzf eprosima_fastrtps-1-5-0-linux.tar.gz requiredcomponentstar -xzf requiredcomponents/eProsima_FastCDR-1.0.7-Linux.tar.gzcpucores=$(( $(lscpu | grep Core.*per.*socket | awk -F: '{print $2}') * $(lscpu | grep Socket\(s\) | awk -F: '{print $2}') ))cd eProsima_FastCDR-1.0.7-Linux; ./configure --libdir=/usr/lib; make -j$cpucores; sudo make installcd ..cd eProsima_FastRTPS-1.5.0-Linux; ./configure --libdir=/usr/lib; make -j$cpucores; sudo make installcd ..rm -rf requiredcomponents eprosima_fastrtps-1-5-0-linux.tar.gzpopd
fi# jMAVSim simulator dependencies
echo "Installing jMAVSim simulator dependencies"
sudo apt-get install ant openjdk-8-jdk openjdk-8-jre -y# Clone PX4/Firmware
clone_dir=~/src
echo "Cloning PX4 to: $clone_dir."
if [ -d "$clone_dir" ]
thenecho " Firmware already cloned."
elsemkdir -p $clone_dircd $clone_dirgit clone https://github.com/PX4/Firmware.git
fi

ubuntu16.04下px4环境搭建与固件编译相关推荐

  1. KVM虚拟机在Ubuntu16.04下的环境搭建

    1 查看CPU是否支持KVM egrep "(svm|vmx)" /proc/cpuinfo 有结果输出,如下图: 2 安装KVM及相关依赖包 sudo apt-get insta ...

  2. Ubuntu16.04深度学习环境搭建

    Ubuntu16.04深度学习环境搭建(anaconda3+cuda10.0+cudnn7.6+pytorch1.2) 文章目录 Ubuntu16.04深度学习环境搭建(anaconda3+cuda1 ...

  3. 双系统gazebo闪退_记录Ubuntu16.04下PX4联合Gazebo仿真时遇到的问题与解决方法

    一.arm-none-eabi-gcc版本问题 在Ubuntu16.04中使用sudo apt-get install gcc-arm-none-eabi命令会自动安装默认版本(gcc version ...

  4. Ubuntu16.04下利用EasyDarwin搭建RTSP流媒体服务器

    文章目录 前言 1.必要环境 2.安装 2.1 下载ffmpeg 2.2 下载EasyDarwin源码 2.3 修改内部参数 3.运行 4.测试 4.1 测试推流 4.2 python播放视频 5.可 ...

  5. 阿里云ubuntu14.04下lamp环境搭建の备忘

    以下内容大部分来自于网络上的收集,百度搜lamp能搜到很多文字教程.百度lamp搭建 推荐几个视频教程: 在Ubuntu Server下搭建LAMP环境 PHP环境LAMP/LNMP安装与配置 我收藏 ...

  6. OpenStack实践(一):Ubuntu16.04下DevStack方式搭建p版OpenStack

    OpenStack部署方式很多,常见的个人部署方式有DevStack.Rdo.all-in-one.multi-node.multi-HA-node等:企业部署方式有Ansible.SaltStack ...

  7. ubuntu16.04服务器开发环境搭建

    这是我搭建完成后跟着记忆写的.这个博客可能还有些漏洞.如果我亲自看着这这篇博客搭建成功(修改)后.会删除这句话 ubuntu16.04有php7.0资源.14.04没有.这里是基于16.04的谢谢. ...

  8. ubuntu16.04下FSA-Net环境安装和训练

    代码下载 下载代码, 可以使用码云下载代码 git clone FSA-Net: [CVPR19] FSA-Net: Learning Fine-Grained Structure Aggregati ...

  9. 2 运维-ubuntu16.04.6xenial-基础环境搭建-安装docker-ce

    文章目录 1 安装要求 2 安装方式 2.1 采用脚本安装 2.2 采用仓库安装 2.2.1 官网仓库 2.2.2 清华仓库 2.3 采用安装包安装 3 配置 3.1 配置镜像加速器 3.2 配置组件 ...

最新文章

  1. 常用英文标点符号的使用
  2. ReentrantReadWriteLock读写锁
  3. 远程桌面连接mstsc 超扎心
  4. 【Other】Ubuntu 14.04 pptp 客户端连接配置
  5. hue 添加jar_在hue下配置jdbc驱动
  6. web开发要学多久,HTML表格标签,薪资翻倍
  7. 80后程序员必须知道的编程语言和它们的创造者
  8. 比亚迪:华为的手机,我们造的
  9. XUtils BitmapUtils 改造以加入drawable支持
  10. springBoot项目启动后无法访问index.html首页或其它controller
  11. OpenOCD 依赖的deb包
  12. linux下ftp二进制传输,FTP的两种传输模式:BINARY和ASCII
  13. 阻击 瑞星 和 雅虎助手 的 SVOHOST.exe(第2版)
  14. python瓦登尔湖词频统计
  15. 基于Python的随机森林(RF)回归与变量重要性影响程度分析
  16. Arch Linux 天坑
  17. 多多买菜代收被叫停?拼多多这样回应
  18. Transformer解读之:Transformer 中的 Attention 机制
  19. 赋值具有的非单一 rhs 维度多于非单一下标数错误的分析和解决方法
  20. 北京科技大学 Dog类定义和测试

热门文章

  1. 网站服务器记录登录,怎样查看远程登录过服务器的记录
  2. 2014年12月30日,31日,2015年1月3日,4日
  3. 2021央美高考成绩查询,【速看】2021届央美初试考题公示~
  4. 查看dll文件的内容
  5. 【fpga】ddr3
  6. rust进水器怎么用_易水香教你如何正确使用家用净水器
  7. WINDOWS 2008 R2无法安装显卡驱动问题解决
  8. aspose将word文档转为html内容
  9. LeetCode49-字母异位词分组
  10. linux台式机双屏幕怎么连接,台式机怎么分屏_台式机双显示器连接方法-太平洋IT百科手机版...