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

Basic arm reaching environment created, myoArmReachRandom-v0 #232

Open
wants to merge 28 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
82ffe29
Basic arm reaching environment created, myoArmReachRandom-v0
jamesheald Sep 18, 2024
6cb0dac
Merge pull request #259 from MyoHub/dev
Vittorio-Caggiano Oct 28, 2024
2be0106
Merge pull request #261 from MyoHub/dev
Vittorio-Caggiano Oct 28, 2024
7927eb0
Merge pull request #265 from MyoHub/dev
Vittorio-Caggiano Oct 31, 2024
da8068b
Merge branch 'MyoHub:main' into myoArmReachRandom-v0
jamesheald Nov 27, 2024
de2718c
Update myoarm_reach.xml
jamesheald Nov 27, 2024
529d812
Update myoarm_reach.xml
jamesheald Nov 27, 2024
19ce87d
Update __init__.py
jamesheald Nov 27, 2024
27d8246
Update myoarm_reach.xml
jamesheald Nov 27, 2024
13ba926
Update myoarm_reach.xml
jamesheald Nov 30, 2024
3fe5baf
Add files via upload
jamesheald Dec 16, 2024
27b87b7
Delete docs/source/images/myoArmNoHand.jpg
jamesheald Dec 16, 2024
e88a130
Add files via upload
jamesheald Dec 16, 2024
85e4f58
Update suite.rst
jamesheald Dec 16, 2024
4d07ede
Add files via upload
jamesheald Dec 16, 2024
268cda8
Delete docs/source/images/myoArmNoHand.png
jamesheald Dec 16, 2024
2de1be5
Add files via upload
jamesheald Dec 16, 2024
31f60cd
Delete docs/source/images/myoArmNoHand.png
jamesheald Dec 16, 2024
6689073
Add files via upload
jamesheald Dec 16, 2024
abd4f37
Delete docs/source/images/myoArmNoHand.png
jamesheald Dec 16, 2024
433806d
Add files via upload
jamesheald Dec 16, 2024
6980bb4
Update suite.rst
jamesheald Dec 16, 2024
0f4bd1d
Add files via upload
jamesheald Dec 16, 2024
720a275
Added a description of the arm reach task, with an image
jamesheald Dec 16, 2024
8966b3d
finger reach mjx
jamesheald Dec 22, 2024
bda7d75
print progress
jamesheald Dec 22, 2024
bf42903
change url to myo_sim submodule
jamesheald Dec 23, 2024
a9cca32
Adding example script to show how to detach hand from the arm
vikashplus Dec 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
3 changes: 2 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[submodule "myosuite/simhive/myo_sim"]
path = myosuite/simhive/myo_sim
url = https://github.com/MyoHub/myo_sim.git
url = https://github.com/jamesheald/myo_sim.git
branch = arm_with_no_hand
[submodule "myosuite/simhive/furniture_sim"]
path = myosuite/simhive/furniture_sim
url = https://github.com/vikashplus/furniture_sim.git
Expand Down
Binary file added docs/source/images/myoArmNoHand_reach.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/images/myoArm_NoHand.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 26 additions & 1 deletion docs/source/suite.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Models and tasks are the most important aspects of Myosuite. To provide further,
* :ref:`myoHand`
* :ref:`myoLeg`
* :ref:`myoArm`
* :ref:`myoArmNoHand`
* :ref:`tasks`
* :ref:`task_and_variations`

Expand All @@ -23,7 +24,7 @@ Models and tasks are the most important aspects of Myosuite. To provide further,
Models
********

MyoSuite consists of five models: :ref:`myoFinger`, :ref:`myoElbow`, :ref:`myoHand`, :ref:`myoArm` and :ref:`myoLeg`.
MyoSuite consists of six models: :ref:`myoFinger`, :ref:`myoElbow`, :ref:`myoHand`, :ref:`myoArm`, :ref:`myoArmNoHand` and :ref:`myoLeg`.
Using these models, we design a rich collection of tasks ranging across simple reaching movements,
contact-rich movements involving object-manipulation such as pen-twirling and baoding balls, as well as locomotion behaviors.

