Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Help Programming a Quadrature Encoder (http://www.chiefdelphi.com/forums/showthread.php?t=68102)

steveg 20-06-2008 07:37

Re: Help Programming a Quadrature Encoder
 
Quote:

Originally Posted by Bomberofdoom (Post 753591)
You mean there's a difference between putting the encoder on the left side or the right side of the gear/wheel?

What Bill is getting at is that while the A signal of the encoder on the left side of the drive train might be leading, the encoder on the right side of the drive train might be lagging. You can check the signals coming out of the encoders with an oscilloscope, or what I usually do is just hook it up, look at the encoder counts in a terminal, and reverse the sign bit if necessary.

Phalanx 20-06-2008 07:48

Re: Help Programming a Quadrature Encoder
 
Generally the data sheet for the encoder will specify which signal leads which.
For example, it may say... A leads B in a clockwise rotation.

So if it's turning clockwise then A will come first followed by B. Conversely if it's turning counter clockwise the B will come first followed by A.

I highly recommend downloading and reading this excellent white paper on quadrature encoders. It explains the A versus B, and provides mostly functional code. The sample code does have 2 bugs, but you should be able to find them. If not PM me. Our team has been using this methodology for the last 2 or 3 seasons very successfully.

http://www.chiefdelphi.com/media/papers/1490

Read it, I think you will see the lights go on in your head and you'll have a much better understanding.

billbo911 20-06-2008 10:40

Re: Help Programming a Quadrature Encoder
 
Quote:

Originally Posted by Bomberofdoom (Post 753591)
You mean there's a difference between putting the encoder on the left side or the right side of the gear/wheel?

Part of why a robot seems to drift to the left or right when driving near full speed is that motors have a "bias". This means that they spin more efficiently in one direction than the other. Now I will point out, the CIM motors in the KOP are not a good example of this because they have very little bias, but they do have some. The reason you notice the effect of this bias is because usually one motor is turning CW while the other is turning CCW to drive a robot forward. So...... one encoder will be going CW while the other is going CCW for the same direction of drive.
Again, this is really simple to handle in the ISR. For the same direction of travel make sure both encoders are incrementing, and decrementing for the opposite direction.

Read through Kevin Watson's encoder code, this is all spelled out clearly.


All times are GMT -5. The time now is 15:20.

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