Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

RobotInfo::Capabilities Class Reference

Allows behaviors to lookup output/button/sensor names from other models to support basic cross-model portability. More...

#include <CommonInfo.h>

Inheritance diagram for RobotInfo::Capabilities:

Detailed Description

Allows behaviors to lookup output/button/sensor names from other models to support basic cross-model portability.

Use the getCapabilities() function to look up the Capabalities instance for a given model based on its string robot name

Definition at line 101 of file CommonInfo.h.

List of all members.

Public Member Functions

 Capabilities (const char *robName, size_t numFrame, const char *const frameNames[], size_t numBut, const char *const butNames[], size_t numSen, const char *const senNames[], size_t pidOff, size_t numPID, size_t ledOff, size_t numLED, size_t numTotalOut)
 constructor, pass the robot name this is regarding, and outputs, buttons, and sensor names
 Capabilities (const Capabilities &cap)
 shallow copy (explicit to satisfy warning)
Capabilitiesoperator= (const Capabilities &cap)
 shallow assign (explicit to satisfy warning)
virtual ~Capabilities ()
 destructor, explicit just to avoid warning when used as base class
const char * getRobotName () const
 returns the name of the robot this corresponds to
unsigned int getNumOutputs () const
 returns the number of unique outputs (i.e. not counting aliases and non-actuated reference frames)
unsigned int getNumFrames () const
 returns the number of unique reference frames (includes all outputs, plus unactuated points of interest, like cameras or end effector tips
unsigned int getNumButtons () const
 returns the number of unique buttons (i.e. not counting aliases)
unsigned int getNumSensors () const
 returns the number of unique sensors (i.e. not counting aliases)
unsigned int getPIDJointOffset () const
 returns the offset of the block of 'PID' joints in an output array
unsigned int getNumPIDJoints () const
 returns the number of 'PID' joints
unsigned int getLEDOffset () const
 returns the offset of the block of LEDs in an output array
unsigned int getNumLEDs () const
 returns the number of LEDs
const char * getOutputName (unsigned int i) const
 look up the name corresponding to an offset, returns NULL if not found/available
const char * getFrameName (unsigned int i) const
 look up the name corresponding to an offset, returns NULL if not found/available
const char * getButtonName (unsigned int i) const
 look up the name corresponding to an offset, returns NULL if not found/available
const char * getSensorName (unsigned int i) const
 look up the name corresponding to an offset, returns NULL if not found/available
unsigned int getOutputOffset (const std::string &out) const
 Look up the offset corresponding to a output name, throws std::invalid_argument if not found.
unsigned int getFrameOffset (const std::string &frame) const
 Look up the offset corresponding to a reference frame name, throws std::invalid_argument if not found.
unsigned int getButtonOffset (const std::string &but) const
 look up the offset corresponding to a button name, throws std::invalid_argument if not found
unsigned int getSensorOffset (const std::string &sen) const
 look up the offset corresponding to a sensor name, throws std::invalid_argument if not found
unsigned int findOutputOffset (const std::string &out) const
 look up the offset corresponding to a output name, returns -1U if not found/available
unsigned int findFrameOffset (const std::string &frame) const
 look up the offset corresponding to a reference frame name, returns -1U if not found/available
unsigned int findButtonOffset (const std::string &but) const
 look up the offset corresponding to a button name, returns -1U if not found/available
unsigned int findSensorOffset (const std::string &sen) const
 look up the offset corresponding to a sensor name, returns -1U if not found/available
const std::set< unsigned int > & getFakeOutputs () const
 returns the offsets of "fake" outputs, see fakeOutputs

Protected Member Functions

unsigned int lookupT (const char *errStr, const std::map< std::string, unsigned int > &nameToIndex, const std::string &capname) const
 helper function, does the work of the get..Offset functions
unsigned int lookup (const std::map< std::string, unsigned int > &nameToIndex, const std::string &capname) const
 helper function, does the work of the find..Offset functions

Static Protected Member Functions

static std::map< std::string,
const Capabilities * > & 
getCaps ()
 returns a static map from robot names to capability instances, which are externally allocated

Protected Attributes

const char * name
 name of robot model
std::vector< std::string > frames
 array of names for reference frames -- this is the "primary" name for each output/frame, frameToIndex may contain additional aliases
std::vector< std::string > buttons
 array of names for buttons -- this is the "primary" name for each button, buttonToIndex may contain additional aliases
std::vector< std::string > sensors
 array of names for sensors -- this is the "primary" name for each sensor, sensorToIndex may contain additional aliases
std::map< std::string,
unsigned int > 
frameToIndex
 maps output names to offset values
std::map< std::string,
unsigned int > 
buttonToIndex
 maps button names to offset values
std::map< std::string,
unsigned int > 
sensorToIndex
 maps sensor names to offset values
size_t pidJointOffset
 the offset of the PID joints
size_t numPIDJoints
 the number of PID joints
size_t ledOffset
 the offset of the LEDs
size_t numLEDs
 the number of LEDs
size_t numOutputs
 the total number of outputs (e.g. the reference frames which are actuated)
std::set< unsigned int > fakeOutputs
 Offsets of "fake" outputs, which don't correspond to any physical device on the robot.

Friends

const CapabilitiesgetCapabilities (const std::string &robName)
 Accessor for Capabilities::caps, returns the Capabilities instance for a specified robot model (or NULL if robot is unknown or didn't provide a Capabilities instance).

Constructor & Destructor Documentation

Capabilities::Capabilities ( const char *  robName,
size_t  numFrame,
const char *const   frameNames[],
size_t  numBut,
const char *const   butNames[],
size_t  numSen,
const char *const   senNames[],
size_t  pidOff,
size_t  numPID,
size_t  ledOff,
size_t  numLED,
size_t  numTotalOut 
)

constructor, pass the robot name this is regarding, and outputs, buttons, and sensor names

Definition at line 248 of file RobotInfo.cc.

RobotInfo::Capabilities::Capabilities ( const Capabilities cap  ) 

shallow copy (explicit to satisfy warning)

Definition at line 107 of file CommonInfo.h.

virtual RobotInfo::Capabilities::~Capabilities (  )  [virtual]

destructor, explicit just to avoid warning when used as base class

Definition at line 123 of file CommonInfo.h.


Member Function Documentation

unsigned int RobotInfo::Capabilities::findButtonOffset ( const std::string &  but  )  const

look up the offset corresponding to a button name, returns -1U if not found/available

Identical to getButtonOffset(), except returns an invalid value instead of throwing an exception. Use this if you are testing to see if a capability exists, and don't want to incur exception handling if it isn't (say you're doing a lot of testing)

Definition at line 189 of file CommonInfo.h.

Referenced by TorqueCalibrate::TakeMeasurementControl::activate(), CameraBehavior::doStart(), PostureEngine::loadLine(), and Controller::takeLine().

unsigned int RobotInfo::Capabilities::findFrameOffset ( const std::string &  frame  )  const

look up the offset corresponding to a reference frame name, returns -1U if not found/available

Identical to getFrameOffset(), except returns an invalid value instead of throwing an exception. Use this if you are testing to see if a capability exists, and don't want to incur exception handling if it isn't (say you're doing a lot of testing)

Definition at line 185 of file CommonInfo.h.

Referenced by plist::OutputSelector::get(), plist::OutputSelector::loadXML(), ArmMC::moveOffsetToPoint(), ArmMC::moveOffsetToPointWithOrientation(), plist::OutputSelector::set(), Grasper::CloseTheGripper::setup(), and Grasper::OpenTheGripper::setup().

unsigned int RobotInfo::Capabilities::findOutputOffset ( const std::string &  out  )  const

look up the offset corresponding to a output name, returns -1U if not found/available

Identical to getOutputOffset(), except returns an invalid value instead of throwing an exception. Use this if you are testing to see if a capability exists, and don't want to incur exception handling if it isn't (say you're doing a lot of testing)

Definition at line 178 of file CommonInfo.h.

Referenced by PostureMC::defaultMaxSpeed(), HeadPointerMC::defaultMaxSpeed(), PostureEngine::loadLine(), HeadController::runCommand(), RunSequenceControl< SequenceSize >::selectedFile(), LoadPostureControl::selectedFile(), HeadPointerMC::setJoints(), and XWalkMC::updateOutputsWalking().

unsigned int RobotInfo::Capabilities::findSensorOffset ( const std::string &  sen  )  const

look up the offset corresponding to a sensor name, returns -1U if not found/available

Identical to getSensorOffset(), except returns an invalid value instead of throwing an exception. Use this if you are testing to see if a capability exists, and don't want to incur exception handling if it isn't (say you're doing a lot of testing)

Definition at line 193 of file CommonInfo.h.

Referenced by PostureEngine::loadLine().

const char* RobotInfo::Capabilities::getButtonName ( unsigned int  i  )  const

look up the name corresponding to an offset, returns NULL if not found/available

Definition at line 147 of file CommonInfo.h.

Referenced by PostureEngine::loadLine().

unsigned int RobotInfo::Capabilities::getButtonOffset ( const std::string &  but  )  const

look up the offset corresponding to a button name, throws std::invalid_argument if not found

Identical to findButtonOffset(), except throws an exception instead of returning an invalid value. Use this if you expect that the button is available, and want a noisy fail-fast if something's wrong (e.g. typo in name?)

Definition at line 169 of file CommonInfo.h.

Referenced by CameraBehavior::doStart(), and EmergencyStopMC::trigger().

std::map< std::string, const Capabilities * > & Capabilities::getCaps (  )  [static, protected]

returns a static map from robot names to capability instances, which are externally allocated

The Capabilties base class will automatically insert entries into this collection.

Definition at line 272 of file RobotInfo.cc.

Referenced by Capabilities(), and RobotInfo::getCapabilities().

const std::set<unsigned int>& RobotInfo::Capabilities::getFakeOutputs (  )  const

returns the offsets of "fake" outputs, see fakeOutputs

Definition at line 196 of file CommonInfo.h.

const char* RobotInfo::Capabilities::getFrameName ( unsigned int  i  )  const

look up the name corresponding to an offset, returns NULL if not found/available

Definition at line 145 of file CommonInfo.h.

Referenced by plist::OutputSelector::get(), plist::OutputSelector::loadXML(), plist::OutputSelector::operator=(), plist::OutputSelector::set(), and plist::OutputSelector::setRange().

unsigned int RobotInfo::Capabilities::getFrameOffset ( const std::string &  frame  )  const

Look up the offset corresponding to a reference frame name, throws std::invalid_argument if not found.

Identical to findFrameOffset(), except throws an exception instead of returning an invalid value. Use this if you expect that the frame is available, and want a noisy fail-fast if something's wrong (e.g. typo in name?)

Definition at line 165 of file CommonInfo.h.

unsigned int RobotInfo::Capabilities::getLEDOffset (  )  const

returns the offset of the block of LEDs in an output array

Definition at line 139 of file CommonInfo.h.

unsigned int RobotInfo::Capabilities::getNumButtons (  )  const

returns the number of unique buttons (i.e. not counting aliases)

Definition at line 133 of file CommonInfo.h.

Referenced by PostureEngine::loadLine().

unsigned int RobotInfo::Capabilities::getNumFrames (  )  const

returns the number of unique reference frames (includes all outputs, plus unactuated points of interest, like cameras or end effector tips

Definition at line 131 of file CommonInfo.h.

Referenced by plist::OutputSelector::loadXML(), plist::OutputSelector::operator=(), plist::OutputSelector::set(), and plist::OutputSelector::setRange().

unsigned int RobotInfo::Capabilities::getNumLEDs (  )  const

returns the number of LEDs

Definition at line 140 of file CommonInfo.h.

unsigned int RobotInfo::Capabilities::getNumOutputs (  )  const

returns the number of unique outputs (i.e. not counting aliases and non-actuated reference frames)

Definition at line 129 of file CommonInfo.h.

Referenced by PostureEngine::loadLine().

unsigned int RobotInfo::Capabilities::getNumPIDJoints (  )  const

returns the number of 'PID' joints

Definition at line 138 of file CommonInfo.h.

Referenced by PostureEngine::loadLine().

unsigned int RobotInfo::Capabilities::getNumSensors (  )  const

returns the number of unique sensors (i.e. not counting aliases)

Definition at line 135 of file CommonInfo.h.

Referenced by PostureEngine::loadLine().

const char* RobotInfo::Capabilities::getOutputName ( unsigned int  i  )  const

look up the name corresponding to an offset, returns NULL if not found/available

Definition at line 143 of file CommonInfo.h.

Referenced by PostureEngine::loadLine().

unsigned int RobotInfo::Capabilities::getOutputOffset ( const std::string &  out  )  const

Look up the offset corresponding to a output name, throws std::invalid_argument if not found.

Identical to findOutputOffset(), except throws an exception instead of returning an invalid value. Use this if you expect that the output is available, and want a noisy fail-fast if something's wrong (e.g. typo in name?)

Definition at line 154 of file CommonInfo.h.

Referenced by EmergencyStopMC::EmergencyStopMC(), EmergencyStopMC::freezeJoints(), BatteryMonitorBehavior::setFlipper(), and TailWagMC::updateOutputs().

unsigned int RobotInfo::Capabilities::getPIDJointOffset (  )  const

returns the offset of the block of 'PID' joints in an output array

Definition at line 137 of file CommonInfo.h.

Referenced by PostureEngine::loadLine().

const char* RobotInfo::Capabilities::getRobotName (  )  const

returns the name of the robot this corresponds to

Definition at line 126 of file CommonInfo.h.

Referenced by plist::OutputSelector::get(), PostureEngine::loadLine(), plist::OutputSelector::loadXML(), plist::OutputSelector::operator=(), and plist::OutputSelector::set().

const char* RobotInfo::Capabilities::getSensorName ( unsigned int  i  )  const

look up the name corresponding to an offset, returns NULL if not found/available

Definition at line 149 of file CommonInfo.h.

Referenced by PostureEngine::loadLine().

unsigned int RobotInfo::Capabilities::getSensorOffset ( const std::string &  sen  )  const

look up the offset corresponding to a sensor name, throws std::invalid_argument if not found

Identical to findSensorOffset(), except throws an exception instead of returning an invalid value. Use this if you expect that the sensor is available, and want a noisy fail-fast if something's wrong (e.g. typo in name?)

Definition at line 173 of file CommonInfo.h.

unsigned int RobotInfo::Capabilities::lookup ( const std::map< std::string, unsigned int > &  nameToIndex,
const std::string &  capname 
) const [protected]
unsigned int RobotInfo::Capabilities::lookupT ( const char *  errStr,
const std::map< std::string, unsigned int > &  nameToIndex,
const std::string &  capname 
) const [protected]
Capabilities& RobotInfo::Capabilities::operator= ( const Capabilities cap  ) 

shallow assign (explicit to satisfy warning)

Definition at line 114 of file CommonInfo.h.


Friends And Related Function Documentation

const Capabilities* getCapabilities ( const std::string &  robName  )  [friend]

Accessor for Capabilities::caps, returns the Capabilities instance for a specified robot model (or NULL if robot is unknown or didn't provide a Capabilities instance).

Use this if you have a robot name in string form and want to check or map its capabilities. (For example, if you are communicating with another robot of a different type over the network.) If you know at compile time the type of the robot in question, you could just directly access its 'capabilities' instance via its RobotInfo namespace. (e.g. ERS210Info::capabilities) If you want the capabilities for the current robot, just use the global 'capabilities' instance as RobotInfo.h will automatically import the current robot's namespace into the global space.

Definition at line 157 of file RobotInfo.h.


Member Data Documentation

std::vector<std::string> RobotInfo::Capabilities::buttons [protected]

array of names for buttons -- this is the "primary" name for each button, buttonToIndex may contain additional aliases

Definition at line 216 of file CommonInfo.h.

Referenced by Capabilities(), DynamicInfo::DynamicCapabilities::findButtonOffset(), getButtonName(), DynamicInfo::DynamicCapabilities::getButtonOffset(), getNumButtons(), DynamicInfo::DynamicCapabilities::operator=(), and operator=().

std::set<unsigned int> RobotInfo::Capabilities::fakeOutputs [protected]

Offsets of "fake" outputs, which don't correspond to any physical device on the robot.

This is used in compatability modes, where some outputs may not be available on the host hardware, or for meta-outputs, which control the interpretation of other outputs. (such as the A/B LED mode setting for the ERS-7, where a "virtual" LED switches the system's intepretation of the face panel LEDs).

Most robots can probably just leave this empty -- on Aperios the "fake" outputs are skipped when interfacing with the system and their values receive feedback from the motion process. When using the tekkotsu executable under unix-based systems, the HAL layer handles this functionality via its own configuration settings, and these values are ignored.

Definition at line 239 of file CommonInfo.h.

Referenced by ERS7Info::ERS7Capabilities::ERS7Capabilities(), getFakeOutputs(), and operator=().

the offset of the LEDs

Definition at line 224 of file CommonInfo.h.

Referenced by getLEDOffset(), DynamicInfo::DynamicCapabilities::operator=(), and operator=().

const char* RobotInfo::Capabilities::name [protected]

name of robot model

Definition at line 214 of file CommonInfo.h.

Referenced by getOutputOffset(), getRobotName(), lookupT(), DynamicInfo::DynamicCapabilities::operator=(), and operator=().

the number of LEDs

Definition at line 225 of file CommonInfo.h.

Referenced by getNumLEDs(), DynamicInfo::DynamicCapabilities::operator=(), and operator=().

the number of PID joints

Definition at line 223 of file CommonInfo.h.

Referenced by getNumPIDJoints(), DynamicInfo::DynamicCapabilities::operator=(), and operator=().

the offset of the PID joints

Definition at line 222 of file CommonInfo.h.

Referenced by getPIDJointOffset(), DynamicInfo::DynamicCapabilities::operator=(), and operator=().

std::vector<std::string> RobotInfo::Capabilities::sensors [protected]

array of names for sensors -- this is the "primary" name for each sensor, sensorToIndex may contain additional aliases

Definition at line 217 of file CommonInfo.h.

Referenced by Capabilities(), DynamicInfo::DynamicCapabilities::findSensorOffset(), getNumSensors(), getSensorName(), DynamicInfo::DynamicCapabilities::getSensorOffset(), DynamicInfo::DynamicCapabilities::operator=(), and operator=().


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

Tekkotsu v5.1CVS
Generated Mon May 9 04:59:26 2016 by Doxygen 1.6.3