Interfacing TalonSRX with RobotDrive

With the addition of the Phoenix Framwork, I’ve encountered issues with the TalonSRX object (formerly CANTalon) seemingly not being a subclass of any sort of SpeedController.

When attempting to use them in the SpeedControllerGroup object to be used in the DifferentialDrive object (formerly RobotDrive) I get an error stating:

The constructor SpeedControllerGroup(TalonSRX, TalonSRX) is undefined

Here’s my code:

package org.usfirst.frc.team4308.robot.subsystems;

import org.usfirst.frc.team4308.robot.RobotMap;
import org.usfirst.frc.team4308.robot.util.MultiSpeedController;

import com.ctre.CANTalon;
import com.ctre.phoenix.motorcontrol.can.TalonSRX;

import edu.wpi.first.wpilibj.Spark;
import edu.wpi.first.wpilibj.SpeedController;
import edu.wpi.first.wpilibj.SpeedControllerGroup;
import edu.wpi.first.wpilibj.command.Subsystem;
import edu.wpi.first.wpilibj.drive.DifferentialDrive;

public class DriveTrain extends Subsystem {
	TalonSRX frontLeft,frontRight,rearLeft,rearRight;
	SpeedControllerGroup leftDrive,rightDrive;
	public static DifferentialDrive drive;
	
	public DriveTrain() {
		// TODO Auto-generated constructor stub
		frontLeft = new TalonSRX(RobotMap.Drive.leftFront);
		frontRight = new TalonSRX(RobotMap.Drive.rightFront);
		rearLeft = new TalonSRX(RobotMap.Drive.leftBack);
		rearRight = new TalonSRX(RobotMap.Drive.rightBack);
		leftDrive = new SpeedControllerGroup(frontLeft,rearLeft);
		rightDrive = new SpeedControllerGroup(frontRight,rearRight);
		drive = new DifferentialDrive(leftDrive, rightDrive);
	}

I have another question on the new TalonSRX class, so we might as well group them here.

Every call to set the output of a Talon SRX involves specifying the control mode. Am I correct in assuming that a controller.set(mode,output) doesn’t change the state of the PID loop calculations if only the desired output changes?

If I were to switch modes - say from position control to velocity control, would that automatically reset the calculations?

You’ll need to use the WPI_TalonSRX class that does implement SpeedController.

Javadoc: CTR Electronics