FollowTarget.parse constructor

FollowTarget.parse(
  1. ByteData data_
)

Implementation

factory FollowTarget.parse(ByteData data_) {
  if (data_.lengthInBytes < FollowTarget.mavlinkEncodedLength) {
    var len = FollowTarget.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 customState = data_.getUint64(8, Endian.little);
  var lat = data_.getInt32(16, Endian.little);
  var lon = data_.getInt32(20, Endian.little);
  var alt = data_.getFloat32(24, Endian.little);
  var vel = MavlinkMessage.asFloat32List(data_, 28, 3);
  var acc = MavlinkMessage.asFloat32List(data_, 40, 3);
  var attitudeQ = MavlinkMessage.asFloat32List(data_, 52, 4);
  var rates = MavlinkMessage.asFloat32List(data_, 68, 3);
  var positionCov = MavlinkMessage.asFloat32List(data_, 80, 3);
  var estCapabilities = data_.getUint8(92);

  return FollowTarget(
      timestamp: timestamp,
      customState: customState,
      lat: lat,
      lon: lon,
      alt: alt,
      vel: vel,
      acc: acc,
      attitudeQ: attitudeQ,
      rates: rates,
      positionCov: positionCov,
      estCapabilities: estCapabilities);
}