ViSP  2.9.0
vpPoseFeatures Class Reference

#include <vpPoseFeatures.h>

Public Types

enum  vpPoseFeaturesMethodType { VIRTUAL_VS, ROBUST_VIRTUAL_VS }
 

Public Member Functions

 vpPoseFeatures ()
 
virtual ~vpPoseFeatures ()
 
void addFeaturePoint (const vpPoint &)
 
void addFeaturePoint3D (const vpPoint &)
 
void addFeatureVanishingPoint (const vpPoint &)
 
void addFeatureVanishingPoint (const vpLine &, const vpLine &)
 
void addFeatureEllipse (const vpCircle &)
 
void addFeatureEllipse (const vpSphere &)
 
void addFeatureLine (const vpLine &)
 
void addFeatureLine (const vpCylinder &, const int &line)
 
void addFeatureSegment (vpPoint &, vpPoint &)
 
template<typename RetType , typename... ArgsFunc, typename... Args>
void addSpecificFeature (RetType(*fct_ptr)(ArgsFunc...), Args &&...args)
 
template<typename ObjType , typename RetType , typename... ArgsFunc, typename... Args>
void addSpecificFeature (ObjType *obj, RetType(ObjType::*fct_ptr)(ArgsFunc...), Args &&...args)
 
void clear ()
 
void computePose (vpHomogeneousMatrix &cMo, const vpPoseFeaturesMethodType &type=VIRTUAL_VS)
 
vpMatrix getCovarianceMatrix () const
 
double getLambda ()
 
unsigned int getVVSIterMax ()
 
void setCovarianceComputation (const bool &flag)
 
void setLambda (const double &val)
 
void setVVSIterMax (const unsigned int &val)
 
void setVerbose (const bool &mode)
 

Detailed Description

Tools for pose computation from any feature.

This class allows to estimate a pose by virtual visual servoing from visual features. The features that are considered are points, segments, lines, ellipses. If the compiler is compatible with C++ 11, it is possible to introduce specific features that are not directly implemented in ViSP.

Examples:
testPoseFeatures.cpp.

Definition at line 424 of file vpPoseFeatures.h.

Member Enumeration Documentation

Method that will be used to estimate the pose from visual features.

Enumerator
VIRTUAL_VS 

Virtual visual servoing approach.

ROBUST_VIRTUAL_VS 

Robust virtual visual servoing approach.

Definition at line 430 of file vpPoseFeatures.h.

Constructor & Destructor Documentation

vpPoseFeatures::vpPoseFeatures ( )

Default constructor.

Definition at line 46 of file vpPoseFeatures.cpp.

vpPoseFeatures::~vpPoseFeatures ( )
virtual

Destructor that deletes the array of features and projections.

Definition at line 57 of file vpPoseFeatures.cpp.

References clear().

Member Function Documentation

void vpPoseFeatures::addFeatureEllipse ( const vpCircle c)

Add an ellipse feature to the list of features to be considered in the pose computation.

Parameters
c: Ellipse projection expressed as a vpCircle.
Examples:
testPoseFeatures.cpp.

Definition at line 205 of file vpPoseFeatures.cpp.

References vpFeatureBuilder::create().

void vpPoseFeatures::addFeatureEllipse ( const vpSphere s)

Add an ellipse feature to the list of features to be considered in the pose computation.

Parameters
s: Ellipse projection expressed as a vpSphere.

Definition at line 188 of file vpPoseFeatures.cpp.

References vpFeatureBuilder::create().

void vpPoseFeatures::addFeatureLine ( const vpLine l)

Add a line feature to the list of features to be considered in the pose computation.

Parameters
l: Line projection expressed as a vpLine.

Definition at line 222 of file vpPoseFeatures.cpp.

References vpFeatureBuilder::create().

void vpPoseFeatures::addFeatureLine ( const vpCylinder c,
const int &  line 
)

Add a line feature to the list of features to be considered in the pose computation.

Parameters
c: Line projection expressed as a vpCylinder.
line: Integer id that indicates which limb of the cylinder is to consider. It can be vpCylinder::line1 or vpCylinder::line2.

Definition at line 241 of file vpPoseFeatures.cpp.

References vpFeatureBuilder::create().

void vpPoseFeatures::addFeaturePoint ( const vpPoint p)

