Simple Motor

Simple Motor

Motor is the most fundamental component in a robot. It provides movement of mechanisms. There are many different types of motors with different capabilities. Most motors are brushed motors but some FRC motors are brushless. Some of their capabilities are built-in to the motor hardware. For example, quadrature encoders are sensor that keep track of the rotational position and velocity of the motor. Some encoders are even capable of registering absolute positions (i.e. absolute rotational position persists across power cycles - doesn’t get clear across power cycles). Some capabilities are provided by the Smart Motor Controller the motor is connected to (e.g. close-loop position or velocity control). Smart Motor Controllers usually have their own microcontrollers running firmware in a higher frequency loop than the Robot Controller. They can provide native close-loop control at a much higher resolution than software close-loop control running on the Robot Controller. Some Smart Motor Controllers support limit switches. Limit switches provides protection against mechanisms travelling beyond their physical range limits. They will cut motor power if the mechanism hits the lower or upper physical limits.

FIRST provided some basic motor classes (e.g. DcMotor/DcMotorEx for FTC and Phoenix5/Phoenix6/SparkMax for FRC). All these motor classes provide very different APIs. It makes writing code for motor subsystems very specific to the motor you use. The Framework Library provides a generic TrcMotor class that abstract all motor capabilities to a generic set of APIs. This allows code written to the generic TrcMotor class applicable to both FTC and FRC platforms regardless of the type of physical motor used. On top of that, TrcMotor also implements many useful features. The following list shows many of the supported features in TrcMotor. Some of the features are supported by the motor or motor controller natively. If the motor is not capable of such features, TrcMotor may simulate some of them in software if at all possible.