Searching \ for '[PIC] Kalman filter?' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/math/filter.htm?key=filter
Search entire site for: 'Kalman filter?'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] Kalman filter?'
2011\02\10@224119 by Nathan House

picon face
Sometime over the next six months or so (planning ahead) I'm going to
try to write a Kalman filter for a PIC. I first want to use it to
integrate signals from one gyroscope and one accelerometer to
detect/predict tilt for a balancing robot, and then eventually I want
to make something called a quadrotor helicopter.

I'm wondering:

#1 - Is this something that can be done reasonably well on a PIC? And,
#2 - Would a PIC18, dsPIC, or PIC32 be best for this project?

I don't understand the theory (i.e. the math) behind Kalman filters
yet, so I'm just looking for some advice to get me started in the
right direction.

Thanks

2011\02\10@234337 by Sean Breheny

face picon face
Hi Nathan,

I built a quadrotor helicopter for my Master's Thesis research. I
don't have tons of free time but I'm willing to answer questions if
you send them to me. In my experience, as far as basic hovering and
level flight go, the quadrotor is very challenging from a hardware
perspective (i.e., making something light enough yet powerful enough
to fly, making the structure stiff enough, etc.) but if you have done
a solid job of the hardware, the control problem itself is fairly
straightforward. In fact, simply doing PID on each axis along with a
simple coordinate transformation from desired forces and torques to
rotor speeds works pretty well.

By far, the best intro to Kalman filters that I've seen is this:

http://www.cs.unc.edu/~welch/kalman/kalmanIntro.html

I think that you are going to want at least a higher-end PIC for this
type of work. Floating point math is almost an absolute must because
of the required dynamic range of the variables.

Be aware of what a Kalman filter is and isn't. It is not the automatic
best solution for all navigation problems. The Kalman filter is the
optimal state estimator in the presence of additive Gaussian white
noise. It allows you to take a dynamical model of a system and
estimate the internal states of that model based only on the model and
measurements of some subset of the various inputs and outputs to the
system.

While many kinds of filters that we use all the time can actually be
considered forms of the Kalman filter, it is often not necessary to go
through the entire Kalman filter design process in order to get good
results from your sensors.

Sean


On Thu, Feb 10, 2011 at 10:41 PM, Nathan House <spam_OUTnathanpiclistTakeThisOuTspamgmail.com> wrote:
{Quote hidden}

>

2011\02\10@235608 by PICdude

flavicon
face
In the process of building a quad-copter (  http://www.veisystems.com/nose/quarc.html ), and researched some of  this recently.

First, I've seen a Kalman filter implemented in a 16F, so allegedly  that's possible.
However, I didn't see that a kalman filter is required for a  quad-copter.  We started doing our own quad-copter code with an  Arduino, but found an open-source implementation last week, so decided  to use that for now, and build this project incrementally until we  (that really means me) have more time to research PID.  At that time,  we'll roll our own code.

Cheers,
-Neil.



Quoting Nathan House <.....nathanpiclistKILLspamspam@spam@gmail.com>:

{Quote hidden}

>

2011\02\11@000143 by PICdude

flavicon
face
Quoting Sean Breheny <shb7spamKILLspamcornell.edu>:

> ... In my experience, as far as basic hovering and
> level flight go, the quadrotor is very challenging from a hardware
> perspective (i.e., making something light enough yet powerful enough
> to fly, making the structure stiff enough, etc.) but if you have done
> a solid job of the hardware, the control problem itself is fairly
> straightforward.

We saw this as the easy part.  We're currently getting (for our  quad-copter project) 10.5 lbs of thrust with ~5lbs weight, so that's a  pretty significant payload.  The PID code has had us head-scratching  for a bit.

http://www.veisystems.com/nose/quarc.html

Cheers,
-Neil.

2011\02\11@004353 by Sean Breheny

face picon face
Hi Neil,

It looks like you guys are doing a pretty good job! Nice thrust test
video. Were you using a scale to measure the thrust?

Well, perhaps you will be lucky (or we were going about things wrong),
but we found that you can't really tell how good your mechanical
design is until you try to control it automatically. Once you get all
the electronics/sensors, etc. on-board, the weight tends to be more
than you had expected. More importantly, the structure we first tried
tended to have vibrations in it which were in the same frequency range
as expected vehicle dynamics, so we couldn't just filter them out. We
had to go back and re-design the structure with tiny steel cables to
tension it like a WWI biplane and make the structure stiff enough that
the vibrations were negligible. The effect of the vibrations was to
make the sensors move relative to the props and violate the simple
rigid-body assumptions of our control model.

Sean


On Fri, Feb 11, 2011 at 12:01 AM, PICdude <.....picdude3KILLspamspam.....narwani.org> wrote:
{Quote hidden}

>

2011\02\11@011345 by PICdude

flavicon
face
Hopefully we won't run into that.  The round tube we felt would be  very rigid (compared to some of the other implementations we've seen),  and we at one point had PID crudely working on one axis and could see  it correct somewhat decently.  We've also engineered the motor mounts  to be "slideable" so we can change moments and somewhat alter the  dynamics of the copter.

That thrust test was an earlier one.  With proper wiring, diff props,  and better code later, we got 10-lbs, 7-oz of thrust.  Yes, we're  using a scale to measure thrust.  And the 5lb weight is with 2 @ 5000  mAH LiPo batteries. so we should get quite a bit of flight time.

We're close now, so will find out soon what issues we run into.

Also pushing out of the PIC-tag subject area here, but guessing that  "PIC" earlier in this sentence and a second time in this same sentence  will keep me legal.

Cheers,
-Neil.



Quoting Sean Breheny <shb7spamspam_OUTcornell.edu>:

{Quote hidden}

>> -

2011\02\11@061811 by Vic Fraenckel

picon face
On 2/10/2011 10:41 PM, Nathan House wrote:
> Sometime over the next six months or so (planning ahead) I'm going to
> try to write a Kalman filter for a PIC. I first want to use it to
> integrate signals from one gyroscope and one accelerometer to
> detect/predict tilt for a balancing robot, and then eventually I want
> to make something called a quadrotor helicopter.
>
Have you discovered http://diydrones.com/ yet? Perhaps you can pick up some pointers there and get some help on these sort of questions from some guys that have "been there - done that"!

Vic

Vic Fraenckel
KC2GUI

2011\02\11@103316 by Peter

picon face
Somewhat related: I'm curious if the pendulum fallacy also applies to reaction
thrust powered flying objects like helicopters. My instinct says it does? That
has interesting implications with regards to the mass distribution of any flying
copter-like device and implicitly reflects upon the attitude control servo
algorythm needed.

-- Peter

2011\02\14@102647 by Nathan House

picon face
So, if a PID doesn't work well enough, would a dsPIC or PIC32 handle a
Kalman filter better

2011\02\14@105847 by Michael Watterson

face picon face
On 14/02/2011 15:26, Nathan House wrote:
> So, if a PID doesn't work well enough, would a dsPIC or PIC32 handle a
> Kalman filter better?
The CPU needed for  any DSP depends  roughly on sample rate x filter complexity x accuracy

A modest CPU thus can do any filter very slowly as long as you don't run out of RAM for intermediate results / pipeline / sample

2011\02\14@130624 by Sean Breheny

face picon face
Just to clarify: It isn't PID vs Kalman filter. A Kalman filter is not
a control technique. It is a technique for obtaining the best
estimates possible in order to feed them as inputs to your control
law. You could have a Kalman filter feeding a PID controller.

As for the processor necessary, as Michael said, it depends on how
fast you need to do things but in most motion control applications
using Kalman filters, I would recommend using a processor with
hardware floating point.

Sean


On Mon, Feb 14, 2011 at 10:26 AM, Nathan House <RemoveMEnathanpiclistTakeThisOuTspamgmail.com> wrote:
> So, if a PID doesn't work well enough, would a dsPIC or PIC32 handle a
> Kalman filter better?
>

More... (looser matching)
- Last day of these posts
- In 2011 , 2012 only
- Today
- New search...