-
Notifications
You must be signed in to change notification settings - Fork 0
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
Heading control not final tuning, just for code review #14
base: dev
Are you sure you want to change the base?
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.
Excited to hear that this is working, but would like workshop the changes and lessen their footprint if possible.
|
||
teleopController.acceptJoystickInput(xAxis, yAxis, omega); | ||
} | ||
} | ||
/*radians*/ |
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.
Can we decouple the "heading control" functionality from the pre-existing teleop control function? Grouping them may cause confusion later down the line (esp. for integrating in autos, etc.).
(ie. create a single setHeadingLock(), push integration with teleop to RobotContainer)
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.
Consider using a supplier to pass in the target(s).
@@ -99,10 +107,39 @@ public void driveTeleopController(double xAxis, double yAxis, double omega) { | |||
if (driveMode != DriveModes.TELEOP) { | |||
driveMode = DriveModes.TELEOP; | |||
} | |||
if (headingController != null) { | |||
headingController = null; | |||
} |
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 is the purpose of this statement?
targetRotation2d = new Rotation2d(targetRotation2d.getRadians() + delta); | ||
} | ||
|
||
public Rotation2d update(Rotation2d yaw, double currentRotationalVelocity) { |
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 is the purpose of currentRotationalVelocity? It doesn't appear to be used yet.
public ChassisSpeeds update(Rotation2d yaw) { | ||
Translation2d linearVelocity = calculateLinearVelocity(controllerX, controllerY); | ||
|
||
double omega = MathUtil.applyDeadband(controllerOmega, 0.1); | ||
double omega = controllerOmega; |
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.
Why remove the deadband?
} | ||
|
||
public Rotation2d update(Rotation2d yaw, double currentRotationalVelocity) { | ||
Logger.recordOutput("Swerve/TargetHeading", normalizeRadians(targetRotation2d.getRadians())); |
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.
Consider applying normalizeRadians() in setTarget(). We want data logged to be the same as what is used.
return a < b ? a : -b; | ||
} | ||
|
||
public double normalizeRadians(double radians) { |
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.
Is this supposed to be private?
@@ -96,10 +97,12 @@ private void configureBindings() { | |||
swerve | |||
.run( | |||
() -> { |
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.
Can we break up the operations here?
(ie. calculate the "heading" separately, etc)
Heading control works but needs to be tuned, angle wrap around does work. Uses trapezoidal profile and pid.