Mavlink Messages for Emaxx Nav Board
Dependents: Madpulse_Speed_Control_temp Madpulse_Speed_Control_Students
emaxx_board/testsuite.h@0:bb2cacd02294, 2017-01-20 (annotated)
- Committer:
- jdawkins
- Date:
- Fri Jan 20 13:20:58 2017 +0000
- Revision:
- 0:bb2cacd02294
Initial Commit of Mavlink Messages for Emaxx Board custom messages for decawave ranging and bno055;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jdawkins | 0:bb2cacd02294 | 1 | /** @file |
jdawkins | 0:bb2cacd02294 | 2 | * @brief MAVLink comm protocol testsuite generated from emaxx_board.xml |
jdawkins | 0:bb2cacd02294 | 3 | * @see http://qgroundcontrol.org/mavlink/ |
jdawkins | 0:bb2cacd02294 | 4 | */ |
jdawkins | 0:bb2cacd02294 | 5 | #pragma once |
jdawkins | 0:bb2cacd02294 | 6 | #ifndef EMAXX_BOARD_TESTSUITE_H |
jdawkins | 0:bb2cacd02294 | 7 | #define EMAXX_BOARD_TESTSUITE_H |
jdawkins | 0:bb2cacd02294 | 8 | |
jdawkins | 0:bb2cacd02294 | 9 | #ifdef __cplusplus |
jdawkins | 0:bb2cacd02294 | 10 | extern "C" { |
jdawkins | 0:bb2cacd02294 | 11 | #endif |
jdawkins | 0:bb2cacd02294 | 12 | |
jdawkins | 0:bb2cacd02294 | 13 | #ifndef MAVLINK_TEST_ALL |
jdawkins | 0:bb2cacd02294 | 14 | #define MAVLINK_TEST_ALL |
jdawkins | 0:bb2cacd02294 | 15 | |
jdawkins | 0:bb2cacd02294 | 16 | static void mavlink_test_emaxx_board(uint8_t, uint8_t, mavlink_message_t *last_msg); |
jdawkins | 0:bb2cacd02294 | 17 | |
jdawkins | 0:bb2cacd02294 | 18 | static void mavlink_test_all(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) |
jdawkins | 0:bb2cacd02294 | 19 | { |
jdawkins | 0:bb2cacd02294 | 20 | |
jdawkins | 0:bb2cacd02294 | 21 | mavlink_test_emaxx_board(system_id, component_id, last_msg); |
jdawkins | 0:bb2cacd02294 | 22 | } |
jdawkins | 0:bb2cacd02294 | 23 | #endif |
jdawkins | 0:bb2cacd02294 | 24 | |
jdawkins | 0:bb2cacd02294 | 25 | |
jdawkins | 0:bb2cacd02294 | 26 | |
jdawkins | 0:bb2cacd02294 | 27 | |
jdawkins | 0:bb2cacd02294 | 28 | static void mavlink_test_heartbeat(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) |
jdawkins | 0:bb2cacd02294 | 29 | { |
jdawkins | 0:bb2cacd02294 | 30 | #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 |
jdawkins | 0:bb2cacd02294 | 31 | mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); |
jdawkins | 0:bb2cacd02294 | 32 | if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_HEARTBEAT >= 256) { |
jdawkins | 0:bb2cacd02294 | 33 | return; |
jdawkins | 0:bb2cacd02294 | 34 | } |
jdawkins | 0:bb2cacd02294 | 35 | #endif |
jdawkins | 0:bb2cacd02294 | 36 | mavlink_message_t msg; |
jdawkins | 0:bb2cacd02294 | 37 | uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; |
jdawkins | 0:bb2cacd02294 | 38 | uint16_t i; |
jdawkins | 0:bb2cacd02294 | 39 | mavlink_heartbeat_t packet_in = { |
jdawkins | 0:bb2cacd02294 | 40 | 963497464,17,84,151,218,2 |
jdawkins | 0:bb2cacd02294 | 41 | }; |
jdawkins | 0:bb2cacd02294 | 42 | mavlink_heartbeat_t packet1, packet2; |
jdawkins | 0:bb2cacd02294 | 43 | memset(&packet1, 0, sizeof(packet1)); |
jdawkins | 0:bb2cacd02294 | 44 | packet1.custom_mode = packet_in.custom_mode; |
jdawkins | 0:bb2cacd02294 | 45 | packet1.type = packet_in.type; |
jdawkins | 0:bb2cacd02294 | 46 | packet1.autopilot = packet_in.autopilot; |
jdawkins | 0:bb2cacd02294 | 47 | packet1.base_mode = packet_in.base_mode; |
jdawkins | 0:bb2cacd02294 | 48 | packet1.system_status = packet_in.system_status; |
jdawkins | 0:bb2cacd02294 | 49 | packet1.mavlink_version = packet_in.mavlink_version; |
jdawkins | 0:bb2cacd02294 | 50 | |
jdawkins | 0:bb2cacd02294 | 51 | |
jdawkins | 0:bb2cacd02294 | 52 | #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 |
jdawkins | 0:bb2cacd02294 | 53 | if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { |
jdawkins | 0:bb2cacd02294 | 54 | // cope with extensions |
jdawkins | 0:bb2cacd02294 | 55 | memset(MAVLINK_MSG_ID_HEARTBEAT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_HEARTBEAT_MIN_LEN); |
jdawkins | 0:bb2cacd02294 | 56 | } |
jdawkins | 0:bb2cacd02294 | 57 | #endif |
jdawkins | 0:bb2cacd02294 | 58 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 59 | mavlink_msg_heartbeat_encode(system_id, component_id, &msg, &packet1); |
jdawkins | 0:bb2cacd02294 | 60 | mavlink_msg_heartbeat_decode(&msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 61 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 62 | |
jdawkins | 0:bb2cacd02294 | 63 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 64 | mavlink_msg_heartbeat_pack(system_id, component_id, &msg , packet1.type , packet1.autopilot , packet1.base_mode , packet1.custom_mode , packet1.system_status ); |
jdawkins | 0:bb2cacd02294 | 65 | mavlink_msg_heartbeat_decode(&msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 66 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 67 | |
jdawkins | 0:bb2cacd02294 | 68 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 69 | mavlink_msg_heartbeat_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.type , packet1.autopilot , packet1.base_mode , packet1.custom_mode , packet1.system_status ); |
jdawkins | 0:bb2cacd02294 | 70 | mavlink_msg_heartbeat_decode(&msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 71 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 72 | |
jdawkins | 0:bb2cacd02294 | 73 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 74 | mavlink_msg_to_send_buffer(buffer, &msg); |
jdawkins | 0:bb2cacd02294 | 75 | for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { |
jdawkins | 0:bb2cacd02294 | 76 | comm_send_ch(MAVLINK_COMM_0, buffer[i]); |
jdawkins | 0:bb2cacd02294 | 77 | } |
jdawkins | 0:bb2cacd02294 | 78 | mavlink_msg_heartbeat_decode(last_msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 79 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 80 | |
jdawkins | 0:bb2cacd02294 | 81 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 82 | mavlink_msg_heartbeat_send(MAVLINK_COMM_1 , packet1.type , packet1.autopilot , packet1.base_mode , packet1.custom_mode , packet1.system_status ); |
jdawkins | 0:bb2cacd02294 | 83 | mavlink_msg_heartbeat_decode(last_msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 84 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 85 | } |
jdawkins | 0:bb2cacd02294 | 86 | |
jdawkins | 0:bb2cacd02294 | 87 | static void mavlink_test_sys_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) |
jdawkins | 0:bb2cacd02294 | 88 | { |
jdawkins | 0:bb2cacd02294 | 89 | #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 |
jdawkins | 0:bb2cacd02294 | 90 | mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); |
jdawkins | 0:bb2cacd02294 | 91 | if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SYS_STATUS >= 256) { |
jdawkins | 0:bb2cacd02294 | 92 | return; |
jdawkins | 0:bb2cacd02294 | 93 | } |
jdawkins | 0:bb2cacd02294 | 94 | #endif |
jdawkins | 0:bb2cacd02294 | 95 | mavlink_message_t msg; |
jdawkins | 0:bb2cacd02294 | 96 | uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; |
jdawkins | 0:bb2cacd02294 | 97 | uint16_t i; |
jdawkins | 0:bb2cacd02294 | 98 | mavlink_sys_status_t packet_in = { |
jdawkins | 0:bb2cacd02294 | 99 | 963497464,963497672,963497880,17859,17963,18067,18171,18275,18379,18483,18587,18691,223 |
jdawkins | 0:bb2cacd02294 | 100 | }; |
jdawkins | 0:bb2cacd02294 | 101 | mavlink_sys_status_t packet1, packet2; |
jdawkins | 0:bb2cacd02294 | 102 | memset(&packet1, 0, sizeof(packet1)); |
jdawkins | 0:bb2cacd02294 | 103 | packet1.onboard_control_sensors_present = packet_in.onboard_control_sensors_present; |
jdawkins | 0:bb2cacd02294 | 104 | packet1.onboard_control_sensors_enabled = packet_in.onboard_control_sensors_enabled; |
jdawkins | 0:bb2cacd02294 | 105 | packet1.onboard_control_sensors_health = packet_in.onboard_control_sensors_health; |
jdawkins | 0:bb2cacd02294 | 106 | packet1.load = packet_in.load; |
jdawkins | 0:bb2cacd02294 | 107 | packet1.voltage_battery = packet_in.voltage_battery; |
jdawkins | 0:bb2cacd02294 | 108 | packet1.current_battery = packet_in.current_battery; |
jdawkins | 0:bb2cacd02294 | 109 | packet1.drop_rate_comm = packet_in.drop_rate_comm; |
jdawkins | 0:bb2cacd02294 | 110 | packet1.errors_comm = packet_in.errors_comm; |
jdawkins | 0:bb2cacd02294 | 111 | packet1.errors_count1 = packet_in.errors_count1; |
jdawkins | 0:bb2cacd02294 | 112 | packet1.errors_count2 = packet_in.errors_count2; |
jdawkins | 0:bb2cacd02294 | 113 | packet1.errors_count3 = packet_in.errors_count3; |
jdawkins | 0:bb2cacd02294 | 114 | packet1.errors_count4 = packet_in.errors_count4; |
jdawkins | 0:bb2cacd02294 | 115 | packet1.battery_remaining = packet_in.battery_remaining; |
jdawkins | 0:bb2cacd02294 | 116 | |
jdawkins | 0:bb2cacd02294 | 117 | |
jdawkins | 0:bb2cacd02294 | 118 | #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 |
jdawkins | 0:bb2cacd02294 | 119 | if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { |
jdawkins | 0:bb2cacd02294 | 120 | // cope with extensions |
jdawkins | 0:bb2cacd02294 | 121 | memset(MAVLINK_MSG_ID_SYS_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SYS_STATUS_MIN_LEN); |
jdawkins | 0:bb2cacd02294 | 122 | } |
jdawkins | 0:bb2cacd02294 | 123 | #endif |
jdawkins | 0:bb2cacd02294 | 124 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 125 | mavlink_msg_sys_status_encode(system_id, component_id, &msg, &packet1); |
jdawkins | 0:bb2cacd02294 | 126 | mavlink_msg_sys_status_decode(&msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 127 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 128 | |
jdawkins | 0:bb2cacd02294 | 129 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 130 | mavlink_msg_sys_status_pack(system_id, component_id, &msg , packet1.onboard_control_sensors_present , packet1.onboard_control_sensors_enabled , packet1.onboard_control_sensors_health , packet1.load , packet1.voltage_battery , packet1.current_battery , packet1.battery_remaining , packet1.drop_rate_comm , packet1.errors_comm , packet1.errors_count1 , packet1.errors_count2 , packet1.errors_count3 , packet1.errors_count4 ); |
jdawkins | 0:bb2cacd02294 | 131 | mavlink_msg_sys_status_decode(&msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 132 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 133 | |
jdawkins | 0:bb2cacd02294 | 134 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 135 | mavlink_msg_sys_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.onboard_control_sensors_present , packet1.onboard_control_sensors_enabled , packet1.onboard_control_sensors_health , packet1.load , packet1.voltage_battery , packet1.current_battery , packet1.battery_remaining , packet1.drop_rate_comm , packet1.errors_comm , packet1.errors_count1 , packet1.errors_count2 , packet1.errors_count3 , packet1.errors_count4 ); |
jdawkins | 0:bb2cacd02294 | 136 | mavlink_msg_sys_status_decode(&msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 137 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 138 | |
jdawkins | 0:bb2cacd02294 | 139 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 140 | mavlink_msg_to_send_buffer(buffer, &msg); |
jdawkins | 0:bb2cacd02294 | 141 | for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { |
jdawkins | 0:bb2cacd02294 | 142 | comm_send_ch(MAVLINK_COMM_0, buffer[i]); |
jdawkins | 0:bb2cacd02294 | 143 | } |
jdawkins | 0:bb2cacd02294 | 144 | mavlink_msg_sys_status_decode(last_msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 145 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 146 | |
jdawkins | 0:bb2cacd02294 | 147 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 148 | mavlink_msg_sys_status_send(MAVLINK_COMM_1 , packet1.onboard_control_sensors_present , packet1.onboard_control_sensors_enabled , packet1.onboard_control_sensors_health , packet1.load , packet1.voltage_battery , packet1.current_battery , packet1.battery_remaining , packet1.drop_rate_comm , packet1.errors_comm , packet1.errors_count1 , packet1.errors_count2 , packet1.errors_count3 , packet1.errors_count4 ); |
jdawkins | 0:bb2cacd02294 | 149 | mavlink_msg_sys_status_decode(last_msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 150 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 151 | } |
jdawkins | 0:bb2cacd02294 | 152 | |
jdawkins | 0:bb2cacd02294 | 153 | static void mavlink_test_system_time(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) |
jdawkins | 0:bb2cacd02294 | 154 | { |
jdawkins | 0:bb2cacd02294 | 155 | #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 |
jdawkins | 0:bb2cacd02294 | 156 | mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); |
jdawkins | 0:bb2cacd02294 | 157 | if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SYSTEM_TIME >= 256) { |
jdawkins | 0:bb2cacd02294 | 158 | return; |
jdawkins | 0:bb2cacd02294 | 159 | } |
jdawkins | 0:bb2cacd02294 | 160 | #endif |
jdawkins | 0:bb2cacd02294 | 161 | mavlink_message_t msg; |
jdawkins | 0:bb2cacd02294 | 162 | uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; |
jdawkins | 0:bb2cacd02294 | 163 | uint16_t i; |
jdawkins | 0:bb2cacd02294 | 164 | mavlink_system_time_t packet_in = { |
jdawkins | 0:bb2cacd02294 | 165 | 93372036854775807ULL,963497880 |
jdawkins | 0:bb2cacd02294 | 166 | }; |
jdawkins | 0:bb2cacd02294 | 167 | mavlink_system_time_t packet1, packet2; |
jdawkins | 0:bb2cacd02294 | 168 | memset(&packet1, 0, sizeof(packet1)); |
jdawkins | 0:bb2cacd02294 | 169 | packet1.time_unix_usec = packet_in.time_unix_usec; |
jdawkins | 0:bb2cacd02294 | 170 | packet1.time_boot_ms = packet_in.time_boot_ms; |
jdawkins | 0:bb2cacd02294 | 171 | |
jdawkins | 0:bb2cacd02294 | 172 | |
jdawkins | 0:bb2cacd02294 | 173 | #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 |
jdawkins | 0:bb2cacd02294 | 174 | if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { |
jdawkins | 0:bb2cacd02294 | 175 | // cope with extensions |
jdawkins | 0:bb2cacd02294 | 176 | memset(MAVLINK_MSG_ID_SYSTEM_TIME_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SYSTEM_TIME_MIN_LEN); |
jdawkins | 0:bb2cacd02294 | 177 | } |
jdawkins | 0:bb2cacd02294 | 178 | #endif |
jdawkins | 0:bb2cacd02294 | 179 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 180 | mavlink_msg_system_time_encode(system_id, component_id, &msg, &packet1); |
jdawkins | 0:bb2cacd02294 | 181 | mavlink_msg_system_time_decode(&msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 182 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 183 | |
jdawkins | 0:bb2cacd02294 | 184 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 185 | mavlink_msg_system_time_pack(system_id, component_id, &msg , packet1.time_unix_usec , packet1.time_boot_ms ); |
jdawkins | 0:bb2cacd02294 | 186 | mavlink_msg_system_time_decode(&msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 187 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 188 | |
jdawkins | 0:bb2cacd02294 | 189 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 190 | mavlink_msg_system_time_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_unix_usec , packet1.time_boot_ms ); |
jdawkins | 0:bb2cacd02294 | 191 | mavlink_msg_system_time_decode(&msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 192 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 193 | |
jdawkins | 0:bb2cacd02294 | 194 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 195 | mavlink_msg_to_send_buffer(buffer, &msg); |
jdawkins | 0:bb2cacd02294 | 196 | for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { |
jdawkins | 0:bb2cacd02294 | 197 | comm_send_ch(MAVLINK_COMM_0, buffer[i]); |
jdawkins | 0:bb2cacd02294 | 198 | } |
jdawkins | 0:bb2cacd02294 | 199 | mavlink_msg_system_time_decode(last_msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 200 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 201 | |
jdawkins | 0:bb2cacd02294 | 202 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 203 | mavlink_msg_system_time_send(MAVLINK_COMM_1 , packet1.time_unix_usec , packet1.time_boot_ms ); |
jdawkins | 0:bb2cacd02294 | 204 | mavlink_msg_system_time_decode(last_msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 205 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 206 | } |
jdawkins | 0:bb2cacd02294 | 207 | |
jdawkins | 0:bb2cacd02294 | 208 | static void mavlink_test_gps_raw_int(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) |
jdawkins | 0:bb2cacd02294 | 209 | { |
jdawkins | 0:bb2cacd02294 | 210 | #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 |
jdawkins | 0:bb2cacd02294 | 211 | mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); |
jdawkins | 0:bb2cacd02294 | 212 | if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GPS_RAW_INT >= 256) { |
jdawkins | 0:bb2cacd02294 | 213 | return; |
jdawkins | 0:bb2cacd02294 | 214 | } |
jdawkins | 0:bb2cacd02294 | 215 | #endif |
jdawkins | 0:bb2cacd02294 | 216 | mavlink_message_t msg; |
jdawkins | 0:bb2cacd02294 | 217 | uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; |
jdawkins | 0:bb2cacd02294 | 218 | uint16_t i; |
jdawkins | 0:bb2cacd02294 | 219 | mavlink_gps_raw_int_t packet_in = { |
jdawkins | 0:bb2cacd02294 | 220 | 93372036854775807ULL,963497880,963498088,963498296,18275,18379,18483,18587,89,156 |
jdawkins | 0:bb2cacd02294 | 221 | }; |
jdawkins | 0:bb2cacd02294 | 222 | mavlink_gps_raw_int_t packet1, packet2; |
jdawkins | 0:bb2cacd02294 | 223 | memset(&packet1, 0, sizeof(packet1)); |
jdawkins | 0:bb2cacd02294 | 224 | packet1.time_usec = packet_in.time_usec; |
jdawkins | 0:bb2cacd02294 | 225 | packet1.lat = packet_in.lat; |
jdawkins | 0:bb2cacd02294 | 226 | packet1.lon = packet_in.lon; |
jdawkins | 0:bb2cacd02294 | 227 | packet1.alt = packet_in.alt; |
jdawkins | 0:bb2cacd02294 | 228 | packet1.eph = packet_in.eph; |
jdawkins | 0:bb2cacd02294 | 229 | packet1.epv = packet_in.epv; |
jdawkins | 0:bb2cacd02294 | 230 | packet1.vel = packet_in.vel; |
jdawkins | 0:bb2cacd02294 | 231 | packet1.cog = packet_in.cog; |
jdawkins | 0:bb2cacd02294 | 232 | packet1.fix_type = packet_in.fix_type; |
jdawkins | 0:bb2cacd02294 | 233 | packet1.satellites_visible = packet_in.satellites_visible; |
jdawkins | 0:bb2cacd02294 | 234 | |
jdawkins | 0:bb2cacd02294 | 235 | |
jdawkins | 0:bb2cacd02294 | 236 | #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 |
jdawkins | 0:bb2cacd02294 | 237 | if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { |
jdawkins | 0:bb2cacd02294 | 238 | // cope with extensions |
jdawkins | 0:bb2cacd02294 | 239 | memset(MAVLINK_MSG_ID_GPS_RAW_INT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GPS_RAW_INT_MIN_LEN); |
jdawkins | 0:bb2cacd02294 | 240 | } |
jdawkins | 0:bb2cacd02294 | 241 | #endif |
jdawkins | 0:bb2cacd02294 | 242 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 243 | mavlink_msg_gps_raw_int_encode(system_id, component_id, &msg, &packet1); |
jdawkins | 0:bb2cacd02294 | 244 | mavlink_msg_gps_raw_int_decode(&msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 245 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 246 | |
jdawkins | 0:bb2cacd02294 | 247 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 248 | mavlink_msg_gps_raw_int_pack(system_id, component_id, &msg , packet1.time_usec , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.eph , packet1.epv , packet1.vel , packet1.cog , packet1.satellites_visible ); |
jdawkins | 0:bb2cacd02294 | 249 | mavlink_msg_gps_raw_int_decode(&msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 250 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 251 | |
jdawkins | 0:bb2cacd02294 | 252 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 253 | mavlink_msg_gps_raw_int_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.eph , packet1.epv , packet1.vel , packet1.cog , packet1.satellites_visible ); |
jdawkins | 0:bb2cacd02294 | 254 | mavlink_msg_gps_raw_int_decode(&msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 255 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 256 | |
jdawkins | 0:bb2cacd02294 | 257 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 258 | mavlink_msg_to_send_buffer(buffer, &msg); |
jdawkins | 0:bb2cacd02294 | 259 | for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { |
jdawkins | 0:bb2cacd02294 | 260 | comm_send_ch(MAVLINK_COMM_0, buffer[i]); |
jdawkins | 0:bb2cacd02294 | 261 | } |
jdawkins | 0:bb2cacd02294 | 262 | mavlink_msg_gps_raw_int_decode(last_msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 263 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 264 | |
jdawkins | 0:bb2cacd02294 | 265 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 266 | mavlink_msg_gps_raw_int_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.eph , packet1.epv , packet1.vel , packet1.cog , packet1.satellites_visible ); |
jdawkins | 0:bb2cacd02294 | 267 | mavlink_msg_gps_raw_int_decode(last_msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 268 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 269 | } |
jdawkins | 0:bb2cacd02294 | 270 | |
jdawkins | 0:bb2cacd02294 | 271 | static void mavlink_test_scaled_imu(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) |
jdawkins | 0:bb2cacd02294 | 272 | { |
jdawkins | 0:bb2cacd02294 | 273 | #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 |
jdawkins | 0:bb2cacd02294 | 274 | mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); |
jdawkins | 0:bb2cacd02294 | 275 | if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SCALED_IMU >= 256) { |
jdawkins | 0:bb2cacd02294 | 276 | return; |
jdawkins | 0:bb2cacd02294 | 277 | } |
jdawkins | 0:bb2cacd02294 | 278 | #endif |
jdawkins | 0:bb2cacd02294 | 279 | mavlink_message_t msg; |
jdawkins | 0:bb2cacd02294 | 280 | uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; |
jdawkins | 0:bb2cacd02294 | 281 | uint16_t i; |
jdawkins | 0:bb2cacd02294 | 282 | mavlink_scaled_imu_t packet_in = { |
jdawkins | 0:bb2cacd02294 | 283 | 963497464,17443,17547,17651,17755,17859,17963,18067,18171,18275 |
jdawkins | 0:bb2cacd02294 | 284 | }; |
jdawkins | 0:bb2cacd02294 | 285 | mavlink_scaled_imu_t packet1, packet2; |
jdawkins | 0:bb2cacd02294 | 286 | memset(&packet1, 0, sizeof(packet1)); |
jdawkins | 0:bb2cacd02294 | 287 | packet1.time_boot_ms = packet_in.time_boot_ms; |
jdawkins | 0:bb2cacd02294 | 288 | packet1.xacc = packet_in.xacc; |
jdawkins | 0:bb2cacd02294 | 289 | packet1.yacc = packet_in.yacc; |
jdawkins | 0:bb2cacd02294 | 290 | packet1.zacc = packet_in.zacc; |
jdawkins | 0:bb2cacd02294 | 291 | packet1.xgyro = packet_in.xgyro; |
jdawkins | 0:bb2cacd02294 | 292 | packet1.ygyro = packet_in.ygyro; |
jdawkins | 0:bb2cacd02294 | 293 | packet1.zgyro = packet_in.zgyro; |
jdawkins | 0:bb2cacd02294 | 294 | packet1.xmag = packet_in.xmag; |
jdawkins | 0:bb2cacd02294 | 295 | packet1.ymag = packet_in.ymag; |
jdawkins | 0:bb2cacd02294 | 296 | packet1.zmag = packet_in.zmag; |
jdawkins | 0:bb2cacd02294 | 297 | |
jdawkins | 0:bb2cacd02294 | 298 | |
jdawkins | 0:bb2cacd02294 | 299 | #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 |
jdawkins | 0:bb2cacd02294 | 300 | if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { |
jdawkins | 0:bb2cacd02294 | 301 | // cope with extensions |
jdawkins | 0:bb2cacd02294 | 302 | memset(MAVLINK_MSG_ID_SCALED_IMU_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SCALED_IMU_MIN_LEN); |
jdawkins | 0:bb2cacd02294 | 303 | } |
jdawkins | 0:bb2cacd02294 | 304 | #endif |
jdawkins | 0:bb2cacd02294 | 305 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 306 | mavlink_msg_scaled_imu_encode(system_id, component_id, &msg, &packet1); |
jdawkins | 0:bb2cacd02294 | 307 | mavlink_msg_scaled_imu_decode(&msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 308 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 309 | |
jdawkins | 0:bb2cacd02294 | 310 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 311 | mavlink_msg_scaled_imu_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag ); |
jdawkins | 0:bb2cacd02294 | 312 | mavlink_msg_scaled_imu_decode(&msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 313 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 314 | |
jdawkins | 0:bb2cacd02294 | 315 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 316 | mavlink_msg_scaled_imu_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag ); |
jdawkins | 0:bb2cacd02294 | 317 | mavlink_msg_scaled_imu_decode(&msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 318 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 319 | |
jdawkins | 0:bb2cacd02294 | 320 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 321 | mavlink_msg_to_send_buffer(buffer, &msg); |
jdawkins | 0:bb2cacd02294 | 322 | for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { |
jdawkins | 0:bb2cacd02294 | 323 | comm_send_ch(MAVLINK_COMM_0, buffer[i]); |
jdawkins | 0:bb2cacd02294 | 324 | } |
jdawkins | 0:bb2cacd02294 | 325 | mavlink_msg_scaled_imu_decode(last_msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 326 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 327 | |
jdawkins | 0:bb2cacd02294 | 328 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 329 | mavlink_msg_scaled_imu_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag ); |
jdawkins | 0:bb2cacd02294 | 330 | mavlink_msg_scaled_imu_decode(last_msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 331 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 332 | } |
jdawkins | 0:bb2cacd02294 | 333 | |
jdawkins | 0:bb2cacd02294 | 334 | static void mavlink_test_attitude(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) |
jdawkins | 0:bb2cacd02294 | 335 | { |
jdawkins | 0:bb2cacd02294 | 336 | #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 |
jdawkins | 0:bb2cacd02294 | 337 | mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); |
jdawkins | 0:bb2cacd02294 | 338 | if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ATTITUDE >= 256) { |
jdawkins | 0:bb2cacd02294 | 339 | return; |
jdawkins | 0:bb2cacd02294 | 340 | } |
jdawkins | 0:bb2cacd02294 | 341 | #endif |
jdawkins | 0:bb2cacd02294 | 342 | mavlink_message_t msg; |
jdawkins | 0:bb2cacd02294 | 343 | uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; |
jdawkins | 0:bb2cacd02294 | 344 | uint16_t i; |
jdawkins | 0:bb2cacd02294 | 345 | mavlink_attitude_t packet_in = { |
jdawkins | 0:bb2cacd02294 | 346 | 963497464,45.0,73.0,101.0,129.0,157.0,185.0 |
jdawkins | 0:bb2cacd02294 | 347 | }; |
jdawkins | 0:bb2cacd02294 | 348 | mavlink_attitude_t packet1, packet2; |
jdawkins | 0:bb2cacd02294 | 349 | memset(&packet1, 0, sizeof(packet1)); |
jdawkins | 0:bb2cacd02294 | 350 | packet1.time_boot_ms = packet_in.time_boot_ms; |
jdawkins | 0:bb2cacd02294 | 351 | packet1.roll = packet_in.roll; |
jdawkins | 0:bb2cacd02294 | 352 | packet1.pitch = packet_in.pitch; |
jdawkins | 0:bb2cacd02294 | 353 | packet1.yaw = packet_in.yaw; |
jdawkins | 0:bb2cacd02294 | 354 | packet1.rollspeed = packet_in.rollspeed; |
jdawkins | 0:bb2cacd02294 | 355 | packet1.pitchspeed = packet_in.pitchspeed; |
jdawkins | 0:bb2cacd02294 | 356 | packet1.yawspeed = packet_in.yawspeed; |
jdawkins | 0:bb2cacd02294 | 357 | |
jdawkins | 0:bb2cacd02294 | 358 | |
jdawkins | 0:bb2cacd02294 | 359 | #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 |
jdawkins | 0:bb2cacd02294 | 360 | if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { |
jdawkins | 0:bb2cacd02294 | 361 | // cope with extensions |
jdawkins | 0:bb2cacd02294 | 362 | memset(MAVLINK_MSG_ID_ATTITUDE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ATTITUDE_MIN_LEN); |
jdawkins | 0:bb2cacd02294 | 363 | } |
jdawkins | 0:bb2cacd02294 | 364 | #endif |
jdawkins | 0:bb2cacd02294 | 365 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 366 | mavlink_msg_attitude_encode(system_id, component_id, &msg, &packet1); |
jdawkins | 0:bb2cacd02294 | 367 | mavlink_msg_attitude_decode(&msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 368 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 369 | |
jdawkins | 0:bb2cacd02294 | 370 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 371 | mavlink_msg_attitude_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.roll , packet1.pitch , packet1.yaw , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed ); |
jdawkins | 0:bb2cacd02294 | 372 | mavlink_msg_attitude_decode(&msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 373 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 374 | |
jdawkins | 0:bb2cacd02294 | 375 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 376 | mavlink_msg_attitude_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.roll , packet1.pitch , packet1.yaw , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed ); |
jdawkins | 0:bb2cacd02294 | 377 | mavlink_msg_attitude_decode(&msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 378 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 379 | |
jdawkins | 0:bb2cacd02294 | 380 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 381 | mavlink_msg_to_send_buffer(buffer, &msg); |
jdawkins | 0:bb2cacd02294 | 382 | for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { |
jdawkins | 0:bb2cacd02294 | 383 | comm_send_ch(MAVLINK_COMM_0, buffer[i]); |
jdawkins | 0:bb2cacd02294 | 384 | } |
jdawkins | 0:bb2cacd02294 | 385 | mavlink_msg_attitude_decode(last_msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 386 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 387 | |
jdawkins | 0:bb2cacd02294 | 388 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 389 | mavlink_msg_attitude_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.roll , packet1.pitch , packet1.yaw , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed ); |
jdawkins | 0:bb2cacd02294 | 390 | mavlink_msg_attitude_decode(last_msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 391 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 392 | } |
jdawkins | 0:bb2cacd02294 | 393 | |
jdawkins | 0:bb2cacd02294 | 394 | static void mavlink_test_attitude_quaternion(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) |
jdawkins | 0:bb2cacd02294 | 395 | { |
jdawkins | 0:bb2cacd02294 | 396 | #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 |
jdawkins | 0:bb2cacd02294 | 397 | mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); |
jdawkins | 0:bb2cacd02294 | 398 | if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ATTITUDE_QUATERNION >= 256) { |
jdawkins | 0:bb2cacd02294 | 399 | return; |
jdawkins | 0:bb2cacd02294 | 400 | } |
jdawkins | 0:bb2cacd02294 | 401 | #endif |
jdawkins | 0:bb2cacd02294 | 402 | mavlink_message_t msg; |
jdawkins | 0:bb2cacd02294 | 403 | uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; |
jdawkins | 0:bb2cacd02294 | 404 | uint16_t i; |
jdawkins | 0:bb2cacd02294 | 405 | mavlink_attitude_quaternion_t packet_in = { |
jdawkins | 0:bb2cacd02294 | 406 | 963497464,45.0,73.0,101.0,129.0,157.0,185.0,213.0 |
jdawkins | 0:bb2cacd02294 | 407 | }; |
jdawkins | 0:bb2cacd02294 | 408 | mavlink_attitude_quaternion_t packet1, packet2; |
jdawkins | 0:bb2cacd02294 | 409 | memset(&packet1, 0, sizeof(packet1)); |
jdawkins | 0:bb2cacd02294 | 410 | packet1.time_boot_ms = packet_in.time_boot_ms; |
jdawkins | 0:bb2cacd02294 | 411 | packet1.q1 = packet_in.q1; |
jdawkins | 0:bb2cacd02294 | 412 | packet1.q2 = packet_in.q2; |
jdawkins | 0:bb2cacd02294 | 413 | packet1.q3 = packet_in.q3; |
jdawkins | 0:bb2cacd02294 | 414 | packet1.q4 = packet_in.q4; |
jdawkins | 0:bb2cacd02294 | 415 | packet1.rollspeed = packet_in.rollspeed; |
jdawkins | 0:bb2cacd02294 | 416 | packet1.pitchspeed = packet_in.pitchspeed; |
jdawkins | 0:bb2cacd02294 | 417 | packet1.yawspeed = packet_in.yawspeed; |
jdawkins | 0:bb2cacd02294 | 418 | |
jdawkins | 0:bb2cacd02294 | 419 | |
jdawkins | 0:bb2cacd02294 | 420 | #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 |
jdawkins | 0:bb2cacd02294 | 421 | if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { |
jdawkins | 0:bb2cacd02294 | 422 | // cope with extensions |
jdawkins | 0:bb2cacd02294 | 423 | memset(MAVLINK_MSG_ID_ATTITUDE_QUATERNION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ATTITUDE_QUATERNION_MIN_LEN); |
jdawkins | 0:bb2cacd02294 | 424 | } |
jdawkins | 0:bb2cacd02294 | 425 | #endif |
jdawkins | 0:bb2cacd02294 | 426 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 427 | mavlink_msg_attitude_quaternion_encode(system_id, component_id, &msg, &packet1); |
jdawkins | 0:bb2cacd02294 | 428 | mavlink_msg_attitude_quaternion_decode(&msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 429 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 430 | |
jdawkins | 0:bb2cacd02294 | 431 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 432 | mavlink_msg_attitude_quaternion_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.q1 , packet1.q2 , packet1.q3 , packet1.q4 , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed ); |
jdawkins | 0:bb2cacd02294 | 433 | mavlink_msg_attitude_quaternion_decode(&msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 434 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 435 | |
jdawkins | 0:bb2cacd02294 | 436 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 437 | mavlink_msg_attitude_quaternion_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.q1 , packet1.q2 , packet1.q3 , packet1.q4 , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed ); |
jdawkins | 0:bb2cacd02294 | 438 | mavlink_msg_attitude_quaternion_decode(&msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 439 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 440 | |
jdawkins | 0:bb2cacd02294 | 441 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 442 | mavlink_msg_to_send_buffer(buffer, &msg); |
jdawkins | 0:bb2cacd02294 | 443 | for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { |
jdawkins | 0:bb2cacd02294 | 444 | comm_send_ch(MAVLINK_COMM_0, buffer[i]); |
jdawkins | 0:bb2cacd02294 | 445 | } |
jdawkins | 0:bb2cacd02294 | 446 | mavlink_msg_attitude_quaternion_decode(last_msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 447 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 448 | |
jdawkins | 0:bb2cacd02294 | 449 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 450 | mavlink_msg_attitude_quaternion_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.q1 , packet1.q2 , packet1.q3 , packet1.q4 , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed ); |
jdawkins | 0:bb2cacd02294 | 451 | mavlink_msg_attitude_quaternion_decode(last_msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 452 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 453 | } |
jdawkins | 0:bb2cacd02294 | 454 | |
jdawkins | 0:bb2cacd02294 | 455 | static void mavlink_test_local_position_ned(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) |
jdawkins | 0:bb2cacd02294 | 456 | { |
jdawkins | 0:bb2cacd02294 | 457 | #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 |
jdawkins | 0:bb2cacd02294 | 458 | mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); |
jdawkins | 0:bb2cacd02294 | 459 | if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_LOCAL_POSITION_NED >= 256) { |
jdawkins | 0:bb2cacd02294 | 460 | return; |
jdawkins | 0:bb2cacd02294 | 461 | } |
jdawkins | 0:bb2cacd02294 | 462 | #endif |
jdawkins | 0:bb2cacd02294 | 463 | mavlink_message_t msg; |
jdawkins | 0:bb2cacd02294 | 464 | uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; |
jdawkins | 0:bb2cacd02294 | 465 | uint16_t i; |
jdawkins | 0:bb2cacd02294 | 466 | mavlink_local_position_ned_t packet_in = { |
jdawkins | 0:bb2cacd02294 | 467 | 963497464,45.0,73.0,101.0,129.0,157.0,185.0 |
jdawkins | 0:bb2cacd02294 | 468 | }; |
jdawkins | 0:bb2cacd02294 | 469 | mavlink_local_position_ned_t packet1, packet2; |
jdawkins | 0:bb2cacd02294 | 470 | memset(&packet1, 0, sizeof(packet1)); |
jdawkins | 0:bb2cacd02294 | 471 | packet1.time_boot_ms = packet_in.time_boot_ms; |
jdawkins | 0:bb2cacd02294 | 472 | packet1.x = packet_in.x; |
jdawkins | 0:bb2cacd02294 | 473 | packet1.y = packet_in.y; |
jdawkins | 0:bb2cacd02294 | 474 | packet1.z = packet_in.z; |
jdawkins | 0:bb2cacd02294 | 475 | packet1.vx = packet_in.vx; |
jdawkins | 0:bb2cacd02294 | 476 | packet1.vy = packet_in.vy; |
jdawkins | 0:bb2cacd02294 | 477 | packet1.vz = packet_in.vz; |
jdawkins | 0:bb2cacd02294 | 478 | |
jdawkins | 0:bb2cacd02294 | 479 | |
jdawkins | 0:bb2cacd02294 | 480 | #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 |
jdawkins | 0:bb2cacd02294 | 481 | if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { |
jdawkins | 0:bb2cacd02294 | 482 | // cope with extensions |
jdawkins | 0:bb2cacd02294 | 483 | memset(MAVLINK_MSG_ID_LOCAL_POSITION_NED_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_LOCAL_POSITION_NED_MIN_LEN); |
jdawkins | 0:bb2cacd02294 | 484 | } |
jdawkins | 0:bb2cacd02294 | 485 | #endif |
jdawkins | 0:bb2cacd02294 | 486 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 487 | mavlink_msg_local_position_ned_encode(system_id, component_id, &msg, &packet1); |
jdawkins | 0:bb2cacd02294 | 488 | mavlink_msg_local_position_ned_decode(&msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 489 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 490 | |
jdawkins | 0:bb2cacd02294 | 491 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 492 | mavlink_msg_local_position_ned_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.x , packet1.y , packet1.z , packet1.vx , packet1.vy , packet1.vz ); |
jdawkins | 0:bb2cacd02294 | 493 | mavlink_msg_local_position_ned_decode(&msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 494 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 495 | |
jdawkins | 0:bb2cacd02294 | 496 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 497 | mavlink_msg_local_position_ned_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.x , packet1.y , packet1.z , packet1.vx , packet1.vy , packet1.vz ); |
jdawkins | 0:bb2cacd02294 | 498 | mavlink_msg_local_position_ned_decode(&msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 499 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 500 | |
jdawkins | 0:bb2cacd02294 | 501 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 502 | mavlink_msg_to_send_buffer(buffer, &msg); |
jdawkins | 0:bb2cacd02294 | 503 | for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { |
jdawkins | 0:bb2cacd02294 | 504 | comm_send_ch(MAVLINK_COMM_0, buffer[i]); |
jdawkins | 0:bb2cacd02294 | 505 | } |
jdawkins | 0:bb2cacd02294 | 506 | mavlink_msg_local_position_ned_decode(last_msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 507 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 508 | |
jdawkins | 0:bb2cacd02294 | 509 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 510 | mavlink_msg_local_position_ned_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.x , packet1.y , packet1.z , packet1.vx , packet1.vy , packet1.vz ); |
jdawkins | 0:bb2cacd02294 | 511 | mavlink_msg_local_position_ned_decode(last_msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 512 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 513 | } |
jdawkins | 0:bb2cacd02294 | 514 | |
jdawkins | 0:bb2cacd02294 | 515 | static void mavlink_test_range_to_node(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) |
jdawkins | 0:bb2cacd02294 | 516 | { |
jdawkins | 0:bb2cacd02294 | 517 | #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 |
jdawkins | 0:bb2cacd02294 | 518 | mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); |
jdawkins | 0:bb2cacd02294 | 519 | if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_RANGE_TO_NODE >= 256) { |
jdawkins | 0:bb2cacd02294 | 520 | return; |
jdawkins | 0:bb2cacd02294 | 521 | } |
jdawkins | 0:bb2cacd02294 | 522 | #endif |
jdawkins | 0:bb2cacd02294 | 523 | mavlink_message_t msg; |
jdawkins | 0:bb2cacd02294 | 524 | uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; |
jdawkins | 0:bb2cacd02294 | 525 | uint16_t i; |
jdawkins | 0:bb2cacd02294 | 526 | mavlink_range_to_node_t packet_in = { |
jdawkins | 0:bb2cacd02294 | 527 | 963497464,45.0,29,96 |
jdawkins | 0:bb2cacd02294 | 528 | }; |
jdawkins | 0:bb2cacd02294 | 529 | mavlink_range_to_node_t packet1, packet2; |
jdawkins | 0:bb2cacd02294 | 530 | memset(&packet1, 0, sizeof(packet1)); |
jdawkins | 0:bb2cacd02294 | 531 | packet1.time_boot_ms = packet_in.time_boot_ms; |
jdawkins | 0:bb2cacd02294 | 532 | packet1.range = packet_in.range; |
jdawkins | 0:bb2cacd02294 | 533 | packet1.my_id = packet_in.my_id; |
jdawkins | 0:bb2cacd02294 | 534 | packet1.tgt_id = packet_in.tgt_id; |
jdawkins | 0:bb2cacd02294 | 535 | |
jdawkins | 0:bb2cacd02294 | 536 | |
jdawkins | 0:bb2cacd02294 | 537 | #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 |
jdawkins | 0:bb2cacd02294 | 538 | if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { |
jdawkins | 0:bb2cacd02294 | 539 | // cope with extensions |
jdawkins | 0:bb2cacd02294 | 540 | memset(MAVLINK_MSG_ID_RANGE_TO_NODE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_RANGE_TO_NODE_MIN_LEN); |
jdawkins | 0:bb2cacd02294 | 541 | } |
jdawkins | 0:bb2cacd02294 | 542 | #endif |
jdawkins | 0:bb2cacd02294 | 543 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 544 | mavlink_msg_range_to_node_encode(system_id, component_id, &msg, &packet1); |
jdawkins | 0:bb2cacd02294 | 545 | mavlink_msg_range_to_node_decode(&msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 546 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 547 | |
jdawkins | 0:bb2cacd02294 | 548 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 549 | mavlink_msg_range_to_node_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.my_id , packet1.tgt_id , packet1.range ); |
jdawkins | 0:bb2cacd02294 | 550 | mavlink_msg_range_to_node_decode(&msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 551 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 552 | |
jdawkins | 0:bb2cacd02294 | 553 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 554 | mavlink_msg_range_to_node_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.my_id , packet1.tgt_id , packet1.range ); |
jdawkins | 0:bb2cacd02294 | 555 | mavlink_msg_range_to_node_decode(&msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 556 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 557 | |
jdawkins | 0:bb2cacd02294 | 558 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 559 | mavlink_msg_to_send_buffer(buffer, &msg); |
jdawkins | 0:bb2cacd02294 | 560 | for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { |
jdawkins | 0:bb2cacd02294 | 561 | comm_send_ch(MAVLINK_COMM_0, buffer[i]); |
jdawkins | 0:bb2cacd02294 | 562 | } |
jdawkins | 0:bb2cacd02294 | 563 | mavlink_msg_range_to_node_decode(last_msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 564 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 565 | |
jdawkins | 0:bb2cacd02294 | 566 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 567 | mavlink_msg_range_to_node_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.my_id , packet1.tgt_id , packet1.range ); |
jdawkins | 0:bb2cacd02294 | 568 | mavlink_msg_range_to_node_decode(last_msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 569 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 570 | } |
jdawkins | 0:bb2cacd02294 | 571 | |
jdawkins | 0:bb2cacd02294 | 572 | static void mavlink_test_fused_imu(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) |
jdawkins | 0:bb2cacd02294 | 573 | { |
jdawkins | 0:bb2cacd02294 | 574 | #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 |
jdawkins | 0:bb2cacd02294 | 575 | mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); |
jdawkins | 0:bb2cacd02294 | 576 | if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_FUSED_IMU >= 256) { |
jdawkins | 0:bb2cacd02294 | 577 | return; |
jdawkins | 0:bb2cacd02294 | 578 | } |
jdawkins | 0:bb2cacd02294 | 579 | #endif |
jdawkins | 0:bb2cacd02294 | 580 | mavlink_message_t msg; |
jdawkins | 0:bb2cacd02294 | 581 | uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; |
jdawkins | 0:bb2cacd02294 | 582 | uint16_t i; |
jdawkins | 0:bb2cacd02294 | 583 | mavlink_fused_imu_t packet_in = { |
jdawkins | 0:bb2cacd02294 | 584 | 963497464,45.0,73.0,101.0,129.0,157.0,185.0,213.0,241.0,269.0 |
jdawkins | 0:bb2cacd02294 | 585 | }; |
jdawkins | 0:bb2cacd02294 | 586 | mavlink_fused_imu_t packet1, packet2; |
jdawkins | 0:bb2cacd02294 | 587 | memset(&packet1, 0, sizeof(packet1)); |
jdawkins | 0:bb2cacd02294 | 588 | packet1.time_boot_ms = packet_in.time_boot_ms; |
jdawkins | 0:bb2cacd02294 | 589 | packet1.accel_x = packet_in.accel_x; |
jdawkins | 0:bb2cacd02294 | 590 | packet1.accel_y = packet_in.accel_y; |
jdawkins | 0:bb2cacd02294 | 591 | packet1.accel_z = packet_in.accel_z; |
jdawkins | 0:bb2cacd02294 | 592 | packet1.gyro_x = packet_in.gyro_x; |
jdawkins | 0:bb2cacd02294 | 593 | packet1.gyro_y = packet_in.gyro_y; |
jdawkins | 0:bb2cacd02294 | 594 | packet1.gyro_z = packet_in.gyro_z; |
jdawkins | 0:bb2cacd02294 | 595 | packet1.roll = packet_in.roll; |
jdawkins | 0:bb2cacd02294 | 596 | packet1.pitch = packet_in.pitch; |
jdawkins | 0:bb2cacd02294 | 597 | packet1.yaw = packet_in.yaw; |
jdawkins | 0:bb2cacd02294 | 598 | |
jdawkins | 0:bb2cacd02294 | 599 | |
jdawkins | 0:bb2cacd02294 | 600 | #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 |
jdawkins | 0:bb2cacd02294 | 601 | if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { |
jdawkins | 0:bb2cacd02294 | 602 | // cope with extensions |
jdawkins | 0:bb2cacd02294 | 603 | memset(MAVLINK_MSG_ID_FUSED_IMU_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_FUSED_IMU_MIN_LEN); |
jdawkins | 0:bb2cacd02294 | 604 | } |
jdawkins | 0:bb2cacd02294 | 605 | #endif |
jdawkins | 0:bb2cacd02294 | 606 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 607 | mavlink_msg_fused_imu_encode(system_id, component_id, &msg, &packet1); |
jdawkins | 0:bb2cacd02294 | 608 | mavlink_msg_fused_imu_decode(&msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 609 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 610 | |
jdawkins | 0:bb2cacd02294 | 611 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 612 | mavlink_msg_fused_imu_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.accel_x , packet1.accel_y , packet1.accel_z , packet1.gyro_x , packet1.gyro_y , packet1.gyro_z , packet1.roll , packet1.pitch , packet1.yaw ); |
jdawkins | 0:bb2cacd02294 | 613 | mavlink_msg_fused_imu_decode(&msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 614 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 615 | |
jdawkins | 0:bb2cacd02294 | 616 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 617 | mavlink_msg_fused_imu_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.accel_x , packet1.accel_y , packet1.accel_z , packet1.gyro_x , packet1.gyro_y , packet1.gyro_z , packet1.roll , packet1.pitch , packet1.yaw ); |
jdawkins | 0:bb2cacd02294 | 618 | mavlink_msg_fused_imu_decode(&msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 619 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 620 | |
jdawkins | 0:bb2cacd02294 | 621 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 622 | mavlink_msg_to_send_buffer(buffer, &msg); |
jdawkins | 0:bb2cacd02294 | 623 | for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { |
jdawkins | 0:bb2cacd02294 | 624 | comm_send_ch(MAVLINK_COMM_0, buffer[i]); |
jdawkins | 0:bb2cacd02294 | 625 | } |
jdawkins | 0:bb2cacd02294 | 626 | mavlink_msg_fused_imu_decode(last_msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 627 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 628 | |
jdawkins | 0:bb2cacd02294 | 629 | memset(&packet2, 0, sizeof(packet2)); |
jdawkins | 0:bb2cacd02294 | 630 | mavlink_msg_fused_imu_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.accel_x , packet1.accel_y , packet1.accel_z , packet1.gyro_x , packet1.gyro_y , packet1.gyro_z , packet1.roll , packet1.pitch , packet1.yaw ); |
jdawkins | 0:bb2cacd02294 | 631 | mavlink_msg_fused_imu_decode(last_msg, &packet2); |
jdawkins | 0:bb2cacd02294 | 632 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
jdawkins | 0:bb2cacd02294 | 633 | } |
jdawkins | 0:bb2cacd02294 | 634 | |
jdawkins | 0:bb2cacd02294 | 635 | static void mavlink_test_emaxx_board(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) |
jdawkins | 0:bb2cacd02294 | 636 | { |
jdawkins | 0:bb2cacd02294 | 637 | mavlink_test_heartbeat(system_id, component_id, last_msg); |
jdawkins | 0:bb2cacd02294 | 638 | mavlink_test_sys_status(system_id, component_id, last_msg); |
jdawkins | 0:bb2cacd02294 | 639 | mavlink_test_system_time(system_id, component_id, last_msg); |
jdawkins | 0:bb2cacd02294 | 640 | mavlink_test_gps_raw_int(system_id, component_id, last_msg); |
jdawkins | 0:bb2cacd02294 | 641 | mavlink_test_scaled_imu(system_id, component_id, last_msg); |
jdawkins | 0:bb2cacd02294 | 642 | mavlink_test_attitude(system_id, component_id, last_msg); |
jdawkins | 0:bb2cacd02294 | 643 | mavlink_test_attitude_quaternion(system_id, component_id, last_msg); |
jdawkins | 0:bb2cacd02294 | 644 | mavlink_test_local_position_ned(system_id, component_id, last_msg); |
jdawkins | 0:bb2cacd02294 | 645 | mavlink_test_range_to_node(system_id, component_id, last_msg); |
jdawkins | 0:bb2cacd02294 | 646 | mavlink_test_fused_imu(system_id, component_id, last_msg); |
jdawkins | 0:bb2cacd02294 | 647 | } |
jdawkins | 0:bb2cacd02294 | 648 | |
jdawkins | 0:bb2cacd02294 | 649 | #ifdef __cplusplus |
jdawkins | 0:bb2cacd02294 | 650 | } |
jdawkins | 0:bb2cacd02294 | 651 | #endif // __cplusplus |
jdawkins | 0:bb2cacd02294 | 652 | #endif // EMAXX_BOARD_TESTSUITE_H |
jdawkins | 0:bb2cacd02294 | 653 |