-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
82dc6ba
commit 2322e65
Showing
5 changed files
with
161 additions
and
10 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,61 @@ | ||
name: Update Stompy S3 Model | ||
|
||
on: | ||
release: | ||
types: [created] | ||
schedule: | ||
- cron: "0 0 * * *" | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
|
||
concurrency: | ||
group: "stompy-s3-model" | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
publish: | ||
timeout-minutes: 10 | ||
name: Update Stompy S3 Model | ||
|
||
# We don't need to run on all platforms since this package is | ||
# platform-agnostic. The output wheel is something like | ||
# "monotonic_attention-<version>-py3-none-any.whl". | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install kscale-onshape-library '.' | ||
- 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
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() |