Ubuntu18.04搭建PX4飞控环境
2020.12.17
环境:VMWare workstation player 16 + ubuntu18.04及以上的系统(强烈不建议16.04)
一、安装、配置git
由于px4在make时会检测.git文件夹的内容,因此务必使用git clone获取源码,而不能从github上手动下载代码。
打开终端(Terminal),依次运行:
下载git:sudo apt-get install git
配置个人信息:
git config --global user.name "github ID"
git config --global user.email "Your E-mail"
创建公钥:
ssh-keygen -C 'Your E-mail' -t rsa
进入文件夹:cd ~/.ssh
打开公钥文件,gedit id_rsa.pub
,拷贝文件内全部内容。
登录github,点击右上角头像进入settings->SSH and GPG keys->New SSH key,Title自拟,将公钥粘贴到Key,点击Add SSH Key。
二、准备px4源码
在终端输入:git clone https://github.com/PX4/PX4-Autopilot.git --recursive
进入PX4-Autopilot:cd PX4-Autopilot
安装工具库:bash ./Tools/setup/ubuntu.sh
中途需要输入几次密码
三、运行
仿真软件:make px4_sitl jmavsim

build:根据飞控版本选择:
将firmware写入飞控
在上述代码后加一个upload,如:
make px4_fmu-v4_default upload
显示如图状态即为写入成功: