SetAttitudeTarget.parse constructor

SetAttitudeTarget.parse(
  1. ByteData data_
)

Implementation

factory SetAttitudeTarget.parse(ByteData data_) {
  if (data_.lengthInBytes < SetAttitudeTarget.mavlinkEncodedLength) {
    var len = SetAttitudeTarget.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 targetSystem = data_.getUint8(36);
  var targetComponent = data_.getUint8(37);
  var typeMask = data_.getUint8(38);
  var thrustBody = MavlinkMessage.asFloat32List(data_, 39, 3);

  return SetAttitudeTarget(
      timeBootMs: timeBootMs,
      q: q,
      bodyRollRate: bodyRollRate,
      bodyPitchRate: bodyPitchRate,
      bodyYawRate: bodyYawRate,
      thrust: thrust,
      targetSystem: targetSystem,
      targetComponent: targetComponent,
      typeMask: typeMask,
      thrustBody: thrustBody);
}