|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.wpi.first.wpilibj.CANJaguar
public class CANJaguar
Nested Class Summary | |
---|---|
static class |
CANJaguar.ControlMode
Mode determines how the Jaguar is controlled |
static class |
CANJaguar.Faults
Faults reported by the Jaguar |
static class |
CANJaguar.LimitMode
Determines which sensor to use for position reference. |
static class |
CANJaguar.Limits
Limit switch masks |
static class |
CANJaguar.NeutralMode
Determines how the Jaguar behaves when sending a zero signal. |
static class |
CANJaguar.PositionReference
Determines which sensor to use for position reference. |
static class |
CANJaguar.SpeedReference
Determines which sensor to use for speed reference. |
Field Summary | |
---|---|
static double |
kApproxBusVoltage
|
static int |
kControllerRate
|
Fields inherited from interface edu.wpi.first.wpilibj.MotorSafety |
---|
DEFAULT_SAFETY_EXPIRATION |
Constructor Summary | |
---|---|
CANJaguar(int deviceNumber)
Constructor Default to percent Vbus control mode. |
|
CANJaguar(int deviceNumber,
CANJaguar.ControlMode controlMode)
Constructor |
Method Summary | |
---|---|
void |
changeControlMode(CANJaguar.ControlMode controlMode)
Change the control mode of this Jaguar object. |
void |
configEncoderCodesPerRev(int codesPerRev)
Configure how many codes per revolution are generated by your encoder. |
void |
configFaultTime(double faultTime)
Configure how long the Jaguar waits in the case of a fault before resuming operation. |
void |
configMaxOutputVoltage(double voltage)
Configure the maximum voltage that the Jaguar will ever output. |
void |
configNeutralMode(CANJaguar.NeutralMode mode)
Configure what the controller does to the H-Bridge when neutral (not driving the output). |
void |
configPotentiometerTurns(int turns)
Configure the number of turns on the potentiometer. |
void |
configSoftPositionLimits(double forwardLimitPosition,
double reverseLimitPosition)
Configure Soft Position Limits when in Position Controller mode. |
void |
disable()
Deprecated. Use disableControl instead. |
void |
disableControl()
Disable the closed loop controller. |
void |
disableSoftPositionLimits()
Disable Soft Position Limits if previously enabled. |
void |
enableControl()
Enable the closed loop controller. |
void |
enableControl(double encoderInitialPosition)
Enable the closed loop controller. |
double |
get()
Deprecated. Use getX instead. |
double |
getBusVoltage()
Get the voltage at the battery input terminals of the Jaguar. |
CANJaguar.ControlMode |
getControlMode()
Get the active control mode from the Jaguar. |
double |
getD()
Get the Differential gain of the controller. |
java.lang.String |
getDescription()
|
double |
getExpiration()
|
short |
getFaults()
Get the status of any faults the Jaguar has detected. |
int |
getFirmwareVersion()
Get the version of the firmware running on the Jaguar. |
boolean |
getForwardLimitOK()
Get the status of the forward limit switch. |
byte |
getHardwareVersion()
Get the version of the Jaguar hardware. |
double |
getI()
Get the Intregral gain of the controller. |
double |
getOutputCurrent()
Get the current through the motor terminals of the Jaguar. |
double |
getOutputVoltage()
Get the voltage being output from the motor terminals of the Jaguar. |
double |
getP()
Get the Proportional gain of the controller. |
double |
getPosition()
Get the position of the encoder or potentiometer. |
CANJaguar.PositionReference |
getPositionReference()
Get the reference source device for position controller mode. |
boolean |
getPowerCycled()
Check if the Jaguar's power has been cycled since this was last called. |
boolean |
getReverseLimitOK()
Get the status of the reverse limit switch. |
java.lang.String |
getSmartDashboardType()
|
double |
getSpeed()
Get the speed of the encoder. |
CANJaguar.SpeedReference |
getSpeedReference()
Get the reference source device for speed controller mode. |
ITable |
getTable()
|
double |
getTemperature()
Get the internal temperature of the Jaguar. |
protected byte |
getTransaction(int messageID,
byte[] data)
Execute a transaction with a Jaguar that gets some property. |
double |
getX()
Get the recently set outputValue setpoint. |
void |
initTable(ITable subtable)
Initializes a table for this sendable object. |
boolean |
isAlive()
|
boolean |
isSafetyEnabled()
|
void |
pidWrite(double output)
Deprecated. Use setX instead. |
protected static byte |
receiveMessage(int messageID,
byte[] data)
|
protected static byte |
receiveMessage(int messageID,
byte[] data,
double timeout)
Receive a message from the CAN bus through the CAN driver in FRC_NetworkCommunication |
protected static void |
sendMessage(int messageID,
byte[] data,
int dataSize)
Send a message on the CAN bus through the CAN driver in FRC_NetworkCommunication Trusted messages require a 2-byte token at the beginning of the data payload. |
void |
set(double outputValue)
Deprecated. Use setX instead. |
void |
set(double outputValue,
byte syncGroup)
Deprecated. Use setX instead. |
void |
setExpiration(double timeout)
|
void |
setPID(double p,
double i,
double d)
Set the P, I, and D constants for the closed loop modes. |
void |
setPositionReference(CANJaguar.PositionReference reference)
Set the reference source device for position controller mode. |
void |
setSafetyEnabled(boolean enabled)
|
void |
setSpeedReference(CANJaguar.SpeedReference reference)
Set the reference source device for speed controller mode. |
protected byte |
setTransaction(int messageID,
byte[] data,
byte dataSize)
Execute a transaction with a Jaguar that sets some property. |
void |
setVoltageRampRate(double rampRate)
Set the maximum voltage change rate. |
void |
setX(double outputValue)
Set the output set-point value. |
void |
setX(double outputValue,
byte syncGroup)
Set the output set-point value. |
void |
startLiveWindowMode()
Start having this sendable object automatically respond to value changes reflect the value on the table. |
void |
stopLiveWindowMode()
Stop having this sendable object automatically respond to value changes. |
void |
stopMotor()
Deprecated. Use disableControl instead. |
static void |
updateSyncGroup(byte syncGroup)
Update all the motors that have pending sets in the syncGroup. |
void |
updateTable()
Update the table for this sendable object with the latest values. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int kControllerRate
public static final double kApproxBusVoltage
Constructor Detail |
---|
public CANJaguar(int deviceNumber) throws CANTimeoutException
deviceNumber
- The address of the Jaguar on the CAN bus.
CANTimeoutException
public CANJaguar(int deviceNumber, CANJaguar.ControlMode controlMode) throws CANTimeoutException
deviceNumber
- The address of the Jaguar on the CAN bus.controlMode
- The control mode that the Jaguar will run in.
CANTimeoutException
Method Detail |
---|
public void setX(double outputValue) throws CANTimeoutException
outputValue
- The set-point to sent to the motor controller.
CANTimeoutException
public void set(double outputValue)
set
in interface SpeedController
outputValue
- The set-point to sent to the motor controller.public void setX(double outputValue, byte syncGroup) throws CANTimeoutException
outputValue
- The set-point to sent to the motor controller.syncGroup
- The update group to add this set() to, pending updateSyncGroup(). If 0, update immediately.
CANTimeoutException
public void set(double outputValue, byte syncGroup)
set
in interface SpeedController
outputValue
- The set-point to sent to the motor controller.syncGroup
- The update group to add this set() to, pending updateSyncGroup(). If 0, update immediately.public double getX() throws CANTimeoutException
CANTimeoutException
public double get()
get
in interface SpeedController
public void disable()
disable
in interface SpeedController
public void pidWrite(double output)
pidWrite
in interface PIDOutput
output
- Write out the percentage voltage value as was computed by the PIDControllerprotected static void sendMessage(int messageID, byte[] data, int dataSize) throws CANTimeoutException
messageID
- The messageID to be used on the CAN busdata
- The up to 8 bytes of data to be sent with the messagedataSize
- Specify how much of the data in "data" to send
CANTimeoutException
protected static byte receiveMessage(int messageID, byte[] data, double timeout) throws CANTimeoutException
messageID
- The messageID to read from the CAN busdata
- The up to 8 bytes of data that was received with the messagetimeout
- Specify how long to wait for a message (in seconds)
CANTimeoutException
protected static byte receiveMessage(int messageID, byte[] data) throws CANTimeoutException
CANTimeoutException
protected byte setTransaction(int messageID, byte[] data, byte dataSize) throws CANTimeoutException
messageID
- The messageID to be used on the CAN bus (device number is added internally)data
- The up to 8 bytes of data to be sent with the messagedataSize
- Specify how much of the data in "data" to send
CANTimeoutException
protected byte getTransaction(int messageID, byte[] data) throws CANTimeoutException
messageID
- The messageID to read from the CAN bus (device number is added internally)data
- The up to 8 bytes of data that was received with the message
CANTimeoutException
public void setSpeedReference(CANJaguar.SpeedReference reference) throws CANTimeoutException
reference
- Specify a SpeedReference.
CANTimeoutException
public CANJaguar.SpeedReference getSpeedReference() throws CANTimeoutException
CANTimeoutException
public void setPositionReference(CANJaguar.PositionReference reference) throws CANTimeoutException
reference
- Specify a PositionReference.
CANTimeoutException
public CANJaguar.PositionReference getPositionReference() throws CANTimeoutException
CANTimeoutException
public void setPID(double p, double i, double d) throws CANTimeoutException
p
- The proportional gain of the Jaguar's PID controller.i
- The integral gain of the Jaguar's PID controller.d
- The differential gain of the Jaguar's PID controller.
CANTimeoutException
public double getP() throws CANTimeoutException
CANTimeoutException
public double getI() throws CANTimeoutException
CANTimeoutException
public double getD() throws CANTimeoutException
CANTimeoutException
public void enableControl() throws CANTimeoutException
CANTimeoutException
public void enableControl(double encoderInitialPosition) throws CANTimeoutException
encoderInitialPosition
- Encoder position to set if position with encoder reference. Ignored otherwise.
CANTimeoutException
public void disableControl() throws CANTimeoutException
CANTimeoutException
public void changeControlMode(CANJaguar.ControlMode controlMode) throws CANTimeoutException
controlMode
- The new mode.
CANTimeoutException
public CANJaguar.ControlMode getControlMode() throws CANTimeoutException
CANTimeoutException
public double getBusVoltage() throws CANTimeoutException
CANTimeoutException
public double getOutputVoltage() throws CANTimeoutException
CANTimeoutException
public double getOutputCurrent() throws CANTimeoutException
CANTimeoutException
public double getTemperature() throws CANTimeoutException
CANTimeoutException
public double getPosition() throws CANTimeoutException
CANTimeoutException
public double getSpeed() throws CANTimeoutException
CANTimeoutException
public boolean getForwardLimitOK() throws CANTimeoutException
CANTimeoutException
public boolean getReverseLimitOK() throws CANTimeoutException
CANTimeoutException
public short getFaults() throws CANTimeoutException
CANTimeoutException
public boolean getPowerCycled() throws CANTimeoutException
CANTimeoutException
public void setVoltageRampRate(double rampRate) throws CANTimeoutException
rampRate
- The maximum rate of voltage change in Percent Voltage mode in V/s.
CANTimeoutException
public int getFirmwareVersion() throws CANTimeoutException
CANTimeoutException
public byte getHardwareVersion() throws CANTimeoutException
CANTimeoutException
public void configNeutralMode(CANJaguar.NeutralMode mode) throws CANTimeoutException
mode
- Select to use the jumper setting or to override it to coast or brake.
CANTimeoutException
public void configEncoderCodesPerRev(int codesPerRev) throws CANTimeoutException
codesPerRev
- The number of counts per revolution in 1X mode.
CANTimeoutException
public void configPotentiometerTurns(int turns) throws CANTimeoutException
turns
- The number of turns of the potentiometer
CANTimeoutException
public void configSoftPositionLimits(double forwardLimitPosition, double reverseLimitPosition) throws CANTimeoutException
forwardLimitPosition
- The position that if exceeded will disable the forward direction.reverseLimitPosition
- The position that if exceeded will disable the reverse direction.
CANTimeoutException
public void disableSoftPositionLimits() throws CANTimeoutException
CANTimeoutException
public void configMaxOutputVoltage(double voltage) throws CANTimeoutException
voltage
- The maximum voltage output by the Jaguar.
CANTimeoutException
public void configFaultTime(double faultTime) throws CANTimeoutException
faultTime
- The time to wait before resuming operation, in seconds.
CANTimeoutException
public static void updateSyncGroup(byte syncGroup) throws CANTimeoutException
syncGroup
- A bitmask of groups to generate synchronous output.
CANTimeoutException
public void setExpiration(double timeout)
setExpiration
in interface MotorSafety
public double getExpiration()
getExpiration
in interface MotorSafety
public boolean isAlive()
isAlive
in interface MotorSafety
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 stopMotor()
stopMotor
in interface MotorSafety
public java.lang.String getSmartDashboardType()
getSmartDashboardType
in interface Sendable
public void initTable(ITable subtable)
initTable
in interface Sendable
subtable
- The table to put the values in.public void updateTable()
updateTable
in interface LiveWindowSendable
public ITable getTable()
getTable
in interface Sendable
public void startLiveWindowMode()
startLiveWindowMode
in interface LiveWindowSendable
public void stopLiveWindowMode()
stopLiveWindowMode
in interface LiveWindowSendable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |