🪄 Transition Rules
Description
Transition rules are OmniGibson
's method for simulating complex physical phenomena not directly supported by the underlying omniverse physics engine, such as slicing, blending, and cooking. A given TransitionRule
dynamically checks for its internal sets of conditions, and, if validated, executes its corresponding transition
.
Transition Rules must be enabled before usage!
To enable usage of transition rules, gm.ENABLE_TRANSITION_RULES
(1) must be set!
- Access global macros via
from omnigibson.macros import gm
Usage
Creating
Because TransitionRule
s are monolithic classes, these should be defined before OmniGibson
is launched. A rule can be easily extended by subclassing the BaseTransitionRule
class and implementing the necessary functions. For a simple example, please see the SlicingRule
class.
Runtime
At runtime, each scene owns a TransitionRuleAPI
instance, which automatically handles the stepping and processing of all defined transition rule classes. For efficiency reasons, rules are dynamically loaded and checked based on the object / system set currently active in the scene. A rule will only be checked if there is at least one valid candidate combination amongst the current object / system set. For example, if there is no sliceable object present in this scene, then SlicingRule
will not be active. Every time an object / system is added / removed from the scene, all rules are refreshed so that the current active transition rule set is always accurate.
In general, you should not need to interface with the TransitionRuleAPI
class at all -- if your rule implementation is correct, then the API will automatically handle the transition when the appropriate conditions are met!
Types
OmniGibson
currently supports _ types of diverse transition rules, each representing a different complex physical phenomena:
SlicingRule Encapsulates slicing an object into halves (e.g.: slicing an apple). Required Candidates
Conditions
Transition
|
|
DicingRule Encapsulates dicing a diceable into small chunks (e.g.: dicing an apple). Required Candidates
Conditions
Transition
|
|
MeltingRule Encapsulates melting an object into liquid (e.g.: melting chocolate). Required Candidates
Conditions
Transition
|
|
CookingPhysicalParticleRule Encapsulates cooking physical particles (e.g.: boiling water). Required Candidates
Conditions
Transition
|
|
ToggleableMachineRule Encapsulates transformative changes when a button is pressed (e.g.: blending a smoothie). Valid transitions are defined by a pre-defined set of "recipes" (input / output combinations). Required Candidates
Conditions
Transition
|
|
MixingToolRule Encapsulates transformative changes during tool-driven mixing (e.g.: mixing a drink with a stirrer). Valid transitions are defined by a pre-defined set of "recipes" (input / output combinations). Required Candidates
Conditions
Transition
|
|
CookingRule Encapsulates transformative changes during cooking (e.g.: baking a cake). Valid transitions are defined by a pre-defined set of "recipes" (input / output combinations). Required Candidates
Conditions
Transition
|
|
WasherRule Encapsulates washing mechanism (e.g.: cleaning clothes in the washing machine with detergent). Washing behavior (i.e.: what types of particles are removed from clothes during washing) is predefined. Required Candidates
Conditions
Transition
|
|
DryerRule Encapsulates drying mechanism (e.g.: drying clothes in the drying machine). Required Candidates
Conditions
Transition
|