Class ShifterModule
- java.lang.Object
-
- com.thegongoliers.output.drivetrain.ShifterModule
-
- All Implemented Interfaces:
DriveModule
public class ShifterModule extends java.lang.Object implements DriveModule
A drivetrain module which allows switching between gears.
-
-
Constructor Summary
Constructors Constructor Description ShifterModule(GearShifter shifter)
ShifterModule(GearShifter shifter, double shiftStopTime)
Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
downshift()
DriveSpeed
run(DriveSpeed currentSpeed, DriveSpeed desiredSpeed, double deltaTime)
Run the drive modulevoid
setShifter(GearShifter shifter)
void
setShiftStopTime(double shiftStopTime)
void
upshift()
-
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
-
ShifterModule
public ShifterModule(GearShifter shifter, double shiftStopTime)
Default constructor- Parameters:
shifter
- The shiftershiftStopTime
- The amount of time in seconds to stop the motors before shifting gears
-
ShifterModule
public ShifterModule(GearShifter shifter)
-
-
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
-
setShifter
public void setShifter(GearShifter shifter)
-
upshift
public void upshift()
-
downshift
public void downshift()
-
setShiftStopTime
public void setShiftStopTime(double shiftStopTime)
-
-