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

Commit e20ff8e

Browse files
committed
ryan tang finished commands for deposit
1 parent 22f0acd commit e20ff8e

File tree

8 files changed

+114
-8
lines changed

8 files changed

+114
-8
lines changed

TechnoOneCode/src/main/java/org/firstinspires/ftc/teamcode/commands/deposit/CarryCommand.java

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
public class CarryCommand extends DumpVariableCommand {
66
public CarryCommand(DepositSubsystem s){
7+
78
super(s, DepositSubsystem.DepositConstants.CARRY);
89
}
910
@Override

TechnoOneCode/src/main/java/org/firstinspires/ftc/teamcode/commands/deposit/DumpCommand.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ public DumpCommand(DepositSubsystem s){
1010
}
1111
@Override
1212
public boolean isFinished() {
13-
return getRuntime().seconds()>0.5;
13+
return getRuntime().seconds() > 0.5;
1414
}
1515
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,24 @@
11
package org.firstinspires.ftc.teamcode.commands.deposit;
22

3-
public class ArmExtendCommand {
3+
import com.technototes.library.command.Command;
4+
5+
import org.firstinspires.ftc.teamcode.subsystems.DepositSubsystem;
6+
7+
public class ArmExtendCommand implements Command {
8+
public DepositSubsystem subsystem;
9+
public ArmExtendCommand(DepositSubsystem s) {
10+
subsystem = s;
11+
addRequirements(s);
12+
}
13+
14+
@Override
15+
public void execute() {
16+
subsystem.fullyOut();
17+
subsystem.collect();
18+
}
19+
20+
@Override
21+
public boolean isFinished() {
22+
return getRuntime().seconds() > 1;
23+
}
424
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,25 @@
11
package org.firstinspires.ftc.teamcode.commands.deposit;
22

3-
public class ArmTranslateCommand {
3+
import com.technototes.library.command.Command;
4+
5+
import org.firstinspires.ftc.teamcode.subsystems.DepositSubsystem;
6+
7+
public class ArmTranslateCommand implements Command {
8+
public DepositSubsystem subsystem;
9+
public double amount;
10+
public ArmTranslateCommand(DepositSubsystem s, double amt) {
11+
subsystem = s;
12+
amount = amt;
13+
addRequirements(s);
14+
}
15+
16+
@Override
17+
public void execute() {
18+
subsystem.translateExtension(amount);
19+
}
20+
21+
@Override
22+
public boolean isFinished() {
23+
return getRuntime().seconds() > 0.1;
24+
}
425
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
package org.firstinspires.ftc.teamcode.commands.deposit;
22

3-
public class CarryCommand {
3+
import org.firstinspires.ftc.teamcode.subsystems.DepositSubsystem;
4+
5+
public class CarryCommand extends DumpVariableCommand {
6+
public CarryCommand(DepositSubsystem s) {
7+
super(s, DepositSubsystem.DepositConstants.CARRY); // good
8+
9+
}
10+
11+
@Override
12+
public boolean isFinished() {
13+
return true;
14+
}
415
}
16+
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
package org.firstinspires.ftc.teamcode.commands.deposit;
22

3-
public class CollectCommand {
3+
import org.firstinspires.ftc.teamcode.subsystems.DepositSubsystem;
4+
5+
public class CollectCommand extends DumpVariableCommand {
6+
public CollectCommand(DepositSubsystem s) {
7+
super(s, DepositSubsystem.DepositConstants.COLLECT); // yes very good
8+
}
9+
10+
@Override
11+
public boolean isFinished() {
12+
return true; // ask alex about this
13+
}
414
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
package org.firstinspires.ftc.teamcode.commands.deposit;
22

3-
public class DumpCommand {
4-
}
3+
import org.firstinspires.ftc.teamcode.subsystems.DepositSubsystem;
4+
5+
public class DumpCommand extends DumpVariableCommand {
6+
// no member variables because idk its already extending idk
7+
public DumpCommand(DepositSubsystem s) {
8+
super(s, DepositSubsystem.DepositConstants.DUMP); // yes work
9+
}
10+
11+
@Override
12+
public boolean isFinished() {
13+
return getRuntime().seconds() > 0.5;
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,35 @@
11
package org.firstinspires.ftc.teamcode.commands.deposit;
22

3-
public class DumpVariableCommand {
3+
import com.technototes.library.command.Command;
4+
5+
import org.firstinspires.ftc.teamcode.subsystems.DepositSubsystem;
6+
7+
import java.util.function.DoubleSupplier;
8+
9+
public class DumpVariableCommand implements Command {
10+
public DepositSubsystem subsystem;
11+
public DoubleSupplier supplier;
12+
public DumpVariableCommand(DepositSubsystem s, DoubleSupplier pos) {
13+
subsystem = s;
14+
supplier = pos;
15+
addRequirements(s);
16+
}
17+
public DumpVariableCommand(DepositSubsystem s, double pos) {
18+
this(s, ()->pos);
19+
}
20+
@Override
21+
public void execute() {
22+
subsystem.setDump(supplier.getAsDouble());
23+
}
24+
25+
@Override
26+
public boolean isFinished() {
27+
return false;
28+
}
29+
30+
@Override
31+
public void end(boolean cancel) {
32+
if (cancel)
33+
subsystem.carry();
34+
}
435
}

0 commit comments

Comments
 (0)