Skip to content

Commit d7ae2d9

Browse files
TechnototesLaptopkevinfrei
authored andcommitted
I kinda added the angle of launching
1 parent 58a0c57 commit d7ae2d9

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

Hoops/src/main/java/org/firstinspires/ftc/hoops/subsystems/LauncherSubsystem.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ public class LauncherSubsystem {
1212

1313
public static double MAX_MOTOR_VELOCITY = 1.0;
1414

15-
boolean hasHardware;
15+
public static double MIN_MOTOR_VELOCITY = 0.25;
1616

17+
boolean hasHardware;
1718
EncodedMotor<DcMotorEx> top;
1819
EncodedMotor<DcMotorEx> bottom;
1920

@@ -38,8 +39,16 @@ public void Launch(double angleInDegrees) {
3839
// Spin the motors
3940
// TODO: make the motors spit the thing at the right angle
4041
if (hasHardware) {
41-
top.setVelocity(MAX_MOTOR_VELOCITY);
42-
bottom.setVelocity(MAX_MOTOR_VELOCITY);
42+
if (angleInDegrees > 0) {
43+
top.setVelocity(MAX_MOTOR_VELOCITY);
44+
bottom.setVelocity(MIN_MOTOR_VELOCITY);
45+
} else if (angleInDegrees < 0) {
46+
top.setVelocity(MIN_MOTOR_VELOCITY);
47+
bottom.setVelocity(MAX_MOTOR_VELOCITY);
48+
} else {
49+
top.setVelocity(MAX_MOTOR_VELOCITY);
50+
bottom.setVelocity(MAX_MOTOR_VELOCITY);
51+
}
4352
}
4453
}
4554

0 commit comments

Comments
 (0)