HilControls.parse constructor

HilControls.parse(
  1. ByteData data_
)

Implementation

factory HilControls.parse(ByteData data_) {
  if (data_.lengthInBytes < HilControls.mavlinkEncodedLength) {
    var len = HilControls.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var timeUsec = data_.getUint64(0, Endian.little);
  var rollAilerons = data_.getFloat32(8, Endian.little);
  var pitchElevator = data_.getFloat32(12, Endian.little);
  var yawRudder = data_.getFloat32(16, Endian.little);
  var throttle = data_.getFloat32(20, Endian.little);
  var aux1 = data_.getFloat32(24, Endian.little);
  var aux2 = data_.getFloat32(28, Endian.little);
  var aux3 = data_.getFloat32(32, Endian.little);
  var aux4 = data_.getFloat32(36, Endian.little);
  var mode = data_.getUint8(40);
  var navMode = data_.getUint8(41);

  return HilControls(
      timeUsec: timeUsec,
      rollAilerons: rollAilerons,
      pitchElevator: pitchElevator,
      yawRudder: yawRudder,
      throttle: throttle,
      aux1: aux1,
      aux2: aux2,
      aux3: aux3,
      aux4: aux4,
      mode: mode,
      navMode: navMode);
}