This is an attempt to create an auto-correction of the Yaw-movement on the Air:bit drone. The compass heading is compared to a desired compass heading, then the difference is being multiplied with a proportional (PID) number and set to Yaw.
- Challenge: The compass heading block uses the accelerometer in it´s equation. The accellerometer will give erradical numbers when motors are spinning. Therefore, these numbers needs to be smoothed with a low pass filter.
The low pass filter and the compassCorrectionFactor needs to be adjusted.
Open this page at https://gomakekit.github.io/airbit-compass/
This repository can be added as an extension in MakeCode.
- open https://makecode.microbit.org/
- click on New Project
- click on Extensions under the gearwheel menu
- search for https://github.com/gomakekit/airbit-compass and import
To edit this repository in MakeCode.
- open https://makecode.microbit.org/
- click on Import then click on Import URL
- paste https://github.com/gomakekit/airbit-compass and click import
This image shows the blocks code from the last commit in master. This image may take a few minutes to refresh.
- for PXT/microbit
