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()
101 vpGenericFeature::vpGenericFeature(
unsigned int dim_s)
103 this->dim_s =
dim_s ;
105 errorStatus = errorNotInitalized ;
123 "and feature dimension");
125 "size mismatch between error dimension"
126 "and feature dimension"));
129 errorStatus = errorInitialized ;
191 const unsigned int select)
196 "and feature dimension");
198 "size mismatch between s* dimension "
199 "and feature dimension"));
207 if (errorStatus == errorHasToBeUpdated)
209 vpERROR_TRACE(
"Error has no been updated since last iteration"
210 "you should have used vpGenericFeature::setError"
211 "in you visual servoing loop") ;
213 "Error has no been updated since last iteration"));
216 if (errorStatus == errorInitialized)
219 errorStatus = errorHasToBeUpdated ;
220 for (
unsigned int i=0 ; i <
dim_s ; i++)
233 for (
unsigned int i=0 ; i <
dim_s ; i++)
237 ex[0] =
s[i] - s_star[i] ;
247 std::cout <<std::endl << me << std::endl ;
253 std::cout <<std::endl << me << std::endl ;
309 if (errorStatus == errorHasToBeUpdated)
311 vpERROR_TRACE(
"Error has no been updated since last iteration"
312 "you should have used vpGenericFeature::setError"
313 "in you visual servoing loop") ;
315 "Error has no been updated since last iteration"));
318 if (errorStatus == errorInitialized)
320 errorStatus = errorHasToBeUpdated ;
321 for (
unsigned int i=0 ; i <
dim_s ; i++)
333 for (
unsigned int i=0 ; i <
dim_s ; i++)
347 std::cout <<std::endl << me << std::endl ;
353 std::cout <<std::endl << me << std::endl ;
417 std::cout <<
"interaction matrix " << L << std::endl ;
419 std::cout <<
"A possible reason (may be) is that you have set" << std::endl ;
420 std::cout <<
"the interaction matrix for s and compute a control " << std::endl ;
421 std::cout <<
"with Ls=s* (default) or vice versa" << std::endl ;
424 "size mismatch between s* dimension "
425 "and feature dimension"));
433 for (
unsigned int i=0 ; i <
dim_s ; i++)
438 for (
int j=0 ; j < 6 ; j++)
464 vpERROR_TRACE(
"size mismatch between interaction matrix size "
465 "and feature dimension");
467 "size mismatch between interaction matrix size "
468 "and feature dimension"));
492 "and feature dimension");
494 "size mismatch between s dimension"
495 "and feature dimension"));
518 "and feature dimension");
520 "size mismatch between s dimension"
521 "and feature dimension"));
548 "and feature dimension");
550 "size mismatch between number of parameters"
551 "and feature dimension"));
554 s[0] = s0 ;
s[1] = s1 ;
s[2] = s2 ;
578 "and feature dimension");
580 "size mismatch between number of parameters"
581 "and feature dimension"));
584 s0 =
s[0] ; s1 =
s[1] ; s2 =
s[2] ;
606 "and feature dimension");
608 "size mismatch between number of parameters"
609 "and feature dimension"));
612 s[0] = s0 ;
s[1] = s1 ;
634 "and feature dimension");
636 "size mismatch between number of parameters"
637 "and feature dimension"));
640 s0 =
s[0] ; s1 =
s[1] ;
660 "and feature dimension");
662 "size mismatch between number of parameters"
663 "and feature dimension"));
686 "and feature dimension");
688 "size mismatch between number of parameters"
689 "and feature dimension"));
721 std::cout <<
"Generic Feature: " ;
722 for (
unsigned int i=0 ; i <
dim_s ; i++)
725 std::cout <<
" s["<<i <<
"]=" <<
s[i] ;
728 std::cout <<std::endl ;
748 static int firsttime =0 ;
767 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
void setError(vpColVector &error)
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.
static const unsigned int FEATURE_LINE[32]
static vpMatrix stackMatrices(const vpMatrix &A, const vpMatrix &B)
Stack two Matrices C = [ A B ]^T.
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)