KatanaNativeInterface $VERSION$
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CKatana Class Reference

Extended Katana class with additional functions. More...

#include <kmlExt.h>

Inheritance diagram for CKatana:
Inheritance graph
Collaboration diagram for CKatana:
Collaboration graph

Public Member Functions

CKatBaseGetBase ()
 Returns pointer to 'CKatBase*'. More...
 
 CKatana ()
 Constructor. More...
 
 ~CKatana ()
 Destructor. More...
 
void create (const char *configurationFile, CCplBase *protocol)
 Create routine. More...
 
void create (KNI::kmlFactory *infos, CCplBase *protocol)
 
void create (TKatGNL &gnl, TKatMOT &mot, TKatSCT &sct, TKatEFF &eff, CCplBase *protocol)
 Create routine. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
void resetTPSP ()
 Forbid the movement of all the motors during the parallel movement. More...
 
void sendTPSP (bool wait=false, long timeout=TM_ENDLESS)
 Moves the allowed motors simultaneously. More...
 
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. More...
 
bool checkENLD (long idx, double degrees)
 Check if the absolute position in degrees is out of range. More...
 
void setGripperParameters (bool isPresent, int openEncoders, int closeEncoders)
 Tell the robot about the presence of a gripper. More...
 
void enableCrashLimits ()
 crash limits enable More...
 
void disableCrashLimits ()
 crash limits disable More...
 
void unBlock ()
 unblock robot after a crash More...
 
void setCrashLimit (long idx, int limit)
 unblock robot after a crash More...
 
void setPositionCollisionLimit (long idx, int limit)
 set collision position limits More...
 
void setSpeedCollisionLimit (long idx, int limit)
 set collision speed limits More...
 
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. More...
 
std::vector< int > getRobotEncoders (bool refreshEncoders=true) const
 Get the current robot encoders as a vector-container. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
void startFourSplinesMovement (bool exactflag)
 Start a fourSplines movement. More...
 
void sendSplineToMotor (unsigned short number, short targetPosition, short duration, short p1, short p2, short p3, short p4)
 Send one spline to the motor. More...
 
void sendFourSplinesToMotor (unsigned short number, short targetPosition, short duration, std::vector< short > &coefficients)
 Send four splines to the motor. More...
 
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. More...
 

Protected Attributes

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

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::CKatana ( )
inline

Constructor.

Definition at line 86 of file kmlExt.h.

◆ ~CKatana()

CKatana::~CKatana ( )
inline

Destructor.

Definition at line 89 of file kmlExt.h.

Member Function Documentation

◆ calibrate() [1/2]

void CKatana::calibrate ( )

◆ calibrate() [2/2]

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

◆ checkENLD()

bool CKatana::checkENLD ( long  idx,
double  degrees 
)

Check if the absolute position in degrees is out of range.

◆ closeGripper()

void CKatana::closeGripper ( bool  waitUntilReached = false,
int  waitTimeout = 100 
)

◆ create() [1/3]

void CKatana::create ( const char *  configurationFile,
CCplBase protocol 
)

Create routine.

◆ create() [2/3]

void CKatana::create ( KNI::kmlFactory infos,
CCplBase protocol 
)

◆ create() [3/3]

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

◆ dec()

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.

◆ decDegrees()

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.

◆ disableCrashLimits()

void CKatana::disableCrashLimits ( )

crash limits disable

◆ enableCrashLimits()

void CKatana::enableCrashLimits ( )

crash limits enable

◆ freezeMotor()

void CKatana::freezeMotor ( short  number)

◆ freezeRobot()

void CKatana::freezeRobot ( )

◆ GetBase()

CKatBase * CKatana::GetBase ( )
inline

Returns pointer to 'CKatBase*'.

Definition at line 81 of file kmlExt.h.

◆ getMotorAccelerationLimit()

short CKatana::getMotorAccelerationLimit ( short  number) const

◆ getMotorEncoders()

int CKatana::getMotorEncoders ( short  number,
bool  refreshEncoders = true 
) const

◆ getMotorVelocityLimit()

short CKatana::getMotorVelocityLimit ( short  number) const

◆ getNumberOfMotors()

short CKatana::getNumberOfMotors ( ) const

◆ getRobotEncoders() [1/2]

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.

◆ getRobotEncoders() [2/2]

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.

◆ inc()

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.

◆ incDegrees()

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.

◆ mov()

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.

◆ movDegrees()

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.

◆ moveMotorBy()

void CKatana::moveMotorBy ( short  number,
double  radianAngle,
bool  waitUntilReached = false,
int  waitTimeout = 0 
)

◆ moveMotorByEnc()

void CKatana::moveMotorByEnc ( short  number,
int  encoders,
bool  waitUntilReached = false,
int  waitTimeout = 0 
)

◆ moveMotorTo()

void CKatana::moveMotorTo ( short  number,
double  radianAngle,
bool  waitUntilReached = false,
int  waitTimeout = 0 
)

◆ moveMotorToEnc()

void CKatana::moveMotorToEnc ( short  number,
int  encoders,
bool  waitUntilReached = false,
int  encTolerance = 100,
int  waitTimeout = 0 
)

◆ moveRobotToEnc() [1/2]

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.

◆ moveRobotToEnc() [2/2]

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.

◆ moveRobotToEnc4D()

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.

◆ openGripper()

void CKatana::openGripper ( bool  waitUntilReached = false,
int  waitTimeout = 100 
)

◆ resetTPSP()

void CKatana::resetTPSP ( )

Forbid the movement of all the motors during the parallel movement.

deprecated: for use with old Katana5M only

◆ searchMechStop()

void CKatana::searchMechStop ( long  idx,
TSearchDir  dir,
TMotSCP  scp,
TMotDYL  dyl 
)
Parameters
idxmotor index
dirsearch direction
scpstatic controller parameters
dyldynamic controller parameters

◆ sendFourSplinesToMotor() [1/2]

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 
)

◆ sendFourSplinesToMotor() [2/2]

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.

◆ sendSplineToMotor()

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

◆ sendTPSP()

void CKatana::sendTPSP ( bool  wait = false,
long  timeout = TM_ENDLESS 
)

Moves the allowed motors simultaneously.

deprecated: for use with old Katana5M only

◆ setCrashLimit()

void CKatana::setCrashLimit ( long  idx,
int  limit 
)

unblock robot after a crash

◆ setGripperParameters()

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

◆ setMotorAccelerationLimit()

void CKatana::setMotorAccelerationLimit ( short  number,
short  acceleration 
)

◆ setMotorVelocityLimit()

void CKatana::setMotorVelocityLimit ( short  number,
short  velocity 
)

◆ setPositionCollisionLimit()

void CKatana::setPositionCollisionLimit ( long  idx,
int  limit 
)

set collision position limits

◆ setRobotAccelerationLimit()

void CKatana::setRobotAccelerationLimit ( short  acceleration)

Set the velocity of all motors together.

This does not set the velocity of the TCP.

◆ setRobotVelocityLimit()

void CKatana::setRobotVelocityLimit ( short  velocity)

◆ setSpeedCollisionLimit()

void CKatana::setSpeedCollisionLimit ( long  idx,
int  limit 
)

set collision speed limits

◆ setTolerance()

void CKatana::setTolerance ( long  idx,
int  enc_tolerance 
)
protected

Sets the tolerance range in encoder units for the robots movements.

◆ setTPSP()

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

◆ setTPSPDegrees()

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

◆ startFourSplinesMovement()

void CKatana::startFourSplinesMovement ( bool  exactflag)

Start a fourSplines movement.

Parameters
exactflagSet it to true if you want the position controller activated after the movement

◆ startSplineMovement()

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

◆ switchMotorOff()

void CKatana::switchMotorOff ( short  number)

◆ switchMotorOn()

void CKatana::switchMotorOn ( short  number)

◆ switchRobotOff()

void CKatana::switchRobotOff ( )

◆ switchRobotOn()

void CKatana::switchRobotOn ( )

◆ unBlock()

void CKatana::unBlock ( )

unblock robot after a crash

◆ waitForMotor()

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

Member Data Documentation

◆ _gripperCloseEncoders

int CKatana::_gripperCloseEncoders
protected

Definition at line 71 of file kmlExt.h.

◆ _gripperIsPresent

bool CKatana::_gripperIsPresent
protected

Definition at line 69 of file kmlExt.h.

◆ _gripperOpenEncoders

int CKatana::_gripperOpenEncoders
protected

Definition at line 70 of file kmlExt.h.

◆ base

CKatBase* CKatana::base
protected

base katana

Definition at line 67 of file kmlExt.h.

◆ mKatanaType

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: