Host Parsing & Integration Examples¶
For IMU600-V2 / firmware 0.11.2 / GUI v1.6.1.
Typical Output Sequence¶
Factory settings begin 50 Hz output within about one second of power-on. A batch has three RAW lines, one FUSED and one AHRS. BARO is sent on its own conversion completion, default 50 lines/s; statistics form one set/s. Ellipses and XX below are schematic placeholders, not checksum-valid packets.
$SPNVIMURAW,1,...*XX
$SPNVIMURAW,2,...*XX
$SPNVIMURAW,3,...*XX
$SPNVIMU,...*XX
$SPNVAHRS,...*XX
$SPNVBARO,...*XX
$SPNVSTAT,1,...*XX
$SPNVSTAT,2,...*XX
$SPNVSTAT,3,...*XX
$SPNVFUS,...*XX
$SPNVSYS,...*XX
The principal INFO,1 order is ACK → BOOT → RESET → AUTH → INIT,1 / 2 / 3 → INIT,B, with possible configuration, calibration and interface reports. Do not assume each host read() contains exactly one full line or packet.
ASCII Checksum & Parser Example¶
Buffer serial bytes into a complete line before calling this function. None indicates bad format or checksum; dispatch accepted results by the first field.
def spnv_checksum(body: str) -> str:
value = 0
for byte in body.encode("ascii"):
value ^= byte
return f"{value:02X}"
def parse_line(line: str):
line = line.rstrip("\r\n")
if not line.startswith("$") or "*" not in line:
return None
body, checksum = line[1:].rsplit("*", 1)
if len(checksum) != 2:
return None
try:
if spnv_checksum(body) != checksum.upper():
return None
except UnicodeEncodeError:
return None
return body.split(",")
body = "SPNVCMD,RATE,100"
command = f"${body}*{spnv_checksum(body)}\r\n".encode("ascii")
# ser.write(command)
What a Binary struct String Means¶
<BBHQ3f3ff3f3ff describes a Python struct layout, not an IMU command. < selects little-endian without native alignment padding; B is unsigned 1 byte, H unsigned 2 bytes, Q unsigned 8 bytes, f a 4-byte float and 3f three consecutive floats. This layout totals 68 bytes.
import struct
RAW_FORMAT = "<BBHQ3f3ff3f3ff"
assert struct.calcsize(RAW_FORMAT) == 68
def decode_raw_payload(payload: bytes):
if len(payload) != 68:
raise ValueError("IMU_RAW payload must be 68 bytes")
v = struct.unpack(RAW_FORMAT, payload)
return {
"imu_id": v[0], "status": v[1], "n": v[2], "ts_us": v[3],
"gyro_deg_s": v[4:7], "acc_m_s2": v[7:10], "temp_c": v[10],
"dth_rad": v[11:14], "dv_m_s": v[14:17], "dt_s": v[17],
}
This decodes payload only. First validate ID, length and CRC on the complete D6 44 frame; see binary protocol. Exclude the seven framing / CRC bytes from unpack. RAW seq is counted for message ID 0x01, shared by all three RAW sensors.
ASCII Bandwidth & Baud Error¶
| ASCII Configuration | Approx. Traffic | At 460800 bps |
|---|---|---|
| 50 Hz both + BARO + AHRS | 38 kB/s | Usable; monitor drops |
| 100 Hz fused + AHRS | 26 kB/s | Fits |
| 100 Hz raw | 45 kB/s | Near limit; possible dropped lines |
| 100 Hz both | 59 kB/s | Exceeds limit |
| Configured Baud | Documented Actual Baud | Absolute Error |
|---|---|---|
| 460800 | 458716 | 0.45% |
| 921600 | 925926 | 0.47% |
| 1500000 | 1515152 | 1.0% |
| 2000000 | 2000000 | 0% |
These errors are the document’s UART-divider values, not a specification for every host adapter. The host must support the chosen baud. At higher rates, check wiring, ground and receive errors, and switch only after ACK at the old baud.
Vendor Host Tool¶
The documented tools/spnv_parser.py handles ASCII / binary, checksums and packet-loss statistics. SpnvParser.feed(bytes) returns a list of (kind, name, dict). These commands require the vendor tool, which is not bundled with this website; request it from ethan@robotlab.com.tw.
python3 spnv_parser.py COM5 460800 --binary --cmd RATE,100 --cmd OUT,fused
python3 spnv_parser.py --file capture.bin
Source document:IMU600-V2 Communication Protocol v1.1 · PDF pages 4–28