// Pack returns a packed byte array which represents a HighresImu payload
359884
func (m *HighresImu) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.TIME_USEC)
	binary.Write(data, binary.LittleEndian, m.XACC)
	binary.Write(data, binary.LittleEndian, m.YACC)
	binary.Write(data, binary.LittleEndian, m.ZACC)
	binary.Write(data, binary.LittleEndian, m.XGYRO)
	binary.Write(data, binary.LittleEndian, m.YGYRO)
	binary.Write(data, binary.LittleEndian, m.ZGYRO)
	binary.Write(data, binary.LittleEndian, m.XMAG)
	binary.Write(data, binary.LittleEndian, m.YMAG)
	binary.Write(data, binary.LittleEndian, m.ZMAG)
	binary.Write(data, binary.LittleEndian, m.ABS_PRESSURE)
	binary.Write(data, binary.LittleEndian, m.DIFF_PRESSURE)
	binary.Write(data, binary.LittleEndian, m.PRESSURE_ALT)
	binary.Write(data, binary.LittleEndian, m.TEMPERATURE)
	binary.Write(data, binary.LittleEndian, m.FIELDS_UPDATED)
	return data.Bytes()
}
836655
func (m *ServoOutputRaw) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.TIME_USEC)
	binary.Write(data, binary.LittleEndian, m.SERVO1_RAW)
	binary.Write(data, binary.LittleEndian, m.SERVO2_RAW)
	binary.Write(data, binary.LittleEndian, m.SERVO3_RAW)
	binary.Write(data, binary.LittleEndian, m.SERVO4_RAW)
	binary.Write(data, binary.LittleEndian, m.SERVO5_RAW)
	binary.Write(data, binary.LittleEndian, m.SERVO6_RAW)
	binary.Write(data, binary.LittleEndian, m.SERVO7_RAW)
	binary.Write(data, binary.LittleEndian, m.SERVO8_RAW)
	binary.Write(data, binary.LittleEndian, m.PORT)
	return data.Bytes()
}
853787
func (m *AuthKey) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.KEY)
	return data.Bytes()
}
419809
func (m *ManualSetpoint) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS)
	binary.Write(data, binary.LittleEndian, m.ROLL)
	binary.Write(data, binary.LittleEndian, m.PITCH)
	binary.Write(data, binary.LittleEndian, m.YAW)
	binary.Write(data, binary.LittleEndian, m.THRUST)
	binary.Write(data, binary.LittleEndian, m.MODE_SWITCH)
	binary.Write(data, binary.LittleEndian, m.MANUAL_OVERRIDE_SWITCH)
	return data.Bytes()
}
1096979
func (m *PowerStatus) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.VCC)
	binary.Write(data, binary.LittleEndian, m.VSERVO)
	binary.Write(data, binary.LittleEndian, m.FLAGS)
	return data.Bytes()
}
590542
func (m *SimState) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.Q1)
	binary.Write(data, binary.LittleEndian, m.Q2)
	binary.Write(data, binary.LittleEndian, m.Q3)
	binary.Write(data, binary.LittleEndian, m.Q4)
	binary.Write(data, binary.LittleEndian, m.ROLL)
	binary.Write(data, binary.LittleEndian, m.PITCH)
	binary.Write(data, binary.LittleEndian, m.YAW)
	binary.Write(data, binary.LittleEndian, m.XACC)
	binary.Write(data, binary.LittleEndian, m.YACC)
	binary.Write(data, binary.LittleEndian, m.ZACC)
	binary.Write(data, binary.LittleEndian, m.XGYRO)
	binary.Write(data, binary.LittleEndian, m.YGYRO)
	binary.Write(data, binary.LittleEndian, m.ZGYRO)
	binary.Write(data, binary.LittleEndian, m.LAT)
	binary.Write(data, binary.LittleEndian, m.LON)
	binary.Write(data, binary.LittleEndian, m.ALT)
	binary.Write(data, binary.LittleEndian, m.STD_DEV_HORZ)
	binary.Write(data, binary.LittleEndian, m.STD_DEV_VERT)
	binary.Write(data, binary.LittleEndian, m.VN)
	binary.Write(data, binary.LittleEndian, m.VE)
	binary.Write(data, binary.LittleEndian, m.VD)
	return data.Bytes()
}
463030
func (m *LogRequestData) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.OFS)
	binary.Write(data, binary.LittleEndian, m.COUNT)
	binary.Write(data, binary.LittleEndian, m.ID)
	binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM)
	binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT)
	return data.Bytes()
}
988445
func (m *TerrainRequest) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.MASK)
	binary.Write(data, binary.LittleEndian, m.LAT)
	binary.Write(data, binary.LittleEndian, m.LON)
	binary.Write(data, binary.LittleEndian, m.GRID_SPACING)
	return data.Bytes()
}
375197
func (m *NavControllerOutput) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.NAV_ROLL)
	binary.Write(data, binary.LittleEndian, m.NAV_PITCH)
	binary.Write(data, binary.LittleEndian, m.ALT_ERROR)
	binary.Write(data, binary.LittleEndian, m.ASPD_ERROR)
	binary.Write(data, binary.LittleEndian, m.XTRACK_ERROR)
	binary.Write(data, binary.LittleEndian, m.NAV_BEARING)
	binary.Write(data, binary.LittleEndian, m.TARGET_BEARING)
	binary.Write(data, binary.LittleEndian, m.WP_DIST)
	return data.Bytes()
}
1340299
func pack(out *[32]byte, x *[5]uint64) {
	t := *x
	freeze(&t)

	out[0] = byte(t[0])
	out[1] = byte(t[0] >> 8)
	out[2] = byte(t[0] >> 16)
	out[3] = byte(t[0] >> 24)
	out[4] = byte(t[0] >> 32)
	out[5] = byte(t[0] >> 40)
	out[6] = byte(t[0] >> 48)

	out[6] ^= byte(t[1]<<3) & 0xf8
	out[7] = byte(t[1] >> 5)
	out[8] = byte(t[1] >> 13)
	out[9] = byte(t[1] >> 21)
	out[10] = byte(t[1] >> 29)
	out[11] = byte(t[1] >> 37)
	out[12] = byte(t[1] >> 45)

	out[12] ^= byte(t[2]<<6) & 0xc0
	out[13] = byte(t[2] >> 2)
	out[14] = byte(t[2] >> 10)
	out[15] = byte(t[2] >> 18)
	out[16] = byte(t[2] >> 26)
	out[17] = byte(t[2] >> 34)
	out[18] = byte(t[2] >> 42)
	out[19] = byte(t[2] >> 50)

	out[19] ^= byte(t[3]<<1) & 0xfe
	out[20] = byte(t[3] >> 7)
	out[21] = byte(t[3] >> 15)
	out[22] = byte(t[3] >> 23)
	out[23] = byte(t[3] >> 31)
	out[24] = byte(t[3] >> 39)
	out[25] = byte(t[3] >> 47)

	out[25] ^= byte(t[4]<<4) & 0xf0
	out[26] = byte(t[4] >> 4)
	out[27] = byte(t[4] >> 12)
	out[28] = byte(t[4] >> 20)
	out[29] = byte(t[4] >> 28)
	out[30] = byte(t[4] >> 36)
	out[31] = byte(t[4] >> 44)
}
674173
func (m *HilRcInputsRaw) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.TIME_USEC)
	binary.Write(data, binary.LittleEndian, m.CHAN1_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN2_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN3_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN4_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN5_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN6_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN7_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN8_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN9_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN10_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN11_RAW)
	binary.Write(data, binary.LittleEndian, m.CHAN12_RAW)
	binary.Write(data, binary.LittleEndian, m.RSSI)
	return data.Bytes()
}
208572
func (arguments Arguments) Pack(args ...interface{}) ([]byte, error) {
	// Make sure arguments match up and pack them
	abiArgs := arguments
	if len(args) != len(abiArgs) {
		return nil, fmt.Errorf("argument count mismatch: %d for %d", len(args), len(abiArgs))
	}
	// variable input is the output appended at the end of packed
	// output. This is used for strings and bytes types input.
	var variableInput []byte

	// input offset is the bytes offset for packed output
	inputOffset := 0
	for _, abiArg := range abiArgs {
		inputOffset += getTypeSize(abiArg.Type)
	}
	var ret []byte
	for i, a := range args {
		input := abiArgs[i]
		// pack the input
		packed, err := input.Type.pack(reflect.ValueOf(a))
		if err != nil {
			return nil, err
		}
		// check for dynamic types
		if isDynamicType(input.Type) {
			// set the offset
			ret = append(ret, packNum(reflect.ValueOf(inputOffset))...)
			// calculate next offset
			inputOffset += len(packed)
			// append to variable input
			variableInput = append(variableInput, packed...)
		} else {
			// append the packed value to the input
			ret = append(ret, packed...)
		}
	}
	// append the variable input at the end of the packed input
	ret = append(ret, variableInput...)

	return ret, nil
}
730476
func PackBytes(cmd BufferEx, b []byte) (int, error) {
	return packBytes(cmd, b)
}
374244
func (m *Attitude) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS)
	binary.Write(data, binary.LittleEndian, m.ROLL)
	binary.Write(data, binary.LittleEndian, m.PITCH)
	binary.Write(data, binary.LittleEndian, m.YAW)
	binary.Write(data, binary.LittleEndian, m.ROLLSPEED)
	binary.Write(data, binary.LittleEndian, m.PITCHSPEED)
	binary.Write(data, binary.LittleEndian, m.YAWSPEED)
	return data.Bytes()
}
181348
func (m *LocalNedPositionSetpointExternal) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS)
	binary.Write(data, binary.LittleEndian, m.X)
	binary.Write(data, binary.LittleEndian, m.Y)
	binary.Write(data, binary.LittleEndian, m.Z)
	binary.Write(data, binary.LittleEndian, m.VX)
	binary.Write(data, binary.LittleEndian, m.VY)
	binary.Write(data, binary.LittleEndian, m.VZ)
	binary.Write(data, binary.LittleEndian, m.AFX)
	binary.Write(data, binary.LittleEndian, m.AFY)
	binary.Write(data, binary.LittleEndian, m.AFZ)
	binary.Write(data, binary.LittleEndian, m.TYPE_MASK)
	binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM)
	binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT)
	binary.Write(data, binary.LittleEndian, m.COORDINATE_FRAME)
	return data.Bytes()
}
467927
func (m *TerrainReport) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.LAT)
	binary.Write(data, binary.LittleEndian, m.LON)
	binary.Write(data, binary.LittleEndian, m.TERRAIN_HEIGHT)
	binary.Write(data, binary.LittleEndian, m.CURRENT_HEIGHT)
	binary.Write(data, binary.LittleEndian, m.SPACING)
	binary.Write(data, binary.LittleEndian, m.PENDING)
	binary.Write(data, binary.LittleEndian, m.LOADED)
	return data.Bytes()
}
794750
func (m *LocalPositionSetpoint) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.X)
	binary.Write(data, binary.LittleEndian, m.Y)
	binary.Write(data, binary.LittleEndian, m.Z)
	binary.Write(data, binary.LittleEndian, m.YAW)
	binary.Write(data, binary.LittleEndian, m.COORDINATE_FRAME)
	return data.Bytes()
}