Odometry.parse constructor

Odometry.parse(
  1. ByteData data_
)

Implementation

factory Odometry.parse(ByteData data_) {
  if (data_.lengthInBytes < Odometry.mavlinkEncodedLength) {
    var len = Odometry.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 x = data_.getFloat32(8, Endian.little);
  var y = data_.getFloat32(12, Endian.little);
  var z = data_.getFloat32(16, Endian.little);
  var q = MavlinkMessage.asFloat32List(data_, 20, 4);
  var vx = data_.getFloat32(36, Endian.little);
  var vy = data_.getFloat32(40, Endian.little);
  var vz = data_.getFloat32(44, Endian.little);
  var rollspeed = data_.getFloat32(48, Endian.little);
  var pitchspeed = data_.getFloat32(52, Endian.little);
  var yawspeed = data_.getFloat32(56, Endian.little);
  var poseCovariance = MavlinkMessage.asFloat32List(data_, 60, 21);
  var velocityCovariance = MavlinkMessage.asFloat32List(data_, 144, 21);
  var frameId = data_.getUint8(228);
  var childFrameId = data_.getUint8(229);
  var resetCounter = data_.getUint8(230);
  var estimatorType = data_.getUint8(231);
  var quality = data_.getInt8(232);

  return Odometry(
      timeUsec: timeUsec,
      x: x,
      y: y,
      z: z,
      q: q,
      vx: vx,
      vy: vy,
      vz: vz,
      rollspeed: rollspeed,
      pitchspeed: pitchspeed,
      yawspeed: yawspeed,
      poseCovariance: poseCovariance,
      velocityCovariance: velocityCovariance,
      frameId: frameId,
      childFrameId: childFrameId,
      resetCounter: resetCounter,
      estimatorType: estimatorType,
      quality: quality);
}