Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1702 | - | 1 | // MESSAGE LOCAL_POSITION_SETPOINT PACKING |
2 | |||
3 | #define MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT 51 |
||
4 | |||
5 | typedef struct __mavlink_local_position_setpoint_t |
||
6 | { |
||
7 | float x; ///< x position |
||
8 | float y; ///< y position |
||
9 | float z; ///< z position |
||
10 | float yaw; ///< Desired yaw angle |
||
11 | uint8_t coordinate_frame; ///< Coordinate frame - valid values are only MAV_FRAME_LOCAL_NED or MAV_FRAME_LOCAL_ENU |
||
12 | } mavlink_local_position_setpoint_t; |
||
13 | |||
14 | #define MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT_LEN 17 |
||
15 | #define MAVLINK_MSG_ID_51_LEN 17 |
||
16 | |||
17 | |||
18 | |||
19 | #define MAVLINK_MESSAGE_INFO_LOCAL_POSITION_SETPOINT { \ |
||
20 | "LOCAL_POSITION_SETPOINT", \ |
||
21 | 5, \ |
||
22 | { { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_local_position_setpoint_t, x) }, \ |
||
23 | { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_local_position_setpoint_t, y) }, \ |
||
24 | { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_local_position_setpoint_t, z) }, \ |
||
25 | { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_local_position_setpoint_t, yaw) }, \ |
||
26 | { "coordinate_frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_local_position_setpoint_t, coordinate_frame) }, \ |
||
27 | } \ |
||
28 | } |
||
29 | |||
30 | |||
31 | /** |
||
32 | * @brief Pack a local_position_setpoint message |
||
33 | * @param system_id ID of this system |
||
34 | * @param component_id ID of this component (e.g. 200 for IMU) |
||
35 | * @param msg The MAVLink message to compress the data into |
||
36 | * |
||
37 | * @param coordinate_frame Coordinate frame - valid values are only MAV_FRAME_LOCAL_NED or MAV_FRAME_LOCAL_ENU |
||
38 | * @param x x position |
||
39 | * @param y y position |
||
40 | * @param z z position |
||
41 | * @param yaw Desired yaw angle |
||
42 | * @return length of the message in bytes (excluding serial stream start sign) |
||
43 | */ |
||
44 | static inline uint16_t mavlink_msg_local_position_setpoint_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, |
||
45 | uint8_t coordinate_frame, float x, float y, float z, float yaw) |
||
46 | { |
||
47 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
||
48 | char buf[17]; |
||
49 | _mav_put_float(buf, 0, x); |
||
50 | _mav_put_float(buf, 4, y); |
||
51 | _mav_put_float(buf, 8, z); |
||
52 | _mav_put_float(buf, 12, yaw); |
||
53 | _mav_put_uint8_t(buf, 16, coordinate_frame); |
||
54 | |||
55 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 17); |
||
56 | #else |
||
57 | mavlink_local_position_setpoint_t packet; |
||
58 | packet.x = x; |
||
59 | packet.y = y; |
||
60 | packet.z = z; |
||
61 | packet.yaw = yaw; |
||
62 | packet.coordinate_frame = coordinate_frame; |
||
63 | |||
64 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 17); |
||
65 | #endif |
||
66 | |||
67 | msg->msgid = MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT; |
||
68 | return mavlink_finalize_message(msg, system_id, component_id, 17, 223); |
||
69 | } |
||
70 | |||
71 | /** |
||
72 | * @brief Pack a local_position_setpoint message on a channel |
||
73 | * @param system_id ID of this system |
||
74 | * @param component_id ID of this component (e.g. 200 for IMU) |
||
75 | * @param chan The MAVLink channel this message was sent over |
||
76 | * @param msg The MAVLink message to compress the data into |
||
77 | * @param coordinate_frame Coordinate frame - valid values are only MAV_FRAME_LOCAL_NED or MAV_FRAME_LOCAL_ENU |
||
78 | * @param x x position |
||
79 | * @param y y position |
||
80 | * @param z z position |
||
81 | * @param yaw Desired yaw angle |
||
82 | * @return length of the message in bytes (excluding serial stream start sign) |
||
83 | */ |
||
84 | static inline uint16_t mavlink_msg_local_position_setpoint_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, |
||
85 | mavlink_message_t* msg, |
||
86 | uint8_t coordinate_frame,float x,float y,float z,float yaw) |
||
87 | { |
||
88 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
||
89 | char buf[17]; |
||
90 | _mav_put_float(buf, 0, x); |
||
91 | _mav_put_float(buf, 4, y); |
||
92 | _mav_put_float(buf, 8, z); |
||
93 | _mav_put_float(buf, 12, yaw); |
||
94 | _mav_put_uint8_t(buf, 16, coordinate_frame); |
||
95 | |||
96 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 17); |
||
97 | #else |
||
98 | mavlink_local_position_setpoint_t packet; |
||
99 | packet.x = x; |
||
100 | packet.y = y; |
||
101 | packet.z = z; |
||
102 | packet.yaw = yaw; |
||
103 | packet.coordinate_frame = coordinate_frame; |
||
104 | |||
105 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 17); |
||
106 | #endif |
||
107 | |||
108 | msg->msgid = MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT; |
||
109 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 17, 223); |
||
110 | } |
||
111 | |||
112 | /** |
||
113 | * @brief Encode a local_position_setpoint struct into a message |
||
114 | * |
||
115 | * @param system_id ID of this system |
||
116 | * @param component_id ID of this component (e.g. 200 for IMU) |
||
117 | * @param msg The MAVLink message to compress the data into |
||
118 | * @param local_position_setpoint C-struct to read the message contents from |
||
119 | */ |
||
120 | static inline uint16_t mavlink_msg_local_position_setpoint_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_local_position_setpoint_t* local_position_setpoint) |
||
121 | { |
||
122 | return mavlink_msg_local_position_setpoint_pack(system_id, component_id, msg, local_position_setpoint->coordinate_frame, local_position_setpoint->x, local_position_setpoint->y, local_position_setpoint->z, local_position_setpoint->yaw); |
||
123 | } |
||
124 | |||
125 | /** |
||
126 | * @brief Send a local_position_setpoint message |
||
127 | * @param chan MAVLink channel to send the message |
||
128 | * |
||
129 | * @param coordinate_frame Coordinate frame - valid values are only MAV_FRAME_LOCAL_NED or MAV_FRAME_LOCAL_ENU |
||
130 | * @param x x position |
||
131 | * @param y y position |
||
132 | * @param z z position |
||
133 | * @param yaw Desired yaw angle |
||
134 | */ |
||
135 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS |
||
136 | |||
137 | static inline void mavlink_msg_local_position_setpoint_send(mavlink_channel_t chan, uint8_t coordinate_frame, float x, float y, float z, float yaw) |
||
138 | { |
||
139 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
||
140 | char buf[17]; |
||
141 | _mav_put_float(buf, 0, x); |
||
142 | _mav_put_float(buf, 4, y); |
||
143 | _mav_put_float(buf, 8, z); |
||
144 | _mav_put_float(buf, 12, yaw); |
||
145 | _mav_put_uint8_t(buf, 16, coordinate_frame); |
||
146 | |||
147 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT, buf, 17, 223); |
||
148 | #else |
||
149 | mavlink_local_position_setpoint_t packet; |
||
150 | packet.x = x; |
||
151 | packet.y = y; |
||
152 | packet.z = z; |
||
153 | packet.yaw = yaw; |
||
154 | packet.coordinate_frame = coordinate_frame; |
||
155 | |||
156 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT, (const char *)&packet, 17, 223); |
||
157 | #endif |
||
158 | } |
||
159 | |||
160 | #endif |
||
161 | |||
162 | // MESSAGE LOCAL_POSITION_SETPOINT UNPACKING |
||
163 | |||
164 | |||
165 | /** |
||
166 | * @brief Get field coordinate_frame from local_position_setpoint message |
||
167 | * |
||
168 | * @return Coordinate frame - valid values are only MAV_FRAME_LOCAL_NED or MAV_FRAME_LOCAL_ENU |
||
169 | */ |
||
170 | static inline uint8_t mavlink_msg_local_position_setpoint_get_coordinate_frame(const mavlink_message_t* msg) |
||
171 | { |
||
172 | return _MAV_RETURN_uint8_t(msg, 16); |
||
173 | } |
||
174 | |||
175 | /** |
||
176 | * @brief Get field x from local_position_setpoint message |
||
177 | * |
||
178 | * @return x position |
||
179 | */ |
||
180 | static inline float mavlink_msg_local_position_setpoint_get_x(const mavlink_message_t* msg) |
||
181 | { |
||
182 | return _MAV_RETURN_float(msg, 0); |
||
183 | } |
||
184 | |||
185 | /** |
||
186 | * @brief Get field y from local_position_setpoint message |
||
187 | * |
||
188 | * @return y position |
||
189 | */ |
||
190 | static inline float mavlink_msg_local_position_setpoint_get_y(const mavlink_message_t* msg) |
||
191 | { |
||
192 | return _MAV_RETURN_float(msg, 4); |
||
193 | } |
||
194 | |||
195 | /** |
||
196 | * @brief Get field z from local_position_setpoint message |
||
197 | * |
||
198 | * @return z position |
||
199 | */ |
||
200 | static inline float mavlink_msg_local_position_setpoint_get_z(const mavlink_message_t* msg) |
||
201 | { |
||
202 | return _MAV_RETURN_float(msg, 8); |
||
203 | } |
||
204 | |||
205 | /** |
||
206 | * @brief Get field yaw from local_position_setpoint message |
||
207 | * |
||
208 | * @return Desired yaw angle |
||
209 | */ |
||
210 | static inline float mavlink_msg_local_position_setpoint_get_yaw(const mavlink_message_t* msg) |
||
211 | { |
||
212 | return _MAV_RETURN_float(msg, 12); |
||
213 | } |
||
214 | |||
215 | /** |
||
216 | * @brief Decode a local_position_setpoint message into a struct |
||
217 | * |
||
218 | * @param msg The message to decode |
||
219 | * @param local_position_setpoint C-struct to decode the message contents into |
||
220 | */ |
||
221 | static inline void mavlink_msg_local_position_setpoint_decode(const mavlink_message_t* msg, mavlink_local_position_setpoint_t* local_position_setpoint) |
||
222 | { |
||
223 | #if MAVLINK_NEED_BYTE_SWAP |
||
224 | local_position_setpoint->x = mavlink_msg_local_position_setpoint_get_x(msg); |
||
225 | local_position_setpoint->y = mavlink_msg_local_position_setpoint_get_y(msg); |
||
226 | local_position_setpoint->z = mavlink_msg_local_position_setpoint_get_z(msg); |
||
227 | local_position_setpoint->yaw = mavlink_msg_local_position_setpoint_get_yaw(msg); |
||
228 | local_position_setpoint->coordinate_frame = mavlink_msg_local_position_setpoint_get_coordinate_frame(msg); |
||
229 | #else |
||
230 | memcpy(local_position_setpoint, _MAV_PAYLOAD(msg), 17); |
||
231 | #endif |
||
232 | } |