CTRE Phoenix Framework TalonSRX Velocity Control is Unimplemented

So I have a few encoders on a Mecanum Drive I’m trying to configure for velocity control. Here’s my current custom class I built for it. It’s more of a port of the regular MecanumDrive so that it uses TalonSRX directly and can engage with the velocity control.

package org.usfirst.frc.team135.robot.util;

import com.ctre.phoenix.motorcontrol.ControlMode;
import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;

import edu.wpi.first.wpilibj.drive.MecanumDrive;
import edu.wpi.first.wpilibj.drive.RobotDriveBase;
import edu.wpi.first.wpilibj.drive.Vector2d;
import edu.wpi.first.wpilibj.hal.FRCNetComm.tInstances;
import edu.wpi.first.wpilibj.hal.FRCNetComm.tResourceType;
import edu.wpi.first.wpilibj.hal.HAL;
import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;

public class MecanumDriveVelocity extends RobotDriveBase{

	private static int instances = 0;
	private boolean m_reported = false;

    private WPI_TalonSRX] mTalons;
    private static final int 
    	FRONT_LEFT = 0,
    	REAR_LEFT = 1,
    	FRONT_RIGHT = 2,
    	REAR_RIGHT = 3;
    enum Side
	public MecanumDriveVelocity(WPI_TalonSRX] talons, Side invertedSide)
		mTalons = talons;
		for (WPI_TalonSRX talon : mTalons)
		/* Motors are inverted already by main drive functions.
		if (invertedSide == Side.LEFT)
		else if(invertedSide == Side.RIGHT)
		setName("MecanumDriveVelocity", instances);
	public void initSendable(SendableBuilder builder) {
		builder.addDoubleProperty("Front Left Motor Speed", mTalons[FRONT_LEFT]::get,
		builder.addDoubleProperty("Front Right Motor Speed", mTalons[FRONT_RIGHT]::get,
		builder.addDoubleProperty("Rear Left Motor Speed", mTalons[REAR_LEFT]::get,
		builder.addDoubleProperty("Rear Right Motor Speed", mTalons[REAR_RIGHT]::get,
	public void driveCartesian(double x, double y, double zRotation, double fieldOrientation, double maxVel)
	    if (!m_reported) {
	        HAL.report(tResourceType.kResourceType_RobotDrive, 4,
	        m_reported = true;

	      y = limit(y);
	      y = applyDeadband(y, m_deadband);

	      x = limit(x);
	      x = applyDeadband(x, m_deadband);

	      // Compensate for gyro angle.
	      Vector2d input = new Vector2d(y, x);

	      double] wheelSpeeds = new double[4];
	      wheelSpeeds[MotorType.kFrontLeft.value] = input.x + input.y + zRotation;
	      wheelSpeeds[MotorType.kFrontRight.value] = input.x - input.y + zRotation;
	      wheelSpeeds[MotorType.kRearLeft.value] = -input.x + input.y + zRotation;
	      wheelSpeeds[MotorType.kRearRight.value] = -input.x - input.y + zRotation;


	      for (int i = 0; i < 4; i++)
	    	  mTalons*.set(ControlMode.Velocity, wheelSpeeds* * maxVel * m_maxOutput);

	public void driveCartesian(double ySpeed, double xSpeed, double zRotation, double maxVel) {
	    driveCartesian(ySpeed, xSpeed, zRotation, 0.0, maxVel);
	public void drivePolar(double magnitude, double angle, double zRotation, double maxVel) 
	    if (!m_reported) 
	    	HAL.report(tResourceType.kResourceType_RobotDrive, 4, tInstances.kRobotDrive_MecanumPolar);
		      m_reported = true;

		driveCartesian(magnitude * Math.sin(angle * (Math.PI / 180.0)),
		                   magnitude * Math.cos(angle * (Math.PI / 180.0)), zRotation, 0.0, maxVel);

	public void stopMotor() {
		for(WPI_TalonSRX talon : mTalons)

	public String getDescription() {
	    return "MecanumDriveVelocity";


I executed the code and found that response is absent. I later found out that Velocity mode is not implemented in the Phoenix Framework as of the time this was posted.

I find that I can’t post pictures so I’ll just link the relevant page and line numbers within github.

The relevant class is BaseMotorController as I’ve linked. Lines 108 to 139 are of particular interest. Here they implement the mode enumeration you must pass to the TalonSRX.set function. Note that velocity control is blank.

I’m thinking we can work around this with a wpilibj PIDController and some encoders. What do you all think?

I’m not really sure how speed control on a mecanum would even work as I’m new to it. Any advice would be appreciated.

Thanks all.**