Skip to content
This repository was archived by the owner on Sep 14, 2019. It is now read-only.

Commit 306cbf5

Browse files
2 parents 91e34ed + 71a0c43 commit 306cbf5

2 files changed

Lines changed: 45 additions & 2 deletions

File tree

Robot2018/src/org/usfirst/frc/team199/Robot2018/Robot.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,23 @@ public void teleopPeriodic() {
165165
Scheduler.getInstance().run();
166166
}
167167

168+
boolean firstTime = true;
168169
/**
169170
* This function is called periodically during test mode
170171
*/
171172
@Override
172173
public void testPeriodic() {
173-
// Robot.dt.setLeft(0.2);
174-
Robot.dt.setRight(0.2);
174+
if(firstTime) {
175+
Robot.dt.enableVelocityPIDs();
176+
firstTime = false;
177+
}
178+
Robot.dt.setVPIDs(Robot.getConst("VPID Test Set", 0.5));
179+
SmartDashboard.putNumber("Drivetrain/Left VPID Targ", Robot.dt.getLeftVPIDSetpoint());
180+
SmartDashboard.putNumber("Drivetrain/Right VPID Targ", Robot.dt.getRightVPIDSetpoint());
181+
SmartDashboard.putNumber("Left VPID Error", Robot.dt.getLeftVPIDerror());
182+
SmartDashboard.putNumber("Right VPID Error", Robot.dt.getRightVPIDerror());
183+
SmartDashboard.putNumber("Left Enc Rate", Robot.dt.getLeftEncRate());
184+
SmartDashboard.putNumber("Right Enc Rate", Robot.dt.getRightEncRate());
185+
175186
}
176187
}

Robot2018/src/org/usfirst/frc/team199/Robot2018/subsystems/Drivetrain.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,38 @@ public void setLeft(double spd) {
5252
public void setRight(double spd) {
5353
dtRight.set(spd);
5454
}
55+
56+
/**
57+
* Use for testing only (i.e. when not going through robotDrive)
58+
* */
59+
public void setVPIDs(double realSpd) {
60+
leftVelocityController.set(realSpd);
61+
rightVelocityController.set(-realSpd);
62+
}
63+
64+
public double getLeftVPIDerror() {
65+
return leftVelocityController.getError();
66+
}
67+
68+
public double getRightVPIDerror() {
69+
return rightVelocityController.getError();
70+
}
71+
72+
public double getLeftVPIDSetpoint() {
73+
return leftVelocityController.get();
74+
}
75+
76+
public double getRightVPIDSetpoint() {
77+
return rightVelocityController.get();
78+
}
79+
80+
public double getLeftEncRate() {
81+
return leftEncRate.getRate();
82+
}
83+
84+
public double getRightEncRate() {
85+
return rightEncRate.getRate();
86+
}
5587

5688
/**
5789
* Drives based on joystick input and SmartDashboard values

0 commit comments

Comments
 (0)