-
Notifications
You must be signed in to change notification settings - Fork 1
Description
RobotCode2024/src/main/java/org/carlmontrobotics/commands/TeleopDrive.java
Lines 98 to 103 in 2c604e3
| if(translationalAcceleration > autoMaxAccelMps2) { | |
| Translation2d limitedAccelerationVector = new Translation2d(autoMaxAccelMps2, Rotation2d.fromRadians(Math.atan2(accelerationY, accelerationX))); | |
| Translation2d limitedVelocityVector = limitedAccelerationVector.times(robotPeriod); | |
| currentForwardVel += limitedVelocityVector.getX(); | |
| currentStrafeVel += limitedVelocityVector.getY(); | |
| } else { |
If only the else statement runs, then there is no lag. The if statement is meant to limit the acceleration of the robot to avoid tipping over. It is suspected that the lag is caused by acceleration/velocity limits that don't allow it to deaccelerate fast enough.
Please see Constants.java to see all the variables used to calculate the acceleration limit.
The mu variable is meant to account for the friction of the carpet. Increasing mu which should increase the acceleration limit should reduce lag, but the reduction of lag is not significant.
| public static final double mu = 1; /* 70/83.2; */ |
Based on current observations, it seems like the if statement is running as intended. Would suggest calculating a better acceleration limit using better physics calculations or "guess and check" a better value.