Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Electrical (http://www.chiefdelphi.com/forums/forumdisplay.php?f=53)
-   -   High speed encoder with slotted / flat end... can't find one. (http://www.chiefdelphi.com/forums/showthread.php?t=106568)

Ether 21-05-2012 14:08

Re: High speed encoder with slotted / flat end... can't find one.
 
1 Attachment(s)

It doesn't look like it's holding the final speed very well (see portion circled in red). Do you have a screenshot with a longer time axis showing if it settles out?


JamesTerm 21-05-2012 14:19

Re: High speed encoder with slotted / flat end... can't find one.
 
Quote:

Originally Posted by Ether (Post 1170790)

It doesn't look like it's holding the final speed very well (see portion circled in red). Do you have a screenshot with a longer time axis showing if it settles out?


Here same exact run... I fixed a bug in the graph program that allows it to process multiple bitmaps when the dump was too long so we can see most of it this time.


Ether 21-05-2012 14:55

Re: High speed encoder with slotted / flat end... can't find one.
 
Quote:

Originally Posted by JamesTerm (Post 1170795)

Hmm. Looks like 10 pixels (p-p) out of 229 pixels (full scale) = 4.4% p-p.

Tom is looking for 2% p-p (2674 to 2619).



JamesTerm 21-05-2012 15:42

Re: High speed encoder with slotted / flat end... can't find one.
 
Quote:

Originally Posted by Ether (Post 1170800)
Hmm. Looks like 10 pixels (p-p) out of 229 pixels (full scale) = 4.4% p-p.
Tom is looking for 2% p-p (2674 to 2619).


The 4.4 is due to poor PID tuning and other mechanical issues with the shooter and should have nothing to do with the averagers giving the encoders a better reading... I could probably get 2.2 if I spent more time tuning the PID... which I did not have during the competition. I really need to find and post what the encoder readings looked like before these averagers were applied... unfortunately I do not have them on this machine.

Ether 21-05-2012 16:46

Re: High speed encoder with slotted / flat end... can't find one.
 
Quote:

Originally Posted by JamesTerm (Post 1170807)
I really need to find and post what the encoder readings looked like before these averagers were applied... unfortunately I do not have them on this machine.

The comparison you really want is your present filtered solution versus the true speed (as measured with a high quality calibrated speed sensor).



JamesTerm 21-05-2012 17:06

Re: High speed encoder with slotted / flat end... can't find one.
 
Quote:

Originally Posted by Ether (Post 1170818)
The comparison you really want is your present filtered solution versus the true speed (as measured with a high quality calibrated speed sensor).



Ok I found the other machine that has a sample of the encoder in its raw state... this is the best I have to show at this time... that should illustrate what the averagers fixed.


Ether 21-05-2012 17:56

Re: High speed encoder with slotted / flat end... can't find one.
 
1 Attachment(s)
Quote:

Originally Posted by JamesTerm (Post 1170823)

Red circle: what is your controller trying to do here?

Blue circle: how are you reading the encoder? Are you using WPILib's GetRate, or are you getting raw counts and dividing by the elapsed time since the last sample was taken? If the latter, are you using actual elapsed time (as measured with a microsecond timer) or are you just using the scheduled period of your sampler? If the latter, did you take any measures (like giving it a higher priority) to reduce jitter?



JamesTerm 21-05-2012 18:23

Re: High speed encoder with slotted / flat end... can't find one.
 
Quote:

Originally Posted by Ether (Post 1170836)
Red circle: what is your controller trying to do here?
Blue circle: how are you reading the encoder? Are you using WPILib's GetRate, or are you getting raw counts and dividing by the elapsed time since the last sample was taken? If the latter, are you using actual elapsed time (as measured with a microsecond timer) or are you just using the scheduled period of your sampler? If the latter, did you take any measures (like giving it a higher priority) to reduce jitter?



I tried both GetRate() preferred, and then the raw counts against a microsecond timer... I believe this one was the GetRate() and both tests look identical (as I did some side-by-side of both method dumps)... where GetRate() did just slightly improve... but not really significant. At slower speeds this noise was not apparent.

A part of me thinks this may be a unique problem that this could be a defected encoder... but I can only speculate, and therefore I think it is good to reveal this to the group in case others may have seen something similar.

AdamHeard 21-05-2012 18:49

Re: High speed encoder with slotted / flat end... can't find one.
 
Tom,

It sounds like now you're doing a 9 cycle moving average filter now, we found that going to a low pass filter with a gusstimated gain was superior. We had several other performance issues at that time so I can't say for sure that a moving average is poor for flywheel control, but my controls classes would make me think a low pass is far better.

We also found that either running in constant time, or compensating for time in all controls calcs increased stability.

"Linearizing" the victors helped us a lot too.

These three rather simple changes gave us the biggest bang for our buck, and could be implemented/tested with little time/investment.

A complete revamp of the control to any number of things would also work, but I aim for the lower hanging fruit.

AdamHeard 21-05-2012 18:53

Re: High speed encoder with slotted / flat end... can't find one.
 
Could you also give us more info on your pid loop?

I see you're commanding velocity with pid, are you doing any other math or tricks? Feed forward? Are using p, i and d?

There is a lot of potential for poor velocity measurement/filtering, especially when acceleration is calculated for the d term, to cause jitter along the lines of what ether already said.

apalrd 21-05-2012 22:03

Re: High speed encoder with slotted / flat end... can't find one.
 
All,

We managed to get quite good speed control (1% from the key, slightly more variance at the lower speed fender) using a 4-line code wheel and Banner sensor. We setup the encoder to average 12 samples and used the rate functions of the WPI library (in LabVIEW). We ran the controller to a certain speed and verified it to within a few rpm with a tachometer, the tachometer readings corresponded quite well to the rpm speed measurements in software.

We used a feed-forward term as the primary element in the control, with PI (or, it could be thought of as PD with the output integrated) handling the variance and spin up. We had a cap on the max integral value which was limited linearly by the error up to ~300rpm (from memory), at which point the integral would be cut off completely. The controller ran in a 10ms Timed Task at high priority.

The feed forward term was calculated by measuring the speed at 25 throttle points, graphing it, and calculating a best fit curve in Excel, although the precision required on some of the terms is high - We didn't get anywhere close to accurate results until we took some of the constants to 10 or more significant digits. If I were to do it again I might come up with a solution that also considered battery voltage, but the I term can deal with battery voltage issues well enough down to around 11v or so, and we don't shoot while moving, so the battery is never that low when shooting.

We attempted a controller without a feed-forward term, using PID only, and the results were less than ideal. Since the I term has to wind up to keep a constant velocity, the gain has to be high enough for it to constantly oscillate slightly and never really settle.

Tom Line 21-05-2012 22:20

Re: High speed encoder with slotted / flat end... can't find one.
 
Quote:

Originally Posted by AdamHeard (Post 1170844)
Could you also give us more info on your pid loop?

I see you're commanding velocity with pid, are you doing any other math or tricks? Feed forward? Are using p, i and d?

There is a lot of potential for poor velocity measurement/filtering, especially when acceleration is calculated for the d term, to cause jitter along the lines of what ether already said.

We're using a PID velocity .vi, in stable time (a timed loop at 10ms). This is not labview's positional PID, it's a true velocity PID that the kids wrote. You can see it at our website - www.fightingpi.org under the resources->controls section in labview.

We use P ( essentially I in a positional PID) and D to damp the overshoot. We have a limiter on the P windup (I believe it's 1 and -1).

You can also see the code on page 22 in this paper:
http://www.chiefdelphi.com/media/papers/2695

Ether 21-05-2012 22:21

Re: High speed encoder with slotted / flat end... can't find one.
 
Quote:

Originally Posted by apalrd (Post 1170888)
We didn't get anywhere close to accurate results until we took some of the constants to 10 or more significant digits.

Hmm. Red flags here. If your model is so sensitive that it requires 10 digits of precision for the constants, then the model probably needs to be changed. I'm guessing you used a high-degree polynomial?

Would you mind posting the 25 data points? I'd like to play around with it.



JamesTerm 21-05-2012 22:53

Re: High speed encoder with slotted / flat end... can't find one.
 
Quote:

Originally Posted by apalrd (Post 1170888)
All,
The feed forward term was calculated by measuring the speed at 25 throttle points, graphing it, and calculating a best fit curve in Excel, although the precision required on some of the terms is high - We didn't get anywhere close to accurate results until we took some of the constants to 10 or more significant digits. If I were to do it again I might come up with a solution that also considered battery voltage, but the I term can deal with battery voltage issues well enough down to around 11v or so, and we don't shoot while moving, so the battery is never that low when shooting.

This is very interesting... it would be cool to see the equations used here.... Thanks.

JamesTerm 21-05-2012 23:01

Re: High speed encoder with slotted / flat end... can't find one.
 
Quote:

Originally Posted by Ether (Post 1170836)
Red circle: what is your controller trying to do here?


Looks like I missed that question... as you see the voltage is pretty constant when that dip occurs... I believe this is when the encoder started to bust out of its casing and loose its counts. This symptom is hard to put into words, but we could see the tiny encoder wheel rolling (very slightly and rapidly) around inside the casing, before we fixed it with the tape.


All times are GMT -5. The time now is 05:55.

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