#include <choreo/trajectory/Trajectory.h>
|
| Trajectory ()=default |
|
| Trajectory (std::string_view name, std::vector< SampleType > samples, std::vector< int > splits, std::vector< EventMarker > events) |
|
std::optional< SampleType > | GetInitialSample (bool mirrorForRedAlliance=false) const |
|
std::optional< SampleType > | GetFinalSample (bool mirrorForRedAlliance=false) const |
|
template<int Year = util::kDefaultYear> |
std::optional< SampleType > | SampleAt (units::second_t timestamp, bool mirrorForRedAlliance=false) const |
|
template<int Year = util::kDefaultYear> |
std::optional< frc::Pose2d > | GetInitialPose (bool mirrorForRedAlliance=false) const |
|
template<int Year = util::kDefaultYear> |
std::optional< frc::Pose2d > | GetFinalPose (bool mirrorForRedAlliance=false) const |
|
units::second_t | GetTotalTime () const |
|
std::vector< frc::Pose2d > | GetPoses () const |
|
template<int Year = util::kDefaultYear> |
Trajectory< SampleType > | Flipped () const |
|
std::vector< EventMarker > | GetEvents (std::string_view eventName) const |
|
std::optional< Trajectory< SampleType > > | GetSplit (int splitIndex) const |
|
bool | operator== (const Trajectory< SampleType > &other) const |
|
|
std::string | name |
| The name of the trajectory.
|
|
std::vector< SampleType > | samples |
| The vector of samples in the trajectory.
|
|
std::vector< int > | splits |
| The waypoints indexes where the trajectory is split.
|
|
std::vector< EventMarker > | events |
| A vector of all of the events in the trajectory.
|
|
template<TrajectorySample SampleType>
class choreo::Trajectory< SampleType >
A trajectory loaded from Choreo.
- Parameters
-
◆ Trajectory() [1/2]
template<TrajectorySample SampleType>
◆ Trajectory() [2/2]
template<TrajectorySample SampleType>
choreo::Trajectory< SampleType >::Trajectory |
( |
std::string_view |
name, |
|
|
std::vector< SampleType > |
samples, |
|
|
std::vector< int > |
splits, |
|
|
std::vector< EventMarker > |
events |
|
) |
| |
|
inline |
Constructs a Trajectory with the specified parameters.
- Parameters
-
name | The name of the trajectory. |
samples | The samples of the trajectory. |
splits | The indices of the splits in the trajectory. |
events | The events in the trajectory. |
◆ Flipped()
template<TrajectorySample SampleType>
template<int Year = util::kDefaultYear>
Returns this trajectory, mirrored across the field midline.
- Template Parameters
-
Year | The field year. Defaults to the current year. |
- Returns
- this trajectory, mirrored across the field midline.
◆ GetEvents()
template<TrajectorySample SampleType>
Returns a vector of all events with the given name in the trajectory.
- Parameters
-
eventName | The name of the event. |
- Returns
- A vector of all events with the given name in the trajectory, if no events are found, an empty vector is returned.
◆ GetFinalPose()
template<TrajectorySample SampleType>
template<int Year = util::kDefaultYear>
std::optional< frc::Pose2d > choreo::Trajectory< SampleType >::GetFinalPose |
( |
bool |
mirrorForRedAlliance = false | ) |
const |
|
inline |
Returns the last Pose in the trajectory.
Will return an empty optional if the trajectory is empty
- Template Parameters
-
Year | The field year. Defaults to the current year. |
- Parameters
-
mirrorForRedAlliance | whether or not to return the Pose mirrored. |
- Returns
- The last Pose in the trajectory.
◆ GetFinalSample()
template<TrajectorySample SampleType>
std::optional< SampleType > choreo::Trajectory< SampleType >::GetFinalSample |
( |
bool |
mirrorForRedAlliance = false | ) |
const |
|
inline |
Returns the last SampleType in the trajectory.
Will return an empty optional if the trajectory is empty
- Parameters
-
mirrorForRedAlliance | whether or not to return the sample as mirrored across the field |
- Returns
- The last sample in the trajectory.
◆ GetInitialPose()
template<TrajectorySample SampleType>
template<int Year = util::kDefaultYear>
std::optional< frc::Pose2d > choreo::Trajectory< SampleType >::GetInitialPose |
( |
bool |
mirrorForRedAlliance = false | ) |
const |
|
inline |
Returns the first Pose in the trajectory.
Will return an empty optional if the trajectory is empty
- Template Parameters
-
Year | The field year. Defaults to the current year. |
- Parameters
-
mirrorForRedAlliance | whether or not to return the Pose mirrored. |
- Returns
- The first Pose in the trajectory.
◆ GetInitialSample()
template<TrajectorySample SampleType>
std::optional< SampleType > choreo::Trajectory< SampleType >::GetInitialSample |
( |
bool |
mirrorForRedAlliance = false | ) |
const |
|
inline |
Returns the first SampleType in the trajectory.
Will return an empty optional if the trajectory is empty
- Parameters
-
mirrorForRedAlliance | whether or not to return the sample as mirrored across the field |
- Returns
- The first sample in the trajectory.
◆ GetPoses()
template<TrajectorySample SampleType>
Returns the vector of poses corresponding to the trajectory.
- Returns
- the vector of poses corresponding to the trajectory.
◆ GetSplit()
template<TrajectorySample SampleType>
Returns a choreo trajectory that represents the split of the trajectory at the given index.
- Parameters
-
splitIndex | the index of the split trajectory to return. |
- Returns
- a choreo trajectory that represents the split of the trajectory at the given index.
◆ GetTotalTime()
template<TrajectorySample SampleType>
The total time the trajectory will take to follow
- Returns
- The total time the trajectory will take to follow, if empty will return 0 seconds.
◆ operator==()
template<TrajectorySample SampleType>
Trajectory equality operator.
- Parameters
-
other | The other trajectory. |
- Returns
- True for equality.
◆ SampleAt()
template<TrajectorySample SampleType>
template<int Year = util::kDefaultYear>
std::optional< SampleType > choreo::Trajectory< SampleType >::SampleAt |
( |
units::second_t |
timestamp, |
|
|
bool |
mirrorForRedAlliance = false |
|
) |
| const |
|
inline |
Return an interpolated sample of the trajectory at the given timestamp.
This function will return an empty optional if the trajectory is empty.
- Template Parameters
-
Year | The field year. Defaults to the current year. |
- Parameters
-
timestamp | The timestamp of this sample relative to the beginning of the trajectory. |
mirrorForRedAlliance | whether or not to return the sample mirrored. |
- Returns
- The SampleType at the given time.
The documentation for this class was generated from the following file: