-
Notifications
You must be signed in to change notification settings - Fork 112
add benchmark for MyoSim MyoArm #937
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Benchmark musculoskeletal environment from MyoSim | ||
|
|
||
| [MyoSim](https://github.com/MyoHub/myo_sim) | ||
|
|
||
| - [MyoArm](https://github.com/MyoHub/myo_sim/tree/main/arm) | ||
|
|
||
|
|
||
| ## Get MyoSim from GitHub | ||
|
|
||
| ```bash | ||
| python get_myosim.py | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| # Copyright 2025 The Newton Developers | ||
| # | ||
| # Licensed under the 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. | ||
| # ============================================================================== | ||
|
|
||
| """Get MyoSim from GitHub.""" | ||
|
|
||
| import subprocess | ||
| import sys | ||
| from typing import Sequence | ||
|
|
||
| from absl import app | ||
| from etils import epath | ||
|
|
||
| _MYOSIM_PATH = epath.Path(__file__).parent.parent / "myo_sim" | ||
|
|
||
| _MYOSIM_COMMIT_SHA = "33f3ded946f55adbdcf963c99999587aadaf975f" | ||
|
|
||
|
|
||
| # TODO(team): shared utility with benchmark/kitchen/populate_scene._clone? | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, in fact we should probably consider doing something like what playground does: Perhaps it's time to support something like this so that we can keep these resources all outside of this repo.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. created an issue #1001 for 'resource loader' |
||
| def _clone(repo_url: str, target_path: str, commit_sha: str) -> None: | ||
| """Clone a git repo with progress bar.""" | ||
| process = subprocess.Popen( | ||
| ["git", "clone", "--progress", repo_url, target_path], | ||
| stdout=subprocess.PIPE, | ||
| stderr=subprocess.PIPE, | ||
| universal_newlines=True, | ||
| ) | ||
|
|
||
| while True: | ||
| # Read output line by line. | ||
| if not process.stderr.readline() and process.poll() is not None: | ||
| break | ||
|
|
||
| if process.returncode != 0: | ||
| raise subprocess.CalledProcessError(process.returncode, ["git", "clone"]) | ||
|
|
||
| # checkout specific commit | ||
| print(f"Checking out commit {commit_sha}") | ||
| subprocess.run(["git", "-C", target_path, "checkout", commit_sha], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
|
|
||
|
|
||
| def main(argv: Sequence[str]): | ||
| """Ensure MyoSim exists, downloading it if necessary.""" | ||
| print(f"myosim path: {_MYOSIM_PATH}") | ||
| if not _MYOSIM_PATH.exists(): | ||
| print("MyoSim not found. Downloading...") | ||
|
|
||
| try: | ||
| _clone("https://github.com/MyoHub/myo_sim.git", str(_MYOSIM_PATH), _MYOSIM_COMMIT_SHA) | ||
| print("Successfully downloaded MyoSim") | ||
| except subprocess.CalledProcessError as e: | ||
| print(f"Error downloading MyoSim: {e}", file=sys.stderr) | ||
| raise | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| app.run(main) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this break running
asv run main^!?Does the user have to manually run
python get_myosim.pyfor the command above to work correctly?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, probably need to run the script first