BHand Class Reference
[Module to get "low-level" control of a BarrettHand]

Basic class for controlling the BarrettHand. More...

#include <bhand.h>

Inheritance diagram for BHand:

Inheritance graph
[legend]
Collaboration diagram for BHand:

Collaboration graph
[legend]

Public Member Functions

 BHand (const std::string devName)
 Constructor for class BarrettHand.
void stop ()
 Aborts current motion and returns to supervisory mode when in real time mode.
 ~BHand ()
 Destructor for class BarrettHand.
Movement Commands
Movement commands are motor commands: they immediately affect one or more of the motors. Each can take motor parameters.

void calib (const Motors motors=ALL) throw (BHandException)
 Calibrates the selected motor controller(s), preparing them for use by other movement commands.
void close (const Motors motors) throw (BHandException)
 Commands the selected motor(s) to move fingers in close direction with a velocity ramp-down at target limit. If selected, each finger moves towards the palm, and the spread motor moves so that fingers F1 and F2 are adjacent to finger F3.
void closeInc (const Motors motors, const unsigned int distance) throw (BHandException)
 Closes the selected motor(s) the given number of counts.
bool getRtModeEnabled ()
 Returns if real Time mode is enabled.
void home (const Motors motors) throw (BHandException)
 Moves the selected motor(s) to position 0.
void init () throw (BHandException)
 Initializes the communication with the BarrettHand setting the baud rate to 38400 and other required preferences for the serial port.
void move (const Motors motors, const int distance) throw (BHandException)
 Opens(-) or closes(+) the selected motor(s) the given number of counts.
void movePos (const Motors motors, const unsigned int pos) throw (BHandException)
 Moves the selected motor(s) to the given position.
void open (const Motors motors) throw (BHandException)
 Commands the selected motor(s) to move fingers in open direction with a velocity ramp-down at target limits.
void openInc (const Motors motors, const unsigned int distance) throw (BHandException)
 Opens the selected motor(s) the given number of counts.
void powerOff (const Motors motors) throw (BHandException)
 Turns the selected motor(s)'s power off.
void rtMode (const Motors motors) throw (BHandException)
 Enters real Time mode.
void torqueClose (const Motors motors) throw (BHandException)
 Commands velocity of selected motor(s) in the direction that closes the finger(s) with control of motor torque at stall.
void torqueOpen (const Motors motors) throw (BHandException)
 Commands velocity of selected motor(s) in the direction that opens the finger(s) with control of motor torque at stall.
Global parameter commands
Global parameter commands configure the hand as a whole, without referencing a particular finger or motor.

unsigned int getGlobalParam (const GParameter param) throw (BHandException)
 Gets the given parameter's value.
void loadGlobalParams () throw (BHandException)
 Loads the global parameters from a file.
void saveGlobalParams () throw (BHandException)
 Saves the global parameters to a file.
void setFactoryParams () throw (BHandException)
 Sets the writable global parameters back to their factory default values.
void setGlobalParam (const GParameter param, const unsigned int value) throw (BHandException)
 Sets the given parameter to the given value.
Motor parameter commands
Motor parameter commands act on the configuration parameters for one or more of the motors.

unsigned int getParam (const int motor, const MParameter param) throw (BHandException)
 Gets the given parameter's value for the selected motor.
void loadParams () throw (BHandException)
 Loads the motor parameters from a file.
void saveParams () throw (BHandException)
 Saves the motor parameters to a file.
void setFactoryParams (const Motors motors) throw (BHandException)
 Sets the selected motor(s)'s parameters back to their factory default values.
void setParam (const Motors motors, const MParameter param, const unsigned int value) throw (BHandException)
 Sets the given parameter to the given value for the selected motor(s).
Administrative commands
Administrative commands implement various housekeeping functions.

void reset () throw (BHandException)
 Resets the hand software. Equivalent to doing a power cycle.

Protected Member Functions

void loadConfigFile ()
 loas the configfile corresponding to the given serial number

Protected Attributes

int MaxTemp
bool RtModeEnabled

Detailed Description

Basic class for controlling the BarrettHand.

This class is an encapsulation of the basic features of the GCL Protocol.

Author:
Bernd Roessler
Examples:

main_test.cpp.


Constructor & Destructor Documentation

BHand::BHand ( const std::string  devName  ) 

Constructor for class BarrettHand.

Parameters:
devName Name for the device the BarrettHand is connected to (e.g. /dev/ttyS0).

BHand::~BHand (  ) 

Destructor for class BarrettHand.

All movement is stopped and the serial connection to the BarrettHand is closed.


Member Function Documentation

void BHand::calib ( const Motors  motors = ALL  )  throw (BHandException) [inline]

Calibrates the selected motor controller(s), preparing them for use by other movement commands.

calib() must be run before any other movement command if the hand was not calibrated outside of the library. Generally it is run without a motor prefix, calibrating all four motors; although, if desired, a subset of the motors can be specified. After an calib() call, all motors are in their home position; at 0 encoder counts.

Parameters:
motors motors to initialize (default: ALL)

void BHand::close ( const Motors  motors  )  throw (BHandException) [inline]

Commands the selected motor(s) to move fingers in close direction with a velocity ramp-down at target limit. If selected, each finger moves towards the palm, and the spread motor moves so that fingers F1 and F2 are adjacent to finger F3.

The close() command is similar to a movePos() command, with the value of the Close Target (CT) motor parameter as the destination. However, unlike the movePos() command, the close() command will not return an ERR32 if it does not reach CT within the maximum position error (MPE) parameter.

