| | |
| | | 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 |
| | |
| | | |
| | | |
| | | 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]) |
| | |
| | | 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( |
| | |
| | | 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, |
| | | ) |
| | | |
| | | |