PathPlanner onTheFly pathing to Limelight Troubleshooting

Hello CD, long time lurker, first time poster. I am currently working with YAGSL, Pathplanner, & LimelightLib to generate on the fly trajectories to april tags. Currently I am attempting to make a path from the robot’s current pose to an arbitrary position 1m forward and 1m to the left (this would be substituted in for the limelights offsets). Right now the robot is starting with its current pose, but its always attempting to go to the 1m offset from the robots zero zero power on position. Is there a simple function I am just not using? Any help would be greatly appreciated. Code Snippets Below:

Robot Container:

new JoystickButton(driverXbox, 7).onTrue(Autos.exampleAuto(drivebase));

Autos.exampleAuto:

public static CommandBase exampleAuto(SwerveSubsystem swerve)
{
System.out.println((swerve.getPose()).getX());
System.out.println((swerve.getPose()).getY());
PathPlannerTrajectory path;
path = PathPlanner.generatePath(
new PathConstraints(4, 3),
PathPoint.fromCurrentHolonomicState(swerve.getPose(),swerve.getRobotVelocity()),
new PathPoint(newTranslation2d(1,1),Rotation2d.fromDegrees(0),Rotation2d.fromDegrees(0))
);
return Commands.sequence(new FollowTrajectory(swerve, path, false));
}

Any help would be greatly appreciated, I am not sure If I am going about implementing this the “correct” way. I saw YAGSL had a driveToLimelight function built in but I am not sure if that is nicely compatible with LimelightLib

Full Github Repo: Here

Try

PathPoint.fromCurrentHolonomicState(swerve.getPose(),swerve.getRobotVelocity()),
new PathPoint(swerve.getPose().transformBy(newTranslation2d(1,1)),Rotation2d.fromDegrees(0),Rotation2d.fromDegrees(0))
);

That will give it a point 1x1 away from your current pose, you are currently telling it to go to the coordinate 1,1

I tried the code snipped you sent and I couldn’t get it to compile, I recreated it so the Pathpoint constructor got the terms it wanted, same issue it works fine when the robot is in the inital starting position, anywhere else it trys to go to 1,1 jankily. I can send YAGSL Simulation videos in afew min…

      new PathPoint((swerve.getPose()).transformBy(new Translation2d(0.5, 0.5)).getTranslation(), Rotation2d.fromDegrees(0), Rotation2d.fromDegrees(0))

Are you using the latest beta of PPLib, beta 5? On the Fly pathing was broken due to a miscalculation of bezier control points, and it would make the curve go towards the origin of the field. PathPlanner 2024 Beta - #170 by mjansen4857

I am currently running PPlib 2023, are you suggesting I update to the new beta or don’t use the new beta? I would like to update YAGSL & PP together once they both have official releases before season

Oh if this is 2023 then it’s not the issue I thought.

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