Toolchain Installation & Setup
#
Toolchain installationIt is recommended to use Linux machine for PX4 development as it takes ๐ฅexcruciatingly๐ฅ long time to compile in Windows.
If you have Ubuntu 18.04 installed (recommended), go ahead to this link or follow the steps below.
caution
If you see errors while running any of the installation scripts, do not proceed to the next step. Check your internet connection and re-run the script until there is no error!
Download PX4 Source Code and run the installation script:
git clone https://github.com/PX4/PX4-Autopilot.git --recursivecd PX4-Autopilotbash ./Tools/setup/ubuntu.sh # re-run this script if there are errors
Acknowledge any prompts as the script progress.
Download and run the ROS/Gazebo installation script:
wget https://raw.githubusercontent.com/PX4/Devguide/master/build_scripts/ubuntu_sim_ros_melodic.shbash ubuntu_sim_ros_melodic.sh # re-run this script if there are errors
You may need to acknowledge some prompts as the script progresses.
Reboot the system to complete installation.
#
Test runTo verify succesful toolchain installation and setup, we will try to compile the PX4 firmware for both simulation and fmu-v2.
First, we try to compile PX4 firmware and run gazebo simulation, more details on simulation with gazebo here.
cd PX4-Autopilotmake px4_sitl gazebo
To takeoff, run commander takeoff
in the PX4 shell.
caution
Sometimes Gazebo fails to load up on the first run. When Gazebo shows a blank window, try running the above command again.
Then, try to compile PX4 firmware for fmu-v2 target, more details on different targets here.
make px4_fmu-v2