HilState.parse constructor

HilState.parse(
  1. ByteData data_
)

Implementation

factory HilState.parse(ByteData data_) {
  if (data_.lengthInBytes < HilState.mavlinkEncodedLength) {
    var len = HilState.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 roll = data_.getFloat32(8, Endian.little);
  var pitch = data_.getFloat32(12, Endian.little);
  var yaw = data_.getFloat32(16, Endian.little);
  var rollspeed = data_.getFloat32(20, Endian.little);
  var pitchspeed = data_.getFloat32(24, Endian.little);
  var yawspeed = data_.getFloat32(28, Endian.little);
  var lat = data_.getInt32(32, Endian.little);
  var lon = data_.getInt32(36, Endian.little);
  var alt = data_.getInt32(40, Endian.little);
  var vx = data_.getInt16(44, Endian.little);
  var vy = data_.getInt16(46, Endian.little);
  var vz = data_.getInt16(48, Endian.little);
  var xacc = data_.getInt16(50, Endian.little);
  var yacc = data_.getInt16(52, Endian.little);
  var zacc = data_.getInt16(54, Endian.little);

  return HilState(
      timeUsec: timeUsec,
      roll: roll,
      pitch: pitch,
      yaw: yaw,
      rollspeed: rollspeed,
      pitchspeed: pitchspeed,
      yawspeed: yawspeed,
      lat: lat,
      lon: lon,
      alt: alt,
      vx: vx,
      vy: vy,
      vz: vz,
      xacc: xacc,
      yacc: yacc,
      zacc: zacc);
}