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 (const ChBody &other)
 
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 SetCollide (bool state)
 Enable/disable the collision for this rigid body.
 
virtual bool GetCollide () const override
 Return true if collision is enabled for this body.
 
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. More...
 
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...
 
virtual bool IsActive () const override
 Return true if the body is currently active and thereofre included into the system solver. 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).
 
virtual void AddCollisionModelsToSystem (ChCollisionSystem *coll_sys) const override
 Add the body collision model (if any) to the provided collision system.
 
virtual void RemoveCollisionModelsFromSystem (ChCollisionSystem *coll_sys) const override
 Remove the body collision model (if any) from the provided collision system.
 
virtual void SyncCollisionModels () override
 Synchronize the position and bounding box of the body collision model (if any).
 
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 GetVisualModelFrame (unsigned int nclone=0) override
 Get the reference frame (expressed in and relative to the absolute frame) of the visual model. More...
 
virtual geometry::ChAABB GetTotalAABB () override
 Get the axis-aligned bounding (AABB) box of the object. More...
 
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 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. More...
 
void RemoveForce (std::shared_ptr< ChForce > aforce)
 Remove a specific force from this body. More...
 
void RemoveAllForces ()
 Remove all markers at once. More...
 
void RemoveAllMarkers ()
 Remove all markers at once. More...
 
std::shared_ptr< ChMarkerSearchMarker (const std::string &name) const
 Find a marker by its name.
 
std::shared_ptr< ChMarkerSearchMarker (int id) const
 Find a marker by its identifier.
 
std::shared_ptr< ChForceSearchForce (const std::string &name) const
 Find a force by its 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(). More...
 
void AddVisualModel (std::shared_ptr< ChVisualModel > model)
 Add an (optional) visualization model. More...
 
std::shared_ptr< ChVisualModelGetVisualModel () const
 Access the visualization model (if any). More...
 
void AddVisualShape (std::shared_ptr< ChVisualShape > shape, const ChFrame<> &frame=ChFrame<>())
 Add the specified visual shape to the visualization model. More...
 
std::shared_ptr< ChVisualShapeGetVisualShape (unsigned int i) const
 Access the specified visualization shape in the visualization model (if any). More...
 
void AddVisualShapeFEA (std::shared_ptr< ChVisualShapeFEA > shapeFEA)
 Add the specified FEA visualization object to the visualization model. More...
 
std::shared_ptr< ChVisualShapeFEAGetVisualShapeFEA (unsigned int i) const
 Access the specified FEA visualization object in the visualization model (if any). More...
 
virtual unsigned int GetNumVisualModelClones () const
 Return the number of clones of the visual model associated with this physics item. More...
 
void AddCamera (std::shared_ptr< ChCamera > camera)
 Attach a ChCamera to this physical item. More...
 
std::vector< std::shared_ptr< ChCamera > > GetCameras () const
 Get the set of cameras attached to this physics item.
 
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

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)
 
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::shared_ptr< ChVisualModelInstancevis_model_instance
 instantiated visualization model
 
std::vector< std::shared_ptr< ChCamera > > cameras
 set of cameras
 
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 modal::ChModalAssembly
 
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.

< pointer to the collision model

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.

◆ 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 with respect to this coordinate system, which is also assumed to be the default coordinates of the body. By default, a call to body.GetPos() is equivalent to body.GetFrame_COG_abs().GetPos().

◆ 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.

◆ GetTotalAABB()

geometry::ChAABB chrono::ChBody::GetTotalAABB ( )
overridevirtual

Get the axis-aligned bounding (AABB) box of the object.

The body AABB is the AABB of its collision model (if any).

Reimplemented from chrono::ChPhysicsItem.

◆ GetVisualModelFrame()

virtual ChFrame chrono::ChBody::GetVisualModelFrame ( unsigned int  nclone = 0)
inlineoverridevirtual

Get the reference frame (expressed in and relative to the absolute frame) of the visual model.

For a ChBody, this is the main coordinate system of the rigid body.

Reimplemented from chrono::ChPhysicsItem.

◆ IsActive()

bool chrono::ChBody::IsActive ( ) const
overridevirtual

Return true if the body is currently active and thereofre included into the system solver.

A body is inactive if it is fixed to ground or in sleep mode.

Reimplemented from chrono::ChPhysicsItem.

◆ RemoveAllForces()

void chrono::ChBody::RemoveAllForces ( )

Remove all markers at once.

Faster than doing multiple RemoveForce().

◆ RemoveAllMarkers()

void chrono::ChBody::RemoveAllMarkers ( )

Remove all markers at once.

Faster than doing multiple RemoveForce().

◆ RemoveForce()

void chrono::ChBody::RemoveForce ( std::shared_ptr< ChForce aforce)

Remove a specific force from this body.

Warning: linear time search.

◆ RemoveMarker()

void chrono::ChBody::RemoveMarker ( std::shared_ptr< ChMarker amarker)

Remove a specific marker from this body.

Warning: linear time search.

◆ SetBodyFixed()

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

Sets the 'fixed' state of the body.

If true, the body does not move with respect to the absolute reference frame.

◆ 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 (e.g., thin cylinders) might cause the integration to diverge quickly. The realism is limited, but the simulation is more stable.

◆ SetSleeping()

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

Force the body in sleeping mode or not.

Usually, this state change is handled internally.

◆ 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