chrono::ChForce Class Reference

Description

Forces are objects which must be attached to rigid bodies in order to apply force or torque to such body.

ChForce objects are able to represent either forces and torques, depending on a flag.

#include <ChForce.h>

Inheritance diagram for chrono::ChForce:
Collaboration diagram for chrono::ChForce:

Public Types

enum  ForceType { FORCE, TORQUE }
 Types of force application.
 
enum  ReferenceFrame { BODY, WORLD }
 Reference for position frame.
 
enum  AlignmentFrame { BODY_DIR, WORLD_DIR }
 Reference for alignment.
 

Public Member Functions

 ChForce ()
 Construct a ChForce object. More...
 
 ChForce (const ChForce &other)
 
virtual ChForce * Clone () const override
 "Virtual" copy constructor (covariant return type).
 
ChBody * GetBody ()
 Return the parent body (the force belongs to this rigid body)
 
void SetBody (ChBody *newRB)
 Sets the parent body (the force belongs to this rigid body)
 
void SetMode (ForceType m_mode)
 Sets the mode (force or torque)
 
ForceType GetMode () const
 
void SetAlignment (AlignmentFrame m_align)
 Sets the alignment method. More...
 
AlignmentFrame GetAlignment () const
 
void SetFrame (ReferenceFrame ref_frame)
 Sets the alignment method. More...
 
ReferenceFrame GetFrame () const
 
const ChVector3d & GetApplicationPointAbs () const
 Gets the application point, in absolute coordinates.
 
const ChVector3d & GetApplicationPointRel () const
 Gets the application point, in rigid body coordinates.
 
void SetApplicationPointAbs (const ChVector3d &point_abs)
 Sets the application point, in absolute coordinates.
 
void SetApplicationPointRel (const ChVector3d &point_rel)
 Sets the application point, in rigid body coordinates.
 
const ChVector3d & GetDirAbs () const
 Gets the force (or torque) direction, in absolute coordinates.
 
const ChVector3d & GetDirRel () const
 Gets the force (or torque) direction, in rigid body coordinates.
 
void SetDirAbs (const ChVector3d &newdir_abs)
 Sets the force (or torque) direction, in absolute coordinates.
 
void SetDirRel (const ChVector3d &newdir_rel)
 Sets the force (or torque) direction, in rigid body coordinates.
 
void SetForceMagnitude (double newf)
 Sets force (or torque) base magnitude. More...
 
double GetForceMagnitude () const
 Gets force (or torque) base magnitude. More...
 
void SetMagnitudeModulation (std::shared_ptr< ChFunction > func)
 Sets a function for time-modulation of the force (or torque) magnitude.
 
std::shared_ptr< ChFunction > GetMagnitudeModulation () const
 
void SetForceModulationX (std::shared_ptr< ChFunction > func)
 Sets a function for time-modulation of force (or torque), X component.
 
std::shared_ptr< ChFunction > GetForceModulationX () const
 
void SetForceModulationY (std::shared_ptr< ChFunction > func)
 Sets a function for time-modulation of force (or torque), Y component.
 
std::shared_ptr< ChFunction > GetForceModulationY () const
 
void SetForceModulationZ (std::shared_ptr< ChFunction > func)
 Sets a function for time-modulation of force (or torque), Z component.
 
std::shared_ptr< ChFunction > GetForceModulationZ () const
 
void SetApplicationPointModulationX (std::shared_ptr< ChFunction > func)
 Sets a function for time-modulation of application point position, X component.
 
std::shared_ptr< ChFunction > GetApplicationPointModulationX () const
 
void SetApplicationPointModulationY (std::shared_ptr< ChFunction > func)
 Sets a function for time-modulation of application point position, Y component.
 
std::shared_ptr< ChFunction > GetApplicationPointModulationY () const
 
void SetApplicationPointModulationZ (std::shared_ptr< ChFunction > func)
 Sets a function for time-modulation of application point position, Z component.
 
std::shared_ptr< ChFunction > GetApplicationPointModulationZ () const
 
const ChVector3d & GetTotalForceAbs () const
 Gets the total instant force (or torque) vector in absolute coordinates. More...
 
const ChVector3d & GetTotalForceRel () const
 Gets the total instant force (or torque) vector in rigid body coordinates. More...
 
void GetBodyForceTorque (ChVector3d &body_force, ChVector3d &body_torque) const
 Gets total force-torque applied to rigid body, as force vector (in absololute coords) and torque vector (in body coords).
 
