Description

Class for rigid bodies.

A rigid body is an entity which can move in 3D space, and can be constrained to other rigid bodies using ChLink objects. Rigid bodies can contain auxiliary references (the ChMarker objects) and forces (the ChForce objects). These objects have mass and inertia properties. A shape can also be associated to the body, for collision detection.

Further info at the Rigid bodies manual page.

#include <ChBody.h>

Inheritance diagram for chrono::ChBody:
Collaboration diagram for chrono::ChBody:

Public Member Functions

 ChBody (collision::ChCollisionSystemType collision_type=collision::ChCollisionSystemType::BULLET)
 Build a rigid body.
 
 ChBody (std::shared_ptr< collision::ChCollisionModel > new_collision_model)
 Build a rigid body with a different collision model.
 
 ChBody (const ChBody &other)
 
virtual ~ChBody ()
 Destructor.
 
virtual ChBodyClone () const override
 "Virtual" copy constructor (covariant return type).
 
void SetBodyFixed (bool state)
 Sets the 'fixed' state of the body. More...
 
bool GetBodyFixed () const
 Return true if this body is fixed to ground.
 
void SetEvalContactCn (bool state)
 If true, the normal restitution coefficient is evaluated from painted material channel.
 
bool GetEvalContactCn () const
 
void SetEvalContactCt (bool state)
 If true, the tangential restitution coefficient is evaluated from painted material channel.
 
bool GetEvalContactCt () const
 
void SetEvalContactKf (bool state)
 If true, the kinetic friction coefficient is evaluated from painted material channel.
 
bool GetEvalContactKf () const
 
void SetEvalContactSf (bool state)
 If true, the static friction coefficient is evaluated from painted material channel.
 
bool GetEvalContactSf () const
 
void SetCollide (bool state)
 Enable/disable the collision for this rigid body. More...
 
virtual bool GetCollide () const override
 Return true if collision is enabled for this body.
 
void SetShowCollisionMesh (bool state)
 Show collision mesh in 3D views.
 
bool GetShowCollisionMesh () const
 Return true if collision mesh is shown in 3D views.
 
void SetLimitSpeed (bool state)
 Enable the maximum linear speed limit (beyond this limit it will be clamped). More...
 
bool GetLimitSpeed () const
 Return true if maximum linear speed is limited.
 
void SetNoGyroTorque (bool state)
 Deactivate the gyroscopic torque (quadratic term). More...
 
bool GetNoGyroTorque () const
 Return true if gyroscopic torque is deactivated.
 
void SetUseSleeping (bool state)
 Enable/disable option for setting bodies to "sleep". More...
 
bool GetUseSleeping () const
 Return true if 'sleep' mode is activated.
 
void SetSleeping (bool state)
 Force the body in sleeping mode or not (usually this state change is not handled by users, anyway, because it is mostly automatic).
 
bool GetSleeping () const
 Return true if this body is currently in 'sleep' mode.
 
bool TrySleeping ()
 Test if a body could go in sleeping state if requirements are satisfied. More...
 
bool IsActive ()
 Return true if the body is active; i.e. More...
 
void SetId (int id)
 Set body id for indexing (internal use only)
 
unsigned int GetId ()
 Set body id for indexing (internal use only)
 
void SetGid (unsigned int id)
 Set global body index (internal use only)
 
unsigned int GetGid () const
 Get the global body index (internal use only)
 
virtual int GetDOF () override
 Number of coordinates of body: 7 because uses quaternions for rotation.
 
virtual int GetDOF_w () override
 Number of coordinates of body: 6 because derivatives use angular velocity.
 
virtual ChVariablesVariables () override
 Return a reference to the encapsulated ChVariablesBody, representing states (pos, speed, or accel.) and forces. More...
 
void SetNoSpeedNoAcceleration () override
 Set no speed and no accelerations (but does not change the position)
 
void SetCollisionModel (std::shared_ptr< collision::ChCollisionModel > new_collision_model)
 Change the collision model.
 
std::shared_ptr< collision::ChCollisionModelGetCollisionModel ()
 Access the collision model for the collision engine. More...
 
virtual void SyncCollisionModels () override
 Synchronize coll.model coordinate and bounding box to the position of the body.
 
virtual void AddCollisionModelsToSystem () override
 If this physical item contains one or more collision models, add them to the system's collision engine.
 
virtual void RemoveCollisionModelsFromSystem () override
 If this physical item contains one or more collision models, remove them from the system's collision engine.
 
virtual const ChFrameMovingGetFrame_COG_to_abs () const
 Get the rigid body coordinate system that represents the GOG (Center of Gravity). More...
 
virtual const ChFrameMovingGetFrame_REF_to_abs () const
 Get the rigid body coordinate system that is used for defining the collision shapes and the ChMarker objects. More...
 
virtual ChFrame GetAssetsFrame (unsigned int nclone=0) override
 Get the master coordinate system for the assets (this will return the main coordinate system of the rigid body)
 
virtual void GetTotalAABB (ChVector<> &bbmin, ChVector<> &bbmax) override
 Get the entire AABB axis-aligned bounding box of the object, as defined by the collision model (if any).
 
virtual void StreamINstate (ChStreamInBinary &mstream) override
 Method to deserialize only the state (position, speed)
 
virtual void StreamOUTstate (ChStreamOutBinary &mstream) override
 Method to serialize only the state (position, speed)
 
void SetDensity (float mdensity)
 The density of the rigid body, as [mass]/[unit volume]. More...
 
void AddMarker (std::shared_ptr< ChMarker > amarker)
 Attach a marker to this body.
 
void AddForce (std::shared_ptr< ChForce > aforce)
 Attach a force to this body.
 
void RemoveMarker (std::shared_ptr< ChMarker > amarker)
 Remove a specific marker from this body. Warning: linear time search.
 
void RemoveForce (std::shared_ptr< ChForce > aforce)
 Remove a specific force from this body. Warning: linear time search.
 
void RemoveAllForces ()
 Remove all markers at once. More...
 
void RemoveAllMarkers ()
 Remove all markers at once. More...
 
std::shared_ptr< ChMarkerSearchMarker (const char *m_name)
 Finds a marker from its ChObject name.
 
