MULTIBODY SIMULATION SOFTWARE - API documentation
Public Member Functions | Protected Attributes
chrono::ChBody Class Reference

#include <CHbody.h>

Inheritance diagram for chrono::ChBody:
Inheritance graph
[legend]
Collaboration diagram for chrono::ChBody:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ChBody ()
 ~ChBody ()
void Copy (ChBody *source)
void SetBodyFixed (bool mev)
bool GetBodyFixed ()
void SetEvalContactCn (bool mev)
bool GetEvalContactCn ()
void SetEvalContactCt (bool mev)
bool GetEvalContactCt ()
void SetEvalContactKf (bool mev)
bool GetEvalContactKf ()
void SetEvalContactSf (bool mev)
bool GetEvalContactSf ()
void SetCollide (bool mcoll)
bool GetCollide ()
void SetShowCollisionMesh (bool mcoll)
bool GetShowCollisionMesh ()
void SetLimitSpeed (bool mlimit)
bool GetLimitSpeed ()
void SetUseSleeping (bool ms)
bool GetUseSleeping ()
void SetSleeping (bool ms)
bool GetSleeping ()
bool TrySleeping ()
bool IsActive ()
virtual int GetDOF ()
ChLcpVariablesBodyOwnMassVariables ()
void VariablesFbReset ()
void VariablesFbLoadForces (double factor=1.)
void VariablesQbLoadSpeed ()
void VariablesQbSetSpeed (double step=0.)
void VariablesQbIncrementPosition (double step)
virtual void InjectVariables (ChLcpSystemDescriptor &mdescriptor)
virtual ChCollisionModelInstanceCollisionModel ()
void SetNoSpeedNoAcceleration ()
ChCollisionModelGetCollisionModel ()
virtual void SyncCollisionModels ()
virtual void AddCollisionModelsToSystem ()
virtual void RemoveCollisionModelsFromSystem ()
int RecomputeCollisionModel ()
ChCoordsys GetLastCollPos ()
void SynchronizeLastCollPos ()
virtual ChFrameGetFrame_COG_to_abs ()
virtual ChFrameGetFrame_REF_to_abs ()
virtual void GetTotalAABB (ChVector<> &bbmin, ChVector<> &bbmax)
virtual void StreamINstate (ChStreamInBinary &mstream)
virtual void StreamOUTstate (ChStreamOutBinary &mstream)
ChSharedPtr< ChMaterialSurface > & GetMaterialSurface ()
void SetMaterialSurface (ChSharedPtr< ChMaterialSurface > &mnewsurf)
float GetImpactC ()
void SetImpactC (float mval)
float GetImpactCt ()
void SetImpactCt (float mval)
float GetKfriction ()
void SetKfriction (float mval)
float GetSfriction ()
void SetSfriction (float mval)
void SetFriction (float mval)
float GetRollingFriction ()
void SetRollingFriction (float mval)
float GetSpinningFriction ()
void SetSpinningFriction (float mval)
float GetDensity ()
void SetDensity (float mdensity)
float GetConductivity ()
void SetConductivity (float mconductivity)
ChVector GetCdim ()
void SetCdim (ChVector<> mcdim)
void AddMarker (ChSharedPtr< ChMarker > amarker)
void AddForce (ChSharedPtr< ChForce > aforce)
void RemoveMarker (ChSharedPtr< ChMarker > amarker)
void RemoveForce (ChSharedPtr< ChForce > aforce)
void RemoveAllForces ()
void RemoveAllMarkers ()
ChSharedPtr< ChMarkerSearchMarker (char *m_name)
ChSharedPtr< ChForceSearchForce (char *m_name)
std::vector< ChMarker * > * GetMarkerList ()
std::vector< ChForce * > * GetForceList ()
ChVector Point_World2Body (ChVector<> *mpoint)
ChVector Point_Body2World (ChVector<> *mpoint)
ChVector Dir_World2Body (ChVector<> *mpoint)
ChVector Dir_Body2World (ChVector<> *mpoint)
ChVector RelPoint_AbsSpeed (ChVector<> *mrelpoint)
ChVector RelPoint_AbsAcc (ChVector<> *mrelpoint)
void SetMass (double newmass)
double GetMass ()
void SetInertia (ChMatrix33<> *newXInertia)
void SetInertiaXX (ChVector<> iner)
ChVector GetInertiaXX ()
void SetInertiaXY (ChVector<> iner)
ChVector GetInertiaXY ()
void SetMaxSpeed (float m_max_speed)
float GetMaxSpeed ()
void SetMaxWvel (float m_max_wvel)
float GetMaxWvel ()
void ClampSpeed ()
void SetSleepTime (float m_t)
float GetSleepTime ()
void SetSleepMinSpeed (float m_t)
float GetSleepMinSpeed ()
void SetSleepMinWvel (float m_t)
float GetSleepMinWvel ()
void ComputeQInertia (ChMatrixNM< double, 4, 4 > *mQInertia)
void ComputeGyro ()
void Add_as_lagrangian_force (ChVector<> force, ChVector<> appl_point, int local, ChMatrixNM< double, 7, 1 > *mQf)
void Add_as_lagrangian_torque (ChVector<> torque, int local, ChMatrixNM< double, 7, 1 > *mQf)
void From_lagrangian_to_forcetorque (ChMatrixNM< double, 7, 1 > *mQf, ChVector<> *mforce, ChVector<> *mtorque)
void From_forcetorque_to_lagrangian (ChVector<> *mforce, ChVector<> *mtorque, ChMatrixNM< double, 7, 1 > *mQf)
void To_abs_forcetorque (ChVector<> force, ChVector<> appl_point, int local, ChVector<> &resultforce, ChVector<> &resulttorque)
void To_abs_torque (ChVector<> torque, int local, ChVector<> &resulttorque)
void Accumulate_force (ChVector<> force, ChVector<> appl_point, int local)
void Accumulate_torque (ChVector<> torque, int local)
ChVector Get_accumulated_force ()
ChVector Get_accumulated_torque ()
void Empty_forces_accumulators ()
ChVector * Get_Scr_force ()
ChVector * Get_Scr_torque ()
void Set_Scr_force (ChVector<> mf)
void Set_Scr_torque (ChVector<> mf)
void Accumulate_script_force (ChVector<> force, ChVector<> appl_point, int local)
void Accumulate_script_torque (ChVector<> torque, int local)
ChVector Get_gyro ()
ChVector Get_Xforce ()
ChVector Get_Xtorque ()
ChMatrix33GetXInertia ()
void BFlagsSetAllOFF ()
void BFlagsSetAllON ()
void BFlagSetON (int mask)
void BFlagSetOFF (int mask)
bool BFlagGet (int mask)
void BFlagSet (int mask, bool state)
void UpdateMarkers (double mytime)
void UpdateForces (double mytime)
void UpdateTime (double mytime)
void UpdateState (ChCoordsys<> mypos, ChCoordsys<> mypos_dt)
void UpdateStateTime (ChCoordsys<> mypos, ChCoordsys<> mypos_dt, double mytime)
void Update (ChCoordsys<> mypos, ChCoordsys<> mypos_dt, double mytime)
virtual void Update (double mytime)
virtual void Update ()
void UpdateExternalGeometry ()
void StreamIN (ChStreamInBinary &mstream)
void StreamOUT (ChStreamOutBinary &mstream)
int StreamOUTall (ChStreamOutBinary &m_file)
int StreamINall (ChStreamInBinary &m_file)
void StreamOUT (ChStreamOutAscii &mstream)
int StreamOUTall (ChStreamOutAscii &mstream)

