Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   encoder uneven (http://www.chiefdelphi.com/forums/showthread.php?t=103492)

therealman1 21-02-2012 12:15

encoder uneven
 
The programming team has been recently been working on our PID loop but the encoder is not keeping it near steady at all. I will soon hopefuly post the code, can anyone give us some advice?

Ether 21-02-2012 12:22

Re: encoder uneven
 
Quote:

Originally Posted by therealman1 (Post 1131662)
The programming team has been recently been working on our PID loop but the encoder is not keeping it near steady at all. I will soon hopefuly post the code, can anyone give us some advice?

You're much more likely to get useful answers if you provide useful information.

Have you looked at the output of the encoder and is it sufficiently noise free and accurate?

What device is the PID controlling?

Is the PID in cRIO or a Jaguar?

Speed, linear position, or angle?

What scaling are you using for the setpoint and process variable?

What encoder part number?

4x 2x or 1x ?

What are your P, I, and D gains?

etc etc etc



therealman1 21-02-2012 12:58

Re: encoder uneven
 
Have you looked at the output of the encoder and is it sufficiently noise free and accurate?
it is not noise free. that is the main problem.

What device is the PID controlling?
shooter drive motors. two jags, connected by a splitter cable

Is the PID in cRIO or a Jaguar?
cRIO

Speed, linear position, or angle?
speed

What scaling are you using for the setpoint and process variable?
all parts are -1-1

What encoder part number?
E4P

4x 2x or 1x ?
4x

What are your P, I, and D gains?
we are setting them. we varry p, while i and d remain at 0

etc etc etc
anything else?

Ether 21-02-2012 13:13

Re: encoder uneven
 
Quote:

Originally Posted by therealman1 (Post 1131710)
Have you looked at the output of the encoder and is it sufficiently noise free and accurate?

it is not noise free. that is the main problem.

4x 2x or 1x ?
4x

What is the encoder speed? There is a limit to how fast the FPGA can count.

Try using 1x. You don't need 4x for the high speed of a shooter wheel.

If that signal isn't quiet enough, then do this:

instead of using GetRate(), read the encoder counts (still using 1x) instead, subtract the previous counts [see footnote] , and divide that by the sample time. Then scale appropriately.


Quote:

anything else?
Yes:

Quote:

What device is the PID controlling?
shooter drive motors. two jags, connected by a splitter cable
Are these identical motors, and are their outputs mechanically linked so they are at the same speed?

Quote:

Is the PID in cRIO or a Jaguar?
cRIO
Home-brew or WPI library?


Quote:

What are your P, I, and D gains?
we are setting them. we varry p, while i and d remain at 0

Speed, linear position, or angle?
speed
Are you integrating the output of the PID?


Quote:

What scaling are you using for the setpoint and process variable?
all parts are -1-1
What do you mean by "-1 -1"


footnote: or do this: read the encoder counts, divide that by the sample time, then reset the encoder counts to zero. I don't know how long it takes the encoder counts to overflow


therealman1 21-02-2012 13:14

Re: encoder uneven
 
that sounds good i will try that

Ether 21-02-2012 13:26

Re: encoder uneven
 
Quote:

Originally Posted by therealman1 (Post 1131722)
that sounds good i will try that

I edited my previous post and added some more comments and questions. Please re-read it.



therealman1 21-02-2012 13:57

Re: encoder uneven
 
Are these identical motors, and are their outputs mechanically linked so they are at the same speed?
They are the same moters and they are both mechanically linked

it is WPI library

Are you integrating the output of the PID?
speed+=PIDshooter.get();
leftJag.set(speed);

-1-1 as from -1 to 1

Ether 21-02-2012 14:34

Re: encoder uneven
 
Quote:

Originally Posted by therealman1 (Post 1131758)
speed+=PIDshooter.get();
leftJag.set(speed);

I assume that PIDshooter.get() returns the output of your PID, correct ?

I assume leftJag.set() is the method which sets the output to your motor controller, correct ?

What is the range of the input that the motor controller is expecting ?

Do you need to clamp that to -/+1 ?

What is the speed of the device to which the encoder is attached ? (the FPGA has a counts/sec limit)



therealman1 21-02-2012 14:44

Re: encoder uneven
 
the jag is expecting -1 to 1, and it is receiving that amount

Ether 21-02-2012 14:54

Re: encoder uneven
 
Quote:

Originally Posted by therealman1 (Post 1131791)
the jag is expecting -1 to 1, and it is receiving that amount

there's no -/+1 clamp here, "speed" is being integrated without bound:

Code:

speed+=PIDshooter.get();
leftJag.set(speed);




All times are GMT -5. The time now is 09:54.

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