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

A single state in a ChoreoTrajectory. More...

#include <ChoreoTrajectoryState.h>

Public Member Functions

 ChoreoTrajectoryState (units::second_t t, units::meter_t x, units::meter_t y, units::radian_t heading, units::meters_per_second_t xVel, units::meters_per_second_t yVel, units::radians_per_second_t angularVel)
 
frc::Pose2d GetPose () const
 
frc::ChassisSpeeds GetChassisSpeeds () const
 
ChoreoTrajectoryState Interpolate (const ChoreoTrajectoryState &endValue, double i) const
 
std::array< double, 7 > AsArray () const
 
ChoreoTrajectoryState Flipped () const
 

Public Attributes

units::second_t timestamp {0_s}
 The time elapsed since the beginning of the trajectory.
 
units::meter_t x = 0_m
 The x position at that point in the trajectory.
 
units::meter_t y = 0_m
 The y position at that point in the trajectory.
 
units::radian_t heading = 0_rad
 The heading at that point in the trajectory.
 
units::meters_per_second_t velocityX = 0_mps
 The x component of the velocity at that point in the trajectory.
 
units::meters_per_second_t velocityY = 0_mps
 The y component of the velocity at that point in the trajectory.
 
units::radians_per_second_t angularVelocity = 0_rad_per_s
 The angular component of the velocity at that point in the trajectory.
 

Detailed Description

A single state in a ChoreoTrajectory.

Constructor & Destructor Documentation

◆ ChoreoTrajectoryState()

ChoreoTrajectoryState::ChoreoTrajectoryState ( units::second_t t,
units::meter_t x,
units::meter_t y,
units::radian_t heading,
units::meters_per_second_t xVel,
units::meters_per_second_t yVel,
units::radians_per_second_t angularVel )

Creates a new ChoreoTrajectoryState given all its parameters

Parameters
tThe timestamp of the new state
xThe x position of the robot at this state
yThe y position of the robot at this state
headingThe heading of the robot at this state
xVelThe x velocity of the robot at this state
yVelThe x velocity of the robot at this state
angularVelThe angular velocity of the robot at this state

Member Function Documentation

◆ AsArray()

std::array< double, 7 > ChoreoTrajectoryState::AsArray ( ) const

Returns this state as an array of doubles

Returns
this state as an array of doubles

◆ Flipped()

ChoreoTrajectoryState ChoreoTrajectoryState::Flipped ( ) const

Returns a new instance of this state mirrored across the midline of the field

Returns
a new instance of this state mirrored across the midline of the field

◆ GetChassisSpeeds()

frc::ChassisSpeeds ChoreoTrajectoryState::GetChassisSpeeds ( ) const

Returns the field-relative chassis speeds of this state.

Returns
the field-relative chassis speeds of this state.

◆ GetPose()

frc::Pose2d ChoreoTrajectoryState::GetPose ( ) const

Returns the pose of the robot at this state

Returns
the pose of the robot at this state

◆ Interpolate()

ChoreoTrajectoryState ChoreoTrajectoryState::Interpolate ( const ChoreoTrajectoryState & endValue,
double i ) const

Returns a new state interpolated between itself and endValue at i

Parameters
endValueThe next state. It should have a timestamp after this state.
ihow far between the two trajectories we should be in range (0,1)
Returns
this state as an array of doubles

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