Re: [Autopilot] fixed point real
Status: Alpha
Brought to you by:
tramm
From: Matt C. <ma...@dr...> - 2003-10-30 00:36:09
|
Trammell Hudson said: > On Thu, Oct 30, 2003 at 12:20:07AM +0100, Jean-Pierre DUMONT wrote: >> So, what do you think about use it exactly ! > > I think it is a good idea. It would save significant amounts of CPU > time and allow more operations on the SA1110 or xscale. > [snip...] > > Divison seems easy: > > A / B = (a*X) / (b*X) = a/b > > However, the division presents a problem. If A < B, the result will > always be zero, regardless of the number of bits on the right hand side > of the fixed point. > > I would suggest trying to recode the AHRS filter into fixed point > and measuring how much time is saved. I'm interested in hearing how > well it works. I recoded your imu_1d.c to use fixed point and wrote some fixed point routines (including divide). It worked well for me. The code is up on my web site at: http://www.dragonflyhollow.org/matt/robots/firemarshalbill/ The code in f16_16.c is my fixed point math library. It uses 16 bits for the integer portion and 16 bits for the fractional portion. The modified imu_1d.c is in kalman.c. The tricky part is making sure there are no overflows - there really isn't a good way to catch them automatically. -Matt |