Visual Servoing Platform
version 3.7.0
Toggle main menu visibility
Loading...
Searching...
No Matches
vpPtu46.cpp
1
/*
2
* ViSP, open source Visual Servoing Platform software.
3
* Copyright (C) 2005 - 2025 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
* Interface for the ptu-46 robot.
32
*/
33
34
/* ----------------------------------------------------------------------- */
35
/* --- INCLUDE ----------------------------------------------------------- */
36
/* ----------------------------------------------------------------------- */
37
38
#include <visp3/core/vpDebug.h>
39
#include <visp3/robot/vpPtu46.h>
40
#include <visp3/robot/vpRobotException.h>
41
42
/* Inclusion des fichiers standards. */
43
#include <math.h>
44
#include <visp3/core/vpMath.h>
45
46
BEGIN_VISP_NAMESPACE
47
/* ------------------------------------------------------------------------ */
48
/* --- COMPUTE ------------------------------------------------------------ */
49
/* ------------------------------------------------------------------------ */
50
const
unsigned
int
vpPtu46::ndof
= 2;
51
const
float
vpPtu46::L
= 0.0765f;
53
const
float
vpPtu46::h
= 0.068f;
55
66
void
vpPtu46::computeMGD
(
const
vpColVector
&q,
vpHomogeneousMatrix
&fMc)
const
67
{
68
if
(q.
getRows
() != 2) {
69
vpERROR_TRACE
(
"Bad dimension for ptu-46 articular vector"
);
70
throw
(
vpException
(
vpException::dimensionError
,
"Bad dimension for ptu-46 articular vector"
));
71
}
72
73
double
q1 = q[0];
// pan
74
double
q2 = q[1];
// tilt
75
76
double
c1 = cos(q1);
77
double
s1 = sin(q1);
78
double
c2 = cos(q2);
79
double
s2 = sin(q2);
80
81
fMc[0][0] = s1;
82
fMc[0][1] = c1 * s2;
83
fMc[0][2] = c1 * c2;
84
fMc[0][3] = -
h
* c1 * s2 -
L
* s1;
85
86
fMc[1][0] = -c1;
87
fMc[1][1] = s1 * s2;
88
fMc[1][2] = s1 * c2;
89
fMc[1][3] = -
h
* s1 * s2 +
L
* c1;
90
91
fMc[2][0] = 0;
92
fMc[2][1] = -c2;
93
fMc[2][2] = s2;
94
fMc[2][3] =
h
* c2;
95
96
fMc[3][0] = 0;
97
fMc[3][1] = 0;
98
fMc[3][2] = 0;
99
fMc[3][3] = 1;
100
101
vpCDEBUG
(6) <<
"Position de la camera: "
<< std::endl << fMc;
102
103
return
;
104
}
105
116
vpHomogeneousMatrix
vpPtu46::computeMGD
(
const
vpColVector
&q)
const
117
{
118
vpHomogeneousMatrix
fMc;
119
120
computeMGD
(q, fMc);
121
122
return
fMc;
123
}
124
134
void
vpPtu46::computeMGD
(
const
vpColVector
&q,
vpPoseVector
&r)
const
135
{
136
vpHomogeneousMatrix
fMc;
137
138
computeMGD
(q, fMc);
139
r.buildFrom(fMc.
inverse
());
140
141
return
;
142
}
143
144
/* ---------------------------------------------------------------------- */
145
/* --- CONSTRUCTOR ------------------------------------------------------ */
146
/* ---------------------------------------------------------------------- */
147
153
vpPtu46::vpPtu46
(
void
) {
init
(); }
154
/* ---------------------------------------------------------------------- */
155
/* --- PRIVATE ---------------------------------------------------------- */
156
/* ---------------------------------------------------------------------- */
157
162
void
vpPtu46::init
() {
return
; }
163
164
/* ----------------------------------------------------------------------- */
165
/* --- DISPLAY ----------------------------------------------------------- */
166
/* ----------------------------------------------------------------------- */
167
168
VISP_EXPORT std::ostream &
operator<<
(std::ostream &os,
const
vpPtu46
&
/* constant */
)
169
{
170
os <<
"Geometric parameters: "
<< std::endl
171
<<
"L: "
172
<<
"\t"
<<
vpPtu46::L
<< std::endl
173
<<
"h: "
174
<<
"\t"
<<
vpPtu46::h
<< std::endl;
175
176
return
os;
177
}
178
189
void
vpPtu46::get_cVe
(
vpVelocityTwistMatrix
&cVe)
const
190
{
191
vpHomogeneousMatrix
cMe;
192
get_cMe
(cMe);
193
194
cVe.
buildFrom
(cMe);
195
}
196
206
void
vpPtu46::get_cMe
(
vpHomogeneousMatrix
&cMe)
const
207
{
208
vpHomogeneousMatrix
eMc;
209
210
eMc[0][0] = 0;
211
eMc[0][1] = -1;
212
eMc[0][2] = 0;
213
eMc[0][3] =
h
;
214
215
eMc[1][0] = 1;
216
eMc[1][1] = 0;
217
eMc[1][2] = 0;
218
eMc[1][3] = -
L
;
219
220
eMc[2][0] = 0;
221
eMc[2][1] = 0;
222
eMc[2][2] = 1;
223
eMc[2][3] = 0;
224
225
eMc[3][0] = 0;
226
eMc[3][1] = 0;
227
eMc[3][2] = 0;
228
eMc[3][3] = 1;
229
230
cMe = eMc.
inverse
();
231
}
232
245
void
vpPtu46::get_eJe
(
const
vpColVector
&q,
vpMatrix
&eJe)
const
246
{
247
248
eJe.
resize
(6, 2);
249
250
if
(q.
getRows
() != 2) {
251
vpERROR_TRACE
(
"Bad dimension for ptu-46 articular vector"
);
252
throw
(
vpException
(
vpException::dimensionError
,
"Bad dimension for ptu-46 articular vector"
));
253
}
254
255
double
s2 = sin(q[1]);
256
double
c2 = cos(q[1]);
257
258
eJe = 0;
259
260
eJe[3][0] = c2;
261
eJe[4][1] = 1;
262
eJe[5][0] = s2;
263
}
264
274
void
vpPtu46::get_fJe
(
const
vpColVector
&q,
vpMatrix
&fJe)
const
275
{
276
277
if
(q.
getRows
() != 2) {
278
vpERROR_TRACE
(
"Bad dimension for ptu-46 articular vector"
);
279
throw
(
vpException
(
vpException::dimensionError
,
"Bad dimension for ptu-46 articular vector"
));
280
}
281
282
fJe.
resize
(6, 2);
283
284
double
s1 = sin(q[0]);
285
double
c1 = cos(q[0]);
286
287
fJe = 0;
288
289
fJe[3][1] = s1;
290
fJe[4][1] = -c1;
291
fJe[5][0] = 1;
292
}
293
END_VISP_NAMESPACE
vpArray2D::resize
void resize(unsigned int nrows, unsigned int ncols, bool flagNullify=true, bool recopy_=true)
Definition
vpArray2D.h:448
vpArray2D::getRows
unsigned int getRows() const
Definition
vpArray2D.h:433
vpColVector
Implementation of column vector and the associated operations.
Definition
vpColVector.h:191
vpException
error that can be emitted by ViSP classes.
Definition
vpException.h:60
vpException::dimensionError
@ dimensionError
Bad dimension.
Definition
vpException.h:71
vpHomogeneousMatrix
Implementation of an homogeneous matrix and operations on such kind of matrices.
Definition
vpHomogeneousMatrix.h:221
vpHomogeneousMatrix::inverse
vpHomogeneousMatrix inverse() const
Definition
vpHomogeneousMatrix.cpp:1016
vpMatrix
Implementation of a matrix and operations on matrices.
Definition
vpMatrix.h:175
vpPoseVector
Implementation of a pose vector and operations on poses.
Definition
vpPoseVector.h:203
vpPtu46::vpPtu46
vpPtu46(void)
Definition
vpPtu46.cpp:153
vpPtu46::get_cVe
void get_cVe(vpVelocityTwistMatrix &_cVe) const
Definition
vpPtu46.cpp:189
vpPtu46::ndof
static const unsigned int ndof
Definition
vpPtu46.h:74
vpPtu46::init
void init(void)
Definition
vpPtu46.cpp:162
vpPtu46::get_cMe
void get_cMe(vpHomogeneousMatrix &_cMe) const
Definition
vpPtu46.cpp:206
vpPtu46::L
static const float L
Definition
vpPtu46.h:77
vpPtu46::computeMGD
void computeMGD(const vpColVector &q, vpHomogeneousMatrix &fMc) const
Definition
vpPtu46.cpp:66
vpPtu46::get_fJe
void get_fJe(const vpColVector &q, vpMatrix &fJe) const
Definition
vpPtu46.cpp:274
vpPtu46::h
static const float h
Definition
vpPtu46.h:78
vpPtu46::operator<<
friend VISP_EXPORT std::ostream & operator<<(std::ostream &os, const vpPtu46 &constant)
Definition
vpPtu46.cpp:168
vpPtu46::get_eJe
void get_eJe(const vpColVector &q, vpMatrix &eJe) const
Definition
vpPtu46.cpp:245
vpVelocityTwistMatrix
Definition
vpVelocityTwistMatrix.h:175
vpVelocityTwistMatrix::buildFrom
vpVelocityTwistMatrix & buildFrom(const vpTranslationVector &t, const vpRotationMatrix &R)
Definition
vpVelocityTwistMatrix.cpp:385
vpCDEBUG
#define vpCDEBUG(level)
Definition
vpDebug.h:554
vpERROR_TRACE
#define vpERROR_TRACE
Definition
vpDebug.h:423
BEGIN_VISP_NAMESPACE
Definition
vpMbtDistanceCircle.cpp:55
modules
robot
src
real-robot
ptu46
vpPtu46.cpp
Generated by
1.17.0