Visual Servoing Platform  version 3.6.1 under development (2024-04-24)
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 &p)
 
void addFeaturePoint3D (const vpPoint &p)
 
void addFeatureVanishingPoint (const vpPoint &p)
 
void addFeatureVanishingPoint (const vpLine &l1, const vpLine &l2)
 
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 396 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 402 of file vpPoseFeatures.h.

Constructor & Destructor Documentation

◆ vpPoseFeatures()

vpPoseFeatures::vpPoseFeatures ( )

Default constructor.

Definition at line 37 of file vpPoseFeatures.cpp.

◆ ~vpPoseFeatures()

vpPoseFeatures::~vpPoseFeatures ( )
virtual

Destructor that deletes the array of features and projections.

Definition at line 44 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 153 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 141 of file vpPoseFeatures.cpp.

References vpFeatureBuilder::create().

◆ addFeatureLine() [1/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 177 of file vpPoseFeatures.cpp.

References vpFeatureBuilder::create().

◆ addFeatureLine() [2/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 165 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 92 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 104 of file vpPoseFeatures.cpp.

References vpFeatureBuilder::create().

◆ addFeatureSegment()

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

References vpFeatureBuilder::create().

◆ addFeatureVanishingPoint() [1/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 128 of file vpPoseFeatures.cpp.

References vpFeatureBuilder::create().

◆ addFeatureVanishingPoint() [2/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 116 of file vpPoseFeatures.cpp.

References vpFeatureBuilder::create().

◆ addSpecificFeature() [1/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.

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/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;
pose.addSpecificFeature(&cpClass, ptrClassPoint, fp, pts[0]);
pose.addSpecificFeature(&cpClass, ptrClassTwoPoint, fp, pts[1], pts[2]);
pose.addSpecificFeature(&cpClass, ptrClassLine, fl, line);
//... Pose Computation
return 0;
}
static void create(vpFeaturePoint &s, const vpCameraParameters &cam, const vpDot &d)
Class that defines a 2D line visual feature which is composed by two parameters that are and ,...
Class that defines a 2D point visual feature which is composed by two parameters that are the cartes...
Class that defines a 3D line in the object frame and allows forward projection of the line in the cam...
Definition: vpLine.h:101
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
Definition: vpPoint.h:77
Tools for pose computation from any feature.
void addSpecificFeature(RetType(*fct_ptr)(ArgsFunc...), Args &&...args)

Definition at line 796 of file vpPoseFeatures.h.

◆ addSpecificFeature() [2/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.

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/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
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);
//... Pose Computation
return 0;
}
Examples
testPoseFeatures.cpp.

Definition at line 717 of file vpPoseFeatures.h.

◆ clear()

void vpPoseFeatures::clear ( )

Clear all the features

Definition at line 46 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 [31].
  • The robust virtual visual servoing approach is described in [8].
Examples
testPoseFeatures.cpp.

Definition at line 315 of file vpPoseFeatures.cpp.

References ROBUST_VIRTUAL_VS, and VIRTUAL_VS.

◆ 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 533 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 548 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 556 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 563 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 571 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 585 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 578 of file vpPoseFeatures.h.