2023 Drive base
 
Loading...
Searching...
No Matches
frc.robot.subsystems.TankDrive Class Reference

Manages the tank drive base. More...

Inheritance diagram for frc.robot.subsystems.TankDrive:
frc.robot.subsystems.DriveBase

Public Member Functions

 TankDrive (int leftTalonPort, int leftVictorPort, int rightTalonPort, int rightVictorPort)
 Constructor for TankDrive Class.
 
void drive (double leftAnalogX, double leftAnalogY, double rightAnalogX, double rightAnalogY)
 Drive the robot tank base from controller input.
 
void turnOnStopMode ()
 should be overridden for actual functionality because depends on drive base specifc speeds (for tank drive, there is a left and right speed, whereas for mecanum there are 4)
 
void updateRobotVelocity ()
 
void getPosition ()
 
void updatePosition ()
 
void printControlsOfCurrentMode ()
 Prints the controls of the current driving mode.
 
void AButtonPressed ()
 
void BButtonPressed ()
 
void XButtonPressed ()
 
void YButtonPressed ()
 
void leftBumperPressed ()
 
void rightBumperPressed ()
 
void printActiveMotorDebugMode ()
 
void cycleMotor ()
 Needs to be implemented in sub classes becuase there might be different numbers of motors.
 
void incrementPIDConstant ()
 PID Tuning Mode: Increments the selected PID constant.
 
void cyclePIDConstant ()
 PID Tuning Mode: Cycles between the PID constants.
 
void toggleDecreasingPIDIncrement ()
 
void printPIDConstants ()
 
void resetPosition ()
 
void printPosition ()
 
- Public Member Functions inherited from frc.robot.subsystems.DriveBase
void drive (double leftAnalogX, double leftAnalogY, double rightAnalogX, double rightAnalogY)
 Drive the robot with controller input.
 
void drive (double leftAnalogX, double leftAnalogY, double rightAnalogX)
 
abstract void printControlsOfCurrentMode ()
 Prints the controls of the current driving mode.
 
void increaseSpeedBracket ()
 The speed bracket controls the multiplier for al the speeds So when you change it, lets say, to 1/2 speed, all movement will be at 1/2 speed.
 
void decreaseSpeedBracket ()
 
void turnOnDefaultMode ()
 
void turnOnDebugMode ()
 
void turnOnStopMode ()
 should be overridden for actual functionality because depends on drive base specifc speeds (for tank drive, there is a left and right speed, whereas for mecanum there are 4)
 
void turnONPIDTuningMode ()
 
abstract void cycleMotor ()
 Needs to be implemented in sub classes becuase there might be different numbers of motors.
 
void AButtonPressed ()
 
void BButtonPressed ()
 
void XButtonPressed ()
 
void YButtonPressed ()
 
void leftBumperPressed ()
 
void rightBumperPressed ()
 
Mode getCurrentMode ()
 
void setCurrentMode (Mode currentMode)
 
int getDebugEnabledMotor ()
 
void setDebugEnabledMotor (int debugEnabledMotor)
 
Trajectory getCurrentTrajectory ()
 
void setCurrentTrajectory (Trajectory currentTrajectory)
 
TrajectoryConfig getTrajectoryConfig ()
 
RamseteController getChassisController ()
 
double getCurrentTrajectoryTime ()
 
void resetCurrentTrajectoryTime ()
 
void incrementCurrentTrajectoryTime ()
 

Private Member Functions

double slowDown (double inputVelocity)
 This will return a value lower than the input, and it is used to slow down the motors during stop mode.
 

Additional Inherited Members

- Protected Attributes inherited from frc.robot.subsystems.DriveBase
TrajectoryConfig trajectoryConfig
 

Detailed Description

Manages the tank drive base.

Definition at line 27 of file TankDrive.java.

Constructor & Destructor Documentation

◆ TankDrive()

