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

Commit e32f958

Browse files
committed
cracked code that got us to worlds
1 parent 7c8943c commit e32f958

File tree

13 files changed

+43
-188
lines changed

13 files changed

+43
-188
lines changed

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

OspreyCode/src/main/java/org/firstinspires/ftc/teamcode/Controls.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public class Controls {
6969
public Stick driveLeftStick, driveRightStick;
7070
public CommandButton resetGyroButton, brakeButton;
7171

72-
public CommandButton[] strategy1Button, strategy2Button;
72+
public CommandButton strategy1Button, strategy2Button;
7373

7474
public Controls(Robot r, CommandGamepad driver, CommandGamepad codriver) {
7575
driverGamepad = driver;
@@ -100,8 +100,8 @@ public Controls(Robot r, CommandGamepad driver, CommandGamepad codriver) {
100100

101101
capUpButton = driverGamepad.start;
102102

103-
strategy1Button = new CommandButton[]{driverGamepad.start, codriverGamepad.start};
104-
strategy2Button = new CommandButton[]{driverGamepad.back, codriverGamepad.back};
103+
strategy1Button = driverGamepad.start;
104+
strategy2Button = driverGamepad.back;
105105

106106
RobotState.setStrategy(RobotState.AllianceHubStrategy.HIGH, RobotState.SharedHubStrategy.OWN);
107107

@@ -118,13 +118,10 @@ public void bindControls() {
118118
if (EXTENSION_ENABLED) bindExtensionControls();
119119
if (BRAKE_ENABLED) bindBrakeControls();
120120

121-
for (CommandButton c : strategy1Button) {
122-
c.whenPressed(RobotState::strategy1);
123-
}
124-
125-
for (CommandButton c : strategy2Button) {
126-
c.whenPressed(RobotState::strategy2);
127-
}
121+
strategy1Button.whenPressed(() -> RobotState.strategy1());
122+
codriverGamepad.start.whenPressed(() -> RobotState.strategy1());
123+
strategy2Button.whenPressed(() -> RobotState.strategy2());
124+
codriverGamepad.back.whenPressed(() -> RobotState.strategy2());
128125

129126

130127
}

OspreyCode/src/main/java/org/firstinspires/ftc/teamcode/Hardware2.java

Lines changed: 0 additions & 126 deletions
This file was deleted.

OspreyCode/src/main/java/org/firstinspires/ftc/teamcode/RobotConstants.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static class AutoRedConstants {
3434
public static ConfigurablePose DUCK_INTAKE_START = new ConfigurablePose(-30, -58, toRadians(145));
3535
public static ConfigurablePose DUCK_INTAKE_END = new ConfigurablePose(-60, -61, toRadians(35));
3636
public static ConfigurablePose SQUARE = new ConfigurablePose(-67, -36, toRadians(0));
37-
public static ConfigurablePose BARRIER_PARK = new ConfigurablePose(60, -30, toRadians(180));
37+
public static ConfigurablePose BARRIER_PARK = new ConfigurablePose(60, -30, toRadians(0));
3838

3939

4040
public static ConfigurablePose SHARED_TRENCH = new ConfigurablePose(64, -23, toRadians(90));
@@ -61,7 +61,7 @@ public static class AutoBlueConstants {
6161
public static ConfigurablePose DUCK_INTAKE_START = new ConfigurablePose(-30, 58, toRadians(-145));
6262
public static ConfigurablePose DUCK_INTAKE_END = new ConfigurablePose(-60, 61, toRadians(-35));
6363
public static ConfigurablePose SQUARE = new ConfigurablePose(-67, 36, toRadians(0));
64-
public static ConfigurablePose BARRIER_PARK = new ConfigurablePose(60, 30, toRadians(-180));
64+
public static ConfigurablePose BARRIER_PARK = new ConfigurablePose(60, 30, toRadians(0));
6565

6666
public static ConfigurablePose SHARED_TRENCH = new ConfigurablePose(64, 23, toRadians(-90));
6767
public static ConfigurablePose SHARED_HUB = new ConfigurablePose(64, 17, toRadians(-90));

OspreyCode/src/main/java/org/firstinspires/ftc/teamcode/commands/autonomous/AutoParkBarrierCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
public class AutoParkBarrierCommand extends SequentialCommandGroup {
1616
public AutoParkBarrierCommand(DrivebaseSubsystem drive, LiftSubsystem lift, ArmSubsystem deposit, ExtensionSubsystem extension){
1717
super(new DepositCollectCommand(deposit, extension, lift),
18-
new ConditionalCommand(()-> CommandScheduler.getInstance().getOpModeRuntime()>24),
18+
new ConditionalCommand(()-> CommandScheduler.getInstance().getOpModeRuntime()>26),
1919
new TrajectorySequenceCommand(drive, RobotConstants.HUB_BARRIER_PARK));
2020
}
2121
}

OspreyCode/src/main/java/org/firstinspires/ftc/teamcode/commands/cap/CapDownCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public CapDownCommand(CapSubsystem cap){
1515
@Override
1616
public void execute() {
1717
subsystem.down();
18-
subsystem.open();
18+
subsystem.close();
1919
}
2020

2121
@Override

OspreyCode/src/main/java/org/firstinspires/ftc/teamcode/commands/cap/CapOutCommand.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ public CapOutCommand(CapSubsystem cap){
1515
@Override
1616
public void execute() {
1717
subsystem.raise();
18+
if(getRuntime().seconds()>0.5) subsystem.raise2();
1819
}
1920

2021
@Override
2122
public boolean isFinished() {
22-
return getRuntime().seconds() >0.6;
23+
return getRuntime().seconds() >1;
2324
}
2425
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package org.firstinspires.ftc.teamcode.commands.lift;
2+
3+
import org.firstinspires.ftc.teamcode.subsystems.LiftSubsystem;
4+
5+
public class LiftLevel2TeleCommand extends LiftCommand {
6+
public LiftLevel2TeleCommand(LiftSubsystem l){
7+
super(l, LiftSubsystem.LiftConstants.TELEOP_LEVEL_2);
8+
}
9+
}

OspreyCode/src/main/java/org/firstinspires/ftc/teamcode/commands/lift/LiftLevelCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
public class LiftLevelCommand extends ChoiceCommand {
1515
public LiftLevelCommand(LiftSubsystem ls) {
1616
super(new Pair<>(()->getAllianceStrategy() == HIGH, new LiftLevel3Command(ls)),
17-
new Pair<>(()->getAllianceStrategy() == MID, new LiftLevel2Command(ls)));
17+
new Pair<>(()->getAllianceStrategy() == MID, new LiftLevel2TeleCommand(ls)));
1818
}
1919
}

OspreyCode/src/main/java/org/firstinspires/ftc/teamcode/controls.txt

Lines changed: 0 additions & 33 deletions
This file was deleted.

OspreyCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/CapSubsystem.java

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,29 @@
1515
public class CapSubsystem implements Subsystem, Supplier<String> {
1616
@Config
1717
public static class CapConstants {
18-
public static double TURRET_INIT = 0.7, TURRET_PICKUP = 0.1, TURRET_CAP = 0.5;
19-
public static double CLAW_OPEN = 0.1, CLAW_CLOSE = 0.6;
20-
public static double ARM_UP = 1, ARM_CAP = 0.85, ARM_INIT = 0.1, ARM_DOWN = 0.1;
18+
public static double TURRET_INIT = 0.8, TURRET_PICKUP = 0.1, TURRET_CARRY = 0.8, TURRET_CAP = 0.5;
19+
public static double CLAW_OPEN = 0.1, CLAW_CLOSE = 0.53;
20+
public static double ARM_UP = 1, ARM_CAP = 0.85, ARM_INIT = 0.4, ARM_DOWN = 0.05;
2121
public static ServoProfiler.Constraints ARM_CONSTRAINTS = new ServoProfiler.Constraints(5, 5, 5);
22+
public static ServoProfiler.Constraints TURRET_CONSTRAINTS = new ServoProfiler.Constraints(3, 2, 2);
23+
2224
}
2325
public Servo armServo;
2426
public Servo clawServo;
2527

2628
public Servo turretServo;
2729

2830
public ServoProfiler armProfiler;
31+
public ServoProfiler turretProfiler;
32+
2933

3034
public CapSubsystem(Servo arm, Servo claw, Servo turret){
3135
CommandScheduler.getInstance().register(this);
3236
armServo = arm;
3337
clawServo = claw;
3438
turretServo = turret;
3539
armProfiler = new ServoProfiler(armServo).setServoRange(0.4).setConstraints(ARM_CONSTRAINTS).setTargetPosition(ARM_INIT);
40+
turretProfiler = new ServoProfiler(turretServo).setConstraints(TURRET_CONSTRAINTS).setTargetPosition(TURRET_INIT);
3641
}
3742

3843
public void open(){
@@ -45,33 +50,35 @@ public void close(){
4550

4651
public void up(){
4752
armProfiler.setTargetPosition(ARM_UP);
48-
turretServo.setPosition(TURRET_CAP);
53+
turretProfiler.setTargetPosition(TURRET_CARRY);
4954
clawServo.setPosition(CLAW_CLOSE);
5055
}
5156
public void raise(){
5257
armProfiler.setTargetPosition(ARM_CAP);
53-
turretServo.setPosition(TURRET_CAP);
58+
}
59+
public void raise2(){
60+
turretProfiler.setTargetPosition(TURRET_CAP);
5461
}
5562
public void down(){
5663
armProfiler.setTargetPosition(ARM_DOWN);
57-
turretServo.setPosition(TURRET_PICKUP);
64+
turretProfiler.setTargetPosition(TURRET_PICKUP);
5865
}
5966
public void translateArm(double translation){
6067
armProfiler.translateTargetPosition(translation);
6168
}
6269
public void translateTurret(double translation){
63-
turretServo.incrementPosition(translation);
70+
turretProfiler.translateTargetPosition(translation);
6471
}
6572

6673
@Override
6774
public void periodic() {
68-
75+
turretProfiler.update();
6976
armProfiler.update();
7077
}
7178

7279
@Override
7380
public String get() {
74-
return "CLAW: "+clawServo.getPosition()+", ARM: "+armProfiler.getTargetPosition()+", TURRET: "+turretServo.getPosition();
81+
return "CLAW: "+clawServo.getPosition()+", ARM: "+armProfiler.getTargetPosition()+", TURRET: "+turretProfiler.getTargetPosition();
7582
}
7683

7784
}

OspreyCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/ExtensionSubsystem.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ public class ExtensionSubsystem implements Subsystem, Supplier<String> {
1414
@Config
1515
public static class ExtensionConstants {
1616
public static double SNAP_1 = 0, SNAP_2= Math.PI;
17-
public static double IN = 0.46, SHARED = 0.3, TELEOP_ALLIANCE = 0.35, STEAL_SHARED = 0.1, LOW_GOAL_AUTO = 0, OUT = 0;
18-
public static double LEFT = 0.2, CENTER = 0.5, RIGHT = 0.8, AUTO_LEFT = 0.25, AUTO_RIGHT = 0.75;
17+
public static double IN = 0.46, SHARED = 0.3, TELEOP_ALLIANCE = 0.35, STEAL_SHARED = 0.2, LOW_GOAL_AUTO = 0, OUT = 0;
18+
public static double LEFT = 0.1, CENTER = 0.5, RIGHT = 0.9, AUTO_LEFT = 0.25, AUTO_RIGHT = 0.75;
1919
}
2020

2121
public Servo slideServo;

OspreyCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/LiftSubsystem.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public static class LiftConstants {
2323
public static double LIFT_UPPER_LIMIT = 600.0;
2424
public static double LIFT_LOWER_LIMIT = 0.0;
2525
//300 for single slide
26-
public static double COLLECT = 0, NEUTRAL = 150, LEVEL_1 = 100, LEVEL_2 = 200, LEVEL_3 = 550;
26+
public static double COLLECT = 0, NEUTRAL = 150, LEVEL_1 = 100, LEVEL_2 = 200, TELEOP_LEVEL_2 = 150, LEVEL_3 = 550;
2727

2828
public static double DEADZONE = 10;
2929

0 commit comments

Comments
 (0)