Package com.crossbotics.ftchelper.robot
Class Drive
java.lang.Object
com.crossbotics.ftchelper.robot.Drive
The drivetrain in
Robot.java: mecanum or standard (tank), its motor names, the motor and
wheel, and how the Control Hub is mounted (for the IMU, the turn sensor).
drive(Drive.mecanum("front_left", "front_right", "back_left", "back_right")
.motor("gobilda-5203-312").wheelMm(96)
.imu("imu", LogoFacingDirection.UP, UsbFacingDirection.FORWARD));
drive(Drive.tank("left_drive", "right_drive").motor("gobilda-5203-312").wheelMm(96));
Its numbers are in Tunables.Drive: maxPower, practiceMaxPower (the
PRACTICE profile's limit), slowSpeed (the slow trigger), and the autonomous ones
(strafeCorrection, turnKp, turnKd, moveMinPower) with
calibrated = true once the Drive Tuner is done (autonomous refuses to run before).
Motor directions: the left side is reversed by default (the usual way motors are mounted). If
pushing the stick forward drives backward or spins the robot, name the reversed motors with
reversed(String...).
Docs: docs/modules/robot.md (section "Drive")
-
Method Summary
Modifier and TypeMethodDescriptiongearRatio(double motorTurnsPerWheelTurn) Motor turns per wheel turn, if gears or a belt sit between them.imu(String name, com.qualcomm.hardware.rev.RevHubOrientationOnRobot.LogoFacingDirection logo, com.qualcomm.hardware.rev.RevHubOrientationOnRobot.UsbFacingDirection usb) The IMU's name and how the Control Hub is mounted.booleanTrue for mecanum (it can strafe).booleanisReversed(String name) True if this drive motor is reversed in Robot.java (a path follower module sets its motors the same way).static DriveA four-wheel mecanum drive (it can strafe).The drive motor, by its parts-catalog id (seeMotors).Every drive motor name, front left first.noImu()No IMU: TeleOp drives robot-centric only, and autonomous refuses to start.Exactly these motors run reversed (instead of the left side).static DriveA two-motor standard (tank) drive, one motor per side.static DriveA four-motor standard (tank) drive.The wheel by its parts catalog id (seeParts): its diameter comes from the catalog.wheelMm(double mm) The wheel diameter in millimetres (goBILDA mecanum: 96 or 104).wheelsAtMm(double trackMm, double wheelBaseMm) Where the wheels sit, for the simulator's turning: wheel centres side to side (track) and front to back (wheel base), in mm.
-
Method Details
-
mecanum
A four-wheel mecanum drive (it can strafe). -
tank
A two-motor standard (tank) drive, one motor per side. -
tank
A four-motor standard (tank) drive. -
motor
The drive motor, by its parts-catalog id (seeMotors). Default "gobilda-5203-312".- Parameters:
id- e.g. "gobilda-5203-312", "rev-hd-hex-20"
-
wheelMm
The wheel diameter in millimetres (goBILDA mecanum: 96 or 104). Default 96. -
wheel
The wheel by its parts catalog id (seeParts): its diameter comes from the catalog.- Parameters:
id- e.g. "gobilda-hogback-96"
-
wheelsAtMm
Where the wheels sit, for the simulator's turning: wheel centres side to side (track) and front to back (wheel base), in mm. -
gearRatio
Motor turns per wheel turn, if gears or a belt sit between them. Default 1. -
reversed
Exactly these motors run reversed (instead of the left side). Use it when the robot drives the wrong way: docs/troubleshooting.md.- Parameters:
motorNames- configuration names of the reversed motors (none = no motor reversed)
-
imu
public Drive imu(String name, com.qualcomm.hardware.rev.RevHubOrientationOnRobot.LogoFacingDirection logo, com.qualcomm.hardware.rev.RevHubOrientationOnRobot.UsbFacingDirection usb) The IMU's name and how the Control Hub is mounted. Default "imu", logo UP, USB FORWARD.- Parameters:
name- the IMU's configuration name (usually "imu")logo- which way the REV logo on the hub facesusb- which way the hub's USB port faces
-
noImu
No IMU: TeleOp drives robot-centric only, and autonomous refuses to start. -
isMecanum
public boolean isMecanum()True for mecanum (it can strafe). -
motorNames
Every drive motor name, front left first. -
isReversed
True if this drive motor is reversed in Robot.java (a path follower module sets its motors the same way).
-