MULTIBODY SIMULATION SOFTWARE - API documentation

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 (int 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)
void SetNoSpeedNoAcceleration ()
ChCollisionModelGetCollisionModel ()
virtual void SyncCollisionModels ()
virtual void AddCollisionModelsToSystem ()
virtual void RemoveCollisionModelsFromSystem ()
int RecomputeCollisionModel ()
Coordsys GetLastCollPos ()
void SynchronizeLastCollPos ()
Coordsys GetLastCollPos_dt ()
void SynchronizeLastCollPos_dt ()
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)
void AddMarker (ChSharedMarkerPtr amarker)
void AddForce (ChSharedForcePtr aforce)
void RemoveMarker (ChSharedMarkerPtr amarker)
void RemoveForce (ChSharedForcePtr aforce)
void RemoveAllForces ()
void RemoveAllMarkers ()
ChMarkerSearchMarker (char *m_name)
ChForceSearchForce (char *m_name)
std::vector
< ChMarker * > * 
GetMarkerList ()
std::vector< ChForce * > * GetForceList ()
Vector Point_World2Body (Vector *mpoint)
Vector Point_Body2World (Vector *mpoint)
Vector Dir_World2Body (Vector *mpoint)
Vector Dir_Body2World (Vector *mpoint)
Vector RelPoint_AbsSpeed (Vector *mrelpoint)
Vector RelPoint_AbsAcc (Vector *mrelpoint)
void SetMass (double newmass)
double GetMass ()
void SetInertia (ChMatrix33<> *newXInertia)
void SetInertiaXX (Vector iner)
Vector GetInertiaXX ()
void SetInertiaXY (Vector iner)
Vector 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 (Vector force, Vector appl_point, int local, ChMatrixNM< double, 7, 1 > *mQf)
void Add_as_lagrangian_torque (Vector torque, int local, ChMatrixNM< double, 7, 1 > *mQf)
void From_lagrangian_to_forcetorque (ChMatrixNM< double, 7, 1 > *mQf, Vector *mforce, Vector *mtorque)
void From_forcetorque_to_lagrangian (Vector *mforce, Vector *mtorque, ChMatrixNM< double, 7, 1 > *mQf)
void To_abs_forcetorque (Vector force, Vector appl_point, int local, Vector &resultforce, Vector &resulttorque)
void To_abs_torque (Vector torque, int local, Vector &resulttorque)
void Accumulate_force (Vector force, Vector appl_point, int local)
void Accumulate_torque (Vector torque, int local)
Vector Get_accumulated_force ()
Vector Get_accumulated_torque ()
void Empty_forces_accumulators ()
VectorGet_Scr_force ()
VectorGet_Scr_torque ()
void Set_Scr_force (Vector mf)
void Set_Scr_torque (Vector mf)
void Accumulate_script_force (Vector force, Vector appl_point, int local)
void Accumulate_script_torque (Vector torque, int local)
Vector Get_gyro ()
Vector Get_Xforce ()
Vector 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 (Coordsys mypos, Coordsys mypos_dt)
void UpdateStateTime (Coordsys mypos, Coordsys mypos_dt, double mytime)
void Update (Coordsys mypos, Coordsys 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)


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.

chrono::ChBody::~ChBody (  ) 

Destructor.


Member Function Documentation

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.

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::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::SetCollide ( int  mcoll  ) 

Enable/disable the collision for this rigid body. After setting ON, remember RecomputeCollisionModel() before anim starts (it is not automatically recomputed here because of performance issues.)

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.

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

Show collision mesh in 3D views.

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

bool chrono::ChBody::GetSleeping (  ) 

Tell if the body is actually in sleeping state.

bool chrono::ChBody::TrySleeping (  ) 

Put the body in sleeping state if requirements are satisfied.

bool chrono::ChBody::IsActive (  ) 

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

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.

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::VariablesFbReset (  )  [virtual]

Sets the 'fb' part of the encapsulated ChLcpVariablesBodyOwnMass to zero.

Reimplemented from chrono::ChPhysicsItem.

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.

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.

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.

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.

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) Basically does nothing, but maybe that inherited classes may specialize this.

Reimplemented from chrono::ChPhysicsItem.

void chrono::ChBody::SetNoSpeedNoAcceleration (  ) 

Set no speed and no accelerations (but does not change the position).

Reimplemented from chrono::ChPhysicsItem.

ChCollisionModel* chrono::ChBody::GetCollisionModel (  ) 

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

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

Synchronize coll.model coordinate and bounding box to the position of the body.

Reimplemented from chrono::ChPhysicsItem.

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.

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.

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

Coordsys chrono::ChBody::GetLastCollPos (  ) 

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

void chrono::ChBody::SynchronizeLastCollPos (  ) 

Stores the current position in the last-collision-position buffer.

Coordsys chrono::ChBody::GetLastCollPos_dt (  ) 

Gets the last speed when the collision detection was performed last time (i.e. last time SynchronizeLastCollPos_dt() was used)

void chrono::ChBody::SynchronizeLastCollPos_dt (  ) 

Stores the current speed in the last-collision-position buffer.

float chrono::ChBody::GetImpactC (  ) 

The normal restitution coefficient, for collisions. Should be in 0..1 range.

float chrono::ChBody::GetImpactCt (  ) 

The tangential restitution coefficient, for collisions.

