cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
osaPuck Class Reference

Implements a Barrett puck. More...

#include <osaPuck.h>

Inheritance diagram for osaPuck:
mtsPuck

Public Types

enum  ID {
  PUCK_ID1 =1, PUCK_ID2 =2, PUCK_ID3 =3, PUCK_ID4 =4,
  PUCK_ID5 =5, PUCK_ID6 =6, PUCK_ID7 =7, SAFETY_MODULE_ID =10,
  PUCK_IDF1 =11, PUCK_IDF2 =12, PUCK_IDF3 =13, PUCK_IDF4 =14
}
 Define the ID of a puck. More...
 
enum  Errno { ESUCCESS, EFAILURE }
 Error values. More...
 

Public Member Functions

 osaPuck ()
 Default constructor. More...
 
 osaPuck (osaPuck::ID id, osaCANBus *can, bool createfilter=true)
 Create a puck with an ID and a CAN device. More...
 
osaPuck::ID GetID () const
 Return the puck ID. More...
 
Barrett::Value GroupIndex () const
 Return the index of the puck within its group. More...
 
Barrett::Value IpNm () const
 Return the motor Amp/Nm constant. More...
 
Barrett::Value CountsPerRevolution () const
 Return the encoder counts/revolution constant. More...
 
osaPuck::Errno InitializeMotor ()
 Perform the initial configuration. More...
 
osaPuck::Errno InitializeSM ()
 Perform the initial configuration. More...
 
osaPuck::Errno SetMode (Barrett::Value mode)
 
osaPuck::Errno GetMode (Barrett::Value &mode)
 
osaPuck::Errno GetGroupA ()
 
osaPuck::Errno GetGroupB ()
 
osaPuck::Errno GetGroupC ()
 
osaPuck::Errno SetGroupA (Barrett::Value A)
 
osaPuck::Errno SetGroupB (Barrett::Value B)
 
osaPuck::Errno SetGroupC (Barrett::Value C)
 
osaPuck::Errno GetStatus (Barrett::Value &status)
 
osaPuck::Errno GetCountsPerRev ()
 
osaPuck::Errno GetIpNm ()
 
osaPuck::Errno GetGroupIndex ()
 
osaPuck::Errno GetMembership ()
 
osaPuck::Errno IgnoreFault (Barrett::Value fault)
 
osaPuck::Errno SetVelocityWarning (Barrett::Value vw)
 
osaPuck::Errno SetVelocityFault (Barrett::Value vf)
 
osaPuck::Errno SetTorqueWarning (Barrett::Value tw)
 
osaPuck::Errno SetTorqueFault (Barrett::Value tf)
 
osaPuck::Errno GetProperty (Barrett::ID id, Barrett::Value &value)
 Query the puck for a property ID. More...
 
osaPuck::Errno SetProperty (Barrett::ID propid, Barrett::Value propval, bool verify)
 Set the puck property ID to a value. More...
 
osaPuck::Errno Reset ()
 Reset the firmware. More...
 
osaPuck::Errno Ready ()
 Set the status to ready. More...
 
osaPuck::Errno SetPosition (double q)
 
osaPuck::Errno GetPosition (Barrett::Value &position)
 
osaPuck::Errno UnpackCANFrame (const osaCANBusFrame &canframe, Barrett::ID &id, Barrett::Value &value)
 unpack a CAN frame More...
 

Static Public Member Functions

static osaPuck::ID OriginID (osaCANBusFrame::ID id)
 Return the origin ID of the CAN id. More...
 
static osaPuck::ID OriginID (const osaCANBusFrame &canframe)
 Return the origin ID of the CAN frame. More...
 
static osaPuck::ID DestinationID (osaCANBusFrame::ID id)
 Return the destination ID of the CAN id. More...
 
static osaPuck::ID DestinationID (const osaCANBusFrame &canframe)
 Return the destination ID of the CAN frame. More...
 

Static Public Attributes

static const Barrett::Value STATUS_RESET = 0
 Define the modes of a puck. More...
 
static const Barrett::Value STATUS_READY = 2
 
static const Barrett::Value MODE_IDLE = 0
 Define the status of a puck. More...
 
