KatanaNativeInterface
$VERSION$
|
Extended Katana class with additional functions. More...
#include <kmlExt.h>
Public Member Functions | |
CKatBase * | GetBase () |
Returns pointer to 'CKatBase*'. | |
CKatana () | |
Constructor. | |
~CKatana () | |
Destructor. | |
void | create (const char *configurationFile, CCplBase *protocol) |
Create routine. | |
void | create (KNI::kmlFactory *infos, CCplBase *protocol) |
void | create (TKatGNL &gnl, TKatMOT &mot, TKatSCT &sct, TKatEFF &eff, CCplBase *protocol) |
Create routine. | |
void | calibrate () |
void | calibrate (long idx, TMotCLB clb, TMotSCP scp, TMotDYL dyl) |
void | searchMechStop (long idx, TSearchDir dir, TMotSCP scp, TMotDYL dyl) |
void | inc (long idx, int dif, bool wait=false, int tolerance=100, long timeout=TM_ENDLESS) |
Increments the motor specified by an index postion in encoders. | |
void | dec (long idx, int dif, bool wait=false, int tolerance=100, long timeout=TM_ENDLESS) |
Decrements the motor specified by an index postion in encoders. | |
void | mov (long idx, int tar, bool wait=false, int tolerance=100, long timeout=TM_ENDLESS) |
Moves the motor specified by an index to a given target position in encoders. | |
void | incDegrees (long idx, double dif, bool wait=false, int tolerance=100, long timeout=TM_ENDLESS) |
Increments the motor specified by an index postion in degree units. | |
void | decDegrees (long idx, double dif, bool wait=false, int tolerance=100, long timeout=TM_ENDLESS) |
Decrements the motor specified by an index postion in degree units. | |
void | movDegrees (long idx, double tar, bool wait=false, int tolerance=100, long timeout=TM_ENDLESS) |
Moves the motor specified by an index to a given target position in degree units. | |
void | setTPSP (long idx, int tar) |
Sets the target position of a motor in encoders and allows the movement of that motor during the parallel movement. | |
void | resetTPSP () |
Forbid the movement of all the motors during the parallel movement. | |
void | sendTPSP (bool wait=false, long timeout=TM_ENDLESS) |
Moves the allowed motors simultaneously. | |
void | setTPSPDegrees (long idx, double tar) |
Sets the target position of a motor in degree Units and allows the movement of that motor during the parallel movement. | |
bool | checkENLD (long idx, double degrees) |
Check if the absolute position in degrees is out of range. | |
void | setGripperParameters (bool isPresent, int openEncoders, int closeEncoders) |
Tell the robot about the presence of a gripper. | |
void | enableCrashLimits () |
crash limits enable | |
void | disableCrashLimits () |
crash limits disable | |
void | unBlock () |
unblock robot after a crash | |
void | setCrashLimit (long idx, int limit) |
unblock robot after a crash | |
void | setPositionCollisionLimit (long idx, int limit) |
set collision position limits | |
void | setSpeedCollisionLimit (long idx, int limit) |
set collision speed limits | |
short | getNumberOfMotors () const |
int | getMotorEncoders (short number, bool refreshEncoders=true) const |
std::vector< int >::iterator | getRobotEncoders (std::vector< int >::iterator start, std::vector< int >::const_iterator end, bool refreshEncoders=true) const |
Write the cached encoders into the container. | |
std::vector< int > | getRobotEncoders (bool refreshEncoders=true) const |
Get the current robot encoders as a vector-container. | |
short | getMotorVelocityLimit (short number) const |
short | getMotorAccelerationLimit (short number) const |
void | setMotorVelocityLimit (short number, short velocity) |
void | setMotorAccelerationLimit (short number, short acceleration) |
void | setRobotVelocityLimit (short velocity) |
void | setRobotAccelerationLimit (short acceleration) |
Set the velocity of all motors together. | |
void | moveMotorByEnc (short number, int encoders, bool waitUntilReached=false, int waitTimeout=0) |
void | moveMotorBy (short number, double radianAngle, bool waitUntilReached=false, int waitTimeout=0) |
void | moveMotorToEnc (short number, int encoders, bool waitUntilReached=false, int encTolerance=100, int waitTimeout=0) |
void | moveMotorTo (short number, double radianAngle, bool waitUntilReached=false, int waitTimeout=0) |
void | waitForMotor (short number, int encoders, int encTolerance=100, short mode=0, int waitTimeout=5000) |
void | moveRobotToEnc (std::vector< int >::const_iterator start, std::vector< int >::const_iterator end, bool waitUntilReached=false, int encTolerance=100, int waitTimeout=0) |
Move to robot to given encoders. | |
void | moveRobotToEnc (std::vector< int > encoders, bool waitUntilReached=false, int encTolerance=100, int waitTimeout=0) |
Move to robot to given encoders in the vector-container. | |
void | moveRobotToEnc4D (std::vector< int > target, int velocity=180, int acceleration=1, int encTolerance=100) |
Move to robot to given target in the vector-container with the given velocity, acceleration and tolerance. | |
void | openGripper (bool waitUntilReached=false, int waitTimeout=100) |
void | closeGripper (bool waitUntilReached=false, int waitTimeout=100) |
void | freezeRobot () |
void | freezeMotor (short number) |
void | switchRobotOn () |
void | switchRobotOff () |
void | switchMotorOn (short number) |
void | switchMotorOff (short number) |
void | startSplineMovement (bool exactflag, int moreflag=1) |
Start a spline movement. | |
void | startFourSplinesMovement (bool exactflag) |
Start a fourSplines movement. | |
void | sendSplineToMotor (unsigned short number, short targetPosition, short duration, short p1, short p2, short p3, short p4) |
Send one spline to the motor. | |
void | sendFourSplinesToMotor (unsigned short number, short targetPosition, short duration, std::vector< short > &coefficients) |
Send four splines to the motor. | |
void | sendFourSplinesToMotor (unsigned short number, short targetPosition, short duration, short p01, short p11, short p21, short p31, short p02, short p12, short p22, short p32, short p03, short p13, short p23, short p33, short p04, short p14, short p24, short p34) |
Protected Member Functions | |
void | setTolerance (long idx, int enc_tolerance) |
Sets the tolerance range in encoder units for the robots movements. | |
Protected Attributes | |
CKatBase * | base |
base katana | |
bool | _gripperIsPresent |
int | _gripperOpenEncoders |
int | _gripperCloseEncoders |
int | mKatanaType |
The type of KatanaXXX (300 or 400) |
Extended Katana class with additional functions.
This class uses the 'CKatBase* base' object to refer to a Katana robot.
CKatana::CKatana | ( | ) | [inline] |
CKatana::~CKatana | ( | ) | [inline] |
void CKatana::calibrate | ( | ) |
void CKatana::calibrate | ( | long | idx, |
TMotCLB | clb, | ||
TMotSCP | scp, | ||
TMotDYL | dyl | ||
) |
idx | motor index |
clb | calibration struct for one motor |
scp | static controller parameters |
dyl | dynamic controller parameters |
bool CKatana::checkENLD | ( | long | idx, |
double | degrees | ||
) |
Check if the absolute position in degrees is out of range.
void CKatana::closeGripper | ( | bool | waitUntilReached = false , |
int | waitTimeout = 100 |
||
) |
void CKatana::create | ( | const char * | configurationFile, |
CCplBase * | protocol | ||
) |
Create routine.
void CKatana::create | ( | KNI::kmlFactory * | infos, |
CCplBase * | protocol | ||
) |
void CKatana::create | ( | TKatGNL & | gnl, |
TKatMOT & | mot, | ||
TKatSCT & | sct, | ||
TKatEFF & | eff, | ||
CCplBase * | protocol | ||
) |
Create routine.
gnl | katana initial attributes |
mot | motor initial attributes |
sct | sensor controller initial attributes |
eff | end effector initial attributes |
protocol | protocol to be used |
void CKatana::dec | ( | long | idx, |
int | dif, | ||
bool | wait = false , |
||
int | tolerance = 100 , |
||
long | timeout = TM_ENDLESS |
||
) |
Decrements the motor specified by an index postion in encoders.
void CKatana::decDegrees | ( | long | idx, |
double | dif, | ||
bool | wait = false , |
||
int | tolerance = 100 , |
||
long | timeout = TM_ENDLESS |
||
) |
Decrements the motor specified by an index postion in degree units.
void CKatana::disableCrashLimits | ( | ) |
crash limits disable
void CKatana::enableCrashLimits | ( | ) |
crash limits enable
void CKatana::freezeMotor | ( | short | number | ) |
void CKatana::freezeRobot | ( | ) |
CKatBase* CKatana::GetBase | ( | ) | [inline] |
short CKatana::getMotorAccelerationLimit | ( | short | number | ) | const |
int CKatana::getMotorEncoders | ( | short | number, |
bool | refreshEncoders = true |
||
) | const |
short CKatana::getMotorVelocityLimit | ( | short | number | ) | const |
short CKatana::getNumberOfMotors | ( | ) | const |
std::vector<int>::iterator CKatana::getRobotEncoders | ( | std::vector< int >::iterator | start, |
std::vector< int >::const_iterator | end, | ||
bool | refreshEncoders = true |
||
) | const |
Write the cached encoders into the container.
Set refreshEncoders=true if the KNI should fetch them from the robot. If m=distance(start, end) is smaller than the number of motors, only the first m motors will be written to the container, the function will not throw an exception because of this. The return value will point to one element after the last one.
std::vector<int> CKatana::getRobotEncoders | ( | bool | refreshEncoders = true | ) | const |
Get the current robot encoders as a vector-container.
This method is mainly provided for convenience. It is easier than the other getRobotEncoders method but probably not so efficient. It is much easier to use via the wrappers.
void CKatana::inc | ( | long | idx, |
int | dif, | ||
bool | wait = false , |
||
int | tolerance = 100 , |
||
long | timeout = TM_ENDLESS |
||
) |
Increments the motor specified by an index postion in encoders.
void CKatana::incDegrees | ( | long | idx, |
double | dif, | ||
bool | wait = false , |
||
int | tolerance = 100 , |
||
long | timeout = TM_ENDLESS |
||
) |
Increments the motor specified by an index postion in degree units.
void CKatana::mov | ( | long | idx, |
int | tar, | ||
bool | wait = false , |
||
int | tolerance = 100 , |
||
long | timeout = TM_ENDLESS |
||
) |
Moves the motor specified by an index to a given target position in encoders.
void CKatana::movDegrees | ( | long | idx, |
double | tar, | ||
bool | wait = false , |
||
int | tolerance = 100 , |
||
long | timeout = TM_ENDLESS |
||
) |
Moves the motor specified by an index to a given target position in degree units.
void CKatana::moveMotorBy | ( | short | number, |
double | radianAngle, | ||
bool | waitUntilReached = false , |
||
int | waitTimeout = 0 |
||
) |
void CKatana::moveMotorByEnc | ( | short | number, |
int | encoders, | ||
bool | waitUntilReached = false , |
||
int | waitTimeout = 0 |
||
) |
void CKatana::moveMotorTo | ( | short | number, |
double | radianAngle, | ||
bool | waitUntilReached = false , |
||
int | waitTimeout = 0 |
||
) |
void CKatana::moveMotorToEnc | ( | short | number, |
int | encoders, | ||
bool | waitUntilReached = false , |
||
int | encTolerance = 100 , |
||
int | waitTimeout = 0 |
||
) |
void CKatana::moveRobotToEnc | ( | std::vector< int >::const_iterator | start, |
std::vector< int >::const_iterator | end, | ||
bool | waitUntilReached = false , |
||
int | encTolerance = 100 , |
||
int | waitTimeout = 0 |
||
) |
Move to robot to given encoders.
You can provide less values than the number of motors. In that case only the given ones will be moved. This can be usefull in cases where you want to move the robot but you don't want to move the gripper.
void CKatana::moveRobotToEnc | ( | std::vector< int > | encoders, |
bool | waitUntilReached = false , |
||
int | encTolerance = 100 , |
||
int | waitTimeout = 0 |
||
) |
Move to robot to given encoders in the vector-container.
This method is mainly provided for convenience. Catch by value (and not by reference) is intended to avoid nasty wrapping code.
void CKatana::moveRobotToEnc4D | ( | std::vector< int > | target, |
int | velocity = 180 , |
||
int | acceleration = 1 , |
||
int | encTolerance = 100 |
||
) |
Move to robot to given target in the vector-container with the given velocity, acceleration and tolerance.
void CKatana::openGripper | ( | bool | waitUntilReached = false , |
int | waitTimeout = 100 |
||
) |
void CKatana::resetTPSP | ( | ) |
Forbid the movement of all the motors during the parallel movement.
deprecated: for use with old Katana5M only
void CKatana::searchMechStop | ( | long | idx, |
TSearchDir | dir, | ||
TMotSCP | scp, | ||
TMotDYL | dyl | ||
) |
idx | motor index |
dir | search direction |
scp | static controller parameters |
dyl | dynamic controller parameters |
void CKatana::sendFourSplinesToMotor | ( | unsigned short | number, |
short | targetPosition, | ||
short | duration, | ||
std::vector< short > & | coefficients | ||
) |
Send four splines to the motor.
duration | Duration has to be given in 10ms units |
coefficients | 4x4 coefficients have to be passed or the function will cause an assertion. |
void CKatana::sendFourSplinesToMotor | ( | unsigned short | number, |
short | targetPosition, | ||
short | duration, | ||
short | p01, | ||
short | p11, | ||
short | p21, | ||
short | p31, | ||
short | p02, | ||
short | p12, | ||
short | p22, | ||
short | p32, | ||
short | p03, | ||
short | p13, | ||
short | p23, | ||
short | p33, | ||
short | p04, | ||
short | p14, | ||
short | p24, | ||
short | p34 | ||
) |
void CKatana::sendSplineToMotor | ( | unsigned short | number, |
short | targetPosition, | ||
short | duration, | ||
short | p1, | ||
short | p2, | ||
short | p3, | ||
short | p4 | ||
) |
Send one spline to the motor.
duration | Duration has to be given in 10ms units |
void CKatana::sendTPSP | ( | bool | wait = false , |
long | timeout = TM_ENDLESS |
||
) |
Moves the allowed motors simultaneously.
deprecated: for use with old Katana5M only
void CKatana::setCrashLimit | ( | long | idx, |
int | limit | ||
) |
unblock robot after a crash
void CKatana::setGripperParameters | ( | bool | isPresent, |
int | openEncoders, | ||
int | closeEncoders | ||
) |
Tell the robot about the presence of a gripper.
openEncoders | Which encoders should be used as target positions for opening the gripper |
closeEncoders | Dito for closing the gripper |
void CKatana::setMotorAccelerationLimit | ( | short | number, |
short | acceleration | ||
) |
void CKatana::setMotorVelocityLimit | ( | short | number, |
short | velocity | ||
) |
void CKatana::setPositionCollisionLimit | ( | long | idx, |
int | limit | ||
) |
set collision position limits
void CKatana::setRobotAccelerationLimit | ( | short | acceleration | ) |
Set the velocity of all motors together.
This does not set the velocity of the TCP.
void CKatana::setRobotVelocityLimit | ( | short | velocity | ) |
void CKatana::setSpeedCollisionLimit | ( | long | idx, |
int | limit | ||
) |
set collision speed limits
void CKatana::setTolerance | ( | long | idx, |
int | enc_tolerance | ||
) | [protected] |
Sets the tolerance range in encoder units for the robots movements.
void CKatana::setTPSP | ( | long | idx, |
int | tar | ||
) |
Sets the target position of a motor in encoders and allows the movement of that motor during the parallel movement.
deprecated: for use with old Katana5M only
void CKatana::setTPSPDegrees | ( | long | idx, |
double | tar | ||
) |
Sets the target position of a motor in degree Units and allows the movement of that motor during the parallel movement.
deprecated: for use with old Katana5M only
void CKatana::startFourSplinesMovement | ( | bool | exactflag | ) |
Start a fourSplines movement.
exactflag | Set it to true if you want the position controller activated after the movement |
void CKatana::startSplineMovement | ( | bool | exactflag, |
int | moreflag = 1 |
||
) |
Start a spline movement.
exactflag | Set it to true if you want the position controller activated after the movement |
moreflag | 0 = start moving more following, 1 = last or a single polynomial movement, 2 = do not start moving yet more following |
void CKatana::switchMotorOff | ( | short | number | ) |
void CKatana::switchMotorOn | ( | short | number | ) |
void CKatana::switchRobotOff | ( | ) |
void CKatana::switchRobotOn | ( | ) |
void CKatana::unBlock | ( | ) |
unblock robot after a crash
void CKatana::waitForMotor | ( | short | number, |
int | encoders, | ||
int | encTolerance = 100 , |
||
short | mode = 0 , |
||
int | waitTimeout = 5000 |
||
) |
int CKatana::_gripperCloseEncoders [protected] |
bool CKatana::_gripperIsPresent [protected] |
int CKatana::_gripperOpenEncoders [protected] |
CKatBase* CKatana::base [protected] |
int CKatana::mKatanaType [protected] |