This file is indexed.

/usr/include/visp/vpPoseFeatures.h is in libvisp-dev 2.9.0-3+b2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
/****************************************************************************
 *
 * $Id: vpPoseFeatures.h 4660 2014-02-09 14:13:27Z fspindle $
 *
 * This file is part of the ViSP software.
 * Copyright (C) 2005 - 2014 by INRIA. All rights reserved.
 * 
 * This software is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * ("GPL") version 2 as published by the Free Software Foundation.
 * See the file LICENSE.txt at the root directory of this source
 * distribution for additional information about the GNU GPL.
 *
 * For using ViSP with software that can not be combined with the GNU
 * GPL, please contact INRIA about acquiring a ViSP Professional 
 * Edition License.
 *
 * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
 * 
 * This software was developed at:
 * INRIA Rennes - Bretagne Atlantique
 * Campus Universitaire de Beaulieu
 * 35042 Rennes Cedex
 * France
 * http://www.irisa.fr/lagadic
 *
 * If you have questions regarding the use of this file, please contact
 * INRIA at visp@inria.fr
 * 
 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 *
 *
 * Description:
 * Pose computation from any features.
 *
 * Authors:
 * Aurelien Yol
 *
 *****************************************************************************/

/*!
  \file vpPose.h
  \brief Tools for pose computation from any feature.

  \author Aurelien Yol
  \date   June, 5 2012
*/

#ifndef vpPoseFeatures_HH
#define vpPoseFeatures_HH

#include <visp/vpDebug.h>
#include <visp/vpException.h>
#include <visp/vpExponentialMap.h>
#include <visp/vpFeatureBuilder.h>
#include <visp/vpBasicFeature.h>
#include <visp/vpFeaturePoint.h>
#include <visp/vpFeatureEllipse.h>
#include <visp/vpRobust.h>
#include <visp/vpForwardProjection.h>
#include <visp/vpPoint.h>
#include <visp/vpCircle.h>
#include <visp/vpSphere.h>
#include <visp/vpLine.h>
#include <visp/vpCylinder.h>

#include <vector>
#include <iostream>

#ifdef VISP_HAVE_CPP11_COMPATIBILITY
#include <tuple>

#ifndef DOXYGEN_SHOULD_SKIP_THIS
//#################################################
//##  Call a function with a tuple as parameters
//#################################################
template < unsigned int N >
struct vpDesiredFeatureBuilderWithTuple
{
  template < typename featureType, typename RetType, typename... ArgsF, typename... ArgsT, typename... Args >
  static void buildDesiredFeatureWithTuple( featureType &feature, 
                           RetType (*f)( ArgsF... ), 
                           const std::tuple<ArgsT...>& t, 
                           Args &&... args )
  {
    vpDesiredFeatureBuilderWithTuple<N-1>::buildDesiredFeatureWithTuple( feature, f, t, std::get<N-1>( t ), args... );
  }
};

template <>
struct vpDesiredFeatureBuilderWithTuple<0>
{
  template < typename featureType, typename RetType, typename... ArgsF, typename... ArgsT, typename... Args >
  static void buildDesiredFeatureWithTuple( featureType &/* feature */, 
                           RetType (*f)( ArgsF... ),
                           const std::tuple<ArgsT...>& /* t */,
                           Args&&... args )
  {
    f( args... );
  }
};

template <>
struct vpDesiredFeatureBuilderWithTuple<1>
{
  template < typename featureType, typename RetType, typename... ArgsF, typename... ArgsT, typename... Args >
  static void buildDesiredFeatureWithTuple( featureType &feature, 
                           RetType (*f)( ArgsF... ),
                           const std::tuple<ArgsT...>& t,
                           Args&&... args )
  {
    vpDesiredFeatureBuilderWithTuple<0>::buildDesiredFeatureWithTuple( feature, f, t, feature, args... );
  }
};

template < typename featureType, typename RetType, typename... Args, typename... ArgsFunc >
void buildDesiredFeatureWithTuple( featureType &feature, 
                  RetType (*f)(ArgsFunc...), 
                  std::tuple<Args...> const& t )
{
   vpDesiredFeatureBuilderWithTuple<sizeof...(Args)>::buildDesiredFeatureWithTuple( feature, f, t );
}

