Skip to content

Commit

Permalink
script changes
Browse files Browse the repository at this point in the history
  • Loading branch information
codekansas committed Apr 1, 2024
1 parent 16f26df commit 2a2983c
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sim/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# requirements.txt

torch
kscale-onshape-library
mlfab
20 changes: 20 additions & 0 deletions sim/scripts/download_urdf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/zsh
# ./sim/scripts/download_urdf.sh

# URL of the latest model.
url=https://cad.onshape.com/documents/71f793a23ab7562fb9dec82d/w/6160a4f44eb6113d3fa116cd/e/1a95e260677a2d2d5a3b1eb3

# Output directory.
output_dir=${MODEL_DIR}/robots/stompy

kol urdf ${url} \
--max-ang-velocity 31.4 \
--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 \
--output-dir ${output_dir}
44 changes: 44 additions & 0 deletions sim/scripts/drop_urdf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
"""Script to drop a URDF in Isaac Gym."""

import argparse

from pathlib import Path
from sim.isaacgym import gymutil, gymtorch, gymapi
import torch
import mlfab


def get_sim_params(num_threads: int, use_gpu: bool) -> gymapi.SimParams:
sim_params = gymapi.SimParams()
sim_params.substeps = 2
sim_params.dt = 1.0 / 60.0

sim_params.physx.solver_type = 1
sim_params.physx.num_position_iterations = 4
sim_params.physx.num_velocity_iterations = 1

sim_params.physx.num_threads = num_threads
sim_params.physx.use_gpu = use_gpu

return sim_params



def main() -> None:
parser = argparse.ArgumentParser(description="Drop a URDF in Isaac Gym.")
parser.add_argument("urdf_path", help="Path to the URDF file to load")
args = parser.parse_args()

mlfab.configure_logging()

# Verifies that the URDF exists.
urdf_path = Path(args.urdf_path)
if not urdf_path.exists():
raise FileNotFoundError(f"URDF file not found: {urdf_path}")

sim_params = get_sim_params(args.num_threads, args.use_gpu)


if __name__ == "__main__":
# python -m sim.scripts.drop_urdf
main()

0 comments on commit 2a2983c

Please sign in to comment.