~xdavidwu/motion-control

0641ccfca1114f6d0adedbd98c8be68e46315442 — xdavidwu 2 years ago 7825035
ahrs: complementary: ignore yaw from tilt
1 files changed, 6 insertions(+), 4 deletions(-)

M ahrs/complementary/complementary.ha
M ahrs/complementary/complementary.ha => ahrs/complementary/complementary.ha +6 -4
@@ 17,11 17,13 @@ export fn read_euler(complementary: complementary) (f64, f64, f64) =
	integration::read_euler(complementary.integration);

export fn update_accelerometer(complementary: complementary, readings: (f64, f64, f64)) void = {
	let q_accel = tilt::estimate(complementary.tilt, readings);
	complementary.integration.q = quaternion::slerp(
	let accel = quaternion::to_euler(tilt::estimate(complementary.tilt, readings));
	let orig = quaternion::to_euler(complementary.integration.q);
	let qc = quaternion::from_euler((accel.0, accel.1, orig.2));
	complementary.integration.q = quaternion::normalize(quaternion::slerp(
		complementary.integration.q,
		q_accel,
		complementary.alpha);
		qc,
		complementary.alpha));
};

export fn destroy(complementary: complementary) void = {