// Pack returns a packed byte array which represents a GlobalPositionSetpointExternalInt payload
434672
func (m *GlobalPositionSetpointExternalInt) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS)
	binary.Write(data, binary.LittleEndian, m.LAT_INT)
	binary.Write(data, binary.LittleEndian, m.LON_INT)
	binary.Write(data, binary.LittleEndian, m.ALT)
	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)
	return data.Bytes()
}
687547
func (m *DataStream) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.MESSAGE_RATE)
	binary.Write(data, binary.LittleEndian, m.STREAM_ID)
	binary.Write(data, binary.LittleEndian, m.ON_OFF)
	return data.Bytes()
}
44757
func Pack(w io.Writer, buf []byte) error {
	if len(buf) > messageMax {
		return errors.New("message is too large")
	}

	var bl [2]byte
	binary.LittleEndian.PutUint16(bl[:], uint16(len(buf)))
	_, err := w.Write(bl[:])
	if err != nil {
		return err
	}

	_, err = w.Write(buf)
	return err
}
1272584
func (m *Setpoint8Dof) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.VAL1)
	binary.Write(data, binary.LittleEndian, m.VAL2)
	binary.Write(data, binary.LittleEndian, m.VAL3)
	binary.Write(data, binary.LittleEndian, m.VAL4)
	binary.Write(data, binary.LittleEndian, m.VAL5)
	binary.Write(data, binary.LittleEndian, m.VAL6)
	binary.Write(data, binary.LittleEndian, m.VAL7)
	binary.Write(data, binary.LittleEndian, m.VAL8)
	binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM)
	return data.Bytes()
}
53858
func (m *ManualControl) 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.R)
	binary.Write(data, binary.LittleEndian, m.BUTTONS)
	binary.Write(data, binary.LittleEndian, m.TARGET)
	return data.Bytes()
}
1254564
func (m *HilControls) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.TIME_USEC)
	binary.Write(data, binary.LittleEndian, m.ROLL_AILERONS)
	binary.Write(data, binary.LittleEndian, m.PITCH_ELEVATOR)
	binary.Write(data, binary.LittleEndian, m.YAW_RUDDER)
	binary.Write(data, binary.LittleEndian, m.THROTTLE)
	binary.Write(data, binary.LittleEndian, m.AUX1)
	binary.Write(data, binary.LittleEndian, m.AUX2)
	binary.Write(data, binary.LittleEndian, m.AUX3)
	binary.Write(data, binary.LittleEndian, m.AUX4)
	binary.Write(data, binary.LittleEndian, m.MODE)
	binary.Write(data, binary.LittleEndian, m.NAV_MODE)
	return data.Bytes()
}
1138317
func (m *MemoryVect) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.ADDRESS)
	binary.Write(data, binary.LittleEndian, m.VER)
	binary.Write(data, binary.LittleEndian, m.TYPE)
	binary.Write(data, binary.LittleEndian, m.VALUE)
	return data.Bytes()
}
1331906
func (m *ChangeOperatorControl) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM)
	binary.Write(data, binary.LittleEndian, m.CONTROL_REQUEST)
	binary.Write(data, binary.LittleEndian, m.VERSION)
	binary.Write(data, binary.LittleEndian, m.PASSKEY)
	return data.Bytes()
}
193965
func (m *SetQuadSwarmRollPitchYawThrust) Pack() []byte {
	data := new(bytes.Buffer)
	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.GROUP)
	binary.Write(data, binary.LittleEndian, m.MODE)
	return data.Bytes()
}
329706
func (m *SetGpsGlobalOrigin) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.LATITUDE)
	binary.Write(data, binary.LittleEndian, m.LONGITUDE)
	binary.Write(data, binary.LittleEndian, m.ALTITUDE)
	binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM)
	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)
}
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()
}
336753
func (m *RawPressure) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.TIME_USEC)
	binary.Write(data, binary.LittleEndian, m.PRESS_ABS)
	binary.Write(data, binary.LittleEndian, m.PRESS_DIFF1)
	binary.Write(data, binary.LittleEndian, m.PRESS_DIFF2)
	binary.Write(data, binary.LittleEndian, m.TEMPERATURE)
	return data.Bytes()
}
1278382
func (m *RequestDataStream) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.REQ_MESSAGE_RATE)
	binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM)
	binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT)
	binary.Write(data, binary.LittleEndian, m.REQ_STREAM_ID)
	binary.Write(data, binary.LittleEndian, m.START_STOP)
	return data.Bytes()
}
1064599
func (cs *StreamManager) Pack(payload []byte) string {
	return cs.Stream.Pack(payload)
}
770223
func (m *ParamValue) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.PARAM_VALUE)
	binary.Write(data, binary.LittleEndian, m.PARAM_COUNT)
	binary.Write(data, binary.LittleEndian, m.PARAM_INDEX)
	binary.Write(data, binary.LittleEndian, m.PARAM_ID)
	binary.Write(data, binary.LittleEndian, m.PARAM_TYPE)
	return data.Bytes()
}
823130
func (cs *ChaChaStream) Pack(payload []byte) string {
	data := make([]byte, len(payload))

	cs.cipher.XORKeyStream(data, payload)
	str := base64.StdEncoding.EncodeToString(data)
	return str
}