Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
testFeature.cpp
1/*
2 * ViSP, open source Visual Servoing Platform software.
3 * Copyright (C) 2005 - 2024 by Inria. All rights reserved.
4 *
5 * This software is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 * See the file LICENSE.txt at the root directory of this source
10 * distribution for additional information about the GNU GPL.
11 *
12 * For using ViSP with software that can not be combined with the GNU
13 * GPL, please contact Inria about acquiring a ViSP Professional
14 * Edition License.
15 *
16 * See https://visp.inria.fr for more information.
17 *
18 * This software was developed at:
19 * Inria Rennes - Bretagne Atlantique
20 * Campus Universitaire de Beaulieu
21 * 35042 Rennes Cedex
22 * France
23 *
24 * If you have questions regarding the use of this file, please contact
25 * Inria at visp@inria.fr
26 *
27 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29 *
30 * Description:
31 * Visual feature manipulation.
32 */
33
34#include <visp3/blob/vpDot2.h>
35#include <visp3/core/vpCameraParameters.h>
36#include <visp3/core/vpColVector.h>
37#include <visp3/core/vpHomogeneousMatrix.h>
38#include <visp3/core/vpRotationMatrix.h>
39#include <visp3/core/vpTranslationVector.h>
40#include <visp3/visual_features/vpFeatureBuilder.h>
41#include <visp3/visual_features/vpFeaturePoint.h>
42#include <visp3/visual_features/vpFeatureThetaU.h>
43#include <visp3/visual_features/vpGenericFeature.h>
44#include <visp3/vs/vpServo.h>
45
46#include <iostream>
47
55int main()
56{
57#ifdef ENABLE_VISP_NAMESPACE
58 using namespace VISP_NAMESPACE_NAME;
59#endif
60 try {
61 for (int i = 0; i < 3; i++) {
63
64 // Creation od a Theta U vector that represent the rotation
65 // between the desired camera frame and the current one.
66 vpThetaUVector tu_cdRc; // Current visual feature s
67 tu_cdRc[0] = 0.1;
68 tu_cdRc[1] = 0.2;
69 tu_cdRc[2] = 0.3;
70
71 // Creation of the current feature s
73 s.buildFrom(tu_cdRc);
74 s.print();
75 task.addFeature(s); // Add current ThetaU feature
76
77 // Creation of the desired feature s^*
78 vpFeatureThetaU s_star(vpFeatureThetaU::cdRc); // init to zero
79
80 // Compute the interaction matrix for the ThetaU_z feature
81 vpMatrix L_z = s.interaction(vpFeatureThetaU::selectTUz());
82 // Compute the error vector (s-s^*) for the ThetaU_z feature
83 s.error(s_star, vpFeatureThetaU::selectTUz());
84
85 std::cout << "End, call vpServo destructors..." << std::endl;
86 }
87 return EXIT_SUCCESS;
88 }
89 catch (const vpException &e) {
90 std::cout << "Catch an exception: " << e << std::endl;
91 return EXIT_FAILURE;
92 }
93}
error that can be emitted by ViSP classes.
Definition vpException.h:60
Class that defines a 3D visual feature from a axis/angle parametrization that represent the rotati...
static unsigned int selectTUz()
Implementation of a matrix and operations on matrices.
Definition vpMatrix.h:175
Implementation of a rotation vector as axis-angle minimal representation.