Skip to content
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

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open

Conversation

mika-okamoto
Copy link

No description provided.

@@ -62,6 +65,7 @@ public void execute() {
currHorizontalOffset = limelights.getShooterTX();
prevError = goalHorizontalOffset - currHorizontalOffset;
aimState = VisionState.FEEDBACK;
controller.disableContinuousInput();
Copy link
Author

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);
Copy link
Author

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);
Copy link
Author

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;
Copy link
Author

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

@mika-okamoto mika-okamoto changed the title replace math w/ calculate PIDController in CmdAlign Sep 13, 2022
Copy link
Contributor

@ControlsNarwhal ControlsNarwhal left a 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)

@mika-okamoto mika-okamoto added the ready for testing ready to test on the robot label Sep 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for testing ready to test on the robot
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants