|
opynsim
Unofficial C++ Documentation
|
#include <model.h>
Public Member Functions | |
| ModelState | initial_state (ModelStateStage realized_to=ModelStateStage::instance) const |
| std::unordered_set< std::string > | rotational_columns_in (const DataFrame &data_frame) const |
| std::unordered_map< std::string, Symbol > | column_to_state_variable_mappings (const DataFrame &data_frame) const |
| DataFrame | convert_data_frame_to_radians (const DataFrame &data_frame) const |
| ModelStates | states_from_data_frame (const DataFrame &data_frame, ModelStateStage realized_to=ModelStateStage::instance) const |
| void | realize (ModelState &model_state, ModelStateStage model_state_stage) const |
Realizes model_state to the given model_state_stage. | |
| size_t | num_coordinates () const |
| Returns the number of coordinates in the model. | |
| std::vector< Symbol > | coordinates () const |
| Returns all coordinates in the model. | |
| double | get_coordinate_value (const ModelState &model_state, const Symbol &coordinate) const |
Returns the value of coordinate in model_state. | |
| void | set_coordinate_value (ModelState &model_state, const Symbol &coordinate, double value) const |
Sets the value of coordinate in model_state to value. | |
| double | get_coordinate_speed (const ModelState &model_state, const Symbol &coordinate) const |
Returns the speed of coordinate in model_state. | |
| void | set_coordinate_speed (ModelState &model_state, const Symbol &coordinate, double speed) const |
Sets the speed of coordinate in model_state to speed. | |
| bool | is_coordinate_locked (const ModelState &model_state, const Symbol &coordinate) const |
Returns true if coordinate is locked in model_state. | |
| void | set_coordinate_locked (ModelState &model_state, const Symbol &coordinate, bool locked=true) const |
Sets the locked state of coordinate in model_state to locked. | |
| bool | is_coordinate_rotational (const Symbol &coordinate) const |
Returns true if coordinate has a rotational (i.e. not translational or coupled). | |
| size_t | num_outputs () const |
| Returns the number of outputs in the model. | |
| std::vector< Symbol > | outputs () const |
| Returns all outputs in the model. | |
| OutputValue | get_output_value (const ModelState &model_state, const Symbol &output) const |
Returns the value of output in model_state. | |
| std::vector< osc::SceneDecoration > | decorations (osc::SceneCache &, const ModelState &model_state, const OpenSimDecorationOptions &={}) const |
Returns scene decorations that visually represent *this in model_state. | |
| const OpenSim::Model & | open_sim_model () const |
Returns the underlying OpenSim::Model (internal method: be careful with this). | |
Friends | |
| class | ModelSpecification |
Represents a readonly multibody physics system compiled from a ModelSpecification.
| std::unordered_map< std::string, Symbol > opyn::Model::column_to_state_variable_mappings | ( | const DataFrame & | data_frame | ) | const |
Returns associative mappings between the names of columns in data_frame and state variables in this Model, where the correspondence can be found.
Returns a new DataFrame that's the result of converting rotational columns in data_frame to radians (if applicable).
Behavior:
data_frame.attrs()["inDegrees"] != "yes", returns a copy of data_frame as-is.data_frame and uses this->rotational_columns_in(copy) to figure out which columns in are rotational, followed by scaling the entire column to radians. The "inDegrees" key is cleared from the returned copy. | std::vector< Symbol > opyn::Model::coordinates | ( | ) | const |
Returns all coordinates in the model.
| std::vector< osc::SceneDecoration > opyn::Model::decorations | ( | osc::SceneCache & | , |
| const ModelState & | model_state, | ||
| const OpenSimDecorationOptions & | = {} |
||
| ) | const |
Returns scene decorations that visually represent *this in model_state.
| double opyn::Model::get_coordinate_speed | ( | const ModelState & | model_state, |
| const Symbol & | coordinate | ||
| ) | const |
Returns the speed of coordinate in model_state.
| double opyn::Model::get_coordinate_value | ( | const ModelState & | model_state, |
| const Symbol & | coordinate | ||
| ) | const |
Returns the value of coordinate in model_state.
| OutputValue opyn::Model::get_output_value | ( | const ModelState & | model_state, |
| const Symbol & | output | ||
| ) | const |
Returns the value of output in model_state.
| ModelState opyn::Model::initial_state | ( | ModelStateStage | realized_to = ModelStateStage::instance | ) | const |
Returns the initial (default) state of this model, which is the state that was defined by the ModelSpecification used to build this model.
The realized_to argument ensures the returned ModelState is realized as-if by calling this->realize(returned_state, realized_to).
| bool opyn::Model::is_coordinate_locked | ( | const ModelState & | model_state, |
| const Symbol & | coordinate | ||
| ) | const |
Returns true if coordinate is locked in model_state.
| bool opyn::Model::is_coordinate_rotational | ( | const Symbol & | coordinate | ) | const |
Returns true if coordinate has a rotational (i.e. not translational or coupled).
| size_t opyn::Model::num_coordinates | ( | ) | const |
Returns the number of coordinates in the model.
| size_t opyn::Model::num_outputs | ( | ) | const |
Returns the number of outputs in the model.
| const OpenSim::Model & opyn::Model::open_sim_model | ( | ) | const |
Returns the underlying OpenSim::Model (internal method: be careful with this).
| std::vector< Symbol > opyn::Model::outputs | ( | ) | const |
Returns all outputs in the model.
| void opyn::Model::realize | ( | ModelState & | model_state, |
| ModelStateStage | model_state_stage | ||
| ) | const |
Realizes model_state to the given model_state_stage.
| std::unordered_set< std::string > opyn::Model::rotational_columns_in | ( | const DataFrame & | data_frame | ) | const |
Returns a set of the names of the columns in data_frame that can be mapped to rotational state variables in this Model.
| void opyn::Model::set_coordinate_locked | ( | ModelState & | model_state, |
| const Symbol & | coordinate, | ||
| bool | locked = true |
||
| ) | const |
Sets the locked state of coordinate in model_state to locked.
| void opyn::Model::set_coordinate_speed | ( | ModelState & | model_state, |
| const Symbol & | coordinate, | ||
| double | speed | ||
| ) | const |
Sets the speed of coordinate in model_state to speed.
| void opyn::Model::set_coordinate_value | ( | ModelState & | model_state, |
| const Symbol & | coordinate, | ||
| double | value | ||
| ) | const |
Sets the value of coordinate in model_state to value.
| ModelStates opyn::Model::states_from_data_frame | ( | const DataFrame & | data_frame, |
| ModelStateStage | realized_to = ModelStateStage::instance |
||
| ) | const |
Returns ModelStates constructed from data_frame.
Columns in data_frame will be mapped to state variables in this Model (see: column_to_state_variable_mappings). Each row in data_frame constructs one state in the returned ModelStates, in row-order.
If data_frame.attrs()["inDegrees"] == "yes" then rotational columns in data_frame will be automatically converted into radians internally (see: rotational_columns_in). This is to support DataFrames loaded from legacy data sources.
The realized_to argument ensures each returned ModelStates is realized as-if by calling this->realize(returned_states[i], realized_to).
|
friend |