feat: 更新右臂和左臂配置,禁用奇异性避免;增强ACT数据采集功能,添加日志记录
This commit is contained in:
@@ -616,14 +616,19 @@ class _StatusPublisher:
|
||||
|
||||
|
||||
class _Logger:
|
||||
def info(self, *_args, **_kwargs):
|
||||
pass
|
||||
def __init__(self):
|
||||
self.infos = []
|
||||
self.warnings = []
|
||||
self.errors = []
|
||||
|
||||
def warn(self, *_args, **_kwargs):
|
||||
pass
|
||||
def info(self, message, *_args, **_kwargs):
|
||||
self.infos.append(message)
|
||||
|
||||
def error(self, *_args, **_kwargs):
|
||||
pass
|
||||
def warn(self, message, *_args, **_kwargs):
|
||||
self.warnings.append(message)
|
||||
|
||||
def error(self, message, *_args, **_kwargs):
|
||||
self.errors.append(message)
|
||||
|
||||
|
||||
def _control_message(seq, control_ns, *, grip=True):
|
||||
@@ -705,7 +710,8 @@ def _recorder_for_test(tmp_path):
|
||||
recorder._status_pub = _StatusPublisher()
|
||||
recorder._now_ns = lambda: now_ns
|
||||
recorder._disk_usage = lambda _path: SimpleNamespace(free=5 * 1024**3)
|
||||
recorder.get_logger = lambda: _Logger()
|
||||
recorder._logger = _Logger()
|
||||
recorder.get_logger = lambda: recorder._logger
|
||||
return recorder
|
||||
|
||||
|
||||
@@ -776,6 +782,14 @@ def test_end_to_end_fake_episode_saves_and_returns_idle(tmp_path):
|
||||
assert recorder.state is RecordingState.IDLE
|
||||
assert "SAVING" in recorder._status_pub.messages
|
||||
assert recorder._status_pub.messages[-2:] == ["SAVED", "IDLE"]
|
||||
assert any(
|
||||
"ACT录制状态:RECORDING,episode_0" in message
|
||||
for message in recorder._logger.infos
|
||||
)
|
||||
assert any(
|
||||
"episode_0.hdf5(3 samples)" in message
|
||||
for message in recorder._logger.infos
|
||||
)
|
||||
|
||||
|
||||
@requires_h5py
|
||||
@@ -791,6 +805,11 @@ def test_final_publish_rejects_allocated_episode_number_conflict(tmp_path):
|
||||
assert not (recorder._task_dir / "episode_1.hdf5").exists()
|
||||
rejected = list((recorder._task_dir / "rejected").glob("*.hdf5"))
|
||||
assert len(rejected) == 1
|
||||
assert any(
|
||||
str(rejected[0]) in message
|
||||
and "原因:episode_number_conflict" in message
|
||||
for message in recorder._logger.warnings
|
||||
)
|
||||
with h5py.File(rejected[0], "r") as root:
|
||||
assert root.attrs["reject_reason"] == "episode_number_conflict"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user