alfonsusrr commited on
Commit
f149cc6
·
verified ·
1 Parent(s): 25f70a9

Add files using upload-large-folder tool

Browse files
.gitignore ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ .venv/
2
+ uv.lock
3
+ .cache/
4
+ __pycache__/
LICENSE_ASSETS.md ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Embodiment asset licenses and sources
2
+
3
+ This register covers the downloaded directories in `arms/` and `grippers/`.
4
+ It records the terms stated by their source packages; it does not replace
5
+ license notices inside individual asset directories. In particular, a bundle's
6
+ MIT license does not override a third-party model's own terms.
7
+
8
+ The five imported arm packages match the embodiments distributed in
9
+ [RoboTwin 2.0](https://github.com/RoboTwin-Platform/RoboTwin) through its [`embodiments.zip` dataset](https://huggingface.co/datasets/TianxingChen/RoboTwin2.0).
10
+
11
+ ## Arms
12
+
13
+ | Directory | Source | License information |
14
+ | --- | --- | --- |
15
+ | `ARX-X5` | [RoboTwin 2.0 embodiments](https://huggingface.co/datasets/TianxingChen/RoboTwin2.0); [ARX-X5 ROS](https://github.com/ARXroboticsX/ARX_X5) | Bundle: MIT; ARX-X5 source assets: BSD-3 |
16
+ | `aloha-agilex` | [RoboTwin 2.0 embodiments](https://huggingface.co/datasets/TianxingChen/RoboTwin2.0) | Bundle: MIT; original model terms not separately stated in the downloaded package |
17
+ | `franka-panda` | [RoboTwin 2.0 embodiments](https://huggingface.co/datasets/TianxingChen/RoboTwin2.0); [Franka ROS](https://github.com/frankaemika/franka_ros) | Bundle: MIT; Franka source assets: Apache-2.0 per the gripper source attribution |
18
+ | `piper` | [RoboTwin 2.0 embodiments](https://huggingface.co/datasets/TianxingChen/RoboTwin2.0); [Agilex Piper ROS](https://github.com/agilexrobotics/piper_ros) | Bundle: MIT; Piper source: MIT per the gripper source attribution |
19
+ | `ur5-wsg` | [RoboTwin 2.0 embodiments](https://huggingface.co/datasets/TianxingChen/RoboTwin2.0) | Bundle: MIT; contains UR5 and gripper components whose original terms are not separately stated in the downloaded package |
20
+ | `armbot` | [ArmBot Team](arms/armbot/README.md) | MIT |
21
+
22
+ ## Grippers
23
+
24
+ The entries below are from
25
+ [`gripper_descriptions`' `LICENSE_ASSETS`](https://huggingface.co/datasets/adithyamurali/gripper_descriptions/blob/main/LICENSE_ASSETS)
26
+ unless noted otherwise. The source checkout inspected was commit
27
+ `19a03c00d19aeaf052d0f6801f0041982d676e8a`. Names not covered by that
28
+ file are not assigned a license by inference.
29
+
30
+ | Directory | Stated license | Original source or notice |
31
+ | --- | --- | --- |
32
+ | `abb_yumi` | BSD-2-Clause | [OrebroUniversity/yumi](https://github.com/OrebroUniversity/yumi) |
33
+ | `arx_x5` | MIT | [real-stanford/arx5-sdk](https://github.com/real-stanford/arx5-sdk) |
34
+ | `barrett_hand` | BSD; dex-urdf adaptation MIT | [dexsuite/dex-urdf](https://github.com/dexsuite/dex-urdf) |
35
+ | `bd_spot` | MIT / BSD-3-Clause | [bdaiinstitute/spot_ros2](https://github.com/bdaiinstitute/spot_ros2) |
36
+ | `dh_ag95` | MIT | [ian-chuang/dh_ag95_gripper_ros2](https://github.com/ian-chuang/dh_ag95_gripper_ros2) |
37
+ | `ezgripper` | BSD, variant unspecified | [SAKErobotics/EZGripper](https://github.com/SAKErobotics/EZGripper) |
38
+ | `fetch_robot` | BSD, variant unspecified | [ZebraDevs/fetch_ros](https://github.com/ZebraDevs/fetch_ros) |
39
+ | `franka_panda` | Apache-2.0; copyright 2017 Franka Emika GmbH | [frankaemika/franka_ros](https://github.com/frankaemika/franka_ros) |
40
+ | `franka_umi` | Apache-2.0; copyright 2017 Franka Emika GmbH | [frankaemika/franka_ros](https://github.com/frankaemika/franka_ros) |
41
+ | `galaxea_g1` | Not stated in the source attribution file | [Gripper descriptions dataset](https://huggingface.co/datasets/adithyamurali/gripper_descriptions) |
42
+ | `gloria_m` | No asset license supplied | Local [manifest](grippers/gloria_m/manifest.json) |
43
+ | `inspire_hand` | No grant stated in the included notice | [Included source and modification notice](grippers/inspire_hand/LICENSE.txt) |
44
+ | `onrobot_RG2` | MIT | [Osaka-University-Harada-Laboratory/onrobot](https://github.com/Osaka-University-Harada-Laboratory/onrobot) |
45
+ | `onrobot_RG6` | MIT | [Osaka-University-Harada-Laboratory/onrobot](https://github.com/Osaka-University-Harada-Laboratory/onrobot) |
46
+ | `piper_hand` | MIT | [agilexrobotics/piper_ros](https://github.com/agilexrobotics/piper_ros) |
47
+ | `robotiq_2f_140` | BSD-2-Clause | [ros-industrial/robotiq](https://github.com/ros-industrial/robotiq) |
48
+ | `robotiq_2f_85` | BSD-2-Clause | [ros-industrial/robotiq](https://github.com/ros-industrial/robotiq) |
49
+ | `robotiq_3f` | BSD-2-Clause | [ros-industrial/robotiq](https://github.com/ros-industrial/robotiq) |
50
+ | `robotiq_hande` | BSD, variant unspecified | [cambel/robotiq](https://github.com/cambel/robotiq) |
51
+ | `sawyer_hand` | MIT | [real-stanford/adagrasp](https://github.com/real-stanford/adagrasp) |
52
+ | `schunk_wsg50` | BSD, variant unspecified | [nalt/wsg50-ros-pkg](https://github.com/nalt/wsg50-ros-pkg) |
53
+ | `sharpa_wave` | Not stated in the source attribution file | [Gripper descriptions dataset](https://huggingface.co/datasets/adithyamurali/gripper_descriptions) |
54
+ | `surge_hand` | Conflicting notices: source attribution says CC BY 4.0; included file uses MIT text | [Included license text](grippers/surge_hand/LICENSE) and [source reference](https://github.com/erwincoumans/pybullet_robots/blob/master/data/surge_hands/LICENSE) |
55
+ | `tesollo_delto2f` | BSD-3-Clause | [Tesollo-Delto/DELTO_ROS](https://github.com/Tesollo-Delto/DELTO_ROS) |
56
+ | `unitree_g1` | BSD-3-Clause; copyright 2016-2022 Unitree Robotics | [unitreerobotics/unitree_ros](https://github.com/unitreerobotics/unitree_ros/tree/master/robots/g1_description) |
57
+ | `wuji_hand` | MIT; source attribution calls this asset `wuji` | [wuji-technology/wuji-hand-description](https://github.com/wuji-technology/wuji-hand-description) |
58
+ | `xarm_hand` | BSD-3-Clause | [xArm-Developer/xarm_ros](https://github.com/xArm-Developer/xarm_ros) |
README.md CHANGED
@@ -1,24 +1,64 @@
1
- ---
2
- pretty_name: BYORobotSim Embodiments
3
- tags:
4
- - robotics
5
- - simulation
6
- - urdf
7
- ---
8
-
9
- # BYORobotSim Embodiments
10
-
11
- Robot geometry and profiles for BYORobotSim. Keep the directory structure
12
- unchanged when downloading an individual arm or gripper: manifests and URDFs
13
- refer to nearby meshes by relative path.
14
-
15
- `arms/` contains the ArmBot profile and imported arm packages. Combined arm and
16
- gripper URDFs remain together so their relative mesh paths continue to work.
17
-
18
- `grippers/` contains standalone gripper profiles. `gloria_m` refers to the shared
19
- ArmBot adapter mesh in `arms/ArmBot/meshes/`.
20
-
21
- Large mesh, image, CAD, and array files use Git LFS. Manifests, URDFs,
22
- configuration, and documentation remain ordinary Git files. Individual source
23
- packages may have their own license terms; consult their included notices and
24
- upstream sources before redistributing them.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Embodiment viewer
2
+
3
+ Asset sources and license terms are listed in [LICENSE_ASSETS.md](LICENSE_ASSETS.md).
4
+ Some individual models have additional or unconfirmed terms, as noted in the
5
+ register.
6
+
7
+ Download the embodiment assets from the repository root, then run the standalone uv viewer:
8
+
9
+ ```sh
10
+ uv run python scripts/download_embodiments.py
11
+ uv run python visualize.py --list
12
+ uv run python visualize.py --kind grippers --name franka_panda
13
+ uv run python visualize.py --kind arms --name franka-panda
14
+ uv run python visualize.py --all --kind grippers
15
+ ```
16
+
17
+ Open the URL printed by viser. The **Pose** slider controls the motion from the starting to the ending joint state; **Play** loops it. `--port` changes the server port. `--all` arranges all discovered gripper URDFs in a grid; arms must be selected individually with `--name`. ArmBot is excluded until it has a URDF. Arm starting poses come from `config.yml`'s `homestate` when available; gripper poses come from `config.json`'s `open` and `close` states. Other joints use their URDF limits.
18
+
19
+ ## Arms
20
+
21
+ Use the directory name in the `--name` column with `--kind arms`.
22
+
23
+ | Name (`--name`) | Model |
24
+ | --- | --- |
25
+ | `ARX-X5` | [X5A.urdf](arms/ARX-X5/X5A.urdf) |
26
+ | `aloha-agilex` | [arx5_description_isaac.urdf](arms/aloha-agilex/urdf/arx5_description_isaac.urdf) |
27
+ | `franka-panda` | [panda.urdf](arms/franka-panda/panda.urdf) |
28
+ | `piper` | [piper.urdf](arms/piper/piper.urdf) |
29
+ | `ur5-wsg` | [ur5_wsg_gripper.urdf](arms/ur5-wsg/ur5_wsg_gripper.urdf) |
30
+ | `armbot` | [Mesh assets](arms/armbot/README.md); no URDF, so it is not available in the viewer |
31
+
32
+ ## Grippers
33
+
34
+ Use the directory name in the `--name` column with `--kind grippers`.
35
+
36
+ | Name (`--name`) | Model |
37
+ | --- | --- |
38
+ | `abb_yumi` | [gripper.urdf](grippers/abb_yumi/gripper.urdf) |
39
+ | `arx_x5` | [gripper.urdf](grippers/arx_x5/gripper.urdf) |
40
+ | `barrett_hand` | [gripper.urdf](grippers/barrett_hand/gripper.urdf) |
41
+ | `bd_spot` | [gripper.urdf](grippers/bd_spot/gripper.urdf) |
42
+ | `dh_ag95` | [gripper.urdf](grippers/dh_ag95/gripper.urdf) |
43
+ | `ezgripper` | [gripper.urdf](grippers/ezgripper/gripper.urdf) |
44
+ | `fetch_robot` | [gripper.urdf](grippers/fetch_robot/gripper.urdf) |
45
+ | `franka_panda` | [gripper.urdf](grippers/franka_panda/gripper.urdf) |
46
+ | `franka_umi` | [gripper.urdf](grippers/franka_umi/gripper.urdf) |
47
+ | `galaxea_g1` | [gripper.urdf](grippers/galaxea_g1/gripper.urdf) |
48
+ | `gloria_m` | [Gloria_M.urdf](grippers/gloria_m/urdf/Gloria_M.urdf) |
49
+ | `inspire_hand` | [gripper.urdf](grippers/inspire_hand/gripper.urdf) |
50
+ | `onrobot_RG2` | [gripper.urdf](grippers/onrobot_RG2/gripper.urdf) |
51
+ | `onrobot_RG6` | [gripper.urdf](grippers/onrobot_RG6/gripper.urdf) |
52
+ | `piper_hand` | [gripper.urdf](grippers/piper_hand/gripper.urdf) |
53
+ | `robotiq_2f_140` | [gripper.urdf](grippers/robotiq_2f_140/gripper.urdf) |
54
+ | `robotiq_2f_85` | [gripper.urdf](grippers/robotiq_2f_85/gripper.urdf) |
55
+ | `robotiq_3f` | [gripper.urdf](grippers/robotiq_3f/gripper.urdf) |
56
+ | `robotiq_hande` | [gripper.urdf](grippers/robotiq_hande/gripper.urdf) |
57
+ | `sawyer_hand` | [gripper.urdf](grippers/sawyer_hand/gripper.urdf) |
58
+ | `schunk_wsg50` | [gripper.urdf](grippers/schunk_wsg50/gripper.urdf) |
59
+ | `sharpa_wave` | [gripper.urdf](grippers/sharpa_wave/gripper.urdf) |
60
+ | `surge_hand` | [gripper.urdf](grippers/surge_hand/gripper.urdf) |
61
+ | `tesollo_delto2f` | [gripper.urdf](grippers/tesollo_delto2f/gripper.urdf) |
62
+ | `unitree_g1` | [gripper.urdf](grippers/unitree_g1/gripper.urdf) |
63
+ | `wuji_hand` | [gripper.urdf](grippers/wuji_hand/gripper.urdf) |
64
+ | `xarm_hand` | [gripper.urdf](grippers/xarm_hand/gripper.urdf) |
arms/armbot/README.md ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ArmBot Module Visualization Assets
2
+
3
+ This directory contains visual mesh assets for the modular robot system used in
4
+ the workspace editor and simulation serializers.
5
+
6
+ ## Module Types
7
+
8
+ ### CAD Source and Export
9
+
10
+ The canonical source files are FreeCAD documents in `~/Downloads/ArmBot3D`.
11
+ Run the following from the repository root to recreate the mesh files after
12
+ changing the CAD source:
13
+
14
+ ```sh
15
+ printf "exec(compile(open('tools/export_armbot_cad.py').read(), 'tools/export_armbot_cad.py', 'exec'))\n" | freecadcmd -c
16
+ ```
17
+
18
+ The exporter centers every part on its module frame, converts FreeCAD
19
+ millimetres to metres, and writes OBJ.
20
+
21
+ The CAD joint is deliberately divided across the two physical links:
22
+
23
+ - `joint_0.obj` and `joint_motor.obj` belong to the stationary `root` link.
24
+ - `joint_1.obj` belongs to the rotating `moving` link.
25
+
26
+ This preserves the revolute kinematics. The 10 cm voxel lattice remains the
27
+ design and mounting grid, while simulation lays out visual and collision meshes
28
+ from the measured CAD bounds so joined ArmBot modules meet at their actual
29
+ mating faces.
30
+
31
+ The supplied motor CAD contains one disconnected terminal subassembly. The
32
+ exporter omits it because its placement is not constrained to the motor body.
33
+
34
+ `meshes/original/Gripper_Adapter.FCStd` is the canonical gripper-to-block
35
+ interface. Its exported `gripper_adapter.obj` is metre-scaled with its block
36
+ mounting plane at local z = 0 and its gripper plane at local z = 10 mm. The
37
+ `gloria_m` profile uses it as a fixed link between the terminal block and
38
+ the gripper base; the profile rotates this interface to the selected gripper
39
+ mount face.
40
+
41
+ ### Arm Modules
42
+ - **Color**: RGB(0.92, 0.93, 0.94) - light gray/off-white (#EBEDEF)
43
+ - **Geometry**: Grid of FreeCAD arm cells, each within a 10cm cube with:
44
+ - Cell size: 10cm grid unit
45
+ - Visual envelope: approximately 84mm per side
46
+ - Surface details and edge treatment defined by the CAD model
47
+ - Multi-cell arms use the 84mm CAD pitch in the engine, so their faces touch
48
+ without visual or collision gaps
49
+
50
+ ### Joint Modules (Revolute/JointUnit)
51
+ - **Joint color**: RGB(0.44, 0.47, 0.51) - medium gray (#707882)
52
+ - **Shaft color**: RGB(0.22, 0.24, 0.27) - dark gray (#383D45)
53
+ - **Geometry**: `Joint-0`, CyberGear motor, and `Joint-1` CAD components.
54
+ - The root housing is oriented with its motor cavity facing the moving half.
55
+ - The motor interface on `Joint-1` faces the root housing.
56
+ - CAD housing offsets use their measured faces, so the two parts meet at the
57
+ hinge plane with no visible gap. External attachments are placed from the
58
+ matching CAD-envelope faces rather than the 10cm lattice centers.
59
+ - The motor is centered inside the root housing's mounting cavity and assigned
60
+ to the root link.
61
+
62
+ ### Axial Joint Modules
63
+ - **Colors**: Same as revolute joints
64
+ - **Geometry**: Two half-height blocks with Z-axis rotation
65
+ - Lower block: 10cm × 10cm × 5cm, at z = -2.5cm
66
+ - Upper block: 10cm × 10cm × 5cm, at z = +2.5cm
67
+ - Shaft: Cylinder radius 9mm, length 4.8cm
68
+ - Border radius: 8mm
69
+
70
+ ### Swing Joint Modules
71
+ - **Colors**: Same as other joints
72
+ - **Geometry**: Triangular prism blocks
73
+ - Isosceles right triangle cross-section
74
+ - Visual scaled to 95% of collision geometry
75
+ - Shaft: Cylinder radius 8mm, length 10cm along Y axis
76
+
77
+ ## Mesh Format
78
+
79
+ All meshes use the rounded box procedural generation from `byorobotsim/sim/model/meshes.py`:
80
+ - Vertices and faces are computed deterministically
81
+ - Bevel segments: 3
82
+ - Consistent winding order for proper lighting
83
+
84
+ ## Usage in Editor
85
+
86
+ The workspace editor (`tools/workspace_editor`) uses these specifications to render robot modules in the 3D preview. The actual simulation uses the same geometry definitions from `byorobotsim/sim/model/design.py`.
arms/armbot/example_mujoco.xml ADDED
@@ -0,0 +1,334 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <mujoco model="world_box_reference">
2
+ <!-- 本文件统一使用米、千克、秒和弧度作为单位。 -->
3
+ <compiler angle="radian" autolimits="true"/>
4
+ <option timestep="0.002" integrator="implicitfast" gravity="0 0 -9.81"/>
5
+
6
+ <visual>
7
+ <headlight ambient="0.35 0.35 0.35"
8
+ diffuse="0.75 0.75 0.75"
9
+ specular="0.2 0.2 0.2"/>
10
+ <global azimuth="135" elevation="-25"/>
11
+ </visual>
12
+
13
+ <asset>
14
+ <texture name="floor_grid"
15
+ type="2d"
16
+ builtin="checker"
17
+ width="512"
18
+ height="512"
19
+ rgb1="0.82 0.84 0.87"
20
+ rgb2="0.94 0.95 0.97"/>
21
+ <material name="floor_material"
22
+ texture="floor_grid"
23
+ texrepeat="8 8"
24
+ texuniform="true"
25
+ reflectance="0.05"/>
26
+ </asset>
27
+
28
+ <!--
29
+ CyberGear 参数元数据,仅供控制程序读取或作为模型说明,不会自动改变 MuJoCo 动力学。
30
+ 机械输出端参数来自《CyberGear微电机使用说明书》:
31
+ 额定转矩 4 N·m,峰值转矩 12 N·m;
32
+ 额定转速 240 rpm = 25.133 rad/s;
33
+ 空载转速 296 rpm = 30.997 rad/s;
34
+ 运控协议速度范围 ±30 rad/s,位置编码范围 ±4π rad;
35
+ 减速比 7.75:1,电机总质量 0.317 kg。
36
+ 手册没有给出转子惯量、粘性阻尼、库仑摩擦和回差,不能在此凭空填写。
37
+ -->
38
+ <custom>
39
+ <numeric name="cybergear_rated_voltage_v" data="24"/>
40
+ <numeric name="cybergear_min_voltage_v" data="16"/>
41
+ <numeric name="cybergear_max_voltage_v" data="28"/>
42
+ <numeric name="cybergear_rated_torque_nm" data="4"/>
43
+ <numeric name="cybergear_peak_torque_nm" data="12"/>
44
+ <numeric name="cybergear_rated_speed_rad_s" data="25.132741"/>
45
+ <numeric name="cybergear_no_load_speed_rad_s" data="30.997048"/>
46
+ <numeric name="cybergear_command_speed_limit_rad_s" data="30"/>
47
+ <numeric name="cybergear_protocol_position_limit_rad" data="12.566371"/>
48
+ <numeric name="cybergear_rated_current_a" data="6.5"/>
49
+ <numeric name="cybergear_peak_current_a" data="23"/>
50
+ <numeric name="cybergear_torque_constant_nm_a" data="0.87"/>
51
+ <numeric name="cybergear_reduction_ratio" data="7.75"/>
52
+ <numeric name="cybergear_total_mass_kg" data="0.317"/>
53
+ <numeric name="cybergear_encoder_counts_per_rev" data="16384"/>
54
+ <!-- 以下两项为仿真初始估计值,不是说明书标称参数。 -->
55
+ <numeric name="cybergear_estimated_frictionloss_nm" data="0.12"/>
56
+ <numeric name="cybergear_estimated_damping_nm_s_rad" data="0.010"/>
57
+ </custom>
58
+
59
+ <worldbody>
60
+ <light name="main_light" pos="1 -1 2" dir="-1 1 -2"/>
61
+ <camera name="overview"
62
+ pos="1.4 -1.4 1.0"
63
+ xyaxes="0.707 0.707 0 -0.333 0.333 0.882"/>
64
+
65
+ <!--
66
+ plane 的前两个 size 数值表示可视区域在 X、Y 方向上的半尺寸。
67
+ 此处显示为约 6 m × 6 m 的地面,但物理碰撞平面是无限大的。
68
+ plane 的默认法向为 +Z,因此 pos 的 Z=0 表示地面位于世界坐标 Z=0。
69
+ -->
70
+ <geom name="floor"
71
+ type="plane"
72
+ pos="0 0 0"
73
+ size="3 3 0.1"
74
+ material="floor_material"
75
+ friction="1.0 0.01 0.001"/>
76
+
77
+ <!--
78
+ 固定底座的实际尺寸:
79
+ 0.30 m × 0.25 m × 0.08 m
80
+ box 的 size 使用各方向的半尺寸:
81
+ 0.15 m × 0.125 m × 0.04 m
82
+ 将几何中心放在 Z=0.04,可使底座底面正好落在 Z=0 的地面上。
83
+ -->
84
+ <geom name="fixed_base"
85
+ type="box"
86
+ pos="0 0 0.02"
87
+ size="0.3 0.3 0.022"
88
+ rgba="0.25 0.30 0.38 1"
89
+ friction="0.9 0.01 0.001"/>
90
+
91
+ <!--
92
+ 这是一个边长为 0.10 m、带自由关节的立方体。
93
+ 仿真开始后,它会从 Z=0.60 m 的位置下落并与地面碰撞。
94
+ -->
95
+ <body name="falling_cube" pos="0.45 0 0.60">
96
+ <freejoint/>
97
+ <geom name="falling_cube_geom"
98
+ type="box"
99
+ size="0.084 0.084 0.084"
100
+ mass="1.0"
101
+ rgba="0.90 0.25 0.15 1"/>
102
+ </body>
103
+
104
+ <!--
105
+ link1 是固定立柱,不设置 joint,因此与世界坐标系刚性连接。
106
+ 底座顶面高度:0.02 + 0.022 = 0.042 m。
107
+ link1 的完整高度:0.084 × 2 = 0.168 m。
108
+ link1 的 body 原点放在底座顶面,几何中心向上偏移 0.084 m,
109
+ 因此 link1 的底面与底座顶面正好贴合。
110
+ -->
111
+ <body name="link1" pos="0 0 0.042">
112
+ <geom name="link1_box"
113
+ type="box"
114
+ pos="0 0 0.084"
115
+ size="0.084 0.084 0.084"
116
+ mass="0.440"
117
+ rgba="0.42 0.45 0.50 1"/>
118
+
119
+ <site name="link1_tip"
120
+ type="sphere"
121
+ pos="0 0 0.168"
122
+ size="0.012"
123
+ rgba="1 0.1 0.1 1"/>
124
+
125
+ <!--
126
+ MuJoCo 的 joint 必须定义在相对父 body 运动的子 body 中。
127
+ link2 位于 link1 顶面,joint1 的转轴取 Z 轴方向。
128
+ link1 顶面�� XY 平面,因此 axis="0 0 1" 垂直于顶面;
129
+ link2 将绕穿过顶面中心的 Z 轴做一维旋转。
130
+ -->
131
+ <body name="link2" pos="0 0 0.168">
132
+ <!--
133
+ 摩擦初始估计:
134
+ frictionloss="0.12" 表示约 0.12 N·m 的库仑摩擦力矩;
135
+ damping="0.010" 表示 0.010 N·m·s/rad 的线性粘性阻尼。
136
+ 在空载转速 30.997 rad/s 时,总阻力矩约为:
137
+ 0.12 + 0.010 × 30.997 ≈ 0.43 N·m。
138
+ 这与手册空载电流 0.5 Arms × 转矩常数 0.87 N·m/Arms
139
+ 得到的约 0.435 N·m 接近,适合作为首次仿真的保守起点。
140
+ 该拆分值并非厂家标定结果,后续应通过实机自由减速或阶跃实验辨识。
141
+ 电机可连续多圈旋转,没有机械刚性限位,因此 limited="false",
142
+ 不设置 range;qpos 中的关节角可以超过 ±2π 并持续累积。
143
+ -->
144
+ <joint name="joint1"
145
+ type="hinge"
146
+ pos="0 0 0"
147
+ axis="0 0 1"
148
+ limited="false"
149
+ damping="0.010"
150
+ frictionloss="0.12"/>
151
+
152
+ <!--
153
+ 用薄圆柱表示居中的电机输出转轴。
154
+ 转轴直径 33 mm,所以半径为 0.0165 m。
155
+ cylinder 的 size 为“半径、半高”,因此半高 0.0005 m
156
+ 对应完整厚度 0.001 m,即 1 mm。
157
+ 转轴质量尚未提供,mass="0" 表示暂不计入 link2 的质量和惯量。
158
+ -->
159
+ <geom name="joint1_shaft"
160
+ type="cylinder"
161
+ pos="0 0 0.0005"
162
+ size="0.0165 0.0005"
163
+ mass="0"
164
+ rgba="0.28 0.32 0.40 1"/>
165
+
166
+ <!--
167
+ link2_box 与 link1_box 尺寸完全相同:
168
+ 完整尺寸为 0.168 m × 0.168 m × 0.168 m。
169
+ 转轴顶面位于 Z=0.001 m,因此方块中心放在
170
+ 0.001 + 0.084 = 0.085 m,使其底面正好落在转轴顶面。
171
+ -->
172
+ <geom name="link2_box"
173
+ type="box"
174
+ pos="0 0 0.085"
175
+ size="0.084 0.084 0.084"
176
+ mass="0.130"
177
+ rgba="0.90 0.91 0.93 1"/>
178
+
179
+ <site name="link2_tip"
180
+ type="sphere"
181
+ pos="0 0 0.169"
182
+ size="0.010"
183
+ rgba="0.10 0.90 0.20 1"/>
184
+
185
+ <!--
186
+ 第二组连杆安装在 link2 的局部 +X 侧面。
187
+ link3 是 link1 的复制体,直接粘连在 link2 侧面,不设置 joint。
188
+
189
+ link3 的 body 原点位于 link2 的 +X 侧面中心:
190
+ link2_box 的 +X 侧面为 X=0.084 m;
191
+ link2_box 的中心高度为 Z=0.085 m。
192
+ euler 绕 Y 轴旋转 +90°,使复制体原来的局部 +Z 方向指向
193
+ link2 的局部 +X 方向。这样 link3 会从 link2 侧面向外延伸。
194
+ -->
195
+ <body name="link3"
196
+ pos="0.084 0 0.085"
197
+ euler="0 1.57079632679 0">
198
+ <geom name="link3_box"
199
+ type="box"
200
+ pos="0 0 0.084"
201
+ size="0.084 0.084 0.084"
202
+ mass="0.440"
203
+ rgba="0.42 0.45 0.50 1"/>
204
+
205
+ <site name="link3_tip"
206
+ type="sphere"
207
+ pos="0 0 0.168"
208
+ size="0.012"
209
+ rgba="1 0.45 0.10 1"/>
210
+
211
+ <!--
212
+ link4 是 link2 的复制体,并通过 joint2 与 link3 相连。
213
+ joint2 在 link3 外侧面的中心,轴线沿复制体的局部 Z 轴。
214
+ 由于 link3 已绕 Y 轴转过 90°,joint2 的轴线在 link2
215
+ 局部坐标中就是 +X,旋转平面为 YZ。
216
+
217
+ joint1 的轴线为 Z、旋转平面为 XY,因此 joint2 的旋转平面
218
+ 与 joint1 的旋转平面互相垂直。
219
+ -->
220
+ <body name="link4" pos="0 0 0.168">
221
+ <joint name="joint2"
222
+ type="hinge"
223
+ pos="0 0 0"
224
+ axis="0 0 1"
225
+ limited="false"
226
+ damping="0.010"
227
+ frictionloss="0.12"/>
228
+
229
+ <!-- 第二个 CyberGear 转轴:直径 33 mm,完整厚度 1 mm。 -->
230
+ <geom name="joint2_shaft"
231
+ type="cylinder"
232
+ pos="0 0 0.0005"
233
+ size="0.0165 0.0005"
234
+ mass="0"
235
+ rgba="0.28 0.32 0.40 1"/>
236
+
237
+ <geom name="link4_box"
238
+ type="box"
239
+ pos="0 0 0.085"
240
+ size="0.084 0.084 0.084"
241
+ mass="0.130"
242
+ rgba="0.90 0.91 0.93 1"/>
243
+
244
+ <site name="link4_tip"
245
+ type="sphere"
246
+ pos="0 0 0.169"
247
+ size="0.010"
248
+ rgba="0.15 0.80 1.00 1"/>
249
+
250
+ <!--
251
+ 在 link4_box 的局部 +Y 侧面连接三个 link4 复制体:
252
+ link5、link6、link7 均为 0.168 m 立方体;
253
+ 每块质�� 0.130 kg,颜色与从动块相同;
254
+ 三者不设置 joint,因此与 link4 刚性连接并随 joint2 一起运动。
255
+
256
+ link4_box 的 +Y 侧面位于 Y=0.084 m,侧面中心高度为 Z=0.085 m。
257
+ link5 的 body 原点放在该侧面中心,并绕局部 X 轴旋转 -90°,
258
+ 使 link5 原来的局部 +Z 延伸方向转为 link4 的局部 +Y。
259
+ link6、link7 再沿 link5 的局部 +Z 方向依次粘连。
260
+ -->
261
+ <body name="link5"
262
+ pos="0 0.084 0.085"
263
+ euler="-1.57079632679 0 0">
264
+ <geom name="link5_box"
265
+ type="box"
266
+ pos="0 0 0.084"
267
+ size="0.084 0.084 0.084"
268
+ mass="0.130"
269
+ rgba="0.90 0.91 0.93 1"/>
270
+
271
+ <body name="link6" pos="0 0 0.168">
272
+ <geom name="link6_box"
273
+ type="box"
274
+ pos="0 0 0.084"
275
+ size="0.084 0.084 0.084"
276
+ mass="0.130"
277
+ rgba="0.90 0.91 0.93 1"/>
278
+
279
+ <body name="link7" pos="0 0 0.168">
280
+ <geom name="link7_box"
281
+ type="box"
282
+ pos="0 0 0.084"
283
+ size="0.084 0.084 0.084"
284
+ mass="0.130"
285
+ rgba="0.90 0.91 0.93 1"/>
286
+
287
+ <site name="arm_tip"
288
+ type="sphere"
289
+ pos="0 0 0.168"
290
+ size="0.010"
291
+ rgba="0.95 0.25 0.20 1"/>
292
+ </body>
293
+ </body>
294
+ </body>
295
+ </body>
296
+ </body>
297
+ </body>
298
+ </body>
299
+ </worldbody>
300
+
301
+ <actuator>
302
+ <!--
303
+ CyberGear 手册给出的 4 N·m 额定转矩和 12 N·m 峰值转矩是负载输出端参数。
304
+ 因此本模型直接在输出关节上施加力矩,gear="1",不能再乘 7.75,
305
+ 否则会把内置减速比重复计算一次。
306
+
307
+ ctrl 的单位为 N·m,允许范围 ±12 N·m;forcerange 再做一次硬限幅。
308
+ 12 N·m 只能短时使用,持续运行应由控制程序按照 4 N·m 额定值和
309
+ 手册过载时间曲线进行热保护。
310
+
311
+ 手册没有直接给出转子惯量、粘性阻尼和摩擦参数,因此暂不填写
312
+ armature;joint1、joint2 中的 damping 和 frictionloss 是依据空载数据配置的
313
+ 初始估计值,后续仍应通过实物辨识修正。
314
+ -->
315
+ <motor name="joint1_motor"
316
+ joint="joint1"
317
+ gear="1"
318
+ ctrlrange="-12 12"
319
+ forcerange="-12 12"/>
320
+ <motor name="joint2_motor"
321
+ joint="joint2"
322
+ gear="1"
323
+ ctrlrange="-12 12"
324
+ forcerange="-12 12"/>
325
+ </actuator>
326
+
327
+ <keyframe>
328
+ <!--
329
+ qpos 顺序:自由关节的位置 xyz、四元数 wxyz、joint1 角度、joint2 角度。
330
+ ctrl 顺序:joint1_motor、joint2_motor。
331
+ -->
332
+ <key name="home" qpos="0.45 0 0.60 1 0 0 0 0 0" ctrl="0 0"/>
333
+ </keyframe>
334
+ </mujoco>
arms/armbot/manifest.json ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "ArmBot",
3
+ "version": 1,
4
+ "units": "m",
5
+ "up_axis": "z",
6
+ "grid_unit": 0.01,
7
+ "meshes": {
8
+ "arm_cell": {
9
+ "path": "meshes/arm_visual.obj",
10
+ "unit_scale": 1.0,
11
+ "mass_kg": 0.13,
12
+ "center_of_mass_m": [
13
+ -5.050485391555241e-05,
14
+ -0.0002273566792648147,
15
+ 5.0487426293626646e-05
16
+ ],
17
+ "inertia_kg_m2": [
18
+ 0.00016527208674153121,
19
+ -7.393610395979322e-07,
20
+ -7.411715131201471e-07,
21
+ 0.00016503704378293014,
22
+ -7.423474102103212e-07,
23
+ 0.00016527210233976312
24
+ ]
25
+ },
26
+ "joint_root": {
27
+ "path": "meshes/joint0_visual.obj",
28
+ "unit_scale": 0.001,
29
+ "mass_kg": 0.52,
30
+ "center_of_mass_m": [
31
+ 7.872585716150412e-05,
32
+ 4.2937453472459255e-05,
33
+ 0.031338424478622416
34
+ ],
35
+ "inertia_kg_m2": [
36
+ 0.00047678546444433895,
37
+ -5.813848298926828e-09,
38
+ -7.581437930804251e-07,
39
+ 0.0004755276390086778,
40
+ 1.0606352907365712e-07,
41
+ 0.00045717125725050237
42
+ ]
43
+ },
44
+ "joint_moving": {
45
+ "path": "meshes/joint1_visual.obj",
46
+ "unit_scale": 0.001,
47
+ "mass_kg": 0.1,
48
+ "center_of_mass_m": [
49
+ -3.968157838847393e-05,
50
+ 4.0124491722277395e-05,
51
+ -0.04140600580370087
52
+ ],
53
+ "inertia_kg_m2": [
54
+ 0.00011909973748651182,
55
+ 3.5517171537644183e-06,
56
+ 4.072070853807783e-07,
57
+ 0.00011910163217863237,
58
+ 4.1077991047008635e-07,
59
+ 0.00011776714909855214
60
+ ]
61
+ }
62
+ },
63
+ "materials": {
64
+ "arm": [0.92, 0.93, 0.94, 1.0],
65
+ "joint": [0.44, 0.47, 0.51, 1.0],
66
+ "shaft": [0.22, 0.24, 0.27, 1.0]
67
+ }
68
+ }
arms/armbot/meshes/arm_visual.obj ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:35dae1b68530498539566036d2c885ae61997c33ad6426459d980dda774c0032
3
+ size 1427581
arms/armbot/meshes/collision/arm_block.obj ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b0bc82db5c2c95e488fa966c59b22d68207228b676b3e37dbc830303731dbef4
3
+ size 28014
arms/armbot/meshes/collision/joint_block.obj ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:88c4accbae406d1fbf3b5e0a9b6c04dc635ff406dd505623ed21b7b18ff086bd
3
+ size 28021
arms/armbot/meshes/gripper_adapter.obj ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4da3104309ebe2dd888691afdb110192851008368a8c770da60c0d1cf0f6a666
3
+ size 1861537
arms/armbot/meshes/joint0_visual.mtl ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ newmtl Shell
2
+ Ka 0.12 0.12 0.12
3
+ Kd 0.72 0.72 0.70
4
+ Ks 0.18 0.18 0.18
5
+ Ns 80
6
+
7
+ newmtl Gold
8
+ Ka 0.20 0.14 0.02
9
+ Kd 0.83 0.61 0.12
10
+ Ks 0.55 0.42 0.12
11
+ Ns 280
arms/armbot/meshes/joint0_visual.obj ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e6dc76f7794e6c4a0119861c67780e18669ddd184195a30801fbbdcf548c2baa
3
+ size 4194056
arms/armbot/meshes/joint1_visual.mtl ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ newmtl Shell
2
+ Ka 0.12 0.12 0.12
3
+ Kd 0.72 0.72 0.70
4
+ Ks 0.18 0.18 0.18
5
+ Ns 80
6
+
7
+ newmtl Gold
8
+ Ka 0.20 0.14 0.02
9
+ Kd 0.83 0.61 0.12
10
+ Ks 0.55 0.42 0.12
11
+ Ns 280
arms/armbot/meshes/joint1_visual.obj ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b9d27e9bf5171289bb2a661e2bd97e0b38d0b033939aad0dc960f173c85abbf9
3
+ size 3473949
arms/armbot/meshes/original/joint_0.obj ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:00d50108d7c89efc40f644da68a8e44e05d66cd7b6a509c4f21a39a81ae5ce7d
3
+ size 1743470
arms/armbot/meshes/original/joint_1.obj ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f1379c5672661075cfd7ab8c67709431c00fb19b062ec3897029bf1e9d634747
3
+ size 1831223
arms/armbot/meshes/original/joint_motor.obj ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:89fe8973985a335a5a73aec9c106d8b3e2376d252fd8d00f86470a530cd887e0
3
+ size 6360034
fig/arms/agilex-aloha.png ADDED

Git LFS Details

  • SHA256: 301235d5d0e8e4d477ed3b708f4a95dd2644efbb717dedaa9380de4e25ddad2b
  • Pointer size: 130 Bytes
  • Size of remote file: 93 kB
fig/arms/arx-x5.png ADDED

Git LFS Details

  • SHA256: 1a5be398c8e2323beb1f961e640db6aaa892d9981724633853b3f456f062b6e7
  • Pointer size: 130 Bytes
  • Size of remote file: 47 kB
pyproject.toml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [project]
2
+ name = "byorobotsim-embodiment-viewer"
3
+ version = "0.1.0"
4
+ description = "Viser viewer for downloaded ByoRobotSim embodiments"
5
+ requires-python = ">=3.11"
6
+ dependencies = [
7
+ "numpy>=1.24",
8
+ "pyyaml>=6",
9
+ "trimesh>=4",
10
+ "viser>=1.0",
11
+ "yourdfpy>=0.0.56",
12
+ ]
13
+
14
+ [tool.uv]
15
+ package = false
visualize.py ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Visualize downloaded grippers and arms with an animated viser server."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ import json
7
+ import math
8
+ import time
9
+ from dataclasses import dataclass
10
+ from pathlib import Path
11
+
12
+ import numpy as np
13
+ import trimesh
14
+ import viser
15
+ import yaml
16
+ import yourdfpy
17
+
18
+
19
+ ROOT = Path(__file__).resolve().parent
20
+
21
+
22
+ @dataclass
23
+ class Embodiment:
24
+ """Hold a loaded URDF and the endpoints of its animation."""
25
+
26
+ name: str
27
+ kind: str
28
+ robot: yourdfpy.URDF
29
+ start: dict[str, float]
30
+ end: dict[str, float]
31
+
32
+
33
+ def discover(kind: str) -> dict[str, Path]:
34
+ """Find one preferred URDF for each downloaded embodiment."""
35
+ found = {}
36
+ for folder in sorted((ROOT / kind).iterdir()):
37
+ if not folder.is_dir() or folder.name.lower() == "armbot":
38
+ continue
39
+ candidates = [folder / "gripper.urdf"] if kind == "grippers" else []
40
+ config_path = folder / "config.yml"
41
+ if config_path.exists():
42
+ config = yaml.safe_load(config_path.read_text()) or {}
43
+ if config.get("urdf_path"):
44
+ candidates.append(folder / config["urdf_path"])
45
+ candidates += sorted(folder.glob("*.urdf"))
46
+ candidates += sorted((folder / "urdf").glob("*.urdf"))
47
+ for path in candidates:
48
+ if path.is_file():
49
+ found[folder.name] = path
50
+ break
51
+ return found
52
+
53
+
54
+ def load_embodiment(kind: str, name: str, path: Path) -> Embodiment:
55
+ """Load visual geometry and choose motion endpoints from asset metadata."""
56
+ robot = yourdfpy.URDF.load(str(path), build_scene_graph=True, load_meshes=True,
57
+ build_collision_scene_graph=False, load_collision_meshes=False)
58
+ joints = {joint.name: joint for joint in robot.robot.joints
59
+ if joint.type in ("revolute", "continuous", "prismatic") and joint.mimic is None}
60
+ start = {}
61
+ end = {}
62
+ folder = path.parent if path.parent.name != "urdf" else path.parent.parent
63
+ gripper_config = folder / "config.json"
64
+ arm_config = folder / "config.yml"
65
+ open_pose = close_pose = {}
66
+ home_pose = {}
67
+ if kind == "grippers" and gripper_config.exists():
68
+ config = json.loads(gripper_config.read_text())
69
+ open_pose, close_pose = config.get("open", {}), config.get("close", {})
70
+ if kind == "arms" and arm_config.exists():
71
+ config = yaml.safe_load(arm_config.read_text()) or {}
72
+ names = config.get("arm_joints_name", [[]])[0]
73
+ values = config.get("homestate", [[]])[0]
74
+ home_pose = dict(zip(names, values))
75
+
76
+ for index, (joint_name, joint) in enumerate(joints.items()):
77
+ lower = float(joint.limit.lower) if joint.limit and joint.limit.lower is not None else -math.pi
78
+ upper = float(joint.limit.upper) if joint.limit and joint.limit.upper is not None else math.pi
79
+ if lower > upper:
80
+ lower, upper = upper, lower
81
+ initial = float(open_pose.get(joint_name, home_pose.get(joint_name, 0.0)))
82
+ start[joint_name] = float(np.clip(initial, lower, upper))
83
+ if joint_name in close_pose:
84
+ target = float(close_pose[joint_name])
85
+ elif kind == "arms" and joint_name in home_pose:
86
+ # Alternate neighboring arm joints in opposite directions for a visible, modest motion.
87
+ target = initial + (0.35 if index % 2 == 0 else -0.35)
88
+ else:
89
+ target = upper if abs(upper - initial) >= abs(initial - lower) else lower
90
+ end[joint_name] = float(np.clip(target, lower, upper))
91
+ return Embodiment(name, kind, robot, start, end)
92
+
93
+
94
+ def add_visuals(server: viser.ViserServer, item: Embodiment, offset: np.ndarray) -> list[tuple[str, object]]:
95
+ """Create each visual mesh once and retain handles for transform updates."""
96
+ handles = []
97
+ scene = item.robot.scene
98
+ for index, (geometry_name, geometry) in enumerate(scene.geometry.items()):
99
+ if isinstance(geometry, trimesh.Scene):
100
+ geometry = geometry.dump(concatenate=True)
101
+ if not isinstance(geometry, trimesh.Trimesh) or len(geometry.vertices) == 0:
102
+ continue
103
+ handle = server.scene.add_mesh_trimesh(f"/{item.kind}/{item.name}/mesh_{index}", geometry)
104
+ handles.append((geometry_name, handle))
105
+ server.scene.add_label(f"/{item.kind}/{item.name}/label", item.name,
106
+ position=tuple(offset + [0, 0, -0.08]))
107
+ return handles
108
+
109
+
110
+ def update_pose(item: Embodiment, handles: list[tuple[str, object]], offset: np.ndarray, phase: float) -> None:
111
+ """Apply interpolated joint positions and update all mesh transforms."""
112
+ pose = {name: value + phase * (item.end[name] - value) for name, value in item.start.items()}
113
+ item.robot.update_cfg(pose)
114
+ for geometry_name, handle in handles:
115
+ transform = item.robot.scene.graph.get(geometry_name)[0]
116
+ handle.position = tuple(transform[:3, 3] + offset)
117
+ handle.wxyz = tuple(trimesh.transformations.quaternion_from_matrix(transform))
118
+
119
+
120
+ def main() -> None:
121
+ """Discover selected assets and serve their looping motion in viser."""
122
+ parser = argparse.ArgumentParser(description=__doc__)
123
+ parser.add_argument("--kind", choices=("grippers", "arms"), default="grippers")
124
+ parser.add_argument("--name", help="Embodiment directory name")
125
+ parser.add_argument("--all", action="store_true", help="Show all gripper URDFs")
126
+ parser.add_argument("--list", action="store_true", help="List available URDFs and exit")
127
+ parser.add_argument("--port", type=int, default=8080)
128
+ args = parser.parse_args()
129
+ if args.all and args.kind != "grippers":
130
+ parser.error("--all is only available for grippers")
131
+ available = discover(args.kind)
132
+ if args.list:
133
+ for kind in ("grippers", "arms"):
134
+ print(f"{kind}: {', '.join(discover(kind))}")
135
+ return
136
+ if not args.all and args.name not in available:
137
+ all_hint = " (or use --all)" if args.kind == "grippers" else ""
138
+ parser.error(f"Choose --name from: {', '.join(available)}{all_hint}")
139
+ selected = available if args.all else {args.name: available[args.name]}
140
+ server = viser.ViserServer(port=args.port)
141
+ models = []
142
+ for index, (name, path) in enumerate(selected.items()):
143
+ try:
144
+ item = load_embodiment(args.kind, name, path)
145
+ spacing = 1.2 if args.kind == "arms" else 0.35
146
+ offset = np.array([index % 5 * spacing, index // 5 * spacing, 0.0])
147
+ handles = add_visuals(server, item, offset)
148
+ update_pose(item, handles, offset, 0.0)
149
+ models.append((item, handles, offset))
150
+ print(f"Loaded {args.kind}/{name}: {len(handles)} visuals, {len(item.start)} joints")
151
+ except Exception as exc:
152
+ if not args.all:
153
+ raise
154
+ print(f"Failed {args.kind}/{name}: {exc}")
155
+ if not models:
156
+ raise RuntimeError("No embodiments could be loaded")
157
+ phase_slider = server.gui.add_slider("Pose", min=0.0, max=1.0, step=0.01, initial_value=0.0)
158
+ playing = server.gui.add_checkbox("Play", initial_value=True)
159
+ print(f"Viewer: http://localhost:{server.get_port()}")
160
+ previous = time.monotonic()
161
+ phase = 0.0
162
+ while True:
163
+ now = time.monotonic()
164
+ if playing.value:
165
+ phase = (phase + (now - previous) / 3.0) % 2.0
166
+ phase_slider.value = round(phase if phase <= 1.0 else 2.0 - phase, 2)
167
+ previous = now
168
+ for item, handles, offset in models:
169
+ update_pose(item, handles, offset, phase_slider.value)
170
+ time.sleep(0.05)
171
+
172
+
173
+ if __name__ == "__main__":
174
+ main()