Getting Started - Breichen1/PracticalFTCBase GitHub Wiki
This guide will not include ALL Roadrunner setup instructions for those choosing to use it- that can be found here. However, I will be making use of the Forward and Lateral push tests to find encoder counts for DriveBot.
Configuration guidelines
Certain subsystems will expect your hardware devices to be named in a particular way. This is true for the Drivetrain, as well as any huskylens or USB cameras. the required names are all listed below. Any hardware device that is not listed below can have different configuration names. Make sure to set the configuration name to EXACTLY how it is listed below.
Drivetrain:
Front Left Drive - leftFront | Front Right Drive - rightFront | Back Left Drive - leftBack | Back Right Drive - rightBack | IMU - imu
Additionally, Strafe deadwheel should be plugged into RightBack, and Forward deadwheel should be plugged into LeftFront.
Huskylens/Cameras:
AprilTag HuskyLens - ATHuskyLens | Color HuskyLens - COLORHuskyLens | Apriltag USB Camera - Webcam 1
For Sensor Devices: When you create a sensor object, it will take the configName as a condition in the constructor. This also needs to be exactly what the name is in the configuration, as this is how you will attach your code to your hardware object.
For Articulators: The motor object is passed to the constructor. This means that when you wish to create an articulator, you must first create your motor object just like you would in traditional robot code- for example, to create an elevator motor, you would run this before constructing your linearArticulator object:
elevatorMotor = new Motor(Map, "elevatorMotor");
After the motor object is created, it is passed to the articulator class in the constructor. Your constructor for a linear actuation should look something like this by the time you're done:
Elevator = new LinearActuator( elevatorMotor, EncoderClicksPerInch, InvertTrue/false, PIDConstants);
Once all of your hardware is set up and configured properly, there are a couple of tuning steps that we need to take.
Tuning / Setting constants
All articulators and auto-drive controllers use PID in this base code. This means we have a lot of tuning to do.
Our first step will be to find the InPerTick constant for the robot's odometry. This step is copied from the Roadrunner setup guide.
Place the robot on the tiles with plenty of room in front. Square the robot up with the grid and make note of its starting position. Run ForwardPushTest and then slowly push the robot straight until the end of the tiles. Record the “ticks traveled” from telemetry before stopping the op mode. Without moving the robot, record also the forward distance traveled on the tiles in inches. Set the inPerTick variable in your Constants class to the real distance traveled divided by the ticks traveled.
Make sure the wheels don’t slip! The motors should spin freely. If the bot is too light or otherwise slipping, you can use theoretical values for ticks per revolution, gear ratio, and wheel diameter to compute inPerTick instead.
If the ticks traveled is close to zero no matter how far you push, the motors on one side are probably reversed. Go back to the previous step and double check the encoder directions.
The next step is to tune all of the PID controllers. This will need to be done empirically for each articulator, as well as the Autonomous drive PID.
To tune, start with a low P value (0.01).
Multiply by 10 until the module starts oscillating around the set point.
Scale back by searching for the value (for example, if it starts oscillating at a P of 10, then try (10 -> 5 -> 7.5 -> etc)) until the module doesn't oscillate around the setpoint.
Disregard I and D unless you know what you're doing.