39 #include <visp3/visual_features/vpGenericFeature.h>
43 #include <visp3/core/vpException.h>
44 #include <visp3/visual_features/vpFeatureException.h>
47 #include <visp3/core/vpDebug.h>
78 vpGenericFeature::vpGenericFeature()
79 : L(), err(), errorStatus(errorNotInitalized)
97 vpGenericFeature::vpGenericFeature(
unsigned int dimension_gen_s)
98 : L(), err(), errorStatus(errorNotInitalized)
100 this->
dim_s = dimension_gen_s ;
119 "and feature dimension");
121 "size mismatch between error dimension"
122 "and feature dimension"));
125 errorStatus = errorInitialized ;
187 const unsigned int select)
192 "and feature dimension");
194 "size mismatch between s* dimension "
195 "and feature dimension"));
203 if (errorStatus == errorHasToBeUpdated)
205 vpERROR_TRACE(
"Error has no been updated since last iteration"
206 "you should have used vpGenericFeature::setError"
207 "in you visual servoing loop") ;
209 "Error has no been updated since last iteration"));
212 if (errorStatus == errorInitialized)
215 errorStatus = errorHasToBeUpdated ;
216 for (
unsigned int i=0 ; i <
dim_s ; i++)
229 for (
unsigned int i=0 ; i <
dim_s ; i++)
233 ex[0] =
s[i] - s_star[i] ;
296 if (errorStatus == errorHasToBeUpdated)
298 vpERROR_TRACE(
"Error has no been updated since last iteration"
299 "you should have used vpGenericFeature::setError"
300 "in you visual servoing loop") ;
302 "Error has no been updated since last iteration"));
305 if (errorStatus == errorInitialized)
307 errorStatus = errorHasToBeUpdated ;
308 for (
unsigned int i=0 ; i <
dim_s ; i++)
320 for (
unsigned int i=0 ; i <
dim_s ; i++)
395 std::cout <<
"interaction matrix " << L << std::endl ;
397 std::cout <<
"A possible reason (may be) is that you have set" << std::endl ;
398 std::cout <<
"the interaction matrix for s and compute a control " << std::endl ;
399 std::cout <<
"with Ls=s* (default) or vice versa" << std::endl ;
402 "size mismatch between s* dimension "
403 "and feature dimension"));
411 for (
unsigned int i=0 ; i <
dim_s ; i++)
416 for (
int j=0 ; j < 6 ; j++)
440 std::cout << L_.
getRows() <<
" " <<
dim_s << std::endl ;;
441 vpERROR_TRACE(
"size mismatch between interaction matrix size "
442 "and feature dimension");
444 "size mismatch between interaction matrix size "
445 "and feature dimension"));
467 "and feature dimension");
469 "size mismatch between s dimension"
470 "and feature dimension"));
491 "and feature dimension");
493 "size mismatch between s dimension"
494 "and feature dimension"));
520 "and feature dimension");
522 "size mismatch between number of parameters"
523 "and feature dimension"));
526 s[0] = s0 ;
s[1] = s1 ;
s[2] = s2 ;
550 "and feature dimension");
552 "size mismatch between number of parameters"
553 "and feature dimension"));
556 s0 =
s[0] ; s1 =
s[1] ; s2 =
s[2] ;
578 "and feature dimension");
580 "size mismatch between number of parameters"
581 "and feature dimension"));
584 s[0] = s0 ;
s[1] = s1 ;
606 "and feature dimension");
608 "size mismatch between number of parameters"
609 "and feature dimension"));
612 s0 =
s[0] ; s1 =
s[1] ;
632 "and feature dimension");
634 "size mismatch between number of parameters"
635 "and feature dimension"));
658 "and feature dimension");
660 "size mismatch between number of parameters"
661 "and feature dimension"));
693 std::cout <<
"Generic Feature: " ;
694 for (
unsigned int i=0 ; i <
dim_s ; i++)
697 std::cout <<
" s["<<i <<
"]=" <<
s[i] ;
700 std::cout <<std::endl ;
720 static int firsttime =0 ;
739 static int firsttime =0 ;
Implementation of a matrix and operations on matrices.
void set_s(const vpColVector &s)
set the value of all the features.
void stack(const double &d)
void resize(const unsigned int nrows, const unsigned int ncols, const bool flagNullify=true)
void display(const vpCameraParameters &cam, const vpImage< unsigned char > &I, const vpColor &color=vpColor::green, unsigned int thickness=1) const
Class to define colors available for display functionnalities.
void stack(const vpMatrix &A)
unsigned int dim_s
Dimension of the visual feature.
feature list or desired feature list is empty
vpMatrix interaction(const unsigned int select=FEATURE_ALL)
void get_s(vpColVector &s) const
get the value of all the features.
class that defines what is a visual feature
Error that can be emited by the vpBasicFeature class and its derivates.
virtual ~vpGenericFeature()
Generic class defining intrinsic camera parameters.
void setInteractionMatrix(const vpMatrix &L)
set the value of the interaction matrix.
unsigned int getRows() const
Return the number of rows of the 2D array.
static const unsigned int FEATURE_LINE[32]
Implementation of column vector and the associated operations.
void print(const unsigned int select=FEATURE_ALL) const
vpGenericFeature * duplicate() const
Class that enables to define a feature or a set of features which are not implemented in ViSP as a sp...
vpColVector get_s(unsigned int select=FEATURE_ALL) const
Get the feature vector .
vpColVector error(const vpBasicFeature &s_star, const unsigned int select=FEATURE_ALL)
vpColVector s
State of the visual feature.
void resize(const unsigned int i, const bool flagNullify=true)
void setError(const vpColVector &error_vector)