rosflight/testsuite.h
Go to the documentation of this file.
1 
5 #ifndef ROSFLIGHT_TESTSUITE_H
6 #define ROSFLIGHT_TESTSUITE_H
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 #ifndef MAVLINK_TEST_ALL
13 #define MAVLINK_TEST_ALL
14 static void mavlink_test_common(uint8_t, uint8_t, mavlink_message_t *last_msg);
15 static void mavlink_test_rosflight(uint8_t, uint8_t, mavlink_message_t *last_msg);
16 
17 static void mavlink_test_all(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
18 {
19  mavlink_test_common(system_id, component_id, last_msg);
20  mavlink_test_rosflight(system_id, component_id, last_msg);
21 }
22 #endif
23 
24 #include "../common/testsuite.h"
25 
26 
27 static void mavlink_test_offboard_control(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
28 {
29  mavlink_message_t msg;
30  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
31  uint16_t i;
32  mavlink_offboard_control_t packet_in = {
33  17.0,45.0,73.0,101.0,53,120
34  };
35  mavlink_offboard_control_t packet1, packet2;
36  memset(&packet1, 0, sizeof(packet1));
37  packet1.x = packet_in.x;
38  packet1.y = packet_in.y;
39  packet1.z = packet_in.z;
40  packet1.F = packet_in.F;
41  packet1.mode = packet_in.mode;
42  packet1.ignore = packet_in.ignore;
43 
44 
45 
46  memset(&packet2, 0, sizeof(packet2));
47  mavlink_msg_offboard_control_encode(system_id, component_id, &msg, &packet1);
49  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
50 
51  memset(&packet2, 0, sizeof(packet2));
52  mavlink_msg_offboard_control_pack(system_id, component_id, &msg , packet1.mode , packet1.ignore , packet1.x , packet1.y , packet1.z , packet1.F );
54  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
55 
56  memset(&packet2, 0, sizeof(packet2));
57  mavlink_msg_offboard_control_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.mode , packet1.ignore , packet1.x , packet1.y , packet1.z , packet1.F );
59  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
60 
61  memset(&packet2, 0, sizeof(packet2));
62  mavlink_msg_to_send_buffer(buffer, &msg);
63  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
64  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
65  }
66  mavlink_msg_offboard_control_decode(last_msg, &packet2);
67  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
68 
69  memset(&packet2, 0, sizeof(packet2));
70  mavlink_msg_offboard_control_send(MAVLINK_COMM_1 , packet1.mode , packet1.ignore , packet1.x , packet1.y , packet1.z , packet1.F );
71  mavlink_msg_offboard_control_decode(last_msg, &packet2);
72  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
73 }
74 
75 static void mavlink_test_small_imu(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
76 {
77  mavlink_message_t msg;
78  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
79  uint16_t i;
80  mavlink_small_imu_t packet_in = {
81  93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,241.0
82  };
83  mavlink_small_imu_t packet1, packet2;
84  memset(&packet1, 0, sizeof(packet1));
85  packet1.time_boot_us = packet_in.time_boot_us;
86  packet1.xacc = packet_in.xacc;
87  packet1.yacc = packet_in.yacc;
88  packet1.zacc = packet_in.zacc;
89  packet1.xgyro = packet_in.xgyro;
90  packet1.ygyro = packet_in.ygyro;
91  packet1.zgyro = packet_in.zgyro;
92  packet1.temperature = packet_in.temperature;
93 
94 
95 
96  memset(&packet2, 0, sizeof(packet2));
97  mavlink_msg_small_imu_encode(system_id, component_id, &msg, &packet1);
98  mavlink_msg_small_imu_decode(&msg, &packet2);
99  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
100 
101  memset(&packet2, 0, sizeof(packet2));
102  mavlink_msg_small_imu_pack(system_id, component_id, &msg , packet1.time_boot_us , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.temperature );
103  mavlink_msg_small_imu_decode(&msg, &packet2);
104  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
105 
106  memset(&packet2, 0, sizeof(packet2));
107  mavlink_msg_small_imu_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_us , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.temperature );
108  mavlink_msg_small_imu_decode(&msg, &packet2);
109  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
110 
111  memset(&packet2, 0, sizeof(packet2));
112  mavlink_msg_to_send_buffer(buffer, &msg);
113  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
114  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
115  }
116  mavlink_msg_small_imu_decode(last_msg, &packet2);
117  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
118 
119  memset(&packet2, 0, sizeof(packet2));
120  mavlink_msg_small_imu_send(MAVLINK_COMM_1 , packet1.time_boot_us , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.temperature );
121  mavlink_msg_small_imu_decode(last_msg, &packet2);
122  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
123 }
124 
125 static void mavlink_test_small_mag(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
126 {
127  mavlink_message_t msg;
128  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
129  uint16_t i;
130  mavlink_small_mag_t packet_in = {
131  17.0,45.0,73.0
132  };
133  mavlink_small_mag_t packet1, packet2;
134  memset(&packet1, 0, sizeof(packet1));
135  packet1.xmag = packet_in.xmag;
136  packet1.ymag = packet_in.ymag;
137  packet1.zmag = packet_in.zmag;
138 
139 
140 
141  memset(&packet2, 0, sizeof(packet2));
142  mavlink_msg_small_mag_encode(system_id, component_id, &msg, &packet1);
143  mavlink_msg_small_mag_decode(&msg, &packet2);
144  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
145 
146  memset(&packet2, 0, sizeof(packet2));
147  mavlink_msg_small_mag_pack(system_id, component_id, &msg , packet1.xmag , packet1.ymag , packet1.zmag );
148  mavlink_msg_small_mag_decode(&msg, &packet2);
149  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
150 
151  memset(&packet2, 0, sizeof(packet2));
152  mavlink_msg_small_mag_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.xmag , packet1.ymag , packet1.zmag );
153  mavlink_msg_small_mag_decode(&msg, &packet2);
154  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
155 
156  memset(&packet2, 0, sizeof(packet2));
157  mavlink_msg_to_send_buffer(buffer, &msg);
158  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
159  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
160  }
161  mavlink_msg_small_mag_decode(last_msg, &packet2);
162  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
163 
164  memset(&packet2, 0, sizeof(packet2));
165  mavlink_msg_small_mag_send(MAVLINK_COMM_1 , packet1.xmag , packet1.ymag , packet1.zmag );
166  mavlink_msg_small_mag_decode(last_msg, &packet2);
167  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
168 }
169 
170 static void mavlink_test_small_baro(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
171 {
172  mavlink_message_t msg;
173  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
174  uint16_t i;
175  mavlink_small_baro_t packet_in = {
176  17.0,45.0,73.0
177  };
178  mavlink_small_baro_t packet1, packet2;
179  memset(&packet1, 0, sizeof(packet1));
180  packet1.altitude = packet_in.altitude;
181  packet1.pressure = packet_in.pressure;
182  packet1.temperature = packet_in.temperature;
183 
184 
185 
186  memset(&packet2, 0, sizeof(packet2));
187  mavlink_msg_small_baro_encode(system_id, component_id, &msg, &packet1);
188  mavlink_msg_small_baro_decode(&msg, &packet2);
189  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
190 
191  memset(&packet2, 0, sizeof(packet2));
192  mavlink_msg_small_baro_pack(system_id, component_id, &msg , packet1.altitude , packet1.pressure , packet1.temperature );
193  mavlink_msg_small_baro_decode(&msg, &packet2);
194  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
195 
196  memset(&packet2, 0, sizeof(packet2));
197  mavlink_msg_small_baro_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.altitude , packet1.pressure , packet1.temperature );
198  mavlink_msg_small_baro_decode(&msg, &packet2);
199  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
200 
201  memset(&packet2, 0, sizeof(packet2));
202  mavlink_msg_to_send_buffer(buffer, &msg);
203  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
204  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
205  }
206  mavlink_msg_small_baro_decode(last_msg, &packet2);
207  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
208 
209  memset(&packet2, 0, sizeof(packet2));
210  mavlink_msg_small_baro_send(MAVLINK_COMM_1 , packet1.altitude , packet1.pressure , packet1.temperature );
211  mavlink_msg_small_baro_decode(last_msg, &packet2);
212  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
213 }
214 
215 static void mavlink_test_diff_pressure(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
216 {
217  mavlink_message_t msg;
218  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
219  uint16_t i;
220  mavlink_diff_pressure_t packet_in = {
221  17.0,45.0,73.0
222  };
223  mavlink_diff_pressure_t packet1, packet2;
224  memset(&packet1, 0, sizeof(packet1));
225  packet1.velocity = packet_in.velocity;
226  packet1.diff_pressure = packet_in.diff_pressure;
227  packet1.temperature = packet_in.temperature;
228 
229 
230 
231  memset(&packet2, 0, sizeof(packet2));
232  mavlink_msg_diff_pressure_encode(system_id, component_id, &msg, &packet1);
233  mavlink_msg_diff_pressure_decode(&msg, &packet2);
234  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
235 
236  memset(&packet2, 0, sizeof(packet2));
237  mavlink_msg_diff_pressure_pack(system_id, component_id, &msg , packet1.velocity , packet1.diff_pressure , packet1.temperature );
238  mavlink_msg_diff_pressure_decode(&msg, &packet2);
239  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
240 
241  memset(&packet2, 0, sizeof(packet2));
242  mavlink_msg_diff_pressure_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.velocity , packet1.diff_pressure , packet1.temperature );
243  mavlink_msg_diff_pressure_decode(&msg, &packet2);
244  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
245 
246  memset(&packet2, 0, sizeof(packet2));
247  mavlink_msg_to_send_buffer(buffer, &msg);
248  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
249  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
250  }
251  mavlink_msg_diff_pressure_decode(last_msg, &packet2);
252  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
253 
254  memset(&packet2, 0, sizeof(packet2));
255  mavlink_msg_diff_pressure_send(MAVLINK_COMM_1 , packet1.velocity , packet1.diff_pressure , packet1.temperature );
256  mavlink_msg_diff_pressure_decode(last_msg, &packet2);
257  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
258 }
259 
260 static void mavlink_test_camera_stamped_small_imu(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
261 {
262  mavlink_message_t msg;
263  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
264  uint16_t i;
266  93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,241.0,113
267  };
268  mavlink_camera_stamped_small_imu_t packet1, packet2;
269  memset(&packet1, 0, sizeof(packet1));
270  packet1.time_boot_us = packet_in.time_boot_us;
271  packet1.xacc = packet_in.xacc;
272  packet1.yacc = packet_in.yacc;
273  packet1.zacc = packet_in.zacc;
274  packet1.xgyro = packet_in.xgyro;
275  packet1.ygyro = packet_in.ygyro;
276  packet1.zgyro = packet_in.zgyro;
277  packet1.temperature = packet_in.temperature;
278  packet1.image = packet_in.image;
279 
280 
281 
282  memset(&packet2, 0, sizeof(packet2));
283  mavlink_msg_camera_stamped_small_imu_encode(system_id, component_id, &msg, &packet1);
285  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
286 
287  memset(&packet2, 0, sizeof(packet2));
288  mavlink_msg_camera_stamped_small_imu_pack(system_id, component_id, &msg , packet1.time_boot_us , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.temperature , packet1.image );
290  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
291 
292  memset(&packet2, 0, sizeof(packet2));
293  mavlink_msg_camera_stamped_small_imu_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_us , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.temperature , packet1.image );
295  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
296 
297  memset(&packet2, 0, sizeof(packet2));
298  mavlink_msg_to_send_buffer(buffer, &msg);
299  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
300  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
301  }
303  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
304 
305  memset(&packet2, 0, sizeof(packet2));
306  mavlink_msg_camera_stamped_small_imu_send(MAVLINK_COMM_1 , packet1.time_boot_us , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.temperature , packet1.image );
308  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
309 }
310 
311 static void mavlink_test_named_command_struct(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
312 {
313  mavlink_message_t msg;
314  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
315  uint16_t i;
316  mavlink_named_command_struct_t packet_in = {
317  17.0,45.0,73.0,101.0,"QRSTUVWXY",211,22
318  };
319  mavlink_named_command_struct_t packet1, packet2;
320  memset(&packet1, 0, sizeof(packet1));
321  packet1.x = packet_in.x;
322  packet1.y = packet_in.y;
323  packet1.z = packet_in.z;
324  packet1.F = packet_in.F;
325  packet1.type = packet_in.type;
326  packet1.ignore = packet_in.ignore;
327 
328  mav_array_memcpy(packet1.name, packet_in.name, sizeof(char)*10);
329 
330 
331  memset(&packet2, 0, sizeof(packet2));
332  mavlink_msg_named_command_struct_encode(system_id, component_id, &msg, &packet1);
334  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
335 
336  memset(&packet2, 0, sizeof(packet2));
337  mavlink_msg_named_command_struct_pack(system_id, component_id, &msg , packet1.name , packet1.type , packet1.ignore , packet1.x , packet1.y , packet1.z , packet1.F );
339  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
340 
341  memset(&packet2, 0, sizeof(packet2));
342  mavlink_msg_named_command_struct_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.name , packet1.type , packet1.ignore , packet1.x , packet1.y , packet1.z , packet1.F );
344  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
345 
346  memset(&packet2, 0, sizeof(packet2));
347  mavlink_msg_to_send_buffer(buffer, &msg);
348  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
349  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
350  }
351  mavlink_msg_named_command_struct_decode(last_msg, &packet2);
352  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
353 
354  memset(&packet2, 0, sizeof(packet2));
355  mavlink_msg_named_command_struct_send(MAVLINK_COMM_1 , packet1.name , packet1.type , packet1.ignore , packet1.x , packet1.y , packet1.z , packet1.F );
356  mavlink_msg_named_command_struct_decode(last_msg, &packet2);
357  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
358 }
359 
360 static void mavlink_test_small_range(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
361 {
362  mavlink_message_t msg;
363  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
364  uint16_t i;
365  mavlink_small_range_t packet_in = {
366  17.0,45.0,73.0,41
367  };
368  mavlink_small_range_t packet1, packet2;
369  memset(&packet1, 0, sizeof(packet1));
370  packet1.range = packet_in.range;
371  packet1.max_range = packet_in.max_range;
372  packet1.min_range = packet_in.min_range;
373  packet1.type = packet_in.type;
374 
375 
376 
377  memset(&packet2, 0, sizeof(packet2));
378  mavlink_msg_small_range_encode(system_id, component_id, &msg, &packet1);
379  mavlink_msg_small_range_decode(&msg, &packet2);
380  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
381 
382  memset(&packet2, 0, sizeof(packet2));
383  mavlink_msg_small_range_pack(system_id, component_id, &msg , packet1.type , packet1.range , packet1.max_range , packet1.min_range );
384  mavlink_msg_small_range_decode(&msg, &packet2);
385  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
386 
387  memset(&packet2, 0, sizeof(packet2));
388  mavlink_msg_small_range_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.type , packet1.range , packet1.max_range , packet1.min_range );
389  mavlink_msg_small_range_decode(&msg, &packet2);
390  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
391 
392  memset(&packet2, 0, sizeof(packet2));
393  mavlink_msg_to_send_buffer(buffer, &msg);
394  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
395  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
396  }
397  mavlink_msg_small_range_decode(last_msg, &packet2);
398  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
399 
400  memset(&packet2, 0, sizeof(packet2));
401  mavlink_msg_small_range_send(MAVLINK_COMM_1 , packet1.type , packet1.range , packet1.max_range , packet1.min_range );
402  mavlink_msg_small_range_decode(last_msg, &packet2);
403  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
404 }
405 
406 static void mavlink_test_rosflight_cmd(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
407 {
408  mavlink_message_t msg;
409  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
410  uint16_t i;
411  mavlink_rosflight_cmd_t packet_in = {
412  5
413  };
414  mavlink_rosflight_cmd_t packet1, packet2;
415  memset(&packet1, 0, sizeof(packet1));
416  packet1.command = packet_in.command;
417 
418 
419 
420  memset(&packet2, 0, sizeof(packet2));
421  mavlink_msg_rosflight_cmd_encode(system_id, component_id, &msg, &packet1);
422  mavlink_msg_rosflight_cmd_decode(&msg, &packet2);
423  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
424 
425  memset(&packet2, 0, sizeof(packet2));
426  mavlink_msg_rosflight_cmd_pack(system_id, component_id, &msg , packet1.command );
427  mavlink_msg_rosflight_cmd_decode(&msg, &packet2);
428  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
429 
430  memset(&packet2, 0, sizeof(packet2));
431  mavlink_msg_rosflight_cmd_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.command );
432  mavlink_msg_rosflight_cmd_decode(&msg, &packet2);
433  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
434 
435  memset(&packet2, 0, sizeof(packet2));
436  mavlink_msg_to_send_buffer(buffer, &msg);
437  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
438  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
439  }
440  mavlink_msg_rosflight_cmd_decode(last_msg, &packet2);
441  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
442 
443  memset(&packet2, 0, sizeof(packet2));
444  mavlink_msg_rosflight_cmd_send(MAVLINK_COMM_1 , packet1.command );
445  mavlink_msg_rosflight_cmd_decode(last_msg, &packet2);
446  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
447 }
448 
449 static void mavlink_test_rosflight_cmd_ack(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
450 {
451  mavlink_message_t msg;
452  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
453  uint16_t i;
454  mavlink_rosflight_cmd_ack_t packet_in = {
455  5,72
456  };
457  mavlink_rosflight_cmd_ack_t packet1, packet2;
458  memset(&packet1, 0, sizeof(packet1));
459  packet1.command = packet_in.command;
460  packet1.success = packet_in.success;
461 
462 
463 
464  memset(&packet2, 0, sizeof(packet2));
465  mavlink_msg_rosflight_cmd_ack_encode(system_id, component_id, &msg, &packet1);
466  mavlink_msg_rosflight_cmd_ack_decode(&msg, &packet2);
467  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
468 
469  memset(&packet2, 0, sizeof(packet2));
470  mavlink_msg_rosflight_cmd_ack_pack(system_id, component_id, &msg , packet1.command , packet1.success );
471  mavlink_msg_rosflight_cmd_ack_decode(&msg, &packet2);
472  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
473 
474  memset(&packet2, 0, sizeof(packet2));
475  mavlink_msg_rosflight_cmd_ack_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.command , packet1.success );
476  mavlink_msg_rosflight_cmd_ack_decode(&msg, &packet2);
477  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
478 
479  memset(&packet2, 0, sizeof(packet2));
480  mavlink_msg_to_send_buffer(buffer, &msg);
481  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
482  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
483  }
484  mavlink_msg_rosflight_cmd_ack_decode(last_msg, &packet2);
485  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
486 
487  memset(&packet2, 0, sizeof(packet2));
488  mavlink_msg_rosflight_cmd_ack_send(MAVLINK_COMM_1 , packet1.command , packet1.success );
489  mavlink_msg_rosflight_cmd_ack_decode(last_msg, &packet2);
490  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
491 }
492 
493 static void mavlink_test_rosflight_output_raw(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
494 {
495  mavlink_message_t msg;
496  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
497  uint16_t i;
498  mavlink_rosflight_output_raw_t packet_in = {
499  93372036854775807ULL,{ 73.0, 74.0, 75.0, 76.0, 77.0, 78.0, 79.0, 80.0 }
500  };
501  mavlink_rosflight_output_raw_t packet1, packet2;
502  memset(&packet1, 0, sizeof(packet1));
503  packet1.stamp = packet_in.stamp;
504 
505  mav_array_memcpy(packet1.values, packet_in.values, sizeof(float)*8);
506 
507 
508  memset(&packet2, 0, sizeof(packet2));
509  mavlink_msg_rosflight_output_raw_encode(system_id, component_id, &msg, &packet1);
511  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
512 
513  memset(&packet2, 0, sizeof(packet2));
514  mavlink_msg_rosflight_output_raw_pack(system_id, component_id, &msg , packet1.stamp , packet1.values );
516  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
517 
518  memset(&packet2, 0, sizeof(packet2));
519  mavlink_msg_rosflight_output_raw_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.stamp , packet1.values );
521  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
522 
523  memset(&packet2, 0, sizeof(packet2));
524  mavlink_msg_to_send_buffer(buffer, &msg);
525  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
526  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
527  }
528  mavlink_msg_rosflight_output_raw_decode(last_msg, &packet2);
529  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
530 
531  memset(&packet2, 0, sizeof(packet2));
532  mavlink_msg_rosflight_output_raw_send(MAVLINK_COMM_1 , packet1.stamp , packet1.values );
533  mavlink_msg_rosflight_output_raw_decode(last_msg, &packet2);
534  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
535 }
536 
537 static void mavlink_test_rosflight_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
538 {
539  mavlink_message_t msg;
540  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
541  uint16_t i;
542  mavlink_rosflight_status_t packet_in = {
543  17235,17339,17,84,151,218,29,96
544  };
545  mavlink_rosflight_status_t packet1, packet2;
546  memset(&packet1, 0, sizeof(packet1));
547  packet1.num_errors = packet_in.num_errors;
548  packet1.loop_time_us = packet_in.loop_time_us;
549  packet1.armed = packet_in.armed;
550  packet1.failsafe = packet_in.failsafe;
551  packet1.rc_override = packet_in.rc_override;
552  packet1.offboard = packet_in.offboard;
553  packet1.error_code = packet_in.error_code;
554  packet1.control_mode = packet_in.control_mode;
555 
556 
557 
558  memset(&packet2, 0, sizeof(packet2));
559  mavlink_msg_rosflight_status_encode(system_id, component_id, &msg, &packet1);
560  mavlink_msg_rosflight_status_decode(&msg, &packet2);
561  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
562 
563  memset(&packet2, 0, sizeof(packet2));
564  mavlink_msg_rosflight_status_pack(system_id, component_id, &msg , packet1.armed , packet1.failsafe , packet1.rc_override , packet1.offboard , packet1.error_code , packet1.control_mode , packet1.num_errors , packet1.loop_time_us );
565  mavlink_msg_rosflight_status_decode(&msg, &packet2);
566  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
567 
568  memset(&packet2, 0, sizeof(packet2));
569  mavlink_msg_rosflight_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.armed , packet1.failsafe , packet1.rc_override , packet1.offboard , packet1.error_code , packet1.control_mode , packet1.num_errors , packet1.loop_time_us );
570  mavlink_msg_rosflight_status_decode(&msg, &packet2);
571  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
572 
573  memset(&packet2, 0, sizeof(packet2));
574  mavlink_msg_to_send_buffer(buffer, &msg);
575  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
576  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
577  }
578  mavlink_msg_rosflight_status_decode(last_msg, &packet2);
579  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
580 
581  memset(&packet2, 0, sizeof(packet2));
582  mavlink_msg_rosflight_status_send(MAVLINK_COMM_1 , packet1.armed , packet1.failsafe , packet1.rc_override , packet1.offboard , packet1.error_code , packet1.control_mode , packet1.num_errors , packet1.loop_time_us );
583  mavlink_msg_rosflight_status_decode(last_msg, &packet2);
584  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
585 }
586 
587 static void mavlink_test_rosflight_version(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
588 {
589  mavlink_message_t msg;
590  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
591  uint16_t i;
592  mavlink_rosflight_version_t packet_in = {
593  "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVW"
594  };
595  mavlink_rosflight_version_t packet1, packet2;
596  memset(&packet1, 0, sizeof(packet1));
597 
598  mav_array_memcpy(packet1.version, packet_in.version, sizeof(char)*50);
599 
600 
601  memset(&packet2, 0, sizeof(packet2));
602  mavlink_msg_rosflight_version_encode(system_id, component_id, &msg, &packet1);
603  mavlink_msg_rosflight_version_decode(&msg, &packet2);
604  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
605 
606  memset(&packet2, 0, sizeof(packet2));
607  mavlink_msg_rosflight_version_pack(system_id, component_id, &msg , packet1.version );
608  mavlink_msg_rosflight_version_decode(&msg, &packet2);
609  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
610 
611  memset(&packet2, 0, sizeof(packet2));
612  mavlink_msg_rosflight_version_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.version );
613  mavlink_msg_rosflight_version_decode(&msg, &packet2);
614  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
615 
616  memset(&packet2, 0, sizeof(packet2));
617  mavlink_msg_to_send_buffer(buffer, &msg);
618  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
619  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
620  }
621  mavlink_msg_rosflight_version_decode(last_msg, &packet2);
622  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
623 
624  memset(&packet2, 0, sizeof(packet2));
625  mavlink_msg_rosflight_version_send(MAVLINK_COMM_1 , packet1.version );
626  mavlink_msg_rosflight_version_decode(last_msg, &packet2);
627  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
628 }
629 
630 static void mavlink_test_rosflight_aux_cmd(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
631 {
632  mavlink_message_t msg;
633  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
634  uint16_t i;
635  mavlink_rosflight_aux_cmd_t packet_in = {
636  { 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0 },{ 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186 }
637  };
638  mavlink_rosflight_aux_cmd_t packet1, packet2;
639  memset(&packet1, 0, sizeof(packet1));
640 
641  mav_array_memcpy(packet1.aux_cmd_array, packet_in.aux_cmd_array, sizeof(float)*14);
642  mav_array_memcpy(packet1.type_array, packet_in.type_array, sizeof(uint8_t)*14);
643 
644 
645  memset(&packet2, 0, sizeof(packet2));
646  mavlink_msg_rosflight_aux_cmd_encode(system_id, component_id, &msg, &packet1);
647  mavlink_msg_rosflight_aux_cmd_decode(&msg, &packet2);
648  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
649 
650  memset(&packet2, 0, sizeof(packet2));
651  mavlink_msg_rosflight_aux_cmd_pack(system_id, component_id, &msg , packet1.type_array , packet1.aux_cmd_array );
652  mavlink_msg_rosflight_aux_cmd_decode(&msg, &packet2);
653  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
654 
655  memset(&packet2, 0, sizeof(packet2));
656  mavlink_msg_rosflight_aux_cmd_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.type_array , packet1.aux_cmd_array );
657  mavlink_msg_rosflight_aux_cmd_decode(&msg, &packet2);
658  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
659 
660  memset(&packet2, 0, sizeof(packet2));
661  mavlink_msg_to_send_buffer(buffer, &msg);
662  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
663  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
664  }
665  mavlink_msg_rosflight_aux_cmd_decode(last_msg, &packet2);
666  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
667 
668  memset(&packet2, 0, sizeof(packet2));
669  mavlink_msg_rosflight_aux_cmd_send(MAVLINK_COMM_1 , packet1.type_array , packet1.aux_cmd_array );
670  mavlink_msg_rosflight_aux_cmd_decode(last_msg, &packet2);
671  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
672 }
673 
674 static void mavlink_test_rosflight_ins(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
675 {
676  mavlink_message_t msg;
677  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
678  uint16_t i;
679  mavlink_rosflight_ins_t packet_in = {
680  17.0,45.0,73.0,101.0,129.0,157.0,185.0,213.0,241.0,269.0,297.0,325.0,353.0
681  };
682  mavlink_rosflight_ins_t packet1, packet2;
683  memset(&packet1, 0, sizeof(packet1));
684  packet1.pos_north = packet_in.pos_north;
685  packet1.pos_east = packet_in.pos_east;
686  packet1.pos_down = packet_in.pos_down;
687  packet1.qw = packet_in.qw;
688  packet1.qx = packet_in.qx;
689  packet1.qy = packet_in.qy;
690  packet1.qz = packet_in.qz;
691  packet1.u = packet_in.u;
692  packet1.v = packet_in.v;
693  packet1.w = packet_in.w;
694  packet1.p = packet_in.p;
695  packet1.q = packet_in.q;
696  packet1.r = packet_in.r;
697 
698 
699 
700  memset(&packet2, 0, sizeof(packet2));
701  mavlink_msg_rosflight_ins_encode(system_id, component_id, &msg, &packet1);
702  mavlink_msg_rosflight_ins_decode(&msg, &packet2);
703  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
704 
705  memset(&packet2, 0, sizeof(packet2));
706  mavlink_msg_rosflight_ins_pack(system_id, component_id, &msg , packet1.pos_north , packet1.pos_east , packet1.pos_down , packet1.qw , packet1.qx , packet1.qy , packet1.qz , packet1.u , packet1.v , packet1.w , packet1.p , packet1.q , packet1.r );
707  mavlink_msg_rosflight_ins_decode(&msg, &packet2);
708  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
709 
710  memset(&packet2, 0, sizeof(packet2));
711  mavlink_msg_rosflight_ins_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.pos_north , packet1.pos_east , packet1.pos_down , packet1.qw , packet1.qx , packet1.qy , packet1.qz , packet1.u , packet1.v , packet1.w , packet1.p , packet1.q , packet1.r );
712  mavlink_msg_rosflight_ins_decode(&msg, &packet2);
713  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
714 
715  memset(&packet2, 0, sizeof(packet2));
716  mavlink_msg_to_send_buffer(buffer, &msg);
717  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
718  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
719  }
720  mavlink_msg_rosflight_ins_decode(last_msg, &packet2);
721  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
722 
723  memset(&packet2, 0, sizeof(packet2));
724  mavlink_msg_rosflight_ins_send(MAVLINK_COMM_1 , packet1.pos_north , packet1.pos_east , packet1.pos_down , packet1.qw , packet1.qx , packet1.qy , packet1.qz , packet1.u , packet1.v , packet1.w , packet1.p , packet1.q , packet1.r );
725  mavlink_msg_rosflight_ins_decode(last_msg, &packet2);
726  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
727 }
728 
729 static void mavlink_test_attitude_correction(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
730 {
731  mavlink_message_t msg;
732  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
733  uint16_t i;
734  mavlink_attitude_correction_t packet_in = {
735  17.0,45.0,73.0,101.0
736  };
737  mavlink_attitude_correction_t packet1, packet2;
738  memset(&packet1, 0, sizeof(packet1));
739  packet1.qw = packet_in.qw;
740  packet1.qx = packet_in.qx;
741  packet1.qy = packet_in.qy;
742  packet1.qz = packet_in.qz;
743 
744 
745 
746  memset(&packet2, 0, sizeof(packet2));
747  mavlink_msg_attitude_correction_encode(system_id, component_id, &msg, &packet1);
749  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
750 
751  memset(&packet2, 0, sizeof(packet2));
752  mavlink_msg_attitude_correction_pack(system_id, component_id, &msg , packet1.qw , packet1.qx , packet1.qy , packet1.qz );
754  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
755 
756  memset(&packet2, 0, sizeof(packet2));
757  mavlink_msg_attitude_correction_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.qw , packet1.qx , packet1.qy , packet1.qz );
759  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
760 
761  memset(&packet2, 0, sizeof(packet2));
762  mavlink_msg_to_send_buffer(buffer, &msg);
763  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
764  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
765  }
766  mavlink_msg_attitude_correction_decode(last_msg, &packet2);
767  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
768 
769  memset(&packet2, 0, sizeof(packet2));
770  mavlink_msg_attitude_correction_send(MAVLINK_COMM_1 , packet1.qw , packet1.qx , packet1.qy , packet1.qz );
771  mavlink_msg_attitude_correction_decode(last_msg, &packet2);
772  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
773 }
774 
775 static void mavlink_test_rosflight_hard_error(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
776 {
777  mavlink_message_t msg;
778  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
779  uint16_t i;
780  mavlink_rosflight_hard_error_t packet_in = {
781  963497464,963497672,963497880,963498088
782  };
783  mavlink_rosflight_hard_error_t packet1, packet2;
784  memset(&packet1, 0, sizeof(packet1));
785  packet1.error_code = packet_in.error_code;
786  packet1.pc = packet_in.pc;
787  packet1.reset_count = packet_in.reset_count;
788  packet1.doRearm = packet_in.doRearm;
789 
790 
791 
792  memset(&packet2, 0, sizeof(packet2));
793  mavlink_msg_rosflight_hard_error_encode(system_id, component_id, &msg, &packet1);
795  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
796 
797  memset(&packet2, 0, sizeof(packet2));
798  mavlink_msg_rosflight_hard_error_pack(system_id, component_id, &msg , packet1.error_code , packet1.pc , packet1.reset_count , packet1.doRearm );
800  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
801 
802  memset(&packet2, 0, sizeof(packet2));
803  mavlink_msg_rosflight_hard_error_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.error_code , packet1.pc , packet1.reset_count , packet1.doRearm );
805  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
806 
807  memset(&packet2, 0, sizeof(packet2));
808  mavlink_msg_to_send_buffer(buffer, &msg);
809  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
810  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
811  }
812  mavlink_msg_rosflight_hard_error_decode(last_msg, &packet2);
813  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
814 
815  memset(&packet2, 0, sizeof(packet2));
816  mavlink_msg_rosflight_hard_error_send(MAVLINK_COMM_1 , packet1.error_code , packet1.pc , packet1.reset_count , packet1.doRearm );
817  mavlink_msg_rosflight_hard_error_decode(last_msg, &packet2);
818  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
819 }
820 
821 static void mavlink_test_rosflight_gnss(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
822 {
823  mavlink_message_t msg;
824  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
825  uint16_t i;
826  mavlink_rosflight_gnss_t packet_in = {
827  93372036854775807ULL,93372036854776311ULL,93372036854776815ULL,963498712,963498920,963499128,963499336,963499544,963499752,963499960,963500168,963500376,963500584,963500792,963501000,963501208,963501416,963501624,963501832,963502040,25
828  };
829  mavlink_rosflight_gnss_t packet1, packet2;
830  memset(&packet1, 0, sizeof(packet1));
831  packet1.time = packet_in.time;
832  packet1.nanos = packet_in.nanos;
833  packet1.rosflight_timestamp = packet_in.rosflight_timestamp;
834  packet1.time_of_week = packet_in.time_of_week;
835  packet1.lat = packet_in.lat;
836  packet1.lon = packet_in.lon;
837  packet1.height = packet_in.height;
838  packet1.vel_n = packet_in.vel_n;
839  packet1.vel_e = packet_in.vel_e;
840  packet1.vel_d = packet_in.vel_d;
841  packet1.h_acc = packet_in.h_acc;
842  packet1.v_acc = packet_in.v_acc;
843  packet1.ecef_x = packet_in.ecef_x;
844  packet1.ecef_y = packet_in.ecef_y;
845  packet1.ecef_z = packet_in.ecef_z;
846  packet1.p_acc = packet_in.p_acc;
847  packet1.ecef_v_x = packet_in.ecef_v_x;
848  packet1.ecef_v_y = packet_in.ecef_v_y;
849  packet1.ecef_v_z = packet_in.ecef_v_z;
850  packet1.s_acc = packet_in.s_acc;
851  packet1.fix_type = packet_in.fix_type;
852 
853 
854 
855  memset(&packet2, 0, sizeof(packet2));
856  mavlink_msg_rosflight_gnss_encode(system_id, component_id, &msg, &packet1);
857  mavlink_msg_rosflight_gnss_decode(&msg, &packet2);
858  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
859 
860  memset(&packet2, 0, sizeof(packet2));
861  mavlink_msg_rosflight_gnss_pack(system_id, component_id, &msg , packet1.time_of_week , packet1.fix_type , packet1.time , packet1.nanos , packet1.lat , packet1.lon , packet1.height , packet1.vel_n , packet1.vel_e , packet1.vel_d , packet1.h_acc , packet1.v_acc , packet1.ecef_x , packet1.ecef_y , packet1.ecef_z , packet1.p_acc , packet1.ecef_v_x , packet1.ecef_v_y , packet1.ecef_v_z , packet1.s_acc , packet1.rosflight_timestamp );
862  mavlink_msg_rosflight_gnss_decode(&msg, &packet2);
863  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
864 
865  memset(&packet2, 0, sizeof(packet2));
866  mavlink_msg_rosflight_gnss_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_of_week , packet1.fix_type , packet1.time , packet1.nanos , packet1.lat , packet1.lon , packet1.height , packet1.vel_n , packet1.vel_e , packet1.vel_d , packet1.h_acc , packet1.v_acc , packet1.ecef_x , packet1.ecef_y , packet1.ecef_z , packet1.p_acc , packet1.ecef_v_x , packet1.ecef_v_y , packet1.ecef_v_z , packet1.s_acc , packet1.rosflight_timestamp );
867  mavlink_msg_rosflight_gnss_decode(&msg, &packet2);
868  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
869 
870  memset(&packet2, 0, sizeof(packet2));
871  mavlink_msg_to_send_buffer(buffer, &msg);
872  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
873  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
874  }
875  mavlink_msg_rosflight_gnss_decode(last_msg, &packet2);
876  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
877 
878  memset(&packet2, 0, sizeof(packet2));
879  mavlink_msg_rosflight_gnss_send(MAVLINK_COMM_1 , packet1.time_of_week , packet1.fix_type , packet1.time , packet1.nanos , packet1.lat , packet1.lon , packet1.height , packet1.vel_n , packet1.vel_e , packet1.vel_d , packet1.h_acc , packet1.v_acc , packet1.ecef_x , packet1.ecef_y , packet1.ecef_z , packet1.p_acc , packet1.ecef_v_x , packet1.ecef_v_y , packet1.ecef_v_z , packet1.s_acc , packet1.rosflight_timestamp );
880  mavlink_msg_rosflight_gnss_decode(last_msg, &packet2);
881  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
882 }
883 
884 static void mavlink_test_rosflight_gnss_raw(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
885 {
886  mavlink_message_t msg;
887  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
888  uint16_t i;
889  mavlink_rosflight_gnss_raw_t packet_in = {
890  93372036854775807ULL,963497880,963498088,963498296,963498504,963498712,963498920,963499128,963499336,963499544,963499752,963499960,963500168,963500376,963500584,963500792,963501000,20979,21083,233,44,111,178,245,56,123,190
891  };
892  mavlink_rosflight_gnss_raw_t packet1, packet2;
893  memset(&packet1, 0, sizeof(packet1));
894  packet1.rosflight_timestamp = packet_in.rosflight_timestamp;
895  packet1.time_of_week = packet_in.time_of_week;
896  packet1.t_acc = packet_in.t_acc;
897  packet1.nano = packet_in.nano;
898  packet1.lon = packet_in.lon;
899  packet1.lat = packet_in.lat;
900  packet1.height = packet_in.height;
901  packet1.height_msl = packet_in.height_msl;
902  packet1.h_acc = packet_in.h_acc;
903  packet1.v_acc = packet_in.v_acc;
904  packet1.vel_n = packet_in.vel_n;
905  packet1.vel_e = packet_in.vel_e;
906  packet1.vel_d = packet_in.vel_d;
907  packet1.g_speed = packet_in.g_speed;
908  packet1.head_mot = packet_in.head_mot;
909  packet1.s_acc = packet_in.s_acc;
910  packet1.head_acc = packet_in.head_acc;
911  packet1.year = packet_in.year;
912  packet1.p_dop = packet_in.p_dop;
913  packet1.month = packet_in.month;
914  packet1.day = packet_in.day;
915  packet1.hour = packet_in.hour;
916  packet1.min = packet_in.min;
917  packet1.sec = packet_in.sec;
918  packet1.valid = packet_in.valid;
919  packet1.fix_type = packet_in.fix_type;
920  packet1.num_sat = packet_in.num_sat;
921 
922 
923 
924  memset(&packet2, 0, sizeof(packet2));
925  mavlink_msg_rosflight_gnss_raw_encode(system_id, component_id, &msg, &packet1);
927  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
928 
929  memset(&packet2, 0, sizeof(packet2));
930  mavlink_msg_rosflight_gnss_raw_pack(system_id, component_id, &msg , packet1.time_of_week , packet1.year , packet1.month , packet1.day , packet1.hour , packet1.min , packet1.sec , packet1.valid , packet1.t_acc , packet1.nano , packet1.fix_type , packet1.num_sat , packet1.lon , packet1.lat , packet1.height , packet1.height_msl , packet1.h_acc , packet1.v_acc , packet1.vel_n , packet1.vel_e , packet1.vel_d , packet1.g_speed , packet1.head_mot , packet1.s_acc , packet1.head_acc , packet1.p_dop , packet1.rosflight_timestamp );
932  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
933 
934  memset(&packet2, 0, sizeof(packet2));
935  mavlink_msg_rosflight_gnss_raw_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_of_week , packet1.year , packet1.month , packet1.day , packet1.hour , packet1.min , packet1.sec , packet1.valid , packet1.t_acc , packet1.nano , packet1.fix_type , packet1.num_sat , packet1.lon , packet1.lat , packet1.height , packet1.height_msl , packet1.h_acc , packet1.v_acc , packet1.vel_n , packet1.vel_e , packet1.vel_d , packet1.g_speed , packet1.head_mot , packet1.s_acc , packet1.head_acc , packet1.p_dop , packet1.rosflight_timestamp );
937  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
938 
939  memset(&packet2, 0, sizeof(packet2));
940  mavlink_msg_to_send_buffer(buffer, &msg);
941  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
942  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
943  }
944  mavlink_msg_rosflight_gnss_raw_decode(last_msg, &packet2);
945  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
946 
947  memset(&packet2, 0, sizeof(packet2));
948  mavlink_msg_rosflight_gnss_raw_send(MAVLINK_COMM_1 , packet1.time_of_week , packet1.year , packet1.month , packet1.day , packet1.hour , packet1.min , packet1.sec , packet1.valid , packet1.t_acc , packet1.nano , packet1.fix_type , packet1.num_sat , packet1.lon , packet1.lat , packet1.height , packet1.height_msl , packet1.h_acc , packet1.v_acc , packet1.vel_n , packet1.vel_e , packet1.vel_d , packet1.g_speed , packet1.head_mot , packet1.s_acc , packet1.head_acc , packet1.p_dop , packet1.rosflight_timestamp );
949  mavlink_msg_rosflight_gnss_raw_decode(last_msg, &packet2);
950  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
951 }
952 
953 static void mavlink_test_rosflight(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
954 {
955  mavlink_test_offboard_control(system_id, component_id, last_msg);
956  mavlink_test_small_imu(system_id, component_id, last_msg);
957  mavlink_test_small_mag(system_id, component_id, last_msg);
958  mavlink_test_small_baro(system_id, component_id, last_msg);
959  mavlink_test_diff_pressure(system_id, component_id, last_msg);
960  mavlink_test_camera_stamped_small_imu(system_id, component_id, last_msg);
961  mavlink_test_named_command_struct(system_id, component_id, last_msg);
962  mavlink_test_small_range(system_id, component_id, last_msg);
963  mavlink_test_rosflight_cmd(system_id, component_id, last_msg);
964  mavlink_test_rosflight_cmd_ack(system_id, component_id, last_msg);
965  mavlink_test_rosflight_output_raw(system_id, component_id, last_msg);
966  mavlink_test_rosflight_status(system_id, component_id, last_msg);
967  mavlink_test_rosflight_version(system_id, component_id, last_msg);
968  mavlink_test_rosflight_aux_cmd(system_id, component_id, last_msg);
969  mavlink_test_rosflight_ins(system_id, component_id, last_msg);
970  mavlink_test_attitude_correction(system_id, component_id, last_msg);
971  mavlink_test_rosflight_hard_error(system_id, component_id, last_msg);
972  mavlink_test_rosflight_gnss(system_id, component_id, last_msg);
973  mavlink_test_rosflight_gnss_raw(system_id, component_id, last_msg);
974 }
975 
976 #ifdef __cplusplus
977 }
978 #endif // __cplusplus
979 #endif // ROSFLIGHT_TESTSUITE_H
static void mavlink_test_rosflight_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
static void mavlink_test_rosflight_cmd_ack(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
static void mavlink_test_small_baro(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
static void mavlink_test_rosflight_gnss_raw(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
static uint16_t mavlink_msg_get_send_buffer_length(const mavlink_message_t *msg)
Get the required buffer size for this message.
Definition: protocol.h:92
static void mavlink_test_rosflight(uint8_t, uint8_t, mavlink_message_t *last_msg)
static void mavlink_test_rosflight_output_raw(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
static void mavlink_test_camera_stamped_small_imu(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
static void mavlink_test_common(uint8_t, uint8_t, mavlink_message_t *last_msg)
static void mavlink_test_small_imu(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
#define MAVLINK_ASSERT(x)
Definition: protocol.h:26
static void mavlink_test_rosflight_gnss(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
static void mavlink_test_attitude_correction(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
static void mavlink_test_small_range(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
static void mavlink_test_rosflight_version(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
static void mavlink_test_offboard_control(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
static void mav_array_memcpy(void *dest, const void *src, size_t n)
Definition: protocol.h:176
static void mavlink_test_rosflight_hard_error(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
static void mavlink_test_all(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
static void mavlink_test_rosflight_cmd(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
static void mavlink_test_diff_pressure(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
static void mavlink_test_rosflight_aux_cmd(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
static void mavlink_test_small_mag(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
static void mavlink_test_rosflight_ins(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
static void mavlink_test_named_command_struct(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)


rosflight
Author(s): Daniel Koch , James Jackson
autogenerated on Wed Jul 3 2019 20:00:13