chrono::ChBodyEasyMesh Class Reference

Description

Easy-to-use class for quick creation of rigid bodies with a triangle mesh shape, that has a REF csys distinct from the COG cys (this is helpful because in many cases the mesh might have an offset barycenter with respect to the reference that we want to use for the body) This class does automatically, at object creation:

  • a visualization shape is created and added, if visualization asset is desired
  • a collision shape is created and added, if collision is desired,
  • mass and moment of inertia is automatically set, according to the geometry (this requires the mesh to be closed, watertight, with proper triangle orientation) Note: this inherits the ChBodyAuxRef, that allow to have the barycenter (COG) and the body reference (REF) in two different positions. So the REF will remain unchanged, while the COG reference is moved to the computed barycenter of convex hull and its rotation is automatically aligned to the main inertia axes of the tensor of inertia.

#include <ChBodyEasy.h>

Inheritance diagram for chrono::ChBodyEasyMesh:
Collaboration diagram for chrono::ChBodyEasyMesh:

Public Member Functions

 ChBodyEasyMesh (const std::string filename, double mdensity, bool compute_mass=true, bool collide=false, double sphere_swept=0.001, bool visual_asset=true, ChMaterialSurface::ContactMethod contact_method=ChMaterialSurface::NSC, std::shared_ptr< collision::ChCollisionModel > collision_model=chrono_types::make_shared< collision::ChModelBullet >())
 Creates a ChBody plus adds an optional visualization shape and, optionally, a collision shape. More...
 
- Public Member Functions inherited from chrono::ChBodyAuxRef
 ChBodyAuxRef (ChMaterialSurface::ContactMethod contact_method=ChMaterialSurface::NSC)
 
 ChBodyAuxRef (std::shared_ptr< collision::ChCollisionModel > new_coll_model, ChMaterialSurface::ContactMethod contact_method=ChMaterialSurface::NSC)
 
 ChBodyAuxRef (const ChBodyAuxRef &other)
 
virtual ChBodyAuxRefClone () const override
 "Virtual" copy constructor (covariant return type).
 
void SetFrame_REF_to_abs (const ChFrame<> &mfra)
 Set the auxiliary reference frame with respect to the absolute frame. More...
 
virtual const ChFrameMovingGetFrame_REF_to_abs () const override
 Get the auxiliary reference frame with respect to the absolute frame. More...
 
void SetFrame_COG_to_REF (const ChFrame<> &mloc)
 Set the COG frame with respect to the auxiliary reference frame. More...
 
ChFrame GetFrame_COG_to_REF () const
 Get the COG frame with respect to the auxiliary reference frame.
 
void SetFrame_REF_to_COG (const ChFrame<> &mloc)
 Set the auxiliary reference frame with respect to the COG frame. More...
 
const ChFrameGetFrame_REF_to_COG () const
 Get the auxiliary reference frame with respect to the COG frame.
 
virtual void Update (bool update_assets=true) override
 Update all auxiliary data of the rigid body and of its children (markers, forces..)
 
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...
 
- Public Member Functions inherited from chrono::ChBody
 ChBody (ChMaterialSurface::ContactMethod contact_method=ChMaterialSurface::NSC)
 Build a rigid body.
 
 ChBody (std::shared_ptr< collision::ChCollisionModel > new_collision_model, ChMaterialSurface::ContactMethod contact_method=ChMaterialSurface::NSC)
 Build a rigid body with a different collision model.
 
 ChBody (const ChBody &other)
 
virtual ~ChBody ()
 Destructor.
 
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.
 
ChVariablesBodyOwnMassVariablesBody () override
 Returns reference to the encapsulated ChVariablesBody, representing body variables (pos, speed, or accel.) and forces. More...
 
ChVariablesVariables () override
 
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.
 
bool RecomputeCollisionModel ()
 Update the optimization structures (OOBB, ABB, etc.) of the collision model, from the associated geometry in some external object (es.CAD).
 
const ChCoordsysGetLastCollPos () const
 Gets the last position when the collision detection was performed last time (i.e. More...
 
void SynchronizeLastCollPos ()
 Stores the current position in the last-collision-position buffer.
 
virtual const ChFrameMovingGetFrame_COG_to_abs () const
 Get the rigid body coordinate system that represents the GOG (Center of Gravity). 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)
 
ChMaterialSurface::ContactMethod GetContactMethod () const
 Infer the contact method from the underlying material properties object.
 
std::shared_ptr< ChMaterialSurfaceNSCGetMaterialSurfaceNSC ()
 Access the NSC material surface properties associated with this body. More...
 
std::shared_ptr< ChMaterialSurfaceSMCGetMaterialSurfaceSMC ()
 Access the SMC material surface properties associated with this body. More...
 
void SetMaterialSurface (const std::shared_ptr< ChMaterialSurface > &mnewsurf)
 Set the material surface properties by passing a ChMaterialSurfaceNSC or ChMaterialSurfaceSMC object.
 
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<> &mpoint)
 
ChVector Dir_Body2World (const ChVector<> &mpoint)
 
ChVector RelPoint_AbsSpeed (const ChVector<> &mrelpoint)
 
ChVector RelPoint_AbsAcc (const ChVector<> &mrelpoint)
 
void SetMass (double newmass)
 Mass of the rigid body. More...
 
double GetMass ()
 
void SetInertia (const ChMatrix33<> &newXInertia)
 Set the inertia tensor of the body. More...
 
const ChMatrix33GetInertia ()
 Get a reference to the inertia tensor, expressed in local coordinate system. More...
 
