Class WsMotorController
- java.lang.Object
-
- org.wildstang.framework.io.outputs.Output
-
- org.wildstang.framework.io.outputs.AnalogOutput
-
- org.wildstang.hardware.roborio.outputs.WsMotorController
-
- Direct Known Subclasses:
WsPhoenix
,WsSparkMax
public abstract class WsMotorController extends AnalogOutput
Abstract class decribing those that control some kind of motor controller.
-
-
Constructor Summary
Constructors Constructor Description WsMotorController(java.lang.String p_name)
Generic motor controller constructor, cannot be called.WsMotorController(java.lang.String p_name, double p_default)
Generic motor controller constructor, cannot be called.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
addFollower(int canConstant, WsMotorControllers controller, boolean oppose)
Add a follower motor to the current motor.abstract void
disableCurrentLimit()
Disables the current limit of the motor controller.abstract java.lang.Object
getController()
Returns the raw motor controller Object.abstract java.lang.Object
getFollower()
Returns the raw follower motor controller Object.abstract double
getOutput()
Returns the current motor output percent.abstract double
getPosition()
Returns the quadrature position from an encoder.abstract double
getTemperature()
Return the motor controller or motor temperatureabstract double
getVelocity()
Returns the quadrature velocity from an encoder.abstract void
resetEncoder()
Resets the position of the encoder.abstract void
sendDataToOutput()
Sets motor speed to current value, from -1.0 to 1.0.abstract void
setBrake()
Sets the motor to brake mode, will not freely spin.abstract void
setCoast()
Sets the motor to coast mode, will freely spin.abstract void
setCurrentLimit(int a, int b, int c)
Sets the current limit of the motor controller.void
setSpeed(double value)
Wraps setValue().void
stop()
Sets the motors to 0 speed.-
Methods inherited from class org.wildstang.framework.io.outputs.AnalogOutput
getValue, setValue
-
-
-
-
Constructor Detail
-
WsMotorController
public WsMotorController(java.lang.String p_name)
Generic motor controller constructor, cannot be called.- Parameters:
p_name
- Descriptive name of the controller.
-
WsMotorController
public WsMotorController(java.lang.String p_name, double p_default)
Generic motor controller constructor, cannot be called.- Parameters:
p_name
- Descriptive name of the controller.p_default
- Default output value.
-
-
Method Detail
-
addFollower
public abstract void addFollower(int canConstant, WsMotorControllers controller, boolean oppose)
Add a follower motor to the current motor.- Parameters:
canConstant
- CAN constant of the new follower motor.controller
- Enumeration representing type of controller.oppose
- True if the follow should oppose the direction of this motor.
-
getController
public abstract java.lang.Object getController()
Returns the raw motor controller Object.- Returns:
- Motor controller object.
-
getFollower
public abstract java.lang.Object getFollower()
Returns the raw follower motor controller Object.- Returns:
- Follower motor controller object, null if no follower.
-
setBrake
public abstract void setBrake()
Sets the motor to brake mode, will not freely spin.
-
setCoast
public abstract void setCoast()
Sets the motor to coast mode, will freely spin.
-
setCurrentLimit
public abstract void setCurrentLimit(int a, int b, int c)
Sets the current limit of the motor controller. Note: parameters may vary- Parameters:
a
- See child class for parameter.b
- See child class for parameter.c
- See child class for parameter.
-
disableCurrentLimit
public abstract void disableCurrentLimit()
Disables the current limit of the motor controller.
-
getVelocity
public abstract double getVelocity()
Returns the quadrature velocity from an encoder.- Returns:
- Current velocity.
-
getPosition
public abstract double getPosition()
Returns the quadrature position from an encoder.- Returns:
- Current position.
-
resetEncoder
public abstract void resetEncoder()
Resets the position of the encoder.
-
getOutput
public abstract double getOutput()
Returns the current motor output percent.- Returns:
- Current motor output as a percent.
-
getTemperature
public abstract double getTemperature()
Return the motor controller or motor temperature- Returns:
- Current temperature.
-
sendDataToOutput
public abstract void sendDataToOutput()
Sets motor speed to current value, from -1.0 to 1.0.- Specified by:
sendDataToOutput
in classOutput
-
setSpeed
public void setSpeed(double value)
Wraps setValue().- Parameters:
value
- New motor percent speed, from -1.0 to 1.0.
-
stop
public void stop()
Sets the motors to 0 speed.
-
-