Class HeadingTransformProcessor
- java.lang.Object
-
- org.team1540.rooster.drive.pipeline.HeadingTransformProcessor
-
- All Implemented Interfaces:
Function<TankDriveData,TankDriveData>
,Processor<TankDriveData,TankDriveData>
public class HeadingTransformProcessor extends Object implements Processor<TankDriveData,TankDriveData>
Processor
to convert headings on [0,2π] to [-π, π] and vice versa. (This class also supports degrees by passingtrue
as the second argument toHeadingTransformProcessor(boolean, boolean)
. This class is aProcessor
that usesTankDriveData
. All fields are passed through as-is except for the heading field which is converted if it is present.
-
-
Constructor Summary
Constructors Constructor Description HeadingTransformProcessor(boolean outputPositive)
Create a newHeadingTransformProcessor
that uses radians.HeadingTransformProcessor(boolean outputPositive, boolean radians)
Create a newHeadingTransformProcessor
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TankDriveData
apply(TankDriveData data)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.team1540.rooster.functional.Processor
followedBy, process
-
-
-
-
Constructor Detail
-
HeadingTransformProcessor
public HeadingTransformProcessor(boolean outputPositive)
Create a newHeadingTransformProcessor
that uses radians.- Parameters:
outputPositive
- Whether to output values in the range [0,2π] (i.e. [0,360]). Iftrue
, creates aHeadingTransformProcessor
to convert angles on [-π, π] to angles on [0,2π]; iffalse
, creates one that does the reverse.
-
HeadingTransformProcessor
public HeadingTransformProcessor(boolean outputPositive, boolean radians)
Create a newHeadingTransformProcessor
.- Parameters:
outputPositive
- Whether to output values in the range [0,2π] (or [0,360]). Iftrue
, creates aHeadingTransformProcessor
to convert angles on [-π, π] to angles on [0,2π]; iffalse
, creates one that does the reverse.radians
- Whether to use radians. Iftrue
, assumes inputs are in radians; otherwise, uses degrees.
-
-
Method Detail
-
apply
public TankDriveData apply(TankDriveData data)
- Specified by:
apply
in interfaceFunction<TankDriveData,TankDriveData>
-
-