Visual Servoing Platform version 3.6.0
Loading...
Searching...
No Matches
movePtu46.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 * Tests the control law
33 *
34*****************************************************************************/
50#include <visp3/core/vpConfig.h>
51#include <visp3/core/vpDebug.h>
52#if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX
53#include <unistd.h>
54#endif
55
56#ifdef VISP_HAVE_PTU46
57
58#include <visp3/robot/vpRobotPtu46.h>
59
60int main()
61{
62 try {
63 vpRobotPtu46 robot;
64 vpColVector q(2);
65
66 vpERROR_TRACE(" ");
67
69
70 q = 0;
71 vpCTRACE << "Set position in the articular frame: " << q.t();
72 robot.setPosition(vpRobot::ARTICULAR_FRAME, q);
73
74 q[0] = vpMath::rad(10);
75 q[1] = vpMath::rad(20);
76 vpCTRACE << "Set position in the articular frame: " << q.t();
77 robot.setPosition(vpRobot::ARTICULAR_FRAME, q);
78
79 vpColVector qm(2);
80 robot.getPosition(vpRobot::ARTICULAR_FRAME, qm);
81 vpCTRACE << "Position in the articular frame " << qm.t();
82
83 vpColVector qdot(2);
85#if 0
86 qdot = 0 ;
87 qdot[0] = vpMath::rad(10) ;
88 qdot[1] = vpMath::rad(10) ;
89 vpCTRACE << "Set camera frame velocity " << qdot.t() ;
90
92 sleep(2) ;
93
94 qdot = 0 ;
95 qdot[0] = vpMath::rad(-10) ;
96 qdot[1] = vpMath::rad(-10) ;
97
98 vpCTRACE << "Set camera frame velocity " << qdot.t() ;
100 sleep(2) ;
101#endif
102
103 qdot = 0;
104 // qdot[0] = vpMath::rad(0.1) ;
105 qdot[1] = vpMath::rad(10);
106 vpCTRACE << "Set articular frame velocity " << qdot.t();
108 sleep(2);
109
110 qdot = 0;
111 qdot[0] = vpMath::rad(-5);
112 // qdot[1] = vpMath::rad(-5);
113
114 vpCTRACE << "Set articular frame velocity " << qdot.t();
116 sleep(2);
117 } catch (const vpException &e) {
118 std::cout << "Sorry PtU46 not available. Got exception: " << e << std::endl;
119 return EXIT_FAILURE
120 }
121 return EXIT_SUCCESS;
122}
123#else
124int main()
125{
126 std::cout << "You do not have an PTU46 PT robot connected to your computer..." << std::endl;
127 return EXIT_SUCCESS;
128}
129
130#endif
Implementation of column vector and the associated operations.
error that can be emitted by ViSP classes.
Definition vpException.h:59
static double rad(double deg)
Definition vpMath.h:116
void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &vel)
Interface for the Directed Perception ptu-46 pan, tilt head .
@ ARTICULAR_FRAME
Definition vpRobot.h:76
@ CAMERA_FRAME
Definition vpRobot.h:80
@ STATE_POSITION_CONTROL
Initialize the position controller.
Definition vpRobot.h:65
@ STATE_VELOCITY_CONTROL
Initialize the velocity controller.
Definition vpRobot.h:64
virtual vpRobotStateType setRobotState(const vpRobot::vpRobotStateType newState)
Definition vpRobot.cpp:198
#define vpCTRACE
Definition vpDebug.h:333
#define vpERROR_TRACE
Definition vpDebug.h:388