const ChVectorN< double, 7 > & GetQf () const
 Gets force-torque applied to rigid body, as lagrangian generalized force (7x1 matrix).
 
void UpdateState ()
 
virtual void Update (double time, UpdateFlags update_flags) override
 Perform any updates necessary at the current phase during the solution process. More...
 
virtual void ArchiveOut (ChArchiveOut &archive_out) override
 Method to allow serialization of transient data to archives.
 
virtual void ArchiveIn (ChArchiveIn &archive_in) override
 Method to allow deserialization of transient data from archives.
 
- Public Member Functions inherited from chrono::ChObj
 ChObj (const ChObj &other)
 
int GetIdentifier () const
 Get the unique integer identifier of this object. More...
 
void SetTag (int tag)
 Set an object integer tag (default: -1). More...
 
int GetTag () const
 Get the tag of this object.
 
void SetName (const std::string &myname)
 Set the name of this object.
 
const std::string & GetName () const
 Get the name of this object.
 
double GetChTime () const
 Gets the simulation time of this object.
 
void SetChTime (double m_time)
 Sets the simulation time of this object.
 
void AddVisualModel (std::shared_ptr< ChVisualModel > model)
 Add an (optional) visualization model. More...
 
std::shared_ptr< ChVisualModel > GetVisualModel () 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< ChVisualShape > GetVisualShape (unsigned int i) const
 Access the specified visualization shape in the visualization model (if any). More...
 
virtual ChFrame GetVisualModelFrame (unsigned int nclone=0) const
 Get the reference frame (expressed in and relative to the absolute frame) of the visual model. More...
 
virtual unsigned int GetNumVisualModelClones () const
 Return the number of clones of the visual model associated with this object. More...
 
void AddCamera (std::shared_ptr< ChCamera > camera)
 Attach a camera to this object. More...
 
std::vector< std::shared_ptr< ChCamera > > GetCameras () const
 Get the set of cameras attached to this object.
 
void UpdateVisualModel ()
 Utility function to update only the associated visual assets (if any).
 
virtual std::string & ArchiveContainerName ()
 

Additional Inherited Members

- Protected Member Functions inherited from chrono::ChObj
int GenerateUniqueIdentifier ()
 
- Protected Attributes inherited from chrono::ChObj
double ChTime
 object simulation time
 
std::string m_name
 object name
 
int m_identifier
 object unique identifier
 
int m_tag
 user-supplied tag
 
std::shared_ptr< ChVisualModelInstance > vis_model_instance
 instantiated visualization model
 
std::vector< std::shared_ptr< ChCamera > > cameras
 set of cameras
 

Constructor & Destructor Documentation

◆ ChForce()

chrono::ChForce::ChForce ( )

Construct a ChForce object.

By default, it is initialized as FORCE mode, BODY frame, and BODY_DIR alignment.

Member Function Documentation

◆ GetForceMagnitude()

double chrono::ChForce::GetForceMagnitude ( ) const
inline

Gets force (or torque) base magnitude.

NB: this value gets modulated by related functions to provide total force.

◆ GetTotalForceAbs()

const ChVector3d& chrono::ChForce::GetTotalForceAbs ( ) const
inline

Gets the total instant force (or torque) vector in absolute coordinates.

This considers the effect of all applied modulations.

◆ GetTotalForceRel()

const ChVector3d& chrono::ChForce::GetTotalForceRel ( ) const
inline

Gets the total instant force (or torque) vector in rigid body coordinates.

This considers the effect of all applied modulations.

◆ SetAlignment()

void chrono::ChForce::SetAlignment ( AlignmentFrame  m_align)
inline

Sets the alignment method.

The force will rotate together with this reference.

◆ SetForceMagnitude()

void chrono::ChForce::SetForceMagnitude ( double  newf)

Sets force (or torque) base magnitude.

NB: this value gets modulated by related functions to provide total force.

◆ SetFrame()

void chrono::ChForce::SetFrame ( ReferenceFrame  ref_frame)

Sets the alignment method.

The force application point will follow this reference.

◆ Update()

void chrono::ChForce::Update ( double  time,
UpdateFlags  update_flags 
)
overridevirtual

Perform any updates necessary at the current phase during the solution process.

This function is called at least once per step to update auxiliary data, internal states, etc. The default implementation updates the item's time stamp and its visualization assets (if any are defined anf only if requested).

Reimplemented from chrono::ChObj.


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