File size: 2,491 Bytes
a89a522 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | from decoupled_wbc.control.main.teleop.configs.configs import SyncSimDataCollectionConfig
from decoupled_wbc.control.main.teleop.run_sync_sim_data_collection import (
main as data_collection_main,
)
def test_sim_data_collection_unit(robot_name="G1", task_name="GroundOnly"):
"""
Fast CI unit test for simulation data collection (50 steps, no tracking checks).
This test validates that:
1. Data collection completes successfully
2. Upper body joints are moving (velocity check)
Note: This test runs for only 50 steps and does not perform end effector tracking validation
for faster CI execution.
"""
config = SyncSimDataCollectionConfig()
config.robot = robot_name
config.task_name = task_name
config.enable_visualization = False
config.enable_real_device = False
config.enable_onscreen = False
config.save_img_obs = True
config.ci_test = True
config.ci_test_mode = "unit"
config.replay_data_path = "decoupled_wbc/tests/replay_data/all_joints_raw_data_replay.pkl"
config.remove_existing_dir = True
config.enable_gravity_compensation = True
res = data_collection_main(config)
assert res, "Data collection did not pass for all datasets"
def test_sim_data_collection_pre_merge(robot_name="G1", task_name="GroundOnly"):
"""
Pre-merge test for simulation data collection with end effector tracking validation (500 steps).
This test validates that:
1. Data collection completes successfully
2. Upper body joints are moving (velocity check)
3. End effector tracking error is within thresholds:
- G1 robots:
Max position error < 7cm (0.07m), Max rotation error < 17°,
Average position error < 5cm (0.05m), Average rotation error < 12°
"""
config = SyncSimDataCollectionConfig()
config.robot = robot_name
config.task_name = task_name
config.enable_visualization = False
config.enable_real_device = False
config.enable_onscreen = False
config.save_img_obs = True
config.ci_test = True
config.ci_test_mode = "pre_merge"
config.replay_data_path = "decoupled_wbc/tests/replay_data/all_joints_raw_data_replay.pkl"
config.remove_existing_dir = True
config.enable_gravity_compensation = True
res = data_collection_main(config)
assert res, "Data collection did not pass for all datasets"
if __name__ == "__main__":
# Run unit tests for fast CI
test_sim_data_collection_unit("G1", "GroundOnly")
|