The CTRE Kraken x60 (and its predecessor, the Falcon 500) are high-performance brushless motors built directly into their own motor controller — the TalonFX. These motors are programmed using the CTRE Phoenix 6 vendor library, which provides a rich API for control modes, configuration, telemetry, and multi-motor synchronization. In FRC Academy lessons, these motors are controlled using theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Holden9607/FRC-Academy/llms.txt
Use this file to discover all available pages before exploring further.
DutyCycleOut control request, which maps directly to a -1.0 to 1.0 speed range.
Hardware Requirements
Before writing any code, make sure you have the following ready:- TalonFX integrated motor controller (built into the Kraken x60 or Falcon 500)
- CAN bus connection from the TalonFX to the roboRIO or a CANivore CAN bridge
- CTRE Phoenix 6 vendor library installed in your WPILib project (available through Phoenix Tuner X)
Required Imports
Add these imports at the top of yourRobot.java file for basic single-motor control:
Defining a Kraken Motor
Declare and instantiate aTalonFX object inline as a private final field. The constructor takes two arguments: the CAN ID and the CAN bus name.
- CAN ID
1is the default used in all FRC Academy lessons. "DINO"is the CANivore bus name used by FRC Team 9607. Replace this with your team’s CANivore name, or use an empty string""to target the roboRIO’s built-in CAN bus.
"DINO" is the CAN bus name used by FRC Team 9607. Replace it with your team’s CANivore bus name, or use an empty string "" to connect through the roboRIO CAN bus instead.Setting Motor Output
Unlike WPILib’s.set() method, CTRE Phoenix 6 uses a control request pattern. You pass a control request object into setControl(). For duty-cycle (percent output) control, use DutyCycleOut:
DutyCycleOut value ranges from -1.0 (full reverse) to 1.0 (full forward). For performance-sensitive code, consider caching the DutyCycleOut object as a field and updating its Output property instead of creating a new object every loop.
Inverting a Motor (for Tank Drive)
In a two-motor drivetrain, the left and right motors face opposite directions. Without inversion, both motors spin the same way and the robot spins in place. For the TalonFX, inversion is applied through aMotorOutputConfigs configuration object. You will need two additional imports:
robotInit(), apply inversion to the right motor:
teleopPeriodic() using DutyCycleOut — there is no follower relationship in a 2-motor drivetrain:
Follower Motors (for 4-Motor Tank Drive)
In a 4-motor drivetrain, each side of the robot has two motors driving the same gearbox. Instead of commanding each motor individually, you configure one motor as a follower that mirrors the output of a lead motor. In Phoenix 6, this is done with theFollower control request. Add this import:
MotorOutputConfigs:
Available Lessons
FRC Academy includes four hands-on coding lessons for the Kraken motor. Each lesson builds on the previous one, from a minimal motor declaration all the way to a full four-motor arcade drivetrain.1. Define a Motor
Declare and instantiate a
TalonFX with CAN ID 1 and bus name "DINO".2. Activate a Single Motor
Bind a
DutyCycleOut control request to the operator controller’s B button using whileTrue and onFalse.3. 2 Motor Tank Drive
Declare left (ID 1) and right (ID 2) motors, invert the right side via
MotorOutputConfigs, and implement arcade drive with DutyCycleOut in teleopPeriodic().4. 4 Motor Tank Drive
Extend to four motors using
Follower control requests, configure right-side inversion, and drive with DutyCycleOut on lead motors.