frc.robot.subsystems.TankDrive.TankDrive ( int  leftTalonPort,
int  leftVictorPort,
int  rightTalonPort,
int  rightVictorPort 
)

Constructor for TankDrive Class.

Parameters
leftMotorPort
rightMotorPort

Definition at line 79 of file TankDrive.java.

80 {
81 leftVictor = new VictorSPX(leftVictorPort);
82 leftSparkMax = new CANSparkMax(leftTalonPort, CANSparkMaxLowLevel.MotorType.kBrushed);
83 rightTalon = new TalonSRX(rightTalonPort);
84 rightVictor = new VictorSPX(rightVictorPort);
85 sparkMaxEncoder = leftSparkMax.getEncoder(SparkMaxRelativeEncoder.Type.kQuadrature, Constants.ENCODER_CPR);
86
87 currentMode = Mode.DEFAULT_MODE;
88
89 leftPID = new PIDController(PIDConstants[0], PIDConstants[1], PIDConstants[2]);
90 rightPID = new PIDController(PIDConstants[0], PIDConstants[1], PIDConstants[2]);
91
92 navx = new AHRS(SPI.Port.kMXP);
93 //odometer = new DifferentialDriveOdometry(new Rotation2d());
95
96 // see declaration in DriveBase
97 /*
98 This trajecotry config needs a look over, because it has not been tested or planned for tank drive. TankDrive functions should fail if used in autonomous
99 trajectoryConfig = new TrajectoryConfig(Constants.maxVelocityMetersPerSecond, Constants.maxAccelerationMetersPerSecond);
100 trajectoryConfig.setReversed(true);
101 */
102 }

References frc.robot.Constants.ENCODER_CPR, and frc.robot.subsystems.TankDrive.resetPosition().

Member Function Documentation

◆ AButtonPressed()

void frc.robot.subsystems.TankDrive.AButtonPressed ( )

Reimplemented from frc.robot.subsystems.DriveBase.

Definition at line 331 of file TankDrive.java.

331 {
332 switch(currentMode) {
333 case DEFAULT_MODE:
335 break;
336 case DEBUG_MODE:
337 cycleMotor();
338 break;
339 case PID_TUNING_MODE:
341 break;
342 default:
343 break;
344 }
345 }
void cycleMotor()
Needs to be implemented in sub classes becuase there might be different numbers of motors.
Definition: TankDrive.java:401
void incrementPIDConstant()
PID Tuning Mode: Increments the selected PID constant.
Definition: TankDrive.java:411

References frc.robot.subsystems.TankDrive.cycleMotor(), frc.robot.subsystems.TankDrive.incrementPIDConstant(), and frc.robot.subsystems.TankDrive.printPosition().

◆ BButtonPressed()

void frc.robot.subsystems.TankDrive.BButtonPressed ( )

Reimplemented from frc.robot.subsystems.DriveBase.

Definition at line 348 of file TankDrive.java.

348 {
349 switch(currentMode) {
350 case DEFAULT_MODE:
352 break;
353 case DEBUG_MODE:
355 break;
356 case PID_TUNING_MODE:
358 break;
359 default:
360 break;
361 }
362 }
void cyclePIDConstant()
PID Tuning Mode: Cycles between the PID constants.
Definition: TankDrive.java:440

References frc.robot.subsystems.TankDrive.cyclePIDConstant(), frc.robot.subsystems.TankDrive.printActiveMotorDebugMode(), and frc.robot.subsystems.TankDrive.resetPosition().

◆ cycleMotor()

void frc.robot.subsystems.TankDrive.cycleMotor ( )

Needs to be implemented in sub classes becuase there might be different numbers of motors.

Reimplemented from frc.robot.subsystems.DriveBase.

Definition at line 401 of file TankDrive.java.

401 {
402 debugEnabledMotor++;
403 debugEnabledMotor %= 4;
404 System.out.println("Current Motor: " + debugEnabledMotor);
405 }

