-
Notifications
You must be signed in to change notification settings - Fork 0
R2 102 implement static shooting calculations #36
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
base: main
Are you sure you want to change the base?
Conversation
|
|
||
| public double getHoodAngleDegrees(Translation2d robotPos) { | ||
|
|
||
| final double g = 9.81; |
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.
Put in constants file
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.
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 |
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.
Rebase from main and you should get all of the ShooterState code. Use that to represent the default angle
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.
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))); |
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.
Fix formatting to be consistent (spaces between match symbols)
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.
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); |
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.
Lets find a good value/placeholder that isn't null for the MaxJerk parameter
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.
Added it under constants 👍
| // Prepare targets | ||
| return Commands.sequence( | ||
| // start setting targets in parallel | ||
| Commands.runOnce(() -> setFlywheelVelocity(velocity)), |
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.
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.
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.
Fixed up logic so it should work okish now?
…-102-implement-static-shooting-calculations
Added shooter logic, hood mechanism, hood logic, and constants for hood angle calculation