Parameters:
motors motors to move
Examples:
main_test.cpp.

void BHand::closeInc ( const Motors  motors,
const unsigned int  distance 
) throw (BHandException) [inline]

Closes the selected motor(s) the given number of counts.

Parameters:
motors motors to move
distance distance to move (0 to 20000)

unsigned int BHand::getGlobalParam ( const GParameter  param  )  throw (BHandException)

Gets the given parameter's value.

Parameters:
param global parameter to be queried

unsigned int BHand::getParam ( const int  motor,
const MParameter  param 
) throw (BHandException)

Gets the given parameter's value for the selected motor.

Note: Only a single motor is accepted as parameter. If more than one motor is given, that one with the lowest number is used.

Parameters:
motor single motor for which parameter is requested
param motor parameter to be queried
Examples:
main_forceExttest.cc.

bool BHand::getRtModeEnabled (  )  [inline]

Returns if real Time mode is enabled.

Returns:
True if RT Mode is enabled.

void BHand::home ( const Motors  motors  )  throw (BHandException) [inline]

Moves the selected motor(s) to position 0.

void BHand::init (  )  throw (BHandException)

Initializes the communication with the BarrettHand setting the baud rate to 38400 and other required preferences for the serial port.

init() must be run before any other movement command.

Reimplemented in BHandForce, and BHandForceExt.

Examples:
main_test.cpp.

void BHand::loadConfigFile (  )  [protected]

loas the configfile corresponding to the given serial number

void BHand::loadGlobalParams (  )  throw (BHandException)

Loads the global parameters from a file.

void BHand::loadParams (  )  throw (BHandException)

Loads the motor parameters from a file.

void BHand::move ( const Motors  motors,
const int  distance 
) throw (BHandException) [inline]

Opens(-) or closes(+) the selected motor(s) the given number of counts.

Parameters:
motors motors to move
distance distance to move (-20000 to 20000)

Reimplemented in BHandForce, BHandForceExt, and BHandForceExtKin.

void BHand::movePos ( const Motors  motors,
const unsigned int  pos 
) throw (BHandException) [inline]

Moves the selected motor(s) to the given position.

Parameters:
motors motors to move
pos position where to move (0 to 20000)
Examples:
main_test.cpp.

Here is the call graph for this function:

void BHand::open ( const Motors  motors  )  throw (BHandException) [inline]

Commands the selected motor(s) to move fingers in open direction with a velocity ramp-down at target limits.

If selected, F1, F2, and F3 open away from the palm, and the spread motor moves so that fingers F1 and F2 are opposite finger F3.

The open() command is similar to a movePos() command, with the value of the OT motor parameter as the destination. However, unlike the movePos() command, the open() command will not return an ERR32 if it does not reach OT within the maximum position error (MPE) parameter.

Parameters:
motors motors to move
Examples:
main_compliantfingers.cc, main_forceExttest.cc, and main_test.cpp.

void BHand::openInc ( const Motors  motors,
const unsigned int  distance 
) throw (BHandException) [inline]

Opens the selected motor(s) the given number of counts.

Parameters:
motors motors to move
distance distance to move (0 to 20000)

void BHand::powerOff ( const Motors  motors  )  throw (BHandException) [inline]

Turns the selected motor(s)'s power off.

Parameters:
motors motors that should be turned off

void BHand::reset (  )  throw (BHandException) [inline]

Resets the hand software. Equivalent to doing a power cycle.

void BHand::rtMode ( const Motors  motors  )  throw (BHandException) [inline]

Enters real Time mode.

If Hand is already in real Time Mode nothing will happen!

Reimplemented in BHandExt.

void BHand::saveGlobalParams (  )  throw (BHandException)

Saves the global parameters to a file.

void BHand::saveParams (  )  throw (BHandException)

Saves the motor parameters to a file.

void BHand::setFactoryParams (  )  throw (BHandException) [inline]

Sets the writable global parameters back to their factory default values.

void BHand::setFactoryParams ( const Motors  motors  )  throw (BHandException) [inline]

Sets the selected motor(s)'s parameters back to their factory default values.

Parameters:
motors motors for which parameters should be set

void BHand::setGlobalParam ( const GParameter  param,
const unsigned int  value 
) throw (BHandException) [inline]

Sets the given parameter to the given value.

Parameters:
param global parameter to be set
value value for global parameter

void BHand::setParam ( const Motors  motors,
const MParameter  param,
const unsigned int  value 
) throw (BHandException) [inline]

Sets the given parameter to the given value for the selected motor(s).

Parameters:
motors motors for which the parameters should be set
param motor parameter to be set
value value for motor paramter

void BHand::stop (  )  [inline]

Aborts current motion and returns to supervisory mode when in real time mode.

Examples:
main_compliantfingers.cc, main_forceExttest.cc, and main_test.cpp.

void BHand::torqueClose ( const Motors  motors  )  throw (BHandException) [inline]

Commands velocity of selected motor(s) in the direction that closes the finger(s) with control of motor torque at stall.

Parameters:
motors motors to move

void BHand::torqueOpen ( const Motors  motors  )  throw (BHandException) [inline]

Commands velocity of selected motor(s) in the direction that opens the finger(s) with control of motor torque at stall.

Parameters:
motors motors to move


Field Documentation

int BHand::MaxTemp [protected]

Maximal allowed Temperature for Hand

bool BHand::RtModeEnabled [protected]

Contains weather real Time mode is enabled or not.


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

tams Tim Baier bhandlib v0.25
Generated Wed Aug 16 14:58:35 2006 by doxygen 1.4.7