Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1702 - 1
// MESSAGE STATE_CORRECTION PACKING
2
 
3
#define MAVLINK_MSG_ID_STATE_CORRECTION 64
4
 
5
typedef struct __mavlink_state_correction_t
6
{
7
 float xErr; ///< x position error
8
 float yErr; ///< y position error
9
 float zErr; ///< z position error
10
 float rollErr; ///< roll error (radians)
11
 float pitchErr; ///< pitch error (radians)
12
 float yawErr; ///< yaw error (radians)
13
 float vxErr; ///< x velocity
14
 float vyErr; ///< y velocity
15
 float vzErr; ///< z velocity
16
} mavlink_state_correction_t;
17
 
18
#define MAVLINK_MSG_ID_STATE_CORRECTION_LEN 36
19
#define MAVLINK_MSG_ID_64_LEN 36
20
 
21
 
22
 
23
#define MAVLINK_MESSAGE_INFO_STATE_CORRECTION { \
24
        "STATE_CORRECTION", \
25
        9, \
26
        {  { "xErr", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_state_correction_t, xErr) }, \
27
         { "yErr", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_state_correction_t, yErr) }, \
28
         { "zErr", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_state_correction_t, zErr) }, \
29
         { "rollErr", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_state_correction_t, rollErr) }, \
30
         { "pitchErr", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_state_correction_t, pitchErr) }, \
31
         { "yawErr", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_state_correction_t, yawErr) }, \
32
         { "vxErr", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_state_correction_t, vxErr) }, \
33
         { "vyErr", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_state_correction_t, vyErr) }, \
34
         { "vzErr", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_state_correction_t, vzErr) }, \
35
         } \
36
}
37
 
38
 
39
/**
40
 * @brief Pack a state_correction message
41
 * @param system_id ID of this system
42
 * @param component_id ID of this component (e.g. 200 for IMU)
43
 * @param msg The MAVLink message to compress the data into
44
 *
45
 * @param xErr x position error
46
 * @param yErr y position error
47
 * @param zErr z position error
48
 * @param rollErr roll error (radians)
49
 * @param pitchErr pitch error (radians)
50
 * @param yawErr yaw error (radians)
51
 * @param vxErr x velocity
52
 * @param vyErr y velocity
53
 * @param vzErr z velocity
54
 * @return length of the message in bytes (excluding serial stream start sign)
55
 */
56
static inline uint16_t mavlink_msg_state_correction_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
57
                                                       float xErr, float yErr, float zErr, float rollErr, float pitchErr, float yawErr, float vxErr, float vyErr, float vzErr)
58
{
59
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
60
        char buf[36];
61
        _mav_put_float(buf, 0, xErr);
62
        _mav_put_float(buf, 4, yErr);
63
        _mav_put_float(buf, 8, zErr);
64
        _mav_put_float(buf, 12, rollErr);
65
        _mav_put_float(buf, 16, pitchErr);
66
        _mav_put_float(buf, 20, yawErr);
67
        _mav_put_float(buf, 24, vxErr);
68
        _mav_put_float(buf, 28, vyErr);
69
        _mav_put_float(buf, 32, vzErr);
70
 
71
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 36);
72
#else
73
        mavlink_state_correction_t packet;
74
        packet.xErr = xErr;
75
        packet.yErr = yErr;
76
        packet.zErr = zErr;
77
        packet.rollErr = rollErr;
78
        packet.pitchErr = pitchErr;
79
        packet.yawErr = yawErr;
80
        packet.vxErr = vxErr;
81
        packet.vyErr = vyErr;
82
        packet.vzErr = vzErr;
83
 
84
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 36);
85
#endif
86
 
87
        msg->msgid = MAVLINK_MSG_ID_STATE_CORRECTION;
88
        return mavlink_finalize_message(msg, system_id, component_id, 36);
89
}
90
 
91
/**
92
 * @brief Pack a state_correction message on a channel
93
 * @param system_id ID of this system
94
 * @param component_id ID of this component (e.g. 200 for IMU)
95
 * @param chan The MAVLink channel this message was sent over
96
 * @param msg The MAVLink message to compress the data into
97
 * @param xErr x position error
98
 * @param yErr y position error
99
 * @param zErr z position error
100
 * @param rollErr roll error (radians)
101
 * @param pitchErr pitch error (radians)
102
 * @param yawErr yaw error (radians)
103
 * @param vxErr x velocity
104
 * @param vyErr y velocity
105
 * @param vzErr z velocity
106
 * @return length of the message in bytes (excluding serial stream start sign)
107
 */
108
static inline uint16_t mavlink_msg_state_correction_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
109
                                                           mavlink_message_t* msg,
110
                                                           float xErr,float yErr,float zErr,float rollErr,float pitchErr,float yawErr,float vxErr,float vyErr,float vzErr)
111
{
112
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
113
        char buf[36];
114
        _mav_put_float(buf, 0, xErr);
115
        _mav_put_float(buf, 4, yErr);
116
        _mav_put_float(buf, 8, zErr);
117
        _mav_put_float(buf, 12, rollErr);
118
        _mav_put_float(buf, 16, pitchErr);
119
        _mav_put_float(buf, 20, yawErr);
120
        _mav_put_float(buf, 24, vxErr);
121
        _mav_put_float(buf, 28, vyErr);
122
        _mav_put_float(buf, 32, vzErr);
123
 
124
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 36);
125
#else
126
        mavlink_state_correction_t packet;
127
        packet.xErr = xErr;
128
        packet.yErr = yErr;
129
        packet.zErr = zErr;
130
        packet.rollErr = rollErr;
131
        packet.pitchErr = pitchErr;
132
        packet.yawErr = yawErr;
133
        packet.vxErr = vxErr;
134
        packet.vyErr = vyErr;
135
        packet.vzErr = vzErr;
136
 
137
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 36);
138
#endif
139
 
140
        msg->msgid = MAVLINK_MSG_ID_STATE_CORRECTION;
141
        return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 36);
142
}
143
 
144
/**
145
 * @brief Encode a state_correction struct into a message
146
 *
147
 * @param system_id ID of this system
148
 * @param component_id ID of this component (e.g. 200 for IMU)
149
 * @param msg The MAVLink message to compress the data into
150
 * @param state_correction C-struct to read the message contents from
151
 */
152
static inline uint16_t mavlink_msg_state_correction_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_state_correction_t* state_correction)
153
{
154
        return mavlink_msg_state_correction_pack(system_id, component_id, msg, state_correction->xErr, state_correction->yErr, state_correction->zErr, state_correction->rollErr, state_correction->pitchErr, state_correction->yawErr, state_correction->vxErr, state_correction->vyErr, state_correction->vzErr);
155
}
156
 
157
/**
158
 * @brief Send a state_correction message
159
 * @param chan MAVLink channel to send the message
160
 *
161
 * @param xErr x position error
162
 * @param yErr y position error
163
 * @param zErr z position error
164
 * @param rollErr roll error (radians)
165
 * @param pitchErr pitch error (radians)
166
 * @param yawErr yaw error (radians)
167
 * @param vxErr x velocity
168
 * @param vyErr y velocity
169
 * @param vzErr z velocity
170
 */
171
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
172
 
173
static inline void mavlink_msg_state_correction_send(mavlink_channel_t chan, float xErr, float yErr, float zErr, float rollErr, float pitchErr, float yawErr, float vxErr, float vyErr, float vzErr)
174
{
175
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
176
        char buf[36];
177
        _mav_put_float(buf, 0, xErr);
178
        _mav_put_float(buf, 4, yErr);
179
        _mav_put_float(buf, 8, zErr);
180
        _mav_put_float(buf, 12, rollErr);
181
        _mav_put_float(buf, 16, pitchErr);
182
        _mav_put_float(buf, 20, yawErr);
183
        _mav_put_float(buf, 24, vxErr);
184
        _mav_put_float(buf, 28, vyErr);
185
        _mav_put_float(buf, 32, vzErr);
186
 
187
        _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATE_CORRECTION, buf, 36);
188
#else
189
        mavlink_state_correction_t packet;
190
        packet.xErr = xErr;
191
        packet.yErr = yErr;
192
        packet.zErr = zErr;
193
        packet.rollErr = rollErr;
194
        packet.pitchErr = pitchErr;
195
        packet.yawErr = yawErr;
196
        packet.vxErr = vxErr;
197
        packet.vyErr = vyErr;
198
        packet.vzErr = vzErr;
199
 