void SetInertiaXX (const ChVector<> &iner)
 Set the diagonal part of the inertia tensor (Ixx, Iyy, Izz values). More...
 
ChVector GetInertiaXX ()
 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 ()
 Get the extra-diagonal part of the inertia tensor (Ixy, Ixz, Iyz values) Warning about sign: in some books they write the inertia tensor as I=[Ixx, -Ixy, -Ixz; etc. 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 Add_as_lagrangian_force (const ChVector<> &force, const ChVector<> &appl_point, bool local, ChVectorN< double, 7 > &mQf)
 Transform and adds a Cartesian force to a generic 7x1 vector of body lagrangian forces mQf . More...
 
void Add_as_lagrangian_torque (const ChVector<> &torque, bool local, ChVectorN< double, 7 > &mQf)
 
void Accumulate_force (const ChVector<> &force, const ChVector<> &appl_point, bool local)
 Add forces and torques into the "accumulators", as increment. More...
 
void Accumulate_torque (const ChVector<> &torque, bool local)
 
void Empty_forces_accumulators ()
 
const ChVectorGet_accumulated_force () const
 
const ChVectorGet_accumulated_torque () const
 
const ChVectorGet_Scr_force () const
 To get & set the 'script' force buffers(only accessed by external scripts, so It's up to the script to remember to set& reset them -link class just add them to all other forces. More...
 
const ChVectorGet_Scr_torque () const
 
void Set_Scr_force (const ChVector<> &mf)
 
void Set_Scr_torque (const ChVector<> &mf)
 
void Accumulate_script_force (const ChVector<> &force, const ChVector<> &appl_point, bool local)
 
void Accumulate_script_torque (const ChVector<> &torque, bool local)
 
const ChVectorGet_gyro () const
 Return the gyroscopic torque.
 
const ChVectorGet_Xforce () const
 Get the total force applied to the rigid body (applied at center of mass. More...
 
const ChVectorGet_Xtorque () const
 Get the total torque applied to the rigid body (expressed in body coordinates). 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 std::shared_ptr< ChMaterialSurface > & GetMaterialSurface () override
 Return the pointer to the surface material. 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 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 generic cartesian force into absolute force+torque applied to body COG. More...
 
void To_abs_torque (const ChVector<> &torque, bool local, ChVector<> &resulttorque)
 Transform generic cartesian torque into absolute torque applied to body COG. 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)
 
virtual void SetWacc_par (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.
 
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.
 
virtual bool operator== (const ChFrame< double > &other) const
 Returns true for identical frames.
 
virtual 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.
 
virtual void SetCoord (const ChCoordsys< double > &mcoord)
 Impose both translation and rotation as a single ChCoordsys. More...
 
virtual void SetCoord (const ChVector< double > &mv, const ChQuaternion< double > &mq)
 Impose both translation and rotation. More...
 
virtual void SetRot (const ChQuaternion< double > &mrot)
 Impose the rotation as a quaternion. More...
 
virtual void SetRot (const ChMatrix33< double > &mA)
 Impose the rotation as a 3x3 matrix. More...
 
virtual 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,.
 
virtual 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...
 
virtual 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...
 
virtual ChVector< double > TransformPointLocalToParent (const ChVector< double > &local) const
 
virtual ChVector< double > TransformParentToLocal (const ChVector< double > &parent) const
 This function transforms a point from the parent coordinate system to local frame coordinate system. More...
 
virtual 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...
 
virtual ChVector< double > TransformPointParentToLocal (const ChVector< double > &parent) const
 
virtual ChVector< double > TransformDirectionParentToLocal (const ChVector< double > &mdirection) const
 This function transforms a direction from 'this' local coordinate system to parent frame coordinate system. More...
 
virtual 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.
 

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
 
- Protected Attributes inherited from chrono::ChBody
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 COG (in absolute coords)
 
ChVector Xtorque
 torque acting on body (in body relative coords)
 
ChVector Force_acc
 force accumulator, applied to COG (in absolute coords)
 
ChVector Torque_acc
 torque accumulator (in abs space)
 
ChVector Scr_force
 script force accumulator, applied to COG (in absolute coords)
 
ChVector Scr_torque
 script torque accumulator (in absolute coords)
 
std::shared_ptr< ChMaterialSurfacematsurface
 data for surface contact and impact
 
ChCoordsys last_coll_pos
 cached position at last collision
 
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
 

Constructor & Destructor Documentation

◆ ChBodyEasyMesh()

chrono::ChBodyEasyMesh::ChBodyEasyMesh ( const std::string  filename,
double  mdensity,
bool  compute_mass = true,
bool  collide = false,
double  sphere_swept = 0.001,
bool  visual_asset = true,
ChMaterialSurface::ContactMethod  contact_method = ChMaterialSurface::NSC,
std::shared_ptr< collision::ChCollisionModel collision_model = chrono_types::make_shared<collision::ChModelBullet>() 
)

Creates a ChBody plus adds an optional visualization shape and, optionally, a collision shape.

Mass and inertia are set automatically depending on density.

Parameters
filename.OBJ mesh defined respect REF c.sys of body (initially REF=0,0,0 pos.)
mdensitydensity of the body
compute_massautomatic evaluation of the mass and inertia properties
collideenable the collision detection
sphere_sweptradius of 'inflating' of mesh, leads to more robust collision detection
visual_assetattach a visualization asset to the body
contact_methodcontact method
collision_modelcollision model

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