opensim-org / opensim-core

SimTK OpenSim C++ libraries and command-line applications, and Java/Python wrapping.
https://opensim.stanford.edu
Apache License 2.0
783 stars 316 forks source link

Root component, World, Environment, combining ModelComponent and Component #769

Closed chrisdembia closed 1 year ago

chrisdembia commented 8 years ago

This is sloppy of me but I'm creating a new issue to document a conversation that @aseth1 @klshrinidhi and I had just now about nesting models and a separate "root component."

  1. Seems like ModelComponent and Component should be merged into one class named Component. The only issue is if it makes sense for all components to have geometry (like operators, etc.).
  2. To allow nesting components, make the Component class concrete so that it can be a container of other components with no other functionality itself. If someone were to create a new musculoskeletal model, its top level object would just be of type Component, not of type Model or World or ContainerComponent, etc.
  3. The current Model class should be called World (not Environment, because Environment doesn't have the right connotation...if I am standing in a park, I am not part of the park).
  4. @klshrinidhi made a good point about perhaps having separate sections in the world for "models" and for the "environment" so that users would know which parts of the World are expected to be swapped (e.g., simulating a human model in different environments).

This picture provides us with just two classes: Component and World. I think it is very clean.

@scpeters, how does Gazebo handle the "environment/world" separately from the models placed in the world? Do you allow nesting models inside other models? Where do you specify the gravity vector, as part of individual models or as part of some root "world" element?

scpeters commented 8 years ago

In Gazebo, the world is represented in both sdformat and the c++ class gazebo::physics::World as a container for models and lights. It also has settings for the gravity and magnetic field and coming soon is wind and atmospheric conditions. It also points to a physics engine with numerical parameters like time step.

It has not historically been the case, but recently nesting models within other models has become possible. We did this to make it easier to define individual components (such as a wheel) as separate models and compose them into a larger model (attaching wheels to a chassis).

Here's a link to our design document describing this:

chrisdembia commented 8 years ago

Thanks @scpeters, that is very helpful.