Package com.thunder.lib.trajectory
Class ThunderTrajectoryRunnerProperties
java.lang.Object
com.thunder.lib.trajectory.ThunderTrajectoryRunnerProperties
A set of callback functions and properties required to run a trajectory.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classClass containing -
Constructor Summary
ConstructorsConstructorDescriptionThunderTrajectoryRunnerProperties(Supplier<Pose2d> getPose, Consumer<Pose2d> resetPose, BiConsumer<ChassisSpeeds, ThunderTrajectoryRunnerProperties.DriveControllerInputData> setSpeedsWithDiagnostics, HolonomicDriveController holonomicDriveController) Constructor for ThunderTrajectoryRunnerProperties.ThunderTrajectoryRunnerProperties(Supplier<Pose2d> getPose, Consumer<Pose2d> resetPose, Consumer<ThunderTrajectoryRunnerProperties.DriveControllerInputData> control, Runnable stop) Constructor for ThunderTrajectoryRunnerProperties, with no drive controller.ThunderTrajectoryRunnerProperties(Supplier<Pose2d> getPose, Consumer<Pose2d> resetPose, Consumer<ChassisSpeeds> setSpeeds, HolonomicDriveController holonomicDriveController) Constructor for ThunderTrajectoryRunnerProperties. -
Method Summary
Modifier and TypeMethodDescriptionGets the control consumer function with diagnostics.Gets the holonomic drive controller.Gets the pose supplier function.Gets the reset pose consumer function.Gets the chassis speeds consumer function.Gets the chassis speeds consumer function with diagnostics.Gets the stop runnable.
-
Constructor Details
-
ThunderTrajectoryRunnerProperties
public ThunderTrajectoryRunnerProperties(Supplier<Pose2d> getPose, Consumer<Pose2d> resetPose, Consumer<ChassisSpeeds> setSpeeds, HolonomicDriveController holonomicDriveController) Constructor for ThunderTrajectoryRunnerProperties.- Parameters:
getPose- Function that returns the current robot pose.resetPose- Function that resets the robot pose (and PID controllers too!)setSpeeds- Function that controls the robot chassis speeds (robot-centric).holonomicDriveController- The holonomic drive controller for trajectory following. ThunderLib will NOT reset its x, y, or theta PID controllers; the user should do that in the resetPose function if desired.
-
ThunderTrajectoryRunnerProperties
public ThunderTrajectoryRunnerProperties(Supplier<Pose2d> getPose, Consumer<Pose2d> resetPose, BiConsumer<ChassisSpeeds, ThunderTrajectoryRunnerProperties.DriveControllerInputData> setSpeedsWithDiagnostics, HolonomicDriveController holonomicDriveController) Constructor for ThunderTrajectoryRunnerProperties.- Parameters:
getPose- Function that returns the current robot pose.resetPose- Function that resets the robot pose (and PID controllers too!)setSpeedsWithDiagnostics- Function that controls the robot chassis speeds (robot-centric) with diagnostic data.holonomicDriveController- The holonomic drive controller for trajectory following. ThunderLib will NOT reset its x, y, or theta PID controllers; the user should do that in the resetPose function if desired.
-
ThunderTrajectoryRunnerProperties
public ThunderTrajectoryRunnerProperties(Supplier<Pose2d> getPose, Consumer<Pose2d> resetPose, Consumer<ThunderTrajectoryRunnerProperties.DriveControllerInputData> control, Runnable stop) Constructor for ThunderTrajectoryRunnerProperties, with no drive controller. Instead, a consumer of DriveControllerInputData must be provided instead of the typical chassis speeds consumer, and the user is responsible for calculating the appropriate speeds on their own.- Parameters:
getPose- Function that returns the current robot pose.resetPose- Function that resets the robot pose (and PID controllers too!)control- Function that controls the robot based on the provided DriveControllerInputData.stop- Function that stops the robot.
-
-
Method Details
-
getPoseSupplier
Gets the pose supplier function.- Returns:
- The pose supplier.
-
getResetPoseConsumer
Gets the reset pose consumer function.- Returns:
- The reset pose consumer.
-
getSpeedsConsumer
Gets the chassis speeds consumer function.- Returns:
- The chassis speeds consumer.
-
getSpeedsWithDiagnosticsConsumer
public Optional<BiConsumer<ChassisSpeeds,ThunderTrajectoryRunnerProperties.DriveControllerInputData>> getSpeedsWithDiagnosticsConsumer()Gets the chassis speeds consumer function with diagnostics.- Returns:
- The chassis speeds consumer with diagnostics.
-
getHolonomicDriveController
Gets the holonomic drive controller.- Returns:
- The holonomic drive controller.
-
getControlConsumer
public Optional<Consumer<ThunderTrajectoryRunnerProperties.DriveControllerInputData>> getControlConsumer()Gets the control consumer function with diagnostics.- Returns:
- The control consumer with diagnostics.
-
getStopRunnable
Gets the stop runnable.- Returns:
- The stop runnable.
-