ChoreoLib
Loading...
Searching...
No Matches
choreolib::ChoreoTrajectory Class Reference

#include <ChoreoTrajectory.h>

Public Member Functions

 ChoreoTrajectory (const std::vector< ChoreoTrajectoryState > &states)
 
ChoreoTrajectoryState Sample (units::second_t timestamp, bool mirrorForRedAlliance=false)
 
frc::Pose2d GetInitialPose () const
 
frc::Pose2d GetFlippedInitialPose () const
 
frc::Pose2d GetFinalPose () const
 
frc::Pose2d GetFlippedFinalPose () const
 
units::second_t GetTotalTime () const
 
std::vector< frc::Pose2d > GetPoses () const
 
ChoreoTrajectory Flipped () const
 
std::vector< ChoreoTrajectoryStateGetSamples () const
 
void SetSamples (const std::vector< ChoreoTrajectoryState > &newSamples)
 

Detailed Description

Represents a trajectory loaded from Choreo. Made up of ChoreoTrajectoryStates

Constructor & Destructor Documentation

◆ ChoreoTrajectory()

ChoreoTrajectory::ChoreoTrajectory ( const std::vector< ChoreoTrajectoryState > & states)
explicit

Constructs a new trajectory from a list of trajectory states

Parameters
statesa vector containing a list of ChoreoTrajectoryStates

Member Function Documentation

◆ Flipped()

ChoreoTrajectory ChoreoTrajectory::Flipped ( ) const

Returns a copy of this trajectory flipped across the midline of the field

Returns
a copy of this trajectory flipped across the midline of the field

◆ GetFinalPose()

frc::Pose2d ChoreoTrajectory::GetFinalPose ( ) const

Returns the final, non-mirrored pose of the trajectory.

Returns
the final, non-mirrored pose of the trajectory.

◆ GetFlippedFinalPose()

frc::Pose2d ChoreoTrajectory::GetFlippedFinalPose ( ) const

Returns the final, mirrored pose of the trajectory.

Returns
the final, mirrored pose of the trajectory.

◆ GetFlippedInitialPose()

frc::Pose2d ChoreoTrajectory::GetFlippedInitialPose ( ) const

Returns the initial, mirrored pose of the trajectory.

Returns
the initial, mirrored pose of the trajectory.

◆ GetInitialPose()

frc::Pose2d ChoreoTrajectory::GetInitialPose ( ) const

Returns the initial, non-mirrored pose of the trajectory.

Returns
the initial, non-mirrored pose of the trajectory.

◆ GetPoses()

std::vector< frc::Pose2d > ChoreoTrajectory::GetPoses ( ) const

Returns a list of robot poses at each sample of the trajectory

Returns
a list of robot poses at each sample of the trajectory

◆ GetSamples()

std::vector< ChoreoTrajectoryState > ChoreoTrajectory::GetSamples ( ) const

Returns a list of all the states in this trajectory

Returns
a list of all the states in this trajectory

◆ GetTotalTime()

units::second_t ChoreoTrajectory::GetTotalTime ( ) const

Returns the total run time of the trajectory

Returns
the total run time of the trajectory

◆ Sample()

ChoreoTrajectoryState ChoreoTrajectory::Sample ( units::second_t timestamp,
bool mirrorForRedAlliance = false )

Samples the trajectory at the specified timestamp and optionally mirrors if on the red alliance

Parameters
timestamphow far into the trajectory we want to sample
mirrorForRedAlliancedefaults to false. If true, mirrors the state across the midline of the field
Returns
A ChoreoTrajectoryState that was sampled from this trajectory

◆ SetSamples()

void ChoreoTrajectory::SetSamples ( const std::vector< ChoreoTrajectoryState > & newSamples)

Sets the samples of this trajectory without constructing a new trajectory

Parameters
newSamplesa list of all the new states to set this trajectory to

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