Rotation and on-the-fly path generation

// Simple path without holonomic rotation. Stationary start/end. Max velocity of 4 m/s and max accel of 3 m/s^2
PathPlannerTrajectory traj1 = PathPlanner.generatePath(
    new PathConstraints(4, 3), 
    new PathPoint(new Translation2d(1.0, 1.0), Rotation2d.fromDegrees(0)), // position, heading
    new PathPoint(new Translation2d(3.0, 3.0), Rotation2d.fromDegrees(45)) // position, heading
);

// Simple path with holonomic rotation. Stationary start/end. Max velocity of 4 m/s and max accel of 3 m/s^2
PathPlannerTrajectory traj2 = PathPlanner.generatePath(
    new PathConstraints(4, 3), 
    new PathPoint(new Translation2d(1.0, 1.0), Rotation2d.fromDegrees(0), Rotation2d.fromDegrees(0)), // position, heading(direction of travel), holonomic rotation
    new PathPoint(new Translation2d(3.0, 3.0), Rotation2d.fromDegrees(45), Rotation2d.fromDegrees(-90) // position, heading(direction of travel), holonomic rotation
);

// More complex path with holonomic rotation. Non-zero starting velocity of 2 m/s. Max velocity of 4 m/s and max accel of 3 m/s^2
PathPlannerTrajectory traj3 = PathPlanner.generatePath(
    new PathConstraints(4, 3), 
    new PathPoint(new Translation2d(1.0, 1.0), Rotation2d.fromDegrees(0), Rotation2d.fromDegrees(0), 2), // position, heading(direction of travel), holonomic rotation, velocity override
    new PathPoint(new Translation2d(3.0, 3.0), Rotation2d.fromDegrees(45), Rotation2d.fromDegrees(-90), // position, heading(direction of travel), holonomic rotation
    new PathPoint(new Translation2d(5.0, 3.0), Rotation2d.fromDegrees(0), Rotation2d.fromDegrees(-30) // position, heading(direction of travel), holonomic rotation
); 

Is the holonomic rotation the field heading or relative to the previous rotation?

1 Like

All the rotations should be in field space

1 Like

Does that go for the translations too? Basically the translation and the holonomic rotation could just be Pose2d of any place on the field, the heading is direction of travel. Is that correct

Yeah all the translations are in absolute field space as well.

Technically it’s a coordinate system parallel to the wpilib standard with the origin wherever your odometry origin is, but if you’re using the wpilib Odom classes (and like 95% of the time other than that) it’s just identical to the typical field coordinate system. I only make this last point because it is possible to redefine the 0 position on the field so that making red/blue autos is absolute and symmetrical, in which case your translations and rotations will still be in field-space but relative to your new origins.

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