SimState.parse constructor

SimState.parse(
  1. ByteData data_
)

Implementation

factory SimState.parse(ByteData data_) {
  if (data_.lengthInBytes < SimState.mavlinkEncodedLength) {
    var len = SimState.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var q1 = data_.getFloat32(0, Endian.little);
  var q2 = data_.getFloat32(4, Endian.little);
  var q3 = data_.getFloat32(8, Endian.little);
  var q4 = data_.getFloat32(12, Endian.little);
  var roll = data_.getFloat32(16, Endian.little);
  var pitch = data_.getFloat32(20, Endian.little);
  var yaw = data_.getFloat32(24, Endian.little);
  var xacc = data_.getFloat32(28, Endian.little);
  var yacc = data_.getFloat32(32, Endian.little);
  var zacc = data_.getFloat32(36, Endian.little);
  var xgyro = data_.getFloat32(40, Endian.little);
  var ygyro = data_.getFloat32(44, Endian.little);
  var zgyro = data_.getFloat32(48, Endian.little);
  var lat = data_.getFloat32(52, Endian.little);
  var lon = data_.getFloat32(56, Endian.little);
  var alt = data_.getFloat32(60, Endian.little);
  var stdDevHorz = data_.getFloat32(64, Endian.little);
  var stdDevVert = data_.getFloat32(68, Endian.little);
  var vn = data_.getFloat32(72, Endian.little);
  var ve = data_.getFloat32(76, Endian.little);
  var vd = data_.getFloat32(80, Endian.little);
  var latInt = data_.getInt32(84, Endian.little);
  var lonInt = data_.getInt32(88, Endian.little);

  return SimState(
      q1: q1,
      q2: q2,
      q3: q3,
      q4: q4,
      roll: roll,
      pitch: pitch,
      yaw: yaw,
      xacc: xacc,
      yacc: yacc,
      zacc: zacc,
      xgyro: xgyro,
      ygyro: ygyro,
      zgyro: zgyro,
      lat: lat,
      lon: lon,
      alt: alt,
      stdDevHorz: stdDevHorz,
      stdDevVert: stdDevVert,
      vn: vn,
      ve: ve,
      vd: vd,
      latInt: latInt,
      lonInt: lonInt);
}