-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Wheel radius charaterization #225
Conversation
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.
Unfortunately implements Logged
doesn't work well on Commands, so this should be good to go to el mainereies. Review comments before merging 🤪
@@ -470,6 +473,7 @@ private void prepareNamedCommands() { | |||
NamedCommands.registerCommand("PrepareShooterW3", shooterCmds.prepareFireCommand(() -> FieldConstants.W3_POSE, Robot::isRedAlliance)); | |||
NamedCommands.registerCommand("PrepareShooter", shooterCmds.prepareFireCommand(pathPlannerStorage::getNextShotTranslation, () -> false)); | |||
NamedCommands.registerCommand("PrepareSWD", shooterCmds.prepareSWDCommand(swerve::getPose, swerve::getRobotRelativeVelocity)); | |||
NamedCommands.registerCommand("WheelRadiusCharacterization", wheelRadiusChar); |
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.
This is only for pp, we dont need it
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.
Format this file quickly with ctrl k+ f teehee
|
||
private Swerve swerve; | ||
|
||
private final SlewRateLimiter omegaLimiter = new SlewRateLimiter(1.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.
we don't need allat
public WheelRadiusCharacterization(Swerve swerve) { | ||
this.swerve = swerve; | ||
addRequirements(this.swerve); | ||
// Use addRequirements() here to declare subsystem dependencies.e |
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.
did you know? you can use addRequirements() here to declare subsystem dependencies.e!1!
|
||
startWheelPositions = swerve.getWheelRadiusCharacterizationPosition(); | ||
|
||
omegaLimiter.reset(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.
i'm listening
public double[] getWheelRadiusCharacterizationPosition() { | ||
return Arrays.stream(swerveModules).mapToDouble(module -> module.getDrivePositionRadians()).toArray(); | ||
} |
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 the formatting
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 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.
I'm literally mechanical advantage
@@ -329,6 +335,10 @@ public double getSpeedMultiplier() { | |||
return this.speedMultiplier; | |||
} | |||
|
|||
public double[] getWheelRadiusCharacterizationPosition() { | |||
return Arrays.stream(swerveModules).mapToDouble(module -> module.getDrivePositionRadians()).toArray(); |
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.
you got that. nice stuff, Jonas.
@@ -410,7 +410,8 @@ public static final class ModuleConstants { | |||
// Calculations required for driving motor conversion factors and feed forward | |||
public static final double DRIVING_MOTOR_FREE_SPEED_RPS = NeoMotorConstants.VORTEX_FREE_SPEED_RPM / 60; | |||
public static final double WHEEL_DIAMETER_METERS = 0.0762; | |||
public static final double WHEEL_CIRCUMFERENCE_METERS = WHEEL_DIAMETER_METERS * Math.PI; | |||
public static final double WHEEL_TO_MOTOR_ROTATIONS = 3.5625; | |||
public static final double WHEEL_CIRCUMFERENCE_METERS = WHEEL_DIAMETER_METERS * Math.PI; |
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.
bro is spaced out
@@ -77,6 +77,13 @@ public SwerveModulePosition getPosition() { | |||
new Rotation2d(turningSpark.getPosition() - chassisAngularOffset)); | |||
} | |||
|
|||
|
|||
// gets the rotations of the wheel converted to radians | |||
// TODO: change 3.5 into a real number from thad |
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.
Todo!!1!
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.
it was todone
// gets the rotations of the wheel converted to radians | ||
// TODO: change 3.5 into a real number from thad | ||
public double getDrivePositionRadians() { | ||
return (drivingSpark.getPosition() / (ModuleConstants.DRIVING_ENCODER_POSITION_FACTOR * ModuleConstants.WHEEL_TO_MOTOR_ROTATIONS)) * 2 * Math.PI; |
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.
just confirm the parenthesis are perfect rq while you are here
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.
looks good to me!!!
No description provided.