AdapTuning.parse constructor

AdapTuning.parse(
  1. ByteData data_
)

Implementation

factory AdapTuning.parse(ByteData data_) {
  if (data_.lengthInBytes < AdapTuning.mavlinkEncodedLength) {
    var len = AdapTuning.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 error = data_.getFloat32(8, Endian.little);
  var theta = data_.getFloat32(12, Endian.little);
  var omega = data_.getFloat32(16, Endian.little);
  var sigma = data_.getFloat32(20, Endian.little);
  var thetaDot = data_.getFloat32(24, Endian.little);
  var omegaDot = data_.getFloat32(28, Endian.little);
  var sigmaDot = data_.getFloat32(32, Endian.little);
  var f = data_.getFloat32(36, Endian.little);
  var fDot = data_.getFloat32(40, Endian.little);
  var u = data_.getFloat32(44, Endian.little);
  var axis = data_.getUint8(48);

  return AdapTuning(
      desired: desired,
      achieved: achieved,
      error: error,
      theta: theta,
      omega: omega,
      sigma: sigma,
      thetaDot: thetaDot,
      omegaDot: omegaDot,
      sigmaDot: sigmaDot,
      f: f,
      fDot: fDot,
      u: u,
      axis: axis);
}