49 #ifndef RBD_rigidBodyModel_H 50 #define RBD_rigidBodyModel_H 67 Ostream&
operator<<(Ostream&,
const rigidBodyModel&);
69 class rigidBodyModelState;
83 void initializeRootBody();
198 const label parentID,
246 inline const vector&
g()
const;
265 const label parentID,
278 const label parentID,
290 const label parentID,
Ostream & operator<<(Ostream &, const rigidBody &)
DynamicList< vector > u_
Sub-expression tau - S^T.pA in the forward-dynamics algorithm.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void forwardDynamics(rigidBodyModelState &state, const scalarField &tau, const Field< spatialVector > &fx) const
Calculate the joint acceleration qDdot from the joint state q,.
DynamicList< spatialTransform > X0_
Transform for external forces to the bodies reference frame.
friend Ostream & operator<<(Ostream &, const rigidBodyModel &)
A list of keyword definitions, which are a keyword followed by any number of values (e...
void applyRestraints(scalarField &tau, Field< spatialVector > &fx) const
Apply the restraints and accumulate the internal joint forces.
DynamicList< spatialVector > pA_
Articulated body bias force.
const subBody & mergedBody(label mergedBodyID) const
Return the merged body for the given body ID.
label bodyID(const word &name) const
Return the ID of the body with the given name.
label merge(const label parentID, const spatialTransform &X, autoPtr< rigidBody > bodyPtr)
Merge the given body with transform X into the parent with ID.
const DynamicList< label > & lambda() const
List of indices of the parent of each body.
bool merged(label bodyID) const
Return true if the body with given ID has been merged with a parent.
DynamicList< spatialTensor > IA_
Velocity-product acceleration.
bool unitQuaternions() const
Return true if any of the joints using quaternions.
vector masterPoint(const label bodyID, const vector &p) const
const PtrList< joint > & joints() const
Return the list of joints in the model.
label nBodies() const
Return the number of bodies in the model (bodies().size())
DynamicList< spatialVector > S1_
Motion subspace for joints with 1 degrees of freedom.
Holds the motion state of rigid-body model.
HashTable< label, word > bodyIDs_
Lookup-table of the IDs of the bodies.
PtrList< restraint > restraints_
Motion restraints.
label nDoF() const
Return the number of degrees of freedom of the model.
DynamicList< spatialVector > v_
The spatial velocity of the bodies.
DynamicList< tensor > Dinv_
Sub-expression (S^T.U)^-1 in the forward-dynamics algorithm.
PtrList< joint > joints_
Each body it attached with a joint which are held on this list.
PtrList< rigidBody > bodies_
List of the bodies.
const spatialVector & v(const label i) const
Return the spatial velocity of the bodies.
label mergedBodyIndex(const label mergedBodyID) const
Return the index of the merged body in the mergedBody list.
A class for handling words, derived from string.
spatialTransform X0(const label bodyId) const
Return the current transform to the global frame for the given body.
label nDoF_
The number of degrees of freedom of the model.
DynamicList< compactSpatialTensor > S_
Motion subspace for joints with 3 degrees of freedom.
bool read(const dictionary &dict)
Read coefficients dictionary and update system parameters,.
const vector & g() const
Return the acceleration due to gravity.
DynamicList< spatialTransform > XT_
Transform from the parent body frame to the joint frame.
PtrList< rigidBody > bodies() const
Return the list of the bodies in the model.
TypeName("rigidBodyModel")
Runtime type information.
DynamicList< spatialVector > c_
The velocity dependent spatial acceleration of the joints.
An STL-conforming hash table.
virtual label join(const label parentID, const spatialTransform &XT, autoPtr< joint > jointPtr, autoPtr< rigidBody > bodyPtr)
Join the given body to the parent with ID parentID via the given.
label master(label bodyID) const
Return the ID of the master body for a sub-body otherwise.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
virtual void write(Ostream &) const
Write.
DynamicList< spatialTransform > Xlambda_
Transform from the parent body to the current body.
DynamicList< label > lambda_
List of indices of the parent of each body.
DynamicList< compactSpatialTensor > U_
Sub-expression IA.S in the forward-dynamics algorithm.
bool unitQuaternions_
True if any of the joints using quaternions.
label mergedBodyID(const label mergedBodyIndex) const
Return the merged body ID for the given merged body index.
PtrList< subBody > mergedBodies_
Bodies may be merged into existing bodies, the inertia of which is.
DynamicList< spatialVector > U1_
Sub-expression IA.S1 in the forward-dynamics algorithm.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
const rigidBodyInertia & I(const label i) const
Return the inertia of body i.
virtual ~rigidBodyModel()
Destructor.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Basic rigid-body model representing a system of rigid-bodies connected by 1-6 DoF joints...
const word & name(const label bodyID) const
Return the name of body with the given ID.
rigidBodyModel()
Null-constructor which adds the single root-body at the origin.
void forwardDynamicsCorrection(const rigidBodyModelState &state) const
Correct the velocity and acceleration of the bodies in the model.
virtual label join_(const label parentID, const spatialTransform &XT, autoPtr< joint > jointPtr, autoPtr< rigidBody > bodyPtr)
Join the given body to the parent with ID parentID via the given.
vector g_
Acceleration due to gravity.
DynamicList< spatialVector > a_
The spatial acceleration of the bodies.