setup guide
Bash Scripts
Bash scripts are provided to help make it easy to install development environment for different target platforms. They are intended to be run on clean Ubuntu LTS installations.
Script | Description |
---|---|
ubuntu.sh | Installs Gazebo 9 and jMAVSim simulators and/or NuttX/Pixhawk tools. Does not include dependencies for Fast DDS. |
ubuntu_sim_ros_melodic.sh | Installs ROS “Melodic” and PX4 on Ubuntu 18.04 LTS only. Do not use on Ubuntu 20.04 or later! |
:::note The scripts may not work if installed “on top” of an existing system, or on a different Ubuntu release. :::
Gazebo, JMAVSim and NuttX (Pixhawk) Targets
Use the ubuntu.sh script to set up a development environment that includes Gazebo 9 and jMAVSim simulators, and/or the NuttX/Pixhawk toolchain.
:::warning ROS users must follow the instructions for: ROS/Gazebo. :::
To install the toolchain:
- Download PX4 Source Code:
git clone https://github.com/PX4/PX4-Autopilot.git --recursive
- Run the ubuntu.sh with no arguments (in a bash shell) to install everything:
bash ./PX4-Autopilot/Tools/setup/ubuntu.sh
- Acknowledge any prompts as the script progress.
- You can use the
--no-nuttx
and--no-sim-tools
options to omit the NuttX and/or simulation tools.
- Restart the computer on completion.
::: details Information-only notes
- The script installs Gazebo 9 (following gazebosim.org instructions). Gazebo 7, 8 are also supported but not recommended.
- You can verify the NuttX installation by confirming the gcc version as shown:
$arm-none-eabi-gcc --version arm-none-eabi-gcc (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204] Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- You’re going to need the PX4 source code anyway.
But if you just wanted to set up the development environment without getting all the source code you could instead just download ubuntu.sh and requirements.txt and then run ubuntu.sh:
wget https://raw.githubusercontent.com/PX4/PX4-Autopilot/master/Tools/setup/ubuntu.sh wget https://raw.githubusercontent.com/PX4/PX4-Autopilot/master/Tools/setup/requirements.txt bash ubuntu.sh
:::
Raspberry Pi
The following instructions explain how to set up a build toolchain for RasPi on Ubuntu 18.04.
:::warning To build for Ubuntu 20.04 (focal) you must use docker (the GCC toolchain on Ubuntu 20.04 can build PX4, but the generated binary files are too new to run on actual Pi). For more information see PilotPi with Raspberry Pi OS Developer Quick Start > Alternative build method using docker. :::
To get the common dependencies for Raspberry Pi:
- Download ubuntu.sh and requirements.txt from the PX4 source repository (/Tools/setup/):
wget https://raw.githubusercontent.com/PX4/PX4-Autopilot/master/Tools/setup/ubuntu.sh wget https://raw.githubusercontent.com/PX4/PX4-Autopilot/master/Tools/setup/requirements.txt
- Run ubuntu.sh in a terminal to get just the common dependencies:
bash ubuntu.sh --no-nuttx --no-sim-tools
- Then setup an cross-compiler (either GCC or clang) as described in the following sections.
GCC (armhf)
Ubuntu software repository provides a set of pre-compiled toolchains. Note that Ubuntu Focal comes up with gcc-9-arm-linux-gnueabihf
as its default installation which is not fully supported, so we must manually install gcc-8-arm-linux-gnueabihf
and set it as the default toolchain. This guide also applies to earlier Ubuntu releases (Bionic).
The following instruction assumes you haven’t installed any version of arm-linux-gnueabihf, and will set up the default executable with update-alternatives
.
Install them with the terminal command:
sudo apt-get install -y gcc-8-arm-linux-gnueabihf g++-8-arm-linux-gnueabihf
Set them as default:
sudo update-alternatives --install /usr/bin/arm-linux-gnueabihf-gcc arm-linux-gnueabihf-gcc /usr/bin/arm-linux-gnueabihf-gcc-8 100 --slave /usr/bin/arm-linux-gnueabihf-g++ arm-linux-gnueabihf-g++ /usr/bin/arm-linux-gnueabihf-g++-8
sudo update-alternatives --config arm-linux-gnueabihf-gcc
GCC (aarch64)
If you want to build PX4 for ARM64 devices, this section is required.
sudo apt-get install -y gcc-8-aarch64-linux-gnu g++-8-aarch64-linux-gnu
sudo update-alternatives --install /usr/bin/aarch64-linux-gnu-gcc aarch64-linux-gnu-gcc /usr/bin/aarch64-linux-gnu-gcc-8 100 --slave /usr/bin/aarch64-linux-gnu-g++ aarch64-linux-gnu-g++ /usr/bin/aarch64-linux-gnu-g++-8
sudo update-alternatives --config aarch64-linux-gnu-gcc
Clang (optional)
First install GCC (needed to use clang).
We recommend you to get clang from the Ubuntu software repository, as shown below:
sudo apt-get install clang
Example below for building PX4 firmware out of tree, using CMake.
cd <PATH-TO-PX4-SRC>
mkdir build/px4_raspberrypi_default_clang
cd build/px4_raspberrypi_default_clang
cmake \
-G"Unix Makefiles" \
-DCONFIG=px4_raspberrypi_default \
-UCMAKE_C_COMPILER \
-DCMAKE_C_COMPILER=clang \
-UCMAKE_CXX_COMPILER \
-DCMAKE_CXX_COMPILER=clang++ \
../..
make
Detailed Information
Additional developer information for using PX4 on Raspberry Pi (including building PX4 natively) can be found here:
ROS/Gazebo
This section explains how to install ROS “Melodic” and PX4 on Ubuntu 18.04.
:::warning ROS builds are tied to specific Ubuntu versions! ROS Melodic can only install on Ubuntu 18.04. :::
To install the development toolchain:
- Download the script in a bash shell:
wget https://raw.githubusercontent.com/PX4/Devguide/master/build_scripts/ubuntu_sim_ros_melodic.sh
- Run the script:
bash ubuntu_sim_ros_melodic.sh
You may need to acknowledge some prompts as the script progresses.
:::note
- ROS Melodic is installed with Gazebo9 by default.
- Your catkin (ROS build system) workspace is created at ~/catkin_ws/.
- The script uses instructions from the ROS Wiki “Melodic” Ubuntu page. :::
The following wiki, pages and posts are tagged with
Title | Type | Excerpt |
---|---|---|
2021-09-26-thesis-indoor-drone.md | post | After launching a file, call the following services to initialize the drone in Gazebo and the Particle Filter algorithm |
Udemy qt5 course by Packt Publishing | post | Tue, Oct 26, 21, Dive into custom model-views, showcasing the power and flexibility of the mvodel view architecture, with extensive www applications |
Pilot handbook + drone resource wiki | post | Tue, Nov 02, 21, pilot's handbook summarized on top of key cocnepts from rapa drone-resource |
Single rotor drone | post | Thu, Nov 04, 21, single rotor air vehilce with rudder and flap to navigate |
Pilot's preflight checklist FAA | post | Tue, Nov 09, 21, preflight checklist with data mining, d3 visualization and google sheet implementation |
final-project | post | Sat, Nov 27, 21, motion planning dashboard with django vue and fcnd |
motion planning dashboard hardware setup | post | Wed, Dec 01, 21, master, raspi, database, video-streaming, api server setup |
px4 mavlink and qgc integration with 4gremoteoperation | post | Tue, Jan 18, 22, powerful 3d simulation environment for autonomous robots suitable for testing object-avoidance and cv |
Airlink by skydrone, youtube | post | Friday, airlink for mission flight, LTE connectivity and dl-ready |
set up with raspi connected to fc | post | Tue, Jan 25, 22, ardupilot documentation |
drone programming primer for software development | post | Mon, Jan 31, 22, flight stack with firmware middleware and api |
runcam with fc connection | post | Tue, Feb 15, 22, runcam split 2 with fc |
my new fixed wing AR Wing Pro, ready for dji HD fpv system | post | Thu, Feb 17, 22, setup guide after opening the package |
realflight 7 setup and console game | post | Thu, Feb 24, 22, flight simulation with real flight 7 |
uavmatrix's cast pro docs | post | Tue, Mar 01, 22, another way to integrate devices to gcs |
firmtech7 of naver cafe raspi drone project | post | Thu, Mar 03, 22, using raspi as fc to control small drone |
Garupner Polaron ex | post | Sun, Mar 06, 22, polaron 2 channels dc charger |
svg visualization messages and parameters | post | Mon, Mar 07, 22, organized structure and tree map of px4 messages and parameters |
lx network, airlink, gcs and data transmission on smart radio, rf mesh and quantum encryption | post | Tue, Apr 26, 22, all about setup and how it operates and managed |
Advanced Features | page | |
Advanced Configuration | page | |
Advanced Flight Controller Orientation Tuning | page | |
rflysim tltr | page | |
Bootloader Update | page | |
Bootloader Flashing onto Betaflight Systems | page | |
Compass Power Compensation | page | |
drones.md | page | my drones I work with and at my disposal. |
ESC Calibration | page | |
Flight Termination Configuration | page | |
my 100 supporters | page | my freelancers I work with since 2018. |
index.md | page | My recent projects are leveraging generative AI across various domains, yielding significant achievements. These encompass Digital Twin, Voice-to-Command, RA... |
Land Detector Configuration | page | |
About this site and its author | portfolio | My portofolio site and its mission statement |
🔭AIOT projects | page | summary. |
contents deploy automation | page | Pilot test on the automation prototype. |
pixhawk apm racing drone | page | summary. |
Challenger Engineering Project | page | summary. |
pixhawk tools | page | rFlyeval project details where Matlab Mathwor Simulink were used for complete process of UAV and UAS. |
Korea drone companies | page | summary. |
Racing drone, attck drone | page | summary. |
Django Django Two scoops | page | summary. |
docker learning curve | page | summary. |
🔭 Ground Control Station web-based approach | page | summary. |
gitlab | page | summary. |
🔭lora monitoring app | page | summary. |
🔭 MQTT pages | page | summary. |
My course list | page | my course list from udemy, udacity, NCS and other sources |
Nextcloud | page | summary. |
Automation pipeline | page | summary. |
Pixhawk 4 | page | summary. |
Pixhawk overview | page | summary. |
🔭raspberry pi project | page | summary. |
🔭yuneec realsense obstacle avoidance | page | summary. |
ROS topic for micro control | page | summary. |
🔭 RQt-based gui | page | summary. |
🔭sensor detection | page | RealSense with Open3D |
🔭Serializer with API | page | summary. |
Rules of thumb | page | Contact me for any support issues. |
web-dev ops pages | page | |
🔭 Webrtc | page | summary. |
Parameter Reference | page | |
Finding/Updating Parameters | page | |
Precision Landing | page | |
pixhawk tools advanced | page | rFlyeval project details where Matlab Mathwork Simulink were used for complete process of UAV and UAS. |
pixhawk tools | page | rFlyeval project details where Matlab Mathwor Simulink were used for complete process of UAV and UAS. |
RTK GPS | page | GNSS/GPS systems |
Iridium/RockBlock Satellite Communication System | page | |
Static Pressure Buildup | page | # Static Pressure Buildup Air flowing over an enclosed vehicle can cause the *static pressure* to change within the canopy/hull. Depending on the location of holes/leaks in the hull, you can end up with under or overpressure (similar to a wing). The change in pressure can affect barometer measurements, leading... |
Air Traffic Avoidance: ADS-B/FLARM | page | |
Air Traffic Avoidance: UAS Traffic Management (UTM) | page | |
Using the ECL EKF | page |