mavlink_msg_set_local_position_setpoint.h 7.96 KB
Newer Older
1
// MESSAGE SET_LOCAL_POSITION_SETPOINT PACKING
James Goppert's avatar
James Goppert committed
2

3
#define MAVLINK_MSG_ID_SET_LOCAL_POSITION_SETPOINT 50
James Goppert's avatar
James Goppert committed
4

5
typedef struct __mavlink_set_local_position_setpoint_t
James Goppert's avatar
James Goppert committed
6
{
lm's avatar
lm committed
7 8 9 10 11 12
 float x; ///< x position
 float y; ///< y position
 float z; ///< z position
 float yaw; ///< Desired yaw angle
 uint8_t target_system; ///< System ID
 uint8_t target_component; ///< Component ID
13
} mavlink_set_local_position_setpoint_t;
James Goppert's avatar
James Goppert committed
14

15
#define MAVLINK_MSG_ID_SET_LOCAL_POSITION_SETPOINT_LEN 18
lm's avatar
lm committed
16 17 18 19
#define MAVLINK_MSG_ID_50_LEN 18



20 21
#define MAVLINK_MESSAGE_INFO_SET_LOCAL_POSITION_SETPOINT { \
	"SET_LOCAL_POSITION_SETPOINT", \
lm's avatar
lm committed
22
	6, \
23 24 25 26 27 28
	{  { "x", MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_set_local_position_setpoint_t, x) }, \
         { "y", MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_set_local_position_setpoint_t, y) }, \
         { "z", MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_set_local_position_setpoint_t, z) }, \
         { "yaw", MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_set_local_position_setpoint_t, yaw) }, \
         { "target_system", MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_set_local_position_setpoint_t, target_system) }, \
         { "target_component", MAVLINK_TYPE_UINT8_T, 0, 17, offsetof(mavlink_set_local_position_setpoint_t, target_component) }, \
lm's avatar
lm committed
29 30 31 32
         } \
}


James Goppert's avatar
James Goppert committed
33
/**
34
 * @brief Pack a set_local_position_setpoint message
James Goppert's avatar
James Goppert committed
35 36 37 38 39 40 41 42 43 44 45 46
 * @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 target_system System ID
 * @param target_component Component ID
 * @param x x position
 * @param y y position
 * @param z z position
 * @param yaw Desired yaw angle
 * @return length of the message in bytes (excluding serial stream start sign)
 */
47
static inline uint16_t mavlink_msg_set_local_position_setpoint_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
lm's avatar
lm committed
48
						       uint8_t target_system, uint8_t target_component, float x, float y, float z, float yaw)
James Goppert's avatar
James Goppert committed
49
{
50
	msg->msgid = MAVLINK_MSG_ID_SET_LOCAL_POSITION_SETPOINT;
James Goppert's avatar
James Goppert committed
51

lm's avatar
lm committed
52 53 54 55 56 57
	put_float_by_index(msg, 0, x); // x position
	put_float_by_index(msg, 4, y); // y position
	put_float_by_index(msg, 8, z); // z position
	put_float_by_index(msg, 12, yaw); // Desired yaw angle
	put_uint8_t_by_index(msg, 16, target_system); // System ID
	put_uint8_t_by_index(msg, 17, target_component); // Component ID
James Goppert's avatar
James Goppert committed
58

59
	return mavlink_finalize_message(msg, system_id, component_id, 18, 131);
James Goppert's avatar
James Goppert committed
60 61 62
}

/**
63
 * @brief Pack a set_local_position_setpoint message on a channel
James Goppert's avatar
James Goppert committed
64 65 66 67 68 69 70 71 72 73 74 75
 * @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 was sent over
 * @param msg The MAVLink message to compress the data into
 * @param target_system System ID
 * @param target_component Component ID
 * @param x x position
 * @param y y position
 * @param z z position
 * @param yaw Desired yaw angle
 * @return length of the message in bytes (excluding serial stream start sign)
 */
