KatanaNativeInterface $VERSION$
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CLMBase Class Reference

Linear movement Class. More...

#include <lmBase.h>

Inheritance diagram for CLMBase:
Inheritance graph
Collaboration diagram for CLMBase:
Collaboration graph

Public Member Functions

 CLMBase ()
 
void initLM ()
 Initialize the parameters for the linear movements. More...
 
void movLM (double X, double Y, double Z, double Al, double Be, double Ga, bool exactflag, double vmax, bool wait=true, int tolerance=100, long timeout=TM_ENDLESS)
 
void movLM2PwithL (double X1, double Y1, double Z1, double Al1, double Be1, double Ga1, double X2, double Y2, double Z2, double Al2, double Be2, double Ga2, bool exactflag, double vmax, bool wait=false, int tolerance=100, long timeout=TM_ENDLESS)
 Old version of movLM2P which uses L-Command (only 4 splines) More...
 
void movLM2P4D (double X1, double Y1, double Z1, double Al1, double Be1, double Ga1, double X2, double Y2, double Z2, double Al2, double Be2, double Ga2, bool exactflag, double vmax, bool wait=false, int tolerance=100, long timeout=TM_ENDLESS)
 
void movLM2P (double X1, double Y1, double Z1, double Al1, double Be1, double Ga1, double X2, double Y2, double Z2, double Al2, double Be2, double Ga2, bool exactflag, double vmax, bool wait=true, int tolerance=100, long timeout=TM_ENDLESS)
 New version of movLM2P with multiple splines. More...
 
void setMaximumLinearVelocity (double maximumVelocity)
 
double getMaximumLinearVelocity () const
 
void setActivatePositionController (bool activate)
 Re-Activate the position controller after the linear movement. More...
 
bool getActivatePositionController ()
 Check if the position controller will be activated after the linear movement. More...
 
void moveRobotLinearTo (double x, double y, double z, double phi, double theta, double psi, bool waitUntilReached=true, int waitTimeout=TM_ENDLESS)
 
void moveRobotLinearTo (std::vector< double > coordinates, bool waitUntilReached=true, int waitTimeout=TM_ENDLESS)
 This method does the same as the one above and is mainly provided for convenience. More...
 
- Public Member Functions inherited from CikBase
 CikBase ()
 
 ~CikBase ()
 
void DKApos (double *position)
 Returns the current position of the robot in cartesian coordinates. More...
 
void getCoordinates (double &x, double &y, double &z, double &phi, double &theta, double &psi, bool refreshEncoders=true)
 Returns the current position of the robot in cartesian coordinates. More...
 
void IKCalculate (double X, double Y, double Z, double Al, double Be, double Ga, std::vector< int >::iterator solution_iter)
 Calculates a set of encoders for the given coordinates. More...
 
void IKCalculate (double X, double Y, double Z, double Al, double Be, double Ga, std::vector< int >::iterator solution_iter, const std::vector< int > &actualPosition)
 Calculates a set of encoders for the given coordinates. More...
 
void IKGoto (double X, double Y, double Z, double Al, double Be, double Ga, bool wait=false, int tolerance=100, long timeout=TM_ENDLESS)
 Moves to robot to given cartesian coordinates and euler-angles. More...
 
void moveRobotTo (double x, double y, double z, double phi, double theta, double psi, bool waitUntilReached=false, int waitTimeout=TM_ENDLESS)
 Moves to robot to given cartesian coordinates and euler-angles. More...
 
void moveRobotTo (std::vector< double > coordinates, bool waitUntilReached=false, int waitTimeout=TM_ENDLESS)
 This method does the same as the one above and is mainly provided for convenience. More...
 
- Public Member Functions inherited from CKatana
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)
 

Private Member Functions

void fillPoints (double vmax)
 
void polDeviratives ()
 
void polCoefficients ()
 
void calcParameters (double *arr_actpos, double *arr_tarpos, double vmax)
 
double totalTime (double distance, double acc, double dec, double vmax)
 Calculates time needed for movement over a distance. More...
 
double relPosition (double reltime, double distance, double acc, double dec, double vmax)
 Calculates the relative position reached after the relative time given. More...
 
void splineCoefficients (int steps, double *timearray, double *encoderarray, double *arr_p1, double *arr_p2, double *arr_p3, double *arr_p4)
 Calculates the spline coefficient and stores them in arr_p1 - arr_p4. More...
 
