1 #define IKFAST_HAS_LIBRARY 26 #define IKFAST_COMPILE_ASSERT(x) extern int __dummy[(int)x] 41 #ifndef __PRETTY_FUNCTION__ 42 #define __PRETTY_FUNCTION__ __FUNCDNAME__ 46 #ifndef __PRETTY_FUNCTION__ 47 #define __PRETTY_FUNCTION__ __func__ 50 #define IKFAST_ASSERT(b) { if( !(b) ) { std::stringstream ss; ss << "ikfast exception: " << __FILE__ << ":" << __LINE__ << ": " <<__PRETTY_FUNCTION__ << ": Assertion '" << #b << "' failed"; throw std::runtime_error(ss.str()); } } 55 #define IKFAST_ALIGNED16(x) __declspec(align(16)) x 57 #define IKFAST_ALIGNED16(x) x __attribute((aligned(16))) 60 #define IK2PI ((IkReal)6.28318530717959) 61 #define IKPI ((IkReal)3.14159265358979) 62 #define IKPI_2 ((IkReal)1.57079632679490) 78 void dgetrf_ (
const int* m,
const int* n,
double* a,
const int* lda,
int* ipiv,
int* info);
79 void zgetrf_ (
const int* m,
const int* n, std::complex<double>* a,
const int* lda,
int* ipiv,
int* info);
80 void dgetri_(
const int* n,
const double* a,
const int* lda,
int* ipiv,
double* work,
const int* lwork,
int* info);
81 void dgesv_ (
const int* n,
const int* nrhs,
double* a,
const int* lda,
int* ipiv,
double* b,
const int* ldb,
int* info);
82 void dgetrs_(
const char *trans,
const int *n,
const int *nrhs,
double *a,
const int *lda,
int *ipiv,
double *b,
const int *ldb,
int *info);
83 void dgeev_(
const char *jobvl,
const char *jobvr,
const int *n,
double *a,
const int *lda,
double *wr,
double *wi,
double *vl,
const int *ldvl,
double *vr,
const int *ldvr,
double *work,
const int *lwork,
int *info);
88 #ifdef IKFAST_NAMESPACE 89 namespace IKFAST_NAMESPACE {
92 inline float IKabs(
float f) {
return fabsf(f); }
93 inline double IKabs(
double f) {
return fabs(f); }
95 inline float IKsqr(
float f) {
return f*f; }
96 inline double IKsqr(
double f) {
return f*f; }
98 inline float IKlog(
float f) {
return logf(f); }
99 inline double IKlog(
double f) {
return log(f); }
102 #ifndef IKFAST_SINCOS_THRESH 103 #define IKFAST_SINCOS_THRESH ((IkReal)1e-7) 107 #ifndef IKFAST_ATAN2_MAGTHRESH 108 #define IKFAST_ATAN2_MAGTHRESH ((IkReal)1e-7) 112 #ifndef IKFAST_SOLUTION_THRESH 113 #define IKFAST_SOLUTION_THRESH ((IkReal)1e-6) 117 #ifndef IKFAST_EVALCOND_THRESH 118 #define IKFAST_EVALCOND_THRESH ((IkReal)0.00001) 125 if( f <= -1 )
return float(-
IKPI_2);
126 else if( f >= 1 )
return float(
IKPI_2);
132 if( f <= -1 )
return -
IKPI_2;
133 else if( f >= 1 )
return IKPI_2;
158 if( f <= -1 )
return float(
IKPI);
159 else if( f >= 1 )
return float(0);
165 if( f <= -1 )
return IKPI;
166 else if( f >= 1 )
return 0;
169 inline float IKsin(
float f) {
return sinf(f); }
171 inline float IKcos(
float f) {
return cosf(f); }
173 inline float IKtan(
float f) {
return tanf(f); }
175 inline float IKsqrt(
float f) {
if( f <= 0.0f )
return 0.0f;
return sqrtf(f); }
176 inline double IKsqrt(
double f) {
if( f <= 0.0 )
return 0.0;
return sqrt(f); }
178 return atan2f(fy,fx);
185 else if( isnan(fx) ) {
188 return atan2f(fy,fx);
198 else if( isnan(fx) ) {
204 template <
typename T>
211 template <
typename T>
217 if( !isnan(fy) && !isnan(fx) ) {
246 template <
typename T>
265 ret.
value = (T)1.0e30;
269 ret.
value = T(1.0)/f;
274 int num = n > 0 ? n : -n;
278 else if( num == 3 ) {
300 IKFAST_API
void ComputeFk(
const IkReal* j, IkReal* eetrans, IkReal* eerot) {
301 for(
int dummyiter = 0; dummyiter < 1; ++dummyiter) {
302 IkReal x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11;
314 x11=(((x0*x8))+((x1*x9)));
315 eetrans[0]=((((-0.36)*x0))+(((-1.0)*x2*x6))+(((-1.0)*x3*x7)));
316 eetrans[1]=(((x2*x7))+(((-1.0)*x3*x6))+(((0.36)*x1)));
317 eetrans[2]=((0.1405)+j[2]);
318 IkReal x12=((1.0)*x10);
339 IkReal j0,cj0,sj0,htj0,j0mul,j1,cj1,sj1,htj1,j1mul,j2,cj2,sj2,htj2,j2mul,j3,cj3,
sj3,htj3,j3mul,new_r00,r00,rxp0_0,new_r01,r01,rxp0_1,new_r02,r02,rxp0_2,new_px,px,npx,new_py,py,npy,new_pz,pz,npz,pp;
340 unsigned char _ij0[2], _nj0,_ij1[2], _nj1,_ij2[2], _nj2,_ij3[2],
_nj3;
345 j0=numeric_limits<IkReal>::quiet_NaN(); _ij0[0] = -1; _ij0[1] = -1; _nj0 = -1; j1=numeric_limits<IkReal>::quiet_NaN(); _ij1[0] = -1; _ij1[1] = -1; _nj1 = -1; j2=numeric_limits<IkReal>::quiet_NaN(); _ij2[0] = -1; _ij2[1] = -1; _nj2 = -1; j3=numeric_limits<IkReal>::quiet_NaN(); _ij3[0] = -1; _ij3[1] = -1; _nj3 = -1;
346 for(
int dummyiter = 0; dummyiter < 1; ++dummyiter) {
348 px = eetrans[0]; py = eetrans[1]; pz = eetrans[2];
351 px = eetrans[0]; py = eetrans[1]; pz = eetrans[2];
356 r00 = new_r00; px = new_px; py = new_py; pz = new_pz;
358 pp=((px*px)+(py*py)+(pz*pz));
360 IkReal verifyeval[1];
362 if(
IKabs(verifyeval[0]) < 0.0000010000000000 )
365 IkReal j2array[1], cj2array[1], sj2array[1];
366 bool j2valid[1]={
false};
368 j2array[0]=((-0.1405)+pz);
369 sj2array[0]=
IKsin(j2array[0]);
370 cj2array[0]=
IKcos(j2array[0]);
372 for(
int ij2 = 0; ij2 < 1; ++ij2)
378 _ij2[0] = ij2; _ij2[1] = -1;
379 for(
int iij2 = ij2+1; iij2 < 1; ++iij2)
383 j2valid[iij2]=
false; _ij2[1] = iij2;
break;
386 j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2];
391 j0eval[1]=((px*px)+(py*py));
392 if(
IKabs(j0eval[0]) < 0.0000010000000000 ||
IKabs(j0eval[1]) < 0.0000010000000000 )
399 IkReal j0array[2], cj0array[2], sj0array[2];
400 bool j0valid[2]={
false};
408 IkReal x16=((1.0)*(x18.
value));
409 if((((((0.5184)*x14))+(((0.5184)*x15)))) < -0.00001)
415 if( (((x19.
value)*(((0.01065975)+(((-1.0)*x15))+(((-1.0)*x14))+(((-1.0)*(pz*pz)))+(((0.281)*pz))+(j2*j2))))) < -1-
IKFAST_SINCOS_THRESH || (((x19.
value)*(((0.01065975)+(((-1.0)*x15))+(((-1.0)*x14))+(((-1.0)*(pz*pz)))+(((0.281)*pz))+(j2*j2))))) > 1+
IKFAST_SINCOS_THRESH )
417 IkReal x17=
IKasin(((x19.
value)*(((0.01065975)+(((-1.0)*x15))+(((-1.0)*x14))+(((-1.0)*(pz*pz)))+(((0.281)*pz))+(j2*j2)))));
418 j0array[0]=((((-1.0)*x16))+(((-1.0)*x17)));
419 sj0array[0]=
IKsin(j0array[0]);
420 cj0array[0]=
IKcos(j0array[0]);
421 j0array[1]=((3.14159265358979)+(((-1.0)*x16))+x17);
422 sj0array[1]=
IKsin(j0array[1]);
423 cj0array[1]=
IKcos(j0array[1]);
424 if( j0array[0] >
IKPI )
428 else if( j0array[0] < -
IKPI )
432 if( j0array[1] >
IKPI )
436 else if( j0array[1] < -
IKPI )
440 for(
int ij0 = 0; ij0 < 2; ++ij0)
446 _ij0[0] = ij0; _ij0[1] = -1;
447 for(
int iij0 = ij0+1; iij0 < 2; ++iij0)
451 j0valid[iij0]=
false; _ij0[1] = iij0;
break;
454 j0 = j0array[ij0]; cj0 = cj0array[ij0]; sj0 = sj0array[ij0];
457 evalcond[0]=((0.05014025)+(((-1.0)*(px*px)))+(((-0.72)*px*(
IKsin(j0))))+(((-1.0)*(pz*pz)))+(((2.0)*j2*pz))+(((0.72)*py*(
IKcos(j0))))+(((-1.0)*(py*py)))+(((-1.0)*(j2*j2))));
470 j1eval[0]=((1.0)+(((7.71604938271605)*x21))+(((7.71604938271605)*x20))+(((5.55555555555556)*x23))+(((-5.55555555555556)*x22)));
471 j1eval[1]=
IKsign(((0.648)+(((5.0)*x21))+(((5.0)*x20))+(((3.6)*x23))+(((-3.6)*x22))));
472 j1eval[2]=((
IKabs(((-0.72)+(((-2.0)*x23))+(((2.0)*x22)))))+(
IKabs(((((-2.0)*py*sj0))+(((-2.0)*cj0*px))))));
473 if(
IKabs(j1eval[0]) < 0.0000010000000000 ||
IKabs(j1eval[1]) < 0.0000010000000000 ||
IKabs(j1eval[2]) < 0.0000010000000000 )
477 bool bgotonextstatement =
true;
482 IkReal x26=((((30.8641975308642)*x24))+(((30.8641975308642)*x25)));
483 IkReal x27=((1.0)+(((7.71604938271605)*x24))+(((7.71604938271605)*x25)));
491 IkReal x29=
pow(x35,-0.5);
496 IkReal x30=x36.
value;
497 IkReal x31=((5.55555555555556)*px*x29);
498 IkReal x32=((5.55555555555556)*py*x29);
499 IkReal x33=(x27*x30);
500 if((((1.0)+(((-1.0)*(x33*x33))))) < -0.00001)
502 IkReal x34=
IKsqrt(((1.0)+(((-1.0)*(x33*x33)))));
509 IkReal gconst0=((((-1.0)*(
IKasin(x33))))+(((-1.0)*(x37.
value))));
510 IkReal gconst1=((((-1.0)*x31*x33))+((x32*x34)));
511 IkReal gconst2=(((x32*x33))+((x31*x34)));
514 if((((((30.8641975308642)*x39))+(((30.8641975308642)*x38)))) < -0.00001)
520 IkReal x40=x42.
value;
521 IkReal x41=((7.71604938271605)*x40);
528 evalcond[0]=((-3.14159265358979)+(
IKfmod(((3.14159265358979)+(
IKabs(((
IKasin((((x38*x41))+((x39*x41))+x40)))+(x43.
value)+j0)))), 6.28318530717959)));
529 if(
IKabs(evalcond[0]) < 0.0000050000000000 )
531 bgotonextstatement=
false;
533 IkReal j1array[2], cj1array[2], sj1array[2];
534 bool j1valid[2]={
false};
536 IkReal x44=((1.0)*gconst2);
541 IkReal x45=x46.
value;
542 j1array[0]=((-1.0)*x45);
543 sj1array[0]=
IKsin(j1array[0]);
544 cj1array[0]=
IKcos(j1array[0]);
545 j1array[1]=((3.14159265358979)+(((-1.0)*x45)));
546 sj1array[1]=
IKsin(j1array[1]);
547 cj1array[1]=
IKcos(j1array[1]);
548 if( j1array[0] >
IKPI )
552 else if( j1array[0] < -
IKPI )
556 if( j1array[1] >
IKPI )
560 else if( j1array[1] < -
IKPI )
564 for(
int ij1 = 0; ij1 < 2; ++ij1)
570 _ij1[0] = ij1; _ij1[1] = -1;
571 for(
int iij1 = ij1+1; iij1 < 2; ++iij1)
575 j1valid[iij1]=
false; _ij1[1] = iij1;
break;
578 j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1];
581 IkReal x47=
IKsin(j1);
582 IkReal x48=
IKcos(j1);
583 evalcond[0]=((0.4)+(((-1.0)*gconst2*py*x48))+((gconst1*px*x48))+((gconst2*px*x47))+((gconst1*py*x47))+(((0.36)*x48)));
591 IkReal j3array[1], cj3array[1], sj3array[1];
592 bool j3valid[1]={
false};
594 j3array[0]=(r00+(((-1.0)*j0))+(((-1.0)*j1)));
595 sj3array[0]=
IKsin(j3array[0]);
596 cj3array[0]=
IKcos(j3array[0]);
597 if( j3array[0] >
IKPI )
601 else if( j3array[0] < -
IKPI )
605 for(
int ij3 = 0; ij3 < 1; ++ij3)
611 _ij3[0] = ij3; _ij3[1] = -1;
612 for(
int iij3 = ij3+1; iij3 < 1; ++iij3)
616 j3valid[iij3]=
false; _ij3[1] = iij3;
break;
619 j3 = j3array[ij3]; cj3 = cj3array[ij3]; sj3 = sj3array[ij3];
622 std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(4);
623 vinfos[0].jointtype = 1;
624 vinfos[0].foffset = j0;
625 vinfos[0].indices[0] = _ij0[0];
626 vinfos[0].indices[1] = _ij0[1];
627 vinfos[0].maxsolutions = _nj0;
628 vinfos[1].jointtype = 1;
629 vinfos[1].foffset = j1;
630 vinfos[1].indices[0] = _ij1[0];
631 vinfos[1].indices[1] = _ij1[1];
632 vinfos[1].maxsolutions = _nj1;
633 vinfos[2].jointtype = 17;
634 vinfos[2].foffset = j2;
635 vinfos[2].indices[0] = _ij2[0];
636 vinfos[2].indices[1] = _ij2[1];
637 vinfos[2].maxsolutions = _nj2;
638 vinfos[3].jointtype = 1;
639 vinfos[3].foffset = j3;
640 vinfos[3].indices[0] = _ij3[0];
641 vinfos[3].indices[1] = _ij3[1];
642 vinfos[3].maxsolutions = _nj3;
643 std::vector<int> vfree(0);
653 if( bgotonextstatement )
655 bool bgotonextstatement =
true;
660 IkReal x51=((5.55555555555556)*px);
661 IkReal x52=((((30.8641975308642)*x50))+(((30.8641975308642)*x49)));
662 IkReal x53=((1.0)+(((7.71604938271605)*x49))+(((7.71604938271605)*x50)));
667 IkReal x54=
pow(x60,-0.5);
675 IkReal x56=x61.
value;
676 IkReal x57=(x53*x56);
677 if((((1.0)+(((-1.0)*(x57*x57))))) < -0.00001)
679 IkReal x58=
IKsqrt(((1.0)+(((-1.0)*(x57*x57)))));
680 IkReal x59=((5.55555555555556)*x54*x58);
687 IkReal gconst3=((3.14159265358979)+(
IKasin(x57))+(((-1.0)*(x62.
value))));
688 IkReal gconst4=((((-1.0)*x51*x54*x57))+(((-1.0)*py*x59)));
689 IkReal gconst5=((((5.55555555555556)*py*x54*x57))+(((-1.0)*x51*x54*x58)));
692 if((((((30.8641975308642)*x63))+(((30.8641975308642)*x64)))) < -0.00001)
704 evalcond[0]=((-3.14159265358979)+(
IKfmod(((3.14159265358979)+(
IKabs(((-3.14159265358979)+(((-1.0)*(
IKasin(((x65.
value)*(((1.0)+(((7.71604938271605)*x64))+(((7.71604938271605)*x63)))))))))+(x66.
value)+j0)))), 6.28318530717959)));
705 if(
IKabs(evalcond[0]) < 0.0000050000000000 )
707 bgotonextstatement=
false;
709 IkReal j1array[1], cj1array[1], sj1array[1];
710 bool j1valid[1]={
false};
713 IkReal x68=gconst4*gconst4;
714 IkReal x69=gconst5*gconst5;
716 IkReal x71=((2.0)*gconst4);
717 IkReal x72=((2.0)*gconst5);
718 IkReal x73=((5.0)*x70);
719 IkReal x74=((5.0)*x67);
728 j1array[0]=((-1.5707963267949)+(x75.
value)+(((1.5707963267949)*(x76.
value))));
729 sj1array[0]=
IKsin(j1array[0]);
730 cj1array[0]=
IKcos(j1array[0]);
731 if( j1array[0] >
IKPI )
735 else if( j1array[0] < -
IKPI )
739 for(
int ij1 = 0; ij1 < 1; ++ij1)
745 _ij1[0] = ij1; _ij1[1] = -1;
746 for(
int iij1 = ij1+1; iij1 < 1; ++iij1)
750 j1valid[iij1]=
false; _ij1[1] = iij1;
break;
753 j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1];
756 IkReal x77=
IKsin(j1);
757 IkReal x78=
IKcos(j1);
758 IkReal x79=((1.0)*gconst5);
759 IkReal x80=(gconst4*x77);
762 evalcond[0]=((0.4)+(((0.36)*x78))+(((-1.0)*x79*x82))+((py*x80))+((gconst4*x81))+((gconst5*px*x77)));
763 evalcond[1]=((((0.36)*x77))+(((-1.0)*x79*x81))+((px*x80))+(((-1.0)*gconst4*x82))+(((-1.0)*py*x77*x79)));
771 IkReal j3array[1], cj3array[1], sj3array[1];
772 bool j3valid[1]={
false};
774 j3array[0]=(r00+(((-1.0)*j0))+(((-1.0)*j1)));
775 sj3array[0]=
IKsin(j3array[0]);
776 cj3array[0]=
IKcos(j3array[0]);
777 if( j3array[0] >
IKPI )
781 else if( j3array[0] < -
IKPI )
785 for(
int ij3 = 0; ij3 < 1; ++ij3)
791 _ij3[0] = ij3; _ij3[1] = -1;
792 for(
int iij3 = ij3+1; iij3 < 1; ++iij3)
796 j3valid[iij3]=
false; _ij3[1] = iij3;
break;
799 j3 = j3array[ij3]; cj3 = cj3array[ij3]; sj3 = sj3array[ij3];
802 std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(4);
803 vinfos[0].jointtype = 1;
804 vinfos[0].foffset = j0;
805 vinfos[0].indices[0] = _ij0[0];
806 vinfos[0].indices[1] = _ij0[1];
807 vinfos[0].maxsolutions = _nj0;
808 vinfos[1].jointtype = 1;
809 vinfos[1].foffset = j1;
810 vinfos[1].indices[0] = _ij1[0];
811 vinfos[1].indices[1] = _ij1[1];
812 vinfos[1].maxsolutions = _nj1;
813 vinfos[2].jointtype = 17;
814 vinfos[2].foffset = j2;
815 vinfos[2].indices[0] = _ij2[0];
816 vinfos[2].indices[1] = _ij2[1];
817 vinfos[2].maxsolutions = _nj2;
818 vinfos[3].jointtype = 1;
819 vinfos[3].foffset = j3;
820 vinfos[3].indices[0] = _ij3[0];
821 vinfos[3].indices[1] = _ij3[1];
822 vinfos[3].maxsolutions = _nj3;
823 std::vector<int> vfree(0);
833 if( bgotonextstatement )
835 bool bgotonextstatement =
true;
840 bgotonextstatement=
false;
845 if( bgotonextstatement )
855 IkReal j1array[1], cj1array[1], sj1array[1];
856 bool j1valid[1]={
false};
858 IkReal x83=((2.0)*cj0);
868 j1array[0]=((-1.5707963267949)+(x85.
value)+(((1.5707963267949)*(x86.
value))));
869 sj1array[0]=
IKsin(j1array[0]);
870 cj1array[0]=
IKcos(j1array[0]);
871 if( j1array[0] >
IKPI )
875 else if( j1array[0] < -
IKPI )
879 for(
int ij1 = 0; ij1 < 1; ++ij1)
885 _ij1[0] = ij1; _ij1[1] = -1;
886 for(
int iij1 = ij1+1; iij1 < 1; ++iij1)
890 j1valid[iij1]=
false; _ij1[1] = iij1;
break;
893 j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1];
896 IkReal x87=
IKcos(j1);
897 IkReal x88=
IKsin(j1);
902 IkReal x93=((1.0)*x87);
903 evalcond[0]=((0.4)+((x87*x90))+((x88*x91))+((x88*x89))+(((-1.0)*x92*x93))+(((0.36)*x87)));
904 evalcond[1]=((((-1.0)*x91*x93))+(((-1.0)*x88*x92))+((x88*x90))+(((0.36)*x88))+(((-1.0)*x89*x93)));
912 IkReal j3array[1], cj3array[1], sj3array[1];
913 bool j3valid[1]={
false};
915 j3array[0]=(r00+(((-1.0)*j0))+(((-1.0)*j1)));
916 sj3array[0]=
IKsin(j3array[0]);
917 cj3array[0]=
IKcos(j3array[0]);
918 if( j3array[0] >
IKPI )
922 else if( j3array[0] < -
IKPI )
926 for(
int ij3 = 0; ij3 < 1; ++ij3)
932 _ij3[0] = ij3; _ij3[1] = -1;
933 for(
int iij3 = ij3+1; iij3 < 1; ++iij3)
937 j3valid[iij3]=
false; _ij3[1] = iij3;
break;
940 j3 = j3array[ij3]; cj3 = cj3array[ij3]; sj3 = sj3array[ij3];
943 std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(4);
944 vinfos[0].jointtype = 1;
945 vinfos[0].foffset = j0;
946 vinfos[0].indices[0] = _ij0[0];
947 vinfos[0].indices[1] = _ij0[1];
948 vinfos[0].maxsolutions = _nj0;
949 vinfos[1].jointtype = 1;
950 vinfos[1].foffset = j1;
951 vinfos[1].indices[0] = _ij1[0];
952 vinfos[1].indices[1] = _ij1[1];
953 vinfos[1].maxsolutions = _nj1;
954 vinfos[2].jointtype = 17;
955 vinfos[2].foffset = j2;
956 vinfos[2].indices[0] = _ij2[0];
957 vinfos[2].indices[1] = _ij2[1];
958 vinfos[2].maxsolutions = _nj2;
959 vinfos[3].jointtype = 1;
960 vinfos[3].foffset = j3;
961 vinfos[3].indices[0] = _ij3[0];
962 vinfos[3].indices[1] = _ij3[1];
963 vinfos[3].maxsolutions = _nj3;
964 std::vector<int> vfree(0);
1001 return solver.
ComputeIk(eetrans,eerot,pfree,solutions);
1006 return solver.
ComputeIk(eetrans,eerot,pfree,solutions);
1013 #ifdef IKFAST_NAMESPACE 1017 #ifndef IKFAST_NO_MAIN 1020 #ifdef IKFAST_NAMESPACE 1021 using namespace IKFAST_NAMESPACE;
1026 printf(
"\nUsage: ./ik r00 r01 r02 t0 r10 r11 r12 t1 r20 r21 r22 t2 free0 ...\n\n" 1027 "Returns the ik solutions given the transformation of the end effector specified by\n" 1028 "a 3x3 rotation R (rXX), and a 3x1 translation (tX).\n" 1035 IkReal eerot[9],eetrans[3];
1036 eerot[0] = atof(argv[1]); eerot[1] = atof(argv[2]); eerot[2] = atof(argv[3]); eetrans[0] = atof(argv[4]);
1037 eerot[3] = atof(argv[5]); eerot[4] = atof(argv[6]); eerot[5] = atof(argv[7]); eetrans[1] = atof(argv[8]);
1038 eerot[6] = atof(argv[9]); eerot[7] = atof(argv[10]); eerot[8] = atof(argv[11]); eetrans[2] = atof(argv[12]);
1039 for(std::size_t i = 0; i < vfree.size(); ++i)
1040 vfree[i] = atof(argv[13+i]);
1041 bool bSuccess =
ComputeIk(eetrans, eerot, vfree.size() > 0 ? &vfree[0] : NULL, solutions);
1044 fprintf(stderr,
"Failed to get ik solution\n");
1052 printf(
"sol%d (free=%d): ", (
int)i, (
int)sol.
GetFree().size());
1053 std::vector<IkReal> vsolfree(sol.
GetFree().size());
1054 sol.
GetSolution(&solvalues[0],vsolfree.size()>0?&vsolfree[0]:NULL);
1055 for( std::size_t j = 0; j < solvalues.size(); ++j)
1056 printf(
"%.15f, ", solvalues[j]);
IKFAST_API bool ComputeIk(const IkReal *eetrans, const IkReal *eerot, const IkReal *pfree, IkSolutionListBase< IkReal > &solutions)
virtual const IkSolutionBase< T > & GetSolution(size_t index) const
returns the solution pointer
IKFAST_API int GetIkType()
IKFAST_API const char * GetKinematicsHash()
IKFAST_API int GetIkRealSize()
#define IKFAST_SOLUTION_THRESH
INLINE Rall1d< T, V, S > log(const Rall1d< T, V, S > &arg)
virtual size_t GetNumSolutions() const
returns the number of solutions stored
void dgeev_(const char *jobvl, const char *jobvr, const int *n, double *a, const int *lda, double *wr, double *wi, double *vl, const int *ldvl, double *vr, const int *ldvr, double *work, const int *lwork, int *info)
void dgetri_(const int *n, const double *a, const int *lda, int *ipiv, double *work, const int *lwork, int *info)
The discrete solutions are returned in this structure.
void dgesv_(const int *n, const int *nrhs, double *a, const int *lda, int *ipiv, double *b, const int *ldb, int *info)
virtual const std::vector< int > & GetFree() const =0
Gets the indices of the configuration space that have to be preset before a full solution can be retu...
float IKatan2(float fy, float fx)
virtual size_t AddSolution(const std::vector< IkSingleDOFSolutionBase< T > > &vinfos, const std::vector< int > &vfree)=0
add one solution and return its index for later retrieval
CheckValue< T > IKPowWithIntegerCheck(T f, int n)
#define IKFAST_EVALCOND_THRESH
IKFAST_API const char * GetIkFastVersion()
INLINE Rall1d< T, V, S > asin(const Rall1d< T, V, S > &x)
#define IKFAST_COMPILE_ASSERT(x)
virtual void Clear()=0
clears all current solutions, note that any memory addresses returned from GetSolution will be invali...
void dgetrs_(const char *trans, const int *n, const int *nrhs, double *a, const int *lda, int *ipiv, double *b, const int *ldb, int *info)
INLINE Rall1d< T, V, S > sqrt(const Rall1d< T, V, S > &arg)
float IKfmod(float x, float y)
int main(int argc, char **argv)
virtual void GetSolution(T *solution, const T *freevalues) const =0
gets a concrete solution
bool ComputeIk(const IkReal *eetrans, const IkReal *eerot, const IkReal *pfree, IkSolutionListBase< IkReal > &solutions)
INLINE Rall1d< T, V, S > pow(const Rall1d< T, V, S > &arg, double m)
IKFAST_API bool ComputeIk2(const IkReal *eetrans, const IkReal *eerot, const IkReal *pfree, IkSolutionListBase< IkReal > &solutions, void *pOpenRAVEManip)
INLINE Rall1d< T, V, S > acos(const Rall1d< T, V, S > &x)
Default implementation of IkSolutionListBase.
INLINE Rall1d< T, V, S > atan2(const Rall1d< T, V, S > &y, const Rall1d< T, V, S > &x)
#define IKFAST_VERSION
Header file for all ikfast c++ files/shared objects.
IKFAST_API int * GetFreeParameters()
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
INLINE Rall1d< T, V, S > tan(const Rall1d< T, V, S > &arg)
IKFAST_API void ComputeFk(const IkReal *j, IkReal *eetrans, IkReal *eerot)
#define IKFAST_ATAN2_MAGTHRESH
IKFAST_API int GetNumJoints()
float IKatan2Simple(float fy, float fx)
manages all the solutions
INLINE Rall1d< T, V, S > sin(const Rall1d< T, V, S > &arg)
void dgetrf_(const int *m, const int *n, double *a, const int *lda, int *ipiv, int *info)
virtual size_t GetNumSolutions() const =0
returns the number of solutions stored
IKFAST_API int GetNumFreeParameters()
CheckValue< T > IKatan2WithCheck(T fy, T fx, T epsilon)
void zgetrf_(const int *m, const int *n, std::complex< double > *a, const int *lda, int *ipiv, int *info)
#define IKFAST_SINCOS_THRESH