76
static inline uint16_t mavlink_msg_set_local_position_setpoint_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
lm's avatar
lm committed
77 78 79
							   mavlink_message_t* msg,
						           uint8_t target_system,uint8_t target_component,float x,float y,float z,float yaw)
{
80
	msg->msgid = MAVLINK_MSG_ID_SET_LOCAL_POSITION_SETPOINT;
lm's avatar
lm committed
81 82 83 84 85 86 87 88

	put_float_by_index(msg, 0, x); // x position
	put_float_by_index(msg, 4, y); // y position
	put_float_by_index(msg, 8, z); // z position
	put_float_by_index(msg, 12, yaw); // Desired yaw angle
	put_uint8_t_by_index(msg, 16, target_system); // System ID
	put_uint8_t_by_index(msg, 17, target_component); // Component ID

89
	return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 18, 131);
lm's avatar
lm committed
90 91
}

James Goppert's avatar
James Goppert committed
92
/**
93
 * @brief Encode a set_local_position_setpoint struct into a message
James Goppert's avatar
James Goppert committed
94 95 96 97
 *
 * @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
98
 * @param set_local_position_setpoint C-struct to read the message contents from
James Goppert's avatar
James Goppert committed
99
 */
100
static inline uint16_t mavlink_msg_set_local_position_setpoint_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_set_local_position_setpoint_t* set_local_position_setpoint)
James Goppert's avatar
James Goppert committed
101
{
102
	return mavlink_msg_set_local_position_setpoint_pack(system_id, component_id, msg, set_local_position_setpoint->target_system, set_local_position_setpoint->target_component, set_local_position_setpoint->x, set_local_position_setpoint->y, set_local_position_setpoint->z, set_local_position_setpoint->yaw);
James Goppert's avatar
James Goppert committed
103 104 105
}

/**
106
 * @brief Send a set_local_position_setpoint message
James Goppert's avatar
James Goppert committed
107 108 109 110 111 112 113 114 115
 * @param chan MAVLink channel to send the message
 *
 * @param target_system System ID
 * @param target_component Component ID
 * @param x x position
 * @param y y position
 * @param z z position
 * @param yaw Desired yaw angle
 */
lm's avatar
lm committed
116 117
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS

118
static inline void mavlink_msg_set_local_position_setpoint_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, float x, float y, float z, float yaw)
lm's avatar
lm committed
119
{
lm's avatar
lm committed
120
	MAVLINK_ALIGNED_MESSAGE(msg, 18);
121
	msg->msgid = MAVLINK_MSG_ID_SET_LOCAL_POSITION_SETPOINT;
LM's avatar
LM committed
122 123 124 125 126 127 128 129

	put_float_by_index(msg, 0, x); // x position
	put_float_by_index(msg, 4, y); // y position
	put_float_by_index(msg, 8, z); // z position
	put_float_by_index(msg, 12, yaw); // Desired yaw angle
	put_uint8_t_by_index(msg, 16, target_system); // System ID
	put_uint8_t_by_index(msg, 17, target_component); // Component ID

130
	mavlink_finalize_message_chan_send(msg, chan, 18, 131);
James Goppert's avatar
James Goppert committed
131 132 133
}

#endif
lm's avatar
lm committed
134

135
// MESSAGE SET_LOCAL_POSITION_SETPOINT UNPACKING
James Goppert's avatar
James Goppert committed
136

lm's avatar
lm committed
137

James Goppert's avatar
James Goppert committed
138
/**
139
 * @brief Get field target_system from set_local_position_setpoint message
James Goppert's avatar
James Goppert committed
140 141 142
 *
 * @return System ID
 */
143
static inline uint8_t mavlink_msg_set_local_position_setpoint_get_target_system(const mavlink_message_t* msg)
James Goppert's avatar
James Goppert committed
144
{
lm's avatar
lm committed
145
	return MAVLINK_MSG_RETURN_uint8_t(msg,  16);
James Goppert's avatar
James Goppert committed
146 147 148
}

