TrajectoryConfig
- class wpimath.TrajectoryConfig(max_velocity: wpimath.units.meters_per_second, max_acceleration: wpimath.units.meters_per_second_squared)
Bases:
pybind11_objectRepresents the configuration for generating a trajectory. This class stores the start velocity, end velocity, max velocity, max acceleration, custom constraints, and the reversed flag.
The class must be constructed with a max velocity and max acceleration. The other parameters (start velocity, end velocity, constraints, reversed) have been defaulted to reasonable values (0, 0, {}, false). These values can be changed via the SetXXX methods.
Constructs a config object.
- Parameters:
max_velocity – The max velocity of the trajectory.
max_acceleration – The max acceleration of the trajectory.
- add_constraint(constraint: wpimath._wpimath.TrajectoryConstraint) None
Adds a user-defined constraint to the trajectory.
- Parameters:
constraint – The user-defined constraint.
- end_velocity() wpimath.units.meters_per_second
Returns the ending velocity of the trajectory.
- Returns:
The ending velocity of the trajectory.
- static from_fps(max_velocity: wpimath.units.feet_per_second, max_acceleration: wpimath.units.feet_per_second_squared) wpimath._wpimath.TrajectoryConfig
- is_reversed() bool
Returns whether the trajectory is reversed or not.
- Returns:
whether the trajectory is reversed or not.
- max_acceleration() wpimath.units.meters_per_second_squared
Returns the maximum acceleration of the trajectory.
- Returns:
The maximum acceleration of the trajectory.
- max_velocity() wpimath.units.meters_per_second
Returns the maximum velocity of the trajectory.
- Returns:
The maximum velocity of the trajectory.
- set_end_velocity(end_velocity: wpimath.units.meters_per_second) None
Sets the end velocity of the trajectory.
- Parameters:
end_velocity – The end velocity of the trajectory.
- set_kinematics(*args, **kwargs)
Overloaded function.
set_kinematics(self: wpimath._wpimath.TrajectoryConfig, kinematics: wpimath._wpimath.DifferentialDriveKinematics) -> None
Adds a differential drive kinematics constraint to ensure that no wheel velocity of a differential drive goes above the max velocity.
- Parameters:
kinematics – The differential drive kinematics.
set_kinematics(self: wpimath._wpimath.TrajectoryConfig, kinematics: wpimath._wpimath.MecanumDriveKinematics) -> None
Adds a mecanum drive kinematics constraint to ensure that no wheel velocity of a mecanum drive goes above the max velocity.
- Parameters:
kinematics – The mecanum drive kinematics.
set_kinematics(self: wpimath._wpimath.TrajectoryConfig, kinematics: wpimath._wpimath.SwerveDrive2Kinematics) -> None
Adds a swerve drive kinematics constraint to ensure that no wheel velocity of a swerve drive goes above the max velocity.
- Parameters:
kinematics – The swerve drive kinematics.
set_kinematics(self: wpimath._wpimath.TrajectoryConfig, kinematics: wpimath._wpimath.SwerveDrive3Kinematics) -> None
Adds a swerve drive kinematics constraint to ensure that no wheel velocity of a swerve drive goes above the max velocity.
- Parameters:
kinematics – The swerve drive kinematics.
set_kinematics(self: wpimath._wpimath.TrajectoryConfig, kinematics: wpimath._wpimath.SwerveDrive4Kinematics) -> None
Adds a swerve drive kinematics constraint to ensure that no wheel velocity of a swerve drive goes above the max velocity.
- Parameters:
kinematics – The swerve drive kinematics.
set_kinematics(self: wpimath._wpimath.TrajectoryConfig, kinematics: wpimath._wpimath.SwerveDrive6Kinematics) -> None
Adds a swerve drive kinematics constraint to ensure that no wheel velocity of a swerve drive goes above the max velocity.
- Parameters:
kinematics – The swerve drive kinematics.
- set_reversed(reversed: bool) None
Sets the reversed flag of the trajectory.
- Parameters:
reversed – Whether the trajectory should be reversed or not.
- set_start_velocity(start_velocity: wpimath.units.meters_per_second) None
Sets the start velocity of the trajectory.
- Parameters:
start_velocity – The start velocity of the trajectory.
- start_velocity() wpimath.units.meters_per_second
Returns the starting velocity of the trajectory.
- Returns:
The starting velocity of the trajectory.