384 lines
15 KiB
C
384 lines
15 KiB
C
|
|
#pragma once
|
||
|
|
// MESSAGE SERVOS PACKING
|
||
|
|
|
||
|
|
#define MAVLINK_MSG_ID_SERVOS 20106
|
||
|
|
|
||
|
|
|
||
|
|
typedef struct __mavlink_servos_t {
|
||
|
|
uint32_t time_boot_ms; /*< [ms] Timestamp (milliseconds since system boot)*/
|
||
|
|
float cmd1[2]; /*< ActuatorCmd1(deg)*/
|
||
|
|
float cmd2[2]; /*< ActuatorCmd2(deg)*/
|
||
|
|
float pos1[2]; /*< ActuatorPos1(deg)*/
|
||
|
|
float pos2[2]; /*< ActuatorPos2(deg)*/
|
||
|
|
uint8_t out_seq; /*< output index*/
|
||
|
|
uint8_t in1_seq; /*< input1 index*/
|
||
|
|
uint8_t in2_seq; /*< input2 index*/
|
||
|
|
} mavlink_servos_t;
|
||
|
|
|
||
|
|
#define MAVLINK_MSG_ID_SERVOS_LEN 39
|
||
|
|
#define MAVLINK_MSG_ID_SERVOS_MIN_LEN 39
|
||
|
|
#define MAVLINK_MSG_ID_20106_LEN 39
|
||
|
|
#define MAVLINK_MSG_ID_20106_MIN_LEN 39
|
||
|
|
|
||
|
|
#define MAVLINK_MSG_ID_SERVOS_CRC 92
|
||
|
|
#define MAVLINK_MSG_ID_20106_CRC 92
|
||
|
|
|
||
|
|
#define MAVLINK_MSG_SERVOS_FIELD_CMD1_LEN 2
|
||
|
|
#define MAVLINK_MSG_SERVOS_FIELD_CMD2_LEN 2
|
||
|
|
#define MAVLINK_MSG_SERVOS_FIELD_POS1_LEN 2
|
||
|
|
#define MAVLINK_MSG_SERVOS_FIELD_POS2_LEN 2
|
||
|
|
|
||
|
|
#if MAVLINK_COMMAND_24BIT
|
||
|
|
#define MAVLINK_MESSAGE_INFO_SERVOS { \
|
||
|
|
20106, \
|
||
|
|
"SERVOS", \
|
||
|
|
8, \
|
||
|
|
{ { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_servos_t, time_boot_ms) }, \
|
||
|
|
{ "cmd1", NULL, MAVLINK_TYPE_FLOAT, 2, 4, offsetof(mavlink_servos_t, cmd1) }, \
|
||
|
|
{ "cmd2", NULL, MAVLINK_TYPE_FLOAT, 2, 12, offsetof(mavlink_servos_t, cmd2) }, \
|
||
|
|
{ "pos1", NULL, MAVLINK_TYPE_FLOAT, 2, 20, offsetof(mavlink_servos_t, pos1) }, \
|
||
|
|
{ "pos2", NULL, MAVLINK_TYPE_FLOAT, 2, 28, offsetof(mavlink_servos_t, pos2) }, \
|
||
|
|
{ "out_seq", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_servos_t, out_seq) }, \
|
||
|
|
{ "in1_seq", NULL, MAVLINK_TYPE_UINT8_T, 0, 37, offsetof(mavlink_servos_t, in1_seq) }, \
|
||
|
|
{ "in2_seq", NULL, MAVLINK_TYPE_UINT8_T, 0, 38, offsetof(mavlink_servos_t, in2_seq) }, \
|
||
|
|
} \
|
||
|
|
}
|
||
|
|
#else
|
||
|
|
#define MAVLINK_MESSAGE_INFO_SERVOS { \
|
||
|
|
"SERVOS", \
|
||
|
|
8, \
|
||
|
|
{ { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_servos_t, time_boot_ms) }, \
|
||
|
|
{ "cmd1", NULL, MAVLINK_TYPE_FLOAT, 2, 4, offsetof(mavlink_servos_t, cmd1) }, \
|
||
|
|
{ "cmd2", NULL, MAVLINK_TYPE_FLOAT, 2, 12, offsetof(mavlink_servos_t, cmd2) }, \
|
||
|
|
{ "pos1", NULL, MAVLINK_TYPE_FLOAT, 2, 20, offsetof(mavlink_servos_t, pos1) }, \
|
||
|
|
{ "pos2", NULL, MAVLINK_TYPE_FLOAT, 2, 28, offsetof(mavlink_servos_t, pos2) }, \
|
||
|
|
{ "out_seq", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_servos_t, out_seq) }, \
|
||
|
|
{ "in1_seq", NULL, MAVLINK_TYPE_UINT8_T, 0, 37, offsetof(mavlink_servos_t, in1_seq) }, \
|
||
|
|
{ "in2_seq", NULL, MAVLINK_TYPE_UINT8_T, 0, 38, offsetof(mavlink_servos_t, in2_seq) }, \
|
||
|
|
} \
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Pack a servos message
|
||
|
|
* @param system_id ID of this system
|
||
|
|
* @param component_id ID of this component (e.g. 200 for IMU)
|
||
|
|
* @param msg The MAVLink message to compress the data into
|
||
|
|
*
|
||
|
|
* @param time_boot_ms [ms] Timestamp (milliseconds since system boot)
|
||
|
|
* @param cmd1 ActuatorCmd1(deg)
|
||
|
|
* @param cmd2 ActuatorCmd2(deg)
|
||
|
|
* @param pos1 ActuatorPos1(deg)
|
||
|
|
* @param pos2 ActuatorPos2(deg)
|
||
|
|
* @param out_seq output index
|
||
|
|
* @param in1_seq input1 index
|
||
|
|
* @param in2_seq input2 index
|
||
|
|
* @return length of the message in bytes (excluding serial stream start sign)
|
||
|
|
*/
|
||
|
|
static inline uint16_t mavlink_msg_servos_pack(uint16_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||
|
|
uint32_t time_boot_ms, const float *cmd1, const float *cmd2, const float *pos1, const float *pos2, uint8_t out_seq, uint8_t in1_seq, uint8_t in2_seq)
|
||
|
|
{
|
||
|
|
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||
|
|
char buf[MAVLINK_MSG_ID_SERVOS_LEN];
|
||
|
|
_mav_put_uint32_t(buf, 0, time_boot_ms);
|
||
|
|
_mav_put_uint8_t(buf, 36, out_seq);
|
||
|
|
_mav_put_uint8_t(buf, 37, in1_seq);
|
||
|
|
_mav_put_uint8_t(buf, 38, in2_seq);
|
||
|
|
_mav_put_float_array(buf, 4, cmd1, 2);
|
||
|
|
_mav_put_float_array(buf, 12, cmd2, 2);
|
||
|
|
_mav_put_float_array(buf, 20, pos1, 2);
|
||
|
|
_mav_put_float_array(buf, 28, pos2, 2);
|
||
|
|
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERVOS_LEN);
|
||
|
|
#else
|
||
|
|
mavlink_servos_t packet;
|
||
|
|
packet.time_boot_ms = time_boot_ms;
|
||
|
|
packet.out_seq = out_seq;
|
||
|
|
packet.in1_seq = in1_seq;
|
||
|
|
packet.in2_seq = in2_seq;
|
||
|
|
mav_array_memcpy(packet.cmd1, cmd1, sizeof(float)*2);
|
||
|
|
mav_array_memcpy(packet.cmd2, cmd2, sizeof(float)*2);
|
||
|
|
mav_array_memcpy(packet.pos1, pos1, sizeof(float)*2);
|
||
|
|
mav_array_memcpy(packet.pos2, pos2, sizeof(float)*2);
|
||
|
|
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERVOS_LEN);
|
||
|
|
#endif
|
||
|
|
|
||
|
|
msg->msgid = MAVLINK_MSG_ID_SERVOS;
|
||
|
|
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SERVOS_MIN_LEN, MAVLINK_MSG_ID_SERVOS_LEN, MAVLINK_MSG_ID_SERVOS_CRC);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Pack a servos message on a channel
|
||
|
|
* @param system_id ID of this system
|
||
|
|
* @param component_id ID of this component (e.g. 200 for IMU)
|
||
|
|
* @param chan The MAVLink channel this message will be sent over
|
||
|
|
* @param msg The MAVLink message to compress the data into
|
||
|
|
* @param time_boot_ms [ms] Timestamp (milliseconds since system boot)
|
||
|
|
* @param cmd1 ActuatorCmd1(deg)
|
||
|
|
* @param cmd2 ActuatorCmd2(deg)
|
||
|
|
* @param pos1 ActuatorPos1(deg)
|
||
|
|
* @param pos2 ActuatorPos2(deg)
|
||
|
|
* @param out_seq output index
|
||
|
|
* @param in1_seq input1 index
|
||
|
|
* @param in2_seq input2 index
|
||
|
|
* @return length of the message in bytes (excluding serial stream start sign)
|
||
|
|
*/
|
||
|
|
static inline uint16_t mavlink_msg_servos_pack_chan(uint16_t system_id, uint8_t component_id, uint8_t chan,
|
||
|
|
mavlink_message_t* msg,
|
||
|
|
uint32_t time_boot_ms,const float *cmd1,const float *cmd2,const float *pos1,const float *pos2,uint8_t out_seq,uint8_t in1_seq,uint8_t in2_seq)
|
||
|
|
{
|
||
|
|
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||
|
|
char buf[MAVLINK_MSG_ID_SERVOS_LEN];
|
||
|
|
_mav_put_uint32_t(buf, 0, time_boot_ms);
|
||
|
|
_mav_put_uint8_t(buf, 36, out_seq);
|
||
|
|
_mav_put_uint8_t(buf, 37, in1_seq);
|
||
|
|
_mav_put_uint8_t(buf, 38, in2_seq);
|
||
|
|
_mav_put_float_array(buf, 4, cmd1, 2);
|
||
|
|
_mav_put_float_array(buf, 12, cmd2, 2);
|
||
|
|
_mav_put_float_array(buf, 20, pos1, 2);
|
||
|
|
_mav_put_float_array(buf, 28, pos2, 2);
|
||
|
|
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERVOS_LEN);
|
||
|
|
#else
|
||
|
|
mavlink_servos_t packet;
|
||
|
|
packet.time_boot_ms = time_boot_ms;
|
||
|
|
packet.out_seq = out_seq;
|
||
|
|
packet.in1_seq = in1_seq;
|
||
|
|
packet.in2_seq = in2_seq;
|
||
|
|
mav_array_memcpy(packet.cmd1, cmd1, sizeof(float)*2);
|
||
|
|
mav_array_memcpy(packet.cmd2, cmd2, sizeof(float)*2);
|
||
|
|
mav_array_memcpy(packet.pos1, pos1, sizeof(float)*2);
|
||
|
|
mav_array_memcpy(packet.pos2, pos2, sizeof(float)*2);
|
||
|
|
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERVOS_LEN);
|
||
|
|
#endif
|
||
|
|
|
||
|
|
msg->msgid = MAVLINK_MSG_ID_SERVOS;
|
||
|
|
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SERVOS_MIN_LEN, MAVLINK_MSG_ID_SERVOS_LEN, MAVLINK_MSG_ID_SERVOS_CRC);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Encode a servos struct
|
||
|
|
*
|
||
|
|
* @param system_id ID of this system
|
||
|
|
* @param component_id ID of this component (e.g. 200 for IMU)
|
||
|
|
* @param msg The MAVLink message to compress the data into
|
||
|
|
* @param servos C-struct to read the message contents from
|
||
|
|
*/
|
||
|
|
static inline uint16_t mavlink_msg_servos_encode(uint16_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_servos_t* servos)
|
||
|
|
{
|
||
|
|
return mavlink_msg_servos_pack(system_id, component_id, msg, servos->time_boot_ms, servos->cmd1, servos->cmd2, servos->pos1, servos->pos2, servos->out_seq, servos->in1_seq, servos->in2_seq);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Encode a servos struct on a channel
|
||
|
|
*
|
||
|
|
* @param system_id ID of this system
|
||
|
|
* @param component_id ID of this component (e.g. 200 for IMU)
|
||
|
|
* @param chan The MAVLink channel this message will be sent over
|
||
|
|
* @param msg The MAVLink message to compress the data into
|
||
|
|
* @param servos C-struct to read the message contents from
|
||
|
|
*/
|
||
|
|
static inline uint16_t mavlink_msg_servos_encode_chan(uint16_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_servos_t* servos)
|
||
|
|
{
|
||
|
|
return mavlink_msg_servos_pack_chan(system_id, component_id, chan, msg, servos->time_boot_ms, servos->cmd1, servos->cmd2, servos->pos1, servos->pos2, servos->out_seq, servos->in1_seq, servos->in2_seq);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Send a servos message
|
||
|
|
* @param chan MAVLink channel to send the message
|
||
|
|
*
|
||
|
|
* @param time_boot_ms [ms] Timestamp (milliseconds since system boot)
|
||
|
|
* @param cmd1 ActuatorCmd1(deg)
|
||
|
|
* @param cmd2 ActuatorCmd2(deg)
|
||
|
|
* @param pos1 ActuatorPos1(deg)
|
||
|
|
* @param pos2 ActuatorPos2(deg)
|
||
|
|
* @param out_seq output index
|
||
|
|
* @param in1_seq input1 index
|
||
|
|
* @param in2_seq input2 index
|
||
|
|
*/
|
||
|
|
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||
|
|
|
||
|
|
static inline void mavlink_msg_servos_send(mavlink_channel_t chan, uint32_t time_boot_ms, const float *cmd1, const float *cmd2, const float *pos1, const float *pos2, uint8_t out_seq, uint8_t in1_seq, uint8_t in2_seq)
|
||
|
|
{
|
||
|
|
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||
|
|
char buf[MAVLINK_MSG_ID_SERVOS_LEN];
|
||
|
|
_mav_put_uint32_t(buf, 0, time_boot_ms);
|
||
|
|
_mav_put_uint8_t(buf, 36, out_seq);
|
||
|
|
_mav_put_uint8_t(buf, 37, in1_seq);
|
||
|
|
_mav_put_uint8_t(buf, 38, in2_seq);
|
||
|
|
_mav_put_float_array(buf, 4, cmd1, 2);
|
||
|
|
_mav_put_float_array(buf, 12, cmd2, 2);
|
||
|
|
_mav_put_float_array(buf, 20, pos1, 2);
|
||
|
|
_mav_put_float_array(buf, 28, pos2, 2);
|
||
|
|
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERVOS, buf, MAVLINK_MSG_ID_SERVOS_MIN_LEN, MAVLINK_MSG_ID_SERVOS_LEN, MAVLINK_MSG_ID_SERVOS_CRC);
|
||
|
|
#else
|
||
|
|
mavlink_servos_t packet;
|
||
|
|
packet.time_boot_ms = time_boot_ms;
|
||
|
|
packet.out_seq = out_seq;
|
||
|
|
packet.in1_seq = in1_seq;
|
||
|
|
packet.in2_seq = in2_seq;
|
||
|
|
mav_array_memcpy(packet.cmd1, cmd1, sizeof(float)*2);
|
||
|
|
mav_array_memcpy(packet.cmd2, cmd2, sizeof(float)*2);
|
||
|
|
mav_array_memcpy(packet.pos1, pos1, sizeof(float)*2);
|
||
|
|
mav_array_memcpy(packet.pos2, pos2, sizeof(float)*2);
|
||
|
|
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERVOS, (const char *)&packet, MAVLINK_MSG_ID_SERVOS_MIN_LEN, MAVLINK_MSG_ID_SERVOS_LEN, MAVLINK_MSG_ID_SERVOS_CRC);
|
||
|
|
#endif
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Send a servos message
|
||
|
|
* @param chan MAVLink channel to send the message
|
||
|
|
* @param struct The MAVLink struct to serialize
|
||
|
|
*/
|
||
|
|
static inline void mavlink_msg_servos_send_struct(mavlink_channel_t chan, const mavlink_servos_t* servos)
|
||
|
|
{
|
||
|
|
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||
|
|
mavlink_msg_servos_send(chan, servos->time_boot_ms, servos->cmd1, servos->cmd2, servos->pos1, servos->pos2, servos->out_seq, servos->in1_seq, servos->in2_seq);
|
||
|
|
#else
|
||
|
|
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERVOS, (const char *)servos, MAVLINK_MSG_ID_SERVOS_MIN_LEN, MAVLINK_MSG_ID_SERVOS_LEN, MAVLINK_MSG_ID_SERVOS_CRC);
|
||
|
|
#endif
|
||
|
|
}
|
||
|
|
|
||
|
|
#if MAVLINK_MSG_ID_SERVOS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
|
||
|
|
/*
|
||
|
|
This varient of _send() can be used to save stack space by re-using
|
||
|
|
memory from the receive buffer. The caller provides a
|
||
|
|
mavlink_message_t which is the size of a full mavlink message. This
|
||
|
|
is usually the receive buffer for the channel, and allows a reply to an
|
||
|
|
incoming message with minimum stack space usage.
|
||
|
|
*/
|
||
|
|
static inline void mavlink_msg_servos_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, const float *cmd1, const float *cmd2, const float *pos1, const float *pos2, uint8_t out_seq, uint8_t in1_seq, uint8_t in2_seq)
|
||
|
|
{
|
||
|
|
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||
|
|
char *buf = (char *)msgbuf;
|
||
|
|
_mav_put_uint32_t(buf, 0, time_boot_ms);
|
||
|
|
_mav_put_uint8_t(buf, 36, out_seq);
|
||
|
|
_mav_put_uint8_t(buf, 37, in1_seq);
|
||
|
|
_mav_put_uint8_t(buf, 38, in2_seq);
|
||
|
|
_mav_put_float_array(buf, 4, cmd1, 2);
|
||
|
|
_mav_put_float_array(buf, 12, cmd2, 2);
|
||
|
|
_mav_put_float_array(buf, 20, pos1, 2);
|
||
|
|
_mav_put_float_array(buf, 28, pos2, 2);
|
||
|
|
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERVOS, buf, MAVLINK_MSG_ID_SERVOS_MIN_LEN, MAVLINK_MSG_ID_SERVOS_LEN, MAVLINK_MSG_ID_SERVOS_CRC);
|
||
|
|
#else
|
||
|
|
mavlink_servos_t *packet = (mavlink_servos_t *)msgbuf;
|
||
|
|
packet->time_boot_ms = time_boot_ms;
|
||
|
|
packet->out_seq = out_seq;
|
||
|
|
packet->in1_seq = in1_seq;
|
||
|
|
packet->in2_seq = in2_seq;
|
||
|
|
mav_array_memcpy(packet->cmd1, cmd1, sizeof(float)*2);
|
||
|
|
mav_array_memcpy(packet->cmd2, cmd2, sizeof(float)*2);
|
||
|
|
mav_array_memcpy(packet->pos1, pos1, sizeof(float)*2);
|
||
|
|
mav_array_memcpy(packet->pos2, pos2, sizeof(float)*2);
|
||
|
|
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERVOS, (const char *)packet, MAVLINK_MSG_ID_SERVOS_MIN_LEN, MAVLINK_MSG_ID_SERVOS_LEN, MAVLINK_MSG_ID_SERVOS_CRC);
|
||
|
|
#endif
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#endif
|
||
|
|
|
||
|
|
// MESSAGE SERVOS UNPACKING
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Get field time_boot_ms from servos message
|
||
|
|
*
|
||
|
|
* @return [ms] Timestamp (milliseconds since system boot)
|
||
|
|
*/
|
||
|
|
static inline uint32_t mavlink_msg_servos_get_time_boot_ms(const mavlink_message_t* msg)
|
||
|
|
{
|
||
|
|
return _MAV_RETURN_uint32_t(msg, 0);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Get field cmd1 from servos message
|
||
|
|
*
|
||
|
|
* @return ActuatorCmd1(deg)
|
||
|
|
*/
|
||
|
|
static inline uint16_t mavlink_msg_servos_get_cmd1(const mavlink_message_t* msg, float *cmd1)
|
||
|
|
{
|
||
|
|
return _MAV_RETURN_float_array(msg, cmd1, 2, 4);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Get field cmd2 from servos message
|
||
|
|
*
|
||
|
|
* @return ActuatorCmd2(deg)
|
||
|
|
*/
|
||
|
|
static inline uint16_t mavlink_msg_servos_get_cmd2(const mavlink_message_t* msg, float *cmd2)
|
||
|
|
{
|
||
|
|
return _MAV_RETURN_float_array(msg, cmd2, 2, 12);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Get field pos1 from servos message
|
||
|
|
*
|
||
|
|
* @return ActuatorPos1(deg)
|
||
|
|
*/
|
||
|
|
static inline uint16_t mavlink_msg_servos_get_pos1(const mavlink_message_t* msg, float *pos1)
|
||
|
|
{
|
||
|
|
return _MAV_RETURN_float_array(msg, pos1, 2, 20);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Get field pos2 from servos message
|
||
|
|
*
|
||
|
|
* @return ActuatorPos2(deg)
|
||
|
|
*/
|
||
|
|
static inline uint16_t mavlink_msg_servos_get_pos2(const mavlink_message_t* msg, float *pos2)
|
||
|
|
{
|
||
|
|
return _MAV_RETURN_float_array(msg, pos2, 2, 28);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Get field out_seq from servos message
|
||
|
|
*
|
||
|
|
* @return output index
|
||
|
|
*/
|
||
|
|
static inline uint8_t mavlink_msg_servos_get_out_seq(const mavlink_message_t* msg)
|
||
|
|
{
|
||
|
|
return _MAV_RETURN_uint8_t(msg, 36);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Get field in1_seq from servos message
|
||
|
|
*
|
||
|
|
* @return input1 index
|
||
|
|
*/
|
||
|
|
static inline uint8_t mavlink_msg_servos_get_in1_seq(const mavlink_message_t* msg)
|
||
|
|
{
|
||
|
|
return _MAV_RETURN_uint8_t(msg, 37);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Get field in2_seq from servos message
|
||
|
|
*
|
||
|
|
* @return input2 index
|
||
|
|
*/
|
||
|
|
static inline uint8_t mavlink_msg_servos_get_in2_seq(const mavlink_message_t* msg)
|
||
|
|
{
|
||
|
|
return _MAV_RETURN_uint8_t(msg, 38);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Decode a servos message into a struct
|
||
|
|
*
|
||
|
|
* @param msg The message to decode
|
||
|
|
* @param servos C-struct to decode the message contents into
|
||
|
|
*/
|
||
|
|
static inline void mavlink_msg_servos_decode(const mavlink_message_t* msg, mavlink_servos_t* servos)
|
||
|
|
{
|
||
|
|
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||
|
|
servos->time_boot_ms = mavlink_msg_servos_get_time_boot_ms(msg);
|
||
|
|
mavlink_msg_servos_get_cmd1(msg, servos->cmd1);
|
||
|
|
mavlink_msg_servos_get_cmd2(msg, servos->cmd2);
|
||
|
|
mavlink_msg_servos_get_pos1(msg, servos->pos1);
|
||
|
|
mavlink_msg_servos_get_pos2(msg, servos->pos2);
|
||
|
|
servos->out_seq = mavlink_msg_servos_get_out_seq(msg);
|
||
|
|
servos->in1_seq = mavlink_msg_servos_get_in1_seq(msg);
|
||
|
|
servos->in2_seq = mavlink_msg_servos_get_in2_seq(msg);
|
||
|
|
#else
|
||
|
|
uint8_t len = msg->len < MAVLINK_MSG_ID_SERVOS_LEN? msg->len : MAVLINK_MSG_ID_SERVOS_LEN;
|
||
|
|
memset(servos, 0, MAVLINK_MSG_ID_SERVOS_LEN);
|
||
|
|
memcpy(servos, _MAV_PAYLOAD(msg), len);
|
||
|
|
#endif
|
||
|
|
}
|