You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm a mentor with Team 1296. We have used PathPlanner for the last two years and it has been great. Thank you!
Your example code on the wiki does not appear to work for automatic mirroring:
// Assuming this method is part of a drivetrain subsystem that provides the necessary methods
public Command followTrajectoryCommand(PathPlannerTrajectory traj, boolean isFirstPath) {
return new SequentialCommandGroup(
new InstantCommand(() -> {
// Reset odometry for the first path you run during auto
if(isFirstPath){
this.resetOdometry(traj.getInitialHolonomicPose());
}
}),
new PPSwerveControllerCommand(
traj,
this::getPose, // Pose supplier
this.kinematics, // SwerveDriveKinematics
new PIDController(0, 0, 0), // X controller. Tune these values for your robot. Leaving them 0 will only use feedforwards.
new PIDController(0, 0, 0), // Y controller (usually the same values as X controller)
new PIDController(0, 0, 0), // Rotation controller. Tune these values for your robot. Leaving them 0 will only use feedforwards.
this::setModuleStates, // Module states consumer
true, // Should the path be automatically mirrored depending on alliance color. Optional, defaults to true
this // Requires this drive subsystem
)
);
}
(Assume Red Alliance DriverStation)
If we call this method with a "traj" that is a properly created blue trajectory and "isFirstPath" is true...
then the odometry will be set to the pose on the Blue side and the PPSwerveControllerCommand will transform the path for Red
If we call this method with a "traj" that is already transformed for Alliance and "isFirstPath" is true...
then the odometry will be properly set to a pose on the Red side but the PPSwerveControllerCommand will transform the path again which I don't know what will happen.
If I understand the other discussions then the proper flow for creation for a command for an initial path should be something similar to this pseudo code...
Seems kinda silly to be transforming the path just to get the initial pose. Either way, here are a couple of questions/suggestions:
Why not provide a method in PathPlannerTrajectory for getInitialHolonomicPose(boolean useAllianceColor) that auto-magically handles the transform of the initial pose
We are sending a simple boolean in the constructor for PPSwerveControllerCommand for alliance mirror, why are we having to send DriverStation.getAlliance for PathPlannerTrajectory transformation.
Thank you for all the hard work on the library. It is truly a great tool and we appreciate your hard work to provide such a wonderful resource. All comments and suggestions are intended as potential improvements and discussion points.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello, I'm a mentor with Team 1296. We have used PathPlanner for the last two years and it has been great. Thank you!
Your example code on the wiki does not appear to work for automatic mirroring:
(Assume Red Alliance DriverStation)
If we call this method with a "traj" that is a properly created blue trajectory and "isFirstPath" is true...
then the odometry will be set to the pose on the Blue side and the PPSwerveControllerCommand will transform the path for Red
If we call this method with a "traj" that is already transformed for Alliance and "isFirstPath" is true...
then the odometry will be properly set to a pose on the Red side but the PPSwerveControllerCommand will transform the path again which I don't know what will happen.
If I understand the other discussions then the proper flow for creation for a command for an initial path should be something similar to this pseudo code...
Seems kinda silly to be transforming the path just to get the initial pose. Either way, here are a couple of questions/suggestions:
Thank you for all the hard work on the library. It is truly a great tool and we appreciate your hard work to provide such a wonderful resource. All comments and suggestions are intended as potential improvements and discussion points.
Best Regards
Beta Was this translation helpful? Give feedback.
All reactions