ChoreoLib
Choreo support library.
Loading...
Searching...
No Matches
choreo::DifferentialSample Class Reference

#include <choreo/trajectory/DifferentialSample.h>

Public Member Functions

constexpr DifferentialSample ()=default
 
constexpr DifferentialSample (units::second_t timestamp, units::meter_t x, units::meter_t y, units::radian_t heading, units::meters_per_second_t vl, units::meters_per_second_t vr, units::radians_per_second_t omega, units::meters_per_second_squared_t al, units::meters_per_second_squared_t ar, units::newton_t fl, units::newton_t fr)
 
units::second_t GetTimestamp () const
 
constexpr frc::Pose2d GetPose () const
 
constexpr frc::ChassisSpeeds GetChassisSpeeds () const
 
constexpr DifferentialSample OffsetBy (units::second_t timeStampOffset) const
 
constexpr DifferentialSample Interpolate (const DifferentialSample &endValue, units::second_t t) const
 
template<int Year = util::kDefaultYear>
constexpr DifferentialSample Flipped () const
 
constexpr bool operator== (const DifferentialSample &other) const
 

Public Attributes

units::second_t timestamp = 0_s
 The timestamp of this sample relative to the beginning of the trajectory.
 
units::meter_t x = 0_m
 The X position of the sample relative to the blue alliance wall origin.
 
units::meter_t y = 0_m
 The Y position of the sample relative to the blue alliance wall origin.
 
units::radian_t heading = 0_rad
 The heading of the sample, with 0 being in the +X direction.
 
units::meters_per_second_t vl = 0_mps
 The velocity of the left wheels.
 
units::meters_per_second_t vr = 0_mps
 The velocity of the right wheels.
 
units::radians_per_second_t omega = 0_rad_per_s
 The chassis angular velocity.
 
units::meters_per_second_squared_t al = 0_mps_sq
 The acceleration of the left wheels.
 
units::meters_per_second_squared_t ar = 0_mps_sq
 The acceleration of the right wheels.
 
units::newton_t fl = 0_N
 The force of the left wheels.
 
units::newton_t fr = 0_N
 The force of the right wheels.
 

Detailed Description

A single differential drive robot sample in a Trajectory.

Constructor & Destructor Documentation

◆ DifferentialSample() [1/2]

constexpr choreo::DifferentialSample::DifferentialSample ( )
constexprdefault

Constructs a DifferentialSample that is defaulted.

◆ DifferentialSample() [2/2]

constexpr choreo::DifferentialSample::DifferentialSample ( units::second_t  timestamp,
units::meter_t  x,
units::meter_t  y,
units::radian_t  heading,
units::meters_per_second_t  vl,
units::meters_per_second_t  vr,
units::radians_per_second_t  omega,
units::meters_per_second_squared_t  al,
units::meters_per_second_squared_t  ar,
units::newton_t  fl,
units::newton_t  fr 
)
inlineconstexpr

Constructs a DifferentialSample with the specified parameters.

Parameters
timestampThe timestamp of this sample, relative to the beginning of the trajectory.
xThe X position of the sample
yThe Y position of the sample
headingThe heading of the sample, with 0 being in the +X direction.
vlThe velocity of the left wheels
vrThe velocity of the right wheels
omegaThe chassis angular velocity
alThe acceleration of the left wheels
arThe acceleration of the left wheels
flThe force of the left wheels
frThe force of the right wheels

Member Function Documentation

◆ Flipped()

template<int Year = util::kDefaultYear>
constexpr DifferentialSample choreo::DifferentialSample::Flipped ( ) const
inlineconstexpr

Returns the current sample flipped based on the field year.

Template Parameters
YearThe field year.
Returns
DifferentialSample that is flipped based on the field layout.

◆ GetChassisSpeeds()

constexpr frc::ChassisSpeeds choreo::DifferentialSample::GetChassisSpeeds ( ) const
inlineconstexpr

Gets the field-relative chassis speeds of the DifferentialSample.

Returns
The field-relative chassis speeds.

◆ GetPose()

constexpr frc::Pose2d choreo::DifferentialSample::GetPose ( ) const
inlineconstexpr

Gets the Pose2d of the DifferentialSample.

Returns
The pose.

◆ GetTimestamp()

units::second_t choreo::DifferentialSample::GetTimestamp ( ) const
inline

Gets the timestamp of the DifferentialSample.

Returns
The timestamp.

◆ Interpolate()

constexpr DifferentialSample choreo::DifferentialSample::Interpolate ( const DifferentialSample endValue,
units::second_t  t 
) const
inlineconstexpr

Interpolates between endValue and this by t

Parameters
endValuethe end interpolated value
ttime to move sample by
Returns
the interpolated sample

◆ OffsetBy()

constexpr DifferentialSample choreo::DifferentialSample::OffsetBy ( units::second_t  timeStampOffset) const
inlineconstexpr

Returns the current sample offset by a the time offset passed in.

Parameters
timeStampOffsettime to move sample by
Returns
DifferentialSample that is moved forward by the offset

◆ operator==()

constexpr bool choreo::DifferentialSample::operator== ( const DifferentialSample other) const
inlineconstexpr

DifferentialSample equality operator.

Parameters
otherThe other DifferentialSample.
Returns
True for equality.

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