Sign in

username:

password:



Not a member?

Search compdsp



Search tips

comp.dsp by Keywords

Adaptive Filter | ADPCM | ADSP | ADSP-2181 | Aliasing | AMR | Anti-Aliasing | ARMA | Autocorrelation | AutoCovariance | Beamforming | Bessel | Blackfin | Butterworth | C6713 | CCS | Chebyshev | CIC Filter | Circular Convolution | Code Composer Studio | Comb Filter | Compression | Convolution | Cross Correlation | DCT | Decimation | Deconvolution | Demodulation | DM642 | DSP Boards | DSP/BIOS | DTMF | Echo Cancellation | Equalization | Equalizer | ETSI | EZLITE (Ez-kit Lite) | FFT | FFTW | FIR Filter | Fixed Point | FSK | G.711 | G.723 | G.729 | Gaussian Noise | Goertzel | GPIO | Hilbert Transform | IFFT | IIR Filter | Interpolation | Invariance | JTAG | Kalman | Laplace Transform | Levinson | LPC | McBSP | MIPS | Modulation | MPEG | Multirate | Notch Filter | Nyquist | OFDM | Oversampling | Pink Noise | Pitch | PLL | Polyphase | QAM | QDMA | Quantization | Quantizer | Radar | Random Noise | Reed Solomon | Remez | Resampling | RTDX | Sampling | Sharc | TI C6711 | Undersampling | Viterbi | Wavelets | White Noise | Wiener Filter | Windowing | XDS510PP | Z Transform

Sponsor

Evaluate multicore with Texas Instruments:
Low-cost evaluation module & free software development kit available NOW.

Discussion Groups

Free Online Books

See Also

Embedded SystemsFPGAElectronics

Discussion Groups | Comp.DSP | Kalman Filter Help - Anybody understand Kalman filtering??

There are 20 messages in this thread.

You are currently looking at messages 0 to 10.


Kalman Filter Help - Anybody understand Kalman filtering?? - quadrotor - 2006-10-01 08:46:00

Hi,

I've been undertaking a project to create a controller for a quadrotor
aircraft. Whilst the dynamic modelling and controller design has nearly
been completed I am having trouble getting the requried feedback signals.

I am trying to implement a Kalman filter to combine the signals of
accelerometers and gyroscopes to produce an attitude estimate. I have read
all the introductory literature and have also obtained some code to achieve
the desired sensor fusion along a single axis.

The code I have is here: 124.243.132.204\tilt.c

The code uses the derivative of the covariance matrix to do the update:
Pdot = A*P + P*A' + Q
The P matrix is then updated using P=P+Pdot*dt

The introductory papers however all use the update equation:
P=A*P*A'+Q

Why is the derivative used and where does that equation come from? I
havent been able to find anything on it. There doesnt seem to be a lot of
info around on the net and Kalman filtering seems to be something that not
many people have an understanding of.

This is my main question but I am also wondering how the A matrix is
derived. I can not see how the fusion of the gyro and accelerometer data
can be achieved with this matrix when fitting it to the form x=Ax+Bu. I
assume x would be [tilt angle, gyro bias] and u would be the gyro data.

Anybody got any ideas at all?? I am completly lost and confused.





______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Kalman Filter Help - Anybody understand Kalman filtering?? - John Herman - 2006-10-01 10:27:00



You might look at

http://www.innovatia.com/software/papers/kalman.htm

