RawImu.parse constructor
RawImu.parse(
- ByteData data_
Implementation
factory RawImu.parse(ByteData data_) {
if (data_.lengthInBytes < RawImu.mavlinkEncodedLength) {
var len = RawImu.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_.getInt16(8, Endian.little);
var yacc = data_.getInt16(10, Endian.little);
var zacc = data_.getInt16(12, Endian.little);
var xgyro = data_.getInt16(14, Endian.little);
var ygyro = data_.getInt16(16, Endian.little);
var zgyro = data_.getInt16(18, Endian.little);
var xmag = data_.getInt16(20, Endian.little);
var ymag = data_.getInt16(22, Endian.little);
var zmag = data_.getInt16(24, Endian.little);
var id = data_.getUint8(26);
var temperature = data_.getInt16(27, Endian.little);
return RawImu(
timeUsec: timeUsec,
xacc: xacc,
yacc: yacc,
zacc: zacc,
xgyro: xgyro,
ygyro: ygyro,
zgyro: zgyro,
xmag: xmag,
ymag: ymag,
zmag: zmag,
id: id,
temperature: temperature);
}