Class TargetAlignmentModule
- java.lang.Object
-
- com.thegongoliers.output.drivetrain.TargetAlignmentModule
-
- All Implemented Interfaces:
DriveModule
public class TargetAlignmentModule extends java.lang.Object implements DriveModule
A drivetrain module which align to vision targets
-
-
Constructor Summary
Constructors Constructor Description TargetAlignmentModule(TargetingCamera camera, double aimStrength, double rangeStrength, boolean shouldSeek)
TargetAlignmentModule(TargetingCamera camera, com.kylecorry.pid.PID aimPID, com.kylecorry.pid.PID rangePID, boolean shouldSeek)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
align(double desiredHorizontalOffset, double desiredTargetArea)
boolean
isAligning()
boolean
overridesUser()
Determines if the module should override the user's inputDriveSpeed
run(DriveSpeed currentSpeed, DriveSpeed desiredSpeed, double deltaTime)
Run the drive modulevoid
setAimPID(com.kylecorry.pid.PID aimPID)
void
setAimThreshold(double threshold)
void
setRangePID(com.kylecorry.pid.PID rangePID)
void
setRangeThreshold(double threshold)
void
setSeekSpeed(double speed)
void
setShouldSeek(boolean shouldSeek)
void
stopAligning()
-
-
-
Constructor Detail
-
TargetAlignmentModule
public TargetAlignmentModule(TargetingCamera camera, double aimStrength, double rangeStrength, boolean shouldSeek)
-
TargetAlignmentModule
public TargetAlignmentModule(TargetingCamera camera, com.kylecorry.pid.PID aimPID, com.kylecorry.pid.PID rangePID, boolean shouldSeek)
-
-
Method Detail
-
run
public DriveSpeed run(DriveSpeed currentSpeed, DriveSpeed desiredSpeed, double deltaTime)
Description copied from interface:DriveModule
Run the drive module- Specified by:
run
in interfaceDriveModule
- Parameters:
currentSpeed
- the current speed of the drivetraindesiredSpeed
- the desired speed of the drivetraindeltaTime
- the delta time since the last call in seconds- Returns:
- the speed the drivetrain should set
-
overridesUser
public boolean overridesUser()
Description copied from interface:DriveModule
Determines if the module should override the user's input- Specified by:
overridesUser
in interfaceDriveModule
- Returns:
- true if it overrides the user's input
-
align
public void align(double desiredHorizontalOffset, double desiredTargetArea)
-
stopAligning
public void stopAligning()
-
isAligning
public boolean isAligning()
-
setShouldSeek
public void setShouldSeek(boolean shouldSeek)
-
setSeekSpeed
public void setSeekSpeed(double speed)
-
setRangeThreshold
public void setRangeThreshold(double threshold)
-
setAimThreshold
public void setAimThreshold(double threshold)
-
setRangePID
public void setRangePID(com.kylecorry.pid.PID rangePID)
-
setAimPID
public void setAimPID(com.kylecorry.pid.PID aimPID)
-
-