AvssDroneImu.parse constructor

AvssDroneImu.parse(
  1. ByteData data_
)

Implementation

factory AvssDroneImu.parse(ByteData data_) {
  if (data_.lengthInBytes < AvssDroneImu.mavlinkEncodedLength) {
    var len = AvssDroneImu.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var timeBootMs = data_.getUint32(0, Endian.little);
  var q1 = data_.getFloat32(4, Endian.little);
  var q2 = data_.getFloat32(8, Endian.little);
  var q3 = data_.getFloat32(12, Endian.little);
  var q4 = data_.getFloat32(16, Endian.little);
  var xacc = data_.getFloat32(20, Endian.little);
  var yacc = data_.getFloat32(24, Endian.little);
  var zacc = data_.getFloat32(28, Endian.little);
  var xgyro = data_.getFloat32(32, Endian.little);
  var ygyro = data_.getFloat32(36, Endian.little);
  var zgyro = data_.getFloat32(40, Endian.little);

  return AvssDroneImu(
      timeBootMs: timeBootMs,
      q1: q1,
      q2: q2,
      q3: q3,
      q4: q4,
      xacc: xacc,
      yacc: yacc,
      zacc: zacc,
      xgyro: xgyro,
      ygyro: ygyro,
      zgyro: zgyro);
}