bool checkJointSpeed (std::vector< int > lastsolution, std::vector< int > solution, double time)
 Checks if the joint speeds are below speed limit. More...
 

Private Attributes

double _maximumVelocity
 
bool _activatePositionController
 
bool _isInitialized
 
TLMtrajectory trajectory
 
TBLENDtrajectory blendtrajectory
 

Additional Inherited Members

- Protected Member Functions inherited from CKatana
void setTolerance (long idx, int enc_tolerance)
 Sets the tolerance range in encoder units for the robots movements. More...
 
- Protected Attributes inherited from CKatana
CKatBasebase
 base katana More...
 
bool _gripperIsPresent
 
int _gripperOpenEncoders
 
int _gripperCloseEncoders
 
int mKatanaType
 The type of KatanaXXX (300 or 400) More...
 

Detailed Description

Linear movement Class.

This class allows to do linear movements with the Katana robot.

Definition at line 153 of file lmBase.h.

Constructor & Destructor Documentation

◆ CLMBase()

CLMBase::CLMBase ( )
inline

Definition at line 239 of file lmBase.h.

Member Function Documentation

◆ calcParameters()

void CLMBase::calcParameters ( double *  arr_actpos,
double *  arr_tarpos,
double  vmax 
)
private

◆ checkJointSpeed()

bool CLMBase::checkJointSpeed ( std::vector< int >  lastsolution,
std::vector< int >  solution,
double  time 
)
private

Checks if the joint speeds are below speed limit.

Maximum joint speed is 180enc / 10ms.

Author
Jonas Haller
Parameters
lastsolutionencoder values of last point
solutionencoder values of current point
timetime difference between the points in s
Returns
true if joint speeds ok, false if joint speed too high

◆ fillPoints()

void CLMBase::fillPoints ( double  vmax)
private

◆ getActivatePositionController()

bool CLMBase::getActivatePositionController ( )

Check if the position controller will be activated after the linear movement.

◆ getMaximumLinearVelocity()

double CLMBase::getMaximumLinearVelocity ( ) const

◆ initLM()

void CLMBase::initLM ( )

Initialize the parameters for the linear movements.

This is in the case you want to initialize it manually

Note
If you do not call it, moveRobotLinearTo() will do it for you automatically

◆ moveRobotLinearTo() [1/2]

void CLMBase::moveRobotLinearTo ( double  x,
double  y,
double  z,
double  phi,
double  theta,
double  psi,
bool  waitUntilReached = true,
int  waitTimeout = TM_ENDLESS 
)
Parameters
waitUntilReachedhas to be true with new implementation of movLM2P

◆ moveRobotLinearTo() [2/2]

void CLMBase::moveRobotLinearTo ( std::vector< double >  coordinates,
bool  waitUntilReached = true,
int  waitTimeout = TM_ENDLESS 
)

This method does the same as the one above and is mainly provided for convenience.

Note
You can call this function in python using tuples: Example: katana.moveRobotLinearTo( (x,y,z,phi,theta,psi) )
If the size of the container is smaller than 6, it will throw an exception!

◆ movLM()

void CLMBase::movLM ( double  X,
double  Y,
double  Z,
double  Al,
double  Be,
double  Ga,
bool  exactflag,
double  vmax,
bool  wait = true,
int  tolerance = 100,
long  timeout = TM_ENDLESS 
)
Parameters
waithas to be true with new implementation of movLM2P

◆ movLM2P()

void CLMBase::movLM2P ( double  X1,
double  Y1,
double  Z1,
double  Al1,
double  Be1,
double  Ga1,
double  X2,
double  Y2,
double  Z2,
double  Al2,
double  Be2,
double  Ga2,
bool  exactflag,
double  vmax,
bool  wait = true,
int  tolerance = 100,
long  timeout = TM_ENDLESS 
)

New version of movLM2P with multiple splines.

