TargetAbsolute.parse constructor

TargetAbsolute.parse(
  1. ByteData data_
)

Implementation

factory TargetAbsolute.parse(ByteData data_) {
  if (data_.lengthInBytes < TargetAbsolute.mavlinkEncodedLength) {
    var len = TargetAbsolute.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var timestamp = data_.getUint64(0, Endian.little);
  var lat = data_.getInt32(8, Endian.little);
  var lon = data_.getInt32(12, Endian.little);
  var alt = data_.getFloat32(16, Endian.little);
  var vel = MavlinkMessage.asFloat32List(data_, 20, 3);
  var acc = MavlinkMessage.asFloat32List(data_, 32, 3);
  var qTarget = MavlinkMessage.asFloat32List(data_, 44, 4);
  var rates = MavlinkMessage.asFloat32List(data_, 60, 3);
  var positionStd = MavlinkMessage.asFloat32List(data_, 72, 2);
  var velStd = MavlinkMessage.asFloat32List(data_, 80, 3);
  var accStd = MavlinkMessage.asFloat32List(data_, 92, 3);
  var id = data_.getUint8(104);
  var sensorCapabilities = data_.getUint8(105);

  return TargetAbsolute(
      timestamp: timestamp,
      lat: lat,
      lon: lon,
      alt: alt,
      vel: vel,
      acc: acc,
      qTarget: qTarget,
      rates: rates,
      positionStd: positionStd,
      velStd: velStd,
      accStd: accStd,
      id: id,
      sensorCapabilities: sensorCapabilities);
}