Re: [Autopilot] Conversion help.
Status: Alpha
Brought to you by:
tramm
From: Trammell H. <hu...@sw...> - 2004-08-26 13:29:26
|
On Wed, Aug 25, 2004 at 06:47:27PM -0500, Francisco Lobo wrote: > So basically i can just replace the > > > const float Pdot[2 * 2] = { > > Q_angle - P[0][1] - P[1][0], /* 0,0 */ > > - P[1][1], /* 0,1 */ > > - P[1][1], /* 1,0 */ > > Q_gyro /* 1,1 */ > > }; > > with > > > P[0][0] += Pdot[0] * dt; > P[0][1] += Pdot[1] * dt; > P[1][0] += Pdot[2] * dt; > P[1][1] += Pdot[3] * dt; No, since the first computes Pdot using the current P, then updates the covariance matrix P for the next time step. You can, however, replace Pdot[2*2] with Pdot[4], or, if you prefer the verbosity, Pdot[2][2] and change initializer for the Pdot array to be a 2x2. > Codevision does not like the Pdot[2*2]. That's a bug in their compiler. 2*2 is a compile time integral expression and is valid as a size specifier for an array in C89 and C99 (and maybe even in earlier pre-ANSI C). This is the real reason I prefer gcc over most embedded systems compilers -- gcc makes an attempt to adhere to the standards, while most in-house compilers don't spend any effort on it. Trammell -- -----|----- hu...@os... W 240-283-1700 *>=====[]L\ hu...@ro... M 505-463-1896 ' -'-`- http://www.swcp.com/~hudson/ KC5RNF |