//#################################################
//##  Call a function with a tuple as parameters
//##  Object Mode
//#################################################

template < unsigned int N >
struct vpDesiredFeatureBuilderObjectWithTuple
{
  template < typename objType, typename featureType, typename RetType, typename... ArgsF, typename... ArgsT, typename... Args >
  static void buildDesiredFeatureObjectWithTuple( objType *obj, featureType &feature, 
                           RetType (objType::*f)( ArgsF... ), 
                           const std::tuple<ArgsT...>& t, 
                           Args &&... args )
  {
    vpDesiredFeatureBuilderObjectWithTuple<N-1>::buildDesiredFeatureObjectWithTuple( obj, feature, f, t, std::get<N-1>( t ), args... );
  }
};

template <>
struct vpDesiredFeatureBuilderObjectWithTuple<0>
{
  template < typename objType, typename featureType, typename RetType, typename... ArgsF, typename... ArgsT, typename... Args >
  static void buildDesiredFeatureObjectWithTuple( objType *obj, featureType & /*feature*/, 
                           RetType (objType::*f)( ArgsF... ),
                           const std::tuple<ArgsT...>& /* t */,
                           Args&&... args )
  {
    (obj->*f)( args... );
  }
};

template <>
struct vpDesiredFeatureBuilderObjectWithTuple<1>
{
  template < typename objType, typename featureType, typename RetType, typename... ArgsF, typename... ArgsT, typename... Args >
  static void buildDesiredFeatureObjectWithTuple( objType *obj, featureType &feature, 
                           RetType (objType::*f)( ArgsF... ),
                           const std::tuple<ArgsT...>& t,
                           Args&&... args )
  {
    vpDesiredFeatureBuilderObjectWithTuple<0>::buildDesiredFeatureObjectWithTuple( obj, feature, f, t, feature, args... );
  }
};

template < typename objType, typename featureType, typename RetType, typename... Args, typename... ArgsFunc >
void buildDesiredFeatureObjectWithTuple( objType *obj, featureType &feature, 
                  RetType (objType::*f)(ArgsFunc...), 
                  std::tuple<Args...> const& t )
{
   vpDesiredFeatureBuilderObjectWithTuple<sizeof...(Args)>::buildDesiredFeatureObjectWithTuple( obj, feature, f, t );
}

//#####################################################
//##  Call un function with a tuple as parameters
//##  Track all the parameters with the cMo
//##  Except the first one (must be de "BasicFeature"
//#####################################################

template < unsigned int N >
struct vpCurrentFeatureBuilderWithTuple
{
  template < typename featureType, typename RetType, typename... ArgsTuple, typename... ArgsDecomposed, typename... ArgsF >
  static void buildCurrentFeatureWithTuple( featureType &feature, 
                                  const vpHomogeneousMatrix &cMo, 
                                  RetType (*f)(ArgsF...), std::tuple<ArgsTuple...>& t, 
                                  ArgsDecomposed &&... args )
  {
    auto proj = std::get<N-1>( t );
    proj.track(cMo);
    vpCurrentFeatureBuilderWithTuple<N-1>::buildCurrentFeatureWithTuple( feature, cMo, f, t, proj, args... );
  }
};

template <>
struct vpCurrentFeatureBuilderWithTuple<0>
{
  template < typename featureType, typename RetType, typename... ArgsTuple, typename... ArgsDecomposed, typename... ArgsF >
  static void buildCurrentFeatureWithTuple( featureType &/*feature*/, 
                                  const vpHomogeneousMatrix & /*cMo*/, 
                                  RetType (*f)(ArgsF...), 
                                  std::tuple<ArgsTuple...>&, 
                                  ArgsDecomposed &&... args )
  {
    f( args... );
  }
};

template <>
struct vpCurrentFeatureBuilderWithTuple<1>
{
  template < typename featureType, typename RetType, typename... ArgsTuple, typename... ArgsDecomposed, typename... ArgsF >
  static void buildCurrentFeatureWithTuple( featureType &feature, 
                                  const vpHomogeneousMatrix &cMo, 
                                  RetType (*f)(ArgsF...), 
                                  std::tuple<ArgsTuple...>&t, 
                                  ArgsDecomposed &&... args )
  {
    vpCurrentFeatureBuilderWithTuple<0>::buildCurrentFeatureWithTuple( feature, cMo, f, t, feature, args... );
  }
};

template < typename featureType, typename RetType, typename... ArgsTuple, typename... ArgsFunc >
void buildCurrentFeatureWithTuple( featureType &feature, 
                         const vpHomogeneousMatrix &cMo, 
                         RetType (*f)(ArgsFunc...), 
                         std::tuple<ArgsTuple...> &t )
{
  vpCurrentFeatureBuilderWithTuple<sizeof...(ArgsTuple)>::buildCurrentFeatureWithTuple( feature, cMo, f, t );
}

//#####################################################
//##  Call un function with a tuple as parameters
//##  Track all the parameters with the cMo
//##  Except the first one (must be de "BasicFeature"
//##  Object Mode
//#####################################################

template < unsigned int N >
struct vpCurrentFeatureBuilderObjectWithTuple
{
  template < typename objType, typename featureType, typename RetType, typename... ArgsTuple, typename... ArgsDecomposed, typename... ArgsF >
  static void buildCurrentFeatureObjectWithTuple( objType *obj, featureType &feature, 
                                  const vpHomogeneousMatrix &cMo, 
                                  RetType (objType::*f)(ArgsF...), 
                                  std::tuple<ArgsTuple...>& t, 
                                  ArgsDecomposed &&... args )
  {
    auto proj = std::get<N-1>( t );
    proj.track(cMo);
    vpCurrentFeatureBuilderObjectWithTuple<N-1>::buildCurrentFeatureObjectWithTuple( obj, feature, cMo, f, t, proj, args... );
  }
};

template <>
struct vpCurrentFeatureBuilderObjectWithTuple<0>
{
  template < typename objType, typename featureType, typename RetType, typename... ArgsTuple, typename... ArgsDecomposed, typename... ArgsF >
  static void buildCurrentFeatureObjectWithTuple( objType *obj, featureType &/*feature*/, 
                                  const vpHomogeneousMatrix &/*cMo*/, 
                                  RetType (objType::*f)(ArgsF...), 
                                  std::tuple<ArgsTuple...>&, 
                                  ArgsDecomposed &&... args )
  {
    (obj->*f)( args... );
  }
};

template <>
struct vpCurrentFeatureBuilderObjectWithTuple<1>
{
  template < typename objType, typename featureType, typename RetType, typename... ArgsTuple, typename... ArgsDecomposed, typename... ArgsF >
  static void buildCurrentFeatureObjectWithTuple( objType *obj, featureType &feature, 
                                  const vpHomogeneousMatrix &cMo, 
                                  RetType (objType::*f)(ArgsF...), 
                                  std::tuple<ArgsTuple...>&t, 
                                  ArgsDecomposed &&... args )
  {
    vpCurrentFeatureBuilderObjectWithTuple<0>::buildCurrentFeatureObjectWithTuple( obj, feature, cMo, f, t, feature, args... );
  }
};

template < typename objType, typename featureType, typename RetType, typename... ArgsTuple, typename... ArgsFunc >
void buildCurrentFeatureObjectWithTuple( objType *obj, featureType &feature, 
                         const vpHomogeneousMatrix &cMo, 
                         RetType (objType::*f)(ArgsFunc...), 
                         std::tuple<ArgsTuple...> &t )
{
  vpCurrentFeatureBuilderObjectWithTuple<sizeof...(ArgsTuple)>::buildCurrentFeatureObjectWithTuple( obj, feature, cMo, f, t );
}

