Update warehouse digital twin and robot fleet optimization

This commit is contained in:
DnyaneshwariP13
2026-11-25 11:54:38 +05:30
parent e9c573ddc2
commit acab3a1f5b
367 changed files with 4411504 additions and 110561 deletions
+64 -2
View File
@@ -113,7 +113,7 @@ def test_warehouse_builder_generates_valid_scene(sample_bundle, manifest_file: P
assert 'def Xform "dock_inbound_1"' in content
assert 'def Xform "picking_station_a1"' in content
assert "dock_inbound.usda" in content
assert "picking_station.usda" in content
assert "dock_outbound.usda" in content
# Charging Bays
assert 'def Scope "ChargingStations"' in content
@@ -144,7 +144,8 @@ def test_robot_animator_single_and_multi_robot(sample_bundle, manifest_file: Pat
"amr_light_01": [
{"t": 0.0, "pos": [2.0, 36.0, 0.0], "yaw_deg": 0.0, "state": "IDLE", "battery_percent": 100.0, "is_loaded": False},
{"t": 5.0, "pos": [12.0, 36.0, 0.0], "yaw_deg": 0.0, "state": "LOADED_TRANSIT", "battery_percent": 98.0, "is_loaded": True},
{"t": 10.0, "pos": [20.0, 36.0, 0.0], "yaw_deg": 90.0, "state": "DROPPING", "battery_percent": 96.0, "is_loaded": True},
{"t": 8.0, "pos": [2.0, 30.0, 0.0], "yaw_deg": 90.0, "state": "DROPPING", "battery_percent": 96.0, "is_loaded": True},
{"t": 10.0, "pos": [2.0, 30.0, 0.0], "yaw_deg": 90.0, "state": "IDLE", "battery_percent": 96.0, "is_loaded": False},
],
"amr_heavy_01": [
{"t": 0.0, "pos": [6.0, 36.0, 0.0], "yaw_deg": 0.0, "state": "IDLE", "battery_percent": 100.0, "is_loaded": False},
@@ -186,3 +187,64 @@ def test_robot_animator_single_and_multi_robot(sample_bundle, manifest_file: Pat
assert 'def Xform "amr_heavy_01"' in fleet_content
assert "amr_light.usda" in fleet_content
assert "amr_heavy.usda" in fleet_content
# Delivered cargo appears at stations post-dropoff
assert 'def Scope "DeliveredCargo"' in fleet_content
assert "Delivered_outbound_pack_1_0" in fleet_content
def test_rack_inventory_depletion_and_dock_vertical_stacking(sample_bundle, manifest_file: Path, tmp_path: Path):
"""Verify rack inventory depletes with time-sampled visibility and dock boxes stack vertically."""
# Mock trajectory with a pick at rack_a_01 and multiple dropoffs at outbound_pack_1
mock_trajectory = {
"metadata": {"simulation_duration": 40.0},
"robots": {
"amr_light_01": [
{"t": 0.0, "pos": [8.0, 8.8, 0.0], "yaw_deg": 90.0, "state": "PICKING", "battery_percent": 100.0, "is_loaded": False},
{"t": 5.0, "pos": [8.0, 8.8, 0.0], "yaw_deg": 90.0, "state": "LOADED_TRANSIT", "battery_percent": 99.0, "is_loaded": True},
{"t": 15.0, "pos": [2.0, 30.0, 0.0], "yaw_deg": -90.0, "state": "DROPPING", "battery_percent": 97.0, "is_loaded": True},
{"t": 18.0, "pos": [2.0, 30.0, 0.0], "yaw_deg": -90.0, "state": "IDLE", "battery_percent": 97.0, "is_loaded": False},
{"t": 20.0, "pos": [8.0, 8.8, 0.0], "yaw_deg": 90.0, "state": "PICKING", "battery_percent": 96.0, "is_loaded": False},
{"t": 25.0, "pos": [8.0, 8.8, 0.0], "yaw_deg": 90.0, "state": "LOADED_TRANSIT", "battery_percent": 95.0, "is_loaded": True},
{"t": 35.0, "pos": [2.0, 30.0, 0.0], "yaw_deg": -90.0, "state": "DROPPING", "battery_percent": 93.0, "is_loaded": True},
{"t": 38.0, "pos": [2.0, 30.0, 0.0], "yaw_deg": -90.0, "state": "IDLE", "battery_percent": 93.0, "is_loaded": False},
],
},
}
traj_data = TrajectoryData.from_dict(mock_trajectory)
animator = Robot3DAnimator.from_config_and_trajectory(
bundle=sample_bundle,
trajectory_data=traj_data,
manifest_path=manifest_file,
sample_step_seconds=1.0,
timecodes_per_second=24.0,
)
stage_file = tmp_path / "depletion_demo.usda"
saved = animator.export_usda(stage_file)
assert saved.exists()
content = saved.read_text(encoding="utf-8")
# 1. Verify rack inventory depletion on rack_a_01
assert 'def Xform "rack_a_01_Cartons_L1"' in content
assert 'token visibility.timeSamples = {' in content
assert '"invisible"' in content
# 2. Verify inbound dock has multi-tier vertical staging stacks
assert 'def Xform "dock_inbound_1_StagedPallet_0_Tier_0"' in content
assert 'def Xform "dock_inbound_1_StagedPallet_0_Tier_1"' in content
assert "(wx, wy, wz) = (2.100, 10.450, 0.150)" in content or "0.150)" in content
assert "1.100)" in content # Second tier stacked on top of first tier
# 3. Verify delivered boxes at outbound_pack_1 stack vertically on top of each other
assert 'def Scope "DeliveredCargo"' in content
assert 'def Xform "Delivered_outbound_pack_1_0"' in content
assert 'def Xform "Delivered_outbound_pack_1_1"' in content
# Box 0 is Tier 0 at z=0.150, Box 1 is Tier 1 directly on top at z=1.100
assert "Delivered_outbound_pack_1_0" in content
assert "Delivered_outbound_pack_1_1" in content
assert "0.150" in content
assert "1.100" in content