# File mechanics/src/joints/NewtonEulerJointR.hpp¶

Go to the source code of this file

class NewtonEulerJointR : public NewtonEulerR
#include <NewtonEulerJointR.hpp>

This class implements an abstract Joint relation (articulation) between one or two Newton/Euler dynamical systems.

Subclassed by CouplerJointR, CylindricalJointR, FixedJointR, KneeJointR, PrismaticJointR

Public Types

enum DoF_Type

Values:

DOF_TYPE_INVALID = 0
DOF_TYPE_LINEAR = 1
DOF_TYPE_ANGULAR = 2

Public Functions

NewtonEulerJointR()

Empty constructor.

The relation may be initialized later by setPoint, setAbsolute, and setBasePositions.

virtual ~NewtonEulerJointR()

destructor

bool absolute()

Get whether points and axes are interpreted in absolute or relative frame.

Return

True for absolute frame, false for relative frame.

bool allowSelfCollide()

Return the value of the _allowSelfCollide flag.

VectorOfVectors &axes()

Get the vector of axes for this joint.

Return

The vector of axes.

SP::SiconosVector axis(unsigned int index)

Get an axis for this joint.

Return

The requested axis.

Parameters
• index: The index of the point.

virtual void computehDoF(double time, BlockVector &q0, SiconosVector &y, unsigned int axis = 0)

Compute the vector of linear and angular positions of the free axes.

virtual void computeJachqDoF(double time, Interaction &inter, SP::BlockVector q0, SimpleMatrix &jachq, unsigned int axis = 0)

Compute the jacobian of linear and angular DoF with respect to some q.

void normalDoF(SiconosVector &ans, const BlockVector &q0, int axis, bool absoluteRef = true)

Retrieve a normal in the direction of a 0-indexed free axis.

Useful for calculating velocities in the axis, or for calculating axis-aligned forces applied to connected bodies. If axis is of angular type (see typeOfDoF), then the returned normal is the axis of rotation.

Parameters
• ans: The vector to receive the projection.

• q0: The state q of one or more NewtonEulerDS

• axis:

• absoluteRef: If true, ans is in the inertial frame, otherwise the q1 frame is assumed.

SP::SiconosVector normalDoF(const BlockVector &q0, int axis, bool absoluteRef = true)
virtual unsigned int numberOfConstraints() = 0

Get the number of constraints defined in the joint.

Return

the number of constraints

virtual unsigned int numberOfDoF() = 0

Return the number of degrees of freedom of this joint.

Return

the number of degrees of freedom (DoF)

SP::SiconosVector point(unsigned int index)

Get a point for this joint.

Return

The requested point.

Parameters
• index: The index of the point.

VectorOfVectors &points()

Get the vector of points for this joint.

Return

The vector of points.

void projectVectorDoF(const SiconosVector &v, const BlockVector &q0, SiconosVector &ans, int axis, bool absoluteRef = true)

Project a vector onto the given 0-indexed free axis.

Useful for calculating velocities in the axis, or for calculating axis-aligned forces applied to connected bodies. If axis is of angular type (see typeOfDoF), then the projection is onto the axis of rotation.

Parameters
• v: The vector to project

• q0: The state q of one or more NewtonEulerDS

• ans: The vector to receive the projection.

• absoluteRef: If true, v and ans are in the inertial frame, otherwise the q1 frame is assumed.

SP::SiconosVector projectVectorDoF(const SiconosVector &v, const BlockVector &q0, int axis, bool absoluteRef = true)
void setAbsolute(bool absoluteRef)

Set whether points and axes should be interpreted in absolute or relative frame.

Won’t take effect until setBasePositions is called.

Parameters
• absoluteRef: true for absolute frame, false for relative frame.

void setAllowSelfCollide(bool x)

Set the value of the _allowSelfCollide flag.

void setAxis(unsigned int index, SP::SiconosVector axis)

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: The index of the points.

• axis: A SiconosVector of size 3.

virtual void setBasePositions(SP::SiconosVector q1, SP::SiconosVector q2 = SP::SiconosVector()) = 0

Initialize the joint constants based on the provided base positions.

Parameters
• q1: A SiconosVector of size 7 indicating translation and orientation in inertial coordinates.

• q2: An optional SiconosVector of size 7 indicating translation and orientation; if null, the inertial frame will be considered as the second base.

void setPoint(unsigned int index, SP::SiconosVector point)

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: The index of the points.

• point: A SiconosVector of size 3.

virtual DoF_Type typeOfDoF(unsigned int axis) = 0

Return the type of a degree of freedom of this joint.

Return

the type of the degree of freedom (DoF)

Protected Functions

virtual void _normalDoF(SiconosVector &ans, const BlockVector &q0, int axis, bool absoluteRef = true)

Private version of normalDoF for subclasses to override.

ACCEPT_SERIALIZATION(NewtonEulerJointR)

serialization hooks

Protected Attributes

bool _absoluteRef

Defines whether points and axes are specified in absolute or relative frame.

bool _allowSelfCollide

A flag determining whether this joint should block “self-collision”, i.e., if true, bodies connected by this joint will not enter into unilateral contact.

VectorOfVectors _axes

Axes used to defined the joint constraint.

VectorOfVectors _points

Points used to defined the joint constraint.