fix: 统一 .mt 首行 '-' 占位符语义——actpred 对齐 pybot/bot4cj 运行时(填 0),弃用 @Servo max 列填充

This commit is contained in:
qing committed 2026-08-11 16:30:39 +08:00
1 parent 6d79fc919f
commit 0aa0710a9e
5 files changed
+42 -44

No files matched your search

+3 -3
View File
@@ -213,9 +213,9 @@ class MatrixSaver:
# ---------------- 占位符语义(与仓颉版 MatrixVars_Hardware.getMt/parseMt 对齐) ----------------
#
# ⚠️ 与 actpred/mt_parser.py 的语义差异(不得误统一):
# actpred 数据管线首行 '-' 用 @Servo 初始角度填充;
# pybot 运行时首行 '-' 数值列解析为 0(Servo 有 max/min 钳位保护)。
# 首行 '-' 数值列解析为 0(Servo 有 max/min 钳位保护)。
# actpred/mt_parser.py 曾用 @Servo max 列填充首行 '-',2026-08 已统一
# 为本语义(填 0),见 docs/reports/bot4cj_python_migration_dev_doc.md §2.3。
def get_mt(obj, row, col):
"""获得项目值:原始值是占位符且非首行(row>1),递归取上一行同列值"""
+1 -1
View File
@@ -91,7 +91,7 @@ def test_placeholder_recursion():
def test_placeholder_first_row():
"""首行 '-':get_mt 返回字面 '-';parse_mt 解析为 typ("0")
⚠️ 与 actpred/mt_parser.py 不同(后者用 @Servo 初始角度填充),不得误统一"""
actpred/mt_parser.py 已统一为本语义(首行 '-' 填 0),本测试即两侧共同的语义锚点"""
m = _matrix("@T\nname v;\na -;\n@\n")
assert get_mt(m, 1, 1) == "-"
assert parse_mt(m, 1, 1) == 0.0