WPILibC++
unspecified
|
Luminary Micro / Vex Robotics Jaguar Speed Control. More...
#include <CANJaguar.h>
Public Member Functions | |
CANJaguar (uint8_t deviceNumber) | |
Constructor for the CANJaguar device. More... | |
uint8_t | getDeviceNumber () const |
uint8_t | GetHardwareVersion () const |
Get the version of the Jaguar hardware. More... | |
virtual void | PIDWrite (float output) override |
Write out the PID value as seen in the PIDOutput base object. More... | |
void | EnableControl (double encoderInitialPosition=0.0) |
Enable the closed loop controller. More... | |
void | DisableControl () |
Disable the closed loop controller. More... | |
void | SetPercentMode () |
Enable controlling the motor voltage as a percentage of the bus voltage without any position or speed feedback. More... | |
void | SetPercentMode (EncoderStruct, uint16_t codesPerRev) |
Enable controlling the motor voltage as a percentage of the bus voltage, and enable speed sensing from a non-quadrature encoder. More... | |
void | SetPercentMode (QuadEncoderStruct, uint16_t codesPerRev) |
Enable controlling the motor voltage as a percentage of the bus voltage, and enable speed sensing from a non-quadrature encoder. More... | |
void | SetPercentMode (PotentiometerStruct) |
Enable controlling the motor voltage as a percentage of the bus voltage, and enable position sensing from a potentiometer and no speed feedback. More... | |
void | SetCurrentMode (double p, double i, double d) |
Enable controlling the motor current with a PID loop. More... | |
void | SetCurrentMode (EncoderStruct, uint16_t 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. More... | |
void | SetCurrentMode (QuadEncoderStruct, uint16_t 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. More... | |
void | SetCurrentMode (PotentiometerStruct, double p, double i, double d) |
Enable controlling the motor current with a PID loop, and enable position sensing from a potentiometer. More... | |
void | SetSpeedMode (EncoderStruct, uint16_t codesPerRev, double p, double i, double d) |
Enable controlling the speed with a feedback loop from a non-quadrature encoder. More... | |
void | SetSpeedMode (QuadEncoderStruct, uint16_t codesPerRev, double p, double i, double d) |
Enable controlling the speed with a feedback loop from a quadrature encoder. More... | |
void | SetPositionMode (QuadEncoderStruct, uint16_t codesPerRev, double p, double i, double d) |
Enable controlling the position with a feedback loop using an encoder. More... | |
void | SetPositionMode (PotentiometerStruct, double p, double i, double d) |
Enable controlling the position with a feedback loop using a potentiometer. More... | |
void | SetVoltageMode () |
Enable controlling the motor voltage without any position or speed feedback. More... | |
void | SetVoltageMode (EncoderStruct, uint16_t codesPerRev) |
Enable controlling the motor voltage with speed feedback from a non-quadrature encoder and no position feedback. More... | |
void | SetVoltageMode (QuadEncoderStruct, uint16_t codesPerRev) |
Enable controlling the motor voltage with position and speed feedback from a quadrature encoder. More... | |
void | SetVoltageMode (PotentiometerStruct) |
Enable controlling the motor voltage with position feedback from a potentiometer and no speed feedback. More... | |
virtual float | Get () const override |
Get the recently set outputValue setpoint. More... | |
virtual void | Set (float value, uint8_t syncGroup=0) override |
Sets the output set-point value. More... | |
virtual void | Disable () override |
Common interface for disabling a motor. More... | |
virtual void | SetP (double p) override |
Set the P constant for the closed loop modes. More... | |
virtual void | SetI (double i) override |
Set the I constant for the closed loop modes. More... | |
virtual void | SetD (double d) override |
Set the D constant for the closed loop modes. More... | |
virtual void | SetPID (double p, double i, double d) override |
Set the P, I, and D constants for the closed loop modes. More... | |
virtual double | GetP () const override |
Get the Proportional gain of the controller. More... | |
virtual double | GetI () const override |
Get the Intregral gain of the controller. More... | |
virtual double | GetD () const override |
Get the Differential gain of the controller. More... | |
virtual bool | IsModePID (CANSpeedController::ControlMode mode) const override |
virtual float | GetBusVoltage () const override |
Get the voltage at the battery input terminals of the Jaguar. More... | |
virtual float | GetOutputVoltage () const override |
Get the voltage being output from the motor terminals of the Jaguar. More... | |
virtual float | GetOutputCurrent () const override |
Get the current through the motor terminals of the Jaguar. More... | |
virtual float | GetTemperature () const override |
Get the internal temperature of the Jaguar. More... | |
virtual double | GetPosition () const override |
Get the position of the encoder or potentiometer. More... | |
virtual double | GetSpeed () const override |
Get the speed of the encoder. More... | |
virtual bool | GetForwardLimitOK () const override |
Get the status of the forward limit switch. More... | |
virtual bool | GetReverseLimitOK () const override |
Get the status of the reverse limit switch. More... | |
virtual uint16_t | GetFaults () const override |
Get the status of any faults the Jaguar has detected. More... | |
virtual void | SetVoltageRampRate (double rampRate) override |
Set the maximum voltage change rate. More... | |
virtual uint32_t | GetFirmwareVersion () const override |
Get the version of the firmware running on the Jaguar. More... | |
virtual void | ConfigNeutralMode (NeutralMode mode) override |
Configure what the controller does to the H-Bridge when neutral (not driving the output). More... | |
virtual void | ConfigEncoderCodesPerRev (uint16_t codesPerRev) override |
Configure how many codes per revolution are generated by your encoder. More... | |
virtual void | ConfigPotentiometerTurns (uint16_t turns) override |
Configure the number of turns on the potentiometer. More... | |
virtual void | ConfigSoftPositionLimits (double forwardLimitPosition, double reverseLimitPosition) override |
Configure Soft Position Limits when in Position Controller mode. More... | |
virtual void | DisableSoftPositionLimits () override |
Disable Soft Position Limits if previously enabled. More... | |
virtual void | ConfigLimitMode (LimitMode mode) override |
Set the limit mode for position control mode. More... | |
virtual void | ConfigForwardLimit (double forwardLimitPosition) override |
Set the position that if exceeded will disable the forward direction. More... | |
virtual void | ConfigReverseLimit (double reverseLimitPosition) override |
Set the position that if exceeded will disable the reverse direction. More... | |
virtual void | ConfigMaxOutputVoltage (double voltage) override |
Configure the maximum voltage that the Jaguar will ever output. More... | |
virtual void | ConfigFaultTime (float faultTime) override |
Configure how long the Jaguar waits in the case of a fault before resuming operation. More... | |
virtual void | SetControlMode (ControlMode mode) |
Used internally. More... | |
virtual ControlMode | GetControlMode () const |
Get the active control mode from the Jaguar. More... | |
void | SetExpiration (float timeout) override |
float | GetExpiration () const override |
bool | IsAlive () const override |
void | StopMotor () override |
Common interface for stopping the motor until the next Set() command Part of the MotorSafety interface. More... | |
bool | IsSafetyEnabled () const override |
void | SetSafetyEnabled (bool enabled) override |
void | GetDescription (std::ostringstream &desc) const override |
uint8_t | GetDeviceID () const |
virtual void | SetInverted (bool isInverted) override |
Common interface for inverting direction of a speed controller. More... | |
virtual bool | GetInverted () const override |
Common interface for the inverting direction of a speed controller. More... | |
![]() | |
virtual void | ConfigNeutralMode (NeutralMode mode)=0 |
![]() | |
ErrorBase (const ErrorBase &)=delete | |
ErrorBase & | operator= (const ErrorBase &)=delete |
virtual Error & | GetError () |
Retrieve the current error. More... | |
virtual const Error & | GetError () const |
virtual void | SetErrnoError (llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t lineNumber) const |
Set error information associated with a C library call that set an error to the "errno" global variable. More... | |
virtual void | SetImaqError (int success, llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t lineNumber) const |
Set the current error information associated from the nivision Imaq API. More... | |
virtual void | SetError (Error::Code code, llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t lineNumber) const |
Set the current error information associated with this sensor. More... | |
virtual void | SetWPIError (llvm::StringRef errorMessage, Error::Code code, llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t lineNumber) const |
Set the current error information associated with this sensor. More... | |
virtual void | CloneError (const ErrorBase &rhs) const |
virtual void | ClearError () const |
Clear the current error information associated with this sensor. | |
virtual bool | StatusIsFatal () const |
Check if the current error code represents a fatal error. More... | |
![]() | |
virtual void | ValueChangedEx (ITable *source, llvm::StringRef key, std::shared_ptr< nt::Value > value, unsigned int flags) |
Extended version of ValueChanged. More... | |
Static Public Member Functions | |
static void | UpdateSyncGroup (uint8_t syncGroup) |
Update all the motors that have pending sets in the syncGroup. More... | |
![]() | |
static void | SetGlobalError (Error::Code code, llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t lineNumber) |
static void | SetGlobalWPIError (llvm::StringRef errorMessage, llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t lineNumber) |
static Error & | GetGlobalError () |
Retrieve the current global error. | |
Protected Member Functions | |
void | SetSpeedReference (uint8_t reference) |
Set the reference source device for speed controller mode. More... | |
uint8_t | GetSpeedReference () const |
Get the reference source device for speed controller mode. More... | |
void | SetPositionReference (uint8_t reference) |
Set the reference source device for position controller mode. More... | |
uint8_t | GetPositionReference () const |
Get the reference source device for position controller mode. More... | |
uint8_t | packPercentage (uint8_t *buffer, double value) |
uint8_t | packFXP8_8 (uint8_t *buffer, double value) |
uint8_t | packFXP16_16 (uint8_t *buffer, double value) |
uint8_t | packint16_t (uint8_t *buffer, int16_t value) |
uint8_t | packint32_t (uint8_t *buffer, int32_t value) |
double | unpackPercentage (uint8_t *buffer) const |
double | unpackFXP8_8 (uint8_t *buffer) const |
double | unpackFXP16_16 (uint8_t *buffer) const |
int16_t | unpackint16_t (uint8_t *buffer) const |
int32_t | unpackint32_t (uint8_t *buffer) const |
void | sendMessage (uint32_t messageID, const uint8_t *data, uint8_t dataSize, int32_t period=CAN_SEND_PERIOD_NO_REPEAT) |
Send a message to the Jaguar. More... | |
void | requestMessage (uint32_t messageID, int32_t period=CAN_SEND_PERIOD_NO_REPEAT) |
Request a message from the Jaguar, but don't wait for it to arrive. More... | |
bool | getMessage (uint32_t messageID, uint32_t mask, uint8_t *data, uint8_t *dataSize) const |
Get a previously requested message. More... | |
void | setupPeriodicStatus () |
Enables periodic status updates from the Jaguar. | |
void | updatePeriodicStatus () const |
Check for new periodic status updates and unpack them into local variables. | |
void | verify () |
Check all unverified params and make sure they're equal to their local cached versions. More... | |
void | ValueChanged (ITable *source, llvm::StringRef key, std::shared_ptr< nt::Value > value, bool isNew) override |
Called when a key-value pair is changed in a ITable. More... | |
void | UpdateTable () override |
Update the table for this sendable object with the latest values. | |
void | StartLiveWindowMode () override |
Start having this sendable object automatically respond to value changes reflect the value on the table. | |
void | StopLiveWindowMode () override |
Stop having this sendable object automatically respond to value changes. | |
std::string | GetSmartDashboardType () const override |
void | InitTable (std::shared_ptr< ITable > subTable) override |
Initializes a table for this sendable object. More... | |
std::shared_ptr< ITable > | GetTable () const override |
Protected Attributes | |
priority_recursive_mutex | m_mutex |
uint8_t | m_deviceNumber |
float | m_value = 0.0f |
ControlMode | m_controlMode = kPercentVbus |
uint8_t | m_speedReference = LM_REF_NONE |
uint8_t | m_positionReference = LM_REF_NONE |
double | m_p = 0.0 |
double | m_i = 0.0 |
double | m_d = 0.0 |
NeutralMode | m_neutralMode = kNeutralMode_Jumper |
uint16_t | m_encoderCodesPerRev = 0 |
uint16_t | m_potentiometerTurns = 0 |
LimitMode | m_limitMode = kLimitMode_SwitchInputsOnly |
double | m_forwardLimit = 0.0 |
double | m_reverseLimit = 0.0 |
double | m_maxOutputVoltage = 30.0 |
double | m_voltageRampRate = 0.0 |
float | m_faultTime = 0.0f |
bool | m_controlModeVerified = false |
bool | m_speedRefVerified = true |
bool | m_posRefVerified = true |
bool | m_pVerified = true |
bool | m_iVerified = true |
bool | m_dVerified = true |
bool | m_neutralModeVerified = true |
bool | m_encoderCodesPerRevVerified = true |
bool | m_potentiometerTurnsVerified = true |
bool | m_forwardLimitVerified = true |
bool | m_reverseLimitVerified = true |
bool | m_limitModeVerified = true |
bool | m_maxOutputVoltageVerified = true |
bool | m_voltageRampRateVerified = true |
bool | m_faultTimeVerified = true |
float | m_busVoltage = 0.0f |
float | m_outputVoltage = 0.0f |
float | m_outputCurrent = 0.0f |
float | m_temperature = 0.0f |
double | m_position = 0.0 |
double | m_speed = 0.0 |
uint8_t | m_limits = 0x00 |
uint16_t | m_faults = 0x0000 |
uint32_t | m_firmwareVersion = 0 |
uint8_t | m_hardwareVersion = 0 |
std::atomic< bool > | m_receivedStatusMessage0 {false} |
std::atomic< bool > | m_receivedStatusMessage1 {false} |
std::atomic< bool > | m_receivedStatusMessage2 {false} |
bool | m_controlEnabled = false |
bool | m_stopped = false |
std::unique_ptr < MotorSafetyHelper > | m_safetyHelper |
std::shared_ptr< ITable > | m_table |
![]() | |
Error | m_error |
Additional Inherited Members | |
![]() | |
enum | ControlMode { kPercentVbus = 0, kCurrent = 1, kSpeed = 2, kPosition = 3, kVoltage = 4, kFollower = 5, kMotionProfile = 6 } |
enum | Faults { kCurrentFault = 1, kTemperatureFault = 2, kBusVoltageFault = 4, kGateDriverFault = 8, kFwdLimitSwitch = 0x10, kRevLimitSwitch = 0x20, kFwdSoftLimit = 0x40, kRevSoftLimit = 0x80 } |
enum | Limits { kForwardLimit = 1, kReverseLimit = 2 } |
enum | NeutralMode { kNeutralMode_Jumper = 0, kNeutralMode_Brake = 1, kNeutralMode_Coast = 2 } |
enum | LimitMode { kLimitMode_SwitchInputsOnly = 0, kLimitMode_SoftPositionLimits = 1, kLimitMode_SrxDisableSwitchInputs = 2 } |
![]() | |
static priority_mutex | _globalErrorMutex |
static Error | _globalError |
Luminary Micro / Vex Robotics Jaguar Speed Control.
|
explicit |
Constructor for the CANJaguar device.
By default the device is configured in Percent mode. The control mode can be changed by calling one of the control modes listed below.
deviceNumber | The address of the Jaguar on the CAN bus. |
|
overridevirtual |
Configure how many codes per revolution are generated by your encoder.
codesPerRev | The number of counts per revolution in 1X mode. |
Implements CANSpeedController.
|
overridevirtual |
Configure how long the Jaguar waits in the case of a fault before resuming operation.
Faults include over temerature, over current, and bus under voltage. The default is 3.0 seconds, but can be reduced to as low as 0.5 seconds.
faultTime | The time to wait before resuming operation, in seconds. |
Implements CANSpeedController.
|
overridevirtual |
Set the position that if exceeded will disable the forward direction.
Use ConfigSoftPositionLimits to set this and the limit mode automatically.
Implements CANSpeedController.
|
overridevirtual |
Set the limit mode for position control mode.
Use ConfigSoftPositionLimits or DisableSoftPositionLimits to set this automatically.
Implements CANSpeedController.
|
overridevirtual |
Configure the maximum voltage that the Jaguar will ever output.
This can be used to limit the maximum output voltage in all modes so that motors which cannot withstand full bus voltage can be used safely.
voltage | The maximum voltage output by the Jaguar. |
Implements CANSpeedController.
|
overridevirtual |
Configure what the controller does to the H-Bridge when neutral (not driving the output).
This allows you to override the jumper configuration for brake or coast.
mode | Select to use the jumper setting or to override it to coast or brake. |
|
overridevirtual |
Configure the number of turns on the potentiometer.
There is no special support for continuous turn potentiometers. Only integer numbers of turns are supported.
turns | The number of turns of the potentiometer. |
Implements CANSpeedController.
|
overridevirtual |
Set the position that if exceeded will disable the reverse direction.
Use ConfigSoftPositionLimits to set this and the limit mode automatically.
Implements CANSpeedController.
|
overridevirtual |
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. If the position limit is reached or the switch is opened, that direction will be disabled.
forwardLimitPosition | The position that if exceeded will disable the forward direction. |
reverseLimitPosition | The position that if exceeded will disable the reverse direction. |
Implements CANSpeedController.
|
overridevirtual |
Common interface for disabling a motor.
Implements CANSpeedController.
void CANJaguar::DisableControl | ( | ) |
Disable the closed loop controller.
Stop driving the output based on the feedback.
|
overridevirtual |
Disable Soft Position Limits if previously enabled.
Soft Position Limits are disabled by default.
Implements CANSpeedController.
void CANJaguar::EnableControl | ( | double | encoderInitialPosition = 0.0 | ) |
Enable the closed loop controller.
Start actually controlling the output based on the feedback. If starting a position controller with an encoder reference, use the encoderInitialPosition parameter to initialize the encoder state.
encoderInitialPosition | Encoder position to set if position with encoder reference. Ignored otherwise. |
|
overridevirtual |
Get the recently set outputValue setpoint.
The scale and the units depend on the mode the Jaguar is in.
In percentVbus Mode, the outputValue is from -1.0 to 1.0 (same as PWM Jaguar).
In voltage Mode, the outputValue is in volts.
In current Mode, the outputValue is in amps.
In speed Mode, the outputValue is in rotations/minute.
In position Mode, the outputValue is in rotations.
Implements CANSpeedController.
|
overridevirtual |
Get the voltage at the battery input terminals of the Jaguar.
Implements CANSpeedController.
|
virtual |
Get the active control mode from the Jaguar.
Ask the Jag what mode it is in.
|
overridevirtual |
Get the Differential gain of the controller.
Implements CANSpeedController.
uint8_t CANJaguar::getDeviceNumber | ( | ) | const |
|
overridevirtual |
Get the status of any faults the Jaguar has detected.
Implements CANSpeedController.
|
overridevirtual |
Get the version of the firmware running on the Jaguar.
Implements CANSpeedController.
|
overridevirtual |
Get the status of the forward limit switch.
Implements CANSpeedController.
uint8_t CANJaguar::GetHardwareVersion | ( | ) | const |
|
overridevirtual |
|
overridevirtual |
Common interface for the inverting direction of a speed controller.
Implements SpeedController.
|
protected |
Get a previously requested message.
Jaguar always generates a message with the same message ID when replying.
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 |
dataSize | Indicates how much data was received |
|
overridevirtual |
Get the current through the motor terminals of the Jaguar.
Implements CANSpeedController.
|
overridevirtual |
Get the voltage being output from the motor terminals of the Jaguar.
Implements CANSpeedController.
|
overridevirtual |
Get the Proportional gain of the controller.
Implements CANSpeedController.
|
overridevirtual |
Get the position of the encoder or potentiometer.
Implements CANSpeedController.
|
protected |
Get the reference source device for position controller mode.
|
overridevirtual |
Get the status of the reverse limit switch.
Implements CANSpeedController.
|
overrideprotectedvirtual |
Implements Sendable.
|
overridevirtual |
Get the speed of the encoder.
Implements CANSpeedController.
|
protected |
Get the reference source device for speed controller mode.
|
overrideprotectedvirtual |
Implements Sendable.
|
overridevirtual |
Get the internal temperature of the Jaguar.
Implements CANSpeedController.
|
overrideprotectedvirtual |
Initializes a table for this sendable object.
subtable | The table to put the values in. |
Implements Sendable.
|
overridevirtual |
Write out the PID value as seen in the PIDOutput base object.
output | Write out the PercentVbus value as was computed by the PIDController |
Implements PIDOutput.
|
protected |
Request a message from the Jaguar, but don't wait for it to arrive.
messageID | The message to request |
periodic | If positive, tell Network Communications to send the message every "period" milliseconds. |
|
protected |
Send a message to the Jaguar.
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 message |
dataSize | Specify how much of the data in "data" to send |
periodic | If positive, tell Network Communications to send the message every "period" milliseconds. |
|
overridevirtual |
Sets the output set-point value.
The scale and the units depend on the mode the Jaguar is in.
In percentVbus Mode, the outputValue is from -1.0 to 1.0 (same as PWM Jaguar).
In voltage Mode, the outputValue is in volts.
In current Mode, the outputValue is in amps.
In speed Mode, the outputValue is in rotations/minute.
In position Mode, the outputValue is in rotations.
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. |
Implements CANSpeedController.
|
virtual |
Used internally.
In order to set the control mode see the methods listed below. Change the control mode of this Jaguar object.
After changing modes, configure any PID constants or other settings needed and then EnableControl() to actually change the mode on the Jaguar.
controlMode | The new mode. |
void CANJaguar::SetCurrentMode | ( | double | p, |
double | i, | ||
double | d | ||
) |
Enable controlling the motor current with a PID loop.
After calling this you must call CANJaguar#EnableControl() or CANJaguar#EnableControl(double) to enable the device.
void CANJaguar::SetCurrentMode | ( | CANJaguar::EncoderStruct | , |
uint16_t | 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 CANJaguar#EnableControl() or CANJaguar#EnableControl(double) to enable the device.
void CANJaguar::SetCurrentMode | ( | CANJaguar::QuadEncoderStruct | , |
uint16_t | 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 CANJaguar#EnableControl() or CANJaguar#EnableControl(double) to enable the device.
void CANJaguar::SetCurrentMode | ( | CANJaguar::PotentiometerStruct | , |
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 CANJaguar#EnableControl() or CANJaguar#EnableControl(double) to enable the device.
|
overridevirtual |
Set the D constant for the closed loop modes.
d | The derivative gain of the Jaguar's PID controller. |
Implements CANSpeedController.
|
overridevirtual |
Set the I constant for the closed loop modes.
i | The integral gain of the Jaguar's PID controller. |
Implements CANSpeedController.
|
overridevirtual |
Common interface for inverting direction of a speed controller.
Only works in PercentVbus, speed, and Voltage modes.
isInverted | The state of inversion, true is inverted |
Implements SpeedController.
|
overridevirtual |
Set the P constant for the closed loop modes.
p | The proportional gain of the Jaguar's PID controller. |
Implements CANSpeedController.
void CANJaguar::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 CANJaguar#EnableControl() or CANJaguar#EnableControl(double) to enable the device.
void CANJaguar::SetPercentMode | ( | CANJaguar::EncoderStruct | , |
uint16_t | 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 CANJaguar#EnableControl() or CANJaguar#EnableControl(double) to enable the device.
tag | The constant CANJaguar::Encoder |
codesPerRev | The counts per revolution on the encoder |
void CANJaguar::SetPercentMode | ( | CANJaguar::QuadEncoderStruct | , |
uint16_t | 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 CANJaguar#EnableControl() or CANJaguar#EnableControl(double) to enable the device.
tag | The constant CANJaguar::QuadEncoder |
codesPerRev | The counts per revolution on the encoder |
void CANJaguar::SetPercentMode | ( | CANJaguar::PotentiometerStruct | ) |
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 CANJaguar#EnableControl() or CANJaguar#EnableControl(double) to enable the device.
potentiometer | The constant CANJaguar::Potentiometer |
|
overridevirtual |
Set the P, I, and D constants for the closed loop modes.
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. |
Implements CANSpeedController.
void CANJaguar::SetPositionMode | ( | CANJaguar::QuadEncoderStruct | , |
uint16_t | codesPerRev, | ||
double | p, | ||
double | i, | ||
double | d | ||
) |
Enable controlling the position with a feedback loop using an encoder.
After calling this you must call CANJaguar#EnableControl() or CANJaguar#EnableControl(double) to enable the device.
void CANJaguar::SetPositionMode | ( | CANJaguar::PotentiometerStruct | , |
double | p, | ||
double | i, | ||
double | d | ||
) |
Enable controlling the position with a feedback loop using a potentiometer.
After calling this you must call CANJaguar#EnableControl() or CANJaguar#EnableControl(double) to enable the device.
|
protected |
Set the reference source device for position controller mode.
Choose between using and encoder and using a potentiometer as the source of position feedback when in position control mode.
reference | Specify a PositionReference. |
void CANJaguar::SetSpeedMode | ( | CANJaguar::EncoderStruct | , |
uint16_t | 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 CANJaguar#EnableControl() or CANJaguar#EnableControl(double) to enable the device.
void CANJaguar::SetSpeedMode | ( | CANJaguar::QuadEncoderStruct | , |
uint16_t | 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 CANJaguar#EnableControl() or CANJaguar#EnableControl(double) to enable the device.
|
protected |
Set the reference source device for speed controller mode.
Choose encoder as the source of speed feedback when in speed control mode.
reference | Specify a speed reference. |
void CANJaguar::SetVoltageMode | ( | ) |
Enable controlling the motor voltage without any position or speed feedback.
After calling this you must call CANJaguar#EnableControl() or CANJaguar#EnableControl(double) to enable the device.
void CANJaguar::SetVoltageMode | ( | CANJaguar::EncoderStruct | , |
uint16_t | codesPerRev | ||
) |
Enable controlling the motor voltage with speed feedback from a non-quadrature encoder and no position feedback.
After calling this you must call CANJaguar#EnableControl() or CANJaguar#EnableControl(double) to enable the device.
encoder | The constant CANJaguar::Encoder |
codesPerRev | The counts per revolution on the encoder |
void CANJaguar::SetVoltageMode | ( | CANJaguar::QuadEncoderStruct | , |
uint16_t | codesPerRev | ||
) |
Enable controlling the motor voltage with position and speed feedback from a quadrature encoder.
After calling this you must call CANJaguar#EnableControl() or CANJaguar#EnableControl(double) to enable the device.
encoder | The constant CANJaguar::QuadEncoder |
codesPerRev | The counts per revolution on the encoder |
void CANJaguar::SetVoltageMode | ( | CANJaguar::PotentiometerStruct | ) |
Enable controlling the motor voltage with position feedback from a potentiometer and no speed feedback.
After calling this you must call CANJaguar#EnableControl() or CANJaguar#EnableControl(double) to enable the device.
potentiometer | The constant CANJaguar::Potentiometer |
|
overridevirtual |
Set the maximum voltage change rate.
When in PercentVbus or Voltage output mode, the rate at which the voltage changes can be limited to reduce current spikes. Set this to 0.0 to disable rate limiting.
rampRate | The maximum rate of voltage change in Percent Voltage mode in V/s. |
Implements CANSpeedController.
|
overridevirtual |
Common interface for stopping the motor until the next Set() command Part of the MotorSafety interface.
Implements CANSpeedController.
|
static |
Update all the motors that have pending sets in the syncGroup.
syncGroup | A bitmask of groups to generate synchronous output. |
|
overrideprotectedvirtual |
Called when a key-value pair is changed in a ITable.
source | the table the key-value pair exists in |
key | the key associated with the value that changed |
value | the new value |
isNew | true if the key did not previously exist in the table, otherwise it is false |
Implements ITableListener.
|
protected |
Check all unverified params and make sure they're equal to their local cached versions.
If a value isn't available, it gets requested. If a value doesn't match up, it gets set again.