43 std::ifstream sFileStream(sConfigFileName.c_str(), std::ifstream::in);
44 if (!sFileStream.good())
46 ARMARX_WARNING_S <<
"CHandModelV2 constructor: file " << sConfigFileName <<
" could not be opened";
53 std::vector<std::vector<float> > aJointOffsets;
54 aJointOffsets.resize(5);
58 sscanf(sLine.c_str(),
"%f %f %f", &vTemp.x, &vTemp.y, &vTemp.z);
63 sscanf(sLine.c_str(),
"%f", &fTemp);
64 aJointOffsets.at(0).push_back(fTemp);
68 sscanf(sLine.c_str(),
"%f", &fTemp);
69 aJointOffsets.at(0).push_back(fTemp);
73 sscanf(sLine.c_str(),
"%f", &fTemp);
74 aJointOffsets.at(0).push_back(fTemp);
78 sscanf(sLine.c_str(),
"%f", &fTemp);
79 aJointOffsets.at(0).push_back(fTemp);
85 sscanf(sLine.c_str(),
"%f %f %f", &vTemp.x, &vTemp.y, &vTemp.z);
90 sscanf(sLine.c_str(),
"%f", &fTemp);
91 aJointOffsets.at(1).push_back(fTemp);
95 sscanf(sLine.c_str(),
"%f", &fTemp);
96 aJointOffsets.at(1).push_back(fTemp);
100 sscanf(sLine.c_str(),
"%f", &fTemp);
101 aJointOffsets.at(1).push_back(fTemp);
106 sscanf(sLine.c_str(),
"%f %f %f", &vTemp.x, &vTemp.y, &vTemp.z);
111 sscanf(sLine.c_str(),
"%f", &fTemp);
112 aJointOffsets.at(2).push_back(fTemp);
116 sscanf(sLine.c_str(),
"%f", &fTemp);
117 aJointOffsets.at(2).push_back(fTemp);
121 sscanf(sLine.c_str(),
"%f", &fTemp);
122 aJointOffsets.at(2).push_back(fTemp);
127 sscanf(sLine.c_str(),
"%f %f %f", &vTemp.x, &vTemp.y, &vTemp.z);
132 sscanf(sLine.c_str(),
"%f", &fTemp);
133 aJointOffsets.at(3).push_back(fTemp);
137 sscanf(sLine.c_str(),
"%f", &fTemp);
138 aJointOffsets.at(3).push_back(fTemp);
142 sscanf(sLine.c_str(),
"%f", &fTemp);
143 aJointOffsets.at(3).push_back(fTemp);
148 sscanf(sLine.c_str(),
"%f %f %f", &vTemp.x, &vTemp.y, &vTemp.z);
153 sscanf(sLine.c_str(),
"%f", &fTemp);
154 aJointOffsets.at(4).push_back(fTemp);
158 sscanf(sLine.c_str(),
"%f", &fTemp);
159 aJointOffsets.at(4).push_back(fTemp);
163 sscanf(sLine.c_str(),
"%f", &fTemp);
164 aJointOffsets.at(4).push_back(fTemp);
169 int nNumFingertipPoints;
171 sscanf(sLine.c_str(),
"%d", &nNumFingertipPoints);
174 float fFingerTipOffsetZ;
176 sscanf(sLine.c_str(),
"%f", &fFingerTipOffsetZ);
179 std::vector<Vec3d> aFingertipPoints;
181 for (
int i = 0; i < nNumFingertipPoints; i++)
183 sscanf(sLine.c_str(),
"%f %f %f", &vTemp.x, &vTemp.y, &vTemp.z);
184 vTemp.z += fFingerTipOffsetZ;
185 aFingertipPoints.push_back(vTemp);
186 std::getline(sFileStream, sLine);
203 std::vector<Vec3d> aFingertipPointsThumb;
204 aFingertipPointsThumb.resize(nNumFingertipPoints);
205 for (
int i = 0; i < nNumFingertipPoints; i++)
207 Math3d::SetVec(aFingertipPointsThumb.at(i), aFingertipPoints.at(i).x, aFingertipPoints.at(i).y, aFingertipPoints.at(i).z);
209 CFinger* pNewFinger =
new CFinger(aJointOffsets.at(0), aFingertipPointsThumb);
213 for (
int i = 1; i <= 4; i++)
215 pNewFinger =
new CFinger(aJointOffsets.at(i), aFingertipPoints);
226 for (
int i = 0; i < 5; i++)
236 for (
int i = 0; i < 5; i++)
257 Vec3d vHandPosition = {(
float)pConfig[0], (
float)pConfig[1], (
float) pConfig[2]};
258 Mat3d mHandOrientation;
259 Math3d::SetRotationMat(mHandOrientation, pConfig[3], pConfig[4], pConfig[5]);
261 float fPalmJointAngle = pConfig[6];
263 std::vector<std::vector<float> > aFingerJointAngles;
264 aFingerJointAngles.resize(5);
265 aFingerJointAngles.at(0).push_back(pConfig[7]);
266 aFingerJointAngles.at(0).push_back(pConfig[8]);
267 aFingerJointAngles.at(0).push_back(pConfig[8]);
268 aFingerJointAngles.at(0).push_back(pConfig[8]);
269 aFingerJointAngles.at(1).push_back(-pConfig[9]);
270 aFingerJointAngles.at(1).push_back(-pConfig[9]);
271 aFingerJointAngles.at(1).push_back(-pConfig[9]);
272 aFingerJointAngles.at(2).push_back(-pConfig[10]);
273 aFingerJointAngles.at(2).push_back(-pConfig[10]);
274 aFingerJointAngles.at(2).push_back(-pConfig[10]);
275 aFingerJointAngles.at(3).push_back(-pConfig[11]);
276 aFingerJointAngles.at(3).push_back(-pConfig[11]);
277 aFingerJointAngles.at(3).push_back(-pConfig[11]);
278 aFingerJointAngles.at(4).push_back(-pConfig[11]);
279 aFingerJointAngles.at(4).push_back(-pConfig[11]);
280 aFingerJointAngles.at(4).push_back(-pConfig[11]);