ViSP
2.9.0
|
#include <vpFeatureTranslation.h>
Public Types | |
enum | vpFeatureTranslationRepresentationType { cdMc, cMcd, cMo } |
enum | vpBasicFeatureDeallocatorType { user, vpServo } |
Public Member Functions | |
void | init () |
vpFeatureTranslation (vpFeatureTranslationRepresentationType r) | |
vpFeatureTranslation (vpHomogeneousMatrix &f2Mf1, vpFeatureTranslationRepresentationType r) | |
virtual | ~vpFeatureTranslation () |
void | buildFrom (const vpHomogeneousMatrix &f2Mf1) |
void | set_Tx (const double t_x) |
void | set_Ty (const double t_y) |
void | set_Tz (const double t_z) |
double | get_Tx () const |
double | get_Ty () const |
double | get_Tz () const |
vpMatrix | interaction (const unsigned int select=FEATURE_ALL) |
vpColVector | error (const vpBasicFeature &s_star, const unsigned int select=FEATURE_ALL) |
void | print (const unsigned int select=FEATURE_ALL) const |
vpFeatureTranslation * | duplicate () const |
void | display (const vpCameraParameters &cam, const vpImage< unsigned char > &I, const vpColor &color=vpColor::green, unsigned int thickness=1) const |
void | display (const vpCameraParameters &cam, const vpImage< vpRGBa > &I, const vpColor &color=vpColor::green, unsigned int thickness=1) const |
unsigned int | dimension_s () |
virtual double | operator[] (const unsigned int i) const |
vpColVector | get_s (unsigned int select=FEATURE_ALL) const |
unsigned int | getDimension (const unsigned int select=FEATURE_ALL) const |
void | setFlags () |
void | setDeallocate (vpBasicFeatureDeallocatorType d) |
vpBasicFeatureDeallocatorType | getDeallocate () |
Static Public Member Functions | |
static unsigned int | selectTx () |
static unsigned int | selectTy () |
static unsigned int | selectTz () |
static unsigned int | selectAll () |
Static Public Attributes | |
static const unsigned int | FEATURE_LINE [32] |
static const unsigned int | FEATURE_ALL = 0xffff |
Protected Member Functions | |
void | resetFlags () |
Protected Attributes | |
vpColVector | s |
unsigned int | dim_s |
bool * | flags |
unsigned int | nbParameters |
vpBasicFeatureDeallocatorType | deallocate |
Class that defines the translation visual feature .
It is convenient to consider two coordinate frames noted here and .
Let be the homogeneous matrix that gives the orientation and the translation of the frame with respect to the frame .
with the rotation matrix that gives the orientation of the frame relative to the frame and the translation vector that gives the position of the frame relative to the frame . To know more about homogeneous matrices see vpHomogeneousMatrix documentation.
This class can be used to manipulate three kind of visual features:
To initialize the feature you may use member fonctions like set_Tx(), set_Ty(), set_Tz(), or also buildFrom() fonctions.
The interaction() method allows to compute the interaction matrix associated to the translation visual feature, while the error() method computes the error vector between the current visual feature and the desired one.
The code below shows how to create a eye-in hand visual servoing task using a 3D translation feature that correspond to the 3D translation between the desired camera frame and the current camera frame. To control six degrees of freedom, at least three other features must be considered like vpFeatureThetaU visual features. First we create a current ( ) and desired ( ) 3D translation feature, set the task to use the interaction matrix associated to the current feature and than compute the camera velocity . The current feature is updated in the while() loop while is set to zero.
If you want to deal only with the subset feature from the 3D translation, you have just to modify the addFeature() call in the previous example by the following line. In that case, the dimension of is two.
If you want to build your own control law, this other example shows how to create a current ( ) and desired ( ) 3D translation visual feature, compute the corresponding error vector and finally build the interaction matrix .
The code below shows how to create an eye-in hand visual servoing task using a 3D translation feature that correspond to the 3D translation between the current camera frame and the object frame. Like with the previous examples, to control six degrees of freedom, at least three other features must be considered like vpFeatureThetaU visual features. The way to initialize the visual features is quite the same as before. The difference is that the cMo method must be precised and the desired feature is note necessary equal to zero.
Definition at line 278 of file vpFeatureTranslation.h.
|
inherited |
Indicates who should deallocate the feature.
Enumerator | |
---|---|
user | |
vpServo |
Definition at line 154 of file vpBasicFeature.h.
Kind of implemented 3D translation feature.
Definition at line 286 of file vpFeatureTranslation.h.
vpFeatureTranslation::vpFeatureTranslation | ( | vpFeatureTranslationRepresentationType | r | ) |
Default constructor that build a visual feature and initialize it to zero.
r | : Type of considered 3D translation feature. |
Definition at line 95 of file vpFeatureTranslation.cpp.
References init().
Referenced by duplicate().
vpFeatureTranslation::vpFeatureTranslation | ( | vpHomogeneousMatrix & | f2Mf1_, |
vpFeatureTranslationRepresentationType | r | ||
) |
Constructor that build a 3D visual feature from an homogeneous matrix that represent the 3D transformation between two frames and .
f2Mf1_ | [in] : 3D displacement that the camera has to achieve to move from the frame to the frame ( ). |
r | : type of feature. It can be vpFeature::cdMc or vpFeature::cMo. |
Definition at line 112 of file vpFeatureTranslation.cpp.
References buildFrom(), and init().
|
inlinevirtual |
Destructor. Does nothing.
Definition at line 309 of file vpFeatureTranslation.h.
References vpBasicFeature::flags.
void vpFeatureTranslation::buildFrom | ( | const vpHomogeneousMatrix & | f2Mf1_ | ) |
Build a 3D translation visual feature from an homogeneous matrix that represent the 3D transformation between two frames and .
f2Mf1_ | [in] : 3D displacement that the camera has to achieve to move from the frame to the frame ( ). |
Definition at line 128 of file vpFeatureTranslation.cpp.
References vpBasicFeature::flags, and vpBasicFeature::s.
Referenced by vpFeatureTranslation().
|
inlineinherited |
Return the dimension of the feature vector .
Definition at line 102 of file vpBasicFeature.h.
|
virtual |
Not implemented.
Implements vpBasicFeature.
Definition at line 576 of file vpFeatureTranslation.cpp.
References vpERROR_TRACE.
|
virtual |
Not implemented.
Implements vpBasicFeature.
Definition at line 597 of file vpFeatureTranslation.cpp.
References vpERROR_TRACE.
|
virtual |
Feature duplication.
Create an object with the same type.
Implements vpBasicFeature.
Definition at line 557 of file vpFeatureTranslation.cpp.
References cdMc, cMcd, cMo, and vpFeatureTranslation().
|
virtual |
Compute the error between the current and the desired visual features from a subset of the possible features.
s_star | : Desired visual feature. |
select | : The error can be computed for a selection of a subset of the possible translation features.
|
vpFeatureException::badInitializationError | : If the desired visual feature is not equal to zero in the case of the feature type is cdMc or cMcd. |
The code below shows how to use this method to manipulate the subset in the case of the cdMc feature type. It can be used also with the cMo feature type. In that case just change vpFeatureTranslation::cdMc by vpFeatureTranslation::cMo during the declaration of the two vpFeatureTranslation features.
To manipulate the subset features , the code becomes:
Reimplemented from vpBasicFeature.
Definition at line 467 of file vpFeatureTranslation.cpp.
References vpFeatureException::badInitializationError, cdMc, cMcd, vpBasicFeature::get_s(), vpBasicFeature::s, selectTx(), selectTy(), selectTz(), vpMatrix::stackMatrices(), vpMatrix::sumSquare(), and vpERROR_TRACE.
|
inherited |
Get the feature vector .
Definition at line 123 of file vpBasicFeature.cpp.
References vpBasicFeature::dim_s, vpBasicFeature::FEATURE_LINE, vpBasicFeature::s, and vpMatrix::stackMatrices().
Referenced by vpServo::computeError(), vpBasicFeature::error(), vpGenericFeature::error(), vpFeatureDepth::error(), vpFeatureThetaU::error(), and error().
double vpFeatureTranslation::get_Tx | ( | ) | const |
Return the subset value of the visual feature .
Definition at line 184 of file vpFeatureTranslation.cpp.
References vpBasicFeature::s.
double vpFeatureTranslation::get_Ty | ( | ) | const |
Return the subset value of the visual feature .
Definition at line 195 of file vpFeatureTranslation.cpp.
References vpBasicFeature::s.
double vpFeatureTranslation::get_Tz | ( | ) | const |
Return the subset value of the visual feature .
Definition at line 207 of file vpFeatureTranslation.cpp.
References vpBasicFeature::s.
|
inlineinherited |
Definition at line 164 of file vpBasicFeature.h.
|
inherited |
Get the feature vector dimension.
Definition at line 108 of file vpBasicFeature.cpp.
References vpBasicFeature::dim_s, vpBasicFeature::FEATURE_LINE, vpMatrix::getRows(), and vpBasicFeature::s.
|
virtual |
Initialise the memory space requested for 3D translation visual feature.
Implements vpBasicFeature.
Definition at line 75 of file vpFeatureTranslation.cpp.
References vpBasicFeature::dim_s, vpBasicFeature::flags, vpBasicFeature::nbParameters, vpColVector::resize(), and vpBasicFeature::s.
Referenced by vpFeatureTranslation().
|
virtual |
Compute and return the interaction matrix from a subset of the possible translation features that represent the 3D transformation .
As it exists three different features, the computation of the interaction matrix is diferent for each one.
With the feature type cdMc:
where is the rotation the camera has to achieve to move from the desired camera frame to the current camera frame.
With the feature type cMcd:
where is the rotation the camera has to achieve to move from the current camera frame to the desired camera frame.
With the feature type cMo:
where is the position of the object frame relative to the current camera frame.
select | : Selection of a subset of the possible translation features.
|
The code below shows how to compute the interaction matrix associated to the visual feature using the cdMc feature type.
The code below shows how to compute the interaction matrix associated to the subset visual feature:
L_xy is here now a 2 by 6 matrix. The first line corresponds to the visual feature while the second one to the visual feature.
It is also possible to build the interaction matrix from all the translation components by:
In that case, L_xyz is a 3 by 6 interaction matrix where the last line corresponds to the visual feature.
Implements vpBasicFeature.
Definition at line 295 of file vpFeatureTranslation.cpp.
References cdMc, cMcd, cMo, vpBasicFeature::deallocate, vpBasicFeature::flags, vpBasicFeature::nbParameters, vpBasicFeature::resetFlags(), vpMatrix::resize(), vpBasicFeature::s, selectTx(), selectTy(), selectTz(), vpMatrix::stackMatrices(), vpBasicFeature::user, and vpTRACE.
|
inlinevirtualinherited |
Return element i in the state vector (usage : x = s[i] )
Definition at line 113 of file vpBasicFeature.h.
|
virtual |
Print to stdout the values of the current visual feature .
select | : Selection of a subset of the possible translation features.
|
Implements vpBasicFeature.
Definition at line 530 of file vpFeatureTranslation.cpp.
References vpBasicFeature::s, selectTx(), selectTy(), and selectTz().
|
protectedinherited |
Definition at line 141 of file vpBasicFeature.cpp.
References vpBasicFeature::flags, and vpBasicFeature::nbParameters.
Referenced by vpFeatureEllipse::interaction(), vpFeatureVanishingPoint::interaction(), vpFeatureDepth::interaction(), vpFeaturePoint::interaction(), vpFeatureLine::interaction(), vpFeaturePoint3D::interaction(), vpFeaturePointPolar::interaction(), vpFeatureThetaU::interaction(), and interaction().
|
inlinestaticinherited |
Select all the features.
Definition at line 116 of file vpBasicFeature.h.
|
inlinestatic |
Function used to select the subset of the translation visual feature.
This function is to use in conjunction with interaction() in order to compute the interaction matrix associated to .
See the interaction() method for an usage example.
This function is also useful in the vpServo class to indicate that a subset of the visual feature is to use in the control law:
Definition at line 369 of file vpFeatureTranslation.h.
Referenced by error(), interaction(), and print().
|
inlinestatic |
Function used to select the subset of the translation visual feature.
This function is to use in conjunction with interaction() in order to compute the interaction matrix associated to .
See the interaction() method for an usage example.
This function is also useful in the vpServo class to indicate that a subset of the visual feature is to use in the control law:
Definition at line 413 of file vpFeatureTranslation.h.
Referenced by error(), interaction(), and print().
|
inlinestatic |
Function used to select the subset of the translation visual feature.
This function is to use in conjunction with interaction() in order to compute the interaction matrix associated to .
See the interaction() method for an usage example.
This function is also useful in the vpServo class to indicate that a subset of the visual feature is to use in the control law:
Definition at line 457 of file vpFeatureTranslation.h.
Referenced by error(), interaction(), and print().
void vpFeatureTranslation::set_Tx | ( | const double | t_x | ) |
Initialise the subset value of the 3D visual feature .
t_x | : subset value to initialize. |
Definition at line 147 of file vpFeatureTranslation.cpp.
References vpBasicFeature::s.
void vpFeatureTranslation::set_Ty | ( | const double | t_y | ) |
Initialise the subset value of the 3D visual feature .
t_y | : subset value to initialize. |
Definition at line 160 of file vpFeatureTranslation.cpp.
References vpBasicFeature::s.
void vpFeatureTranslation::set_Tz | ( | const double | t_z | ) |
Initialise the subset value of the 3D visual feature .
t_z | : subset value to initialize. |
Definition at line 174 of file vpFeatureTranslation.cpp.
References vpBasicFeature::s.
|
inlineinherited |
Definition at line 163 of file vpBasicFeature.h.
Referenced by vpServo::addFeature().
|
inherited |
Set feature flags to true to prevent warning when re-computing the interaction matrix without having updated the feature.
Definition at line 151 of file vpBasicFeature.cpp.
References vpBasicFeature::flags, and vpBasicFeature::nbParameters.
|
protectedinherited |
Definition at line 161 of file vpBasicFeature.h.
Referenced by vpFeatureEllipse::interaction(), vpFeatureVanishingPoint::interaction(), vpFeatureSegment::interaction(), vpFeatureDepth::interaction(), vpFeaturePoint::interaction(), vpFeatureLine::interaction(), vpFeaturePoint3D::interaction(), vpFeaturePointPolar::interaction(), vpFeatureThetaU::interaction(), interaction(), and vpBasicFeature::operator=().
|
protectedinherited |
Dimension of the visual feature.
Definition at line 93 of file vpBasicFeature.h.
Referenced by vpFeatureMoment::duplicate(), vpGenericFeature::duplicate(), vpBasicFeature::error(), vpFeatureLuminance::error(), vpGenericFeature::error(), vpBasicFeature::get_s(), vpGenericFeature::get_s(), vpBasicFeature::getDimension(), vpFeatureMoment::getDimension(), vpFeatureEllipse::init(), vpFeatureVanishingPoint::init(), vpFeatureLuminance::init(), vpFeatureSegment::init(), vpFeatureDepth::init(), vpFeatureMoment::init(), vpFeaturePoint::init(), vpFeatureLine::init(), vpFeaturePoint3D::init(), vpFeatureThetaU::init(), vpFeaturePointPolar::init(), init(), vpFeatureLuminance::interaction(), vpGenericFeature::interaction(), vpFeatureMoment::interaction(), vpBasicFeature::operator=(), vpFeatureLuminance::operator=(), vpGenericFeature::print(), vpFeatureMoment::print(), vpGenericFeature::set_s(), vpGenericFeature::setError(), vpGenericFeature::setInteractionMatrix(), vpFeatureMoment::update(), vpFeatureLuminance::vpFeatureLuminance(), and vpGenericFeature::vpGenericFeature().
|
staticinherited |
Definition at line 87 of file vpBasicFeature.h.
Referenced by vpFeatureDepth::error(), vpFeatureDepth::interaction(), and vpFeatureDepth::print().
|
staticinherited |
Definition at line 85 of file vpBasicFeature.h.
Referenced by vpBasicFeature::error(), vpGenericFeature::error(), vpBasicFeature::get_s(), vpBasicFeature::getDimension(), vpFeatureMoment::getDimension(), vpGenericFeature::interaction(), vpFeatureMoment::interaction(), vpGenericFeature::print(), and vpFeatureMoment::print().
|
protectedinherited |
Ensure that all the parameters needed to compute the iteraction matrix are set.
Definition at line 96 of file vpBasicFeature.h.
Referenced by vpFeatureEllipse::buildFrom(), vpFeatureVanishingPoint::buildFrom(), vpFeatureDepth::buildFrom(), vpFeaturePoint::buildFrom(), vpFeatureLine::buildFrom(), vpFeaturePoint3D::buildFrom(), vpFeatureThetaU::buildFrom(), vpFeaturePointPolar::buildFrom(), buildFrom(), vpFeatureMoment::duplicate(), vpFeatureEllipse::init(), vpFeatureVanishingPoint::init(), vpFeatureLuminance::init(), vpFeatureSegment::init(), vpFeatureDepth::init(), vpFeatureMoment::init(), vpFeaturePoint::init(), vpFeatureLine::init(), vpFeaturePoint3D::init(), vpFeatureThetaU::init(), vpFeaturePointPolar::init(), init(), vpFeatureEllipse::interaction(), vpFeatureVanishingPoint::interaction(), vpFeatureSegment::interaction(), vpFeatureDepth::interaction(), vpFeaturePoint::interaction(), vpFeatureLine::interaction(), vpFeaturePoint3D::interaction(), vpFeaturePointPolar::interaction(), vpFeatureThetaU::interaction(), interaction(), vpBasicFeature::operator=(), vpBasicFeature::resetFlags(), vpFeaturePointPolar::set_rho(), vpFeaturePointPolar::set_rhoThetaZ(), vpFeaturePointPolar::set_theta(), vpFeatureThetaU::set_TUx(), vpFeatureThetaU::set_TUy(), vpFeatureThetaU::set_TUz(), vpFeatureEllipse::set_x(), vpFeatureVanishingPoint::set_x(), vpFeatureDepth::set_x(), vpFeaturePoint::set_x(), vpFeaturePoint3D::set_X(), vpFeatureEllipse::set_xy(), vpFeaturePoint::set_xyZ(), vpFeaturePoint3D::set_XYZ(), vpFeatureDepth::set_xyZLogZoverZstar(), vpFeatureEllipse::set_y(), vpFeatureVanishingPoint::set_y(), vpFeatureDepth::set_y(), vpFeaturePoint::set_y(), vpFeaturePoint3D::set_Y(), vpFeatureLuminance::set_Z(), vpFeatureDepth::set_Z(), vpFeaturePoint::set_Z(), vpFeaturePoint3D::set_Z(), vpFeaturePointPolar::set_Z(), vpFeatureEllipse::setABC(), vpFeatureLine::setABCD(), vpBasicFeature::setFlags(), vpFeatureEllipse::setMu(), vpFeatureLine::setRhoTheta(), vpFeatureMoment::update(), vpFeatureLuminance::vpFeatureLuminance(), vpFeatureDepth::~vpFeatureDepth(), vpFeatureEllipse::~vpFeatureEllipse(), vpFeatureLine::~vpFeatureLine(), vpFeatureLuminance::~vpFeatureLuminance(), vpFeatureMoment::~vpFeatureMoment(), vpFeaturePoint::~vpFeaturePoint(), vpFeaturePoint3D::~vpFeaturePoint3D(), vpFeaturePointPolar::~vpFeaturePointPolar(), vpFeatureSegment::~vpFeatureSegment(), vpFeatureThetaU::~vpFeatureThetaU(), ~vpFeatureTranslation(), and vpFeatureVanishingPoint::~vpFeatureVanishingPoint().
|
protectedinherited |
Number of parameters needed to compute the interaction matrix.
Definition at line 98 of file vpBasicFeature.h.
Referenced by vpFeatureEllipse::buildFrom(), vpFeatureVanishingPoint::buildFrom(), vpFeatureDepth::buildFrom(), vpFeaturePoint::buildFrom(), vpFeatureLine::buildFrom(), vpFeaturePoint3D::buildFrom(), vpFeatureThetaU::buildFrom(), vpFeaturePointPolar::buildFrom(), vpFeatureMoment::duplicate(), vpFeatureEllipse::init(), vpFeatureVanishingPoint::init(), vpFeatureLuminance::init(), vpFeatureSegment::init(), vpFeatureDepth::init(), vpFeatureMoment::init(), vpFeaturePoint::init(), vpFeatureLine::init(), vpFeaturePoint3D::init(), vpFeatureThetaU::init(), vpFeaturePointPolar::init(), init(), vpFeatureEllipse::interaction(), vpFeatureVanishingPoint::interaction(), vpFeatureSegment::interaction(), vpFeatureDepth::interaction(), vpFeaturePoint::interaction(), vpFeatureLine::interaction(), vpFeaturePoint3D::interaction(), vpFeaturePointPolar::interaction(), vpFeatureThetaU::interaction(), interaction(), vpBasicFeature::operator=(), vpBasicFeature::resetFlags(), vpFeaturePointPolar::set_rhoThetaZ(), vpFeaturePoint::set_xyZ(), vpFeaturePoint3D::set_XYZ(), vpFeatureDepth::set_xyZLogZoverZstar(), vpFeatureEllipse::setABC(), vpFeatureLine::setABCD(), vpBasicFeature::setFlags(), vpFeatureMoment::update(), and vpFeatureLuminance::vpFeatureLuminance().
|
protectedinherited |
State of the visual feature.
Definition at line 91 of file vpBasicFeature.h.
Referenced by vpFeatureEllipse::buildFrom(), vpFeatureLuminance::buildFrom(), vpFeatureVanishingPoint::buildFrom(), vpFeatureDepth::buildFrom(), vpFeaturePoint::buildFrom(), vpFeatureLine::buildFrom(), vpFeaturePoint3D::buildFrom(), vpFeatureThetaU::buildFrom(), vpFeaturePointPolar::buildFrom(), buildFrom(), vpFeatureEllipse::display(), vpFeatureMoment::duplicate(), vpBasicFeature::error(), vpFeatureEllipse::error(), vpFeatureVanishingPoint::error(), vpFeatureLuminance::error(), vpFeatureMomentAlpha::error(), vpGenericFeature::error(), vpFeatureDepth::error(), vpFeaturePoint::error(), vpFeatureLine::error(), vpFeaturePoint3D::error(), vpFeaturePointPolar::error(), vpFeatureThetaU::error(), error(), vpFeatureDepth::get_LogZoverZstar(), vpFeaturePointPolar::get_rho(), vpBasicFeature::get_s(), vpGenericFeature::get_s(), vpFeaturePointPolar::get_theta(), vpFeatureThetaU::get_TUx(), vpFeatureThetaU::get_TUy(), vpFeatureThetaU::get_TUz(), get_Tx(), get_Ty(), get_Tz(), vpFeatureVanishingPoint::get_x(), vpFeaturePoint::get_x(), vpFeaturePoint3D::get_X(), vpFeatureVanishingPoint::get_y(), vpFeaturePoint::get_y(), vpFeaturePoint3D::get_Y(), vpFeaturePoint3D::get_Z(), vpBasicFeature::getDimension(), vpFeatureEllipse::init(), vpFeatureVanishingPoint::init(), vpFeatureLuminance::init(), vpFeatureSegment::init(), vpFeatureDepth::init(), vpGenericFeature::init(), vpFeatureMoment::init(), vpFeaturePoint::init(), vpFeatureLine::init(), vpFeaturePoint3D::init(), vpFeatureThetaU::init(), vpFeaturePointPolar::init(), init(), vpFeatureEllipse::interaction(), vpFeatureLine::interaction(), vpFeatureThetaU::interaction(), interaction(), vpBasicFeature::operator=(), vpFeatureEllipse::print(), vpFeatureSegment::print(), vpGenericFeature::print(), vpFeatureMoment::print(), vpFeatureLine::print(), vpFeatureThetaU::print(), print(), vpFeatureDepth::set_LogZoverZstar(), vpFeaturePointPolar::set_rho(), vpGenericFeature::set_s(), vpFeaturePointPolar::set_theta(), vpFeatureThetaU::set_TUx(), vpFeatureThetaU::set_TUy(), vpFeatureThetaU::set_TUz(), set_Tx(), set_Ty(), set_Tz(), vpFeatureEllipse::set_x(), vpFeatureVanishingPoint::set_x(), vpFeaturePoint::set_x(), vpFeaturePoint3D::set_X(), vpFeatureEllipse::set_xy(), vpFeatureEllipse::set_y(), vpFeatureVanishingPoint::set_y(), vpFeaturePoint::set_y(), vpFeaturePoint3D::set_Y(), vpFeaturePoint3D::set_Z(), vpFeatureEllipse::setMu(), vpFeatureLine::setRhoTheta(), vpFeatureMoment::update(), and vpGenericFeature::vpGenericFeature().