Class TankController
- java.lang.Object
-
- frc.robot.util.hyperdrive.emulation.TankController
-
- All Implemented Interfaces:
IController
public class TankController extends java.lang.Object implements IController
Controller for tank-style robot.
-
-
Field Summary
Fields Modifier and Type Field Description static intLEFT_CONTROLLERstatic intRIGHT_CONTROLLER
-
Constructor Summary
Constructors Constructor Description TankController(IEmulateParams parameters)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublecalculateOutput(int controllerID, double setpoint, double current)Uses the specified controller to calculate the necessary percent output to acheive a value.edu.wpi.first.wpilibj.controller.PIDControllergetPIDController(int id)Returns the PIDController with the given name.
-
-
-
Field Detail
-
LEFT_CONTROLLER
public static final int LEFT_CONTROLLER
- See Also:
- Constant Field Values
-
RIGHT_CONTROLLER
public static final int RIGHT_CONTROLLER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TankController
public TankController(IEmulateParams parameters)
-
-
Method Detail
-
getPIDController
public edu.wpi.first.wpilibj.controller.PIDController getPIDController(int id)
Description copied from interface:IControllerReturns the PIDController with the given name. "Index" values will be provided through implementing classes. For example, if using aTankController, possible values are LEFT_CONTROLLER and RIGHT_CONTROLLER.- Specified by:
getPIDControllerin interfaceIController- Parameters:
id- The ID of the controller to use. As mentioned earlier, values will be provided as static fields by the implementing class.- Returns:
- The PIDController with the specified identity, or a "safe" PIDController (where all gains are set to 0) if there is no such controller.
-
calculateOutput
public double calculateOutput(int controllerID, double setpoint, double current)Description copied from interface:IControllerUses the specified controller to calculate the necessary percent output to acheive a value.- Specified by:
calculateOutputin interfaceIController- Parameters:
controllerID- The ID of the controller to use. For more information about IDs, seeIController.getPIDController(int).setpoint- The desired value to acheive.current- The current value.- Returns:
- The output required to drive the "current" value to the "desired" value.
-
-