Protected Attributes

ChCollisionModelcollision_model
int bflag
std::vector< ChMarker * > marklist
std::vector< ChForce * > forcelist
ChVector gyro
ChVector Xforce
ChVector Xtorque
ChVector Force_acc
ChVector Torque_acc
ChVector Scr_force
ChVector Scr_torque
ChSharedPtr< ChMaterialSurfacematsurface
ChCoordsys last_coll_pos
float density
float conductivity
ChVector cdim
ChLcpVariablesBodyOwnMass variables
float max_speed
float max_wvel
float sleep_time
float sleep_minspeed
float sleep_minwvel
float sleep_starttime

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


Constructor & Destructor Documentation

chrono::ChBody::ChBody ( )

Build a rigid body.

CLASS FOR SOLID BODIES.


Member Function Documentation

void chrono::ChBody::Accumulate_force ( ChVector<>  force,
ChVector<>  appl_point,
int  local 
)

As before, but puts the result into the "accumulators", as increment. Forces and torques currently in accumulators will affect the body. It's up to the user to remember to empty them and/or set again at each integration step. Useful to apply forces to bodies without needing to add ChForce() objects. If local=true, force,appl.point or torque are considered expressed in body coordinates, otherwise are considered in absolute coordinates.

void chrono::ChBody::Add_as_lagrangian_force ( ChVector<>  force,
ChVector<>  appl_point,
int  local,
ChMatrixNM< double, 7, 1 > *  mQf 
)

