新增pod_bridge吊舱桥接中间件(树莓派4B部署)
- pod_bridge: 协议G版编解码/地理位置引导律/PX4网关/串口链路/闭环主循环 - 含三项安全修复: position_time_ms拆分、表2-2锁定门控、run()异常护栏 - 测试92条全绿; 附树莓派4B(Ubuntu 24.04)部署注意事项与最小依赖清单
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
"""pod_bridge —— 光电吊舱 ↔ PX4 飞控 协议桥接(规格:docs/光电吊舱控制协议G版-PB.docx)。
|
||||
|
||||
吊舱自带 CPU 完成目标解算;本包只做双向搬运 + 格式转换:
|
||||
PX4 遥测(姿态/经纬度/时间) → 表3(EB 91) 串口下发吊舱
|
||||
吊舱 表4(EE 18) 目标经纬度 + 表2-2(EE 16) 遥测 → offboard 速度设定点驱动 PX4 朝目标飞行
|
||||
|
||||
当前含纯协议编解码层 protocol(四帧 encode/decode + FrameParser)、地理位置
|
||||
引导律 guidance(载机位置 + 目标经纬度 → offboard 速度/航向)、配置 config
|
||||
(BridgeConfig + load_from_json)、飞控侧网关 px4_gateway(读 PX4 遥测 +
|
||||
复用 MavsdkCommandGateway 发 offboard 指令)、吊舱侧串口 pod_serial(PodSerial
|
||||
+ PodLink 接口)、闭环主循环 bridge(PodBridge);均可 mock 单测,无硬件依赖。
|
||||
"""
|
||||
|
||||
from .bridge import PodBridge
|
||||
from .config import (
|
||||
BridgeConfig,
|
||||
LinkConfig,
|
||||
PodSerialConfig,
|
||||
Px4Config,
|
||||
load_from_json,
|
||||
)
|
||||
from .guidance import (
|
||||
GuidanceConfig,
|
||||
GuidanceInput,
|
||||
GuidanceLaw,
|
||||
haversine_distance_m,
|
||||
initial_bearing_deg,
|
||||
)
|
||||
from .pod_serial import PodLink, PodSerial
|
||||
from .protocol import (
|
||||
ALT_SCALE,
|
||||
ANGLE_SCALE,
|
||||
ATTITUDE_LEN,
|
||||
CONTROL_LEN,
|
||||
CarrierAttitude,
|
||||
ControlCode,
|
||||
ControlCommand,
|
||||
FrameParser,
|
||||
LATLON_SCALE,
|
||||
RANGE_SCALE,
|
||||
RATE_SCALE,
|
||||
SPEED_SCALE,
|
||||
SYNC_ATTITUDE,
|
||||
SYNC_CONTROL,
|
||||
SYNC_TARGET,
|
||||
SYNC_TELEMETRY,
|
||||
TARGET_LEN,
|
||||
TELEMETRY_LEN,
|
||||
Telemetry,
|
||||
TargetGeo,
|
||||
checksum,
|
||||
decode_attitude,
|
||||
decode_control,
|
||||
decode_target,
|
||||
decode_telemetry,
|
||||
encode_attitude,
|
||||
encode_control,
|
||||
encode_target,
|
||||
encode_telemetry,
|
||||
)
|
||||
from .px4_gateway import OwnState, Px4Gateway
|
||||
|
||||
__all__ = [
|
||||
"ALT_SCALE",
|
||||
"ANGLE_SCALE",
|
||||
"ATTITUDE_LEN",
|
||||
"BridgeConfig",
|
||||
"CONTROL_LEN",
|
||||
"CarrierAttitude",
|
||||
"ControlCode",
|
||||
"ControlCommand",
|
||||
"FrameParser",
|
||||
"GuidanceConfig",
|
||||
"GuidanceInput",
|
||||
"GuidanceLaw",
|
||||
"LATLON_SCALE",
|
||||
"LinkConfig",
|
||||
"OwnState",
|
||||
"PodBridge",
|
||||
"PodLink",
|
||||
"PodSerial",
|
||||
"PodSerialConfig",
|
||||
"Px4Config",
|
||||
"Px4Gateway",
|
||||
"RANGE_SCALE",
|
||||
"RATE_SCALE",
|
||||
"SPEED_SCALE",
|
||||
"SYNC_ATTITUDE",
|
||||
"SYNC_CONTROL",
|
||||
"SYNC_TARGET",
|
||||
"SYNC_TELEMETRY",
|
||||
"TARGET_LEN",
|
||||
"TELEMETRY_LEN",
|
||||
"Telemetry",
|
||||
"TargetGeo",
|
||||
"checksum",
|
||||
"decode_attitude",
|
||||
"decode_control",
|
||||
"decode_target",
|
||||
"decode_telemetry",
|
||||
"encode_attitude",
|
||||
"encode_control",
|
||||
"encode_target",
|
||||
"encode_telemetry",
|
||||
"haversine_distance_m",
|
||||
"initial_bearing_deg",
|
||||
"load_from_json",
|
||||
]
|
||||
Reference in New Issue
Block a user