forked from huggingface/lerobot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclean_calibration.py
More file actions
43 lines (26 loc) · 1.12 KB
/
Copy pathclean_calibration.py
File metadata and controls
43 lines (26 loc) · 1.12 KB
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
#!/usr/bin/env python
"""Clean calibration file to remove extra fields."""
import json
from pathlib import Path
def clean_calibration():
"""Remove extra fields from calibration that aren't part of MotorCalibration."""
calib_file = Path.home() / ".cache/huggingface/lerobot/calibration/robots/so101_follower/so101_chess.json"
with open(calib_file) as f:
calib_data = json.load(f)
# Clean each motor calibration to only include MotorCalibration fields
cleaned_calibration = {}
for motor_name, data in calib_data.items():
cleaned_calibration[motor_name] = {
"id": data["id"],
"drive_mode": data["drive_mode"],
"homing_offset": data["homing_offset"],
"range_min": data["range_min"],
"range_max": data["range_max"]
}
# Save cleaned version
with open(calib_file, 'w') as f:
json.dump(cleaned_calibration, f, indent=2)
print(f"✓ Cleaned calibration file: {calib_file}")
print("Removed extra fields, kept only MotorCalibration fields")
if __name__ == "__main__":
clean_calibration()