Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Electrical (http://www.chiefdelphi.com/forums/forumdisplay.php?f=53)
-   -   Multiple Encoder issues (http://www.chiefdelphi.com/forums/showthread.php?t=115714)

Dragonslayerend 02-04-2013 14:45

Multiple Encoder issues
 
Okay So we want to create an auton drivetrain using two encoders. The encoders are to be wired to the Digital sidecard. Each encoder is wired accordingly to specs. a & b to two signal ports and positive and negative to respective pins. The issue we have is when we add a second encoder to the digital sidecard the new encoder gives me flickering values, although the first encoder still gives me normal values. Another thing is also if the second encoder is programmed to anything besides GetDistance()(We use C++) Function, it will not give me any values. When using only one encoder we can use it with any port. Though after adding a second encoder, all other ports will result in the same flickering response besides the port used by the first encoder. We can interchange encoders and the result is still the same even with different encoders. We also got the same results from using a whole second set of electronics(new cRIO ect.). So what we would like to ask is how do you use multiple encoders on a digital sidecard?

Joe Ross 02-04-2013 14:57

Re: Multiple Encoder issues
 
What does the 5v light on the digital sidecar do when the additional encoders are added? Can you post your code?

In 2009, we used 5 encoders. We've used 2 encoders each year since then.

Phalanx 02-04-2013 15:57

Re: Multiple Encoder issues
 
A few years ago I ran into something similar. I banged my head against the way for the better part of a day trying to isolate it.

We swapped encoders, we continuity tested the cables, even checked for bleed over on each pin. We could find nothing wrong.

Purely by accident, one encoder was not plugged into the digital side car and suddenly all but that one were working flawlessly. I replaced that cable with a new one and presto everything started working.

What it turned out to be was ONE bad encoder cable, where in cable, heck if I know, because it passed every test I could do at the event. But that was it.

So my suggestion would be to disconnect all your encoders, and then add them back one at a time until you find the culprit.

Dragonslayerend 02-04-2013 17:31

Re: Multiple Encoder issues
 
Quote:

Originally Posted by Joe Ross (Post 1256261)
What does the 5v light on the digital sidecar do when the additional encoders are added? Can you post your code?

In 2009, we used 5 encoders. We've used 2 encoders each year since then.

This is my simple encoder code to test the encoders. Also the encoder wires work, I switch the wires connected to the ports.
#include "WPILib.h"

class RobotDemo : public SimpleRobot
{
Encoder *Encoder1, *Encoder2;
CANJaguar *Jag1, *Jag2;
Servo *Shift;
DriverStationLCD *DsLCD;
Joystick *One;

public:
RobotDemo(void)
{
Encoder1 = new Encoder(2,3);
Encoder2 = new Encoder(4,5);
Jag1 = new CANJaguar(3);
Jag2 = new CANJaguar(4);
Shift = new Servo(1);
DsLCD = DriverStationLCD::GetInstance();
One = new Joystick(1);
}

void Autonomous(void)
{
}

void OperatorControl(void)
{
while (IsOperatorControl())
{
Encoder1->Start();
Encoder2->Start();
while(IsEnabled())
{
Jag1->Set(One->GetY());
Jag1->Set(One->GetY());
Shift->Set((One->GetRawAxis(4)/2)+.5);
DsLCD->Printf(DriverStationLCD::kUser_Line1,1,"Speed:%f" ,Encoder1->GetRate());
DsLCD->Printf(DriverStationLCD::kUser_Line2,2,"Speed:%f" ,Encoder2->Get());
DsLCD->UpdateLCD();
}
}
}
void Test() {

}
};

START_ROBOT_CLASS(RobotDemo);

MrRoboSteve 10-04-2013 22:31

Re: Multiple Encoder issues
 
If you put the encoders on higher numbered ports on the DSC do you get the same results?

Have you swapped the cable that connects the DSC to the cRIO?

Which encoders are you using?

When you say "flickering values", what do you mean?

A couple things on your test code -- don't think they're causing your problem, but good to fix.

1. You're setting Jag1 twice and not setting Jag2.
2. Should print out the same value from each of the encoders.

Dragonslayerend 16-04-2013 01:34

Re: Multiple Encoder issues
 
Quote:

Originally Posted by stevep001 (Post 1260234)
If you put the encoders on higher numbered ports on the DSC do you get the same results?

Have you swapped the cable that connects the DSC to the cRIO?

Which encoders are you using?

When you say "flickering values", what do you mean?

A couple things on your test code -- don't think they're causing your problem, but good to fix.

1. You're setting Jag1 twice and not setting Jag2.
2. Should print out the same value from each of the encoders.

Yeah we get the same results. And By flickering I mean it jumps back and forth from 1-2. Ex: *It gives me* 1,2,1,2,1,2,1. (over and over again as I spin the encoder). We have swapped the cables multiple times. We are using Ep4 360 and 250 encoders. Oh and I have multiple versions of the code to test the encoders that didn't involve Jags and printed out only GetDistance() for both.

Hugh Meyer 16-04-2013 09:38

Re: Multiple Encoder issues
 
Check the A & B signals with a scope. You should see two square waves that are 90 degrees out of phase. If they are on the ragged edge of right you will get the sequence you described. Be sure the encoder wheel is paired with the correct sensor base. The different line count requires a different sensor to maintain the 90 degree phase response. The distance the encoder wheel is from the sensor also will affect this. Use the special tool US Digital provides to set the distance. End play or shaft run out will also cause trouble.

-Hugh


All times are GMT -5. The time now is 11:18.

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