std::shared_ptr< ChForceSearchForce (const char *m_name)
 Finds a force from its ChObject name.
 
const std::vector< std::shared_ptr< ChMarker > > & GetMarkerList () const
 Gets the list of children markers. More...
 
const std::vector< std::shared_ptr< ChForce > > & GetForceList () const
 Gets the list of children forces. More...
 
ChVector Point_World2Body (const ChVector<> &mpoint)
 
ChVector Point_Body2World (const ChVector<> &mpoint)
 
ChVector Dir_World2Body (const ChVector<> &dir)
 
ChVector Dir_Body2World (const ChVector<> &dir)
 
ChVector RelPoint_AbsSpeed (const ChVector<> &mrelpoint)
 
ChVector RelPoint_AbsAcc (const ChVector<> &mrelpoint)
 
void SetMass (double newmass)
 Set the body mass. More...
 
double GetMass ()
 Get the body mass.
 
void SetInertia (const ChMatrix33<> &newXInertia)
 Set the inertia tensor of the body. More...
 
const ChMatrix33GetInertia () const
 Get the inertia tensor, expressed in the local coordinate system. More...
 
const ChMatrix33GetInvInertia () const
 Get the inverse of the inertia matrix.
 
void SetInertiaXX (const ChVector<> &iner)
 Set the diagonal part of the inertia tensor (Ixx, Iyy, Izz values). More...
 
ChVector GetInertiaXX () const
 Get the diagonal part of the inertia tensor (Ixx, Iyy, Izz values). More...
 
void SetInertiaXY (const ChVector<> &iner)
 Set the off-diagonal part of the inertia tensor (Ixy, Ixz, Iyz values). More...
 
ChVector GetInertiaXY () const
 Get the extra-diagonal part of the inertia tensor (Ixy, Ixz, Iyz values). More...
 
void SetMaxSpeed (float m_max_speed)
 Set the maximum linear speed (beyond this limit it will be clamped). More...
 
float GetMaxSpeed () const
 
void SetMaxWvel (float m_max_wvel)
 Set the maximum angular speed (beyond this limit it will be clamped). More...
 
float GetMaxWvel () const
 
void ClampSpeed ()
 Clamp the body speed to the provided limits. More...
 
void SetSleepTime (float m_t)
 Set the amount of time which must pass before going automatically in sleep mode when the body has very small movements.
 
float GetSleepTime () const
 
void SetSleepMinSpeed (float m_t)
 Set the max linear speed to be kept for 'sleep_time' before freezing.
 
float GetSleepMinSpeed () const
 
void SetSleepMinWvel (float m_t)
 Set the max linear speed to be kept for 'sleep_time' before freezing.
 
float GetSleepMinWvel () const
 
void ComputeQInertia (ChMatrix44<> &mQInertia)
 Computes the 4x4 inertia tensor in quaternion space, if needed.
 
void ComputeGyro ()
 Computes the gyroscopic torque. More...
 
void Accumulate_force (const ChVector<> &force, const ChVector<> &appl_point, bool local)
 Add an applied force to the body's accumulator (as an increment). More...
 
void Accumulate_torque (const ChVector<> &torque, bool local)
 Add an applied torque to the body's accumulator (as an increment). More...
 
void Empty_forces_accumulators ()
 Clear the force and torque accumulators.
 
const ChVectorGet_accumulated_force () const
 Return the current value of the accumulator force. More...
 
const ChVectorGet_accumulated_torque () const
 Return the current value of the accumulator torque. More...
 
void UpdateMarkers (double mytime)
 Update all children markers of the rigid body, at current body state.
 
void UpdateForces (double mytime)
 Update all children forces of the rigid body, at current body state.
 
void UpdateTime (double mytime)
 Update local time of rigid body, and time-dependent data.
 
virtual void Update (double mytime, bool update_assets=true) override
 Update all auxiliary data of the rigid body and of its children (markers, forces..), at given time.
 
virtual void Update (bool update_assets=true) override
 Update all auxiliary data of the rigid body and of its children (markers, forces..)
 
ChVector GetAppliedForce ()
 Return the resultant applied force on the body. More...
 
ChVector GetAppliedTorque ()
 Return the resultant applied torque on the body. More...
 
ChVector GetContactForce ()
 Get the resultant contact force acting on this body.
 
ChVector GetContactTorque ()
 Get the resultant contact torque acting on this body.
 
virtual ChPhysicsItemGetPhysicsItem () override
 This is only for backward compatibility.
 
virtual void ArchiveOUT (ChArchiveOut &marchive) override
 Method to allow serialization of transient data to archives.
 
virtual void ArchiveIN (ChArchiveIn &marchive) override
 Method to allow deserialization of transient data from archives. More...
 
virtual void LoadableGetVariables (std::vector< ChVariables * > &mvars) override
 Get the pointers to the contained ChVariables, appending to the mvars vector.
 
virtual void LoadableStateIncrement (const unsigned int off_x, ChState &x_new, const ChState &x, const unsigned int off_v, const ChStateDelta &Dv) override
 Increment all DOFs using a delta.
 
virtual void LoadableGetStateBlock_x (int block_offset, ChState &mD) override
 Gets all the DOFs packed in a single vector (position part)
 
virtual void LoadableGetStateBlock_w (int block_offset, ChStateDelta &mD) override
 Gets all the DOFs packed in a single vector (speed part)
 
virtual void ComputeNF (const double U, const double V, const double W, ChVectorDynamic<> &Qi, double &detJ, const ChVectorDynamic<> &F, ChVectorDynamic<> *state_x, ChVectorDynamic<> *state_w) override
 Evaluate Q=N'*F, for Q generalized lagrangian load, where N is some type of matrix evaluated at point P(U,V,W) assumed in absolute coordinates, and F is a load assumed in absolute coordinates. More...
 
- Public Member Functions inherited from chrono::ChPhysicsItem
 ChPhysicsItem (const ChPhysicsItem &other)
 
ChSystemGetSystem () const
 Get the pointer to the parent ChSystem()
 
virtual void SetSystem (ChSystem *m_system)
 Set the pointer to the parent ChSystem() and also add to new collision system / remove from old coll.system.
 
void AddAsset (std::shared_ptr< ChAsset > masset)
 Add an optional asset (it can be used to define visualization shapes, es ChSphereShape, or textures, or custom attached properties that the user can define by creating his class inherited from ChAsset)
 
std::vector< std::shared_ptr< ChAsset > > & GetAssets ()
 Access to the list of optional assets.
 
std::shared_ptr< ChAssetGetAssetN (unsigned int num)
 Access the Nth asset in the list of optional assets.
 
virtual unsigned int GetAssetsFrameNclones ()
 Optionally, a ChPhysicsItem can return multiple asset coordinate systems; this can be helpful if, for example, when a ChPhysicsItem contains 'clones' with the same assets (ex. More...
 
virtual void GetCenter (ChVector<> &mcenter)
 Get a symbolic 'center' of the object. More...
 
virtual void Setup ()
 This might recompute the number of coordinates, DOFs, constraints, in case this might change (ex in ChAssembly), as well as state offsets of contained items (ex in ChMesh)
 
virtual int GetDOC ()
 Get the number of scalar constraints, if any, in this item.
 
virtual int GetDOC_c ()
 Get the number of scalar constraints, if any, in this item (only bilateral constr.) Children classes might override this.
 
virtual int GetDOC_d ()
 Get the number of scalar constraints, if any, in this item (only unilateral constr.) Children classes might override this.
 
unsigned int GetOffset_x ()
 Get offset in the state vector (position part)
 
unsigned int GetOffset_w ()
 Get offset in the state vector (speed part)
 
unsigned int GetOffset_L ()
 Get offset in the lagrangian multipliers.
 
void SetOffset_x (const unsigned int moff)
 Set offset in the state vector (position part) Note: only the ChSystem::Setup function should use this.
 
void SetOffset_w (const unsigned int moff)
 Set offset in the state vector (speed part) Note: only the ChSystem::Setup function should use this.
 
void SetOffset_L (const unsigned int moff)
 Set offset in the lagrangian multipliers Note: only the ChSystem::Setup function should use this.
 
virtual void IntStateGatherReactions (const unsigned int off_L, ChVectorDynamic<> &L)
 From item's reaction forces to global reaction vector. More...
 
virtual void IntStateScatterReactions (const unsigned int off_L, const ChVectorDynamic<> &L)
 From global reaction vector to item's reaction forces. More...
 
virtual void IntLoadResidual_CqL (const unsigned int off_L, ChVectorDynamic<> &R, const ChVectorDynamic<> &L, const double c)
 Takes the term Cq'*L, scale and adds to R at given offset: R += c*Cq'*L. More...
 
virtual void IntLoadConstraint_C (const unsigned int off, ChVectorDynamic<> &Qc, const double c, bool do_clamp, double recovery_clamp)
 Takes the term C, scale and adds to Qc at given offset: Qc += c*C. More...
 
virtual void IntLoadConstraint_Ct (const unsigned int off, ChVectorDynamic<> &Qc, const double c)
 Takes the term Ct, scale and adds to Qc at given offset: Qc += c*Ct. More...
 
virtual void InjectConstraints (ChSystemDescriptor &mdescriptor)
 Tell to a system descriptor that there are constraints of type ChConstraint in this object (for further passing it to a solver) Basically does nothing, but maybe that inherited classes may specialize this.
 
virtual void ConstraintsBiReset ()
 Sets to zero the known term (b_i) of encapsulated ChConstraints.
 
virtual void ConstraintsBiLoad_C (double factor=1, double recovery_clamp=0.1, bool do_clamp=false)
 Adds the current C (constraint violation) to the known term (b_i) of encapsulated ChConstraints.
 
virtual void ConstraintsBiLoad_Ct (double factor=1)
 Adds the current Ct (partial t-derivative, as in C_dt=0-> [Cq]*q_dt=-Ct) to the known term (b_i) of encapsulated ChConstraints.
 
virtual void ConstraintsBiLoad_Qc (double factor=1)
 Adds the current Qc (the vector of C_dtdt=0 -> [Cq]*q_dtdt=Qc ) to the known term (b_i) of encapsulated ChConstraints.
 
virtual void ConstraintsFbLoadForces (double factor=1)
 Adds the current link-forces, if any, (caused by springs, etc.) to the 'fb' vectors of the ChVariables referenced by encapsulated ChConstraints.
 
virtual void ConstraintsLoadJacobians ()
 Adds the current jacobians in encapsulated ChConstraints.
 
virtual void ConstraintsFetch_react (double factor=1)
 Fetches the reactions from the lagrangian multiplier (l_i) of encapsulated ChConstraints. More...
 
virtual void InjectKRMmatrices (ChSystemDescriptor &mdescriptor)
 Tell to a system descriptor that there are items of type ChKblock in this object (for further passing it to a solver) Basically does nothing, but maybe that inherited classes may specialize this.
 
virtual void KRMmatricesLoad (double Kfactor, double Rfactor, double Mfactor)
 Adds the current stiffness K and damping R and mass M matrices in encapsulated ChKblock item(s), if any. More...
 
- Public Member Functions inherited from chrono::ChObj
 ChObj (const ChObj &other)
 
int GetIdentifier () const
 Gets the numerical identifier of the object.
 
void SetIdentifier (int id)
 Sets the numerical identifier of the object.
 
double GetChTime () const
 Gets the simulation time of this object.
 
void SetChTime (double m_time)
 Sets the simulation time of this object.
 
const char * GetName () const
 Gets the name of the object as C Ascii null-terminated string -for reading only!
 
void SetName (const char myname[])
 Sets the name of this object, as ascii string.
 
std::string GetNameString () const
 Gets the name of the object as C Ascii null-terminated string.
 
void SetNameString (const std::string &myname)
 Sets the name of this object, as std::string.
 
void MFlagsSetAllOFF (int &mflag)
 
void MFlagsSetAllON (int &mflag)
 
void MFlagSetON (int &mflag, int mask)
 
void MFlagSetOFF (int &mflag, int mask)
 
int MFlagGet (int &mflag, int mask)
 
virtual std::string & ArchiveContainerName ()
 
- Public Member Functions inherited from chrono::ChBodyFrame
 ChBodyFrame (const ChBodyFrame &other)
 
void To_abs_forcetorque (const ChVector<> &force, const ChVector<> &appl_point, bool local, ChVector<> &resultforce, ChVector<> &resulttorque)
 Transform a force applied at a point on the body into a force and moment applied to the COM and expressed in the absolute frame. More...
 
- Public Member Functions inherited from chrono::ChFrameMoving< double >
 ChFrameMoving (const ChVector< double > &mv=ChVector< double >(0, 0, 0), const ChQuaternion< double > &mq=ChQuaternion< double >(1, 0, 0, 0))
 Construct from pos and rot (as a quaternion)
 
 ChFrameMoving (const ChVector< double > &mv, const ChMatrix33< double > &ma)
 Construct from pos and rotation (as a 3x3 matrix)
 
 ChFrameMoving (const ChCoordsys< double > &mc)
 Construct from a coordsys.
 
 ChFrameMoving (const ChFrame< double > &mc)
 Construct from a frame.
 
 ChFrameMoving (const ChFrameMoving< double > &other)
 Copy constructor, build from another moving frame.
 
virtual ~ChFrameMoving ()
 Destructor.
 
ChFrameMoving< double > & operator= (const ChFrameMoving< double > &other)
 Assignment operator: copy from another moving frame.
 
ChFrameMoving< double > & operator= (const ChFrame< double > &other)
 Assignment operator: copy from another frame.
 
bool operator== (const ChFrameMoving< double > &other) const
 Returns true for identical frames.
 
bool operator!= (const ChFrameMoving< double > &other) const
 Returns true for different frames.
 
ChFrameMoving< double > operator>> (const ChFrameMoving< double > &Fb) const
 The '>>' operator transforms a coordinate system, so transformations can be represented with this syntax: new_frame = old_frame >> tr_frame; For a sequence of transformations, i.e. More...
 
ChFrameMoving< double > operator* (const ChFrameMoving< double > &Fb) const
 The '*' operator transforms a coordinate system, so transformations can be represented with this syntax: new_frame = tr_frame * old_frame; For a sequence of transformations, i.e. More...
 
ChFrameMoving< double > & operator>>= (const ChFrameMoving< double > &T)
 Performs pre-multiplication of this frame by another frame, for example: A>>=T means A'=T*A ; or A'=A >> T.
 
ChFrameMoving< double > & operator>>= (const ChVector< double > &D)
 Performs pre-multiplication of this frame by a vector D, to 'move' by a displacement D:
 
ChFrameMoving< double > & operator>>= (const ChQuaternion< double > &R)
 Performs pre-multiplication of this frame by a quaternion R, to 'rotate' it by R:
 
ChFrameMoving< double > & operator>>= (const ChCoordsys< double > &F)
 Performs pre-multiplication of this frame by a ChCoordsys F:
 
ChFrameMoving< double > & operator>>= (const ChFrame< double > &F)
 Performs pre-multiplication of this frame by a ChFrame F:
 
ChFrameMoving< double > & operator%= (const ChFrameMoving< double > &T)
 Performs pre-multiplication of this frame by another frame, for example: A%=T means A'=T*A ; or A'=A >> T Note: DEPRECATED, use >>= instead.
 
ChFrameMoving< double > & operator*= (const ChFrameMoving< double > &T)
 Performs post-multiplication of this frame by another frame, for example: A*=T means A'=A*T ; or A'=T >> A.
 
ChCoordsys< double > & GetCoord_dt ()
 Return both current rotation and translation speeds as a coordsystem object, with vector and quaternion.
 
const ChCoordsys< double > & GetCoord_dt () const
 
ChCoordsys< double > & GetCoord_dtdt ()
 Return both current rotation and translation accelerations as a coordsystem object, with vector and quaternion.
 
const ChCoordsys< double > & GetCoord_dtdt () const
 
ChVector< double > & GetPos_dt ()
 Return the current speed as a 3d vector.
 
const ChVector< double > & GetPos_dt () const
 
ChVector< double > & GetPos_dtdt ()
 Return the current acceleration as a 3d vector.
 
const ChVector< double > & GetPos_dtdt () const
 
ChQuaternion< double > & GetRot_dt ()
 Return the current rotation speed as a quaternion.
 
const ChQuaternion< double > & GetRot_dt () const
 
ChQuaternion< double > & GetRot_dtdt ()
 Return the current rotation acceleration as a quaternion.
 
const ChQuaternion< double > & GetRot_dtdt () const
 
ChVector< double > GetWvel_loc () const
 Computes the actual angular speed (expressed in local coords)
 
ChVector< double > GetWvel_par () const
 Computes the actual angular speed (expressed in parent coords)
 
ChVector< double > GetWacc_loc () const
 Computes the actual angular acceleration (expressed in local coords)
 
ChVector< double > GetWacc_par () const
 Computes the actual angular acceleration (expressed in parent coords)
 
virtual void SetCoord_dt (const ChCoordsys< double > &mcoord_dt)
 Set both linear speed and rotation speed as a single ChCoordsys derivative.
 
virtual void SetPos_dt (const ChVector< double > &mvel)
 Set the linear speed.
 
virtual void SetRot_dt (const ChQuaternion< double > &mrot_dt)
 Set the rotation speed as a quaternion. More...
 
virtual void SetWvel_loc (const ChVector< double > &wl)
 Set the rotation speed from given angular speed (expressed in local csys)
 
virtual void SetWvel_par (const ChVector< double > &wp)
 Set the rotation speed from given angular speed (expressed in parent csys)
 
virtual void SetCoord_dtdt (const ChCoordsys< double > &mcoord_dtdt)
 Set both linear acceleration and rotation acceleration as a single ChCoordsys derivative.
 
virtual void SetPos_dtdt (const ChVector< double > &macc)
 Set the linear acceleration.
 
virtual void SetRot_dtdt (const ChQuaternion< double > &mrot_dtdt)
 Set the rotation acceleration as a quaternion derivative. More...
 
virtual void SetWacc_loc (const ChVector< double > &al)
 Set the rotation acceleration from given angular acceleration (expressed in local csys) Note: even when the local angular acceleration is zero, you are still encouraged to call this method bacause q_dtdt might be nonzero due to nonzero q_dt in case of rotational motion.
 
virtual void SetWacc_par (const ChVector< double > &ap)
 Set the rotation speed from given angular speed (expressed in parent csys)
 
void Compute_Adt (ChMatrix33< double > &mA_dt) const
 Computes the time derivative of rotation matrix, mAdt.
 
void Compute_Adtdt (ChMatrix33< double > &mA_dtdt)
 Computes the 2nd time derivative of rotation matrix, mAdtdt.
 
ChMatrix33< double > GetA_dt ()
 Computes and returns an Adt matrix (-note: prefer using Compute_Adt() directly for better performance)
 
ChMatrix33< double > GetA_dtdt ()
 Computes and returns an Adt matrix (-note: prefer using Compute_Adtdt() directly for better performance)
 
void ConcatenatePreTransformation (const ChFrameMoving< double > &T)
 Apply a transformation (rotation and translation) represented by another ChFrameMoving T. More...
 
void ConcatenatePostTransformation (const ChFrameMoving< double > &T)
 Apply a transformation (rotation and translation) represented by another ChFrameMoving T in local coordinate. More...
 
ChVector< double > PointSpeedLocalToParent (const ChVector< double > &localpos) const
 Given the position of a point in local frame coords, and assuming it is sticky to frame, return the speed in parent coords.
 
ChVector< double > PointSpeedLocalToParent (const ChVector< double > &localpos, const ChVector< double > &localspeed) const
 Given the position localpos of a point in the local reference frame, assuming that the point moves in the local reference frame with localspeed, return the speed in the parent reference frame.
 
ChVector< double > PointAccelerationLocalToParent (const ChVector< double > &localpos) const
 Given the position of a point in local frame coords, and assuming it is sticky to frame, return the acceleration in parent coords. More...
 
ChVector< double > PointAccelerationLocalToParent (const ChVector< double > &localpos, const ChVector< double > &localspeed, const ChVector< double > &localacc) const
 Given the position of a point in local frame coords, and assuming it has a frame-relative speed localspeed and frame-relative acceleration localacc, return the acceleration in parent coords.
 
ChVector< double > PointSpeedParentToLocal (const ChVector< double > &parentpos, const ChVector< double > &parentspeed) const
 Given the position of a point in parent frame coords, and assuming it has an absolute speed parentspeed, return the speed in local coords.
 
ChVector< double > PointAccelerationParentToLocal (const ChVector< double > &parentpos, const ChVector< double > &parentspeed, const ChVector< double > &parentacc) const
 Given the position of a point in parent frame coords, and assuming it has an absolute speed parentspeed and absolute acceleration parentacc, return the acceleration in local coords.
 
void TransformLocalToParent (const ChFrameMoving< double > &local, ChFrameMoving< double > &parent) const
 This function transforms a frame from 'this' local coordinate system to parent frame coordinate system, and also transforms the speed and acceleration of the frame. More...
 
void TransformParentToLocal (const ChFrameMoving< double > &parent, ChFrameMoving< double > &local) const
 This function transforms a frame from the parent coordinate system to 'this' local frame coordinate system. More...
 
bool Equals (const ChFrameMoving< double > &other) const
 Returns true if coordsys is identical to other coordsys.
 
bool Equals (const ChFrameMoving< double > &other, double tol) const
 Returns true if coordsys is equal to other coordsys, within a tolerance 'tol'.
 
virtual void Invert () override
 The transformation (also for speeds, accelerations) is inverted in place. More...
 
ChFrameMoving< double > GetInverse () const
 
- Public Member Functions inherited from chrono::ChFrame< double >
 ChFrame (const ChVector< double > &mv=ChVector< double >(0, 0, 0), const ChQuaternion< double > &mq=ChQuaternion< double >(1, 0, 0, 0))
 Default constructor, or construct from pos and rot (as a quaternion)
 
 ChFrame (const ChVector< double > &mv, const ChMatrix33< double > &ma)
 Construct from pos and rotation (as a 3x3 matrix)
 
 ChFrame (const ChCoordsys< double > &mc)
 Construct from a coordsys.
 
 ChFrame (const ChVector< double > &mv, const double alpha, const ChVector< double > &mu)
 Construct from position mv and rotation of angle alpha around unit vector mu.
 
 ChFrame (const ChFrame< double > &other)
 Copy constructor, build from another frame.
 
ChFrame< double > & operator= (const ChFrame< double > &other)
 Assignment operator: copy from another frame.
 
bool operator== (const ChFrame< double > &other) const
 Returns true for identical frames.
 
bool operator!= (const ChFrame< double > &other) const
 Returns true for different frames.
 
ChFrame< double > operator>> (const ChFrame< double > &Fb) const
 The '>>' operator transforms a coordinate system, so transformations can be represented with this syntax: new_frame = old_frame >> tr_frame; For a sequence of transformations, i.e. More...
 
ChFrame< double > operator* (const ChFrame< double > &Fb) const
 The '>>' operator transforms a vector, so transformations can be represented with this syntax: new_v = old_v >> tr_frame; For a sequence of transformations, i.e. More...
 
ChVector< double > operator* (const ChVector< double > &V) const
 The '*' operator transforms a vector, so transformations can be represented with this syntax: new_v = tr_frame * old_v; For a sequence of transformations, i.e. More...
 
ChVector< double > operator/ (const ChVector< double > &V) const
 The '/' is like the '*' operator (see), but uses the inverse transformation for A, in A/b. More...
 
ChFrame< double > & operator>>= (const ChFrame< double > &T)
 Performs pre-multiplication of this frame by another frame, for example: A>>=T means A'=T*A ; or A'=A >> T.
 
ChFrame< double > & operator>>= (const ChVector< double > &D)
 Performs pre-multiplication of this frame by a vector D, to 'move' by a displacement D:
 
ChFrame< double > & operator>>= (const ChQuaternion< double > &R)
 Performs pre-multiplication of this frame by a quaternion R, to 'rotate' it by R:
 
ChFrame< double > & operator>>= (const ChCoordsys< double > &F)
 Performs pre-multiplication of this frame by a ChCoordsys F, to transform it:
 
ChFrame< double > & operator%= (const ChFrame< double > &T)
 Performs pre-multiplication of this frame by another frame, for example: A%=T means A'=T*A ; or A'=A >> T Note: DEPRECATED, use >>= instead.
 
ChFrame< double > & operator*= (const ChFrame< double > &T)
 Performs post-multiplication of this frame by another frame, for example: A*=T means A'=A*T ; or A'=T >> A.
 
ChCoordsys< double > & GetCoord ()
 Return both current rotation and translation as a coordsystem object, with vector and quaternion.
 
const ChCoordsys< double > & GetCoord () const
 
ChVector< double > & GetPos ()
 Return the current translation as a 3d vector.
 
const ChVector< double > & GetPos () const
 
ChQuaternion< double > & GetRot ()
 Return the current rotation as a quaternion.
 
const ChQuaternion< double > & GetRot () const
 
ChMatrix33< double > & GetA ()
 Return the current rotation as a 3x3 matrix.
 
const ChMatrix33< double > & GetA () const
 
ChVector< double > GetRotAxis ()
 Get axis of finite rotation, in parent space.
 
double GetRotAngle ()
 Get angle of rotation about axis of finite rotation.
 
void SetCoord (const ChCoordsys< double > &mcoord)
 Impose both translation and rotation as a single ChCoordsys. More...
 
void SetCoord (const ChVector< double > &mv, const ChQuaternion< double > &mq)
 Impose both translation and rotation. More...
 
void SetRot (const ChQuaternion< double > &mrot)
 Impose the rotation as a quaternion. More...
 
void SetRot (const ChMatrix33< double > &mA)
 Impose the rotation as a 3x3 matrix. More...
 
void SetPos (const ChVector< double > &mpos)
 Impose the translation.
 
void ConcatenatePreTransformation (const ChFrame< double > &T)
 Apply a transformation (rotation and translation) represented by another ChFrame T. More...
 
void ConcatenatePostTransformation (const ChFrame< double > &T)
 Apply a transformation (rotation and translation) represented by another ChFrame T in local coordinate. More...
 
void Move (const ChVector< double > &V)
 An easy way to move the frame by the amount specified by vector V, (assuming V expressed in parent coordinates)
 
void Move (const ChCoordsys< double > &VR)
 Apply both translation and rotation, assuming both expressed in parent coordinates, as a vector for translation and quaternion for rotation,.
 
ChVector< double > TransformLocalToParent (const ChVector< double > &local) const
 This function transforms a point from the local frame coordinate system to the parent coordinate system. More...
 
void TransformLocalToParent (const ChFrame< double > &local, ChFrame< double > &parent) const
 This function transforms a frame from 'this' local coordinate system to parent frame coordinate system. More...
 
ChVector< double > TransformPointLocalToParent (const ChVector< double > &local) const
 
ChVector< double > TransformParentToLocal (const ChVector< double > &parent) const
 This function transforms a point from the parent coordinate system to local frame coordinate system. More...
 
void TransformParentToLocal (const ChFrame< double > &parent, ChFrame< double > &local) const
 This function transforms a frame from the parent coordinate system to 'this' local frame coordinate system. More...
 
ChVector< double > TransformPointParentToLocal (const ChVector< double > &parent) const
 
ChVector< double > TransformDirectionParentToLocal (const ChVector< double > &mdirection) const
 This function transforms a direction from 'this' local coordinate system to parent frame coordinate system. More...
 
ChVector< double > TransformDirectionLocalToParent (const ChVector< double > &mdirection) const
 This function transforms a direction from the parent frame coordinate system to 'this' local coordinate system. More...
 
bool Equals (const ChFrame< double > &other) const
 Returns true if coordsys is identical to other coordsys.
 
bool Equals (const ChFrame< double > &other, double tol) const
 Returns true if coordsys is equal to other coordsys, within a tolerance 'tol'.
 
void Normalize ()
 Normalize the rotation, so that quaternion has unit length.
 
virtual void SetIdentity ()
 Sets to no translation and no rotation.
 
ChFrame< double > GetInverse () const
 
- Public Member Functions inherited from chrono::ChLoadableUVW
virtual bool IsTetrahedronIntegrationNeeded ()
 If true, use quadrature over u,v,w in [0..1] range as tetrahedron volumetric coords (with z=1-u-v-w) otherwise use default quadrature over u,v,w in [-1..+1] as box isoparametric coords.
 
virtual bool IsTrianglePrismIntegrationNeeded ()
 If true, use quadrature over u,v in [0..1] range as triangle natural coords (with z=1-u-v), and use linear quadrature over w in [-1..+1], otherwise use default quadrature over u,v,w in [-1..+1] as box isoparametric coords.
 

Protected Attributes

std::shared_ptr< collision::ChCollisionModelcollision_model
 pointer to the collision model
 
unsigned int body_id
 body-specific identifier, used for indexing (internal use only)
 
unsigned int body_gid
 body-specific identifier, used for global indexing (internal use only)
 
std::vector< std::shared_ptr< ChMarker > > marklist
 list of markers
 
std::vector< std::shared_ptr< ChForce > > forcelist
 list of forces
 
ChVector gyro
 gyroscopic torque, i.e. Qm = Wvel x (XInertia*Wvel)
 
ChVector Xforce
 force acting on body, applied to COM (in absolute coords)
 
ChVector Xtorque
 torque acting on body (in body local coords)
 
ChVector Force_acc
 force accumulator, applied to COM (in absolute coords)
 
ChVector Torque_acc
 torque accumulator (in body local coords)
 
float density
 used when doing the 'recompute mass' operation.
 
ChVariablesBodyOwnMass variables
 interface to solver (store inertia and coordinates)
 
float max_speed
 limit on linear speed
 
float max_wvel
 limit on angular velocity
 
float sleep_time
 
float sleep_minspeed
 
float sleep_minwvel
 
float sleep_starttime
 
- Protected Attributes inherited from chrono::ChPhysicsItem
ChSystemsystem
 parent system
 
std::vector< std::shared_ptr< ChAsset > > assets
 set of assets
 
unsigned int offset_x
 offset in vector of state (position part)
 
unsigned int offset_w
 offset in vector of state (speed part)
 
unsigned int offset_L
 offset in vector of lagrangian multipliers
 
- Protected Attributes inherited from chrono::ChObj
double ChTime
 the time of simulation for the object
 

Friends

class ChSystem
 
class ChSystemMulticore
 
class ChSystemMulticoreNSC
 
class ChAssembly
 
class ChConveyor
 

Additional Inherited Members

- Public Attributes inherited from chrono::ChFrameMoving< double >
ChCoordsys< double > coord_dt
 Rotation and position speed, as vector+quaternion.
 
ChCoordsys< double > coord_dtdt
 Rotation and position acceleration, as vector+quaternion.
 
- Public Attributes inherited from chrono::ChFrame< double >
ChCoordsys< double > coord
 Rotation and position, as vector+quaternion.
 
ChMatrix33< double > Amatrix
 3x3 orthogonal rotation matrix
 

Member Function Documentation

◆ Accumulate_force()

void chrono::ChBody::Accumulate_force ( const ChVector<> &  force,
const ChVector<> &  appl_point,
bool  local 
)

Add an applied force to the body's accumulator (as an increment).

It is the caller's responsibility to clear the force and torque accumulators at each integration step. If local = true, the provided applied force is assumed to be expressed in body coordinates. If local = false, the provided applied force is assumed to be expressed in absolute coordinates.

Parameters
forceapplied force
appl_pointapplication point
localforce and point expressed in body local frame?

◆ Accumulate_torque()

void chrono::ChBody::Accumulate_torque ( const ChVector<> &  torque,
bool  local 
)

Add an applied torque to the body's accumulator (as an increment).

It is the caller's responsibility to clear the force and torque accumulators at each integration step. If local = true, the provided applied torque is assumed to be expressed in body coordinates. If local = false, the provided applied torque is assumed to be expressed in absolute coordinates.

Parameters
torqueapplied torque
localtorque expressed in body local frame?

◆ ArchiveIN()

void chrono::ChBody::ArchiveIN ( ChArchiveIn marchive)
overridevirtual

Method to allow deserialization of transient data from archives.

Method to allow de serialization of transient data from archives.

Reimplemented from chrono::ChBodyFrame.

Reimplemented in chrono::ChBodyAuxRef.

◆ ClampSpeed()

void chrono::ChBody::ClampSpeed ( )

Clamp the body speed to the provided limits.

When this function is called, the speed of the body is clamped to the range specified by max_speed and max_wvel. Remember to put the body in the SetLimitSpeed(true) mode.

◆ ComputeGyro()

void chrono::ChBody::ComputeGyro ( )

Computes the gyroscopic torque.

In fact, in sake of highest speed, the gyroscopic torque isn't automatically updated each time a SetCoord() or SetCoord_dt() etc. is called, but only if necessary, for each UpdateState().

◆ ComputeNF()

void chrono::ChBody::ComputeNF ( const double  U,
const double  V,
const double  W,
ChVectorDynamic<> &  Qi,
double &  detJ,
const ChVectorDynamic<> &  F,
ChVectorDynamic<> *  state_x,
ChVectorDynamic<> *  state_w 
)
overridevirtual

Evaluate Q=N'*F, for Q generalized lagrangian load, where N is some type of matrix evaluated at point P(U,V,W) assumed in absolute coordinates, and F is a load assumed in absolute coordinates.

det[J] is unused.

Parameters
Ux coordinate of application point in absolute space
Vy coordinate of application point in absolute space
Wz coordinate of application point in absolute space
QiReturn result of N'*F here, maybe with offset block_offset
detJReturn det[J] here
FInput F vector, size is 6, it is {Force,Torque} in absolute coords.
state_xif != 0, update state (pos. part) to this, then evaluate Q
state_wif != 0, update state (speed part) to this, then evaluate Q

Implements chrono::ChLoadableUVW.

◆ Get_accumulated_force()

const ChVector& chrono::ChBody::Get_accumulated_force ( ) const
inline

Return the current value of the accumulator force.

Note that this is a resultant force as applied to the COM and expressed in the absolute frame.

◆ Get_accumulated_torque()

const ChVector& chrono::ChBody::Get_accumulated_torque ( ) const
inline

Return the current value of the accumulator torque.

Note that this is a resultant torque expressed in the body local frame.

◆ GetAppliedForce()

ChVector chrono::ChBody::GetAppliedForce ( )

Return the resultant applied force on the body.

This resultant force includes all external applied loads acting on this body (from gravity, loads, springs, etc). However, this does not include any constraint forces. In particular, contact forces are not included if using the NSC formulation, but are included when using the SMC formulation.

◆ GetAppliedTorque()

ChVector chrono::ChBody::GetAppliedTorque ( )

Return the resultant applied torque on the body.

This resultant torque includes all external applied loads acting on this body (from gravity, loads, springs, etc). However, this does not include any constraint forces. In particular, contact torques are not included if using the NSC formulation, but are included when using the SMC formulation.

◆ GetCollisionModel()

std::shared_ptr<collision::ChCollisionModel> chrono::ChBody::GetCollisionModel ( )
inline

Access the collision model for the collision engine.

To get a non-null pointer, remember to SetCollide(true), before.

◆ GetForceList()

const std::vector<std::shared_ptr<ChForce> >& chrono::ChBody::GetForceList ( ) const
inline

Gets the list of children forces.

NOTE: to modify this list, use the appropriate Remove.. and Add.. functions.

◆ GetFrame_COG_to_abs()

virtual const ChFrameMoving& chrono::ChBody::GetFrame_COG_to_abs ( ) const
inlinevirtual

Get the rigid body coordinate system that represents the GOG (Center of Gravity).

The mass and inertia tensor are defined respect to this coordinate system, that is also assumed the default main coordinates of the body. By default, doing mybody.GetPos() etc. is like mybody.GetFrame_COG_abs().GetPos() etc.

◆ GetFrame_REF_to_abs()

virtual const ChFrameMoving& chrono::ChBody::GetFrame_REF_to_abs ( ) const
inlinevirtual

Get the rigid body coordinate system that is used for defining the collision shapes and the ChMarker objects.

For the base ChBody, this is always the same reference of the COG.

Reimplemented in chrono::ChBodyAuxRef.

◆ GetInertia()

const ChMatrix33& chrono::ChBody::GetInertia ( ) const
inline

Get the inertia tensor, expressed in the local coordinate system.

The return 3x3 symmetric matrix contains the following values:

 [ int{y^2+z^2}dm    -int{xy}dm    -int{xz}dm    ]
 [                  int{x^2+z^2}   -int{yz}dm    ]
 [                                int{x^2+y^2}dm ]

◆ GetInertiaXX()

ChVector chrono::ChBody::GetInertiaXX ( ) const

Get the diagonal part of the inertia tensor (Ixx, Iyy, Izz values).

The return 3x1 vector contains the following values:

[  int{y^2+z^2}dm   int{x^2+z^2}   int{x^2+y^2}dm ]

◆ GetInertiaXY()

ChVector chrono::ChBody::GetInertiaXY ( ) const

Get the extra-diagonal part of the inertia tensor (Ixy, Ixz, Iyz values).

The return 3x1 vector contains the following values:

[ -int{xy}dm   -int{xz}dm   -int{yz}dm ]

◆ GetMarkerList()

const std::vector<std::shared_ptr<ChMarker> >& chrono::ChBody::GetMarkerList ( ) const
inline

Gets the list of children markers.

NOTE: to modify this list, use the appropriate Remove.. and Add.. functions.

◆ IsActive()

bool chrono::ChBody::IsActive ( )

Return true if the body is active; i.e.

it is neither fixed to ground nor is it in "sleep" mode. Return false otherwise.

◆ RemoveAllForces()

void chrono::ChBody::RemoveAllForces ( )

Remove all markers at once.

Faster than doing multiple RemoveForce() Don't care about deletion: it is automatic, only when needed.

◆ RemoveAllMarkers()

void chrono::ChBody::RemoveAllMarkers ( )

Remove all markers at once.

Faster than doing multiple RemoveForce() Don't care about deletion: it is automatic, only when needed.

◆ SetBodyFixed()

void chrono::ChBody::SetBodyFixed ( bool  state)

Sets the 'fixed' state of the body.

If true, it does not move respect to the absolute world, despite constraints, forces, etc.

◆ SetCollide()

void chrono::ChBody::SetCollide ( bool  state)

Enable/disable the collision for this rigid body.

before anim starts, if you added an external object that implements onAddCollisionGeometries(), ex. in a plug-in for a CAD)

◆ SetDensity()

void chrono::ChBody::SetDensity ( float  mdensity)
inline

The density of the rigid body, as [mass]/[unit volume].

Used just if the inertia tensor and mass are automatically recomputed from the geometry (in case a CAD plugin for example provides the surfaces.)

◆ SetInertia()

void chrono::ChBody::SetInertia ( const ChMatrix33<> &  newXInertia)

Set the inertia tensor of the body.

The provided 3x3 matrix should be symmetric and contain the inertia tensor, expressed in the local coordinate system:

              [ int{y^2+z^2}dm    -int{xy}dm    -int{xz}dm    ]
newXInertia = [                  int{x^2+z^2}   -int{yz}dm    ]
              [                                int{x^2+y^2}dm ]

◆ SetInertiaXX()

void chrono::ChBody::SetInertiaXX ( const ChVector<> &  iner)

Set the diagonal part of the inertia tensor (Ixx, Iyy, Izz values).

The provided 3x1 vector should contain the moments of inertia, expressed in the local coordinate frame:

iner = [  int{y^2+z^2}dm   int{x^2+z^2}   int{x^2+y^2}dm ]

◆ SetInertiaXY()

void chrono::ChBody::SetInertiaXY ( const ChVector<> &  iner)

Set the off-diagonal part of the inertia tensor (Ixy, Ixz, Iyz values).

