Package choreo.trajectory
Class DifferentialSample
java.lang.Object
choreo.trajectory.DifferentialSample
- All Implemented Interfaces:
TrajectorySample<DifferentialSample>,Interpolatable<DifferentialSample>,StructSerializable,WPISerializable
A single differential drive robot sample in a Trajectory.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal doubleThe acceleration of the left side in m/s².final doubleThe chassis angular acceleration in rad/s².final doubleThe acceleration of the right side in m/s².final doubleThe force of the left side in Newtons.final doubleThe force of the right side in Newtons.final doubleThe heading of the sample in radians, with 0 being in the +X direction.final doubleThe chassis angular velocity in rad/s.static final Struct<DifferentialSample>The struct for the DifferentialSample class.final doubleThe timestamp of this sample relative to the beginning of the trajectory.final doubleThe velocity of the left side in m/s.final doubleThe velocity of the right side in m/s.final doubleThe X position of the sample relative to the blue alliance wall origin in meters.final doubleThe Y position of the sample relative to the blue alliance wall origin in meters. -
Constructor Summary
ConstructorsConstructorDescriptionDifferentialSample(double timestamp, double x, double y, double heading, double vl, double vr, double omega, double al, double ar, double alpha, double fl, double fr) Constructs a DifferentialSample with the specified parameters. -
Method Summary
Modifier and TypeMethodDescriptionbooleanflipped()Returns this sample, mirrored across the field midline.Returns the field-relative chassis speeds of this sample.getPose()Returns the pose at this sample.doubleReturns the timestamp of this sample.interpolate(DifferentialSample endValue, double timestamp) offsetBy(double timestampOffset) Returns this sample, offset by the given timestamp.
-
Field Details
-
t
The timestamp of this sample relative to the beginning of the trajectory. -
x
The X position of the sample relative to the blue alliance wall origin in meters. -
y
The Y position of the sample relative to the blue alliance wall origin in meters. -
heading
The heading of the sample in radians, with 0 being in the +X direction. -
vl
The velocity of the left side in m/s. -
vr
The velocity of the right side in m/s. -
omega
The chassis angular velocity in rad/s. -
al
The acceleration of the left side in m/s². -
ar
The acceleration of the right side in m/s². -
alpha
The chassis angular acceleration in rad/s². -
fl
The force of the left side in Newtons. -
fr
The force of the right side in Newtons. -
struct
The struct for the DifferentialSample class.
-
-
Constructor Details
-
DifferentialSample
public DifferentialSample(double timestamp, double x, double y, double heading, double vl, double vr, double omega, double al, double ar, double alpha, double fl, double fr) Constructs a DifferentialSample with the specified parameters.- Parameters:
timestamp- The timestamp of this sample.x- The X position of the sample in meters.y- The Y position of the sample in meters.heading- The heading of the sample in radians, with 0 being in the +X direction.vl- The velocity of the left side in m/s.vr- The velocity of the right side in m/s.omega- The chassis angular velocity in rad/s.al- The acceleration of the left side in m/s².ar- The acceleration of the right side in m/s².alpha- The chassis angular acceleration in rad/s².fl- The force of the left side in Newtons.fr- The force of the right side in Newtons.
-
-
Method Details
-
getTimestamp
Description copied from interface:TrajectorySampleReturns the timestamp of this sample.- Specified by:
getTimestampin interfaceTrajectorySample<DifferentialSample>- Returns:
- the timestamp of this sample.
-
getPose
Description copied from interface:TrajectorySampleReturns the pose at this sample.- Specified by:
getPosein interfaceTrajectorySample<DifferentialSample>- Returns:
- the pose at this sample.
-
getChassisSpeeds
Returns the field-relative chassis speeds of this sample.- Specified by:
getChassisSpeedsin interfaceTrajectorySample<DifferentialSample>- Returns:
- the field-relative chassis speeds of this sample.
- See Also:
-
interpolate
- Specified by:
interpolatein interfaceInterpolatable<DifferentialSample>
-
flipped
Description copied from interface:TrajectorySampleReturns this sample, mirrored across the field midline.- Specified by:
flippedin interfaceTrajectorySample<DifferentialSample>- Returns:
- this sample, mirrored across the field midline.
-
offsetBy
Description copied from interface:TrajectorySampleReturns this sample, offset by the given timestamp.- Specified by:
offsetByin interfaceTrajectorySample<DifferentialSample>- Parameters:
timestampOffset- the offset to apply to the timestamp.- Returns:
- this sample, offset by the given timestamp.
-
equals
-