Thread: Swerve Gear Box
View Single Post
  #40   Spotlight this post!  
Unread 28-08-2011, 01:20
davidthefat davidthefat is offline
Alumni
AKA: David Yoon
FRC #0589 (Falkons)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2010
Location: California
Posts: 792
davidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud of
Re: Swerve Gear Box

Quote:
Originally Posted by Ether View Post
Hopefully the several ensuing responses from various posters have given you pause.



So if you're using PID for steering angle, and the process variable is 2 degrees, and you want the setpoint to be 359 degrees, then you would calculate an error of 359-2= 357 degrees and feed that error to your PID?

Think about it.

Well, it would still work regardless since I am checking and regulating the output to be a legit one that is not out of range. 359 - 2 = 357; 357/359; 0.994428969; 0.994428969 * 95 = 94.4707521; 0.994428969 *25 = 24.8607242; 0.994428969 *5 = 4.97214484

94.4707521 + 24.8607242 + 4.97214484 = 124.303621 (truncated = 124)

If that was the opposite and we were at 359 and wanted 2 it would be trouble.

-357/2 = -178.5 (that is -178.5 PERCENT, which is a big no no.)
We can deal with it this way: just regulate the error percent to be -1.0 to 1.0 or regulate the output at the end. It would both deal with that problem.
Yes my method does favor the going from a low to high than high to low.
You can say that it is an error on my part, but that is the beauty of engineering; you rarely get it right the first time.

Also I can just do higher # - lower # then divide by the higher # to always give -1 to 1. Then just put the desired input- current input as a variable and just mask out and & the number to get the + or -. I'll clarify in teh morning. I sound like gibberish at night.
__________________
Do not say what can or cannot be done, but, instead, say what must be done for the task at hand must be accomplished.

Last edited by davidthefat : 28-08-2011 at 04:08.