UAV development Four: Pixhawk development environment to build

4. Pixhawk development environment to build

  • PX4 code can be developed on the Mac OS, Linux or Windows, this paper, long-term support version of Ubuntu as a development environment Ubuntu16.04
  1. In order to facilitate the development, we need to add users to the group "dialout", the terminal execute:
sudo usermod -a -G dialout $USER

Then log off, log back in, because changes made will be effective after re-login. Note: Never use sudo to repair permissions problem, otherwise it will bring more rights issues, need to reinstall the system to solve.

  1. Installation packages rely PX4
    update package list compiled below PX4 installation dependencies. Install cmake, execute:
sudo add-apt-repository ppa:george-edison55/cmake-3.x -y
sudo apt-get update

Install the necessary software, such as python, git, qtcreator and so on:

4.1. Prerequisite Software

sudo apt-get install python-argparse git-core wget zip 
sudo apt-get install python-empy qtcreatorcmake build-essential genromfs -y

Install some simulation tools:

4.2. Compilation Tools

  1. Add installation source development environment
    sudo add-apt-repository ppa:openjdk-r/ppa sudo apt-get update sudo apt-get install openjdk-8-jre sudo apt-get install ant protobuf-compiler libeigen3-devlibopencv-dev openjdk-8-jdk openjdk-8-jre clang-3.5 lldb-3.5 -y
  2. Installation of cross compiler tool chain
    1. Ubuntu comes with a series of agency management, which can seriously interfere with any robot related to the serial port (or usb port), uninstall it would not have any impact, we unloaded it here:
      sudo apt-get remove modemmanager
    2. Updating the package list and install the following dependencies:
      sudo apt-get install python-serial openocd sudo apt-get install flex bison libncurses5-devautoconf texinfo build-essential sudo apt-get install libftdi-dev libtoolzlib1g-dev sudo apt-get install python-empy
    3. Installation arm-none-eabi compiler tool chain, before adding arm-none-eabi tool chain, be sure to remove the residual:
    • Delete the remaining command
      sudo apt-get remove gcc-arm-none-eabi gdb-arm-none-eabibinutils-arm-none-eabi gcc-arm-embedded sudo add-apt-repository --remove ppa:team-gcc-arm-embedded/ppa
    • Installation Tool Command
      sudo apt-get install gcc-arm-none-eabi
    1. If you need to come in raspberry raspberries come in you need to install the development tool for the chain. Raspberry Pi Raspberry Pi developers should download the Linux tool chain from the following address. The installation script will automatically install cross compiler tool chain:
      git clone https://github.com/pixhawk/rpi_toolchain.git cd rpi_toolchain ./install_cross.sh
      the need to enter a password tool chain installation. If you do not want the tool chain installed in the default location / opt / rpi_toolchain,
      can perform
    ./install_cross.sh<PATH>
    Other incoming address to the installation script. The installation script will automatically configure the environment variables needed. Finally, run the following command to update the environment variables:
    source ~/.profile
  3. Code is compiled
    after a good development environment to build, you can begin to download the code and compiled, PX4 can console or GUI / IDE development. Here we briefly introduce the development of the console.
    1. If you create a directory, and then download the code from the git:
      mkdir -p ~/src cd ~/src
    2. The first chapter introduced Pixhawktwo firmware package, we use ArduPilot firmware package, execute the command
      git clone https://github.com/ArduPilot/ardupilot cd ardupilot git submodule update --init --recursive cd ..
    3. You can now build the binary file by compiling the source code. Before using the hardware directly, it is recommended to be simulated. Then you can compile the code and downloaded:
      cd ardupilot make px4fmu-v2_default
      notes that "make" command character is a compilation tools, "px4fmu-v2" is a hardware / ardupilot version, "default" is the default configuration, all PX4 compiler target follow this rule. By adding after the command 'upload', compiled binaries will be uploaded to the flight control hardware via USB. Situation after successful download as follows:

Guess you like

Origin www.cnblogs.com/hellocxz/p/12104970.html