iCub-main
Loading...
Searching...
No Matches
Fingertip2Left.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_FINGERTIP2_L_H__
13#define __ALE_FINGERTIP2_L_H__
14
16{
17public:
18 Fingertip2L(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 dXv[0]=53.0; dYv[0]= 0.0;
40 dXv[1]=53.0; dYv[1]=45.0;
41 dXv[2]=dX[4]+10.0; dYv[2]=dY[4]+10.0;
42 dXv[3]=0.0; dYv[3]=dY[6]+12.0;
43 dXv[4]=-dXv[2]; dYv[4]=dYv[2];
44 dXv[5]=-dXv[1]; dYv[5]=dYv[1];
45 dXv[6]=-dXv[0]; dYv[6]=dYv[0];
46
47 const double scale=2.7/15.3;
48 for (int i=0; i<nTaxels; ++i)
49 {
50 dX[i]*=scale;
51 dY[i]*=scale;
52 }
53 for (int i=0; i<nVerts; ++i)
54 {
55 dXv[i]*=scale;
56 dYv[i]*=scale;
57 }
58
59 m_RadiusOrig=1.8;
60
61 const double DEG2RAD=M_PI/180.0;
62 const double CST=cos(DEG2RAD*th);
63 const double SNT=sin(DEG2RAD*th);
64
65 for (int i=0; i<nTaxels; ++i)
66 {
67 double x=dX[i];
68 double y=dY[i];
69 if (lrMirror==1) x=-x;
70
71 dX[i]=cx+CST*x-SNT*y;
72 dY[i]=cy+SNT*x+CST*y;
73 }
74
75 for (int i=0; i<nVerts; ++i)
76 {
77 double x=dXv[i];
78 double y=dYv[i];
79 if (lrMirror==1) x=-x;
80
81 dXv[i]=cx+CST*x-SNT*y;
82 dYv[i]=cy+SNT*x+CST*y;
83 }
84
85 // in static definition
86 //dXmin=dYmin= HUGE;
87 //dXmax=dYmax=-HUGE;
88
89 for (int i=0; i<nVerts; ++i)
90 {
91 if (dXv[i]<dXmin) dXmin=dXv[i];
92 if (dXv[i]>dXmax) dXmax=dXv[i];
93 if (dYv[i]<dYmin) dYmin=dYv[i];
94 if (dYv[i]>dYmax) dYmax=dYv[i];
95 }
96
97 dXc=cx;
98 dYc=cy;
99 }
100};
101
102#endif
#define M_PI
Definition XSensMTx.cpp:24
Fingertip2L(double cx, double cy, double th, double gain=1.0, int layoutNum=0, int lrMirror=0)
double dX[MAX_TAXELS]
int x[MAX_TAXELS]
double m_RadiusOrig
static double dXmin
static double dYmax
double dXv[8]
double dY[MAX_TAXELS]
static double dXmax
double dYv[8]
int y[MAX_TAXELS]
static double dYmin
#define DEG2RAD