pod_console: 补自动锁定指令序列与状态字诊断
--auto-lock 追加0x0F发现目标自动锁定+0x10识别转跟踪(只发0x07常不锁定), --motor-on 可先开电机0x27, 指令间200ms间隔; 面板新增状态字行(s1/s2/s3、 视频源、电机、自检)便于判断吊舱实际状态; 退出汇总改为分级排查指引。 打桩验证: 序列0x27/0x07(param_x=1)/0x0F/0x10 与状态字解析均正确
This commit is contained in:
@@ -6,8 +6,13 @@ Ctrl+C 退出;退出时打印本次运行的锁定事件汇总(含每次锁定
|
||||
用法:
|
||||
python utils/pod_bridge/pod_console.py /dev/ttyAMA0
|
||||
python utils/pod_bridge/pod_console.py /dev/ttyAMA0 --detect drone --refresh 0.2
|
||||
python utils/pod_bridge/pod_console.py /dev/ttyAMA0 --detect drone --auto-lock
|
||||
python utils/pod_bridge/pod_console.py /dev/ttyAMA0 --duration 60 # 定时自动结束
|
||||
|
||||
锁定不起来时的排查:先看面板「状态字」行(电机/自检/视频源),再试 --auto-lock
|
||||
(识别开 0x07 + 发现目标自动锁定 0x0F + 识别转跟踪 0x10),必要时 --motor-on
|
||||
先开电机(0x27)。协议上「识别」与「跟踪」是两个阶段,只开识别常不锁定。
|
||||
|
||||
说明:
|
||||
* 默认 --duration 0 表示一直运行直到 Ctrl+C;
|
||||
* 终端(TTY)下清屏刷新,输出重定向到文件时改为逐次追加,便于留存日志;
|
||||
@@ -91,13 +96,29 @@ def main() -> int:
|
||||
help="运行时长(秒);0 表示一直跑到 Ctrl+C")
|
||||
ap.add_argument("--detect", choices=sorted(_DETECT_PARAM_X),
|
||||
help="启动时下发 目标识别开(0x07)")
|
||||
ap.add_argument("--auto-lock", action="store_true",
|
||||
help="在识别开之后追加 发现目标自动锁定(0x0F)与 识别转跟踪(0x10)")
|
||||
ap.add_argument("--motor-on", action="store_true",
|
||||
help="启动时先下发 开电机(0x27)")
|
||||
args = ap.parse_args()
|
||||
|
||||
pod = PodSerial(args.port, args.baud)
|
||||
|
||||
def _send(code, **params):
|
||||
pod.send(encode_control(ControlCommand(code=code, **params)))
|
||||
time.sleep(0.2) # 吊舱处理指令需要时间,连续下发间隔 200ms
|
||||
print(f"[send] 0x{int(code):02X} {params or ''}")
|
||||
|
||||
if args.motor_on:
|
||||
_send(ControlCode.MOTOR_ON) # 0x27 开电机
|
||||
if args.detect:
|
||||
px = _DETECT_PARAM_X[args.detect]
|
||||
pod.send(encode_control(ControlCommand(
|
||||
code=ControlCode.TARGET_DETECT_ON, param_x=px)))
|
||||
_send(ControlCode.TARGET_DETECT_ON, # 0x07 目标识别开
|
||||
param_x=_DETECT_PARAM_X[args.detect])
|
||||
if args.auto_lock:
|
||||
_send(ControlCode.AUTO_LOCK_ON_FOUND) # 0x0F 发现目标自动锁定
|
||||
_send(ControlCode.DETECT_TO_TRACK) # 0x10 识别转跟踪
|
||||
elif args.detect:
|
||||
print("[提示] 只开了识别(0x07)可能仍不锁定,可加 --auto-lock 追加 0x0F/0x10")
|
||||
|
||||
tty = sys.stdout.isatty()
|
||||
t0 = time.monotonic()
|
||||
@@ -159,6 +180,13 @@ def main() -> int:
|
||||
frame_ang = "-" if latest is None else \
|
||||
(f"{latest.frame_roll_deg:+.2f}, {latest.frame_pitch_deg:+.2f}, "
|
||||
f"{latest.frame_yaw_deg:+.2f}")
|
||||
if latest is not None:
|
||||
st = (f"状态字 s1=0x{latest.status1:02X} s2=0x{latest.status2:02X} "
|
||||
f"s3=0x{latest.status3:02X} | 视频源={latest.track_source} "
|
||||
f"电机={'开' if latest.motor_on else '关'} "
|
||||
f"自检=0x{latest.self_check:02X}")
|
||||
else:
|
||||
st = "状态字: 尚无遥测"
|
||||
tgt_txt = "无"
|
||||
if latest_tgt is not None:
|
||||
g, ts = latest_tgt
|
||||
@@ -171,6 +199,7 @@ def main() -> int:
|
||||
f" 锁定: {lock_txt}",
|
||||
f" 激光: {laser}",
|
||||
f" 脱靶量(X,Y): {off} 框架角(R,P,Y): {frame_ang}",
|
||||
f" {st}",
|
||||
f" 最近目标: {tgt_txt}",
|
||||
f" 锁定次数: {len(tracker.events)}"
|
||||
+ (f"(进行中第 {len(tracker.events) + 1} 次)"
|
||||
@@ -198,8 +227,12 @@ def main() -> int:
|
||||
f"({n_tele / now_s:.1f}Hz 均值) | 目标帧 {n_tgt}")
|
||||
print(f"锁定事件 {len(tracker.events)} 次")
|
||||
if not tracker.events:
|
||||
print(" 未出现锁定:确认视场内有目标;必要时补发 AUTO_LOCK_ON_FOUND(0x0F) "
|
||||
"或 DETECT_TO_TRACK(0x10)")
|
||||
print(" 未出现锁定,排查顺序:")
|
||||
print(" 1) 视场内是否有目标、识别类型是否匹配(--detect person / drone,对应 0x07 参数X 0/1)")
|
||||
print(" 2) 加 --auto-lock:协议上「识别」与「跟踪」是两个阶段,只发 0x07 常不锁定")
|
||||
print(" 3) 看面板「状态字」行:电机是否为开(否则 --motor-on 发 0x27)、自检是否异常")
|
||||
print(" 4) 手动试探:send_control.py --code AUTO_LOCK_ON_FOUND / DETECT_TO_TRACK")
|
||||
print(" 5) 仍不锁定则确认吊舱是否已进入可跟踪模式(镜头/变焦/抗遮挡等)")
|
||||
else:
|
||||
for i, (s, e, l0, l1, n) in enumerate(tracker.events, 1):
|
||||
lz = "-"
|
||||
|
||||
Reference in New Issue
Block a user