43 #include <visp/vpGenericFeature.h>
47 #include <visp/vpException.h>
48 #include <visp/vpMatrixException.h>
49 #include <visp/vpFeatureException.h>
52 #include <visp/vpDebug.h>
83 vpGenericFeature::vpGenericFeature()
84 : L(), err(), errorStatus(errorNotInitalized)
102 vpGenericFeature::vpGenericFeature(
unsigned int dimension_gen_s)
103 : L(), err(), errorStatus(errorNotInitalized)
105 this->
dim_s = dimension_gen_s ;
124 "and feature dimension");
126 "size mismatch between error dimension"
127 "and feature dimension"));
130 errorStatus = errorInitialized ;
192 const unsigned int select)
197 "and feature dimension");
199 "size mismatch between s* dimension "
200 "and feature dimension"));
208 if (errorStatus == errorHasToBeUpdated)
210 vpERROR_TRACE(
"Error has no been updated since last iteration"
211 "you should have used vpGenericFeature::setError"
212 "in you visual servoing loop") ;
214 "Error has no been updated since last iteration"));
217 if (errorStatus == errorInitialized)
220 errorStatus = errorHasToBeUpdated ;
221 for (
unsigned int i=0 ; i <
dim_s ; i++)
234 for (
unsigned int i=0 ; i <
dim_s ; i++)
238 ex[0] =
s[i] - s_star[i] ;
248 std::cout <<std::endl << me << std::endl ;
254 std::cout <<std::endl << me << std::endl ;
310 if (errorStatus == errorHasToBeUpdated)
312 vpERROR_TRACE(
"Error has no been updated since last iteration"
313 "you should have used vpGenericFeature::setError"
314 "in you visual servoing loop") ;
316 "Error has no been updated since last iteration"));
319 if (errorStatus == errorInitialized)
321 errorStatus = errorHasToBeUpdated ;
322 for (
unsigned int i=0 ; i <
dim_s ; i++)
334 for (
unsigned int i=0 ; i <
dim_s ; i++)
348 std::cout <<std::endl << me << std::endl ;
354 std::cout <<std::endl << me << std::endl ;
418 std::cout <<
"interaction matrix " << L << std::endl ;
420 std::cout <<
"A possible reason (may be) is that you have set" << std::endl ;
421 std::cout <<
"the interaction matrix for s and compute a control " << std::endl ;
422 std::cout <<
"with Ls=s* (default) or vice versa" << std::endl ;
425 "size mismatch between s* dimension "
426 "and feature dimension"));
434 for (
unsigned int i=0 ; i <
dim_s ; i++)
439 for (
int j=0 ; j < 6 ; j++)
463 std::cout << L_.
getRows() <<
" " <<
dim_s << std::endl ;;
464 vpERROR_TRACE(
"size mismatch between interaction matrix size "
465 "and feature dimension");
467 "size mismatch between interaction matrix size "
468 "and feature dimension"));
490 "and feature dimension");
492 "size mismatch between s dimension"
493 "and feature dimension"));
514 "and feature dimension");
516 "size mismatch between s dimension"
517 "and feature dimension"));
543 "and feature dimension");
545 "size mismatch between number of parameters"
546 "and feature dimension"));
549 s[0] = s0 ;
s[1] = s1 ;
s[2] = s2 ;
573 "and feature dimension");
575 "size mismatch between number of parameters"
576 "and feature dimension"));
579 s0 =
s[0] ; s1 =
s[1] ; s2 =
s[2] ;
601 "and feature dimension");
603 "size mismatch between number of parameters"
604 "and feature dimension"));
607 s[0] = s0 ;
s[1] = s1 ;
629 "and feature dimension");
631 "size mismatch between number of parameters"
632 "and feature dimension"));
635 s0 =
s[0] ; s1 =
s[1] ;
655 "and feature dimension");
657 "size mismatch between number of parameters"
658 "and feature dimension"));
681 "and feature dimension");
683 "size mismatch between number of parameters"
684 "and feature dimension"));
716 std::cout <<
"Generic Feature: " ;
717 for (
unsigned int i=0 ; i <
dim_s ; i++)
720 std::cout <<
" s["<<i <<
"]=" <<
s[i] ;
723 std::cout <<std::endl ;
743 static int firsttime =0 ;
762 static int firsttime =0 ;
Definition of the vpMatrix class.
void resize(const unsigned int nrows, const unsigned int ncols, const bool nullify=true)
void set_s(const vpColVector &s)
set the value of all the features.
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.
unsigned int dim_s
Dimension of the visual feature.
error that can be emited by ViSP classes.
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.
void stackMatrices(const vpMatrix &A)
static const unsigned int FEATURE_LINE[32]
Class that provides a data structure for the column vectors as well as a set of operations on these v...
void print(const unsigned int select=FEATURE_ALL) const
error that can be emited by the vpMatrix class and its derivates
vpGenericFeature * duplicate() const
Class that enables to define a feature or a set of features which are not implemented in ViSP as a sp...
unsigned int getRows() const
Return the number of rows of the matrix.
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)