TrajectoryRepresentationWaypoints.parse constructor

TrajectoryRepresentationWaypoints.parse(
  1. ByteData data_
)

Implementation

factory TrajectoryRepresentationWaypoints.parse(ByteData data_) {
  if (data_.lengthInBytes <
      TrajectoryRepresentationWaypoints.mavlinkEncodedLength) {
    var len = TrajectoryRepresentationWaypoints.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 velX = MavlinkMessage.asFloat32List(data_, 68, 5);
  var velY = MavlinkMessage.asFloat32List(data_, 88, 5);
  var velZ = MavlinkMessage.asFloat32List(data_, 108, 5);
  var accX = MavlinkMessage.asFloat32List(data_, 128, 5);
  var accY = MavlinkMessage.asFloat32List(data_, 148, 5);
  var accZ = MavlinkMessage.asFloat32List(data_, 168, 5);
  var posYaw = MavlinkMessage.asFloat32List(data_, 188, 5);
  var velYaw = MavlinkMessage.asFloat32List(data_, 208, 5);
  var command = MavlinkMessage.asUint16List(data_, 228, 5);
  var validPoints = data_.getUint8(238);

  return TrajectoryRepresentationWaypoints(
      timeUsec: timeUsec,
      posX: posX,
      posY: posY,
      posZ: posZ,
      velX: velX,
      velY: velY,
      velZ: velZ,
      accX: accX,
      accY: accY,
      accZ: accZ,
      posYaw: posYaw,
      velYaw: velYaw,
      command: command,
      validPoints: validPoints);
}