The provided 3x1 vector should contain the products of inertia, expressed in the local coordinate frame:

iner = [ -int{xy}dm   -int{xz}dm   -int{yz}dm ]

◆ SetLimitSpeed()

void chrono::ChBody::SetLimitSpeed ( bool  state)

Enable the maximum linear speed limit (beyond this limit it will be clamped).

This is useful in virtual reality and real-time simulations, because it reduces the risk of bad collision detection. The realism is limited, but the simulation is more stable.

◆ SetMass()

void chrono::ChBody::SetMass ( double  newmass)
inline

Set the body mass.

Try not to mix bodies with too high/too low values of mass, for numerical stability.

◆ SetMaxSpeed()

void chrono::ChBody::SetMaxSpeed ( float  m_max_speed)
inline

Set the maximum linear speed (beyond this limit it will be clamped).

This is useful in virtual reality and real-time simulations, because it reduces the risk of bad collision detection. This speed limit is active only if you set SetLimitSpeed(true);

◆ SetMaxWvel()

void chrono::ChBody::SetMaxWvel ( float  m_max_wvel)
inline

Set the maximum angular speed (beyond this limit it will be clamped).

This is useful in virtual reality and real-time simulations, because it reduces the risk of bad collision detection. This speed limit is active only if you set SetLimitSpeed(true);

◆ SetNoGyroTorque()

void chrono::ChBody::SetNoGyroTorque ( bool  state)

Deactivate the gyroscopic torque (quadratic term).

This is useful in virtual reality and real-time simulations, where objects that spin too fast with non-uniform inertia tensors (ex thin cylinders) might cause the integration to diverge quickly. The realism is limited, but the simulation is more stable.

◆ SetUseSleeping()

void chrono::ChBody::SetUseSleeping ( bool  state)

Enable/disable option for setting bodies to "sleep".

If use sleeping = true, bodies which stay in same place for long enough time will be deactivated, for optimization. The realism is limited, but the simulation is faster.

◆ TrySleeping()

bool chrono::ChBody::TrySleeping ( )

Test if a body could go in sleeping state if requirements are satisfied.

Return true if state could be changed from no sleep to sleep.

◆ Variables()

virtual ChVariables& chrono::ChBody::Variables ( )
inlineoverridevirtual

Return a reference to the encapsulated ChVariablesBody, representing states (pos, speed, or accel.) and forces.

The ChVariablesBodyOwnMass is the interface to the system solver.

Implements chrono::ChBodyFrame.


The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono/physics/ChBody.h
  • /builds/uwsbel/chrono/src/chrono/physics/ChBody.cpp