File tree Expand file tree Collapse file tree 1 file changed +15
-10
lines changed
src/main/java/frc/robot/subsystems Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -13,24 +13,29 @@ public class Elevator extends SubsystemBase {
13
13
public Elevator () {
14
14
elevator = new Neo (9 );
15
15
elevator .setPID (0.1 , 0 , 0 ); // 😳
16
+ elevator .setSoftLimit (null , 0 );
16
17
}
17
18
18
19
@ Override
19
20
public void periodic () {
20
21
// CommandScheduler.getInstance().run(); //This method will be called once per scheduler run
21
22
}
22
23
23
-
24
- public Command motionUp (){
25
- return runOnce (() -> elevator .set (0.5 ));
24
+ private Command moveUpOrDown (boolean goingUp ) {
25
+ elevator .getPosition ();
26
+ if (goingUp ) {
27
+ return runOnce (() -> elevator .setPosition (0.8 ));
28
+ }
29
+ else {
30
+ return runOnce (() -> elevator .set (0 ));
31
+ }
26
32
}
27
-
28
- public Command motionDown () {
29
- return runOnce (() -> elevator . set (- 0.5 ) );
33
+
34
+ public Command motionUp () {
35
+ return moveUpOrDown ( true );
30
36
}
31
- public void limits (){
32
- double maxlimit = elevator . setrotation ( 0.8 );
33
- double minlimit = elevator . setrotation ( 1.0 );
37
+
38
+ public Command motionDown () {
39
+ return moveUpOrDown ( false );
34
40
}
35
-
36
41
}
You can’t perform that action at this time.
0 commit comments