RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
mavlink_msg_gimbal_report.h
1#pragma once
2// MESSAGE GIMBAL_REPORT PACKING
3
4#define MAVLINK_MSG_ID_GIMBAL_REPORT 200
5
6MAVPACKED(
7typedef struct __mavlink_gimbal_report_t {
8 float delta_time; /*< Time since last update (seconds)*/
9 float delta_angle_x; /*< Delta angle X (radians)*/
10 float delta_angle_y; /*< Delta angle Y (radians)*/
11 float delta_angle_z; /*< Delta angle X (radians)*/
12 float delta_velocity_x; /*< Delta velocity X (m/s)*/
13 float delta_velocity_y; /*< Delta velocity Y (m/s)*/
14 float delta_velocity_z; /*< Delta velocity Z (m/s)*/
15 float joint_roll; /*< Joint ROLL (radians)*/
16 float joint_el; /*< Joint EL (radians)*/
17 float joint_az; /*< Joint AZ (radians)*/
18 uint8_t target_system; /*< System ID*/
19 uint8_t target_component; /*< Component ID*/
20}) mavlink_gimbal_report_t;
21
22#define MAVLINK_MSG_ID_GIMBAL_REPORT_LEN 42
23#define MAVLINK_MSG_ID_GIMBAL_REPORT_MIN_LEN 42
24#define MAVLINK_MSG_ID_200_LEN 42
25#define MAVLINK_MSG_ID_200_MIN_LEN 42
26
27#define MAVLINK_MSG_ID_GIMBAL_REPORT_CRC 134
28#define MAVLINK_MSG_ID_200_CRC 134
29
30
31
32#if MAVLINK_COMMAND_24BIT
33#define MAVLINK_MESSAGE_INFO_GIMBAL_REPORT { \
34 200, \
35 "GIMBAL_REPORT", \
36 12, \
37 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 40, offsetof(mavlink_gimbal_report_t, target_system) }, \
38 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 41, offsetof(mavlink_gimbal_report_t, target_component) }, \
39 { "delta_time", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_gimbal_report_t, delta_time) }, \
40 { "delta_angle_x", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_gimbal_report_t, delta_angle_x) }, \
41 { "delta_angle_y", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_gimbal_report_t, delta_angle_y) }, \
42 { "delta_angle_z", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_gimbal_report_t, delta_angle_z) }, \
43 { "delta_velocity_x", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_gimbal_report_t, delta_velocity_x) }, \
44 { "delta_velocity_y", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_gimbal_report_t, delta_velocity_y) }, \
45 { "delta_velocity_z", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_gimbal_report_t, delta_velocity_z) }, \
46 { "joint_roll", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_gimbal_report_t, joint_roll) }, \
47 { "joint_el", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_gimbal_report_t, joint_el) }, \
48 { "joint_az", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_gimbal_report_t, joint_az) }, \
49 } \
50}
51#else
52#define MAVLINK_MESSAGE_INFO_GIMBAL_REPORT { \
53 "GIMBAL_REPORT", \
54 12, \
55 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 40, offsetof(mavlink_gimbal_report_t, target_system) }, \
56 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 41, offsetof(mavlink_gimbal_report_t, target_component) }, \
57 { "delta_time", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_gimbal_report_t, delta_time) }, \
58 { "delta_angle_x", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_gimbal_report_t, delta_angle_x) }, \
59 { "delta_angle_y", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_gimbal_report_t, delta_angle_y) }, \
60 { "delta_angle_z", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_gimbal_report_t, delta_angle_z) }, \
61 { "delta_velocity_x", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_gimbal_report_t, delta_velocity_x) }, \
62 { "delta_velocity_y", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_gimbal_report_t, delta_velocity_y) }, \
63 { "delta_velocity_z", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_gimbal_report_t, delta_velocity_z) }, \
64 { "joint_roll", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_gimbal_report_t, joint_roll) }, \
65 { "joint_el", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_gimbal_report_t, joint_el) }, \
66 { "joint_az", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_gimbal_report_t, joint_az) }, \
67 } \
68}
69#endif
70
91static inline uint16_t mavlink_msg_gimbal_report_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
92 uint8_t target_system, uint8_t target_component, float delta_time, float delta_angle_x, float delta_angle_y, float delta_angle_z, float delta_velocity_x, float delta_velocity_y, float delta_velocity_z, float joint_roll, float joint_el, float joint_az)
93{
94#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
95 char buf[MAVLINK_MSG_ID_GIMBAL_REPORT_LEN];
96 _mav_put_float(buf, 0, delta_time);
97 _mav_put_float(buf, 4, delta_angle_x);
98 _mav_put_float(buf, 8, delta_angle_y);
99 _mav_put_float(buf, 12, delta_angle_z);
100 _mav_put_float(buf, 16, delta_velocity_x);
101 _mav_put_float(buf, 20, delta_velocity_y);
102 _mav_put_float(buf, 24, delta_velocity_z);
103 _mav_put_float(buf, 28, joint_roll);
104 _mav_put_float(buf, 32, joint_el);
105 _mav_put_float(buf, 36, joint_az);
106 _mav_put_uint8_t(buf, 40, target_system);
107 _mav_put_uint8_t(buf, 41, target_component);
108
109 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GIMBAL_REPORT_LEN);
110#else
111 mavlink_gimbal_report_t packet;
112 packet.delta_time = delta_time;
113 packet.delta_angle_x = delta_angle_x;
114 packet.delta_angle_y = delta_angle_y;
115 packet.delta_angle_z = delta_angle_z;
116 packet.delta_velocity_x = delta_velocity_x;
117 packet.delta_velocity_y = delta_velocity_y;
118 packet.delta_velocity_z = delta_velocity_z;
119 packet.joint_roll = joint_roll;
120 packet.joint_el = joint_el;
121 packet.joint_az = joint_az;
122 packet.target_system = target_system;
123 packet.target_component = target_component;
124
125 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_REPORT_LEN);
126#endif
127
128 msg->msgid = MAVLINK_MSG_ID_GIMBAL_REPORT;
129 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GIMBAL_REPORT_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_REPORT_LEN, MAVLINK_MSG_ID_GIMBAL_REPORT_CRC);
130}
131
152static inline uint16_t mavlink_msg_gimbal_report_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
153 mavlink_message_t* msg,
154 uint8_t target_system,uint8_t target_component,float delta_time,float delta_angle_x,float delta_angle_y,float delta_angle_z,float delta_velocity_x,float delta_velocity_y,float delta_velocity_z,float joint_roll,float joint_el,float joint_az)
155{
156#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
157 char buf[MAVLINK_MSG_ID_GIMBAL_REPORT_LEN];
158 _mav_put_float(buf, 0, delta_time);
159 _mav_put_float(buf, 4, delta_angle_x);
160 _mav_put_float(buf, 8, delta_angle_y);
161 _mav_put_float(buf, 12, delta_angle_z);
162 _mav_put_float(buf, 16, delta_velocity_x);
163 _mav_put_float(buf, 20, delta_velocity_y);
164 _mav_put_float(buf, 24, delta_velocity_z);
165 _mav_put_float(buf, 28, joint_roll);
166 _mav_put_float(buf, 32, joint_el);
167 _mav_put_float(buf, 36, joint_az);
168 _mav_put_uint8_t(buf, 40, target_system);
169 _mav_put_uint8_t(buf, 41, target_component);
170
171 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GIMBAL_REPORT_LEN);
172#else
173 mavlink_gimbal_report_t packet;
174 packet.delta_time = delta_time;
175 packet.delta_angle_x = delta_angle_x;
176 packet.delta_angle_y = delta_angle_y;
177 packet.delta_angle_z = delta_angle_z;
178 packet.delta_velocity_x = delta_velocity_x;
179 packet.delta_velocity_y = delta_velocity_y;
180 packet.delta_velocity_z = delta_velocity_z;
181 packet.joint_roll = joint_roll;
182 packet.joint_el = joint_el;
183 packet.joint_az = joint_az;
184 packet.target_system = target_system;
185 packet.target_component = target_component;
186
187 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_REPORT_LEN);
188#endif
189
190 msg->msgid = MAVLINK_MSG_ID_GIMBAL_REPORT;
191 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GIMBAL_REPORT_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_REPORT_LEN, MAVLINK_MSG_ID_GIMBAL_REPORT_CRC);
192}
193
202static inline uint16_t mavlink_msg_gimbal_report_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gimbal_report_t* gimbal_report)
203{
204 return mavlink_msg_gimbal_report_pack(system_id, component_id, msg, gimbal_report->target_system, gimbal_report->target_component, gimbal_report->delta_time, gimbal_report->delta_angle_x, gimbal_report->delta_angle_y, gimbal_report->delta_angle_z, gimbal_report->delta_velocity_x, gimbal_report->delta_velocity_y, gimbal_report->delta_velocity_z, gimbal_report->joint_roll, gimbal_report->joint_el, gimbal_report->joint_az);
205}
206
216static inline uint16_t mavlink_msg_gimbal_report_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gimbal_report_t* gimbal_report)
217{
218 return mavlink_msg_gimbal_report_pack_chan(system_id, component_id, chan, msg, gimbal_report->target_system, gimbal_report->target_component, gimbal_report->delta_time, gimbal_report->delta_angle_x, gimbal_report->delta_angle_y, gimbal_report->delta_angle_z, gimbal_report->delta_velocity_x, gimbal_report->delta_velocity_y, gimbal_report->delta_velocity_z, gimbal_report->joint_roll, gimbal_report->joint_el, gimbal_report->joint_az);
219}
220
238#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
239
240static inline void mavlink_msg_gimbal_report_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, float delta_time, float delta_angle_x, float delta_angle_y, float delta_angle_z, float delta_velocity_x, float delta_velocity_y, float delta_velocity_z, float joint_roll, float joint_el, float joint_az)
241{
242#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
243 char buf[MAVLINK_MSG_ID_GIMBAL_REPORT_LEN];
244 _mav_put_float(buf, 0, delta_time);
245 _mav_put_float(buf, 4, delta_angle_x);
246 _mav_put_float(buf, 8, delta_angle_y);
247 _mav_put_float(buf, 12, delta_angle_z);
248 _mav_put_float(buf, 16, delta_velocity_x);
249 _mav_put_float(buf, 20, delta_velocity_y);
250 _mav_put_float(buf, 24, delta_velocity_z);
251 _mav_put_float(buf, 28, joint_roll);
252 _mav_put_float(buf, 32, joint_el);
253 _mav_put_float(buf, 36, joint_az);
254 _mav_put_uint8_t(buf, 40, target_system);
255 _mav_put_uint8_t(buf, 41, target_component);
256
257 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_REPORT, buf, MAVLINK_MSG_ID_GIMBAL_REPORT_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_REPORT_LEN, MAVLINK_MSG_ID_GIMBAL_REPORT_CRC);
258#else
259 mavlink_gimbal_report_t packet;
260 packet.delta_time = delta_time;
261 packet.delta_angle_x = delta_angle_x;
262 packet.delta_angle_y = delta_angle_y;
263 packet.delta_angle_z = delta_angle_z;
264 packet.delta_velocity_x = delta_velocity_x;
265 packet.delta_velocity_y = delta_velocity_y;
266 packet.delta_velocity_z = delta_velocity_z;
267 packet.joint_roll = joint_roll;
268 packet.joint_el = joint_el;
269 packet.joint_az = joint_az;
270 packet.target_system = target_system;
271 packet.target_component = target_component;
272
273 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_REPORT, (const char *)&packet, MAVLINK_MSG_ID_GIMBAL_REPORT_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_REPORT_LEN, MAVLINK_MSG_ID_GIMBAL_REPORT_CRC);
274#endif
275}
276
282static inline void mavlink_msg_gimbal_report_send_struct(mavlink_channel_t chan, const mavlink_gimbal_report_t* gimbal_report)
283{
284#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
285 mavlink_msg_gimbal_report_send(chan, gimbal_report->target_system, gimbal_report->target_component, gimbal_report->delta_time, gimbal_report->delta_angle_x, gimbal_report->delta_angle_y, gimbal_report->delta_angle_z, gimbal_report->delta_velocity_x, gimbal_report->delta_velocity_y, gimbal_report->delta_velocity_z, gimbal_report->joint_roll, gimbal_report->joint_el, gimbal_report->joint_az);
286#else
287 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_REPORT, (const char *)gimbal_report, MAVLINK_MSG_ID_GIMBAL_REPORT_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_REPORT_LEN, MAVLINK_MSG_ID_GIMBAL_REPORT_CRC);
288#endif
289}
290
291#if MAVLINK_MSG_ID_GIMBAL_REPORT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
292/*
293 This varient of _send() can be used to save stack space by re-using
294 memory from the receive buffer. The caller provides a
295 mavlink_message_t which is the size of a full mavlink message. This
296 is usually the receive buffer for the channel, and allows a reply to an
297 incoming message with minimum stack space usage.
298 */
299static inline void mavlink_msg_gimbal_report_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, float delta_time, float delta_angle_x, float delta_angle_y, float delta_angle_z, float delta_velocity_x, float delta_velocity_y, float delta_velocity_z, float joint_roll, float joint_el, float joint_az)
300{
301#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
302 char *buf = (char *)msgbuf;
303 _mav_put_float(buf, 0, delta_time);
304 _mav_put_float(buf, 4, delta_angle_x);
305 _mav_put_float(buf, 8, delta_angle_y);
306 _mav_put_float(buf, 12, delta_angle_z);
307 _mav_put_float(buf, 16, delta_velocity_x);
308 _mav_put_float(buf, 20, delta_velocity_y);
309 _mav_put_float(buf, 24, delta_velocity_z);
310 _mav_put_float(buf, 28, joint_roll);
311 _mav_put_float(buf, 32, joint_el);
312 _mav_put_float(buf, 36, joint_az);
313 _mav_put_uint8_t(buf, 40, target_system);
314 _mav_put_uint8_t(buf, 41, target_component);
315
316 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_REPORT, buf, MAVLINK_MSG_ID_GIMBAL_REPORT_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_REPORT_LEN, MAVLINK_MSG_ID_GIMBAL_REPORT_CRC);
317#else
318 mavlink_gimbal_report_t *packet = (mavlink_gimbal_report_t *)msgbuf;
319 packet->delta_time = delta_time;
320 packet->delta_angle_x = delta_angle_x;
321 packet->delta_angle_y = delta_angle_y;
322 packet->delta_angle_z = delta_angle_z;
323 packet->delta_velocity_x = delta_velocity_x;
324 packet->delta_velocity_y = delta_velocity_y;
325 packet->delta_velocity_z = delta_velocity_z;
326 packet->joint_roll = joint_roll;
327 packet->joint_el = joint_el;
328 packet->joint_az = joint_az;
329 packet->target_system = target_system;
330 packet->target_component = target_component;
331
332 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_REPORT, (const char *)packet, MAVLINK_MSG_ID_GIMBAL_REPORT_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_REPORT_LEN, MAVLINK_MSG_ID_GIMBAL_REPORT_CRC);
333#endif
334}
335#endif
336
337#endif
338
339// MESSAGE GIMBAL_REPORT UNPACKING
340
341
347static inline uint8_t mavlink_msg_gimbal_report_get_target_system(const mavlink_message_t* msg)
348{
349 return _MAV_RETURN_uint8_t(msg, 40);
350}
351
357static inline uint8_t mavlink_msg_gimbal_report_get_target_component(const mavlink_message_t* msg)
358{
359 return _MAV_RETURN_uint8_t(msg, 41);
360}
361
367static inline float mavlink_msg_gimbal_report_get_delta_time(const mavlink_message_t* msg)
368{
369 return _MAV_RETURN_float(msg, 0);
370}
371
377static inline float mavlink_msg_gimbal_report_get_delta_angle_x(const mavlink_message_t* msg)
378{
379 return _MAV_RETURN_float(msg, 4);
380}
381
387static inline float mavlink_msg_gimbal_report_get_delta_angle_y(const mavlink_message_t* msg)
388{
389 return _MAV_RETURN_float(msg, 8);
390}
391
397static inline float mavlink_msg_gimbal_report_get_delta_angle_z(const mavlink_message_t* msg)
398{
399 return _MAV_RETURN_float(msg, 12);
400}
401
407static inline float mavlink_msg_gimbal_report_get_delta_velocity_x(const mavlink_message_t* msg)
408{
409 return _MAV_RETURN_float(msg, 16);
410}
411
417static inline float mavlink_msg_gimbal_report_get_delta_velocity_y(const mavlink_message_t* msg)
418{
419 return _MAV_RETURN_float(msg, 20);
420}
421
427static inline float mavlink_msg_gimbal_report_get_delta_velocity_z(const mavlink_message_t* msg)
428{
429 return _MAV_RETURN_float(msg, 24);
430}
431
437static inline float mavlink_msg_gimbal_report_get_joint_roll(const mavlink_message_t* msg)
438{
439 return _MAV_RETURN_float(msg, 28);
440}
441
447static inline float mavlink_msg_gimbal_report_get_joint_el(const mavlink_message_t* msg)
448{
449 return _MAV_RETURN_float(msg, 32);
450}
451
457static inline float mavlink_msg_gimbal_report_get_joint_az(const mavlink_message_t* msg)
458{
459 return _MAV_RETURN_float(msg, 36);
460}
461
468static inline void mavlink_msg_gimbal_report_decode(const mavlink_message_t* msg, mavlink_gimbal_report_t* gimbal_report)
469{
470#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
471 gimbal_report->delta_time = mavlink_msg_gimbal_report_get_delta_time(msg);
472 gimbal_report->delta_angle_x = mavlink_msg_gimbal_report_get_delta_angle_x(msg);
473 gimbal_report->delta_angle_y = mavlink_msg_gimbal_report_get_delta_angle_y(msg);
474 gimbal_report->delta_angle_z = mavlink_msg_gimbal_report_get_delta_angle_z(msg);
475 gimbal_report->delta_velocity_x = mavlink_msg_gimbal_report_get_delta_velocity_x(msg);
476 gimbal_report->delta_velocity_y = mavlink_msg_gimbal_report_get_delta_velocity_y(msg);
477 gimbal_report->delta_velocity_z = mavlink_msg_gimbal_report_get_delta_velocity_z(msg);
478 gimbal_report->joint_roll = mavlink_msg_gimbal_report_get_joint_roll(msg);
479 gimbal_report->joint_el = mavlink_msg_gimbal_report_get_joint_el(msg);
480 gimbal_report->joint_az = mavlink_msg_gimbal_report_get_joint_az(msg);
481 gimbal_report->target_system = mavlink_msg_gimbal_report_get_target_system(msg);
482 gimbal_report->target_component = mavlink_msg_gimbal_report_get_target_component(msg);
483#else
484 uint8_t len = msg->len < MAVLINK_MSG_ID_GIMBAL_REPORT_LEN? msg->len : MAVLINK_MSG_ID_GIMBAL_REPORT_LEN;
485 memset(gimbal_report, 0, MAVLINK_MSG_ID_GIMBAL_REPORT_LEN);
486 memcpy(gimbal_report, _MAV_PAYLOAD(msg), len);
487#endif
488}