PX4 Vision Example

These examples use the Pixhawk Platform. You can install it following the instructions in installation section.

To install this project, please clone the repository:

git clone https://github.com/aerostack2/project_px4_vision

To start using this project, please go to the root folder of the project.

Execution

The flags for the components launcher are:

  • -s: launch the components for the simulated version.

  • -g: use GPS localization for outdoor flight.

  • -t: launch keyboard teleoperation.

  • -r: record rosbag.

  • -n: use custom dron namespace.

Arguments for the components launcher are:

  • -e: estimator type. Allowed values [ground_truth, raw_odometry, mocap]. Default: ground_truth.

Simulated execution

In order to launch the components for the simulated version, you have to execute:

./launch_as2.bash -s -t

This will open a simulation for a single drone alongside the Aerostack2 components necessary for the mission execution.

A window like the following image should open.

../../../_images/single_drone_gz_classic.png

Gazebo Classic simulator

It will also open a keyboard teleoperation (argument -t), which you can use to teleoperate the drone with the aerostack2 keyboard teleoperation user interface.

A window like the following image should popup:

../../../_images/keyboard_teleop_view3.png

Keyboard teleoperation

To start the mission, go to a new terminal line and execute:

python3 mission.py -s

To do a clean exit of tmux, execute:

./stop.bash drone0

Real execution

Before launching the components, remember to set the correct state estimator to use. Currently, Aerostack2 supports two types of state estimators for the PX4, this are:

  • Optitrack: which uses mocap plugin.

  • Odometry: which uses raw_odometry plugin.

Also, the second one have two versions, the one to indoor flights and the one to outdoor flights using GPS, that you can select with the flag -g.

In order to launch the components, do:

  • For the odometmocapry version, do:

./launch_as2.bash -e mocap -t
  • For the odometry indoor version, do:

./launch_as2.bash -e raw_odometry -t
  • For the odometry outdoor version, do:

./launch_as2.bash -e raw_odometry -g -t

Note

Before launching the components with mocap, it is also necessary to set the file real_config/mocap.yaml. This file will be used by the state estimator mocap plugin to get the ground truth pose coming from our motion capture system into the Aerostack2 common interface localization topics.

To start the mission, execute:

python3 mission.py

To do a clean exit of tmux, execute the following command:

./stop.bash drone0