This section covers the basics of using different kinds of motor controllers and encoders. Motors are typically controlled through either PWM or CAN. PWM is a protocol that uses a single wire to send data to the motor controller, so it cannot provide back any information or sensor data from the motor. CAN is more advanced and allows for more information to be sent to and from the motor controller, such as configuration data, encoder position, temperature, current draw, etc.
Encoder
Typically when using dedicated encoders, you can use the frc::Encoder class.
Header
Initialization
Usage
PWM Servo
PWM Servos can be controlled with the frc::Servo class.
Header
Initialization
Percent Output
CAN Spark Max
CAN Spark Max motor controllers are used to control REV motors, such as Neos or Neo 550s. They can be controlled with the rev::CANSparkMax class.
Header
Initialization
Percent Output
Idle Mode
Encoder
PID Controller
CAN Talon FX
CAN Talon FX motor controllers are used to control CTRE motors, predominantly the Falcon 500. They can be controlled with the ctre::phoenix::motorcontrol::can::TalonFX class.
Header
Initialization
Percent Output
Idle Mode
Encoder
PID Controller
CAN Talon SRX
CAN Talon FX motor controllers are used to control CTRE motors, predominantly the Falcon 500. They can be controlled with the ctre::phoenix::motorcontrol::can::TalonSRX class.
Header
Initialization
Percent Output
Idle Mode
Encoder
PID Controller
CANCoder
The CTRE CANCoder is an absolute encoder, meaning that it’s position won’t reset when the robot is powered off. They can be controlled with the ctre::phoenix::sensors::CANCoder class.
Header
Initialization
Absolute Position
Spark
PWM Spark motor controllers can be controlled with the frc::Spark class.