-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switched some commands to the new version so the students have examples
- Loading branch information
Kevin Frei
committed
Sep 16, 2024
1 parent
92cf769
commit 128db2f
Showing
29 changed files
with
211 additions
and
331 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...n750/src/main/java/org/firstinspires/ftc/sixteen750/commands/driving/DrivingCommands.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package org.firstinspires.ftc.sixteen750.commands.driving; | ||
|
||
import com.technototes.library.command.Command; | ||
import org.firstinspires.ftc.sixteen750.subsystems.DrivebaseSubsystem; | ||
|
||
public class DrivingCommands { | ||
|
||
public static Command NormalDriving(DrivebaseSubsystem ds) { | ||
return Command.create(ds::setNormalMode); | ||
} | ||
|
||
public static Command SnailDriving(DrivebaseSubsystem ds) { | ||
return Command.create(ds::setSnailMode); | ||
} | ||
|
||
public static Command TurboDriving(DrivebaseSubsystem ds) { | ||
return Command.create(ds::setTurboMode); | ||
} | ||
|
||
public static Command NormalSpeed(DrivebaseSubsystem ds) { | ||
return Command.create(ds::auto); | ||
} | ||
|
||
public static Command SlowSpeed(DrivebaseSubsystem ds) { | ||
return Command.create(ds::slow); | ||
} | ||
|
||
public static Command FastSpeed(DrivebaseSubsystem ds) { | ||
return Command.create(ds::fast); | ||
} | ||
|
||
public static Command ResetGyro(DrivebaseSubsystem ds) { | ||
return Command.create(ds::setExternalHeading, 0.0); | ||
} | ||
|
||
public static Command RecordHeading(DrivebaseSubsystem drive) { | ||
return Command.create(drive::saveHeading); | ||
} | ||
} |
18 changes: 0 additions & 18 deletions
18
...50/src/main/java/org/firstinspires/ftc/sixteen750/commands/driving/NormalModeCommand.java
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
...750/src/main/java/org/firstinspires/ftc/sixteen750/commands/driving/ResetGyroCommand.java
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
Sixteen750/src/main/java/org/firstinspires/ftc/sixteen750/commands/driving/SlowCommand.java
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
...750/src/main/java/org/firstinspires/ftc/sixteen750/commands/driving/SnailModeCommand.java
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
Sixteen750/src/main/java/org/firstinspires/ftc/sixteen750/commands/driving/TurboCommand.java
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
...750/src/main/java/org/firstinspires/ftc/sixteen750/commands/driving/TurboModeCommand.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
Sixteen750/src/main/java/org/firstinspires/ftc/sixteen750/helpers/HeadingHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package org.firstinspires.ftc.sixteen750.helpers; | ||
|
||
import org.firstinspires.ftc.robotcontroller.internal.FtcRobotControllerActivity; | ||
|
||
public class HeadingHelper { | ||
|
||
public double headingUpdateTime; | ||
public double lastHeading; | ||
public double lastXPosition; | ||
public double lastYPosition; | ||
|
||
public HeadingHelper(double lastX, double lastY, double heading) { | ||
headingUpdateTime = System.currentTimeMillis() / 1000.0; | ||
lastXPosition = lastX; | ||
lastYPosition = lastY; | ||
lastHeading = heading; | ||
} | ||
|
||
public static void saveHeading(double x, double y, double h) { | ||
FtcRobotControllerActivity.SaveBetweenRuns = new HeadingHelper(x, y, h); | ||
} | ||
|
||
public static void clearSavedInfo() { | ||
FtcRobotControllerActivity.SaveBetweenRuns = null; | ||
} | ||
|
||
public static boolean validHeading() { | ||
HeadingHelper hh = (HeadingHelper) FtcRobotControllerActivity.SaveBetweenRuns; | ||
if (hh == null) { | ||
return false; | ||
} | ||
double now = System.currentTimeMillis() / 1000.0; | ||
return now < hh.headingUpdateTime + 45; | ||
} | ||
|
||
public static double getSavedHeading() { | ||
HeadingHelper hh = (HeadingHelper) FtcRobotControllerActivity.SaveBetweenRuns; | ||
if (hh != null) { | ||
return hh.lastHeading; | ||
} | ||
return 0.0; | ||
} | ||
|
||
public static double getSavedX() { | ||
HeadingHelper hh = (HeadingHelper) FtcRobotControllerActivity.SaveBetweenRuns; | ||
if (hh != null) { | ||
return hh.lastXPosition; | ||
} | ||
return 0.0; | ||
} | ||
|
||
public static double getSavedY() { | ||
HeadingHelper hh = (HeadingHelper) FtcRobotControllerActivity.SaveBetweenRuns; | ||
if (hh != null) { | ||
return hh.lastYPosition; | ||
} | ||
return 0.0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.