public final class CANJaguar extends java.lang.Object implements ActuatorModule, ControllerModule, SpeedController, MotorSafety, RateSource, LiveWindowSendable
| Modifier and Type | Class and Description |
|---|---|
static class |
CANJaguar.ControlMode
Mode determines how the Jaguar is controlled, used internally.
|
private static class |
CANJaguar.EncoderTag |
static class |
CANJaguar.LimitMode
Determines which sensor to use for position reference.
|
static class |
CANJaguar.NeutralMode
Determines how the Jaguar behaves when sending a zero signal.
|
private static class |
CANJaguar.PotentiometerTag |
private static class |
CANJaguar.QuadEncoderTag |
| Modifier and Type | Field and Description |
|---|---|
static double |
kApproxBusVoltage |
static int |
kBusVoltageFault |
static int |
kControllerRate |
static int |
kCurrentFault |
static CANJaguar.EncoderTag |
kEncoder
Sets an encoder as the speed reference only.
|
static int |
kForwardLimit
Limit switch masks
|
private static int |
kFullMessageIDMask |
static int |
kGateDriverFault |
static int |
kMaxMessageDataSize |
static CANJaguar.PotentiometerTag |
kPotentiometer
Sets a potentiometer as the position reference only.
|
static CANJaguar.QuadEncoderTag |
kQuadEncoder
Sets a quadrature encoder as the position and speed reference.
|
(package private) static int |
kReceiveStatusAttempts |
static int |
kReverseLimit |
private static int |
kSendMessagePeriod |
static int |
kTemperatureFault |
private static java.util.BitSet |
m_allocated |
private double |
m_busVoltage |
(package private) boolean |
m_controlEnabled |
private CANJaguar.ControlMode |
m_controlMode |
private boolean |
m_controlModeVerified |
private double |
m_d |
private java.lang.String |
m_description |
private byte |
m_deviceNumber |
private boolean |
m_dVerified |
private short |
m_encoderCodesPerRev |
private boolean |
m_encoderCodesPerRevVerified |
private short |
m_faults |
private float |
m_faultTime |
private boolean |
m_faultTimeVerified |
private int |
m_firmwareVersion |
private double |
m_forwardLimit |
private boolean |
m_forwardLimitVerified |
private byte |
m_hardwareVersion |
private double |
m_i |
private boolean |
m_inverted |
private boolean |
m_iVerified |
private CANJaguar.LimitMode |
m_limitMode |
private boolean |
m_limitModeVerified |
private byte |
m_limits |
private ITableListener |
m_listener |
private double |
m_maxOutputVoltage |
private boolean |
m_maxOutputVoltageVerified |
private CANJaguar.NeutralMode |
m_neutralMode |
private boolean |
m_neutralModeVerified |
private double |
m_outputCurrent |
private double |
m_outputVoltage |
private double |
m_p |
private double |
m_position |
private int |
m_positionReference |
private boolean |
m_posRefVerified |
private short |
m_potentiometerTurns |
private boolean |
m_potentiometerTurnsVerified |
private boolean |
m_pVerified |
private boolean |
m_receivedStatusMessage0 |
private boolean |
m_receivedStatusMessage1 |
private boolean |
m_receivedStatusMessage2 |
private double |
m_reverseLimit |
private boolean |
m_reverseLimitVerified |
private MotorSafetyHelper |
m_safetyHelper |
private double |
m_speed |
private int |
m_speedReference |
private boolean |
m_speedRefVerified |
private ITable |
m_table |
private double |
m_temperature |
private double |
m_value |
private double |
m_voltageRampRate |
private boolean |
m_voltageRampRateVerified |
SAFETY_TIMEOUT_DEFAULT, SAFETY_TIMEOUT_LOOSE, SAFETY_TIMEOUT_STRICT| Constructor and Description |
|---|
CANJaguar(int deviceNumber)
Constructor for the CANJaguar device.
By default the device is configured in Percent mode. |
CANJaguar(int deviceNumber,
java.lang.String desc)
Constructor for the CANJaguar device.
By default the device is configured in Percent mode. |
CANJaguar(int deviceNumber,
java.lang.String desc,
PDP.PowerChannel pwChannel)
Constructor for the CANJaguar device.
By default the device is configured in Percent mode. |
| Modifier and Type | Method and Description |
|---|---|
private void |
changeControlMode(CANJaguar.ControlMode controlMode)
Used internally.
|
void |
configEncoderCodesPerRev(int codesPerRev)
Configure how many codes per revolution are generated by your encoder.
|
void |
configFaultTime(float faultTime)
Configure how long the Jaguar waits in the case of a fault before resuming operation.
|
void |
configForwardLimit(double forwardLimitPosition)
Set the position that, if exceeded, will disable the forward direction.
|
void |
configLimitMode(CANJaguar.LimitMode mode)
Set the limit mode for position control mode.
Use configSoftPositionLimits(double, double) or disableSoftPositionLimits() to set this
automatically. |
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 |
configReverseLimit(double reverseLimitPosition)
Set the position that, if exceeded, will disable the reverse direction.
|
void |
configSoftPositionLimits(double forwardLimitPosition,
double reverseLimitPosition)
Configure Soft Position Limits when in Position Controller mode.
When controlling position, you can add additional limits on top of the limit switch inputs that are based on the position feedback. |
void |
disable()
Deprecated.
Call
disableControl() instead. |
void |
disableControl()
Disable the closed loop controller.
|
void |
disableModule()
Disable the module
|
void |
disableSoftPositionLimits()
Disable Soft Position Limits if previously enabled.
Soft Position Limits are disabled by default. |
void |
enableControl()
Enable the closed loop controller.
|
void |
enableControl(double encoderInitialPosition)
Enable the closed loop controller.
|
void |
enableModule()
Enable the module
|
void |
free()
Cancel periodic messages to the Jaguar, effectively disabling it.
|
boolean |
FXP16_EQ(double a,
double b)
Compare floats for equality as fixed point numbers
|
boolean |
FXP8_EQ(double a,
double b)
Compare floats for equality as fixed point numbers
|
double |
get()
Get the recently set outputValue set point.
|
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 Derivative gain of the controller.
|
java.lang.String |
getDescription()
Gets the description.
|
int |
getDeviceID() |
(package private) int |
getDeviceNumber() |
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 Integral gain of the controller.
|
protected void |
getMessage(int messageID,
int messageMask,
byte[] data)
Get a previously requested message.
|
boolean |
getModuleEnabled() |
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.
|
double |
getRate()
Get the speed of the encoder in RPM.
|
boolean |
getReverseLimitOK()
Get the status of the reverse limit switch.
|
MotorSafetyHelper |
getSafetyHelper()
Return the MotorSafetyHelper object for this MotorSafety Object
|
java.lang.String |
getSmartDashboardType() |
double |
getSpeed()
Common interface for getting the current set speed of a speed
controller.
|
ITable |
getTable() |
double |
getTemperature()
Get the internal temperature of the Jaguar.
|
void |
initTable(ITable subtable) |
void |
makeSafe()
Make this actuator safe.
|
private static byte |
packFXP16_16(byte[] buffer,
double value) |
private static byte |
packFXP8_8(byte[] buffer,
double value) |
private static byte |
packINT16(byte[] buffer,
short value) |
private static byte |
packPercentage(byte[] buffer,
double value) |
void |
pidWrite(double output) |
protected void |
requestMessage(int messageID)
Request a message from the Jaguar, but don't wait for it to arrive.
|
protected void |
requestMessage(int messageID,
int period)
Request a message from the Jaguar, but don't wait for it to arrive.
|
protected void |
sendMessage(int messageID,
byte[] data,
int dataSize)
Send a message to the Jaguar, non-periodically
|
protected void |
sendMessage(int messageID,
byte[] data,
int dataSize,
int period)
Send a message to the Jaguar.
|
(package private) static void |
sendMessageHelper(int messageID,
byte[] data,
int dataSize,
int period) |
void |
set(double value)
Sets the output set-point value.
|
void |
set(double outputValue,
byte syncGroup)
Sets the output set-point value.
|
void |
setCurrentMode(CANJaguar.EncoderTag tag,
int codesPerRev,
double p,
double i,
double d)
Enable controlling the motor current with a PID loop, and enable speed
sensing from a non-quadrature encoder.
After calling this you must call enableControl() or enableControl(double) to enable the device. |
void |
setCurrentMode(CANJaguar.PotentiometerTag tag,
double p,
double i,
double d)
Enable controlling the motor current with a PID loop, and enable position
sensing from a potentiometer.
After calling this you must call enableControl() or enableControl(double) to enable the device. |
void |
setCurrentMode(CANJaguar.QuadEncoderTag tag,
int codesPerRev,
double p,
double i,
double d)
Enable controlling the motor current with a PID loop, and enable speed and
position sensing from a quadrature encoder.
After calling this you must call enableControl() or enableControl(double) to enable the device. |
void |
setCurrentMode(double p,
double i,
double d)
Enable controlling the motor current with a PID loop.
After calling this you must call enableControl() or enableControl(double) to enable the device. |
void |
setD(double d)
Set the D constant for the closed loop modes.
|
void |
setI(double i)
Set the I constant for the closed loop modes.
|
void |
setInverted(boolean inverted)
Set the inverted state of the speed controller.
|
void |
setP(double p)
Set the P constant for the closed loop modes.
|
void |
setPercentMode()
Enable controlling the motor voltage as a percentage of the bus voltage
without any position or speed feedback.
After calling this you must call enableControl() or enableControl(double) to enable the device. |
void |
setPercentMode(CANJaguar.EncoderTag tag,
int codesPerRev)
Enable controlling the motor voltage as a percentage of the bus voltage,
and enable speed sensing from a non-quadrature encoder.
After calling this you must call enableControl() or enableControl(double) to enable the device. |
void |
setPercentMode(CANJaguar.PotentiometerTag tag)
Enable controlling the motor voltage as a percentage of the bus voltage,
and enable position sensing from a potentiometer and no speed feedback.
After calling this you must call enableControl() or enableControl(double) to enable the device. |
void |
setPercentMode(CANJaguar.QuadEncoderTag tag,
int codesPerRev)
Enable controlling the motor voltage as a percentage of the bus voltage,
and enable position and speed sensing from a quadrature encoder.
After calling this you must call enableControl() or enableControl(double) to enable the device. |
void |
setPID(double p,
double i,
double d)
Set the P, I, and D constants for the closed loop modes.
|
void |
setPositionMode(CANJaguar.PotentiometerTag tag,
double p,
double i,
double d)
Enable controlling the position with a feedback loop using a potentiometer.
After calling this you must call enableControl() or enableControl(double) to enable the device. |
void |
setPositionMode(CANJaguar.QuadEncoderTag tag,
int codesPerRev,
double p,
double i,
double d)
Enable controlling the position with a feedback loop using an encoder.
After calling this you must call enableControl() or enableControl(double) to enable the device. |
private void |
setPositionReference(int reference)
Set the reference source device for position controller mode.
|
void |
setSpeed(double speed)
Set the speed of the SpeedController
|
void |
setSpeedMode(CANJaguar.EncoderTag tag,
int codesPerRev,
double p,
double i,
double d)
Enable controlling the speed with a feedback loop from a non-quadrature
encoder.
After calling this you must call enableControl() or enableControl(double) to enable the device. |
void |
setSpeedMode(CANJaguar.QuadEncoderTag tag,
int codesPerRev,
double p,
double i,
double d)
Enable controlling the speed with a feedback loop from a quadrature encoder.
After calling this you must call enableControl() or enableControl(double) to enable the device. |
private void |
setSpeedReference(int reference)
Set the reference source device for speed controller mode.
|
protected void |
setupPeriodicStatus()
Enables periodic status updates from the Jaguar
|
void |
setVoltageMode()
Enable controlling the motor voltage without any position or speed feedback.
After calling this you must call enableControl() or enableControl(double) to enable the device. |
void |
setVoltageMode(CANJaguar.EncoderTag tag,
int codesPerRev)
Enable controlling the motor voltage with speed feedback from a
non-quadrature encoder and no position feedback.
After calling this you must call enableControl() or enableControl(double) to enable the device. |
void |
setVoltageMode(CANJaguar.PotentiometerTag tag)
Enable controlling the motor voltage with position feedback from a
potentiometer and no speed feedback.
|
void |
setVoltageMode(CANJaguar.QuadEncoderTag tag,
int codesPerRev)
Enable controlling the motor voltage with position and speed feedback from a
quadrature encoder.
After calling this you must call enableControl() or enableControl(double) to enable the device. |
void |
setVoltageRampRate(double rampRate)
set the maximum voltage change rate.
|
void |
startLiveWindowMode() |
void |
stopLiveWindowMode() |
void |
stopMotor()
Stop/Disable the motor.
|
private static void |
swap16(int x,
byte[] buffer)
we are on ARM-LE now, not Freescale so no need to swap
|
private static void |
swap32(int x,
byte[] buffer) |
private static short |
unpack16(byte[] buffer,
int offset)
Unpack 16-bit data from a buffer in little-endian byte order
|
private static int |
unpack32(byte[] buffer,
int offset)
Unpack 32-bit data from a buffer in little-endian byte order
|
private static double |
unpackFXP16_16(byte[] buffer) |
private static double |
unpackFXP8_8(byte[] buffer) |
private static short |
unpackINT16(byte[] buffer) |
private static int |
unpackINT32(byte[] buffer) |
private static double |
unpackPercentage(byte[] buffer) |
protected void |
updatePeriodicStatus()
Check for new periodic status updates and unpack them into local variables.
|
static void |
updateSyncGroup(byte syncGroup)
Update all the motors that have pending sets in the syncGroup.
|
void |
updateTable() |
protected void |
verify()
Check all unverified params and make sure they're equal to their local
cached versions.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfeed, getSafetyExpiration, isAlive, isSafetyEnabled, setSafetyEnabled, setSafetyExpirationpublic static final int kMaxMessageDataSize
public static final int kControllerRate
public static final double kApproxBusVoltage
private MotorSafetyHelper m_safetyHelper
private static final int kFullMessageIDMask
private static final int kSendMessagePeriod
private static java.util.BitSet m_allocated
public static final CANJaguar.EncoderTag kEncoder
public static final CANJaguar.QuadEncoderTag kQuadEncoder
public static final CANJaguar.PotentiometerTag kPotentiometer
public static final int kCurrentFault
public static final int kTemperatureFault
public static final int kBusVoltageFault
public static final int kGateDriverFault
public static final int kForwardLimit
public static final int kReverseLimit
private byte m_deviceNumber
private double m_value
private CANJaguar.ControlMode m_controlMode
private int m_speedReference
private int m_positionReference
private double m_p
private double m_i
private double m_d
private CANJaguar.NeutralMode m_neutralMode
private short m_encoderCodesPerRev
private short m_potentiometerTurns
private CANJaguar.LimitMode m_limitMode
private double m_forwardLimit
private double m_reverseLimit
private double m_maxOutputVoltage
private double m_voltageRampRate
private float m_faultTime
private java.lang.String m_description
private boolean m_controlModeVerified
private boolean m_speedRefVerified
private boolean m_posRefVerified
private boolean m_pVerified
private boolean m_iVerified
private boolean m_dVerified
private boolean m_neutralModeVerified
private boolean m_encoderCodesPerRevVerified
private boolean m_potentiometerTurnsVerified
private boolean m_forwardLimitVerified
private boolean m_reverseLimitVerified
private boolean m_limitModeVerified
private boolean m_maxOutputVoltageVerified
private boolean m_voltageRampRateVerified
private boolean m_faultTimeVerified
private double m_busVoltage
private double m_outputVoltage
private double m_outputCurrent
private double m_temperature
private double m_position
private double m_speed
private byte m_limits
private short m_faults
private int m_firmwareVersion
private byte m_hardwareVersion
private boolean m_inverted
private boolean m_receivedStatusMessage0
private boolean m_receivedStatusMessage1
private boolean m_receivedStatusMessage2
private ITable m_table
private ITableListener m_listener
static final int kReceiveStatusAttempts
boolean m_controlEnabled
public CANJaguar(int deviceNumber)
deviceNumber - The address of the Jaguar on the CAN bus.setCurrentMode(double, double, double),
setCurrentMode(PotentiometerTag, double, double, double),
setCurrentMode(EncoderTag, int, double, double, double),
setCurrentMode(QuadEncoderTag, int, double, double, double),
setPercentMode(),
setPercentMode(PotentiometerTag),
setPercentMode(EncoderTag, int),
setPercentMode(QuadEncoderTag, int),
setPositionMode(PotentiometerTag, double, double, double),
setPositionMode(QuadEncoderTag, int, double, double, double),
setSpeedMode(EncoderTag, int, double, double, double),
setSpeedMode(QuadEncoderTag, int, double, double, double),
setVoltageMode(),
setVoltageMode(PotentiometerTag),
setVoltageMode(EncoderTag, int),
setVoltageMode(QuadEncoderTag, int)public CANJaguar(int deviceNumber,
java.lang.String desc)
deviceNumber - The address of the Jaguar on the CAN bus.desc - The description of this CANJaguarsetCurrentMode(double, double, double),
setCurrentMode(PotentiometerTag, double, double, double),
setCurrentMode(EncoderTag, int, double, double, double),
setCurrentMode(QuadEncoderTag, int, double, double, double),
setPercentMode(),
setPercentMode(PotentiometerTag),
setPercentMode(EncoderTag, int),
setPercentMode(QuadEncoderTag, int),
setPositionMode(PotentiometerTag, double, double, double),
setPositionMode(QuadEncoderTag, int, double, double, double),
setSpeedMode(EncoderTag, int, double, double, double),
setSpeedMode(QuadEncoderTag, int, double, double, double),
setVoltageMode(),
setVoltageMode(PotentiometerTag),
setVoltageMode(EncoderTag, int),
setVoltageMode(QuadEncoderTag, int)public CANJaguar(int deviceNumber,
java.lang.String desc,
PDP.PowerChannel pwChannel)
deviceNumber - The address of the Jaguar on the CAN bus.desc - The description of this CANJaguarpwChannel - the PowerChannel this is running on.setCurrentMode(double, double, double),
setCurrentMode(PotentiometerTag, double, double, double),
setCurrentMode(EncoderTag, int, double, double, double),
setCurrentMode(QuadEncoderTag, int, double, double, double),
setPercentMode(),
setPercentMode(PotentiometerTag),
setPercentMode(EncoderTag, int),
setPercentMode(QuadEncoderTag, int),
setPositionMode(PotentiometerTag, double, double, double),
setPositionMode(QuadEncoderTag, int, double, double, double),
setSpeedMode(EncoderTag, int, double, double, double),
setSpeedMode(QuadEncoderTag, int, double, double, double),
setVoltageMode(),
setVoltageMode(PotentiometerTag),
setVoltageMode(EncoderTag, int),
setVoltageMode(QuadEncoderTag, int)public void free()
int getDeviceNumber()
public double get()
public double getSpeed()
getSpeed in interface SpeedSourcegetSpeed in interface SpeedControllerpublic void set(double outputValue,
byte syncGroup)
set in interface SpeedControlleroutputValue - 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 void set(double value)
value - The set-point to sent to the motor controller.public void setSpeed(double speed)
setSpeed in interface SpeedSinksetSpeed in interface SpeedControllervalue - The set-point to sent to the motor controller.public void setInverted(boolean inverted)
setInverted in interface SpeedControllerinverted - true to invert the values sent to the motor.protected void verify()
@Deprecated public void disable()
disableControl() instead.public void pidWrite(double output)
pidWrite in interface PIDSinkpidWrite in interface SpeedControllerprivate void setSpeedReference(int reference)
reference - Specify a speed reference.private void setPositionReference(int reference)
reference - Specify a position reference.public void setP(double p)
p - The proportional gain of the Jaguar's PID controller.public void setI(double i)
i - The integral gain of the Jaguar's PID controller.public void setD(double d)
d - The derivative gain of the Jaguar's PID controller.public void setPID(double p,
double i,
double d)
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.public double getP()
public double getI()
public double getD()
public void enableControl(double encoderInitialPosition)
encoderInitialPosition - Encoder position to set if position with encoder reference. Ignored otherwise.public void enableControl()
CANJaguar.enableControl(double encoderInitialPosition)
with encoderInitialPosition set to 0.0public void disableControl()
public void setPercentMode()
enableControl() or enableControl(double) to enable the device.public void setPercentMode(CANJaguar.EncoderTag tag, int codesPerRev)
enableControl() or enableControl(double) to enable the device.tag - The constant kEncodercodesPerRev - The counts per revolution on the encoderpublic void setPercentMode(CANJaguar.QuadEncoderTag tag, int codesPerRev)
enableControl() or enableControl(double) to enable the device.tag - The constant kQuadEncodercodesPerRev - The counts per revolution on the encoderpublic void setPercentMode(CANJaguar.PotentiometerTag tag)
enableControl() or enableControl(double) to enable the device.tag - The constant kPotentiometerpublic void setCurrentMode(double p,
double i,
double d)
enableControl() or enableControl(double) to enable the device.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.public void setCurrentMode(CANJaguar.EncoderTag tag, int codesPerRev, double p, double i, double d)
enableControl() or enableControl(double) to enable the device.tag - The constant kEncoderp - 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.public void setCurrentMode(CANJaguar.QuadEncoderTag tag, int codesPerRev, double p, double i, double d)
enableControl() or enableControl(double) to enable the device.tag - The constant kQuadEncoderp - 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.public void setCurrentMode(CANJaguar.PotentiometerTag tag, double p, double i, double d)
enableControl() or enableControl(double) to enable the device.tag - The constant kPotentiometerp - 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.public void setSpeedMode(CANJaguar.EncoderTag tag, int codesPerRev, double p, double i, double d)
enableControl() or enableControl(double) to enable the device.tag - The constant kEncodercodesPerRev - The counts per revolution on the encoderp - 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.public void setSpeedMode(CANJaguar.QuadEncoderTag tag, int codesPerRev, double p, double i, double d)
enableControl() or enableControl(double) to enable the device.tag - The constant kQuadEncodercodesPerRev - The counts per revolution on the encoderp - 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.public void setPositionMode(CANJaguar.QuadEncoderTag tag, int codesPerRev, double p, double i, double d)
enableControl() or enableControl(double) to enable the device.tag - The constant kQuadEncodercodesPerRev - The counts per revolution on the encoderp - 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.public void setPositionMode(CANJaguar.PotentiometerTag tag, double p, double i, double d)
enableControl() or enableControl(double) to enable the device.tag - The constant kPotentiometerp - 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.public void setVoltageMode()
enableControl() or enableControl(double) to enable the device.public void setVoltageMode(CANJaguar.EncoderTag tag, int codesPerRev)
enableControl() or enableControl(double) to enable the device.tag - The constant kEncodercodesPerRev - The counts per revolution on the encoderpublic void setVoltageMode(CANJaguar.QuadEncoderTag tag, int codesPerRev)
enableControl() or enableControl(double) to enable the device.tag - The constant kQuadEncodercodesPerRev - The counts per revolution on the encoderpublic void setVoltageMode(CANJaguar.PotentiometerTag tag)
tag - The constant kPotentiometerprivate void changeControlMode(CANJaguar.ControlMode controlMode)
controlMode - The new mode.setCurrentMode(double, double, double),
setCurrentMode(PotentiometerTag, double, double, double),
setCurrentMode(EncoderTag, int, double, double, double),
setCurrentMode(QuadEncoderTag, int, double, double, double),
setPercentMode(),
setPercentMode(PotentiometerTag),
setPercentMode(EncoderTag, int),
setPercentMode(QuadEncoderTag, int),
setPositionMode(PotentiometerTag, double, double, double),
setPositionMode(QuadEncoderTag, int, double, double, double),
setSpeedMode(EncoderTag, int, double, double, double),
setSpeedMode(QuadEncoderTag, int, double, double, double),
setVoltageMode(),
setVoltageMode(PotentiometerTag),
setVoltageMode(EncoderTag, int),
setVoltageMode(QuadEncoderTag, int)public CANJaguar.ControlMode getControlMode()
public double getBusVoltage()
public double getOutputVoltage()
public double getOutputCurrent()
public double getTemperature()
public double getPosition()
configPotentiometerTurns(int),
configEncoderCodesPerRev(int)public double getRate()
getRate in interface RateSourcepublic boolean getForwardLimitOK()
public boolean getReverseLimitOK()
public short getFaults()
kCurrentFault,
kBusVoltageFault,
kTemperatureFault,
kGateDriverFaultpublic void setVoltageRampRate(double rampRate)
rampRate - The maximum rate of voltage change in Percent Voltage mode in V/s.public int getFirmwareVersion()
public byte getHardwareVersion()
public void configNeutralMode(CANJaguar.NeutralMode mode)
mode - Select to use the jumper setting or to override it to coast or brake.public void configEncoderCodesPerRev(int codesPerRev)
codesPerRev - The number of counts per revolution in 1X mode.public void configPotentiometerTurns(int turns)
turns - The number of turns of the potentiometerpublic void configSoftPositionLimits(double forwardLimitPosition,
double reverseLimitPosition)
forwardLimitPosition - The position that, if exceeded, will disable the forward direction.reverseLimitPosition - The position that, if exceeded, will disable the reverse direction.public void disableSoftPositionLimits()
public void configLimitMode(CANJaguar.LimitMode mode)
configSoftPositionLimits(double, double) or disableSoftPositionLimits() to set this
automatically.mode - The CANJaguar.LimitMode to use to limit the rotation of the device.CANJaguar.LimitMode.SwitchInputsOnly,
CANJaguar.LimitMode.SoftPositionLimitspublic void configForwardLimit(double forwardLimitPosition)
configSoftPositionLimits(double, double) to set this and the CANJaguar.LimitMode automatically.forwardLimitPosition - The position that, if exceeded, will disable the forward direction.public void configReverseLimit(double reverseLimitPosition)
configSoftPositionLimits(double, double) to set this and the CANJaguar.LimitMode automatically.reverseLimitPosition - The position that, if exceeded, will disable the reverse direction.public void configMaxOutputVoltage(double voltage)
voltage - The maximum voltage output by the Jaguar.public void configFaultTime(float faultTime)
faultTime - The time to wait before resuming operation, in seconds.static void sendMessageHelper(int messageID,
byte[] data,
int dataSize,
int period)
throws CANMessageNotFoundException
CANMessageNotFoundExceptionprotected void sendMessage(int messageID,
byte[] data,
int dataSize,
int period)
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 sendperiod - If positive, tell Network Communications to send the
message every "period" milliseconds.protected void sendMessage(int messageID,
byte[] data,
int dataSize)
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 sendprotected void requestMessage(int messageID,
int period)
messageID - The message to requestperiod - If positive, tell Network Communications to request the
message every "period" milliseconds.protected void requestMessage(int messageID)
messageID - The message to requestprotected void getMessage(int messageID,
int messageMask,
byte[] data)
throws CANMessageNotFoundException
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 messageCANMessageNotFoundException - if there's not new message availableprotected void setupPeriodicStatus()
protected void updatePeriodicStatus()
public static void updateSyncGroup(byte syncGroup)
syncGroup - A bitmask of groups to generate synchronous output.private static final void swap16(int x,
byte[] buffer)
private static final void swap32(int x,
byte[] buffer)
private static final byte packPercentage(byte[] buffer,
double value)
private static final byte packFXP8_8(byte[] buffer,
double value)
private static final byte packFXP16_16(byte[] buffer,
double value)
private static final byte packINT16(byte[] buffer,
short value)
private static final short unpack16(byte[] buffer,
int offset)
buffer - The buffer to unpack fromoffset - The offset into he buffer to unpackprivate static final int unpack32(byte[] buffer,
int offset)
buffer - The buffer to unpack fromoffset - The offset into he buffer to unpackprivate static final double unpackPercentage(byte[] buffer)
private static final double unpackFXP8_8(byte[] buffer)
private static final double unpackFXP16_16(byte[] buffer)
private static final short unpackINT16(byte[] buffer)
private static final int unpackINT32(byte[] buffer)
public boolean FXP8_EQ(double a,
double b)
public boolean FXP16_EQ(double a,
double b)
public MotorSafetyHelper getSafetyHelper()
MotorSafetygetSafetyHelper in interface MotorSafetypublic java.lang.String getDescription()
MotorSafetygetDescription in interface MotorSafetypublic int getDeviceID()
public void stopMotor()
stopMotor in interface SpeedControllerstopMotor in interface MotorSafetypublic java.lang.String getSmartDashboardType()
getSmartDashboardType in interface Sendablepublic void updateTable()
updateTable in interface UpdatingSendablepublic void startLiveWindowMode()
startLiveWindowMode in interface LiveWindowSendablepublic void stopLiveWindowMode()
stopLiveWindowMode in interface LiveWindowSendablepublic void enableModule()
enableModule in interface Modulepublic void disableModule()
disableModule in interface Modulepublic boolean getModuleEnabled()
getModuleEnabled in interface Modulepublic void makeSafe()
makeSafe in interface ActuatorModule