Add a point feature to the list of features to be considered in the pose computation.

Parameters
p: Point projection expressed as a vpPoint.
Examples:
testPoseFeatures.cpp.

Definition at line 118 of file vpPoseFeatures.cpp.

References vpFeatureBuilder::create().

void vpPoseFeatures::addFeaturePoint3D ( const vpPoint p)

Add a point 3D feature to the list of features to be considered in the pose computation.

Parameters
p: Projection expressed as a vpPoint.
Examples:
testPoseFeatures.cpp.

Definition at line 135 of file vpPoseFeatures.cpp.

References vpFeatureBuilder::create().

void vpPoseFeatures::addFeatureSegment ( vpPoint P1,
vpPoint P2 
)

Add a segment feature to the list of features to be considered in the pose computation.

Parameters
P1: First extremity projection.
P2: Second extremity projection.

Definition at line 260 of file vpPoseFeatures.cpp.

References vpFeatureBuilder::create().

void vpPoseFeatures::addFeatureVanishingPoint ( const vpPoint p)

Add a vanishing point feature to the list of features to be considered in the pose computation.

Parameters
p: Projection expressed as a vpPoint.
Examples:
testPoseFeatures.cpp.

Definition at line 152 of file vpPoseFeatures.cpp.

References vpFeatureBuilder::create().

void vpPoseFeatures::addFeatureVanishingPoint ( const vpLine l1,
const vpLine l2 
)

Add a vanishing point feature to the list of features to be considered in the pose computation.

Parameters
l1: First line used to create the feature.
l2: Second line used to create the feature.

Definition at line 170 of file vpPoseFeatures.cpp.

References vpFeatureBuilder::create().

template<typename RetType , typename... ArgsFunc, typename... Args>
void vpPoseFeatures::addSpecificFeature ( RetType(*)(ArgsFunc...)  fct_ptr,
Args &&...  args 
)

Add a specific feature for the pose computation.

Parameters
fct_ptr: pointer on the function used to create the feature.
args: List of function parameters; First argument supposed to be derived from vpBasicFeature (redefine interaction() and error() functions), others are supposed to be derived from vpForwardProjection (redefine track() function)
Warning
This function is only available with C++11. It has to be activated with USE_CPP11 option from CMake.
#include <visp/vpConfig.h>
#include <visp/vpPoseFeatures.h>
void vp_createPoint(vpFeaturePoint &fp,const vpPoint &p){
}
void vp_createTwoPoint(vpFeaturePoint &fp,const vpPoint &p, const vpPoint&p2){
}
void vp_createLine(vpFeatureLine &fp,const vpLine &l){
}
int main()
{
vpPoint pts[4];
vpLine line;
//... Projection of the points and line
#ifdef VISP_HAVE_CPP11_COMPATIBILITY
pose.addSpecificFeature(ptr, fp, pts[0]);
pose.addSpecificFeature(&vp_createPoint, fp, pts[1]);
pose.addSpecificFeature(&vp_createTwoPoint, fp, pts[2], pts[3]);
pose.addSpecificFeature(&vp_createLine, fl, line);
#endif
//... Pose Computation
return 0;
}
Examples:
testPoseFeatures.cpp.

Definition at line 639 of file vpPoseFeatures.h.

template<typename ObjType , typename RetType, typename... ArgsFunc, typename... Args>
void vpPoseFeatures::addSpecificFeature ( ObjType *  obj,
RetType(ObjType::*)(ArgsFunc...)  fct_ptr,
Args &&...  args 
)

Add a specific feature for the pose computation.