In article <T...@giganews.com>, "quadrotor" 
<q...@gmail.com> wrote:
>Hi,
>
>I've been undertaking a project to create a controller for a quadrotor
>aircraft. Whilst the dynamic modelling and controller design has nearly
>been completed I am having trouble getting the requried feedback signals.
>
>I am trying to implement a Kalman filter to combine the signals of
>accelerometers and gyroscopes to produce an attitude estimate. I have read
>all the introductory literature and have also obtained some code to achieve
>the desired sensor fusion along a single axis.
>
>The code I have is here: 124.243.132.204\tilt.c
>
>The code uses the derivative of the covariance matrix to do the update:
>Pdot = A*P + P*A' + Q
>The P matrix is then updated using P=P+Pdot*dt
>
>The introductory papers however all use the update equation:
>P=A*P*A'+Q
>
>Why is the derivative used and where does that equation come from? I
>havent been able to find anything on it. There doesnt seem to be a lot of
>info around on the net and Kalman filtering seems to be something that not
>many people have an understanding of.
>
>This is my main question but I am also wondering how the A matrix is
>derived. I can not see how the fusion of the gyro and accelerometer data
>can be achieved with this matrix when fitting it to the form x=Ax+Bu. I
>assume x would be [tilt angle, gyro bias] and u would be the gyro data.
>
>Anybody got any ideas at all?? I am completly lost and confused.
>
>
>
>
>
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Kalman Filter Help - Anybody understand Kalman filtering?? - David Tweed - 2006-10-01 10:30:00

quadrotor wrote:
> I've been undertaking a project to create a controller for a
> quadrotor aircraft. Whilst the dynamic modelling and controller
> design has nearly been completed I am having trouble getting
> the requried feedback signals.

Filtering issues aside, your system is underdetermined. With
accelerometers and rate gyros alone, it is impossible to distinguish
sensor biases from real motion. You need some sort of absolute
reference sensor to combine with your data. For example, a
3-D magnetometer would give you an attitude reference with no
inherent drift, or a GPS receiver would give you a position
and/or velocity reference with no drift.

-- Dave Tweed
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Kalman Filter Help - Anybody understand Kalman filtering?? - Tim Wescott - 2006-10-01 15:55:00

quadrotor wrote:

> Hi,
> 
> I've been undertaking a project to create a controller for a quadrotor
> aircraft. Whilst the dynamic modelling and controller design has nearly
> been completed I am having trouble getting the requried feedback signals.
> 
> I am trying to implement a Kalman filter to combine the signals of
> accelerometers and gyroscopes to produce an attitude estimate. I have read
> all the introductory literature and have also obtained some code to achieve
> the desired sensor fusion along a single axis.
> 
> The code I have is here: 124.243.132.204\tilt.c
> 
> The code uses the derivative of the covariance matrix to do the update:
> Pdot = A*P + P*A' + Q
> The P matrix is then updated using P=P+Pdot*dt
> 
> The introductory papers however all use the update equation:
> P=A*P*A'+Q
> 
> Why is the derivative used and where does that equation come from? I
> havent been able to find anything on it.

I assume they use the derivative because they feel they'll get some 
numerical advantage over doing the direct calculation.  The expression 
for Pdot doesn't look right to me, however -- I'm not saying it _isn't_ 
right, but I'd have to dig into the math to verify it for myself.

> There doesnt seem to be a lot of
> info around on the net and Kalman filtering seems to be something that not
> many people have an understanding of.

Its not terrifically common, but it's not uncommon either.  Try 
Wikipedia.  Part of the reason you can't find information on the web is 
that you're asking a question whose answer is book length.  I just got a 
copy of Dan Simon's "Optimal State Estimation", Wiley 2006.  I recommend 
it if you're up to the math.
> 
> This is my main question but I am also wondering how the A matrix is
> derived. I can not see how the fusion of the gyro and accelerometer data
> can be achieved with this matrix when fitting it to the form x=Ax+Bu. I
> assume x would be [tilt angle, gyro bias] and u would be the gyro data.

As pointed out elsewhere you have no absolute reference, so your system 
is not fully determined.  Having some sort of absolute tilt or position 
measurement would get you a long way toward determinacy.
> 
> Anybody got any ideas at all?? I am completly lost and confused.
> 

All you can do with what you have is cage your system on the ground 
(i.e. find your drifts and initialize your tilt and position estimates), 
then use your control inputs to modify the various estimates when you're 
flying.  I wouldn't even use a Kalman filter in this case -- I would 
just servo the platform rates to the turn inputs from the pilot, and the 
acceleration to the throttle input from the pilot, and see how flyable 
the thing is.

