MCPcopy Create free account
hub / github.com/bulletphysics/bullet3 / computeIK2

Method computeIK2

examples/SharedMemory/IKTrajectoryHelper.cpp:190–296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188
189
190bool IKTrajectoryHelper::computeIK2(
191 const double* endEffectorTargetPositions,
192 const double* endEffectorCurrentPositions,
193 int numEndEffectors,
194 const double* q_current, int numQ,
195 double* q_new, int ikMethod, const double* linear_jacobians, const double dampIk[6])
196{
197 MatrixRmn AugMat;
198 bool useAngularPart = false;//for now (ikMethod == IK2_VEL_DLS_WITH_ORIENTATION || ikMethod == IK2_VEL_DLS_WITH_ORIENTATION_NULLSPACE || ikMethod == IK2_VEL_SDLS_WITH_ORIENTATION) ? true : false;
199
200 Jacobian ikJacobian(useAngularPart, numQ, numEndEffectors);
201
202 ikJacobian.Reset();
203
204 bool UseJacobianTargets1 = false;
205
206 if (UseJacobianTargets1)
207 {
208 ikJacobian.SetJtargetActive();
209 }
210 else
211 {
212 ikJacobian.SetJendActive();
213 }
214
215 VectorRn deltaC(numEndEffectors *3);
216 MatrixRmn completeJacobian(numEndEffectors*3, numQ);
217
218 for (int ne = 0; ne < numEndEffectors; ne++)
219 {
220 VectorR3 targets;
221 targets.Set(endEffectorTargetPositions[ne*3+0], endEffectorTargetPositions[ne * 3 + 1], endEffectorTargetPositions[ne * 3 + 2]);
222
223 // Set one end effector world position from Bullet
224 VectorRn deltaS(3);
225 for (int i = 0; i < 3; ++i)
226 {
227 deltaS.Set(i, dampIk[i] * (endEffectorTargetPositions[ne*3+i] - endEffectorCurrentPositions[ne*3+i]));
228 }
229 {
230
231 for (int i = 0; i < 3; ++i)
232 {
233 deltaC.Set(ne*3+i, deltaS[i]);
234 for (int j = 0; j < numQ; ++j)
235 {
236 completeJacobian.Set(ne * 3 + i, j, linear_jacobians[((ne*3+i) * numQ) + j]);
237 }
238 }
239 }
240 }
241 ikJacobian.SetDeltaS(deltaC);
242 ikJacobian.SetJendTrans(completeJacobian);
243
244 // Calculate the change in theta values
245 switch (ikMethod)
246 {
247 case IK2_JACOB_TRANS:

Calls 14

SetJtargetActiveMethod · 0.80
SetJendActiveMethod · 0.80
SetDeltaSMethod · 0.80
SetJendTransMethod · 0.80
GetLengthMethod · 0.80
CalcDeltaThetasDLS2Method · 0.80
CalcDeltaThetasSDLSMethod · 0.80
ZeroDeltaThetasMethod · 0.80

Tested by

no test coverage detected