Skip to content

Conversation

azdaniel123
Copy link

No description provided.

@levyishai levyishai changed the title 90% of the constans Side Shooter Azoulay Nov 12, 2023
@levyishai levyishai changed the title Side Shooter Azoulay Azoulay Nov 20, 2023
Comment on lines +25 to +28
double getAnglePosition() {
double positionRevolutions = SideShooterConstants.ANGLE_ENCODER_POSITION_SIGNAL.refresh().getValue();
return positionRevolutions;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return a rotation2d here.

return positionRevolutions;
}

Double getAngleVelocityDegreesPerSecond() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the primative type double.

Comment on lines +54 to +55
);
angleMotor.setVoltage(pidOutPut = feedforward);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this here?

Comment on lines +25 to +36
double getAnglePosition() {
double positionRevolutions = SideShooterConstants.ANGLE_ENCODER_POSITION_SIGNAL.refresh().getValue();
return positionRevolutions;
}

Double getAngleVelocityDegreesPerSecond() {
return Conversions.revolutionsToDegrees(SideShooterConstants.ANGLE_ENCODER_VELOCITY_SIGNAL.refresh().getValue());
}

double getAngleMotorProfileTime() {
return Timer.getFPGATimestamp() - lastAngleMotorProfileGenerationTime;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move these to the bottom of the class and make them private.

Comment on lines +46 to +57
double calculateAngleOutput(TrapezoidProfile.State targetState) {
double pidOutPut = SideShooterConstants.ANGLE_PID_CONTROLLER.calculate(
getAnglePosition(),
targetState.position
);
double feedforward = SideShooterConstants.SIDE_SHOOTER_FEEDFORWARD.calculate(
Units.degreesToRadians(targetState.position),
targetState.velocity
);
angleMotor.setVoltage(pidOutPut = feedforward);
return feedforward + pidOutPut;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this down and make it private.

Comment on lines +9 to +12
public static SideShooterCommands getInstance() {
return getInstance();
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh?

Comment on lines +14 to +22
public Command getSetTargetShooterAngleCommand(Rotation2d targetAngle) {
return new FunctionalCommand(
() -> SideShooter.getInstance().generateAngleMotorProfile(targetAngle),
() -> getSetTargetShooterAngleCommand(targetAngle),
(interrupted) -> {},
() -> false,
SideShooter.getInstance()
);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this static, and instead of typing SideShooter.getInstance() every time have a class variable for it.
Also, add the commands to set the target voltage and target state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants