Visual Servoing Platform version 3.6.0
Loading...
Searching...
No Matches
vpFeatureMomentCommon.h
1/****************************************************************************
2 *
3 * ViSP, open source Visual Servoing Platform software.
4 * Copyright (C) 2005 - 2023 by Inria. All rights reserved.
5 *
6 * This software is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 * See the file LICENSE.txt at the root directory of this source
11 * distribution for additional information about the GNU GPL.
12 *
13 * For using ViSP with software that can not be combined with the GNU
14 * GPL, please contact Inria about acquiring a ViSP Professional
15 * Edition License.
16 *
17 * See https://visp.inria.fr for more information.
18 *
19 * This software was developed at:
20 * Inria Rennes - Bretagne Atlantique
21 * Campus Universitaire de Beaulieu
22 * 35042 Rennes Cedex
23 * France
24 *
25 * If you have questions regarding the use of this file, please contact
26 * Inria at visp@inria.fr
27 *
28 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
29 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30 *
31 * Description:
32 * Pre-filled pseudo-database used to handle dependencies between common
33 *moment features.
34 *
35 * Authors:
36 * Filip Novotny
37 *
38*****************************************************************************/
39
45
46#ifndef _vpFeatureMomentCommon_h_
47#define _vpFeatureMomentCommon_h_
48#include <visp3/visual_features/vpFeatureMomentAlpha.h>
49#include <visp3/visual_features/vpFeatureMomentArea.h>
50#include <visp3/visual_features/vpFeatureMomentAreaNormalized.h>
51#include <visp3/visual_features/vpFeatureMomentBasic.h>
52#include <visp3/visual_features/vpFeatureMomentCInvariant.h>
53#include <visp3/visual_features/vpFeatureMomentCentered.h>
54#include <visp3/visual_features/vpFeatureMomentCommon.h>
55#include <visp3/visual_features/vpFeatureMomentDatabase.h>
56#include <visp3/visual_features/vpFeatureMomentGravityCenter.h>
57#include <visp3/visual_features/vpFeatureMomentGravityCenterNormalized.h>
58
60class vpServo;
158 vpMomentCommon mdb_dst(vpMomentCommon::getSurface(dst),vpMomentCommon::getMu3(dst),vpMomentCommon::getAlpha(dst),1.);
159 //Init classic features
160 vpFeatureMomentCommon fmdb_dst(mdb_dst);
161
162 //update+compute moment primitives from object (for source)
163 mdb_src.updateAll(src);
164 //update+compute features (+interaction matrices) from plane
165 fmdb_src.updateAll(0.,0.,1.);
166
167 //update+compute moment primitives from object (for destination)
168 mdb_dst.updateAll(dst);
169 //update+compute features (+interaction matrices) from plane
170 fmdb_dst.updateAll(0.,0.,1.);
171
172 //define visual servoing task
173 vpServo task;
174 task.setServo(vpServo::EYEINHAND_CAMERA);
175 task.setInteractionMatrixType(vpServo::CURRENT);
176
177 //Add all classic features to the task
178 //In this example, source and destination features are translated by 0.1
179 //will produce a movement of 0.1 on x-axis.
180 task.addFeature(fmdb_src.getFeatureGravityNormalized(),fmdb_dst.getFeatureGravityNormalized());
181 task.addFeature(fmdb_src.getFeatureAn(),fmdb_dst.getFeatureAn());
182 //the object is NOT symmetric
183 //select C4 and C6
184 task.addFeature(fmdb_src.getFeatureCInvariant(),fmdb_dst.getFeatureCInvariant(),(1 << 3) | (1 << 5));
185 task.addFeature(fmdb_src.getFeatureAlpha(),fmdb_dst.getFeatureAlpha());
186
187 task.setLambda(1) ;
188 vpColVector v = task.computeControlLaw() ;
189
190 task.print();
191
192 return 0;
193}
194 \endcode
195This code produces the following output:
196\code
197Visual servoing task:
198Type of control law
199Eye-in-hand configuration
200Control in the camera frame
201List of visual features : s
2020.0166667,-0.00833333,
2031,
204-0.312148,0.0249916,
205-1.43449,
206List of desired visual features : s*
2070.116667,-0.00833333,
2081,
209-0.312148,0.0249916,
210-1.43449,
211Interaction Matrix Ls
212-1 0 -6.938893904e-18 0.007291666667 -1.06875 -0.008333333333
2130 -1 3.469446952e-18 1.0171875 -0.007291666667 -0.01666666667
2140 0 -1 0.0125 0.025 0
2150 0 -4.585529113e-15 -0.2983860943 0.5832596643 -4.376751552e-16
2160 0 -3.58244462e-15 0.08633028234 -0.2484618767 3.63421192e-16
2174.353086256e-17 -1.339411156e-16 -0 -0.03019436997 -0.0168230563 -1
218Error vector (s-s*)
219-0.1 0 0 1.831867991e-15 -1.072059108e-15 0
220Gain : Zero= 1 Inf= 1 Deriv= 0
221
222\endcode
223*/
225{
226private:
227 vpFeatureMomentGravityCenter featureGravity;
228 vpFeatureMomentGravityCenterNormalized featureGravityNormalized;
230 vpFeatureMomentCInvariant featureCInvariant;
231 vpFeatureMomentAlpha featureAlpha;
232 vpFeatureMomentCentered featureCentered;
233 vpFeatureMomentBasic featureMomentBasic;
234 vpFeatureMomentArea feature_moment_area;
235
236public:
237 vpFeatureMomentCommon(vpMomentDatabase &moments, double A = 0.0, double B = 0.0, double C = 1.0);
238 void updateAll(double A, double B, double C);
242 vpFeatureMomentAlpha &getFeatureAlpha() { return featureAlpha; }
243
251 vpFeatureMomentBasic &getFeatureMomentBasic() { return featureMomentBasic; }
255 vpFeatureMomentCentered &getFeatureCentered() { return featureCentered; }
256
260 vpFeatureMomentCInvariant &getFeatureCInvariant() { return featureCInvariant; }
268 vpFeatureMomentArea &getFeatureArea() { return feature_moment_area; }
273};
274
275#endif
Functionality computation for in-plane rotation moment feature : computes the interaction matrix asso...
Functionality computation for normalized surface moment feature. Computes the interaction matrix asso...
Surface moment feature. Computes the interaction matrix associated with vpMomentArea.
Functionality computation for basic moment feature. Computes the interaction matrix associated with v...
Functionality computation for 2D rotation/translation/scale non-symmetric invariant moment feature....
Functionality computation for centered moment feature. Computes the interaction matrix associated wit...
vpFeatureMomentCentered & getFeatureCentered()
vpFeatureMomentAreaNormalized & getFeatureAn()
vpFeatureMomentArea & getFeatureArea()
vpFeatureMomentCommon(vpMomentDatabase &moments, double A=0.0, double B=0.0, double C=1.0)
vpFeatureMomentGravityCenterNormalized & getFeatureGravityNormalized()
vpFeatureMomentBasic & getFeatureMomentBasic()
vpFeatureMomentAlpha & getFeatureAlpha()
vpFeatureMomentCInvariant & getFeatureCInvariant()
vpFeatureMomentGravityCenter & getFeatureGravityCenter()
virtual void updateAll(double A=0.0, double B=0.0, double C=1.0)
Functionality computation for centered and normalized moment feature. Computes the interaction matrix...
Functionality computation for gravity center moment feature. Computes the interaction matrix associat...
This class allows to register all vpMoments so they can access each other according to their dependen...