AttPosMocap.parse constructor

AttPosMocap.parse(
  1. ByteData data_
)

Implementation

factory AttPosMocap.parse(ByteData data_) {
  if (data_.lengthInBytes < AttPosMocap.mavlinkEncodedLength) {
    var len = AttPosMocap.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 q = MavlinkMessage.asFloat32List(data_, 8, 4);
  var x = data_.getFloat32(24, Endian.little);
  var y = data_.getFloat32(28, Endian.little);
  var z = data_.getFloat32(32, Endian.little);
  var covariance = MavlinkMessage.asFloat32List(data_, 36, 21);

  return AttPosMocap(
      timeUsec: timeUsec, q: q, x: x, y: y, z: z, covariance: covariance);
}