siconos.mechanics.joints#
Module documentation
- class siconos.mechanics.joints.nullDeleter(*args, **kwargs)[source]#
Bases:
object
- Using a shared_ptr to hold a pointer to a statically allocated
object use create<type>SPtr(<type> &x) cf http://www.boost.org/doc/
- class siconos.mechanics.joints.NewtonEulerJointR[source]#
Bases:
NewtonEulerR
This class implements an abstract Joint relation (articulation) between one or two Newton/Euler dynamical systems.
Empty constructor. The relation may be initialized later by setPoint, setAbsolute, and setBasePositions.
- setPoint(index, point)[source]#
Set a point for this joint. The role of each point is specific to the joint subclass. Won’t take effect until setBasePositions is called.
- Parameters:
index (int) – The index of the points.
point (
SiconosVector
) – A SiconosVector of size 3.
- point(index)[source]#
Get a point for this joint.
- Parameters:
index (int) – The index of the point.
- Return type:
SiconosVector
- Returns:
The requested point.
- points()[source]#
Get the vector of points for this joint.
- Return type:
VectorOfVectors
- Returns:
The vector of points.
- setAxis(index, axis)[source]#
Set an axis for this joint. The role of each axis is specific to the joint subclass. Won’t take effect until setBasePositions is called.
- Parameters:
index (int) – The index of the points.
axis (
SiconosVector
) – A SiconosVector of size 3.
- axis(index)[source]#
Get an axis for this joint.
- Parameters:
index (int) – The index of the point.
- Return type:
SiconosVector
- Returns:
The requested axis.
- axes()[source]#
Get the vector of axes for this joint.
- Return type:
VectorOfVectors
- Returns:
The vector of axes.
- setAbsolute(absoluteRef)[source]#
Set whether points and axes should be interpreted in absolute or relative frame. Won’t take effect until setBasePositions is called.
- Parameters:
absoluteRef (boolean) – true for absolute frame, false for relative frame.
- absolute()[source]#
Get whether points and axes are interpreted in absolute or relative frame.
- Return type:
boolean
- Returns:
True for absolute frame, false for relative frame.
- setBasePositions(*args)[source]#
Initialize the joint constants based on the provided base positions.
- Parameters:
q1 (
SiconosVector
) – A SiconosVector of size 7 indicating translation and orientation in inertial coordinates.q2 (
SiconosVector
, optional) – An optional SiconosVector of size 7 indicating translation and orientation; if null, the inertial frame will be considered as the second base.
- computehDoF(time, q0, y, axis=0)[source]#
Compute the vector of linear and angular positions of the free axes
- computeJachqDoF(time, inter, q0, jachq, axis=0)[source]#
Compute the jacobian of linear and angular DoF with respect to some q
- numberOfConstraints()[source]#
Get the number of constraints defined in the joint
- Return type:
- Returns:
the number of constraints
- class siconos.mechanics.joints.KneeJointR(*args)[source]#
Bases:
NewtonEulerJointR
This class implements a knee joint between one or two Newton/Euler Dynamical system
Overload 1: Empty constructor. The relation may be initialized later by setPoint, setAbsolute, and setBasePositions.
Overload 2: Constructor based on one or two dynamical systems and a point.
- Parameters:
d1 (
NewtonEulerDS
, optional) – first DynamicalSystem linked by the joint.d2 (
NewtonEulerDS
, optional) – second DynamicalSystem linked by the joint, or NULL for absolute frame.P (
SiconosVector
) – SiconosVector of size 3 that defines the point around which rotation is allowed.absoluteRef (boolean) – if true, P is in the absolute frame, otherwise P is in d1 frame.
Overload 3: Constructor based on one or two dynamical systems and a point.
- Parameters:
d1 (
NewtonEulerDS
, optional) – first DynamicalSystem linked by the joint.d2 – second DynamicalSystem linked by the joint, or NULL for absolute frame.
P (
SiconosVector
) – SiconosVector of size 3 that defines the point around which rotation is allowed.absoluteRef (boolean) – if true, P is in the absolute frame, otherwise P is in d1 frame.
Overload 4: Constructor based on one or two dynamical systems and a point.
- Parameters:
d1 – first DynamicalSystem linked by the joint.
d2 – second DynamicalSystem linked by the joint, or NULL for absolute frame.
P (
SiconosVector
) – SiconosVector of size 3 that defines the point around which rotation is allowed.absoluteRef (boolean) – if true, P is in the absolute frame, otherwise P is in d1 frame.
- initialize(inter)[source]#
initialize components specific to derived classes.
- Parameters:
inter (
Interaction
) – Interaction associated with the Relation
- setBasePositions(*args)[source]#
Initialize the joint constants based on the provided base positions.
- Parameters:
q1 (
SiconosVector
) – A SiconosVector of size 7 indicating translation and orientation in inertial coordinates.q2 (
SiconosVector
, optional) – An optional SiconosVector of size 7 indicating translation and orientation; if null, the inertial frame will be considered as the second base.
- numberOfConstraints()[source]#
Get the number of constraints defined in the joint
- Return type:
- Returns:
the number of constraints
- numberOfDoF()[source]#
Get the number of degrees of freedom defined in the joint
- Return type:
- Returns:
the number of degrees of freedom (DoF)
- typeOfDoF(axis)[source]#
Return the type of a degree of freedom of this joint.
- Return type:
- Returns:
the type of the degree of freedom (DoF)
- class siconos.mechanics.joints.PivotJointR(*args)[source]#
Bases:
KneeJointR
This class implements a pivots joint between one or two Newton/Euler Dynamical system. - Inherits from KneeJointR
- Overload 1:
Empty constructor. The relation may be initialized later by
setPoint, setAxis, setAbsolute, and setBasePositions.
- Overload 2:
Constructor based on one or two dynamical systems, a point and an axis.
- type d1:
NewtonEulerDS
, optional- param d1:
first DynamicalSystem linked by the joint.
- type d2:
NewtonEulerDS
, optional- param d2:
second DynamicalSystem linked by the joint, or NULL for absolute frame.
- type P:
SiconosVector
- param P:
SiconosVector of size 3 that defines the point around which rotation is allowed.
- type A:
SiconosVector
- param A:
SiconosVector of size 3 that defines the cylindrical axis.
- type absoluteRef:
boolean
- param absoluteRef:
if true, P and A are in the absolute frame, otherwise P and A are in d1 frame.
- Overload 3:
Constructor based on one or two dynamical systems, a point and an axis.
- type d1:
NewtonEulerDS
, optional- param d1:
first DynamicalSystem linked by the joint.
- param d2:
second DynamicalSystem linked by the joint, or NULL for absolute frame.
- type P:
SiconosVector
- param P:
SiconosVector of size 3 that defines the point around which rotation is allowed.
- type A:
SiconosVector
- param A:
SiconosVector of size 3 that defines the cylindrical axis.
- type absoluteRef:
boolean
- param absoluteRef:
if true, P and A are in the absolute frame, otherwise P and A are in d1 frame.
- Overload 4:
Constructor based on one or two dynamical systems, a point and an axis.
- param d1:
first DynamicalSystem linked by the joint.
- param d2:
second DynamicalSystem linked by the joint, or NULL for absolute frame.
- type P:
SiconosVector
- param P:
SiconosVector of size 3 that defines the point around which rotation is allowed.
- type A:
SiconosVector
- param A:
SiconosVector of size 3 that defines the cylindrical axis.
- type absoluteRef:
boolean
- param absoluteRef:
if true, P and A are in the absolute frame, otherwise P and A are in d1 frame.
- setBasePositions(*args)[source]#
Initialize the joint constants based on the provided base positions.
- Parameters:
q1 (
SiconosVector
) – A SiconosVector of size 7 indicating translation and orientation in inertial coordinates.q2 (
SiconosVector
, optional) – An optional SiconosVector of size 7 indicating translation and orientation; if null, the inertial frame will be considered as the second base.
- computeh(time, q0, y)[source]#
to compute the output y = h(t,q,z) of the Relation
- Parameters:
time (float) – current time value
q – coordinates of the dynamical systems involved in the relation
y (
SiconosVector
) – the resulting vector
- computehDoF(time, q0, y, axis)[source]#
Compute the vector of linear and angular positions of the free axes
- computeJachqDoF(time, inter, q0, jachq, axis)[source]#
Compute the jacobian of linear and angular DoF with respect to some q
- numberOfConstraints()[source]#
Get the number of constraints defined in the joint
- Return type:
- Returns:
the number of constraints
- class siconos.mechanics.joints.PrismaticJointR(*args)[source]#
Bases:
NewtonEulerJointR
This class implements a prismatic joint between one or two Newton/Euler Dynamical system
From a given axis, we construct two unit othorgonal vectors to the axis V1 and V2 such that (axis,V1,V2) is an orthogonal frame
Overload 1: Empty constructor. The relation may be initialized later by setPoint, setAbsolute, and setBasePositions.
Overload 2: Constructor based on one or two dynamical systems and an axis.
- Parameters:
d1 (
NewtonEulerDS
, optional) – first DynamicalSystem linked by the joint.d2 (
NewtonEulerDS
, optional) – second DynamicalSystem linked by the joint, or NULL for absolute frame.axis (
SiconosVector
) – SiconosVector of size 3 that defines the prismatic axis.absoluteRef (boolean) – if true, A is in the absolute frame, otherwise A is in d1 frame.
Overload 3: Constructor based on one or two dynamical systems and an axis.
- Parameters:
d1 (
NewtonEulerDS
, optional) – first DynamicalSystem linked by the joint.d2 – second DynamicalSystem linked by the joint, or NULL for absolute frame.
axis (
SiconosVector
) – SiconosVector of size 3 that defines the prismatic axis.absoluteRef (boolean) – if true, A is in the absolute frame, otherwise A is in d1 frame.
Overload 4: Constructor based on one or two dynamical systems and an axis.
- Parameters:
d1 – first DynamicalSystem linked by the joint.
d2 – second DynamicalSystem linked by the joint, or NULL for absolute frame.
axis (
SiconosVector
) – SiconosVector of size 3 that defines the prismatic axis.absoluteRef (boolean) – if true, A is in the absolute frame, otherwise A is in d1 frame.
- setBasePositions(*args)[source]#
Initialize the joint constants based on the provided base positions.
- Parameters:
q1 (
SiconosVector
) – A SiconosVector of size 7 indicating translation and orientation in inertial coordinates.q2 (
SiconosVector
, optional) – An optional SiconosVector of size 7 indicating translation and orientation; if null, the inertial frame will be considered as the second base.
- computehDoF(time, q0, y, axis)[source]#
Compute the vector of linear and angular positions of the free axes
- computeJachqDoF(time, inter, q0, jachq, axis)[source]#
Compute the jacobian of linear and angular DoF with respect to some q
- computeJachq(time, inter, q0)[source]#
compute the jacobian of h w.r.t. q
- Parameters:
time (float) – current time
inter (
Interaction
) – the interaction using this relationq0 (
BlockVector
) – the container of the block vector to the dynamical system
- computeh(time, q0, y)[source]#
to compute the output y = h(t,q,z) of the Relation
- Parameters:
time (float) – current time value
q – coordinates of the dynamical systems involved in the relation
y (
SiconosVector
) – the resulting vector
- numberOfConstraints()[source]#
Get the number of constraints defined in the joint
- Return type:
- Returns:
the number of constraints
- class siconos.mechanics.joints.FixedJointR(*args)[source]#
Bases:
NewtonEulerJointR
This class implements a fixed joint between one or two Newton/Euler Dynamical system
- Overload 1:
Empty constructor. The relation may be initialized later by
setBasePositions.
- Overload 2:
constructor,
- param a:
SP::NewtonEulerDS d1, a dynamical system containing the initial position
- param a:
SP::NewtonEulerDS d2, a dynamical system containing the initial position
- Overload 3:
constructor,
- param a:
SP::NewtonEulerDS d1, a dynamical system containing the initial position
- param a:
SP::NewtonEulerDS d2, a dynamical system containing the initial position
- setBasePositions(*args)[source]#
Initialize the joint constants based on the provided base positions.
- Parameters:
q1 (
SiconosVector
) – A SiconosVector of size 7 indicating translation and orientation in inertial coordinates.q2 (
SiconosVector
, optional) – An optional SiconosVector of size 7 indicating translation and orientation; if null, the inertial frame will be considered as the second base.
- numberOfConstraints()[source]#
Get the number of constraints defined in the joint
- Return type:
- Returns:
the number of constraints
- computeJachq(time, inter, q0)[source]#
compute the jacobian of h w.r.t. q
- Parameters:
time (float) – current time
inter (
Interaction
) – the interaction using this relationq0 (
BlockVector
) – the container of the block vector to the dynamical system
- computeh(time, q0, y)[source]#
to compute the output y = h(t,q,z) of the Relation
- Parameters:
time (float) – current time value
q – coordinates of the dynamical systems involved in the relation
y (
SiconosVector
) – the resulting vector
- class siconos.mechanics.joints.CylindricalJointR(*args)[source]#
Bases:
NewtonEulerJointR
This class implements a cylindrical joint between one or two Newton/Euler Dynamical system. It is similar to a PrismaticJointR but allows for rotation around the axis.
From a given axis, we construct two unit othorgonal vectors to the axis V1 and V2 such that (axis,V1,V2) is an orthogonal frame
Overload 1: Empty constructor. The relation may be initialized later by setPoint, setAbsolute, and setBasePositions.
Overload 2: Constructor based on one or two dynamical systems, a point and an axis.
- Parameters:
d1 (
NewtonEulerDS
, optional) – first DynamicalSystem linked by the joint.d2 (
NewtonEulerDS
, optional) – second DynamicalSystem linked by the joint, or NULL for absolute frame.P (
SiconosVector
) – SiconosVector of size 3 that defines the point around which rotation is allowed.A (
SiconosVector
) – SiconosVector of size 3 that defines the cylindrical axis.absoluteRef (boolean) – if true, P and A are in the absolute frame, otherwise P and A are in d1 frame.
Overload 3: Constructor based on one or two dynamical systems, a point and an axis.
- Parameters:
d1 (
NewtonEulerDS
, optional) – first DynamicalSystem linked by the joint.d2 – second DynamicalSystem linked by the joint, or NULL for absolute frame.
P (
SiconosVector
) – SiconosVector of size 3 that defines the point around which rotation is allowed.A (
SiconosVector
) – SiconosVector of size 3 that defines the cylindrical axis.absoluteRef (boolean) – if true, P and A are in the absolute frame, otherwise P and A are in d1 frame.
Overload 4: Constructor based on one or two dynamical systems, a point and an axis.
- Parameters:
d1 – first DynamicalSystem linked by the joint.
d2 – second DynamicalSystem linked by the joint, or NULL for absolute frame.
P (
SiconosVector
) – SiconosVector of size 3 that defines the point around which rotation is allowed.A (
SiconosVector
) – SiconosVector of size 3 that defines the cylindrical axis.absoluteRef (boolean) – if true, P and A are in the absolute frame, otherwise P and A are in d1 frame.
- setBasePositions(*args)[source]#
Initialize the joint constants based on the provided base positions.
- Parameters:
q1 (
SiconosVector
) – A SiconosVector of size 7 indicating translation and orientation in inertial coordinates.q2 (
SiconosVector
, optional) – An optional SiconosVector of size 7 indicating translation and orientation; if null, the inertial frame will be considered as the second base.
- computeJachq(time, inter, q0)[source]#
compute the jacobian of h w.r.t. q
- Parameters:
time (float) – current time
inter (
Interaction
) – the interaction using this relationq0 (
BlockVector
) – the container of the block vector to the dynamical system
- computeh(time, q0, y)[source]#
to compute the output y = h(t,q,z) of the Relation
- Parameters:
time (float) – current time value
q – coordinates of the dynamical systems involved in the relation
y (
SiconosVector
) – the resulting vector
- computehDoF(time, q0, y, axis)[source]#
Compute the vector of linear and angular positions of the free axes
- computeJachqDoF(time, inter, q0, jachq, axis)[source]#
Compute the jacobian of linear and angular DoF with respect to some q
- numberOfConstraints()[source]#
Get the number of constraints defined in the joint
- Return type:
- Returns:
the number of constraints
- class siconos.mechanics.joints.CouplerJointR(*args)[source]#
Bases:
NewtonEulerJointR
This class implements a coupling (equality) between two DoFs of any NewtonEulerJointR. Can be used e.g. to implement a screw relation (coupled rotation and translation) based on CylindricalJointR.
Overload 1: Empty constructor. The relation may be initialized later by setPoint, setAbsolute, and setBasePositions.
Overload 2: Initialize a coupler. See setReferences() for an explanation of the parameters.
Overload 3: Initialize a coupler. See setReferences() for an explanation of the parameters.
Overload 4: Initialize a coupler. See setReferences() for an explanation of the parameters.
Overload 5: Initialize a coupler. See setReferences() for an explanation of the parameters.
Overload 6: Initialize a coupler. See setReferences() for an explanation of the parameters.
Overload 7: Initialize a coupler. See setReferences() for an explanation of the parameters.
- makeBlockVectors(q1, q2, q01, q02)[source]#
An internal helper function to assign reference vectors during
computeh and computeJachq.
- computeh(time, q0, y)[source]#
to compute the output y = h(t,q,z) of the Relation
- Parameters:
time (float) – current time value
q – coordinates of the dynamical systems involved in the relation
y (
SiconosVector
) – the resulting vector
- computeJachq(time, inter, q0)[source]#
compute the jacobian of h w.r.t. q
- Parameters:
time (float) – current time
inter (
Interaction
) – the interaction using this relationq0 (
BlockVector
) – the container of the block vector to the dynamical system
- setReferences(*args)[source]#
Overload 1: Set reference joints and vectors. This constraint maintains the equality theta2=theta1*ratio; theta1 is measured by joint1 with reference to some vector ref1 which must replace either the first or second DS of the current relation being defined. If ref1 and ref2 are null, then no reference is used. Typically ref1 and ref2 will be equal in order to implement gear ratios for example. joint1 must be between ref1 and ds1 specified in setBasePositions(), while joint2 must be between ref2 and ds2.
- Parameters:
joint1 (
NewtonEulerJointR
) – The joint for the first reference measurement theta1.dof1 (int) – The degree of freedom index of joint1 to use for the first reference measurement theta1.
ref1 (
SiconosVector
) – The optional reference position for the first reference measurement theta1.ref1_index (int) – Must be 0 or 1, depending on where ref1 appears in joint1.
joint2 (
NewtonEulerJointR
) – The joint for the second reference measurement theta2.dof2 (int) – The degree of freedom index of joint2 to use for the second reference measurement theta2.
ref2 (
SiconosVector
) – The optional reference position for the second reference measurement theta2.ref2_index (int) – Must be 0 or 1, depending on where ref2 appears in joint2.
Overload 2: Set reference joints and vectors. This constraint maintains the equality theta2=theta1*ratio; theta1 is measured by joint1 with reference to some vector ref1 which must replace either the first or second DS of the current relation being defined. If ref1 and ref2 are null, then no reference is used. Typically ref1 and ref2 will be equal in order to implement gear ratios for example. joint1 must be between ref1 and ds1 specified in setBasePositions(), while joint2 must be between ref2 and ds2. This alternative setReferences() takes NewtonEulerDS as parameters, but the reference vectors will be taken as refds1->q() and refds2->q() respectively.
- Parameters:
joint1 (
NewtonEulerJointR
) – The joint for the first reference measurement theta1.dof1 (int) – The degree of freedom index of joint1 to use for the first reference measurement theta1.
refds1 (
NewtonEulerDS
) – The optional reference vector for the first reference measurement theta1.ref1_index (int) – Must be 0 or 1, depending on where ref1 appears in joint1.
joint2 (
NewtonEulerJointR
) – The joint for the second reference measurement theta2.dof2 (int) – The degree of freedom index of joint2 to use for the second reference measurement theta2.
refds2 (
NewtonEulerDS
) – The optional reference vector for the second reference measurement theta2.ref2_index (int) – Must be 0 or 1, depending on where ref2 appears in joint2.
- setBasePositions(*args)[source]#
Initialize the joint constants based on the provided base positions.
- Parameters:
q1 (
SiconosVector
) – A SiconosVector of size 7 indicating translation and orientation in inertial coordinates.q2 (
SiconosVector
, optional) – An optional SiconosVector of size 7 indicating translation and orientation; if null, the inertial frame will be considered as the second base.
- numberOfConstraints()[source]#
Get the number of constraints defined in the joint
- Return type:
- Returns:
the number of constraints
- numberOfDoF()[source]#
Get the number of degrees of freedom defined in the joint
- Return type:
- Returns:
the number of degrees of freedom (DoF)
- typeOfDoF(axis)[source]#
Return the type of a degree of freedom of this joint.
- Return type:
- Returns:
the type of the degree of freedom (DoF)
- class siconos.mechanics.joints.JointStopR(*args)[source]#
Bases:
NewtonEulerR
This class implements a stop on a DoF for any NewtonEulerJointR.
Overload 1: Initialize a joint stop for a common case: a single axis with a single stop, either positive or negative. For use with NewtonImpactNSL.
Overload 2: Initialize a joint stop for a common case: a single axis with a single stop, either positive or negative. For use with NewtonImpactNSL.
Overload 3: Initialize a multidimensional joint stop, e.g. the cone stop on a ball joint. For use with NewtonImpactFrictionNSL size 2 or 3.
- computeh(time, q0, y)[source]#
to compute the output y = h(t,q,z) of the Relation
- Parameters:
time (float) – current time value
q – coordinates of the dynamical systems involved in the relation
y (
SiconosVector
) – the resulting vector
- class siconos.mechanics.joints.JointFrictionR(*args)[source]#
Bases:
NewtonEulerR
This class implements a friction on a DoF for any NewtonEulerJointR.
Overload 1: Initialize a multidimensional joint friction, e.g. the cone friction on a ball joint. For use with NewtonImpactFrictionNSL size 2 or 3.
Overload 2: Initialize a multidimensional joint friction, e.g. the cone friction on a ball joint. For use with NewtonImpactFrictionNSL size 2 or 3.
- computeh(time, q0, y)[source]#
to compute the output y = h(t,q,z) of the Relation
- Parameters:
time (float) – current time value
q – coordinates of the dynamical systems involved in the relation
y (
SiconosVector
) – the resulting vector