-- 

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

Posting from Google?  See http://cfaj.freeshell.org/google/

"Applied Control Theory for Embedded Systems" came out in April.
See details at http://www.wescottdesign.com/actfes/actfes.html
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Kalman Filter Help - Anybody understand Kalman filtering?? - Peter Nachtwey - 2006-10-01 17:11:00

quadrotor wrote:

> This is my main question but I am also wondering how the A matrix is
> derived.

I too recommend Dan Simon's book.   In his simple examples the systems
keeps doing whatever it was doing as if the system was in space
unaffected by gravity.   Auto tuning systems for PID systems derive the
A and B matrix values empirically.  Real engineers can caluculate value
for A and B.

> I can not see how the fusion of the gyro and accelerometer data
> can be achieved with this matrix when fitting it to the form x=Ax+Bu. I
> assume x would be [tilt angle, gyro bias] and u would be the gyro data.
>
> Anybody got any ideas at all?? I am completly lost and confused.

The estimated acceleration is subtracted from the accelerometer
acceleration and mulitplied by the Kalman gain then added to Ax.   The
Bu term doesn't apply unless there is a forcing function.  You just
have to get a book on Kalman filters and work through the examples
until you understand.

See equations 2-5
http://www.innovatia.com/software/papers/kalman.htm




Peter Nachtwey

______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Kalman Filter Help - Anybody understand Kalman filtering?? - steve - 2006-10-01 17:53:00

quadrotor wrote:

> Why is the derivative used and where does that equation come from? I
> havent been able to find anything on it. There doesnt seem to be a lot of
> info around on the net and Kalman filtering seems to be something that not
> many people have an understanding of.
>
that's an understatement, most Kalman filter info also tends to be
circular, they all reference each other for specific details. Or you
might read something like this "Kalman filtering is a huge field which
cannot be explained in a brief paper.", you know either a big fat "Dead
End" sign or 400 references are coming up shortly.

I find things I understand I can explain to others in less then 2
pages, things I don't take a book.

______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Kalman Filter Help - Anybody understand Kalman filtering?? - Tim Wescott - 2006-10-01 18:00:00

Tim Wescott wrote:

> quadrotor wrote:
> 
-- snip --
>>
>> This is my main question but I am also wondering how the A matrix is
>> derived. I can not see how the fusion of the gyro and accelerometer data
>> can be achieved with this matrix when fitting it to the form x=Ax+Bu. I
>> assume x would be [tilt angle, gyro bias] and u would be the gyro data.
-- snip --
> 
I forgot to mention this before -- in a formal Kalman filter design the 
A matrix (the state evolution matrix in a continuous-time system, or the 
state transition matrix in a discrete-time system) is determined from 
building a careful model of the system, informed, as Peter has pointed 
out, with careful measurements if possible.

This design step is where many Kalman filtering efforts break down -- 
the performance of your Kalman filter will suffer significantly if you 
get it wrong, so you have to either 'lie to the math' when you construct 
your problem by pretending to more noise than is really there, or you 
have to use alternate filtering strategies (like H-infinity state 
estimators).

-- 

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

Posting from Google?  See http://cfaj.freeshell.org/google/

"Applied Control Theory for Embedded Systems" came out in April.
See details at http://www.wescottdesign.com/actfes/actfes.html
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Kalman Filter Help - Anybody understand Kalman filtering?? - quadrotor - 2006-10-01 22:51:00

Thanks for the replies guys. I am looking to try and implement some sort of
sensor fusion between the gyro and the accerlometer using a Kalman filter
and I have see other examples of this being successful in other quadrotor
systems. 

The tilt.c code I posted does exactly what I want along a single axis but
I was just wondering about some of the functions used. Tim touched on why
Pdot was used to update the P matrix and I have tried to do the maths to
confirm that the result is the same as using the "normal" covariance
update equation but have been unsuccessful. The A matrix as defined in
tilt.c is also puzzling.

