Skip to content

Commit

Permalink
Add end conditions to following points
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahsnider committed Nov 19, 2024
1 parent 23bf6a3 commit f18a684
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.
11 changes: 6 additions & 5 deletions src/main/java/frc/robot/autos/trailblazer/Trailblazer.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,12 @@ public Command followSegment(AutoSegment segment) {
private Command followPoint(AutoPoint point, List<AutoPointConstraint> segmentConstraints) {
return point.command.alongWith(
Commands.run(
() -> {
var constrainedVelocityGoal = getSwerveSetpoint(point, segmentConstraints);
swerve.setFieldRelativeAutoSpeeds(constrainedVelocityGoal);
},
swerve));
() -> {
var constrainedVelocityGoal = getSwerveSetpoint(point, segmentConstraints);
swerve.setFieldRelativeAutoSpeeds(constrainedVelocityGoal);
},
swerve)
.until(() -> pathTracker.isFinished(point)));
}

private ChassisSpeeds getSwerveSetpoint(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import frc.robot.autos.trailblazer.AutoPoint;
import java.util.List;

// TODO: Implement https://github.com/team581/2024-offseason-bot/issues/94
public class HeuristicPathTracker implements PathTracker {
private List<AutoPoint> points = List.of();

Expand All @@ -15,7 +16,11 @@ public void resetAndSetPoints(List<AutoPoint> points) {

@Override
public Pose2d getTargetPose(Pose2d currentPose, ChassisSpeeds currentFieldRelativeRobotSpeeds) {
// TODO: Implement https://github.com/team581/2024-offseason-bot/issues/94
return currentPose;
return null;
}

@Override
public boolean isFinished(AutoPoint point) {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,12 @@ public interface PathTracker {
* @return
*/
public Pose2d getTargetPose(Pose2d currentPose, ChassisSpeeds currentFieldRelativeRobotSpeeds);

/**
* Check whether the robot has finished following the given point.
*
* @param point The point to check.
* @return Whether the robot has finished following the given point.
*/
public boolean isFinished(AutoPoint point);
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,9 @@ public void resetAndSetPoints(List<AutoPoint> points) {}
public Pose2d getTargetPose(Pose2d currentPose, ChassisSpeeds currentFieldRelativeRobotSpeeds) {
return null;
}

@Override
public boolean isFinished(AutoPoint point) {
return false;
}
}

0 comments on commit f18a684

Please sign in to comment.