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

The CuikSuite Project

joint.c File Reference

Implementaton of the function operating on Tjoint. More...

#include "joint.h"
#include "error.h"
#include "defines.h"
#include "geom.h"
#include "varnames.h"
#include <math.h>
#include <string.h>

Go to the source code of this file.

Functions

void NewFreeJoint (unsigned int id, unsigned int linkID1, Tlink *link1, unsigned int linkID2, Tlink *link2, Tjoint *j)
 Constructor.
void NewFixJoint (unsigned int id, unsigned int linkID1, Tlink *link1, unsigned int linkID2, Tlink *link2, THTransform *t, Tjoint *j)
 Constructor.
void NewRevoluteJoint (unsigned int id, unsigned int linkID1, Tlink *link1, unsigned int linkID2, Tlink *link2, double **points, boolean hasLimits, Tinterval *range, double **rPoints, boolean avoidLimits, double avoidLimitsWeight, Tjoint *j)
 Constructor.
void NewUniversalJoint (unsigned int id, unsigned int linkID1, Tlink *link1, unsigned int linkID2, Tlink *link2, double **points, boolean hasLimits, Tinterval *range1, Tinterval *range2, double **rPoints, boolean avoidLimits, double avoidLimitsWeight, Tjoint *j)
 Constructor.
void NewSphericalJoint (unsigned int id, unsigned int linkID1, Tlink *link1, unsigned int linkID2, Tlink *link2, double **points, boolean hasLimits, double range, double **rPoints, boolean avoidLimits, double avoidLimitsWeight, Tjoint *j)
 Constructor.
void NewPrismaticJoint (unsigned int id, unsigned int linkID1, Tlink *link1, unsigned int linkID2, Tlink *link2, double **points, Tinterval *range, boolean avoidLimits, double avoidLimitsWeight, Tjoint *j)
 Constructor.
void NewSphSphJoint (unsigned int id, unsigned int linkID1, Tlink *link1, unsigned int linkID2, Tlink *link2, double **points, double l, double r, Tcolor *color, Tjoint *j)
 Constructor.
void NewInPatchJoint (unsigned int id, unsigned int linkID1, Tlink *link1, unsigned int linkID2, Tlink *link2, double **points, double **patch, boolean avoidLimits, double avoidLimitsWeight, Tjoint *j)
 Constructor.
void CopyJoint (Tjoint *j_dst, Tjoint *j_src)
 Copy constructor.
unsigned int GetJointType (Tjoint *j)
 Gets the joint type.
unsigned int GetJointID (Tjoint *j)
 Gets the joint identifier.
unsigned int JointFromID (Tjoint *j)
 Gets the identifier of the first joint involved in the link.
TlinkJointFrom (Tjoint *j)
 Gets a pointer to the first joint involved in the link.
unsigned int JointToID (Tjoint *j)
 Gets the identifier of the second joint involved in the link.
TlinkJointTo (Tjoint *j)
 Gets a pointer to the second joint involved in the link.
void GetJointPoint (unsigned int link, unsigned int point, double *p, Tjoint *j)
 Gets one of the points defining the rotation/sliding axis for the joint.
boolean LimitedJoint (Tjoint *j)
 Checks if a joint has limits.
TintervalGetJointRange (Tjoint *j)
 Checks the limits of a joint.
TintervalGetJointSecondRange (Tjoint *j)
 Checks the second limit of a universal joint.
signed int GetJointDOF (Tjoint *j)
 Computes the degrees of freedom allowed by a given joint.
double GetJointLength (Tjoint *j)
 Returns the length of a spherical-spherical joint.
THTransformGetJointTransform (Tjoint *j)
 Returns the homogeneous transform defining a fix joint.
void GenerateJointRangeEquations (Tparameters *p, TCuikSystem *cs, Tjoint *j)
 Generate the constraints related with the joint limits.
void GenerateJointEquationsInBranch (double s, TCuikSystem *cs, Tequation *eq, Tjoint *j)
 Generate the constraints of a joint in a sequence.
void GenerateJointEquations (Tparameters *p, double maxCoord, TCuikSystem *cs, Tjoint *j)
 Generate the constraints related with the joint.
void RegenerateJointSolution (TCuikSystem *cs, double *sol, Tjoint *j)
 Computes the values for the dummy variables used in the joint equations.
double GetJointMaxCoordinate (Tjoint *j)
 Returns the maximum coordinate value for all the objects in the joint.
