DifferentialDrive decleration with TalonSRX class

Our team is working on writing a c++ equivalent for all of our Labview code to eventually switch technologies.

We are having an issue with setting up arcade drive using the TalonSRX class.
The core issue is that DifferentialDrive will not accept the TalonSRX as a SpeedController

but… the TalonSRX extends BaseMotorController so i figure it should be castable. I just cant for the life of me figure out how to create a SpeedController class from the Talon

The reason we want to use DifferentialDrive is to take advantage of the ArcadeDrive class, we are currently manually setting the output via .Set but its messy

any help would be great!

I believe you’ll find you want to use the WPI_TalonSRX class for your motor controllers instead; it already inherits from SpeedController. See the CTRE docs at:
http://www.ctr-electronics.com/downloads/api/cpp/html/classctre_1_1phoenix_1_1motorcontrol_1_1can_1_1_w_p_i___talon_s_r_x.html

3 Likes

We’ll give this a shot at our next meeting! Thank you for the link!