Drone compass calibration

From Rsewiki
Revision as of 13:01, 2 December 2020 by Jca (Talk | contribs)

Jump to: navigation, search

back to Drone control

Contents

Calibration setup

Once the controller is mounted on the drone, it is time to calibrate the compass.

Upload the calibration firmware to the Teensy (using the Arduino GUI)

Run the calibration app - in the bin directory for Linux, or here for other platforms https://www.pjrc.com/store/prop_shield.html

Compass calibration app

If on Linux go to

cd mobotware/drone_ctrl/trunk/CalibrateSensors
./MotionCal

Compass-calibrate-app.png

Calibration app - with a fair set of values. Runs directly on Ubuntu 18.04, for Ubuntu 20.04 see below

Ubuntu 20.04

The calibration app is rather old, so it asks for libpng12.so.0.

I managed to install it through package nsight-systems

sudo apt install nsight-systems
cd /usr/lib/x86_64-linux-gnu
sudo ln -s ../nsight-systems/Host-x86_64/libpng12.so.0

Another option is to get the source code, but the Makefile asks for wxwidgets/3.0.2.gtk2-opengl/bin/wx-config, which I couldn't find.

Arduino code for compas calibration

In arduino open the calibration firmware in mobotware/drone_ctrl/trunk/CalibrateSensors

Run the arduino version, where you have installed the Teensyduino and open the CalibrateSensors.ino

In my case

cd mobotware/drone_ctrl/trunk/CalibrateSensors
/home/chr/Downloads/arduino-1.8.13/arduino 
  • Select board Teensy3.5
  • Compile
  • upload (to /dev/ttyACM0 or the port to which the Teensy is connected)

Arduino-compass-calibrate.png

Arduino with sensor calibration code. Sending raw data to app and receive the calibration data when send is pressed on the calibration app. The calibration is saved in the Teensy EE-prom and will be loaded by the sensor library.

Rotate drone and save result

In the Calibration app, clear the buffer when you are ready to rotate the drome in all directions.

  • press 'clear'

Rotate the drone in all directions, until you get a sphere or an ellipsoide as in the figure above.

When it looks good, upload to the Teensy by "Send Cal"

  • press 'send Cal'

It is then saved in the Teensy flash (addresses below the first 512 bytes, that is not used by the drone firmware).

Reload drone control firmware

Go back to the drone_ctrl directory and reload

cd mobotware/drone_ctrl/trunk/drone_ctrl
make
make upload

The new compas calibration should be in effect.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox