NavControllerOutput.parse constructor

NavControllerOutput.parse(
  1. ByteData data_
)

Implementation

factory NavControllerOutput.parse(ByteData data_) {
  if (data_.lengthInBytes < NavControllerOutput.mavlinkEncodedLength) {
    var len = NavControllerOutput.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var navRoll = data_.getFloat32(0, Endian.little);
  var navPitch = data_.getFloat32(4, Endian.little);
  var altError = data_.getFloat32(8, Endian.little);
  var aspdError = data_.getFloat32(12, Endian.little);
  var xtrackError = data_.getFloat32(16, Endian.little);
  var navBearing = data_.getInt16(20, Endian.little);
  var targetBearing = data_.getInt16(22, Endian.little);
  var wpDist = data_.getUint16(24, Endian.little);

  return NavControllerOutput(
      navRoll: navRoll,
      navPitch: navPitch,
      altError: altError,
      aspdError: aspdError,
      xtrackError: xtrackError,
      navBearing: navBearing,
      targetBearing: targetBearing,
      wpDist: wpDist);
}