RoadRunner basics (pre-Center Stage version).
Basic Concepts
- Localization: ability to know the robot’s position on the field at any time
- Declaring & initialization Java object:
Object object = new Object();
- Vector2d:
(x, y)
- Pose2d:
(x, y, heading)
- Feedback control
- e.g. PID
- update robot behavior (e.g. motor power) from error (target value - sensor value) after the fact
- Feedforward
- update robot behavior (e.g. motor power) from anticipated obstacles (e.g. static friction) beforehand
- DriveConstants
- TrackWidth: distance between two wheels (measured from the center)
- RUN_USING_ENCODING: set to false; we are not using FTC motor’s builtin PID controller
- Consider not using 100% of the measured MAX_* constants to increase robot stability
RR setup Overview
- Download quickstart
- Set up drivetrain
- Rename SampleMechanumDrive to Drivetrain
- Set motor device names in constructor
- Reverse motor directions as appropriate (usually left side)
- Set up DriveConstants
- Update TICKS_PER_REV, MAX_RPM, WHEEL_RADIUS, GEAR_RATIO, TRACK_WIDTH, MAX_{VEL_ACCEL,ANG_VEL,ANG_ACCEL} based on robot specifications
- LearnRoadrunner.com has DriveConstants.java for download, but double check just to be sure. The file they have might not be updated.
- Follow tuning tests on LearnRoadrunner.com
- Record constants measured on tuning tests (if any) in DriveConstants.java
- Make RR paths in your Opode
- profit
RoadRunner dashboard
To access:
- Connect to robot WiFi
- Go to http://192.168.43.1:8080/dash
- Make sure that the field view is visible.
Tuning
Do all of the tuning tests below in order.
Localization Test
NOTE
Skip if not using dead wheels
- Goal: To check if dead wheels are working correctly
- To pass:
- Move the robot on the field with your hands (make it as varied as possible: forward, backward, turns, etc)
- Check that robot’s position is accurate on RoadRunner dashboard
DriveVelocityTuner Test
Skip
We are not using built-in motor PID.
DriveFeedforwardTuner
- Goal: Tune kV, kA, kStatic coefficients for feedforward control
- Steps:
- Go to dashboard
- Start the test
- Use controller to configure test
- Record tuned parameters in DriveConstants
StraightTest
- Goal: check if the prior tuning tests are successful
- To pass:
- Run StraightTest while the robot is placed like on the field diagram (placed centered on the seam between tiles)
- If the translational error & heading error is low enough, & the robot’s position on field matches what you see on the diagram, then the robot passed.
- If failed, try checking wheel set screws.
TrackWidthTuner
- Goal: To determine empirical track width to help robot turn better
- Steps
- Run angular velocity tuner to set an appropriate MAX_ANG_VEL value
- Run TrackWidthTuner and check the resulting track width. If the number looks normal (within 3 inches of your measured track width) and if the robot turned 180 degrees (+/- 1 degree), then save it in DriveConstants. If not, continue with the steps below
- Manually increase/decrease track width until the robot turns close to 180 degrees. Save the reslting track width in DriveConstants
BackAndForth
- Goal: To set an initial estimate for HEADING_PID and TRANSLATION_PID.
- Steps:
- Turn BackAndForth on
- Increase kP of heading PID slowly until the actual heading (green) matches the target heading (blue)
- Increase kP of translational PID until the green line matches the blue line
- Increase kD of translational PID until there is minimal overshoot while having negligible jitters.
Three-Wheel Localizer Tuning
- X, Y_MULTIPLIER
- LATERAL_DISTANCE