CTRE Phoenix 6 C++ 26.0.0-beta-1
Loading...
Searching...
No Matches
ctre::phoenix6::swerve::LinearPath Class Reference

A linear path for a holonomic drivetrain (i.e. More...

#include <ctre/phoenix6/swerve/utility/LinearPath.hpp>

Classes

struct  State
 Path state. More...
 

Public Member Functions

constexpr LinearPath (frc::TrapezoidProfile< units::meters >::Constraints linear, frc::TrapezoidProfile< units::radians >::Constraints angular)
 Constructs a linear path.
 
constexpr State Calculate (units::second_t t, State const &current, Pose2d const &goal)
 Calculates the pose and speeds of the path at a time t where the current state is at t = 0.
 
constexpr units::second_t TotalTime () const
 Returns the total time the profile takes to reach the goal.
 
constexpr bool IsFinished (units::second_t t) const
 Returns true if the profile has reached the goal.
 

Detailed Description

A linear path for a holonomic drivetrain (i.e.

swerve or mechanum). This generates profiled setpoints for the robot along a straight line based on trapezoidal velocity constraints (using frc#TrapezoidProfile).

Initialization:

TrapezoidProfile::Constraints{kMaxV, kMaxA},
TrapezoidProfile::Constraints{kMaxOmega, kMaxAlpha}
};
LinearPath::State current{initialPose, initialFieldSpeeds};
A linear path for a holonomic drivetrain (i.e.
Definition LinearPath.hpp:35

Run on update:

current = path.Calculate(timeSincePreviousUpdate, current, targetPose);

Constructor & Destructor Documentation

◆ LinearPath()

ctre::phoenix6::swerve::LinearPath::LinearPath ( frc::TrapezoidProfile< units::meters >::Constraints linear,
frc::TrapezoidProfile< units::radians >::Constraints angular )
inlineconstexpr

Constructs a linear path.

Parameters
linearThe constraints on the profile linear motion
angularThe constraints on the profile angular motion

Member Function Documentation

◆ Calculate()

State ctre::phoenix6::swerve::LinearPath::Calculate ( units::second_t t,
State const & current,
Pose2d const & goal )
inlineconstexpr

Calculates the pose and speeds of the path at a time t where the current state is at t = 0.

Parameters
tHow long to advance from the current state to the desired state
currentThe current state
goalThe desired pose when the path is complete
Returns
The pose and speeds of the profile at time t

◆ IsFinished()

bool ctre::phoenix6::swerve::LinearPath::IsFinished ( units::second_t t) const
inlineconstexpr

Returns true if the profile has reached the goal.

The profile has reached the goal if the time since the profile started has exceeded the profile's total time.

Parameters
tThe time since the beginning of the profile
Returns
true if the profile has reached the goal

◆ TotalTime()

units::second_t ctre::phoenix6::swerve::LinearPath::TotalTime ( ) const
inlineconstexpr

Returns the total time the profile takes to reach the goal.

Returns
The total time the profile takes to reach the goal

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