/********************************* TRICK HEADER ******************************* PURPOSE: ( Simulate a planar, 2DOF manipulator for Trick example sim.) LIBRARY DEPENDENCY: ((kinematics/ManipKinemat.o) (utils/utils.o) ) PROGRAMMERS: (((Sean Harmeyer) (NASA) (Dec 2022) (Trick Example Sim))) *******************************************************************************/ #include "kinematics/ManipKinemat.hh" #include "include/trick/memorymanager_c_intf.h" ManipKinemat::ManipKinemat(int numDof):ndof(numDof) { int i,j; /* These vectors and matrices don't explicitly depend on the * number of degrees of freedom */ V_ee = (double *)TMM_declare_var_1d("double",2); P_task_base = (double *)TMM_declare_var_1d("double",2); P_joint_ee = (double *)TMM_declare_var_1d("double",2); P_task_ee = (double *)TMM_declare_var_1d("double",2); joint_ee = (double *)TMM_declare_var_1d("double",2); R_task_base = (double **)TMM_declare_var_1d("double*",2); R_base_task = (double **)TMM_declare_var_1d("double*",2); R_ee_joint = (double **)TMM_declare_var_1d("double*",2); jacobian = (double **)TMM_declare_var_1d("double*",2); R_ee_task = (double **)TMM_declare_var_1d("double*",2); /* total number of degrees of freedom determines the size of all of these * vectors and matrices, so we size them accordingly */ joint_u = (double *)TMM_declare_var_1d("double",ndof); joint_q = (double *)TMM_declare_var_1d("double",ndof); joint_w = (double *)TMM_declare_var_1d("double",ndof); joint_l = (double **)TMM_declare_var_1d("double*",ndof); jacInv = (double **)TMM_declare_var_1d("double*",ndof); P_joint_joint = (double **)TMM_declare_var_1d("double*",ndof); P_task_joint = (double **)TMM_declare_var_1d("double*",ndof); V_joint_joint = (double **)TMM_declare_var_1d("double*",ndof); V_joint_task = (double **)TMM_declare_var_1d("double*",ndof); R_joint = (double ***)TMM_declare_var_1d("double**",ndof); R_joint_task = (double ***)TMM_declare_var_1d("double**",ndof); for(i=0;i<2;i++) { R_task_base[i] = (double *)TMM_declare_var_1d("double",2); R_base_task[i] = (double *)TMM_declare_var_1d("double",2); R_ee_task[i] = (double *)TMM_declare_var_1d("double",2); R_ee_joint[i] = (double *)TMM_declare_var_1d("double",2); jacobian[i] = (double *)TMM_declare_var_1d("double",ndof); } for(i=0;i 2.0 * M_PI) joint_q[i] -= 2.0 * M_PI; else if (joint_q[i] < -2.0 * M_PI) joint_q[i] += 2.0 * M_PI; } // Calculate current rotation matrices for all frames for (i=0; i