float chrono::ChBody::GetKfriction (  ) 

The kinetic friction coefficient. Usually in 0..1 range, rarely above.

float chrono::ChBody::GetSfriction (  ) 

The static friction coefficient. Usually a bit higher than kinetic coeff.

void chrono::ChBody::SetFriction ( float  mval  ) 

Set both static friction and kinetic friction at once, with same value.

float chrono::ChBody::GetRollingFriction (  ) 

The rolling friction coefficient. Usually a very low coefficient. Note! a non-zero value will make the simulation 2x slower! Also, the GPU solver currently does not support rolling friction. Default: 0.

float chrono::ChBody::GetSpinningFriction (  ) 

The spinning friction coefficient. Usually a very low coefficient. Note! a non-zero value will make the simulation 2x slower! Also, the GPU solver currently does not support spinning friction. Default: 0.

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 the Realsoft3D plugin for example provides the surfaces.)

void chrono::ChBody::AddMarker ( ChSharedMarkerPtr  amarker  ) 

Attach a marker to this body.

void chrono::ChBody::AddForce ( ChSharedForcePtr  aforce  ) 

Attach a force to this body.

void chrono::ChBody::RemoveMarker ( ChSharedMarkerPtr  amarker  ) 

Remove a specific marker from this body. Warning: linear time search.

void chrono::ChBody::RemoveForce ( ChSharedForcePtr  aforce  ) 

Remove a specific force from this marker. Warning: linear time search.

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.

ChMarker * chrono::ChBody::SearchMarker ( char *  m_name  ) 

Finds a marker from its ChObject name.

ChForce * chrono::ChBody::SearchForce ( char *  m_name  ) 

Finds a force from its ChObject name.

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

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

Vector chrono::ChBody::Point_World2Body ( Vector mpoint  ) 

Utilities for coordinate transformations

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::SetInertia ( ChMatrix33<> *  newXInertia  ) 

Set the inertia tensor of the body.

void chrono::ChBody::SetInertiaXX ( Vector  iner  ) 

Set the diagonal part of the inertia tensor.

Vector chrono::ChBody::GetInertiaXX (  ) 

Get the diagonal part of the inertia tensor.

void chrono::ChBody::SetInertiaXY ( Vector  iner  ) 

Set the extradiagonal part of the inertia tensor (xy, yz, zx values, the rest is symmetric)

Vector chrono::ChBody::GetInertiaXY (  ) 

Get the extradiagonal part of the inertia tensor (xy, yz, zx values, the rest is symmetric)

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::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::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::SetSleepMinSpeed ( float  m_t  ) 

Set the max linear speed to be kept for 'sleep_time' before freezing.

void chrono::ChBody::SetSleepMinWvel ( float  m_t  ) 

Set the max linear speed to be kept for 'sleep_time' before freezing.

void chrono::ChBody::ComputeQInertia ( ChMatrixNM< double, 4, 4 > *  mQInertia  ) 

Computes the 4x4 inertia tensor in quaternion space, if needed.

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::Add_as_lagrangian_force ( Vector  force,
Vector  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::From_lagrangian_to_forcetorque ( ChMatrixNM< double, 7, 1 > *  mQf,
Vector mforce,
Vector mtorque 
)

Given a lagrangian force (in a 7x1 matrix), computes the fore and torque as vectors.

void chrono::ChBody::From_forcetorque_to_lagrangian ( Vector mforce,
Vector mtorque,
ChMatrixNM< double, 7, 1 > *  mQf 
)

Given force and torque as vectors, computes the lagrangian force (in a 7x1 matrix).

void chrono::ChBody::To_abs_forcetorque ( Vector  force,
Vector  appl_point,
int  local,
Vector resultforce,
Vector 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 ( Vector  torque,
int  local,
Vector 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::Accumulate_force ( Vector  force,
Vector  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.

Vector* 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.

Vector chrono::ChBody::Get_gyro (  ) 

Return the gyroscopic torque.

Vector chrono::ChBody::Get_Xforce (  ) 

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

Vector chrono::ChBody::Get_Xtorque (  ) 

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

ChMatrix33* chrono::ChBody::GetXInertia (  ) 

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

void chrono::ChBody::UpdateMarkers ( double  mytime  ) 

Update all children markers of the rigid body, at current body state.

void chrono::ChBody::UpdateForces ( double  mytime  ) 

Update all children forces of the rigid body, at current body state.

void chrono::ChBody::UpdateTime ( double  mytime  ) 

Update local time of rigid body, and time-dependant data.

void chrono::ChBody::UpdateState ( Coordsys  mypos,
Coordsys  mypos_dt 
)

Update all auxiliary data of the rigid body, at given time.

void chrono::ChBody::UpdateStateTime ( Coordsys  mypos,
Coordsys  mypos_dt,
double  mytime 
)

Update all auxiliary data of the rigid body, at given time and state.

void chrono::ChBody::Update ( Coordsys  mypos,
Coordsys  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.

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

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

Reimplemented from chrono::ChPhysicsItem.

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

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.

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.

int chrono::ChBody::StreamOUTall ( ChStreamOutBinary m_file  ) 

Save data, including child markers and child forces.

int chrono::ChBody::StreamINall ( ChStreamInBinary m_file  ) 

Read data, including child markers and child forces.

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


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