Description
Parser for YAML specification files for Chrono models and simulations.
The parser caches model information and simulation settings from a YAML input file and then allows populating an MBS Chrono system and setting solver and simulation parameters.
#include <ChParserMbsYAML.h>


Public Member Functions | |
| ChParserMbsYAML (bool verbose=false) | |
| ChParserMbsYAML (const std::string &yaml_filename, bool verbose=false) | |
| bool | HasSolverData () const |
| Return true if a YAML solver file has been loaded. | |
| bool | HasModelData () const |
| Return true if a YAML model file has been loaded. | |
| virtual void | LoadFile (const std::string &yaml_filename) |
| Load the specified MBS simulation input YAML file. | |
| virtual void | LoadSimData (const YAML::Node &yaml) |
| Load the simulation, output, and visualization settings from the specified YAML node. | |
| virtual void | LoadModelData (const YAML::Node &yaml) |
| Load the MBS model from the specified YAML node. | |
| virtual void | LoadSolverData (const YAML::Node &yaml) |
| Load the solver parameters from the specified YAML node. | |
| std::shared_ptr< ChSystem > | CreateSystem () |
| Create and return a Chrono system configured from cached simulation parameters. More... | |
| void | SetSimulationParameters (ChSystem &sys) |
| Set solver and integrator settings from cached values. More... | |
| double | GetTimestep () const |
| double | GetEndtime () const |
| bool | EnforceRealtime () const |
| bool | Render () const |
| double | GetRenderFPS () const |
| CameraVerticalDir | GetCameraVerticalDir () const |
| const ChVector3d & | GetCameraLocation () const |
| const ChVector3d & | GetCameraTarget () const |
| bool | EnableShadows () const |
| int | Populate (ChSystem &sys, const ChFramed &model_frame=ChFramed(), const std::string &model_prefix="") |
| Populate the given system with the cached Chrono components. More... | |
| void | Depopulate (ChSystem &sys, int instance_index) |
| Remove from the specified system the Chrono objects from the specified instance. | |
| int | GetNumInstances () const |
| Return the number of instances created from the YAML model file. | |
| std::shared_ptr< ChBodyAuxRef > | FindBodyByName (const std::string &name) const |
| Find and return the body with specified name in the current model instance. | |
| std::shared_ptr< ChBodyAuxRef > | FindBodyByName (const std::string &name, int model_instance) const |
| Find and return the body with specified name in the given model instance. | |
| std::vector< std::shared_ptr< ChBodyAuxRef > > | FindBodiesByName (const std::string &name) const |
| Find and return bodies with given base name from all model instances. | |
| std::shared_ptr< ChLinkMotor > | FindMotorByName (const std::string &name) const |
| Find and return the motor with specified name in the current model instance. | |
| std::shared_ptr< ChLinkMotor > | FindMotorByName (const std::string &name, int model_instance) const |
| Find and return the motor with specified name in the given model instance. | |
| std::vector< std::shared_ptr< ChLinkMotor > > | FindMotorsByName (const std::string &name) const |
| Find and return motors with given base name from all model instances. | |
| void | AttachLoadController (std::shared_ptr< ChLoadController > controller, const std::string &name, int model_instance) |
| Attach the external controller for the load controller with given name. More... | |
| void | AttachMotorController (std::shared_ptr< ChMotorController > controller, const std::string &name, int model_instance) |
| Attach the external controller for the motor controller with given name. More... | |
| void | DoStepDynamics () |
| Advance dynamics of the multibody system. More... | |
| void | ApplyLoadControllerLoads (const LoadControllerLoads &controller_loads) |
| Apply loads generated by the load controllers in the given list. More... | |
| void | ApplyMotorControllerActuations (const MotorControllerActuations &controller_loads) |
| Apply actuations generated by the motor controllers in the given list. More... | |
| void | SaveOutput (ChSystem &sys, int frame) |
| Save simulation output results at the current time. More... | |
Public Member Functions inherited from chrono::parsers::ChParserYAML | |
| void | SetVerbose (bool verbose) |
| Set verbose terminal output (default: false). | |
| virtual void | SetOutputDir (const std::string &out_dir) |
| Set root output directory (default: "."). More... | |
| const std::string & | GetName () const |
| Return the name of the YAML model. | |
| virtual bool | Output () const |
| Return true if generating output. | |
| ChOutput::Type | GetOutputType () const |
| Return the output type. | |
| ChOutput::Mode | GetOutputMode () const |
| Return the output mode. | |
| virtual double | GetOutputFPS () const |
| Return the output frequency. | |
| virtual void | SaveOutput (int frame) |
| Save simulation output results at the current time. More... | |
Friends | |
| class | ChParserVehicleYAML |
| class | ChParserFsiYAML |
Additional Inherited Members | |
Public Types inherited from chrono::parsers::ChParserYAML | |
| enum | YamlFileType { MBS, SPH, TDPF, FSI, VEHICLE, UNKNOWN } |
| Type of a Chrono YAML specification file. | |
Static Public Member Functions inherited from chrono::parsers::ChParserYAML | |
| static YamlFileType | ReadYamlFileType (const std::string &yaml_filename) |
| Peek in specified YAML file and read the fluid system type. More... | |
Protected Member Functions inherited from chrono::parsers::ChParserYAML | |
| void | ReadOutputParams (const YAML::Node &a) |
| Read output settings from specified YAML node. | |
Static Protected Member Functions inherited from chrono::parsers::ChParserYAML | |
| static YamlFileType | ReadYamlFileType (const YAML::Node &a) |
| Read the YAML file type. | |
Protected Attributes inherited from chrono::parsers::ChParserYAML | |
| std::string | m_name |
| name of the YAML model | |
| bool | m_verbose |
| verbose terminal output (default: false) | |
| bool | m_use_degrees |
| all angles given in degrees (default: true) | |
| std::string | m_output_dir |
| root output directory | |
| std::shared_ptr< ChOutput > | m_output_db |
| output database | |
| OutputParameters | m_output |
| output parameters | |
| ChYamlFileHandler | m_file_handler |
| handler for data file paths | |
Member Function Documentation
◆ ApplyLoadControllerLoads()
| void chrono::parsers::ChParserMbsYAML::ApplyLoadControllerLoads | ( | const LoadControllerLoads & | controller_loads | ) |
Apply loads generated by the load controllers in the given list.
Notes:
- controller loads are automatically set in ChParserMbsYAML::DoStepDynamics if controllers have been added with ChParserMbsYAML::AttachLoadController.
- this function provides an alternative mechanism for applying controller loads (for arbitrary controllers, not necessarily derived from ChLoadController).
◆ ApplyMotorControllerActuations()
| void chrono::parsers::ChParserMbsYAML::ApplyMotorControllerActuations | ( | const MotorControllerActuations & | controller_loads | ) |
Apply actuations generated by the motor controllers in the given list.
Notes:
- controller actuations are automatically set in ChParserMbsYAML::DoStepDynamics if controllers have been added with ChParserMbsYAML::AttachMotorController.
- this function provides an alternative mechanism for applying controller actuations (for arbitrary controllers, not necessarily derived from ChMotorController).
◆ AttachLoadController()
| void chrono::parsers::ChParserMbsYAML::AttachLoadController | ( | std::shared_ptr< ChLoadController > | controller, |
| const std::string & | name, | ||
| int | model_instance | ||
| ) |
Attach the external controller for the load controller with given name.
This function can be called only after the MBS model was loaded and the model specification must include parameters for a load controller with specified name.
◆ AttachMotorController()
| void chrono::parsers::ChParserMbsYAML::AttachMotorController | ( | std::shared_ptr< ChMotorController > | controller, |
| const std::string & | name, | ||
| int | model_instance | ||
| ) |
Attach the external controller for the motor controller with given name.
This function can be called only after the MBS model was loaded, the model specification must include parameters for a motor with specified name, and that motor was set as externally actuated.
◆ CreateSystem()
| std::shared_ptr< ChSystem > chrono::parsers::ChParserMbsYAML::CreateSystem | ( | ) |
Create and return a Chrono system configured from cached simulation parameters.
If no YAML simulation file was loaded, this function returns a ChSystemNSC with default settings.
◆ DoStepDynamics()
| void chrono::parsers::ChParserMbsYAML::DoStepDynamics | ( | ) |
Advance dynamics of the multibody system.
- load controllers (if any are attached) are synchronized and their dynamics advanced in time;
- output is generated if requested in the simulation YAML file;
- the dynamics of the underlying Chrono system is advanced in time;
- soft real-time is enforced if requested in the simulation YAML file.
◆ Populate()
| int chrono::parsers::ChParserMbsYAML::Populate | ( | ChSystem & | sys, |
| const ChFramed & | model_frame = ChFramed(), |
||
| const std::string & | model_prefix = "" |
||
| ) |
Populate the given system with the cached Chrono components.
An instance of the underlying Chrono model can be created at the specified frame (relative to the global frame), with all Chrono object names using the specified prefix. Throws an error if no YAML model file was loaded.
◆ SaveOutput()
| void chrono::parsers::ChParserMbsYAML::SaveOutput | ( | ChSystem & | sys, |
| int | frame | ||
| ) |
Save simulation output results at the current time.
Note: this function is automatically called in ChParserMbsYAML::DoStepDynamics.
◆ SetSimulationParameters()
| void chrono::parsers::ChParserMbsYAML::SetSimulationParameters | ( | ChSystem & | sys | ) |
Set solver and integrator settings from cached values.
If no YAML simulation file was loaded, this function is a no-op.
The documentation for this class was generated from the following files:
- /builds/uwsbel/chrono/src/chrono_parsers/yaml/ChParserMbsYAML.h
- /builds/uwsbel/chrono/src/chrono_parsers/yaml/ChParserMbsYAML.cpp
Public Member Functions inherited from