OmniGibson icon indicating copy to clipboard operation
OmniGibson copied to clipboard

Parallel environments support & RL toolkit

Open cgokmen opened this issue 10 months ago • 0 comments

Please read below changelog prior to reviewing huge PR!

I designed this PR but major thanks to @sujaygarlanka for initial implementation and @hang-yin for tying up the hundreds of loose ends.

Major changes:

  • Add capability to track multiple scenes in one simulator instance
  • Update env such that it owns exactly one scene
  • Make all the infra changes necessary to allow multiple envs to be loaded with each own scene
  • Restructure prim hierarchy to allow scene prims to do scene offsetting
  • Restructure particle systems to use one system instance per scene instead of subclassing & at a global scale
  • Grasp task, reward, and termination are introduced for primitive-learning experiments
  • Fix some major issues in the motion primitives and get the grasp working smoothly in delta joint control mode
  • Introduce naming requirements for controllable and dummy object prim paths to ensure that these objects can be filtered by view globs.
  • Introduces BatchControlViewAPI, which allows cached read/writes to all robots’ controller states for each physics step, drastically improving controller speeds
  • RigidContactAPI, ControllableObjectViewAPI etc. APIs are classes that can be instantiated globally to provide different APIs for subsets of objects, e.g. there’s a GripperRigidContactAPI and a DummyObjectViewAPI
  • Add Scene capability to prebuild USD and save it so that many copies of the scene can be loaded quickly (and also allowing USD copies of full scene to be generated easily)

Minor changes:

  • Change simulator from full-lifetime singleton to stage-lifetime. This involved some major changes to the simulator lifecycle (what happens at init / init stage / open new stage / reset / etc)
  • Replace gym with gymnasium
  • Remove state size assumption and allow each serializable instance to deserialize a variable number of items (will be used later for RigidPrim state, currently not included in PR due to some issues with it)
  • Make JointCtrl dof idxing faster using ix instead of meshgrid (makes noticeable differerence in profile)
  • Add a relatively half-assed ternary mode into MultiFingerGripperController to allow it to have kind of a delta mode. We will iterate on this in a follow-up PR.
  • Add pre-step and post-step APIs to env to allow step to get batched across envs
  • Falling condition now supports checking for toppling over
  • Fixes memory leak in CachedFunctions by removing caching (the ControllableObjectViewAPI already performs caching - we will remove the class entirely in a follow up)
  • Remove UniquelyNamed - this assumption no longer holds
  • Improve speed by removing certain OG-to-trimesh reconversions e.g. in check_extent_radius_ratio
  • Introduce a WIP kit file that is based on OmniIsaacSimEnv’s, which seems to be a bit faster.
  • Update assisted grasping to use tensorized collision checks for much faster grasp handling
  • Add a created_manually flag to distinguish objects that were generated through the pipeline (which will have APIs correctly applied) vs others. This needs to be done in the opposite direction but requires a pipeline run.
  • Add include_in_obs flag to external sensors such that they can be rendered only for debug viewing vs. also as an env obs

Caveats:

  • Transition Map API is broken in the multi-scene context and needs to be fixed in a follow up.

cgokmen avatar Apr 04 '24 20:04 cgokmen