Function parseHrdBuffer

  • Parses a binary HRD data buffer into an array of velocity/torque samples.

    Each sample in the buffer consists of:

    • 4 bytes: velocity (signed 32-bit integer, little-endian, Q15 fixed-point format)
    • 2 bytes: torque (signed 16-bit integer, little-endian)

    The function iterates through the buffer in 6-byte chunks, extracting velocity and torque for each sample. The velocity is converted from Q15 fixed-point format to a floating-point number and rounded to an integer.

    Each returned sample is a tuple of the form: [velocityQ15, torque, velocity], where:

    • velocityQ15 is the original 32-bit Q15 integer from the buffer
    • torque is the 16-bit signed integer from the buffer
    • velocity is the floating-point velocity value converted from Q15 and rounded to an integer

    If the buffer length is not a multiple of 6, an error is logged and an empty array is returned.

    Returns

    An array of [velocityQ15, torque, velocity] tuples, one per sample, or an empty array if the buffer is invalid.

    Parameters

    • data: Uint8Array

      A Uint8Array containing raw HRD binary data.

    Returns number[][]

Generated using TypeDoc