/**
149
 * @brief Get field target_component from set_local_position_setpoint message
James Goppert's avatar
James Goppert committed
150 151 152
 *
 * @return Component ID
 */
153
static inline uint8_t mavlink_msg_set_local_position_setpoint_get_target_component(const mavlink_message_t* msg)
James Goppert's avatar
James Goppert committed
154
{
lm's avatar
lm committed
155
	return MAVLINK_MSG_RETURN_uint8_t(msg,  17);
James Goppert's avatar
James Goppert committed
156 157 158
}

/**
159
 * @brief Get field x from set_local_position_setpoint message
James Goppert's avatar
James Goppert committed
160 161 162
 *
 * @return x position
 */
163
static inline float mavlink_msg_set_local_position_setpoint_get_x(const mavlink_message_t* msg)
James Goppert's avatar
James Goppert committed
164
{
lm's avatar
lm committed
165
	return MAVLINK_MSG_RETURN_float(msg,  0);
James Goppert's avatar
James Goppert committed
166 167 168
}

/**
169
 * @brief Get field y from set_local_position_setpoint message
James Goppert's avatar
James Goppert committed
170 171 172
 *
 * @return y position
 */
173
static inline float mavlink_msg_set_local_position_setpoint_get_y(const mavlink_message_t* msg)
James Goppert's avatar
James Goppert committed
174
{
lm's avatar
lm committed
175
	return MAVLINK_MSG_RETURN_float(msg,  4);
James Goppert's avatar
James Goppert committed
176 177 178
}

/**
179
 * @brief Get field z from set_local_position_setpoint message
James Goppert's avatar
James Goppert committed
180 181 182
 *
 * @return z position
 */
183
static inline float mavlink_msg_set_local_position_setpoint_get_z(const mavlink_message_t* msg)
James Goppert's avatar
James Goppert committed
184
{
lm's avatar
lm committed
185
	return MAVLINK_MSG_RETURN_float(msg,  8);
James Goppert's avatar
James Goppert committed
186 187 188
}

/**
189
 * @brief Get field yaw from set_local_position_setpoint message
James Goppert's avatar
James Goppert committed
190 191 192
 *
 * @return Desired yaw angle
 */
193
static inline float mavlink_msg_set_local_position_setpoint_get_yaw(const mavlink_message_t* msg)
James Goppert's avatar
James Goppert committed
194
{
lm's avatar
lm committed
195
	return MAVLINK_MSG_RETURN_float(msg,  12);
James Goppert's avatar
James Goppert committed
196 197 198
}

/**
199
 * @brief Decode a set_local_position_setpoint message into a struct
James Goppert's avatar
James Goppert committed
200 201
 *
 * @param msg The message to decode
202
 * @param set_local_position_setpoint C-struct to decode the message contents into
James Goppert's avatar
James Goppert committed
203
 */
204
static inline void mavlink_msg_set_local_position_setpoint_decode(const mavlink_message_t* msg, mavlink_set_local_position_setpoint_t* set_local_position_setpoint)
James Goppert's avatar
James Goppert committed
205
{
lm's avatar
lm committed
206
#if MAVLINK_NEED_BYTE_SWAP
207 208 209 210 211 212
	set_local_position_setpoint->x = mavlink_msg_set_local_position_setpoint_get_x(msg);
	set_local_position_setpoint->y = mavlink_msg_set_local_position_setpoint_get_y(msg);
	set_local_position_setpoint->z = mavlink_msg_set_local_position_setpoint_get_z(msg);
	set_local_position_setpoint->yaw = mavlink_msg_set_local_position_setpoint_get_yaw(msg);
	set_local_position_setpoint->target_system = mavlink_msg_set_local_position_setpoint_get_target_system(msg);
	set_local_position_setpoint->target_component = mavlink_msg_set_local_position_setpoint_get_target_component(msg);
lm's avatar
lm committed
213
#else
214
	memcpy(set_local_position_setpoint, MAVLINK_PAYLOAD(msg), 18);
lm's avatar
lm committed
215
#endif
James Goppert's avatar
James Goppert committed
216
}