chrono::utils::ChParserOpenSim Class Reference

Description

OpenSim input file parser.

#include <ChParserOpenSim.h>

Classes

class  Report
 Report containing information about objects parsed from file. More...
 

Public Types

enum  VisType { PRIMITIVES, MESH, NONE }
 

Public Member Functions

void SetContactFrictionCoefficient (float friction_coefficient)
 Set coefficient of friction. More...
 
void SetContactRestitutionCoefficient (float restitution_coefficient)
 Set coefficient of restitution. More...
 
void SetContactMaterialProperties (float young_modulus, float poisson_ratio)
 Set contact material properties. More...
 
void SetContactMaterialCoefficients (float kn, float gn, float kt, float gt)
 Set contact material coefficients. More...
 
void SetCollide (bool val)
 Enable collision between bodies in this model (default: false).
 
void SetCollisionFamilies (int family_1=1, int family_2=2)
 Set collision families (to disable collision between a body and its parent). More...
 
void SetVisualizationType (VisType val)
 Set body visualization type (default: NONE).
 
void SetVerbose (bool val)
 Enable/disable verbose parsing output (default: false).
 
void ActivateActuators (bool val)
 Activate actuators. More...
 
void Parse (ChSystem &system, const std::string &filename)
 Parse the specified OpenSim input file and create the model in the given system. More...
 
ChSystemParse (const std::string &filename, ChMaterialSurface::ContactMethod contact_method=ChMaterialSurface::NSC)
 Parse the specified OpenSim input file and create the model in a new system. More...
 
const ReportGetReport () const
 Get the report for this parser. More...
 
void PrintReport () const
 Print the parser's report.
 
void SetExcitationFunction (const std::string &name, std::shared_ptr< ChFunction > modulation)
 Set excitation function for the actuator with the specified name. More...
 

Member Function Documentation

void chrono::utils::ChParserOpenSim::ActivateActuators ( bool  val)

Activate actuators.

By default, any actuator read in from the osim file is inactive (zero excitation). If enabled, all actuators will receive a constant excitation function with value 1. The excitation function for an actuator can be specified, after parsing, using SetExcitationFunction().

const Report& chrono::utils::ChParserOpenSim::GetReport ( ) const

Get the report for this parser.

This contains the lists of bodies, joints, and forces that were created from the input osim file.

void chrono::utils::ChParserOpenSim::Parse ( ChSystem system,
const std::string &  filename 
)

Parse the specified OpenSim input file and create the model in the given system.

Parameters
[in]systemcontaining Chrono system
[in]filenameOpenSim input file name
ChSystem * chrono::utils::ChParserOpenSim::Parse ( const std::string &  filename,
ChMaterialSurface::ContactMethod  contact_method = ChMaterialSurface::NSC 
)

Parse the specified OpenSim input file and create the model in a new system.

Note that the created system is not deleted in the parser's destructor; rather, ownership is transferred to the caller.

Parameters
[in]filenameOpenSim input file name
[in]contact_methodcontact method
void chrono::utils::ChParserOpenSim::SetCollisionFamilies ( int  family_1 = 1,
int  family_2 = 2 
)

Set collision families (to disable collision between a body and its parent).

Note: automaticaly enables collision.

Parameters
[in]family_1first collision family
[in]family_2second collision family
void chrono::utils::ChParserOpenSim::SetContactFrictionCoefficient ( float  friction_coefficient)

Set coefficient of friction.

The default value is 0.6

void chrono::utils::ChParserOpenSim::SetContactMaterialCoefficients ( float  kn,
float  gn,
float  kt,
float  gt 
)

Set contact material coefficients.

These values are used directly to compute contact forces (if the containing system is so configured and if the SMC contact method is being used). The default values are: kn=2e5, gn=40, kt=2e5, gt=20

Parameters
[in]knnormal contact stiffness
[in]gnnormal contact damping
[in]kttangential contact stiffness
[in]gttangential contact damping
void chrono::utils::ChParserOpenSim::SetContactMaterialProperties ( float  young_modulus,
float  poisson_ratio 
)

Set contact material properties.

These values are used to calculate contact material coefficients (if the containing system is so configured and if the SMC contact method is being used). The default values are: Y = 2e5 and nu = 0.3

Parameters
[in]young_modulusYoung's modulus of elasticity
[in]poisson_ratioPoisson ratio
void chrono::utils::ChParserOpenSim::SetContactRestitutionCoefficient ( float  restitution_coefficient)

Set coefficient of restitution.

The default value is 0.4

void chrono::utils::ChParserOpenSim::SetExcitationFunction ( const std::string &  name,
std::shared_ptr< ChFunction modulation 
)

Set excitation function for the actuator with the specified name.

This method should be invoked only after parsing an osim file.