void PlotJoint (Tplot3d *pt, Tjoint *j)
 Adds a joint to a 3d scene.
void MoveJoint (Tplot3d *pt, TCuikSystem *cs, double *sol, double **r, Tjoint *j)
 Displaces a joint in a 3d scene.
void DeleteJoint (Tjoint *j)
 Destructor.

Detailed Description

Implementaton of the function operating on Tjoint.

See also:
Tjoint, joint.h.

Definition in file joint.c.


Function Documentation

void NewFreeJoint ( unsigned int  id,
unsigned int  linkID1,
Tlink link1,
unsigned int  linkID2,
Tlink link2,
Tjoint j 
)

Defines a free joint between links. A free joint is a dummy joint imposing no constraint between the relative movements of the links. It is used to see a different free flying mechanisms as a single mechanism. This basically simplify the structures we use (we don't have to implement a multi-mechanism stucture, for instance) and the generation of equations from the mechanism definition can be easily implemented with a single ground link.

Up to now we hardly used/tested this type of joints.

Parameters:
id Unique identifier given to the joint.
linkID1 Identifier of the first link to relate.
link1 Pointer to the first link to relate.
linkID2 Identifier of the second link to relate.
link2 Pointer to the first link to relate.
j The joint to initialize.

Definition at line 19 of file joint.c.

References Tjoint::avoidLimits, Tjoint::avoidLimitsWeight, Tjoint::color, Error(), FALSE, FREE_JOINT, Tjoint::hasLimits, HTransformIdentity(), Tjoint::id, INF, Tjoint::length, Tjoint::link, Tjoint::linkID, NewColor(), NewInterval(), NO_UINT, Tjoint::normals, Tjoint::obj3d, Tjoint::points, Tjoint::rad, Tjoint::range, Tjoint::range2, Tjoint::t, and Tjoint::trs.

Referenced by GenerateKinTree().

Here is the call graph for this function:

Here is the caller graph for this function:

void NewFixJoint ( unsigned int  id,
unsigned int  linkID1,
Tlink link1,
unsigned int  linkID2,
Tlink link2,
THTransform t,
Tjoint j 
)

Defines a fix joint between links. A fix joint fixes the relative translation and orientation between two links.

Fix joints are typically used when placing the end effector of a robot to compute its inverse kinematics.

Parameters:
id Unique identifier given to the joint.
linkID1 Identifier of the first link to relate.
link1 Pointer to the first link to relate.
linkID2 Identifier of the second link to relate.
link2 Pointer to the first link to relate.
t Homogeneous transform defining the relative position between the two links.
j The joint to initialize.

Definition at line 64 of file joint.c.

References Tjoint::avoidLimits, Tjoint::avoidLimitsWeight, Tjoint::color, Error(), FALSE, FIX_JOINT, Tjoint::hasLimits, HTransformCopy(), HTransformGetElement(), Tjoint::id, INF, Tjoint::length, Tjoint::link, Tjoint::linkID, NewColor(), NewInterval(), NO_UINT, Tjoint::normals, Tjoint::obj3d, Tjoint::points, Tjoint::rad, Tjoint::range, Tjoint::range2, Tjoint::t, and Tjoint::trs.

Here is the call graph for this function:

void NewRevoluteJoint ( unsigned int  id,
unsigned int  linkID1,
Tlink link1,
unsigned int  linkID2,
Tlink link2,
double **  points,
boolean  hasLimits,
Tinterval range,
double **  rPoints,
boolean  avoidLimits,
double  avoidLimitsWeight,
Tjoint j 
)

Defines a new revolute joint between two links.

Note that we assume centered rotations, that is, if there is any limit in the rotation it is always in the for of a symmetric interval [-range,range]. This is completely general (by defining appropriate reference vectors the rotation range can be made symmetric around 0 and it helps when defining constraints.

Parameters:
id Unique identifier given to the joint.
linkID1 Identifier of the first link to relate.
link1 Pointer to the first link to relate.
linkID2 Identifier of the second link to relate.
link2 Pointer to the first link to relate.
points Four points defining the rotation axis. The first two points define the rotation axis in the reference frame of link1 and the two other points are the same vector in the frame of reference of link2.
hasLimits TRUE if the joint to create include limits for the rotation movement.
range If hasLimits is TRUE, this is the valid range for the rotation (in radiants).
rPoints If hasLimits is TRUE, two points that define the reference position (i.e., the zero position) for the rotation. Actually points[0]->rPoints[0] define one vector in link1 and points[2]->rPoints[1] another vector in link2 that must coincide when the angle is 0. In other works, the angle between these vectors is the angle between the links and we only allow it to move from -range, to range.
The vector points[0]->rPoints[0] must be orthogonal to points[0]->points[1] and the same applies to points[2]->rPoints[1] and points[2]->points[3].
avoidLimits TRUE if the search process has to be focussed in the center of the valid ranges for the joint. This flag in only considered if hasLimits is true.
avoidLimitsWeight If avoidLimits is TRUE, this is the strength of the limit avoidance for this joint.
j The joint to initialize.

Definition at line 120 of file joint.c.

References Tjoint::avoidLimits, Tjoint::avoidLimitsWeight, Tjoint::color, CopyInterval(), Error(), FALSE, Tjoint::hasLimits, HTransformApply(), HTransformDelete(), HTransformIdentity(), HTransformInverse(), HTransformProduct(), HTransformRx(), HTransformX2Vect(), Tjoint::id, INF, IntervalCenter(), IntervalOffset(), Tjoint::length, Tjoint::link, Tjoint::linkID, NewColor(), NewInterval(), NO_UINT, Tjoint::normals, Tjoint::obj3d, Tjoint::points, Tjoint::rad, Tjoint::range, Tjoint::range2, REV_JOINT, Tjoint::t, Tjoint::trs, Tjoint::vrange, and ZERO.

Here is the call graph for this function:

void NewUniversalJoint ( unsigned int  id,
unsigned int  linkID1,
Tlink link1,
unsigned int  linkID2,
Tlink link2,
double **  points,
boolean  hasLimits,
Tinterval range1,
Tinterval range2,
double **  rPoints,
boolean  avoidLimits,
double  avoidLimitsWeight,
Tjoint j 
)

Defines a new universal joint between two links.

Parameters:
id Unique identifier given to the joint.
linkID1 Identifier of the first link to relate.
link1 Pointer to the first link to relate.
linkID2 Identifier of the second link to relate.
link2 Pointer to the first link to relate.
points Four points defining the two rotation axes. The first two points define the rotation axis in the reference frame of link1 and the second pair of points point is the same point in the frame of reference of link2. The constraint imposed by the universal joint forces these two vectors to be orthogonal when
hasLimits TRUE if the joint to create include limits.
range1 If hasLimits is TRUE, this is the valid range for the first rotation (in radiants).
range2 If hasLimits is TRUE, this is the valid range for the second rotation (in radiants).
rPoints points[0]->rPoints[0] define the vector in link1 that must coincide with vector points[2]->points[3] when the first rotation is zero.
points[2]->rPoints[1] define the vector in link2 that must coincide with vector points[0]->points[1] when the second rotation is zero.
avoidLimits TRUE if the search process has to be focussed in the center of the valid ranges for the joint. This flag in only considered if hasLimits is true.
avoidLimitsWeight If avoidLimits is TRUE, this is the strength of the limit avoidance for this joint.
j The joint to initialize.

Definition at line 250 of file joint.c.

References Tjoint::avoidLimits, Tjoint::avoidLimitsWeight, Tjoint::color, CopyInterval(), Error(), FALSE, Tjoint::hasLimits, HTransformApply(), HTransformDelete(), HTransformIdentity(), HTransformInverse(), HTransformProduct(), HTransformRx(), HTransformX2Vect(), Tjoint::id, INF, IntervalCenter(), IntervalOffset(), Tjoint::length, Tjoint::link, Tjoint::linkID, NewColor(), NewInterval(), NO_UINT, Tjoint::normals, Tjoint::obj3d, Tjoint::points, Tjoint::rad, Tjoint::range, Tjoint::range2, Tjoint::t, Tjoint::trs, UNV_JOINT, Tjoint::vrange, and ZERO.

Here is the call graph for this function:

void NewSphericalJoint ( unsigned int  id,
unsigned int  linkID1,
Tlink link1,
unsigned int  linkID2,
Tlink link2,
double **  points,
boolean  hasLimits,
double  range,
double **  rPoints,
boolean  avoidLimits,
double  avoidLimitsWeight,
Tjoint j 
)

Defines a new spherical joint between two links.

The limits for a spherical joint are defined symmetrically around an axis rigidly linked to the first link.

Parameters:
id Unique identifier given to the joint.
linkID1 Identifier of the first link to relate.
link1 Pointer to the first link to relate.
linkID2 Identifier of the second link to relate.
link2 Pointer to the first link to relate.
points Two points defining the rotation point. The first point define the rotation point in the reference frame of link1 and the second point is the same point in the frame of reference of link2.
hasLimits TRUE if the joint to create include limits.
range If hasLimits is TRUE, the valid value of rotation angle between the two links is [-range,range] .
rPoints points[0]->rPoints[0] and points[2]->rPoints[1] define the vectors in link1 and link2 respectively that must coincide when the angle between links is 0. In other works, the angle between these vectors is the angle between the links and we only allow it to move from -range, to range.
avoidLimits TRUE if the search process has to be focussed in the center of the valid ranges for the joint. This flag in only considered if hasLimits is true.
avoidLimitsWeight If avoidLimits is TRUE, this is the strength of the limit avoidance for this joint.
j The joint to initialize.

Definition at line 394 of file joint.c.

References Tjoint::avoidLimits, Tjoint::avoidLimitsWeight, Tjoint::color, Error(), FALSE, Tjoint::hasLimits, HTransformIdentity(), Tjoint::id, INF, Tjoint::length, Tjoint::link, Tjoint::linkID, NewColor(), NewInterval(), NO_UINT, Tjoint::obj3d, Tjoint::points, Tjoint::rad, Tjoint::range, Tjoint::range2, SPH_JOINT, Tjoint::t, Tjoint::trs, and Tjoint::vrange.

Here is the call graph for this function:

void NewPrismaticJoint ( unsigned int  id,
unsigned int  linkID1,
Tlink link1,
unsigned int  linkID2,
Tlink link2,
double **  points,
Tinterval range,
boolean  avoidLimits,
double  avoidLimitsWeight,
Tjoint j 
)

Defines a new prismatic joint between two links.

Note that prismatic joints are always limited.

Parameters:
id Unique identifier given to the joint.
linkID1 Identifier of the first link to relate.
link1 Pointer to the first link to relate.
linkID2 Identifier of the second link to relate.
link2 Pointer to the first link to relate.
points Four points defining the sliding axis. The first two points define the sliding axis in the reference frame of link1 and the two other points are the same vector in the frame of reference of link2.
range Valid range of values for the prismatic joint.
avoidLimits TRUE if the search process has to be focussed in the center of the valid ranges for the joint. This flag in only considered if hasLimits is true.
avoidLimitsWeight If avoidLimits is TRUE, this is the strength of the limit avoidance for this joint.
j The joint to intialize.

Definition at line 473 of file joint.c.

References Tjoint::avoidLimits, Tjoint::avoidLimitsWeight, Tjoint::color, CopyInterval(), Error(), Tjoint::hasLimits, HTransformIdentity(), Tjoint::id, INF, Tjoint::length, Tjoint::link, Tjoint::linkID, NewColor(), NewInterval(), NO_UINT, Tjoint::normals, Tjoint::obj3d, Tjoint::points, PRS_JOINT, Tjoint::rad, Tjoint::range, Tjoint::range2, Tjoint::t, Tjoint::trs, TRUE, and Tjoint::vrange.

Here is the call graph for this function:

void NewSphSphJoint ( unsigned int  id,
unsigned int  linkID1,
Tlink link1,
unsigned int  linkID2,
Tlink link2,
double **  points,
double  l,
double  r,
Tcolor color,
Tjoint j 
)

Defines a new spherical-spherical composite joint between two links.

Parameters:
id Unique identifier given to the joint.
linkID1 Identifier of the first link to relate.
link1 Pointer to the first link to relate.
linkID2 Identifier of the second link to relate.
link2 Pointer to the first link to relate.
points Two points defining the end points of the spherical-spherical joint. The first point in given in the first link and the second in the second link.
l Length of the spherical-spherical joint. Distance between the two extremes of the joint.
r Radius of the cylinder in between the extremes of the spherical-spherical joint.
color The color for the cylinder in between the extremes of the spherical-spherical joint.
j The joint to initialize.

Definition at line 536 of file joint.c.

References Tjoint::avoidLimits, Tjoint::color, CopyColor(), Error(), FALSE, Tjoint::hasLimits, HTransformIdentity(), Tjoint::id, INF, Tjoint::length, Tjoint::link, Tjoint::linkID, NewInterval(), NO_UINT, Tjoint::obj3d, Tjoint::points, Tjoint::rad, Tjoint::range, Tjoint::range2, SPH_SPH_JOINT, Tjoint::t, Tjoint::trs, and Tjoint::vrange.

Here is the call graph for this function:

void NewInPatchJoint ( unsigned int  id,
unsigned int  linkID1,
Tlink link1,
unsigned int  linkID2,
Tlink link2,
double **  points,
double **  patch,
boolean  avoidLimits,
double  avoidLimitsWeight,
Tjoint j 
)

Defines a new in-patch joint between two links. An in-patch joint is a generalization of a planar joint where the plane is replaced by a order one Bezier patch. This patch is defined by 4 points. When the four points are coplanar this joint is a planar joint.

This type of joints are basically used to define contact between links.

Parameters:
id Unique identifier given to the joint.
linkID1 Identifier of the first link to relate.
link1 Pointer to the first link to relate.
linkID2 Identifier of the second link to relate.
link2 Pointer to the first link to relate.
points A point and a normal vector on the first link. This joint forces the point to be in the patch and the normal vector to be aligned with that of the patch at the contact point.
patch Four points defining a first-order Bezier patch in the second link.
avoidLimits TRUE if the search process has to be focussed in the center of the valid ranges for the joint. This flag in only considered if hasLimits is true.
avoidLimitsWeight If avoidLimits is TRUE, this is the strength of the limit avoidance for this joint.
j The joint to initialize.

Definition at line 590 of file joint.c.

References Tjoint::avoidLimits, Tjoint::avoidLimitsWeight, ComputeBoundingBox3d(), CrossProduct(), DotProduct(), Error(), Tjoint::hasLimits, Tjoint::id, IN_PATCH_JOINT, IntervalAdd(), IntervalPow(), IntervalSqrt(), Tjoint::link, Tjoint::linkID, LowerLimit(), Tjoint::normals, Tjoint::normRange, Tjoint::points, Tjoint::t, TRUE, and ZERO.

Here is the call graph for this function:

void CopyJoint ( Tjoint j_dst,
Tjoint j_src 
)

Defines a joint structure copying data from anther joint.

Parameters:
j_dst The joint to create.
j_src The joint from where to copy.

Definition at line 698 of file joint.c.

References Tjoint::avoidLimits, Tjoint::avoidLimitsWeight, Tjoint::color, CopyColor(), CopyInterval(), Tjoint::hasLimits, HTransformCopy(), Tjoint::id, Tjoint::length, Tjoint::link, Tjoint::linkID, Tjoint::normals, Tjoint::normRange, Tjoint::obj3d, Tjoint::points, Tjoint::rad, Tjoint::range, Tjoint::range2, Tjoint::t, Tjoint::trs, and Tjoint::vrange.

Referenced by AddJoint2Mechanism().

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int GetJointType ( Tjoint j  ) 

Gets the joint type.

Parameters:
j The joint to query.
Returns:
The joint type.

Definition at line 747 of file joint.c.

References Tjoint::t.

Referenced by IsRevoluteBinaryLink().

Here is the caller graph for this function:

unsigned int GetJointID ( Tjoint j  ) 

Gets the joint identifier (given to the joint when created).

Parameters:
j The joint to query.
Returns:
The joint identifier.

Definition at line 752 of file joint.c.

References Tjoint::id.

unsigned int JointFromID ( Tjoint j  ) 

Gets the identifier of the first joint involved in the link.

Parameters:
j The joint to query.
Returns:
The identifier of the first joint involved in the link.

Definition at line 757 of file joint.c.

References Tjoint::linkID.

Referenced by Branch2Link(), GenerateKinTree(), GetBranchDestination(), GetBranchOrigin(), and IsRevoluteBinaryLink().

Here is the caller graph for this function:

Tlink* JointFrom ( Tjoint j  ) 

Gets a pointer to the first joint involved in the link.

Parameters:
j The joint to query.
Returns:
The pointer to the first joint involved in the link.

Definition at line 762 of file joint.c.

References Tjoint::link.

unsigned int JointToID ( Tjoint j  ) 

Gets the identifier of the second joint involved in the link.

Parameters:
j The joint to query.
Returns:
The identifier of the second joint involved in the link.

Definition at line 767 of file joint.c.

References Tjoint::linkID.

Referenced by Branch2Link(), GenerateKinTree(), GetBranchDestination(), GetBranchOrigin(), and IsRevoluteBinaryLink().

Here is the caller graph for this function:

Tlink* JointTo ( Tjoint j  ) 

Gets a pointer to the second joint involved in the link.

Parameters:
j The joint to query.
Returns:
The pointer to the second joint involved in the link.

Definition at line 772 of file joint.c.

References Tjoint::link.

void GetJointPoint ( unsigned int  link,
unsigned int  point,
double *  p,
Tjoint j 
)

Gets one of the points defining the rotation/sliding axis for the joint.

Parameters:
link 0 if we want to get the point in the first link reference frame and 1 if we want to get it in the frame of the second link.
point 0/1 according if we want to get the origin of the axis or the end.
p An array where to store the requested point.
j The joint to query.

Definition at line 777 of file joint.c.

References Tjoint::points.

Referenced by IsRevoluteBinaryLink().

Here is the caller graph for this function:

boolean LimitedJoint ( Tjoint j  ) 

Checks if a joint has limits.

Parameters:
j The joint to query.
Returns:
TRUE if there joint jas limits.

Definition at line 787 of file joint.c.

References Tjoint::hasLimits.

Tinterval* GetJointRange ( Tjoint j  ) 

Checks the limits of a joint.

Parameters:
j The joint to query.
Returns:
A pointer to the interval with the limits of the joint. For joints with no limits, this interval will be non-meaningful.

Definition at line 792 of file joint.c.

References Tjoint::range.

Tinterval* GetJointSecondRange ( Tjoint j  ) 

Checks the second limit of a universal joint.

Only universal joints have a second range.

Parameters:
j The joint to query.
Returns:
A pointer to the interval with the limits of the joint. For joints with no limits, this interval will be non-meaningful.

Definition at line 797 of file joint.c.

References Tjoint::range2.

signed int GetJointDOF ( Tjoint j  ) 

Computes the degrees of freedom allowed by a given joint. The degrees of freedom constrained by the joint are 6-the allowed ones (i.e., the returned by this function.

Parameters:
j The joint to query.
Returns:
The degrees of freedom allowed by the joint.

Definition at line 802 of file joint.c.

References Error(), FIX_JOINT, FREE_JOINT, IN_PATCH_JOINT, PRS_JOINT, REV_JOINT, SPH_JOINT, SPH_SPH_JOINT, Tjoint::t, and UNV_JOINT.

Referenced by GetMechanismDOF().

Here is the call graph for this function:

Here is the caller graph for this function:

double GetJointLength ( Tjoint j  ) 

Returns the distance between the two spherical joints in a spherical-spherical joint.

For other types of joints this function triggers and error.

Parameters:
j The joint to query.
Returns:
The length of a spherical-spherical joint.

Definition at line 838 of file joint.c.

References Error(), Tjoint::length, SPH_SPH_JOINT, and Tjoint::t.

Here is the call graph for this function:

THTransform* GetJointTransform ( Tjoint j  ) 

Returns the homogeneous transform defining a fix joint.

For other types of joints this function triggers and error.

Parameters:
j The joint to query.
Returns:
A pointer to the homogeneous transform defining a fix joint.

Definition at line 846 of file joint.c.

References Error(), FIX_JOINT, Tjoint::t, and Tjoint::trs.

Here is the call graph for this function:

void GenerateJointRangeEquations ( Tparameters p,
TCuikSystem cs,
Tjoint j 
)

Adds to the given cuiksystem the variables and equations necessary to deal with the joint ranges. For prismatic joints this is one variable and its associated range. For revolute joints, we have to define two vectors one associted with link1 and the other link2 and define the scalar and vector products (this produces a third vector aligned with the rotation axis) to get the cosinus/sinus of the rotated angle that are then bounded given the range for the allowed rotation between the two links.

Parameters:
p A set of parameters. They include, for instance the dummification level.
cs The cuiksystem where to add the variables and equations.
j The joint from where to generate the variables and equations.

Definition at line 854 of file joint.c.

References AddCt2Monomial(), AddEquation2CS(), AddMonomial(), AddTerm2SearchCriterion(), AddVariable2CS(), AddVariable2Monomial(), ApplyLinkRot(), Tjoint::avoidLimits, Tjoint::avoidLimitsWeight, COS_VAR, COS_VAR_UNI, DeleteEquation(), DeleteInterval(), DeleteMonomial(), DeleteVariable(), EQU, Error(), FIX_JOINT, FREE_JOINT, FREE_JOINT_VAR, GenerateDotProductEquation(), GetCSVariableID(), GetLinkName(), Tjoint::hasLimits, Tjoint::id, IN_PATCH_JOINT, IN_PATCH_JOINT_CTRL_VAR, INF, InitEquation(), InitMonomial(), IntervalCenter(), IntervalCosinus(), IntervalSize(), IsGroundLink, Tjoint::link, Tjoint::linkID, NEW, NewInterval(), NewVariable(), NO_UINT, PRS_JOINT, PRS_JOINT_VAR, Tjoint::range, Tjoint::range2, ResetMonomial(), REV_JOINT, ROT_JOINT_VAR_REF, SECONDARY_VAR, SetEquationCmp(), SetEquationType(), SetEquationValue(), SetVariableInterval(), SPH_JOINT, SPH_JOINT_VAR_REF, SPH_SPH_JOINT, SYSTEM_EQ, SYSTEM_VAR, Tjoint::t, UNV_JOINT, UNV_JOINT_VAR, UNV_JOINT_VAR_REF, and Tjoint::vrange.

Referenced by InitWorldKinCS().

Here is the call graph for this function:

Here is the caller graph for this function:

void GenerateJointEquationsInBranch ( double  s,
TCuikSystem cs,
Tequation eq,
Tjoint j 
)

Adds to the given equations the constraints of a joint

Before using this method, the variables and equations for individual joints have to be generated (using GenerateJointEquations).

When considered in a sequence, joints define a sum of vectors taking from the origin of the frame of reference of one link to the origin of the frame of reference for the next link. When these sums are taken on a closed branch, we get the loop equations.

Since links and joints are defined in 3D, summing vectors defined on links and joints define 3 equations, one for X, one for Y, and another for Z.

Parameters:
s Orientation of the joint in the sequence (1 for positive and -1 for negative).
cs The cuiksystem where the joints are defined.
eq Three equations (X, Y, and Z) where to add the joint constraints.
j The joint from where to generate the variables and equations.

Definition at line 1090 of file joint.c.

References AddCt2Monomial(), AddMonomial(), AddVariable2Monomial(), ApplyLinkRot(), DeleteMonomial(), Error(), FIX_JOINT, FREE_JOINT, FREE_JOINT_VAR, GetCSVariableID(), GetLinkName(), Tjoint::id, IN_PATCH_JOINT, IN_PATCH_JOINT_CTRL_VAR, InitMonomial(), IsGroundLink, Tjoint::length, Tjoint::link, Tjoint::linkID, NEW, NO_UINT, Tjoint::normals, Tjoint::points, PRS_JOINT, PRS_JOINT_VAR, ResetMonomial(), REV_JOINT, SPH_JOINT, SPH_SPH_JOINT, SPH_SPH_JOINT_VAR, Tjoint::t, and UNV_JOINT.

Referenced by GenerateTransEquationsFromBranch().

Here is the call graph for this function:

Here is the caller graph for this function:

void GenerateJointEquations ( Tparameters p,
double  maxCoord,
TCuikSystem cs,
Tjoint j 
)

Adds to the given cuiksystem the variables and equations necessary to deal with the joint. Intutively, we have to add equations so that the revolute/sliding axis is the same as view from link1 and from link2.

Parameters:
p A set of parameters. They include, for instance the dummification level.
maxCoord The maximum value for the variables in the system.
cs The cuiksystem where to add the variables and equations.
j The joint from where to generate the variables and equations.

Definition at line 1199 of file joint.c.

References AddCt2Monomial(), AddEquation2CS(), AddMonomial(), AddVariable2CS(), AddVariable2Monomial(), ApplyLinkRot(), DeleteEquation(), DeleteInterval(), DeleteMonomial(), DeleteVariable(), DUMMY_VAR, EQU, Error(), FIX_JOINT, FREE_JOINT, FREE_JOINT_VAR, GenerateDotProductEquation(), GenerateNormEquation(), GenerateSaddleEquation(), GetLinkName(), HTransformGetElement(), Tjoint::id, IN_PATCH_JOINT, IN_PATCH_JOINT_CTRL_VAR, IN_PATCH_JOINT_SCALE_VAR, InitEquation(), InitMonomial(), IsGroundLink, Tjoint::link, Tjoint::linkID, NEW, NewInterval(), NewVariable(), NO_UINT, Tjoint::normals, Tjoint::normRange, Tjoint::points, PRS_JOINT, ResetMonomial(), REV_JOINT, SECONDARY_VAR, SetEquationCmp(), SetEquationType(), SetVariableInterval(), SPH_JOINT, SPH_SPH_JOINT, SPH_SPH_JOINT_VAR, SYSTEM_EQ, SYSTEM_VAR, Tjoint::t, Tjoint::trs, UNV_JOINT, and UNV_JOINT_VAR.

Referenced by InitWorldKinCS().

Here is the call graph for this function:

Here is the caller graph for this function:

void RegenerateJointSolution ( TCuikSystem cs,
double *  sol,
Tjoint j 
)

Solution points only include values for the system variables (and secondary). However, in some formulations, the frame joint equations use not only system/secondary variables, but dummy variable too. This function computes the values for the joint-related dummy variables form the non-dummy ones for a given joint.

Currently only the IN_PATCH_JOINT uses dummy variables but this can change in the future.

Parameters:
cs The cuik system on which the boxes are defiend. It is used to, given the name of the variables corresponding the reference frame of the given link, retrive its numerical identifiers, i.e., the number of range of the box to use to instantiate each variable.
sol The solution point with the values for the system variables. At the end of the function, this vector also has values for
j The joint.

Definition at line 1430 of file joint.c.

References GetCSVariableID(), GetLinkName(), Tjoint::id, IN_PATCH_JOINT, IN_PATCH_JOINT_CTRL_VAR, Tjoint::link, NEW, and Tjoint::t.

Referenced by RegenerateMechanismSolution().

Here is the call graph for this function:

Here is the caller graph for this function:

double GetJointMaxCoordinate ( Tjoint j  ) 

Returns the maximum coordinate value for all the objects in the joint.

Only spherical-spherical joints have an associated object. In this case the function returns the length of the link in between the two spherical joints. Otherwise this function returns 0.

Parameters:
j The joint to query.
Returns:
The the maximum coordinate value used in the joint.

Definition at line 1458 of file joint.c.

References Tjoint::length, LowerLimit(), PRS_JOINT, Tjoint::range, SPH_SPH_JOINT, Tjoint::t, and UpperLimit().

Referenced by AddJoint2Mechanism().

Here is the call graph for this function:

Here is the caller graph for this function:

void PlotJoint ( Tplot3d pt,
Tjoint j 
)

Adds a link to a 3d scene. Nothing is added for all joints but for spherical-spherical joints where we add a cylinder aligned with the X axis.

Parameters:
pt The 3d geometry where to add the link.
j The joint to add to the scene.

Definition at line 1483 of file joint.c.

References Close3dObject(), Tjoint::color, Tjoint::length, Tjoint::obj3d, PlotCylinder(), PlotSphere(), Tjoint::rad, SPH_SPH_JOINT, StartNew3dObject(), and Tjoint::t.

Referenced by PlotMechanism().

Here is the call graph for this function:

Here is the caller graph for this function:

void MoveJoint ( Tplot3d pt,
TCuikSystem cs,
double *  sol,
double **  r,
Tjoint j 
)

Displaces a joint previously added to a 3d scene.

Actually, only in the case of composite joints (spherical-spherical joints) there is an effect for this function.

Composite joints (spherical-spherical joints) generate a cylinder connecting the two spherical joints. This function moves this cylinder to the position given by the start-end points of the spherical-spherical joint extracted from the link definitions, the link translation equations, and the link rotation matrixes taken from the given solution point.

Note that the rotation around the principal axis of the cylinder does not matters, that is the effect of a spherical-spherical joint.

Parameters:
pt The 3d scene where the apply the displacement.
cs The cuik system on which the boxes are defiend. It is used to, given the name of the variables corresponding the reference frame of the given link, retrive its numerical identifiers, i.e., the number of range of the box to use to instantiate each variable.
sol The solution point. Only values for system variables are used.
r Array of 3-d vectors with the translation from the ground link to each link.
j The joint to move.

Definition at line 1501 of file joint.c.

References GetTransform2Link(), HTransformApply(), HTransformDelete(), HTransformX2Vect(), IsGroundLink, Tjoint::link, Tjoint::linkID, Move3dObject(), Tjoint::obj3d, Tjoint::points, SPH_SPH_JOINT, and Tjoint::t.

Referenced by MoveMechanism().

Here is the call graph for this function:

Here is the caller graph for this function:

void DeleteJoint ( Tjoint j  ) 

Deletes the information stored in a joint and frees the allocated memory.

Parameters:
j The joint to delete.

Definition at line 1545 of file joint.c.

References DeleteInterval(), HTransformDelete(), Tjoint::range, Tjoint::range2, and Tjoint::trs.

Referenced by DeleteMechanism(), and GenerateKinTree().

Here is the call graph for this function:

Here is the caller graph for this function: