Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V0.7.0: Gymnasium Upgrade. Multiple teleOP controllers. MuJoCo upgrade #135

Merged
merged 62 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from 58 commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
9d4dd41
explicit add
Vittorio-Caggiano Oct 10, 2023
d212e33
SETUP: Updating setup details
vikashplus Oct 10, 2023
9726f7f
Marking the start of v0.7.0
vikashplus Oct 19, 2023
e160593
BUGFIX: Removing spurious self collisions in fetch model that was pre…
vikashplus Oct 19, 2023
3d48ad6
README: Adding homepage and white paper links
vikashplus Nov 9, 2023
63da185
init
vmoens Nov 7, 2023
74388b5
amend
vmoens Nov 7, 2023
3131405
amend
vmoens Nov 7, 2023
b7fb4de
add reset
vmoens Nov 7, 2023
4c3c418
add gymnasium
vmoens Nov 7, 2023
7abd6c8
BUGFIX: Removing torch dependency from testing. Proper Env seeding po…
vikashplus Nov 19, 2023
229221a
BUGFIX: Proper seeding for controlled randomization
vikashplus Nov 19, 2023
b7ca41e
BUGFIX: Fixing bugs in supporting different gym versions
vikashplus Nov 19, 2023
40f940c
FEATURE: Adding support with passing tests for multiple gym/gymnasium…
vikashplus Nov 23, 2023
9e41485
adding a bash script that tests across a few versions
vikashplus Nov 23, 2023
7c283f7
BUGFIX: Extra non existant geom options was introduced while moving f…
vikashplus Nov 24, 2023
15bda40
use forward call from parent class
Vittorio-Caggiano Dec 3, 2023
abc3f70
examine_sim.py adapted to mujoco bindings
andrearosasco Dec 20, 2023
96da0e5
added back shebang
andrearosasco Dec 20, 2023
81e90cb
add string xml loading
raghavauppuluri13 Nov 28, 2023
94fe08e
format and add str check
raghavauppuluri13 Dec 20, 2023
3b56770
BUGFIX: Removing hardcoded enums
vikashplus Dec 25, 2023
69c1303
FEATURE: Setup checks for FFmpeg, and prompts with options to install…
vikashplus Dec 25, 2023
e828a2e
CLEANUP: Removing lingering torch checks
vikashplus Dec 28, 2023
7bea218
BUGFIX: SED has a different syntax for -i option on mac
vikashplus Dec 28, 2023
1052b24
FEATURE: A cleaner way to import gym, or gymnasium as gym
vikashplus Dec 29, 2023
0a921ed
FEATURE: Moving gym resolution to util.__init__ for better user exper…
vikashplus Dec 31, 2023
ae51c9e
BUGFIX: Depth rendering was throwing lots of warnings. Defaulting it …
vikashplus Dec 31, 2023
676375f
FEATURE: reset now accepts an optional seed. A few env suites upgrade…
vikashplus Dec 31, 2023
89fe9b2
FEATURE: moving tests to env.unwrapped. Cleaning all test warnings
vikashplus Dec 31, 2023
9f32f15
FEATURE: Upgrading ChaseTag env
vikashplus Dec 31, 2023
3397e80
MAJOR: FEATURE: Adding the arms and legs models. Updagrading myo envs…
vikashplus Dec 31, 2023
535388e
BUGFIX: Cleaning up robot exit
vikashplus Dec 31, 2023
cb3c942
MINOR: Changing NONE to ALL for better clarity
vikashplus Dec 31, 2023
65bb9d2
FEATURE: Upgrading examine_env to use unwrapped env
vikashplus Dec 31, 2023
1077f86
BUG: Prompt utils is facing closing issues. Implemented a workaround …
vikashplus Dec 31, 2023
fbcc87c
MINOR: renamed close_robot to close for consistency
vikashplus Jan 1, 2024
0069093
TESTS: Updating tests to check everything for different versions. Add…
vikashplus Jan 1, 2024
047f158
FEATURE: Upgrading MyoSim to include latest MyoArm and MyoLegs models
vikashplus Jan 1, 2024
e4414a1
BUGFIX: Adding kwargs to all resets
vikashplus Jan 1, 2024
7378a88
Updating MyoSim git-hash
vikashplus Jan 1, 2024
82c6ab4
MAJOR: BUGFIX: Robot class doesn't delete the persistent robot connec…
vikashplus Jan 7, 2024
b8283d2
save _horizon during setup
vmoens Jan 10, 2024
9a42f8e
Update env_base.py
vmoens Jan 11, 2024
bc994ef
Update env_base.py
vmoens Jan 11, 2024
750f6c3
BUGFIX: Making registery fetch work for all versions
vikashplus Jan 12, 2024
77b4347
BUGFIX: using implement for to get horizon form proper place
vikashplus Jan 20, 2024
3f74d12
SYNC: MyoSuite f9873cba1186843700cc91f63220f0391cbaa85a
vikashplus Jan 20, 2024
4898218
BUGFIX: Camera index 0 will be out of range if no camera is modelled.…
vikashplus Mar 9, 2024
76b3455
BUGFIX+TESTS: fixed env unwrapped bug. Paths were using wrapped envs.…
vikashplus Mar 9, 2024
538894c
MINOR: Improved naming consistency
vikashplus Mar 11, 2024
c3936b2
MINOR: force pushing filename changes
vikashplus Mar 11, 2024
1cb8334
FEATURE: Adding documentaiton on how to use nested groups
vikashplus Mar 18, 2024
315606e
BUGFIX: RENDERER: Remove flipping of depth/segmentation buffers
sriramsk1999 Mar 6, 2024
777edf3
Added support for Xbox 360 controller based tele-operation
dosssman Feb 1, 2024
fb90d46
Revert "BUGFIX: Depth rendering was throwing lots of warnings. Defaul…
sriramsk1999 Mar 7, 2024
f95cde9
BUGFIX: Updating the submodule hash
vikashplus Mar 24, 2024
80ad5bf
MAJOR: Upgrading to MuJoCo 3.1.3
vikashplus Mar 24, 2024
dc97c43
BUGFIX: Extra index was added in np.choice option
vikashplus Mar 25, 2024
68de012
MAJOR: Moving setup to default to Gymnasium. Last stable point is gym…
vikashplus Mar 26, 2024
b3567f1
FEATURE: Adding an option to Silence all prompts
vikashplus Mar 26, 2024
5160e49
Adding shields
vikashplus Mar 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ License :: Under Apache License, Version 2.0 (the "License"); you may not use th

