DriveConstants. Some of the parameters can be filled in based on your physical robot. Others will be tuned or adjusted later on.
org.firstinspires.ftc.teamcode.drivepackage and fill in all applicable items marked
// TODO(it may be helpful to delete the comments when you're completely done to keep track).
LocalizationTestand the drive the robot around the field with the gamepads. Make sure that the robot's pose estimate corresponds with reality. While small errors may be attributed to intrinsic inaccuracy of the localizer, large errors are indicative of improper drive/localizer constants. It's important to discover these configuration errors early and fix them before proceeding prematurely.
RUN_USING_ENCODER) if you have encoders on your drive motors. If you decide to use the built-in PID, it's important to tune the coefficients for your robot (this is especially true for drivetrains which often have higher loads than other actuators). Run
DriveVelocityPIDTunerand adjust the PID gains with the dashboard to minimize the error as best you can (note: the tuning variable will not appear until the op mode finishs initializing). Here is a rough procedure:
DriveConstants.MOTOR_VELO_PIDwith the new coefficients when you're finished.
kStatic, the robot executes a quasi-static ramp test where the power is slowly ramped up to minimize acceleration (it's effectively zero). Throughout this procedure, the velocity and power are recorded. In the corresponding velocity vs. power graph,
kVis the slope and
kStaticis the y-intercept. Next, to find
kA, the robot attempts to accelerate rapidly from rest. This time, the acceleration, velocity, and power are recorded. The velocity is used to determine the acceleration-only power. The acceleration is then graphed against this new power, and the resulting slope is
AutomaticFeedforwardTuner. The DS telemetry prompts will guide you through the process. If you want to do some analysis yourself, the tuner also saves the data to
/sdcard/RoadRunneron the RC.
StraightTest. If the robot lands within a few inches of the target, these steps were successful. If not, repeat the procedures or consider the possibility of an incorrect drive constant (especially if using the built-in motor velocity PID). If this is still unsuccessful,you are free to adjust the parameters (i.e.,
DriveConstants) slightly to get closer to the goal (keep in mind that feedback will be added later).
TrackWidthTunercomputes an empirical track width that is better suited for feedforward.
TurnTest. If you decide to do this, make sure to test a variety of angles; it's more important that the value works OK across different angles than it works perfectly for a single angle.
TurnTest. If the robot is relatively close to the target for a variety of angles, you can proceed.
SplineTest. If the robot successfully follows the spline, it's a good indication that the previous steps were successful. Otherwise, try to ascertain the cause of the failure. Did the robot over/under-rotate? If so, check the track width. Did the robot travel too far/stop too short? If so, check the drive characterization. This is where knowledge of Road Runner becomes extremely helpful.
SplineTestworks well, you can run
FollowerPIDTunerand tune the follower PID controllers. Typically only a P controller is required (on occasion a PD is justifiable). This should get the last 10% tracking accuracy.