Class ShifterModule

  • All Implemented Interfaces:
    DriveModule

    public class ShifterModule
    extends java.lang.Object
    implements DriveModule
    A drivetrain module which allows switching between gears.
    • Constructor Detail

      • ShifterModule

        public ShifterModule​(GearShifter shifter,
                             double shiftStopTime)
        Default constructor
        Parameters:
        shifter - The shifter
        shiftStopTime - 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 interface DriveModule
        Parameters:
        currentSpeed - the current speed of the drivetrain
        desiredSpeed - the desired speed of the drivetrain
        deltaTime - 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)