Libbarrett
1.2.4
|
00001 00093 #ifndef BARRETT_CDLBT_DYNAMICS_H_ 00094 #define BARRETT_CDLBT_DYNAMICS_H_ 00095 #ifdef __cplusplus 00096 extern "C" { 00097 #endif 00098 00099 #include <libconfig.h> 00100 #include <gsl/gsl_vector.h> 00101 #include <gsl/gsl_matrix.h> 00102 00103 #include <barrett/cdlbt/kinematics.h> 00104 00105 00111 struct bt_dynamics_link 00112 { 00115 struct bt_dynamics_link * next; 00116 struct bt_dynamics_link * prev; 00121 double mass; 00122 gsl_vector * com; 00123 gsl_matrix * I; 00127 /* NOTE: 00128 * Do we need rotor inertia here?? */ 00129 00130 /* Next, a place to hold the results from calculations */ 00131 00134 gsl_vector * omega; 00136 gsl_vector * omega_prev; 00137 gsl_vector * alpha; 00139 gsl_vector * a; 00142 /* A couple of caches, also expressed in local link frame */ 00143 00146 gsl_vector * fnet; 00147 gsl_vector * tnet; 00148 gsl_vector * f; 00149 gsl_vector * f_next; 00150 gsl_vector * t; 00155 gsl_matrix * com_jacobian; 00156 gsl_matrix * com_jacobian_linear; 00158 gsl_matrix * com_jacobian_angular; 00162 }; 00163 00164 00169 struct bt_dynamics 00170 { 00171 int dof; 00172 int nlinks; 00173 struct bt_dynamics_link ** link_array; 00174 00175 struct bt_dynamics_link * base; 00176 struct bt_dynamics_link ** link; /* Moving links array */ 00177 struct bt_dynamics_link * toolplate; 00178 00179 /* Yay JSIM! */ 00180 gsl_matrix * jsim; 00181 00182 /* Temporary Vectors */ 00183 gsl_vector * temp1_v3; 00184 gsl_vector * temp2_v3; 00185 00186 /* Temporary Matrices */ 00187 gsl_matrix * temp3x3_1; 00188 gsl_matrix * temp3x3_2; 00189 gsl_matrix * temp3xn_1; 00190 }; 00191 00192 00208 int bt_dynamics_create(struct bt_dynamics ** dynptr, 00209 config_setting_t * dynconfig, int ndofs); 00210 00211 00220 int bt_dynamics_destroy(struct bt_dynamics * dyn); 00221 00222 00240 int bt_dynamics_eval_inverse(struct bt_dynamics * dyn, 00241 const struct bt_kinematics * kin, 00242 const gsl_vector * jvel, const gsl_vector * jacc, 00243 gsl_vector * jtor); 00244 00245 00254 int bt_dynamics_eval_jsim(struct bt_dynamics * dyn, struct bt_kinematics * kin); 00255 00256 00257 #ifdef __cplusplus 00258 } 00259 #endif 00260 #endif /* BARRETT_CDLBT_DYNAMICS_H_ */