ManualSetpoint.parse constructor

ManualSetpoint.parse(
  1. ByteData data_
)

Implementation

factory ManualSetpoint.parse(ByteData data_) {
  if (data_.lengthInBytes < ManualSetpoint.mavlinkEncodedLength) {
    var len = ManualSetpoint.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 roll = data_.getFloat32(4, Endian.little);
  var pitch = data_.getFloat32(8, Endian.little);
  var yaw = data_.getFloat32(12, Endian.little);
  var thrust = data_.getFloat32(16, Endian.little);
  var modeSwitch = data_.getUint8(20);
  var manualOverrideSwitch = data_.getUint8(21);

  return ManualSetpoint(
      timeBootMs: timeBootMs,
      roll: roll,
      pitch: pitch,
      yaw: yaw,
      thrust: thrust,
      modeSwitch: modeSwitch,
      manualOverrideSwitch: manualOverrideSwitch);
}