List of available classes and brief descriptions of their functions
AlliancePose2d/AllianceTranslation2d
- Wrapper on base geometry classes.
- Input as Blue alliance version, use blue() or red() to get specific version
- Use get() to get alliance specific version, based on driverstation alliance
Conversions
mod(value, base)returns mathematical modulus (default%operator doesn't handle negative correctly)wrap(int, min, max)returns value within endpoints inclusive (default only handles double)clamp()allows limits in any order (default needs min, max) with a range of overloads- int and double with endpoints
- single input double clamps [-1..1]
- input Translation2d clamps magnitude [0..1]
round(value, places)returnsvaluerounded toplacesdecimal placesbuildPose()creates a new Pose2d from double values in metres and degreesat[Pose/Translation/Rotation]()checks if input values are within standard tolerances (under ControlConstants) of each othernear[Pose/Translation/Rotation]()checks if input values are within input tolerances of eachothernormaliseAngle(newAngle, currentAngle, maxAngle)for turret-style rotation pathing- Works for any range of motion. Max angle is symetric, e.g. max=180 -> range=[-180..180]
- Favours the centre over shortest path if shortest is >135 degrees
FieldUtils
alliance...()various functions for getting and comparing the current allianceflip[Pose/Translation]()mirrors over centrelinerotate[Pose/Translation]()rotates 180 around field centreinAllianceZone()checks if given position is fully within the defined alliance zone
Launchpad
- Interface for launchpad controller
- Predefined triggers for all buttons, can be used in the same way as normal controller buttons
- Can set colour to individual buttons, spans of buttons, or use predefined display grids
LockableXboxController
- Wrapper on
CommandXboxControllerwith a configurable button to unlock it with a rumble to confirm. - All buttons read false and axes read 0 while controller is locked.
- Holding the unlock button for 1.5s (configurable) locks the controller again, with a rumble to confirm.
MatchTime
- Time handler to convert ststem time to match time
startAuto()to calibrate the timing of the Auto periodstartTele()to calibrate the timing of the Teleop period
PBDash
- Custom NetworkTables interface with configurable data keys
- Predefined keys can use any type, and are given a default value
- Can be globally accessed through a variable rather than by string
get()andput()automatically handle the associated data type and set defaults appropriatelybutton()returns true when the value has changed, then resets it- Various triggers can be used to monitor the value
- Generic access for
int,double,boolean, andString, automatic default pushed on first use - Various functions to add objects to the field render
putFieldObject()sets position of named object(s)addToFieldObject()appends poses to existing object, with padding to ensure it renders as a trajectoryputFieldPath()renders a line between given pointstrailFieldObject()renders a line of the last 50 poses given
Block
- A defined string of LEDs within the whole strip, defined by length
- Has no internal reference to its position in the strip. Start position is given when render() is called by the
LEDStripsubsystem - Has option to render first 4 LEDs to network tables (
setNetworkTableAddress(...)) - Patterns can be applied to multiple blocks simultaneously
Patterns
- dummy: no render
- conditional: takes any two patterns to render based on boolean condition
- supplied: takes a colour supplier
- chase: two colours of given lengths, move by one pixel at given frequency. can be used for alternating patterns
PositionMotor
- Wrapper around a TalonFX motor for position control using Motion Magic.
- All positions and targets are measured in mechanicsm rotations.
- setTarget() set the target position; baseSetTarget()sends the target directly to the motor, bypassing overridden setTarget() method in subclasses.
- Various commands for position control:
- setTargetCmd() set a target once, accepting either fixed value or DoubleSupplier.
- gotoTargetCmd() set a target and wait until the motor reaches it.
- adjustTargetCmd() continuously adjust the target by the supply amount, mainly use for joystick control.
- getAngle()/getPosition() return the current position; getTarget() returns the requested target.
- atTarget() check whether the motor within 0.1 of its target, using the value returned by getTarget() and getPosition().
- stop() sets motor output to zero; devicesValid() check the motor connection.
- Stimultion:
- Using DCMotorSim to caculated movement from the simulated motor voltage.
- simulationPeriodic() updated the simulated motor position every simulation cycle.
- Feeds simulated position back to the TalonFX motor.
VelocityMotor
- Wrapper around a TalonFX motor for position control using Motion Magic.
- Controls motor speed in mechanism rotations per second
- setSpeed() set the target motor velocity
- setSpeedCmd() sets the velocity once using DoubleSupplier
- runCmd() continously updates the target velocity from a Double Supplier, setting it to zero when the command ends.
- getSpeed() returns the measured velocity
- devicesValid() checks the motor connection.
- Simulation:
- Using DCMotorSim to caculated movement from the simulated motor voltage.
- simulationPeriodic() updated the simulated motor velocity every simulation cycle.
- Feeds simulated velocity back to the TalonFX motor.
BiMotor
- Extend VelocityMotor to control two TalonFX motors together.
- Use a leader-follower configuration, where the second motor follow the first.
- Constructor accepts seperate CAN IDs fro the leader and the follower, a shared configuration, and flipped option.
- The flipped option determines whether the follower runs aligned with or opposed to the leader.
- Inherits velocity controls methods and commands from VelocityMotor.
- Overrides devicesValid() to check that both motors are connected.
SpringMotor
- Wrapper around a TalonFX motor for position control using two different Motion Magic configuration slots.
- setTarget() stores the desired target position in mechamism rotations.
- setTargetCmd() sets the target once, accepting etheir fixed value or a DoubleSupplier.
- getAngle() returns the current motor position in mechamism rotations.
- periodic() continuosly sends the target to the motor and selects the control slots based on its current position:
- Slot 1
- Slot 0
AutoBuilder
- Takes text input from dashboard and converts it into a chain of tokens which are then parsed to generate an auto command
CommandGen
- Contains the code to generate commands from input tokens
- Check TODO marks in ParsedRepr.java to add new instruction options to the list
- Check TODO marks in CommandGen.java to impliment new instruction options