Expand Down Expand Up @@ -192,6 +193,17 @@ Model specification can be found on our github repo of `myoArm <https://github.c
.. image:: images/myoArm.png
:height: 200

.. _myoArmNoHand:

myoArmNoHand
=========
The myoArmNoHand is the myoArm with the extrinsic and intrinsic hand muscles removed, enabling the study of pure-reaching tasks that have no grasp or manipulation component.

This musculoskeletal model is comprised of 38 joints and 24 muscle-tendon units.

.. image:: images/myoArm_NoHand.png
:height: 200

.. _tasks:

Tasks
Expand Down Expand Up @@ -328,6 +340,19 @@ Variants:
.. image:: images/hand_pen_twirl.png
:width: 200

Arm Reach
=====================

Objective:
- Reach a target with the end of the forearm

Variants:
- **Easy**: Reach to a fixed target ``myoArmReachFixed-v0``
- **Hard**: Reach to a randomly selected target ``myoArmReachRandom-v0``

.. image:: images/myoArmNoHand_reach.png
:width: 200

Hand Multiobject Reorientation
======================================
A :ref:`myoHand` model reorients a set of parameterized geometries to a given target orientation without dropping it.
Expand Down
39 changes: 39 additions & 0 deletions myosuite/detach_hand_from_arm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

import mujoco # tested with Version: 3.2.4
from mujoco import viewer
import time

file_path = "simhive/myo_sim/arm/myoarm.xml"
spec = mujoco.MjSpec.from_file(file_path)

# find body to remove
b_lunate = spec.find_body('lunate')
b_lunate_pos = b_lunate.pos.copy()

# add site to the parent body
b_radius = spec.find_body('radius')
b_radius.add_site(
name='wrist',
pos=b_lunate_pos,
group=3
)

# Remove the body
spec.detach_body(b_lunate)

# compile model and
mj_model = spec.compile()
mj_data = mujoco.MjData(mj_model)
window = viewer.launch_passive(
mj_model,
mj_data,
show_left_ui=False,
show_right_ui=False,
)

while window.is_running():
mujoco.mj_step(mj_model, mj_data)
window.sync()
time.sleep(.01)

print("Success. Clear Exit")
34 changes: 34 additions & 0 deletions myosuite/envs/myo/assets/arm/myoarm_reach.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<mujoco model="MyoArm_NoHand_v0.01">
<!-- =================================================
Copyright 2020 Vikash Kumar, Vittorio Caggiano, Guillaume Durandau
Model :: Myo Arm No Hand (MuJoCoV2.0)
Author :: Vikash Kumar ([email protected]), Vittorio Caggiano, Huawei Wang
source :: https://github.com/vikashplus
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.
====================================================== -->

<include file="../../../../simhive/myo_sim/arm/assets/myoarm_nohand_assets.xml"/>
<include file="../../../../simhive/myo_sim/scene/myosuite_scene.xml"/>
<compiler meshdir='../../../../simhive/myo_sim/' texturedir='../../../../simhive/myo_sim/'/>

<asset>
<mesh file="../myo_sim/meshes/human_lowpoly_norighthand.stl" name="body_norighthand"/>
</asset>

<worldbody>

<!-- ======= MyoArm ======= -->
<geom name="body" type="mesh" mesh="body_norighthand" euler="0 0 3.14" contype="0" conaffinity="0"/>
<body name="full_body" pos="-.025 0.1 1.40">
<include file="../../../../simhive/myo_sim/arm/assets/myoarm_body.xml"/>
</body>

<site name="forearm_tip_target" pos="0 0.002 0" rgba="0 1 0 .3" size="0.02"/>

</worldbody>

<keyframe>
<key qpos='-0.0707426 0.0299604 -0.0299638 0.0707454 -0.0143074 0.115747 0.0520177 -0.0520191 -0.115749 0.0143169 1.2671 0 -1.267 -0.013375 0 0.45559 0.173656 -0.141372 -0.500336 -0.780052 -0.383593 -0.0390846 0.0475231 -0.261981 0.0147788 0.00868063 0.00578373 -0.261937 0.00697434 0.00890255 -8.61942e-05 -0.261899 -2.25553e-05 0.00771655 -7.32368e-05 -0.133003 -1.74538e-05 0'/>
</keyframe>

</mujoco>
29 changes: 28 additions & 1 deletion myosuite/envs/myo/myobase/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,4 +517,31 @@ def register_env_with_variants(id, entry_point, max_episode_steps, kwargs):
'normalize_act': True,
'frame_skip': 5,
}
)
)

# Arm Reaching ==============================
register_env_with_variants(id='myoArmReachFixed-v0',
entry_point='myosuite.envs.myo.myobase.reach_v0:ReachEnvV0',
max_episode_steps=150,
kwargs={
'model_path': curr_dir+'/../assets/arm/myoarm_reach.xml',
'target_reach_range': {
'forearm_tip': ((-0.2, -0.2, 1.2), (-0.2, -0.2, 1.2)),
},
'normalize_act': True,
'far_th': 1.
}
)

register_env_with_variants(id='myoArmReachRandom-v0',
entry_point='myosuite.envs.myo.myobase.reach_v0:ReachEnvV0',
max_episode_steps=150,
kwargs={
'model_path': curr_dir+'/../assets/arm/myoarm_reach.xml',
'target_reach_range': {
'forearm_tip': ((-0.2-0.15, -0.2-0.15, 1.2-0.15), (-0.2+0.15, -0.2+0.15, 1.2+0.15)),
},
'normalize_act': True,
'far_th': 1.
}
)
2 changes: 1 addition & 1 deletion myosuite/simhive/YCB_sim
2 changes: 1 addition & 1 deletion myosuite/simhive/myo_sim