CTRE Phoenix C++ 5.33.0
ctre::phoenix::motion::TrajectoryPoint Struct Reference

Motion Profile Trajectory Point This is simply a data transfer object. More...

#include <ctre/phoenix/motion/TrajectoryPoint.h>

Public Member Functions

 TrajectoryPoint ()
 
 TrajectoryPoint (double position, double velocity, double arbFeedFwd, double auxiliaryPos, double auxiliaryVel, double auxiliaryArbFeedFwd, uint32_t profileSlotSelect0, uint32_t profileSlotSelect1, bool isLastPoint, bool zeroPos, uint32_t timeDur, bool useAuxPID)
 Create a trajectory point with specified values. More...
 

Public Attributes

double position = 0
 The position to servo to (in sensor units). More...
 
double velocity = 0
 The velocity to feed-forward (in sensor-units per 100ms). More...
 
double arbFeedFwd = 0
 Added to the output of PID[0], should be within [-1,+1] where 0.01 = 1%. More...
 
double headingDeg = 0
 Not used. More...
 
double auxiliaryPos = 0
 The position for auxiliary PID[1] to target (in sensor units). More...
 
double auxiliaryVel = 0
 The velocity for auxiliary PID[1] to target. More...
 
double auxiliaryArbFeedFwd = 0
 Added to the output of PID[1], should be within [-1,+1] where 0.01 = 1%. More...
 
uint32_t profileSlotSelect0 = 0
 Which slot to get PIDF gains. More...
 
uint32_t profileSlotSelect1 = 0
 Which slot to get PIDF gains for auxiliary PID. More...
 
bool isLastPoint = false
 Set to true to signal Talon that this is the final point, so do not attempt to pop another trajectory point from out of the Talon buffer. More...
 
bool zeroPos = false
 Set to true to signal Talon to zero the selected sensor. More...
 
int timeDur = 0
 Duration (ms) to apply this trajectory pt. More...
 
bool useAuxPID = false
 If using MotionProfileArc, this flag must be true on all points. More...
 

Detailed Description

Motion Profile Trajectory Point This is simply a data transfer object.

Constructor & Destructor Documentation

◆ TrajectoryPoint() [1/2]

ctre::phoenix::motion::TrajectoryPoint::TrajectoryPoint ( )
inline

◆ TrajectoryPoint() [2/2]

ctre::phoenix::motion::TrajectoryPoint::TrajectoryPoint ( double  position,
double  velocity,
double  arbFeedFwd,
double  auxiliaryPos,
double  auxiliaryVel,
double  auxiliaryArbFeedFwd,
uint32_t  profileSlotSelect0,
uint32_t  profileSlotSelect1,
bool  isLastPoint,
bool  zeroPos,
uint32_t  timeDur,
bool  useAuxPID 
)
inline

Create a trajectory point with specified values.

Parameters
positionThe position to servo to (in sensor units).
velocityThe velocity to feed-forward (in sensor-units per 100ms).
arbFeedFwdAdded to the output of PID[0], should be within [-1,+1] where 0.01 = 1%.
auxiliaryPosThe position for auxiliary PID[1] to target (in sensor units).
auxiliaryVelThe velocity for auxiliary PID[1] to target. (in sensor-units per 100ms).
auxiliaryArbFeedFwdAdded to the output of PID[1], should be within [-1,+1] where 0.01 = 1%.
profileSlotSelect0The slot to select for base PIDF gains
profileSlotSelect1The slot to select for auxiliary PIDF gains
isLastPointTrue if this is the last piont
zeroPosTrue if the motor controller should zero the sensor position
timeDurThe time duration of this point
useAuxPIDEnables the auxiliary PID

Member Data Documentation

◆ arbFeedFwd

double ctre::phoenix::motion::TrajectoryPoint::arbFeedFwd = 0

Added to the output of PID[0], should be within [-1,+1] where 0.01 = 1%.

◆ auxiliaryArbFeedFwd

double ctre::phoenix::motion::TrajectoryPoint::auxiliaryArbFeedFwd = 0

Added to the output of PID[1], should be within [-1,+1] where 0.01 = 1%.

◆ auxiliaryPos

double ctre::phoenix::motion::TrajectoryPoint::auxiliaryPos = 0

The position for auxiliary PID[1] to target (in sensor units).

◆ auxiliaryVel

double ctre::phoenix::motion::TrajectoryPoint::auxiliaryVel = 0

The velocity for auxiliary PID[1] to target.

(in sensor-units per 100ms).

◆ headingDeg

double ctre::phoenix::motion::TrajectoryPoint::headingDeg = 0

Not used.

Use auxiliaryPos instead.

See also
auxiliaryPos

◆ isLastPoint

bool ctre::phoenix::motion::TrajectoryPoint::isLastPoint = false

Set to true to signal Talon that this is the final point, so do not attempt to pop another trajectory point from out of the Talon buffer.

Instead continue processing this way point. Typically the velocity member variable should be zero so that the motor doesn't spin indefinitely.

◆ position

double ctre::phoenix::motion::TrajectoryPoint::position = 0

The position to servo to (in sensor units).

◆ profileSlotSelect0

uint32_t ctre::phoenix::motion::TrajectoryPoint::profileSlotSelect0 = 0

Which slot to get PIDF gains.

PID is used for position servo. F is used as the Kv constant for velocity feed-forward. Typically this is hard-coded to a particular slot, but you are free to gain schedule if need be. gain schedule if need be. Choose from [0,3].

◆ profileSlotSelect1

uint32_t ctre::phoenix::motion::TrajectoryPoint::profileSlotSelect1 = 0

Which slot to get PIDF gains for auxiliary PID.

This only has impact during MotionProfileArc Control mode. Choose from [0,3].

◆ timeDur

int ctre::phoenix::motion::TrajectoryPoint::timeDur = 0

Duration (ms) to apply this trajectory pt.

This time unit is ADDED to the existing base time set by ConfigMotionProfileTrajectoryPeriod().

◆ useAuxPID

bool ctre::phoenix::motion::TrajectoryPoint::useAuxPID = false

If using MotionProfileArc, this flag must be true on all points.

If using MotionProfile, this flag must be false on all points.

◆ velocity

double ctre::phoenix::motion::TrajectoryPoint::velocity = 0

The velocity to feed-forward (in sensor-units per 100ms).

◆ zeroPos

bool ctre::phoenix::motion::TrajectoryPoint::zeroPos = false

Set to true to signal Talon to zero the selected sensor.

When generating MPs, one simple method is to make the first target position zero, and the final target position the target distance from the current position. Then when you fire the MP, the current position gets set to zero. If this is the intent, you can set zeroPos on the first trajectory point.

Otherwise you can leave this false for all points, and offset the positions of all trajectory points so they are correct.

If using multiple sensor sources (Arc modes) we recommend you manually set sensor positions before arming MP.


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