//#################################################
//##  Call that will be used in our vpPoseFeatures
//##  to store the specific features.
//#################################################
/*!
  \class vpPoseSpecificFeature
  \ingroup Pose
  \brief Class used to define specific features that could be considered in pose estimation from visual features implemented in vpPoseFeatures.
*/
class VISP_EXPORT vpPoseSpecificFeature
{
public: 
  vpPoseSpecificFeature(){}
  virtual ~vpPoseSpecificFeature(){};
  
  virtual vpColVector error() = 0;
  virtual vpMatrix currentInteraction() = 0;
  virtual void createDesired() = 0;
  virtual void createCurrent(const vpHomogeneousMatrix &cMo) = 0;
};

//#################################################
//##  Template for all kind of specific features
//#################################################

/*!
  \class vpPoseSpecificFeatureTemplate
  \ingroup Pose
  \brief Template class that allows to estimate a pose from all kind of specific features if the compiler support C++ 11.
*/
template< typename featureType, typename RetType, typename ...Args >
class vpPoseSpecificFeatureTemplate : public vpPoseSpecificFeature
{
private:
  featureType desiredFeature;
  featureType currentFeature;
  std::tuple<Args...> *tuple;
  RetType (*func_ptr)(Args...);
  
public:  
  vpPoseSpecificFeatureTemplate(RetType (*f_ptr)(Args...), Args &&...args)
  {
    func_ptr = f_ptr; //std::move(f_ptr);
    tuple = new std::tuple<Args...>(args...);
  }
  
  virtual ~vpPoseSpecificFeatureTemplate()
  {
    delete tuple;
  };
  
  virtual void createDesired(){
    buildDesiredFeatureWithTuple(desiredFeature, func_ptr, *tuple);
  }
  
  virtual vpColVector error(){
    //std::cout << "Getting S... : " << std::get<0>(*tuple).get_s() << std::endl;
    return currentFeature.error(desiredFeature);
  }
  
  virtual vpMatrix currentInteraction(){
    return currentFeature.interaction();
  }
  
  virtual void createCurrent(const vpHomogeneousMatrix &cMo){
    buildCurrentFeatureWithTuple(currentFeature, cMo, func_ptr, *tuple);
  }
};

//#################################################
//##  Template for all kind of specific features
//##  Object Mode
//#################################################

/*!
  \class vpPoseSpecificFeatureTemplateObject
  \ingroup Pose
  \brief Template class that allows to estimate a pose from all kind of specific features if the compiler support C++ 11.
*/
template< typename ObjectType, typename featureType, typename RetType, typename ...Args >
class vpPoseSpecificFeatureTemplateObject : public vpPoseSpecificFeature
{
private:
  featureType desiredFeature;
  featureType currentFeature;
  std::tuple<Args...> *tuple;
  RetType (ObjectType::*func_ptr)(Args...);
  ObjectType* obj;
  
public:  
  vpPoseSpecificFeatureTemplateObject(ObjectType *o, RetType (ObjectType::*f_ptr)(Args...), Args &&...args)
  {
    func_ptr = f_ptr; //std::move(f_ptr);
    tuple = new std::tuple<Args...>(args...);
    obj = o;
  }
  
  virtual ~vpPoseSpecificFeatureTemplateObject()
  {
    delete tuple;
  };
  
  virtual void createDesired(){
    buildDesiredFeatureObjectWithTuple(obj, desiredFeature, func_ptr, *tuple);
  }
  
  virtual vpColVector error(){
    return currentFeature.error(desiredFeature);
  }
  
  virtual vpMatrix currentInteraction(){
    return currentFeature.interaction();
  }
  
  virtual void createCurrent(const vpHomogeneousMatrix &cMo){
    buildCurrentFeatureObjectWithTuple(obj, currentFeature, cMo, func_ptr, *tuple);
  }
};
#endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
#endif //VISP_HAVE_CPP11_COMPATIBILITY

/*!
  \class vpPoseFeatures
  \brief Tools for pose computation from any feature.
  \ingroup Pose

  This class allows to estimate a pose by virtual visual servoing from visual features. The features that are considered are points, segments, lines, ellipses.
  If the compiler is compatible with C++ 11, it is possible to introduce specific features that are not directly implemented in ViSP.
  */
class VISP_EXPORT vpPoseFeatures
{
public:
  /*!
    Method that will be used to estimate the pose from visual features.
    */
  typedef enum
    {
      VIRTUAL_VS,        /*!< Virtual visual servoing approach. */
      ROBUST_VIRTUAL_VS  /*!< Robust virtual visual servoing approach. */
    } vpPoseFeaturesMethodType;
		
private:
  
#ifndef DOXYGEN_SHOULD_SKIP_THIS
  template<typename FeatureType, typename FirstParamType>
  struct vpDuo{
    FeatureType    *desiredFeature;
    FirstParamType firstParam;
    vpDuo() : desiredFeature(NULL), firstParam() {}
  };
  
  template<typename FeatureType, typename FirstParamType, typename SecondParamType>
  struct vpTrio{
    FeatureType    *desiredFeature;
    FirstParamType  firstParam;
    SecondParamType secondParam;

    vpTrio() : desiredFeature(NULL), firstParam(), secondParam() {}
  };
#endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS

  unsigned int                        maxSize;
  unsigned int                        totalSize;
  unsigned int                        vvsIterMax;
  double                              lambda;
  
  bool                                verbose;
  
  bool                                computeCovariance;
  vpMatrix                            covarianceMatrix;
  
  //vpFeaturePoint
  std::vector<vpDuo<vpFeaturePoint,vpPoint> >                   featurePoint_Point_list;
  //vpFeaturePoint3D
  std::vector<vpDuo<vpFeaturePoint3D,vpPoint> >                 featurePoint3D_Point_list;
  //vpFeatureVanishingPoint
  std::vector<vpDuo<vpFeatureVanishingPoint,vpPoint> >          featureVanishingPoint_Point_list;
  std::vector<vpTrio<vpFeatureVanishingPoint,vpLine,vpLine> >   featureVanishingPoint_DuoLine_list;
  //vpFeatureEllipse
  std::vector<vpDuo<vpFeatureEllipse,vpSphere> >                featureEllipse_Sphere_list;
  std::vector<vpDuo<vpFeatureEllipse,vpCircle> >                featureEllipse_Circle_list;
  //vpFeatureLine
  std::vector<vpDuo<vpFeatureLine,vpLine> >                     featureLine_Line_list;
  std::vector<vpTrio<vpFeatureLine,vpCylinder,int> >            featureLine_DuoLineInt_List;
	//vpFeatureSegment
  std::vector<vpTrio<vpFeatureSegment,vpPoint,vpPoint> >        featureSegment_DuoPoints_list;
  
#ifdef VISP_HAVE_CPP11_COMPATIBILITY
  //Specific features
  std::vector<vpPoseSpecificFeature*>                               featureSpecific_list;
#endif
  
public:
  
	vpPoseFeatures();
	virtual ~vpPoseFeatures();
	
	// ! Features addition
	void addFeaturePoint(const vpPoint&);
	
  void addFeaturePoint3D(const vpPoint&);
	
	void addFeatureVanishingPoint(const vpPoint&);
  void addFeatureVanishingPoint(const vpLine&, const vpLine&);
	
	void addFeatureEllipse(const vpCircle&);
	void addFeatureEllipse(const vpSphere&);
	
	void addFeatureLine(const vpLine&);
	void addFeatureLine(const vpCylinder&, const int &line);
  
  void addFeatureSegment(vpPoint &, vpPoint&);

  
#ifdef VISP_HAVE_CPP11_COMPATIBILITY
  template<typename RetType, typename ...ArgsFunc, typename ...Args>
	void addSpecificFeature(RetType (*fct_ptr)(ArgsFunc ...), Args &&...args);
  
  template<typename ObjType, typename RetType, typename ...ArgsFunc, typename ...Args>
  void addSpecificFeature(ObjType *obj, RetType (ObjType::*fct_ptr)(ArgsFunc ...), Args &&...args);
#endif
	
  void clear();
  
	// ! Pose computation
	void computePose(vpHomogeneousMatrix & cMo, const vpPoseFeaturesMethodType &type = VIRTUAL_VS);
  