Transform and adds a cartesian force to a generic 7x1 vector of body lagrangian forces mQf . The carthesian force must be passed as vector and application point, and vcan be either in local (local = TRUE) or absolute reference (local = FALSE)

void chrono::ChBody::AddCollisionModelsToSystem ( ) [virtual]

If this physical item contains one or more collision models, add them to the system's collision engine.

Reimplemented from chrono::ChPhysicsItem.

Reimplemented in chrono::ChConveyor.

void chrono::ChBody::ClampSpeed ( )

When this function is called, the speed of the body is clamped into limits posed by max_speed and max_wvel - but remember to put the body in the SetLimitSpeed(true) mode.

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().

void chrono::ChBody::Copy ( ChBody source)

Copy from another ChBody. NOTE: all settings of the body are copied, but the child hierarchy of ChForces and ChMarkers (if any) are NOT copied.

ChVector* chrono::ChBody::Get_Scr_force ( )

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. Script forces&torques are considered applied to COG, in abs csys.

ChVector chrono::ChBody::Get_Xforce ( )

Get the total force applied to the rigid body (applied at center of mass. expressed in absolute coordinates).

ChVector chrono::ChBody::Get_Xtorque ( )

Get the total torque applied to the rigid body (expressed in body coordinates). This does not include the gyroscopic torque.

bool chrono::ChBody::GetCollide ( ) [virtual]

Tell if the object is subject to collision. Only for interface; child classes may override this, using internal flags.

Reimplemented from chrono::ChPhysicsItem.

Reimplemented in chrono::ChConveyor.

ChCollisionModel* chrono::ChBody::GetCollisionModel ( )

Acess the collision model for the collision engine. To get a non-null pointer, remember to SetCollide(true), before.

float chrono::ChBody::GetDensity ( )

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

virtual int chrono::ChBody::GetDOF ( ) [virtual]

Number of coordinates of the rigid body =6 (internally, 3+4=7 coords are used since quaternions are used for large rotations, but local coords -ex. w&v velocity- are 6)

Reimplemented from chrono::ChPhysicsItem.

Reimplemented in chrono::ChConveyor.

std::vector<ChForce*>* chrono::ChBody::GetForceList ( )

Gets the list of children forces. NOTE! use this list only to enumerate etc., but NOT to remove or add items (use the appropriate Remove.. and Add.. functions instead!)

virtual ChFrame& chrono::ChBody::GetFrame_COG_to_abs ( ) [virtual]

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.

virtual ChFrame& chrono::ChBody::GetFrame_REF_to_abs ( ) [virtual]

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.

Vector chrono::ChBody::GetInertiaXY ( )

Get the extradiagonal part of the inertia tensor (Ixy, Iyz, Izx values, the rest is symmetric) Warning about sign: in some books they write the inertia tensor as I=[Ixx, -Ixy, -Ixz; etc.] but here is I=[Ixx, Ixy, Ixz; etc.]

ChCoordsys chrono::ChBody::GetLastCollPos ( )

Gets the last position when the collision detection was performed last time (i.e. last time SynchronizeLastCollPos() was used)

std::vector<ChMarker*>* chrono::ChBody::GetMarkerList ( )

Gets the list of children markers. NOTE! use this list only to enumerate etc., but NOT to remove or add items (use the appropriate Remove.. and Add.. functions instead!)

ChSharedPtr<ChMaterialSurface>& chrono::ChBody::GetMaterialSurface ( )

Access the material surface properties, referenced by this rigid body. The material surface contains properties such as friction, etc. The ChMaterialSurface can be a shared object! (by default, each body creates its own as soon as instanced, but later the material object can be replaced).

