Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1702 - 1
// MESSAGE SET_LOCAL_POSITION_SETPOINT PACKING
2
 
3
#define MAVLINK_MSG_ID_SET_LOCAL_POSITION_SETPOINT 50
4
 
5
typedef struct __mavlink_set_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 target_system; ///< System ID
12
 uint8_t target_component; ///< Component ID
13
 uint8_t coordinate_frame; ///< Coordinate frame - valid values are only MAV_FRAME_LOCAL_NED or MAV_FRAME_LOCAL_ENU
14
} mavlink_set_local_position_setpoint_t;
15
 
16
#define MAVLINK_MSG_ID_SET_LOCAL_POSITION_SETPOINT_LEN 19
17
#define MAVLINK_MSG_ID_50_LEN 19
18
 
19
 
20
 
21
#define MAVLINK_MESSAGE_INFO_SET_LOCAL_POSITION_SETPOINT { \
22
        "SET_LOCAL_POSITION_SETPOINT", \
23
        7, \
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
         } \
32
}
33
 
34
 
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
40
 *
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)
49
 */
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)
52
{
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);
62
 
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;
73
 
74
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 19);
75
#endif
76
 
77
        msg->msgid = MAVLINK_MSG_ID_SET_LOCAL_POSITION_SETPOINT;
78
        return mavlink_finalize_message(msg, system_id, component_id, 19, 214);
79
}
80
 
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)
95
 */
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)
99
{
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);
109
 
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;
120
 
121
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 19);
122
#endif
123
 
124
        msg->msgid = MAVLINK_MSG_ID_SET_LOCAL_POSITION_SETPOINT;
125
        return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 19, 214);
126
}
127
 
128
/**
129
 * @brief Encode a set_local_position_setpoint struct into a message
130
 *
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
135
 */
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)
137
{
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);
139
}
140
 
141
/**
142
 * @brief Send a set_local_position_setpoint message
143
 * @param chan MAVLink channel to send the message
144
 *
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
152
 */
153
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
154
 
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)
156
{
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);
166
 
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;
177
 
178
        _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_LOCAL_POSITION_SETPOINT, (const char *)&packet, 19, 214);
179
#endif
180
}
181
 
182
#endif
183
 
184
// MESSAGE SET_LOCAL_POSITION_SETPOINT UNPACKING
185
 
186
 
187
/**
188
 * @brief Get field target_system from set_local_position_setpoint message
189
 *
190
 * @return System ID
191
 */
192
static inline uint8_t mavlink_msg_set_local_position_setpoint_get_target_system(const mavlink_message_t* msg)
193
{
194
        return _MAV_RETURN_uint8_t(msg,  16);
195
}
196
 
197
/**
198
 * @brief Get field target_component from set_local_position_setpoint message
199
 *
200
 * @return Component ID
201
 */
202
static inline uint8_t mavlink_msg_set_local_position_setpoint_get_target_component(const mavlink_message_t* msg)
203
{
204
        return _MAV_RETURN_uint8_t(msg,  17);
205
}
206
 
207
/**
208
 * @brief Get field coordinate_frame from set_local_position_setpoint message
209
 *
210
 * @return Coordinate frame - valid values are only MAV_FRAME_LOCAL_NED or MAV_FRAME_LOCAL_ENU
211
 */
212
static inline uint8_t mavlink_msg_set_local_position_setpoint_get_coordinate_frame(const mavlink_message_t* msg)
213
{
214
        return _MAV_RETURN_uint8_t(msg,  18);
215
}
216
 
217
/**
218
 * @brief Get field x from set_local_position_setpoint message
219
 *
220
 * @return x position
221
 */
222
static inline float mavlink_msg_set_local_position_setpoint_get_x(const mavlink_message_t* msg)
223
{
224
        return _MAV_RETURN_float(msg,  0);
225
}
226
 
227
/**
228
 * @brief Get field y from set_local_position_setpoint message
229
 *
230
 * @return y position
231
 */
232
static inline float mavlink_msg_set_local_position_setpoint_get_y(const mavlink_message_t* msg)
233
{
234
        return _MAV_RETURN_float(msg,  4);
235
}
236
 
237
/**
238
 * @brief Get field z from set_local_position_setpoint message
239
 *
240
 * @return z position
241
 */
242
static inline float mavlink_msg_set_local_position_setpoint_get_z(const mavlink_message_t* msg)
243
{
244
        return _MAV_RETURN_float(msg,  8);
245
}
246
 
247
/**
248
 * @brief Get field yaw from set_local_position_setpoint message
249
 *
250
 * @return Desired yaw angle
251
 */
252
static inline float mavlink_msg_set_local_position_setpoint_get_yaw(const mavlink_message_t* msg)
253
{
254
        return _MAV_RETURN_float(msg,  12);
255
}
256
 
257
/**
258
 * @brief Decode a set_local_position_setpoint message into a struct
259
 *
260
 * @param msg The message to decode
261
 * @param set_local_position_setpoint C-struct to decode the message contents into
262
 */
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)
264
{
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
276
}