DrivetrainSplineSample

class wpimath.DrivetrainSplineSample(*args, **kwargs)

Bases: HolonomicSample

Represents a single sample in a spline-based drivetrain trajectory.

Overloaded function.

  1. __init__(self: wpimath._wpimath.DrivetrainSplineSample) -> None

Constructs a default DrivetrainSplineSample with all zero values.

  1. __init__(self: wpimath._wpimath.DrivetrainSplineSample, time: wpimath.units.seconds, pose: wpimath._wpimath.Pose2d, velocity: wpimath.units.meters_per_second, acceleration: wpimath.units.meters_per_second_squared, curvature: wpimath.units.radians_per_meter) -> None

Constructs a SplineSample from path-relative scalars.

The robot follows the path along its heading, so the scalar forward velocity and acceleration are rotated into the field frame using the sample’s pose. The resulting velocity and acceleration are field-relative.

Parameters:
  • time – The time of the sample relative to the trajectory start.

  • pose – The robot pose at this sample (in the field reference frame).

  • velocity – The signed forward (path-tangential) velocity.

  • acceleration – The signed forward (path-tangential) acceleration.

  • curvature – The curvature of the path at this sample.

  1. __init__(self: wpimath._wpimath.DrivetrainSplineSample, time: wpimath.units.seconds, pose: wpimath._wpimath.Pose2d, velocity: wpimath._wpimath.ChassisVelocities, acceleration: wpimath._wpimath.ChassisAccelerations, curvature: wpimath.units.radians_per_meter) -> None

Constructs a SplineSample.

Parameters:
  • time – The time of the sample relative to the trajectory start.

  • pose – The robot pose at this sample (in the field reference frame).

  • velocity – The robot velocity at this sample (in the field reference frame).

  • acceleration – The robot acceleration at this sample (in the field reference frame).

  • curvature – The curvature of the path at this sample.

  1. __init__(self: wpimath._wpimath.DrivetrainSplineSample, sample: wpimath._wpimath.HolonomicSample) -> None

Constructs a SplineSample from a generic sample. Curvature is calculated as omega / forward velocity.

Parameters:

sample – The HolonomicSample to convert.

forward_acceleration() wpimath.units.meters_per_second_squared

Returns the signed forward (robot-relative tangential) acceleration at this sample. This is the field-relative acceleration projected onto the sample’s heading.

Returns:

The forward acceleration.

forward_velocity() wpimath.units.meters_per_second

Returns the signed forward (robot-relative tangential) velocity at this sample. This is the field-relative velocity projected onto the sample’s heading.

Returns:

The forward velocity.

relative_to(other: wpimath._wpimath.Pose2d) wpimath._wpimath.DrivetrainSplineSample

Transforms this sample to be relative to the given pose.

Parameters:

other – The pose to make this sample relative to.

Returns:

A new sample with the relative pose.

transform(transform: wpimath._wpimath.Transform2d) wpimath._wpimath.DrivetrainSplineSample

Transforms the pose of this sample by the given transform.

Parameters:

transform – The transform to apply to the pose.

Returns:

A new sample with the transformed pose.