200
        _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATE_CORRECTION, (const char *)&packet, 36);
201
#endif
202
}
203
 
204
#endif
205
 
206
// MESSAGE STATE_CORRECTION UNPACKING
207
 
208
 
209
/**
210
 * @brief Get field xErr from state_correction message
211
 *
212
 * @return x position error
213
 */
214
static inline float mavlink_msg_state_correction_get_xErr(const mavlink_message_t* msg)
215
{
216
        return _MAV_RETURN_float(msg,  0);
217
}
218
 
219
/**
220
 * @brief Get field yErr from state_correction message
221
 *
222
 * @return y position error
223
 */
224
static inline float mavlink_msg_state_correction_get_yErr(const mavlink_message_t* msg)
225
{
226
        return _MAV_RETURN_float(msg,  4);
227
}
228
 
229
/**
230
 * @brief Get field zErr from state_correction message
231
 *
232
 * @return z position error
233
 */
234
static inline float mavlink_msg_state_correction_get_zErr(const mavlink_message_t* msg)
235
{
236
        return _MAV_RETURN_float(msg,  8);
237
}
238
 
239
/**
240
 * @brief Get field rollErr from state_correction message
241
 *
242
 * @return roll error (radians)
243
 */
244
static inline float mavlink_msg_state_correction_get_rollErr(const mavlink_message_t* msg)
245
{
246
        return _MAV_RETURN_float(msg,  12);
247
}
248
 
249
/**
250
 * @brief Get field pitchErr from state_correction message
251
 *
252
 * @return pitch error (radians)
253
 */
254
static inline float mavlink_msg_state_correction_get_pitchErr(const mavlink_message_t* msg)
255
{
256
        return _MAV_RETURN_float(msg,  16);
257
}
258
 
259
/**
260
 * @brief Get field yawErr from state_correction message
261
 *
262
 * @return yaw error (radians)
263
 */
264
static inline float mavlink_msg_state_correction_get_yawErr(const mavlink_message_t* msg)
265
{
266
        return _MAV_RETURN_float(msg,  20);
267
}
268
 
269
/**
270
 * @brief Get field vxErr from state_correction message
271
 *
272
 * @return x velocity
273
 */
274
static inline float mavlink_msg_state_correction_get_vxErr(const mavlink_message_t* msg)
275
{
276
        return _MAV_RETURN_float(msg,  24);
277
}
278
 
279
/**
280
 * @brief Get field vyErr from state_correction message
281
 *
282
 * @return y velocity
283
 */
284
static inline float mavlink_msg_state_correction_get_vyErr(const mavlink_message_t* msg)
285
{
286
        return _MAV_RETURN_float(msg,  28);
287
}
288
 
289
/**
290
 * @brief Get field vzErr from state_correction message
291
 *
292
 * @return z velocity
293
 */
294
static inline float mavlink_msg_state_correction_get_vzErr(const mavlink_message_t* msg)
295
{
296
        return _MAV_RETURN_float(msg,  32);
297
}
298
 
299
/**
300
 * @brief Decode a state_correction message into a struct
301
 *
302
 * @param msg The message to decode
303
 * @param state_correction C-struct to decode the message contents into
304
 */
305
static inline void mavlink_msg_state_correction_decode(const mavlink_message_t* msg, mavlink_state_correction_t* state_correction)
306
{
307
#if MAVLINK_NEED_BYTE_SWAP
308
        state_correction->xErr = mavlink_msg_state_correction_get_xErr(msg);
309
        state_correction->yErr = mavlink_msg_state_correction_get_yErr(msg);
310
        state_correction->zErr = mavlink_msg_state_correction_get_zErr(msg);
311
        state_correction->rollErr = mavlink_msg_state_correction_get_rollErr(msg);
312
        state_correction->pitchErr = mavlink_msg_state_correction_get_pitchErr(msg);
313
        state_correction->yawErr = mavlink_msg_state_correction_get_yawErr(msg);
314
        state_correction->vxErr = mavlink_msg_state_correction_get_vxErr(msg);
315
        state_correction->vyErr = mavlink_msg_state_correction_get_vyErr(msg);
316
        state_correction->vzErr = mavlink_msg_state_correction_get_vzErr(msg);
317
#else
318
        memcpy(state_correction, _MAV_PAYLOAD(msg), 36);
319
#endif
320
}