TrajectoryRepresentationBezier.parse constructor

TrajectoryRepresentationBezier.parse(
  1. ByteData data_
)

Implementation

factory TrajectoryRepresentationBezier.parse(ByteData data_) {
  if (data_.lengthInBytes <
      TrajectoryRepresentationBezier.mavlinkEncodedLength) {
    var len = TrajectoryRepresentationBezier.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 posX = MavlinkMessage.asFloat32List(data_, 8, 5);
  var posY = MavlinkMessage.asFloat32List(data_, 28, 5);
  var posZ = MavlinkMessage.asFloat32List(data_, 48, 5);
  var delta = MavlinkMessage.asFloat32List(data_, 68, 5);
  var posYaw = MavlinkMessage.asFloat32List(data_, 88, 5);
  var validPoints = data_.getUint8(108);

  return TrajectoryRepresentationBezier(
      timeUsec: timeUsec,
      posX: posX,
      posY: posY,
      posZ: posZ,
      delta: delta,
      posYaw: posYaw,
      validPoints: validPoints);
}