ViSP
2.8.0
|
#include <vpServo.h>
Public Types | |
enum | vpServoType { NONE, EYEINHAND_CAMERA, EYEINHAND_L_cVe_eJe, EYETOHAND_L_cVe_eJe, EYETOHAND_L_cVf_fVe_eJe, EYETOHAND_L_cVf_fJe } |
enum | vpServoIteractionMatrixType { CURRENT, DESIRED, MEAN, USER_DEFINED } |
enum | vpServoInversionType { TRANSPOSE, PSEUDO_INVERSE } |
enum | vpServoPrintType { ALL, CONTROLLER, ERROR_VECTOR, FEATURE_CURRENT, FEATURE_DESIRED, GAIN, INTERACTION_MATRIX, MINIMUM } |
Public Attributes | |
vpMatrix | L |
vpColVector | error |
vpMatrix | J1 |
vpMatrix | J1p |
vpColVector | s |
vpColVector | sStar |
vpColVector | e1 |
vpColVector | e |
vpColVector | q_dot |
vpColVector | v |
vpServoType | servoType |
unsigned int | rankJ1 |
vpList< vpBasicFeature * > | featureList |
vpList< vpBasicFeature * > | desiredFeatureList |
vpList< unsigned int > | featureSelectionList |
vpAdaptiveGain | lambda |
int | signInteractionMatrix |
vpServoIteractionMatrixType | interactionMatrixType |
vpServoInversionType | inversionType |
Protected Member Functions | |
void | init () |
Protected Attributes | |
vpVelocityTwistMatrix | cVe |
bool | init_cVe |
vpVelocityTwistMatrix | cVf |
bool | init_cVf |
vpVelocityTwistMatrix | fVe |
bool | init_fVe |
vpMatrix | eJe |
bool | init_eJe |
vpMatrix | fJe |
bool | init_fJe |
bool | errorComputed |
bool | interactionMatrixComputed |
unsigned int | dim_task |
bool | taskWasKilled |
bool | forceInteractionMatrixComputation |
vpMatrix | WpW |
vpMatrix | I_WpW |
vpColVector | sv |
Class required to compute the visual servoing control law descbribed in [1] and [2].
To learn how to use this class, we suggest first to follow the Tutorial: Image-based visual servo.
The example below shows how to build a position-based visual servo from 3D visual features . In that case, we have . Let us denote the angle/axis parametrization of the rotation . Moreover, and represent respectively the translation and the rotation between the desired camera frame and the current one obtained by pose estimation (see vpPose class).
enum vpServo::vpServoType |
vpServo::vpServo | ( | ) |
Default constructor.
By default:
Definition at line 77 of file vpServo.cpp.
References init().
vpServo::vpServo | ( | vpServoType | _servoType | ) |
constructor with Choice of the visual servoing control law
Definition at line 82 of file vpServo.cpp.
References setServo().
|
virtual |
destructor
Destructor.
In fact, it does nothing. You have to call kill() to destroy the current and desired feature lists.
Definition at line 98 of file vpServo.cpp.
References taskWasKilled, and vpTRACE.
void vpServo::addFeature | ( | vpBasicFeature & | s, |
vpBasicFeature & | s_star, | ||
const unsigned int | select = vpBasicFeature::FEATURE_ALL |
||
) |
create a new ste of two visual features
create a new set of 2 features in the task
Definition at line 444 of file vpServo.cpp.
References desiredFeatureList, featureList, featureSelectionList, and s.
void vpServo::addFeature | ( | vpBasicFeature & | s, |
const unsigned int | select = vpBasicFeature::FEATURE_ALL |
||
) |
create a new ste of two visual features
create a new visual features in the task (the desired feature is then null)
Definition at line 456 of file vpServo.cpp.
References desiredFeatureList, vpBasicFeature::duplicate(), featureList, featureSelectionList, vpBasicFeature::init(), s, vpBasicFeature::setDeallocate(), and vpBasicFeature::vpServo.
vpColVector vpServo::computeControlLaw | ( | ) |
compute the desired control law
Compute the control law according to the equation:
or
if the dimension of the task is equal to number of available degrees of freedom (in that case )
in this equation Js is function of the interaction matrix and of the robot Jacobian. It is also built according to the chosen configuration eye-in-hand or eye-to-hand (see vpServo::setServo method)
Definition at line 883 of file vpServo.cpp.
References computeError(), computeInteractionMatrix(), cVe, cVf, e, e1, eJe, error, EYEINHAND_CAMERA, EYEINHAND_L_cVe_eJe, EYETOHAND_L_cVe_eJe, EYETOHAND_L_cVf_fJe, EYETOHAND_L_cVf_fVe_eJe, fJe, fVe, vpMatrix::getCols(), I_WpW, init_cVe, init_eJe, init_fJe, init_fVe, inversionType, J1, J1p, lambda, NONE, PSEUDO_INVERSE, vpMatrix::pseudoInverse(), rankJ1, vpMatrix::resize(), vpServoException::servoError, servoType, vpMatrix::setIdentity(), signInteractionMatrix, sv, vpMatrix::t(), testInitialization(), testUpdated(), vpERROR_TRACE, and WpW.
vpColVector vpServo::computeError | ( | ) |
Compute the error between the current set of visual features and the desired set of visual features .
Definition at line 682 of file vpServo.cpp.
References desiredFeatureList, dim_task, vpList< type >::empty(), vpBasicFeature::error(), error, errorComputed, vpList< type >::front(), vpBasicFeature::get_s(), vpMatrix::getRows(), vpList< type >::next(), vpServoException::noFeatureError, vpList< type >::outside(), vpColVector::resize(), s, sStar, vpList< type >::value(), vpDEBUG_TRACE, and vpERROR_TRACE.
Referenced by computeControlLaw().
vpMatrix vpServo::computeInteractionMatrix | ( | ) |
compute the interaction matrix related to the set of visual features
Compute the interaction matrix related to the set of visual features.
Definition at line 590 of file vpServo.cpp.
References CURRENT, DESIRED, desiredFeatureList, dim_task, forceInteractionMatrixComputation, vpMatrix::getCols(), vpMatrix::getRows(), interactionMatrixComputed, interactionMatrixType, L, MEAN, USER_DEFINED, and vpERROR_TRACE.
Referenced by computeControlLaw().
|
inline |
|
inline |
|
inline |
|
inline |
unsigned int vpServo::getDimension | ( | ) |
Return the task dimension.
get the task dimension
Definition at line 486 of file vpServo.cpp.
References dim_task, featureList, featureSelectionList, vpList< type >::front(), vpBasicFeature::getDimension(), vpList< type >::next(), vpList< type >::outside(), and vpList< type >::value().
|
inline |
Return the error between the current set of visual features and the desired set of visual features . The error vector is updated after a call of computeError() or computeControlLaw().
Definition at line 301 of file vpServo.h.
Referenced by vpServoData::save().
|
inline |
Return the projection operator . This operator is updated after a call of computeControlLaw().
|
inline |
|
inline |
Return the task jacobian . The task jacobian is updated after a call of computeControlLaw().
In the general case, the task jacobian is given by .
|
inline |
Return the pseudo inverse of the task jacobian . The task jacobian and its pseudo inverse are updated after a call of computeControlLaw().
|
inline |
Return the rank of the task jacobian. The rank is updated after a call of computeControlLaw().
|
inline |
|
inline |
Return the projection operator . This operator is updated after a call of computeControlLaw().
|
protected |
basic initialization
Initialize the servo.
By default:
Definition at line 128 of file vpServo.cpp.
References DESIRED, desiredFeatureList, dim_task, errorComputed, featureList, featureSelectionList, forceInteractionMatrixComputation, init_cVe, init_cVf, init_eJe, init_fJe, init_fVe, interactionMatrixComputed, interactionMatrixType, inversionType, vpList< type >::kill(), NONE, PSEUDO_INVERSE, servoType, signInteractionMatrix, and taskWasKilled.
Referenced by vpServo().
void vpServo::kill | ( | ) |
destruction (memory deallocation if required)
Task destruction. Kill the current and desired visual feature lists.
It is mendatory to call explicitly this function to avoid potential memory leaks.
Definition at line 177 of file vpServo.cpp.
References desiredFeatureList, featureList, vpList< type >::front(), vpBasicFeature::getDeallocate(), vpList< type >::kill(), vpList< type >::next(), vpList< type >::outside(), taskWasKilled, vpList< type >::value(), and vpBasicFeature::vpServo.
void vpServo::print | ( | const vpServo::vpServoPrintType | displayLevel = ALL , |
std::ostream & | os = std::cout |
||
) |
Prints on os stream information about the task:
displayLevel | : If vpServo::ALL prints
|
displayLevel | : If vpServo::MINIMUM prints only the error vector (s-s*). |
os | : Output stream. |
Definition at line 258 of file vpServo.cpp.
References ALL, CONTROLLER, desiredFeatureList, error, ERROR_VECTOR, errorComputed, EYEINHAND_CAMERA, EYEINHAND_L_cVe_eJe, EYETOHAND_L_cVe_eJe, EYETOHAND_L_cVf_fJe, EYETOHAND_L_cVf_fVe_eJe, FEATURE_CURRENT, FEATURE_DESIRED, featureList, featureSelectionList, vpList< type >::front(), GAIN, INTERACTION_MATRIX, interactionMatrixComputed, L, lambda, MINIMUM, vpList< type >::next(), NONE, vpList< type >::outside(), vpBasicFeature::print(), s, servoType, vpColVector::t(), and vpList< type >::value().
vpColVector vpServo::secondaryTask | ( | vpColVector & | de2dt | ) |
Add a secondary task.
Compute the secondary task according to the projection operator. See equation (7) of the IEEE RA magazine, dec 2005 paper.
Compute the vector:
to be added to the primary task
which is computed using the computeControlLaw() method.
Definition at line 1053 of file vpServo.cpp.
References vpMatrix::getCols(), I_WpW, J1, vpServoException::noDofFree, rankJ1, vpMatrix::resize(), vpMatrix::setIdentity(), vpERROR_TRACE, and WpW.
vpColVector vpServo::secondaryTask | ( | vpColVector & | e2, |
vpColVector & | de2dt | ||
) |
Add a secondary task.
Compute the secondary task according to the projection operator. See equation (7) of the IEEE RA magazine, dec 2005 paper.
Compute the vector:
to be added to the primary task
which is computed using computeControlLaw() method
Definition at line 1101 of file vpServo.cpp.
References e1, vpMatrix::getCols(), I_WpW, J1, lambda, vpServoException::noDofFree, rankJ1, vpMatrix::resize(), vpMatrix::setIdentity(), vpERROR_TRACE, and WpW.
|
inline |
Definition at line 230 of file vpServo.h.
Referenced by setServo().
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 238 of file vpServo.h.
Referenced by setServo().
|
inline |
|
inline |
|
inline |
|
inline |
void vpServo::setInteractionMatrixType | ( | const vpServoIteractionMatrixType & | interactionMatrixType, |
const vpServoInversionType & | interactionMatrixInversion = PSEUDO_INVERSE |
||
) |
Set the type of the interaction matrix (current, mean, desired, user).
Definition at line 509 of file vpServo.cpp.
References interactionMatrixType, and inversionType.
|
inline |
set the gain lambda
|
inline |
|
inline |
void vpServo::setServo | ( | vpServoType | _servo_type | ) |
Choice of the visual servoing control law.
Definition at line 214 of file vpServo.cpp.
References vpMatrix::eye(), EYEINHAND_CAMERA, EYEINHAND_L_cVe_eJe, servoType, set_cVe(), set_eJe(), and signInteractionMatrix.
Referenced by vpServo().
bool vpServo::testInitialization | ( | ) |
test if all the initialization are correct if true control law can be computed
Definition at line 796 of file vpServo.cpp.
References EYEINHAND_CAMERA, EYEINHAND_L_cVe_eJe, EYETOHAND_L_cVe_eJe, EYETOHAND_L_cVf_fJe, EYETOHAND_L_cVf_fVe_eJe, init_cVe, init_cVf, init_eJe, init_fJe, init_fVe, NONE, vpServoException::servoError, servoType, and vpERROR_TRACE.
Referenced by computeControlLaw().
bool vpServo::testUpdated | ( | ) |
test if all the update are correct if true control law can be computed
Definition at line 831 of file vpServo.cpp.
References EYEINHAND_CAMERA, EYEINHAND_L_cVe_eJe, EYETOHAND_L_cVe_eJe, EYETOHAND_L_cVf_fJe, EYETOHAND_L_cVf_fVe_eJe, init_cVe, init_eJe, init_fJe, init_fVe, NONE, vpServoException::servoError, servoType, and vpERROR_TRACE.
Referenced by computeControlLaw().
|
protected |
Twist transformation matrix between Re and Rc.
Definition at line 490 of file vpServo.h.
Referenced by computeControlLaw().
|
protected |
Twist transformation matrix between Rf and Rc.
Definition at line 493 of file vpServo.h.
Referenced by computeControlLaw().
vpList<vpBasicFeature *> vpServo::desiredFeatureList |
List of desired visual features (produce )
Definition at line 467 of file vpServo.h.
Referenced by addFeature(), computeError(), computeInteractionMatrix(), vpServoDisplay::display(), init(), kill(), and print().
|
protected |
dimension of the task
Definition at line 519 of file vpServo.h.
Referenced by computeError(), computeInteractionMatrix(), getDimension(), and init().
vpColVector vpServo::e |
vpColVector vpServo::e1 |
Primary task .
Definition at line 448 of file vpServo.h.
Referenced by computeControlLaw(), and secondaryTask().
|
protected |
Jacobian expressed in the end-effector frame.
Definition at line 504 of file vpServo.h.
Referenced by computeControlLaw().
vpColVector vpServo::error |
Error between the current set of visual features and the desired set of visual features . This vector is updated after a call of computeError() or computeControlLaw().
Definition at line 434 of file vpServo.h.
Referenced by computeControlLaw(), computeError(), and print().
|
protected |
true if the error has been computed
Definition at line 515 of file vpServo.h.
Referenced by computeError(), init(), and print().
vpList<vpBasicFeature *> vpServo::featureList |
List of visual features (produce )
Definition at line 465 of file vpServo.h.
Referenced by addFeature(), vpServoDisplay::display(), getDimension(), init(), kill(), and print().
vpList<unsigned int> vpServo::featureSelectionList |
List of selection among visual features used for selection of a subset of each visual feature if required
Definition at line 470 of file vpServo.h.
Referenced by addFeature(), getDimension(), init(), and print().
|
protected |
Jacobian expressed in the robot reference frame.
Definition at line 507 of file vpServo.h.
Referenced by computeControlLaw().
|
protected |
Force the interaction matrix computation even if it is already done.
Definition at line 522 of file vpServo.h.
Referenced by computeInteractionMatrix(), and init().
|
protected |
Twist transformation matrix between Re and Rf.
Definition at line 496 of file vpServo.h.
Referenced by computeControlLaw().
|
protected |
projection operators I-WpW
Definition at line 527 of file vpServo.h.
Referenced by computeControlLaw(), and secondaryTask().
|
protected |
Definition at line 491 of file vpServo.h.
Referenced by computeControlLaw(), init(), testInitialization(), and testUpdated().
|
protected |
Definition at line 494 of file vpServo.h.
Referenced by init(), and testInitialization().
|
protected |
Definition at line 505 of file vpServo.h.
Referenced by computeControlLaw(), init(), testInitialization(), and testUpdated().
|
protected |
Definition at line 508 of file vpServo.h.
Referenced by computeControlLaw(), init(), testInitialization(), and testUpdated().
|
protected |
Definition at line 497 of file vpServo.h.
Referenced by computeControlLaw(), init(), testInitialization(), and testUpdated().
|
protected |
true if the interaction matrix has been computed
Definition at line 517 of file vpServo.h.
Referenced by computeInteractionMatrix(), init(), and print().
vpServoIteractionMatrixType vpServo::interactionMatrixType |
Type of the interaction matrox (current, mean, desired, user)
Definition at line 479 of file vpServo.h.
Referenced by computeInteractionMatrix(), init(), and setInteractionMatrixType().
vpServoInversionType vpServo::inversionType |
Indicates if the transpose or the pseudo inverse of the interaction matrix should be used to compute the task
Definition at line 482 of file vpServo.h.
Referenced by computeControlLaw(), init(), and setInteractionMatrixType().
vpMatrix vpServo::J1 |
Task Jacobian .
Definition at line 436 of file vpServo.h.
Referenced by computeControlLaw(), and secondaryTask().
vpMatrix vpServo::J1p |
Pseudo inverse of the task Jacobian.
Definition at line 438 of file vpServo.h.
Referenced by computeControlLaw().
vpMatrix vpServo::L |
Interaction matrix.
Definition at line 430 of file vpServo.h.
Referenced by computeInteractionMatrix(), and print().
vpAdaptiveGain vpServo::lambda |
Gain.
Definition at line 473 of file vpServo.h.
Referenced by computeControlLaw(), print(), and secondaryTask().
vpColVector vpServo::q_dot |
unsigned int vpServo::rankJ1 |
Rank of the task Jacobian.
Definition at line 462 of file vpServo.h.
Referenced by computeControlLaw(), and secondaryTask().
vpColVector vpServo::s |
Current state of visual features . This vector is updated after a call of computeError() or computeControlLaw().
Definition at line 442 of file vpServo.h.
Referenced by addFeature(), computeError(), print(), and vpServoData::save().
vpServoType vpServo::servoType |
Chosen visual servoing control law.
Definition at line 459 of file vpServo.h.
Referenced by computeControlLaw(), init(), print(), setServo(), testInitialization(), and testUpdated().
int vpServo::signInteractionMatrix |
Sign of the interaction +/- 1 (1 for eye-in-hand, -1 for eye-to-hand configuration)
Definition at line 477 of file vpServo.h.
Referenced by computeControlLaw(), init(), and setServo().
vpColVector vpServo::sStar |
Desired state of visual features . This vector is updated after a call of computeError() or computeControlLaw().
Definition at line 445 of file vpServo.h.
Referenced by computeError(), and vpServoData::save().
|
protected |
Definition at line 529 of file vpServo.h.
Referenced by computeControlLaw().
|
protected |
Definition at line 520 of file vpServo.h.
Referenced by init(), kill(), and ~vpServo().
vpColVector vpServo::v |
|
protected |
projection operators WpW
Definition at line 525 of file vpServo.h.
Referenced by computeControlLaw(), and secondaryTask().