static const Barrett::Value MODE_TORQUE = 2
 
static const Barrett::Value MODE_POSITION = 3
 
static const Barrett::Value MODE_PID = 3
 
static const Barrett::Value MODE_VELOCITY = 4
 
static const Barrett::Value MODE_TRAPEZOIDAL = 5
 

Detailed Description

Implements a Barrett puck.

Pucks are the small gizmos that are connected to each motor. They essentially have all the hardware to control motors (micro-controller, amplifier, encoder and CAN device). Pucks are used to query encoders positions and set motors currents. A puck also has several "properties" (see the Barrett documentation) to determine their behavior. Each puck is accesses on the CAN bus by its node ID but several pucks can be addressed by group (

See Also
devGroup).

Member Enumeration Documentation

Error values.

Enumerator
ESUCCESS 
EFAILURE 

Define the ID of a puck.

The ID of a puck is at most 5 bits. Hence we use 8 bits of which only the 5 LSB are used.

Enumerator
PUCK_ID1 
PUCK_ID2 
PUCK_ID3 
PUCK_ID4 
PUCK_ID5 
PUCK_ID6 
PUCK_ID7 
SAFETY_MODULE_ID 
PUCK_IDF1 
PUCK_IDF2 
PUCK_IDF3 
PUCK_IDF4 

Constructor & Destructor Documentation

osaPuck::osaPuck ( )

Default constructor.

osaPuck::osaPuck ( osaPuck::ID  id,
osaCANBus can,
bool  createfilter = true 
)

Create a puck with an ID and a CAN device.

Initialize the puck to the given ID and give the CAN device connected to the puck.

Parameters
puckidThe ID of the puck
canThe CAN device used to communicate with the puck

Member Function Documentation

Barrett::Value osaPuck::CountsPerRevolution ( ) const

Return the encoder counts/revolution constant.

static osaPuck::ID osaPuck::DestinationID ( osaCANBusFrame::ID  id)
static

Return the destination ID of the CAN id.

Each CAN ID consists of 11 bits. For communicating with pucks, this ID is composed of 5 bits representing the ID of the puck at the origin of the CAN frame and 5 bits representing the ID of the destination puck. Call this method to obtain the destination puck ID in a CAN ID.

Parameters
canidThe CAN id
Returns
The origin puck ID of the CAN ID
See Also
Origin( osaCANBusFrame )
static osaPuck::ID osaPuck::DestinationID ( const osaCANBusFrame canframe)
static

Return the destination ID of the CAN frame.

Each CAN frame contains an 11 bits ID. For communicating with pucks, this ID is composed of 5 bits representing the ID of the puck at the origin of the CAN frame and 5 bits representing the ID of the destination puck. Call this method to obtain the destination puck ID in a CAN frame.

Parameters
canidThe CAN frame
Returns
The origin puck ID of the CAN frame
See Also
Destination( osaCANBusID )
osaPuck::Errno osaPuck::GetCountsPerRev ( )
osaPuck::Errno osaPuck::GetGroupA ( )
osaPuck::Errno osaPuck::GetGroupB ( )
osaPuck::Errno osaPuck::GetGroupC ( )
osaPuck::Errno osaPuck::GetGroupIndex ( )
osaPuck::ID osaPuck::GetID ( ) const

Return the puck ID.

osaPuck::Errno osaPuck::GetIpNm ( )
osaPuck::Errno osaPuck::GetMembership ( )
osaPuck::Errno osaPuck::GetMode ( Barrett::Value mode)
osaPuck::Errno osaPuck::GetPosition ( Barrett::Value position)
osaPuck::Errno osaPuck::GetProperty ( Barrett::ID  id,
Barrett::Value value 
)

Query the puck for a property ID.

This method queries the puck for the value of a property.

Parameters
propidThe ID of the property to query
Returns
The value of the property
osaPuck::Errno osaPuck::GetStatus ( Barrett::Value status)
Barrett::Value osaPuck::GroupIndex ( ) const

Return the index of the puck within its group.

Each puck on the WAM belongs to a group. The upper arm group contains represents 4 pucks and the forearm group represents 3 pucks. Since these groups are ordered, the index (0, 1, 2, 3) of a puck within its group matters. Call this method if you want to find the (zero) index of the pucks within its group.

