Merged in f5soh/librepilot/update_credits (pull request #529)
[librepilot.git] / flight / libraries / mavlink / v1.0 / common / mavlink_msg_set_local_position_setpoint.h
blob420d0d1b8136cbe8be3dae8d268b2206d9c76c6b
1 // MESSAGE SET_LOCAL_POSITION_SETPOINT PACKING
3 #define MAVLINK_MSG_ID_SET_LOCAL_POSITION_SETPOINT 50
5 typedef struct __mavlink_set_local_position_setpoint_t {
6 float x; ///< x position
7 float y; ///< y position
8 float z; ///< z position
9 float yaw; ///< Desired yaw angle
10 uint8_t target_system; ///< System ID
11 uint8_t target_component; ///< Component ID
12 uint8_t coordinate_frame; ///< Coordinate frame - valid values are only MAV_FRAME_LOCAL_NED or MAV_FRAME_LOCAL_ENU
13 } mavlink_set_local_position_setpoint_t;
15 #define MAVLINK_MSG_ID_SET_LOCAL_POSITION_SETPOINT_LEN 19
16 #define MAVLINK_MSG_ID_50_LEN 19
19 #define MAVLINK_MESSAGE_INFO_SET_LOCAL_POSITION_SETPOINT \
20 { \
21 "SET_LOCAL_POSITION_SETPOINT", \
22 7, \
23 { \
24 { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_set_local_position_setpoint_t, x) }, \
25 { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_set_local_position_setpoint_t, y) }, \
26 { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_set_local_position_setpoint_t, z) }, \
27 { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_set_local_position_setpoint_t, yaw) }, \
28 { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_set_local_position_setpoint_t, target_system) }, \
29 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 17, offsetof(mavlink_set_local_position_setpoint_t, target_component) }, \
30 { "coordinate_frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 18, offsetof(mavlink_set_local_position_setpoint_t, coordinate_frame) }, \
31 } \
35 /**
36 * @brief Pack a set_local_position_setpoint message
37 * @param system_id ID of this system
38 * @param component_id ID of this component (e.g. 200 for IMU)
39 * @param msg The MAVLink message to compress the data into
41 * @param target_system System ID
42 * @param target_component Component ID
43 * @param coordinate_frame Coordinate frame - valid values are only MAV_FRAME_LOCAL_NED or MAV_FRAME_LOCAL_ENU
44 * @param x x position
45 * @param y y position
46 * @param z z position
47 * @param yaw Desired yaw angle
48 * @return length of the message in bytes (excluding serial stream start sign)
50 static inline uint16_t mavlink_msg_set_local_position_setpoint_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t *msg,
51 uint8_t target_system, uint8_t target_component, uint8_t coordinate_frame, float x, float y, float z, float yaw)
53 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
54 char buf[19];
55 _mav_put_float(buf, 0, x);
56 _mav_put_float(buf, 4, y);
57 _mav_put_float(buf, 8, z);
58 _mav_put_float(buf, 12, yaw);
59 _mav_put_uint8_t(buf, 16, target_system);
60 _mav_put_uint8_t(buf, 17, target_component);
61 _mav_put_uint8_t(buf, 18, coordinate_frame);
63 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 19);
64 #else
65 mavlink_set_local_position_setpoint_t packet;
66 packet.x = x;
67 packet.y = y;
68 packet.z = z;
69 packet.yaw = yaw;
70 packet.target_system = target_system;
71 packet.target_component = target_component;
72 packet.coordinate_frame = coordinate_frame;
74 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 19);
75 #endif // if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
77 msg->msgid = MAVLINK_MSG_ID_SET_LOCAL_POSITION_SETPOINT;
78 return mavlink_finalize_message(msg, system_id, component_id, 19, 214);
81 /**
82 * @brief Pack a set_local_position_setpoint message on a channel
83 * @param system_id ID of this system
84 * @param component_id ID of this component (e.g. 200 for IMU)
85 * @param chan The MAVLink channel this message was sent over
86 * @param msg The MAVLink message to compress the data into
87 * @param target_system System ID
88 * @param target_component Component ID
89 * @param coordinate_frame Coordinate frame - valid values are only MAV_FRAME_LOCAL_NED or MAV_FRAME_LOCAL_ENU
90 * @param x x position
91 * @param y y position
92 * @param z z position
93 * @param yaw Desired yaw angle
94 * @return length of the message in bytes (excluding serial stream start sign)
96 static inline uint16_t mavlink_msg_set_local_position_setpoint_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
97 mavlink_message_t *msg,
98 uint8_t target_system, uint8_t target_component, uint8_t coordinate_frame, float x, float y, float z, float yaw)
100 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
101 char buf[19];
102 _mav_put_float(buf, 0, x);
103 _mav_put_float(buf, 4, y);
104 _mav_put_float(buf, 8, z);
105 _mav_put_float(buf, 12, yaw);
106 _mav_put_uint8_t(buf, 16, target_system);
107 _mav_put_uint8_t(buf, 17, target_component);
108 _mav_put_uint8_t(buf, 18, coordinate_frame);
110 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 19);
111 #else
112 mavlink_set_local_position_setpoint_t packet;
113 packet.x = x;
114 packet.y = y;
115 packet.z = z;
116 packet.yaw = yaw;
117 packet.target_system = target_system;
118 packet.target_component = target_component;
119 packet.coordinate_frame = coordinate_frame;
121 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 19);
122 #endif // if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
124 msg->msgid = MAVLINK_MSG_ID_SET_LOCAL_POSITION_SETPOINT;
125 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 19, 214);
129 * @brief Encode a set_local_position_setpoint struct into a message
131 * @param system_id ID of this system
132 * @param component_id ID of this component (e.g. 200 for IMU)
133 * @param msg The MAVLink message to compress the data into
134 * @param set_local_position_setpoint C-struct to read the message contents from
136 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)
138 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->coordinate_frame, set_local_position_setpoint->x, set_local_position_setpoint->y, set_local_position_setpoint->z, set_local_position_setpoint->yaw);
142 * @brief Send a set_local_position_setpoint message
143 * @param chan MAVLink channel to send the message
145 * @param target_system System ID
146 * @param target_component Component ID
147 * @param coordinate_frame Coordinate frame - valid values are only MAV_FRAME_LOCAL_NED or MAV_FRAME_LOCAL_ENU
148 * @param x x position
149 * @param y y position
150 * @param z z position
151 * @param yaw Desired yaw angle
153 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
155 static inline void mavlink_msg_set_local_position_setpoint_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t coordinate_frame, float x, float y, float z, float yaw)
157 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
158 char buf[19];
159 _mav_put_float(buf, 0, x);
160 _mav_put_float(buf, 4, y);
161 _mav_put_float(buf, 8, z);
162 _mav_put_float(buf, 12, yaw);
163 _mav_put_uint8_t(buf, 16, target_system);
164 _mav_put_uint8_t(buf, 17, target_component);
165 _mav_put_uint8_t(buf, 18, coordinate_frame);
167 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_LOCAL_POSITION_SETPOINT, buf, 19, 214);
168 #else
169 mavlink_set_local_position_setpoint_t packet;
170 packet.x = x;
171 packet.y = y;
172 packet.z = z;
173 packet.yaw = yaw;
174 packet.target_system = target_system;
175 packet.target_component = target_component;
176 packet.coordinate_frame = coordinate_frame;
178 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_LOCAL_POSITION_SETPOINT, (const char *)&packet, 19, 214);
179 #endif // if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
182 #endif // ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
184 // MESSAGE SET_LOCAL_POSITION_SETPOINT UNPACKING
188 * @brief Get field target_system from set_local_position_setpoint message
190 * @return System ID
192 static inline uint8_t mavlink_msg_set_local_position_setpoint_get_target_system(const mavlink_message_t *msg)
194 return _MAV_RETURN_uint8_t(msg, 16);
198 * @brief Get field target_component from set_local_position_setpoint message
200 * @return Component ID
202 static inline uint8_t mavlink_msg_set_local_position_setpoint_get_target_component(const mavlink_message_t *msg)
204 return _MAV_RETURN_uint8_t(msg, 17);
208 * @brief Get field coordinate_frame from set_local_position_setpoint message
210 * @return Coordinate frame - valid values are only MAV_FRAME_LOCAL_NED or MAV_FRAME_LOCAL_ENU
212 static inline uint8_t mavlink_msg_set_local_position_setpoint_get_coordinate_frame(const mavlink_message_t *msg)
214 return _MAV_RETURN_uint8_t(msg, 18);
218 * @brief Get field x from set_local_position_setpoint message
220 * @return x position
222 static inline float mavlink_msg_set_local_position_setpoint_get_x(const mavlink_message_t *msg)
224 return _MAV_RETURN_float(msg, 0);
228 * @brief Get field y from set_local_position_setpoint message
230 * @return y position
232 static inline float mavlink_msg_set_local_position_setpoint_get_y(const mavlink_message_t *msg)
234 return _MAV_RETURN_float(msg, 4);
238 * @brief Get field z from set_local_position_setpoint message
240 * @return z position
242 static inline float mavlink_msg_set_local_position_setpoint_get_z(const mavlink_message_t *msg)
244 return _MAV_RETURN_float(msg, 8);
248 * @brief Get field yaw from set_local_position_setpoint message
250 * @return Desired yaw angle
252 static inline float mavlink_msg_set_local_position_setpoint_get_yaw(const mavlink_message_t *msg)
254 return _MAV_RETURN_float(msg, 12);
258 * @brief Decode a set_local_position_setpoint message into a struct
260 * @param msg The message to decode
261 * @param set_local_position_setpoint C-struct to decode the message contents into
263 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)
265 #if MAVLINK_NEED_BYTE_SWAP
266 set_local_position_setpoint->x = mavlink_msg_set_local_position_setpoint_get_x(msg);
267 set_local_position_setpoint->y = mavlink_msg_set_local_position_setpoint_get_y(msg);
268 set_local_position_setpoint->z = mavlink_msg_set_local_position_setpoint_get_z(msg);
269 set_local_position_setpoint->yaw = mavlink_msg_set_local_position_setpoint_get_yaw(msg);
270 set_local_position_setpoint->target_system = mavlink_msg_set_local_position_setpoint_get_target_system(msg);
271 set_local_position_setpoint->target_component = mavlink_msg_set_local_position_setpoint_get_target_component(msg);
272 set_local_position_setpoint->coordinate_frame = mavlink_msg_set_local_position_setpoint_get_coordinate_frame(msg);
273 #else
274 memcpy(set_local_position_setpoint, _MAV_PAYLOAD(msg), 19);
275 #endif