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)

Ether 08-03-2015 22:01

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

Originally Posted by tStano (Post 1455224)
How would you use the voltmeter to tell whats wrong with the encoder? Just to see that it is indeed getting power and common?

That's a start.

Quote:

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
Or unless you rotate it by hand, very very slowly... in which case you should see the signal waveform (especially with an analog voltmeter).



The Lucas 09-03-2015 00:39

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

Originally Posted by tStano (Post 1455224)
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.

Many multimeters have a "Hz" setting that can be a quick check for encoder output channels, including this one that was offered in First Choice. Spin encoder by hand to test frequency of your outputs (faster spin = higher frequency).

Aaron,
As others have suggested, checking the voltage supplied to the encoder (as close as you can get the probe to the actual +5 pin on the encoder) is a good start. From some of the symptoms you describe, I suspect you may have a short on the 5v rail of your RoboRIO. There are several more convenient indicators (other than a voltmeter) that will tell you if a short has occurred. These indicators include Red Power Led on the RIO and the RoboRIO webdash. A limit switch does not require 5v power so it is not a good proxy for an encoder in a test.

If you do have a short, look for any obvious swarf (metal shavings) that could be causing it. If you can't find any foreign metal shorts, then it is time to unplug everything (one by one) from 5v until it goes away. Inspect the wire with the short to find the source. One of the sneakier causes of a short is the frame violating the insulation of those 3 wire cables.

I had a swarf short issue this year that took me a while to resolve the night before bag. Here is a brief summary (highlights on my mistakes) with some dead ends and hours of bot drive time removed. I first noticed the navX MXP board 3.3v LED was off. I removed the navX, expecting to find metal under the board (last time it was the 4-40 lock nut that holds the navX shield on :rolleyes: ), but no short there. Grabbed the multimeter, the 3.3v pin on the MXP tested normal. Confused (I thought the navX used 3.3v input, it uses 5V), I eventually tested the 5V on the MXP. It was 0v, and I was wondering why the MXP 5v pin was not working but the rest of the RIO had 5v (I assumed, but it did not). I slowly connected a massive amount of swarf in the DIO ports (some perfectly coiled around 5v and ground) and then noticed the Red Power LED on the RIO. It is easy to develop tunnel vision when you think you know the cause of the issue, when you need to step back take a look at the bigger picture and test your assumptions along with basic fuctionality.

xNovax 09-03-2015 14:07

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

Originally Posted by The Lucas (Post 1455321)
Many multimeters have a "Hz" setting that can be a quick check for encoder output channels, including this one that was offered in First Choice. Spin encoder by hand to test frequency of your outputs (faster spin = higher frequency).

Aaron,
As others have suggested, checking the voltage supplied to the encoder (as close as you can get the probe to the actual +5 pin on the encoder) is a good start. From some of the symptoms you describe, I suspect you may have a short on the 5v rail of your RoboRIO. There are several more convenient indicators (other than a voltmeter) that will tell you if a short has occurred. These indicators include Red Power Led on the RIO and the RoboRIO webdash. A limit switch does not require 5v power so it is not a good proxy for an encoder in a test.

If you do have a short, look for any obvious swarf (metal shavings) that could be causing it. If you can't find any foreign metal shorts, then it is time to unplug everything (one by one) from 5v until it goes away. Inspect the wire with the short to find the source. One of the sneakier causes of a short is the frame violating the insulation of those 3 wire cables.

I had a swarf short issue this year that took me a while to resolve the night before bag. Here is a brief summary (highlights on my mistakes) with some dead ends and hours of bot drive time removed. I first noticed the navX MXP board 3.3v LED was off. I removed the navX, expecting to find metal under the board (last time it was the 4-40 lock nut that holds the navX shield on :rolleyes: ), but no short there. Grabbed the multimeter, the 3.3v pin on the MXP tested normal. Confused (I thought the navX used 3.3v input, it uses 5V), I eventually tested the 5V on the MXP. It was 0v, and I was wondering why the MXP 5v pin was not working but the rest of the RIO had 5v (I assumed, but it did not). I slowly connected a massive amount of swarf in the DIO ports (some perfectly coiled around 5v and ground) and then noticed the Red Power LED on the RIO. It is easy to develop tunnel vision when you think you know the cause of the issue, when you need to step back take a look at the bigger picture and test your assumptions along with basic fuctionality.

Thank you very much for the reply. I will make sure to look for anything in the DIO slots, test the voltage of our DIO slots, and I will see if our multimeter has a Hz mode. I will post back after my meeting tonight to follow up.

jbernardis 12-03-2015 21:33

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)

A simple continuity test is not enough for a cable. You also need to check the cable for short circuits - a cable with a short can and often does show continuity on each wire.

Our team learned this the hard way.

E Dawg 13-03-2015 14:16

Re: [Help] Problems with Encoders and PID Control
 
Make sure that there are no electrical issues anywhere else on the bot, as well. That has caused issues for us even though it wasn't directly connected to the sensor.

Hoover 23-03-2015 17:19

Re: [Help] Problems with Encoders and PID Control
 
This is rather urgent...

Did you ever find the problem with this? This started happening to us and it is wasting all our enbagging time.

We tried 3 different encoders
We have verified they are spinning
We tried different digital ports

We rolled back code to where we knew it worked.

We recently updated the firmware to the roborio as required. Other than that, we should be in the same state we were when it was working.

The problem sounds so similar to the one described in this thread I wonder if it is the same problem.

ozrien 23-03-2015 22:37

