driveToPose Method from YAGSL Example Code Not Rotating Fully

I’m using the example code in YAGSL to follow a path. The path is followed but the robot seemingly stops rotating once it reaches the correct translation.

Here is the driveToPose method:

public Command driveToPose(Pose2d pose)
  {
// Create the constraints to use while pathfinding
    PathConstraints constraints = new PathConstraints(
        swerveDrive.getMaximumVelocity(), 4.0,
        swerveDrive.getMaximumAngularVelocity(), Units.degreesToRadians(720));

// Since AutoBuilder is configured, we can use it to build pathfinding commands
    return AutoBuilder.pathfindToPose(
        pose,
        constraints,
        0.0, // Goal end velocity in meters/sec
        0.0 // Rotation delay distance in meters. This is how far the robot should travel before attempting to rotate.
                                     );
  }

Here are the two ways I’m calling it:

    drivetrain.driveToPose(
      new Pose2d(
        new Translation2d(
          0,
          0
        ),
        new Rotation2d(
          Math.PI
        )
      )
    )
drivetrain.driveToPose(
      new Pose2d(
        new Translation2d(
          1,
          0
        ),
        new Rotation2d(
          Math.PI
        )
      )
    )

The first one, with just rotation and no translation2D, the robot doesn’t do anything. The second one, the robot moves to the translation and rotates but once it reaches the right translation, it stops rotating and doesn’t fully reach PI in rotation.

Is there some kind of option somewhere for me to tick to have the robot continue to rotate or am I using the library wrong, or is it something else?

Thanks in advance! :smile:

After more googling I have figured out that rotation in place is not what pathplanner is meant for

1 Like

Yerp, but the function is a nice thing to have :slight_smile: if you make a rotateInPlace command function and chain the 2 together and PR it to YAGSL-Example dev branch I will merge it to main.

I may or may not get around to it. It is fairly easy to do though

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.