-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into pawel/upgrade_mjcf
- Loading branch information
Showing
10 changed files
with
163 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Update Stompy S3 Model | ||
|
||
on: | ||
release: | ||
types: [created] | ||
schedule: | ||
- cron: "30 2 * * *" | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
|
||
concurrency: | ||
group: "stompy-s3-model" | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
publish: | ||
name: Update Stompy S3 Model | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install 'kscale-onshape-library @ git+https://github.com/kscalelabs/onshape.git@master' # Bleeding edge | ||
- name: Build package | ||
env: | ||
ONSHAPE_ACCESS_KEY: ${{ secrets.ONSHAPE_ACCESS_KEY }} | ||
ONSHAPE_SECRET_KEY: ${{ secrets.ONSHAPE_SECRET_KEY }} | ||
ONSHAPE_API: ${{ secrets.ONSHAPE_API }} | ||
run: python -m sim.scripts.update_stompy_s3 | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: us-east-1 | ||
|
||
- name: Upload to S3 | ||
env: | ||
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | ||
run: | | ||
for file in stompy/*.tar.gz; do | ||
aws s3 cp "$file" s3://${AWS_S3_BUCKET}/$(basename "$file") | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,4 +25,4 @@ out*/ | |
# Training artifacts | ||
wandb/ | ||
runs/ | ||
stompy/ | ||
stompy/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
"""Updates the Stompy model.""" | ||
|
||
import tarfile | ||
from pathlib import Path | ||
|
||
from kol.logging import configure_logging | ||
from kol.onshape.converter import Converter | ||
|
||
STOMPY_MODEL = ( | ||
"https://cad.onshape.com/documents/71f793a23ab7562fb9dec82d/" | ||
"w/6160a4f44eb6113d3fa116cd/e/1a95e260677a2d2d5a3b1eb3" | ||
) | ||
|
||
SUFFIX_TO_JOINT_EFFORT = { | ||
"dof_x4_h": 1.5, | ||
"dof_x4": 1.5, | ||
"dof_x6": 3, | ||
"dof_x8": 6, | ||
"dof_x10": 12, | ||
"knee_revolute": 13.9, | ||
"ankle_revolute": 6, | ||
} | ||
|
||
|
||
def main() -> None: | ||
configure_logging() | ||
|
||
output_dir = Path("stompy") | ||
|
||
# Gets the latest STL URDF. | ||
converter = Converter( | ||
document_url=STOMPY_MODEL, | ||
output_dir=output_dir / "latest_stl_urdf", | ||
suffix_to_joint_effort=list(SUFFIX_TO_JOINT_EFFORT.items()), | ||
disable_mimics=True, | ||
mesh_ext="stl", | ||
) | ||
converter.save_urdf() | ||
latest_stl_urdf_path = converter.output_dir | ||
|
||
# Manually builds the tarball. | ||
with tarfile.open(output_dir / "latest_stl_urdf.tar.gz", "w:gz") as tar: | ||
for suffix in (".urdf", ".stl"): | ||
for file in latest_stl_urdf_path.rglob(f"**/*{suffix}"): | ||
tar.add(file, arcname=file.relative_to(latest_stl_urdf_path)) | ||
|
||
# Gets the latest OBJ URDF. | ||
converter = Converter( | ||
document_url=STOMPY_MODEL, | ||
output_dir=output_dir / "latest_obj_urdf", | ||
suffix_to_joint_effort=list(SUFFIX_TO_JOINT_EFFORT.items()), | ||
disable_mimics=True, | ||
mesh_ext="obj", | ||
) | ||
converter.save_urdf() | ||
latest_obj_urdf_path = converter.output_dir | ||
|
||
# Manually builds the tarball. | ||
with tarfile.open(output_dir / "latest_obj_urdf.tar.gz", "w:gz") as tar: | ||
for suffix in (".urdf", ".obj"): | ||
for file in latest_obj_urdf_path.rglob(f"**/*{suffix}"): | ||
tar.add(file, arcname=file.relative_to(latest_obj_urdf_path)) | ||
|
||
# Gets the latest MJCF. | ||
converter = Converter( | ||
document_url=STOMPY_MODEL, | ||
output_dir=output_dir / "latest_mjcf", | ||
suffix_to_joint_effort=list(SUFFIX_TO_JOINT_EFFORT.items()), | ||
disable_mimics=True, | ||
) | ||
converter.save_mjcf() | ||
latest_mjcf_path = converter.output_dir | ||
|
||
# Manually builds the tarball. | ||
with tarfile.open(output_dir / "latest_mjcf.tar.gz", "w:gz") as tar: | ||
for suffix in (".xml", ".stl"): | ||
for file in latest_mjcf_path.rglob(f"**/*{suffix}"): | ||
tar.add(file, arcname=file.relative_to(latest_mjcf_path)) | ||
|
||
|
||
if __name__ == "__main__": | ||
# python -m sim.scripts.update_stompy | ||
main() |