Visual Tracking on Pixhawk: Difference between revisions

From Rsewiki
No edit summary
No edit summary
Line 9: Line 9:


== Installation Instructions ==
== Installation Instructions ==
=== Default Pixhawk Firmware ==
=== Default Pixhawk Firmware ===
For instructions on setting up the required tool chain and building the standard 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
follow the tutorial at http://dev.px4.io/starting-installing.html
Line 31: Line 31:
To fetch the code I delvelpped and assign the correct submodule for the ekf run the following commands:
To fetch the code I delvelpped and assign the correct submodule for the ekf run the following commands:


<code>
mkdir Pixhawk
mkdir Pixhawk
cd Pixhawk
cd Pixhawk
git clone https://github.com/skrogh/Firmware.git
git clone https://github.com/skrogh/Firmware.git
cd Firmware
cd Firmware
git remote add upstream https://github.com/PX4/Firmware.git
git remote add upstream https://github.com/PX4/Firmware.git
git checkout mocap-ekf2
git checkout mocap-ekf2
Tools/check_submodules.sh
Tools/check_submodules.sh
cd src/lib/ecl
cd src/lib/ecl
git remote rename origin upstream
git remote rename origin upstream
git remote add origin https://github.com/skrogh/ecl.git
git remote add origin https://github.com/skrogh/ecl.git
git fetch origin
git fetch origin
git checkout mocap-ekf2
git checkout mocap-ekf2
cd ../../..
cd ../../..
make px4fmu-v2_default
make px4fmu-v2_default -j8
</code>


This will do:
This will do:
Line 62: Line 60:
* Again work was done on the <code>mocap-ekf2</code> branch, so switch to this one.
* Again work was done on the <code>mocap-ekf2</code> branch, so switch to this one.
* Go back to the toplevel
* Go back to the toplevel
* build the default configuration (-j8 is an optional argument, telling make to build with 8 threads - this is faster but error messages are usually a bit more chaotic, as they don't necessarily appear last in the outputted text)
* build the default configuration





Revision as of 14:59, 22 January 2016

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.

SD card and parameters