http://coecsl.ece.uiuc.edu/ge423/spring04/group9/objectives_sensors.htm

Above is another link that attemps to do something similiar. I can
understand the method used here (the actualy definition of the system
seems incorrect to me however as when its expanded it doesnt make any
sense).

Any mode ideas as to why Pdot is used to update and how they actually came
up with the A matrix??

Thanks for your help guys. I was unable to find any other place on the net
that was able to provide any help at all.
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Kalman Filter Help - Anybody understand Kalman filtering?? - quadrotor - 2006-10-01 23:05:00

Just another note now that I've had some time to digest whats been said. I
only want the fusion to be accurate for near hover conditions. The angles
determined using the accelerometers would be fairly accurate and without
drift for near hover situations.
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Kalman Filter Help - Anybody understand Kalman filtering?? - Jerry Avins - 2006-10-02 00:11:00

Tim Wescott wrote:
> quadrotor wrote:
> 
>> Hi,
>>
>> I've been undertaking a project to create a controller for a quadrotor
>> aircraft. Whilst the dynamic modelling and controller design has nearly
>> been completed I am having trouble getting the requried feedback signals.
>>
>> I am trying to implement a Kalman filter to combine the signals of
>> accelerometers and gyroscopes to produce an attitude estimate. I have 
>> read
>> all the introductory literature and have also obtained some code to 
>> achieve
>> the desired sensor fusion along a single axis.
>>
>> The code I have is here: 124.243.132.204\tilt.c
>>
>> The code uses the derivative of the covariance matrix to do the update:
>> Pdot = A*P + P*A' + Q
>> The P matrix is then updated using P=P+Pdot*dt
>>
>> The introductory papers however all use the update equation:
>> P=A*P*A'+Q
>>
>> Why is the derivative used and where does that equation come from? I
>> havent been able to find anything on it.
> 
> I assume they use the derivative because they feel they'll get some 
> numerical advantage over doing the direct calculation.  The expression 
> for Pdot doesn't look right to me, however -- I'm not saying it _isn't_ 
> right, but I'd have to dig into the math to verify it for myself.
> 
>> There doesnt seem to be a lot of
>> info around on the net and Kalman filtering seems to be something that 
>> not
>> many people have an understanding of.
> 
> Its not terrifically common, but it's not uncommon either.  Try 
> Wikipedia.  Part of the reason you can't find information on the web is 
> that you're asking a question whose answer is book length.  I just got a 
> copy of Dan Simon's "Optimal State Estimation", Wiley 2006.  I recommend 
> it if you're up to the math.
>>
>> This is my main question but I am also wondering how the A matrix is
>> derived. I can not see how the fusion of the gyro and accelerometer data
>> can be achieved with this matrix when fitting it to the form x=Ax+Bu. I
>> assume x would be [tilt angle, gyro bias] and u would be the gyro data.
> 
> As pointed out elsewhere you have no absolute reference, so your system 
> is not fully determined.  Having some sort of absolute tilt or position 
> measurement would get you a long way toward determinacy.
>>
>> Anybody got any ideas at all?? I am completly lost and confused.
>>
> 
> All you can do with what you have is cage your system on the ground 
> (i.e. find your drifts and initialize your tilt and position estimates), 
> then use your control inputs to modify the various estimates when you're 
> flying.  I wouldn't even use a Kalman filter in this case -- I would 
> just servo the platform rates to the turn inputs from the pilot, and the 
> acceleration to the throttle input from the pilot, and see how flyable 
> the thing is.

And remember that for stability, the "stable platform" must have an 
undamped resonance with a period of 88 minutes. (88 minutes is the 
orbital time at zero altitude assuming no air, and also the period of a 
pendulum whose length is the earth's radius, assuming uniform gravity.)

Jerry
-- 
        "The rights of the best of men are secured only as the
        rights of the vilest and most abhorrent are protected."
            - Chief Justice Charles Evans Hughes, 1927
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

| 1 | 2 | next