Referenced by frc.robot.subsystems.TankDrive.AButtonPressed().

◆ cyclePIDConstant()

void frc.robot.subsystems.TankDrive.cyclePIDConstant ( )

PID Tuning Mode: Cycles between the PID constants.

Definition at line 440 of file TankDrive.java.

440 {
441 currentPIDConstant++;
442 currentPIDConstant %= 3;
443 if(currentPIDConstant == 0) {
444 System.out.println("kP Selected");
445 }
446 else if(currentPIDConstant == 1) {
447 System.out.println("kI Selected");
448 }
449 else if(currentPIDConstant == 2) {
450 System.out.println("kD Selected");
451 }
452 }

Referenced by frc.robot.subsystems.TankDrive.BButtonPressed().

◆ drive()

void frc.robot.subsystems.TankDrive.drive ( double  leftAnalogX,
double  leftAnalogY,
double  rightAnalogX,
double  rightAnalogY 
)

Drive the robot tank base from controller input.

These are doubles on the interval [-1,1], and come from the controller's analog sticks (circle spinny things)

Parameters
leftAnalogX
leftAnalogY
rightAnalogX
rightAnalogY

we only care about left Y and right X left Y is average velocity right X is velocity difference between wheels

Reimplemented from frc.robot.subsystems.DriveBase.

Definition at line 115 of file TankDrive.java.

