NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mavlink_msg_position_control_setpoint.h
Go to the documentation of this file.
1 // MESSAGE POSITION_CONTROL_SETPOINT PACKING
2 
3 #define MAVLINK_MSG_ID_POSITION_CONTROL_SETPOINT 170
4 
6 {
7  float x;
8  float y;
9  float z;
10  float yaw;
11  uint16_t id;
13 
14 #define MAVLINK_MSG_ID_POSITION_CONTROL_SETPOINT_LEN 18
15 #define MAVLINK_MSG_ID_170_LEN 18
16 
17 #define MAVLINK_MSG_ID_POSITION_CONTROL_SETPOINT_CRC 28
18 #define MAVLINK_MSG_ID_170_CRC 28
19 
20 
21 
22 #define MAVLINK_MESSAGE_INFO_POSITION_CONTROL_SETPOINT { \
23  "POSITION_CONTROL_SETPOINT", \
24  5, \
25  { { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_position_control_setpoint_t, x) }, \
26  { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_position_control_setpoint_t, y) }, \
27  { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_position_control_setpoint_t, z) }, \
28  { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_position_control_setpoint_t, yaw) }, \
29  { "id", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_position_control_setpoint_t, id) }, \
30  } \
31 }
32 
33 
47 static inline uint16_t mavlink_msg_position_control_setpoint_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
48  uint16_t id, float x, float y, float z, float yaw)
49 {
50 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
52  _mav_put_float(buf, 0, x);
53  _mav_put_float(buf, 4, y);
54  _mav_put_float(buf, 8, z);
55  _mav_put_float(buf, 12, yaw);
56  _mav_put_uint16_t(buf, 16, id);
57 
59 #else
61  packet.x = x;
62  packet.y = y;
63  packet.z = z;
64  packet.yaw = yaw;
65  packet.id = id;
66 
68 #endif
69 
71 #if MAVLINK_CRC_EXTRA
73 #else
74  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_POSITION_CONTROL_SETPOINT_LEN);
75 #endif
76 }
77 
91 static inline uint16_t mavlink_msg_position_control_setpoint_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
92  mavlink_message_t* msg,
93  uint16_t id,float x,float y,float z,float yaw)
94 {
95 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
97  _mav_put_float(buf, 0, x);
98  _mav_put_float(buf, 4, y);
99  _mav_put_float(buf, 8, z);
100  _mav_put_float(buf, 12, yaw);
101  _mav_put_uint16_t(buf, 16, id);
102 
104 #else
106  packet.x = x;
107  packet.y = y;
108  packet.z = z;
109  packet.yaw = yaw;
110  packet.id = id;
111 
113 #endif
114 
116 #if MAVLINK_CRC_EXTRA
118 #else
119  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_POSITION_CONTROL_SETPOINT_LEN);
120 #endif
121 }
122 
131 static inline uint16_t mavlink_msg_position_control_setpoint_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_position_control_setpoint_t* position_control_setpoint)
132 {
133  return mavlink_msg_position_control_setpoint_pack(system_id, component_id, msg, position_control_setpoint->id, position_control_setpoint->x, position_control_setpoint->y, position_control_setpoint->z, position_control_setpoint->yaw);
134 }
135 
145 static inline uint16_t mavlink_msg_position_control_setpoint_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_position_control_setpoint_t* position_control_setpoint)
146 {
147  return mavlink_msg_position_control_setpoint_pack_chan(system_id, component_id, chan, msg, position_control_setpoint->id, position_control_setpoint->x, position_control_setpoint->y, position_control_setpoint->z, position_control_setpoint->yaw);
148 }
149 
160 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
161 
162 static inline void mavlink_msg_position_control_setpoint_send(mavlink_channel_t chan, uint16_t id, float x, float y, float z, float yaw)
163 {
164 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
166  _mav_put_float(buf, 0, x);
167  _mav_put_float(buf, 4, y);
168  _mav_put_float(buf, 8, z);
169  _mav_put_float(buf, 12, yaw);
170  _mav_put_uint16_t(buf, 16, id);
171 
172 #if MAVLINK_CRC_EXTRA
174 #else
176 #endif
177 #else
179  packet.x = x;
180  packet.y = y;
181  packet.z = z;
182  packet.yaw = yaw;
183  packet.id = id;
184 
185 #if MAVLINK_CRC_EXTRA
187 #else
188  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_POSITION_CONTROL_SETPOINT, (const char *)&packet, MAVLINK_MSG_ID_POSITION_CONTROL_SETPOINT_LEN);
189 #endif
190 #endif
191 }
192 
193 #if MAVLINK_MSG_ID_POSITION_CONTROL_SETPOINT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
194 /*
195  This varient of _send() can be used to save stack space by re-using
196  memory from the receive buffer. The caller provides a
197  mavlink_message_t which is the size of a full mavlink message. This
198  is usually the receive buffer for the channel, and allows a reply to an
199  incoming message with minimum stack space usage.
200  */
201 static inline void mavlink_msg_position_control_setpoint_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint16_t id, float x, float y, float z, float yaw)
202 {
203 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
204  char *buf = (char *)msgbuf;
205  _mav_put_float(buf, 0, x);
206  _mav_put_float(buf, 4, y);
207  _mav_put_float(buf, 8, z);
208  _mav_put_float(buf, 12, yaw);
209  _mav_put_uint16_t(buf, 16, id);
210 
211 #if MAVLINK_CRC_EXTRA
213 #else
215 #endif
216 #else
218  packet->x = x;
219  packet->y = y;
220  packet->z = z;
221  packet->yaw = yaw;
222  packet->id = id;
223 
224 #if MAVLINK_CRC_EXTRA
226 #else
227  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_POSITION_CONTROL_SETPOINT, (const char *)packet, MAVLINK_MSG_ID_POSITION_CONTROL_SETPOINT_LEN);
228 #endif
229 #endif
230 }
231 #endif
232 
233 #endif
234 
235 // MESSAGE POSITION_CONTROL_SETPOINT UNPACKING
236 
237 
243 static inline uint16_t mavlink_msg_position_control_setpoint_get_id(const mavlink_message_t* msg)
244 {
245  return _MAV_RETURN_uint16_t(msg, 16);
246 }
247 
253 static inline float mavlink_msg_position_control_setpoint_get_x(const mavlink_message_t* msg)
254 {
255  return _MAV_RETURN_float(msg, 0);
256 }
257 
263 static inline float mavlink_msg_position_control_setpoint_get_y(const mavlink_message_t* msg)
264 {
265  return _MAV_RETURN_float(msg, 4);
266 }
267 
273 static inline float mavlink_msg_position_control_setpoint_get_z(const mavlink_message_t* msg)
274 {
275  return _MAV_RETURN_float(msg, 8);
276 }
277 
283 static inline float mavlink_msg_position_control_setpoint_get_yaw(const mavlink_message_t* msg)
284 {
285  return _MAV_RETURN_float(msg, 12);
286 }
287 
294 static inline void mavlink_msg_position_control_setpoint_decode(const mavlink_message_t* msg, mavlink_position_control_setpoint_t* position_control_setpoint)
295 {
296 #if MAVLINK_NEED_BYTE_SWAP
297  position_control_setpoint->x = mavlink_msg_position_control_setpoint_get_x(msg);
298  position_control_setpoint->y = mavlink_msg_position_control_setpoint_get_y(msg);
299  position_control_setpoint->z = mavlink_msg_position_control_setpoint_get_z(msg);
300  position_control_setpoint->yaw = mavlink_msg_position_control_setpoint_get_yaw(msg);
301  position_control_setpoint->id = mavlink_msg_position_control_setpoint_get_id(msg);
302 #else
303  memcpy(position_control_setpoint, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_POSITION_CONTROL_SETPOINT_LEN);
304 #endif
305 }
#define _mav_put_float(buf, wire_offset, b)
Definition: protocol.h:145
uint8_t z
set the acc deadband for z-Axis, this ignores small accelerations
Definition: accelerometer.h:52
int16_t yaw
Definition: sensors.h:31
#define _mav_put_uint16_t(buf, wire_offset, b)
Definition: protocol.h:139