Open berkakinci opened 7 months ago
Pull Request #17 improves fine motion of robot for both AbsoluteDrive and AbsoluteDriveAdv. Pull Request #16 increases heading deadband to 75% (from 50%) only for AbsoluteDrive.
I want to close this, but there is still one more improvement we could make: the analog stick profile from power of 3 to 5 or even 7. Have Renuka try both and see which works best.
diff --git a/src/main/java/frc/robot/subsystems/swervedrive/SwerveSubsystem.java b/src/main/java/frc/robot/subsystems/swervedrive/SwerveSubsystem.java
index 6429b2c..a67223b 100644
--- a/src/main/java/frc/robot/subsystems/swervedrive/SwerveSubsystem.java
+++ b/src/main/java/frc/robot/subsystems/swervedrive/SwerveSubsystem.java
@@ -298,8 +298,8 @@ public class SwerveSubsystem extends SubsystemBase {
* @return {@link ChassisSpeeds} which can be sent to th Swerve Drive.
*/
public ChassisSpeeds getTargetSpeeds(double xInput, double yInput, double headingX, double headingY) {
- xInput = Math.pow(xInput, 3);
- yInput = Math.pow(yInput, 3);
+ xInput = Math.pow(xInput, 5);
+ yInput = Math.pow(yInput, 5);
return swerveDrive.swerveController.getTargetSpeeds(xInput, yInput, headingX, headingY, getHeading().getRadians(), maximumSpeed);
}
BTW, you may want to reduce deadband too. Deadband of something like 2x or 3x noise in stick should be plenty especially since the higher powers will reduce the effect dramatically.
I also noticed there are two implementations of getTargetSpeeds, so update both. Second doesn't seem to be currently used. If you make a Constants.java entry for the power, you can make it more generic with a little more math. This one without complex numbers: y = sign(x) * abs(x) ^ a https://www.desmos.com/calculator/uzelyagtci
Pull request #21 addresses the final point. I didn't change current behavior, but wrote the code to make it easily adjustable. Tweak away at next opportunity to practice.
Add deadband for heading control. Improve fine motion of robot. (With acceleration limit or more aggressive stick profile from power of 3 to power of 5) After competition drivability review with drivers/operator.