View Single Post
  #6   Spotlight this post!  
Unread 14-05-2009, 22:31
nathanww nathanww is offline
Hacker
FRC #1678 (Citrus Circuits)
Team Role: Programmer
 
Join Date: Dec 2008
Rookie Year: 2007
Location: Davis, CA
Posts: 224
nathanww is just really nicenathanww is just really nicenathanww is just really nicenathanww is just really nice
Re: Misbehaving encoders

Quote:
The theory you are describing (that you aren't reading the encoders fast enough and that they are going HIGH->LOW->HIGH so fast you don't see the "LOW" part) is known as aliasing.
Actually, the theory that I was referring to was that there wasn't enough difference between the voltage that the encoder sends for HIGH and what it sends for LOW. When we looked at this, it didn't really seem to actually touch either extreme of max/min--so we thought that it might be possible that the control system wasn't seeing these small differences because both the HIGH and LOW fall into what it considers HIGH.


Quote:
What kind of encoder are you using?
It's the US digital kit encoder

Quote:
How is it currently wired?
Each encoder's A and B outputs are wired to the signal in on the digital sidecar. We also use the power and ground on one PWM for those connections on the encoder
[/quote]

Quote:
Are you using LabView or C++, and what encoder code are you using?
We're using C++, which is

Code:
	Encoder *encoder1;
***more declarations******
encoder1=new Encoder(2,3,false,Encoder::k4X);
*****more config stuff********
void RobotInit(void) {
encoder1->Start();
encoder1->SetDistancePerPulse(100); //values are completely arbitary
encoder1->SetMinRate(1);
*****the rest of the init, now in the teleop periodic*****

printf("encoder1=%d",encoder1->Get());
    if (encoder1->GetStopped()) {
		printf("encoder stopped");
       }
__________________
Get yer robot source code here!