Skip to content

PIDController in CmdAlign - #137

Open
mika-okamoto wants to merge 3 commits into
Team3128:devfrom
agheyi:PIDInCmdAlign
Open

PIDController in CmdAlign#137
mika-okamoto wants to merge 3 commits into
Team3128:devfrom
agheyi:PIDInCmdAlign

Conversation

@mika-okamoto

Copy link
Copy Markdown

No description provided.

currHorizontalOffset = limelights.getShooterTX();
prevError = goalHorizontalOffset - currHorizontalOffset;
aimState = VisionState.FEEDBACK;
controller.disableContinuousInput();

Copy link
Copy Markdown
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

if(!limelights.getShooterHasValidTarget()) {
aimState = VisionState.SEARCHING;
plateauCount = 0;
controller.enableContinuousInput(-180, 180);

Copy link
Copy Markdown
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 ff = Math.signum(currError) * VISION_PID_kF;
double feedbackPower = VISION_PID_kP * currError + VISION_PID_kD * (currError - prevError) / (currTime - prevTime) + ff;

double feedbackPower = controller.calculate(currHorizontalOffset);

Copy link
Copy Markdown
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


double feedbackPower = controller.calculate(currHorizontalOffset);
double ff = Math.signum(currError) * VISION_PID_kF;
double feedbackPower = controller.calculate(currHorizontalOffset) + ff;

Copy link
Copy Markdown
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

@ControlsNarwhal ControlsNarwhal left a comment

Copy link
Copy Markdown
Contributor

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