LRT14  1.0
 All Classes Namespaces Functions Variables Enumerations Enumerator
AsyncCANJaguar Class Reference

Asynchronous implementation of a CAN driver for the Jaguar. More...

#include <AsyncCANJaguar.h>

Inheritance diagram for AsyncCANJaguar:
Collaboration diagram for AsyncCANJaguar:

Public Member Functions

 AsyncCANJaguar (UINT8 channel, std::string name)
 Constructs a new Jaguar on the CAN network.
 
 ~AsyncCANJaguar ()
 Destroys the AsyncCANJaguar object.
 
void Update ()
 Sends the saved values to the speed controllers.
 
void SetDutyCycle (float duty_cycle)
 Set the duty cycle of the Jaguar.
 
void SetPosition (float position)
 Set the output position of the Jaguar.
 
void SetVelocity (float velocity)
 Set the output velocity of the Jaguar.
 
void SetPID (double p, double i, double d)
 Set the PID parameters.
 
void ConfigNeutralMode (LRTSpeedController::NeutralMode mode)
 Set the new neutral mode.
 
void SetSpeedReference (SpeedReference reference)
 Set the new speed reference.
 
void ChangeControlMode (CANJaguar::ControlMode mode)
 Set the new control mode.
 
void EnableControl (double encoderInitialPosition=0.0)
 Enables control.
 
void SetVoltageRampRate (double rampRate)
 Set ramp rate of voltage output.
 
void ConfigEncoderCodesPerRev (UINT16 codesPerRev)
 Set number of encoder codes per revolution.
 
void ConfigPotentiometerTurns (UINT16 turns)
 Set number of potentiometer turns.
 
void ConfigSoftPositionLimits (double forwardLimitPosition, double reverseLimitPosition)
 Sets soft position limits.
 
void DisableSoftPositionLimits ()
 Disables soft position limits.
 
void DisableControl ()
 Disables control.
 
void ConfigMaxOutputVoltage (double voltage)
 Sets maximum output voltage.
 
void ConfigFaultTime (float faultTime)
 Configure Fault time.
 
void SetExpiration (float timeout)
 Configure Expiration time.
 
void SetPositionReference (CANJaguar::PositionReference reference)
 Set the new position reference.
 
void AddCollectionFlags (uint32_t flags=0xffffffff)
 Sets (does not clear) new collection flags.
 
void RemoveCollectionFlags (uint32_t flags=0xffffffff)
 Clears (does not set) existing collection flags.
 
void SetCollectionFlags (uint32_t flags)
 Sets collection flags to input (will clear old flags)
 
float GetDutyCycle ()
 Get the duty cycle of the Jaguar that is pending to be sent.
 
float GetHardwareValue ()
 Get the duty cycle of the Jaguar that was last received.
 
LRTSpeedController::NeutralMode GetNeutralMode ()
 Gets the neutral mode (brake or coast).
 
double GetP ()
 Gets the P gain.
 
double GetI ()
 Gets the I gain.
 
double GetD ()
 Gets the D gain.
 
SpeedReference GetSpeedReference ()
 Gets the current speed reference.
 
PositionReference GetPositionReference ()
 Gets the current position reference.
 
ControlMode GetControlMode ()
 Gets the control mode.
 
float GetBusVoltage ()
 Gets the bus voltage.
 
float GetOutputVoltage ()
 Gets the output voltage.
 
double GetOutputCurrent ()
 Gets the output current.
 
float GetTemperature ()
 Gets the temperature.
 
float GetPosition ()
 Gets the position.
 
double GetSpeed ()
 Gets the speed.
 
bool GetForwardLimitOK ()
 Get forward limit m_status.
 
bool GetReverseLimitOK ()
 Get reverse limit m_status.
 
bool GetPowerCycled ()
 Get power cycle m_status.
 
float GetExpiration ()
 Get expiration time.
 
bool StatusOK ()
 Simple wrapper for GetFaults() == 0.
 
void ResetCache ()
 Clear the cache.
 
