iCub-main
icub-main
src
tools
iCubSkinGui
plugin
include
Fingertip3Left.h
Go to the documentation of this file.
1
// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2
3
/*
4
* Copyright (C) 2009 RobotCub Consortium
5
* Author: Marco Maggiali marco.maggiali@iit.it
6
* CopyPolicy: Released under the terms of the GNU GPL v2.0.
7
*
8
*/
9
10
#include "
include/TouchSensor.h
"
11
12
#ifndef __ALE_FINGERTIP3_L_H__
13
#define __ALE_FINGERTIP3_L_H__
14
15
class
Fingertip3L
:
public
TouchSensor
16
{
17
public
:
18
Fingertip3L
(
double
cx,
double
cy,
double
th,
double
gain=1.0,
int
layoutNum=0,
int
lrMirror=0)
19
{
20
dGain
=gain;
21
ilrMirror
=lrMirror;
22
ilayoutNum
=layoutNum;
23
nVerts
=7;
24
nTaxels
=12;
25
26
/* dX[0]= 41.0; dY[0]=10.0;
27
dX[1]= 15.0; dY[1]=10.0;
28
dX[2]= 15.0; dY[2]=35.0;
29
dX[3]= 41.0; dY[3]=35.0;
30
dX[4]= 30.0; dY[4]=64.0;
31
dX[5]= 11.0; dY[5]=58.0;
32
dX[6]= 0.0; dY[6]=82.0;
33
dX[7]=-11.0; dY[7]=58.0;
34
dX[8]=-30.0; dY[8]=64.0;
35
dX[9]=-41.0; dY[9]=35.0;
36
dX[10]=-15.0; dY[10]=35.0;
37
dX[11]=-15.0; dY[11]=10.0;
38
*/
39
dY
[0]=-20.0;
dX
[0]= 30.0;
40
dY
[1]=-20.0;
dX
[1]= 0.0;
41
dY
[2]=-20.0;
dX
[2]= -30.0;
42
dY
[3]=-39.0;
dX
[3]= -45.0;
43
dY
[4]=-39.0;
dX
[4]= 45.0;
44
dY
[5]=-58.0;
dX
[5]= -30.0;
45
dY
[6]=-58.0;
dX
[6]= 0.0;
46
dY
[7]=-58.0;
dX
[7]= 30.0;
47
dY
[8]= 10.0;
dX
[8]= 25.0;
48
dY
[9]= 00.0;
dX
[9]= 0.0;
49
dY
[10]= 10.0;
dX
[10]= -25.;
50
dY
[11]= 40.0;
dX
[11]= 0.0;
51
52
dXv
[0]=53.0;
dYv
[0]= 0.0;
53
dXv
[1]=53.0;
dYv
[1]=45.0;
54
dXv
[2]=
dX
[4]+10.0;
dYv
[2]=
dY
[4]+10.0;
55
dXv
[3]=0.0;
dYv
[3]=
dY
[6]+12.0;
56
dXv
[4]=-
dXv
[2];
dYv
[4]=
dYv
[2];
57
dXv
[5]=-
dXv
[1];
dYv
[5]=
dYv
[1];
58
dXv
[6]=-
dXv
[0];
dYv
[6]=
dYv
[0];
59
60
const
double
scale=2.7/15.3;
61
for
(
int
i=0; i<
nTaxels
; ++i)
62
{
63
dX
[i]*=scale;
64
dY
[i]*=scale;
65
}
66
for
(
int
i=0; i<
nVerts
; ++i)
67
{
68
dXv
[i]*=scale;
69
dYv
[i]*=scale;
70
}
71
72
m_RadiusOrig
=1.8;
73
74
const
double
DEG2RAD
=
M_PI
/180.0;
75
const
double
CST=cos(
DEG2RAD
*th);
76
const
double
SNT=sin(
DEG2RAD
*th);
77
78
for
(
int
i=0; i<
nTaxels
; ++i)
79
{
80
double
x
=
dX
[i];
81
double
y
=
dY
[i];
82
if
(lrMirror==1)
x
=-
x
;
83
84
dX
[i]=cx+CST*
x
-SNT*
y
;
85
dY
[i]=cy+SNT*
x
+CST*
y
;
86
}
87
88
for
(
int
i=0; i<
nVerts
; ++i)
89
{
90
double
x
=
dXv
[i];
91
double
y
=
dYv
[i];
92
if
(lrMirror==1)
x
=-
x
;
93
94
// dXv[i]=cx+CST*x-SNT*y;
95
// dYv[i]=cy+SNT*x+CST*y;
96
dXv
[i]=0;
97
dYv
[i]=0;
98
}
99
100
// in static definition
101
//dXmin=dYmin= HUGE;
102
//dXmax=dYmax=-HUGE;
103
104
/*for (int i=0; i<nVerts; ++i)
105
{
106
if (dXv[i]<dXmin) dXmin=dXv[i];
107
if (dXv[i]>dXmax) dXmax=dXv[i];
108
if (dYv[i]<dYmin) dYmin=dYv[i];
109
if (dYv[i]>dYmax) dYmax=dYv[i];
110
}*/
111
112
dXc
=cx;
113
dYc
=cy;
114
}
115
};
116
117
#endif
TouchSensor.h
M_PI
#define M_PI
Definition:
XSensMTx.cpp:24
DEG2RAD
constexpr double DEG2RAD
Definition:
bvhnodeinertial.h:26
Fingertip3L
Definition:
Fingertip3Left.h:16
Fingertip3L::Fingertip3L
Fingertip3L(double cx, double cy, double th, double gain=1.0, int layoutNum=0, int lrMirror=0)
Definition:
Fingertip3Left.h:18
TouchSensor
Definition:
TouchSensor.h:21
TouchSensor::dX
double dX[MAX_TAXELS]
Definition:
TouchSensor.h:382
TouchSensor::dYc
double dYc
Definition:
TouchSensor.h:385
TouchSensor::x
int x[MAX_TAXELS]
Definition:
TouchSensor.h:402
TouchSensor::nVerts
int nVerts
Definition:
TouchSensor.h:405
TouchSensor::m_RadiusOrig
double m_RadiusOrig
Definition:
TouchSensor.h:390
TouchSensor::ilayoutNum
int ilayoutNum
Definition:
TouchSensor.h:387
TouchSensor::dXc
double dXc
Definition:
TouchSensor.h:385
TouchSensor::nTaxels
int nTaxels
Definition:
TouchSensor.h:406
TouchSensor::dXv
double dXv[8]
Definition:
TouchSensor.h:384
TouchSensor::dY
double dY[MAX_TAXELS]
Definition:
TouchSensor.h:382
TouchSensor::dYv
double dYv[8]
Definition:
TouchSensor.h:384
TouchSensor::dGain
double dGain
Definition:
TouchSensor.h:386
TouchSensor::y
int y[MAX_TAXELS]
Definition:
TouchSensor.h:402
TouchSensor::ilrMirror
int ilrMirror
Definition:
TouchSensor.h:388
Generated on Wed Nov 13 2024 21:11:42 for iCub-main by
1.9.1