iCub-main
Loading...
Searching...
No Matches
Quad16.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 Randazzo marco.randazzo@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_QUAD16_H__
13#define __ALE_QUAD16_H__
14
15class Quad16 : public TouchSensor
16{
17public:
18 Quad16(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=16;
33 m_RadiusOrig=2.0;
34
35 dX[0]=0.2; dY[0]=0.2;
36 dX[1]=0.4; dY[1]=0.2;
37 dX[2]=0.6; dY[2]=0.2;
38 dX[3]=0.8; dY[3]=0.2;
39
40 dX[4]=0.2; dY[4]=0.4;
41 dX[5]=0.4; dY[5]=0.4;
42 dX[6]=0.6; dY[6]=0.4;
43 dX[7]=0.8; dY[7]=0.4;
44
45 dX[8]=0.2; dY[8]=0.6;
46 dX[9]=0.4; dY[9]=0.6;
47 dX[10]=0.6; dY[10]=0.6;
48 dX[11]=0.8; dY[11]=0.6;
49
50 dX[12]=0.2; dY[12]=0.8;
51 dX[13]=0.4; dY[13]=0.8;
52 dX[14]=0.6; dY[14]=0.8;
53 dX[15]=0.8; dY[15]=0.8;
54
55 for (int i=0; i<nTaxels; ++i)
56 {
57 double x=40.0*dX[i]-20.0;
58 double y=40.0*dY[i]-20.0;
59
60 if (lrMirror==1) x=-x;
61 dX[i]=cx+CST*x-SNT*y;
62 dY[i]=cy+SNT*x+CST*y;
63 }
64
65 dXv[0]=-15;
66 dYv[0]=-15;
67 dXv[1]=+15;
68 dYv[1]=-15;
69 dXv[2]=+15;
70 dYv[2]=+15;
71 dXv[3]=-15;
72 dYv[3]=+15;
73
74 for (int i=0; i<nVerts; ++i)
75 {
76 double x=dXv[i];
77 double y=dYv[i];
78 if (lrMirror==1) x=-x;
79 dXv[i]=cx+CST*x-SNT*y;
80 dYv[i]=cy+SNT*x+CST*y;
81 }
82
83 // in static definition
84 //dXmin=dYmin= HUGE;
85 //dXmax=dYmax=-HUGE;
86
87 for (int i=0; i<nVerts; ++i)
88 {
89 if (dXv[i]<dXmin) dXmin=dXv[i];
90 if (dXv[i]>dXmax) dXmax=dXv[i];
91 if (dYv[i]<dYmin) dYmin=dYv[i];
92 if (dYv[i]>dYmax) dYmax=dYv[i];
93 }
94
95 dXc=cx;
96 dYc=cy;
97 }
98};
99
100#endif
#define M_PI
Definition XSensMTx.cpp:24
Quad16(double cx, double cy, double th, double gain=1.0, int layoutNum=0, int lrMirror=0)
Definition Quad16.h:18
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