HilStateQuaternion.parse constructor

HilStateQuaternion.parse(
  1. ByteData data_
)

Implementation

factory HilStateQuaternion.parse(ByteData data_) {
  if (data_.lengthInBytes < HilStateQuaternion.mavlinkEncodedLength) {
    var len = HilStateQuaternion.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 attitudeQuaternion = MavlinkMessage.asFloat32List(data_, 8, 4);
  var rollspeed = data_.getFloat32(24, Endian.little);
  var pitchspeed = data_.getFloat32(28, Endian.little);
  var yawspeed = data_.getFloat32(32, Endian.little);
  var lat = data_.getInt32(36, Endian.little);
  var lon = data_.getInt32(40, Endian.little);
  var alt = data_.getInt32(44, Endian.little);
  var vx = data_.getInt16(48, Endian.little);
  var vy = data_.getInt16(50, Endian.little);
  var vz = data_.getInt16(52, Endian.little);
  var indAirspeed = data_.getUint16(54, Endian.little);
  var trueAirspeed = data_.getUint16(56, Endian.little);
  var xacc = data_.getInt16(58, Endian.little);
  var yacc = data_.getInt16(60, Endian.little);
  var zacc = data_.getInt16(62, Endian.little);

  return HilStateQuaternion(
      timeUsec: timeUsec,
      attitudeQuaternion: attitudeQuaternion,
      rollspeed: rollspeed,
      pitchspeed: pitchspeed,
      yawspeed: yawspeed,
      lat: lat,
      lon: lon,
      alt: alt,
      vx: vx,
      vy: vy,
      vz: vz,
      indAirspeed: indAirspeed,
      trueAirspeed: trueAirspeed,
      xacc: xacc,
      yacc: yacc,
      zacc: zacc);
}