Class DrivetrainSplineSample
java.lang.Object
org.wpilib.math.trajectory.TrajectorySample
org.wpilib.math.trajectory.HolonomicSample
org.wpilib.math.trajectory.DrivetrainSplineSample
- All Implemented Interfaces:
ProtobufSerializable, StructSerializable, WPISerializable
Represents a single sample in a spline-based trajectory.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal doubleThe curvature of the path at this sample, in rad/m.Fields inherited from class HolonomicSample
acceleration, pose, proto, struct, velocityFields inherited from class TrajectorySample
time -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a DrivetrainSplineSample with all values set to zero.DrivetrainSplineSample(double time, Pose2d pose, double velocity, double acceleration, double curvature) Constructs a DrivetrainSplineSample from path-relative scalars.DrivetrainSplineSample(double time, Pose2d pose, ChassisVelocities velocity, ChassisAccelerations acceleration, double curvature) Constructs a DrivetrainSplineSample.Constructs a DrivetrainSplineSample from another HolonomicSample, assuming the other sample's linear velocity is not zero. -
Method Summary
Modifier and TypeMethodDescriptionbooleandoubleReturns the signed forward (robot-relative tangential) acceleration at this sample, in meters per second squared.doubleReturns the signed forward (robot-relative tangential) velocity at this sample, in meters per second.inthashCode()relativeTo(Pose2d other) Transforms this sample to be relative to the given pose.transform(Transform2d transform) Transforms the pose of this sample by the given transform.Methods inherited from class HolonomicSample
kinematicInterpolate
-
Field Details
-
curvature
public final double curvatureThe curvature of the path at this sample, in rad/m.
-
-
Constructor Details
-
DrivetrainSplineSample
public DrivetrainSplineSample(double time, Pose2d pose, double velocity, double acceleration, double curvature) Constructs a DrivetrainSplineSample 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
HolonomicSample.velocityandHolonomicSample.accelerationare field-relative.- Parameters:
time- The time of the sample relative to the trajectory start, in seconds.pose- The robot pose at this sample (in the field reference frame).velocity- The signed forward (path-tangential) velocity in meters per second.acceleration- The signed forward (path-tangential) acceleration in meters per second squared.curvature- The curvature of the path at this sample, in rad/m.
-
DrivetrainSplineSample
public DrivetrainSplineSample(double time, Pose2d pose, ChassisVelocities velocity, ChassisAccelerations acceleration, double curvature) Constructs a DrivetrainSplineSample.- Parameters:
time- The time of the sample relative to the trajectory start, in seconds.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, in rad/m.
-
DrivetrainSplineSample
Constructs a DrivetrainSplineSample from another HolonomicSample, assuming the other sample's linear velocity is not zero. Curvature is computed as omega / forward velocity.- Parameters:
sample- The HolonomicSample to convert.
-
DrivetrainSplineSample
public DrivetrainSplineSample()Constructs a DrivetrainSplineSample with all values set to zero.
-
-
Method Details
-
forwardVelocity
public double forwardVelocity()Returns the signed forward (robot-relative tangential) velocity at this sample, in meters per second. This is the field-relativeHolonomicSample.velocityprojected onto the sample's heading.- Returns:
- The forward velocity in meters per second.
-
forwardAcceleration
public double forwardAcceleration()Returns the signed forward (robot-relative tangential) acceleration at this sample, in meters per second squared. This is the field-relativeHolonomicSample.accelerationprojected onto the sample's heading.- Returns:
- The forward acceleration in meters per second squared.
-
transform
Transforms the pose of this sample by the given transform.- Overrides:
transformin classHolonomicSample- Parameters:
transform- The transform to apply to the pose.- Returns:
- A new sample with the transformed pose.
-
relativeTo
Transforms this sample to be relative to the given pose.- Overrides:
relativeToin classHolonomicSample- Parameters:
other- The pose to make this sample relative to.- Returns:
- A new sample with the relative pose.
-
equals
- Overrides:
equalsin classHolonomicSample
-
hashCode
public int hashCode()- Overrides:
hashCodein classHolonomicSample
-