  /*!
    Get the covariance matrix of the pose parameters computed by virtual visual servoing.
    
    \warning By default, the covariance matrix is not computed. To enable the computation, use setCovarianceComputation().
  */
  vpMatrix getCovarianceMatrix() const { 
    if(!computeCovariance)
      vpTRACE("Warning : The covariance matrix has not been computed. See setCovarianceComputation() to do it.");
    
    return covarianceMatrix; 
  }
  
  /*!
    Get the gain that is used to compute the pose with the control law \f${\bf v} = -\lambda {\bf L}^+ ({\bf s} - {\bf s}^*)\f$.

    \return Value of \f$\lambda\f$, the gain of the control law.
  */
  double getLambda(){ return lambda; }
  
  /*!
    Get the maximum number of iterations of the virtual visual servoing (VVS) scheme implemented in computePose().

    \return Maximum number of iterations used during VVS minimization.
  */
  unsigned int getVVSIterMax(){ return vvsIterMax; }
  
  /*!
    Enable or disable covariance computation of the pose parameters.

    \param flag : True if the covariance has to be computed, false otherwise.
  */
  void setCovarianceComputation(const bool& flag) { computeCovariance = flag; }
  
  /*!
    Set the gain used in the virtual visual servoing scheme : \f${\bf v} = -\lambda {\bf L}^+ ({\bf s} - {\bf s}^*)\f$.

    \param val : Value of the gain \f$\lambda\f$.
  */
  void setLambda(const double &val){ lambda = val; }
  
  /*!
    Set the maximum number of iterations used in computePose().

    \param val : Maximum number of iteration used in the VVS scheme.
  */
  void setVVSIterMax(const unsigned int &val){ vvsIterMax = val; }
  
  /*!
   Turn the verbose mode ON / OFF.
   
   \param mode : new verbose state. True to turn ON, false otherwise.
  */
  void setVerbose(const bool &mode){ verbose = mode; }
 
  
private:
  void error_and_interaction(vpHomogeneousMatrix & cMo, vpColVector &err, vpMatrix &L);
  
	void computePoseVVS(vpHomogeneousMatrix & cMo);
	void computePoseRobustVVS(vpHomogeneousMatrix & cMo);
};

#ifdef VISP_HAVE_CPP11_COMPATIBILITY
/*!
  Add a specific feature for the pose computation.
  
  \param fct_ptr : pointer on the function used to create the feature.
  \param args : List of function parameters; 
                First argument supposed to be derived from vpBasicFeature (redefine interaction() and error() functions), 
                others are supposed to be derived from vpForwardProjection (redefine track() function)
  
  \warning This function is only available with C++11. It has to be activated with USE_CPP11 option from CMake.
  
  \code
#include <visp/vpConfig.h>
#include <visp/vpPoseFeatures.h>

void vp_createPoint(vpFeaturePoint &fp,const vpPoint &p){
  vpFeatureBuilder::create(fp,p);
}

void vp_createTwoPoint(vpFeaturePoint &fp,const vpPoint &p, const vpPoint&p2){
  vpFeatureBuilder::create(fp,p);
  vpFeatureBuilder::create(fp,p2);
}

void vp_createLine(vpFeatureLine &fp,const vpLine &l){
  vpFeatureBuilder::create(fp,l);
}

int main()
{
  vpPoseFeatures pose;
  
  vpPoint pts[4];
  vpLine line;
  
  //... Projection of the points and line 

  vpFeaturePoint fp;
  vpFeatureLine fl;
  void (*ptr)(vpFeaturePoint&, const vpPoint&) = &vpFeatureBuilder::create;
  
#ifdef VISP_HAVE_CPP11_COMPATIBILITY  
  pose.addSpecificFeature(ptr, fp, pts[0]);
  pose.addSpecificFeature(&vp_createPoint, fp, pts[1]);
  pose.addSpecificFeature(&vp_createTwoPoint, fp, pts[2], pts[3]);
  pose.addSpecificFeature(&vp_createLine, fl, line);
#endif
  
  //... Pose Computation

  return 0;
}
  \endcode
*/
template< typename RetType, typename ...ArgsFunc, typename ...Args>
void vpPoseFeatures::addSpecificFeature(RetType (*fct_ptr)(ArgsFunc ...), Args &&...args)
{
  typedef typename std::tuple_element<0, std::tuple<Args...> >::type featureTypeReference;
  typedef typename std::remove_reference<featureTypeReference>::type featureType; 
  featureSpecific_list.push_back(
    new vpPoseSpecificFeatureTemplate< featureType, RetType, ArgsFunc... >(fct_ptr,std::forward<ArgsFunc>(args)...)
  );
  
  featureSpecific_list.back()->createDesired();
  
  totalSize++;
  if(featureSpecific_list.size() > maxSize)
    maxSize = featureSpecific_list.size();
}

