@@ -68,11 +68,20 @@ public class RobotMap {
6868 * the TalonSRX to configure
6969 */
7070 private void configSRX (WPI_TalonSRX mc ) {
71+ // stuff cole said to put
7172 int kTimeout = (int ) Robot .getConst ("kTimeoutMs" , 10 );
7273 mc .configNominalOutputForward (0 , kTimeout );
7374 mc .configNominalOutputReverse (0 , kTimeout );
7475 mc .configPeakOutputForward (1 , kTimeout );
7576 mc .configPeakOutputReverse (-1 , kTimeout );
77+
78+ // current limiting stuff cole said to put
79+ mc .configPeakCurrentLimit (0 , 0 );
80+ mc .configPeakCurrentDuration (0 , 0 );
81+ // 40 amps is the amp limit of a CIM. also, the PDP has 40 amp circuit breakers,
82+ // so if we went above 40, the motors would stop completely
83+ mc .configContinuousCurrentLimit (40 , 0 );
84+ mc .enableCurrentLimit (true );
7685 }
7786
7887 /**
@@ -83,6 +92,7 @@ private void configSRX(WPI_TalonSRX mc) {
8392 * the VictorSPX to configure
8493 */
8594 private void configSPX (WPI_VictorSPX mc ) {
95+ // stuff cole said to put
8696 int kTimeout = (int ) Robot .getConst ("kTimeoutMs" , 10 );
8797 mc .configNominalOutputForward (0 , kTimeout );
8898 mc .configNominalOutputReverse (0 , kTimeout );
@@ -92,12 +102,12 @@ private void configSPX(WPI_VictorSPX mc) {
92102
93103 public RobotMap () {
94104
95- // intakeMotor = new WPI_TalonSRX(getPort("IntakeTalonSRX", 4));
96- // configSRX(intakeMotor);
97- // liftMotor = new WPI_TalonSRX(getPort("LiftTalonSRX", 5));
98- // configSRX(liftMotor);
99- // climberMotor = new WPI_TalonSRX(getPort("ClimberTalonSRX", 6));
100- // configSRX(climberMotor);
105+ // intakeMotor = new WPI_TalonSRX(getPort("IntakeTalonSRX", 4));
106+ // configSRX(intakeMotor);
107+ // liftMotor = new WPI_TalonSRX(getPort("LiftTalonSRX", 5));
108+ // configSRX(liftMotor);
109+ // climberMotor = new WPI_TalonSRX(getPort("ClimberTalonSRX", 6));
110+ // configSRX(climberMotor);
101111
102112 leftEncPort1 = new DigitalInput (getPort ("1LeftEnc" , 1 ));
103113 leftEncPort2 = new DigitalInput (getPort ("2LeftEnc" , 0 ));
@@ -107,12 +117,14 @@ public RobotMap() {
107117 leftEncRate .setPIDSourceType (PIDSourceType .kRate );
108118 leftEncDist .setDistancePerPulse (Robot .getConst ("Distance Per Pulse Left" , 0.184 ));
109119 leftEncRate .setDistancePerPulse (Robot .getConst ("Distance Per Pulse Left" , 0.184 ));
110-
111- dtLeftMaster = new WPI_TalonSRX (getPort ("LeftTalonSRXMaster" , 2 ));
120+
121+ dtLeftMaster = new WPI_TalonSRX (getPort ("LeftTalonSRXMaster" , 1 ));
112122 configSRX (dtLeftMaster );
113- dtLeftSlave = new WPI_VictorSPX (getPort ("LeftVictorSPXSlave" , 0 ));
123+ dtLeftSlave = new WPI_VictorSPX (getPort ("LeftVictorSPXSlave" , 2 ));
114124 configSPX (dtLeftSlave );
115125 dtLeft = new SpeedControllerGroup (dtLeftMaster , dtLeftSlave );
126+ //inverted bc gear boxes invert from input to output
127+ dtLeft .setInverted (true );
116128
117129 leftVelocityController = new VelocityPIDController (Robot .getConst ("VelocityLeftkP" , 0 ),
118130 Robot .getConst ("VelocityLeftkI" , 0 ), Robot .getConst ("VelocityLeftkD" , 0 ),
@@ -122,6 +134,7 @@ public RobotMap() {
122134 leftVelocityController .setOutputRange (-1.0 , 1.0 );
123135 leftVelocityController .setContinuous (false );
124136 leftVelocityController .setAbsoluteTolerance (Robot .getConst ("VelocityToleranceLeft" , 2 ));
137+ SmartDashboard .putData (leftVelocityController );
125138
126139 rightEncPort1 = new DigitalInput (getPort ("1RightEnc" , 3 ));
127140 rightEncPort2 = new DigitalInput (getPort ("2RightEnc" , 2 ));
@@ -131,13 +144,15 @@ public RobotMap() {
131144 rightEncRate .setPIDSourceType (PIDSourceType .kRate );
132145 rightEncDist .setDistancePerPulse (Robot .getConst ("Distance Per Pulse Right" , 0.184 ));
133146 rightEncRate .setDistancePerPulse (Robot .getConst ("Distance Per Pulse Right" , 0.184 ));
134-
135- dtRightMaster = new WPI_TalonSRX (getPort ("RightTalonSRXMaster" , 1 ));
147+
148+ dtRightMaster = new WPI_TalonSRX (getPort ("RightTalonSRXMaster" , 4 ));
136149 configSRX (dtRightMaster );
137150 dtRightSlave = new WPI_VictorSPX (getPort ("RightVictorSPXSlave" , 3 ));
138151 configSPX (dtRightSlave );
139152 dtRight = new SpeedControllerGroup (dtRightMaster , dtRightSlave );
140-
153+ //inverted bc gear boxes invert from input to output
154+ dtRight .setInverted (true );
155+
141156 rightVelocityController = new VelocityPIDController (Robot .getConst ("VelocityRightkP" , 0 ),
142157 Robot .getConst ("VelocityRightkI" , 0 ), Robot .getConst ("VelocityRightkD" , 0 ),
143158 1 / Robot .getConst ("Max Low Speed" , 84 ), rightEncRate , dtRight );
@@ -147,13 +162,14 @@ public RobotMap() {
147162 rightVelocityController .setContinuous (false );
148163 rightVelocityController .setAbsoluteTolerance (Robot .getConst ("VelocityToleranceRight" , 2 ));
149164
150- // robotDrive = new DifferentialDrive(leftVelocityController, rightVelocityController);
151- // robotDrive.setMaxOutput(Robot.getConst("Max High Speed", 204));
165+ // robotDrive = new DifferentialDrive(leftVelocityController,
166+ // rightVelocityController);
167+ // robotDrive.setMaxOutput(Robot.getConst("Max High Speed", 204));
152168 robotDrive = new DifferentialDrive (dtLeft , dtRight );
153-
169+
154170 distEncAvg = new PIDSourceAverage (leftEncDist , rightEncDist );
155171 fancyGyro = new AHRS (SerialPort .Port .kMXP );
156- // dtGear = new DoubleSolenoid(getPort("1dtGearSolenoid", 0), getPort("2dtGearSolenoid", 1));
172+ dtGear = new DoubleSolenoid (getPort ("1dtGearSolenoid" , 0 ), getPort ("2dtGearSolenoid" , 1 ));
157173 }
158174
159175 /**
0 commit comments