<!-- # RoboHive -->

![PyPI](https://img.shields.io/pypi/v/robohive)
[**[Homepage]**](https://sites.google.com/view/robohive) &ensp; [**[White Paper]**](https://arxiv.org/abs/2310.06828) &ensp; [![Documentation](https://img.shields.io/static/v1?label=Wiki&message=Documentation&color=<green)](https://github.com/vikashplus/robohive/wiki) ![PyPI](https://img.shields.io/pypi/v/robohive)
vikashplus marked this conversation as resolved.
Show resolved Hide resolved
![PyPI - License](https://img.shields.io/pypi/l/robohive)
[![Downloads](https://pepy.tech/badge/robohive)](https://pepy.tech/project/robohive)
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1rdSgnsfUaE-eFLjAkFHeqfUWzAK8ruTs?usp=sharing)
[![Slack](https://img.shields.io/badge/Slack-4A154B?style=for-the-badge&logo=slack&logoColor=white)](https://robohiveworkspace.slack.com)
[![Documentation](https://img.shields.io/static/v1?label=Wiki&message=Documentation&color=<green)](https://github.com/vikashplus/robohive/wiki)

![RoboHive Social Preview](https://github.com/vikashplus/robohive/assets/12837145/04aff6da-f9fa-4f5f-abc6-cfcd70c6cd90)
`RoboHive` is a collection of environments/tasks simulated with the [MuJoCo](http://www.mujoco.org/) physics engine exposed using the OpenAI-Gym API.
`RoboHive` is a collection of environments/tasks simulated with the [MuJoCo](http://www.mujoco.org/) physics engine exposed using the OpenAI-Gym API. Its compatible with any gym-compatible agents training framework ([Stable Baselines](https://stable-baselines3.readthedocs.io/en/master), [RLlib](https://docs.ray.io/en/latest/rllib/index.html), [TorchRL](https://pytorch.org/rl/), [AgentHive](https://sites.google.com/view/robohive/baseline), etc)

# Getting Started
Getting started with RoboHive is as simple as -
Expand Down
39 changes: 27 additions & 12 deletions robohive/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


# RoboHive version
__version__ = "0.6.0"
__version__ = "0.7.0"


# Check for RoboHive initialization
Expand All @@ -16,63 +16,78 @@


# Register RoboHive Envs
import gym
_current_gym_envs = gym.envs.registration.registry.env_specs.keys()
from robohive.utils import gym
from robohive.utils.implement_for import implement_for

#TODO: check versions
@implement_for("gym", None, "0.24")
def gym_registry_specs():
return gym.envs.registry.env_specs

@implement_for("gym", "0.24", None)
def gym_registry_specs():
return gym.envs.registry

@implement_for("gymnasium")
def gym_registry_specs():
return gym.envs.registry

_current_gym_envs = gym_registry_specs().keys()
vikashplus marked this conversation as resolved.
Show resolved Hide resolved
_current_gym_envs = set(_current_gym_envs)
robohive_env_suite = set()

# Register Arms Suite
import robohive.envs.arms # noqa
robohive_arm_suite = set(gym.envs.registration.registry.env_specs.keys())-robohive_env_suite-_current_gym_envs
robohive_arm_suite = set(gym_registry_specs().keys())-robohive_env_suite-_current_gym_envs
robohive_arm_suite = set(sorted(robohive_arm_suite))
robohive_env_suite = robohive_env_suite | robohive_arm_suite

# Register MyoBase Suite
import robohive.envs.myo.myobase # noqa
robohive_myobase_suite = set(gym.envs.registration.registry.env_specs.keys())-robohive_env_suite-_current_gym_envs
robohive_myobase_suite = set(gym_registry_specs().keys())-robohive_env_suite-_current_gym_envs
robohive_env_suite = robohive_env_suite | robohive_myobase_suite
robohive_myobase_suite = sorted(robohive_myobase_suite)

# Register MyoChal Suite
import robohive.envs.myo.myochallenge # noqa
robohive_myochal_suite = set(gym.envs.registration.registry.env_specs.keys())-robohive_env_suite-_current_gym_envs
robohive_myochal_suite = set(gym_registry_specs().keys())-robohive_env_suite-_current_gym_envs
robohive_env_suite = robohive_env_suite | robohive_myochal_suite
robohive_myochal_suite = sorted(robohive_myochal_suite)

# Register MyoDM Suite
import robohive.envs.myo.myodm # noqa
robohive_myodm_suite = set(gym.envs.registration.registry.env_specs.keys())-robohive_env_suite-_current_gym_envs
robohive_myodm_suite = set(gym_registry_specs().keys())-robohive_env_suite-_current_gym_envs
robohive_env_suite = robohive_env_suite | robohive_myodm_suite
robohive_myodm_suite = sorted(robohive_myodm_suite)

# Register FM suite
import robohive.envs.fm # noqa
robohive_fm_suite = set(gym.envs.registration.registry.env_specs.keys())-robohive_env_suite-_current_gym_envs
robohive_fm_suite = set(gym_registry_specs().keys())-robohive_env_suite-_current_gym_envs
robohive_env_suite = robohive_env_suite | robohive_fm_suite
robohive_fm_suite = sorted(robohive_fm_suite)

# Register Hands Suite
import robohive.envs.hands # noqa
# import robohive.envs.tcdm # noqa # WIP
robohive_hand_suite = set(gym.envs.registration.registry.env_specs.keys())-robohive_env_suite-_current_gym_envs
robohive_hand_suite = set(gym_registry_specs().keys())-robohive_env_suite-_current_gym_envs
robohive_env_suite = robohive_env_suite | robohive_hand_suite
robohive_hand_suite = sorted(robohive_hand_suite)

# Register Claw suite
import robohive.envs.claws # noqa
robohive_claw_suite = set(gym.envs.registration.registry.env_specs.keys())-robohive_env_suite-_current_gym_envs
robohive_claw_suite = set(gym_registry_specs().keys())-robohive_env_suite-_current_gym_envs
robohive_env_suite = robohive_env_suite | robohive_claw_suite
robohive_claw_suite = sorted(robohive_claw_suite)

# Register Multi-task Suite
import robohive.envs.multi_task # noqa
robohive_multitask_suite = set(gym.envs.registration.registry.env_specs.keys())-robohive_env_suite-_current_gym_envs
robohive_multitask_suite = set(gym_registry_specs().keys())-robohive_env_suite-_current_gym_envs
robohive_env_suite = robohive_env_suite | robohive_multitask_suite
robohive_multitask_suite = sorted(robohive_multitask_suite)

# Register Locomotion Suite
import robohive.envs.quadrupeds # noqa
robohive_quad_suite = set(gym.envs.registration.registry.env_specs.keys())-robohive_env_suite-_current_gym_envs
robohive_quad_suite = set(gym_registry_specs().keys())-robohive_env_suite-_current_gym_envs
robohive_env_suite = robohive_env_suite | robohive_quad_suite
robohive_quad_suite = sorted(robohive_quad_suite)

Expand Down
4 changes: 3 additions & 1 deletion robohive/envs/arms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
License :: Under Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
================================================= """

from gym.envs.registration import register
# from gym.envs.registration import register
from robohive.utils import gym; register=gym.register

from robohive.envs.env_variants import register_env_variant
import os
curr_dir = os.path.dirname(os.path.abspath(__file__))
Expand Down
4 changes: 4 additions & 0 deletions robohive/envs/arms/fetch/assets/fetch_reach_v0.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,8 @@

</worldbody>

<keyframe>
<key name="pick_pose" qpos='-0.000445298 0 0.4334 0.0803 -0.906015 -0.0314 0.87789 0 1.62 0 0.0315 0.0315'/>
</keyframe>

</mujoco>
16 changes: 11 additions & 5 deletions robohive/envs/arms/pick_place_v0.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
================================================= """

import collections
import gym
from robohive.utils import gym
import numpy as np

from robohive.envs import env_base
Expand Down Expand Up @@ -70,6 +70,12 @@ def _setup(self,
self.randomize = randomize
self.geom_sizes = geom_sizes

# Save body init pos
self.init_body_pos = {}
for body in ["obj0", "obj1", "obj2"]:
bid = self.sim.model.body_name2id(body)
self.init_body_pos[body] = self.sim.model.body_pos[bid].copy()

super()._setup(obs_keys=obs_keys,
weighted_reward_keys=weighted_reward_keys,
reward_mode=reward_mode,
Expand Down Expand Up @@ -109,7 +115,7 @@ def get_reward_dict(self, obs_dict):
rwd_dict['dense'] = np.sum([wt*rwd_dict[key] for key, wt in self.rwd_keys_wt.items()], axis=0)
return rwd_dict

def reset(self):
def reset(self, **kwargs):

if self.randomize:
# target location
Expand All @@ -119,19 +125,19 @@ def reset(self):
# object shapes and locations
for body in ["obj0", "obj1", "obj2"]:
bid = self.sim.model.body_name2id(body)
self.sim.model.body_pos[bid] += self.np_random.uniform(low=[-.010, -.010, -.010], high=[-.010, -.010, -.010])# random pos
self.sim.model.body_pos[bid] = self.init_body_pos[body] + self.np_random.uniform(low=[-.010, -.010, -.010], high=[-.010, -.010, -.010])# random pos
self.sim.model.body_quat[bid] = euler2quat(self.np_random.uniform(low=(-np.pi/2, -np.pi/2, -np.pi/2), high=(np.pi/2, np.pi/2, np.pi/2)) ) # random quat

for gid in range(self.sim.model.body_geomnum[bid]):
gid+=self.sim.model.body_geomadr[bid]
self.sim.model.geom_type[gid]=self.np_random.randint(low=2, high=7) # random shape
self.sim.model.geom_type[gid]=self.np_random.choice([2,3,4,5,6,7]) # random shape
vikashplus marked this conversation as resolved.
Show resolved Hide resolved
self.sim.model.geom_size[gid]=self.np_random.uniform(low=self.geom_sizes['low'], high=self.geom_sizes['high']) # random size
self.sim.model.geom_pos[gid]=self.np_random.uniform(low=-1*self.sim.model.geom_size[gid], high=self.sim.model.geom_size[gid]) # random pos
self.sim.model.geom_quat[gid]=euler2quat(self.np_random.uniform(low=(-np.pi/2, -np.pi/2, -np.pi/2), high=(np.pi/2, np.pi/2, np.pi/2)) ) # random quat
self.sim.model.geom_rgba[gid]=self.np_random.uniform(low=[.2, .2, .2, 1], high=[.9, .9, .9, 1]) # random color
self.sim.forward()

obs = super().reset(self.init_qpos, self.init_qvel)
obs = super().reset(self.init_qpos, self.init_qvel, **kwargs)
return obs

# def viewer_setup(self):
Expand Down
6 changes: 3 additions & 3 deletions robohive/envs/arms/push_base_v0.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
================================================= """

import collections
import gym
from robohive.utils import gym
import numpy as np

from robohive.envs import env_base
Expand Down Expand Up @@ -103,8 +103,8 @@ def get_reward_dict(self, obs_dict):
rwd_dict['dense'] = np.sum([wt*rwd_dict[key] for key, wt in self.rwd_keys_wt.items()], axis=0)
return rwd_dict

def reset(self):
def reset(self, **kwargs):
self.sim.model.site_pos[self.target_sid] = self.np_random.uniform(high=self.target_xyz_range['high'], low=self.target_xyz_range['low'])
self.sim_obsd.model.site_pos[self.target_sid] = self.sim.model.site_pos[self.target_sid]
obs = super().reset(self.init_qpos, self.init_qvel)
obs = super().reset(self.init_qpos, self.init_qvel, **kwargs)
return obs
6 changes: 3 additions & 3 deletions robohive/envs/arms/reach_base_v0.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
================================================= """

import collections
import gym
from robohive.utils import gym
import numpy as np

from robohive.envs import env_base
Expand Down Expand Up @@ -97,8 +97,8 @@ def get_reward_dict(self, obs_dict):
rwd_dict['dense'] = np.sum([wt*rwd_dict[key] for key, wt in self.rwd_keys_wt.items()], axis=0)
return rwd_dict

def reset(self, reset_qpos=None, reset_qvel=None):
def reset(self, reset_qpos=None, reset_qvel=None, **kwargs):
self.sim.model.site_pos[self.target_sid] = self.np_random.uniform(high=self.target_xyz_range['high'], low=self.target_xyz_range['low'])
self.sim_obsd.model.site_pos[self.target_sid] = self.sim.model.site_pos[self.target_sid]
obs = super().reset(reset_qpos, reset_qvel)
obs = super().reset(reset_qpos, reset_qvel, **kwargs)
return obs
4 changes: 2 additions & 2 deletions robohive/envs/claws/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
License :: Under Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
================================================= """

from gym.envs.registration import register
from robohive.utils import gym; register=gym.register
import os
curr_dir = os.path.dirname(os.path.abspath(__file__))
from robohive.envs.env_variants import register_env_variant
Expand Down Expand Up @@ -38,7 +38,7 @@
'model_path': curr_dir+'/trifinger/trifinger_reorient.xml',
'object_site_name': "object",
'target_site_name': "target",
'target_xyz_range': {'high':[.05, .05, 0.9], 'low':[-.05, -.05, 0.99]},
'target_xyz_range': {'high':[.05, .05, 0.99], 'low':[-.05, -.05, 0.9]},
'target_euler_range': {'high':[1, 1, 1], 'low':[-1, -1, -1]}
}
)
Expand Down
6 changes: 3 additions & 3 deletions robohive/envs/claws/reorient_v0.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
================================================= """

import collections
import gym
from robohive.utils import gym
import numpy as np

from robohive.envs import env_base
Expand Down Expand Up @@ -98,7 +98,7 @@ def get_reward_dict(self, obs_dict):
rwd_dict['dense'] = np.sum([wt*rwd_dict[key] for key, wt in self.rwd_keys_wt.items()], axis=0)
return rwd_dict

def reset(self):
def reset(self, **kwargs):
desired_pos = self.np_random.uniform(high=self.target_xyz_range['high'], low=self.target_xyz_range['low'])
self.sim.model.site_pos[self.target_sid] = desired_pos
self.sim_obsd.model.site_pos[self.target_sid] = desired_pos
Expand All @@ -108,5 +108,5 @@ def reset(self):
self.sim.model.site_quat[self.target_sid] = euler2quat(desired_orien)
self.sim_obsd.model.site_quat[self.target_sid] = euler2quat(desired_orien)

obs = super().reset(self.init_qpos, self.init_qvel)
obs = super().reset(self.init_qpos, self.init_qvel, **kwargs)
return obs
Loading
Loading