Returns
The zero index of the puck within its group
osaPuck::Errno osaPuck::IgnoreFault ( Barrett::Value  fault)
osaPuck::Errno osaPuck::InitializeMotor ( )

Perform the initial configuration.

This sets the puck in the "ready" status and in "idle" mode. It also queries the puck for its group index, I/Nm constant and counts/rev constant.

Parameters
falseif no error occurred. true otherwise
osaPuck::Errno osaPuck::InitializeSM ( )

Perform the initial configuration.

This sets the safety module

Parameters
falseif no error occurred. true otherwise
Barrett::Value osaPuck::IpNm ( ) const

Return the motor Amp/Nm constant.

static osaPuck::ID osaPuck::OriginID ( osaCANBusFrame::ID  id)
static

Return the origin ID of the CAN id.

Each CAN ID consists of 11 bits. For communicating with pucks, this ID is composed of 5 bits representing the ID of the puck at the origin of the CAN frame and 5 bits representing the ID of the destination puck. Call this method to obtain the origin puck ID in a CAN ID.

Parameters
canidThe CAN id
Returns
The origin puck ID of the CAN ID
See Also
Origin( osaCANBusFrame )
static osaPuck::ID osaPuck::OriginID ( const osaCANBusFrame canframe)
static

Return the origin ID of the CAN frame.

Each CAN frame contains an 11 bits ID. For communicating with pucks, this ID is composed of 5 bits representing the ID of the puck at the origin of the CAN frame and 5 bits representing the ID of the destination puck. Call this method to obtain the origin puck ID in a CAN frame.

Parameters
canidThe CAN frame
Returns
The origin puck ID of the CAN frame
See Also
Origin( osaCANBusID )
osaPuck::Errno osaPuck::Ready ( )

Set the status to ready.

osaPuck::Errno osaPuck::Reset ( )

Reset the firmware.

osaPuck::Errno osaPuck::SetGroupA ( Barrett::Value  A)
osaPuck::Errno osaPuck::SetGroupB ( Barrett::Value  B)
osaPuck::Errno osaPuck::SetGroupC ( Barrett::Value  C)
osaPuck::Errno osaPuck::SetMode ( Barrett::Value  mode)
osaPuck::Errno osaPuck::SetPosition ( double  q)
osaPuck::Errno osaPuck::SetProperty ( Barrett::ID  propid,
Barrett::Value  propval,
bool  verify 
)

Set the puck property ID to a value.

This method sets the value of the puck's property.

Parameters
propidThe ID of the property to set
propvalThe value of the property
verifyDouble check by querying the property of the puck
Returns
false is no error occurred. true otherwise
osaPuck::Errno osaPuck::SetTorqueFault ( Barrett::Value  tf)
osaPuck::Errno osaPuck::SetTorqueWarning ( Barrett::Value  tw)
osaPuck::Errno osaPuck::SetVelocityFault ( Barrett::Value  vf)
osaPuck::Errno osaPuck::SetVelocityWarning ( Barrett::Value  vw)
osaPuck::Errno osaPuck::UnpackCANFrame ( const osaCANBusFrame canframe,
Barrett::ID id,
Barrett::Value value 
)

unpack a CAN frame

Extract the property ID and a property value of a CAN frame.

Parameters
canframe[in]The CAN frame to process
propid[out]The ID of the property in the data
propval[out]The value of the property in the data

Member Data Documentation

const Barrett::Value osaPuck::MODE_IDLE = 0
static

Define the status of a puck.

Pucks defines the following status for a puck

const Barrett::Value osaPuck::MODE_PID = 3
static
const Barrett::Value osaPuck::MODE_POSITION = 3
static
const Barrett::Value osaPuck::MODE_TORQUE = 2
static
const Barrett::Value osaPuck::MODE_TRAPEZOIDAL = 5
static
const Barrett::Value osaPuck::MODE_VELOCITY = 4
static
const Barrett::Value osaPuck::STATUS_READY = 2
static
const Barrett::Value osaPuck::STATUS_RESET = 0
static

Define the modes of a puck.

Pucks defines the following mode in which a puck can be


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