Skip to content

Instantly share code, notes, and snippets.

# -*- coding: utf-8 -*-
from PIL import Image, ImageOps
from argparse import ArgumentParser
import sys
import math
SCREEN_WIDTH = 1200
SCREEN_HEIGHT = 825
# Without an input our state changed only by biases
# So we repeat our quat
I4 = Identity(4)
# and we assume biases stay the same
I3 = Identity(3)
# we drop the first column to multiply quaternions with 3-vectors
def q2m(q):
return Matrix([
[-q.b, -q.c, -q.d],
[ q.a, -q.d, q.c],
@bofh
bofh / ekf.py
Last active March 11, 2021 16:18
q0, q1, q2, q3 = symbols("q_0 q_1 q_2 q_3")
q = Quaternion(q0, q1, q2, q3)
bx = symbols("b_x")
by = symbols("b_y")
bz = symbols("b_z")
x = Matrix([q0, q1, q2, q3, bx, by, bz])
q0_next, q1_next, q2_next, q3_next = symbols("q0_next q1_next q2_next q3_next")
q_next = Quaternion(q0_next, q1_next, q2_next, q3_next)
bx_next = symbols("bx_next")
error[E0599]: no variant or associated item named `UART5` found for type `stm32f3::stm32f303::Interrupt` in the current scope
--> calibrating_ahrs/main.rs:138:12
|
138 | fn UART5();
| ^^^^^ variant or associated item not found in `stm32f3::stm32f303::Interrupt`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0599`.
039991564;1.5539145;-0.0052126986;-0.00072071905;
0.052674316;0.03352002;9.828548;0.013848438;0.0053263223;0.014780545;0.0039986563;1.553974;-0.005188685;-0.0006716283;
0.07661719;-0.0071828617;9.895589;0.015446335;-0.0002663161;0.013315806;0.0039984374;1.5540277;-0.0052012326;-0.0006672987;
0.023942871;0.0047885743;9.897983;0.016777916;-0.002130529;0.011052119;0.003998625;1.5540723;-0.0051878416;-0.0006502061;
0.03352002;0.014365723;9.888406;0.014647386;0.00013315806;0.010785802;0.003998594;1.5541158;-0.0051702186;-0.00063425314;
0.057462893;0.01676001;9.876434;0.015313176;-0.0034621095;0.011984225;0.003999;1.5541642;-0.005184296;-0.00061146566;
0.047885742;-0.028731447;9.876434;0.01584581;-0.002530003;0.013315806;0.0039986875;1.5542178;-0.005186848;-0.00062342663;
0.04309717;-0.035914306;9.852491;0.013582122;-0.0035952674;0.013981596;0.003998625;1.5542741;-0.0051877457;-0.00065778114;
0.04309717;-0.014365723;9.876434;0.016245283;-0.0026631611;0.0127831735;0.003998625;1.5543256;-0.005186664;-0.00065653387;
This file has been truncated, but you can view the full file.
0.88588625 0.49082887 9.0504055 0.28003138 0.11451593 0.02956109 6.11875e-05 1.8087692e-06 -0.040267043 0.022336401
0.8930691 0.483646 9.0192795 0.28003138 0.11624698 0.028229509 0.003031469 9.530939e-05 -0.060370468 0.033751696
0.8810977 0.53153175 9.016886 0.2806972 0.11438277 0.028495824 0.003990656 0.00022459672 -0.0702807 0.041516438
0.8715205 0.45491457 9.031251 0.28016454 0.11265171 0.028628983 0.0039904374 0.0003577218 -0.07585727 0.044388782
0.8882805 0.51237744 9.057589 0.2828277 0.11265171 0.028495824 0.003990375 0.0004916456 -0.07967069 0.047614403
0.87391484 0.48125172 9.043222 0.28083035 0.113583826 0.029827405 0.003990344 0.0006325455 -0.0819245 0.049429405
0.88349193 0.49561745 9.0504055 0.28083035 0.11438277 0.028362665 0.0039902814 0.0007685832 -0.08363541 0.05111211
0.8930691 0.45970315 9.0192795 0.28149614 0.112119086 0.029028457 0.0039904686 0.00090760627 -0.084968604 0.052073885
0.8906748 0.4644917 9.0192795 0.28176245 0.11171961 0.028628983 0.0039907503 0.0010453993 -0.08594708 0.053008
@bofh
bofh / laying_fpu_full.log
Created May 27, 2019 15:04
Results for passing laying_pc.log via proving_ground/feed on a thumbv7em-none-eabihf
0.00035692778,-0.005511612,0.012298794,0.00035692778,-0.005511612,0.012298794,
0.00074087887,-0.0082964115,0.013977079,0.00074087887,-0.0082964115,0.013977079,
0.0011334465,-0.0085896,0.013607653,0.0011334465,-0.0085896,0.013607653,
0.0015111603,-0.0077588395,0.014238404,0.0015111603,-0.0077588395,0.014238404,
0.0018899906,-0.008037852,0.014580941,0.0018899906,-0.008037852,0.014580941,
0.002269528,-0.008078649,0.014705296,0.002269528,-0.008078649,0.014705296,
0.002659056,-0.007726158,0.015022709,0.002659056,-0.007726158,0.015022709,
0.0030515043,-0.007542186,0.015061276,0.0030515043,-0.007542186,0.015061276,
0.003437582,-0.0072640767,0.015054976,0.003437582,-0.0072640767,0.015054976,
0.0038237115,-0.0073329946,0.015249286,0.0038237115,-0.0073329946,0.015249286,
@bofh
bofh / laying_pc.log
Created May 27, 2019 10:54
Results from PC build of DCMIMU
0.08140577 0.18196583 10.211635 0.0037284256 -0.0055926386 0.04474111 0.007977625 0.00035692778 -0.005511612 0.012298794
0.11492579 0.16041724 10.1422 0.0030626352 -0.0059921127 0.048203215 0.007977937 0.00074087887 -0.0082964115 0.013977079
0.093377195 0.1292915 10.185298 0.004261058 -0.004394216 0.04926848 0.007978375 0.0011334465 -0.0085896 0.013607653
0.047885742 0.1676001 10.216423 0.002530003 -0.004394216 0.047404267 0.0079784375 0.0015111603 -0.0077588395 0.014238404
0.090982914 0.16041724 10.149384 0.002530003 -0.0034621095 0.047537427 0.007977937 0.0018899906 -0.008037852 0.014580941
0.08140577 0.15562867 10.185298 0.002130529 -0.006524745 0.047670584 0.007978188 0.002269528 -0.008078649 0.014705296
0.052674316 0.17478296 10.221211 0.0015978967 -0.0029294773 0.048869006 0.0079785 0.002659056 -0.007726158 0.015022709
0.062251467 0.15323438 10.137412 0.0041278997 -0.004660532 0.04926848 0.0079775 0.0030515043 -0.007542186 0.015061276
0.05028003 0.15084009 10.137412 0.0026631611 -0.00479369 0.04
@bofh
bofh / laying.log
Created May 27, 2019 10:42
Data from MPU9250 laying almost flat.
0.08140577 0.18196583 10.211635 0.0037284256 -0.0055926386 0.04474111 0.007977625 -3.0261583 -0.0062152203 0.015819557
0.11492579 0.16041724 10.1422 0.0030626352 -0.0059921127 0.048203215 0.007977937 -3.0253944 -0.0062229135 0.015827162
0.093377195 0.1292915 10.185298 0.004261058 -0.004394216 0.04926848 0.007978375 -3.0246198 -0.0062241764 0.015838083
0.047885742 0.1676001 10.216423 0.002530003 -0.004394216 0.047404267 0.0079784375 -3.0238547 -0.006220216 0.015833206
0.090982914 0.16041724 10.149384 0.002530003 -0.0034621095 0.047537427 0.007977937 -3.0230792 -0.006229325 0.015833184
0.08140577 0.15562867 10.185298 0.002130529 -0.006524745 0.047670584 0.007978188 -3.022323 -0.006257707 0.015832609
0.052674316 0.17478296 10.221211 0.0015978967 -0.0029294773 0.048869006 0.0079785 -3.0215502 -0.006241512 0.0158118
0.062251467 0.15323438 10.137412 0.0041278997 -0.004660532 0.04926848 0.0079775 -3.0207667 -0.0062190653 0.015825406
0.05028003 0.15084009 10.137412 0.0026631611 -0.00479369 0.048469532 0.007977937 -3.
@bofh
bofh / memory.x
Last active February 4, 2019 12:55
Linker script for the STM32F303K8
/* Linker script for the STM32F303K8 */
MEMORY
{
/* NOTE 1 K = 1 KiBi = 1024 bytes */
FLASH : ORIGIN = 0x08000000, LENGTH = 64K
RAM : ORIGIN = 0x20000000, LENGTH = 12K
}