Skip to content

Commit

Permalink
refactor: changed terminology
Browse files Browse the repository at this point in the history
  • Loading branch information
WeilSimon committed Feb 11, 2024
1 parent e31f36b commit 71034cb
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 11 deletions.
9 changes: 9 additions & 0 deletions src/main/deploy/choreo/AmpLanePABCSprint.1.traj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/main/deploy/choreo/AmpLanePABCSprint.2.traj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/main/deploy/choreo/AmpLanePABCSprint.3.traj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/main/deploy/choreo/AmpLanePABCSprint.4.traj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/main/deploy/choreo/SourceLanePHGFSprint.1.traj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/main/deploy/choreo/SourceLanePHGFSprint.2.traj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/main/deploy/choreo/SourceLanePHGFSprint.3.traj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/main/deploy/choreo/SourceLanePHGFSprint.4.traj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions src/main/java/org/team1540/robot2024/util/AutoCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class AutoCommand extends SequentialCommandGroup {

private List<PathHelper> paths = new ArrayList<>();

private int index = 0;
private int pathIndex = 0;

public AutoCommand(String name){
this.name = name;
Expand Down Expand Up @@ -52,16 +52,16 @@ public List<PathHelper> getPaths() {
return paths;
}

public PathHelper getPath(int index){
return paths.get(index);
public PathHelper getPath(int pathIndex){
return paths.get(pathIndex);
}
public PathHelper getNextPath(){
return getPath(index++);
return getPath(pathIndex++);
}
public int getIndex(){
return index;
public int getPathIndex(){
return pathIndex;
}
public void setIndex(int index){
this.index = index;
public void setPathIndex(int index){
this.pathIndex = index;
}
}
6 changes: 3 additions & 3 deletions src/main/java/org/team1540/robot2024/util/PathHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ public PathPlannerPath getPath() {

public Command getCommand(Drivetrain drivetrain, boolean shouldRealign) {
BooleanSupplier shouldFlip = () -> DriverStation.getAlliance().orElse(null) == DriverStation.Alliance.Red;
Supplier<Pose2d> flippedInitialPose = () -> shouldFlip.getAsBoolean() ? GeometryUtil.flipFieldPose(initialPose) : initialPose;
Supplier<Pose2d> startingPose = () -> shouldFlip.getAsBoolean() ? GeometryUtil.flipFieldPose(initialPose) : initialPose;
Command command = new ConditionalCommand(
AutoBuilder.pathfindThenFollowPath(path, constraints),
AutoBuilder.followPath(path),
() -> drivetrain.getPose().getTranslation().getDistance((flippedInitialPose.get()).getTranslation()) > 1 && shouldRealign); //TODO tune this distance
Command resetCommand = new InstantCommand(() -> drivetrain.setPose(flippedInitialPose.get()));
() -> drivetrain.getPose().getTranslation().getDistance((startingPose.get()).getTranslation()) > 1 && shouldRealign); //TODO tune this distance
Command resetCommand = new InstantCommand(() -> drivetrain.setPose(startingPose.get()));
return isResetting ? resetCommand.andThen(command) : command;
}

Expand Down

0 comments on commit 71034cb

Please sign in to comment.