KatanaNativeInterface  $VERSION$
Public Member Functions | Protected Member Functions | Protected Attributes
CKatana Class Reference

Extended Katana class with additional functions. More...

#include <kmlExt.h>

Inheritance diagram for CKatana:
Inheritance graph
[legend]
Collaboration diagram for CKatana:
Collaboration graph
[legend]

List of all members.

Public Member Functions

CKatBaseGetBase ()
 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

CKatBasebase
 base katana
bool _gripperIsPresent
int _gripperOpenEncoders
int _gripperCloseEncoders
int mKatanaType
 The type of KatanaXXX (300 or 400)

Detailed Description

Extended Katana class with additional functions.

This class uses the 'CKatBase* base' object to refer to a Katana robot.

Definition at line 64 of file kmlExt.h.


Constructor & Destructor Documentation

CKatana::CKatana ( ) [inline]

Constructor.

Definition at line 86 of file kmlExt.h.

CKatana::~CKatana ( ) [inline]

Destructor.

Definition at line 89 of file kmlExt.h.


Member Function Documentation

void CKatana::calibrate ( long  idx,
TMotCLB  clb,
TMotSCP  scp,
TMotDYL  dyl 
)
Parameters:
idxmotor index
clbcalibration struct for one motor
scpstatic controller parameters
dyldynamic 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.

Parameters:
gnlkatana initial attributes
motmotor initial attributes
sctsensor controller initial attributes
effend effector initial attributes
protocolprotocol 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.

crash limits disable

crash limits enable

void CKatana::freezeMotor ( short  number)
CKatBase* CKatana::GetBase ( ) [inline]

Returns pointer to 'CKatBase*'.

Definition at line 81 of file kmlExt.h.

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 
)

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 
)
Parameters:
idxmotor index
dirsearch direction
scpstatic controller parameters
dyldynamic controller parameters
void CKatana::sendFourSplinesToMotor ( unsigned short  number,
short  targetPosition,
short  duration,
std::vector< short > &  coefficients 
)

Send four splines to the motor.

Parameters:
durationDuration has to be given in 10ms units
coefficients4x4 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.

Parameters:
durationDuration 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.

Parameters:
openEncodersWhich encoders should be used as target positions for opening the gripper
closeEncodersDito 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.

Parameters:
exactflagSet 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.

Parameters:
exactflagSet it to true if you want the position controller activated after the movement
moreflag0 = 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::unBlock ( )

unblock robot after a crash

void CKatana::waitForMotor ( short  number,
int  encoders,
int  encTolerance = 100,
short  mode = 0,
int  waitTimeout = 5000 
)

Member Data Documentation

Definition at line 71 of file kmlExt.h.

bool CKatana::_gripperIsPresent [protected]

Definition at line 69 of file kmlExt.h.

Definition at line 70 of file kmlExt.h.

CKatBase* CKatana::base [protected]

base katana

Definition at line 67 of file kmlExt.h.

int CKatana::mKatanaType [protected]

The type of KatanaXXX (300 or 400)

Definition at line 73 of file kmlExt.h.


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