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  boolean isTensegrity;
62 } Tmechanism;
63 
71 void InitMechanism(Tmechanism *m);
72 
82 unsigned int GetMechanismNLinks(Tmechanism *m);
83 
93 unsigned int GetMechanismNJoints(Tmechanism *m);
94 
105 unsigned int GetMechanismNBodies(Tmechanism *m);
106 
120 
136 
137 
155 signed int GetMechanismMobility(Tmechanism *m);
156 
171 void GetMechanismDefiningPoint(unsigned int lID,unsigned int bID,unsigned int pID,
172  double *p,Tmechanism *m);
173 
185 unsigned int AddLink2Mechanism(Tlink *l,Tmechanism *m);
186 
198 unsigned int AddJoint2Mechanism(Tjoint *j,Tmechanism *m);
199 
211 unsigned int AddBody2Mechanism(unsigned int lID,Tpolyhedron *b,Tmechanism *m);
212 
224 unsigned int GetLinkID(char *name,Tmechanism *m);
225 
237 Tlink *GetMechanismLink(unsigned int i,Tmechanism *m);
238 
250 unsigned int GetMechanismLinkID(char *ln,Tmechanism *m);
251 
263 Tjoint *GetMechanismJoint(unsigned int i,Tmechanism *m);
264 
279 boolean AllRevolute(Tmechanism *m);
280 
294 void PlotMechanism(Tplot3d *pt,double axesLength,Tmechanism *m);
295 
296 
318  double *sol,Tmechanism *m);
319 
320 
339 
340 
353  double *dof,Tmechanism *m);
354 
355 
368 void MechanismPrintAtoms(FILE *f,THTransform *tl,Tmechanism *m);
369 
380 void MechanismStoreRigidAtoms(FILE *f,THTransform *tl,Tmechanism *m);
381 
394  THTransform *tl,TLinkConf *def,
395  Tmechanism *m);
396 
409 void PrintMechanism(FILE *f,char *path,char *prefix,Tmechanism *m);
410 
418 void DeleteMechanism(Tmechanism *m);
419 
420 #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:230
signed int GetMechanismMobility(Tmechanism *m)
Computes the mobility of a given mechanism.
Definition: mechanism.c:74
Relation between two links.
Definition: joint.h:168
void PlotMechanism(Tplot3d *pt, double axesLength, Tmechanism *m)
Adds a mechanism to a 3d scene.
Definition: mechanism.c:212
double GetMechanismMaxCoordinate(Tmechanism *m)
Returns the sum of the maximum coordinate value for all the links and joints in the mechanism...
Definition: mechanism.c:46
A homgeneous transform in R^3.
unsigned int GetMechanismNLinks(Tmechanism *m)
Gets the number of links of a mechanism.
Definition: mechanism.c:26
void DeleteMechanism(Tmechanism *m)
Destructor.
Definition: mechanism.c:513
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:196
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:31
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:134
A 3D plot.
Definition: plot3d.h:54
void GetMechanismDOFsFromTransforms(Tparameters *p, THTransform *tl, TLinkConf *def, double *dof, Tmechanism *m)
Extract the joint DOF values form the poses of all links.
Definition: mechanism.c:286
Definition of the Tbox type and the associated functions.
boolean isTensegrity
Definition: mechanism.h:60
void MechanismStoreRigidAtoms(FILE *f, THTransform *tl, Tmechanism *m)
Auxiliary function for WorldStoreRigidGroups.
Definition: mechanism.c:354
void RegenerateMechanismBox(Tparameters *p, TCuikSystem *cs, Tbox *b, Tmechanism *m)
Computes the values for the non-system variables.
Definition: mechanism.c:255
Definition of the Tjoint type and the associated functions.
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:89
Tjoint * GetMechanismJoint(unsigned int i, Tmechanism *m)
Gets a joint given its identifier.
Definition: mechanism.c:185
A generic vector.
Definition: vector.h:227
boolean IsMechanismAllSpheres(Tmechanism *m)
TRUE if the mechanism is composed by spheres only.
Definition: mechanism.c:41
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:411
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:95
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:160
Tvector links
Definition: mechanism.h:53
Tlink * GetMechanismLink(unsigned int i, Tmechanism *m)
Gets a link given its identifier.
Definition: mechanism.c:149
unsigned int AddBody2Mechanism(unsigned int lID, Tpolyhedron *b, Tmechanism *m)
Adds a convex sub-part to a mechanism.
Definition: mechanism.c:130
boolean allSpheres
Definition: mechanism.h:57
void MoveMechanismFromTransforms(Tparameters *pr, Tplot3d *pt, THTransform *tl, TLinkConf *def, Tmechanism *m)
Displaces a mechanism in a 3d scene.
Definition: mechanism.c:391
unsigned int GetLinkID(char *name, Tmechanism *m)
Gets the identifier of a link given its name.
Definition: mechanism.c:51
unsigned int AddJoint2Mechanism(Tjoint *j, Tmechanism *m)
Adds a joint to a mechanism.
Definition: mechanism.c:113
void MechanismPrintAtoms(FILE *f, THTransform *tl, Tmechanism *m)
Prints the center of the atoms in a mechanism.
Definition: mechanism.c:339
unsigned int GetMechanismNBodies(Tmechanism *m)
Gets the number of convex sub-parts (or bodies) of a mechanism.
Definition: mechanism.c:36
Link configuration.
Definition: link.h:276