CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

kalman filter

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
zrbz



Joined: 16 Jul 2007
Posts: 2

View user's profile Send private message

kalman filter
PostPosted: Sun Jun 08, 2008 6:53 am     Reply with quote

can anyone help me implement a kalman filter using pic16f877?

i am using 1000 tics per revolution shaft encoder to get the position of my motor.
RLScott



Joined: 10 Jul 2007
Posts: 465

View user's profile Send private message

Re: kalman filter
PostPosted: Mon Jun 09, 2008 6:22 am     Reply with quote

Does your shaft encoder have an index pulse too?

What sort of noise do you expect to have to deal with? I have never heard of a Kalman filter being used "estimate" the position of a shaft when a reliable encode is connected to it.

Robert Scott
Real-Time Specialties
Guest








PostPosted: Mon Jun 09, 2008 8:34 am     Reply with quote

no it does not have an index pulse. i use it for a bipedal robot, so im expecting unnecessary increments in the encoder when the robot moves.
Ttelmah
Guest







PostPosted: Mon Jun 09, 2008 10:02 am     Reply with quote

The encoder, should return where the shaft is.
The 'point' about a Kalman filter, is where there is significant variation in the reading being taken, and the reading relates to a well understood motion, you can make a 'better guess' at where the real position is. So, if using a ultrasonic range finder for example, or a similar IR detector, which can have momentary variations as ambient conditions change, and also return a fairly 'noisy' signal, the Kalman filter is a good way of working out the real position. However with a shaft encoder, the reading should be accurate, and such a filter would be pointless...
You don't say what sort of rotational rate is involved, but if it is more than a slow rate, I doubt if a PIC, could perform a reasonable Kalman filter anyway, from a 1000ppr encoder. If the speed was at all significant, I'd consider using a hardware counter for the position (to avoid pulses being missed), and let the PIC get on with other jobs.

Best Wishes
RLScott



Joined: 10 Jul 2007
Posts: 465

View user's profile Send private message

Re: kalman filter
PostPosted: Mon Jun 09, 2008 10:22 am     Reply with quote

Another reason why a Kalman filter is pointless in a shaft encoder is that the readings are not independent. Once an error in the count creeps in, that error stays in forever (or until some independent information comes in that can correct the error.) A Kalman filter would help in the case where each reading may have some error, but the error affects only that reading and not any future readings.

Why do you think that there will be unnecessary counts when the robot moves? Are you at least using a quadrature encoder (with A and B phases)? Such an encoder, when connected to a proper quadrature up/down counter, will not get any unnecessary counts, and it will properly account for stopping and reversing direction.

Robert Scott
Real-Time Specialties
radiohound



Joined: 17 Jan 2009
Posts: 1

View user's profile Send private message

Re: kalman filter
PostPosted: Sat Jan 17, 2009 8:22 pm     Reply with quote

zrbz wrote:
can anyone help me implement a kalman filter using pic16f877?

i am using 1000 tics per revolution shaft encoder to get the position of my motor.


Here is an implementation for a 16f628. But it is in assembly language.

http://home.earthlink.net/~david.schultz/rnd/2004/#code

-Walter
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group