PidTuning.parse constructor

PidTuning.parse(
  1. ByteData data_
)

Implementation

factory PidTuning.parse(ByteData data_) {
  if (data_.lengthInBytes < PidTuning.mavlinkEncodedLength) {
    var len = PidTuning.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var desired = data_.getFloat32(0, Endian.little);
  var achieved = data_.getFloat32(4, Endian.little);
  var ff = data_.getFloat32(8, Endian.little);
  var p = data_.getFloat32(12, Endian.little);
  var i = data_.getFloat32(16, Endian.little);
  var d = data_.getFloat32(20, Endian.little);
  var axis = data_.getUint8(24);
  var srate = data_.getFloat32(25, Endian.little);
  var pdmod = data_.getFloat32(29, Endian.little);

  return PidTuning(
      desired: desired,
      achieved: achieved,
      ff: ff,
      p: p,
      i: i,
      d: d,
      axis: axis,
      srate: srate,
      pdmod: pdmod);
}