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

Commit 2c19666

Browse files
committed
changed all PR comments
fixed enable/disable/stop (also added enable to the end() of MoveLift so it's ready and live when not using that non-PID command anymore changed getString in OI to be SmartDashboard. instead of Robot. but left my getString methods in there bc not doing any harm left end() in interrupted bc not really doing any harm got rid of spd --> voltage method and replaced it with a constant from Robot.getConst
1 parent 421d2d6 commit 2c19666

6 files changed

Lines changed: 6 additions & 29 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ public OI(Robot robot) {
104104
moveLiftPIDDownButton.whileHeld(new MoveLiftWithPID(Robot.lift, false));
105105

106106
testLiftPID = new JoystickButton(leftJoy, getButton("Test Lift PID", 5));
107-
testLiftPID.whenPressed(
108-
new LiftToPosition(Robot.lift, Robot.getString("Lift Targ Height", LiftHeight.SWITCH.toString())));
107+
testLiftPID.whenPressed(new LiftToPosition(Robot.lift,
108+
SmartDashboard.getString("Lift Targ Height", LiftHeight.SWITCH.toString())));
109109

110110
rightJoy = new Joystick(1);
111111
shiftHighGearButton = new JoystickButton(rightJoy, getButton("Shift High Gear", 4));

Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/LiftToPosition.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,11 @@ public LiftToPosition(Lift lift, String goal) {
2323
// Called just before this Command runs the first time
2424
@Override
2525
protected void initialize() {
26-
// There's no way to reset the Lift's PID constants after constructing it, so if
27-
// you change them you must Restart Robot Code in DS.
26+
lift.getPIDController().setPID(Robot.getConst("LiftkP", 0.1), Robot.getConst("LiftkI", 0),
27+
Robot.getConst("LiftkD", 0), Robot.getConst("LiftkF", 0.1));
2828
double setpoint = lift.getDesiredDistFromPos(pos);
2929
lift.setSetpoint(setpoint);
3030
System.out.println("Target Height: " + setpoint);
31-
lift.enable();
32-
System.out.println("Enabled");
3331
}
3432

3533
// Called repeatedly when this Command is scheduled to run
@@ -47,11 +45,6 @@ protected boolean isFinished() {
4745
// Called once after isFinished returns true
4846
@Override
4947
protected void end() {
50-
lift.disable();
51-
System.out.println("Disabled");
52-
// keep stopLift() after disable() so they don't conflict
53-
lift.stopLift();
54-
System.out.println("Stopped");
5548
}
5649

5750
// Called when another command which requires one or more of the same

Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/MoveLift.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ protected boolean isFinished() {
4646
@Override
4747
protected void end() {
4848
lift.stopLift();
49+
lift.enable();
4950
}
5051

5152
// Called when another command which requires one or more of the same

Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/MoveLiftWithPID.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ public MoveLiftWithPID(Lift lift, boolean up) {
2828
protected void initialize() {
2929
setpoint = 0;
3030
lift.setSetpoint(setpoint);
31-
lift.enable();
3231
}
3332

3433
// Called repeatedly when this Command is scheduled to run
@@ -48,9 +47,6 @@ protected boolean isFinished() {
4847
// Called once after isFinished returns true
4948
@Override
5049
protected void end() {
51-
lift.disable();
52-
// keep stopLift() after disable() so they don't conflict
53-
lift.stopLift();
5450
}
5551

5652
// Called when another command which requires one or more of the same

Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/UpdateLiftPosition.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@ protected boolean isFinished() {
8181
// Called once after isFinished returns true
8282
@Override
8383
protected void end() {
84-
lift.stopLift();
85-
lift.disable();
8684
}
8785

8886
// Called when another command which requires one or more of the same

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

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -176,18 +176,7 @@ protected double returnPIDInput() {
176176
protected void usePIDOutput(double output) {
177177
double out = output;
178178
double spd = liftEnc.getRate();
179-
out += convertSpdToVoltage(spd);
179+
out += Robot.getConst("Lift: Necessary Voltage", 0);
180180
runMotor(out);
181181
}
182-
183-
/**
184-
* Takes a value for the current lift speed and translates it to the amount of
185-
* voltage to motors need to supply.
186-
*
187-
* @param speed
188-
* - the current lift speed (in/s)
189-
*/
190-
public double convertSpdToVoltage(double speed) {
191-
return 0;
192-
}
193182
}

0 commit comments

Comments
 (0)