mechanism.h
Go to the documentation of this file.
1 #ifndef MECHANISMH
2 #define MECHANISMH
3 
4 #include "vector.h"
5 #include "cuiksystem.h"
6 #include "box.h"
7 #include "link.h"
8 #include "joint.h"
9 #include "plot3d.h"
10 #include "color.h"
11 
21 /****************************************************************************/
28 #define INIT_NUM_LINKS 10
29 /****************************************************************************/
36 #define INIT_NUM_JOINTS 10
37 /****************************************************************************/
38 
51 typedef struct {
56  unsigned int nbodies;
57  boolean allSpheres;
58  double maxCoord;
60 } Tmechanism;
61 
69 void InitMechanism(Tmechanism *m);
70 
80 unsigned int GetMechanismNLinks(Tmechanism *m);
81 
91 unsigned int GetMechanismNJoints(Tmechanism *m);
92 
103 unsigned int GetMechanismNBodies(Tmechanism *m);
104 
118 
134 
135 
153 signed int GetMechanismMobility(Tmechanism *m);
154 
169 void GetMechanismDefiningPoint(unsigned int lID,unsigned int bID,unsigned int pID,
170  double *p,Tmechanism *m);
171 
183 unsigned int AddLink2Mechanism(Tlink *l,Tmechanism *m);
184 
196 unsigned int AddJoint2Mechanism(Tjoint *j,Tmechanism *m);
197 
209 unsigned int AddBody2Mechanism(unsigned int lID,Tpolyhedron *b,Tmechanism *m);
210 
222 unsigned int GetLinkID(char *name,Tmechanism *m);
223 
235 Tlink *GetMechanismLink(unsigned int i,Tmechanism *m);
236 
248 unsigned int GetMechanismLinkID(char *ln,Tmechanism *m);
249 
261 Tjoint *GetMechanismJoint(unsigned int i,Tmechanism *m);
262 
277 boolean AllRevolute(Tmechanism *m);
278 
292 void PlotMechanism(Tplot3d *pt,double axesLength,Tmechanism *m);
293 
294 
316  double *sol,Tmechanism *m);
317 
318 
337 
338 
350 
351 
364 void MechanismPrintAtoms(FILE *f,THTransform *tl,Tmechanism *m);
365 
376 void MechanismStoreRigidAtoms(FILE *f,THTransform *tl,Tmechanism *m);
377 
389  Tplot3d *pt,THTransform *tl,Tmechanism *m);
390 
403 void PrintMechanism(FILE *f,char *path,char *prefix,Tmechanism *m);
404 
412 void DeleteMechanism(Tmechanism *m);
413 
414 #endif
void RegenerateMechanismSolution(Tparameters *p, TCuikSystem *cs, double *sol, Tmechanism *m)
Computes the values for the non-system variables used to represent the rotation matrices for all link...
Definition: mechanism.c:242
signed int GetMechanismMobility(Tmechanism *m)
Computes the mobility of a given mechanism.
Definition: mechanism.c:73
Relation between two links.
Definition: joint.h:177
void PlotMechanism(Tplot3d *pt, double axesLength, Tmechanism *m)
Adds a mechanism to a 3d scene.
Definition: mechanism.c:209
void GetMechanismDOFsFromTransforms(Tparameters *p, THTransform *tl, double *dof, Tmechanism *m)
Extract the joint DOF values form the poses of all links.
Definition: mechanism.c:298
double GetMechanismMaxCoordinate(Tmechanism *m)
Returns the sum of the maximum coordinate value for all the links and joints in the mechanism...
Definition: mechanism.c:45
A homgeneous transform in R^3.
unsigned int GetMechanismNLinks(Tmechanism *m)
Gets the number of links of a mechanism.
Definition: mechanism.c:25
void DeleteMechanism(Tmechanism *m)
Destructor.
Definition: mechanism.c:441
double maxCoord
Definition: mechanism.h:58
Definition of the Tplot3d type and the associated functions.
boolean AllRevolute(Tmechanism *m)
TRUE if all joints are revolute joints.
Definition: mechanism.c:193
void InitMechanism(Tmechanism *m)
Constructor.
Definition: mechanism.c:16
unsigned int GetMechanismNJoints(Tmechanism *m)
Gets the number of joints of a mechanism.
Definition: mechanism.c:30
Tvector joints
Definition: mechanism.h:52
A mechanism description.
Definition: mechanism.h:51
unsigned int nbodies
Definition: mechanism.h:56
A polyhedron.
Definition: polyhedron.h:124
A 3D plot.
Definition: plot3d.h:54
Definition of the Tbox type and the associated functions.
void MechanismStoreRigidAtoms(FILE *f, THTransform *tl, Tmechanism *m)
Auxiliary function for WorldStoreRigidGroups.
Definition: mechanism.c:335
void RegenerateMechanismBox(Tparameters *p, TCuikSystem *cs, Tbox *b, Tmechanism *m)
Computes the values for the non-system variables.
Definition: mechanism.c:267
Definition of the Tjoint type and the associated functions.
void MoveMechanismFromTransforms(Tparameters *pr, Tplot3d *pt, THTransform *tl, Tmechanism *m)
Displaces a mechanism in a 3d scene.
Definition: mechanism.c:372
A table of parameters.
Definition of the TCuikSystem type and the associated functions.
void GetMechanismDefiningPoint(unsigned int lID, unsigned int bID, unsigned int pID, double *p, Tmechanism *m)
Gets a point from the mechanism.
Definition: mechanism.c:88
Tjoint * GetMechanismJoint(unsigned int i, Tmechanism *m)
Gets a joint given its identifier.
Definition: mechanism.c:182
A generic vector.
Definition: vector.h:227
boolean IsMechanismAllSpheres(Tmechanism *m)
TRUE if the mechanism is composed by spheres only.
Definition: mechanism.c:40
A box.
Definition: box.h:83
void PrintMechanism(FILE *f, char *path, char *prefix, Tmechanism *m)
Stores the mechanisms information into a file.
Definition: mechanism.c:414
A cuiksystem, i.e., a set of variables and equations defining a position analysis problem...
Definition: cuiksystem.h:181
Definition of the Tcolor type and the associated functions.
unsigned int AddLink2Mechanism(Tlink *l, Tmechanism *m)
Adds a link to a mechanism.
Definition: mechanism.c:94
Definition of the Tvector type and the associated functions.
unsigned int GetMechanismLinkID(char *ln, Tmechanism *m)
Gets a link identifier given its name.
Definition: mechanism.c:157
Tvector links
Definition: mechanism.h:53
Tlink * GetMechanismLink(unsigned int i, Tmechanism *m)
Gets a link given its identifier.
Definition: mechanism.c:146
unsigned int AddBody2Mechanism(unsigned int lID, Tpolyhedron *b, Tmechanism *m)
Adds a convex sub-part to a mechanism.
Definition: mechanism.c:127
boolean allSpheres
Definition: mechanism.h:57
unsigned int GetLinkID(char *name, Tmechanism *m)
Gets the identifier of a link given its name.
Definition: mechanism.c:50
unsigned int AddJoint2Mechanism(Tjoint *j, Tmechanism *m)
Adds a joint to a mechanism.
Definition: mechanism.c:111
void MechanismPrintAtoms(FILE *f, THTransform *tl, Tmechanism *m)
Prints the center of the atoms in a mechanism.
Definition: mechanism.c:320
unsigned int GetMechanismNBodies(Tmechanism *m)
Gets the number of convex sub-parts (or bodies) of a mechanism.
Definition: mechanism.c:35