diff --git a/sim/requirements.txt b/sim/requirements.txt index 2ee1e7bd..2798cd06 100644 --- a/sim/requirements.txt +++ b/sim/requirements.txt @@ -1,2 +1,5 @@ # requirements.txt +torch +kscale-onshape-library +mlfab diff --git a/sim/scripts/download_urdf.sh b/sim/scripts/download_urdf.sh new file mode 100755 index 00000000..1f27eb6a --- /dev/null +++ b/sim/scripts/download_urdf.sh @@ -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} diff --git a/sim/scripts/drop_urdf.py b/sim/scripts/drop_urdf.py new file mode 100644 index 00000000..20af57ad --- /dev/null +++ b/sim/scripts/drop_urdf.py @@ -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()