Skip to content

Drivetrain acceleration limits causes significant lag #31

Description

@ProfessorAtomicManiac

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions