yincheng.zhong
2025-11-24 08da431bc5693c77659d664bb131f2bfdd14d8e4
python/hitl/protocols.py
@@ -175,6 +175,13 @@
    throttle_pwm: int
    stage: str
    timestamp_ms: float
    east: float
    north: float
    up: float
    heading_deg: float
    target_heading_deg: float
    target_east: float
    target_north: float
@dataclass
@@ -305,7 +312,7 @@
def decode_control_status(msg: PythonAsciiMessage) -> Optional[ControlStatus]:
    if msg.tag.upper() != "CTRL" or len(msg.fields) < 6:
    if msg.tag.upper() != "CTRL" or len(msg.fields) < 14:
        return None
    try:
        forward = float(msg.fields[0])
@@ -314,7 +321,14 @@
        steering = int(float(msg.fields[3]))
        throttle = int(float(msg.fields[4]))
        stage = msg.fields[5]
        timestamp = float(msg.fields[6]) if len(msg.fields) > 6 else 0.0
        timestamp = float(msg.fields[6])
        east = float(msg.fields[7])
        north = float(msg.fields[8])
        up = float(msg.fields[9])
        heading = float(msg.fields[10])
        target_heading = float(msg.fields[11])
        target_e = float(msg.fields[12])
        target_n = float(msg.fields[13])
    except ValueError:
        return None
    return ControlStatus(
@@ -325,6 +339,13 @@
        throttle_pwm=throttle,
        stage=stage,
        timestamp_ms=timestamp,
        east=east,
        north=north,
        up=up,
        heading_deg=heading,
        target_heading_deg=target_heading,
        target_east=target_e,
        target_north=target_n,
    )