Visual Tracking on Pixhawk
System Overview
The tracker consists of:
- A quarotor equipped with a Pixhawk, the Drone
- A linux computer connected to a
- HD webcam, and
- 3DR telemetry radio.
- Software running on the linux computer for tracking the drone, and sending the position over the telemetry link
- Modified Pixhawk firmware with sensors added to the ekf2 module
Installation Instructions
Default Pixhawk Firmware
For instructions on setting up the required tool chain and building the standard Pixhawk firmware, follow the tutorial at http://dev.px4.io/starting-installing.html
The Pixhawk team uses Git
to synchronize their work. If you are not familiar with git,
now would be a good time to familiarize yourself with it.
The Pixhawk firmware is a rather large project. The main part of the software is located at https://github.com/PX4/Firmware.git, but some part reside in so called git submodules.
To get a general idea about, how to make custom modules (programs) for the Pixhawk I suggest reading through the examples at http://dev.px4.io/
Updated Pixhawk Firmware
The important changes in the Pixhawk firmware are located at:
<blockqute>
src/lib/ecl
- this is the submodule for the EKF source code (and some other modules). The reason why it's in a submodule, is because it's ment as a portable estimator and can be used in other projects as well
<blockqute>
src/modules/ekf2
- this is a wrapper for the EKF mentioned above. It passes data from uORB topics to the filter and back.
To fetch the code I delvelpped and assign the correct submodule for the ekf run the following commands:
mkdir Pixhawk cd Pixhawk git clone https://github.com/skrogh/Firmware.git cd Firmware git remote add upstream https://github.com/PX4/Firmware.git git checkout mocap-ekf2 Tools/check_submodules.sh cd src/lib/ecl git remote rename origin upstream git remote add origin https://github.com/skrogh/ecl.git git fetch origin git checkout mocap-ekf2 cd ../../.. make px4fmu-v2_default
This will do:
- Make a new directory for the project
- Enter it
- Clone my fork of the repository. This includes updated wrappers for the filter and some changes to enable Mikrokopter drivers
- Enter the repository
- Add a remote to the original repository. This can later be used to update the software to include changes made by the PX4 team
- All work on motion capture input has ben done on a separate branch
mocap-ekf2
so we switch to that Tools/check_submodules.sh
is a script that ensures, that submodules are up to date. We run it to fetch all submodules- Go into the submodule for the estimator
- Move the original "origin" remote to "upstream" (these are just names, but this is to keep consistency)
- Add a new remote to the version of this repo I made the changes in
- Fetch changes
- Again work was done on the
mocap-ekf2
branch, so switch to this one. - Go back to the toplevel
- build the default configuration
Important notes
Changes in files not concerning the EKF
The following files have been changed, to enable Mikrokopter BL-CTRL motor drivers and ultrasonic rangefinder:
cmake/configs/nuttx_px4fmu-v2_default.cmake
in the process the ekf2
module was added to the build list along with the useful tool listener
.
To free up some space, some unused modules were commented out of the build list.