- Public Member Functions inherited from SynchronizedProcess
void RunOneCycle ()
 Gives a semaphore which allows Tick() to be called.
 
virtual void preTick ()
 Takes a semaphore which blocks Tick() until RunOneCycle() is called.
 
- Public Member Functions inherited from LRTSpeedController
void Output ()
 Checks safety and sends the saved values to the speed controllers.
 
void RegisterSafety (CounterBase *encoder, double timeoutSeconds, float threshold=0.01)
 Registers an encoder with this speed controller for stall safety.
 
virtual void SafetyCallback ()
 Called when safety fails on this speed controller.
 
virtual void Log ()
 Logs data to the Logger.
 
virtual void Send ()
 Sends data to the LiveNetworkSender.
 

Static Public Attributes

static std::vector
< AsyncCANJaguar * > 
jaguar_vector
 Linked list of all of the constructed AsyncCANJaguars.
 

Protected Member Functions

void Tick ()
 Does the actual communication, not including timing.
 

Additional Inherited Members

- Static Public Member Functions inherited from LRTSpeedController
static float CurrentLimit (float dutyCycle, float speed, float forwardLimit, float reverseLimit)
 Calculates a duty cycle with current limiting applied.
 

Detailed Description

Asynchronous implementation of a CAN driver for the Jaguar.

Reimplements the large majority of useful operations on the Jaguar in a threaded fashion.

Constructor & Destructor Documentation

AsyncCANJaguar::AsyncCANJaguar ( UINT8  channel,
std::string  name 
)

Constructs a new Jaguar on the CAN network.

Parameters
channelChannel that the Jaguar is assigned to
nameThe name of the Jaguar

Here is the call graph for this function:

Member Function Documentation

void AsyncCANJaguar::AddCollectionFlags ( uint32_t  flags = 0xffffffff)

Sets (does not clear) new collection flags.

Parameters
flagsThe flags to be set, defaults to all
void AsyncCANJaguar::ChangeControlMode ( CANJaguar::ControlMode  mode)

Set the new control mode.

Parameters
modethe new mode

Here is the call graph for this function:

void AsyncCANJaguar::ConfigEncoderCodesPerRev ( UINT16  codesPerRev)

Set number of encoder codes per revolution.

Parameters
codesPerRevcodes per revolution

Here is the call graph for this function:

void AsyncCANJaguar::ConfigFaultTime ( float  faultTime)

Configure Fault time.

Parameters
faultTimeFault time

Here is the call graph for this function:

void AsyncCANJaguar::ConfigMaxOutputVoltage ( double  voltage)

Sets maximum output voltage.

Parameters
voltageThe voltage

Here is the call graph for this function:

void AsyncCANJaguar::ConfigNeutralMode ( LRTSpeedController::NeutralMode  mode)
virtual

Set the new neutral mode.

Parameters
modethe new mode

Implements LRTSpeedController.

Here is the call graph for this function:

void AsyncCANJaguar::ConfigPotentiometerTurns ( UINT16  turns)

Set number of potentiometer turns.

Parameters
turnsnumber of potentiometer turns

Here is the call graph for this function:

void AsyncCANJaguar::ConfigSoftPositionLimits ( double  forwardLimitPosition,
double  reverseLimitPosition 
)

Sets soft position limits.

Parameters
forwardLimitPositionforward soft position limit
reverseLimitPositionreverse soft position limit

Here is the call graph for this function:

void AsyncCANJaguar::EnableControl ( double  encoderInitialPosition = 0.0)

Enables control.

Parameters
encoderInitialPositionthe initial position of the encoder

Here is the call graph for this function:

float AsyncCANJaguar::GetBusVoltage ( )

Gets the bus voltage.

Returns
bus voltage
CANJaguar::ControlMode AsyncCANJaguar::GetControlMode ( )

Gets the control mode.

Returns
control mode
double AsyncCANJaguar::GetD ( )

Gets the D gain.

Returns
derivative gain
float AsyncCANJaguar::GetDutyCycle ( )
virtual

Get the duty cycle of the Jaguar that is pending to be sent.

Returns
duty cycle

Implements LRTSpeedController.

Here is the call graph for this function:

float AsyncCANJaguar::GetExpiration ( )

Get expiration time.

Returns
expiration time
bool AsyncCANJaguar::GetForwardLimitOK ( )

Get forward limit m_status.

Returns
forward limit m_status
float AsyncCANJaguar::GetHardwareValue ( )
virtual

Get the duty cycle of the Jaguar that was last received.

Returns
duty cycle

Implements LRTSpeedController.

double AsyncCANJaguar::GetI ( )

Gets the I gain.

Returns
integral gain
LRTSpeedController::NeutralMode AsyncCANJaguar::GetNeutralMode ( )
virtual

Gets the neutral mode (brake or coast).

Returns
the neutral mode (brake or coast)

Implements LRTSpeedController.

Here is the call graph for this function:

double AsyncCANJaguar::GetOutputCurrent ( )

Gets the output current.

Returns
output current
float AsyncCANJaguar::GetOutputVoltage ( )

Gets the output voltage.

Returns
output voltage
double AsyncCANJaguar::GetP ( )

Gets the P gain.

Returns
proportional gain
float AsyncCANJaguar::GetPosition ( )

Gets the position.

Returns
position
CANJaguar::PositionReference AsyncCANJaguar::GetPositionReference ( )

Gets the current position reference.

Returns
position reference
bool AsyncCANJaguar::GetPowerCycled ( )

Get power cycle m_status.

Returns
power cycle m_status
bool AsyncCANJaguar::GetReverseLimitOK ( )

Get reverse limit m_status.

Returns
reverse limit m_status
double AsyncCANJaguar::GetSpeed ( )

Gets the speed.

Returns
speed
CANJaguar::SpeedReference AsyncCANJaguar::GetSpeedReference ( )

Gets the current speed reference.

Returns
speed reference
float AsyncCANJaguar::GetTemperature ( )

Gets the temperature.

Returns
temperature
void AsyncCANJaguar::RemoveCollectionFlags ( uint32_t  flags = 0xffffffff)

Clears (does not set) existing collection flags.

Parameters
flagsThe flags to be cleared, defaults to all
void AsyncCANJaguar::SetCollectionFlags ( uint32_t  flags)

Sets collection flags to input (will clear old flags)

Parameters
flagsFlag register
void AsyncCANJaguar::SetDutyCycle ( float  duty_cycle)
virtual

Set the duty cycle of the Jaguar.

Parameters
duty_cycle

Implements LRTSpeedController.

Here is the call graph for this function:

void AsyncCANJaguar::SetExpiration ( float  timeout)

Configure Expiration time.

Parameters
timeoutExpiration timeout

Here is the call graph for this function:

void AsyncCANJaguar::SetPID ( double  p,
double  i,
double  d 
)

Set the PID parameters.

Parameters
pproportional gain
iintegral gain
dderivative gain

Here is the call graph for this function:

void AsyncCANJaguar::SetPosition ( float  position)

Set the output position of the Jaguar.

Parameters
position

Here is the call graph for this function:

void AsyncCANJaguar::SetPositionReference ( CANJaguar::PositionReference  reference)

Set the new position reference.

Parameters
referenceThe new reference

Here is the call graph for this function:

void AsyncCANJaguar::SetSpeedReference ( SpeedReference  reference)

Set the new speed reference.

Parameters
referencethe new reference

Here is the call graph for this function:

void AsyncCANJaguar::SetVelocity ( float  velocity)

Set the output velocity of the Jaguar.

Parameters
velocity

Here is the call graph for this function:

void AsyncCANJaguar::SetVoltageRampRate ( double  rampRate)

Set ramp rate of voltage output.

Parameters
rampRateramp rate

Here is the call graph for this function:

bool AsyncCANJaguar::StatusOK ( )

Simple wrapper for GetFaults() == 0.

Returns
true if no faults

Here is the caller graph for this function:


The documentation for this class was generated from the following files: