Visual Servoing Platform
version 3.0.0
|
#include <visp3/visual_features/vpFeatureTranslation.h>
Public Types | |
enum | vpFeatureTranslationRepresentationType { cdMc, cMcd, cMo } |
enum | { FEATURE_ALL = 0xffff } |
enum | vpBasicFeatureDeallocatorType { user, vpServo } |
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] |
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 274 of file vpFeatureTranslation.h.
|
inherited |
Enumerator | |
---|---|
FEATURE_ALL |
Definition at line 84 of file vpBasicFeature.h.
|
inherited |
Indicates who should deallocate the feature.
Enumerator | |
---|---|
user | |
vpServo |
Definition at line 153 of file vpBasicFeature.h.
Kind of implemented 3D translation feature.
Definition at line 282 of file vpFeatureTranslation.h.
vpFeatureTranslation::vpFeatureTranslation | ( | ) |
Default constructor that builds a visual feature and initialize it to zero. The type of the translation feature will be vpFeatureTranslation::cdMc by default. Use the function setFeatureTranslationType() to set the desired type of feature.
Definition at line 90 of file vpFeatureTranslation.cpp.
References init().
Referenced by duplicate().
vpFeatureTranslation::vpFeatureTranslation | ( | vpFeatureTranslationRepresentationType | r | ) |
Default constructor that builds a visual feature and initialize it to zero specifying the type.
r | : Type of considered 3D translation feature. |
Definition at line 103 of file vpFeatureTranslation.cpp.
References init().
vpFeatureTranslation::vpFeatureTranslation | ( | vpHomogeneousMatrix & | f2Mf1_, |
vpFeatureTranslationRepresentationType | r | ||
) |
Constructor that builds 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 120 of file vpFeatureTranslation.cpp.
References buildFrom(), and init().
|
inlinevirtual |
Destructor. Does nothing.
Definition at line 307 of file vpFeatureTranslation.h.
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 136 of file vpFeatureTranslation.cpp.
References vpBasicFeature::flags, and vpBasicFeature::s.
Referenced by vpFeatureTranslation().
|
inlineinherited |
Return the dimension of the feature vector .
Definition at line 101 of file vpBasicFeature.h.
|
virtual |
Not implemented.
Implements vpBasicFeature.
Definition at line 613 of file vpFeatureTranslation.cpp.
References vpERROR_TRACE.
|
virtual |
Not implemented.
Implements vpBasicFeature.
Definition at line 634 of file vpFeatureTranslation.cpp.
References vpERROR_TRACE.
|
virtual |
Feature duplication.
Create an object with the same type.
Implements vpBasicFeature.
Definition at line 594 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 504 of file vpFeatureTranslation.cpp.
References vpFeatureException::badInitializationError, cdMc, cMcd, vpBasicFeature::get_s(), vpBasicFeature::s, selectTx(), selectTy(), selectTz(), vpColVector::stack(), vpColVector::sumSquare(), and vpERROR_TRACE.
|
inherited |
Get the feature vector .
Definition at line 130 of file vpBasicFeature.cpp.
References vpBasicFeature::dim_s, vpBasicFeature::FEATURE_LINE, vpBasicFeature::s, and vpColVector::stack().
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 221 of file vpFeatureTranslation.cpp.
References vpBasicFeature::s.
double vpFeatureTranslation::get_Ty | ( | ) | const |
Return the subset value of the visual feature .
Definition at line 232 of file vpFeatureTranslation.cpp.
References vpBasicFeature::s.
double vpFeatureTranslation::get_Tz | ( | ) | const |
Return the subset value of the visual feature .
Definition at line 244 of file vpFeatureTranslation.cpp.
References vpBasicFeature::s.
|
inlineinherited |
Definition at line 163 of file vpBasicFeature.h.
|
inherited |
Get the feature vector dimension.
Definition at line 115 of file vpBasicFeature.cpp.
References vpBasicFeature::dim_s, vpBasicFeature::FEATURE_LINE, vpArray2D< Type >::getRows(), and vpBasicFeature::s.
vpFeatureTranslation::vpFeatureTranslationRepresentationType vpFeatureTranslation::getFeatureTranslationType | ( | ) | const |
Get the type of translation feature.
Definition at line 211 of file vpFeatureTranslation.cpp.
|
virtual |
Initialise the memory space requested for 3D translation visual feature.
Implements vpBasicFeature.
Definition at line 70 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 332 of file vpFeatureTranslation.cpp.
References cdMc, cMcd, cMo, vpBasicFeature::deallocate, vpBasicFeature::flags, vpBasicFeature::nbParameters, vpBasicFeature::resetFlags(), vpArray2D< Type >::resize(), vpBasicFeature::s, selectTx(), selectTy(), selectTz(), vpMatrix::stack(), vpBasicFeature::user, and vpTRACE.
|
inlinevirtualinherited |
Return element i in the state vector (usage : x = s[i] )
Definition at line 112 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 567 of file vpFeatureTranslation.cpp.
References vpBasicFeature::s, selectTx(), selectTy(), and selectTz().
|
protectedinherited |
Definition at line 148 of file vpBasicFeature.cpp.
References vpBasicFeature::flags, and vpBasicFeature::nbParameters.
Referenced by vpFeatureEllipse::interaction(), vpFeatureVanishingPoint::interaction(), vpFeatureDepth::interaction(), vpFeaturePoint::interaction(), vpFeatureLine::interaction(), vpFeaturePoint3D::interaction(), vpFeatureThetaU::interaction(), vpFeaturePointPolar::interaction(), and interaction().
|
inlinestaticinherited |
Select all the features.
Definition at line 115 of file vpBasicFeature.h.
|
static |
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 694 of file vpFeatureTranslation.cpp.
References vpBasicFeature::FEATURE_LINE.
Referenced by error(), interaction(), and print().
|
static |
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 739 of file vpFeatureTranslation.cpp.
References vpBasicFeature::FEATURE_LINE.
Referenced by error(), interaction(), and print().
|
static |
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 784 of file vpFeatureTranslation.cpp.
References vpBasicFeature::FEATURE_LINE.
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 169 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 182 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 196 of file vpFeatureTranslation.cpp.
References vpBasicFeature::s.
|
inlineinherited |
Definition at line 162 of file vpBasicFeature.h.
Referenced by vpServo::addFeature().
void vpFeatureTranslation::setFeatureTranslationType | ( | const vpFeatureTranslationRepresentationType | r | ) |
Set the type of translation feature.
r | : type of translation feature. It can be vpFeatureTranslation::cdMc, vpFeatureTranslation::cMcd or vpFeatureTranslation::cMo. |
Definition at line 155 of file vpFeatureTranslation.cpp.
|
inherited |
Set feature flags to true to prevent warning when re-computing the interaction matrix without having updated the feature.
Definition at line 158 of file vpBasicFeature.cpp.
References vpBasicFeature::flags, and vpBasicFeature::nbParameters.
|
protectedinherited |
Definition at line 160 of file vpBasicFeature.h.
Referenced by vpFeatureEllipse::interaction(), vpFeatureVanishingPoint::interaction(), vpFeatureSegment::interaction(), vpFeatureDepth::interaction(), vpFeaturePoint::interaction(), vpFeatureLine::interaction(), vpFeaturePoint3D::interaction(), vpFeatureThetaU::interaction(), vpFeaturePointPolar::interaction(), interaction(), and vpBasicFeature::operator=().
|
protectedinherited |
Dimension of the visual feature.
Definition at line 92 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(), vpFeaturePoint::init(), vpFeatureMoment::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 82 of file vpBasicFeature.h.
Referenced by vpBasicFeature::error(), vpGenericFeature::error(), vpBasicFeature::get_s(), vpBasicFeature::getDimension(), vpFeatureMoment::getDimension(), vpGenericFeature::interaction(), vpFeatureMoment::interaction(), vpGenericFeature::print(), vpFeatureMoment::print(), vpFeatureSegment::selectAlpha(), vpFeatureSegment::selectL(), vpFeatureEllipse::selectMu02(), vpFeatureEllipse::selectMu11(), vpFeatureEllipse::selectMu20(), vpFeatureLine::selectRho(), vpFeaturePointPolar::selectRho(), vpFeatureLine::selectTheta(), vpFeaturePointPolar::selectTheta(), vpFeatureThetaU::selectTUx(), vpFeatureThetaU::selectTUy(), vpFeatureThetaU::selectTUz(), selectTx(), selectTy(), selectTz(), vpFeatureEllipse::selectX(), vpFeatureVanishingPoint::selectX(), vpFeaturePoint::selectX(), vpFeaturePoint3D::selectX(), vpFeatureSegment::selectXc(), vpFeatureEllipse::selectY(), vpFeatureVanishingPoint::selectY(), vpFeaturePoint::selectY(), vpFeaturePoint3D::selectY(), vpFeatureSegment::selectYc(), and vpFeaturePoint3D::selectZ().
|
protectedinherited |
Ensure that all the parameters needed to compute the iteraction matrix are set.
Definition at line 95 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(), vpFeaturePoint::init(), vpFeatureMoment::init(), vpFeatureLine::init(), vpFeaturePoint3D::init(), vpFeatureThetaU::init(), vpFeaturePointPolar::init(), init(), vpFeatureEllipse::interaction(), vpFeatureVanishingPoint::interaction(), vpFeatureSegment::interaction(), vpFeatureDepth::interaction(), vpFeaturePoint::interaction(), vpFeatureLine::interaction(), vpFeaturePoint3D::interaction(), vpFeatureThetaU::interaction(), vpFeaturePointPolar::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(), and vpBasicFeature::~vpBasicFeature().
|
protectedinherited |
Number of parameters needed to compute the interaction matrix.
Definition at line 97 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(), vpFeaturePoint::init(), vpFeatureMoment::init(), vpFeatureLine::init(), vpFeaturePoint3D::init(), vpFeatureThetaU::init(), vpFeaturePointPolar::init(), init(), vpFeatureEllipse::interaction(), vpFeatureVanishingPoint::interaction(), vpFeatureSegment::interaction(), vpFeatureDepth::interaction(), vpFeaturePoint::interaction(), vpFeatureLine::interaction(), vpFeaturePoint3D::interaction(), vpFeatureThetaU::interaction(), vpFeaturePointPolar::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 90 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(), vpFeatureEllipse::error(), vpFeatureVanishingPoint::error(), vpBasicFeature::error(), vpFeatureLuminance::error(), vpFeatureMomentAlpha::error(), vpGenericFeature::error(), vpFeatureDepth::error(), vpFeaturePoint::error(), vpFeatureLine::error(), vpFeaturePoint3D::error(), vpFeatureThetaU::error(), vpFeaturePointPolar::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(), vpFeaturePoint::init(), vpFeatureMoment::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().