public class NidecBrushless extends SendableBase implements SpeedController, MotorSafety, Sendable
DEFAULT_SAFETY_EXPIRATION
Constructor and Description |
---|
NidecBrushless(int pwmChannel,
int dioChannel)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
disable()
Disable the motor.
|
void |
enable()
Re-enable the motor after disable() has been called.
|
void |
free()
Free the resources used by this object.
|
double |
get()
Get the recently set value of the PWM.
|
int |
getChannel()
Gets the channel number associated with the object.
|
java.lang.String |
getDescription() |
double |
getExpiration()
Return the safety expiration time.
|
boolean |
getInverted()
Common interface for returning if a speed controller is in the inverted state or not.
|
void |
initSendable(SendableBuilder builder)
Initializes this
Sendable object. |
boolean |
isAlive()
Check if the motor is currently alive or stopped due to a timeout.
|
boolean |
isSafetyEnabled()
Check if motor safety is enabled.
|
void |
pidWrite(double output)
Write out the PID value as seen in the PIDOutput base object.
|
void |
set(double speed)
Set the PWM value.
|
void |
setExpiration(double timeout)
Set the safety expiration time.
|
void |
setInverted(boolean isInverted)
Common interface for inverting direction of a speed controller.
|
void |
setSafetyEnabled(boolean enabled) |
void |
stopMotor()
Stop the motor.
|
addChild, getName, getSubsystem, setName, setName, setName, setSubsystem
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getName, getSubsystem, setName, setName, setSubsystem
public NidecBrushless(int pwmChannel, int dioChannel)
pwmChannel
- The PWM channel that the Nidec Brushless controller is attached to.
0-9 are on-board, 10-19 are on the MXP portdioChannel
- The DIO channel that the Nidec Brushless controller is attached to.
0-9 are on-board, 10-25 are on the MXP portpublic void free()
free
in class SendableBase
public void set(double speed)
The PWM value is set using a range of -1.0 to 1.0, appropriately scaling the value for the FPGA.
set
in interface SpeedController
speed
- The speed value between -1.0 and 1.0 to set.public double get()
get
in interface SpeedController
public void setInverted(boolean isInverted)
SpeedController
setInverted
in interface SpeedController
isInverted
- The state of inversion true is inverted.public boolean getInverted()
SpeedController
getInverted
in interface SpeedController
public void pidWrite(double output)
public void setExpiration(double timeout)
setExpiration
in interface MotorSafety
timeout
- The timeout (in seconds) for this motor objectpublic double getExpiration()
getExpiration
in interface MotorSafety
public boolean isAlive()
isAlive
in interface MotorSafety
public void stopMotor()
stopMotor
in interface MotorSafety
stopMotor
in interface SpeedController
public boolean isSafetyEnabled()
isSafetyEnabled
in interface MotorSafety
public void setSafetyEnabled(boolean enabled)
setSafetyEnabled
in interface MotorSafety
public java.lang.String getDescription()
getDescription
in interface MotorSafety
public void disable()
disable
in interface SpeedController
public void enable()
public int getChannel()
public void initSendable(SendableBuilder builder)
Sendable
Sendable
object.initSendable
in interface Sendable
builder
- sendable builder