Skip to content

Conversation

@shlap
Copy link
Contributor

@shlap shlap commented Jan 30, 2026

Added shooter logic, hood mechanism, hood logic, and constants for hood angle calculation

@shlap shlap requested a review from rhit-halseysh January 30, 2026 00:23

public double getHoodAngleDegrees(Translation2d robotPos) {

final double g = 9.81;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Put in constants file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added it under shooter constants 👍

double check = Math.pow(ShooterConstants.EXIT_VELOCITY, 4) - g * (g * Math.pow(distance, 2) + 2 * ShooterConstants.HEIGHT_DIFFERENCE * Math.pow(ShooterConstants.EXIT_VELOCITY, 2));

if (check < 0) {
return 45.0; // Default angle if the shot is not possible
Copy link
Collaborator

Choose a reason for hiding this comment

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

Rebase from main and you should get all of the ShooterState code. Use that to represent the default angle

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What does it mean to rebase? I did "Pull (rebase)" in Source Control, but I don't think that did anything.

if (check < 0) {
return 45.0; // Default angle if the shot is not possible
}
return Math.toDegrees(Math.atan((ShooterConstants.EXIT_VELOCITY*ShooterConstants.EXIT_VELOCITY + Math.sqrt(check)) / (g * distance)));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Fix formatting to be consistent (spaces between match symbols)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it 👍

// Sets hood angle
public void setHoodAngle(double angleDegrees) {
hoodAngle = angleDegrees;
_hood.runPosition(Angle.ofBaseUnits(angleDegrees, Degrees), ShooterConstants.HOOD_VELOCITY, ShooterConstants.HOOD_ACCELERATION, null, PIDSlot.SLOT_0);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Lets find a good value/placeholder that isn't null for the MaxJerk parameter

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added it under constants 👍

// Prepare targets
return Commands.sequence(
// start setting targets in parallel
Commands.runOnce(() -> setFlywheelVelocity(velocity)),
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's a chance that this will be an issue, since it could just run the velocity for one cycle, then stop when the command is followed by setHoodAngle right away.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed up logic so it should work okish now?

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.

3 participants