116 {
117
118 /**
119 * we only care about left Y and right X
120 * left Y is average velocity
121 * right X is velocity difference between wheels
122 */
123
124 double x = rightAnalogX;
125
126 double y = leftAnalogY;
127
128 if(Math.abs(x) < Constants.ANALOG_DEAD_ZONE && Math.abs(y) < Constants.ANALOG_DEAD_ZONE) return; // deadzone
129
130 // make sure that both velocities are in [-1, 1]
131 double preScaledLeftVel = y - x * rotationalSpeedMultiplier;
132 double preScaledRightVel = y + x * rotationalSpeedMultiplier;
133 double scaleFactor = 1 / Math.max(Math.max(Math.abs(preScaledLeftVel), Math.abs(preScaledRightVel)), 1);
134
135 // scale to what the controller asks
136 leftVel = preScaledLeftVel * scaleFactor * speedMultiplier;
137 rightVel = preScaledRightVel * scaleFactor * speedMultiplier;
138
139 // // leftTalon.set(ControlMode.PercentOutput, leftVel);
140 // leftVictor.set(ControlMode.PercentOutput, leftVel);
141 // leftSparkMax.set(leftVel);
142 // rightTalon.set(ControlMode.PercentOutput, rightVel);
143 // rightVictor.set(ControlMode.PercentOutput, rightVel);
144 // set the motor speeds
145 if(currentMode == Mode.DEFAULT_MODE || currentMode == Mode.PID_TUNING_MODE) {
146 leftVictor.set(ControlMode.PercentOutput, -1 *leftVel);
147 leftSparkMax.set(leftVel);
148 rightTalon.set(ControlMode.PercentOutput, rightVel);
149 rightVictor.set(ControlMode.PercentOutput, rightVel);
150
151
152
153 // PID stuff
154
155 // actual angular velocities converted to radians per second
156 double leftAngVel = sparkMaxEncoder.getVelocity() * Constants.SPARK_MAX_CONVERSION_FACTOR;
157 double rightAngVel = rightTalon.getSelectedSensorVelocity() * Constants.TALON_CONVERSION_FACTOR;
158
159 // normalized (actual) angular velocities
160 double normalLeftAngVel = leftAngVel / maxAngularVel;
161 double normalRightAngVel = rightAngVel / maxAngularVel;
162
163
164
165 // set the motors according to the PID
166 double leftPIDValue = leftPID.calculate(normalLeftAngVel, leftVel);
167 double rightPIDValue = rightPID.calculate(normalRightAngVel, rightVel);
168
169
170 leftVictor.set(ControlMode.PercentOutput, -1 * leftPIDValue);
171 leftSparkMax.set(leftPIDValue);
172
173 // System.out.println("Analog: " + leftAnalogY + ", Input: " + rightVel + ", Measured: " + rightAngVel + ", Normalized: " + normalRightAngVel + ", PID: " + rightPIDValue);
174 System.out.println("Right: " + normalRightAngVel + ", Left: " + normalLeftAngVel);
175
176
177 rightTalon.set(ControlMode.PercentOutput, rightPIDValue);
178 rightVictor.set(ControlMode.PercentOutput, rightPIDValue);
179
180
181
182 } else if (currentMode == Mode.DEBUG_MODE) {
183 switch (debugEnabledMotor){
184 case 0:
185 leftVictor.set(ControlMode.PercentOutput, -1 * leftVel);
186 break;
187 case 1:
188 rightVictor.set(ControlMode.PercentOutput, rightVel);
189 break;
190 case 2:
191 rightTalon.set(ControlMode.PercentOutput, rightVel);
192 break;
193 case 3:
194 leftSparkMax.set(leftVel);
195 break;
196 }
197 } else if (currentMode == Mode.STOP_MODE){
198 // STOP!!!!! set motors to 0
199 // slower stop
200 slowingLeftVel = slowDown(slowingLeftVel);
201 slowingRightVel = slowDown(slowingRightVel);
202
203 leftVictor.set(ControlMode.PercentOutput, -1 *slowingLeftVel);
204 leftSparkMax.set(slowingLeftVel);
205 rightTalon.set(ControlMode.PercentOutput, slowingRightVel);
206 rightVictor.set(ControlMode.PercentOutput, slowingRightVel);
207
208 }
210 // System.out.println(rightTalon.getSelectedSensorVelocity()); // clicks per 100ms
211 // System.out.println(rightTalon.getSelectedSensorVelocity() * 10 * 60 / 4096);
212 // System.out.println(sparkMaxEncoder.getVelocity()); // actual rpm
213 // System.out.println("");
214
215
216
217
218 // // Print angular velocity and motor use level
219 // // get rotational speeds from the motors on each side
220 // // divide by 60 to get rotations per second
221 // double leftRPS = -1 * sparkMaxEncoder.getVelocity() / 60;
222
223 // if (Math.abs(leftRPS) > 0.1){
224 // // // multiply by 10 because this is per 100ms - we want rps
225 // double rightRPS = rightTalon.getSelectedSensorVelocity() * 10 / Constants.ENCODER_CPR;
226 // System.out.println("Right Rps: " + rightRPS + "\nLeft RPS: " + leftRPS);
227 // System.out.println("Right velocity from controller: " + rightVel + "\nLeft Velocity from controller: " + leftVel);
228 // }
229
230
231 }
double slowDown(double inputVelocity)
This will return a value lower than the input, and it is used to slow down the motors during stop mod...
Definition: TankDrive.java:240

References frc.robot.Constants.ANALOG_DEAD_ZONE, frc.robot.subsystems.TankDrive.slowDown(), frc.robot.Constants.SPARK_MAX_CONVERSION_FACTOR, frc.robot.Constants.TALON_CONVERSION_FACTOR, and frc.robot.subsystems.TankDrive.updatePosition().

◆ getPosition()

void frc.robot.subsystems.TankDrive.getPosition ( )

Definition at line 280 of file TankDrive.java.

281 {
282
283 }

◆ incrementPIDConstant()

void frc.robot.subsystems.TankDrive.incrementPIDConstant ( )

PID Tuning Mode: Increments the selected PID constant.

Definition at line 411 of file TankDrive.java.

411 {
412 if(increasingPIDConstant) {
413 PIDConstants[currentPIDConstant] += PIDIncrements[currentPIDConstant];
414 } else {
415 PIDConstants[currentPIDConstant] -= PIDIncrements[currentPIDConstant];
416 }
417 // make sure constants are in [0, constantMax]
418 PIDConstants[currentPIDConstant] = Math.min(PIDConstants[currentPIDConstant], PIDMaximums[currentPIDConstant]);
419 PIDConstants[currentPIDConstant] = Math.max(PIDConstants[currentPIDConstant], 0);
420
421 // print PID constants
422 System.out.println("kP: " + PIDConstants[0] + ", kI: " + PIDConstants[1] + ", kD: " + PIDConstants[2]);
423
424 // set PID constant in the PID controllers
425 if(currentPIDConstant == 0) {
426 leftPID.setP(PIDConstants[0]);
427 rightPID.setP(PIDConstants[0]);
428 } else if (currentPIDConstant == 1) {
429 leftPID.setI(PIDConstants[1]);
430 rightPID.setI(PIDConstants[1]);
431 } else if (currentPIDConstant == 2) {
432 leftPID.setD(PIDConstants[2]);
433 rightPID.setD(PIDConstants[2]);
434 }
435 }

Referenced by frc.robot.subsystems.TankDrive.AButtonPressed().

◆ leftBumperPressed()

void frc.robot.subsystems.TankDrive.leftBumperPressed ( )

◆ printActiveMotorDebugMode()

void frc.robot.subsystems.TankDrive.printActiveMotorDebugMode ( )

Definition at line 397 of file TankDrive.java.

397 {
398 System.out.println("Current Motor: " + debugEnabledMotor);
399 }

Referenced by frc.robot.subsystems.TankDrive.BButtonPressed().

◆ printControlsOfCurrentMode()

void frc.robot.subsystems.TankDrive.printControlsOfCurrentMode ( )

Prints the controls of the current driving mode.

Reimplemented from frc.robot.subsystems.DriveBase.

Definition at line 300 of file TankDrive.java.

300 {
301 System.out.println("Controls:");
302 switch(currentMode) {
303 case DEFAULT_MODE:
304 System.out.println("A: Print position");
305 System.out.println("B: Reset position to 0");
306 System.out.println("Left Bracket: Decrease speed multiplier");
307 System.out.println("Right Bracket: Increase speed multiplier");
308 break;
309 case DEBUG_MODE:
310 System.out.println("A: Cycle active motor");
311 System.out.println("B: Print current active motor");
312 System.out.println("Left Bracket: Decrease speed multiplier");
313 System.out.println("Right Bracket: Increase speed multiplier");
314 break;
315 case STOP_MODE:
316 System.out.println("Left Bracket: Decrease speed multiplier");
317 System.out.println("Right Bracket: Increase speed multiplier");
318 break;
319 case PID_TUNING_MODE:
320 System.out.println("A: Increment selected PID constant");
321 System.out.println("B: Cycle selected PID constant");
322 System.out.println("X: Toggle between increasing/decreasing PID constant");
323 System.out.println("Y: Print PID constant");
324 System.out.println("Left Bracket: Decrease speed multiplier");
325 System.out.println("Right Bracket: Increase speed multiplier");
326 break;
327 }
328 }

◆ printPIDConstants()

void frc.robot.subsystems.TankDrive.printPIDConstants ( )

Definition at line 467 of file TankDrive.java.

467 {
468 System.out.println("kP: " + PIDConstants[0] + ", kI: " + PIDConstants[1] + ", kD: " + PIDConstants[2]);
469 }

Referenced by frc.robot.subsystems.TankDrive.YButtonPressed().

◆ printPosition()

void frc.robot.subsystems.TankDrive.printPosition ( )

Definition at line 481 of file TankDrive.java.

482 {
483 Pose2d posFromWheelDisplacement = odometer.getPoseMeters();
484 System.out.println("Position from odometer and wheel: ");
485 System.out.println("X: " + posFromWheelDisplacement.getX() + " Y: " + posFromWheelDisplacement.getY() + " rotation: " + posFromWheelDisplacement.getRotation());
486
487 System.out.println("\nPosition info from navx: ");
488 System.out.println("X: " + navx.getDisplacementX() + " Y: " + navx.getDisplacementY() + " rotation: " + navx.getAngle());
489 System.out.println();
490
491 // get the linear position of the left wheel and convert to meters
492 double leftWheelPos = -1 * sparkMaxEncoder.getPosition() * 2 * Math.PI * Constants.TANK_WHEEL_RADIUS;
493
494 // get the linear position of the right wheel and convert to meters
495 double rightWheelPos = rightTalon.getSelectedSensorPosition() / Constants.ENCODER_CPR * 2 * Math.PI * Constants.TANK_WHEEL_RADIUS;
496 System.out.println("Right Pos: " + rightWheelPos + " left pos: " + leftWheelPos);
497
498
499 // Print angular velocity and motor use level
500 // get rotational speeds from the motors on each side
501 // divide by 60 to get rotations per second
502 double leftRPS = -1 * sparkMaxEncoder.getVelocity() / 60;
503 // // multiply by 10 because this is per 100ms - we want rps
504 double rightRPS = rightTalon.getSelectedSensorVelocity() * 10 / Constants.ENCODER_CPR;
505 System.out.println("Right Rps: " + rightRPS + "\nLeft RPS: " + leftRPS);
506
507 }

References frc.robot.Constants.ENCODER_CPR, and frc.robot.Constants.TANK_WHEEL_RADIUS.

Referenced by frc.robot.subsystems.TankDrive.AButtonPressed().

◆ resetPosition()

void frc.robot.subsystems.TankDrive.resetPosition ( )

Definition at line 471 of file TankDrive.java.

472 {
473 // reset the sensors to zero the position
474 navx.reset();
475 navx.resetDisplacement();
476 sparkMaxEncoder.setPosition(0);
477 rightTalon.setSelectedSensorPosition(0);
478 // odometer.resetPosition(new Pose2d(), new Rotation2d());
479 }

Referenced by frc.robot.subsystems.TankDrive.BButtonPressed(), and frc.robot.subsystems.TankDrive.TankDrive().

◆ rightBumperPressed()

void frc.robot.subsystems.TankDrive.rightBumperPressed ( )

Reimplemented from frc.robot.subsystems.DriveBase.

Definition at line 392 of file TankDrive.java.

392 {
394 }
void increaseSpeedBracket()
The speed bracket controls the multiplier for al the speeds So when you change it,...
Definition: DriveBase.java:67

References frc.robot.subsystems.DriveBase.increaseSpeedBracket().

◆ slowDown()

double frc.robot.subsystems.TankDrive.slowDown ( double  inputVelocity)
private

This will return a value lower than the input, and it is used to slow down the motors during stop mode.

Parameters
inputVelocitybetween -1 and 1 (double)
Returns
the new value (lower)

Definition at line 240 of file TankDrive.java.

240 {
241 // input is between -1 and 1
242 double newVelocity;
243 if (Math.abs(inputVelocity) > Constants.SLOW_DOWN_CUTOFF){
244 // velocity still needs to be reduced (magnatude is above cutoff)
245 newVelocity = inputVelocity / Constants.SLOW_DOWN_FACTOR;
246 } else {
247 // input has reached cutoff, now returning 0 speed
248 return 0;
249 }
250 return newVelocity;
251 }

References frc.robot.Constants.SLOW_DOWN_CUTOFF, and frc.robot.Constants.SLOW_DOWN_FACTOR.

Referenced by frc.robot.subsystems.TankDrive.drive().

◆ toggleDecreasingPIDIncrement()

void frc.robot.subsystems.TankDrive.toggleDecreasingPIDIncrement ( )

Definition at line 457 of file TankDrive.java.

457 {
458 if(increasingPIDConstant) {
459 increasingPIDConstant = false;
460 System.out.println("Decreasing PID Constants");
461 } else {
462 increasingPIDConstant = true;
463 System.out.println("Increasing PID Constants");
464 }
465 }

Referenced by frc.robot.subsystems.TankDrive.XButtonPressed().

◆ turnOnStopMode()

void frc.robot.subsystems.TankDrive.turnOnStopMode ( )

should be overridden for actual functionality because depends on drive base specifc speeds (for tank drive, there is a left and right speed, whereas for mecanum there are 4)

Reimplemented from frc.robot.subsystems.DriveBase.

Definition at line 254 of file TankDrive.java.

254 {
255 if(currentMode == Mode.STOP_MODE) return;
256 currentMode = Mode.STOP_MODE;
257 // Stop mode activated, so now the robot needs to slow down
258 // start by saving the last left and right velocities
259 slowingLeftVel = leftVel;
260 slowingRightVel = rightVel;
261 System.out.println("STOP MODE");
262 }

◆ updatePosition()

void frc.robot.subsystems.TankDrive.updatePosition ( )

Definition at line 285 of file TankDrive.java.

286 {
287 // get the linear position of the left wheel and convert to meters
288 double leftWheelPos = -1 * sparkMaxEncoder.getPosition() * 2 * Math.PI * Constants.TANK_WHEEL_RADIUS;
289
290 // get the linear position of the right wheel and convert to meters
291 double rightWheelPos = rightTalon.getSelectedSensorPosition() / Constants.ENCODER_CPR * 2 * Math.PI * Constants.TANK_WHEEL_RADIUS;
292
293 // get the angle of the robot
294 double theta = navx.getAngle() / 180 * Math.PI;
295 Rotation2d rot = new Rotation2d(theta);
296 odometer.update(rot, leftWheelPos, rightWheelPos);
297 }

References frc.robot.Constants.TANK_WHEEL_RADIUS.

Referenced by frc.robot.subsystems.TankDrive.drive().

◆ updateRobotVelocity()

void frc.robot.subsystems.TankDrive.updateRobotVelocity ( )

Definition at line 264 of file TankDrive.java.

264 {
265
266 // get rotational speeds from the motors on each side
267 // divide by 60 to get rotations per second
268 // double leftRPS = -1 * sparkMaxEncoder.getVelocity() / 60;
269 // // multiply by 10 because this is per 100ms - we want rps
270 // double rightRPS = rightTalon.getSelectedSensorVelocity() * 10 / Constants.ENCODER_CPR;
271
272 // // find linear velocities in m/s
273 // double leftVel = (leftRPS * 2 * Math.PI) * Constants.TANK_WHEEL_RADIUS;
274 // double rightVel = (rightRPS * 2 * Math.PI) * Constants.TANK_WHEEL_RADIUS;
275
276 // currentSpeeds.leftMetersPerSecond = leftVel;
277 // currentSpeeds.rightMetersPerSecond = rightVel;
278 }

◆ XButtonPressed()

void frc.robot.subsystems.TankDrive.XButtonPressed ( )

Reimplemented from frc.robot.subsystems.DriveBase.

Definition at line 365 of file TankDrive.java.

365 {
366 switch(currentMode) {
367 case PID_TUNING_MODE:
369 break;
370 default:
371 break;
372 }
373 }

References frc.robot.subsystems.TankDrive.toggleDecreasingPIDIncrement().

◆ YButtonPressed()

void frc.robot.subsystems.TankDrive.YButtonPressed ( )

Reimplemented from frc.robot.subsystems.DriveBase.

Definition at line 376 of file TankDrive.java.

376 {
377 switch(currentMode) {
378 case PID_TUNING_MODE:
380 break;
381 default:
382 break;
383 }
384 }

References frc.robot.subsystems.TankDrive.printPIDConstants().


The documentation for this class was generated from the following file: