pathplanner icon indicating copy to clipboard operation
pathplanner copied to clipboard

Ability to set the Pose of the drivebase on the autobuilder, with mirroring capabilities.

Open blaze-developer opened this issue 10 months ago • 0 comments

Right now, if I want to set the drivebase to be at the initial pose in a path, I have to do something like this:

public static Command initialFollowPathCommand(Drive drive, String pathName, boolean mirroredX) {
    Optional<PathPlannerPath> path = findPath(pathName, mirroredX);

    if (path.isPresent()) {
      PathPlannerPath initPosePath = path.get();
      Alliance alliance = DriverStation.getAlliance().orElse(Alliance.Blue);

      if (alliance == Alliance.Red) {
        initPosePath = path.get().flipPath();
      }

      if (initPosePath.getStartingHolonomicPose().isEmpty()) {
        return Commands.none();
      }

      return Commands.sequence(
        setPoseCommand(
          drive,
          initPosePath.getStartingHolonomicPose().orElseThrow()
        ),
        AutoBuilder.followPath(path.get())
      );
    }

    return Commands.none();
}

Manually checking the alliance for setting the initial pose seems like it shouldn't be required, considering the many other forms of mirroring that this library does for you. Am I doing something wrong, or should something like this become a feature?

Thanks!

blaze-developer avatar Feb 09 '25 04:02 blaze-developer