|
18 | 18 | import edu.wpi.first.math.trajectory.TrapezoidProfile; |
19 | 19 | import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; |
20 | 20 | import edu.wpi.first.wpilibj2.command.Command; |
| 21 | +import edu.wpi.first.wpilibj2.command.Commands; |
21 | 22 | import edu.wpi.first.wpilibj2.command.SubsystemBase; |
22 | 23 | import frc.robot.Constants.IntakeConstants; |
23 | 24 | import java.util.function.DoubleSupplier; |
@@ -50,73 +51,27 @@ public Deploy() { |
50 | 51 | SmartDashboard.putNumber("INTAKE/Deploy Encoder", deployEncoder.getPosition()); |
51 | 52 |
|
52 | 53 | deployEncoder.setPosition(1); |
53 | | - SmartDashboard.putNumber("INTAKE/kS", IntakeConstants.kS); |
54 | | - SmartDashboard.putNumber("INTAKE/kG", IntakeConstants.kG); |
55 | | - SmartDashboard.putNumber("INTAKE/kV", IntakeConstants.kV); |
56 | | - SmartDashboard.putNumber("INTAKE/kP", IntakeConstants.kP); |
57 | | - SmartDashboard.putNumber("INTAKE/kI", IntakeConstants.kI); |
58 | | - SmartDashboard.putNumber("INTAKE/kD", IntakeConstants.kD); |
59 | 54 | SmartDashboard.putNumber("INTAKE/rest speed", rest); |
60 | 55 | } |
61 | 56 |
|
62 | | - // private Command runCMD(double voltage) { |
63 | | - // return run( |
64 | | - // () -> { |
65 | | - // deployMotor.set(speed); |
66 | | - // }); |
67 | | - // } |
68 | | - // Adds start and stop for deploying |
69 | 57 | public Command deployCMD() { |
70 | 58 | return run( |
71 | 59 | () -> { |
72 | | - deployMotor.set( |
73 | | - controller.calculate( |
74 | | - deployEncoder.getPosition(), IntakeConstants.DEPLOY_POSITION.in(Radians))); |
| 60 | + deployMotor.set(0.2); |
75 | 61 | }); |
76 | | - |
77 | | - // // Deploys fuel |
78 | | - // return Commands.sequence( |
79 | | - // Commands.runOnce( |
80 | | - // () -> { |
81 | | - // closedLoopController.setSetpoint( |
82 | | - // IntakeConstants.DEPLOY_POSITION.in(Radians), ControlType.kPosition); |
83 | | - // }, this), |
84 | | - // Commands.waitUntil(closedLoopController::isAtSetpoint), |
85 | | - // Commands.runOnce(() -> deployMotor.set(rest))) |
86 | | - // .withName("Deployed"); |
87 | | - } |
88 | | - |
89 | | - public Command readyCMD() { |
90 | | - return run( |
91 | | - () -> { |
92 | | - deployMotor.set( |
93 | | - controller.calculate( |
94 | | - deployEncoder.getPosition(), IntakeConstants.READY_POSITION.in(Radians))); |
95 | | - }); |
96 | | - |
97 | | - // return Commands.runOnce( |
98 | | - // () -> { |
99 | | - // closedLoopController.setSetpoint( |
100 | | - // IntakeConstants.READY_POSITION.in(Radians), ControlType.kPosition); |
101 | | - // }, this) |
102 | | - // .withName("Ready"); |
103 | | - |
104 | 62 | } |
105 | 63 |
|
106 | 64 | public Command undeployCMD() { |
107 | | - return run( |
| 65 | + return Commands.sequence( |
| 66 | + Commands.runOnce( |
108 | 67 | () -> { |
109 | | - deployMotor.set( |
110 | | - controller.calculate( |
111 | | - deployEncoder.getPosition(), IntakeConstants.UP_POSITION.in(Radians))); |
112 | | - }); |
| 68 | + deployMotor.set(-0.3); |
| 69 | + }), |
| 70 | + Commands.waitSeconds(0.5), |
| 71 | + Commands.runOnce(() -> { |
| 72 | + deployMotor.set(-0.02); |
| 73 | + })); |
113 | 74 |
|
114 | | - // return Commands.run( |
115 | | - // () -> { |
116 | | - // closedLoopController.setSetpoint( |
117 | | - // IntakeConstants.UP_POSITION.in(Radians), ControlType.kPosition); |
118 | | - // }, this) |
119 | | - // .withName("Retracted"); |
120 | 75 | } |
121 | 76 |
|
122 | 77 | public Command mannualCMD(DoubleSupplier speed) { |
|
0 commit comments