Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ForTeaching/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ android {
dependencies {
implementation project(':FtcRobotController')
// Uncomment this to use a local version of TechnoLib
// implementation project(':RobotLibrary') // FLIP: TechnoLibLocal
// implementation project(':Path') // FLIP: TechnoLibLocal
// implementation project(':Vision') // FLIP: TechnoLibLocal
implementation project(':RobotLibrary') // FLIP: TechnoLibLocal
implementation project(':Path') // FLIP: TechnoLibLocal
implementation project(':Vision') // FLIP: TechnoLibLocal
annotationProcessor files('lib/OpModeAnnotationProcessor.jar')
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package org.firstinspires.ftc.forteaching.TechnoBot.Commands;

import com.technototes.library.command.SimpleCommand;
import com.technototes.library.command.SimpleRequiredCommand;

import org.firstinspires.ftc.forteaching.TechnoBot.Subsystems.ClawSubsystem;
import org.firstinspires.ftc.forteaching.TechnoBot.Subsystems.LiftSubsystem;
import org.firstinspires.ftc.forteaching.TechnoBot.Subsystems.MotorAsServoSubsystem;
import org.firstinspires.ftc.forteaching.TechnoBot.Subsystems.MovementTestingSubsystem;

public class Commands {
public static class Claw {
public static SimpleRequiredCommand<ClawSubsystem> open(ClawSubsystem clawSubsystem) {
return new SimpleRequiredCommand<>(clawSubsystem, ClawSubsystem::open);
}
public static SimpleRequiredCommand<ClawSubsystem> close(ClawSubsystem clawSubsystem) {
return new SimpleRequiredCommand<>(clawSubsystem, ClawSubsystem::close);
}
}

public static class Lift {
public static SimpleRequiredCommand<LiftSubsystem> moveUp(LiftSubsystem lift) {
return new SimpleRequiredCommand<>(lift, LiftSubsystem::moveUp);
}
public static SimpleRequiredCommand<LiftSubsystem> moveDown(LiftSubsystem lift) {
return new SimpleRequiredCommand<>(lift, LiftSubsystem::moveUp);
}
}

public static class MotorAsServo {
public static SimpleRequiredCommand<MotorAsServoSubsystem> increaseEncMotor(MotorAsServoSubsystem m) {
return new SimpleRequiredCommand<>(m, MotorAsServoSubsystem::increaseEncMotor);
}
public static SimpleRequiredCommand<MotorAsServoSubsystem> decreaseEncMotor(MotorAsServoSubsystem m) {
return new SimpleRequiredCommand<>(m, MotorAsServoSubsystem::decreaseEncMotor);
}
public static SimpleRequiredCommand<MotorAsServoSubsystem> stop(MotorAsServoSubsystem m) {
return new SimpleRequiredCommand<>(m, MotorAsServoSubsystem::stop);
}
public static SimpleRequiredCommand<MotorAsServoSubsystem> halt(MotorAsServoSubsystem m) {
return new SimpleRequiredCommand<>(m, MotorAsServoSubsystem::halt);
}
}

public static class MovementTesting {
public static SimpleRequiredCommand<MovementTestingSubsystem> incMotorSpeed(MovementTestingSubsystem m) {
return new SimpleRequiredCommand<>(m, MovementTestingSubsystem::increaseMotorSpeed);
}
public static SimpleRequiredCommand<MovementTestingSubsystem> decMotorSpeed(MovementTestingSubsystem m) {
return new SimpleRequiredCommand<>(m, MovementTestingSubsystem::decreaseMotorSpeed);
}
public static SimpleRequiredCommand<MovementTestingSubsystem> incServoSpeed(MovementTestingSubsystem m) {
return new SimpleRequiredCommand<>(m, MovementTestingSubsystem::increaseServoMotor);
}
public static SimpleRequiredCommand<MovementTestingSubsystem> decServoSpeed(MovementTestingSubsystem m) {
return new SimpleRequiredCommand<>(m, MovementTestingSubsystem::decreaseServoMotor);
}
public static SimpleCommand neutralMotorSpeed(MovementTestingSubsystem m) {
return new SimpleCommand(m::neutralMotorSpeed);
}
public static SimpleCommand neutralServoSpeed(MovementTestingSubsystem m) {
return new SimpleCommand(m::neutralServoMotor);
}
public static SimpleCommand brakeMotor(MovementTestingSubsystem m) {
return new SimpleCommand(m::brakeMotor);
}
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,9 @@
import com.technototes.library.control.CommandGamepad;
import com.technototes.library.control.Stick;
import com.technototes.library.util.Alliance;
import org.firstinspires.ftc.forteaching.TechnoBot.Commands.CloseClawCommand;
import org.firstinspires.ftc.forteaching.TechnoBot.Commands.LiftDownCommand;
import org.firstinspires.ftc.forteaching.TechnoBot.Commands.LiftUpCommand;

import org.firstinspires.ftc.forteaching.TechnoBot.Commands.Commands;
import org.firstinspires.ftc.forteaching.TechnoBot.Commands.MecDriveCommand;
import org.firstinspires.ftc.forteaching.TechnoBot.Commands.OpenClawCommand;
import org.firstinspires.ftc.forteaching.TechnoBot.Commands.Operations;
import org.firstinspires.ftc.forteaching.TechnoBot.Commands.TestEncodedMotorCommand;
import org.firstinspires.ftc.forteaching.TechnoBot.Commands.TestMotorCommand;
import org.firstinspires.ftc.forteaching.TechnoBot.Commands.TestServoCommand;

public class Controls {

Expand Down Expand Up @@ -94,65 +88,52 @@ public Controls(CommandGamepad gpad, TheBot bot, Alliance ally) {
}

public void bindClawControls() {
openClaw.whenPressed(new OpenClawCommand(robot.clawSubsystem));
closeClaw.whenPressed(new CloseClawCommand(robot.clawSubsystem));
openClaw.whenPressed(Commands.Claw.open(robot.clawSubsystem));
closeClaw.whenPressed(Commands.Claw.close(robot.clawSubsystem));
}

public void bindLiftControls() {
liftUp.whenPressed(new LiftUpCommand(robot.liftSubsystem));
liftDown.whenPressed(new LiftDownCommand(robot.liftSubsystem));
liftUp.whenPressed(Commands.Lift.moveUp(robot.liftSubsystem));
liftDown.whenPressed(Commands.Lift.moveDown(robot.liftSubsystem));
}

// Joysticks require a "scheduleJoystick" thing, so the commands are invoked all the time
private void bindDrivebaseControls() {
CommandScheduler
.getInstance()
.scheduleJoystick(
// new TankDriveCommand(robot.tankDriveBase, leftTankStick, rightTankStick, snapToAngle)
new MecDriveCommand(robot.mecanumDrivebase, leftMecDriveStick, rightMecDriveStick)
);
}

// Silly helpers to make the code more succinct below
private TestEncodedMotorCommand MakeEncCommand(Operations op) {
return new TestEncodedMotorCommand(robot.encodedMotorSubsystem, op);
}

private TestMotorCommand MakeMotorCommand(Operations op) {
return new TestMotorCommand(robot.movementTestingSubsystem, op);
}

private TestServoCommand MakeServoCommand(Operations op) {
return new TestServoCommand(robot.movementTestingSubsystem, op);
.scheduleJoystick(
// new TankDriveCommand(robot.tankDriveBase, leftTankStick, rightTankStick, snapToAngle)
new MecDriveCommand(robot.mecanumDrivebase, leftMecDriveStick, rightMecDriveStick)
);
}

private void bindTesterControls() {
encMotorTestUp.whenPressed(MakeEncCommand(Operations.Increase));
encMotorTestDown.whenPressed(MakeEncCommand(Operations.Decrease));
encMotorTestUp.whenPressed(Commands.MotorAsServo.increaseEncMotor(robot.encodedMotorSubsystem));
encMotorTestDown.whenPressed(Commands.MotorAsServo.decreaseEncMotor(robot.encodedMotorSubsystem));

motorTestUp.whenPressed(MakeMotorCommand(Operations.Increase));
motorTestDown.whenPressed(MakeMotorCommand(Operations.Decrease));
motorTestUp.whenPressed(Commands.MovementTesting.incMotorSpeed(robot.movementTestingSubsystem));
motorTestDown.whenPressed(Commands.MovementTesting.decMotorSpeed(robot.movementTestingSubsystem));

servoTestUp.whenPressed(MakeServoCommand(Operations.Increase));
servoTestDown.whenPressed(MakeServoCommand(Operations.Decrease));
servoTestUp.whenPressed(Commands.MovementTesting.incServoSpeed(robot.movementTestingSubsystem));
servoTestDown.whenPressed(Commands.MovementTesting.decServoSpeed(robot.movementTestingSubsystem));

// For this stuff, ParallelCommandGroups or SequentialCommandGroups both work the same
// For command that take "time" you parallel command groups (as they will run at the same
// time as the other commands) but if you want "do A, then do B, then do C" you should
// use a sequential command group
stop.whenPressed(
new ParallelCommandGroup(
MakeEncCommand(Operations.Stop),
MakeMotorCommand(Operations.Stop),
MakeServoCommand(Operations.Stop)
)
new ParallelCommandGroup(
Commands.MovementTesting.neutralMotorSpeed(robot.movementTestingSubsystem),
Commands.MovementTesting.neutralServoSpeed(robot.movementTestingSubsystem),
Commands.MotorAsServo.stop(robot.encodedMotorSubsystem)
)
);
halt.whenPressed(
new ParallelCommandGroup(
MakeMotorCommand(Operations.Halt),
MakeEncCommand(Operations.Halt),
MakeServoCommand(Operations.Halt)
)
new ParallelCommandGroup(
Commands.MovementTesting.brakeMotor(robot.movementTestingSubsystem),
Commands.MovementTesting.neutralServoSpeed(robot.movementTestingSubsystem),
Commands.MotorAsServo.halt(robot.encodedMotorSubsystem)
)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void uponInit() {
controls = new Controls(driverGamepad, robot, Alliance.RED);

if (TheBot.Connected.Camera) CommandScheduler
.getInstance()

.scheduleInit(new VisionCommand(robot.visionSystem, Alliance.RED));
}
}
6 changes: 3 additions & 3 deletions Sixteen750/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ android {
dependencies {
implementation project(':FtcRobotController')
// Uncomment this to use a local version of TechnoLib
// implementation project(':RobotLibrary') // FLIP: TechnoLibLocal
// implementation project(':Path') // FLIP: TechnoLibLocal
// implementation project(':Vision') // FLIP: TechnoLibLocal
implementation project(':RobotLibrary') // FLIP: TechnoLibLocal
implementation project(':Path') // FLIP: TechnoLibLocal
implementation project(':Vision') // FLIP: TechnoLibLocal
annotationProcessor files('lib/OpModeAnnotationProcessor.jar')
}
Loading