Chief Delphi

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

RedLight 01-02-2014 11:30

Encoder Trouble
 
We use Java and have Grayhill 63R encoders that do not work. We have checked the wiring and it is fine. The a and b signals are taking up 2 different channels, it has power and ground, and the wires are not broken. The constructor is :
driveLeftEncoder = new Encoder(3, 4, false, EncodingType.k4X);
We also remembered to start and reset it. When printing the values, the encoder always returns 0 for the get() method, .25 for the getDistance() method, 1 for getRaw(),and true or false at random for getDirection(). Unless we stop then start it, the rate is 0, and when we do it is a random value. Also without stopping and starting it, it always returns true for getStopped(). We are utterly confused as to what is wrong and would appreciate any help.

Sparkyshires 01-02-2014 11:33

Re: Encoder Trouble
 
An issue that can easily get over looked is do you have your encoder reset inside a while function? And would you also mind posting your code?

sarangmittal 01-02-2014 11:54

Re: Encoder Trouble
 
Another thing crucial to getting Encoders to work is using the setDistancePerPulse() method.

You experimentally determine this constant by rolling the robot over a pre-determined distance, and recording the number of pulses from the get() method.

Then it's as easy as dividing distance by the number of pulses, and using the setDistancePerPulse() before getting the distance.

Hope this helps.

If this still doesn't work, maybe try posting the code, and we can look it over.

Michael U 01-02-2014 18:36

Encoder Trouble
 
1 Attachment(s)
For the past two weeks our team has tried to get our US Digital encoder working. We cannot read any values from the encoder at all. Our wiring is the same as this:


And our code is attached.

We have tried to test everything that we could think of. Please help us find what is wrong so we can get them working. Thank you very much for your help, we really appreciate it.

Ether 01-02-2014 18:49

Re: Encoder Trouble
 
Quote:

Originally Posted by Michael U (Post 1335943)
For the past two weeks our team has tried to get our US Digital encoder working. We cannot read any values from the encoder at all. Our wiring is the same as this:


And our code is attached.

We have tried to test everything that we could think of. Please help us find what is wrong so we can get them working. Thank you very much for your help, we really appreciate it.

Are you really connecting the encoders to the DCS PWM outputs rather than the DIO?



geomapguy 01-02-2014 18:57

Re: Encoder Trouble
 
Quote:

Originally Posted by Ether (Post 1335951)
Are you really connecting the encoders to the DCS PWM outputs rather than the DIO?



Maybe he meant PWM cable

Ether 01-02-2014 18:58

Re: Encoder Trouble
 
Quote:

Originally Posted by geomapguy (Post 1335957)
Maybe he meant PWM cable

I hope so. But that needs to be confirmed.



Michael U 01-02-2014 19:19

Re: Encoder Trouble
 
Sorry for the confusion, we are connecting them via pwm cable to the "DIGITAL I/O" on the digital sidecar.

Ether 01-02-2014 19:58

Re: Encoder Trouble
 
Quote:

Originally Posted by Michael U (Post 1335968)
Sorry for the confusion, we are connecting them via pwm cable to the "DIGITAL I/O" on the digital sidecar.

Does your team have access to an oscilloscope, even a cheap one?




Michael U 01-02-2014 20:09

Re: Encoder Trouble
 
Yes, we do own an oscilloscope.

Ether 01-02-2014 20:14

Re: Encoder Trouble
 
Quote:

Originally Posted by Michael U (Post 1336003)
Yes, we do own an oscilloscope.

Look at the output of the encoder(s). See if there's any signal coming out.

You may have to carefully strip the insulation of a small section of the signal wires.



apalrd 01-02-2014 20:25

Re: Encoder Trouble
 
Quote:

Originally Posted by Ether (Post 1336013)
]You may have to carefully strip the insulation of a small section of the signal wires.

I was taught by an smart EE to use a scribe to poke through the insulation of the wire, then touch the probe to the scribe. Super easy, and the wire isn't exposed when you're done (you should still warp it in electrical tape afterward)

The same guy taught me to strip wire using small side cutters, another handy trick.

Michael U 01-02-2014 21:02

Re: Encoder Trouble
 
We are getting signals from channel a and channel b. (it looks like a pwm signal)

Ether 01-02-2014 21:31

Re: Encoder Trouble
 
Quote:

Originally Posted by apalrd (Post 1336025)
I was taught by an smart EE to use a scribe to poke through the insulation of the wire, then touch the probe to the scribe.

Of course. Thank you. I suppose you could use a needle or a pin in a pinch.



Ether 01-02-2014 21:33

Re: Encoder Trouble
 
Quote:

Originally Posted by Michael U (Post 1336051)
We are getting signals from channel a and channel b. (it looks like a pwm signal)

A and B should be in quadrature. Are they?




All times are GMT -5. The time now is 02:38.

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