forked from tasbolat1/franka_analytical_ik
-
Notifications
You must be signed in to change notification settings - Fork 0
/
panda_ik_hand.cpp
536 lines (447 loc) · 18.1 KB
/
panda_ik_hand.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
// Analytical Franka inverse kinematics using q7 as redundant parameter
// - Yanhao He, February 2020
// c++ -O3 -Wall -shared -std=c++11 -fPIC $(python3 -m pybind11 --includes) franka_ik_pybind.cpp -o franka_ik_pybind$(python3-config --extension-suffix)
// https://www.linyuanshi.me/post/pybind11-array/
#ifndef FRANKA_IK_HE_HPP
#define FRANKA_IK_HE_HPP
#include <array>
#include <cmath>
#include "Eigen/Dense"
#include <pybind11/pybind11.h>
#include <pybind11/eigen.h>
#include <pybind11/stl.h>
#include <pybind11/functional.h>
#include <pybind11/stl_bind.h>
namespace py = pybind11;
// inverse kinematics w.r.t. End Effector Frame (using Franka Hand data)
std::array< std::array<double, 7>, 4 > franka_IK_EE ( Eigen::Matrix3d R_EE,
Eigen::Vector3d z_EE,
Eigen::Vector3d p_EE,
double q7,
std::array<double, 7> q_actual_array )
{
const std::array< std::array<double, 7>, 4 > q_all_NAN = {{ {{NAN, NAN, NAN, NAN, NAN, NAN, NAN}},
{{NAN, NAN, NAN, NAN, NAN, NAN, NAN}},
{{NAN, NAN, NAN, NAN, NAN, NAN, NAN}},
{{NAN, NAN, NAN, NAN, NAN, NAN, NAN}} }};
const std::array<double, 7> q_NAN = {{NAN, NAN, NAN, NAN, NAN, NAN, NAN}};
std::array< std::array<double, 7>, 4 > q_all = q_all_NAN;
const double d1 = 0.3330;
const double d3 = 0.3160;
const double d5 = 0.3840;
const double d7e = 0.2104;
const double a4 = 0.0825;
const double a7 = 0.0880;
const double LL24 = 0.10666225; // a4^2 + d3^2
const double LL46 = 0.15426225; // a4^2 + d5^2
const double L24 = 0.326591870689; // sqrt(LL24)
const double L46 = 0.392762332715; // sqrt(LL46)
const double thetaH46 = 1.35916951803; // atan(d5/a4);
const double theta342 = 1.31542071191; // atan(d3/a4);
const double theta46H = 0.211626808766; // acot(d5/a4);
const std::array<double, 7> q_min = {{-2.8973, -1.7628, -2.8973, -3.0718, -2.8973, -0.0175, -2.8973}};
const std::array<double, 7> q_max = {{2.8973, 1.7628, 2.8973, -0.0698, 2.8973, 3.7525, 2.8973}};
if (q7 <= q_min[6] || q7 >= q_max[6])
return q_all_NAN;
else
for (int i = 0; i < 4; i++)
q_all[i][6] = q7;
// compute p_6
Eigen::Vector3d p_7 = p_EE - d7e*z_EE;
Eigen::Vector3d x_EE_6;
x_EE_6 << std::cos(q7 - M_PI_4), -std::sin(q7 - M_PI_4), 0.0;
Eigen::Vector3d x_6 = R_EE*x_EE_6;
x_6 /= x_6.norm(); // visibly increases accuracy
Eigen::Vector3d p_6 = p_7 - a7*x_6;
// compute q4
Eigen::Vector3d p_2;
p_2 << 0.0, 0.0, d1;
Eigen::Vector3d V26 = p_6 - p_2;
double LL26 = V26[0]*V26[0] + V26[1]*V26[1] + V26[2]*V26[2];
double L26 = std::sqrt(LL26);
if (L24 + L46 < L26 || L24 + L26 < L46 || L26 + L46 < L24)
return q_all_NAN;
double theta246 = std::acos((LL24 + LL46 - LL26)/2.0/L24/L46);
double q4 = theta246 + thetaH46 + theta342 - 2.0*M_PI;
if (q4 <= q_min[3] || q4 >= q_max[3])
return q_all_NAN;
else
for (int i = 0; i < 4; i++)
q_all[i][3] = q4;
// compute q6
double theta462 = std::acos((LL26 + LL46 - LL24)/2.0/L26/L46);
double theta26H = theta46H + theta462;
double D26 = -L26*std::cos(theta26H);
Eigen::Vector3d Z_6 = z_EE.cross(x_6);
Eigen::Vector3d Y_6 = Z_6.cross(x_6);
Eigen::Matrix3d R_6;
R_6.col(0) = x_6;
R_6.col(1) = Y_6/Y_6.norm();
R_6.col(2) = Z_6/Z_6.norm();
Eigen::Vector3d V_6_62 = R_6.transpose()*(-V26);
double Phi6 = std::atan2(V_6_62[1], V_6_62[0]);
double Theta6 = std::asin(D26/std::sqrt(V_6_62[0]*V_6_62[0] + V_6_62[1]*V_6_62[1]));
std::array<double, 2> q6;
q6[0] = M_PI - Theta6 - Phi6;
q6[1] = Theta6 - Phi6;
for (int i = 0; i < 2; i++)
{
if (q6[i] <= q_min[5])
q6[i] += 2.0*M_PI;
else if (q6[i] >= q_max[5])
q6[i] -= 2.0*M_PI;
if (q6[i] <= q_min[5] || q6[i] >= q_max[5])
{
q_all[2*i] = q_NAN;
q_all[2*i + 1] = q_NAN;
}
else
{
q_all[2*i][5] = q6[i];
q_all[2*i + 1][5] = q6[i];
}
}
if (std::isnan(q_all[0][5]) && std::isnan(q_all[2][5]))
return q_all_NAN;
// compute q1 & q2
double thetaP26 = 3.0*M_PI_2 - theta462 - theta246 - theta342;
double thetaP = M_PI - thetaP26 - theta26H;
double LP6 = L26*sin(thetaP26)/std::sin(thetaP);
std::array< Eigen::Vector3d, 4 > z_5_all;
std::array< Eigen::Vector3d, 4 > V2P_all;
for (int i = 0; i < 2; i++)
{
Eigen::Vector3d z_6_5;
z_6_5 << std::sin(q6[i]), std::cos(q6[i]), 0.0;
Eigen::Vector3d z_5 = R_6*z_6_5;
Eigen::Vector3d V2P = p_6 - LP6*z_5 - p_2;
z_5_all[2*i] = z_5;
z_5_all[2*i + 1] = z_5;
V2P_all[2*i] = V2P;
V2P_all[2*i + 1] = V2P;
double L2P = V2P.norm();
if (std::fabs(V2P[2]/L2P) > 0.999)
{
q_all[2*i][0] = q_actual_array[0];
q_all[2*i][1] = 0.0;
q_all[2*i + 1][0] = q_actual_array[0];
q_all[2*i + 1][1] = 0.0;
}
else
{
q_all[2*i][0] = std::atan2(V2P[1], V2P[0]);
q_all[2*i][1] = std::acos(V2P[2]/L2P);
if (q_all[2*i][0] < 0)
q_all[2*i + 1][0] = q_all[2*i][0] + M_PI;
else
q_all[2*i + 1][0] = q_all[2*i][0] - M_PI;
q_all[2*i + 1][1] = -q_all[2*i][1];
}
}
for (int i = 0; i < 4; i++)
{
if ( q_all[i][0] <= q_min[0] || q_all[i][0] >= q_max[0]
|| q_all[i][1] <= q_min[1] || q_all[i][1] >= q_max[1] )
{
q_all[i] = q_NAN;
continue;
}
// compute q3
Eigen::Vector3d z_3 = V2P_all[i]/V2P_all[i].norm();
Eigen::Vector3d Y_3 = -V26.cross(V2P_all[i]);
Eigen::Vector3d y_3 = Y_3/Y_3.norm();
Eigen::Vector3d x_3 = y_3.cross(z_3);
Eigen::Matrix3d R_1;
double c1 = std::cos(q_all[i][0]);
double s1 = std::sin(q_all[i][0]);
R_1 << c1, -s1, 0.0,
s1, c1, 0.0,
0.0, 0.0, 1.0;
Eigen::Matrix3d R_1_2;
double c2 = std::cos(q_all[i][1]);
double s2 = std::sin(q_all[i][1]);
R_1_2 << c2, -s2, 0.0,
0.0, 0.0, 1.0,
-s2, -c2, 0.0;
Eigen::Matrix3d R_2 = R_1*R_1_2;
Eigen::Vector3d x_2_3 = R_2.transpose()*x_3;
q_all[i][2] = std::atan2(x_2_3[2], x_2_3[0]);
if (q_all[i][2] <= q_min[2] || q_all[i][2] >= q_max[2])
{
q_all[i] = q_NAN;
continue;
}
// compute q5
Eigen::Vector3d VH4 = p_2 + d3*z_3 + a4*x_3 - p_6 + d5*z_5_all[i];
Eigen::Matrix3d R_5_6;
double c6 = std::cos(q_all[i][5]);
double s6 = std::sin(q_all[i][5]);
R_5_6 << c6, -s6, 0.0,
0.0, 0.0, -1.0,
s6, c6, 0.0;
Eigen::Matrix3d R_5 = R_6*R_5_6.transpose();
Eigen::Vector3d V_5_H4 = R_5.transpose()*VH4;
q_all[i][4] = -std::atan2(V_5_H4[1], V_5_H4[0]);
if (q_all[i][4] <= q_min[4] || q_all[i][4] >= q_max[4])
{
q_all[i] = q_NAN;
continue;
}
}
return q_all;
}
// "Case-Consistent" inverse kinematics w.r.t. End Effector Frame (using Franka Hand data)
std::array<double, 7> franka_IK_EE_CC ( Eigen::Matrix3d R_EE,
Eigen::Vector3d z_EE,
Eigen::Vector3d p_EE,
double q7,
std::array<double, 7> q_actual_array )
{
const std::array<double, 7> q_NAN = {{NAN, NAN, NAN, NAN, NAN, NAN, NAN}};
std::array<double, 7> q;
// Eigen::Map< Eigen::Matrix<double, 4, 4> > O_T_EE(O_T_EE_array.data());
// constants
const double d1 = 0.3330;
const double d3 = 0.3160;
const double d5 = 0.3840;
const double d7e = 0.2104;
const double a4 = 0.0825;
const double a7 = 0.0880;
const double LL24 = 0.10666225; // a4^2 + d3^2
const double LL46 = 0.15426225; // a4^2 + d5^2
const double L24 = 0.326591870689; // sqrt(LL24)
const double L46 = 0.392762332715; // sqrt(LL46)
const double thetaH46 = 1.35916951803; // atan(d5/a4);
const double theta342 = 1.31542071191; // atan(d3/a4);
const double theta46H = 0.211626808766; // acot(d5/a4);
const std::array<double, 7> q_min = {{-2.8973, -1.7628, -2.8973, -3.0718, -2.8973, -0.0175, -2.8973}};
const std::array<double, 7> q_max = {{ 2.8973, 1.7628, 2.8973, -0.0698, 2.8973, 3.7525, 2.8973}};
// return NAN if input q7 is out of range
if (q7 <= q_min[6] || q7 >= q_max[6])
return q_NAN;
else
q[6] = q7;
// FK for getting current case id
double c1_a = std::cos(q_actual_array[0]); double s1_a = std::sin(q_actual_array[0]);
double c2_a = std::cos(q_actual_array[1]); double s2_a = std::sin(q_actual_array[1]);
double c3_a = std::cos(q_actual_array[2]); double s3_a = std::sin(q_actual_array[2]);
double c4_a = std::cos(q_actual_array[3]); double s4_a = std::sin(q_actual_array[3]);
double c5_a = std::cos(q_actual_array[4]); double s5_a = std::sin(q_actual_array[4]);
double c6_a = std::cos(q_actual_array[5]); double s6_a = std::sin(q_actual_array[5]);
std::array< Eigen::Matrix<double, 4, 4>, 7> As_a;
As_a[0] << c1_a, -s1_a, 0.0, 0.0, // O1
s1_a, c1_a, 0.0, 0.0,
0.0, 0.0, 1.0, d1,
0.0, 0.0, 0.0, 1.0;
As_a[1] << c2_a, -s2_a, 0.0, 0.0, // O2
0.0, 0.0, 1.0, 0.0,
-s2_a, -c2_a, 0.0, 0.0,
0.0, 0.0, 0.0, 1.0;
As_a[2] << c3_a, -s3_a, 0.0, 0.0, // O3
0.0, 0.0, -1.0, -d3,
s3_a, c3_a, 0.0, 0.0,
0.0, 0.0, 0.0, 1.0;
As_a[3] << c4_a, -s4_a, 0.0, a4, // O4
0.0, 0.0, -1.0, 0.0,
s4_a, c4_a, 0.0, 0.0,
0.0, 0.0, 0.0, 1.0;
As_a[4] << 1.0, 0.0, 0.0, -a4, // H
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0;
As_a[5] << c5_a, -s5_a, 0.0, 0.0, // O5
0.0, 0.0, 1.0, d5,
-s5_a, -c5_a, 0.0, 0.0,
0.0, 0.0, 0.0, 1.0;
As_a[6] << c6_a, -s6_a, 0.0, 0.0, // O6
0.0, 0.0, -1.0, 0.0,
s6_a, c6_a, 0.0, 0.0,
0.0, 0.0, 0.0, 1.0;
std::array< Eigen::Matrix<double, 4, 4>, 7> Ts_a;
Ts_a[0] = As_a[0];
for (unsigned int j = 1; j < 7; j++)
Ts_a[j] = Ts_a[j - 1]*As_a[j];
// identify q6 case
Eigen::Vector3d V62_a = Ts_a[1].block<3, 1>(0, 3) - Ts_a[6].block<3, 1>(0, 3);
Eigen::Vector3d V6H_a = Ts_a[4].block<3, 1>(0, 3) - Ts_a[6].block<3, 1>(0, 3);
Eigen::Vector3d Z6_a = Ts_a[6].block<3, 1>(0, 2);
bool is_case6_0 = ((V6H_a.cross(V62_a)).transpose()*Z6_a <= 0);
// identify q1 case
bool is_case1_1 = (q_actual_array[1] < 0);
// IK: compute p_6
// Eigen::Matrix3d R_EE = O_T_EE.topLeftCorner<3, 3>();
// Eigen::Vector3d z_EE = O_T_EE.block<3, 1>(0, 2);
// Eigen::Vector3d p_EE = O_T_EE.block<3, 1>(0, 3);
Eigen::Vector3d p_7 = p_EE - d7e*z_EE;
Eigen::Vector3d x_EE_6;
x_EE_6 << std::cos(q7 - M_PI_4), -std::sin(q7 - M_PI_4), 0.0;
Eigen::Vector3d x_6 = R_EE*x_EE_6;
x_6 /= x_6.norm(); // visibly increases accuracy
Eigen::Vector3d p_6 = p_7 - a7*x_6;
// IK: compute q4
Eigen::Vector3d p_2;
p_2 << 0.0, 0.0, d1;
Eigen::Vector3d V26 = p_6 - p_2;
double LL26 = V26[0]*V26[0] + V26[1]*V26[1] + V26[2]*V26[2];
double L26 = std::sqrt(LL26);
if (L24 + L46 < L26 || L24 + L26 < L46 || L26 + L46 < L24)
return q_NAN;
double theta246 = std::acos((LL24 + LL46 - LL26)/2.0/L24/L46);
q[3] = theta246 + thetaH46 + theta342 - 2.0*M_PI;
if (q[3] <= q_min[3] || q[3] >= q_max[3])
return q_NAN;
// IK: compute q6
double theta462 = std::acos((LL26 + LL46 - LL24)/2.0/L26/L46);
double theta26H = theta46H + theta462;
double D26 = -L26*std::cos(theta26H);
Eigen::Vector3d Z_6 = z_EE.cross(x_6);
Eigen::Vector3d Y_6 = Z_6.cross(x_6);
Eigen::Matrix3d R_6;
R_6.col(0) = x_6;
R_6.col(1) = Y_6/Y_6.norm();
R_6.col(2) = Z_6/Z_6.norm();
Eigen::Vector3d V_6_62 = R_6.transpose()*(-V26);
double Phi6 = std::atan2(V_6_62[1], V_6_62[0]);
double Theta6 = std::asin(D26/std::sqrt(V_6_62[0]*V_6_62[0] + V_6_62[1]*V_6_62[1]));
if (is_case6_0)
q[5] = M_PI - Theta6 - Phi6;
else
q[5] = Theta6 - Phi6;
if (q[5] <= q_min[5])
q[5] += 2.0*M_PI;
else if (q[5] >= q_max[5])
q[5] -= 2.0*M_PI;
if (q[5] <= q_min[5] || q[5] >= q_max[5])
return q_NAN;
// IK: compute q1 & q2
double thetaP26 = 3.0*M_PI_2 - theta462 - theta246 - theta342;
double thetaP = M_PI - thetaP26 - theta26H;
double LP6 = L26*sin(thetaP26)/std::sin(thetaP);
Eigen::Vector3d z_6_5;
z_6_5 << std::sin(q[5]), std::cos(q[5]), 0.0;
Eigen::Vector3d z_5 = R_6*z_6_5;
Eigen::Vector3d V2P = p_6 - LP6*z_5 - p_2;
double L2P = V2P.norm();
if (std::fabs(V2P[2]/L2P) > 0.999)
{
q[0] = q_actual_array[0];
q[1] = 0.0;
}
else
{
q[0] = std::atan2(V2P[1], V2P[0]);
q[1] = std::acos(V2P[2]/L2P);
if (is_case1_1)
{
if (q[0] < 0.0)
q[0] += M_PI;
else
q[0] -= M_PI;
q[1] = -q[1];
}
}
if ( q[0] <= q_min[0] || q[0] >= q_max[0]
|| q[1] <= q_min[1] || q[1] >= q_max[1] )
return q_NAN;
// IK: compute q3
Eigen::Vector3d z_3 = V2P/V2P.norm();
Eigen::Vector3d Y_3 = -V26.cross(V2P);
Eigen::Vector3d y_3 = Y_3/Y_3.norm();
Eigen::Vector3d x_3 = y_3.cross(z_3);
Eigen::Matrix3d R_1;
double c1 = std::cos(q[0]);
double s1 = std::sin(q[0]);
R_1 << c1, -s1, 0.0,
s1, c1, 0.0,
0.0, 0.0, 1.0;
Eigen::Matrix3d R_1_2;
double c2 = std::cos(q[1]);
double s2 = std::sin(q[1]);
R_1_2 << c2, -s2, 0.0,
0.0, 0.0, 1.0,
-s2, -c2, 0.0;
Eigen::Matrix3d R_2 = R_1*R_1_2;
Eigen::Vector3d x_2_3 = R_2.transpose()*x_3;
q[2] = std::atan2(x_2_3[2], x_2_3[0]);
if (q[2] <= q_min[2] || q[2] >= q_max[2])
return q_NAN;
// IK: compute q5
Eigen::Vector3d VH4 = p_2 + d3*z_3 + a4*x_3 - p_6 + d5*z_5;
Eigen::Matrix3d R_5_6;
double c6 = std::cos(q[5]);
double s6 = std::sin(q[5]);
R_5_6 << c6, -s6, 0.0,
0.0, 0.0, -1.0,
s6, c6, 0.0;
Eigen::Matrix3d R_5 = R_6*R_5_6.transpose();
Eigen::Vector3d V_5_H4 = R_5.transpose()*VH4;
q[4] = -std::atan2(V_5_H4[1], V_5_H4[0]);
if (q[4] <= q_min[4] || q[4] >= q_max[4])
return q_NAN;
return q;
}
// pybind11 wrapper for franka_IK
py::array_t<double> franka_IK(Eigen::Ref<Eigen::MatrixXd> targetHandPosition,
py::array_t<double>& tHO,
double q7,
py::array_t<double>& cP)
{
py::buffer_info buf2 = tHO.request();
py::buffer_info buf3 = cP.request();
auto result = py::array_t<double>(28);
result.resize({4, 7});
py::buffer_info buf4 = result.request();
double* targetHandOrientation = (double*)buf2.ptr;
double* currentPosition = (double*)buf3.ptr;
double* ptr4 = (double*)buf4.ptr;
Eigen::Quaterniond q(targetHandOrientation);
Eigen::Matrix3d targetRotation = q.normalized().toRotationMatrix();
Eigen::Vector3d targetPosition = targetHandPosition;
Eigen::Vector3d offset(0.0, 0.0, 0.1034);
targetPosition = targetRotation * offset + targetPosition;
std::array<double, 7> q_actual_array;
for (int i = 0; i < 7; i++) q_actual_array[i] = currentPosition[i];
std::array< std::array<double, 7>, 4 > ans = franka_IK_EE(targetRotation, targetRotation.block<3, 1>(0, 2), targetPosition, q7, q_actual_array);
for (int i = 0; i < 4; i++)
{
for(int j = 0; j < 7; j++)
{
ptr4[i*7+j] = ans[i][j];
}
}
return result;
}
// pybind11 wrapper for franka_IK_EE_CC
py::array_t<double> franka_IKCC(Eigen::Ref<Eigen::MatrixXd> targetHandPosition,
py::array_t<double>& tHO,
double q7,
py::array_t<double>& cP)
{
py::buffer_info buf2 = tHO.request();
py::buffer_info buf3 = cP.request();
auto result = py::array_t<double>(7);
py::buffer_info buf4 = result.request();
double* targetHandOrientation = (double*)buf2.ptr;
double* currentPosition = (double*)buf3.ptr;
double* ptr4 = (double*)buf4.ptr;
Eigen::Quaterniond q(targetHandOrientation);
Eigen::Matrix3d targetRotation = q.normalized().toRotationMatrix();
Eigen::Vector3d targetPosition = targetHandPosition;
Eigen::Vector3d offset(0.0, 0.0, 0.1034);
targetPosition = targetRotation * offset + targetPosition;
std::array<double, 7> q_actual_array;
for (int i = 0; i < 7; i++) q_actual_array[i] = currentPosition[i];
std::array<double, 7> ans = franka_IK_EE_CC(targetRotation, targetRotation.block<3, 1>(0, 2), targetPosition, q7, q_actual_array);
for (int i = 0; i < 7; i++)
{
ptr4[i] = ans[i];
}
return result;
}
PYBIND11_MODULE(panda_ik_hand, m)
{
m.doc() = "Analytical IK";
m.def("franka_IK", &franka_IK);
m.def("franka_IKCC", &franka_IKCC);
}
#endif // FRANKA_IK_HE_HPP