Author
Jonas Haller
Parameters
X1X coordinate of actual position
Y1Y coordinate of actual position
Z1Z coordinate of actual position
Ph1Phi angle of actual position
Th1Theta angle of actual position
Ps1Psi angle of actual position
X2X coordinate of target position
Y2Y coordinate of target position
Z2Z coordinate of target position
Ph2Phi angle of target position
Th2Theta angle of target position
Ps2Psi angle of target position
exactflagactivate the position controller after the movement
vmaxmaximum velocity of the movement in mm/s
waitparam for legacy reasons only, has to be true
tolerancetolerance for all motor encoders
timeouttimeout for linear movement in ms
Exceptions
NoSolutionExceptionif no solution found for IK
JointSpeedExceptionif joint speed too high
WaitParameterExceptionif wait set to false
Returns
void

◆ movLM2P4D()

void CLMBase::movLM2P4D ( double  X1,
double  Y1,
double  Z1,
double  Al1,
double  Be1,
double  Ga1,
double  X2,
double  Y2,
double  Z2,
double  Al2,
double  Be2,
double  Ga2,
bool  exactflag,
double  vmax,
bool  wait = false,
int  tolerance = 100,
long  timeout = TM_ENDLESS 
)

◆ movLM2PwithL()

void CLMBase::movLM2PwithL ( double  X1,
double  Y1,
double  Z1,
double  Al1,
double  Be1,
double  Ga1,
double  X2,
double  Y2,
double  Z2,
double  Al2,
double  Be2,
double  Ga2,
bool  exactflag,
double  vmax,
bool  wait = false,
int  tolerance = 100,
long  timeout = TM_ENDLESS 
)

Old version of movLM2P which uses L-Command (only 4 splines)

◆ polCoefficients()

void CLMBase::polCoefficients ( )
private

◆ polDeviratives()

void CLMBase::polDeviratives ( )
private

◆ relPosition()

double CLMBase::relPosition ( double  reltime,
double  distance,
double  acc,
double  dec,
double  vmax 
)
private

Calculates the relative position reached after the relative time given.

Author
Jonas Haller
Parameters
reltimerelative time (fraction of totaltime)
distancedistance of the movement in mm
accacceleration at the beginning in mm/s^2
decdeceleration at the end in mm/s^2
vmaxmaximum velocity of the movement in mm/s
Returns
relative distance (fraction of distance)

◆ setActivatePositionController()

void CLMBase::setActivatePositionController ( bool  activate)

Re-Activate the position controller after the linear movement.

Note
This can result in a small movement after the movement

◆ setMaximumLinearVelocity()

void CLMBase::setMaximumLinearVelocity ( double  maximumVelocity)

◆ splineCoefficients()

void CLMBase::splineCoefficients ( int  steps,
double *  timearray,
double *  encoderarray,
double *  arr_p1,
double *  arr_p2,
double *  arr_p3,
double *  arr_p4 
)
private

Calculates the spline coefficient and stores them in arr_p1 - arr_p4.

Boundary conditions are that f_1'=0 and f_n'=0 (zero velocity at beginning and end of the movement) and f_i''=P_(i+1)''.

Author
Jonas Haller
Parameters
stepsnumber of splines to calculate
timearraytimes of the points (length = steps + 1)
encoderarrayencoder values of the points (length = steps + 1)
arr_p1to return parameters 1 (length = steps)
arr_p2to return parameters 2 (length = steps)
arr_p3to return parameters 3 (length = steps)
arr_p4to return parameters 4 (length = steps)
Returns
void

◆ totalTime()

double CLMBase::totalTime ( double  distance,
double  acc,
double  dec,
double  vmax 
)
private

Calculates time needed for movement over a distance.

Author
Jonas Haller
Parameters
distancedistance of the movement in mm
accacceleration at the beginning in mm/s^2
decdeceleration at the end in mm/s^2
vmaxmaximum velocity of the movement in mm/s
Returns
time needed for the movement in s

Member Data Documentation

◆ _activatePositionController

bool CLMBase::_activatePositionController
private

Definition at line 157 of file lmBase.h.

◆ _isInitialized

bool CLMBase::_isInitialized
private

Definition at line 158 of file lmBase.h.

◆ _maximumVelocity

double CLMBase::_maximumVelocity
private

Definition at line 156 of file lmBase.h.

◆ blendtrajectory

TBLENDtrajectory CLMBase::blendtrajectory
private

Definition at line 162 of file lmBase.h.

◆ trajectory

TLMtrajectory CLMBase::trajectory
private

Definition at line 161 of file lmBase.h.


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