Skip to main content

Documentation 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.

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 the 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)
CTRE Phoenix 6 is a paid vendor library available through Phoenix Tuner X. Ensure it is properly licensed and installed in your WPILib project’s vendordeps folder before compiling. Without it, TalonFX and DutyCycleOut will not resolve.

Required Imports

Add these imports at the top of your Robot.java file for basic single-motor control:
import com.ctre.phoenix6.hardware.TalonFX;
import com.ctre.phoenix6.controls.DutyCycleOut;
For multi-motor drivetrains that use follower pairing, also add:
import com.ctre.phoenix6.controls.Follower;

Defining a Kraken Motor

Declare and instantiate a TalonFX object inline as a private final field. The constructor takes two arguments: the CAN ID and the CAN bus name.
  • CAN ID 1 is 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.
private final TalonFX m_motor = new TalonFX(1, "DINO");
"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:
m_motor.setControl(new DutyCycleOut(0.5));  // 50% forward
m_motor.setControl(new DutyCycleOut(0.0));  // stop
The 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 a MotorOutputConfigs configuration object. You will need two additional imports:
import com.ctre.phoenix6.configs.MotorOutputConfigs;
import com.ctre.phoenix6.signals.InvertedValue;
Then, inside robotInit(), apply inversion to the right motor:
var rightConfig = new MotorOutputConfigs();
rightConfig.Inverted = InvertedValue.Clockwise_Positive;
m_rightMotor.getConfigurator().apply(rightConfig);
After inversion is configured, command both motors separately in teleopPeriodic() using DutyCycleOut — there is no follower relationship in a 2-motor drivetrain:
m_leftMotor.setControl(new DutyCycleOut(leftSpeed));
m_rightMotor.setControl(new DutyCycleOut(rightSpeed));

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 the Follower control request. Add this import:
import com.ctre.phoenix6.controls.Follower;
For a 4-motor drive setup (two motors per side), configure follower motors to track their lead motors:
// In robotInit():
m_leftFollow.setControl(new Follower(m_leftLead.getDeviceID(), false));
m_rightFollow.setControl(new Follower(m_rightLead.getDeviceID(), false));
Then invert the entire right side using MotorOutputConfigs:
var rightConfig = new MotorOutputConfigs();
rightConfig.Inverted = InvertedValue.Clockwise_Positive;
m_rightLead.getConfigurator().apply(rightConfig);

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.

Build docs developers (and LLMs) love