5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Dronecode - PX4環境構築

Last updated at Posted at 2020-07-04

ドローンの自律飛行を実現するには、DronecodeとMAVSDKを試してみます。

目次

  1. PX4環境構築
  2. uORB Messaging
  3. QGroundControlの使い方(ユーザーガイド)
  4. MAVLinkの入門
  5. QGroundControlのカスタマイズ開発

動作環境

  • Ubuntu 18.04
  • ROS Melodic

PX4環境構築

ユーザ権限の設定、dialoutグループに追加

$ sudo usermod -a -G dialout $USER

ユーザ権限反映には、Logout and Loginしてください

Gazebo, JMAVSim and NuttX (Pixhawk) Targets

  1. Download ubuntu.sh and requirements.txt from the PX4
  2. Run the ubuntu.sh to install
wget https://raw.githubusercontent.com/PX4/Firmware/v1.10.0/Tools/setup/ubuntu.sh
wget https://raw.githubusercontent.com/PX4/Firmware/v1.10.0/Tools/setup/requirements.txt
source ubuntu.sh

ROS/Gazebo

  1. Download ubuntu_sim_ros_melodic.sh
  2. Run the ubuntu_sim_ros_melodic.sh to install

install ROS/Gazebo ("Melodic") for use with PX4

$ wget https://raw.githubusercontent.com/PX4/Devguide/v1.9.0/build_scripts/ubuntu_sim_ros_melodic.sh

$ source ubuntu_sim_ros_melodic.sh

Downloading PX4 Source Code

$ git clone https://github.com/PX4/Firmware.git

First Build (Using the jMAVSim Simulator)

use java 8

$ sudo apt install openjdk-8-jdk
$ sudo update-alternatives --config java # choose java-8

PX4 Make Build Targets

make [VENDOR_][MODEL][_VARIANT] [VIEWER_MODEL_DEBUGGER]
VENDOR: The manufacturer of the board: px4(Pixhawk), intel, parrot, etc. 
MODEL: The board model : sitl, fmu-v2, etc.
VARIANT: Indicates particular configurations: rtps, lpe, default, and may be omitted.

VIEWER: This is the simulator : gazebo, jmavsim
MODEL: The vehicle model : iris (default), rover, etc.
DEBUGGER: Debugger to use: none (default), ide, gdb, lldb, ddd, valgrind, callgrind

Use jMAVSim Simulation

$ cd Firmware
$ make px4_sitl jmavsim
pxh> commander takeoff

image.png

image.png

Use Gazebo Simulation

$ make px4_sitl gazebo
pxh> commander takeoff

image.png

image.png

Fast RTPS のインストール

eProsima Fast RTPSとは、RTPS (Real Time Publish Subscribe) protocolです。

Fast RTPS を使ってPX4 uORB topicsのデータを各モジュールの間で共有する。

eProsima Fast RTPSを使用には、Java(Java JDK 8推奨)が必要です。

Installation from Sources

  • foonathan_memory のインストール
$ git clone https://github.com/foonathan/memory.git
$ cd memory
$ git submodule update --init --recursive
$ mkdir build && cd build
$ cmake -DCMAKE_CXX_FLAGS=-fPIC ..
$ cmake --build . --target install
  • Fast-RTPS のインストール
$ git clone -b master https://github.com/eProsima/Fast-RTPS
$ mkdir Fast-RTPS/build && cd Fast-RTPS/build
$ sudo apt-get install gradle
$ cmake -DBUILD_JAVA=ON -DCOMPILE_EXAMPLES=ON -DPERFORMANCE_TESTS=ON -DTHIRDPARTY=ON -DCMAKE_PREFIX_PATH=/usr/local/lib/ ..
$ make
$ sudo make install

QGroundControl のインストール

sudo usermod -a -G dialout $USER
sudo apt-get remove modemmanager -y
sudo apt-get install gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-gl -y
  1. Download QGroundControl.AppImage.
  2. Install (and run) using the terminal commands:
chmod +x ./QGroundControl.AppImage
./QGroundControl.AppImage  (or double click)

image.png

Next: uORB Messaging

5
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?