VisionPositionDelta.parse constructor

VisionPositionDelta.parse(
  1. ByteData data_
)

Implementation

factory VisionPositionDelta.parse(ByteData data_) {
  if (data_.lengthInBytes < VisionPositionDelta.mavlinkEncodedLength) {
    var len = VisionPositionDelta.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 timeDeltaUsec = data_.getUint64(8, Endian.little);
  var angleDelta = MavlinkMessage.asFloat32List(data_, 16, 3);
  var positionDelta = MavlinkMessage.asFloat32List(data_, 28, 3);
  var confidence = data_.getFloat32(40, Endian.little);

  return VisionPositionDelta(
      timeUsec: timeUsec,
      timeDeltaUsec: timeDeltaUsec,
      angleDelta: angleDelta,
      positionDelta: positionDelta,
      confidence: confidence);
}