30 #ifndef _REC_ROBOTINO_API2_COMPACTBHASIMPLE_H_ 31 #define _REC_ROBOTINO_API2_COMPACTBHASIMPLE_H_ 57 Pole(
float x,
float y,
float weight1,
float weight2,
float weight3)
91 float getWeight(
float x,
float y,
int weightIdx)
const 95 float dist = sqrt( dX * dX + dY * dY );
96 return std::max( 0.f, 1 - (_weight[weightIdx-1] * dist) );
106 static const Pole _pole1;
107 static const Pole _pole2;
108 static const Pole _pole3;
109 static const Pole _pole4;
110 static const Pole _pole5;
111 static const Pole _pole6;
121 static void xy2pressure(
float x,
float y,
float* b1,
float* b2,
float* b3 )
127 float dist = sqrt( x * x + y * y );
136 *b1 = _pole3.getWeight(x, y, 3);
137 *b1 += _pole4.getWeight(x, y, 3);
138 *b1 += _pole5.getWeight(x, y, 3);
142 *b2 = _pole5.getWeight(x, y, 1);
143 *b2 += _pole6.getWeight(x, y, 1);
144 *b2 += _pole1.getWeight(x, y, 1);
148 *b3 = _pole1.getWeight(x, y, 2);
149 *b3 += _pole2.getWeight(x, y, 2);
150 *b3 += _pole3.getWeight(x, y, 2);
154 const CompactBHASimple::Pole CompactBHASimple::_pole1 = Pole(0.0f, 1.0f, 1.0f, 1.0f, 0.0f);
155 const CompactBHASimple::Pole CompactBHASimple::_pole2 = Pole((sqrt((
float)3.0) / 2.0f), 0.5f, 0.0f, 1.0f, 0.0f);
156 const CompactBHASimple::Pole CompactBHASimple::_pole3 = Pole((sqrt((
float)3.0) / 2.0f), -0.5f, 0.0f, 1.0f, 1.0f);
157 const CompactBHASimple::Pole CompactBHASimple::_pole4 = Pole(0.0f, -1.0f, 0.0f, 0.0f, 1.0f);
158 const CompactBHASimple::Pole CompactBHASimple::_pole5 = Pole(-(sqrt((
float)3.0f) / 2.0f), -0.5f, 1.0f, 0.0f, 1.0f);
159 const CompactBHASimple::Pole CompactBHASimple::_pole6 = Pole(-(sqrt((
float)3.0f) / 2.0f), 0.5f, 1.0f, 0.0f, 0.0f);
164 #endif //_REC_ROBOTINO_API2_COMPACTBHASIMPLE_H_ Calculation from xy coordinates to pressures.
Definition: CompactBHASimple.h:47
static void xy2pressure(float x, float y, float *b1, float *b2, float *b3)
Definition: CompactBHASimple.h:121
Definition: AnalogInput.h:36