View Single Post
  #3   Spotlight this post!  
Unread 20-02-2012, 01:26
bob.wolff68's Avatar
bob.wolff68 bob.wolff68 is offline
Da' Mentor Man
FRC #1967
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2007
Location: United States
Posts: 157
bob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nice
Re: US Digital E4P Encoder Not Giving Pulse Data

Similar to Alan's comment - but if not obvious...you need to call "GetRate()" again and again in your OperatorControl() loop. Are you able to get printf() data via NetConsole? Or are you using SmartDashboard? If so, make sure you print out these items so you can get a sense of whether or not it is working properly. Also, if GetRate() is returning nothing of interest, I'd suggest calling GetRAW() and printing that out or plotting it on SmartDashboard. GetRAW should be an ever-increasing counter.

Now, if you're doing all that and it's not working, here's what we did to diagnose a bad hardware situation...

If your inputs from the Encoder are on digital IO's 5 and 6, plot the values of those digital inputs on 5 and 6 to ensure they are both changing when the shaft is spun. We found that one of our inputs was bad from the encoder and threw it in the trashcan.

Code:
// Testing encoder digital IO's without actually using the encoder class...
// This is a 'substitute diagnosis' for...
// Encoder enc(5, 6); which seems to be not working.
DigitalInput in1(5);
DigitalInput in2(6);
SmartDashboard* smarty = SmartDashboard::GetInstance();
int in1value, in2value;

while (IsOperatorControl())
{
  in1value = in1.Get();
  in2value = in2.Get();

  smarty->PutInt("In1", in1value);
  smarty->PutInt("In2", in2value);
}
If you don't get a text box (which can be turned into a plot/chart for easier viewing) which is changing from ones to zeros and back over and over again, then your encoder is hooked up wrong, plugged into the wrong slots/IOs, or dead/broken.

bob - Team 1967 - The Janksters
__________________
~~~~~~~~~~~~~~~~~~~
Bob Wolff - Software from the old-school
Mentor / C / C++ guy
Team 1967 - The Janksters - San Jose, CA
Reply With Quote