Institut de Robòtica i Informàtica Industrial
KRD Group

The CuikSuite Project

mechanism.h

Go to the documentation of this file.
00001 #ifndef MECHANISMH
00002 #define MECHANISMH
00003 
00004 #include "vector.h"
00005 #include "cuiksystem.h"
00006 #include "box.h"
00007 #include "link.h"
00008 #include "joint.h"
00009 #include "plot3d.h"
00010 #include "color.h"
00011 
00021 /****************************************************************************/
00028 #define INIT_NUM_LINKS 10
00029 /****************************************************************************/
00036 #define INIT_NUM_JOINTS 10
00037 /****************************************************************************/
00038 
00051 typedef struct {
00052   Tvector joints; 
00053   Tvector links;  
00056   unsigned int nbodies; 
00057   double maxCoord; 
00059 } Tmechanism;
00060 
00068 void InitMechanism(Tmechanism *m);
00069 
00079 unsigned int GetMechanismNLinks(Tmechanism *m);
00080 
00090 unsigned int GetMechanismNJoints(Tmechanism *m);
00091 
00102 unsigned int GetMechanismNBodies(Tmechanism *m);
00103 
00121 signed int GetMechanismDOF(Tmechanism *m);
00122 
00137 void GetMechanismDefiningPoint(unsigned int lID,unsigned int bID,unsigned int pID,
00138                                double *p,Tmechanism *m);
00139 
00151 unsigned int AddLink2Mechanism(Tlink *l,Tmechanism *m);
00152 
00164 unsigned int AddJoint2Mechanism(Tjoint *j,Tmechanism *m);
00165 
00177 unsigned int AddBody2Mechanism(unsigned int lID,Tcpolyhedron *b,Tmechanism *m);
00178 
00190 unsigned int GetLinkID(char *name,Tmechanism *m);
00191 
00203 Tlink *GetMechanismLink(unsigned int i,Tmechanism *m);
00204 
00216 Tjoint *GetMechanismJoint(unsigned int i,Tmechanism *m);
00217 
00218 
00219 
00234 double GetMechanismMaxCoordinate(Tmechanism *m);
00235 
00249 void PlotMechanism(Tplot3d *pt,double axesLength,Tmechanism *m);
00250 
00251 
00271 void RegenerateMechanismSolution(TCuikSystem *cs,double *sol,Tmechanism *m);
00272 
00288 void MoveMechanism(Tplot3d *pt,TCuikSystem *cs,double *sol,
00289                    double **r,Tmechanism *m);
00290 
00298 void DeleteMechanism(Tmechanism *m);
00299 
00300 #endif