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
Modifier and TypeFieldDescriptionfinal double
The acceleration of the left side in m/s².final double
The acceleration of the right side in m/s².final double
The force of the left side in Newtons.final double
The force of the right side in Newtons.final double
The heading of the sample in radians, with 0 being in the +X direction.static final Struct<DifferentialSample>
The struct for the DifferentialSample class.final double
The timestamp of this sample relative to the beginning of the trajectory.final double
The velocity of the left side in m/s.final double
The velocity of the right side in m/s.final double
The X position of the sample relative to the blue alliance wall origin in meters.final double
The Y position of the sample relative to the blue alliance wall origin in meters. -
Constructor Summary
ConstructorDescriptionDifferentialSample
(double timestamp, double x, double y, double heading, double vl, double vr, double al, double ar, double fl, double fr) Constructs a DifferentialSample with the specified parameters. -
Method Summary
Modifier and TypeMethodDescriptionboolean
flipped()
Returns this sample, mirrored across the field midline.Returns the field-relative chassis speeds of this sample.getPose()
Returns the pose at this sample.double
Returns the timestamp of this sample.interpolate
(DifferentialSample endValue, double timestamp) makeArray
(int length) For internal use only.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. -
al
The acceleration of the left side in m/s². -
ar
The acceleration of the right side in m/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 al, double ar, 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.al
- The acceleration of the left side in m/s².ar
- The acceleration of the right side in m/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:TrajectorySample
Returns the timestamp of this sample.- Specified by:
getTimestamp
in interfaceTrajectorySample<DifferentialSample>
- Returns:
- the timestamp of this sample.
-
getPose
Description copied from interface:TrajectorySample
Returns the pose at this sample.- Specified by:
getPose
in interfaceTrajectorySample<DifferentialSample>
- Returns:
- the pose at this sample.
-
getChassisSpeeds
Returns the field-relative chassis speeds of this sample.- Specified by:
getChassisSpeeds
in interfaceTrajectorySample<DifferentialSample>
- Returns:
- the field-relative chassis speeds of this sample.
- See Also:
-
interpolate
- Specified by:
interpolate
in interfaceInterpolatable<DifferentialSample>
-
flipped
Description copied from interface:TrajectorySample
Returns this sample, mirrored across the field midline.- Specified by:
flipped
in interfaceTrajectorySample<DifferentialSample>
- Returns:
- this sample, mirrored across the field midline.
-
offsetBy
Description copied from interface:TrajectorySample
Returns this sample, offset by the given timestamp.- Specified by:
offsetBy
in interfaceTrajectorySample<DifferentialSample>
- Parameters:
timestampOffset
- the offset to apply to the timestamp.- Returns:
- this sample, offset by the given timestamp.
-
makeArray
Description copied from interface:TrajectorySample
For internal use only.- Specified by:
makeArray
in interfaceTrajectorySample<DifferentialSample>
- Parameters:
length
- the length of the array to create.- Returns:
- the created array.
-
equals
-