Parameters
obj: object used to call the function defined by fct_ptr.
fct_ptr: pointer on the function used to create the feature.
args: List of function parameters; First argument supposed to be derived from vpBasicFeature (redefine interaction() and error() functions), others are supposed to be derived from vpForwardProjection (redefine track() function)
Warning
This function is only available with C++11. It has to be activated with USE_CPP11 option from CMake.
#include <visp/vpConfig.h>
#include <visp/vpPoseFeatures.h>
class vp_createClass{
public:
vp_createClass(){}
int vp_createPoint(vpFeaturePoint &fp,const vpPoint &p){
return 2;
}
void vp_createTwoPoint(vpFeaturePoint &fp,const vpPoint &p, const vpPoint &p2){
}
void vp_createLine(vpFeatureLine &fp,const vpLine &l){
}
};
int main()
{
vpPoint pts[3];
vpLine line;
//... Projection of the points and line
vp_createClass cpClass;
int (vp_createClass::*ptrClassPoint)(vpFeaturePoint&, const vpPoint&) = &vp_createClass::vp_createPoint;
void (vp_createClass::*ptrClassTwoPoint)(vpFeaturePoint&, const vpPoint&, const vpPoint&) = &vp_createClass::vp_createTwoPoint;
void (vp_createClass::*ptrClassLine)(vpFeatureLine &, const vpLine &) = &vp_createClass::vp_createLine;
#ifdef VISP_HAVE_CPP11_COMPATIBILITY
pose.addSpecificFeature(&cpClass, ptrClassPoint, fp, pts[0]);
pose.addSpecificFeature(&cpClass, ptrClassTwoPoint, fp, pts[1], pts[2]);
pose.addSpecificFeature(&cpClass, ptrClassLine, fl, line);
#endif
//... Pose Computation
return 0;
}

Definition at line 718 of file vpPoseFeatures.h.

void vpPoseFeatures::clear ( )

Clear all the features

Definition at line 65 of file vpPoseFeatures.cpp.

Referenced by ~vpPoseFeatures().

void vpPoseFeatures::computePose ( vpHomogeneousMatrix cMo,
const vpPoseFeaturesMethodType type = VIRTUAL_VS 
)

Compute the pose according to the desired method (virtual visual servoing, or robust virtual visual servoing approach).

Parameters
cMo: Computed pose.
type: Method to use for the pose computation.
  • The virtual visual servoing approach is described in [19].
  • The robust virtual visual servoing approach is described in [8].
Examples:
testPoseFeatures.cpp.

Definition at line 408 of file vpPoseFeatures.cpp.

References ROBUST_VIRTUAL_VS, and VIRTUAL_VS.

vpMatrix vpPoseFeatures::getCovarianceMatrix ( ) const
inline

Get the covariance matrix of the pose parameters computed by virtual visual servoing.

Warning
By default, the covariance matrix is not computed. To enable the computation, use setCovarianceComputation().
Examples:
testPoseFeatures.cpp.

Definition at line 527 of file vpPoseFeatures.h.

References vpTRACE.

double vpPoseFeatures::getLambda ( )
inline

Get the gain that is used to compute the pose with the control law ${\bf v} = -\lambda {\bf L}^+ ({\bf s} - {\bf s}^*)$.

Returns
Value of $\lambda$, the gain of the control law.

Definition at line 539 of file vpPoseFeatures.h.

unsigned int vpPoseFeatures::getVVSIterMax ( )
inline

Get the maximum number of iterations of the virtual visual servoing (VVS) scheme implemented in computePose().

Returns
Maximum number of iterations used during VVS minimization.

Definition at line 546 of file vpPoseFeatures.h.

void vpPoseFeatures::setCovarianceComputation ( const bool &  flag)
inline

Enable or disable covariance computation of the pose parameters.

Parameters
flag: True if the covariance has to be computed, false otherwise.
Examples:
testPoseFeatures.cpp.

Definition at line 553 of file vpPoseFeatures.h.

void vpPoseFeatures::setLambda ( const double &  val)
inline

Set the gain used in the virtual visual servoing scheme : ${\bf v} = -\lambda {\bf L}^+ ({\bf s} - {\bf s}^*)$.

Parameters
val: Value of the gain $\lambda$.
Examples:
testPoseFeatures.cpp.

Definition at line 560 of file vpPoseFeatures.h.

void vpPoseFeatures::setVerbose ( const bool &  mode)
inline

Turn the verbose mode ON / OFF.

Parameters
mode: new verbose state. True to turn ON, false otherwise.
Examples:
testPoseFeatures.cpp.

Definition at line 574 of file vpPoseFeatures.h.

void vpPoseFeatures::setVVSIterMax ( const unsigned int &  val)
inline

Set the maximum number of iterations used in computePose().

Parameters
val: Maximum number of iteration used in the VVS scheme.
Examples:
testPoseFeatures.cpp.

Definition at line 567 of file vpPoseFeatures.h.