-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PIDController in CmdAlign #137
base: dev
Are you sure you want to change the base?
Conversation
@@ -62,6 +65,7 @@ public void execute() { | |||
currHorizontalOffset = limelights.getShooterTX(); | |||
prevError = goalHorizontalOffset - currHorizontalOffset; | |||
aimState = VisionState.FEEDBACK; | |||
controller.disableContinuousInput(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be .enable not .disable because you're switching from searching to feedback
@@ -70,16 +74,16 @@ public void execute() { | |||
if(!limelights.getShooterHasValidTarget()) { | |||
aimState = VisionState.SEARCHING; | |||
plateauCount = 0; | |||
controller.enableContinuousInput(-180, 180); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be .disable
|
||
double feedbackPower = controller.calculate(currHorizontalOffset); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep the ff line in here and set feedbackPower = the code you have in here with .calculate() + ff
double ff = Math.signum(currError) * VISION_PID_kF
break; | ||
} | ||
|
||
// turn with PID loop using input as horizontal tx error to target | ||
currHorizontalOffset = limelights.getShooterTX(); | ||
currError = goalHorizontalOffset - currHorizontalOffset; // currError is positive if we are too far left | ||
|
||
double feedbackPower = controller.calculate(currHorizontalOffset); | ||
double ff = Math.signum(currError) * VISION_PID_kF; | ||
double feedbackPower = controller.calculate(currHorizontalOffset) + ff; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use currError instead of currHorizontalOffset
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good - mika
(this is anwika's pr, I made the pr from my account so am approving with this account)
No description provided.