Class PowerEfficiencyModule

  • 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 Detail

      • PowerEfficiencyModule

        public PowerEfficiencyModule​(double secondsToReachFullSpeed,
                                     double turnThreshold)
        Default constructor
        Parameters:
        secondsToReachFullSpeed - the ramping time in seconds from 0 to full speed
        turnThreshold - 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 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
      • 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.