11 #include <yarp/os/ConnectionReader.h>
12 #include <yarp/os/ConnectionWriter.h>
13 #include <yarp/math/Math.h>
17 using namespace yarp::math;
18 using namespace yarp::sig;
19 using namespace yarp::os;
29 const yarp::sig::Vector &_geoCenter,
unsigned int _activeTaxels,
double _pressure)
31 geoCenter(_geoCenter), activeTaxels(_activeTaxels), taxelList(vector<unsigned int>(activeTaxels, 0)), pressure(_pressure), normalDir(
zeros(3)){}
34 const yarp::sig::Vector &_geoCenter,
unsigned int _activeTaxels,
double _pressure,
const Vector &_normalDir)
36 geoCenter(_geoCenter), activeTaxels(_activeTaxels), taxelList(vector<unsigned int>(activeTaxels, 0)), pressure(_pressure), normalDir(_normalDir){}
39 const yarp::sig::Vector &_geoCenter, vector<unsigned int> _taxelList,
double _pressure)
41 geoCenter(_geoCenter), taxelList(_taxelList), activeTaxels(_taxelList.size()), pressure(_pressure), normalDir(
zeros(3)){}
44 const yarp::sig::Vector &_geoCenter, vector<unsigned int> _taxelList,
double _pressure,
const Vector &_normalDir)
46 geoCenter(_geoCenter), taxelList(_taxelList), activeTaxels(_taxelList.size()), pressure(_pressure), normalDir(_normalDir){}
49 const yarp::sig::Vector &_geoCenter, std::vector<unsigned int> _taxelList,
double _pressure,
const yarp::sig::Vector &_normalDir,
50 const yarp::sig::Vector &_F,
const yarp::sig::Vector &_Mu)
52 geoCenter(_geoCenter), taxelList(_taxelList), activeTaxels(_taxelList.size()), pressure(_pressure), normalDir(_normalDir){
111 connection.appendInt32(BOTTLE_TAG_LIST);
112 connection.appendInt32(8);
114 connection.appendInt32(BOTTLE_TAG_LIST + BOTTLE_TAG_INT32);
115 connection.appendInt32(4);
121 connection.appendInt32(BOTTLE_TAG_LIST + BOTTLE_TAG_FLOAT64);
122 connection.appendInt32(3);
123 for(
int i=0;i<3;i++) connection.appendFloat64(
CoP[i]);
125 connection.appendInt32(BOTTLE_TAG_LIST + BOTTLE_TAG_FLOAT64);
126 connection.appendInt32(3);
127 for(
int i=0;i<3;i++) connection.appendFloat64(
F[i]);
129 connection.appendInt32(BOTTLE_TAG_LIST + BOTTLE_TAG_FLOAT64);
130 connection.appendInt32(3);
131 for(
int i=0;i<3;i++) connection.appendFloat64(
Mu[i]);
133 connection.appendInt32(BOTTLE_TAG_LIST + BOTTLE_TAG_FLOAT64);
134 connection.appendInt32(3);
135 for(
int i=0;i<3;i++) connection.appendFloat64(
geoCenter[i]);
137 connection.appendInt32(BOTTLE_TAG_LIST + BOTTLE_TAG_FLOAT64);
138 connection.appendInt32(3);
139 for(
int i=0;i<3;i++) connection.appendFloat64(
normalDir[i]);
141 connection.appendInt32(BOTTLE_TAG_LIST + BOTTLE_TAG_INT32);
145 connection.appendInt32(BOTTLE_TAG_FLOAT64);
150 connection.convertTextMode();
152 return !connection.isError();
157 connection.convertTextMode();
168 if(connection.expectInt32() != BOTTLE_TAG_LIST || connection.expectInt32() != 8)
172 if(connection.expectInt32()!=BOTTLE_TAG_LIST+BOTTLE_TAG_INT32 || connection.expectInt32()!=4)
180 if(connection.expectInt32()!=BOTTLE_TAG_LIST+BOTTLE_TAG_FLOAT64 || connection.expectInt32()!=3)
182 for(
int i=0;i<3;i++)
CoP[i] = connection.expectFloat64();
185 if(connection.expectInt32()!=BOTTLE_TAG_LIST+BOTTLE_TAG_FLOAT64 || connection.expectInt32()!=3)
187 for(
int i=0;i<3;i++)
F[i] = connection.expectFloat64();
191 if(connection.expectInt32()!=BOTTLE_TAG_LIST+BOTTLE_TAG_FLOAT64 || connection.expectInt32()!=3)
193 for(
int i=0;i<3;i++)
Mu[i] = connection.expectFloat64();
196 if(connection.expectInt32()!=BOTTLE_TAG_LIST+BOTTLE_TAG_FLOAT64 || connection.expectInt32()!=3)
198 for(
int i=0;i<3;i++)
geoCenter[i] = connection.expectFloat64();
201 if(connection.expectInt32()!=BOTTLE_TAG_LIST+BOTTLE_TAG_FLOAT64 || connection.expectInt32()!=3)
203 for(
int i=0;i<3;i++)
normalDir[i] = connection.expectFloat64();
206 if(connection.expectInt32()!=BOTTLE_TAG_LIST+BOTTLE_TAG_INT32)
213 if(connection.expectInt32()!=BOTTLE_TAG_FLOAT64)
215 pressure = connection.expectFloat64();
217 return !connection.isError();
222 unsigned int index = 0;
227 v.setSubvector(index,
CoP); index+=3;
228 v.setSubvector(index,
F); index+=3;
229 v.setSubvector(index,
Mu); index+=3;
230 v.setSubvector(index,
geoCenter); index+=3;
231 v.setSubvector(index,
normalDir); index+=3;
243 unsigned int index = 0;
248 CoP = v.subVector(index, index+2); index+=3;
249 F = v.subVector(index, index+2); index+=3;
250 Mu = v.subVector(index, index+2); index+=3;
251 geoCenter = v.subVector(index, index+2); index+=3;
252 normalDir = v.subVector(index, index+2); index+=3;
258 taxelList[i] = (
unsigned int)(v[index++]);
267 geoCenter.toString(precision)<<
", normal direction: "<<
normalDir.toString(precision)<<
Class that encloses everything relate to a skinPart.
const std::string SkinPart_s[]