Skip to content

Commit

Permalink
Update quadruped envs and procedural generated floor texture (#279)
Browse files Browse the repository at this point in the history
* v0.6.0 Alpha Release: Sapien 3 integration  (#175)

* version bump

* copy code over

* refactor xmate3

* Update xmate3.py

* Changed Replay Trajectory to add options to record rewards as well as specify reward mode (#177)

* Added reward mode argument and record rewards argument to replay trajectory

* Fixed an error

---------

Co-authored-by: Arnav G <[email protected]>
Co-authored-by: Stone Tao <[email protected]>

* merge in refactor and updates for utils

* merge in changes for trajectory

* merge new examples

* merge new env code, refactors + new scene builder api

* merge new agents code

* merge code for new assets, floors etc.

* Update __init__.py

* Delete README.md

---------

Co-authored-by: Arnav G <[email protected]>
Co-authored-by: Arnav G <[email protected]>

* bump version and remove old requirements.txt file

* merge updates (#183)

- fix bug where some files were missing for franka for motion planning code
- fix bug that required user to have ai2 assets
- update floor tiles

* fix bug with scene demos

* version bump

* Update README.md

* merge updates

* Added decision transformer implementation to baseline (#180)

* copy over ms3 code

* fix pick cube task reward

* code format

* fix bug with to_tensor

* fix bug with to_tensor calls

* Fetch mobile (#188)

* Progress: Fetch mobile base

* fix

* fix

* unfinished: integrate into gpu sim stuff

* Fix: gpu sim compatibility issues

* Fix: fetch sensor cfg

* Fix: pd_ee_pose controller ik, env step cpu sim output, utils, fetch pose

* Fix: fetch is_grasping cpu sim

* code formatting

* fix a few a number of environments and tests (#190)

* fix a few envs, mark pick clutter as to be fixed in the future.

* code refactor

* fix some batching code, only reset and step return numpy on cpu mode

* format code

* code formatting

* remove a lot of unused variables

* gpu end effector control + various bug fixes (#191)

* update template

* add minimal pick cube task with "task sheet"

* task sheets

* init

* fix some bugs

* auto batch actions before processing

* init

* work

* bug fix

* Update visual_all_envs_cpu.py

* code golfing

* Update sapien_env.py

* update some tests

* Update vec_env.py

* formatting

* Squashed commit of the following:

commit 27101d4bdc4bd98451ed38d209045b36794288a9
Author: Stone Tao <[email protected]>
Date:   Tue Jan 23 18:12:03 2024 -0800

    fix some bugs with fetch

* fix bug with ee pose controller for panda

* Fix: pd_base_vel action expected Float not Double

* Trivial: table scene builder height and width

* Tasks remake for GPU sim (#192)

* work

* sac impl

* update template

* add minimal pick cube task with "task sheet"

* task sheets

* work

* work

* work

* fix templates

* using torch rng

* use torch rng

* batched uniform sampler, stack cube v1 task

* fix bugs with scene masking, merge_actors function

* Update pick_single_ycb.py

* Update pick_single_ycb.py

* bug fixes

* stack cube task bug fix

* refactor, appending hidden_objects list allows handling of hiding e.g. goal sites

* WIP work

* Revert "WIP work"

This reverts commit 9a6710f.

* quick fix: table dims in scene builder

* Tasks remake (#195)

* work

* sac impl

* update template

* add minimal pick cube task with "task sheet"

* task sheets

* work

* work

* work

* fix templates

* using torch rng

* use torch rng

* batched uniform sampler, stack cube v1 task

* fix bugs with scene masking, merge_actors function

* Update pick_single_ycb.py

* Update pick_single_ycb.py

* bug fixes

* stack cube task bug fix

* refactor, appending hidden_objects list allows handling of hiding e.g. goal sites

* WIP work

* Revert "WIP work"

This reverts commit 9a6710f.

* Revert "Revert "WIP work""

This reverts commit dcb3a5f.

* refactor some code, cache some properties, batch some properties

* fix naming of joints and links to also be prepended by scene-{i}

* bug fixes. Disable some functionality via a ._merged bool

* disable hand camera on panda (people should use the real sense panda config

* fix some setters

* work

* cache property for body data indices, it is now auto computed for user

* work

* change default value for static as resting objects still have a minor amount of angular rotation at times

* code updates

* decorator to assert error when gpu is initialized for calling functions user should not call.

* Update actor.py

* bug fixes

* work

* new utility functions for getting desired meshes, fixed goal site place

* performance improvements, swap obs and info

* Update __init__.py

* Update articulation.py

* Update pick_single_ycb.py

* update documentation

* tuned max episode steps for faster PPO

* use memory leak free new sapien and new buffer access api, fix controller reconfigure

* bug fixes, new tests

* test

* more bug fixes

* work

* add velocity target control gpu support. perf improvements for indexing articulation related things. Fix some bugs

* Update base_controller.py

* fix collision setting bugs

* apply vel

* fix self collision bugs

* fix gymnasium vector env wrapper to ignore the timelimit wrapper

* clean up

* fixes

* linkmerging

* bug fix

* work

* better camera angles

* work

* bug fixes

* code clean up with new wrappers

* Fix: pick cube get_obs_extra pass info

* Fix: fetch is_static

* Benchmarking code (#198)

* cleaner benchmarking code

* code init

* Update benchmark_cpu_sim.py

* Update benchmark_gpu_sim.py

* basic profiler

* update benchmark code

* code update

* Update README.md

* Fix: fetch is_static

---------

Co-authored-by: arth-shukla <[email protected]>

* Code cleanup (#197)

* cleanup

* remove old tasks

* cleanup

* refactor

* work

* more tests

* fix tests

* visual-encoders (#199)

* First commit of VisualEncoder

Add necessary files

* Try to deal with ConnectionResetError by changing wrappers location

* Change wrappers

* Removed tyro

* Change filename to lowercase

* work and add tests

* Delete ppo_liftcube_VisualEncoder.py

* fixes

---------

Co-authored-by: itsygao <[email protected]>
Co-authored-by: ygaoproj <[email protected]>

* faster benchmark results, new sapien

* bug fix

* Fix build_actor_ai2 Actor

* fix bug in cpu sim with init_raw_obs

* refactor some names from render_cameras to render_human_cameras and cameras to sensors

* Fix: fetch init

* Fix: fetch action space normed to -1 to 1

* Expand sensor api properly and refactor code to use it (#201)

* new tests, mark gpu tests, rework sensor api

* renaming

* new test

* code clean up

* docs

* Update sapien_env.py

* refator more code. Observation processing code only delete sensor data that they replace now.

* bug fix with human renderer

* fetch torso link

* Multirobot support + basic tasks (#202)

* multi robot support

* work

* Update two_robot_stack_cube.py

* finish task obs and reward

* reward, fixes

* bug fixes

* refinement

* Update pick_cube.py

* better camera angles

* fix int issue

* work

* Update two_robot_stack_cube.py

* work

* robot support typing

* better debugging camera

* Update two_robot_stack_cube.py

* work

* Update ppo.py

* add multi agent task tests

* bug fix with SUPPORTED_ROBOTS attribute

* Save benchmark data to csv (#203)

* profiling code to csv

* Update benchmark_gpu_sim.py

* trivial pr: `cameras` render mode (#204)

* Trivial: add cameras, renders both human cameras and agent sensors

* Fix: cpu inverted colors bug

* Remove cameras render mode

* Reset by index (#205)

* support partial resets and add test

* adhere to gymnasium

* support fail and success terminations and update docs

* work

* Update link.py

* Settable default scene/memory configs  + attempt at legged tasks + bug fixes (#206)

* basic locomotion robot

* work

* bug fixes

* work

* work

* Update articulation.py

* bug fixes

* tuned sim configs for some tasks

* tuned scene configs for more tasks

* work

* Update benchmark_gpu_sim.py

* Update sapien_env.py

* bug fix with controller not resetting after each env reset, affecting e.g. joint delta pos controllers (#207)

* fix controller not resetting to a initial state when env.reset is called...

* Update pd_joint_pos.py

* simplify code

* fixes

* use a lower memory configuration for all gpu sim tests

* reset agent before episode initialization in case episode initialization will set other qpos/qvel/qf values

* Update minimal_template.py

* fetch reachable dist

* update pick cube mp solution

* work

* init code

* Update interactive_teleop.py

* fix rt rendering

* Fixed bug for resetting elapsed steps (#211)

* fix some bugs with interactive panda tele-op and recording epsiodes and state get/set (#210)

* fix state setting.

* Update record.py

* work

* Update record.py

* wip

* buyg fixes and work

* bug fixes

* bug fixes

* work

* Update interactive_teleop.py

* Update pick_single_ycb.py

* reduce verbosity

* add batched timelimit wrapper only for gpu sim envs. Otherwise use gymnasium CPU one.

* Update registration.py

* use make_vec api? and avoid timelimit wrapper type issues

* bug fixes

* fix tests

* Update test_gpu_envs.py

* bug fixes

* Update ppo.py

* bug fixes

* fix bug where gymnasium vecenv wrapper would mess up success indicators and now gymnasium vecenv wrapper will auto find max episode steps value

* Fix: clone() on int in cpu sim

* Net force (#213)

* new package

* add net force tensor for a body

* net forces for multiple links on articulation

* work

* Update README.md

* Update xmate3.py

* update sapien version

* bug fixes with gpu ppo + partial resets (#215)

* partial reset + rookie implementations

* Update ppo.py

* Update README.md

* New task: DClaw Valve Rotating (#214)

* add: add dclaw rotating task

* ref: resolve todo

* fix: fix partial reset bug and make the environment much simpler for level 0

* work (#216)

* Fix: update render_human camera pos each render (e.g. when mounted to moving object)

* Baselines diffusion policy (#196)

* init diff policy baseline

* added training script and readme

* Finished diffusion policy baseline

* corrected jupyter notebook

* formatted notebook

* lowercase

---------

Co-authored-by: Stone Tao <[email protected]>

* fix bug where viewer camera was fixed in place to a sensor

* fix bug where failure is not used for termination

* bug fix with adding mounted cameras

* GPU Simulated Scenes, New more organized asset locations (#217)

* Fix: some scene manip env issues

* Better fetch cameras

* Fix: disable collisions only on fetch wheels

* Fix: fetch grapsing retval

* Progress: updates to scene-related classes/envs

* Fix: ai2thor scene builder set poses in initialize()

* Fix: ai2thor fetch scene builder ground collisions

* Fix: ai2 sb don't reconfigure by default

* Fix: sb load_actors instead of load_agents

* Trivial: add fetch resting qpos as attr

* Fix: pick_object scene pose setting

* Fix: renderer follows camera

* Fix: options is None

* Fix: fetch body delta pos controller

* Fix: record wrapper options=None by default

* Progress: support for loading navigable positions

* Progress: update base scene builder w/ DexM3 version

* Trivial: add arm camera, more "working" coacd objects

* minor ai2 sb changes

* Trivial: port over everything needed for scene manip testing

* bigger place reward

* Fix: keep x/y/zrot qvel in obs

* Try tune reward

* scale place reward more

* Try lessen place rew

* work

* work

* add bug fix

* Create scene_gpu.py

* Update sequential_task.py

* temp code

* make more objects static

* base empty scene manipulation env

* work

* work

* tests

* work

* more work

* modify benchmark code to support cpu and gpu sim tests

* add lighting?

* work

* articulations

* work

* Update scene_builder.py

* new dataset location

* fix for new dataset paths for some tasks, remove old tasks

* remove scene tasks as they are not done

* work

* work

* fixes

* change some defaults

---------

Co-authored-by: arth-shukla <[email protected]>

* Fix actor show/hide visual gpu sim (#221)

* Fix: actor show/hide visual not working on gpu sim

* Fix: by default hidden poses hidden

* bug fix

* Fix: setter and getter for actor.pose returns before_hide_pose if hidden, Fix: render human also sets _hidden_objs to hidden when doen rendering

* Unit test + fix for hide/show visual

---------

Co-authored-by: StoneT2000 <[email protected]>

* New docs (#220)

* work

* Update setup.py

* lots of docs

* work

* new theme and work

* readthedocs

* work

* bug fix

* fix

* work

* new task: in hand rotating in_hand_task (#219)

* fix bug where articulation get net contact forces was oriented wrong despite having right shape

* Fix: fetch in TableSceneBuilder

* New trajectory format and bug fixes (#222)

* work

* work?

* bug fixes and support new state dict format, reduce robot name verbosity

* Update pick_cube.py

* Update test_gpu_envs.py

* Update test_gpu_envs.py

* bug fix with setting before hide poses

* bug fixes

* work

* work

* fix a bunch of bugs

* fix batching for scalar values

* Update benchmark_maniskill.py

* bug fix

* add more useful print for ppo

* fix bug where controller reset did nothandle partial reset correctly and new tests

* bug fixes

* bug fix with set state dict where merged actor didnt have the right new name and other bugs

* bug fix to handle both single and multiple envs

* bug fixes with formatting

* Update record.py

* sapien upgrade

* Update sapien_utils.py

* work

* fix default value of gravity issue caused by newer python verisons

* Robot and scene builder registration and all env testing and temporarily removing old envs (#224)

* work

* unregister envs that are not meant to be run by themselves

* bug fixes

* bug fixes

* Update record.py

* Update README.md

* remove old code, register another scene

* typings

* make scene builder api consistent

* Update table_scene_builder.py

* Packaging and import fixing (#225)

* add lots of init py files

* new imports 1

* more

* work

* work

* work

* fixes

* Update setup.py

* remove circular import errors?

* support a default sim configuration choice

* use dacite package to fix nested dataclasses and typecheck the sim configs

* Update sapien_env.py

* More ms3 docs (#227)

* use shared version in docs and pip

* work

* support upload videos in docs

* work

* Update .gitignore

* docs

* Update teleoperation.md

* work

* work

* docs, move some code around

* Update quickstart.md

* some benchmarking results

* new theme with better github support

* examples

* Update teleoperation.md

* docs

* work

* Update custom_tasks.md

* work

* Update sapien_env.py

* work

* more docs

* work

* fix rtd

* Update conf.py

* temp fix for videos on rtc

* New packaging (#228)

* work

* www

* updates

* Update setup.py

* renaming a lot

* work

* Update publish-to-pypi.yml

* Bug fixes releases (#229)

* work

* more docs, change far for cameras

* Fix: circular import from table scene builder

* Mp work (#230)

* motion planning demos

* work

* Update motionplanning.md

* work

* work

* work

* examples

* Update interactive_panda.py

* remove old TODOs

* Update setup.py

* Update types.py

* docs

* Datasets+replay fix gpu camera matrices (#231)

* Update index.md

* raise user warning about registering with types

* Update README.md

* Update README.md

* disable target ee control mode due to bug atm, fix up replay trajectories

* clean up code

* www

* Update observations.py

* rgb option and work and bug fixes

* lots of bug fixes

* docs, small optimization to cache matrices

* work

* dataset documentation and some refactoring

* nice documentation and figures and bug fix

* Update panda.py

* more documentation on advanced featureas

* more docs

* typos

* more typo fixes

* code refactoring to simplify maniskill lifecycle (#232)

* refactor: reconfigure -> _reconfigure. Add _after_reconfigure() function for use cases like mobile manip. pick task

* refactor: _load_actors -> _load_scene. Deprecate _load_articulations in favor of user self organization in their code

* refactor _setup_lighting -> _load_lighting. better docs

* Update sapien_env.py

* docs

* multiple refactors (#233)

* refactoring

* bug fixes

* refactor: _register_* to _sensor_configs property

* refactoring default sim cfg

* consistency work

* consistent namings

* bump and include .stl files for mplib

* bug fixes

* Update setup.py

* Pull cube and Lift peg tasks with demo videos (#234)

* pull cube and lift peg tasks

* pull cube and lift peg tasks

* More docs (#235)

* Update README.md

* refactoring

* refactor the new tasks

* fix tasks, add more docs on tasks

* new diagrams and work

* temporarily remove not up to date code

* Update installation.md

* Update Dockerfile

* fix typos in docs

* new sapien package without mem leak

* More demos more docs (#236)

* Create contact_pair_impulse_test.py

* fixes

* Update setup.py

* work

* work

* Update download_asset.py

* bug fix with table scene builder

* Update demo_vis_pcd.py

* fix bug where deepcopy will track internal dict references that broke parse urdf config

* Add back some old tasks and bug fixes (#237)

* bug fix, upgrade realsense panda arm with actual real sense camera mesh

* work

* bug fix for episode recording

* bug fixes, reward mode none supported

* version bump

fixes:
- extrinsic camera matrix was None, broke some visual observations
-  improved panda + camera model
- bug where gpu sim used with 1 parallel env has broken visual data processing code
- bug where save video did not save separate videos on CPU sim.
changes:
- add back peg insertion side task (but without dense reward as its not easy to batch)

* Update observations.py

* Update installation.md

* fix demo name

* AssemblingKits-v1 on gpu, update docs and more consistent video names (#239)

* work

* use scene_idxs as opposed to scene_mask for faster loading, for loops are too slow

* Update assembling_kits.py

* bug fixes

* work

* updated documentation on scene_idxs (faster than scene_masks)

* partially support mimic joints (#238)

* partially support mimic joints

* Update articulation_builder.py

---------

Co-authored-by: StoneT2000 <[email protected]>

* fix warning consistency

* camera randomization tutorial/vectorized camera poses and some refactoring (#240)

* vectorized camera poses and refactor camera config

* bug fixes

* fixes

* documentation

* Update domain_randomization.md

* Update domain_randomization.md

* better naming

* refactoring some code

* a

* Refactor scene mask to scene idxs (#242)

* move out scene masks in favor of scene idxs

* Update link.py

* Update custom_tasks_advanced.md

* bug fix where could not mount camera on actor and docs

* dev4 version bump + fix bug with human render camera global pose

* typo

* work

* fix typos

* Refactor to provide options in load and initialize related functions (#243)

* work

* Update custom_tasks.md

* update documentation for new features, evaluate and get obs extra are optional now

* Added ppo partial reset arg (#241)

* Added ppo-partial reset arg

* Changed eval envs to also have a partial reset arg

* Fixed bug

* require actors/articulations built to have unique names

* Task tuning (#244)

* tuning

* Update README.md

* Update assembling_kits.py

* Update ppo.py

* update docs to clarify the gymnasium wrapper implementation reasons

* Update setup.py

* fix bug with pcd demo

* Fix: replicacad static obj poses

* Fix: replicacad pose issues

* Use fast kinematics library now for IK

* moving demos to hugging face and small change in demo storage structure.

* Created using Colaboratory

* Update setup.py

* move tutorial to right location

* fix demo manual control, hardcoded for fetch for now, and fix render functions returning batched images when there is only one environment

* support (batched) intrinsics in camera config and bug fix with demo manual control

* bug fix with ordering in dataclass

* set some defaults for camera cfg and fix ordering bug for some tasks

* Update setup.py

* Update README.md

* bug fix with typings for python 3.11

* update docs

* Batched drives, hide not ready functions, improved typing of structs, some bug fixes for unregistered envs (#248)

* support using different drive mode in the joint position controller

* refactoring

* work

* w

* w

* fix typings

* w

* w

* version bump

* Created using Colaboratory

* move draft tutorial

* docs on how to contribute tasks (#250)

* add

* w

* docs

* work

* work

* Rotate Cube Task using Trifingerpro robot (#249)

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* Fix pd ee pose for non panda robots, name refactors to be more explicit, and links have references to their joints (#253)

* save joint reference in links

* some code refactor, gpu sim ee control for other robots should be working now

* Pick clutter task (GPU) (#254)

* init

* Update pick_clutter_ycb.py

* fix bug with reset mask

* support more indexing options for Pose, actor_views and articulation_views, pick clutter task work, bug fix with pd_ee_pose controller

* return in reset info whether we reconfigure, necessary to know in order to determine when to delete trajectory buffer in record wrapper

* Update actor.py

* Update sapien_env.py

* Update pick_clutter_ycb.py

* docs

* Update pick_clutter_ycb.py

* fix bug with rotate cube task requiring pytorch kinematics library

* Update articulation.py

* Fix doc typos and refactor some old links/names (#255)

* updates to docs

* refactorings

* remove old code and fix circular import bugs with register envs utility

* sapien.physx -> physx for consistency and fix typings

* support evaluation options for PPO baseline code, remove old videos, refactor force_use_gpu_sim to sim_backend, bug fix where seed was null in saved trajectory jsons

* improved docs w.r.t installation

* versioin bump

* Fix RotateCubeLevel1 Rotation Init Error (#256)

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* update rotate_cube v1

* Peg insertion side batched dense reward, simplify utilities code and refactoring (#259)

* init

* clean up utility functions, refactoring some out into new files

* merge conflicts, refactoring

* simplify imports

* refactorings

* Update sapien_utils.py

* modify tutorial tasks to always include the common utilities module

* Update sapien_utils.py

* fix circular import errors

* bug fix with index_dict_array, affecting record episode wrapper

* more flexible pose setting for merged actors/articulation views on CPU (#260)

* support setting pose on a view of actors in CPU sim, add device property to pose struct

* flexible pose setting for links as well

* Clamp and normalize reward of RotateCubeEnv (#261)

* support controllers configuring balance_passive_force (#263)

* version bump

* typo fix in template robot file

* Fix memory leaks caused by bad cache for visual obs modes, fix printing of actors/articulations in pdb modes, clear sim state after reconfigures (#264)

* fix cpu sim mem leak with visual obs and constant reconfiguring

* more fixes

* remove old code

* Update mem_leak_test.py

* version bump

* Fix camera not accepting intrinsic argument, small refactor of add_camera API, and add peg insertion to test matrices (#267)

* work

* add peg insertion side to test matrices

* Update test_gpu_envs.py

* fix asset download for ReplicaCAD / hf repo datasets (to be moved in the future)

* Add segmentation data w/ docs + demos, fix replay trajectory test, change OrderedDict to dict in some places (#270)

* work

* fix replay trajectory tests to use new directory

* Update test_replay_trajectory.py

* Update test_replay_trajectory.py

* deprecate env.get_actors and env.get_articulations.

* demo code

* fix demo code

* Update observation.md

* Update sapien_env.py

* Update sapien_env.py

* version bump

* fix fast_kinematics version as latest one may be buggy as its in beta

* fix bug where extrinsic matrix was incorrectly cached when there is a mount

* Update render_camera.py

* add appropriate tests

* fix tests

* Fix: use physx.is_gpu_enabled() instead of self.num_envs > 1 (#272)

* MJCF Loader for SAPIEN/ManiSkill and example CartPole task from DM Control, New QoL features for joints (#273)

* move controller config setup after articulation is loaded for robots to give user access to active joints easily

* change fix_root_link to be a agent property

* work

* work

* fixes

* Update mjcf_loader.py

* work

* code cleanup, use joint pos correctly

* work

* fixes

* work

* a1 loading test

* Update _mjcf_loader.py

* support loading other objects in xml

* cartpole task implemented from xml

* cart pole task, fetch qpos by joint

* work

* docs

* fix controllers, use disable gravity to balance passive forces on CPU and GPU.

* Update sapien_env.py

* more runtime errors

* tuned ppo for cartpole

* some minor fixes

* cart pole video demo

* docs

* H1 robot (#275)

* work

* cleaner code

* init

* fix urdf mesh paths

* provide a typical "standing" keyframe

* fix a few files

* some useful scripts

* work

* new envs, simplified contact version of h1 robot

* work

* Tutorial on how to add robots (#276)

* work

* cleaner code

* work

* work

* Update custom_robots.md

* Update custom_robots.md

* Update controllers.md

* Code refactor for better naming (#277)

* default_sim_cfg -> default_sim_config to follow semantics of other code

* _sensor_configs->_default_sensor_configs, _human_render_camera_configs->_default_human_render_camera_configs

* remove _parsed

* remove OrderedDict in favor of dict and removing old code

* fixing up anymal and refactoring

* add friction to robot feet to let it stand easily, procedurally generated checkerboard

* Update ground.py

* tuning

* work

* Update anymal_c.py

* refactor

* update benchmarking code

* work

* tune joint limits for easy rl

* use simplified collision mesh

* work

* revert

* revert

* revert

* revert

* revert

* work

* Delete floor_tiles_06_2k.glb

---------

Co-authored-by: Arnav G <[email protected]>
Co-authored-by: Arnav G <[email protected]>
Co-authored-by: arth-shukla <[email protected]>
Co-authored-by: itsygao <[email protected]>
Co-authored-by: ygaoproj <[email protected]>
Co-authored-by: Yuzhe Qin <[email protected]>
Co-authored-by: smtrived <[email protected]>
Co-authored-by: Fanbo Xiang <[email protected]>
Co-authored-by: Chen Bao <[email protected]>
Co-authored-by: Chen Bao <[email protected]>
  • Loading branch information
11 people authored Apr 26, 2024
1 parent 7abac39 commit d772247
Show file tree
Hide file tree
Showing 21 changed files with 3,551 additions and 843 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ python -m twine upload dist/*

ManiSkill is built to support building your own custom tasks easily. The documentation on how to use the ManiSkill API to do so is here: https://maniskill.readthedocs.io/en/latest/user_guide/tutorials/custom_tasks.html

We encourage users to either create their own repositories with their own tasks for others to use, or to submit to this ManiSkill repo to be part of the official, *vetted*, task list. For tasks in this repo, we do a number of checks to ensure they are of high quality and are well documented. For detailed information on how to add new tasks, see https://maniskill.readthedocs.io/en/latest/contributing/task.html
We encourage users to either create their own repositories with their own tasks for others to use, or to submit to this ManiSkill repo to be part of the official, *vetted*, task list. For tasks in this repo, we do a number of checks to ensure they are of high quality and are well documented. For detailed information on how to add new tasks, see https://maniskill.readthedocs.io/en/latest/contributing/task.html
5 changes: 5 additions & 0 deletions mani_skill/agents/base_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ class BaseAgent:
"""Whether to fix the root link of the robot"""
load_multiple_collisions: bool = False
"""Whether the referenced collision meshes of a robot definition should be loaded as multiple convex collisions"""
disable_self_collisions: bool = False
"""Whether to disable self collisions. This is generally not recommended as you should be defining a SRDF file to exclude specific collisions.
However for some robots/tasks it may be easier to disable all self collisions between links in the robot to increase simulation speed
"""

keyframes: Dict[str, Keyframe] = dict()
"""a dict of predefined keyframes similar to what Mujoco does that you can use to reset the agent to that may be of interest"""
Expand Down Expand Up @@ -123,6 +127,7 @@ def _load_articulation(self):
loader.name = f"{self.uid}-agent-{self._agent_idx}"
loader.fix_root_link = self.fix_root_link
loader.load_multiple_collisions_from_file = self.load_multiple_collisions
loader.disable_self_collisions = self.disable_self_collisions

if self.urdf_config is not None:
urdf_config = sapien_utils.parse_urdf_config(self.urdf_config)
Expand Down
106 changes: 58 additions & 48 deletions mani_skill/agents/robots/anymal/anymal_c.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# TODO (stao): Anymal may not be modelled correctly or efficiently at the moment
import numpy as np
import sapien
import torch

from mani_skill import PACKAGE_ASSET_DIR, format_path
from mani_skill.agents.base_agent import BaseAgent
from mani_skill import PACKAGE_ASSET_DIR
from mani_skill.agents.base_agent import BaseAgent, Keyframe
from mani_skill.agents.controllers import *
from mani_skill.agents.registration import register_agent
from mani_skill.utils import sapien_utils
Expand All @@ -11,33 +14,53 @@
@register_agent()
class ANYmalC(BaseAgent):
uid = "anymal-c"
urdf_path = f"{PACKAGE_ASSET_DIR}/robots/anymal-c/urdf/anymal.urdf"
urdf_config = dict()
urdf_path = f"{PACKAGE_ASSET_DIR}/robots/anymal-c/urdf/anymal_old.urdf"
urdf_config = dict(
_materials=dict(
foot=dict(static_friction=2.0, dynamic_friction=2.0, restitution=0.0)
),
link=dict(
LF_FOOT=dict(material="foot", patch_radius=0.1, min_patch_radius=0.1),
LH_FOOT=dict(material="foot", patch_radius=0.1, min_patch_radius=0.1),
RF_FOOT=dict(material="foot", patch_radius=0.1, min_patch_radius=0.1),
RH_FOOT=dict(material="foot", patch_radius=0.1, min_patch_radius=0.1),
),
)
fix_root_link = False
disable_self_collisions = True

keyframes = dict(
standing=Keyframe(
pose=sapien.Pose(p=[0, 0, 0.545]),
qpos=np.array(
[0.03, -0.03, 0.03, -0.03, 0.4, 0.4, -0.4, -0.4, -0.8, -0.8, 0.8, 0.8]
),
)
)

joint_names = [
"LF_HAA",
"RF_HAA",
"LH_HAA",
"RH_HAA",
"LF_HFE",
"RF_HFE",
"LH_HFE",
"RH_HFE",
"LF_KFE",
"RF_KFE",
"LH_KFE",
"RH_KFE",
]

def __init__(self, *args, **kwargs):
self.joint_names = [
"LF_HAA",
"RF_HAA",
"LH_HAA",
"RH_HAA",
"LF_HFE",
"RF_HFE",
"LH_HFE",
"RH_HFE",
"LF_KFE",
"RF_KFE",
"LH_KFE",
"RH_KFE",
]
super().__init__(*args, **kwargs)

@property
def _controller_configs(self):
self.arm_stiffness = 85.0
self.arm_stiffness = 80.0
self.arm_damping = 2.0
self.arm_force_limit = 100

# delta action scale for Omni Isaac Gym Envs is self.dt * self.action_scale = 1/60 * 13.5. NOTE that their self.dt value is not the same as the actual DT used in sim...., they use default of 1/100
pd_joint_delta_pos = PDJointPosControllerConfig(
self.joint_names,
Expand All @@ -59,37 +82,22 @@ def _controller_configs(self):
normalize_action=False,
use_delta=False,
)
# TODO (stao): For quadrupeds perhaps we disable gravit for all links except the root?
controller_configs = dict(
pd_joint_delta_pos=pd_joint_delta_pos, pd_joint_pos=pd_joint_pos
pd_joint_delta_pos=dict(
body=pd_joint_delta_pos, balance_passive_force=False
),
pd_joint_pos=dict(body=pd_joint_pos, balance_passive_force=False),
)
return controller_configs

def _after_init(self):
pass

def _load_articulation(self):
"""
Load the robot articulation
"""
loader = self.scene.create_urdf_loader()
loader.name = self.uid
if self._agent_idx is not None:
loader.name = f"{self.uid}-agent-{self._agent_idx}"
loader.fix_root_link = self.fix_root_link

urdf_path = format_path(str(self.urdf_path))

urdf_config = sapien_utils.parse_urdf_config(self.urdf_config)
sapien_utils.check_urdf_config(urdf_config)

# TODO(jigu): support loading multiple convex collision shapes
sapien_utils.apply_urdf_config(loader, urdf_config)
loader.disable_self_collisions = True
self.robot: Articulation = loader.load(urdf_path)
assert self.robot is not None, f"Fail to load URDF from {urdf_path}"
# disable gravity / compensate gravity automatically in all links but the root one
for link in self.robot.links[1:]:
link.disable_gravity = True

def is_standing(self):
"""This quadruped is considered standing if it is face up and body is at least 0.5m off the ground"""
def is_standing(self, ground_height=0):
"""This quadruped is considered standing if it is face up and body is at least 0.35m off the ground"""
target_q = torch.tensor([1, 0, 0, 0], device=self.device)
inner_prod = (self.robot.pose.q * target_q).sum(axis=1)
# angle_diff = 1 - (inner_prod ** 2) # computes a distance from 0 to 1 between 2 quaternions
Expand All @@ -98,7 +106,9 @@ def is_standing(self):
) # computes an angle between 2 quaternions
# about 20 degrees
aligned = angle_diff < 0.349
high_enough = self.robot.pose.p[:, 2] > 0.5
return torch.logical_and(aligned, high_enough)
high_enough = self.robot.pose.p[:, 2] > 0.35 + ground_height
return aligned & high_enough

sensor_configs = []
def is_fallen(self, ground_height=0):
"""This quadruped is considered fallen if its body is 0.175m off the ground"""
return self.robot.pose.p[:, 2] < 0.175 + ground_height
Loading

0 comments on commit d772247

Please sign in to comment.