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>
58 vpGenericFeature::vpGenericFeature() : L(), err(), errorStatus(errorNotInitialized)
77 vpGenericFeature::vpGenericFeature(
unsigned int dimension_gen_s) : L(), err(), errorStatus(errorNotInitialized)
79 this->
dim_s = dimension_gen_s;
95 vpERROR_TRACE(
"size mismatch between error dimension"
96 "and feature dimension");
98 "and feature dimension"));
100 errorStatus = errorInitialized;
162 vpERROR_TRACE(
"size mismatch between s* dimension "
163 "and feature dimension");
165 "and feature dimension"));
171 if (errorStatus == errorHasToBeUpdated) {
172 vpERROR_TRACE(
"Error has no been updated since last iteration"
173 "you should have used vpGenericFeature::setError"
174 "in you visual servoing loop");
176 "Error has no been updated since last iteration"));
178 else if (errorStatus == errorInitialized) {
179 vpDEBUG_TRACE(25,
"Error init: e=e.");
180 errorStatus = errorHasToBeUpdated;
181 for (
unsigned int i = 0; i <
dim_s; i++)
190 vpDEBUG_TRACE(25,
"Error not init: e=s-s*.");
192 for (
unsigned int i = 0; i <
dim_s; i++)
195 ex[0] =
s[i] - s_star[i];
252 if (errorStatus == errorHasToBeUpdated) {
253 vpERROR_TRACE(
"Error has no been updated since last iteration"
254 "you should have used vpGenericFeature::setError"
255 "in you visual servoing loop");
257 "Error has no been updated since last iteration"));
259 else if (errorStatus == errorInitialized) {
260 errorStatus = errorHasToBeUpdated;
261 for (
unsigned int i = 0; i <
dim_s; i++)
271 for (
unsigned int i = 0; i <
dim_s; i++)
340 std::cout <<
"interaction matrix " << L << std::endl;
341 vpERROR_TRACE(
"Interaction has not been initialized");
342 std::cout <<
"A possible reason (may be) is that you have set" << std::endl;
343 std::cout <<
"the interaction matrix for s and compute a control " << std::endl;
344 std::cout <<
"with Ls=s* (default) or vice versa" << std::endl;
347 "and feature dimension"));
354 for (
unsigned int i = 0; i <
dim_s; i++)
359 for (
int j = 0; j < 6; j++)
381 vpERROR_TRACE(
"size mismatch between interaction matrix size "
382 "and feature dimension");
384 "and feature dimension"));
404 vpERROR_TRACE(
"size mismatch between s dimension"
405 "and feature dimension");
407 "and feature dimension"));
425 vpERROR_TRACE(
"size mismatch between s dimension"
426 "and feature dimension");
428 "and feature dimension"));
451 vpERROR_TRACE(
"size mismatch between number of parameters"
452 "and feature dimension");
454 "and feature dimension"));
479 vpERROR_TRACE(
"size mismatch between number of parameters"
480 "and feature dimension");
482 "and feature dimension"));
504 vpERROR_TRACE(
"size mismatch between number of parameters"
505 "and feature dimension");
507 "and feature dimension"));
528 vpERROR_TRACE(
"size mismatch between number of parameters"
529 "and feature dimension");
531 "and feature dimension"));
550 vpERROR_TRACE(
"size mismatch between number of parameters"
551 "and feature dimension");
553 "and feature dimension"));
571 vpERROR_TRACE(
"size mismatch between number of parameters"
572 "and feature dimension");
574 "and feature dimension"));
603 std::cout <<
"Generic Feature: ";
604 for (
unsigned int i = 0; i <
dim_s; i++)
606 std::cout <<
" s[" << i <<
"]=" <<
s[i];
609 std::cout << std::endl;
616 vpTRACE(
"dims = %d",
dim_s);
624 const vpColor & ,
unsigned int )
const
626 static int firsttime = 0;
628 if (firsttime == 0) {
630 vpERROR_TRACE(
"not implemented");
639 const vpColor & ,
unsigned int )
const
641 static int firsttime = 0;
643 if (firsttime == 0) {
645 vpERROR_TRACE(
"not implemented");
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.
vpColVector get_s(unsigned int select=FEATURE_ALL) const
Get the feature vector .
unsigned int dim_s
Dimension of the visual feature.
static const unsigned int FEATURE_LINE[32]
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...
vpGenericFeature * duplicate() const VP_OVERRIDE
vpColVector error(const vpBasicFeature &s_star, unsigned int select=FEATURE_ALL) VP_OVERRIDE
void setInteractionMatrix(const vpMatrix &L)
set the value of the interaction matrix.
void display(const vpCameraParameters &cam, const vpImage< unsigned char > &I, const vpColor &color=vpColor::green, unsigned int thickness=1) const VP_OVERRIDE
void get_s(vpColVector &s) const
get the value of all the features.
vpMatrix interaction(unsigned int select=FEATURE_ALL) VP_OVERRIDE
void print(unsigned int select=FEATURE_ALL) const VP_OVERRIDE
void set_s(const vpColVector &s)
set the value of all the features.
void setError(const vpColVector &error_vector)
Implementation of a matrix and operations on matrices.
void stack(const vpMatrix &A)