ControlSystemState.parse constructor

ControlSystemState.parse(
  1. ByteData data_
)

Implementation

factory ControlSystemState.parse(ByteData data_) {
  if (data_.lengthInBytes < ControlSystemState.mavlinkEncodedLength) {
    var len = ControlSystemState.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 xAcc = data_.getFloat32(8, Endian.little);
  var yAcc = data_.getFloat32(12, Endian.little);
  var zAcc = data_.getFloat32(16, Endian.little);
  var xVel = data_.getFloat32(20, Endian.little);
  var yVel = data_.getFloat32(24, Endian.little);
  var zVel = data_.getFloat32(28, Endian.little);
  var xPos = data_.getFloat32(32, Endian.little);
  var yPos = data_.getFloat32(36, Endian.little);
  var zPos = data_.getFloat32(40, Endian.little);
  var airspeed = data_.getFloat32(44, Endian.little);
  var velVariance = MavlinkMessage.asFloat32List(data_, 48, 3);
  var posVariance = MavlinkMessage.asFloat32List(data_, 60, 3);
  var q = MavlinkMessage.asFloat32List(data_, 72, 4);
  var rollRate = data_.getFloat32(88, Endian.little);
  var pitchRate = data_.getFloat32(92, Endian.little);
  var yawRate = data_.getFloat32(96, Endian.little);

  return ControlSystemState(
      timeUsec: timeUsec,
      xAcc: xAcc,
      yAcc: yAcc,
      zAcc: zAcc,
      xVel: xVel,
      yVel: yVel,
      zVel: zVel,
      xPos: xPos,
      yPos: yPos,
      zPos: zPos,
      airspeed: airspeed,
      velVariance: velVariance,
      posVariance: posVariance,
      q: q,
      rollRate: rollRate,
      pitchRate: pitchRate,
      yawRate: yawRate);
}