AttitudeTarget.parse constructor

AttitudeTarget.parse(
  1. ByteData data_
)

Implementation

factory AttitudeTarget.parse(ByteData data_) {
  if (data_.lengthInBytes < AttitudeTarget.mavlinkEncodedLength) {
    var len = AttitudeTarget.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var timeBootMs = data_.getUint32(0, Endian.little);
  var q = MavlinkMessage.asFloat32List(data_, 4, 4);
  var bodyRollRate = data_.getFloat32(20, Endian.little);
  var bodyPitchRate = data_.getFloat32(24, Endian.little);
  var bodyYawRate = data_.getFloat32(28, Endian.little);
  var thrust = data_.getFloat32(32, Endian.little);
  var typeMask = data_.getUint8(36);

  return AttitudeTarget(
      timeBootMs: timeBootMs,
      q: q,
      bodyRollRate: bodyRollRate,
      bodyPitchRate: bodyPitchRate,
      bodyYawRate: bodyYawRate,
      thrust: thrust,
      typeMask: typeMask);
}