Class CANMotorConfig
- java.lang.Object
-
- com.alumiboti5590.eop.components.motors.util.CANMotorConfig
-
public class CANMotorConfig extends java.lang.Object
CANMotorConfig packages together the CAN IDs of motors and if they should be inverted or not. Before, these used to be stray values that would be managed independently of each other, but keeping them grouped makes it a bit easier to reason about.
-
-
Field Summary
Fields Modifier and Type Field Description int
kCANBusID
The CAN bus ID of the motorMotorIdleMode
kIdleMode
Determines the default idle mode of the motor; if it should be braking or coastingboolean
kIsInverted
If the motor power output should be inverted or not
-
Constructor Summary
Constructors Constructor Description CANMotorConfig(int canBusID, boolean isInverted)
Create a new CAN bus motor configuration with brake mode enabled by defaultCANMotorConfig(int canBusID, boolean isInverted, MotorIdleMode idleMode)
Create a new CAN bus motor configuration with brake mode enabled by default
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.revrobotics.CANSparkMax
toSparkMaxBrushless()
Converts the CAN motor config into a Spark Max controlling a brushless motor, such as a Neo or Neo 550com.ctre.phoenix.motorcontrol.can.TalonSRX
toTalonSRX()
Converts the CAN motor config into a Talon SRX controlling a brushed motor, such as a CIM, 775, or Redline.com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX
toWPITalonSRX()
Converts the CAN motor config into a Talon SRX controlling a brushed motor, such as a CIM, 775, or Redline.com.revrobotics.CANSparkMax
UNSAFE_toSparkMaxBrushed()
Converts the CAN motor config into a Spark Max controlling a brushed motor, such as a CIM, 775, or Redline.
-
-
-
Field Detail
-
kCANBusID
public final int kCANBusID
The CAN bus ID of the motor
-
kIsInverted
public final boolean kIsInverted
If the motor power output should be inverted or not
-
kIdleMode
public final MotorIdleMode kIdleMode
Determines the default idle mode of the motor; if it should be braking or coasting
-
-
Constructor Detail
-
CANMotorConfig
public CANMotorConfig(int canBusID, boolean isInverted)
Create a new CAN bus motor configuration with brake mode enabled by default- Parameters:
canBusID
- the CAN bus ID number to useisInverted
- if the motor output should be inverted or not
-
CANMotorConfig
public CANMotorConfig(int canBusID, boolean isInverted, MotorIdleMode idleMode)
Create a new CAN bus motor configuration with brake mode enabled by default- Parameters:
canBusID
- the CAN bus ID number to useisInverted
- if the motor output should be inverted or notidleMode
- the desired idle mode of the motor; either brake or coasting
-
-
Method Detail
-
toSparkMaxBrushless
public com.revrobotics.CANSparkMax toSparkMaxBrushless()
Converts the CAN motor config into a Spark Max controlling a brushless motor, such as a Neo or Neo 550- Returns:
- a Spark Max abstracted motor controller
-
UNSAFE_toSparkMaxBrushed
public com.revrobotics.CANSparkMax UNSAFE_toSparkMaxBrushed()
Converts the CAN motor config into a Spark Max controlling a brushed motor, such as a CIM, 775, or Redline. This is very uncommon as we would usually use a Talon SRX for those motors- Returns:
- a Spark Max abstracted motor controller
-
toTalonSRX
public com.ctre.phoenix.motorcontrol.can.TalonSRX toTalonSRX()
Converts the CAN motor config into a Talon SRX controlling a brushed motor, such as a CIM, 775, or Redline.- Returns:
- a Talon SRX abstracted motor controller
-
toWPITalonSRX
public com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX toWPITalonSRX()
Converts the CAN motor config into a Talon SRX controlling a brushed motor, such as a CIM, 775, or Redline.- Returns:
- a Talon SRX abstracted motor controller
-
-