Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1702 | - | 1 | // MESSAGE SENSOR_OFFSETS PACKING |
2 | |||
3 | #define MAVLINK_MSG_ID_SENSOR_OFFSETS 150 |
||
4 | |||
5 | typedef struct __mavlink_sensor_offsets_t |
||
6 | { |
||
7 | int16_t mag_ofs_x; ///< magnetometer X offset |
||
8 | int16_t mag_ofs_y; ///< magnetometer Y offset |
||
9 | int16_t mag_ofs_z; ///< magnetometer Z offset |
||
10 | float mag_declination; ///< magnetic declination (radians) |
||
11 | int32_t raw_press; ///< raw pressure from barometer |
||
12 | int32_t raw_temp; ///< raw temperature from barometer |
||
13 | float gyro_cal_x; ///< gyro X calibration |
||
14 | float gyro_cal_y; ///< gyro Y calibration |
||
15 | float gyro_cal_z; ///< gyro Z calibration |
||
16 | float accel_cal_x; ///< accel X calibration |
||
17 | float accel_cal_y; ///< accel Y calibration |
||
18 | float accel_cal_z; ///< accel Z calibration |
||
19 | } mavlink_sensor_offsets_t; |
||
20 | |||
21 | #define MAVLINK_MSG_ID_SENSOR_OFFSETS_LEN 42 |
||
22 | #define MAVLINK_MSG_ID_150_LEN 42 |
||
23 | |||
24 | |||
25 | |||
26 | #define MAVLINK_MESSAGE_INFO_SENSOR_OFFSETS { \ |
||
27 | "SENSOR_OFFSETS", \ |
||
28 | 12, \ |
||
29 | { { "mag_ofs_x", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_sensor_offsets_t, mag_ofs_x) }, \ |
||
30 | { "mag_ofs_y", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_sensor_offsets_t, mag_ofs_y) }, \ |
||
31 | { "mag_ofs_z", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_sensor_offsets_t, mag_ofs_z) }, \ |
||
32 | { "mag_declination", NULL, MAVLINK_TYPE_FLOAT, 0, 6, offsetof(mavlink_sensor_offsets_t, mag_declination) }, \ |
||
33 | { "raw_press", NULL, MAVLINK_TYPE_INT32_T, 0, 10, offsetof(mavlink_sensor_offsets_t, raw_press) }, \ |
||
34 | { "raw_temp", NULL, MAVLINK_TYPE_INT32_T, 0, 14, offsetof(mavlink_sensor_offsets_t, raw_temp) }, \ |
||
35 | { "gyro_cal_x", NULL, MAVLINK_TYPE_FLOAT, 0, 18, offsetof(mavlink_sensor_offsets_t, gyro_cal_x) }, \ |
||
36 | { "gyro_cal_y", NULL, MAVLINK_TYPE_FLOAT, 0, 22, offsetof(mavlink_sensor_offsets_t, gyro_cal_y) }, \ |
||
37 | { "gyro_cal_z", NULL, MAVLINK_TYPE_FLOAT, 0, 26, offsetof(mavlink_sensor_offsets_t, gyro_cal_z) }, \ |
||
38 | { "accel_cal_x", NULL, MAVLINK_TYPE_FLOAT, 0, 30, offsetof(mavlink_sensor_offsets_t, accel_cal_x) }, \ |
||
39 | { "accel_cal_y", NULL, MAVLINK_TYPE_FLOAT, 0, 34, offsetof(mavlink_sensor_offsets_t, accel_cal_y) }, \ |
||
40 | { "accel_cal_z", NULL, MAVLINK_TYPE_FLOAT, 0, 38, offsetof(mavlink_sensor_offsets_t, accel_cal_z) }, \ |
||
41 | } \ |
||
42 | } |
||
43 | |||
44 | |||
45 | /** |
||
46 | * @brief Pack a sensor_offsets message |
||
47 | * @param system_id ID of this system |
||
48 | * @param component_id ID of this component (e.g. 200 for IMU) |
||
49 | * @param msg The MAVLink message to compress the data into |
||
50 | * |
||
51 | * @param mag_ofs_x magnetometer X offset |
||
52 | * @param mag_ofs_y magnetometer Y offset |
||
53 | * @param mag_ofs_z magnetometer Z offset |
||
54 | * @param mag_declination magnetic declination (radians) |
||
55 | * @param raw_press raw pressure from barometer |
||
56 | * @param raw_temp raw temperature from barometer |
||
57 | * @param gyro_cal_x gyro X calibration |
||
58 | * @param gyro_cal_y gyro Y calibration |
||
59 | * @param gyro_cal_z gyro Z calibration |
||
60 | * @param accel_cal_x accel X calibration |
||
61 | * @param accel_cal_y accel Y calibration |
||
62 | * @param accel_cal_z accel Z calibration |
||
63 | * @return length of the message in bytes (excluding serial stream start sign) |
||
64 | */ |
||
65 | static inline uint16_t mavlink_msg_sensor_offsets_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, |
||
66 | int16_t mag_ofs_x, int16_t mag_ofs_y, int16_t mag_ofs_z, float mag_declination, int32_t raw_press, int32_t raw_temp, float gyro_cal_x, float gyro_cal_y, float gyro_cal_z, float accel_cal_x, float accel_cal_y, float accel_cal_z) |
||
67 | { |
||
68 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
||
69 | char buf[42]; |
||
70 | _mav_put_int16_t(buf, 0, mag_ofs_x); |
||
71 | _mav_put_int16_t(buf, 2, mag_ofs_y); |
||
72 | _mav_put_int16_t(buf, 4, mag_ofs_z); |
||
73 | _mav_put_float(buf, 6, mag_declination); |
||
74 | _mav_put_int32_t(buf, 10, raw_press); |
||
75 | _mav_put_int32_t(buf, 14, raw_temp); |
||
76 | _mav_put_float(buf, 18, gyro_cal_x); |
||
77 | _mav_put_float(buf, 22, gyro_cal_y); |
||
78 | _mav_put_float(buf, 26, gyro_cal_z); |
||
79 | _mav_put_float(buf, 30, accel_cal_x); |
||
80 | _mav_put_float(buf, 34, accel_cal_y); |
||
81 | _mav_put_float(buf, 38, accel_cal_z); |
||
82 | |||
83 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 42); |
||
84 | #else |
||
85 | mavlink_sensor_offsets_t packet; |
||
86 | packet.mag_ofs_x = mag_ofs_x; |
||
87 | packet.mag_ofs_y = mag_ofs_y; |
||
88 | packet.mag_ofs_z = mag_ofs_z; |
||
89 | packet.mag_declination = mag_declination; |
||
90 | packet.raw_press = raw_press; |
||
91 | packet.raw_temp = raw_temp; |
||
92 | packet.gyro_cal_x = gyro_cal_x; |
||
93 | packet.gyro_cal_y = gyro_cal_y; |
||
94 | packet.gyro_cal_z = gyro_cal_z; |
||
95 | packet.accel_cal_x = accel_cal_x; |
||
96 | packet.accel_cal_y = accel_cal_y; |
||
97 | packet.accel_cal_z = accel_cal_z; |
||
98 | |||
99 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 42); |
||
100 | #endif |
||
101 | |||
102 | msg->msgid = MAVLINK_MSG_ID_SENSOR_OFFSETS; |
||
103 | return mavlink_finalize_message(msg, system_id, component_id, 42); |
||
104 | } |
||
105 | |||
106 | /** |
||
107 | * @brief Pack a sensor_offsets message on a channel |
||
108 | * @param system_id ID of this system |
||
109 | * @param component_id ID of this component (e.g. 200 for IMU) |
||
110 | * @param chan The MAVLink channel this message was sent over |
||
111 | * @param msg The MAVLink message to compress the data into |
||
112 | * @param mag_ofs_x magnetometer X offset |
||
113 | * @param mag_ofs_y magnetometer Y offset |
||
114 | * @param mag_ofs_z magnetometer Z offset |
||
115 | * @param mag_declination magnetic declination (radians) |
||
116 | * @param raw_press raw pressure from barometer |
||
117 | * @param raw_temp raw temperature from barometer |
||
118 | * @param gyro_cal_x gyro X calibration |
||
119 | * @param gyro_cal_y gyro Y calibration |
||
120 | * @param gyro_cal_z gyro Z calibration |
||
121 | * @param accel_cal_x accel X calibration |
||
122 | * @param accel_cal_y accel Y calibration |
||
123 | * @param accel_cal_z accel Z calibration |
||
124 | * @return length of the message in bytes (excluding serial stream start sign) |
||
125 | */ |
||
126 | static inline uint16_t mavlink_msg_sensor_offsets_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, |
||
127 | mavlink_message_t* msg, |
||
128 | int16_t mag_ofs_x,int16_t mag_ofs_y,int16_t mag_ofs_z,float mag_declination,int32_t raw_press,int32_t raw_temp,float gyro_cal_x,float gyro_cal_y,float gyro_cal_z,float accel_cal_x,float accel_cal_y,float accel_cal_z) |
||
129 | { |
||
130 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
||
131 | char buf[42]; |
||
132 | _mav_put_int16_t(buf, 0, mag_ofs_x); |
||
133 | _mav_put_int16_t(buf, 2, mag_ofs_y); |
||
134 | _mav_put_int16_t(buf, 4, mag_ofs_z); |
||
135 | _mav_put_float(buf, 6, mag_declination); |
||
136 | _mav_put_int32_t(buf, 10, raw_press); |
||
137 | _mav_put_int32_t(buf, 14, raw_temp); |
||
138 | _mav_put_float(buf, 18, gyro_cal_x); |
||
139 | _mav_put_float(buf, 22, gyro_cal_y); |
||
140 | _mav_put_float(buf, 26, gyro_cal_z); |
||
141 | _mav_put_float(buf, 30, accel_cal_x); |
||
142 | _mav_put_float(buf, 34, accel_cal_y); |
||
143 | _mav_put_float(buf, 38, accel_cal_z); |
||
144 | |||
145 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 42); |
||
146 | #else |
||
147 | mavlink_sensor_offsets_t packet; |
||
148 | packet.mag_ofs_x = mag_ofs_x; |
||
149 | packet.mag_ofs_y = mag_ofs_y; |
||
150 | packet.mag_ofs_z = mag_ofs_z; |
||
151 | packet.mag_declination = mag_declination; |
||
152 | packet.raw_press = raw_press; |
||
153 | packet.raw_temp = raw_temp; |
||
154 | packet.gyro_cal_x = gyro_cal_x; |
||
155 | packet.gyro_cal_y = gyro_cal_y; |
||
156 | packet.gyro_cal_z = gyro_cal_z; |
||
157 | packet.accel_cal_x = accel_cal_x; |
||
158 | packet.accel_cal_y = accel_cal_y; |
||
159 | packet.accel_cal_z = accel_cal_z; |
||
160 | |||
161 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 42); |
||
162 | #endif |
||
163 | |||
164 | msg->msgid = MAVLINK_MSG_ID_SENSOR_OFFSETS; |
||
165 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 42); |
||
166 | } |
||
167 | |||
168 | /** |
||
169 | * @brief Encode a sensor_offsets struct into a message |
||
170 | * |
||
171 | * @param system_id ID of this system |
||
172 | * @param component_id ID of this component (e.g. 200 for IMU) |
||
173 | * @param msg The MAVLink message to compress the data into |
||
174 | * @param sensor_offsets C-struct to read the message contents from |
||
175 | */ |
||
176 | static inline uint16_t mavlink_msg_sensor_offsets_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_sensor_offsets_t* sensor_offsets) |
||
177 | { |
||
178 | return mavlink_msg_sensor_offsets_pack(system_id, component_id, msg, sensor_offsets->mag_ofs_x, sensor_offsets->mag_ofs_y, sensor_offsets->mag_ofs_z, sensor_offsets->mag_declination, sensor_offsets->raw_press, sensor_offsets->raw_temp, sensor_offsets->gyro_cal_x, sensor_offsets->gyro_cal_y, sensor_offsets->gyro_cal_z, sensor_offsets->accel_cal_x, sensor_offsets->accel_cal_y, sensor_offsets->accel_cal_z); |
||
179 | } |
||
180 | |||
181 | /** |
||
182 | * @brief Send a sensor_offsets message |
||
183 | * @param chan MAVLink channel to send the message |
||
184 | * |
||
185 | * @param mag_ofs_x magnetometer X offset |
||
186 | * @param mag_ofs_y magnetometer Y offset |
||
187 | * @param mag_ofs_z magnetometer Z offset |
||
188 | * @param mag_declination magnetic declination (radians) |
||
189 | * @param raw_press raw pressure from barometer |
||
190 | * @param raw_temp raw temperature from barometer |
||
191 | * @param gyro_cal_x gyro X calibration |
||
192 | * @param gyro_cal_y gyro Y calibration |
||
193 | * @param gyro_cal_z gyro Z calibration |
||
194 | * @param accel_cal_x accel X calibration |
||
195 | * @param accel_cal_y accel Y calibration |
||
196 | * @param accel_cal_z accel Z calibration |
||
197 | */ |
||
198 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS |
||
199 | |||
200 | static inline void mavlink_msg_sensor_offsets_send(mavlink_channel_t chan, int16_t mag_ofs_x, int16_t mag_ofs_y, int16_t mag_ofs_z, float mag_declination, int32_t raw_press, int32_t raw_temp, float gyro_cal_x, float gyro_cal_y, float gyro_cal_z, float accel_cal_x, float accel_cal_y, float accel_cal_z) |
||
201 | { |
||
202 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
||
203 | char buf[42]; |
||
204 | _mav_put_int16_t(buf, 0, mag_ofs_x); |
||
205 | _mav_put_int16_t(buf, 2, mag_ofs_y); |
||
206 | _mav_put_int16_t(buf, 4, mag_ofs_z); |
||
207 | _mav_put_float(buf, 6, mag_declination); |
||
208 | _mav_put_int32_t(buf, 10, raw_press); |
||
209 | _mav_put_int32_t(buf, 14, raw_temp); |
||
210 | _mav_put_float(buf, 18, gyro_cal_x); |
||
211 | _mav_put_float(buf, 22, gyro_cal_y); |
||
212 | _mav_put_float(buf, 26, gyro_cal_z); |
||
213 | _mav_put_float(buf, 30, accel_cal_x); |
||
214 | _mav_put_float(buf, 34, accel_cal_y); |
||
215 | _mav_put_float(buf, 38, accel_cal_z); |
||
216 | |||
217 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENSOR_OFFSETS, buf, 42); |
||
218 | #else |
||
219 | mavlink_sensor_offsets_t packet; |
||
220 | packet.mag_ofs_x = mag_ofs_x; |
||
221 | packet.mag_ofs_y = mag_ofs_y; |
||
222 | packet.mag_ofs_z = mag_ofs_z; |
||
223 | packet.mag_declination = mag_declination; |
||
224 | packet.raw_press = raw_press; |
||
225 | packet.raw_temp = raw_temp; |
||
226 | packet.gyro_cal_x = gyro_cal_x; |
||
227 | packet.gyro_cal_y = gyro_cal_y; |
||
228 | packet.gyro_cal_z = gyro_cal_z; |
||
229 | packet.accel_cal_x = accel_cal_x; |
||
230 | packet.accel_cal_y = accel_cal_y; |
||
231 | packet.accel_cal_z = accel_cal_z; |
||
232 | |||
233 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENSOR_OFFSETS, (const char *)&packet, 42); |
||
234 | #endif |
||
235 | } |
||
236 | |||
237 | #endif |
||
238 | |||
239 | // MESSAGE SENSOR_OFFSETS UNPACKING |
||
240 | |||
241 | |||
242 | /** |
||
243 | * @brief Get field mag_ofs_x from sensor_offsets message |
||
244 | * |
||
245 | * @return magnetometer X offset |
||
246 | */ |
||
247 | static inline int16_t mavlink_msg_sensor_offsets_get_mag_ofs_x(const mavlink_message_t* msg) |
||
248 | { |
||
249 | return _MAV_RETURN_int16_t(msg, 0); |
||
250 | } |
||
251 | |||
252 | /** |
||
253 | * @brief Get field mag_ofs_y from sensor_offsets message |
||
254 | * |
||
255 | * @return magnetometer Y offset |
||
256 | */ |
||
257 | static inline int16_t mavlink_msg_sensor_offsets_get_mag_ofs_y(const mavlink_message_t* msg) |
||
258 | { |
||
259 | return _MAV_RETURN_int16_t(msg, 2); |
||
260 | } |
||
261 | |||
262 | /** |
||
263 | * @brief Get field mag_ofs_z from sensor_offsets message |
||
264 | * |
||
265 | * @return magnetometer Z offset |
||
266 | */ |
||
267 | static inline int16_t mavlink_msg_sensor_offsets_get_mag_ofs_z(const mavlink_message_t* msg) |
||
268 | { |
||
269 | return _MAV_RETURN_int16_t(msg, 4); |
||
270 | } |
||
271 | |||
272 | /** |
||
273 | * @brief Get field mag_declination from sensor_offsets message |
||
274 | * |
||
275 | * @return magnetic declination (radians) |
||
276 | */ |
||
277 | static inline float mavlink_msg_sensor_offsets_get_mag_declination(const mavlink_message_t* msg) |
||
278 | { |
||
279 | return _MAV_RETURN_float(msg, 6); |
||
280 | } |
||
281 | |||
282 | /** |
||
283 | * @brief Get field raw_press from sensor_offsets message |
||
284 | * |
||
285 | * @return raw pressure from barometer |
||
286 | */ |
||
287 | static inline int32_t mavlink_msg_sensor_offsets_get_raw_press(const mavlink_message_t* msg) |
||
288 | { |
||
289 | return _MAV_RETURN_int32_t(msg, 10); |
||
290 | } |
||
291 | |||
292 | /** |
||
293 | * @brief Get field raw_temp from sensor_offsets message |
||
294 | * |
||
295 | * @return raw temperature from barometer |
||
296 | */ |
||
297 | static inline int32_t mavlink_msg_sensor_offsets_get_raw_temp(const mavlink_message_t* msg) |
||
298 | { |
||
299 | return _MAV_RETURN_int32_t(msg, 14); |
||
300 | } |
||
301 | |||
302 | /** |
||
303 | * @brief Get field gyro_cal_x from sensor_offsets message |
||
304 | * |
||
305 | * @return gyro X calibration |
||
306 | */ |
||
307 | static inline float mavlink_msg_sensor_offsets_get_gyro_cal_x(const mavlink_message_t* msg) |
||
308 | { |
||
309 | return _MAV_RETURN_float(msg, 18); |
||
310 | } |
||
311 | |||
312 | /** |
||
313 | * @brief Get field gyro_cal_y from sensor_offsets message |
||
314 | * |
||
315 | * @return gyro Y calibration |
||
316 | */ |
||
317 | static inline float mavlink_msg_sensor_offsets_get_gyro_cal_y(const mavlink_message_t* msg) |
||
318 | { |
||
319 | return _MAV_RETURN_float(msg, 22); |
||
320 | } |
||
321 | |||
322 | /** |
||
323 | * @brief Get field gyro_cal_z from sensor_offsets message |
||
324 | * |
||
325 | * @return gyro Z calibration |
||
326 | */ |
||
327 | static inline float mavlink_msg_sensor_offsets_get_gyro_cal_z(const mavlink_message_t* msg) |
||
328 | { |
||
329 | return _MAV_RETURN_float(msg, 26); |
||
330 | } |
||
331 | |||
332 | /** |
||
333 | * @brief Get field accel_cal_x from sensor_offsets message |
||
334 | * |
||
335 | * @return accel X calibration |
||
336 | */ |
||
337 | static inline float mavlink_msg_sensor_offsets_get_accel_cal_x(const mavlink_message_t* msg) |
||
338 | { |
||
339 | return _MAV_RETURN_float(msg, 30); |
||
340 | } |
||
341 | |||
342 | /** |
||
343 | * @brief Get field accel_cal_y from sensor_offsets message |
||
344 | * |
||
345 | * @return accel Y calibration |
||
346 | */ |
||
347 | static inline float mavlink_msg_sensor_offsets_get_accel_cal_y(const mavlink_message_t* msg) |
||
348 | { |
||
349 | return _MAV_RETURN_float(msg, 34); |
||
350 | } |
||
351 | |||
352 | /** |
||
353 | * @brief Get field accel_cal_z from sensor_offsets message |
||
354 | * |
||
355 | * @return accel Z calibration |
||
356 | */ |
||
357 | static inline float mavlink_msg_sensor_offsets_get_accel_cal_z(const mavlink_message_t* msg) |
||
358 | { |
||
359 | return _MAV_RETURN_float(msg, 38); |
||
360 | } |
||
361 | |||
362 | /** |
||
363 | * @brief Decode a sensor_offsets message into a struct |
||
364 | * |
||
365 | * @param msg The message to decode |
||
366 | * @param sensor_offsets C-struct to decode the message contents into |
||
367 | */ |
||
368 | static inline void mavlink_msg_sensor_offsets_decode(const mavlink_message_t* msg, mavlink_sensor_offsets_t* sensor_offsets) |
||
369 | { |
||
370 | #if MAVLINK_NEED_BYTE_SWAP |
||
371 | sensor_offsets->mag_ofs_x = mavlink_msg_sensor_offsets_get_mag_ofs_x(msg); |
||
372 | sensor_offsets->mag_ofs_y = mavlink_msg_sensor_offsets_get_mag_ofs_y(msg); |
||
373 | sensor_offsets->mag_ofs_z = mavlink_msg_sensor_offsets_get_mag_ofs_z(msg); |
||
374 | sensor_offsets->mag_declination = mavlink_msg_sensor_offsets_get_mag_declination(msg); |
||
375 | sensor_offsets->raw_press = mavlink_msg_sensor_offsets_get_raw_press(msg); |
||
376 | sensor_offsets->raw_temp = mavlink_msg_sensor_offsets_get_raw_temp(msg); |
||
377 | sensor_offsets->gyro_cal_x = mavlink_msg_sensor_offsets_get_gyro_cal_x(msg); |
||
378 | sensor_offsets->gyro_cal_y = mavlink_msg_sensor_offsets_get_gyro_cal_y(msg); |
||
379 | sensor_offsets->gyro_cal_z = mavlink_msg_sensor_offsets_get_gyro_cal_z(msg); |
||
380 | sensor_offsets->accel_cal_x = mavlink_msg_sensor_offsets_get_accel_cal_x(msg); |
||
381 | sensor_offsets->accel_cal_y = mavlink_msg_sensor_offsets_get_accel_cal_y(msg); |
||
382 | sensor_offsets->accel_cal_z = mavlink_msg_sensor_offsets_get_accel_cal_z(msg); |
||
383 | #else |
||
384 | memcpy(sensor_offsets, _MAV_PAYLOAD(msg), 42); |
||
385 | #endif |
||
386 | } |