Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Electrical (http://www.chiefdelphi.com/forums/forumdisplay.php?f=53)
-   -   [Help] Problems with Encoders and PID Control (http://www.chiefdelphi.com/forums/showthread.php?t=135584)

xNovax 08-03-2015 19:47

[Help] Problems with Encoders and PID Control
 
I have run into an issue with an encoder on my teams robot, the encoder was working fine at the beginning of the day but as the day went on the encoder stopped working. Now we cannot get any encoders to work on the robot. Here is what we have tried: Replace the encoder with a new one, change the wire connection to the encoder, changing the DIO port for the encoder, triple checking our code, testing the DIO ports with a limit switch(successful) and power cycling the robot and our drive station.

I have become stumped with what is causing the issue. My mentors seem to think that it is something to do with software but I have checked the code multiple times.

Here is our code: https://github.com/Cyberfalcons/robot2015

Here is the class where the encoder is being used: https://github.com/Cyberfalcons/robo...nElevator.java

Any help is greatly appreciated!

cjl2625 08-03-2015 19:53

Re: [Help] Problems with Encoders and PID Control
 
I once had a similar problem where I couldn't get a reading out of our lift encoder. It turned out that the limit switch at the bottom was constantly on, so the encoder kept getting reset to zero.
I see this in your code, which looked similar to what I was doing:
Code:

else if (getBottom() == true) {
                        resetEncoder();

Just an idea

xNovax 08-03-2015 20:01

Re: [Help] Problems with Encoders and PID Control
 
That should only cause problems if we try to go down when the limit switch is engaged. We have tried hand spinning an encoder that is not attached to any subsystems and it still does not read anything but 0.

Thad House 08-03-2015 20:06

Re: [Help] Problems with Encoders and PID Control
 
Quote:

Originally Posted by xNovax (Post 1455175)
That should only cause problems if we try to go down when the limit switch is engaged. We have tried hand spinning an encoder that is not attached to any subsystems and it still does not read anything but 0.

Remember all DIOs return true if nothing is attached to them. So if the limit switch came unplugged or went bad, the encoder would be constantly resetting. So if you were trying to test the encoders but had all other DIOs unplugged, the encoder would constantly be getting reset, unless you commented out the reset code.

xNovax 08-03-2015 20:08

Re: [Help] Problems with Encoders and PID Control
 
We tested the limit switches to make sure they were working before we started messing with other stuff.

Ether 08-03-2015 20:08

Re: [Help] Problems with Encoders and PID Control
 
Quote:

Originally Posted by xNovax (Post 1455175)
That should only cause problems if we try to go down when the limit switch is engaged. We have tried hand spinning an encoder that is not attached to any subsystems and it still does not read anything but 0.

Time to get out the voltmeter.



tStano 08-03-2015 20:08

Re: [Help] Problems with Encoders and PID Control
 
A quadrature encoder will do weird things if both channels are not plugged in. Pretty sure it would read zero. Are both channels plugged in to DIO ports?

Also, did you try inintializing the encoder as a digital input and watching the true/false flash?

xNovax 08-03-2015 20:10

Re: [Help] Problems with Encoders and PID Control
 
Quote:

Originally Posted by Ether (Post 1455181)
Time to get out the voltmeter.



We checked the connections in both of the wires we tested with.

xNovax 08-03-2015 20:11

Re: [Help] Problems with Encoders and PID Control
 
Quote:

Originally Posted by tStano (Post 1455182)
A quadrature encoder will do weird things if both channels are not plugged in. Pretty sure it would read zero. Are both channels plugged in to DIO ports?

Also, did you try inintializing the encoder as a digital input and watching the true/false flash?

We made sure that both channels were plugged in, I will try the digital input thing once I have access to the robot.

Ether 08-03-2015 20:15

Re: [Help] Problems with Encoders and PID Control
 
Quote:

Originally Posted by xNovax (Post 1455184)
We checked the connections in both of the wires we tested with.

How did you check them?



xNovax 08-03-2015 20:16

Re: [Help] Problems with Encoders and PID Control
 
Quote:

Originally Posted by Ether (Post 1455191)
How did you check them?



Beep test (Sorry I don't know the technical term)

Ether 08-03-2015 20:22

Re: [Help] Problems with Encoders and PID Control
 
Quote:

Originally Posted by xNovax (Post 1455192)
Beep test (Sorry I don't know the technical term)

What's a beep test?



E Dawg 08-03-2015 20:25

Re: [Help] Problems with Encoders and PID Control
 
Quote:

Originally Posted by Ether (Post 1455194)
What's a beep test?



It's a continuity test, I believe.

Ether 08-03-2015 20:28

Re: [Help] Problems with Encoders and PID Control
 
Quote:

Originally Posted by E Dawg (Post 1455197)
It's a continuity test, I believe.

You can't measure volts with a continuity tester.



tStano 08-03-2015 20:59

Re: [Help] Problems with Encoders and PID Control
 
Quote:

Originally Posted by Ether (Post 1455181)
Time to get out the voltmeter.

How would you use the voltmeter to tell whats wrong with the encoder? Just to see that it is indeed getting power and common? The pulses on the output channels will probably be much too fast to be read without an oscilliscope, unless the encoder has really low resolution I suppose. Carry on.


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

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