#!/usr/bin/env bash
# One command to regenerate the entire parametric fidex robot package.
# Source of truth: wrap_holder.py + yoke_exact.py (LOCKED) + param_arm.py + fidex_holder.py.
set -uo pipefail
cd /data/cameron/repos/smith300_para_stuff
CAD=/data/cameron/repos/cad_experiments/.venv_cad/bin/python
MJ=/data/cameron/repos/custom_robot_building/.venv/bin/python
export PYTHONPATH=/data/cameron/repos/smith300_para_stuff/tom_patch

echo "[1/7] servo holder (voxel clearance)";  $CAD voxel_trim.py 0.3            | tail -1
echo "[2/7] compact connector yoke (45mm)";   $CAD gen_yoke_arm.py             | tail -1
echo "[3/7] fidex marker holders (15/50mm)";  $CAD fidex_holder.py 15 fidex_holder_sm.stl | tail -1; $CAD fidex_holder.py 50 fidex_holder_bg.stl | tail -1
echo "[4/7] arm URDF + fidex_config.json";    $CAD param_arm.py                | tail -1
echo "[5/7] ArUco marker boards";             $CAD gen_markers.py              | tail -1
echo "[6/7] true-scale print sheet";          $CAD gen_print_sheet.py          | tail -1
echo "[7/7] hero render";                     MUJOCO_GL=egl $MJ render_hero.py smith300_modular.urdf arm_hero.png 40 -8 | tail -1
echo "=== DONE: smith300_modular.urdf + fidex_config.json + fidex_markers/ + fidex_print_sheet.png + STLs ==="
