iCub-main
icub-main
src
tools
iCubSkinGui
plugin
include
PalmLeft.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_PALML_H__
13
#define __ALE_PALML_H__
14
15
class
PalmL
:
public
TouchSensor
16
{
17
public
:
18
PalmL
(
double
cx,
double
cy,
double
th,
double
gain=1.0,
int
layoutNum=0,
int
lrMirror=0)
19
{
20
const
double
DEG2RAD
=
M_PI
/180.0;
21
22
const
double
CST=cos(
DEG2RAD
*th);
23
const
double
SNT=sin(
DEG2RAD
*th);
24
25
const
double
H
=sin(
DEG2RAD
*60.0);
26
const
double
L=2.0*
H
/9.0;
27
28
dGain
=gain;
29
ilrMirror
=lrMirror;
30
ilayoutNum
=layoutNum;
31
nVerts
=4;
32
nTaxels
=48;
33
m_RadiusOrig
=1.8;
34
35
for
(
int
i=0; i<
nTaxels
; ++i)
36
{
37
dX
[0]=15;
//not used
38
dY
[0]=15;
//not used
39
}
40
41
42
43
dX
[29]=1.5;
dY
[29]=6.5;
44
dX
[28]=6.5;
dY
[28]=6;
45
dX
[30]=11.5;
dY
[30]=6;
46
dX
[31]=16.5;
dY
[31]=6;
47
dX
[33]=21.5;
dY
[33]=6;
48
dX
[27]=6.5;
dY
[27]=1;
49
dX
[26]=11.5;
dY
[26]=1;
50
dX
[32]=16.5;
dY
[32]=1;
51
dX
[34]=21.5;
dY
[34]=1;
52
dX
[35]=9.5;
dY
[35]=-2;
//thermal_pad
53
dX
[25]=14.5;
dY
[25]=-3.5;
54
dX
[24]=21.5;
dY
[24]=-4;
55
56
57
dX
[6]=27;
dY
[6]=6;
58
dX
[7]=32;
dY
[7]=6;
59
dX
[8]=37;
dY
[8]=6;
60
dX
[9]=42;
dY
[9]=5.5;
61
dX
[10]=47;
dY
[10]=4.5;
62
dX
[11]=51.7;
dY
[11]=4;
//thermal_pad
63
dX
[3]=27;
dY
[3]=1;
64
dX
[1]=32;
dY
[1]=1;
65
dX
[4]=37;
dY
[4]=1;
66
dX
[5]=42;
dY
[5]=0;
67
dX
[2]=27;
dY
[2]=-3.5;
68
dX
[0]=32;
dY
[0]=-3.5;
69
70
71
dX
[17]=37.5;
dY
[17]=-4.5;
72
dX
[20]=42;
dY
[20]=-5.5;
73
dX
[21]=46.5;
dY
[21]=-8;
74
dX
[15]=27;
dY
[15]=-9;
75
dX
[14]=32;
dY
[14]=-9;
76
dX
[16]=37;
dY
[16]=-9;
77
dX
[19]=42;
dY
[19]=-10.5;
78
79
dX
[13]=38;
dY
[13]=-14;
80
dX
[18]=43;
dY
[18]=-16;
81
dX
[22]=47;
dY
[22]=-13;
82
dX
[12]=47.5;
dY
[12]=-18;
83
dX
[23]=43.5;
dY
[23]=-20;
//thermal_pad
84
85
dX
[45]=28;
dY
[45]=-19.5;
86
dX
[42]=33;
dY
[42]=-19.5;
87
dX
[36]=38;
dY
[36]=-19.5;
88
dX
[44]=28;
dY
[44]=-24.5;
89
dX
[40]=33;
dY
[40]=-24.5;
90
dX
[38]=38;
dY
[38]=-24.5;
91
dX
[37]=43;
dY
[37]=-26;
92
dX
[41]=35;
dY
[41]=-29;
93
dX
[39]=40;
dY
[39]=-29.5;
94
dX
[43]=37;
dY
[43]=-32.5;
//thermal pad
95
dX
[47]=33;
dY
[47]=-14.5;
96
dX
[46]=28;
dY
[46]=-14.5;
97
98
for
(
int
i=0; i<
nTaxels
; ++i)
99
{
100
double
x
=1.2*
dX
[i]-0.0;
101
double
y
=1.2*
dY
[i]-0.0;
102
103
if
(lrMirror==1)
x
=-
x
;
104
dX
[i]=cx+CST*
x
-SNT*
y
;
105
dY
[i]=cy+SNT*
x
+CST*
y
;
106
}
107
108
dXv
[0]=-25;
109
dYv
[0]=-50;
110
dXv
[1]=+50;
111
dYv
[1]=-50;
112
dXv
[2]=+50;
113
dYv
[2]=+50;
114
dXv
[3]=-25;
115
dYv
[3]=+50;
116
117
for
(
int
i=0; i<
nVerts
; ++i)
118
{
119
double
x
=
dXv
[i];
120
double
y
=
dYv
[i];
121
if
(lrMirror==1)
x
=-
x
;
122
dXv
[i]=cx+CST*
x
-SNT*
y
;
123
dYv
[i]=cy+SNT*
x
+CST*
y
;
124
}
125
126
// in static definition
127
//dXmin=dYmin= HUGE;
128
//dXmax=dYmax=-HUGE;
129
130
for
(
int
i=0; i<
nVerts
; ++i)
131
{
132
if
(
dXv
[i]<
dXmin
)
dXmin
=
dXv
[i];
133
if
(
dXv
[i]>
dXmax
)
dXmax
=
dXv
[i];
134
if
(
dYv
[i]<
dYmin
)
dYmin
=
dYv
[i];
135
if
(
dYv
[i]>
dYmax
)
dYmax
=
dYv
[i];
136
}
137
138
dXc
=cx;
139
dYc
=cy;
140
}
141
void
draw
(
unsigned
char
*image)
142
{
143
for
(
int
i=0; i<
nVerts
; ++i)
144
{
145
//drawLine(image,xv[i],yv[i],xv[(i+1)%nVerts],yv[(i+1)%nVerts]);
146
}
147
148
for
(
int
i=0; i<
nTaxels
; ++i)
149
{
150
if
((i==43) || (i==23) || (i==11) || (i==35) )
151
{
152
drawCircle
(image,
x
[i],
y
[i],
m_Radius
/2);
153
}
154
else
155
drawCircle
(image,
x
[i],
y
[i],
m_Radius
);
156
}
157
}
158
};
159
160
#endif
TouchSensor.h
M_PI
#define M_PI
Definition:
XSensMTx.cpp:24
DEG2RAD
constexpr double DEG2RAD
Definition:
bvhnodeinertial.h:26
PalmL
Definition:
PalmLeft.h:16
PalmL::draw
void draw(unsigned char *image)
Definition:
PalmLeft.h:141
PalmL::PalmL
PalmL(double cx, double cy, double th, double gain=1.0, int layoutNum=0, int lrMirror=0)
Definition:
PalmLeft.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::m_Radius
double m_Radius
Definition:
TouchSensor.h:390
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::dXmin
static double dXmin
Definition:
TouchSensor.h:383
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::dYmax
static double dYmax
Definition:
TouchSensor.h:383
TouchSensor::dXv
double dXv[8]
Definition:
TouchSensor.h:384
TouchSensor::dY
double dY[MAX_TAXELS]
Definition:
TouchSensor.h:382
TouchSensor::dXmax
static double dXmax
Definition:
TouchSensor.h:383
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::drawCircle
void drawCircle(unsigned char *image, int cx, int cy, double radius)
Definition:
TouchSensor.h:353
TouchSensor::dYmin
static double dYmin
Definition:
TouchSensor.h:383
TouchSensor::ilrMirror
int ilrMirror
Definition:
TouchSensor.h:388
H
H
Definition:
compute_ekf_fast.m:27
Generated on Wed Nov 13 2024 21:11:42 for iCub-main by
1.9.1