This paper mainly records the building process of PX4 environment under Ubuntu 18.04. Because I installed ROS Melodic before installing PX4 environment, and gazebo was installed at the same time when installing ROS, it is impossible to determine whether the subsequent problems were caused by installing ROS first.
This paper is divided into the following parts:
- Installation using officially recommended installation scripts
- Solve problems in installation process
- Download PX4 source code
- Video recording
Please note that:
The following installation process is completed under the mobile hotspot. If you are a campus network user and download speed is too slow, please try using mobile phone hotspots.
1. Installation using officially recommended installation scripts
openPX4_Ubuntu Install the page, then install it according to the official recommended script, select the installation script ubuntu.sh.
1. Download ubuntu.sh and requirements.txt
wget https://raw.githubusercontent.com/PX4/Firmware/master/Tools/setup/ubuntu.sh wget https://raw.githubusercontent.com/PX4/Firmware/master/Tools/setup/requirements.txt
2. Run ubuntu.sh
source ubuntu.sh
3. Waiting for installation to complete
After installation, restart the computer at the terminal prompt.
After installation, you can check whether Nuttx was successfully installed by checking the gcc version.
$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.
2. Solve the problems in the installation process
1.python package installation is too slow
In the installation process, python dependency is too slow because it is directly obtained from pip sources abroad.
Open the downloaded ubuntu.sh and find the following lines:
# Python3 dependencies echo echo "Installing PX4 Python3 dependencies" sudo python3 -m pip install --upgrade pip setuptools wheel sudo python3 -m pip install -r ${DIR}/requirements.txt # Python2 dependencies echo echo "Installing PX4 Python2 dependencies" sudo python2 -m pip install --upgrade pip setuptools wheel sudo python2 -m pip install -r ${DIR}/requirements.txt
Modify it to
# Python3 dependencies echo echo "Installing PX4 Python3 dependencies" sudo python3 -m pip install --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple pip setuptools wheel sudo python3 -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r ${DIR}/requirements.txt # Python2 dependencies echo echo "Installing PX4 Python2 dependencies" sudo python2 -m pip install --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple pip setuptools wheel sudo python2 -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r ${DIR}/requirements.txt
After that, run again
source ubuntu.sh
2. Cross-compiler gcc downloads too slowly
You can open ubuntu.sh directly, find the download address of the compiler, and put that address in it.
https://armkeil.blob.core.win...
Copy to the browser to download, download completed, refer to the ubuntu.sh manual operation command to complete the installation.
3. Download PX4 source code
Navigate to your home directory and run commands
git clone https://github.com/PX4/Firmware.git
The download process is slow, wait for the download to complete, run the command
Run command
git submodule update --init --recursive
4.gazebo simulation
Open the terminal to the Firmware folder and run the command
make px4_sitl gazebo_iris
4. Video Recording
At the same time, I also recorded a video of my installation process. Please click here See.