34#include <visp3/visual_features/vpGenericFeature.h>
37#include <visp3/core/vpException.h>
38#include <visp3/visual_features/vpFeatureException.h>
41#include <visp3/core/vpDebug.h>
56vpGenericFeature::vpGenericFeature() : L(), err(), errorStatus(errorNotInitialized)
75vpGenericFeature::vpGenericFeature(
unsigned int dimension_gen_s) : L(), err(), errorStatus(errorNotInitialized)
77 this->
dim_s = dimension_gen_s;
78 s.resize(dimension_gen_s);
94 "and feature dimension");
96 "and feature dimension"));
98 errorStatus = errorInitialized;
161 "and feature dimension");
163 "and feature dimension"));
169 if (errorStatus == errorHasToBeUpdated) {
170 vpERROR_TRACE(
"Error has no been updated since last iteration"
171 "you should have used vpGenericFeature::setError"
172 "in you visual servoing loop");
174 "Error has no been updated since last iteration"));
176 else if (errorStatus == errorInitialized) {
178 errorStatus = errorHasToBeUpdated;
179 for (
unsigned int i = 0; i <
dim_s; i++)
190 for (
unsigned int i = 0; i <
dim_s; i++)
193 ex[0] =
s[i] - s_star[i];
250 if (errorStatus == errorHasToBeUpdated) {
251 vpERROR_TRACE(
"Error has no been updated since last iteration"
252 "you should have used vpGenericFeature::setError"
253 "in you visual servoing loop");
255 "Error has no been updated since last iteration"));
257 else if (errorStatus == errorInitialized) {
258 errorStatus = errorHasToBeUpdated;
259 for (
unsigned int i = 0; i <
dim_s; i++)
269 for (
unsigned int i = 0; i <
dim_s; i++)
337 if (L.getRows() == 0) {
338 std::cout <<
"interaction matrix " << L << std::endl;
340 std::cout <<
"A possible reason (may be) is that you have set" << std::endl;
341 std::cout <<
"the interaction matrix for s and compute a control " << std::endl;
342 std::cout <<
"with Ls=s* (default) or vice versa" << std::endl;
345 "and feature dimension"));
352 for (
unsigned int i = 0; i <
dim_s; i++)
357 for (
int j = 0; j < 6; j++)
379 vpERROR_TRACE(
"size mismatch between interaction matrix size "
380 "and feature dimension");
382 "and feature dimension"));
403 "and feature dimension");
405 "and feature dimension"));
424 "and feature dimension");
426 "and feature dimension"));
450 "and feature dimension");
452 "and feature dimension"));
478 "and feature dimension");
480 "and feature dimension"));
503 "and feature dimension");
505 "and feature dimension"));
527 "and feature dimension");
529 "and feature dimension"));
549 "and feature dimension");
551 "and feature dimension"));
570 "and feature dimension");
572 "and feature dimension"));
601 std::cout <<
"Generic Feature: ";
602 for (
unsigned int i = 0; i <
dim_s; i++)
604 std::cout <<
" s[" << i <<
"]=" <<
s[i];
607 std::cout << std::endl;
612 vpGenericFeature *feature =
new vpGenericFeature(
dim_s);
622 const vpColor & ,
unsigned int )
const
624 static int firsttime = 0;
626 if (firsttime == 0) {
637 const vpColor & ,
unsigned int )
const
639 static int firsttime = 0;
641 if (firsttime == 0) {
void resize(unsigned int nrows, unsigned int ncols, bool flagNullify=true, bool recopy_=true)
unsigned int getRows() const
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.
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.
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)
Definition of the vpImage class member functions.
Implementation of a matrix and operations on matrices.
void stack(const vpMatrix &A)