Building
ArdupilotFor Pixhawk/px4 on
LinuxWith make
Use make to compile ardupilot for Pixhawk 2, Pixhawk and PX4 on Linux.
Note: Compile Pixhawk 2 and Pixhawk using ( make px4-v2
). Compile PX4 use make px4-v1
.
Quick start
System ubuntu16.04
Setup
To install Git:
sudo apt-get-qq-y install git
Installing the ARM-NONE-EABI-GCC Compiler
Installing Gawk,cmake
Apt-get Install gawk CMake
Clone Source to Local:
git clone https://github.com/diydrones/ardupilot. git
Run the Ubuntu installation script:
Ardupilot/tools/scripts/install-prereqs-ubuntu.sh-y
Reload the path (Log-out and log-in to make permanent):
. ~/.profile
Build Compilation
Here are the commands to compile Pixhawk2/pixhawk for different models. Compile PX4 use make px4-v2 instead ofmake px4-v1
To build for PX4 replace make px4-v2
with make px4-v1
.
Build for Copter:
ardupilot/arducoptermake px4-v2
Issues that occur during the compilation process:
The matrix directory name on GitHub has changed so it can't be found, manual git clone download can
The following problems arise:
Less python-empy,pip,catkin-pkg, directly using the Apt-get install installation can
Follow the instructions to install whichever is less
Another problem: Genromfs not found
Direct Apt-get Install Genromfs
Final compile succeeded, generate PX4 firmware file
Build for Plane:
ardupilot/arduplanemake px4-v2
Build for Rover:
ardupilot/apmrover2make px4-v2
Build for antenna Tracker:
ardupilot/antennatrackermake px4-v2
Building
One of you has the 3 git trees and compiler setup you does the build in your vehicle directory. For example, if building Plane then does this:
ardupilot/arduplanemake px4
That would build the files arduplane-v1.px4 and arduplane-v2.px4. The V1 file is for px4v1, and the V2 file is for px4v2 (the Pixhawk).
You can only compile one using "make Px4-v1" or "makes Px4-v2".
The first time you build it'll take quite a long time as it builds the PX4 archives. Subsequent builds is faster (especially if you setup ccache correctly).
Loading firmware
To load the firmware onto the board use
Make Px4-v1-upload
Or
Make Px4-v2-upload
After it says ' waiting for bootloader ' plugin your PX4 on USB.
If upload consistently fails in the erase step and check if you're running ' modemmanager ' which can take control of the PX4 USB Port. Removing Modemmanager can help.
Cleaning
If There has been updates to the PX4NUTTX or px4firmware git submodules you could need to does a full clean build. To do the use:
Make Px4-clean
That'll remove the px4nuttx archives So can do a build from scratch
Build Ardupilot for PIXHAWK/PX4 ardupilot build environment using make compilation in Linux