/*!
  Add a specific feature for the pose computation.
  
  \param obj : object used to call the function defined by fct_ptr.
  \param fct_ptr : pointer on the function used to create the feature.
  \param args : List of function parameters; 
                First argument supposed to be derived from vpBasicFeature (redefine interaction() and error() functions), 
                others are supposed to be derived from vpForwardProjection (redefine track() function)
  
  \warning This function is only available with C++11. It has to be activated with USE_CPP11 option from CMake.
  
  \code
#include <visp/vpConfig.h>
#include <visp/vpPoseFeatures.h>

class vp_createClass{
public:
  vp_createClass(){}
  
  int vp_createPoint(vpFeaturePoint &fp,const vpPoint &p){
    vpFeatureBuilder::create(fp,p);
    return 2;
  }
  
  void vp_createTwoPoint(vpFeaturePoint &fp,const vpPoint &p, const vpPoint &p2){
    vpFeatureBuilder::create(fp,p);
    vpFeatureBuilder::create(fp,p2);
  }
  
  void vp_createLine(vpFeatureLine &fp,const vpLine &l){
    vpFeatureBuilder::create(fp,l);
  }
};

int main()
{
  vpPoseFeatures pose;
  
  vpPoint pts[3];
  vpLine line;
  
  //... Projection of the points and line 

  vpFeaturePoint fp;
  vpFeatureLine fl;
  
  vp_createClass cpClass;
  int (vp_createClass::*ptrClassPoint)(vpFeaturePoint&, const vpPoint&) = &vp_createClass::vp_createPoint;
  void (vp_createClass::*ptrClassTwoPoint)(vpFeaturePoint&, const vpPoint&, const vpPoint&) = &vp_createClass::vp_createTwoPoint;
  void (vp_createClass::*ptrClassLine)(vpFeatureLine &, const vpLine &) = &vp_createClass::vp_createLine;
  
#ifdef VISP_HAVE_CPP11_COMPATIBILITY  
  pose.addSpecificFeature(&cpClass, ptrClassPoint, fp, pts[0]);
  pose.addSpecificFeature(&cpClass, ptrClassTwoPoint, fp, pts[1], pts[2]);
  pose.addSpecificFeature(&cpClass, ptrClassLine, fl, line);
#endif
  
  //... Pose Computation

  return 0;
}
  \endcode
*/
template< typename ObjType, typename RetType, typename ...ArgsFunc, typename ...Args>
void vpPoseFeatures::addSpecificFeature(ObjType *obj, RetType (ObjType::*fct_ptr)(ArgsFunc ...), Args &&...args)
{
  typedef typename std::tuple_element<0, std::tuple<Args...> >::type featureTypeReference;
  typedef typename std::remove_reference<featureTypeReference>::type featureType; 
  featureSpecific_list.push_back(
    new vpPoseSpecificFeatureTemplateObject< ObjType, featureType, RetType, ArgsFunc... >(obj, fct_ptr,std::forward<ArgsFunc>(args)...)
  );
  
  featureSpecific_list.back()->createDesired();
  
  totalSize++;
  if(featureSpecific_list.size() > maxSize)
    maxSize = featureSpecific_list.size();
}
#endif


#endif