View Single Post
  #5   Spotlight this post!  
Unread 20-02-2011, 16:27
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Keeping track of Encoder Shaft Location using WPI Counter VI

I actually think my early morning quick-fix didn't fix. Taking a step back, it feels to me like you want three pieces of state data.

1. Last counter value -- used to compute delta, and updated to new counter value each call.

2. Number of forward counts

3. Number of backward counts

The button is used to determine whether the new delta is added to the Fwd or Bkwd state data.

The return value is the Fwd - Bkwd counts.

Perhaps you can do it with less, state, but to me, this seems the most natural way to think of it.

Hope that helps.
Greg McKaskle
Reply With Quote