void chrono::ChBody::GetTotalAABB ( ChVector<> &  bbmin,
ChVector<> &  bbmax 
) [virtual]

Get the entire AABB axis-aligned bounding box of the object, as defined by the collision model (if any).

Reimplemented from chrono::ChPhysicsItem.

ChMatrix33* chrono::ChBody::GetXInertia ( )

Get the address of the inertia tensor, as a 3x3 matrix, expressed in local coordinate system.

void chrono::ChBody::InjectVariables ( ChLcpSystemDescriptor mdescriptor) [virtual]

Tell to a system descriptor that there are variables of type ChLcpVariables in this object (for further passing it to a LCP solver)

Reimplemented from chrono::ChPhysicsItem.

Reimplemented in chrono::ChConveyor, chrono::ChBodyDEMMPI, and chrono::ChBodyMPI.

bool chrono::ChBody::IsActive ( )

Tell if the body is active, i.e. it is neither fixed to ground nor it is in sleep mode.

Vector chrono::ChBody::Point_World2Body ( ChVector<> *  mpoint)

Utilities for coordinate transformations

int chrono::ChBody::RecomputeCollisionModel ( )

Update the optimization structures (OOBB, ABB, etc.) of the collision model, from the associated geometry in some external object (es.CAD).

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.

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.

void chrono::ChBody::RemoveCollisionModelsFromSystem ( ) [virtual]

If this physical item contains one or more collision models, remove them from the system's collision engine.

Reimplemented from chrono::ChPhysicsItem.

Reimplemented in chrono::ChConveyor.

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

Sets the 'fixed' state of the body. If true, it does not move respect to the absolute world, despite constraints, forces, etc.

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

Enable/disable the collision for this rigid body. (After setting ON, you may need RecomputeCollisionModel() before anim starts, if you added an external object that implements onAddCollisionGeometries(), ex. in a plugin for a CAD)

void chrono::ChBody::SetEvalContactCn ( bool  mev)

If true, the normal restitution coefficient is evaluated from painted material channel.

void chrono::ChBody::SetEvalContactCt ( bool  mev)

If true, the tangential restitution coefficient is evaluated from painted material channel.

void chrono::ChBody::SetEvalContactKf ( bool  mev)

If true, the kinetic friction coefficient is evaluated from painted material channel.

void chrono::ChBody::SetEvalContactSf ( bool  mev)

If true, the static friction coefficient is evaluated from painted material channel.

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

Set the extradiagonal part of the inertia tensor (Ixy, Iyz, Izx values, the rest is symmetric) Warning about sign: in some books they write the inertia tensor as I=[Ixx, -Ixy, -Ixz; etc.] but here is I=[Ixx, Ixy, Ixz; etc.]

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

Trick. 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. The realism is limited, but the simulation is more stable.

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

Mass of the rigid body. Must be positive. Try not to mix bodies with too high/too low values of mass, for numerical stability.

void chrono::ChBody::SetMaterialSurface ( ChSharedPtr< ChMaterialSurface > &  mnewsurf)

Set the material surface properties by passing a ChMaterialSurface object. Thank to smart pointers, the one that was previously used is replaced and, if needed, it is automatically dereferenced and deleted. The ChMaterialSurface can be a shared object! (by default, each body creates its own as soon as instanced, but later the material object can be replaced).

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

Trick. 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);

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

Trick. Set the maximum angualar 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);

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

Force the body in sleeping mode or not (usually this state change is not handled by users, anyway, because it is mostly automatic).

void chrono::ChBody::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.

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

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

void chrono::ChBody::StreamIN ( ChStreamInBinary mstream) [virtual]

Method to allow deserializing a persistent binary archive (ex: a file) into transient data.

Reimplemented from chrono::ChPhysicsItem.

Reimplemented in chrono::ChConveyor, chrono::ChBodyDEM, chrono::ChBodyAuxRef, chrono::ChBodyDEMMPI, and chrono::ChBodyMPI.

void chrono::ChBody::StreamOUT ( ChStreamOutBinary mstream) [virtual]

Method to allow serializing transient data into a persistent binary archive (ex: a file).

Reimplemented from chrono::ChPhysicsItem.

Reimplemented in chrono::ChConveyor, chrono::ChBodyDEM, chrono::ChBodyAuxRef, chrono::ChBodyDEMMPI, and chrono::ChBodyMPI.

