Path
pathplannerlib Index / Pathplannerlib / Path
Auto-generated documentation for pathplannerlib.path module.
ConstraintsZone
A zone on a path with different kinematic constraints
Arguments
minWaypointPos
float - Starting position of the zonemaxWaypointPos
float - End position of the zoneconstraints
PathConstraints - PathConstraints to apply within the zone
Signature
ConstraintsZone().forSegmentIndex
Transform the positions of this zone for a given segment number.
For example, a zone from [1.5, 2.0] for the segment 1 will have the positions [0.5, 1.0]
Arguments
segment_index
- The segment index to transform positions for
Returns
The transformed zone
Signature
ConstraintsZone.fromJson
Signature
ConstraintsZone().isWithinZone
Get if a given waypoint relative position is within this zone
Arguments
t
- Waypoint relative position
Returns
True if given position is within this zone
Signature
ConstraintsZone().overlapsRange
Get if this zone overlaps a given range
Arguments
min_pos
- The minimum waypoint relative position of the rangemax_pos
- The maximum waypoint relative position of the range
Returns
True if any part of this zone is within the given range
Signature
EventMarker
Position along the path that will trigger a command when reached
Arguments
waypointRelativePos
float - The waypoint relative position of the markercommand
Command - The command that should be triggered at this marker
Signature
EventMarker.fromJson
Signature
GoalEndState
Describes the goal end state of the robot when finishing a path
Arguments
velocity
float - The goal end velocity (M/S)rotation
Rotation2d - The goal rotationrotateFast
bool - Should the robot reach the rotation as fast as possible
Signature
GoalEndState.fromJson
Signature
PathConstraints
Kinematic path following constraints
Arguments
maxVelocityMps
float - Max linear velocity (M/S)maxAccelerationMpsSq
float - Max linear acceleration (M/S^2)maxAngularVelocityRps
float - Max angular velocity (Rad/S)maxAngularAccelerationRpsSq
float - Max angular acceleration (Rad/S^2)
Signature
PathConstraints.fromJson
Signature
PathPlannerPath
Signature
class PathPlannerPath:
def __init__(
self,
bezier_points: List[Translation2d],
constraints: PathConstraints,
goal_end_state: GoalEndState,
holonomic_rotations: List[RotationTarget] = [],
constraint_zones: List[ConstraintsZone] = [],
event_markers: List[EventMarker] = [],
is_reversed: bool = False,
preview_starting_rotation: Rotation2d = Rotation2d(),
): ...
See also
PathPlannerPath.bezierFromPoses
Create the bezier points necessary to create a path using a list of poses
Arguments
poses
- List of poses. Each pose represents one waypoint.
Returns
Bezier points
Signature
PathPlannerPath().flipPath
Flip a path to the other side of the field, maintaining a global blue alliance origin
Returns
The flipped path
Signature
PathPlannerPath.fromChoreoTrajectory
Load a Choreo trajectory as a PathPlannerPath
Arguments
trajectory_name
- The name of the Choreo trajectory to load. This should be just the name of the trajectory. The trajectories must be located in the "deploy/choreo" directory.
Returns
PathPlannerPath created from the given Choreo trajectory file
Signature
PathPlannerPath.fromPathFile
Load a path from a path file in storage
Arguments
path_name
- The name of the path to load
Returns
PathPlannerPath created from the given file name
Signature
PathPlannerPath.fromPathPoints
Create a path with pre-generated points. This should already be a smooth path.
Arguments
path_points
- Path points along the smooth curve of the pathconstraints
- The global constraints of the pathgoal_end_state
- The goal end state of the path
Returns
A PathPlannerPath following the given pathpoints
Signature
@staticmethod
def fromPathPoints(
path_points: List[PathPoint],
constraints: PathConstraints,
goal_end_state: GoalEndState,
) -> PathPlannerPath: ...
See also
PathPlannerPath().getAllPathPoints
Get all the path points in this path
Returns
Path points in the path
Signature
See also
PathPlannerPath().getEventMarkers
Get all the event markers for this path
Returns
The event markers for this path
Signature
See also
PathPlannerPath().getGlobalConstraints
Get the global constraints for this path
Returns
Global constraints that apply to this path
Signature
See also
PathPlannerPath().getGoalEndState
Get the goal end state of this path
Returns
The goal end state
Signature
See also
PathPlannerPath().getPathPoses
Get a list of poses representing every point in this path. This can be used to display a path on a field 2d widget, for example.
Returns
List of poses for each point in this path
Signature
PathPlannerPath().getPoint
Get a specific point along this path
Arguments
index
- Index of the point to get
Returns
The point at the given index
Signature
See also
PathPlannerPath().getPreviewStartingHolonomicPose
Get the starting pose for the holomonic path based on the preview settings. NOTE: This should only be used for the first path you are running, and only if you are not using an auto mode file. Using this pose to reset the robots pose between sequential paths will cause a loss of accuracy.
Returns
Pose at the path's starting point
Signature
PathPlannerPath().getStartingDifferentialPose
Get the differential pose for the start point of this path
Returns
Pose at the path's starting point
Signature
PathPlannerPath().getTrajectory
Generate a trajectory for this path.
Arguments
starting_speeds
- The robot-relative starting speeds.starting_rotation
- The starting rotation of the robot.
Returns
The generated trajectory.
Signature
def getTrajectory(
self, starting_speeds: ChassisSpeeds, starting_rotation: Rotation2d
) -> PathPlannerTrajectory: ...
PathPlannerPath().isChoreoPath
Check if this path is loaded from a Choreo trajectory
Returns
True if this path is from choreo, false otherwise
Signature
PathPlannerPath().isReversed
Should the path be followed reversed (differential drive only)
Returns
True if reversed
Signature
PathPlannerPath().numPoints
Get the number of points in this path
Returns
Number of points in the path
Signature
PathPlannerPath().replan
Replan this path based on the current robot position and speeds
Arguments
starting_pose
- New starting pose for the replanned pathcurrent_speeds
- Current chassis speeds of the robot
Returns
The replanned path
Signature
PathPoint
A point along a pathplanner path
Arguments
position
Translation2d - Position of the pointrotationTarget
RotationTarget - Rotation target at this pointconstraints
PathConstraints - The constraints at this point
Signature
PathSegment
Signature
class PathSegment:
def __init__(
self,
p1: Translation2d,
p2: Translation2d,
p3: Translation2d,
p4: Translation2d,
target_holonomic_rotations: List[RotationTarget] = [],
constraint_zones: List[ConstraintsZone] = [],
end_segment: bool = False,
): ...
See also
RotationTarget
A target holonomic rotation at a position along a path
Arguments
waypointRelativePosition
float - Waypoint relative position of this targettarget
Rotation2d - Target rotationrotateFast
bool - Should the robot reach the rotation as fast as possible
Signature
RotationTarget().forSegmentIndex
Transform the position of this target for a given segment number.
For example, a target with position 1.5 for the segment 1 will have the position 0.5
Arguments
segment_index
- The segment index to transform position for
Returns
The transformed target