cisst-saw
|
Implements a Barrett puck. More...
#include <osaPuck.h>
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... | |
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 |
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 (
enum osaPuck::Errno |
enum osaPuck::ID |
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.
puckid | The ID of the puck |
can | The CAN device used to communicate with the puck |
Barrett::Value osaPuck::CountsPerRevolution | ( | ) | const |
Return the encoder counts/revolution constant.
|
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.
canid | The CAN id |
|
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.
canid | The CAN frame |
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.
propid | The ID of the property to query |
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.
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.
false | if no error occurred. true otherwise |
osaPuck::Errno osaPuck::InitializeSM | ( | ) |
Perform the initial configuration.
This sets the safety module
false | if no error occurred. true otherwise |
Barrett::Value osaPuck::IpNm | ( | ) | const |
Return the motor Amp/Nm constant.
|
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.
canid | The CAN id |
|
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.
canid | The CAN frame |
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.
propid | The ID of the property to set |
propval | The value of the property |
verify | Double check by querying the property of the puck |
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.
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 |
|
static |
Define the status of a puck.
Pucks defines the following status for a puck
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Define the modes of a puck.
Pucks defines the following mode in which a puck can be