void chrono::ChBody::StreamOUT ( ChStreamOutAscii mstream) [virtual]

Method to allow serialization of transient data in ascii, as a readable item, for example "chrono::GetLog() << myobject;"

Reimplemented from chrono::ChFrameMoving< double >.

void chrono::ChBody::To_abs_forcetorque ( ChVector<>  force,
ChVector<>  appl_point,
int  local,
ChVector<> &  resultforce,
ChVector<> &  resulttorque 
)

Trasform generic cartesian force into absolute force+torque applied to body COG. If local=1, force & application point are intended as expressed in local coordinates, if =0, in absolute.

void chrono::ChBody::To_abs_torque ( ChVector<>  torque,
int  local,
ChVector<> &  resulttorque 
)

Trasform generic cartesian torque into absolute torque applied to body COG. If local=1, torque is intended as expressed in local coordinates, if =0, in absolute.

void chrono::ChBody::Update ( ChCoordsys<>  mypos,
ChCoordsys<>  mypos_dt,
double  mytime 
)

Update all auxiliary data of the rigid body and of its children (markers, forces..), at given time and state

void chrono::ChBody::Update ( double  mytime) [virtual]

Update all auxiliary data of the rigid body and of its children (markers, forces..), at given time

Reimplemented from chrono::ChPhysicsItem.

Reimplemented in chrono::ChConveyor, and chrono::ChBodyDEMMPI.

void chrono::ChBody::Update ( ) [virtual]

Update all auxiliary data of the rigid body and of its children (markers, forces..)

Reimplemented from chrono::ChPhysicsItem.

Reimplemented in chrono::ChBodyAuxRef, and chrono::ChBodyDEMMPI.

void chrono::ChBody::UpdateExternalGeometry ( )

Tells to the associated external object ChExternalObject() ,if any, that its 3D shape must be updated in order to syncronize to ChBody coordinates

ChLcpVariablesBodyOwnMass& chrono::ChBody::Variables ( )

Returns reference to the encapsulated ChLcpVariablesBody, representing body variables (pos, speed or accel.- see VariablesLoad...() ) and forces. The ChLcpVariablesBodyOwnMass is the interface ta the LCP system solver.

void chrono::ChBody::VariablesFbLoadForces ( double  factor = 1.) [virtual]

Adds the current forces applied to body (including gyroscopic torque) in encapsulated ChLcpVariablesBody, in the 'fb' part: qf+=forces*factor

Reimplemented from chrono::ChPhysicsItem.

Reimplemented in chrono::ChConveyor.

void chrono::ChBody::VariablesQbIncrementPosition ( double  step) [virtual]

Increment body position by the 'qb' part of the ChLcpVariablesBody, multiplied by a 'step' factor. pos+=qb*step If qb is a speed, this behaves like a single step of 1-st order numerical integration (Eulero integration). Does not automatically update markers & forces.

Reimplemented from chrono::ChPhysicsItem.

Reimplemented in chrono::ChConveyor.

void chrono::ChBody::VariablesQbLoadSpeed ( ) [virtual]

Initialize the 'qb' part of the ChLcpVariablesBody with the current value of body speeds. Note: since 'qb' is the unknown of the LCP, this function sems unuseful, however the LCP solver has an option 'add_Mq_to_f', that takes [M]*qb and add to the 'fb' term before starting (this is often needed in the Anitescu time stepping method, for instance); this explains the need of this method..

Reimplemented from chrono::ChPhysicsItem.

Reimplemented in chrono::ChConveyor.

void chrono::ChBody::VariablesQbSetSpeed ( double  step = 0.) [virtual]

Fetches the body speed (both linear and angular) from the 'qb' part of the ChLcpVariablesBody (does not updates the full body&markers state) and sets it as the current body speed. If 'step' is not 0, also computes the approximate acceleration of the body using backward differences, that is accel=(new_speed-old_speed)/step. Mostly used after the LCP provided the solution in ChLcpVariablesBody .

Reimplemented from chrono::ChPhysicsItem.

Reimplemented in chrono::ChConveyor.


CHRONO::ENGINE
C++ library for multibody simulation, (C) Alessandro Tasora
This API documentation has been generated on Tue Jul 10 2012 by Doxygen