-
Notifications
You must be signed in to change notification settings - Fork 0
MotorWrapper
CaedmonM edited this page Jan 12, 2026
·
5 revisions
import com.btwrobotics.WhatTime.frc.MotorManagers.MotorWrapper;The MotorWrapper class wraps a TalonFX motor object and allows direction inversion logic to be built-in to simplify use across other classes.
Creates a new MotorWrapper with the specified motor and inversion setting:
- motor: The TalonFX motor instance.
- inverted: Whether the motor's direction should be inverted by default.
public MotorWrapper(TalonFX motor, boolean inverted)Convenience method for creating a MotorWrapper using a static syntax:
public static MotorWrapper of(TalonFX motor, boolean inverted)public void set(double speed)public TalonFX getMotor()public boolean isInverted()TalonFX myMotor = new TalonFX(5);
MotorWrapper wrapper = new MotorWrapper(myMotor, true);
// Or using the static constructor
MotorWrapper wrapper2 = MotorWrapper.of(new TalonFX(6), false);
wrapper.set(0.5); // Sets the motor to -0.5 due to inversion
boolean inverted = wrapper.isInverted(); // true