Class PowerEfficiencyModule
- java.lang.Object
-
- com.thegongoliers.output.drivetrain.RampModule
-
- All Implemented Interfaces:
DriveModule
public class PowerEfficiencyModule extends java.lang.Object implements DriveModule
A drivetrain module which will force the drivetrain to accelerate slower.
-
-
Constructor Summary
Constructors Constructor Description PowerEfficiencyModule(double secondsToReachFullSpeed)
Default constructorPowerEfficiencyModule(double secondsToReachFullSpeed, double turnThreshold)
Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DriveSpeed
run(DriveSpeed currentSpeed, DriveSpeed desiredSpeed, double deltaTime)
Run the drive modulevoid
setRampingTime(double secondsToReachFullSpeed)
void
setTurnThreshold(double turnThreshold)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.thegongoliers.output.drivetrain.DriveModule
overridesUser
-
-
-
-
Constructor Detail
-
PowerEfficiencyModule
public PowerEfficiencyModule(double secondsToReachFullSpeed, double turnThreshold)
Default constructor- Parameters:
secondsToReachFullSpeed
- the ramping time in seconds from 0 to full speedturnThreshold
- the maximum difference between the two wheel speeds to run the power efficiency module on. Defaults to 2.
-
PowerEfficiencyModule
public PowerEfficiencyModule(double secondsToReachFullSpeed)
Default constructor- Parameters:
secondsToReachFullSpeed
- the ramping time in seconds from 0 to full speed
-
-
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
-
setRampingTime
public void setRampingTime(double secondsToReachFullSpeed)
- Parameters:
secondsToReachFullSpeed
- the ramping time in seconds from 0 to full speed
-
setTurnThreshold
public void setTurnThreshold(double turnThreshold)
- Parameters:
turnThreshold
- the maximum difference between the two wheel speeds to run the power efficiency module on. Defaults to 2.
-
-