![]() |
Visual Servoing Platform
version 3.3.0
|
#include <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 Public Attributes | |
static const unsigned int | FEATURE_LINE [32] |
Protected Attributes | |
vpColVector | s |
unsigned int | dim_s |
bool * | flags |
unsigned int | nbParameters |
Inherited functionalities from vpBasicFeature | |
unsigned int | dimension_s () |
vpColVector | get_s (unsigned int select=FEATURE_ALL) const |
vpBasicFeatureDeallocatorType | getDeallocate () |
unsigned int | getDimension (unsigned int select=FEATURE_ALL) const |
virtual double | operator[] (unsigned int i) const |
void | setDeallocate (vpBasicFeatureDeallocatorType d) |
void | setFlags () |
static unsigned int | selectAll () |
vpBasicFeatureDeallocatorType | deallocate |
void | resetFlags () |
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 275 of file vpFeatureTranslation.h.
|
inherited |
Enumerator | |
---|---|
FEATURE_ALL |
Definition at line 81 of file vpBasicFeature.h.
|
inherited |
Indicates who should deallocate the feature.
Enumerator | |
---|---|
user | |
vpServo |
Definition at line 87 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 87 of file vpFeatureTranslation.cpp.
|
explicit |
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 96 of file vpFeatureTranslation.cpp.
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 ![]() ![]() ![]() |
r | : type of feature. It can be vpFeature::cdMc or vpFeature::cMo. |
Definition at line 113 of file vpFeatureTranslation.cpp.
|
inlinevirtual |
Destructor. Does nothing.
Definition at line 305 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 ![]() ![]() ![]() |
Definition at line 130 of file vpFeatureTranslation.cpp.
|
inlineinherited |
Return the dimension of the feature vector .
Definition at line 109 of file vpBasicFeature.h.
|
virtual |
Not implemented.
Implements vpBasicFeature.
Definition at line 608 of file vpFeatureTranslation.cpp.
|
virtual |
Not implemented.
Implements vpBasicFeature.
Definition at line 625 of file vpFeatureTranslation.cpp.
|
virtual |
Feature duplication.
Create an object with the same type.
Implements vpBasicFeature.
Definition at line 591 of file vpFeatureTranslation.cpp.
|
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 ![]() |
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 508 of file vpFeatureTranslation.cpp.
|
inherited |
Get the feature vector .
Definition at line 113 of file vpBasicFeature.cpp.
double vpFeatureTranslation::get_Tx | ( | ) | const |
Return the subset value of the visual feature
.
Definition at line 204 of file vpFeatureTranslation.cpp.
double vpFeatureTranslation::get_Ty | ( | ) | const |
Return the subset value of the visual feature
.
Definition at line 211 of file vpFeatureTranslation.cpp.
double vpFeatureTranslation::get_Tz | ( | ) | const |
Return the subset value of the visual feature
.
Definition at line 218 of file vpFeatureTranslation.cpp.
|
inlineinherited |
Definition at line 122 of file vpBasicFeature.h.
|
inherited |
Get the feature vector dimension.
Definition at line 99 of file vpBasicFeature.cpp.
vpFeatureTranslation::vpFeatureTranslationRepresentationType vpFeatureTranslation::getFeatureTranslationType | ( | ) | const |
Get the type of translation feature.
Definition at line 194 of file vpFeatureTranslation.cpp.
|
virtual |
Initialise the memory space requested for 3D translation visual feature.
Implements vpBasicFeature.
Definition at line 67 of file vpFeatureTranslation.cpp.
|
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 301 of file vpFeatureTranslation.cpp.
|
inlinevirtualinherited |
Return element i in the state vector (usage : x = s[i] )
Definition at line 129 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 563 of file vpFeatureTranslation.cpp.
|
protectedinherited |
Definition at line 130 of file vpBasicFeature.cpp.
References vpBasicFeature::flags, and vpBasicFeature::nbParameters.
|
inlinestaticinherited |
Select all the features.
Definition at line 141 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 682 of file vpFeatureTranslation.cpp.
|
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 727 of file vpFeatureTranslation.cpp.
|
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 772 of file vpFeatureTranslation.cpp.
void vpFeatureTranslation::set_Tx | ( | double | t_x | ) |
Initialise the subset value of the 3D visual feature
.
t_x | : ![]() |
Definition at line 163 of file vpFeatureTranslation.cpp.
void vpFeatureTranslation::set_Ty | ( | double | t_y | ) |
Initialise the subset value of the 3D visual feature
.
t_y | : ![]() |
Definition at line 173 of file vpFeatureTranslation.cpp.
void vpFeatureTranslation::set_Tz | ( | double | t_z | ) |
Initialise the subset value of the 3D visual feature
.
t_z | : ![]() |
Definition at line 183 of file vpFeatureTranslation.cpp.
|
inlineinherited |
Definition at line 136 of file vpBasicFeature.h.
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 149 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 140 of file vpBasicFeature.cpp.
|
protectedinherited |
Definition at line 147 of file vpBasicFeature.h.
|
protectedinherited |
Dimension of the visual feature.
Definition at line 93 of file vpBasicFeature.h.
Referenced by vpGenericFeature::duplicate(), vpFeatureEllipse::init(), and vpFeatureLuminance::init().
|
staticinherited |
Definition at line 79 of file vpBasicFeature.h.
Referenced by vpFeatureEllipse::selectMu02(), vpFeatureEllipse::selectMu11(), vpFeatureEllipse::selectMu20(), and vpFeatureEllipse::selectY().
|
protectedinherited |
Ensure that all the parameters needed to compute the iteraction matrix are set.
Definition at line 97 of file vpBasicFeature.h.
Referenced by vpFeatureEllipse::buildFrom(), vpFeatureEllipse::init(), vpBasicFeature::resetFlags(), vpFeatureEllipse::set_x(), vpFeatureEllipse::set_xy(), vpFeatureEllipse::set_y(), vpFeatureEllipse::setABC(), and vpFeatureEllipse::setMu().
|
protectedinherited |
Number of parameters needed to compute the interaction matrix.
Definition at line 99 of file vpBasicFeature.h.
Referenced by vpFeatureEllipse::buildFrom(), vpFeatureEllipse::init(), vpBasicFeature::resetFlags(), and vpFeatureEllipse::setABC().
|
protectedinherited |
State of the visual feature.
Definition at line 91 of file vpBasicFeature.h.
Referenced by vpFeatureEllipse::buildFrom(), vpFeatureMomentAlpha::error(), vpFeatureEllipse::init(), vpFeatureLuminance::init(), vpGenericFeature::init(), vpFeatureEllipse::print(), vpFeatureEllipse::set_x(), vpFeatureEllipse::set_xy(), vpFeatureEllipse::set_y(), and vpFeatureEllipse::setMu().