libmove3d  3.13.0
/home/slemaign/softs-local/BioMove3D-git/include/device.h
Go to the documentation of this file.
00001 /****************************************************************************/
00009 /****************************************************************************/
00010 
00011 #ifndef _DEVICE_H
00012 #define _DEVICE_H
00013 
00015 #define JNT_NB_DOF_MAX     6
00016 
00018 #define JNT_MAX_SIZE_NAME 80
00019 
00020 #define NDOF_BASE           6
00021 #define NDOF_BASE_TRANSLATE 3
00022 #define NDOF_BASE_ROTATE    3
00023 
00025 #define NB_POS_PARAM 6
00026 
00027 #define MAX_TRANSITION 10
00028 
00029 #ifdef LIGHT_PLANNER
00030 #include <vector>
00031 #endif
00032 
00033 #include "p3d_sys.h"
00034 #include "p3d_type.h"
00035 #include "p3d_matrix.h"
00036 #include "polyhedre.h"
00037 #include "p3d_poly.h"
00038 #include "dyna_list.h"              // modif Juan
00039 #include "p3d.h"
00040 #include "traj.h"
00041 #include "localpath.h"
00042 
00043 /*--------------------------------------------------------------------------*/
00048 typedef struct s_read_jnt_link_data {
00050   struct jnt * jnt_link;
00052   int jnt_num;
00054   int robot_num;
00056   int flag_prev;
00058   double pos_param[NB_POS_PARAM];
00059 } p3d_read_jnt_link_data;
00060 
00061 /*--------------------------------------------------------------------------*/
00066 typedef struct p3d_read_jnt_data {
00067   p3d_type_joint type;
00068   double scale;
00069   char name[JNT_MAX_SIZE_NAME];
00070   int flag_name;
00071   int prev_jnt;
00072   int flag_prev_jnt;
00073   int nb_dof;
00074   double * v;
00075   int flag_v;
00076   double * v_pos0;
00077   int flag_v_pos0;
00078   double * vmin;
00079   int flag_vmin;
00080   double * vmax;
00081   int flag_vmax;
00082   double * vmin_rand;
00083   int flag_vmin_rand;
00084   double * vmax_rand;
00085   int flag_vmax_rand;
00086   int * is_user;
00087   int flag_is_user;
00088   int * is_active_for_planner;
00089   int flag_is_active_for_planner;
00090   int nb_param;
00091   double * param;
00092   int flag_param;
00093   p3d_matrix4 pos;
00094   int flag_pos;
00095   int flag_relative_pos;
00096   double * velocity_max;
00097   int flag_velocity_max;
00098   double * acceleration_max;
00099   int flag_acceleration_max;
00100   double * jerk_max;
00101   int flag_jerk_max;
00102   double * torque_max;
00103   int flag_torque_max;
00104   
00105   int nb_links;
00106   struct s_read_jnt_link_data ** link_array;
00107 
00108 } p3d_read_jnt_data;
00109 
00110 
00114 typedef struct
00115 {
00117   p3d_vector3 axis;
00118 
00120   double v;
00121 
00124   double old_v;
00125 
00130   double v0;
00131 
00133   double vmin;
00134 
00136   double vmax;
00137 
00138   
00140   double velocity_max;
00141 
00143   double acceleration_max;
00144 
00146   double jerk_max;
00147 
00149   double torque_max;
00150   
00155   double vmin_r;
00156 
00161   double vmax_r;
00162 
00169   int   is_user;
00170 
00175   int   is_active_for_planner;
00176 
00184   int   is_modified;
00185 
00187   int lock;
00188 
00194   bool circular;
00195 } p3d_dof_data;
00196 
00200 typedef struct link_between_joint
00201 {
00203   p3d_matrix4 rel_pos;
00204 
00206   struct jnt * prev_jnt;
00207 
00209   struct jnt * next_jnt;
00210 
00211 } p3d_link_between_joint;
00212 
00213 
00217 typedef struct jnt
00218 {
00237   p3d_type_joint   type;
00238 
00246   int kinematic_type;
00247 #ifdef BIO
00248 
00249   int bio_jnt_type;  // modif Juan
00251   int bio_AAnumber;  // modif ljaillet
00253   int num_subrobot;
00254 #endif
00255 
00256   int num;
00257 
00259   char  name[JNT_MAX_SIZE_NAME];
00260 
00265   int ui_kin_num;
00266 
00273   int kin_joint_id;
00274 
00276   int is_used_in_device_flag;
00277 
00279   struct rob  *rob;
00280 
00282   struct obj  *o;
00283 
00287   //  double v;
00288 
00292   //double vmin;
00293 
00297   //  double vmax;
00298 
00299   /*----------------------------------------------------------------------
00300    * Placement parameters
00301    */
00302 
00306   p3d_matrix4 pos0_obs;
00307 
00311   p3d_matrix4 pos0;
00312 
00317   p3d_point p0;
00318 
00323   p3d_point relative_p0;
00324 
00331   int   is_defined_relative;
00332 
00339   p3d_matrix4 abs_pos;
00340 
00342   int abs_pos_modified;
00343 
00351   p3d_matrix4 abs_pos_before_jnt;
00352 
00354   int abs_pos_before_jnt_modified;
00355 
00357   int pos_obj_modified;
00358 
00360   int pos_updated;
00361 
00367   p3d_matrix4   jnt_mat;
00368 
00370   int mat_modified;
00371 
00372   /*----------------------------------------------------------------------
00373    * The link to other joints.
00374    */
00375 
00377   struct jnt  *prev_jnt;
00378 
00380   struct jnt  **next_jnt;
00381 
00383   int   n_next_jnt;
00384 
00386   struct link_between_joint **link_jnt_arr;
00387 
00389   int        n_link_jnt;
00390 
00393   struct link_between_joint **link_jnt_owned_arr;
00394 
00396   int        n_link_jnt_owned;
00397 
00401   double  dist;
00402 
00404   p3d_prejac  *prejac;
00405 
00409   void  *end_user_data;
00410 
00412   int   index_dof;
00413 
00419   int   index_user_dof;
00420 
00422   int dof_equiv_nbr;
00423 
00430   int user_dof_equiv_nbr;
00431 
00433   p3d_dof_data  dof_data[JNT_NB_DOF_MAX];
00434 
00435 } p3d_jnt, *pp3d_jnt;
00436 
00440 typedef struct lm_list_param
00441 {
00442   p3d_localpath_type lpl_type;
00443   void  *lm_param;
00444   struct lm_list_param  *next;
00445 
00446 } lm_list_param_str, *plm_list_param_str;
00447 
00448 #ifdef MULTIGRAPH
00449 
00450 typedef struct multiGraphJoint{
00452   int nbJoints;
00454   int * joints;
00456   int * cntrts;
00457 }p3d_multiGraphJoint;
00458 
00459 typedef struct multiGraph{
00461   char * envName;
00463   char * robotName;
00465   int nbGraphs;
00467   struct graph ** graphs;
00469   int * active;
00471   struct multiGraphJoint ** mgJoints;
00473   int * usedJoint;
00475   int involvesCp;
00477   struct flatSuperGraph * fsg;
00478 } p3d_multiGraph;
00479 #endif
00480 
00481 #ifdef MULTILOCALPATH
00482 
00483 typedef struct multiLocalPathJoint{
00485         int nbJoints;
00487         int nbDofs;
00489         int * joints;
00491         char gpName[30];
00493         p3d_group_type  gpType;
00495         p3d_localpath_type      lplType;
00497         plm_list_param_str local_method_params;
00498 
00499 }p3d_multiLocalPathJoint;
00500 
00501 typedef struct multiLocalPath{
00503         int nblpGp;
00505         int * active;
00507         struct multiLocalPathJoint ** mlpJoints;
00509         p3d_traj        **t;
00510 } p3d_multiLocalPath;
00511 #endif
00512 
00515 typedef enum {
00516   P3D_ROB_DEFAULT_DISPLAY, 
00517   P3D_ROB_NO_DISPLAY, 
00518   P3D_ROB_UNLIT_BLACK_DISPLAY, 
00519   P3D_ROB_UNLIT_RED_DISPLAY, 
00520   P3D_ROB_RED_DISPLAY, 
00521   P3D_ROB_UNLIT_GREEN_DISPLAY, 
00522   P3D_ROB_GREEN_DISPLAY, 
00523   P3D_ROB_UNLIT_BLUE_DISPLAY, 
00524   P3D_ROB_BLUE_DISPLAY, 
00525   P3D_ROB_CUSTOM_COLOR_DISPLAY,  
00526   P3D_ROB_UNLIT_CUSTOM_COLOR_DISPLAY,  
00527 } p3d_rob_display_mode;
00528 
00529 
00536 typedef struct rob
00537 {
00538   char  *name;
00539 
00541   int num;
00542 
00548   int ui_kin_num;
00549 
00551   int is_used_in_env_flag;
00552 
00554   int kinematic_type;
00555 
00556   struct env  *env;
00557 
00558   /*----------------------------------------------------------------------
00559    * corps du robots
00560    */
00561   int no;
00562   p3d_obj **o,*ocur;
00563 
00565   int  nb_dof;
00566 
00572   int  nb_user_dof;
00573 
00575   int njoints;
00577   p3d_jnt **joints;
00578 
00587   p3d_jnt *j_modif;
00588 
00594   p3d_jnt *first_joint;
00595 
00602   p3d_matrix4 * first_abs_pos;
00603 
00605   int   nt;
00606 
00608   p3d_traj  **t;
00610   p3d_traj  *tcur;
00611 
00615   p3d_box box;
00619   double rx;
00623   double ry;
00627   double rz;
00631   double vmin_rot[NDOF_BASE_ROTATE];
00635   double vmax_rot[NDOF_BASE_ROTATE];
00636 
00638   int coll;
00639 
00641   p3d_BB BB;
00642 
00644   int nconf;
00646   config_namePt *conf;
00648   config_namePt confcur;
00650   configPt  ROBOT_POS;
00652   configPt  ROBOT_GOTO;
00654   configPt transitionConfigs[MAX_TRANSITION];
00656   int nTransition;
00657   // modif Juan ( not used yet ! )
00659   int *ikSolPos;
00661   int *ikSolGoto;
00663   int *ikSolTransition[MAX_TRANSITION];
00665   int *ikSol;
00666   // fmodif Juan
00668   int sdk_id_qinit;
00670   int sdk_id_qgoal;
00671 
00676   double *length_array;
00677 
00679   p3d_localpath_type lpl_type;
00681   plm_list_param_str local_method_params;
00682 
00684   struct graph  *GRAPH;
00685 
00687   struct cntrt_management *cntrt_manager;  // modif. Juan
00688 
00690   void    *user_appli;
00691 
00692   configPt currect_q_inv;  // temporary modif
00693 
00694 #ifdef BIO
00695   int nbAA;
00696   int nb_flexible_sc;
00697   p3d_jnt** list_firstjnts_flexible_sc;
00698   int  nb_ligand_dof;
00699   int num_subrobot_ligand;
00700   p3d_jnt** list_AA_firstjnt;
00701 #endif
00702 
00703   p3d_rob_display_mode display_mode;  
00705 // TODO: Because of the removal of hri_planner from BioMove3D (to libhri), this flag is problematic:
00706 // - libmove3d p3d_rob struct is compiled without this part
00707 // - libhri/move3d-studio use this part, resulting in structs that have different sizes.
00708 //#ifdef HRI_PLANNER_GUI
00709 //
00710 
00711 /* Modif Luis */
00712   int show_pos_area;     // boolean show/hide semidisc of position area
00713   double max_pos_range;  // Max Range distance for the position area
00714   double min_pos_range;  // Min Range distance for the position area
00715   double angle_range;    // aperture angle (rad) of acepted "in front of" positions (range:[-angle/2,angle/2])
00716 
00717 
00718   // Camera's Properties
00719   int show_view_field;   // boolean show/hide cone of camera field of view
00720 
00721   double cam_pos[3];     // Camera Position point in the robot X,Y,Z
00722   double cam_dir[3];     // and orientation point X,Y,Z
00723   int    cam_axe;        // Axe where the camera is looking forward
00724   double cam_pan;        // Camera's pan angle
00725   double cam_tilt;       // Camera's tilt angle
00726   double cam_max_range;  // Max Range of view of the camera
00727   double cam_min_range;  // Min Range of view of the camera (end of de cone)
00728   double cam_h_angle;    // Camera Horizontal caption angle
00729   double cam_v_angle;    // Camera Vertical caption angle
00730   int    cam_body_index; // Index of the body of the robot with attached camera
00731 
00732   //Perspective
00733   int caption_selected;
00734   void *lookatpoint; //used later as a psp_obs_vertex* from perspective.h
00735 
00736   /* End Modif Luis */
00737 
00738 //#endif
00739 
00740 #ifdef MULTIGRAPH
00741   struct multiGraph *mg;
00742 #endif
00743 
00744 #ifdef MULTILOCALPATH
00745   struct multiLocalPath *mlp;
00746 #endif
00747 #ifdef LIGHT_PLANNER
00748   int graspNbJoints;
00749   p3d_jnt** graspJoints;
00750   p3d_jnt* baseJnt;
00751   p3d_jnt* curObjectJnt;
00752   double relativeZRotationBaseObject;
00753   int * isUserDof;
00754   int nbCcCntrts; //Closed Chain constraints
00755   struct cntrt ** ccCntrts;
00756   configPt openChainConf;
00757   configPt closedChainConf;
00758   double configCostThreshold;
00759   struct graph* preComputedGraphs[4]; //Save the precomputed Graphs: 0 = Platform Graph without the object, 1 = Upper Body Graph without the object, 2 = Platform Graph with the object, 3 = Upper Body with the object
00760 #endif
00761 #if defined(FK_CNTRT) && defined(LIGHT_PLANNER)
00762   int nbFkCntrts; //Forward kinematics constraints for the virtual object used by the closed chain constraints 
00763   struct cntrt ** fkCntrts;
00764 #endif
00765 #if  defined(LIGHT_PLANNER)
00766   int isCarryingObject;
00767 //  struct rob *carriedObject; /*!< pointer to the carried object (a freeflyer robot) */
00768   std::vector<class ArmManipulationData> *armManipulationData;
00769 #endif
00770 #ifdef DPG
00771   int nbDpgCells;
00772   class DpgCell ** dpgCells;
00773 #endif
00774   int draw_custom_color;
00775   int draw_transparent;
00776   int inhibitCollisionTolerance; 
00777 } p3d_rob, *pp3d_rob;
00778 
00779 #endif /* #ifndef _DEVICE_H */
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines