|
ChoreoLib
|
#include <Choreo.h>
Static Public Member Functions | |
| static ChoreoTrajectory | GetTrajectory (std::string_view trajName) |
| static std::vector< ChoreoTrajectory > | GetTrajectoryGroup (std::string_view trajName) |
| static frc2::CommandPtr | ChoreoSwerveCommandFactory (ChoreoTrajectory trajectory, std::function< frc::Pose2d()> poseSupplier, frc::PIDController xController, frc::PIDController yController, frc::PIDController rotationController, std::function< void(frc::ChassisSpeeds)> outputChassisSpeeds, std::function< bool(void)> mirrorTrajectory, frc2::Requirements requirements={}) |
| static frc2::CommandPtr | ChoreoSwerveCommandFactory (ChoreoTrajectory trajectory, std::function< frc::Pose2d()> poseSupplier, ChoreoControllerFunction controller, std::function< void(frc::ChassisSpeeds)> outputChassisSpeeds, std::function< bool(void)> mirrorTrajectory, frc2::Requirements requirements={}) |
| static ChoreoControllerFunction | ChoreoSwerveController (frc::PIDController xController, frc::PIDController yController, frc::PIDController rotationController) |
A class that handles loading choreo trajectories and creating command factories for following trajectories
|
static |
Creates a CommandPtr that commands your drivebase to follow a Choreo trajectory
| trajectory | a ChoreoTrajectory to follow |
| poseSupplier | a function that returns a Pose2d of the robots current position |
| controller | a ChoreoControllerFunction that handles the feedback of the robots position |
| outputChassisSpeeds | a function that consuming the calculated robot relative ChassisSpeeds |
| mirrorTrajectory | If this returns true, the path will be mirrored to the opposite side, while keeping the same coordinate system origin. This will be called every loop during the command. |
| requirements | the frc2::Requirements of the command |
|
static |
Creates a CommandPtr that commands your drivebase to follow a Choreo trajectory
| trajectory | a ChoreoTrajectory to follow |
| poseSupplier | a function that returns a Pose2d of the robots current position |
| xController | a PIDController that controls the feedback on the global x position of the robot |
| yController | a PIDController that controls the feedback on the global y position of the robot |
| rotationController | a PIDController that controls the feedback on the global heading of the robot |
| outputChassisSpeeds | a function that consuming the calculated robot relative ChassisSpeeds |
| mirrorTrajectory | If this returns true, the path will be mirrored to the opposite side, while keeping the same coordinate system origin. This will be called every loop during the command. |
| requirements | the frc2::Requirements of the command |
|
static |
Creates a ChoreoControllerFunction handles the feedback of the drivebase position
| xController | a PIDController that controls the feedback on the global x position of the robot |
| yController | a PIDController that controls the feedback on the global y position of the robot |
| rotationController | a PIDController that controls the feedback on the global heading of the robot |
|
static |
Load a trajectory from the deploy directory. ChoreoLib expects .traj files to be placed in src/main/deploy/choreo/[trajName].traj .
| trajName | the path name in Choreo, which matches the file name in the deploy directory. Do not include ".traj" here. |
|
static |
Loads the split parts of the specified trajectory.
ChoreoLib expects split .traj files to be placed in src/main/deploy/choreo/[trajName].[segmentNumber].traj.
This method determines the number of parts to load by counting the files that match the pattern "trajName.X.traj", where X is a string of digits. Let this count be N. It then attempts to load "trajName.1.traj" through "trajName.N.traj", consecutively counting up.
| trajName | the path name in Choreo. Do not include ".traj" here. |
| std::runtime_error | If any files cannot be loaded. |