Go to the documentation of this file.
52 #ifndef RBD_rigidBodyModel_H
53 #define RBD_rigidBodyModel_H
74 Ostream&
operator<<(Ostream&,
const rigidBodyModel&);
76 class rigidBodyModelState;
90 void initializeRootBody();
96 void makeComposite(
const label
bodyID);
208 const label parentID,
253 inline label
nDoF()
const;
259 inline const vector&
g()
const;
281 const label parentID,
294 const label parentID,
306 const label parentID,
virtual ~rigidBodyModel()
Destructor.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Holds the motion state of rigid-body model.
A class for handling words, derived from Foam::string.
spatialTransform X0(const label bodyId) const
Return the current transform to the global frame for the given body.
label nBodies() const
Return the number of bodies in the model (bodies().size())
bool merged(label bodyID) const
Return true if the body with given ID has been merged with a parent.
DynamicList< spatialVector > v_
The spatial velocity of the bodies.
DynamicList< tensor > Dinv_
Sub-expression (S^T.U)^-1 in the forward-dynamics algorithm.
PtrList< rigidBody > bodies_
List of the bodies.
const rigidBodyInertia & I(const label i) const
Return the inertia of body i.
friend Ostream & operator<<(Ostream &, const rigidBodyModel &)
rigidBodyModel(const Time &time)
Null-constructor which adds the single root-body at the origin.
label mergedBodyIndex(const label mergedBodyID) const
Return the index of the merged body in the mergedBody list.
Ostream & operator<<(Ostream &, const rigidBody &)
DynamicList< spatialVector > pA_
Articulated body bias force.
const spatialVector & v(const label i) const
Return the spatial velocity of the bodies.
const PtrList< joint > & joints() const
Return the list of joints in the model.
DynamicList< spatialTransform > X0_
Transform for external forces to the bodies reference frame.
DynamicList< compactSpatialTensor > S_
Motion subspace for joints with 3 degrees of freedom.
const spatialVector & a(const label i) const
Return the spatial acceleration of the bodies.
void forwardDynamicsCorrection(const rigidBodyModelState &state) const
Correct the velocity and acceleration of the bodies in the model.
DynamicList< label > lambda_
List of indices of the parent of each body.
const Time & time() const
Return the time.
label mergedBodyID(const label mergedBodyIndex) const
Return the merged body ID for the given merged body index.
DynamicList< spatialTensor > IA_
Velocity-product acceleration.
bool unitQuaternions_
True if any of the joints using quaternions.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
label master(label bodyID) const
Return the ID of the master body for a sub-body otherwise.
Basic rigid-body model representing a system of rigid-bodies connected by 1-6 DoF joints.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
DynamicList< spatialVector > S1_
Motion subspace for joints with 1 degrees of freedom.
PtrList< restraint > restraints_
Motion restraints.
label bodyID(const word &name) const
Return the ID of the body with the given name.
PtrList< joint > joints_
Each body it attached with a joint which are held on this list.
const DynamicList< label > & lambda() const
List of indices of the parent of each body.
const Time & time_
Reference to time database.
label nDoF_
The number of degrees of freedom of the model.
const word & name(const label bodyID) const
Return the name of body with the given ID.
void forwardDynamics(rigidBodyModelState &state, const scalarField &tau, const Field< spatialVector > &fx) const
Calculate the joint acceleration qDdot from the joint state q,.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
vector masterPoint(const label bodyID, const vector &p) const
vector g_
Acceleration due to gravity.
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.
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.
bool read(const dictionary &dict)
Read coefficients dictionary and update system parameters,.
DynamicList< spatialVector > a_
The spatial acceleration of the bodies.
bool unitQuaternions() const
Return true if any of the joints using quaternions.
DynamicList< spatialVector > c_
The velocity dependent spatial acceleration of the joints.
void applyRestraints(scalarField &tau, Field< spatialVector > &fx, const rigidBodyModelState &state) const
Apply the restraints and accumulate the internal joint forces.
TypeName("rigidBodyModel")
Runtime type information.
virtual void write(Ostream &) const
Write.
DynamicList< spatialTransform > XT_
Transform from the parent body frame to the joint frame.
const subBody & mergedBody(label mergedBodyID) const
Return the merged body for the given body ID.
const vector & g() const
Return the acceleration due to gravity.
DynamicList< spatialTransform > Xlambda_
Transform from the parent body to the current body.
DynamicList< vector > u_
Sub-expression tau - S^T.pA in the forward-dynamics algorithm.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
DynamicList< compactSpatialTensor > U_
Sub-expression IA.S in the forward-dynamics algorithm.
PtrList< subBody > mergedBodies_
Bodies may be merged into existing bodies, the inertia of which is.
label nDoF() const
Return the number of degrees of freedom of the model.
HashTable< label > bodyIDs_
Lookup-table of the IDs of the bodies.
PtrList< rigidBody > bodies() const
Return the list of the bodies in the model.
DynamicList< spatialVector > U1_
Sub-expression IA.S1 in the forward-dynamics algorithm.
label merge(const label parentID, const spatialTransform &X, autoPtr< rigidBody > bodyPtr)
Merge the given body with transform X into the parent with ID.