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