fix(pybot×actpred): 微动作录制时间轴均匀化——首行分解为重复步,delay 列权重归零

pybot run():带 delay 的首行(无前序状态)不再单步执行,分解为
N=delay//10 个重复微步(插值退化恒等),录制数据全 10ms 均匀节拍,
delay 列恒 10ms——行级时长信息已隐式编码在步数中,消除首行 200ms
造成的时间采样不均(frame_len/history_len 等间隔假设被破坏)。

actpred default_column_weights:spk.delay 权重 0.2→0.0(步级恒值列
无信号,与保留位同级);spk.F 保持 0.2。

新录制数据集(952 样本,delay 恒 10)存于 data/pybot_record_v2(不入库)。
This commit is contained in:
qing committed 2026-08-14 21:56:01 +00:00
1 parent 1cf428f384
commit 99c1bc1739
5 files changed
+27 -18

No files matched your search

+3 -2
View File
@@ -68,8 +68,9 @@ def test_run_stand_action(mock_i2c):
# s9/s10: 90° → offval = int(1.5*4096/20) = 307
assert writes[32:36] == servo_writes(8, 307)
assert writes[36:40] == servo_writes(9, 307)
# 10 舵机 × 4 寄存器
assert len(writes) == 40
# 首行 delay=200 → 分解为 20 个重复微步:10 舵机 × 4 寄存器 × 20 步
assert len(writes) == 800
assert writes[40:44] == servo_writes(0, 204) # 第 2 步与第 1 步相同
robot.deactive()
+6 -5
View File
@@ -201,7 +201,7 @@ def test_action_vector_padding(tmp_path, mock_i2c):
robot.deactive()
actions = np.load(tmp_path / "episode_0000" / "actions.npy")
assert actions.shape == (19, 18) # 1(首行)+ 9×2(微步)= 19
assert actions.shape == (20, 18) # 10 行 × delay=20 → 各 2 微步 = 20
assert np.all(actions[:, 4:] == 0) # 列 4-17 全为零
@@ -216,8 +216,9 @@ def test_placeholder_resolution(tmp_path, mock_i2c):
actions = np.load(tmp_path / "episode_0000" / "actions.npy")
# s1.A: 全 45(首行 45,后续行 '-' 继承 45,插值 45→45 仍为 45)
assert np.all(actions[:, 0] == 45)
# s2.A: 首行 0,后续行插值
expected_s2 = [0, 5, 10, 15, 20, 25, 30, 15, 0, 5, 10, 15, 20, 25, 30, 15, 0, 5, 10]
# s2.A: 首行 0 重复 2 步(不插值),后续行插值
expected_s2 = [0, 0, 5, 10, 15, 20, 25, 30, 15, 0, 5, 10,
15, 20, 25, 30, 15, 0, 5, 10]
assert list(actions[:, 1]) == expected_s2
@@ -270,8 +271,8 @@ def test_micro_action_interpolation(tmp_path, mock_i2c):
robot.deactive()
actions = np.load(tmp_path / "episode_0000" / "actions.npy")
# 首行 s1=0(不分解),row2 s1 从 0→30 分 3 步
expected_s1 = [0, 10, 20, 30]
# 首行 s1=0 重复 3 步(不插值),row2 s1 从 0→30 分 3 步插值
expected_s1 = [0, 0, 0, 10, 20, 30]
assert list(actions[:, 0]) == expected_s1