AttitudeQuaternion.parse constructor

AttitudeQuaternion.parse(
  1. ByteData data_
)

Implementation

factory AttitudeQuaternion.parse(ByteData data_) {
  if (data_.lengthInBytes < AttitudeQuaternion.mavlinkEncodedLength) {
    var len = AttitudeQuaternion.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var timeBootMs = data_.getUint32(0, Endian.little);
  var q1 = data_.getFloat32(4, Endian.little);
  var q2 = data_.getFloat32(8, Endian.little);
  var q3 = data_.getFloat32(12, Endian.little);
  var q4 = data_.getFloat32(16, Endian.little);
  var rollspeed = data_.getFloat32(20, Endian.little);
  var pitchspeed = data_.getFloat32(24, Endian.little);
  var yawspeed = data_.getFloat32(28, Endian.little);
  var reprOffsetQ = MavlinkMessage.asFloat32List(data_, 32, 4);

  return AttitudeQuaternion(
      timeBootMs: timeBootMs,
      q1: q1,
      q2: q2,
      q3: q3,
      q4: q4,
      rollspeed: rollspeed,
      pitchspeed: pitchspeed,
      yawspeed: yawspeed,
      reprOffsetQ: reprOffsetQ);
}