Re: [Help] Problems with Encoders and PID Control
 
You probably already checked but...
Is the encoder getting power (3.3 or 5v?). Don't just inspect the wiring, probe the contact with a voltmeter and measure. Then do the same thing with quadA and quadB. They should drive high then drive low as you rotate the shaft. Basically it should square wave as you turn.

What kind of encoder?

Hoover 24-03-2015 06:50

Re: [Help] Problems with Encoders and PID Control
 
Hi ozrien,

We use Vex shaft encoders.

http://www.vexrobotics.com/276-2156.html

To test the encoder, we fired up our test robot (uses a cRio) and got valid values from it when turning it by hand. I wasn't surprised by this because if we try 3 encoders and none of them work there is very little chance they are all bad.

Next, today's session, I will try it again on our current robot. If it works then the encoder is intermittent possibly due to wiring issues (see below).

If it doesn't, we will write a test program for it that tests only the encoder. The best case scenario is that it is our software bug because that will be the easiest to find and fix.

If none of this works on the roboRio, how do we test if we are getting output to the digital pins? Can that be done with a volt meter? If we don't see any with our simple program then what? That would seem a fairly serious problem with the hardware. If the roboRio is compromised, we don't have another.

Secondly, we use these adapter cable for the encoder. I hate doing it this way and I really wish the encoder came with female ends. This gives multiple points of failure. If these are intermittent they could even be our problem. The alternative is to cut and solder microwires and we've always avoided this. We went all last year with this setup with no problem but it is still worrisome.

http://www.vexrobotics.com/vex/produ.../276-2395.html

In any case I will report back what we find.

Hoover 24-03-2015 14:56

Re: [Help] Problems with Encoders and PID Control
 
Were in pretty deep here.

We tried the encoder on the cRio again to verify it works.
We tried a new encoder as well and that works.

We wrote a program that only reads an encoder.
We tried that on different ports.

(java)
m_encoder = new Encoder(2, 3, true);
...
m_encoder.get()... always returns 0.

We verified the Encoder class no longer needs .start();

We tried re-running the latest firmware on the roboRio. This did not help.

Where is the old firmware for the roboRio? We'd like to try that.

Ether 24-03-2015 15:17

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

Originally Posted by Hoover (Post 1461459)
If none of this works on the roboRio, how do we test if we are getting output to the digital pins? Can that be done with a volt meter?

Yes.

If you have a cheap analog voltmeter use that instead of digital.

Just set the voltmeter for the 12 volt scale and measure the voltage between the A channel and ground. Turn the encoder shaft very slowly and you should see the needle go from zero to some positive value. Repeat for B channel.

PS it goes without saying (I hope) that the encoder must be powered.



Hoover 24-03-2015 16:01

Re: [Help] Problems with Encoders and PID Control
 
Yeah... speaking of voltage, we are not getting any voltage on the power pin for DIO on the roboRio.

Any switch we have works because we don't require voltage.

We think this is where we are at.

Ether 24-03-2015 16:17

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

Originally Posted by Hoover (Post 1461707)
Yeah... speaking of voltage, we are not getting any voltage on the power pin for DIO on the roboRio.

Well, the encoder surely is not going to provide a signal without power.

That's why I always urge simple troubleshooting with a voltmeter before spending a lot of time swapping out parts.



Hoover 24-03-2015 16:44

Re: [Help] Problems with Encoders and PID Control
 
We know about the 'brownout condition' of the roboRio but we don't think it is in that state as the power light is normal.

We get 3.3 volts from power to signal pins. We get no voltage from the power to ground pin.

We have a tournament on Friday. We will try to learn as much about it there.

Meanwhile our team is learning to play manually... not bad either

Ether 24-03-2015 16:51

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

Originally Posted by Hoover (Post 1461731)
We get 3.3 volts from power to signal pins. We get no voltage from the power to ground pin.

Where and how are you measuring this? At the RIO DIO with no cable attached?



JamesBrown 24-03-2015 16:56

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

Originally Posted by Hoover (Post 1461707)
Yeah... speaking of voltage, we are not getting any voltage on the power pin for DIO on the roboRio.

Any switch we have works because we don't require voltage.

We think this is where we are at.

Quote:

Originally Posted by Ether (Post 1461718)
Well, the encoder surely is not going to provide a signal without power.

That's why I always urge simple troubleshooting with a voltmeter before spending a lot of time swapping out parts.



Now that you know why you aren't getting anything from the encoder, it is time to move upstream, and figure out why you aren't getting any power on the DIO pins.

WHat color is your power LED? Red? If so you probably have a short from 5V to GND

Start by unplugging everything, and visually inspect all of the slots to ensure no debris is present. Verify the Power LED is Green, and measure the voltage on the DIO +5V pins again.

If you have power now, start looking for your short. Take each connector, one at a time, and verify there is no continuity between pins 2 and 3 on the connector. If there is no continuity, plug it back in and verify that you still have 5V power. If there is continuity, or when you plug it in you lose power, then inspect the cable, and device to find and fix the short.


Edit- Apparently I was slow replying.

Quote:

Originally Posted by Hoover (Post 1461731)
We know about the 'brownout condition' of the roboRio but we don't think it is in that state as the power light is normal.

Define Normal

Quote:

Originally Posted by Hoover (Post 1461731)
Meanwhile our team is learning to play manually... not bad either

My only concern with this approach is that if the issue is something like a 5V short from debris in the controller, then that debris could move, causing different, potentially worse symptoms.


All times are GMT -5. The time now is 06:30.

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