Setup
Before you tune Pedro, there are a few simple steps you must complete.
Setting your robot's mass
Your robot's mass is used to compensate for centripetal force. To set the
mass, simply add .mass
in FollowerConstants
. Note that the mass must
be in kilograms.
public static FollowerConstants followerConstants = new FollowerConstants()
.mass(5);
Tip
If you don't have a large enough scale to weigh your robot, you can stand on the scale while holding your robot and then subtract your own weight.
Adding drivetrain constants
Next, we will add our drivetrain constants. These include motor names, motor directions, and the max power. The max power must be a number from 0 to 1.
Mecanum
If you have a mecanum drivetrain, add the following to your Constants
class.
public static MecanumConstants driveConstants = new MecanumConstants()
.maxPower(1)
.rightFrontMotorName("rf")
.rightRearMotorName("rr")
.leftRearMotorName("lr")
.leftFrontMotorName("lf")
.leftFrontMotorDirection(DcMotorSimple.Direction.REVERSE)
.leftRearMotorDirection(DcMotorSimple.Direction.REVERSE)
.rightFrontMotorDirection(DcMotorSimple.Direction.FORWARD)
.rightRearMotorDirection(DcMotorSimple.Direction.FORWARD)
Important
Make sure that your motor names and directions are correct. It's likely that you will have to reverse one side!
Then, add the mecanum drivetrain to the follower builder in createFollower
:
public static Follower createFollower(HardwareMap hardwareMap) {
return new FollowerBuilder(followerConstants, hardwareMap)
.pathConstraints(pathConstraints)
.mecanumDrivetrain(driveConstants)
.build();
Last updated on