LRT13  1.0
 All Classes Namespaces Functions Variables Enumerations Enumerator
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | List of all members
AsyncCANJaguar Class Reference

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

#include <AsyncCANJaguar.h>

Inheritance diagram for AsyncCANJaguar:
SynchronizedProcess Loggable LRTSpeedController AsyncProcess

Public Member Functions

 AsyncCANJaguar (UINT8 channel, const char *name)
 Constructs a new Jaguar on the CAN network.
 
 ~AsyncCANJaguar ()
 
virtual 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.
 
virtual 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)
 
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 ()
 
void ResetCache ()
 
virtual void Log ()
 Logs data.
 
- 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.
 

Static Public Member Functions

static void SetGameState (data::RobotData::RobotState state)
 Set the game state.
 

Public Attributes

AsyncCANJaguarnext_jaguar_
 Pointer to next Jaguar.
 

Static Public Attributes

static vector< AsyncCANJaguar * > jaguar_vector
 LinkedList of all of the constructed CAN Jaguars.
 

Protected Member Functions

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

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.

Author
Robert Ying
Brian Axelrod
Karthik Viswanathan
David Giandomenico

Constructor & Destructor Documentation

AsyncCANJaguar::AsyncCANJaguar ( UINT8  channel,
const char *  name 
)

Constructs a new Jaguar on the CAN network.

Parameters
channelChannel that the Jaguar is assigned to
nameThe name of the Jaguar
AsyncCANJaguar::~AsyncCANJaguar ( )

the Jaguar object and stops the thread

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
void AsyncCANJaguar::ConfigEncoderCodesPerRev ( UINT16  codesPerRev)

Set number of encoder codes per revolution.

Parameters
codesPerRevcodes per revolution
void AsyncCANJaguar::ConfigFaultTime ( float  faultTime)

Configure fault time.

Parameters
faultTimefault time
void AsyncCANJaguar::ConfigMaxOutputVoltage ( double  voltage)

Sets maximum output voltage.

Parameters
voltagethe voltage
void AsyncCANJaguar::ConfigNeutralMode ( LRTSpeedController::NeutralMode  mode)
virtual

Set the new neutral mode.

Parameters
modethe new mode

Implements LRTSpeedController.

void AsyncCANJaguar::ConfigPotentiometerTurns ( UINT16  turns)

Set number of potentiometer turns.

Parameters
turnsnumber of potentiometer turns
void AsyncCANJaguar::ConfigSoftPositionLimits ( double  forwardLimitPosition,
double  reverseLimitPosition 
)

Sets soft position limits.

Parameters
forwardLimitPositionforward soft position limit
reverseLimitPositionreverse soft position limit
void AsyncCANJaguar::EnableControl ( double  encoderInitialPosition = 0.0)

Enables control.

Parameters
encoderInitialPositionthe initial position of the encoder
float AsyncCANJaguar::GetBusVoltage ( )
inline

Gets the bus voltage.

Returns
bus voltage
ControlMode AsyncCANJaguar::GetControlMode ( )
inline

Gets the control mode.

Returns
control mode
double AsyncCANJaguar::GetD ( )
inline

Gets the D gain.

Returns
derivative gain
float AsyncCANJaguar::GetExpiration ( )
inline

Get expiration time.

Returns
expiration time
bool AsyncCANJaguar::GetForwardLimitOK ( )
inline

Get forward limit m_status.

Returns
forward limit m_status
double AsyncCANJaguar::GetI ( )
inline

Gets the I gain.

Returns
integral gain
double AsyncCANJaguar::GetOutputCurrent ( )
inline

Gets the output current.

Returns
output current
float AsyncCANJaguar::GetOutputVoltage ( )
inline

Gets the output voltage.

Returns
output voltage
double AsyncCANJaguar::GetP ( )
inline

Gets the P gain.

Returns
proportional gain
float AsyncCANJaguar::GetPosition ( )
inline

Gets the position.

Returns
position
PositionReference AsyncCANJaguar::GetPositionReference ( )
inline

Gets the current position reference.

Returns
position reference
bool AsyncCANJaguar::GetPowerCycled ( )
inline

Get power cycle m_status.

Returns
power cycle m_status
bool AsyncCANJaguar::GetReverseLimitOK ( )
inline

Get reverse limit m_status.

Returns
reverse limit m_status
double AsyncCANJaguar::GetSpeed ( )
inline

Gets the speed.

Returns
speed
SpeedReference AsyncCANJaguar::GetSpeedReference ( )
inline

Gets the current speed reference.

Returns
speed reference
float AsyncCANJaguar::GetTemperature ( )
inline

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::ResetCache ( )
Parameters
Clearthe cache
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.

void AsyncCANJaguar::SetExpiration ( float  timeout)

Configure expiration time.

Parameters
timeoutexpiration timeout
void AsyncCANJaguar::SetGameState ( data::RobotData::RobotState  state)
static

Set the game state.

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

Set the PID parameters.

Parameters
pproportional gain
iintegral gain
dderivative gain
void AsyncCANJaguar::SetPosition ( float  position)

Set the output position of the Jaguar.

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

Set the new position reference.

Parameters
referencethe new reference
void AsyncCANJaguar::SetSpeedReference ( SpeedReference  reference)

Set the new speed reference.

Parameters
referencethe new reference
void AsyncCANJaguar::SetVelocity ( float  velocity)

Set the output velocity of the Jaguar.

Parameters
velocity
void AsyncCANJaguar::SetVoltageRampRate ( double  rampRate)

Set ramp rate of voltage output.

Parameters
rampRateramp rate
bool AsyncCANJaguar::StatusOK ( )

Simple wrapper for GetFaults() == 0

Returns
true if no faults

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