Ahrs.parse constructor

Ahrs.parse(
  1. ByteData data_
)

Implementation

factory Ahrs.parse(ByteData data_) {
  if (data_.lengthInBytes < Ahrs.mavlinkEncodedLength) {
    var len = Ahrs.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var omegaix = data_.getFloat32(0, Endian.little);
  var omegaiy = data_.getFloat32(4, Endian.little);
  var omegaiz = data_.getFloat32(8, Endian.little);
  var accelWeight = data_.getFloat32(12, Endian.little);
  var renormVal = data_.getFloat32(16, Endian.little);
  var errorRp = data_.getFloat32(20, Endian.little);
  var errorYaw = data_.getFloat32(24, Endian.little);

  return Ahrs(
      omegaix: omegaix,
      omegaiy: omegaiy,
      omegaiz: omegaiz,
      accelWeight: accelWeight,
      renormVal: renormVal,
      errorRp: errorRp,
      errorYaw: errorYaw);
}