ThunderLib
Loading...
Searching...
No Matches
thunder::TrajectoryRunnerProperties Struct Reference

#include <TrajectoryRunnerProperties.hpp>

Classes

struct  DriveControllerInputData
 

Public Types

using GetPoseFunc = std::function<frc::Pose2d()>
 
using ResetPoseFunc = std::function<void(const frc::Pose2d&)>
 
using GetSpeedsFunc = std::function<frc::ChassisSpeeds()>
 
using SetSpeedsFunc = std::function<void(const frc::ChassisSpeeds&)>
 
using SetSpeedsWithDiagnosticsFunc
 
using ControlFunc = std::function<void(const DriveControllerInputData&)>
 
using StopFunc = std::function<void()>
 

Public Member Functions

 TrajectoryRunnerProperties (GetPoseFunc getPoseFunc, ResetPoseFunc resetPoseFunc, SetSpeedsFunc setSpeedsFunc, std::shared_ptr< frc::HolonomicDriveController > holonomicDriveController)
 
 TrajectoryRunnerProperties (GetPoseFunc getPoseFunc, ResetPoseFunc resetPoseFunc, SetSpeedsWithDiagnosticsFunc setSpeedsWithDiagnosticsFunc, std::shared_ptr< frc::HolonomicDriveController > holonomicDriveController)
 
 TrajectoryRunnerProperties (GetPoseFunc getPose, ResetPoseFunc resetPose, ControlFunc control, StopFunc stop)
 
bool isValid () const
 
 operator bool () const
 

Public Attributes

const GetPoseFunc getPose = nullptr
 
const ResetPoseFunc resetPose = nullptr
 
const SetSpeedsFunc setSpeeds = nullptr
 
const SetSpeedsWithDiagnosticsFunc setSpeedsWithDiagnostics = nullptr
 
const std::shared_ptr< frc::HolonomicDriveController > controller = nullptr
 
const ControlFunc control = nullptr
 
const StopFunc stop = nullptr
 

Detailed Description

A set of callback functions and properties required to run a trajectory.

Member Typedef Documentation

◆ SetSpeedsWithDiagnosticsFunc

using thunder::TrajectoryRunnerProperties::SetSpeedsWithDiagnosticsFunc
Initial value:
std::function<void(const frc::ChassisSpeeds&, const DriveControllerInputData&)>

Constructor & Destructor Documentation

◆ TrajectoryRunnerProperties() [1/3]

thunder::TrajectoryRunnerProperties::TrajectoryRunnerProperties ( GetPoseFunc getPoseFunc,
ResetPoseFunc resetPoseFunc,
SetSpeedsFunc setSpeedsFunc,
std::shared_ptr< frc::HolonomicDriveController > holonomicDriveController )
inline

Constructor for TrajectoryRunnerProperties.

Parameters
getPoseFunction that returns the current robot pose.
resetPoseFunction that resets the robot pose (and PID controllers too!)
setSpeedsFunction that controls the robot chassis speeds (robot-centric).
holonomicDriveControllerThe 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.

◆ TrajectoryRunnerProperties() [2/3]

thunder::TrajectoryRunnerProperties::TrajectoryRunnerProperties ( GetPoseFunc getPoseFunc,
ResetPoseFunc resetPoseFunc,
SetSpeedsWithDiagnosticsFunc setSpeedsWithDiagnosticsFunc,
std::shared_ptr< frc::HolonomicDriveController > holonomicDriveController )
inline

Constructor for TrajectoryRunnerProperties.

Parameters
getPoseFunction that returns the current robot pose.
resetPoseFunction that resets the robot pose (and PID controllers too!)
setSpeedsWithDiagnosticsFunction that controls the robot chassis speeds (robot-centric) with diagnostic data.
holonomicDriveControllerThe 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.

◆ TrajectoryRunnerProperties() [3/3]

thunder::TrajectoryRunnerProperties::TrajectoryRunnerProperties ( GetPoseFunc getPose,
ResetPoseFunc resetPose,
ControlFunc control,
StopFunc stop )
inline

Constructor for TrajectoryRunnerProperties, 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
getPoseFunction that returns the current robot pose.
resetPoseFunction that resets the robot pose (and PID controllers too!)
controlFunction that controls the robot based on the provided DriveControllerInputData.
stopFunction that stops the robot.

Member Data Documentation

◆ control

const ControlFunc thunder::TrajectoryRunnerProperties::control = nullptr

Control the robot.

◆ controller

const std::shared_ptr<frc::HolonomicDriveController> thunder::TrajectoryRunnerProperties::controller = nullptr

Holonomic drive controller to use for following the trajectory.

Note
ThunderLib will NOT reset the controller's x, y, or theta PID controllers; the user should do that in the resetPose function if desired.

◆ getPose

const GetPoseFunc thunder::TrajectoryRunnerProperties::getPose = nullptr

Gets the current pose of the robot.

◆ resetPose

const ResetPoseFunc thunder::TrajectoryRunnerProperties::resetPose = nullptr

Resets the robot's pose to the specified pose (and PID controllers too!).

If not provided (nullptr), the robot's pose will not be reset at the start of the trajectory.

◆ setSpeeds

const SetSpeedsFunc thunder::TrajectoryRunnerProperties::setSpeeds = nullptr

Control the robot's chassis speeds.

Speeds are robot-relative, not field-relative.

◆ setSpeedsWithDiagnostics

const SetSpeedsWithDiagnosticsFunc thunder::TrajectoryRunnerProperties::setSpeedsWithDiagnostics = nullptr

Control the robot's chassis speeds with diagnostic data.

Speeds are robot-relative, not field-relative.

◆ stop

const StopFunc thunder::TrajectoryRunnerProperties::stop = nullptr

Stop the robot (at the end of the trajectory or on interruption).


The documentation for this struct was generated from the following file: