How do I program robot drive system with Talon SRX?

I want to program drive system for our robot using 6 Talon SRXs:

TalonSRX masterLeft = new TalonSRX(1);
TalonSRX slaveLeftFront = new TalonSRX(3);
TalonSRX slaveLeftRear = new TalonSRX(5);

TalonSRX masterRight = new TalonSRX(2);
TalonSRX slaveRightFront = new TalonSRX(4);
TalonSRX slaveRightRear = new TalonSRX(6);

All the slaves programed to follow the masters
Normally, I use the DifferentialDrive class and then the arcadeDrive() method, but I receive an error when I type:

DifferentialDrive drive = new DifferentialDrive(masterLeft, masterRight);

So my question is how to program arcade drive system using my Talon SRXs?

Setting up the slave controllers should not affect your ability to create a differential drive with the two master controllers. Can you be more specific about the error and/or post more of your code, or a link to it?

1 Like

If you want to use differential drive or any WPI function with Talons, you need to use WPI_TalonSRX instead of just TalonSRX.

The reason for this is that WPI_TalonSRX implements the SpeedController interface which the DifferentialDrive class takes as a parameter.

4 Likes

That worked, Thank a lot!

The problem with using WPI_TalonSRX is you do lose some functionality if you are going to later be using them for more advanced functions. But that is perfect for a startup drivetrain.

I don’t think you lose any functionality since WPI_TalonSRX is just a subclass of TalonSRX which just adds some functionality to it.

2 Likes

Yes, I’m pretty sure it’s just a TalonSRX extended to implement SpeedController and SendableBase.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.