Skip to content

Constants Overview

Kevin Cai edited this page Apr 21, 2019 · 1 revision

Current Constants and What They Do:

  1. QUICKTURN_THRESHOLD

    • This determines the speed at which the drivetrain will switch into quickturn. Curvature drive changes the path of the robot so that it turns similar to the wheels of a car, which allows for easier driving. The downside to this is that the robot is not able to turn in place, which quickturn remedies. Therefore, if the speed of the robot is below this threshold, the robot will use quickturn.
    • Recommended Value: 0.05 to 0.02
  2. QUICKTURN_SPEED

    • This determines the speed at which the robot will turn when the robot switches into quickturn. Quickturn is more startling than curvature drive because it can often turn too fast. You may want to slow this down.
    • Recommended Value: 1 to 0.2
  3. TURN_DIV

    • When the limelight returns the angle that the target is in its camera, it returns a value between -27 and 27 degrees. However, the drivetrain only accepts turn values from -1 to 1. In order to convert the angle to an accepted value, it must be divided by this constant.

    • How To Tune:

      • If the robot turns to the target too slowly, or does not reach it at all, decrease this value.

      • If the robot overshoots or oscillates, increase this value.

    • Recommended Value: 16 to 24 (When used after MOVE_TURN_MUL and finding the square root)

  4. MOVE_TURN_MUL

    • If the robot is moving faster, turning has less of an effect. This constant increases the amount to turn.

    • How To Tune:

      • Increase this constant if the robot crashes into the side of the target when moving. Decrease either based on personal preference or if oscillation is present.
    • Recommended Value: 3 to 8; Alfred uses 6.3. Edwin is from 7-9.

  5. Limelight.X_ANGLE_SHIFT

    • In newer versions of Limelight.java, there is a variable called Limelight.X_ANGLE_SHIFT which works as an offset. Make sure this updated before tuning.

    • How To Tune: Drive up to the target using Autodrive. If it turns too far left, increase this value; if it turns too far right, decrease this value. THIS IS ONLY USED WHEN THE INITIAL CROSSHAIRS ARE OFF, you should probably tune the crosshairs, but this is a good last-minute fix.

  6. SPEED_WHILE_TURNING

    • This constant determines the speed that the robot will turn while it is at a steep angle. At the steepest angle, 1, the robot will not move. At the constant of 2, the robot will move at 1/2 speed. At 3, it will move at 2/3 speed, and so on.

    • How To Tune: Approach the target at a slanted angle. If the robot drives so that the target is out of view or the robot does not turn enough, decrease this. CAUTION: Do not set this value to lower than 1.

    • Recommended Value: 1 to 3

  7. AUTOMATIC_DRIVE_SPEED

    • This is the maximum speed at which the robot can move during AutomaticDrive.

    • How To Tune Determine if the robot moves too fast or too slow during AutomaticDrive. It may be moving too fast if it can not reach the target.

    • Recommended Value: 0.25 to 0.4 (Depends on Drivetrain)

Recommended Values:

TURN_DIV: 15 to 22 on both Edwin and Alfred

MOVE_TURN_MUL: 6 to 9 on both Edwin and Alfred

SPEED_WHILE_TURNING: 1 to 3 on both Edwin and Alfred

AUTOMATIC_DRIVE_SPEED: 0.1 to 0.3 on both Edwin and Alfred

X_SHIFT: -4 to +4 on all robots. If it's greater than that, just manually change the crosshairs.

QUICKTURN_THRESHOLD: 0.02 to 0.08 on both Edwin and Alfred

QUICKTURN_SPEED: 0.2 to 1 on all robots

Clone this wiki locally