ViconPositionEstimate.parse constructor

ViconPositionEstimate.parse(
  1. ByteData data_
)

Implementation

factory ViconPositionEstimate.parse(ByteData data_) {
  if (data_.lengthInBytes < ViconPositionEstimate.mavlinkEncodedLength) {
    var len =
        ViconPositionEstimate.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var usec = data_.getUint64(0, Endian.little);
  var x = data_.getFloat32(8, Endian.little);
  var y = data_.getFloat32(12, Endian.little);
  var z = data_.getFloat32(16, Endian.little);
  var roll = data_.getFloat32(20, Endian.little);
  var pitch = data_.getFloat32(24, Endian.little);
  var yaw = data_.getFloat32(28, Endian.little);
  var covariance = MavlinkMessage.asFloat32List(data_, 32, 21);

  return ViconPositionEstimate(
      usec: usec,
      x: x,
      y: y,
      z: z,
      roll: roll,
      pitch: pitch,
      yaw: yaw,
      covariance: covariance);
}