1313import org .usfirst .frc .team199 .Robot2018 .autonomous .VelocityPIDController ;
1414import org .usfirst .frc .team199 .Robot2018 .commands .TeleopDrive ;
1515
16+ import com .ctre .phoenix .motorcontrol .ControlMode ;
17+ import com .ctre .phoenix .motorcontrol .can .WPI_TalonSRX ;
18+ import com .ctre .phoenix .motorcontrol .can .WPI_VictorSPX ;
1619import com .kauailabs .navx .frc .AHRS ;
1720
1821import edu .wpi .first .wpilibj .DoubleSolenoid ;
@@ -25,6 +28,10 @@ public class Drivetrain extends Subsystem implements DrivetrainInterface {
2528 // Put methods for controlling this subsystem
2629 // here. Call these from Commands.
2730
31+ private final WPI_TalonSRX dtLeftMaster = RobotMap .dtLeftMaster ;
32+ private final WPI_VictorSPX dtLeftSlave = RobotMap .dtLeftSlave ;
33+ private final WPI_TalonSRX dtRightMaster = RobotMap .dtRightMaster ;
34+ private final WPI_VictorSPX dtRightSlave = RobotMap .dtRightSlave ;
2835 private final Encoder leftEncDist = RobotMap .leftEncDist ;
2936 private final Encoder rightEncDist = RobotMap .rightEncDist ;
3037 private final PIDSourceAverage distEncAvg = RobotMap .distEncAvg ;
@@ -42,6 +49,32 @@ public void initDefaultCommand() {
4249 setDefaultCommand (new TeleopDrive ());
4350 }
4451
52+ /**
53+ * Sets the left side of the drivetrain to use the talons' pids to run at the
54+ * specified speed.
55+ *
56+ * @param value
57+ * The speed to run at
58+ */
59+ public void dtLeftPIDDrive (double value ) {
60+ double setValue = value * Robot .getConst ("Units per 100ms" , 3413 );
61+ dtLeftMaster .set (ControlMode .Velocity , setValue );
62+ dtLeftSlave .set (ControlMode .Velocity , setValue );
63+ }
64+
65+ /**
66+ * Sets the right side of the drivetrain to use the talons' pids to run at the
67+ * specified speed.
68+ *
69+ * @param value
70+ * The speed to run at
71+ */
72+ public void dtRightPIDDrive (double value ) {
73+ double setValue = value * Robot .getConst ("Units per 100ms" , 3413 );
74+ dtRightMaster .set (ControlMode .Velocity , setValue );
75+ dtRightSlave .set (ControlMode .Velocity , setValue );
76+ }
77+
4578 /**
4679 * Drives based on joystick input and SmartDashboard values
4780 */
0 commit comments