iCub-main
Loading...
Searching...
No Matches
icub-main
src
tools
iCubSkinGui
plugin
include
fakePalm.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_FPALM_H__
13
#define __ALE_FPALM_H__
14
15
class
fakePalm
:
public
TouchSensor
16
{
17
public
:
18
fakePalm
(
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
dGain
=0.0;
// for now to stick the dots to be always OFF
30
ilrMirror
=lrMirror;
31
ilayoutNum
=layoutNum;
32
nVerts
=4;
33
nTaxels
=1;
34
m_RadiusOrig
=0.1;
35
36
for
(
int
i=0; i<
nTaxels
; ++i)
37
{
38
dX
[0]=15;
//not used
39
dY
[0]=15;
//not used
40
dX
[i] = 0.0;
dY
[i] = 0.0;
41
}
42
43
44
45
46
47
for
(
int
i=0; i<
nTaxels
; ++i)
48
{
49
double
x
=1.2*
dX
[i]-0.0;
50
double
y
=1.2*
dY
[i]-0.0;
51
52
if
(lrMirror==1)
x
=-
x
;
53
dX
[i]=cx+CST*
x
-SNT*
y
;
54
dY
[i]=cy+SNT*
x
+CST*
y
;
55
}
56
57
dXv
[0]=-25;
58
dYv
[0]=-50;
59
dXv
[1]=+50;
60
dYv
[1]=-50;
61
dXv
[2]=+50;
62
dYv
[2]=+50;
63
dXv
[3]=-25;
64
dYv
[3]=+50;
65
66
for
(
int
i=0; i<
nVerts
; ++i)
67
{
68
double
x
=
dXv
[i];
69
double
y
=
dYv
[i];
70
if
(lrMirror==1)
x
=-
x
;
71
dXv
[i]=cx+CST*
x
-SNT*
y
;
72
dYv
[i]=cy+SNT*
x
+CST*
y
;
73
}
74
75
// in static definition
76
//dXmin=dYmin= HUGE;
77
//dXmax=dYmax=-HUGE;
78
79
for
(
int
i=0; i<
nVerts
; ++i)
80
{
81
if
(
dXv
[i]<
dXmin
)
dXmin
=
dXv
[i];
82
if
(
dXv
[i]>
dXmax
)
dXmax
=
dXv
[i];
83
if
(
dYv
[i]<
dYmin
)
dYmin
=
dYv
[i];
84
if
(
dYv
[i]>
dYmax
)
dYmax
=
dYv
[i];
85
}
86
87
dXc
=cx;
88
dYc
=cy;
89
}
90
void
draw
(
unsigned
char
*image)
91
{
92
for
(
int
i=0; i<
nVerts
; ++i)
93
{
94
//drawLine(image,xv[i],yv[i],xv[(i+1)%nVerts],yv[(i+1)%nVerts]);
95
}
96
97
for
(
int
i=0; i<
nTaxels
; ++i)
98
{
99
if
((i==43) || (i==23) || (i==11) || (i==35) )
100
{
101
drawCircle
(image,
x
[i],
y
[i],
m_Radius
/2);
102
}
103
else
104
drawCircle
(image,
x
[i],
y
[i],
m_Radius
);
105
}
106
}
107
};
108
109
#endif
TouchSensor.h
M_PI
#define M_PI
Definition
XSensMTx.cpp:24
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
fakePalm
Definition
fakePalm.h:16
fakePalm::fakePalm
fakePalm(double cx, double cy, double th, double gain=1.0, int layoutNum=0, int lrMirror=0)
Definition
fakePalm.h:18
fakePalm::draw
void draw(unsigned char *image)
Definition
fakePalm.h:90
H
H
Definition
compute_ekf_fast.m:27
DEG2RAD
#define DEG2RAD
Definition
pointing_far.cpp:36
Generated on Wed Dec 18 2024 16:34:49 for iCub-main by
1.9.8