iCub-main
Loading...
Searching...
No Matches
Fingertip4Right.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_FINGERTIP4_R_H__
13#define __ALE_FINGERTIP4_R_H__
14
16{
17public:
18 Fingertip4R(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 dY[4]=-25.0; dX[4]= -20.0;
27 dY[5]=-25.0; dX[5]= 0.0;
28 dY[6]=-25.0; dX[6]= 20.0;
29 dY[8]=-39.0; dX[8]= 35.0;
30 dY[7]=-39.0; dX[7]= -35.0;
31 dY[9]=-53.0; dX[9]= 20.0;
32 dY[10]=-53.0; dX[10]= 0.0;
33 dY[11]=-53.0; dX[11]= -20.0;
34 dY[3]= -2.0; dX[3]= -22.0;
35 dY[2]= 10.0; dX[2]= -5.0;
36 dY[1]= 28.0; dX[1]= 4.0;
37 dY[0]= 30.0; dX[0]= -32.0;
38
39 lrMirror=0; //forcing mirror
40
41 dXv[0]=53.0; dYv[0]= 0.0;
42 dXv[1]=53.0; dYv[1]=45.0;
43 dXv[2]=dX[3]+10.0; dYv[2]=dY[3]+10.0;
44 dXv[3]=0.0; dYv[3]=dY[5]+12.0;
45 dXv[4]=-dXv[2]; dYv[4]=dYv[2];
46 dXv[5]=-dXv[1]; dYv[5]=dYv[1];
47 dXv[6]=-dXv[0]; dYv[6]=dYv[0];
48
49 const double scale=2.7/15.3;
50 for (int i=0; i<nTaxels; ++i)
51 {
52 dX[i]*=scale;
53 dY[i]*=scale;
54 }
55 for (int i=0; i<nVerts; ++i)
56 {
57 dXv[i]*=scale;
58 dYv[i]*=scale;
59 }
60
61 m_RadiusOrig=1.5;
62
63 const double DEG2RAD=M_PI/180.0;
64 const double CST=cos(DEG2RAD*th);
65 const double SNT=sin(DEG2RAD*th);
66
67 for (int i=0; i<nTaxels; ++i)
68 {
69 double x=dX[i];
70 double y=dY[i];
71 if (lrMirror==1) x=-x;
72
73 dX[i]=cx+CST*x-SNT*y;
74 dY[i]=cy+SNT*x+CST*y;
75 }
76
77 for (int i=0; i<nVerts; ++i)
78 {
79 double x=dXv[i];
80 double y=dYv[i];
81 if (lrMirror==1) x=-x;
82
83 dXv[i]=0;
84 dYv[i]=0;
85 }
86
87 // in static definition
88 //dXmin=dYmin= HUGE;
89 //dXmax=dYmax=-HUGE;
90
91 for (int i=0; i<nVerts; ++i)
92 {
93 if (dXv[i]<dXmin) dXmin=dXv[i];
94 if (dXv[i]>dXmax) dXmax=dXv[i];
95 if (dYv[i]<dYmin) dYmin=dYv[i];
96 if (dYv[i]>dYmax) dYmax=dYv[i];
97 }
98
99 dXc=cx;
100 dYc=cy;
101 }
102};
103
104#endif
#define M_PI
Definition XSensMTx.cpp:24
Fingertip4R(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