36 #include <visp3/visual_features/vpGenericFeature.h>
39 #include <visp3/core/vpException.h>
40 #include <visp3/visual_features/vpFeatureException.h>
43 #include <visp3/core/vpDebug.h>
65 vpGenericFeature::vpGenericFeature() : L(), err(), errorStatus(errorNotInitalized)
84 vpGenericFeature::vpGenericFeature(
unsigned int dimension_gen_s) : L(), err(), errorStatus(errorNotInitalized)
86 this->
dim_s = dimension_gen_s;
103 "and feature dimension");
105 "and feature dimension"));
107 errorStatus = errorInitialized;
170 "and feature dimension");
172 "and feature dimension"));
178 if (errorStatus == errorHasToBeUpdated) {
179 vpERROR_TRACE(
"Error has no been updated since last iteration"
180 "you should have used vpGenericFeature::setError"
181 "in you visual servoing loop");
183 "Error has no been updated since last iteration"));
184 }
else if (errorStatus == errorInitialized) {
186 errorStatus = errorHasToBeUpdated;
187 for (
unsigned int i = 0; i <
dim_s; i++)
197 for (
unsigned int i = 0; i <
dim_s; i++)
200 ex[0] =
s[i] - s_star[i];
256 if (errorStatus == errorHasToBeUpdated) {
257 vpERROR_TRACE(
"Error has no been updated since last iteration"
258 "you should have used vpGenericFeature::setError"
259 "in you visual servoing loop");
261 "Error has no been updated since last iteration"));
262 }
else if (errorStatus == errorInitialized) {
263 errorStatus = errorHasToBeUpdated;
264 for (
unsigned int i = 0; i <
dim_s; i++)
273 for (
unsigned int i = 0; i <
dim_s; i++)
341 std::cout <<
"interaction matrix " << L << std::endl;
343 std::cout <<
"A possible reason (may be) is that you have set" << std::endl;
344 std::cout <<
"the interaction matrix for s and compute a control " << std::endl;
345 std::cout <<
"with Ls=s* (default) or vice versa" << std::endl;
348 "and feature dimension"));
355 for (
unsigned int i = 0; i <
dim_s; i++)
360 for (
int j = 0; j < 6; j++)
382 vpERROR_TRACE(
"size mismatch between interaction matrix size "
383 "and feature dimension");
385 "and feature dimension"));
406 "and feature dimension");
408 "and feature dimension"));
427 "and feature dimension");
429 "and feature dimension"));
453 "and feature dimension");
455 "and feature dimension"));
481 "and feature dimension");
483 "and feature dimension"));
506 "and feature dimension");
508 "and feature dimension"));
530 "and feature dimension");
532 "and feature dimension"));
552 "and feature dimension");
554 "and feature dimension"));
573 "and feature dimension");
575 "and feature dimension"));
604 std::cout <<
"Generic Feature: ";
605 for (
unsigned int i = 0; i <
dim_s; i++)
607 std::cout <<
" s[" << i <<
"]=" <<
s[i];
610 std::cout << std::endl;
625 const vpColor & ,
unsigned int )
const
627 static int firsttime = 0;
629 if (firsttime == 0) {
640 const vpColor & ,
unsigned int )
const
642 static int firsttime = 0;
644 if (firsttime == 0) {
void resize(unsigned int nrows, unsigned int ncols, bool flagNullify=true, bool recopy_=true)
unsigned int getRows() const
class that defines what is a visual feature
vpColVector s
State of the visual feature.
static const unsigned int FEATURE_LINE[32]
vpColVector get_s(unsigned int select=FEATURE_ALL) const
Get the feature vector .
unsigned int dim_s
Dimension of the visual feature.
Generic class defining intrinsic camera parameters.
Implementation of column vector and the associated operations.
void resize(unsigned int i, bool flagNullify=true)
Class to define RGB colors available for display functionalities.
Error that can be emitted by the vpBasicFeature class and its derivates.
@ notInitializedError
Feature not initialized.
@ badErrorVectorError
Feature list or desired feature list is empty.
@ sizeMismatchError
Size mismatch error.
Class that enables to define a feature or a set of features which are not implemented in ViSP as a sp...
void setInteractionMatrix(const vpMatrix &L)
set the value of the interaction matrix.
void print(unsigned int select=FEATURE_ALL) const
virtual ~vpGenericFeature()
vpMatrix interaction(unsigned int select=FEATURE_ALL)
void display(const vpCameraParameters &cam, const vpImage< unsigned char > &I, const vpColor &color=vpColor::green, unsigned int thickness=1) const
void get_s(vpColVector &s) const
get the value of all the features.
vpColVector error(const vpBasicFeature &s_star, unsigned int select=FEATURE_ALL)
void set_s(const vpColVector &s)
set the value of all the features.
vpGenericFeature * duplicate() const
void setError(const vpColVector &error_vector)
Implementation of a matrix and operations on matrices.
void stack(const vpMatrix &A)