Valkyrie 2026
Loading...
Searching...
No Matches
valor::TrajectoryFollower Class Reference

A class responsible for following a choreo or custom trajectory. More...

#include <valkyrie/TrajectoryFollower.h>

Classes

struct  Config

Public Types

enum class  TrajectoryEndCondition { TIME , POSITION }
 Enum to represent the how the trajectory determines that it is finished: time or position.
enum class  FieldSymmetry { MIRROR , ROTATE }

Public Member Functions

 TrajectoryFollower ()=delete
 The default constructor where everything is initialized to zero.
 TrajectoryFollower (TrajectoryFollower &)=delete
 TrajectoryFollower (TrajectoryFollower &&)=delete

Static Public Member Functions

static void Register (Config config)
 Defines the essential functions for the trajectory follower.
static frc2::CommandPtr FollowPath (std::optional< choreo::Trajectory< choreo::SwerveSample > > traj, std::optional< TrajectoryEndCondition > end, std::optional< units::meter_t > tol, std::optional< std::function< bool()> > inter, bool isMirrored, bool resetOdom)
 Follows a choreo trajectory.
static void SetPID (WorldAlign::TranslationalPIDF_t x, WorldAlign::TranslationalPIDF_t y, WorldAlign::RotationalPIDF_t rot)
 Sets a new PIDF config.

Detailed Description

A class responsible for following a choreo or custom trajectory.

Member Function Documentation

◆ FollowPath()

frc2::CommandPtr valor::TrajectoryFollower::FollowPath ( std::optional< choreo::Trajectory< choreo::SwerveSample > > traj,
std::optional< TrajectoryEndCondition > end,
std::optional< units::meter_t > tol,
std::optional< std::function< bool()> > inter,
bool isMirrored,
bool resetOdom )
static

Follows a choreo trajectory.

Parameters
trajThe choreo trajectory to be followed
endThe optional type of condition that ends the command. Defaults to time
tolThe position tolerance when using position end condition
interAn optional function that describes an interrupted condition. Returns a boolean
isMirroredA boolean to mirror paths over the middle of the field on one alliance side
resetOdomWhether to reset the odom at the start of the path
Returns
Returns a command pointer that follows the path

◆ Register()

void valor::TrajectoryFollower::Register ( Config config)
static

Defines the essential functions for the trajectory follower.

Parameters
resetThe resetOdom function
driveThe drive function that is FIELD RELATIVE
getterThe pose getter
symThe type of field symmetry
fieldSizeXThe x field length
fieldSizeYThe y field length
allianceCallback that determines whether the trajectory should be flipped. Usually this should be set to return if the current alliance is red.

◆ SetPID()

void valor::TrajectoryFollower::SetPID ( WorldAlign::TranslationalPIDF_t x,
WorldAlign::TranslationalPIDF_t y,
WorldAlign::RotationalPIDF_t rot )
static

Sets a new PIDF config.

Parameters
xThe x PIDF config
yThe y PIDF config
rotThe rotation PIDF config

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