Go to Post I'm still trying to find a way to get FIRST to dump the Chicken Dance song. :p - Koko Ed [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Spotlight this post!  
Unread 05-28-2010, 03:48 PM
vamfun vamfun is offline
Mentor :Contol System Engineer
AKA: Chris
FRC #0599 (Robodox)
Team Role: Engineer
 
Join Date: Jan 2009
Rookie Year: 2003
Location: Van Nuys, California
Posts: 182
vamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of light
Send a message via AIM to vamfun
Re: Encoder::GetRate()

Quote:
Originally Posted by mikets View Post
I am sorry if I don't understand. If the goal is to get velocity, wouldn't it be easier to do this instead:
Code:
vel = (currentDistance - previousDistance)/period;
This should work unless there is a problem with GetDistance() too.
If the period is identical to the pulse period, then this is the same as GetRate() (less some filtering).

If the period is set by a periodic loop outside of encoder.c and not the actual pulse period, then vel is an average speed over that sample period. As I mentioned in the first post, if the sample period is much shorter than the actual pulse period, then this "vel" approaches an impulse train with zeros in between. These impulses can cause trouble if there are nonlinearities in the system such as limits or threshold detectors. So with very high sample rates, additional filtering is needed to negate these effects. The simplest way to filter the impulses is to increase the sample period over which you obtain the average rate, but this causes added delays is detecting speed changes.

So the GetRate() output is a nice compromise. It detects when a pulse has changed and then adjusts the rate and holds it in a register for whoever wants to use it. The averaging time varies with the pulse period and it has an artificial max period but it eliminates the impulses present with very high sample rates and minimizes the need for additional filtering.

I might add that encoder rate noise from other sources often dictates that even GetRate() be further filtered.

Last edited by vamfun : 05-28-2010 at 04:13 PM.
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unexpected results from Encoder::GetRate() LyraS C/C++ 90 04-16-2012 08:27 PM
Encoder Error Haragorn NI LabVIEW 15 01-31-2010 08:29 PM
Screwing Encoder into Encoder Mount? Adrien Electrical 3 01-25-2009 06:14 PM
encoder.c Gary Bonner Programming 2 01-14-2005 01:41 PM


All times are GMT -5. The time now is 10:40 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi