Class VoltageControlModule
- java.lang.Object
-
- com.thegongoliers.output.drivetrain.VoltageControlModule
-
- All Implemented Interfaces:
DriveModule
public class VoltageControlModule extends java.lang.Object implements DriveModule
Ensures that the drivetrain runs at a consistent voltage, compensating for battery voltage fluctuations
-
-
Constructor Summary
Constructors Constructor Description VoltageControlModule(double maxVoltage)VoltageControlModule(double maxVoltage, VoltageSensor batteryVoltage)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DriveSpeedrun(DriveSpeed currentSpeed, DriveSpeed desiredSpeed, double deltaTime)Run the drive modulevoidsetMaxVoltage(double maxVoltage)-
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
-
VoltageControlModule
public VoltageControlModule(double maxVoltage, VoltageSensor batteryVoltage)- Parameters:
maxVoltage- The maximum voltage of the drivetrain motors when the input speed is 1 (in volts)batteryVoltage- The battery voltage sensor
-
VoltageControlModule
public VoltageControlModule(double maxVoltage)
- Parameters:
maxVoltage- The maximum voltage of the drivetrain motors when the input speed is 1 (in volts)
-
-
Method Detail
-
run
public DriveSpeed run(DriveSpeed currentSpeed, DriveSpeed desiredSpeed, double deltaTime)
Description copied from interface:DriveModuleRun the drive module- Specified by:
runin 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
-
setMaxVoltage
public void setMaxVoltage(double maxVoltage)
-
-