Ubuntu16.04下的环境搭建
之前搭建PX4环境常常编译不通,cmake,gcc,以及交叉编译器gcc-arm-none-eabi的版本问题导致make固件报错,好不容易编译通过了,在进行安装jMAVSim simulator时又出现一些Javaclass没有,很是头疼,现在有好消息了,官网现在提供了安装各种文件的脚本文件了,简直方便的不行,现在具体介绍搭建步骤:
1. 注销:
sudo usermod -a -G dialout $USER
注销之后再登入,这样你就成为新的用户了,这个操作只需要进行一次,之后你再需要重新下载固件就不需要这一步了
2. 运行脚本文件:
官网最新提供了一个脚本文件,新建一个脚本文件ubuntu_sim_nuttx.sh,这个脚本文件不仅有PX4环境所需要的各种库,并且也安装了jMAVSim的各种依赖。复制以下内容到脚本文件中:
#!/bin/bash
## Bash script for setting up a PX4 development environment for Pixhawk/NuttX targets on Ubuntu LTS (16.04).
## It can be used for installing simulators and the NuttX toolchain.
##
## Installs:
## - Common dependencies and tools for all targets (including: Ninja build system, Qt Creator, pyulog)
## - FastRTPS and FastCDR
## - jMAVSim simulator
## - Gazebo8 simulator
## - NuttX toolchain (i.e. gcc compiler)
## - PX4/Firmware source (to ~/src/Firmware/)
# Ubuntu Config
sudo apt-get remove modemmanager -y
# Ninja build system
ninja_dir=$HOME/ninja
echo "Installing Ninja to: $ninja_dir."
if [ -d "$ninja_dir" ]
then
echo " Ninja already installed."
else
pushd .
mkdir -p $ninja_dir
cd $ninja_dir
wget https://github.com/martine/ninja/releases/download/v1.6.0/ninja-linux.zip
unzip ninja-linux.zip
rm ninja-linux.zip
exportline="export PATH=$ninja_dir:\$PATH"
if grep -Fxq "$exportline" ~/.profile; then echo " Ninja already in path" ; else echo $exportline >> ~/.profile; fi
. ~/.profile
popd
fi
# Common Dependencies
echo "Installing common dependencies"
sudo add-apt-repository ppa:george-edison55/cmake-3.x -y
sudo apt-get update
sudo apt-get install python-argparse git-core wget zip python-empy qtcreator cmake build-essential genromfs -y
# required python packages
sudo apt-get install python-dev -y
sudo apt-get install python-pip
sudo -H pip install pandas jinja2
pip install pyserial
# optional python tools
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