libmove3d
3.13.0
|
00001 /* (jcortes) */ 00002 /****************************************************************************/ 00009 #include "p3d.h" 00010 00011 #ifndef CNTRT_H 00012 #define CNTRT_H 00013 00014 #define DOF_WITHOUT_CNTRT 0 00015 #define DOF_PASSIF 2 00016 #define DOF_ACTIF 1 00017 00018 /********************** 00019 PARALLEL SYS 00020 ***********************/ 00021 00022 /*-----------------------------------------------------------------------------*/ 00025 typedef struct s_tri_attach { 00029 p3d_matrix4 Ttri2pp; 00030 int index_att[3]; 00031 double l12; 00032 double l13; 00033 double l23; 00034 double angle12; 00035 struct s_tri_attach *next; 00036 } p3d_tri_attach; 00037 00038 00039 /*-----------------------------------------------------------------------------*/ 00042 #define MAX_N_MANIPULATORS 10 00043 typedef struct s_parallel { 00045 struct jnt *base_jntPt; 00047 struct jnt *platform_jntPt; 00049 int (*fct_parplatf_shoot)(struct s_parallel*, configPt); 00051 double platform_dof_min_bounds[6]; 00052 double platform_dof_max_bounds[6]; 00054 int n_manipulators; 00056 struct jnt *att_jnt[MAX_N_MANIPULATORS]; 00058 int index_link_platf[MAX_N_MANIPULATORS]; 00060 double dpa[MAX_N_MANIPULATORS]; 00062 struct cntrt *manip_cntrt[MAX_N_MANIPULATORS]; 00066 struct s_tri_attach *triangles; 00067 } p3d_parallel; 00068 00069 00070 /********************** 00071 RLG 00072 ***********************/ 00073 00074 /* clasement of joints for RLG */ 00075 #define RJA1 1 00076 #define RJA2 2 00077 #define RJB1 3 00078 #define RJB2 4 00079 #define RJB3 5 00080 #define RJC0 6 00081 #define RJC1 7 00082 #define RJD1 8 00083 #define RJD2 9 00084 #define TJ 10 00085 00086 typedef struct s_shell { 00087 double rext; 00088 double rint; 00089 double alpha; 00090 } p3d_shell; 00091 00092 typedef struct s_rlg_chain_data { 00093 struct jnt *jnt; 00094 int num_dof_jnt; 00095 int jtype; 00096 double lmax; 00097 double lmin; 00098 double dat[4]; 00099 struct s_shell shell; 00100 double totrml; 00101 double totmMdif; 00102 p3d_matrix4 Tref; 00103 double refval; 00104 } p3d_rlg_chain_data, *pp3d_rlg_chain_data; 00105 00106 typedef struct s_rlg_chain { 00107 int nlinksrlgch; 00108 struct s_rlg_chain_data **rlg_data; 00109 int (*rlg_chain_fct)(struct cntrt* ct, configPt q); 00110 } p3d_rlg_chain, *pp3d_rlg_chain; 00111 00112 00113 typedef struct s_rlg_base { 00114 struct jnt *basejntPt; 00115 int (*rlg_base_fct)(struct cntrt*, configPt); 00116 double rmax, rmin; 00117 p3d_matrix4 Tbm; 00118 double lbm; 00119 } p3d_rlg_base, *pp3d_rlg_base; 00120 00121 00122 00123 /*-----------------------------------------------------------------------------*/ 00127 typedef struct s_rlg { 00128 struct s_rlg_chain *rlgchPt; 00129 struct s_rlg_base *rlgbsPt; 00130 } p3d_rlg, *pp3d_rlg; 00131 00132 /********************** 00133 CONSTRAINTS 00134 ***********************/ 00135 00136 #define MAX_ARGU_CNTRT 30 00137 00139 typedef struct cntrt { 00140 int num; 00141 char namecntrt[40]; 00142 int active; 00143 int (*fct_cntrt)(struct cntrt *ct, int iksol, configPt, double dl); 00144 int nactjnts, npasjnts; 00145 int ndval, nival; 00146 struct jnt * actjnts[MAX_ARGU_CNTRT]; 00147 int act_jnt_dof[MAX_ARGU_CNTRT]; 00148 int act_rob_dof[MAX_ARGU_CNTRT]; 00149 int actjnt_state[MAX_ARGU_CNTRT]; 00150 struct jnt * pasjnts[MAX_ARGU_CNTRT]; 00151 int pas_jnt_dof[MAX_ARGU_CNTRT]; 00152 int pas_rob_dof[MAX_ARGU_CNTRT]; 00153 int argu_i[MAX_ARGU_CNTRT]; 00154 double argu_d[MAX_ARGU_CNTRT]; 00155 00156 int markedForSingularity;//this singularity is marked for singularity don't compute the cntrt 0 00157 int nSingularities;//number of singularities 00158 struct singularity *singularities[MAX_ARGU_CNTRT];//array of singularities 00159 00160 p3d_matrix4 Tatt; 00161 p3d_matrix4 Tatt2; 00162 p3d_matrix4 Tatt_default; 00163 p3d_matrix4 Tbase; 00164 p3d_matrix4 TSingularity; 00165 struct obj * col_pairs[2][MAX_ARGU_CNTRT]; 00166 struct cntrt *next_cntrt; 00167 struct cntrt *prev_cntrt; 00168 int enchained_rob_dof[MAX_ARGU_CNTRT]; 00169 int nenchained; 00170 struct cntrt **enchained; 00171 struct cntrt *reshoot_ct; 00172 int nctud; 00173 struct cntrt **ct_to_update; 00174 struct s_rlg *rlgPt; 00175 struct s_parallel *parallel_sys_data; 00176 struct s_bio_6R_ik_data *bio_ik_data; 00177 struct cntrt_management *cntrt_manager; 00178 int nbSol; //Number of possible solutions. This parameter is filled in the set_function of the constraint. 00179 } p3d_cntrt, *pp3d_cntrt; 00180 00183 typedef struct singJntVal { 00184 int jntNum; //The joint number 00185 double *val; //The joint singular value 00186 } p3d_singJntVal, *pp3d_singJntVal; 00187 00188 00191 typedef struct singularity { 00192 int nJnt; //the number of jnt for this singularity 00193 p3d_singJntVal *singJntVal[MAX_ARGU_CNTRT]; //array of singular joint values composing this singularity 00194 int nRel; //the number of relation between two classes 00195 int classes[MAX_ARGU_CNTRT][2]; //two columns array of the classes that this singularity can connect 00196 } p3d_singularity, *pp3d_singularity; 00197 00199 typedef struct cntrt_management { 00200 00202 p3d_cntrt **cntrts; 00203 00205 int ncntrts; 00206 00208 int nb_dof; 00209 00214 int *in_cntrt; 00215 00217 struct s_dbl_list *cntrt_call_list; 00218 00219 } p3d_cntrt_management, *pp3d_cntrt_management; 00220 00221 // struct lessJnt { 00222 // bool operator() (const struct jnt* jnt1, const struct jnt* jnt2) const 00223 // {return jnt1->num < jnt2->num;} 00224 // }; 00225 // 00226 // class Constraint{ 00227 // private: 00228 // int id; 00229 // std::string name; 00230 // int active; 00231 // std::multimap <struct jnt*, std::vector <int>, lessJnt> actjnts; 00232 // std::multimap <struct jnt*, std::vector <int>, lessJnt> pasjnts; 00233 // std::vector <int> argu_i; 00234 // std::vector <double> argu_d; 00235 // p3d_matrix4 Tatt; 00236 // p3d_matrix4 Tatt2; 00237 // std::vector <pair <struct obj*, struct obj*>> col_pairs; 00238 // // struct obj * col_pairs[2][MAX_ARGU_CNTRT]; 00239 // // struct cntrt *next_cntrt; 00240 // // struct cntrt *prev_cntrt; 00241 // int enchained_rob_dof[MAX_ARGU_CNTRT]; 00242 // int nenchained; 00243 // std::vector <Constraint&> enchained; 00244 // Constraint& reshoot_ct; 00245 // int nctud; 00246 // std::vector <Constraint&> ct_to_update; 00247 // struct s_rlg *rlgPt; 00248 // struct s_parallel *parallel_sys_data; 00249 // struct s_bio_6R_ik_data *bio_ik_data; 00250 // struct cntrt_management *cntrt_manager; 00251 // 00252 // p3d_matrix4 Tbase; 00253 // p3d_matrix4 TSingularity; 00254 // int markedForSingularity;//this singularity is marked for singularity don't compute the cntrt 0 00255 // int nbSol; 00256 // int nSingularities;//number of singularities 00257 // std::vector<struct singularity* > singularities;//vector of singularities 00258 // }; 00259 00260 #endif 00261