Visual Servoing Platform  version 3.6.1 under development (2024-05-04)
testRobotViper850.cpp
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  * Test for Afma 6 dof robot.
33  *
34 *****************************************************************************/
35 
43 #include <iostream>
44 #include <visp3/core/vpCameraParameters.h>
45 #include <visp3/core/vpConfig.h>
46 #include <visp3/core/vpDebug.h>
47 #include <visp3/robot/vpRobotViper850.h>
48 #ifdef VISP_HAVE_VIPER850
49 
50 int main()
51 {
52  try {
53 
54  std::cout << "a test for vpRobotViper850 class..." << std::endl;
55 
56  vpRobotViper850 viper850;
58 
59  std::cout << "-- Default settings for Viper850 ---" << std::endl;
60  std::cout << viper850 << std::endl;
61  viper850.getCameraParameters(cam, 640, 480);
62  std::cout << cam << std::endl;
63 
64  std::cout << "-- Settings associated to the Marlin F033C camera without "
65  "distortion ---"
66  << std::endl;
68 
69  std::cout << viper850 << std::endl;
70  viper850.getCameraParameters(cam, 640, 480);
71  std::cout << cam << std::endl;
72 
73  std::cout << "-- Settings associated to the Marlin F033C camera with "
74  "distortion ------"
75  << std::endl;
77  std::cout << viper850 << std::endl;
78  viper850.getCameraParameters(cam, 640, 480);
79  std::cout << cam << std::endl;
80 
81  std::cout << "-- Current joint position:" << std::endl;
82  vpColVector q;
84  std::cout << " " << q.t() << std::endl;
85 
86  std::cout << "-- Current fMe:" << std::endl;
87 
89  viper850.get_fMe(q, fMe);
91  fMe.extract(t);
93  fMe.extract(R);
94  vpRzyzVector rzyz;
95  rzyz.buildFrom(R);
96 
97  std::cout << "fMe:" << std::endl
98  << "\tt: " << t.t() << std::endl
99  << "\trzyz (deg): " << vpMath::deg(rzyz[0]) << " " << vpMath::deg(rzyz[1]) << " " << vpMath::deg(rzyz[2])
100  << std::endl;
101  return EXIT_SUCCESS;
102  } catch (const vpException &e) {
103  std::cout << "Catch an exception: " << e << std::endl;
104  return EXIT_FAILURE;
105  }
106 }
107 #else
108 int main()
109 {
110  std::cout << "The real Viper850 robot controller is not available." << std::endl;
111  return EXIT_SUCCESS;
112 }
113 
114 #endif
Generic class defining intrinsic camera parameters.
@ perspectiveProjWithDistortion
Perspective projection with distortion model.
Implementation of column vector and the associated operations.
Definition: vpColVector.h:163
vpRowVector t() const
error that can be emitted by ViSP classes.
Definition: vpException.h:59
Implementation of an homogeneous matrix and operations on such kind of matrices.
void extract(vpRotationMatrix &R) const
static double deg(double rad)
Definition: vpMath.h:117
void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &position) vp_override
@ ARTICULAR_FRAME
Definition: vpRobot.h:78
Implementation of a rotation matrix and operations on such kind of matrices.
Implementation of a rotation vector as Euler angle minimal representation.
Definition: vpRzyzVector.h:175
vpRzyzVector buildFrom(const vpRotationMatrix &R)
Class that consider the case of a translation vector.
vpRowVector t() const
void getCameraParameters(vpCameraParameters &cam, const unsigned int &image_width, const unsigned int &image_height) const
Definition: vpViper850.cpp:556
@ TOOL_MARLIN_F033C_CAMERA
Definition: vpViper850.h:121
void get_fMe(const vpColVector &q, vpHomogeneousMatrix &fMe) const
Definition: vpViper.cpp:707