Visual Servoing Platform  version 3.1.0
vpPoseFeatures Class Reference

#include <visp3/vision/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 376 of file vpPoseFeatures.h.

Member Enumeration Documentation

◆ vpPoseFeaturesMethodType

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 382 of file vpPoseFeatures.h.

Constructor & Destructor Documentation

◆ vpPoseFeatures()

vpPoseFeatures::vpPoseFeatures ( )

Default constructor.

Definition at line 45 of file vpPoseFeatures.cpp.

◆ ~vpPoseFeatures()

vpPoseFeatures::~vpPoseFeatures ( )
virtual

Destructor that deletes the array of features and projections.

Definition at line 56 of file vpPoseFeatures.cpp.

References clear().

Member Function Documentation

◆ addFeatureEllipse() [1/2]

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 207 of file vpPoseFeatures.cpp.

References vpFeatureBuilder::create().

◆ addFeatureEllipse() [2/2]

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 189 of file vpPoseFeatures.cpp.

References vpFeatureBuilder::create().

◆ addFeatureLine() [1/2]

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 225 of file vpPoseFeatures.cpp.

References vpFeatureBuilder::create().

◆ addFeatureLine() [2/2]

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 245 of file vpPoseFeatures.cpp.

References vpFeatureBuilder::create().

◆ addFeaturePoint()

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 115 of file vpPoseFeatures.cpp.

References vpFeatureBuilder::create().

◆ addFeaturePoint3D()

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 133 of file vpPoseFeatures.cpp.

References vpFeatureBuilder::create().

◆ addFeatureSegment()

◆ addFeatureVanishingPoint() [1/2]

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 151 of file vpPoseFeatures.cpp.

References vpFeatureBuilder::create().

◆ addFeatureVanishingPoint() [2/2]

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().

◆ addSpecificFeature() [1/2]

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 <visp3/core/vpConfig.h>
#include <visp3/vision/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 593 of file vpPoseFeatures.h.

◆ addSpecificFeature() [2/2]

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 <visp3/core/vpConfig.h>
#include <visp3/vision/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 675 of file vpPoseFeatures.h.

◆ clear()

void vpPoseFeatures::clear ( )

Clear all the features

Definition at line 61 of file vpPoseFeatures.cpp.

Referenced by ~vpPoseFeatures().

◆ computePose()

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 [26].
  • The robust virtual visual servoing approach is described in [7].
Examples:
testPoseFeatures.cpp.

Definition at line 413 of file vpPoseFeatures.cpp.

References vpMatrix::computeCovarianceMatrix(), vpExponentialMap::direct(), vpArray2D< Type >::getRows(), vpHomogeneousMatrix::inverse(), vpRobust::MEstimator(), vpMatrix::pseudoInverse(), vpArray2D< Type >::resize(), vpColVector::resize(), ROBUST_VIRTUAL_VS, vpRobust::setIteration(), vpRobust::setThreshold(), vpMath::sqr(), vpColVector::sumSquare(), vpRobust::TUKEY, VIRTUAL_VS, vpERROR_TRACE, and vpTRACE.

◆ getCovarianceMatrix()

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 475 of file vpPoseFeatures.h.

References vpTRACE.

◆ getLambda()

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 490 of file vpPoseFeatures.h.

◆ getVVSIterMax()

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 498 of file vpPoseFeatures.h.

◆ setCovarianceComputation()

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 505 of file vpPoseFeatures.h.

◆ setLambda()

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 513 of file vpPoseFeatures.h.

◆ setVerbose()

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 527 of file vpPoseFeatures.h.

◆ setVVSIterMax()

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 520 of file vpPoseFeatures.h.