diff --git a/ASLUAV/ASLUAV.h b/ASLUAV/ASLUAV.h deleted file mode 100644 index 29220433d..000000000 --- a/ASLUAV/ASLUAV.h +++ /dev/null @@ -1,284 +0,0 @@ -/** @file - * @brief MAVLink comm protocol generated from ASLUAV.xml - * @see http://mavlink.org - */ -#pragma once -#ifndef MAVLINK_ASLUAV_H -#define MAVLINK_ASLUAV_H - -#ifndef MAVLINK_H - #error Wrong include order: MAVLINK_ASLUAV.H MUST NOT BE DIRECTLY USED. Include mavlink.h from the same directory instead or set ALL AND EVERY defines from MAVLINK.H manually accordingly, including the #define MAVLINK_H call. -#endif - -#undef MAVLINK_THIS_XML_IDX -#define MAVLINK_THIS_XML_IDX 0 - -#ifdef __cplusplus -extern "C" { -#endif - -// MESSAGE LENGTHS AND CRCS - -#ifndef MAVLINK_MESSAGE_LENGTHS -#define MAVLINK_MESSAGE_LENGTHS {} -#endif - -#ifndef MAVLINK_MESSAGE_CRCS -#define MAVLINK_MESSAGE_CRCS {{0, 50, 9, 9, 0, 0, 0}, {1, 124, 31, 31, 0, 0, 0}, {2, 137, 12, 12, 0, 0, 0}, {4, 237, 14, 14, 3, 12, 13}, {5, 217, 28, 28, 1, 0, 0}, {6, 104, 3, 3, 0, 0, 0}, {7, 119, 32, 32, 0, 0, 0}, {8, 117, 36, 36, 0, 0, 0}, {11, 89, 6, 6, 1, 4, 0}, {19, 137, 24, 24, 3, 4, 5}, {20, 214, 20, 20, 3, 2, 3}, {21, 159, 2, 2, 3, 0, 1}, {22, 220, 25, 25, 0, 0, 0}, {23, 168, 23, 23, 3, 4, 5}, {24, 24, 30, 52, 0, 0, 0}, {25, 23, 101, 101, 0, 0, 0}, {26, 170, 22, 24, 0, 0, 0}, {27, 144, 26, 29, 0, 0, 0}, {28, 67, 16, 16, 0, 0, 0}, {29, 115, 14, 16, 0, 0, 0}, {30, 39, 28, 28, 0, 0, 0}, {31, 246, 32, 48, 0, 0, 0}, {32, 185, 28, 28, 0, 0, 0}, {33, 104, 28, 28, 0, 0, 0}, {34, 237, 22, 22, 0, 0, 0}, {35, 244, 22, 22, 0, 0, 0}, {36, 222, 21, 37, 0, 0, 0}, {37, 212, 6, 7, 3, 4, 5}, {38, 9, 6, 7, 3, 4, 5}, {39, 254, 37, 38, 3, 32, 33}, {40, 230, 4, 5, 3, 2, 3}, {41, 28, 4, 4, 3, 2, 3}, {42, 28, 2, 2, 0, 0, 0}, {43, 132, 2, 3, 3, 0, 1}, {44, 221, 4, 5, 3, 2, 3}, {45, 232, 2, 3, 3, 0, 1}, {46, 11, 2, 2, 0, 0, 0}, {47, 153, 3, 4, 3, 0, 1}, {48, 41, 13, 21, 1, 12, 0}, {49, 39, 12, 20, 0, 0, 0}, {50, 78, 37, 37, 3, 18, 19}, {51, 196, 4, 5, 3, 2, 3}, {52, 132, 7, 7, 0, 0, 0}, {54, 15, 27, 27, 3, 24, 25}, {55, 3, 25, 25, 0, 0, 0}, {61, 167, 72, 72, 0, 0, 0}, {62, 183, 26, 26, 0, 0, 0}, {63, 119, 181, 181, 0, 0, 0}, {64, 191, 225, 225, 0, 0, 0}, {65, 118, 42, 42, 0, 0, 0}, {66, 148, 6, 6, 3, 2, 3}, {67, 21, 4, 4, 0, 0, 0}, {69, 243, 11, 11, 1, 10, 0}, {70, 124, 18, 38, 3, 16, 17}, {73, 38, 37, 38, 3, 32, 33}, {74, 20, 20, 20, 0, 0, 0}, {75, 158, 35, 35, 3, 30, 31}, {76, 152, 33, 33, 3, 30, 31}, {77, 143, 3, 10, 3, 8, 9}, {78, 119, 47, 47, 3, 42, 43}, {79, 102, 45, 45, 3, 42, 43}, {80, 14, 4, 4, 3, 2, 3}, {81, 106, 22, 22, 0, 0, 0}, {82, 49, 39, 39, 3, 36, 37}, {83, 22, 37, 37, 0, 0, 0}, {84, 143, 53, 53, 3, 50, 51}, {85, 140, 51, 51, 0, 0, 0}, {86, 5, 53, 53, 3, 50, 51}, {87, 150, 51, 51, 0, 0, 0}, {89, 231, 28, 28, 0, 0, 0}, {90, 183, 56, 56, 0, 0, 0}, {91, 63, 42, 42, 0, 0, 0}, {92, 54, 33, 33, 0, 0, 0}, {93, 47, 81, 81, 0, 0, 0}, {100, 175, 26, 34, 0, 0, 0}, {101, 102, 32, 117, 0, 0, 0}, {102, 158, 32, 117, 0, 0, 0}, {103, 208, 20, 57, 0, 0, 0}, {104, 56, 32, 116, 0, 0, 0}, {105, 93, 62, 63, 0, 0, 0}, {106, 138, 44, 44, 0, 0, 0}, {107, 108, 64, 65, 0, 0, 0}, {108, 32, 84, 84, 0, 0, 0}, {109, 185, 9, 9, 0, 0, 0}, {110, 84, 254, 254, 3, 1, 2}, {111, 34, 16, 16, 0, 0, 0}, {112, 174, 12, 12, 0, 0, 0}, {113, 124, 36, 39, 0, 0, 0}, {114, 237, 44, 44, 0, 0, 0}, {115, 4, 64, 64, 0, 0, 0}, {116, 76, 22, 24, 0, 0, 0}, {117, 128, 6, 6, 3, 4, 5}, {118, 56, 14, 14, 0, 0, 0}, {119, 116, 12, 12, 3, 10, 11}, {120, 134, 97, 97, 0, 0, 0}, {121, 237, 2, 2, 3, 0, 1}, {122, 203, 2, 2, 3, 0, 1}, {123, 250, 113, 113, 3, 0, 1}, {124, 87, 35, 37, 0, 0, 0}, {125, 203, 6, 6, 0, 0, 0}, {126, 220, 79, 79, 0, 0, 0}, {127, 25, 35, 35, 0, 0, 0}, {128, 226, 35, 35, 0, 0, 0}, {129, 46, 22, 24, 0, 0, 0}, {130, 29, 13, 13, 0, 0, 0}, {131, 223, 255, 255, 0, 0, 0}, {132, 85, 14, 39, 0, 0, 0}, {133, 6, 18, 18, 0, 0, 0}, {134, 229, 43, 43, 0, 0, 0}, {135, 203, 8, 8, 0, 0, 0}, {136, 1, 22, 22, 0, 0, 0}, {137, 195, 14, 16, 0, 0, 0}, {138, 109, 36, 120, 0, 0, 0}, {139, 168, 43, 43, 3, 41, 42}, {140, 181, 41, 41, 0, 0, 0}, {141, 47, 32, 32, 0, 0, 0}, {142, 72, 243, 243, 0, 0, 0}, {143, 131, 14, 16, 0, 0, 0}, {144, 127, 93, 93, 0, 0, 0}, {146, 103, 100, 100, 0, 0, 0}, {147, 154, 36, 54, 0, 0, 0}, {148, 178, 60, 78, 0, 0, 0}, {149, 200, 30, 60, 0, 0, 0}, {162, 189, 8, 9, 0, 0, 0}, {192, 36, 44, 54, 0, 0, 0}, {201, 218, 16, 16, 0, 0, 0}, {202, 231, 41, 41, 0, 0, 0}, {203, 172, 98, 98, 0, 0, 0}, {204, 251, 38, 38, 0, 0, 0}, {205, 97, 14, 14, 0, 0, 0}, {206, 64, 32, 32, 0, 0, 0}, {207, 234, 33, 33, 0, 0, 0}, {208, 144, 16, 16, 0, 0, 0}, {209, 155, 41, 41, 0, 0, 0}, {210, 20, 102, 102, 0, 0, 0}, {211, 54, 16, 16, 0, 0, 0}, {212, 222, 46, 46, 0, 0, 0}, {213, 200, 14, 14, 0, 0, 0}, {214, 23, 24, 24, 0, 0, 0}, {215, 149, 18, 18, 0, 0, 0}, {225, 208, 65, 65, 0, 0, 0}, {230, 163, 42, 42, 0, 0, 0}, {231, 105, 40, 40, 0, 0, 0}, {232, 151, 63, 65, 0, 0, 0}, {233, 35, 182, 182, 0, 0, 0}, {234, 150, 40, 40, 0, 0, 0}, {235, 179, 42, 42, 0, 0, 0}, {241, 90, 32, 32, 0, 0, 0}, {242, 104, 52, 60, 0, 0, 0}, {243, 85, 53, 61, 1, 52, 0}, {244, 95, 6, 6, 0, 0, 0}, {245, 130, 2, 2, 0, 0, 0}, {246, 184, 38, 38, 0, 0, 0}, {247, 81, 19, 19, 0, 0, 0}, {248, 8, 254, 254, 3, 3, 4}, {249, 204, 36, 36, 0, 0, 0}, {250, 49, 30, 30, 0, 0, 0}, {251, 170, 18, 18, 0, 0, 0}, {252, 44, 18, 18, 0, 0, 0}, {253, 83, 51, 54, 0, 0, 0}, {254, 46, 9, 9, 0, 0, 0}, {256, 71, 42, 42, 3, 8, 9}, {257, 131, 9, 9, 0, 0, 0}, {258, 187, 32, 232, 3, 0, 1}, {259, 92, 235, 235, 0, 0, 0}, {260, 146, 5, 13, 0, 0, 0}, {261, 179, 27, 60, 0, 0, 0}, {262, 12, 18, 22, 0, 0, 0}, {263, 133, 255, 255, 0, 0, 0}, {264, 49, 28, 28, 0, 0, 0}, {265, 26, 16, 20, 0, 0, 0}, {266, 193, 255, 255, 3, 2, 3}, {267, 35, 255, 255, 3, 2, 3}, {268, 14, 4, 4, 3, 2, 3}, {269, 109, 213, 213, 0, 0, 0}, {270, 59, 19, 19, 0, 0, 0}, {271, 22, 52, 52, 0, 0, 0}, {275, 126, 31, 31, 0, 0, 0}, {276, 18, 49, 49, 0, 0, 0}, {280, 70, 33, 33, 0, 0, 0}, {281, 48, 13, 13, 0, 0, 0}, {282, 123, 35, 35, 3, 32, 33}, {283, 74, 144, 144, 0, 0, 0}, {284, 99, 32, 32, 3, 30, 31}, {285, 137, 40, 40, 3, 38, 39}, {286, 210, 53, 53, 3, 50, 51}, {287, 1, 23, 23, 3, 20, 21}, {288, 20, 23, 23, 3, 20, 21}, {290, 221, 42, 42, 0, 0, 0}, {291, 10, 57, 57, 0, 0, 0}, {299, 19, 96, 98, 0, 0, 0}, {300, 217, 22, 22, 0, 0, 0}, {301, 243, 58, 58, 0, 0, 0}, {310, 28, 17, 17, 0, 0, 0}, {311, 95, 116, 116, 0, 0, 0}, {320, 243, 20, 20, 3, 2, 3}, {321, 88, 2, 2, 3, 0, 1}, {322, 243, 149, 149, 0, 0, 0}, {323, 78, 147, 147, 3, 0, 1}, {324, 132, 146, 146, 0, 0, 0}, {330, 23, 158, 167, 0, 0, 0}, {331, 91, 230, 232, 0, 0, 0}, {332, 236, 239, 239, 0, 0, 0}, {333, 231, 109, 109, 0, 0, 0}, {334, 72, 10, 10, 0, 0, 0}, {335, 225, 24, 24, 0, 0, 0}, {336, 245, 84, 84, 0, 0, 0}, {339, 199, 5, 5, 0, 0, 0}, {340, 99, 70, 70, 0, 0, 0}, {350, 232, 20, 252, 0, 0, 0}, {360, 11, 25, 25, 0, 0, 0}, {370, 75, 87, 87, 0, 0, 0}, {373, 117, 42, 42, 0, 0, 0}, {375, 251, 140, 140, 0, 0, 0}, {380, 232, 20, 20, 0, 0, 0}, {385, 147, 133, 133, 3, 2, 3}, {390, 156, 238, 238, 0, 0, 0}, {395, 163, 156, 156, 0, 0, 0}, {400, 110, 254, 254, 3, 4, 5}, {401, 183, 6, 6, 3, 4, 5}, {9000, 113, 137, 137, 0, 0, 0}, {9005, 117, 34, 34, 0, 0, 0}, {12900, 114, 44, 44, 3, 0, 1}, {12901, 254, 59, 59, 3, 30, 31}, {12902, 49, 53, 53, 3, 4, 5}, {12903, 249, 46, 46, 3, 0, 1}, {12904, 203, 46, 46, 3, 20, 21}, {12905, 49, 43, 43, 3, 0, 1}, {12915, 62, 254, 254, 3, 0, 1}} -#endif - -#include "../protocol.h" - -#define MAVLINK_ENABLED_ASLUAV - -// ENUM DEFINITIONS - - -/** @brief Commands to be executed by the MAV. They can be executed on user request, or as part of a mission script. If the action is used in a mission, the parameter mapping to the waypoint/mission message is as follows: Param 1, Param 2, Param 3, Param 4, X: Param 5, Y:Param 6, Z:Param 7. This command list is similar what ARINC 424 is for commercial aircraft: A data format how to interpret waypoint/mission data. NaN and INT32_MAX may be used in float/integer params (respectively) to indicate optional/default values (e.g. to use the component's current yaw or latitude rather than a specific value). See https://mavlink.io/en/guide/xml_schema.html#MAV_CMD for information about the structure of the MAV_CMD entries */ -#ifndef HAVE_ENUM_MAV_CMD -#define HAVE_ENUM_MAV_CMD -typedef enum MAV_CMD -{ - MAV_CMD_NAV_WAYPOINT=16, /* Navigate to waypoint. |Hold time. (ignored by fixed wing, time to stay at waypoint for rotary wing)| Acceptance radius (if the sphere with this radius is hit, the waypoint counts as reached)| 0 to pass through the WP, if > 0 radius to pass by WP. Positive value for clockwise orbit, negative value for counter-clockwise orbit. Allows trajectory control.| Desired yaw angle at waypoint (rotary wing). NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_LOITER_UNLIM=17, /* Loiter around this waypoint an unlimited amount of time |Empty| Empty| Loiter radius around waypoint for forward-only moving vehicles (not multicopters). If positive loiter clockwise, else counter-clockwise| Desired yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_LOITER_TURNS=18, /* Loiter around this waypoint for X turns |Number of turns.| Leave loiter circle only once heading towards the next waypoint (0 = False)| Loiter radius around waypoint for forward-only moving vehicles (not multicopters). If positive loiter clockwise, else counter-clockwise| Loiter circle exit location and/or path to next waypoint ("xtrack") for forward-only moving vehicles (not multicopters). 0 for the vehicle to converge towards the center xtrack when it leaves the loiter (the line between the centers of the current and next waypoint), 1 to converge to the direct line between the location that the vehicle exits the loiter radius and the next waypoint. Otherwise the angle (in degrees) between the tangent of the loiter circle and the center xtrack at which the vehicle must leave the loiter (and converge to the center xtrack). NaN to use the current system default xtrack behaviour.| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_LOITER_TIME=19, /* Loiter at the specified latitude, longitude and altitude for a certain amount of time. Multicopter vehicles stop at the point (within a vehicle-specific acceptance radius). Forward-only moving vehicles (e.g. fixed-wing) circle the point with the specified radius/direction. If the Heading Required parameter (2) is non-zero forward moving aircraft will only leave the loiter circle once heading towards the next waypoint. |Loiter time (only starts once Lat, Lon and Alt is reached).| Leave loiter circle only once heading towards the next waypoint (0 = False)| Loiter radius around waypoint for forward-only moving vehicles (not multicopters). If positive loiter clockwise, else counter-clockwise.| Loiter circle exit location and/or path to next waypoint ("xtrack") for forward-only moving vehicles (not multicopters). 0 for the vehicle to converge towards the center xtrack when it leaves the loiter (the line between the centers of the current and next waypoint), 1 to converge to the direct line between the location that the vehicle exits the loiter radius and the next waypoint. Otherwise the angle (in degrees) between the tangent of the loiter circle and the center xtrack at which the vehicle must leave the loiter (and converge to the center xtrack). NaN to use the current system default xtrack behaviour.| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_RETURN_TO_LAUNCH=20, /* Return to launch location |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_NAV_LAND=21, /* Land at location. |Minimum target altitude if landing is aborted (0 = undefined/use system default).| Precision land mode.| Empty.| Desired yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude.| Longitude.| Landing altitude (ground level in current frame).| */ - MAV_CMD_NAV_TAKEOFF=22, /* Takeoff from ground / hand. Vehicles that support multiple takeoff modes (e.g. VTOL quadplane) should take off using the currently configured mode. |Minimum pitch (if airspeed sensor present), desired pitch without sensor| Empty| Empty| Yaw angle (if magnetometer present), ignored without magnetometer. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_LAND_LOCAL=23, /* Land at local position (local frame only) |Landing target number (if available)| Maximum accepted offset from desired landing position - computed magnitude from spherical coordinates: d = sqrt(x^2 + y^2 + z^2), which gives the maximum accepted distance between the desired landing position and the position where the vehicle is about to land| Landing descend rate| Desired yaw angle| Y-axis position| X-axis position| Z-axis / ground level position| */ - MAV_CMD_NAV_TAKEOFF_LOCAL=24, /* Takeoff from local position (local frame only) |Minimum pitch (if airspeed sensor present), desired pitch without sensor| Empty| Takeoff ascend rate| Yaw angle (if magnetometer or another yaw estimation source present), ignored without one of these| Y-axis position| X-axis position| Z-axis position| */ - MAV_CMD_NAV_FOLLOW=25, /* Vehicle following, i.e. this waypoint represents the position of a moving vehicle |Following logic to use (e.g. loitering or sinusoidal following) - depends on specific autopilot implementation| Ground speed of vehicle to be followed| Radius around waypoint. If positive loiter clockwise, else counter-clockwise| Desired yaw angle.| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_CONTINUE_AND_CHANGE_ALT=30, /* Continue on the current course and climb/descend to specified altitude. When the altitude is reached continue to the next command (i.e., don't proceed to the next command until the desired altitude is reached. |Climb or Descend (0 = Neutral, command completes when within 5m of this command's altitude, 1 = Climbing, command completes when at or above this command's altitude, 2 = Descending, command completes when at or below this command's altitude.| Empty| Empty| Empty| Empty| Empty| Desired altitude| */ - MAV_CMD_NAV_LOITER_TO_ALT=31, /* Begin loiter at the specified Latitude and Longitude. If Lat=Lon=0, then loiter at the current position. Don't consider the navigation command complete (don't leave loiter) until the altitude has been reached. Additionally, if the Heading Required parameter is non-zero the aircraft will not leave the loiter until heading toward the next waypoint. |Leave loiter circle only once heading towards the next waypoint (0 = False)| Loiter radius around waypoint for forward-only moving vehicles (not multicopters). If positive loiter clockwise, negative counter-clockwise, 0 means no change to standard loiter.| Empty| Loiter circle exit location and/or path to next waypoint ("xtrack") for forward-only moving vehicles (not multicopters). 0 for the vehicle to converge towards the center xtrack when it leaves the loiter (the line between the centers of the current and next waypoint), 1 to converge to the direct line between the location that the vehicle exits the loiter radius and the next waypoint. Otherwise the angle (in degrees) between the tangent of the loiter circle and the center xtrack at which the vehicle must leave the loiter (and converge to the center xtrack). NaN to use the current system default xtrack behaviour.| Latitude| Longitude| Altitude| */ - MAV_CMD_DO_FOLLOW=32, /* Begin following a target |System ID (of the FOLLOW_TARGET beacon). Send 0 to disable follow-me and return to the default position hold mode.| Reserved| Reserved| Altitude mode: 0: Keep current altitude, 1: keep altitude difference to target, 2: go to a fixed altitude above home.| Altitude above home. (used if mode=2)| Reserved| Time to land in which the MAV should go to the default position hold mode after a message RX timeout.| */ - MAV_CMD_DO_FOLLOW_REPOSITION=33, /* Reposition the MAV after a follow target command has been sent |Camera q1 (where 0 is on the ray from the camera to the tracking device)| Camera q2| Camera q3| Camera q4| altitude offset from target| X offset from target| Y offset from target| */ - MAV_CMD_DO_ORBIT=34, /* Start orbiting on the circumference of a circle defined by the parameters. Setting any value NaN results in using defaults. |Radius of the circle. positive: Orbit clockwise. negative: Orbit counter-clockwise.| Tangential Velocity. NaN: Vehicle configuration default.| Yaw behavior of the vehicle.| Reserved (e.g. for dynamic center beacon options)| Center point latitude (if no MAV_FRAME specified) / X coordinate according to MAV_FRAME. NaN: Use current vehicle position or current center if already orbiting.| Center point longitude (if no MAV_FRAME specified) / Y coordinate according to MAV_FRAME. NaN: Use current vehicle position or current center if already orbiting.| Center point altitude (MSL) (if no MAV_FRAME specified) / Z coordinate according to MAV_FRAME. NaN: Use current vehicle position or current center if already orbiting.| */ - MAV_CMD_NAV_ROI=80, /* Sets the region of interest (ROI) for a sensor set or the vehicle itself. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. |Region of interest mode.| Waypoint index/ target ID. (see MAV_ROI enum)| ROI index (allows a vehicle to manage multiple ROI's)| Empty| x the location of the fixed ROI (see MAV_FRAME)| y| z| */ - MAV_CMD_NAV_PATHPLANNING=81, /* Control autonomous path planning on the MAV. |0: Disable local obstacle avoidance / local path planning (without resetting map), 1: Enable local path planning, 2: Enable and reset local path planning| 0: Disable full path planning (without resetting map), 1: Enable, 2: Enable and reset map/occupancy grid, 3: Enable and reset planned route, but not occupancy grid| Empty| Yaw angle at goal| Latitude/X of goal| Longitude/Y of goal| Altitude/Z of goal| */ - MAV_CMD_NAV_SPLINE_WAYPOINT=82, /* Navigate to waypoint using a spline path. |Hold time. (ignored by fixed wing, time to stay at waypoint for rotary wing)| Empty| Empty| Empty| Latitude/X of goal| Longitude/Y of goal| Altitude/Z of goal| */ - MAV_CMD_NAV_VTOL_TAKEOFF=84, /* Takeoff from ground using VTOL mode, and transition to forward flight with specified heading. The command should be ignored by vehicles that dont support both VTOL and fixed-wing flight (multicopters, boats,etc.). |Empty| Front transition heading.| Empty| Yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_VTOL_LAND=85, /* Land using VTOL mode |Empty| Empty| Approach altitude (with the same reference as the Altitude field). NaN if unspecified.| Yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude| Longitude| Altitude (ground level)| */ - MAV_CMD_NAV_GUIDED_ENABLE=92, /* hand control over to an external controller |On / Off (> 0.5f on)| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_NAV_DELAY=93, /* Delay the next navigation command a number of seconds or until a specified time |Delay (-1 to enable time-of-day fields)| hour (24h format, UTC, -1 to ignore)| minute (24h format, UTC, -1 to ignore)| second (24h format, UTC, -1 to ignore)| Empty| Empty| Empty| */ - MAV_CMD_NAV_PAYLOAD_PLACE=94, /* Descend and place payload. Vehicle moves to specified location, descends until it detects a hanging payload has reached the ground, and then releases the payload. If ground is not detected before the reaching the maximum descent value (param1), the command will complete without releasing the payload. |Maximum distance to descend.| Empty| Empty| Empty| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_LAST=95, /* NOP - This command is only used to mark the upper limit of the NAV/ACTION commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_CONDITION_DELAY=112, /* Delay mission state machine. |Delay| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_CONDITION_CHANGE_ALT=113, /* Ascend/descend to target altitude at specified rate. Delay mission state machine until desired altitude reached. |Descent / Ascend rate.| Empty| Empty| Empty| Empty| Empty| Target Altitude| */ - MAV_CMD_CONDITION_DISTANCE=114, /* Delay mission state machine until within desired distance of next NAV point. |Distance.| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_CONDITION_YAW=115, /* Reach a certain target angle. |target angle, 0 is north| angular speed| direction: -1: counter clockwise, 1: clockwise| 0: absolute angle, 1: relative offset| Empty| Empty| Empty| */ - MAV_CMD_CONDITION_LAST=159, /* NOP - This command is only used to mark the upper limit of the CONDITION commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_MODE=176, /* Set system mode. |Mode| Custom mode - this is system specific, please refer to the individual autopilot specifications for details.| Custom sub mode - this is system specific, please refer to the individual autopilot specifications for details.| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_JUMP=177, /* Jump to the desired command in the mission list. Repeat this action only the specified number of times |Sequence number| Repeat count| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_CHANGE_SPEED=178, /* Change speed and/or throttle set points. |Speed type (0=Airspeed, 1=Ground Speed, 2=Climb Speed, 3=Descent Speed)| Speed (-1 indicates no change)| Throttle (-1 indicates no change)| 0: absolute, 1: relative| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_HOME=179, /* Changes the home location either to the current location or a specified location. |Use current (1=use current location, 0=use specified location)| Empty| Empty| Yaw angle. NaN to use default heading| Latitude| Longitude| Altitude| */ - MAV_CMD_DO_SET_PARAMETER=180, /* Set a system parameter. Caution! Use of this command requires knowledge of the numeric enumeration value of the parameter. |Parameter number| Parameter value| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_RELAY=181, /* Set a relay to a condition. |Relay instance number.| Setting. (1=on, 0=off, others possible depending on system hardware)| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_REPEAT_RELAY=182, /* Cycle a relay on and off for a desired number of cycles with a desired period. |Relay instance number.| Cycle count.| Cycle time.| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_SERVO=183, /* Set a servo to a desired PWM value. |Servo instance number.| Pulse Width Modulation.| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_REPEAT_SERVO=184, /* Cycle a between its nominal setting and a desired PWM for a desired number of cycles with a desired period. |Servo instance number.| Pulse Width Modulation.| Cycle count.| Cycle time.| Empty| Empty| Empty| */ - MAV_CMD_DO_FLIGHTTERMINATION=185, /* Terminate flight immediately |Flight termination activated if > 0.5| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_CHANGE_ALTITUDE=186, /* Change altitude set point. |Altitude.| Frame of new altitude.| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_ACTUATOR=187, /* Sets actuators (e.g. servos) to a desired value. The actuator numbers are mapped to specific outputs (e.g. on any MAIN or AUX PWM or UAVCAN) using a flight-stack specific mechanism (i.e. a parameter). |Actuator 1 value, scaled from [-1 to 1]. NaN to ignore.| Actuator 2 value, scaled from [-1 to 1]. NaN to ignore.| Actuator 3 value, scaled from [-1 to 1]. NaN to ignore.| Actuator 4 value, scaled from [-1 to 1]. NaN to ignore.| Actuator 5 value, scaled from [-1 to 1]. NaN to ignore.| Actuator 6 value, scaled from [-1 to 1]. NaN to ignore.| Index of actuator set (i.e if set to 1, Actuator 1 becomes Actuator 7)| */ - MAV_CMD_DO_LAND_START=189, /* Mission command to perform a landing. This is used as a marker in a mission to tell the autopilot where a sequence of mission items that represents a landing starts. It may also be sent via a COMMAND_LONG to trigger a landing, in which case the nearest (geographically) landing sequence in the mission will be used. The Latitude/Longitude is optional, and may be set to 0 if not needed. If specified then it will be used to help find the closest landing sequence. |Empty| Empty| Empty| Empty| Latitude| Longitude| Empty| */ - MAV_CMD_DO_RALLY_LAND=190, /* Mission command to perform a landing from a rally point. |Break altitude| Landing speed| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_GO_AROUND=191, /* Mission command to safely abort an autonomous landing. |Altitude| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_REPOSITION=192, /* Reposition the vehicle to a specific WGS84 global position. |Ground speed, less than 0 (-1) for default| Bitmask of option flags.| Reserved| Yaw heading. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.). For planes indicates loiter direction (0: clockwise, 1: counter clockwise)| Latitude| Longitude| Altitude| */ - MAV_CMD_DO_PAUSE_CONTINUE=193, /* If in a GPS controlled position mode, hold the current position or continue. |0: Pause current mission or reposition command, hold current position. 1: Continue mission. A VTOL capable vehicle should enter hover mode (multicopter and VTOL planes). A plane should loiter with the default loiter radius.| Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| */ - MAV_CMD_DO_SET_REVERSE=194, /* Set moving direction to forward or reverse. |Direction (0=Forward, 1=Reverse)| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_ROI_LOCATION=195, /* Sets the region of interest (ROI) to a location. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. This command can be sent to a gimbal manager but not to a gimbal device. A gimbal is not to react to this message. |Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| Empty| Empty| Empty| Latitude of ROI location| Longitude of ROI location| Altitude of ROI location| */ - MAV_CMD_DO_SET_ROI_WPNEXT_OFFSET=196, /* Sets the region of interest (ROI) to be toward next waypoint, with optional pitch/roll/yaw offset. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. This command can be sent to a gimbal manager but not to a gimbal device. A gimbal device is not to react to this message. |Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| Empty| Empty| Empty| Pitch offset from next waypoint, positive pitching up| Roll offset from next waypoint, positive rolling to the right| Yaw offset from next waypoint, positive yawing to the right| */ - MAV_CMD_DO_SET_ROI_NONE=197, /* Cancels any previous ROI command returning the vehicle/sensors to default flight characteristics. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. This command can be sent to a gimbal manager but not to a gimbal device. A gimbal device is not to react to this message. After this command the gimbal manager should go back to manual input if available, and otherwise assume a neutral position. |Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_ROI_SYSID=198, /* Mount tracks system with specified system ID. Determination of target vehicle position may be done with GLOBAL_POSITION_INT or any other means. This command can be sent to a gimbal manager but not to a gimbal device. A gimbal device is not to react to this message. |System ID| Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_DO_CONTROL_VIDEO=200, /* Control onboard camera system. |Camera ID (-1 for all)| Transmission: 0: disabled, 1: enabled compressed, 2: enabled raw| Transmission mode: 0: video stream, >0: single images every n seconds| Recording: 0: disabled, 1: enabled compressed, 2: enabled raw| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_ROI=201, /* Sets the region of interest (ROI) for a sensor set or the vehicle itself. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. |Region of interest mode.| Waypoint index/ target ID (depends on param 1).| Region of interest index. (allows a vehicle to manage multiple ROI's)| Empty| MAV_ROI_WPNEXT: pitch offset from next waypoint, MAV_ROI_LOCATION: latitude| MAV_ROI_WPNEXT: roll offset from next waypoint, MAV_ROI_LOCATION: longitude| MAV_ROI_WPNEXT: yaw offset from next waypoint, MAV_ROI_LOCATION: altitude| */ - MAV_CMD_DO_DIGICAM_CONFIGURE=202, /* Configure digital camera. This is a fallback message for systems that have not yet implemented PARAM_EXT_XXX messages and camera definition files (see https://mavlink.io/en/services/camera_def.html ). |Modes: P, TV, AV, M, Etc.| Shutter speed: Divisor number for one second.| Aperture: F stop number.| ISO number e.g. 80, 100, 200, Etc.| Exposure type enumerator.| Command Identity.| Main engine cut-off time before camera trigger. (0 means no cut-off)| */ - MAV_CMD_DO_DIGICAM_CONTROL=203, /* Control digital camera. This is a fallback message for systems that have not yet implemented PARAM_EXT_XXX messages and camera definition files (see https://mavlink.io/en/services/camera_def.html ). |Session control e.g. show/hide lens| Zoom's absolute position| Zooming step value to offset zoom from the current position| Focus Locking, Unlocking or Re-locking| Shooting Command| Command Identity| Test shot identifier. If set to 1, image will only be captured, but not counted towards internal frame count.| */ - MAV_CMD_DO_MOUNT_CONFIGURE=204, /* Mission command to configure a camera or antenna mount |Mount operation mode| stabilize roll? (1 = yes, 0 = no)| stabilize pitch? (1 = yes, 0 = no)| stabilize yaw? (1 = yes, 0 = no)| roll input (0 = angle body frame, 1 = angular rate, 2 = angle absolute frame)| pitch input (0 = angle body frame, 1 = angular rate, 2 = angle absolute frame)| yaw input (0 = angle body frame, 1 = angular rate, 2 = angle absolute frame)| */ - MAV_CMD_DO_MOUNT_CONTROL=205, /* Mission command to control a camera or antenna mount |pitch depending on mount mode (degrees or degrees/second depending on pitch input).| roll depending on mount mode (degrees or degrees/second depending on roll input).| yaw depending on mount mode (degrees or degrees/second depending on yaw input).| altitude depending on mount mode.| latitude, set if appropriate mount mode.| longitude, set if appropriate mount mode.| Mount mode.| */ - MAV_CMD_DO_SET_CAM_TRIGG_DIST=206, /* Mission command to set camera trigger distance for this flight. The camera is triggered each time this distance is exceeded. This command can also be used to set the shutter integration time for the camera. |Camera trigger distance. 0 to stop triggering.| Camera shutter integration time. -1 or 0 to ignore| Trigger camera once immediately. (0 = no trigger, 1 = trigger)| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_FENCE_ENABLE=207, /* Mission command to enable the geofence |enable? (0=disable, 1=enable, 2=disable_floor_only)| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_PARACHUTE=208, /* Mission item/command to release a parachute or enable/disable auto release. |Action| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_MOTOR_TEST=209, /* Mission command to perform motor test. |Motor instance number. (from 1 to max number of motors on the vehicle)| Throttle type.| Throttle.| Timeout.| Motor count. (number of motors to test to test in sequence, waiting for the timeout above between them; 0=1 motor, 1=1 motor, 2=2 motors...)| Motor test order.| Empty| */ - MAV_CMD_DO_INVERTED_FLIGHT=210, /* Change to/from inverted flight. |Inverted flight. (0=normal, 1=inverted)| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_GRIPPER=211, /* Mission command to operate a gripper. |Gripper instance number.| Gripper action to perform.| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_AUTOTUNE_ENABLE=212, /* Enable/disable autotune. |Enable (1: enable, 0:disable).| Empty.| Empty.| Empty.| Empty.| Empty.| Empty.| */ - MAV_CMD_NAV_SET_YAW_SPEED=213, /* Sets a desired vehicle turn angle and speed change. |Yaw angle to adjust steering by.| Speed.| Final angle. (0=absolute, 1=relative)| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_CAM_TRIGG_INTERVAL=214, /* Mission command to set camera trigger interval for this flight. If triggering is enabled, the camera is triggered each time this interval expires. This command can also be used to set the shutter integration time for the camera. |Camera trigger cycle time. -1 or 0 to ignore.| Camera shutter integration time. Should be less than trigger cycle time. -1 or 0 to ignore.| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_MOUNT_CONTROL_QUAT=220, /* Mission command to control a camera or antenna mount, using a quaternion as reference. |quaternion param q1, w (1 in null-rotation)| quaternion param q2, x (0 in null-rotation)| quaternion param q3, y (0 in null-rotation)| quaternion param q4, z (0 in null-rotation)| Empty| Empty| Empty| */ - MAV_CMD_DO_GUIDED_MASTER=221, /* set id of master controller |System ID| Component ID| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_GUIDED_LIMITS=222, /* Set limits for external control |Timeout - maximum time that external controller will be allowed to control vehicle. 0 means no timeout.| Altitude (MSL) min - if vehicle moves below this alt, the command will be aborted and the mission will continue. 0 means no lower altitude limit.| Altitude (MSL) max - if vehicle moves above this alt, the command will be aborted and the mission will continue. 0 means no upper altitude limit.| Horizontal move limit - if vehicle moves more than this distance from its location at the moment the command was executed, the command will be aborted and the mission will continue. 0 means no horizontal move limit.| Empty| Empty| Empty| */ - MAV_CMD_DO_ENGINE_CONTROL=223, /* Control vehicle engine. This is interpreted by the vehicles engine controller to change the target engine state. It is intended for vehicles with internal combustion engines |0: Stop engine, 1:Start Engine| 0: Warm start, 1:Cold start. Controls use of choke where applicable| Height delay. This is for commanding engine start only after the vehicle has gained the specified height. Used in VTOL vehicles during takeoff to start engine after the aircraft is off the ground. Zero for no delay.| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_MISSION_CURRENT=224, /* Set the mission item with sequence number seq as current item. This means that the MAV will continue to this mission item on the shortest path (not following the mission items in-between). |Mission sequence value to set| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_LAST=240, /* NOP - This command is only used to mark the upper limit of the DO commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_PREFLIGHT_CALIBRATION=241, /* Trigger calibration. This command will be only accepted if in pre-flight mode. Except for Temperature Calibration, only one sensor should be set in a single message and all others should be zero. |1: gyro calibration, 3: gyro temperature calibration| 1: magnetometer calibration| 1: ground pressure calibration| 1: radio RC calibration, 2: RC trim calibration| 1: accelerometer calibration, 2: board level calibration, 3: accelerometer temperature calibration, 4: simple accelerometer calibration| 1: APM: compass/motor interference calibration (PX4: airspeed calibration, deprecated), 2: airspeed calibration| 1: ESC calibration, 3: barometer temperature calibration| */ - MAV_CMD_PREFLIGHT_SET_SENSOR_OFFSETS=242, /* Set sensor offsets. This command will be only accepted if in pre-flight mode. |Sensor to adjust the offsets for: 0: gyros, 1: accelerometer, 2: magnetometer, 3: barometer, 4: optical flow, 5: second magnetometer, 6: third magnetometer| X axis offset (or generic dimension 1), in the sensor's raw units| Y axis offset (or generic dimension 2), in the sensor's raw units| Z axis offset (or generic dimension 3), in the sensor's raw units| Generic dimension 4, in the sensor's raw units| Generic dimension 5, in the sensor's raw units| Generic dimension 6, in the sensor's raw units| */ - MAV_CMD_PREFLIGHT_UAVCAN=243, /* Trigger UAVCAN configuration (actuator ID assignment and direction mapping). Note that this maps to the legacy UAVCAN v0 function UAVCAN_ENUMERATE, which is intended to be executed just once during initial vehicle configuration (it is not a normal pre-flight command and has been poorly named). |1: Trigger actuator ID assignment and direction mapping. 0: Cancel command.| Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| */ - MAV_CMD_PREFLIGHT_STORAGE=245, /* Request storage of different parameter values and logs. This command will be only accepted if in pre-flight mode. |Parameter storage: 0: READ FROM FLASH/EEPROM, 1: WRITE CURRENT TO FLASH/EEPROM, 2: Reset to defaults| Mission storage: 0: READ FROM FLASH/EEPROM, 1: WRITE CURRENT TO FLASH/EEPROM, 2: Reset to defaults| Onboard logging: 0: Ignore, 1: Start default rate logging, -1: Stop logging, > 1: logging rate (e.g. set to 1000 for 1000 Hz logging)| Reserved| Empty| Empty| Empty| */ - MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN=246, /* Request the reboot or shutdown of system components. |0: Do nothing for autopilot, 1: Reboot autopilot, 2: Shutdown autopilot, 3: Reboot autopilot and keep it in the bootloader until upgraded.| 0: Do nothing for onboard computer, 1: Reboot onboard computer, 2: Shutdown onboard computer, 3: Reboot onboard computer and keep it in the bootloader until upgraded.| WIP: 0: Do nothing for camera, 1: Reboot onboard camera, 2: Shutdown onboard camera, 3: Reboot onboard camera and keep it in the bootloader until upgraded| WIP: 0: Do nothing for mount (e.g. gimbal), 1: Reboot mount, 2: Shutdown mount, 3: Reboot mount and keep it in the bootloader until upgraded| Reserved (set to 0)| Reserved (set to 0)| WIP: ID (e.g. camera ID -1 for all IDs)| */ - MAV_CMD_DO_UPGRADE=247, /* Request a target system to start an upgrade of one (or all) of its components. For example, the command might be sent to a companion computer to cause it to upgrade a connected flight controller. The system doing the upgrade will report progress using the normal command protocol sequence for a long running operation. Command protocol information: https://mavlink.io/en/services/command.html. |Component id of the component to be upgraded. If set to 0, all components should be upgraded.| 0: Do not reboot component after the action is executed, 1: Reboot component after the action is executed.| Reserved| Reserved| Reserved| Reserved| WIP: upgrade progress report rate (can be used for more granular control).| */ - MAV_CMD_OVERRIDE_GOTO=252, /* Override current mission with command to pause mission, pause mission and move to position, continue/resume mission. When param 1 indicates that the mission is paused (MAV_GOTO_DO_HOLD), param 2 defines whether it holds in place or moves to another position. |MAV_GOTO_DO_HOLD: pause mission and either hold or move to specified position (depending on param2), MAV_GOTO_DO_CONTINUE: resume mission.| MAV_GOTO_HOLD_AT_CURRENT_POSITION: hold at current position, MAV_GOTO_HOLD_AT_SPECIFIED_POSITION: hold at specified position.| Coordinate frame of hold point.| Desired yaw angle.| Latitude/X position.| Longitude/Y position.| Altitude/Z position.| */ - MAV_CMD_OBLIQUE_SURVEY=260, /* Mission command to set a Camera Auto Mount Pivoting Oblique Survey (Replaces CAM_TRIGG_DIST for this purpose). The camera is triggered each time this distance is exceeded, then the mount moves to the next position. Params 4~6 set-up the angle limits and number of positions for oblique survey, where mount-enabled vehicles automatically roll the camera between shots to emulate an oblique camera setup (providing an increased HFOV). This command can also be used to set the shutter integration time for the camera. |Camera trigger distance. 0 to stop triggering.| Camera shutter integration time. 0 to ignore| The minimum interval in which the camera is capable of taking subsequent pictures repeatedly. 0 to ignore.| Total number of roll positions at which the camera will capture photos (images captures spread evenly across the limits defined by param5).| Angle limits that the camera can be rolled to left and right of center.| Fixed pitch angle that the camera will hold in oblique mode if the mount is actuated in the pitch axis.| Empty| */ - MAV_CMD_MISSION_START=300, /* start running a mission |first_item: the first mission item to run| last_item: the last mission item to run (after this item is run, the mission ends)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_COMPONENT_ARM_DISARM=400, /* Arms / Disarms a component |0: disarm, 1: arm| 0: arm-disarm unless prevented by safety checks (i.e. when landed), 21196: force arming/disarming (e.g. allow arming to override preflight checks and disarming in flight)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_ILLUMINATOR_ON_OFF=405, /* Turns illuminators ON/OFF. An illuminator is a light source that is used for lighting up dark areas external to the sytstem: e.g. a torch or searchlight (as opposed to a light source for illuminating the system itself, e.g. an indicator light). |0: Illuminators OFF, 1: Illuminators ON| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_GET_HOME_POSITION=410, /* Request the home position from the vehicle. |Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| */ - MAV_CMD_INJECT_FAILURE=420, /* Inject artificial failure for testing purposes. Note that autopilots should implement an additional protection before accepting this command such as a specific param setting. |The unit which is affected by the failure.| The type how the failure manifests itself.| Instance affected by failure (0 to signal all).| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_START_RX_PAIR=500, /* Starts receiver pairing. |0:Spektrum.| RC type.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_GET_MESSAGE_INTERVAL=510, /* Request the interval between messages for a particular MAVLink message ID. The receiver should ACK the command and then emit its response in a MESSAGE_INTERVAL message. |The MAVLink message ID| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_SET_MESSAGE_INTERVAL=511, /* Set the interval between messages for a particular MAVLink message ID. This interface replaces REQUEST_DATA_STREAM. |The MAVLink message ID| The interval between two messages. Set to -1 to disable and 0 to request default rate.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Target address of message stream (if message has target address fields). 0: Flight-stack default (recommended), 1: address of requestor, 2: broadcast.| */ - MAV_CMD_REQUEST_MESSAGE=512, /* Request the target system(s) emit a single instance of a specified message (i.e. a "one-shot" version of MAV_CMD_SET_MESSAGE_INTERVAL). |The MAVLink message ID of the requested message.| Use for index ID, if required. Otherwise, the use of this parameter (if any) must be defined in the requested message. By default assumed not used (0).| The use of this parameter (if any), must be defined in the requested message. By default assumed not used (0).| The use of this parameter (if any), must be defined in the requested message. By default assumed not used (0).| The use of this parameter (if any), must be defined in the requested message. By default assumed not used (0).| The use of this parameter (if any), must be defined in the requested message. By default assumed not used (0).| Target address for requested message (if message has target address fields). 0: Flight-stack default, 1: address of requestor, 2: broadcast.| */ - MAV_CMD_REQUEST_PROTOCOL_VERSION=519, /* Request MAVLink protocol version compatibility. All receivers should ACK the command and then emit their capabilities in an PROTOCOL_VERSION message |1: Request supported protocol versions by all nodes on the network| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES=520, /* Request autopilot capabilities. The receiver should ACK the command and then emit its capabilities in an AUTOPILOT_VERSION message |1: Request autopilot version| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_CAMERA_INFORMATION=521, /* Request camera information (CAMERA_INFORMATION). |0: No action 1: Request camera capabilities| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_CAMERA_SETTINGS=522, /* Request camera settings (CAMERA_SETTINGS). |0: No Action 1: Request camera settings| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_STORAGE_INFORMATION=525, /* Request storage information (STORAGE_INFORMATION). Use the command's target_component to target a specific component's storage. |Storage ID (0 for all, 1 for first, 2 for second, etc.)| 0: No Action 1: Request storage information| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_STORAGE_FORMAT=526, /* Format a storage medium. Once format is complete, a STORAGE_INFORMATION message is sent. Use the command's target_component to target a specific component's storage. |Storage ID (1 for first, 2 for second, etc.)| Format storage (and reset image log). 0: No action 1: Format storage| Reset Image Log (without formatting storage medium). This will reset CAMERA_CAPTURE_STATUS.image_count and CAMERA_IMAGE_CAPTURED.image_index. 0: No action 1: Reset Image Log| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_CAMERA_CAPTURE_STATUS=527, /* Request camera capture status (CAMERA_CAPTURE_STATUS) |0: No Action 1: Request camera capture status| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_FLIGHT_INFORMATION=528, /* Request flight information (FLIGHT_INFORMATION) |1: Request flight information| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_RESET_CAMERA_SETTINGS=529, /* Reset all camera settings to Factory Default |0: No Action 1: Reset all settings| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_SET_CAMERA_MODE=530, /* Set camera running mode. Use NaN for reserved values. GCS will send a MAV_CMD_REQUEST_VIDEO_STREAM_STATUS command after a mode change if the camera supports video streaming. |Reserved (Set to 0)| Camera mode| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ - MAV_CMD_SET_CAMERA_ZOOM=531, /* Set camera zoom. Camera must respond with a CAMERA_SETTINGS message (on success). |Zoom type| Zoom value. The range of valid values depend on the zoom type.| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ - MAV_CMD_SET_CAMERA_FOCUS=532, /* Set camera focus. Camera must respond with a CAMERA_SETTINGS message (on success). |Focus type| Focus value| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ - MAV_CMD_JUMP_TAG=600, /* Tagged jump target. Can be jumped to with MAV_CMD_DO_JUMP_TAG. |Tag.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_DO_JUMP_TAG=601, /* Jump to the matching tag in the mission list. Repeat this action for the specified number of times. A mission should contain a single matching tag for each jump. If this is not the case then a jump to a missing tag should complete the mission, and a jump where there are multiple matching tags should always select the one with the lowest mission sequence number. |Target tag to jump to.| Repeat count.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_PARAM_TRANSACTION=900, /* Request to start or end a parameter transaction. Multiple kinds of transport layers can be used to exchange parameters in the transaction (param, param_ext and mavftp). The command response can either be a success/failure or an in progress in case the receiving side takes some time to apply the parameters. |Action to be performed (start, commit, cancel, etc.)| Possible transport layers to set and get parameters via mavlink during a parameter transaction.| Identifier for a specific transaction.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_DO_GIMBAL_MANAGER_PITCHYAW=1000, /* High level setpoint to be sent to a gimbal manager to set a gimbal attitude. It is possible to set combinations of the values below. E.g. an angle as well as a desired angular rate can be used to get to this angle at a certain angular rate, or an angular rate only will result in continuous turning. NaN is to be used to signal unset. Note: a gimbal is never to react to this command but only the gimbal manager. |Pitch angle (positive to pitch up, relative to vehicle for FOLLOW mode, relative to world horizon for LOCK mode).| Yaw angle (positive to yaw to the right, relative to vehicle for FOLLOW mode, absolute to North for LOCK mode).| Pitch rate (positive to pitch up).| Yaw rate (positive to yaw to the right).| Gimbal manager flags to use.| Reserved (default:0)| Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| */ - MAV_CMD_DO_GIMBAL_MANAGER_CONFIGURE=1001, /* Gimbal configuration to set which sysid/compid is in primary and secondary control. |Sysid for primary control (0: no one in control, -1: leave unchanged, -2: set itself in control (for missions where the own sysid is still unknown), -3: remove control if currently in control).| Compid for primary control (0: no one in control, -1: leave unchanged, -2: set itself in control (for missions where the own sysid is still unknown), -3: remove control if currently in control).| Sysid for secondary control (0: no one in control, -1: leave unchanged, -2: set itself in control (for missions where the own sysid is still unknown), -3: remove control if currently in control).| Compid for secondary control (0: no one in control, -1: leave unchanged, -2: set itself in control (for missions where the own sysid is still unknown), -3: remove control if currently in control).| Reserved (default:0)| Reserved (default:0)| Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| */ - MAV_CMD_IMAGE_START_CAPTURE=2000, /* Start image capture sequence. Sends CAMERA_IMAGE_CAPTURED after each capture. Use NaN for reserved values. |Reserved (Set to 0)| Desired elapsed time between two consecutive pictures (in seconds). Minimum values depend on hardware (typically greater than 2 seconds).| Total number of images to capture. 0 to capture forever/until MAV_CMD_IMAGE_STOP_CAPTURE.| Capture sequence number starting from 1. This is only valid for single-capture (param3 == 1), otherwise set to 0. Increment the capture ID for each capture command to prevent double captures when a command is re-transmitted.| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| */ - MAV_CMD_IMAGE_STOP_CAPTURE=2001, /* Stop image capture sequence Use NaN for reserved values. |Reserved (Set to 0)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ - MAV_CMD_REQUEST_CAMERA_IMAGE_CAPTURE=2002, /* Re-request a CAMERA_IMAGE_CAPTURED message. |Sequence number for missing CAMERA_IMAGE_CAPTURED message| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ - MAV_CMD_DO_TRIGGER_CONTROL=2003, /* Enable or disable on-board camera triggering system. |Trigger enable/disable (0 for disable, 1 for start), -1 to ignore| 1 to reset the trigger sequence, -1 or 0 to ignore| 1 to pause triggering, but without switching the camera off or retracting it. -1 to ignore| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_CAMERA_TRACK_POINT=2004, /* If the camera supports point visual tracking (CAMERA_CAP_FLAGS_HAS_TRACKING_POINT is set), this command allows to initiate the tracking. |Point to track x value (normalized 0..1, 0 is left, 1 is right).| Point to track y value (normalized 0..1, 0 is top, 1 is bottom).| Point radius (normalized 0..1, 0 is image left, 1 is image right).| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_CAMERA_TRACK_RECTANGLE=2005, /* If the camera supports rectangle visual tracking (CAMERA_CAP_FLAGS_HAS_TRACKING_RECTANGLE is set), this command allows to initiate the tracking. |Top left corner of rectangle x value (normalized 0..1, 0 is left, 1 is right).| Top left corner of rectangle y value (normalized 0..1, 0 is top, 1 is bottom).| Bottom right corner of rectangle x value (normalized 0..1, 0 is left, 1 is right).| Bottom right corner of rectangle y value (normalized 0..1, 0 is top, 1 is bottom).| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_CAMERA_STOP_TRACKING=2010, /* Stops ongoing tracking. |Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_VIDEO_START_CAPTURE=2500, /* Starts video capture (recording). |Video Stream ID (0 for all streams)| Frequency CAMERA_CAPTURE_STATUS messages should be sent while recording (0 for no messages, otherwise frequency)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| */ - MAV_CMD_VIDEO_STOP_CAPTURE=2501, /* Stop the current video capture (recording). |Video Stream ID (0 for all streams)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| */ - MAV_CMD_VIDEO_START_STREAMING=2502, /* Start video streaming |Video Stream ID (0 for all streams, 1 for first, 2 for second, etc.)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_VIDEO_STOP_STREAMING=2503, /* Stop the given video stream |Video Stream ID (0 for all streams, 1 for first, 2 for second, etc.)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_VIDEO_STREAM_INFORMATION=2504, /* Request video stream information (VIDEO_STREAM_INFORMATION) |Video Stream ID (0 for all streams, 1 for first, 2 for second, etc.)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_VIDEO_STREAM_STATUS=2505, /* Request video stream status (VIDEO_STREAM_STATUS) |Video Stream ID (0 for all streams, 1 for first, 2 for second, etc.)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_LOGGING_START=2510, /* Request to start streaming logging data over MAVLink (see also LOGGING_DATA message) |Format: 0: ULog| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| */ - MAV_CMD_LOGGING_STOP=2511, /* Request to stop streaming log data over MAVLink |Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| */ - MAV_CMD_AIRFRAME_CONFIGURATION=2520, /* |Landing gear ID (default: 0, -1 for all)| Landing gear position (Down: 0, Up: 1, NaN for no change)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| */ - MAV_CMD_CONTROL_HIGH_LATENCY=2600, /* Request to start/stop transmitting over the high latency telemetry |Control transmission over high latency telemetry (0: stop, 1: start)| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_PANORAMA_CREATE=2800, /* Create a panorama at the current position |Viewing angle horizontal of the panorama (+- 0.5 the total angle)| Viewing angle vertical of panorama.| Speed of the horizontal rotation.| Speed of the vertical rotation.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_DO_VTOL_TRANSITION=3000, /* Request VTOL transition |The target VTOL state. Only MAV_VTOL_STATE_MC and MAV_VTOL_STATE_FW can be used.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_ARM_AUTHORIZATION_REQUEST=3001, /* Request authorization to arm the vehicle to a external entity, the arm authorizer is responsible to request all data that is needs from the vehicle before authorize or deny the request. If approved the progress of command_ack message should be set with period of time that this authorization is valid in seconds or in case it was denied it should be set with one of the reasons in ARM_AUTH_DENIED_REASON. - |Vehicle system id, this way ground station can request arm authorization on behalf of any vehicle| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_SET_GUIDED_SUBMODE_STANDARD=4000, /* This command sets the submode to standard guided when vehicle is in guided mode. The vehicle holds position and altitude and the user can input the desired velocities along all three axes. - |Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_SET_GUIDED_SUBMODE_CIRCLE=4001, /* This command sets submode circle when vehicle is in guided mode. Vehicle flies along a circle facing the center of the circle. The user can input the velocity along the circle and change the radius. If no input is given the vehicle will hold position. - |Radius of desired circle in CIRCLE_MODE| User defined| User defined| User defined| Target latitude of center of circle in CIRCLE_MODE| Target longitude of center of circle in CIRCLE_MODE| Reserved (default:0)| */ - MAV_CMD_CONDITION_GATE=4501, /* Delay mission state machine until gate has been reached. |Geometry: 0: orthogonal to path between previous and next waypoint.| Altitude: 0: ignore altitude| Empty| Empty| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_FENCE_RETURN_POINT=5000, /* Fence return point. There can only be one fence return point. - |Reserved| Reserved| Reserved| Reserved| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_FENCE_POLYGON_VERTEX_INCLUSION=5001, /* Fence vertex for an inclusion polygon (the polygon must not be self-intersecting). The vehicle must stay within this area. Minimum of 3 vertices required. - |Polygon vertex count| Vehicle must be inside ALL inclusion zones in a single group, vehicle must be inside at least one group, must be the same for all points in each polygon| Reserved| Reserved| Latitude| Longitude| Reserved| */ - MAV_CMD_NAV_FENCE_POLYGON_VERTEX_EXCLUSION=5002, /* Fence vertex for an exclusion polygon (the polygon must not be self-intersecting). The vehicle must stay outside this area. Minimum of 3 vertices required. - |Polygon vertex count| Reserved| Reserved| Reserved| Latitude| Longitude| Reserved| */ - MAV_CMD_NAV_FENCE_CIRCLE_INCLUSION=5003, /* Circular fence area. The vehicle must stay inside this area. - |Radius.| Vehicle must be inside ALL inclusion zones in a single group, vehicle must be inside at least one group| Reserved| Reserved| Latitude| Longitude| Reserved| */ - MAV_CMD_NAV_FENCE_CIRCLE_EXCLUSION=5004, /* Circular fence area. The vehicle must stay outside this area. - |Radius.| Reserved| Reserved| Reserved| Latitude| Longitude| Reserved| */ - MAV_CMD_NAV_RALLY_POINT=5100, /* Rally point. You can have multiple rally points defined. - |Reserved| Reserved| Reserved| Reserved| Latitude| Longitude| Altitude| */ - MAV_CMD_UAVCAN_GET_NODE_INFO=5200, /* Commands the vehicle to respond with a sequence of messages UAVCAN_NODE_INFO, one message per every UAVCAN node that is online. Note that some of the response messages can be lost, which the receiver can detect easily by checking whether every received UAVCAN_NODE_STATUS has a matching message UAVCAN_NODE_INFO received earlier; if not, this command should be sent again in order to request re-transmission of the node information messages. |Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| */ - MAV_CMD_PAYLOAD_PREPARE_DEPLOY=30001, /* Deploy payload on a Lat / Lon / Alt position. This includes the navigation to reach the required release position and velocity. |Operation mode. 0: prepare single payload deploy (overwriting previous requests), but do not execute it. 1: execute payload deploy immediately (rejecting further deploy commands during execution, but allowing abort). 2: add payload deploy to existing deployment list.| Desired approach vector in compass heading. A negative value indicates the system can define the approach vector at will.| Desired ground speed at release time. This can be overridden by the airframe in case it needs to meet minimum airspeed. A negative value indicates the system can define the ground speed at will.| Minimum altitude clearance to the release position. A negative value indicates the system can define the clearance at will.| Latitude. Note, if used in MISSION_ITEM (deprecated) the units are degrees (unscaled)| Longitude. Note, if used in MISSION_ITEM (deprecated) the units are degrees (unscaled)| Altitude (MSL)| */ - MAV_CMD_PAYLOAD_CONTROL_DEPLOY=30002, /* Control the payload deployment. |Operation mode. 0: Abort deployment, continue normal mission. 1: switch to payload deployment mode. 100: delete first payload deployment request. 101: delete all payload deployment requests.| Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| */ - MAV_CMD_WAYPOINT_USER_1=31000, /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_WAYPOINT_USER_2=31001, /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_WAYPOINT_USER_3=31002, /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_WAYPOINT_USER_4=31003, /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_WAYPOINT_USER_5=31004, /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_SPATIAL_USER_1=31005, /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_SPATIAL_USER_2=31006, /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_SPATIAL_USER_3=31007, /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_SPATIAL_USER_4=31008, /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_SPATIAL_USER_5=31009, /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_USER_1=31010, /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ - MAV_CMD_USER_2=31011, /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ - MAV_CMD_USER_3=31012, /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ - MAV_CMD_USER_4=31013, /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ - MAV_CMD_USER_5=31014, /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ - MAV_CMD_RESET_MPPT=40001, /* Mission command to reset Maximum Power Point Tracker (MPPT) |MPPT number| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_PAYLOAD_CONTROL=40002, /* Mission command to perform a power cycle on payload |Complete power cycle| VISensor power cycle| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_FIXED_MAG_CAL_YAW=42006, /* Magnetometer calibration based on provided known yaw. This allows for fast calibration using WMM field tables in the vehicle, given only the known yaw of the vehicle. If Latitude and longitude are both zero then use the current vehicle location. |Yaw of vehicle in earth frame.| CompassMask, 0 for all.| Latitude.| Longitude.| Empty.| Empty.| Empty.| */ - MAV_CMD_DO_WINCH=42600, /* Command to operate winch. |Winch instance number.| Action to perform.| Length of cable to release (negative to wind).| Release rate (negative to wind).| Empty.| Empty.| Empty.| */ - MAV_CMD_ENUM_END=42601, /* | */ -} MAV_CMD; -#endif - -/** @brief */ -#ifndef HAVE_ENUM_GSM_LINK_TYPE -#define HAVE_ENUM_GSM_LINK_TYPE -typedef enum GSM_LINK_TYPE -{ - GSM_LINK_TYPE_NONE=0, /* no service | */ - GSM_LINK_TYPE_UNKNOWN=1, /* link type unknown | */ - GSM_LINK_TYPE_2G=2, /* 2G (GSM/GRPS/EDGE) link | */ - GSM_LINK_TYPE_3G=3, /* 3G link (WCDMA/HSDPA/HSPA) | */ - GSM_LINK_TYPE_4G=4, /* 4G link (LTE) | */ - GSM_LINK_TYPE_ENUM_END=5, /* | */ -} GSM_LINK_TYPE; -#endif - -/** @brief */ -#ifndef HAVE_ENUM_GSM_MODEM_TYPE -#define HAVE_ENUM_GSM_MODEM_TYPE -typedef enum GSM_MODEM_TYPE -{ - GSM_MODEM_TYPE_UNKNOWN=0, /* not specified | */ - GSM_MODEM_TYPE_HUAWEI_E3372=1, /* HUAWEI LTE USB Stick E3372 | */ - GSM_MODEM_TYPE_ENUM_END=2, /* | */ -} GSM_MODEM_TYPE; -#endif - -// MAVLINK VERSION - -#ifndef MAVLINK_VERSION -#define MAVLINK_VERSION 2 -#endif - -#if (MAVLINK_VERSION == 0) -#undef MAVLINK_VERSION -#define MAVLINK_VERSION 2 -#endif - -// MESSAGE DEFINITIONS -#include "./mavlink_msg_command_int_stamped.h" -#include "./mavlink_msg_command_long_stamped.h" -#include "./mavlink_msg_sens_power.h" -#include "./mavlink_msg_sens_mppt.h" -#include "./mavlink_msg_aslctrl_data.h" -#include "./mavlink_msg_aslctrl_debug.h" -#include "./mavlink_msg_asluav_status.h" -#include "./mavlink_msg_ekf_ext.h" -#include "./mavlink_msg_asl_obctrl.h" -#include "./mavlink_msg_sens_atmos.h" -#include "./mavlink_msg_sens_batmon.h" -#include "./mavlink_msg_fw_soaring_data.h" -#include "./mavlink_msg_sensorpod_status.h" -#include "./mavlink_msg_sens_power_board.h" -#include "./mavlink_msg_gsm_link_status.h" -#include "./mavlink_msg_satcom_link_status.h" -#include "./mavlink_msg_sensor_airflow_angles.h" - -// base include -#include "../common/common.h" - -#undef MAVLINK_THIS_XML_IDX -#define MAVLINK_THIS_XML_IDX 0 - -#if MAVLINK_THIS_XML_IDX == MAVLINK_PRIMARY_XML_IDX -# define MAVLINK_MESSAGE_INFO {MAVLINK_MESSAGE_INFO_HEARTBEAT, MAVLINK_MESSAGE_INFO_SYS_STATUS, MAVLINK_MESSAGE_INFO_SYSTEM_TIME, MAVLINK_MESSAGE_INFO_PING, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL_ACK, MAVLINK_MESSAGE_INFO_AUTH_KEY, MAVLINK_MESSAGE_INFO_LINK_NODE_STATUS, MAVLINK_MESSAGE_INFO_SET_MODE, MAVLINK_MESSAGE_INFO_PARAM_ACK_TRANSACTION, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_READ, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_LIST, MAVLINK_MESSAGE_INFO_PARAM_VALUE, MAVLINK_MESSAGE_INFO_PARAM_SET, MAVLINK_MESSAGE_INFO_GPS_RAW_INT, MAVLINK_MESSAGE_INFO_GPS_STATUS, MAVLINK_MESSAGE_INFO_SCALED_IMU, MAVLINK_MESSAGE_INFO_RAW_IMU, MAVLINK_MESSAGE_INFO_RAW_PRESSURE, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE, MAVLINK_MESSAGE_INFO_ATTITUDE, MAVLINK_MESSAGE_INFO_ATTITUDE_QUATERNION, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT, MAVLINK_MESSAGE_INFO_RC_CHANNELS_SCALED, MAVLINK_MESSAGE_INFO_RC_CHANNELS_RAW, MAVLINK_MESSAGE_INFO_SERVO_OUTPUT_RAW, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_PARTIAL_LIST, MAVLINK_MESSAGE_INFO_MISSION_WRITE_PARTIAL_LIST, MAVLINK_MESSAGE_INFO_MISSION_ITEM, MAVLINK_MESSAGE_INFO_MISSION_REQUEST, MAVLINK_MESSAGE_INFO_MISSION_SET_CURRENT, MAVLINK_MESSAGE_INFO_MISSION_CURRENT, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_LIST, MAVLINK_MESSAGE_INFO_MISSION_COUNT, MAVLINK_MESSAGE_INFO_MISSION_CLEAR_ALL, MAVLINK_MESSAGE_INFO_MISSION_ITEM_REACHED, MAVLINK_MESSAGE_INFO_MISSION_ACK, MAVLINK_MESSAGE_INFO_SET_GPS_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_GPS_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_PARAM_MAP_RC, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_INT, MAVLINK_MESSAGE_INFO_MISSION_CHANGED, MAVLINK_MESSAGE_INFO_SAFETY_SET_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_SAFETY_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_ATTITUDE_QUATERNION_COV, MAVLINK_MESSAGE_INFO_NAV_CONTROLLER_OUTPUT, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT_COV, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED_COV, MAVLINK_MESSAGE_INFO_RC_CHANNELS, MAVLINK_MESSAGE_INFO_REQUEST_DATA_STREAM, MAVLINK_MESSAGE_INFO_DATA_STREAM, MAVLINK_MESSAGE_INFO_MANUAL_CONTROL, MAVLINK_MESSAGE_INFO_RC_CHANNELS_OVERRIDE, MAVLINK_MESSAGE_INFO_MISSION_ITEM_INT, MAVLINK_MESSAGE_INFO_VFR_HUD, MAVLINK_MESSAGE_INFO_COMMAND_INT, MAVLINK_MESSAGE_INFO_COMMAND_LONG, MAVLINK_MESSAGE_INFO_COMMAND_ACK, MAVLINK_MESSAGE_INFO_COMMAND_INT_STAMPED, MAVLINK_MESSAGE_INFO_COMMAND_LONG_STAMPED, MAVLINK_MESSAGE_INFO_COMMAND_CANCEL, MAVLINK_MESSAGE_INFO_MANUAL_SETPOINT, MAVLINK_MESSAGE_INFO_SET_ATTITUDE_TARGET, MAVLINK_MESSAGE_INFO_ATTITUDE_TARGET, MAVLINK_MESSAGE_INFO_SET_POSITION_TARGET_LOCAL_NED, MAVLINK_MESSAGE_INFO_POSITION_TARGET_LOCAL_NED, MAVLINK_MESSAGE_INFO_SET_POSITION_TARGET_GLOBAL_INT, MAVLINK_MESSAGE_INFO_POSITION_TARGET_GLOBAL_INT, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET, MAVLINK_MESSAGE_INFO_HIL_STATE, MAVLINK_MESSAGE_INFO_HIL_CONTROLS, MAVLINK_MESSAGE_INFO_HIL_RC_INPUTS_RAW, MAVLINK_MESSAGE_INFO_HIL_ACTUATOR_CONTROLS, MAVLINK_MESSAGE_INFO_OPTICAL_FLOW, MAVLINK_MESSAGE_INFO_GLOBAL_VISION_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_VISION_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_VISION_SPEED_ESTIMATE, MAVLINK_MESSAGE_INFO_VICON_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_HIGHRES_IMU, MAVLINK_MESSAGE_INFO_OPTICAL_FLOW_RAD, MAVLINK_MESSAGE_INFO_HIL_SENSOR, MAVLINK_MESSAGE_INFO_SIM_STATE, MAVLINK_MESSAGE_INFO_RADIO_STATUS, MAVLINK_MESSAGE_INFO_FILE_TRANSFER_PROTOCOL, MAVLINK_MESSAGE_INFO_TIMESYNC, MAVLINK_MESSAGE_INFO_CAMERA_TRIGGER, MAVLINK_MESSAGE_INFO_HIL_GPS, MAVLINK_MESSAGE_INFO_HIL_OPTICAL_FLOW, MAVLINK_MESSAGE_INFO_HIL_STATE_QUATERNION, MAVLINK_MESSAGE_INFO_SCALED_IMU2, MAVLINK_MESSAGE_INFO_LOG_REQUEST_LIST, MAVLINK_MESSAGE_INFO_LOG_ENTRY, MAVLINK_MESSAGE_INFO_LOG_REQUEST_DATA, MAVLINK_MESSAGE_INFO_LOG_DATA, MAVLINK_MESSAGE_INFO_LOG_ERASE, MAVLINK_MESSAGE_INFO_LOG_REQUEST_END, MAVLINK_MESSAGE_INFO_GPS_INJECT_DATA, MAVLINK_MESSAGE_INFO_GPS2_RAW, MAVLINK_MESSAGE_INFO_POWER_STATUS, MAVLINK_MESSAGE_INFO_SERIAL_CONTROL, MAVLINK_MESSAGE_INFO_GPS_RTK, MAVLINK_MESSAGE_INFO_GPS2_RTK, MAVLINK_MESSAGE_INFO_SCALED_IMU3, MAVLINK_MESSAGE_INFO_DATA_TRANSMISSION_HANDSHAKE, MAVLINK_MESSAGE_INFO_ENCAPSULATED_DATA, MAVLINK_MESSAGE_INFO_DISTANCE_SENSOR, MAVLINK_MESSAGE_INFO_TERRAIN_REQUEST, MAVLINK_MESSAGE_INFO_TERRAIN_DATA, MAVLINK_MESSAGE_INFO_TERRAIN_CHECK, MAVLINK_MESSAGE_INFO_TERRAIN_REPORT, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE2, MAVLINK_MESSAGE_INFO_ATT_POS_MOCAP, MAVLINK_MESSAGE_INFO_SET_ACTUATOR_CONTROL_TARGET, MAVLINK_MESSAGE_INFO_ACTUATOR_CONTROL_TARGET, MAVLINK_MESSAGE_INFO_ALTITUDE, MAVLINK_MESSAGE_INFO_RESOURCE_REQUEST, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE3, MAVLINK_MESSAGE_INFO_FOLLOW_TARGET, MAVLINK_MESSAGE_INFO_CONTROL_SYSTEM_STATE, MAVLINK_MESSAGE_INFO_BATTERY_STATUS, MAVLINK_MESSAGE_INFO_AUTOPILOT_VERSION, MAVLINK_MESSAGE_INFO_LANDING_TARGET, MAVLINK_MESSAGE_INFO_FENCE_STATUS, MAVLINK_MESSAGE_INFO_MAG_CAL_REPORT, MAVLINK_MESSAGE_INFO_SENS_POWER, MAVLINK_MESSAGE_INFO_SENS_MPPT, MAVLINK_MESSAGE_INFO_ASLCTRL_DATA, MAVLINK_MESSAGE_INFO_ASLCTRL_DEBUG, MAVLINK_MESSAGE_INFO_ASLUAV_STATUS, MAVLINK_MESSAGE_INFO_EKF_EXT, MAVLINK_MESSAGE_INFO_ASL_OBCTRL, MAVLINK_MESSAGE_INFO_SENS_ATMOS, MAVLINK_MESSAGE_INFO_SENS_BATMON, MAVLINK_MESSAGE_INFO_FW_SOARING_DATA, MAVLINK_MESSAGE_INFO_SENSORPOD_STATUS, MAVLINK_MESSAGE_INFO_SENS_POWER_BOARD, MAVLINK_MESSAGE_INFO_GSM_LINK_STATUS, MAVLINK_MESSAGE_INFO_SATCOM_LINK_STATUS, MAVLINK_MESSAGE_INFO_SENSOR_AIRFLOW_ANGLES, MAVLINK_MESSAGE_INFO_EFI_STATUS, MAVLINK_MESSAGE_INFO_ESTIMATOR_STATUS, MAVLINK_MESSAGE_INFO_WIND_COV, MAVLINK_MESSAGE_INFO_GPS_INPUT, MAVLINK_MESSAGE_INFO_GPS_RTCM_DATA, MAVLINK_MESSAGE_INFO_HIGH_LATENCY, MAVLINK_MESSAGE_INFO_HIGH_LATENCY2, MAVLINK_MESSAGE_INFO_VIBRATION, MAVLINK_MESSAGE_INFO_HOME_POSITION, MAVLINK_MESSAGE_INFO_SET_HOME_POSITION, MAVLINK_MESSAGE_INFO_MESSAGE_INTERVAL, MAVLINK_MESSAGE_INFO_EXTENDED_SYS_STATE, MAVLINK_MESSAGE_INFO_ADSB_VEHICLE, MAVLINK_MESSAGE_INFO_COLLISION, MAVLINK_MESSAGE_INFO_V2_EXTENSION, MAVLINK_MESSAGE_INFO_MEMORY_VECT, MAVLINK_MESSAGE_INFO_DEBUG_VECT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_FLOAT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_INT, MAVLINK_MESSAGE_INFO_STATUSTEXT, MAVLINK_MESSAGE_INFO_DEBUG, MAVLINK_MESSAGE_INFO_SETUP_SIGNING, MAVLINK_MESSAGE_INFO_BUTTON_CHANGE, MAVLINK_MESSAGE_INFO_PLAY_TUNE, MAVLINK_MESSAGE_INFO_CAMERA_INFORMATION, MAVLINK_MESSAGE_INFO_CAMERA_SETTINGS, MAVLINK_MESSAGE_INFO_STORAGE_INFORMATION, MAVLINK_MESSAGE_INFO_CAMERA_CAPTURE_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_IMAGE_CAPTURED, MAVLINK_MESSAGE_INFO_FLIGHT_INFORMATION, MAVLINK_MESSAGE_INFO_MOUNT_ORIENTATION, MAVLINK_MESSAGE_INFO_LOGGING_DATA, MAVLINK_MESSAGE_INFO_LOGGING_DATA_ACKED, MAVLINK_MESSAGE_INFO_LOGGING_ACK, MAVLINK_MESSAGE_INFO_VIDEO_STREAM_INFORMATION, MAVLINK_MESSAGE_INFO_VIDEO_STREAM_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_FOV_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_TRACKING_IMAGE_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_TRACKING_GEO_STATUS, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_INFORMATION, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_STATUS, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_SET_ATTITUDE, MAVLINK_MESSAGE_INFO_GIMBAL_DEVICE_INFORMATION, MAVLINK_MESSAGE_INFO_GIMBAL_DEVICE_SET_ATTITUDE, MAVLINK_MESSAGE_INFO_GIMBAL_DEVICE_ATTITUDE_STATUS, MAVLINK_MESSAGE_INFO_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_SET_PITCHYAW, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_SET_MANUAL_CONTROL, MAVLINK_MESSAGE_INFO_ESC_INFO, MAVLINK_MESSAGE_INFO_ESC_STATUS, MAVLINK_MESSAGE_INFO_WIFI_CONFIG_AP, MAVLINK_MESSAGE_INFO_PROTOCOL_VERSION, MAVLINK_MESSAGE_INFO_AIS_VESSEL, MAVLINK_MESSAGE_INFO_UAVCAN_NODE_STATUS, MAVLINK_MESSAGE_INFO_UAVCAN_NODE_INFO, MAVLINK_MESSAGE_INFO_PARAM_EXT_REQUEST_READ, MAVLINK_MESSAGE_INFO_PARAM_EXT_REQUEST_LIST, MAVLINK_MESSAGE_INFO_PARAM_EXT_VALUE, MAVLINK_MESSAGE_INFO_PARAM_EXT_SET, MAVLINK_MESSAGE_INFO_PARAM_EXT_ACK, MAVLINK_MESSAGE_INFO_OBSTACLE_DISTANCE, MAVLINK_MESSAGE_INFO_ODOMETRY, MAVLINK_MESSAGE_INFO_TRAJECTORY_REPRESENTATION_WAYPOINTS, MAVLINK_MESSAGE_INFO_TRAJECTORY_REPRESENTATION_BEZIER, MAVLINK_MESSAGE_INFO_CELLULAR_STATUS, MAVLINK_MESSAGE_INFO_ISBD_LINK_STATUS, MAVLINK_MESSAGE_INFO_CELLULAR_CONFIG, MAVLINK_MESSAGE_INFO_RAW_RPM, MAVLINK_MESSAGE_INFO_UTM_GLOBAL_POSITION, MAVLINK_MESSAGE_INFO_DEBUG_FLOAT_ARRAY, MAVLINK_MESSAGE_INFO_ORBIT_EXECUTION_STATUS, MAVLINK_MESSAGE_INFO_SMART_BATTERY_INFO, MAVLINK_MESSAGE_INFO_GENERATOR_STATUS, MAVLINK_MESSAGE_INFO_ACTUATOR_OUTPUT_STATUS, MAVLINK_MESSAGE_INFO_TIME_ESTIMATE_TO_TARGET, MAVLINK_MESSAGE_INFO_TUNNEL, MAVLINK_MESSAGE_INFO_ONBOARD_COMPUTER_STATUS, MAVLINK_MESSAGE_INFO_COMPONENT_INFORMATION, MAVLINK_MESSAGE_INFO_PLAY_TUNE_V2, MAVLINK_MESSAGE_INFO_SUPPORTED_TUNES, MAVLINK_MESSAGE_INFO_WHEEL_DISTANCE, MAVLINK_MESSAGE_INFO_WINCH_STATUS, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_BASIC_ID, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_LOCATION, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_AUTHENTICATION, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_SELF_ID, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_SYSTEM, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_OPERATOR_ID, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_MESSAGE_PACK} -# define MAVLINK_MESSAGE_NAMES {{ "ACTUATOR_CONTROL_TARGET", 140 }, { "ACTUATOR_OUTPUT_STATUS", 375 }, { "ADSB_VEHICLE", 246 }, { "AIS_VESSEL", 301 }, { "ALTITUDE", 141 }, { "ASLCTRL_DATA", 203 }, { "ASLCTRL_DEBUG", 204 }, { "ASLUAV_STATUS", 205 }, { "ASL_OBCTRL", 207 }, { "ATTITUDE", 30 }, { "ATTITUDE_QUATERNION", 31 }, { "ATTITUDE_QUATERNION_COV", 61 }, { "ATTITUDE_TARGET", 83 }, { "ATT_POS_MOCAP", 138 }, { "AUTH_KEY", 7 }, { "AUTOPILOT_STATE_FOR_GIMBAL_DEVICE", 286 }, { "AUTOPILOT_VERSION", 148 }, { "BATTERY_STATUS", 147 }, { "BUTTON_CHANGE", 257 }, { "CAMERA_CAPTURE_STATUS", 262 }, { "CAMERA_FOV_STATUS", 271 }, { "CAMERA_IMAGE_CAPTURED", 263 }, { "CAMERA_INFORMATION", 259 }, { "CAMERA_SETTINGS", 260 }, { "CAMERA_TRACKING_GEO_STATUS", 276 }, { "CAMERA_TRACKING_IMAGE_STATUS", 275 }, { "CAMERA_TRIGGER", 112 }, { "CELLULAR_CONFIG", 336 }, { "CELLULAR_STATUS", 334 }, { "CHANGE_OPERATOR_CONTROL", 5 }, { "CHANGE_OPERATOR_CONTROL_ACK", 6 }, { "COLLISION", 247 }, { "COMMAND_ACK", 77 }, { "COMMAND_CANCEL", 80 }, { "COMMAND_INT", 75 }, { "COMMAND_INT_STAMPED", 78 }, { "COMMAND_LONG", 76 }, { "COMMAND_LONG_STAMPED", 79 }, { "COMPONENT_INFORMATION", 395 }, { "CONTROL_SYSTEM_STATE", 146 }, { "DATA_STREAM", 67 }, { "DATA_TRANSMISSION_HANDSHAKE", 130 }, { "DEBUG", 254 }, { "DEBUG_FLOAT_ARRAY", 350 }, { "DEBUG_VECT", 250 }, { "DISTANCE_SENSOR", 132 }, { "EFI_STATUS", 225 }, { "EKF_EXT", 206 }, { "ENCAPSULATED_DATA", 131 }, { "ESC_INFO", 290 }, { "ESC_STATUS", 291 }, { "ESTIMATOR_STATUS", 230 }, { "EXTENDED_SYS_STATE", 245 }, { "FENCE_STATUS", 162 }, { "FILE_TRANSFER_PROTOCOL", 110 }, { "FLIGHT_INFORMATION", 264 }, { "FOLLOW_TARGET", 144 }, { "FW_SOARING_DATA", 210 }, { "GENERATOR_STATUS", 373 }, { "GIMBAL_DEVICE_ATTITUDE_STATUS", 285 }, { "GIMBAL_DEVICE_INFORMATION", 283 }, { "GIMBAL_DEVICE_SET_ATTITUDE", 284 }, { "GIMBAL_MANAGER_INFORMATION", 280 }, { "GIMBAL_MANAGER_SET_ATTITUDE", 282 }, { "GIMBAL_MANAGER_SET_MANUAL_CONTROL", 288 }, { "GIMBAL_MANAGER_SET_PITCHYAW", 287 }, { "GIMBAL_MANAGER_STATUS", 281 }, { "GLOBAL_POSITION_INT", 33 }, { "GLOBAL_POSITION_INT_COV", 63 }, { "GLOBAL_VISION_POSITION_ESTIMATE", 101 }, { "GPS2_RAW", 124 }, { "GPS2_RTK", 128 }, { "GPS_GLOBAL_ORIGIN", 49 }, { "GPS_INJECT_DATA", 123 }, { "GPS_INPUT", 232 }, { "GPS_RAW_INT", 24 }, { "GPS_RTCM_DATA", 233 }, { "GPS_RTK", 127 }, { "GPS_STATUS", 25 }, { "GSM_LINK_STATUS", 213 }, { "HEARTBEAT", 0 }, { "HIGHRES_IMU", 105 }, { "HIGH_LATENCY", 234 }, { "HIGH_LATENCY2", 235 }, { "HIL_ACTUATOR_CONTROLS", 93 }, { "HIL_CONTROLS", 91 }, { "HIL_GPS", 113 }, { "HIL_OPTICAL_FLOW", 114 }, { "HIL_RC_INPUTS_RAW", 92 }, { "HIL_SENSOR", 107 }, { "HIL_STATE", 90 }, { "HIL_STATE_QUATERNION", 115 }, { "HOME_POSITION", 242 }, { "ISBD_LINK_STATUS", 335 }, { "LANDING_TARGET", 149 }, { "LINK_NODE_STATUS", 8 }, { "LOCAL_POSITION_NED", 32 }, { "LOCAL_POSITION_NED_COV", 64 }, { "LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET", 89 }, { "LOGGING_ACK", 268 }, { "LOGGING_DATA", 266 }, { "LOGGING_DATA_ACKED", 267 }, { "LOG_DATA", 120 }, { "LOG_ENTRY", 118 }, { "LOG_ERASE", 121 }, { "LOG_REQUEST_DATA", 119 }, { "LOG_REQUEST_END", 122 }, { "LOG_REQUEST_LIST", 117 }, { "MAG_CAL_REPORT", 192 }, { "MANUAL_CONTROL", 69 }, { "MANUAL_SETPOINT", 81 }, { "MEMORY_VECT", 249 }, { "MESSAGE_INTERVAL", 244 }, { "MISSION_ACK", 47 }, { "MISSION_CHANGED", 52 }, { "MISSION_CLEAR_ALL", 45 }, { "MISSION_COUNT", 44 }, { "MISSION_CURRENT", 42 }, { "MISSION_ITEM", 39 }, { "MISSION_ITEM_INT", 73 }, { "MISSION_ITEM_REACHED", 46 }, { "MISSION_REQUEST", 40 }, { "MISSION_REQUEST_INT", 51 }, { "MISSION_REQUEST_LIST", 43 }, { "MISSION_REQUEST_PARTIAL_LIST", 37 }, { "MISSION_SET_CURRENT", 41 }, { "MISSION_WRITE_PARTIAL_LIST", 38 }, { "MOUNT_ORIENTATION", 265 }, { "NAMED_VALUE_FLOAT", 251 }, { "NAMED_VALUE_INT", 252 }, { "NAV_CONTROLLER_OUTPUT", 62 }, { "OBSTACLE_DISTANCE", 330 }, { "ODOMETRY", 331 }, { "ONBOARD_COMPUTER_STATUS", 390 }, { "OPEN_DRONE_ID_AUTHENTICATION", 12902 }, { "OPEN_DRONE_ID_BASIC_ID", 12900 }, { "OPEN_DRONE_ID_LOCATION", 12901 }, { "OPEN_DRONE_ID_MESSAGE_PACK", 12915 }, { "OPEN_DRONE_ID_OPERATOR_ID", 12905 }, { "OPEN_DRONE_ID_SELF_ID", 12903 }, { "OPEN_DRONE_ID_SYSTEM", 12904 }, { "OPTICAL_FLOW", 100 }, { "OPTICAL_FLOW_RAD", 106 }, { "ORBIT_EXECUTION_STATUS", 360 }, { "PARAM_ACK_TRANSACTION", 19 }, { "PARAM_EXT_ACK", 324 }, { "PARAM_EXT_REQUEST_LIST", 321 }, { "PARAM_EXT_REQUEST_READ", 320 }, { "PARAM_EXT_SET", 323 }, { "PARAM_EXT_VALUE", 322 }, { "PARAM_MAP_RC", 50 }, { "PARAM_REQUEST_LIST", 21 }, { "PARAM_REQUEST_READ", 20 }, { "PARAM_SET", 23 }, { "PARAM_VALUE", 22 }, { "PING", 4 }, { "PLAY_TUNE", 258 }, { "PLAY_TUNE_V2", 400 }, { "POSITION_TARGET_GLOBAL_INT", 87 }, { "POSITION_TARGET_LOCAL_NED", 85 }, { "POWER_STATUS", 125 }, { "PROTOCOL_VERSION", 300 }, { "RADIO_STATUS", 109 }, { "RAW_IMU", 27 }, { "RAW_PRESSURE", 28 }, { "RAW_RPM", 339 }, { "RC_CHANNELS", 65 }, { "RC_CHANNELS_OVERRIDE", 70 }, { "RC_CHANNELS_RAW", 35 }, { "RC_CHANNELS_SCALED", 34 }, { "REQUEST_DATA_STREAM", 66 }, { "RESOURCE_REQUEST", 142 }, { "SAFETY_ALLOWED_AREA", 55 }, { "SAFETY_SET_ALLOWED_AREA", 54 }, { "SATCOM_LINK_STATUS", 214 }, { "SCALED_IMU", 26 }, { "SCALED_IMU2", 116 }, { "SCALED_IMU3", 129 }, { "SCALED_PRESSURE", 29 }, { "SCALED_PRESSURE2", 137 }, { "SCALED_PRESSURE3", 143 }, { "SENSORPOD_STATUS", 211 }, { "SENSOR_AIRFLOW_ANGLES", 215 }, { "SENS_ATMOS", 208 }, { "SENS_BATMON", 209 }, { "SENS_MPPT", 202 }, { "SENS_POWER", 201 }, { "SENS_POWER_BOARD", 212 }, { "SERIAL_CONTROL", 126 }, { "SERVO_OUTPUT_RAW", 36 }, { "SETUP_SIGNING", 256 }, { "SET_ACTUATOR_CONTROL_TARGET", 139 }, { "SET_ATTITUDE_TARGET", 82 }, { "SET_GPS_GLOBAL_ORIGIN", 48 }, { "SET_HOME_POSITION", 243 }, { "SET_MODE", 11 }, { "SET_POSITION_TARGET_GLOBAL_INT", 86 }, { "SET_POSITION_TARGET_LOCAL_NED", 84 }, { "SIM_STATE", 108 }, { "SMART_BATTERY_INFO", 370 }, { "STATUSTEXT", 253 }, { "STORAGE_INFORMATION", 261 }, { "SUPPORTED_TUNES", 401 }, { "SYSTEM_TIME", 2 }, { "SYS_STATUS", 1 }, { "TERRAIN_CHECK", 135 }, { "TERRAIN_DATA", 134 }, { "TERRAIN_REPORT", 136 }, { "TERRAIN_REQUEST", 133 }, { "TIMESYNC", 111 }, { "TIME_ESTIMATE_TO_TARGET", 380 }, { "TRAJECTORY_REPRESENTATION_BEZIER", 333 }, { "TRAJECTORY_REPRESENTATION_WAYPOINTS", 332 }, { "TUNNEL", 385 }, { "UAVCAN_NODE_INFO", 311 }, { "UAVCAN_NODE_STATUS", 310 }, { "UTM_GLOBAL_POSITION", 340 }, { "V2_EXTENSION", 248 }, { "VFR_HUD", 74 }, { "VIBRATION", 241 }, { "VICON_POSITION_ESTIMATE", 104 }, { "VIDEO_STREAM_INFORMATION", 269 }, { "VIDEO_STREAM_STATUS", 270 }, { "VISION_POSITION_ESTIMATE", 102 }, { "VISION_SPEED_ESTIMATE", 103 }, { "WHEEL_DISTANCE", 9000 }, { "WIFI_CONFIG_AP", 299 }, { "WINCH_STATUS", 9005 }, { "WIND_COV", 231 }} -# if MAVLINK_COMMAND_24BIT -# include "../mavlink_get_info.h" -# endif -#endif - -#ifdef __cplusplus -} -#endif // __cplusplus -#endif // MAVLINK_ASLUAV_H diff --git a/ASLUAV/mavlink_msg_asl_obctrl.h b/ASLUAV/mavlink_msg_asl_obctrl.h deleted file mode 100644 index e03541490..000000000 --- a/ASLUAV/mavlink_msg_asl_obctrl.h +++ /dev/null @@ -1,388 +0,0 @@ -#pragma once -// MESSAGE ASL_OBCTRL PACKING - -#define MAVLINK_MSG_ID_ASL_OBCTRL 207 - - -typedef struct __mavlink_asl_obctrl_t { - uint64_t timestamp; /*< [us] Time since system start*/ - float uElev; /*< Elevator command [~]*/ - float uThrot; /*< Throttle command [~]*/ - float uThrot2; /*< Throttle 2 command [~]*/ - float uAilL; /*< Left aileron command [~]*/ - float uAilR; /*< Right aileron command [~]*/ - float uRud; /*< Rudder command [~]*/ - uint8_t obctrl_status; /*< Off-board computer status*/ -} mavlink_asl_obctrl_t; - -#define MAVLINK_MSG_ID_ASL_OBCTRL_LEN 33 -#define MAVLINK_MSG_ID_ASL_OBCTRL_MIN_LEN 33 -#define MAVLINK_MSG_ID_207_LEN 33 -#define MAVLINK_MSG_ID_207_MIN_LEN 33 - -#define MAVLINK_MSG_ID_ASL_OBCTRL_CRC 234 -#define MAVLINK_MSG_ID_207_CRC 234 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_ASL_OBCTRL { \ - 207, \ - "ASL_OBCTRL", \ - 8, \ - { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_asl_obctrl_t, timestamp) }, \ - { "uElev", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_asl_obctrl_t, uElev) }, \ - { "uThrot", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_asl_obctrl_t, uThrot) }, \ - { "uThrot2", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_asl_obctrl_t, uThrot2) }, \ - { "uAilL", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_asl_obctrl_t, uAilL) }, \ - { "uAilR", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_asl_obctrl_t, uAilR) }, \ - { "uRud", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_asl_obctrl_t, uRud) }, \ - { "obctrl_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_asl_obctrl_t, obctrl_status) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_ASL_OBCTRL { \ - "ASL_OBCTRL", \ - 8, \ - { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_asl_obctrl_t, timestamp) }, \ - { "uElev", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_asl_obctrl_t, uElev) }, \ - { "uThrot", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_asl_obctrl_t, uThrot) }, \ - { "uThrot2", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_asl_obctrl_t, uThrot2) }, \ - { "uAilL", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_asl_obctrl_t, uAilL) }, \ - { "uAilR", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_asl_obctrl_t, uAilR) }, \ - { "uRud", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_asl_obctrl_t, uRud) }, \ - { "obctrl_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_asl_obctrl_t, obctrl_status) }, \ - } \ -} -#endif - -/** - * @brief Pack a asl_obctrl message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param timestamp [us] Time since system start - * @param uElev Elevator command [~] - * @param uThrot Throttle command [~] - * @param uThrot2 Throttle 2 command [~] - * @param uAilL Left aileron command [~] - * @param uAilR Right aileron command [~] - * @param uRud Rudder command [~] - * @param obctrl_status Off-board computer status - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_asl_obctrl_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint64_t timestamp, float uElev, float uThrot, float uThrot2, float uAilL, float uAilR, float uRud, uint8_t obctrl_status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_ASL_OBCTRL_LEN]; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_float(buf, 8, uElev); - _mav_put_float(buf, 12, uThrot); - _mav_put_float(buf, 16, uThrot2); - _mav_put_float(buf, 20, uAilL); - _mav_put_float(buf, 24, uAilR); - _mav_put_float(buf, 28, uRud); - _mav_put_uint8_t(buf, 32, obctrl_status); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ASL_OBCTRL_LEN); -#else - mavlink_asl_obctrl_t packet; - packet.timestamp = timestamp; - packet.uElev = uElev; - packet.uThrot = uThrot; - packet.uThrot2 = uThrot2; - packet.uAilL = uAilL; - packet.uAilR = uAilR; - packet.uRud = uRud; - packet.obctrl_status = obctrl_status; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ASL_OBCTRL_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_ASL_OBCTRL; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ASL_OBCTRL_MIN_LEN, MAVLINK_MSG_ID_ASL_OBCTRL_LEN, MAVLINK_MSG_ID_ASL_OBCTRL_CRC); -} - -/** - * @brief Pack a asl_obctrl message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param timestamp [us] Time since system start - * @param uElev Elevator command [~] - * @param uThrot Throttle command [~] - * @param uThrot2 Throttle 2 command [~] - * @param uAilL Left aileron command [~] - * @param uAilR Right aileron command [~] - * @param uRud Rudder command [~] - * @param obctrl_status Off-board computer status - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_asl_obctrl_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint64_t timestamp,float uElev,float uThrot,float uThrot2,float uAilL,float uAilR,float uRud,uint8_t obctrl_status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_ASL_OBCTRL_LEN]; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_float(buf, 8, uElev); - _mav_put_float(buf, 12, uThrot); - _mav_put_float(buf, 16, uThrot2); - _mav_put_float(buf, 20, uAilL); - _mav_put_float(buf, 24, uAilR); - _mav_put_float(buf, 28, uRud); - _mav_put_uint8_t(buf, 32, obctrl_status); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ASL_OBCTRL_LEN); -#else - mavlink_asl_obctrl_t packet; - packet.timestamp = timestamp; - packet.uElev = uElev; - packet.uThrot = uThrot; - packet.uThrot2 = uThrot2; - packet.uAilL = uAilL; - packet.uAilR = uAilR; - packet.uRud = uRud; - packet.obctrl_status = obctrl_status; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ASL_OBCTRL_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_ASL_OBCTRL; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ASL_OBCTRL_MIN_LEN, MAVLINK_MSG_ID_ASL_OBCTRL_LEN, MAVLINK_MSG_ID_ASL_OBCTRL_CRC); -} - -/** - * @brief Encode a asl_obctrl struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param asl_obctrl C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_asl_obctrl_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_asl_obctrl_t* asl_obctrl) -{ - return mavlink_msg_asl_obctrl_pack(system_id, component_id, msg, asl_obctrl->timestamp, asl_obctrl->uElev, asl_obctrl->uThrot, asl_obctrl->uThrot2, asl_obctrl->uAilL, asl_obctrl->uAilR, asl_obctrl->uRud, asl_obctrl->obctrl_status); -} - -/** - * @brief Encode a asl_obctrl struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param asl_obctrl C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_asl_obctrl_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_asl_obctrl_t* asl_obctrl) -{ - return mavlink_msg_asl_obctrl_pack_chan(system_id, component_id, chan, msg, asl_obctrl->timestamp, asl_obctrl->uElev, asl_obctrl->uThrot, asl_obctrl->uThrot2, asl_obctrl->uAilL, asl_obctrl->uAilR, asl_obctrl->uRud, asl_obctrl->obctrl_status); -} - -/** - * @brief Send a asl_obctrl message - * @param chan MAVLink channel to send the message - * - * @param timestamp [us] Time since system start - * @param uElev Elevator command [~] - * @param uThrot Throttle command [~] - * @param uThrot2 Throttle 2 command [~] - * @param uAilL Left aileron command [~] - * @param uAilR Right aileron command [~] - * @param uRud Rudder command [~] - * @param obctrl_status Off-board computer status - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_asl_obctrl_send(mavlink_channel_t chan, uint64_t timestamp, float uElev, float uThrot, float uThrot2, float uAilL, float uAilR, float uRud, uint8_t obctrl_status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_ASL_OBCTRL_LEN]; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_float(buf, 8, uElev); - _mav_put_float(buf, 12, uThrot); - _mav_put_float(buf, 16, uThrot2); - _mav_put_float(buf, 20, uAilL); - _mav_put_float(buf, 24, uAilR); - _mav_put_float(buf, 28, uRud); - _mav_put_uint8_t(buf, 32, obctrl_status); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ASL_OBCTRL, buf, MAVLINK_MSG_ID_ASL_OBCTRL_MIN_LEN, MAVLINK_MSG_ID_ASL_OBCTRL_LEN, MAVLINK_MSG_ID_ASL_OBCTRL_CRC); -#else - mavlink_asl_obctrl_t packet; - packet.timestamp = timestamp; - packet.uElev = uElev; - packet.uThrot = uThrot; - packet.uThrot2 = uThrot2; - packet.uAilL = uAilL; - packet.uAilR = uAilR; - packet.uRud = uRud; - packet.obctrl_status = obctrl_status; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ASL_OBCTRL, (const char *)&packet, MAVLINK_MSG_ID_ASL_OBCTRL_MIN_LEN, MAVLINK_MSG_ID_ASL_OBCTRL_LEN, MAVLINK_MSG_ID_ASL_OBCTRL_CRC); -#endif -} - -/** - * @brief Send a asl_obctrl message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_asl_obctrl_send_struct(mavlink_channel_t chan, const mavlink_asl_obctrl_t* asl_obctrl) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_asl_obctrl_send(chan, asl_obctrl->timestamp, asl_obctrl->uElev, asl_obctrl->uThrot, asl_obctrl->uThrot2, asl_obctrl->uAilL, asl_obctrl->uAilR, asl_obctrl->uRud, asl_obctrl->obctrl_status); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ASL_OBCTRL, (const char *)asl_obctrl, MAVLINK_MSG_ID_ASL_OBCTRL_MIN_LEN, MAVLINK_MSG_ID_ASL_OBCTRL_LEN, MAVLINK_MSG_ID_ASL_OBCTRL_CRC); -#endif -} - -#if MAVLINK_MSG_ID_ASL_OBCTRL_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_asl_obctrl_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t timestamp, float uElev, float uThrot, float uThrot2, float uAilL, float uAilR, float uRud, uint8_t obctrl_status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_float(buf, 8, uElev); - _mav_put_float(buf, 12, uThrot); - _mav_put_float(buf, 16, uThrot2); - _mav_put_float(buf, 20, uAilL); - _mav_put_float(buf, 24, uAilR); - _mav_put_float(buf, 28, uRud); - _mav_put_uint8_t(buf, 32, obctrl_status); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ASL_OBCTRL, buf, MAVLINK_MSG_ID_ASL_OBCTRL_MIN_LEN, MAVLINK_MSG_ID_ASL_OBCTRL_LEN, MAVLINK_MSG_ID_ASL_OBCTRL_CRC); -#else - mavlink_asl_obctrl_t *packet = (mavlink_asl_obctrl_t *)msgbuf; - packet->timestamp = timestamp; - packet->uElev = uElev; - packet->uThrot = uThrot; - packet->uThrot2 = uThrot2; - packet->uAilL = uAilL; - packet->uAilR = uAilR; - packet->uRud = uRud; - packet->obctrl_status = obctrl_status; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ASL_OBCTRL, (const char *)packet, MAVLINK_MSG_ID_ASL_OBCTRL_MIN_LEN, MAVLINK_MSG_ID_ASL_OBCTRL_LEN, MAVLINK_MSG_ID_ASL_OBCTRL_CRC); -#endif -} -#endif - -#endif - -// MESSAGE ASL_OBCTRL UNPACKING - - -/** - * @brief Get field timestamp from asl_obctrl message - * - * @return [us] Time since system start - */ -static inline uint64_t mavlink_msg_asl_obctrl_get_timestamp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint64_t(msg, 0); -} - -/** - * @brief Get field uElev from asl_obctrl message - * - * @return Elevator command [~] - */ -static inline float mavlink_msg_asl_obctrl_get_uElev(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field uThrot from asl_obctrl message - * - * @return Throttle command [~] - */ -static inline float mavlink_msg_asl_obctrl_get_uThrot(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Get field uThrot2 from asl_obctrl message - * - * @return Throttle 2 command [~] - */ -static inline float mavlink_msg_asl_obctrl_get_uThrot2(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 16); -} - -/** - * @brief Get field uAilL from asl_obctrl message - * - * @return Left aileron command [~] - */ -static inline float mavlink_msg_asl_obctrl_get_uAilL(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 20); -} - -/** - * @brief Get field uAilR from asl_obctrl message - * - * @return Right aileron command [~] - */ -static inline float mavlink_msg_asl_obctrl_get_uAilR(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 24); -} - -/** - * @brief Get field uRud from asl_obctrl message - * - * @return Rudder command [~] - */ -static inline float mavlink_msg_asl_obctrl_get_uRud(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 28); -} - -/** - * @brief Get field obctrl_status from asl_obctrl message - * - * @return Off-board computer status - */ -static inline uint8_t mavlink_msg_asl_obctrl_get_obctrl_status(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 32); -} - -/** - * @brief Decode a asl_obctrl message into a struct - * - * @param msg The message to decode - * @param asl_obctrl C-struct to decode the message contents into - */ -static inline void mavlink_msg_asl_obctrl_decode(const mavlink_message_t* msg, mavlink_asl_obctrl_t* asl_obctrl) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - asl_obctrl->timestamp = mavlink_msg_asl_obctrl_get_timestamp(msg); - asl_obctrl->uElev = mavlink_msg_asl_obctrl_get_uElev(msg); - asl_obctrl->uThrot = mavlink_msg_asl_obctrl_get_uThrot(msg); - asl_obctrl->uThrot2 = mavlink_msg_asl_obctrl_get_uThrot2(msg); - asl_obctrl->uAilL = mavlink_msg_asl_obctrl_get_uAilL(msg); - asl_obctrl->uAilR = mavlink_msg_asl_obctrl_get_uAilR(msg); - asl_obctrl->uRud = mavlink_msg_asl_obctrl_get_uRud(msg); - asl_obctrl->obctrl_status = mavlink_msg_asl_obctrl_get_obctrl_status(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_ASL_OBCTRL_LEN? msg->len : MAVLINK_MSG_ID_ASL_OBCTRL_LEN; - memset(asl_obctrl, 0, MAVLINK_MSG_ID_ASL_OBCTRL_LEN); - memcpy(asl_obctrl, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ASLUAV/mavlink_msg_aslctrl_data.h b/ASLUAV/mavlink_msg_aslctrl_data.h deleted file mode 100644 index 456fb1e22..000000000 --- a/ASLUAV/mavlink_msg_aslctrl_data.h +++ /dev/null @@ -1,813 +0,0 @@ -#pragma once -// MESSAGE ASLCTRL_DATA PACKING - -#define MAVLINK_MSG_ID_ASLCTRL_DATA 203 - - -typedef struct __mavlink_aslctrl_data_t { - uint64_t timestamp; /*< [us] Timestamp*/ - float h; /*< See sourcecode for a description of these values... */ - float hRef; /*< */ - float hRef_t; /*< */ - float PitchAngle; /*< [deg] Pitch angle*/ - float PitchAngleRef; /*< [deg] Pitch angle reference*/ - float q; /*< */ - float qRef; /*< */ - float uElev; /*< */ - float uThrot; /*< */ - float uThrot2; /*< */ - float nZ; /*< */ - float AirspeedRef; /*< [m/s] Airspeed reference*/ - float YawAngle; /*< [deg] Yaw angle*/ - float YawAngleRef; /*< [deg] Yaw angle reference*/ - float RollAngle; /*< [deg] Roll angle*/ - float RollAngleRef; /*< [deg] Roll angle reference*/ - float p; /*< */ - float pRef; /*< */ - float r; /*< */ - float rRef; /*< */ - float uAil; /*< */ - float uRud; /*< */ - uint8_t aslctrl_mode; /*< ASLCTRL control-mode (manual, stabilized, auto, etc...)*/ - uint8_t SpoilersEngaged; /*< */ -} mavlink_aslctrl_data_t; - -#define MAVLINK_MSG_ID_ASLCTRL_DATA_LEN 98 -#define MAVLINK_MSG_ID_ASLCTRL_DATA_MIN_LEN 98 -#define MAVLINK_MSG_ID_203_LEN 98 -#define MAVLINK_MSG_ID_203_MIN_LEN 98 - -#define MAVLINK_MSG_ID_ASLCTRL_DATA_CRC 172 -#define MAVLINK_MSG_ID_203_CRC 172 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_ASLCTRL_DATA { \ - 203, \ - "ASLCTRL_DATA", \ - 25, \ - { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_aslctrl_data_t, timestamp) }, \ - { "aslctrl_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 96, offsetof(mavlink_aslctrl_data_t, aslctrl_mode) }, \ - { "h", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_aslctrl_data_t, h) }, \ - { "hRef", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_aslctrl_data_t, hRef) }, \ - { "hRef_t", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_aslctrl_data_t, hRef_t) }, \ - { "PitchAngle", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_aslctrl_data_t, PitchAngle) }, \ - { "PitchAngleRef", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_aslctrl_data_t, PitchAngleRef) }, \ - { "q", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_aslctrl_data_t, q) }, \ - { "qRef", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_aslctrl_data_t, qRef) }, \ - { "uElev", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_aslctrl_data_t, uElev) }, \ - { "uThrot", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_aslctrl_data_t, uThrot) }, \ - { "uThrot2", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_aslctrl_data_t, uThrot2) }, \ - { "nZ", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_aslctrl_data_t, nZ) }, \ - { "AirspeedRef", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_aslctrl_data_t, AirspeedRef) }, \ - { "SpoilersEngaged", NULL, MAVLINK_TYPE_UINT8_T, 0, 97, offsetof(mavlink_aslctrl_data_t, SpoilersEngaged) }, \ - { "YawAngle", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_aslctrl_data_t, YawAngle) }, \ - { "YawAngleRef", NULL, MAVLINK_TYPE_FLOAT, 0, 60, offsetof(mavlink_aslctrl_data_t, YawAngleRef) }, \ - { "RollAngle", NULL, MAVLINK_TYPE_FLOAT, 0, 64, offsetof(mavlink_aslctrl_data_t, RollAngle) }, \ - { "RollAngleRef", NULL, MAVLINK_TYPE_FLOAT, 0, 68, offsetof(mavlink_aslctrl_data_t, RollAngleRef) }, \ - { "p", NULL, MAVLINK_TYPE_FLOAT, 0, 72, offsetof(mavlink_aslctrl_data_t, p) }, \ - { "pRef", NULL, MAVLINK_TYPE_FLOAT, 0, 76, offsetof(mavlink_aslctrl_data_t, pRef) }, \ - { "r", NULL, MAVLINK_TYPE_FLOAT, 0, 80, offsetof(mavlink_aslctrl_data_t, r) }, \ - { "rRef", NULL, MAVLINK_TYPE_FLOAT, 0, 84, offsetof(mavlink_aslctrl_data_t, rRef) }, \ - { "uAil", NULL, MAVLINK_TYPE_FLOAT, 0, 88, offsetof(mavlink_aslctrl_data_t, uAil) }, \ - { "uRud", NULL, MAVLINK_TYPE_FLOAT, 0, 92, offsetof(mavlink_aslctrl_data_t, uRud) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_ASLCTRL_DATA { \ - "ASLCTRL_DATA", \ - 25, \ - { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_aslctrl_data_t, timestamp) }, \ - { "aslctrl_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 96, offsetof(mavlink_aslctrl_data_t, aslctrl_mode) }, \ - { "h", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_aslctrl_data_t, h) }, \ - { "hRef", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_aslctrl_data_t, hRef) }, \ - { "hRef_t", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_aslctrl_data_t, hRef_t) }, \ - { "PitchAngle", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_aslctrl_data_t, PitchAngle) }, \ - { "PitchAngleRef", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_aslctrl_data_t, PitchAngleRef) }, \ - { "q", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_aslctrl_data_t, q) }, \ - { "qRef", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_aslctrl_data_t, qRef) }, \ - { "uElev", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_aslctrl_data_t, uElev) }, \ - { "uThrot", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_aslctrl_data_t, uThrot) }, \ - { "uThrot2", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_aslctrl_data_t, uThrot2) }, \ - { "nZ", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_aslctrl_data_t, nZ) }, \ - { "AirspeedRef", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_aslctrl_data_t, AirspeedRef) }, \ - { "SpoilersEngaged", NULL, MAVLINK_TYPE_UINT8_T, 0, 97, offsetof(mavlink_aslctrl_data_t, SpoilersEngaged) }, \ - { "YawAngle", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_aslctrl_data_t, YawAngle) }, \ - { "YawAngleRef", NULL, MAVLINK_TYPE_FLOAT, 0, 60, offsetof(mavlink_aslctrl_data_t, YawAngleRef) }, \ - { "RollAngle", NULL, MAVLINK_TYPE_FLOAT, 0, 64, offsetof(mavlink_aslctrl_data_t, RollAngle) }, \ - { "RollAngleRef", NULL, MAVLINK_TYPE_FLOAT, 0, 68, offsetof(mavlink_aslctrl_data_t, RollAngleRef) }, \ - { "p", NULL, MAVLINK_TYPE_FLOAT, 0, 72, offsetof(mavlink_aslctrl_data_t, p) }, \ - { "pRef", NULL, MAVLINK_TYPE_FLOAT, 0, 76, offsetof(mavlink_aslctrl_data_t, pRef) }, \ - { "r", NULL, MAVLINK_TYPE_FLOAT, 0, 80, offsetof(mavlink_aslctrl_data_t, r) }, \ - { "rRef", NULL, MAVLINK_TYPE_FLOAT, 0, 84, offsetof(mavlink_aslctrl_data_t, rRef) }, \ - { "uAil", NULL, MAVLINK_TYPE_FLOAT, 0, 88, offsetof(mavlink_aslctrl_data_t, uAil) }, \ - { "uRud", NULL, MAVLINK_TYPE_FLOAT, 0, 92, offsetof(mavlink_aslctrl_data_t, uRud) }, \ - } \ -} -#endif - -/** - * @brief Pack a aslctrl_data message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param timestamp [us] Timestamp - * @param aslctrl_mode ASLCTRL control-mode (manual, stabilized, auto, etc...) - * @param h See sourcecode for a description of these values... - * @param hRef - * @param hRef_t - * @param PitchAngle [deg] Pitch angle - * @param PitchAngleRef [deg] Pitch angle reference - * @param q - * @param qRef - * @param uElev - * @param uThrot - * @param uThrot2 - * @param nZ - * @param AirspeedRef [m/s] Airspeed reference - * @param SpoilersEngaged - * @param YawAngle [deg] Yaw angle - * @param YawAngleRef [deg] Yaw angle reference - * @param RollAngle [deg] Roll angle - * @param RollAngleRef [deg] Roll angle reference - * @param p - * @param pRef - * @param r - * @param rRef - * @param uAil - * @param uRud - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_aslctrl_data_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint64_t timestamp, uint8_t aslctrl_mode, float h, float hRef, float hRef_t, float PitchAngle, float PitchAngleRef, float q, float qRef, float uElev, float uThrot, float uThrot2, float nZ, float AirspeedRef, uint8_t SpoilersEngaged, float YawAngle, float YawAngleRef, float RollAngle, float RollAngleRef, float p, float pRef, float r, float rRef, float uAil, float uRud) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_ASLCTRL_DATA_LEN]; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_float(buf, 8, h); - _mav_put_float(buf, 12, hRef); - _mav_put_float(buf, 16, hRef_t); - _mav_put_float(buf, 20, PitchAngle); - _mav_put_float(buf, 24, PitchAngleRef); - _mav_put_float(buf, 28, q); - _mav_put_float(buf, 32, qRef); - _mav_put_float(buf, 36, uElev); - _mav_put_float(buf, 40, uThrot); - _mav_put_float(buf, 44, uThrot2); - _mav_put_float(buf, 48, nZ); - _mav_put_float(buf, 52, AirspeedRef); - _mav_put_float(buf, 56, YawAngle); - _mav_put_float(buf, 60, YawAngleRef); - _mav_put_float(buf, 64, RollAngle); - _mav_put_float(buf, 68, RollAngleRef); - _mav_put_float(buf, 72, p); - _mav_put_float(buf, 76, pRef); - _mav_put_float(buf, 80, r); - _mav_put_float(buf, 84, rRef); - _mav_put_float(buf, 88, uAil); - _mav_put_float(buf, 92, uRud); - _mav_put_uint8_t(buf, 96, aslctrl_mode); - _mav_put_uint8_t(buf, 97, SpoilersEngaged); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ASLCTRL_DATA_LEN); -#else - mavlink_aslctrl_data_t packet; - packet.timestamp = timestamp; - packet.h = h; - packet.hRef = hRef; - packet.hRef_t = hRef_t; - packet.PitchAngle = PitchAngle; - packet.PitchAngleRef = PitchAngleRef; - packet.q = q; - packet.qRef = qRef; - packet.uElev = uElev; - packet.uThrot = uThrot; - packet.uThrot2 = uThrot2; - packet.nZ = nZ; - packet.AirspeedRef = AirspeedRef; - packet.YawAngle = YawAngle; - packet.YawAngleRef = YawAngleRef; - packet.RollAngle = RollAngle; - packet.RollAngleRef = RollAngleRef; - packet.p = p; - packet.pRef = pRef; - packet.r = r; - packet.rRef = rRef; - packet.uAil = uAil; - packet.uRud = uRud; - packet.aslctrl_mode = aslctrl_mode; - packet.SpoilersEngaged = SpoilersEngaged; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ASLCTRL_DATA_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_ASLCTRL_DATA; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ASLCTRL_DATA_MIN_LEN, MAVLINK_MSG_ID_ASLCTRL_DATA_LEN, MAVLINK_MSG_ID_ASLCTRL_DATA_CRC); -} - -/** - * @brief Pack a aslctrl_data message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param timestamp [us] Timestamp - * @param aslctrl_mode ASLCTRL control-mode (manual, stabilized, auto, etc...) - * @param h See sourcecode for a description of these values... - * @param hRef - * @param hRef_t - * @param PitchAngle [deg] Pitch angle - * @param PitchAngleRef [deg] Pitch angle reference - * @param q - * @param qRef - * @param uElev - * @param uThrot - * @param uThrot2 - * @param nZ - * @param AirspeedRef [m/s] Airspeed reference - * @param SpoilersEngaged - * @param YawAngle [deg] Yaw angle - * @param YawAngleRef [deg] Yaw angle reference - * @param RollAngle [deg] Roll angle - * @param RollAngleRef [deg] Roll angle reference - * @param p - * @param pRef - * @param r - * @param rRef - * @param uAil - * @param uRud - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_aslctrl_data_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint64_t timestamp,uint8_t aslctrl_mode,float h,float hRef,float hRef_t,float PitchAngle,float PitchAngleRef,float q,float qRef,float uElev,float uThrot,float uThrot2,float nZ,float AirspeedRef,uint8_t SpoilersEngaged,float YawAngle,float YawAngleRef,float RollAngle,float RollAngleRef,float p,float pRef,float r,float rRef,float uAil,float uRud) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_ASLCTRL_DATA_LEN]; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_float(buf, 8, h); - _mav_put_float(buf, 12, hRef); - _mav_put_float(buf, 16, hRef_t); - _mav_put_float(buf, 20, PitchAngle); - _mav_put_float(buf, 24, PitchAngleRef); - _mav_put_float(buf, 28, q); - _mav_put_float(buf, 32, qRef); - _mav_put_float(buf, 36, uElev); - _mav_put_float(buf, 40, uThrot); - _mav_put_float(buf, 44, uThrot2); - _mav_put_float(buf, 48, nZ); - _mav_put_float(buf, 52, AirspeedRef); - _mav_put_float(buf, 56, YawAngle); - _mav_put_float(buf, 60, YawAngleRef); - _mav_put_float(buf, 64, RollAngle); - _mav_put_float(buf, 68, RollAngleRef); - _mav_put_float(buf, 72, p); - _mav_put_float(buf, 76, pRef); - _mav_put_float(buf, 80, r); - _mav_put_float(buf, 84, rRef); - _mav_put_float(buf, 88, uAil); - _mav_put_float(buf, 92, uRud); - _mav_put_uint8_t(buf, 96, aslctrl_mode); - _mav_put_uint8_t(buf, 97, SpoilersEngaged); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ASLCTRL_DATA_LEN); -#else - mavlink_aslctrl_data_t packet; - packet.timestamp = timestamp; - packet.h = h; - packet.hRef = hRef; - packet.hRef_t = hRef_t; - packet.PitchAngle = PitchAngle; - packet.PitchAngleRef = PitchAngleRef; - packet.q = q; - packet.qRef = qRef; - packet.uElev = uElev; - packet.uThrot = uThrot; - packet.uThrot2 = uThrot2; - packet.nZ = nZ; - packet.AirspeedRef = AirspeedRef; - packet.YawAngle = YawAngle; - packet.YawAngleRef = YawAngleRef; - packet.RollAngle = RollAngle; - packet.RollAngleRef = RollAngleRef; - packet.p = p; - packet.pRef = pRef; - packet.r = r; - packet.rRef = rRef; - packet.uAil = uAil; - packet.uRud = uRud; - packet.aslctrl_mode = aslctrl_mode; - packet.SpoilersEngaged = SpoilersEngaged; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ASLCTRL_DATA_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_ASLCTRL_DATA; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ASLCTRL_DATA_MIN_LEN, MAVLINK_MSG_ID_ASLCTRL_DATA_LEN, MAVLINK_MSG_ID_ASLCTRL_DATA_CRC); -} - -/** - * @brief Encode a aslctrl_data struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param aslctrl_data C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_aslctrl_data_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_aslctrl_data_t* aslctrl_data) -{ - return mavlink_msg_aslctrl_data_pack(system_id, component_id, msg, aslctrl_data->timestamp, aslctrl_data->aslctrl_mode, aslctrl_data->h, aslctrl_data->hRef, aslctrl_data->hRef_t, aslctrl_data->PitchAngle, aslctrl_data->PitchAngleRef, aslctrl_data->q, aslctrl_data->qRef, aslctrl_data->uElev, aslctrl_data->uThrot, aslctrl_data->uThrot2, aslctrl_data->nZ, aslctrl_data->AirspeedRef, aslctrl_data->SpoilersEngaged, aslctrl_data->YawAngle, aslctrl_data->YawAngleRef, aslctrl_data->RollAngle, aslctrl_data->RollAngleRef, aslctrl_data->p, aslctrl_data->pRef, aslctrl_data->r, aslctrl_data->rRef, aslctrl_data->uAil, aslctrl_data->uRud); -} - -/** - * @brief Encode a aslctrl_data struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param aslctrl_data C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_aslctrl_data_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_aslctrl_data_t* aslctrl_data) -{ - return mavlink_msg_aslctrl_data_pack_chan(system_id, component_id, chan, msg, aslctrl_data->timestamp, aslctrl_data->aslctrl_mode, aslctrl_data->h, aslctrl_data->hRef, aslctrl_data->hRef_t, aslctrl_data->PitchAngle, aslctrl_data->PitchAngleRef, aslctrl_data->q, aslctrl_data->qRef, aslctrl_data->uElev, aslctrl_data->uThrot, aslctrl_data->uThrot2, aslctrl_data->nZ, aslctrl_data->AirspeedRef, aslctrl_data->SpoilersEngaged, aslctrl_data->YawAngle, aslctrl_data->YawAngleRef, aslctrl_data->RollAngle, aslctrl_data->RollAngleRef, aslctrl_data->p, aslctrl_data->pRef, aslctrl_data->r, aslctrl_data->rRef, aslctrl_data->uAil, aslctrl_data->uRud); -} - -/** - * @brief Send a aslctrl_data message - * @param chan MAVLink channel to send the message - * - * @param timestamp [us] Timestamp - * @param aslctrl_mode ASLCTRL control-mode (manual, stabilized, auto, etc...) - * @param h See sourcecode for a description of these values... - * @param hRef - * @param hRef_t - * @param PitchAngle [deg] Pitch angle - * @param PitchAngleRef [deg] Pitch angle reference - * @param q - * @param qRef - * @param uElev - * @param uThrot - * @param uThrot2 - * @param nZ - * @param AirspeedRef [m/s] Airspeed reference - * @param SpoilersEngaged - * @param YawAngle [deg] Yaw angle - * @param YawAngleRef [deg] Yaw angle reference - * @param RollAngle [deg] Roll angle - * @param RollAngleRef [deg] Roll angle reference - * @param p - * @param pRef - * @param r - * @param rRef - * @param uAil - * @param uRud - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_aslctrl_data_send(mavlink_channel_t chan, uint64_t timestamp, uint8_t aslctrl_mode, float h, float hRef, float hRef_t, float PitchAngle, float PitchAngleRef, float q, float qRef, float uElev, float uThrot, float uThrot2, float nZ, float AirspeedRef, uint8_t SpoilersEngaged, float YawAngle, float YawAngleRef, float RollAngle, float RollAngleRef, float p, float pRef, float r, float rRef, float uAil, float uRud) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_ASLCTRL_DATA_LEN]; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_float(buf, 8, h); - _mav_put_float(buf, 12, hRef); - _mav_put_float(buf, 16, hRef_t); - _mav_put_float(buf, 20, PitchAngle); - _mav_put_float(buf, 24, PitchAngleRef); - _mav_put_float(buf, 28, q); - _mav_put_float(buf, 32, qRef); - _mav_put_float(buf, 36, uElev); - _mav_put_float(buf, 40, uThrot); - _mav_put_float(buf, 44, uThrot2); - _mav_put_float(buf, 48, nZ); - _mav_put_float(buf, 52, AirspeedRef); - _mav_put_float(buf, 56, YawAngle); - _mav_put_float(buf, 60, YawAngleRef); - _mav_put_float(buf, 64, RollAngle); - _mav_put_float(buf, 68, RollAngleRef); - _mav_put_float(buf, 72, p); - _mav_put_float(buf, 76, pRef); - _mav_put_float(buf, 80, r); - _mav_put_float(buf, 84, rRef); - _mav_put_float(buf, 88, uAil); - _mav_put_float(buf, 92, uRud); - _mav_put_uint8_t(buf, 96, aslctrl_mode); - _mav_put_uint8_t(buf, 97, SpoilersEngaged); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ASLCTRL_DATA, buf, MAVLINK_MSG_ID_ASLCTRL_DATA_MIN_LEN, MAVLINK_MSG_ID_ASLCTRL_DATA_LEN, MAVLINK_MSG_ID_ASLCTRL_DATA_CRC); -#else - mavlink_aslctrl_data_t packet; - packet.timestamp = timestamp; - packet.h = h; - packet.hRef = hRef; - packet.hRef_t = hRef_t; - packet.PitchAngle = PitchAngle; - packet.PitchAngleRef = PitchAngleRef; - packet.q = q; - packet.qRef = qRef; - packet.uElev = uElev; - packet.uThrot = uThrot; - packet.uThrot2 = uThrot2; - packet.nZ = nZ; - packet.AirspeedRef = AirspeedRef; - packet.YawAngle = YawAngle; - packet.YawAngleRef = YawAngleRef; - packet.RollAngle = RollAngle; - packet.RollAngleRef = RollAngleRef; - packet.p = p; - packet.pRef = pRef; - packet.r = r; - packet.rRef = rRef; - packet.uAil = uAil; - packet.uRud = uRud; - packet.aslctrl_mode = aslctrl_mode; - packet.SpoilersEngaged = SpoilersEngaged; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ASLCTRL_DATA, (const char *)&packet, MAVLINK_MSG_ID_ASLCTRL_DATA_MIN_LEN, MAVLINK_MSG_ID_ASLCTRL_DATA_LEN, MAVLINK_MSG_ID_ASLCTRL_DATA_CRC); -#endif -} - -/** - * @brief Send a aslctrl_data message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_aslctrl_data_send_struct(mavlink_channel_t chan, const mavlink_aslctrl_data_t* aslctrl_data) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_aslctrl_data_send(chan, aslctrl_data->timestamp, aslctrl_data->aslctrl_mode, aslctrl_data->h, aslctrl_data->hRef, aslctrl_data->hRef_t, aslctrl_data->PitchAngle, aslctrl_data->PitchAngleRef, aslctrl_data->q, aslctrl_data->qRef, aslctrl_data->uElev, aslctrl_data->uThrot, aslctrl_data->uThrot2, aslctrl_data->nZ, aslctrl_data->AirspeedRef, aslctrl_data->SpoilersEngaged, aslctrl_data->YawAngle, aslctrl_data->YawAngleRef, aslctrl_data->RollAngle, aslctrl_data->RollAngleRef, aslctrl_data->p, aslctrl_data->pRef, aslctrl_data->r, aslctrl_data->rRef, aslctrl_data->uAil, aslctrl_data->uRud); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ASLCTRL_DATA, (const char *)aslctrl_data, MAVLINK_MSG_ID_ASLCTRL_DATA_MIN_LEN, MAVLINK_MSG_ID_ASLCTRL_DATA_LEN, MAVLINK_MSG_ID_ASLCTRL_DATA_CRC); -#endif -} - -#if MAVLINK_MSG_ID_ASLCTRL_DATA_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_aslctrl_data_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t timestamp, uint8_t aslctrl_mode, float h, float hRef, float hRef_t, float PitchAngle, float PitchAngleRef, float q, float qRef, float uElev, float uThrot, float uThrot2, float nZ, float AirspeedRef, uint8_t SpoilersEngaged, float YawAngle, float YawAngleRef, float RollAngle, float RollAngleRef, float p, float pRef, float r, float rRef, float uAil, float uRud) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_float(buf, 8, h); - _mav_put_float(buf, 12, hRef); - _mav_put_float(buf, 16, hRef_t); - _mav_put_float(buf, 20, PitchAngle); - _mav_put_float(buf, 24, PitchAngleRef); - _mav_put_float(buf, 28, q); - _mav_put_float(buf, 32, qRef); - _mav_put_float(buf, 36, uElev); - _mav_put_float(buf, 40, uThrot); - _mav_put_float(buf, 44, uThrot2); - _mav_put_float(buf, 48, nZ); - _mav_put_float(buf, 52, AirspeedRef); - _mav_put_float(buf, 56, YawAngle); - _mav_put_float(buf, 60, YawAngleRef); - _mav_put_float(buf, 64, RollAngle); - _mav_put_float(buf, 68, RollAngleRef); - _mav_put_float(buf, 72, p); - _mav_put_float(buf, 76, pRef); - _mav_put_float(buf, 80, r); - _mav_put_float(buf, 84, rRef); - _mav_put_float(buf, 88, uAil); - _mav_put_float(buf, 92, uRud); - _mav_put_uint8_t(buf, 96, aslctrl_mode); - _mav_put_uint8_t(buf, 97, SpoilersEngaged); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ASLCTRL_DATA, buf, MAVLINK_MSG_ID_ASLCTRL_DATA_MIN_LEN, MAVLINK_MSG_ID_ASLCTRL_DATA_LEN, MAVLINK_MSG_ID_ASLCTRL_DATA_CRC); -#else - mavlink_aslctrl_data_t *packet = (mavlink_aslctrl_data_t *)msgbuf; - packet->timestamp = timestamp; - packet->h = h; - packet->hRef = hRef; - packet->hRef_t = hRef_t; - packet->PitchAngle = PitchAngle; - packet->PitchAngleRef = PitchAngleRef; - packet->q = q; - packet->qRef = qRef; - packet->uElev = uElev; - packet->uThrot = uThrot; - packet->uThrot2 = uThrot2; - packet->nZ = nZ; - packet->AirspeedRef = AirspeedRef; - packet->YawAngle = YawAngle; - packet->YawAngleRef = YawAngleRef; - packet->RollAngle = RollAngle; - packet->RollAngleRef = RollAngleRef; - packet->p = p; - packet->pRef = pRef; - packet->r = r; - packet->rRef = rRef; - packet->uAil = uAil; - packet->uRud = uRud; - packet->aslctrl_mode = aslctrl_mode; - packet->SpoilersEngaged = SpoilersEngaged; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ASLCTRL_DATA, (const char *)packet, MAVLINK_MSG_ID_ASLCTRL_DATA_MIN_LEN, MAVLINK_MSG_ID_ASLCTRL_DATA_LEN, MAVLINK_MSG_ID_ASLCTRL_DATA_CRC); -#endif -} -#endif - -#endif - -// MESSAGE ASLCTRL_DATA UNPACKING - - -/** - * @brief Get field timestamp from aslctrl_data message - * - * @return [us] Timestamp - */ -static inline uint64_t mavlink_msg_aslctrl_data_get_timestamp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint64_t(msg, 0); -} - -/** - * @brief Get field aslctrl_mode from aslctrl_data message - * - * @return ASLCTRL control-mode (manual, stabilized, auto, etc...) - */ -static inline uint8_t mavlink_msg_aslctrl_data_get_aslctrl_mode(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 96); -} - -/** - * @brief Get field h from aslctrl_data message - * - * @return See sourcecode for a description of these values... - */ -static inline float mavlink_msg_aslctrl_data_get_h(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field hRef from aslctrl_data message - * - * @return - */ -static inline float mavlink_msg_aslctrl_data_get_hRef(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Get field hRef_t from aslctrl_data message - * - * @return - */ -static inline float mavlink_msg_aslctrl_data_get_hRef_t(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 16); -} - -/** - * @brief Get field PitchAngle from aslctrl_data message - * - * @return [deg] Pitch angle - */ -static inline float mavlink_msg_aslctrl_data_get_PitchAngle(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 20); -} - -/** - * @brief Get field PitchAngleRef from aslctrl_data message - * - * @return [deg] Pitch angle reference - */ -static inline float mavlink_msg_aslctrl_data_get_PitchAngleRef(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 24); -} - -/** - * @brief Get field q from aslctrl_data message - * - * @return - */ -static inline float mavlink_msg_aslctrl_data_get_q(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 28); -} - -/** - * @brief Get field qRef from aslctrl_data message - * - * @return - */ -static inline float mavlink_msg_aslctrl_data_get_qRef(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 32); -} - -/** - * @brief Get field uElev from aslctrl_data message - * - * @return - */ -static inline float mavlink_msg_aslctrl_data_get_uElev(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 36); -} - -/** - * @brief Get field uThrot from aslctrl_data message - * - * @return - */ -static inline float mavlink_msg_aslctrl_data_get_uThrot(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 40); -} - -/** - * @brief Get field uThrot2 from aslctrl_data message - * - * @return - */ -static inline float mavlink_msg_aslctrl_data_get_uThrot2(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 44); -} - -/** - * @brief Get field nZ from aslctrl_data message - * - * @return - */ -static inline float mavlink_msg_aslctrl_data_get_nZ(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 48); -} - -/** - * @brief Get field AirspeedRef from aslctrl_data message - * - * @return [m/s] Airspeed reference - */ -static inline float mavlink_msg_aslctrl_data_get_AirspeedRef(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 52); -} - -/** - * @brief Get field SpoilersEngaged from aslctrl_data message - * - * @return - */ -static inline uint8_t mavlink_msg_aslctrl_data_get_SpoilersEngaged(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 97); -} - -/** - * @brief Get field YawAngle from aslctrl_data message - * - * @return [deg] Yaw angle - */ -static inline float mavlink_msg_aslctrl_data_get_YawAngle(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 56); -} - -/** - * @brief Get field YawAngleRef from aslctrl_data message - * - * @return [deg] Yaw angle reference - */ -static inline float mavlink_msg_aslctrl_data_get_YawAngleRef(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 60); -} - -/** - * @brief Get field RollAngle from aslctrl_data message - * - * @return [deg] Roll angle - */ -static inline float mavlink_msg_aslctrl_data_get_RollAngle(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 64); -} - -/** - * @brief Get field RollAngleRef from aslctrl_data message - * - * @return [deg] Roll angle reference - */ -static inline float mavlink_msg_aslctrl_data_get_RollAngleRef(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 68); -} - -/** - * @brief Get field p from aslctrl_data message - * - * @return - */ -static inline float mavlink_msg_aslctrl_data_get_p(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 72); -} - -/** - * @brief Get field pRef from aslctrl_data message - * - * @return - */ -static inline float mavlink_msg_aslctrl_data_get_pRef(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 76); -} - -/** - * @brief Get field r from aslctrl_data message - * - * @return - */ -static inline float mavlink_msg_aslctrl_data_get_r(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 80); -} - -/** - * @brief Get field rRef from aslctrl_data message - * - * @return - */ -static inline float mavlink_msg_aslctrl_data_get_rRef(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 84); -} - -/** - * @brief Get field uAil from aslctrl_data message - * - * @return - */ -static inline float mavlink_msg_aslctrl_data_get_uAil(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 88); -} - -/** - * @brief Get field uRud from aslctrl_data message - * - * @return - */ -static inline float mavlink_msg_aslctrl_data_get_uRud(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 92); -} - -/** - * @brief Decode a aslctrl_data message into a struct - * - * @param msg The message to decode - * @param aslctrl_data C-struct to decode the message contents into - */ -static inline void mavlink_msg_aslctrl_data_decode(const mavlink_message_t* msg, mavlink_aslctrl_data_t* aslctrl_data) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - aslctrl_data->timestamp = mavlink_msg_aslctrl_data_get_timestamp(msg); - aslctrl_data->h = mavlink_msg_aslctrl_data_get_h(msg); - aslctrl_data->hRef = mavlink_msg_aslctrl_data_get_hRef(msg); - aslctrl_data->hRef_t = mavlink_msg_aslctrl_data_get_hRef_t(msg); - aslctrl_data->PitchAngle = mavlink_msg_aslctrl_data_get_PitchAngle(msg); - aslctrl_data->PitchAngleRef = mavlink_msg_aslctrl_data_get_PitchAngleRef(msg); - aslctrl_data->q = mavlink_msg_aslctrl_data_get_q(msg); - aslctrl_data->qRef = mavlink_msg_aslctrl_data_get_qRef(msg); - aslctrl_data->uElev = mavlink_msg_aslctrl_data_get_uElev(msg); - aslctrl_data->uThrot = mavlink_msg_aslctrl_data_get_uThrot(msg); - aslctrl_data->uThrot2 = mavlink_msg_aslctrl_data_get_uThrot2(msg); - aslctrl_data->nZ = mavlink_msg_aslctrl_data_get_nZ(msg); - aslctrl_data->AirspeedRef = mavlink_msg_aslctrl_data_get_AirspeedRef(msg); - aslctrl_data->YawAngle = mavlink_msg_aslctrl_data_get_YawAngle(msg); - aslctrl_data->YawAngleRef = mavlink_msg_aslctrl_data_get_YawAngleRef(msg); - aslctrl_data->RollAngle = mavlink_msg_aslctrl_data_get_RollAngle(msg); - aslctrl_data->RollAngleRef = mavlink_msg_aslctrl_data_get_RollAngleRef(msg); - aslctrl_data->p = mavlink_msg_aslctrl_data_get_p(msg); - aslctrl_data->pRef = mavlink_msg_aslctrl_data_get_pRef(msg); - aslctrl_data->r = mavlink_msg_aslctrl_data_get_r(msg); - aslctrl_data->rRef = mavlink_msg_aslctrl_data_get_rRef(msg); - aslctrl_data->uAil = mavlink_msg_aslctrl_data_get_uAil(msg); - aslctrl_data->uRud = mavlink_msg_aslctrl_data_get_uRud(msg); - aslctrl_data->aslctrl_mode = mavlink_msg_aslctrl_data_get_aslctrl_mode(msg); - aslctrl_data->SpoilersEngaged = mavlink_msg_aslctrl_data_get_SpoilersEngaged(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_ASLCTRL_DATA_LEN? msg->len : MAVLINK_MSG_ID_ASLCTRL_DATA_LEN; - memset(aslctrl_data, 0, MAVLINK_MSG_ID_ASLCTRL_DATA_LEN); - memcpy(aslctrl_data, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ASLUAV/mavlink_msg_aslctrl_debug.h b/ASLUAV/mavlink_msg_aslctrl_debug.h deleted file mode 100644 index 831609965..000000000 --- a/ASLUAV/mavlink_msg_aslctrl_debug.h +++ /dev/null @@ -1,463 +0,0 @@ -#pragma once -// MESSAGE ASLCTRL_DEBUG PACKING - -#define MAVLINK_MSG_ID_ASLCTRL_DEBUG 204 - - -typedef struct __mavlink_aslctrl_debug_t { - uint32_t i32_1; /*< Debug data*/ - float f_1; /*< Debug data */ - float f_2; /*< Debug data*/ - float f_3; /*< Debug data*/ - float f_4; /*< Debug data*/ - float f_5; /*< Debug data*/ - float f_6; /*< Debug data*/ - float f_7; /*< Debug data*/ - float f_8; /*< Debug data*/ - uint8_t i8_1; /*< Debug data*/ - uint8_t i8_2; /*< Debug data*/ -} mavlink_aslctrl_debug_t; - -#define MAVLINK_MSG_ID_ASLCTRL_DEBUG_LEN 38 -#define MAVLINK_MSG_ID_ASLCTRL_DEBUG_MIN_LEN 38 -#define MAVLINK_MSG_ID_204_LEN 38 -#define MAVLINK_MSG_ID_204_MIN_LEN 38 - -#define MAVLINK_MSG_ID_ASLCTRL_DEBUG_CRC 251 -#define MAVLINK_MSG_ID_204_CRC 251 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_ASLCTRL_DEBUG { \ - 204, \ - "ASLCTRL_DEBUG", \ - 11, \ - { { "i32_1", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_aslctrl_debug_t, i32_1) }, \ - { "i8_1", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_aslctrl_debug_t, i8_1) }, \ - { "i8_2", NULL, MAVLINK_TYPE_UINT8_T, 0, 37, offsetof(mavlink_aslctrl_debug_t, i8_2) }, \ - { "f_1", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_aslctrl_debug_t, f_1) }, \ - { "f_2", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_aslctrl_debug_t, f_2) }, \ - { "f_3", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_aslctrl_debug_t, f_3) }, \ - { "f_4", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_aslctrl_debug_t, f_4) }, \ - { "f_5", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_aslctrl_debug_t, f_5) }, \ - { "f_6", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_aslctrl_debug_t, f_6) }, \ - { "f_7", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_aslctrl_debug_t, f_7) }, \ - { "f_8", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_aslctrl_debug_t, f_8) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_ASLCTRL_DEBUG { \ - "ASLCTRL_DEBUG", \ - 11, \ - { { "i32_1", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_aslctrl_debug_t, i32_1) }, \ - { "i8_1", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_aslctrl_debug_t, i8_1) }, \ - { "i8_2", NULL, MAVLINK_TYPE_UINT8_T, 0, 37, offsetof(mavlink_aslctrl_debug_t, i8_2) }, \ - { "f_1", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_aslctrl_debug_t, f_1) }, \ - { "f_2", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_aslctrl_debug_t, f_2) }, \ - { "f_3", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_aslctrl_debug_t, f_3) }, \ - { "f_4", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_aslctrl_debug_t, f_4) }, \ - { "f_5", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_aslctrl_debug_t, f_5) }, \ - { "f_6", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_aslctrl_debug_t, f_6) }, \ - { "f_7", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_aslctrl_debug_t, f_7) }, \ - { "f_8", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_aslctrl_debug_t, f_8) }, \ - } \ -} -#endif - -/** - * @brief Pack a aslctrl_debug message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param i32_1 Debug data - * @param i8_1 Debug data - * @param i8_2 Debug data - * @param f_1 Debug data - * @param f_2 Debug data - * @param f_3 Debug data - * @param f_4 Debug data - * @param f_5 Debug data - * @param f_6 Debug data - * @param f_7 Debug data - * @param f_8 Debug data - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_aslctrl_debug_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint32_t i32_1, uint8_t i8_1, uint8_t i8_2, float f_1, float f_2, float f_3, float f_4, float f_5, float f_6, float f_7, float f_8) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_ASLCTRL_DEBUG_LEN]; - _mav_put_uint32_t(buf, 0, i32_1); - _mav_put_float(buf, 4, f_1); - _mav_put_float(buf, 8, f_2); - _mav_put_float(buf, 12, f_3); - _mav_put_float(buf, 16, f_4); - _mav_put_float(buf, 20, f_5); - _mav_put_float(buf, 24, f_6); - _mav_put_float(buf, 28, f_7); - _mav_put_float(buf, 32, f_8); - _mav_put_uint8_t(buf, 36, i8_1); - _mav_put_uint8_t(buf, 37, i8_2); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ASLCTRL_DEBUG_LEN); -#else - mavlink_aslctrl_debug_t packet; - packet.i32_1 = i32_1; - packet.f_1 = f_1; - packet.f_2 = f_2; - packet.f_3 = f_3; - packet.f_4 = f_4; - packet.f_5 = f_5; - packet.f_6 = f_6; - packet.f_7 = f_7; - packet.f_8 = f_8; - packet.i8_1 = i8_1; - packet.i8_2 = i8_2; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ASLCTRL_DEBUG_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_ASLCTRL_DEBUG; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ASLCTRL_DEBUG_MIN_LEN, MAVLINK_MSG_ID_ASLCTRL_DEBUG_LEN, MAVLINK_MSG_ID_ASLCTRL_DEBUG_CRC); -} - -/** - * @brief Pack a aslctrl_debug message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param i32_1 Debug data - * @param i8_1 Debug data - * @param i8_2 Debug data - * @param f_1 Debug data - * @param f_2 Debug data - * @param f_3 Debug data - * @param f_4 Debug data - * @param f_5 Debug data - * @param f_6 Debug data - * @param f_7 Debug data - * @param f_8 Debug data - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_aslctrl_debug_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint32_t i32_1,uint8_t i8_1,uint8_t i8_2,float f_1,float f_2,float f_3,float f_4,float f_5,float f_6,float f_7,float f_8) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_ASLCTRL_DEBUG_LEN]; - _mav_put_uint32_t(buf, 0, i32_1); - _mav_put_float(buf, 4, f_1); - _mav_put_float(buf, 8, f_2); - _mav_put_float(buf, 12, f_3); - _mav_put_float(buf, 16, f_4); - _mav_put_float(buf, 20, f_5); - _mav_put_float(buf, 24, f_6); - _mav_put_float(buf, 28, f_7); - _mav_put_float(buf, 32, f_8); - _mav_put_uint8_t(buf, 36, i8_1); - _mav_put_uint8_t(buf, 37, i8_2); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ASLCTRL_DEBUG_LEN); -#else - mavlink_aslctrl_debug_t packet; - packet.i32_1 = i32_1; - packet.f_1 = f_1; - packet.f_2 = f_2; - packet.f_3 = f_3; - packet.f_4 = f_4; - packet.f_5 = f_5; - packet.f_6 = f_6; - packet.f_7 = f_7; - packet.f_8 = f_8; - packet.i8_1 = i8_1; - packet.i8_2 = i8_2; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ASLCTRL_DEBUG_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_ASLCTRL_DEBUG; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ASLCTRL_DEBUG_MIN_LEN, MAVLINK_MSG_ID_ASLCTRL_DEBUG_LEN, MAVLINK_MSG_ID_ASLCTRL_DEBUG_CRC); -} - -/** - * @brief Encode a aslctrl_debug struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param aslctrl_debug C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_aslctrl_debug_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_aslctrl_debug_t* aslctrl_debug) -{ - return mavlink_msg_aslctrl_debug_pack(system_id, component_id, msg, aslctrl_debug->i32_1, aslctrl_debug->i8_1, aslctrl_debug->i8_2, aslctrl_debug->f_1, aslctrl_debug->f_2, aslctrl_debug->f_3, aslctrl_debug->f_4, aslctrl_debug->f_5, aslctrl_debug->f_6, aslctrl_debug->f_7, aslctrl_debug->f_8); -} - -/** - * @brief Encode a aslctrl_debug struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param aslctrl_debug C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_aslctrl_debug_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_aslctrl_debug_t* aslctrl_debug) -{ - return mavlink_msg_aslctrl_debug_pack_chan(system_id, component_id, chan, msg, aslctrl_debug->i32_1, aslctrl_debug->i8_1, aslctrl_debug->i8_2, aslctrl_debug->f_1, aslctrl_debug->f_2, aslctrl_debug->f_3, aslctrl_debug->f_4, aslctrl_debug->f_5, aslctrl_debug->f_6, aslctrl_debug->f_7, aslctrl_debug->f_8); -} - -/** - * @brief Send a aslctrl_debug message - * @param chan MAVLink channel to send the message - * - * @param i32_1 Debug data - * @param i8_1 Debug data - * @param i8_2 Debug data - * @param f_1 Debug data - * @param f_2 Debug data - * @param f_3 Debug data - * @param f_4 Debug data - * @param f_5 Debug data - * @param f_6 Debug data - * @param f_7 Debug data - * @param f_8 Debug data - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_aslctrl_debug_send(mavlink_channel_t chan, uint32_t i32_1, uint8_t i8_1, uint8_t i8_2, float f_1, float f_2, float f_3, float f_4, float f_5, float f_6, float f_7, float f_8) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_ASLCTRL_DEBUG_LEN]; - _mav_put_uint32_t(buf, 0, i32_1); - _mav_put_float(buf, 4, f_1); - _mav_put_float(buf, 8, f_2); - _mav_put_float(buf, 12, f_3); - _mav_put_float(buf, 16, f_4); - _mav_put_float(buf, 20, f_5); - _mav_put_float(buf, 24, f_6); - _mav_put_float(buf, 28, f_7); - _mav_put_float(buf, 32, f_8); - _mav_put_uint8_t(buf, 36, i8_1); - _mav_put_uint8_t(buf, 37, i8_2); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ASLCTRL_DEBUG, buf, MAVLINK_MSG_ID_ASLCTRL_DEBUG_MIN_LEN, MAVLINK_MSG_ID_ASLCTRL_DEBUG_LEN, MAVLINK_MSG_ID_ASLCTRL_DEBUG_CRC); -#else - mavlink_aslctrl_debug_t packet; - packet.i32_1 = i32_1; - packet.f_1 = f_1; - packet.f_2 = f_2; - packet.f_3 = f_3; - packet.f_4 = f_4; - packet.f_5 = f_5; - packet.f_6 = f_6; - packet.f_7 = f_7; - packet.f_8 = f_8; - packet.i8_1 = i8_1; - packet.i8_2 = i8_2; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ASLCTRL_DEBUG, (const char *)&packet, MAVLINK_MSG_ID_ASLCTRL_DEBUG_MIN_LEN, MAVLINK_MSG_ID_ASLCTRL_DEBUG_LEN, MAVLINK_MSG_ID_ASLCTRL_DEBUG_CRC); -#endif -} - -/** - * @brief Send a aslctrl_debug message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_aslctrl_debug_send_struct(mavlink_channel_t chan, const mavlink_aslctrl_debug_t* aslctrl_debug) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_aslctrl_debug_send(chan, aslctrl_debug->i32_1, aslctrl_debug->i8_1, aslctrl_debug->i8_2, aslctrl_debug->f_1, aslctrl_debug->f_2, aslctrl_debug->f_3, aslctrl_debug->f_4, aslctrl_debug->f_5, aslctrl_debug->f_6, aslctrl_debug->f_7, aslctrl_debug->f_8); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ASLCTRL_DEBUG, (const char *)aslctrl_debug, MAVLINK_MSG_ID_ASLCTRL_DEBUG_MIN_LEN, MAVLINK_MSG_ID_ASLCTRL_DEBUG_LEN, MAVLINK_MSG_ID_ASLCTRL_DEBUG_CRC); -#endif -} - -#if MAVLINK_MSG_ID_ASLCTRL_DEBUG_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_aslctrl_debug_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t i32_1, uint8_t i8_1, uint8_t i8_2, float f_1, float f_2, float f_3, float f_4, float f_5, float f_6, float f_7, float f_8) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint32_t(buf, 0, i32_1); - _mav_put_float(buf, 4, f_1); - _mav_put_float(buf, 8, f_2); - _mav_put_float(buf, 12, f_3); - _mav_put_float(buf, 16, f_4); - _mav_put_float(buf, 20, f_5); - _mav_put_float(buf, 24, f_6); - _mav_put_float(buf, 28, f_7); - _mav_put_float(buf, 32, f_8); - _mav_put_uint8_t(buf, 36, i8_1); - _mav_put_uint8_t(buf, 37, i8_2); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ASLCTRL_DEBUG, buf, MAVLINK_MSG_ID_ASLCTRL_DEBUG_MIN_LEN, MAVLINK_MSG_ID_ASLCTRL_DEBUG_LEN, MAVLINK_MSG_ID_ASLCTRL_DEBUG_CRC); -#else - mavlink_aslctrl_debug_t *packet = (mavlink_aslctrl_debug_t *)msgbuf; - packet->i32_1 = i32_1; - packet->f_1 = f_1; - packet->f_2 = f_2; - packet->f_3 = f_3; - packet->f_4 = f_4; - packet->f_5 = f_5; - packet->f_6 = f_6; - packet->f_7 = f_7; - packet->f_8 = f_8; - packet->i8_1 = i8_1; - packet->i8_2 = i8_2; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ASLCTRL_DEBUG, (const char *)packet, MAVLINK_MSG_ID_ASLCTRL_DEBUG_MIN_LEN, MAVLINK_MSG_ID_ASLCTRL_DEBUG_LEN, MAVLINK_MSG_ID_ASLCTRL_DEBUG_CRC); -#endif -} -#endif - -#endif - -// MESSAGE ASLCTRL_DEBUG UNPACKING - - -/** - * @brief Get field i32_1 from aslctrl_debug message - * - * @return Debug data - */ -static inline uint32_t mavlink_msg_aslctrl_debug_get_i32_1(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 0); -} - -/** - * @brief Get field i8_1 from aslctrl_debug message - * - * @return Debug data - */ -static inline uint8_t mavlink_msg_aslctrl_debug_get_i8_1(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 36); -} - -/** - * @brief Get field i8_2 from aslctrl_debug message - * - * @return Debug data - */ -static inline uint8_t mavlink_msg_aslctrl_debug_get_i8_2(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 37); -} - -/** - * @brief Get field f_1 from aslctrl_debug message - * - * @return Debug data - */ -static inline float mavlink_msg_aslctrl_debug_get_f_1(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 4); -} - -/** - * @brief Get field f_2 from aslctrl_debug message - * - * @return Debug data - */ -static inline float mavlink_msg_aslctrl_debug_get_f_2(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field f_3 from aslctrl_debug message - * - * @return Debug data - */ -static inline float mavlink_msg_aslctrl_debug_get_f_3(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Get field f_4 from aslctrl_debug message - * - * @return Debug data - */ -static inline float mavlink_msg_aslctrl_debug_get_f_4(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 16); -} - -/** - * @brief Get field f_5 from aslctrl_debug message - * - * @return Debug data - */ -static inline float mavlink_msg_aslctrl_debug_get_f_5(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 20); -} - -/** - * @brief Get field f_6 from aslctrl_debug message - * - * @return Debug data - */ -static inline float mavlink_msg_aslctrl_debug_get_f_6(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 24); -} - -/** - * @brief Get field f_7 from aslctrl_debug message - * - * @return Debug data - */ -static inline float mavlink_msg_aslctrl_debug_get_f_7(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 28); -} - -/** - * @brief Get field f_8 from aslctrl_debug message - * - * @return Debug data - */ -static inline float mavlink_msg_aslctrl_debug_get_f_8(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 32); -} - -/** - * @brief Decode a aslctrl_debug message into a struct - * - * @param msg The message to decode - * @param aslctrl_debug C-struct to decode the message contents into - */ -static inline void mavlink_msg_aslctrl_debug_decode(const mavlink_message_t* msg, mavlink_aslctrl_debug_t* aslctrl_debug) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - aslctrl_debug->i32_1 = mavlink_msg_aslctrl_debug_get_i32_1(msg); - aslctrl_debug->f_1 = mavlink_msg_aslctrl_debug_get_f_1(msg); - aslctrl_debug->f_2 = mavlink_msg_aslctrl_debug_get_f_2(msg); - aslctrl_debug->f_3 = mavlink_msg_aslctrl_debug_get_f_3(msg); - aslctrl_debug->f_4 = mavlink_msg_aslctrl_debug_get_f_4(msg); - aslctrl_debug->f_5 = mavlink_msg_aslctrl_debug_get_f_5(msg); - aslctrl_debug->f_6 = mavlink_msg_aslctrl_debug_get_f_6(msg); - aslctrl_debug->f_7 = mavlink_msg_aslctrl_debug_get_f_7(msg); - aslctrl_debug->f_8 = mavlink_msg_aslctrl_debug_get_f_8(msg); - aslctrl_debug->i8_1 = mavlink_msg_aslctrl_debug_get_i8_1(msg); - aslctrl_debug->i8_2 = mavlink_msg_aslctrl_debug_get_i8_2(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_ASLCTRL_DEBUG_LEN? msg->len : MAVLINK_MSG_ID_ASLCTRL_DEBUG_LEN; - memset(aslctrl_debug, 0, MAVLINK_MSG_ID_ASLCTRL_DEBUG_LEN); - memcpy(aslctrl_debug, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ASLUAV/mavlink_msg_asluav_status.h b/ASLUAV/mavlink_msg_asluav_status.h deleted file mode 100644 index b4a709fff..000000000 --- a/ASLUAV/mavlink_msg_asluav_status.h +++ /dev/null @@ -1,280 +0,0 @@ -#pragma once -// MESSAGE ASLUAV_STATUS PACKING - -#define MAVLINK_MSG_ID_ASLUAV_STATUS 205 - - -typedef struct __mavlink_asluav_status_t { - float Motor_rpm; /*< Motor RPM */ - uint8_t LED_status; /*< Status of the position-indicator LEDs*/ - uint8_t SATCOM_status; /*< Status of the IRIDIUM satellite communication system*/ - uint8_t Servo_status[8]; /*< Status vector for up to 8 servos*/ -} mavlink_asluav_status_t; - -#define MAVLINK_MSG_ID_ASLUAV_STATUS_LEN 14 -#define MAVLINK_MSG_ID_ASLUAV_STATUS_MIN_LEN 14 -#define MAVLINK_MSG_ID_205_LEN 14 -#define MAVLINK_MSG_ID_205_MIN_LEN 14 - -#define MAVLINK_MSG_ID_ASLUAV_STATUS_CRC 97 -#define MAVLINK_MSG_ID_205_CRC 97 - -#define MAVLINK_MSG_ASLUAV_STATUS_FIELD_SERVO_STATUS_LEN 8 - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_ASLUAV_STATUS { \ - 205, \ - "ASLUAV_STATUS", \ - 4, \ - { { "LED_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_asluav_status_t, LED_status) }, \ - { "SATCOM_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_asluav_status_t, SATCOM_status) }, \ - { "Servo_status", NULL, MAVLINK_TYPE_UINT8_T, 8, 6, offsetof(mavlink_asluav_status_t, Servo_status) }, \ - { "Motor_rpm", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_asluav_status_t, Motor_rpm) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_ASLUAV_STATUS { \ - "ASLUAV_STATUS", \ - 4, \ - { { "LED_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_asluav_status_t, LED_status) }, \ - { "SATCOM_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_asluav_status_t, SATCOM_status) }, \ - { "Servo_status", NULL, MAVLINK_TYPE_UINT8_T, 8, 6, offsetof(mavlink_asluav_status_t, Servo_status) }, \ - { "Motor_rpm", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_asluav_status_t, Motor_rpm) }, \ - } \ -} -#endif - -/** - * @brief Pack a asluav_status message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param LED_status Status of the position-indicator LEDs - * @param SATCOM_status Status of the IRIDIUM satellite communication system - * @param Servo_status Status vector for up to 8 servos - * @param Motor_rpm Motor RPM - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_asluav_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t LED_status, uint8_t SATCOM_status, const uint8_t *Servo_status, float Motor_rpm) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_ASLUAV_STATUS_LEN]; - _mav_put_float(buf, 0, Motor_rpm); - _mav_put_uint8_t(buf, 4, LED_status); - _mav_put_uint8_t(buf, 5, SATCOM_status); - _mav_put_uint8_t_array(buf, 6, Servo_status, 8); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ASLUAV_STATUS_LEN); -#else - mavlink_asluav_status_t packet; - packet.Motor_rpm = Motor_rpm; - packet.LED_status = LED_status; - packet.SATCOM_status = SATCOM_status; - mav_array_memcpy(packet.Servo_status, Servo_status, sizeof(uint8_t)*8); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ASLUAV_STATUS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_ASLUAV_STATUS; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ASLUAV_STATUS_MIN_LEN, MAVLINK_MSG_ID_ASLUAV_STATUS_LEN, MAVLINK_MSG_ID_ASLUAV_STATUS_CRC); -} - -/** - * @brief Pack a asluav_status message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param LED_status Status of the position-indicator LEDs - * @param SATCOM_status Status of the IRIDIUM satellite communication system - * @param Servo_status Status vector for up to 8 servos - * @param Motor_rpm Motor RPM - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_asluav_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t LED_status,uint8_t SATCOM_status,const uint8_t *Servo_status,float Motor_rpm) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_ASLUAV_STATUS_LEN]; - _mav_put_float(buf, 0, Motor_rpm); - _mav_put_uint8_t(buf, 4, LED_status); - _mav_put_uint8_t(buf, 5, SATCOM_status); - _mav_put_uint8_t_array(buf, 6, Servo_status, 8); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ASLUAV_STATUS_LEN); -#else - mavlink_asluav_status_t packet; - packet.Motor_rpm = Motor_rpm; - packet.LED_status = LED_status; - packet.SATCOM_status = SATCOM_status; - mav_array_memcpy(packet.Servo_status, Servo_status, sizeof(uint8_t)*8); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ASLUAV_STATUS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_ASLUAV_STATUS; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ASLUAV_STATUS_MIN_LEN, MAVLINK_MSG_ID_ASLUAV_STATUS_LEN, MAVLINK_MSG_ID_ASLUAV_STATUS_CRC); -} - -/** - * @brief Encode a asluav_status struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param asluav_status C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_asluav_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_asluav_status_t* asluav_status) -{ - return mavlink_msg_asluav_status_pack(system_id, component_id, msg, asluav_status->LED_status, asluav_status->SATCOM_status, asluav_status->Servo_status, asluav_status->Motor_rpm); -} - -/** - * @brief Encode a asluav_status struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param asluav_status C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_asluav_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_asluav_status_t* asluav_status) -{ - return mavlink_msg_asluav_status_pack_chan(system_id, component_id, chan, msg, asluav_status->LED_status, asluav_status->SATCOM_status, asluav_status->Servo_status, asluav_status->Motor_rpm); -} - -/** - * @brief Send a asluav_status message - * @param chan MAVLink channel to send the message - * - * @param LED_status Status of the position-indicator LEDs - * @param SATCOM_status Status of the IRIDIUM satellite communication system - * @param Servo_status Status vector for up to 8 servos - * @param Motor_rpm Motor RPM - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_asluav_status_send(mavlink_channel_t chan, uint8_t LED_status, uint8_t SATCOM_status, const uint8_t *Servo_status, float Motor_rpm) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_ASLUAV_STATUS_LEN]; - _mav_put_float(buf, 0, Motor_rpm); - _mav_put_uint8_t(buf, 4, LED_status); - _mav_put_uint8_t(buf, 5, SATCOM_status); - _mav_put_uint8_t_array(buf, 6, Servo_status, 8); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ASLUAV_STATUS, buf, MAVLINK_MSG_ID_ASLUAV_STATUS_MIN_LEN, MAVLINK_MSG_ID_ASLUAV_STATUS_LEN, MAVLINK_MSG_ID_ASLUAV_STATUS_CRC); -#else - mavlink_asluav_status_t packet; - packet.Motor_rpm = Motor_rpm; - packet.LED_status = LED_status; - packet.SATCOM_status = SATCOM_status; - mav_array_memcpy(packet.Servo_status, Servo_status, sizeof(uint8_t)*8); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ASLUAV_STATUS, (const char *)&packet, MAVLINK_MSG_ID_ASLUAV_STATUS_MIN_LEN, MAVLINK_MSG_ID_ASLUAV_STATUS_LEN, MAVLINK_MSG_ID_ASLUAV_STATUS_CRC); -#endif -} - -/** - * @brief Send a asluav_status message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_asluav_status_send_struct(mavlink_channel_t chan, const mavlink_asluav_status_t* asluav_status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_asluav_status_send(chan, asluav_status->LED_status, asluav_status->SATCOM_status, asluav_status->Servo_status, asluav_status->Motor_rpm); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ASLUAV_STATUS, (const char *)asluav_status, MAVLINK_MSG_ID_ASLUAV_STATUS_MIN_LEN, MAVLINK_MSG_ID_ASLUAV_STATUS_LEN, MAVLINK_MSG_ID_ASLUAV_STATUS_CRC); -#endif -} - -#if MAVLINK_MSG_ID_ASLUAV_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_asluav_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t LED_status, uint8_t SATCOM_status, const uint8_t *Servo_status, float Motor_rpm) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_float(buf, 0, Motor_rpm); - _mav_put_uint8_t(buf, 4, LED_status); - _mav_put_uint8_t(buf, 5, SATCOM_status); - _mav_put_uint8_t_array(buf, 6, Servo_status, 8); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ASLUAV_STATUS, buf, MAVLINK_MSG_ID_ASLUAV_STATUS_MIN_LEN, MAVLINK_MSG_ID_ASLUAV_STATUS_LEN, MAVLINK_MSG_ID_ASLUAV_STATUS_CRC); -#else - mavlink_asluav_status_t *packet = (mavlink_asluav_status_t *)msgbuf; - packet->Motor_rpm = Motor_rpm; - packet->LED_status = LED_status; - packet->SATCOM_status = SATCOM_status; - mav_array_memcpy(packet->Servo_status, Servo_status, sizeof(uint8_t)*8); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ASLUAV_STATUS, (const char *)packet, MAVLINK_MSG_ID_ASLUAV_STATUS_MIN_LEN, MAVLINK_MSG_ID_ASLUAV_STATUS_LEN, MAVLINK_MSG_ID_ASLUAV_STATUS_CRC); -#endif -} -#endif - -#endif - -// MESSAGE ASLUAV_STATUS UNPACKING - - -/** - * @brief Get field LED_status from asluav_status message - * - * @return Status of the position-indicator LEDs - */ -static inline uint8_t mavlink_msg_asluav_status_get_LED_status(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 4); -} - -/** - * @brief Get field SATCOM_status from asluav_status message - * - * @return Status of the IRIDIUM satellite communication system - */ -static inline uint8_t mavlink_msg_asluav_status_get_SATCOM_status(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 5); -} - -/** - * @brief Get field Servo_status from asluav_status message - * - * @return Status vector for up to 8 servos - */ -static inline uint16_t mavlink_msg_asluav_status_get_Servo_status(const mavlink_message_t* msg, uint8_t *Servo_status) -{ - return _MAV_RETURN_uint8_t_array(msg, Servo_status, 8, 6); -} - -/** - * @brief Get field Motor_rpm from asluav_status message - * - * @return Motor RPM - */ -static inline float mavlink_msg_asluav_status_get_Motor_rpm(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 0); -} - -/** - * @brief Decode a asluav_status message into a struct - * - * @param msg The message to decode - * @param asluav_status C-struct to decode the message contents into - */ -static inline void mavlink_msg_asluav_status_decode(const mavlink_message_t* msg, mavlink_asluav_status_t* asluav_status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - asluav_status->Motor_rpm = mavlink_msg_asluav_status_get_Motor_rpm(msg); - asluav_status->LED_status = mavlink_msg_asluav_status_get_LED_status(msg); - asluav_status->SATCOM_status = mavlink_msg_asluav_status_get_SATCOM_status(msg); - mavlink_msg_asluav_status_get_Servo_status(msg, asluav_status->Servo_status); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_ASLUAV_STATUS_LEN? msg->len : MAVLINK_MSG_ID_ASLUAV_STATUS_LEN; - memset(asluav_status, 0, MAVLINK_MSG_ID_ASLUAV_STATUS_LEN); - memcpy(asluav_status, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ASLUAV/mavlink_msg_command_int_stamped.h b/ASLUAV/mavlink_msg_command_int_stamped.h deleted file mode 100644 index 540f85530..000000000 --- a/ASLUAV/mavlink_msg_command_int_stamped.h +++ /dev/null @@ -1,563 +0,0 @@ -#pragma once -// MESSAGE COMMAND_INT_STAMPED PACKING - -#define MAVLINK_MSG_ID_COMMAND_INT_STAMPED 78 - - -typedef struct __mavlink_command_int_stamped_t { - uint64_t vehicle_timestamp; /*< Microseconds elapsed since vehicle boot*/ - uint32_t utc_time; /*< UTC time, seconds elapsed since 01.01.1970*/ - float param1; /*< PARAM1, see MAV_CMD enum*/ - float param2; /*< PARAM2, see MAV_CMD enum*/ - float param3; /*< PARAM3, see MAV_CMD enum*/ - float param4; /*< PARAM4, see MAV_CMD enum*/ - int32_t x; /*< PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7*/ - int32_t y; /*< PARAM6 / local: y position in meters * 1e4, global: longitude in degrees * 10^7*/ - float z; /*< PARAM7 / z position: global: altitude in meters (MSL, WGS84, AGL or relative to home - depending on frame).*/ - uint16_t command; /*< The scheduled action for the mission item, as defined by MAV_CMD enum*/ - uint8_t target_system; /*< System ID*/ - uint8_t target_component; /*< Component ID*/ - uint8_t frame; /*< The coordinate system of the COMMAND, as defined by MAV_FRAME enum*/ - uint8_t current; /*< false:0, true:1*/ - uint8_t autocontinue; /*< autocontinue to next wp*/ -} mavlink_command_int_stamped_t; - -#define MAVLINK_MSG_ID_COMMAND_INT_STAMPED_LEN 47 -#define MAVLINK_MSG_ID_COMMAND_INT_STAMPED_MIN_LEN 47 -#define MAVLINK_MSG_ID_78_LEN 47 -#define MAVLINK_MSG_ID_78_MIN_LEN 47 - -#define MAVLINK_MSG_ID_COMMAND_INT_STAMPED_CRC 119 -#define MAVLINK_MSG_ID_78_CRC 119 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_COMMAND_INT_STAMPED { \ - 78, \ - "COMMAND_INT_STAMPED", \ - 15, \ - { { "utc_time", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_command_int_stamped_t, utc_time) }, \ - { "vehicle_timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_command_int_stamped_t, vehicle_timestamp) }, \ - { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 42, offsetof(mavlink_command_int_stamped_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 43, offsetof(mavlink_command_int_stamped_t, target_component) }, \ - { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 44, offsetof(mavlink_command_int_stamped_t, frame) }, \ - { "command", NULL, MAVLINK_TYPE_UINT16_T, 0, 40, offsetof(mavlink_command_int_stamped_t, command) }, \ - { "current", NULL, MAVLINK_TYPE_UINT8_T, 0, 45, offsetof(mavlink_command_int_stamped_t, current) }, \ - { "autocontinue", NULL, MAVLINK_TYPE_UINT8_T, 0, 46, offsetof(mavlink_command_int_stamped_t, autocontinue) }, \ - { "param1", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_command_int_stamped_t, param1) }, \ - { "param2", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_command_int_stamped_t, param2) }, \ - { "param3", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_command_int_stamped_t, param3) }, \ - { "param4", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_command_int_stamped_t, param4) }, \ - { "x", NULL, MAVLINK_TYPE_INT32_T, 0, 28, offsetof(mavlink_command_int_stamped_t, x) }, \ - { "y", NULL, MAVLINK_TYPE_INT32_T, 0, 32, offsetof(mavlink_command_int_stamped_t, y) }, \ - { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_command_int_stamped_t, z) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_COMMAND_INT_STAMPED { \ - "COMMAND_INT_STAMPED", \ - 15, \ - { { "utc_time", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_command_int_stamped_t, utc_time) }, \ - { "vehicle_timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_command_int_stamped_t, vehicle_timestamp) }, \ - { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 42, offsetof(mavlink_command_int_stamped_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 43, offsetof(mavlink_command_int_stamped_t, target_component) }, \ - { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 44, offsetof(mavlink_command_int_stamped_t, frame) }, \ - { "command", NULL, MAVLINK_TYPE_UINT16_T, 0, 40, offsetof(mavlink_command_int_stamped_t, command) }, \ - { "current", NULL, MAVLINK_TYPE_UINT8_T, 0, 45, offsetof(mavlink_command_int_stamped_t, current) }, \ - { "autocontinue", NULL, MAVLINK_TYPE_UINT8_T, 0, 46, offsetof(mavlink_command_int_stamped_t, autocontinue) }, \ - { "param1", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_command_int_stamped_t, param1) }, \ - { "param2", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_command_int_stamped_t, param2) }, \ - { "param3", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_command_int_stamped_t, param3) }, \ - { "param4", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_command_int_stamped_t, param4) }, \ - { "x", NULL, MAVLINK_TYPE_INT32_T, 0, 28, offsetof(mavlink_command_int_stamped_t, x) }, \ - { "y", NULL, MAVLINK_TYPE_INT32_T, 0, 32, offsetof(mavlink_command_int_stamped_t, y) }, \ - { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_command_int_stamped_t, z) }, \ - } \ -} -#endif - -/** - * @brief Pack a command_int_stamped message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param utc_time UTC time, seconds elapsed since 01.01.1970 - * @param vehicle_timestamp Microseconds elapsed since vehicle boot - * @param target_system System ID - * @param target_component Component ID - * @param frame The coordinate system of the COMMAND, as defined by MAV_FRAME enum - * @param command The scheduled action for the mission item, as defined by MAV_CMD enum - * @param current false:0, true:1 - * @param autocontinue autocontinue to next wp - * @param param1 PARAM1, see MAV_CMD enum - * @param param2 PARAM2, see MAV_CMD enum - * @param param3 PARAM3, see MAV_CMD enum - * @param param4 PARAM4, see MAV_CMD enum - * @param x PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7 - * @param y PARAM6 / local: y position in meters * 1e4, global: longitude in degrees * 10^7 - * @param z PARAM7 / z position: global: altitude in meters (MSL, WGS84, AGL or relative to home - depending on frame). - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_command_int_stamped_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint32_t utc_time, uint64_t vehicle_timestamp, uint8_t target_system, uint8_t target_component, uint8_t frame, uint16_t command, uint8_t current, uint8_t autocontinue, float param1, float param2, float param3, float param4, int32_t x, int32_t y, float z) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_COMMAND_INT_STAMPED_LEN]; - _mav_put_uint64_t(buf, 0, vehicle_timestamp); - _mav_put_uint32_t(buf, 8, utc_time); - _mav_put_float(buf, 12, param1); - _mav_put_float(buf, 16, param2); - _mav_put_float(buf, 20, param3); - _mav_put_float(buf, 24, param4); - _mav_put_int32_t(buf, 28, x); - _mav_put_int32_t(buf, 32, y); - _mav_put_float(buf, 36, z); - _mav_put_uint16_t(buf, 40, command); - _mav_put_uint8_t(buf, 42, target_system); - _mav_put_uint8_t(buf, 43, target_component); - _mav_put_uint8_t(buf, 44, frame); - _mav_put_uint8_t(buf, 45, current); - _mav_put_uint8_t(buf, 46, autocontinue); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMMAND_INT_STAMPED_LEN); -#else - mavlink_command_int_stamped_t packet; - packet.vehicle_timestamp = vehicle_timestamp; - packet.utc_time = utc_time; - packet.param1 = param1; - packet.param2 = param2; - packet.param3 = param3; - packet.param4 = param4; - packet.x = x; - packet.y = y; - packet.z = z; - packet.command = command; - packet.target_system = target_system; - packet.target_component = target_component; - packet.frame = frame; - packet.current = current; - packet.autocontinue = autocontinue; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMMAND_INT_STAMPED_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_COMMAND_INT_STAMPED; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_COMMAND_INT_STAMPED_MIN_LEN, MAVLINK_MSG_ID_COMMAND_INT_STAMPED_LEN, MAVLINK_MSG_ID_COMMAND_INT_STAMPED_CRC); -} - -/** - * @brief Pack a command_int_stamped message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param utc_time UTC time, seconds elapsed since 01.01.1970 - * @param vehicle_timestamp Microseconds elapsed since vehicle boot - * @param target_system System ID - * @param target_component Component ID - * @param frame The coordinate system of the COMMAND, as defined by MAV_FRAME enum - * @param command The scheduled action for the mission item, as defined by MAV_CMD enum - * @param current false:0, true:1 - * @param autocontinue autocontinue to next wp - * @param param1 PARAM1, see MAV_CMD enum - * @param param2 PARAM2, see MAV_CMD enum - * @param param3 PARAM3, see MAV_CMD enum - * @param param4 PARAM4, see MAV_CMD enum - * @param x PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7 - * @param y PARAM6 / local: y position in meters * 1e4, global: longitude in degrees * 10^7 - * @param z PARAM7 / z position: global: altitude in meters (MSL, WGS84, AGL or relative to home - depending on frame). - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_command_int_stamped_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint32_t utc_time,uint64_t vehicle_timestamp,uint8_t target_system,uint8_t target_component,uint8_t frame,uint16_t command,uint8_t current,uint8_t autocontinue,float param1,float param2,float param3,float param4,int32_t x,int32_t y,float z) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_COMMAND_INT_STAMPED_LEN]; - _mav_put_uint64_t(buf, 0, vehicle_timestamp); - _mav_put_uint32_t(buf, 8, utc_time); - _mav_put_float(buf, 12, param1); - _mav_put_float(buf, 16, param2); - _mav_put_float(buf, 20, param3); - _mav_put_float(buf, 24, param4); - _mav_put_int32_t(buf, 28, x); - _mav_put_int32_t(buf, 32, y); - _mav_put_float(buf, 36, z); - _mav_put_uint16_t(buf, 40, command); - _mav_put_uint8_t(buf, 42, target_system); - _mav_put_uint8_t(buf, 43, target_component); - _mav_put_uint8_t(buf, 44, frame); - _mav_put_uint8_t(buf, 45, current); - _mav_put_uint8_t(buf, 46, autocontinue); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMMAND_INT_STAMPED_LEN); -#else - mavlink_command_int_stamped_t packet; - packet.vehicle_timestamp = vehicle_timestamp; - packet.utc_time = utc_time; - packet.param1 = param1; - packet.param2 = param2; - packet.param3 = param3; - packet.param4 = param4; - packet.x = x; - packet.y = y; - packet.z = z; - packet.command = command; - packet.target_system = target_system; - packet.target_component = target_component; - packet.frame = frame; - packet.current = current; - packet.autocontinue = autocontinue; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMMAND_INT_STAMPED_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_COMMAND_INT_STAMPED; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_COMMAND_INT_STAMPED_MIN_LEN, MAVLINK_MSG_ID_COMMAND_INT_STAMPED_LEN, MAVLINK_MSG_ID_COMMAND_INT_STAMPED_CRC); -} - -/** - * @brief Encode a command_int_stamped struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param command_int_stamped C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_command_int_stamped_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_command_int_stamped_t* command_int_stamped) -{ - return mavlink_msg_command_int_stamped_pack(system_id, component_id, msg, command_int_stamped->utc_time, command_int_stamped->vehicle_timestamp, command_int_stamped->target_system, command_int_stamped->target_component, command_int_stamped->frame, command_int_stamped->command, command_int_stamped->current, command_int_stamped->autocontinue, command_int_stamped->param1, command_int_stamped->param2, command_int_stamped->param3, command_int_stamped->param4, command_int_stamped->x, command_int_stamped->y, command_int_stamped->z); -} - -/** - * @brief Encode a command_int_stamped struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param command_int_stamped C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_command_int_stamped_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_command_int_stamped_t* command_int_stamped) -{ - return mavlink_msg_command_int_stamped_pack_chan(system_id, component_id, chan, msg, command_int_stamped->utc_time, command_int_stamped->vehicle_timestamp, command_int_stamped->target_system, command_int_stamped->target_component, command_int_stamped->frame, command_int_stamped->command, command_int_stamped->current, command_int_stamped->autocontinue, command_int_stamped->param1, command_int_stamped->param2, command_int_stamped->param3, command_int_stamped->param4, command_int_stamped->x, command_int_stamped->y, command_int_stamped->z); -} - -/** - * @brief Send a command_int_stamped message - * @param chan MAVLink channel to send the message - * - * @param utc_time UTC time, seconds elapsed since 01.01.1970 - * @param vehicle_timestamp Microseconds elapsed since vehicle boot - * @param target_system System ID - * @param target_component Component ID - * @param frame The coordinate system of the COMMAND, as defined by MAV_FRAME enum - * @param command The scheduled action for the mission item, as defined by MAV_CMD enum - * @param current false:0, true:1 - * @param autocontinue autocontinue to next wp - * @param param1 PARAM1, see MAV_CMD enum - * @param param2 PARAM2, see MAV_CMD enum - * @param param3 PARAM3, see MAV_CMD enum - * @param param4 PARAM4, see MAV_CMD enum - * @param x PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7 - * @param y PARAM6 / local: y position in meters * 1e4, global: longitude in degrees * 10^7 - * @param z PARAM7 / z position: global: altitude in meters (MSL, WGS84, AGL or relative to home - depending on frame). - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_command_int_stamped_send(mavlink_channel_t chan, uint32_t utc_time, uint64_t vehicle_timestamp, uint8_t target_system, uint8_t target_component, uint8_t frame, uint16_t command, uint8_t current, uint8_t autocontinue, float param1, float param2, float param3, float param4, int32_t x, int32_t y, float z) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_COMMAND_INT_STAMPED_LEN]; - _mav_put_uint64_t(buf, 0, vehicle_timestamp); - _mav_put_uint32_t(buf, 8, utc_time); - _mav_put_float(buf, 12, param1); - _mav_put_float(buf, 16, param2); - _mav_put_float(buf, 20, param3); - _mav_put_float(buf, 24, param4); - _mav_put_int32_t(buf, 28, x); - _mav_put_int32_t(buf, 32, y); - _mav_put_float(buf, 36, z); - _mav_put_uint16_t(buf, 40, command); - _mav_put_uint8_t(buf, 42, target_system); - _mav_put_uint8_t(buf, 43, target_component); - _mav_put_uint8_t(buf, 44, frame); - _mav_put_uint8_t(buf, 45, current); - _mav_put_uint8_t(buf, 46, autocontinue); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_INT_STAMPED, buf, MAVLINK_MSG_ID_COMMAND_INT_STAMPED_MIN_LEN, MAVLINK_MSG_ID_COMMAND_INT_STAMPED_LEN, MAVLINK_MSG_ID_COMMAND_INT_STAMPED_CRC); -#else - mavlink_command_int_stamped_t packet; - packet.vehicle_timestamp = vehicle_timestamp; - packet.utc_time = utc_time; - packet.param1 = param1; - packet.param2 = param2; - packet.param3 = param3; - packet.param4 = param4; - packet.x = x; - packet.y = y; - packet.z = z; - packet.command = command; - packet.target_system = target_system; - packet.target_component = target_component; - packet.frame = frame; - packet.current = current; - packet.autocontinue = autocontinue; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_INT_STAMPED, (const char *)&packet, MAVLINK_MSG_ID_COMMAND_INT_STAMPED_MIN_LEN, MAVLINK_MSG_ID_COMMAND_INT_STAMPED_LEN, MAVLINK_MSG_ID_COMMAND_INT_STAMPED_CRC); -#endif -} - -/** - * @brief Send a command_int_stamped message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_command_int_stamped_send_struct(mavlink_channel_t chan, const mavlink_command_int_stamped_t* command_int_stamped) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_command_int_stamped_send(chan, command_int_stamped->utc_time, command_int_stamped->vehicle_timestamp, command_int_stamped->target_system, command_int_stamped->target_component, command_int_stamped->frame, command_int_stamped->command, command_int_stamped->current, command_int_stamped->autocontinue, command_int_stamped->param1, command_int_stamped->param2, command_int_stamped->param3, command_int_stamped->param4, command_int_stamped->x, command_int_stamped->y, command_int_stamped->z); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_INT_STAMPED, (const char *)command_int_stamped, MAVLINK_MSG_ID_COMMAND_INT_STAMPED_MIN_LEN, MAVLINK_MSG_ID_COMMAND_INT_STAMPED_LEN, MAVLINK_MSG_ID_COMMAND_INT_STAMPED_CRC); -#endif -} - -#if MAVLINK_MSG_ID_COMMAND_INT_STAMPED_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_command_int_stamped_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t utc_time, uint64_t vehicle_timestamp, uint8_t target_system, uint8_t target_component, uint8_t frame, uint16_t command, uint8_t current, uint8_t autocontinue, float param1, float param2, float param3, float param4, int32_t x, int32_t y, float z) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint64_t(buf, 0, vehicle_timestamp); - _mav_put_uint32_t(buf, 8, utc_time); - _mav_put_float(buf, 12, param1); - _mav_put_float(buf, 16, param2); - _mav_put_float(buf, 20, param3); - _mav_put_float(buf, 24, param4); - _mav_put_int32_t(buf, 28, x); - _mav_put_int32_t(buf, 32, y); - _mav_put_float(buf, 36, z); - _mav_put_uint16_t(buf, 40, command); - _mav_put_uint8_t(buf, 42, target_system); - _mav_put_uint8_t(buf, 43, target_component); - _mav_put_uint8_t(buf, 44, frame); - _mav_put_uint8_t(buf, 45, current); - _mav_put_uint8_t(buf, 46, autocontinue); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_INT_STAMPED, buf, MAVLINK_MSG_ID_COMMAND_INT_STAMPED_MIN_LEN, MAVLINK_MSG_ID_COMMAND_INT_STAMPED_LEN, MAVLINK_MSG_ID_COMMAND_INT_STAMPED_CRC); -#else - mavlink_command_int_stamped_t *packet = (mavlink_command_int_stamped_t *)msgbuf; - packet->vehicle_timestamp = vehicle_timestamp; - packet->utc_time = utc_time; - packet->param1 = param1; - packet->param2 = param2; - packet->param3 = param3; - packet->param4 = param4; - packet->x = x; - packet->y = y; - packet->z = z; - packet->command = command; - packet->target_system = target_system; - packet->target_component = target_component; - packet->frame = frame; - packet->current = current; - packet->autocontinue = autocontinue; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_INT_STAMPED, (const char *)packet, MAVLINK_MSG_ID_COMMAND_INT_STAMPED_MIN_LEN, MAVLINK_MSG_ID_COMMAND_INT_STAMPED_LEN, MAVLINK_MSG_ID_COMMAND_INT_STAMPED_CRC); -#endif -} -#endif - -#endif - -// MESSAGE COMMAND_INT_STAMPED UNPACKING - - -/** - * @brief Get field utc_time from command_int_stamped message - * - * @return UTC time, seconds elapsed since 01.01.1970 - */ -static inline uint32_t mavlink_msg_command_int_stamped_get_utc_time(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 8); -} - -/** - * @brief Get field vehicle_timestamp from command_int_stamped message - * - * @return Microseconds elapsed since vehicle boot - */ -static inline uint64_t mavlink_msg_command_int_stamped_get_vehicle_timestamp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint64_t(msg, 0); -} - -/** - * @brief Get field target_system from command_int_stamped message - * - * @return System ID - */ -static inline uint8_t mavlink_msg_command_int_stamped_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 42); -} - -/** - * @brief Get field target_component from command_int_stamped message - * - * @return Component ID - */ -static inline uint8_t mavlink_msg_command_int_stamped_get_target_component(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 43); -} - -/** - * @brief Get field frame from command_int_stamped message - * - * @return The coordinate system of the COMMAND, as defined by MAV_FRAME enum - */ -static inline uint8_t mavlink_msg_command_int_stamped_get_frame(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 44); -} - -/** - * @brief Get field command from command_int_stamped message - * - * @return The scheduled action for the mission item, as defined by MAV_CMD enum - */ -static inline uint16_t mavlink_msg_command_int_stamped_get_command(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 40); -} - -/** - * @brief Get field current from command_int_stamped message - * - * @return false:0, true:1 - */ -static inline uint8_t mavlink_msg_command_int_stamped_get_current(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 45); -} - -/** - * @brief Get field autocontinue from command_int_stamped message - * - * @return autocontinue to next wp - */ -static inline uint8_t mavlink_msg_command_int_stamped_get_autocontinue(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 46); -} - -/** - * @brief Get field param1 from command_int_stamped message - * - * @return PARAM1, see MAV_CMD enum - */ -static inline float mavlink_msg_command_int_stamped_get_param1(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Get field param2 from command_int_stamped message - * - * @return PARAM2, see MAV_CMD enum - */ -static inline float mavlink_msg_command_int_stamped_get_param2(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 16); -} - -/** - * @brief Get field param3 from command_int_stamped message - * - * @return PARAM3, see MAV_CMD enum - */ -static inline float mavlink_msg_command_int_stamped_get_param3(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 20); -} - -/** - * @brief Get field param4 from command_int_stamped message - * - * @return PARAM4, see MAV_CMD enum - */ -static inline float mavlink_msg_command_int_stamped_get_param4(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 24); -} - -/** - * @brief Get field x from command_int_stamped message - * - * @return PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7 - */ -static inline int32_t mavlink_msg_command_int_stamped_get_x(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 28); -} - -/** - * @brief Get field y from command_int_stamped message - * - * @return PARAM6 / local: y position in meters * 1e4, global: longitude in degrees * 10^7 - */ -static inline int32_t mavlink_msg_command_int_stamped_get_y(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 32); -} - -/** - * @brief Get field z from command_int_stamped message - * - * @return PARAM7 / z position: global: altitude in meters (MSL, WGS84, AGL or relative to home - depending on frame). - */ -static inline float mavlink_msg_command_int_stamped_get_z(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 36); -} - -/** - * @brief Decode a command_int_stamped message into a struct - * - * @param msg The message to decode - * @param command_int_stamped C-struct to decode the message contents into - */ -static inline void mavlink_msg_command_int_stamped_decode(const mavlink_message_t* msg, mavlink_command_int_stamped_t* command_int_stamped) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - command_int_stamped->vehicle_timestamp = mavlink_msg_command_int_stamped_get_vehicle_timestamp(msg); - command_int_stamped->utc_time = mavlink_msg_command_int_stamped_get_utc_time(msg); - command_int_stamped->param1 = mavlink_msg_command_int_stamped_get_param1(msg); - command_int_stamped->param2 = mavlink_msg_command_int_stamped_get_param2(msg); - command_int_stamped->param3 = mavlink_msg_command_int_stamped_get_param3(msg); - command_int_stamped->param4 = mavlink_msg_command_int_stamped_get_param4(msg); - command_int_stamped->x = mavlink_msg_command_int_stamped_get_x(msg); - command_int_stamped->y = mavlink_msg_command_int_stamped_get_y(msg); - command_int_stamped->z = mavlink_msg_command_int_stamped_get_z(msg); - command_int_stamped->command = mavlink_msg_command_int_stamped_get_command(msg); - command_int_stamped->target_system = mavlink_msg_command_int_stamped_get_target_system(msg); - command_int_stamped->target_component = mavlink_msg_command_int_stamped_get_target_component(msg); - command_int_stamped->frame = mavlink_msg_command_int_stamped_get_frame(msg); - command_int_stamped->current = mavlink_msg_command_int_stamped_get_current(msg); - command_int_stamped->autocontinue = mavlink_msg_command_int_stamped_get_autocontinue(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_COMMAND_INT_STAMPED_LEN? msg->len : MAVLINK_MSG_ID_COMMAND_INT_STAMPED_LEN; - memset(command_int_stamped, 0, MAVLINK_MSG_ID_COMMAND_INT_STAMPED_LEN); - memcpy(command_int_stamped, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ASLUAV/mavlink_msg_command_long_stamped.h b/ASLUAV/mavlink_msg_command_long_stamped.h deleted file mode 100644 index 6875d2255..000000000 --- a/ASLUAV/mavlink_msg_command_long_stamped.h +++ /dev/null @@ -1,513 +0,0 @@ -#pragma once -// MESSAGE COMMAND_LONG_STAMPED PACKING - -#define MAVLINK_MSG_ID_COMMAND_LONG_STAMPED 79 - - -typedef struct __mavlink_command_long_stamped_t { - uint64_t vehicle_timestamp; /*< Microseconds elapsed since vehicle boot*/ - uint32_t utc_time; /*< UTC time, seconds elapsed since 01.01.1970*/ - float param1; /*< Parameter 1, as defined by MAV_CMD enum.*/ - float param2; /*< Parameter 2, as defined by MAV_CMD enum.*/ - float param3; /*< Parameter 3, as defined by MAV_CMD enum.*/ - float param4; /*< Parameter 4, as defined by MAV_CMD enum.*/ - float param5; /*< Parameter 5, as defined by MAV_CMD enum.*/ - float param6; /*< Parameter 6, as defined by MAV_CMD enum.*/ - float param7; /*< Parameter 7, as defined by MAV_CMD enum.*/ - uint16_t command; /*< Command ID, as defined by MAV_CMD enum.*/ - uint8_t target_system; /*< System which should execute the command*/ - uint8_t target_component; /*< Component which should execute the command, 0 for all components*/ - uint8_t confirmation; /*< 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command)*/ -} mavlink_command_long_stamped_t; - -#define MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_LEN 45 -#define MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_MIN_LEN 45 -#define MAVLINK_MSG_ID_79_LEN 45 -#define MAVLINK_MSG_ID_79_MIN_LEN 45 - -#define MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_CRC 102 -#define MAVLINK_MSG_ID_79_CRC 102 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_COMMAND_LONG_STAMPED { \ - 79, \ - "COMMAND_LONG_STAMPED", \ - 13, \ - { { "utc_time", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_command_long_stamped_t, utc_time) }, \ - { "vehicle_timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_command_long_stamped_t, vehicle_timestamp) }, \ - { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 42, offsetof(mavlink_command_long_stamped_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 43, offsetof(mavlink_command_long_stamped_t, target_component) }, \ - { "command", NULL, MAVLINK_TYPE_UINT16_T, 0, 40, offsetof(mavlink_command_long_stamped_t, command) }, \ - { "confirmation", NULL, MAVLINK_TYPE_UINT8_T, 0, 44, offsetof(mavlink_command_long_stamped_t, confirmation) }, \ - { "param1", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_command_long_stamped_t, param1) }, \ - { "param2", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_command_long_stamped_t, param2) }, \ - { "param3", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_command_long_stamped_t, param3) }, \ - { "param4", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_command_long_stamped_t, param4) }, \ - { "param5", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_command_long_stamped_t, param5) }, \ - { "param6", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_command_long_stamped_t, param6) }, \ - { "param7", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_command_long_stamped_t, param7) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_COMMAND_LONG_STAMPED { \ - "COMMAND_LONG_STAMPED", \ - 13, \ - { { "utc_time", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_command_long_stamped_t, utc_time) }, \ - { "vehicle_timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_command_long_stamped_t, vehicle_timestamp) }, \ - { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 42, offsetof(mavlink_command_long_stamped_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 43, offsetof(mavlink_command_long_stamped_t, target_component) }, \ - { "command", NULL, MAVLINK_TYPE_UINT16_T, 0, 40, offsetof(mavlink_command_long_stamped_t, command) }, \ - { "confirmation", NULL, MAVLINK_TYPE_UINT8_T, 0, 44, offsetof(mavlink_command_long_stamped_t, confirmation) }, \ - { "param1", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_command_long_stamped_t, param1) }, \ - { "param2", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_command_long_stamped_t, param2) }, \ - { "param3", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_command_long_stamped_t, param3) }, \ - { "param4", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_command_long_stamped_t, param4) }, \ - { "param5", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_command_long_stamped_t, param5) }, \ - { "param6", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_command_long_stamped_t, param6) }, \ - { "param7", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_command_long_stamped_t, param7) }, \ - } \ -} -#endif - -/** - * @brief Pack a command_long_stamped message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param utc_time UTC time, seconds elapsed since 01.01.1970 - * @param vehicle_timestamp Microseconds elapsed since vehicle boot - * @param target_system System which should execute the command - * @param target_component Component which should execute the command, 0 for all components - * @param command Command ID, as defined by MAV_CMD enum. - * @param confirmation 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command) - * @param param1 Parameter 1, as defined by MAV_CMD enum. - * @param param2 Parameter 2, as defined by MAV_CMD enum. - * @param param3 Parameter 3, as defined by MAV_CMD enum. - * @param param4 Parameter 4, as defined by MAV_CMD enum. - * @param param5 Parameter 5, as defined by MAV_CMD enum. - * @param param6 Parameter 6, as defined by MAV_CMD enum. - * @param param7 Parameter 7, as defined by MAV_CMD enum. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_command_long_stamped_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint32_t utc_time, uint64_t vehicle_timestamp, uint8_t target_system, uint8_t target_component, uint16_t command, uint8_t confirmation, float param1, float param2, float param3, float param4, float param5, float param6, float param7) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_LEN]; - _mav_put_uint64_t(buf, 0, vehicle_timestamp); - _mav_put_uint32_t(buf, 8, utc_time); - _mav_put_float(buf, 12, param1); - _mav_put_float(buf, 16, param2); - _mav_put_float(buf, 20, param3); - _mav_put_float(buf, 24, param4); - _mav_put_float(buf, 28, param5); - _mav_put_float(buf, 32, param6); - _mav_put_float(buf, 36, param7); - _mav_put_uint16_t(buf, 40, command); - _mav_put_uint8_t(buf, 42, target_system); - _mav_put_uint8_t(buf, 43, target_component); - _mav_put_uint8_t(buf, 44, confirmation); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_LEN); -#else - mavlink_command_long_stamped_t packet; - packet.vehicle_timestamp = vehicle_timestamp; - packet.utc_time = utc_time; - packet.param1 = param1; - packet.param2 = param2; - packet.param3 = param3; - packet.param4 = param4; - packet.param5 = param5; - packet.param6 = param6; - packet.param7 = param7; - packet.command = command; - packet.target_system = target_system; - packet.target_component = target_component; - packet.confirmation = confirmation; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_COMMAND_LONG_STAMPED; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_MIN_LEN, MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_LEN, MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_CRC); -} - -/** - * @brief Pack a command_long_stamped message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param utc_time UTC time, seconds elapsed since 01.01.1970 - * @param vehicle_timestamp Microseconds elapsed since vehicle boot - * @param target_system System which should execute the command - * @param target_component Component which should execute the command, 0 for all components - * @param command Command ID, as defined by MAV_CMD enum. - * @param confirmation 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command) - * @param param1 Parameter 1, as defined by MAV_CMD enum. - * @param param2 Parameter 2, as defined by MAV_CMD enum. - * @param param3 Parameter 3, as defined by MAV_CMD enum. - * @param param4 Parameter 4, as defined by MAV_CMD enum. - * @param param5 Parameter 5, as defined by MAV_CMD enum. - * @param param6 Parameter 6, as defined by MAV_CMD enum. - * @param param7 Parameter 7, as defined by MAV_CMD enum. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_command_long_stamped_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint32_t utc_time,uint64_t vehicle_timestamp,uint8_t target_system,uint8_t target_component,uint16_t command,uint8_t confirmation,float param1,float param2,float param3,float param4,float param5,float param6,float param7) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_LEN]; - _mav_put_uint64_t(buf, 0, vehicle_timestamp); - _mav_put_uint32_t(buf, 8, utc_time); - _mav_put_float(buf, 12, param1); - _mav_put_float(buf, 16, param2); - _mav_put_float(buf, 20, param3); - _mav_put_float(buf, 24, param4); - _mav_put_float(buf, 28, param5); - _mav_put_float(buf, 32, param6); - _mav_put_float(buf, 36, param7); - _mav_put_uint16_t(buf, 40, command); - _mav_put_uint8_t(buf, 42, target_system); - _mav_put_uint8_t(buf, 43, target_component); - _mav_put_uint8_t(buf, 44, confirmation); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_LEN); -#else - mavlink_command_long_stamped_t packet; - packet.vehicle_timestamp = vehicle_timestamp; - packet.utc_time = utc_time; - packet.param1 = param1; - packet.param2 = param2; - packet.param3 = param3; - packet.param4 = param4; - packet.param5 = param5; - packet.param6 = param6; - packet.param7 = param7; - packet.command = command; - packet.target_system = target_system; - packet.target_component = target_component; - packet.confirmation = confirmation; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_COMMAND_LONG_STAMPED; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_MIN_LEN, MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_LEN, MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_CRC); -} - -/** - * @brief Encode a command_long_stamped struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param command_long_stamped C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_command_long_stamped_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_command_long_stamped_t* command_long_stamped) -{ - return mavlink_msg_command_long_stamped_pack(system_id, component_id, msg, command_long_stamped->utc_time, command_long_stamped->vehicle_timestamp, command_long_stamped->target_system, command_long_stamped->target_component, command_long_stamped->command, command_long_stamped->confirmation, command_long_stamped->param1, command_long_stamped->param2, command_long_stamped->param3, command_long_stamped->param4, command_long_stamped->param5, command_long_stamped->param6, command_long_stamped->param7); -} - -/** - * @brief Encode a command_long_stamped struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param command_long_stamped C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_command_long_stamped_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_command_long_stamped_t* command_long_stamped) -{ - return mavlink_msg_command_long_stamped_pack_chan(system_id, component_id, chan, msg, command_long_stamped->utc_time, command_long_stamped->vehicle_timestamp, command_long_stamped->target_system, command_long_stamped->target_component, command_long_stamped->command, command_long_stamped->confirmation, command_long_stamped->param1, command_long_stamped->param2, command_long_stamped->param3, command_long_stamped->param4, command_long_stamped->param5, command_long_stamped->param6, command_long_stamped->param7); -} - -/** - * @brief Send a command_long_stamped message - * @param chan MAVLink channel to send the message - * - * @param utc_time UTC time, seconds elapsed since 01.01.1970 - * @param vehicle_timestamp Microseconds elapsed since vehicle boot - * @param target_system System which should execute the command - * @param target_component Component which should execute the command, 0 for all components - * @param command Command ID, as defined by MAV_CMD enum. - * @param confirmation 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command) - * @param param1 Parameter 1, as defined by MAV_CMD enum. - * @param param2 Parameter 2, as defined by MAV_CMD enum. - * @param param3 Parameter 3, as defined by MAV_CMD enum. - * @param param4 Parameter 4, as defined by MAV_CMD enum. - * @param param5 Parameter 5, as defined by MAV_CMD enum. - * @param param6 Parameter 6, as defined by MAV_CMD enum. - * @param param7 Parameter 7, as defined by MAV_CMD enum. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_command_long_stamped_send(mavlink_channel_t chan, uint32_t utc_time, uint64_t vehicle_timestamp, uint8_t target_system, uint8_t target_component, uint16_t command, uint8_t confirmation, float param1, float param2, float param3, float param4, float param5, float param6, float param7) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_LEN]; - _mav_put_uint64_t(buf, 0, vehicle_timestamp); - _mav_put_uint32_t(buf, 8, utc_time); - _mav_put_float(buf, 12, param1); - _mav_put_float(buf, 16, param2); - _mav_put_float(buf, 20, param3); - _mav_put_float(buf, 24, param4); - _mav_put_float(buf, 28, param5); - _mav_put_float(buf, 32, param6); - _mav_put_float(buf, 36, param7); - _mav_put_uint16_t(buf, 40, command); - _mav_put_uint8_t(buf, 42, target_system); - _mav_put_uint8_t(buf, 43, target_component); - _mav_put_uint8_t(buf, 44, confirmation); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_LONG_STAMPED, buf, MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_MIN_LEN, MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_LEN, MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_CRC); -#else - mavlink_command_long_stamped_t packet; - packet.vehicle_timestamp = vehicle_timestamp; - packet.utc_time = utc_time; - packet.param1 = param1; - packet.param2 = param2; - packet.param3 = param3; - packet.param4 = param4; - packet.param5 = param5; - packet.param6 = param6; - packet.param7 = param7; - packet.command = command; - packet.target_system = target_system; - packet.target_component = target_component; - packet.confirmation = confirmation; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_LONG_STAMPED, (const char *)&packet, MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_MIN_LEN, MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_LEN, MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_CRC); -#endif -} - -/** - * @brief Send a command_long_stamped message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_command_long_stamped_send_struct(mavlink_channel_t chan, const mavlink_command_long_stamped_t* command_long_stamped) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_command_long_stamped_send(chan, command_long_stamped->utc_time, command_long_stamped->vehicle_timestamp, command_long_stamped->target_system, command_long_stamped->target_component, command_long_stamped->command, command_long_stamped->confirmation, command_long_stamped->param1, command_long_stamped->param2, command_long_stamped->param3, command_long_stamped->param4, command_long_stamped->param5, command_long_stamped->param6, command_long_stamped->param7); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_LONG_STAMPED, (const char *)command_long_stamped, MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_MIN_LEN, MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_LEN, MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_CRC); -#endif -} - -#if MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_command_long_stamped_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t utc_time, uint64_t vehicle_timestamp, uint8_t target_system, uint8_t target_component, uint16_t command, uint8_t confirmation, float param1, float param2, float param3, float param4, float param5, float param6, float param7) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint64_t(buf, 0, vehicle_timestamp); - _mav_put_uint32_t(buf, 8, utc_time); - _mav_put_float(buf, 12, param1); - _mav_put_float(buf, 16, param2); - _mav_put_float(buf, 20, param3); - _mav_put_float(buf, 24, param4); - _mav_put_float(buf, 28, param5); - _mav_put_float(buf, 32, param6); - _mav_put_float(buf, 36, param7); - _mav_put_uint16_t(buf, 40, command); - _mav_put_uint8_t(buf, 42, target_system); - _mav_put_uint8_t(buf, 43, target_component); - _mav_put_uint8_t(buf, 44, confirmation); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_LONG_STAMPED, buf, MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_MIN_LEN, MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_LEN, MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_CRC); -#else - mavlink_command_long_stamped_t *packet = (mavlink_command_long_stamped_t *)msgbuf; - packet->vehicle_timestamp = vehicle_timestamp; - packet->utc_time = utc_time; - packet->param1 = param1; - packet->param2 = param2; - packet->param3 = param3; - packet->param4 = param4; - packet->param5 = param5; - packet->param6 = param6; - packet->param7 = param7; - packet->command = command; - packet->target_system = target_system; - packet->target_component = target_component; - packet->confirmation = confirmation; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_LONG_STAMPED, (const char *)packet, MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_MIN_LEN, MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_LEN, MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_CRC); -#endif -} -#endif - -#endif - -// MESSAGE COMMAND_LONG_STAMPED UNPACKING - - -/** - * @brief Get field utc_time from command_long_stamped message - * - * @return UTC time, seconds elapsed since 01.01.1970 - */ -static inline uint32_t mavlink_msg_command_long_stamped_get_utc_time(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 8); -} - -/** - * @brief Get field vehicle_timestamp from command_long_stamped message - * - * @return Microseconds elapsed since vehicle boot - */ -static inline uint64_t mavlink_msg_command_long_stamped_get_vehicle_timestamp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint64_t(msg, 0); -} - -/** - * @brief Get field target_system from command_long_stamped message - * - * @return System which should execute the command - */ -static inline uint8_t mavlink_msg_command_long_stamped_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 42); -} - -/** - * @brief Get field target_component from command_long_stamped message - * - * @return Component which should execute the command, 0 for all components - */ -static inline uint8_t mavlink_msg_command_long_stamped_get_target_component(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 43); -} - -/** - * @brief Get field command from command_long_stamped message - * - * @return Command ID, as defined by MAV_CMD enum. - */ -static inline uint16_t mavlink_msg_command_long_stamped_get_command(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 40); -} - -/** - * @brief Get field confirmation from command_long_stamped message - * - * @return 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command) - */ -static inline uint8_t mavlink_msg_command_long_stamped_get_confirmation(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 44); -} - -/** - * @brief Get field param1 from command_long_stamped message - * - * @return Parameter 1, as defined by MAV_CMD enum. - */ -static inline float mavlink_msg_command_long_stamped_get_param1(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Get field param2 from command_long_stamped message - * - * @return Parameter 2, as defined by MAV_CMD enum. - */ -static inline float mavlink_msg_command_long_stamped_get_param2(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 16); -} - -/** - * @brief Get field param3 from command_long_stamped message - * - * @return Parameter 3, as defined by MAV_CMD enum. - */ -static inline float mavlink_msg_command_long_stamped_get_param3(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 20); -} - -/** - * @brief Get field param4 from command_long_stamped message - * - * @return Parameter 4, as defined by MAV_CMD enum. - */ -static inline float mavlink_msg_command_long_stamped_get_param4(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 24); -} - -/** - * @brief Get field param5 from command_long_stamped message - * - * @return Parameter 5, as defined by MAV_CMD enum. - */ -static inline float mavlink_msg_command_long_stamped_get_param5(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 28); -} - -/** - * @brief Get field param6 from command_long_stamped message - * - * @return Parameter 6, as defined by MAV_CMD enum. - */ -static inline float mavlink_msg_command_long_stamped_get_param6(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 32); -} - -/** - * @brief Get field param7 from command_long_stamped message - * - * @return Parameter 7, as defined by MAV_CMD enum. - */ -static inline float mavlink_msg_command_long_stamped_get_param7(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 36); -} - -/** - * @brief Decode a command_long_stamped message into a struct - * - * @param msg The message to decode - * @param command_long_stamped C-struct to decode the message contents into - */ -static inline void mavlink_msg_command_long_stamped_decode(const mavlink_message_t* msg, mavlink_command_long_stamped_t* command_long_stamped) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - command_long_stamped->vehicle_timestamp = mavlink_msg_command_long_stamped_get_vehicle_timestamp(msg); - command_long_stamped->utc_time = mavlink_msg_command_long_stamped_get_utc_time(msg); - command_long_stamped->param1 = mavlink_msg_command_long_stamped_get_param1(msg); - command_long_stamped->param2 = mavlink_msg_command_long_stamped_get_param2(msg); - command_long_stamped->param3 = mavlink_msg_command_long_stamped_get_param3(msg); - command_long_stamped->param4 = mavlink_msg_command_long_stamped_get_param4(msg); - command_long_stamped->param5 = mavlink_msg_command_long_stamped_get_param5(msg); - command_long_stamped->param6 = mavlink_msg_command_long_stamped_get_param6(msg); - command_long_stamped->param7 = mavlink_msg_command_long_stamped_get_param7(msg); - command_long_stamped->command = mavlink_msg_command_long_stamped_get_command(msg); - command_long_stamped->target_system = mavlink_msg_command_long_stamped_get_target_system(msg); - command_long_stamped->target_component = mavlink_msg_command_long_stamped_get_target_component(msg); - command_long_stamped->confirmation = mavlink_msg_command_long_stamped_get_confirmation(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_LEN? msg->len : MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_LEN; - memset(command_long_stamped, 0, MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_LEN); - memcpy(command_long_stamped, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ASLUAV/mavlink_msg_ekf_ext.h b/ASLUAV/mavlink_msg_ekf_ext.h deleted file mode 100644 index 72cb943b1..000000000 --- a/ASLUAV/mavlink_msg_ekf_ext.h +++ /dev/null @@ -1,363 +0,0 @@ -#pragma once -// MESSAGE EKF_EXT PACKING - -#define MAVLINK_MSG_ID_EKF_EXT 206 - - -typedef struct __mavlink_ekf_ext_t { - uint64_t timestamp; /*< [us] Time since system start*/ - float Windspeed; /*< [m/s] Magnitude of wind velocity (in lateral inertial plane)*/ - float WindDir; /*< [rad] Wind heading angle from North*/ - float WindZ; /*< [m/s] Z (Down) component of inertial wind velocity*/ - float Airspeed; /*< [m/s] Magnitude of air velocity*/ - float beta; /*< [rad] Sideslip angle*/ - float alpha; /*< [rad] Angle of attack*/ -} mavlink_ekf_ext_t; - -#define MAVLINK_MSG_ID_EKF_EXT_LEN 32 -#define MAVLINK_MSG_ID_EKF_EXT_MIN_LEN 32 -#define MAVLINK_MSG_ID_206_LEN 32 -#define MAVLINK_MSG_ID_206_MIN_LEN 32 - -#define MAVLINK_MSG_ID_EKF_EXT_CRC 64 -#define MAVLINK_MSG_ID_206_CRC 64 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_EKF_EXT { \ - 206, \ - "EKF_EXT", \ - 7, \ - { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_ekf_ext_t, timestamp) }, \ - { "Windspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_ekf_ext_t, Windspeed) }, \ - { "WindDir", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_ekf_ext_t, WindDir) }, \ - { "WindZ", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_ekf_ext_t, WindZ) }, \ - { "Airspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_ekf_ext_t, Airspeed) }, \ - { "beta", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_ekf_ext_t, beta) }, \ - { "alpha", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_ekf_ext_t, alpha) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_EKF_EXT { \ - "EKF_EXT", \ - 7, \ - { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_ekf_ext_t, timestamp) }, \ - { "Windspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_ekf_ext_t, Windspeed) }, \ - { "WindDir", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_ekf_ext_t, WindDir) }, \ - { "WindZ", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_ekf_ext_t, WindZ) }, \ - { "Airspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_ekf_ext_t, Airspeed) }, \ - { "beta", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_ekf_ext_t, beta) }, \ - { "alpha", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_ekf_ext_t, alpha) }, \ - } \ -} -#endif - -/** - * @brief Pack a ekf_ext message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param timestamp [us] Time since system start - * @param Windspeed [m/s] Magnitude of wind velocity (in lateral inertial plane) - * @param WindDir [rad] Wind heading angle from North - * @param WindZ [m/s] Z (Down) component of inertial wind velocity - * @param Airspeed [m/s] Magnitude of air velocity - * @param beta [rad] Sideslip angle - * @param alpha [rad] Angle of attack - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_ekf_ext_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint64_t timestamp, float Windspeed, float WindDir, float WindZ, float Airspeed, float beta, float alpha) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_EKF_EXT_LEN]; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_float(buf, 8, Windspeed); - _mav_put_float(buf, 12, WindDir); - _mav_put_float(buf, 16, WindZ); - _mav_put_float(buf, 20, Airspeed); - _mav_put_float(buf, 24, beta); - _mav_put_float(buf, 28, alpha); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_EKF_EXT_LEN); -#else - mavlink_ekf_ext_t packet; - packet.timestamp = timestamp; - packet.Windspeed = Windspeed; - packet.WindDir = WindDir; - packet.WindZ = WindZ; - packet.Airspeed = Airspeed; - packet.beta = beta; - packet.alpha = alpha; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_EKF_EXT_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_EKF_EXT; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_EKF_EXT_MIN_LEN, MAVLINK_MSG_ID_EKF_EXT_LEN, MAVLINK_MSG_ID_EKF_EXT_CRC); -} - -/** - * @brief Pack a ekf_ext message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param timestamp [us] Time since system start - * @param Windspeed [m/s] Magnitude of wind velocity (in lateral inertial plane) - * @param WindDir [rad] Wind heading angle from North - * @param WindZ [m/s] Z (Down) component of inertial wind velocity - * @param Airspeed [m/s] Magnitude of air velocity - * @param beta [rad] Sideslip angle - * @param alpha [rad] Angle of attack - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_ekf_ext_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint64_t timestamp,float Windspeed,float WindDir,float WindZ,float Airspeed,float beta,float alpha) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_EKF_EXT_LEN]; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_float(buf, 8, Windspeed); - _mav_put_float(buf, 12, WindDir); - _mav_put_float(buf, 16, WindZ); - _mav_put_float(buf, 20, Airspeed); - _mav_put_float(buf, 24, beta); - _mav_put_float(buf, 28, alpha); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_EKF_EXT_LEN); -#else - mavlink_ekf_ext_t packet; - packet.timestamp = timestamp; - packet.Windspeed = Windspeed; - packet.WindDir = WindDir; - packet.WindZ = WindZ; - packet.Airspeed = Airspeed; - packet.beta = beta; - packet.alpha = alpha; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_EKF_EXT_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_EKF_EXT; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_EKF_EXT_MIN_LEN, MAVLINK_MSG_ID_EKF_EXT_LEN, MAVLINK_MSG_ID_EKF_EXT_CRC); -} - -/** - * @brief Encode a ekf_ext struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param ekf_ext C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_ekf_ext_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_ekf_ext_t* ekf_ext) -{ - return mavlink_msg_ekf_ext_pack(system_id, component_id, msg, ekf_ext->timestamp, ekf_ext->Windspeed, ekf_ext->WindDir, ekf_ext->WindZ, ekf_ext->Airspeed, ekf_ext->beta, ekf_ext->alpha); -} - -/** - * @brief Encode a ekf_ext struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param ekf_ext C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_ekf_ext_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_ekf_ext_t* ekf_ext) -{ - return mavlink_msg_ekf_ext_pack_chan(system_id, component_id, chan, msg, ekf_ext->timestamp, ekf_ext->Windspeed, ekf_ext->WindDir, ekf_ext->WindZ, ekf_ext->Airspeed, ekf_ext->beta, ekf_ext->alpha); -} - -/** - * @brief Send a ekf_ext message - * @param chan MAVLink channel to send the message - * - * @param timestamp [us] Time since system start - * @param Windspeed [m/s] Magnitude of wind velocity (in lateral inertial plane) - * @param WindDir [rad] Wind heading angle from North - * @param WindZ [m/s] Z (Down) component of inertial wind velocity - * @param Airspeed [m/s] Magnitude of air velocity - * @param beta [rad] Sideslip angle - * @param alpha [rad] Angle of attack - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_ekf_ext_send(mavlink_channel_t chan, uint64_t timestamp, float Windspeed, float WindDir, float WindZ, float Airspeed, float beta, float alpha) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_EKF_EXT_LEN]; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_float(buf, 8, Windspeed); - _mav_put_float(buf, 12, WindDir); - _mav_put_float(buf, 16, WindZ); - _mav_put_float(buf, 20, Airspeed); - _mav_put_float(buf, 24, beta); - _mav_put_float(buf, 28, alpha); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EKF_EXT, buf, MAVLINK_MSG_ID_EKF_EXT_MIN_LEN, MAVLINK_MSG_ID_EKF_EXT_LEN, MAVLINK_MSG_ID_EKF_EXT_CRC); -#else - mavlink_ekf_ext_t packet; - packet.timestamp = timestamp; - packet.Windspeed = Windspeed; - packet.WindDir = WindDir; - packet.WindZ = WindZ; - packet.Airspeed = Airspeed; - packet.beta = beta; - packet.alpha = alpha; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EKF_EXT, (const char *)&packet, MAVLINK_MSG_ID_EKF_EXT_MIN_LEN, MAVLINK_MSG_ID_EKF_EXT_LEN, MAVLINK_MSG_ID_EKF_EXT_CRC); -#endif -} - -/** - * @brief Send a ekf_ext message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_ekf_ext_send_struct(mavlink_channel_t chan, const mavlink_ekf_ext_t* ekf_ext) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_ekf_ext_send(chan, ekf_ext->timestamp, ekf_ext->Windspeed, ekf_ext->WindDir, ekf_ext->WindZ, ekf_ext->Airspeed, ekf_ext->beta, ekf_ext->alpha); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EKF_EXT, (const char *)ekf_ext, MAVLINK_MSG_ID_EKF_EXT_MIN_LEN, MAVLINK_MSG_ID_EKF_EXT_LEN, MAVLINK_MSG_ID_EKF_EXT_CRC); -#endif -} - -#if MAVLINK_MSG_ID_EKF_EXT_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_ekf_ext_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t timestamp, float Windspeed, float WindDir, float WindZ, float Airspeed, float beta, float alpha) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_float(buf, 8, Windspeed); - _mav_put_float(buf, 12, WindDir); - _mav_put_float(buf, 16, WindZ); - _mav_put_float(buf, 20, Airspeed); - _mav_put_float(buf, 24, beta); - _mav_put_float(buf, 28, alpha); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EKF_EXT, buf, MAVLINK_MSG_ID_EKF_EXT_MIN_LEN, MAVLINK_MSG_ID_EKF_EXT_LEN, MAVLINK_MSG_ID_EKF_EXT_CRC); -#else - mavlink_ekf_ext_t *packet = (mavlink_ekf_ext_t *)msgbuf; - packet->timestamp = timestamp; - packet->Windspeed = Windspeed; - packet->WindDir = WindDir; - packet->WindZ = WindZ; - packet->Airspeed = Airspeed; - packet->beta = beta; - packet->alpha = alpha; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EKF_EXT, (const char *)packet, MAVLINK_MSG_ID_EKF_EXT_MIN_LEN, MAVLINK_MSG_ID_EKF_EXT_LEN, MAVLINK_MSG_ID_EKF_EXT_CRC); -#endif -} -#endif - -#endif - -// MESSAGE EKF_EXT UNPACKING - - -/** - * @brief Get field timestamp from ekf_ext message - * - * @return [us] Time since system start - */ -static inline uint64_t mavlink_msg_ekf_ext_get_timestamp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint64_t(msg, 0); -} - -/** - * @brief Get field Windspeed from ekf_ext message - * - * @return [m/s] Magnitude of wind velocity (in lateral inertial plane) - */ -static inline float mavlink_msg_ekf_ext_get_Windspeed(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field WindDir from ekf_ext message - * - * @return [rad] Wind heading angle from North - */ -static inline float mavlink_msg_ekf_ext_get_WindDir(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Get field WindZ from ekf_ext message - * - * @return [m/s] Z (Down) component of inertial wind velocity - */ -static inline float mavlink_msg_ekf_ext_get_WindZ(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 16); -} - -/** - * @brief Get field Airspeed from ekf_ext message - * - * @return [m/s] Magnitude of air velocity - */ -static inline float mavlink_msg_ekf_ext_get_Airspeed(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 20); -} - -/** - * @brief Get field beta from ekf_ext message - * - * @return [rad] Sideslip angle - */ -static inline float mavlink_msg_ekf_ext_get_beta(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 24); -} - -/** - * @brief Get field alpha from ekf_ext message - * - * @return [rad] Angle of attack - */ -static inline float mavlink_msg_ekf_ext_get_alpha(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 28); -} - -/** - * @brief Decode a ekf_ext message into a struct - * - * @param msg The message to decode - * @param ekf_ext C-struct to decode the message contents into - */ -static inline void mavlink_msg_ekf_ext_decode(const mavlink_message_t* msg, mavlink_ekf_ext_t* ekf_ext) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - ekf_ext->timestamp = mavlink_msg_ekf_ext_get_timestamp(msg); - ekf_ext->Windspeed = mavlink_msg_ekf_ext_get_Windspeed(msg); - ekf_ext->WindDir = mavlink_msg_ekf_ext_get_WindDir(msg); - ekf_ext->WindZ = mavlink_msg_ekf_ext_get_WindZ(msg); - ekf_ext->Airspeed = mavlink_msg_ekf_ext_get_Airspeed(msg); - ekf_ext->beta = mavlink_msg_ekf_ext_get_beta(msg); - ekf_ext->alpha = mavlink_msg_ekf_ext_get_alpha(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_EKF_EXT_LEN? msg->len : MAVLINK_MSG_ID_EKF_EXT_LEN; - memset(ekf_ext, 0, MAVLINK_MSG_ID_EKF_EXT_LEN); - memcpy(ekf_ext, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ASLUAV/mavlink_msg_fw_soaring_data.h b/ASLUAV/mavlink_msg_fw_soaring_data.h deleted file mode 100644 index b518743e3..000000000 --- a/ASLUAV/mavlink_msg_fw_soaring_data.h +++ /dev/null @@ -1,813 +0,0 @@ -#pragma once -// MESSAGE FW_SOARING_DATA PACKING - -#define MAVLINK_MSG_ID_FW_SOARING_DATA 210 - - -typedef struct __mavlink_fw_soaring_data_t { - uint64_t timestamp; /*< [ms] Timestamp*/ - uint64_t timestampModeChanged; /*< [ms] Timestamp since last mode change*/ - float xW; /*< [m/s] Thermal core updraft strength*/ - float xR; /*< [m] Thermal radius*/ - float xLat; /*< [deg] Thermal center latitude*/ - float xLon; /*< [deg] Thermal center longitude*/ - float VarW; /*< Variance W*/ - float VarR; /*< Variance R*/ - float VarLat; /*< Variance Lat*/ - float VarLon; /*< Variance Lon */ - float LoiterRadius; /*< [m] Suggested loiter radius*/ - float LoiterDirection; /*< Suggested loiter direction*/ - float DistToSoarPoint; /*< [m] Distance to soar point*/ - float vSinkExp; /*< [m/s] Expected sink rate at current airspeed, roll and throttle*/ - float z1_LocalUpdraftSpeed; /*< [m/s] Measurement / updraft speed at current/local airplane position*/ - float z2_DeltaRoll; /*< [deg] Measurement / roll angle tracking error*/ - float z1_exp; /*< Expected measurement 1*/ - float z2_exp; /*< Expected measurement 2*/ - float ThermalGSNorth; /*< [m/s] Thermal drift (from estimator prediction step only)*/ - float ThermalGSEast; /*< [m/s] Thermal drift (from estimator prediction step only)*/ - float TSE_dot; /*< [m/s] Total specific energy change (filtered)*/ - float DebugVar1; /*< Debug variable 1*/ - float DebugVar2; /*< Debug variable 2*/ - uint8_t ControlMode; /*< Control Mode [-]*/ - uint8_t valid; /*< Data valid [-]*/ -} mavlink_fw_soaring_data_t; - -#define MAVLINK_MSG_ID_FW_SOARING_DATA_LEN 102 -#define MAVLINK_MSG_ID_FW_SOARING_DATA_MIN_LEN 102 -#define MAVLINK_MSG_ID_210_LEN 102 -#define MAVLINK_MSG_ID_210_MIN_LEN 102 - -#define MAVLINK_MSG_ID_FW_SOARING_DATA_CRC 20 -#define MAVLINK_MSG_ID_210_CRC 20 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_FW_SOARING_DATA { \ - 210, \ - "FW_SOARING_DATA", \ - 25, \ - { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_fw_soaring_data_t, timestamp) }, \ - { "timestampModeChanged", NULL, MAVLINK_TYPE_UINT64_T, 0, 8, offsetof(mavlink_fw_soaring_data_t, timestampModeChanged) }, \ - { "xW", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_fw_soaring_data_t, xW) }, \ - { "xR", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_fw_soaring_data_t, xR) }, \ - { "xLat", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_fw_soaring_data_t, xLat) }, \ - { "xLon", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_fw_soaring_data_t, xLon) }, \ - { "VarW", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_fw_soaring_data_t, VarW) }, \ - { "VarR", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_fw_soaring_data_t, VarR) }, \ - { "VarLat", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_fw_soaring_data_t, VarLat) }, \ - { "VarLon", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_fw_soaring_data_t, VarLon) }, \ - { "LoiterRadius", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_fw_soaring_data_t, LoiterRadius) }, \ - { "LoiterDirection", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_fw_soaring_data_t, LoiterDirection) }, \ - { "DistToSoarPoint", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_fw_soaring_data_t, DistToSoarPoint) }, \ - { "vSinkExp", NULL, MAVLINK_TYPE_FLOAT, 0, 60, offsetof(mavlink_fw_soaring_data_t, vSinkExp) }, \ - { "z1_LocalUpdraftSpeed", NULL, MAVLINK_TYPE_FLOAT, 0, 64, offsetof(mavlink_fw_soaring_data_t, z1_LocalUpdraftSpeed) }, \ - { "z2_DeltaRoll", NULL, MAVLINK_TYPE_FLOAT, 0, 68, offsetof(mavlink_fw_soaring_data_t, z2_DeltaRoll) }, \ - { "z1_exp", NULL, MAVLINK_TYPE_FLOAT, 0, 72, offsetof(mavlink_fw_soaring_data_t, z1_exp) }, \ - { "z2_exp", NULL, MAVLINK_TYPE_FLOAT, 0, 76, offsetof(mavlink_fw_soaring_data_t, z2_exp) }, \ - { "ThermalGSNorth", NULL, MAVLINK_TYPE_FLOAT, 0, 80, offsetof(mavlink_fw_soaring_data_t, ThermalGSNorth) }, \ - { "ThermalGSEast", NULL, MAVLINK_TYPE_FLOAT, 0, 84, offsetof(mavlink_fw_soaring_data_t, ThermalGSEast) }, \ - { "TSE_dot", NULL, MAVLINK_TYPE_FLOAT, 0, 88, offsetof(mavlink_fw_soaring_data_t, TSE_dot) }, \ - { "DebugVar1", NULL, MAVLINK_TYPE_FLOAT, 0, 92, offsetof(mavlink_fw_soaring_data_t, DebugVar1) }, \ - { "DebugVar2", NULL, MAVLINK_TYPE_FLOAT, 0, 96, offsetof(mavlink_fw_soaring_data_t, DebugVar2) }, \ - { "ControlMode", NULL, MAVLINK_TYPE_UINT8_T, 0, 100, offsetof(mavlink_fw_soaring_data_t, ControlMode) }, \ - { "valid", NULL, MAVLINK_TYPE_UINT8_T, 0, 101, offsetof(mavlink_fw_soaring_data_t, valid) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_FW_SOARING_DATA { \ - "FW_SOARING_DATA", \ - 25, \ - { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_fw_soaring_data_t, timestamp) }, \ - { "timestampModeChanged", NULL, MAVLINK_TYPE_UINT64_T, 0, 8, offsetof(mavlink_fw_soaring_data_t, timestampModeChanged) }, \ - { "xW", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_fw_soaring_data_t, xW) }, \ - { "xR", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_fw_soaring_data_t, xR) }, \ - { "xLat", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_fw_soaring_data_t, xLat) }, \ - { "xLon", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_fw_soaring_data_t, xLon) }, \ - { "VarW", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_fw_soaring_data_t, VarW) }, \ - { "VarR", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_fw_soaring_data_t, VarR) }, \ - { "VarLat", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_fw_soaring_data_t, VarLat) }, \ - { "VarLon", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_fw_soaring_data_t, VarLon) }, \ - { "LoiterRadius", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_fw_soaring_data_t, LoiterRadius) }, \ - { "LoiterDirection", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_fw_soaring_data_t, LoiterDirection) }, \ - { "DistToSoarPoint", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_fw_soaring_data_t, DistToSoarPoint) }, \ - { "vSinkExp", NULL, MAVLINK_TYPE_FLOAT, 0, 60, offsetof(mavlink_fw_soaring_data_t, vSinkExp) }, \ - { "z1_LocalUpdraftSpeed", NULL, MAVLINK_TYPE_FLOAT, 0, 64, offsetof(mavlink_fw_soaring_data_t, z1_LocalUpdraftSpeed) }, \ - { "z2_DeltaRoll", NULL, MAVLINK_TYPE_FLOAT, 0, 68, offsetof(mavlink_fw_soaring_data_t, z2_DeltaRoll) }, \ - { "z1_exp", NULL, MAVLINK_TYPE_FLOAT, 0, 72, offsetof(mavlink_fw_soaring_data_t, z1_exp) }, \ - { "z2_exp", NULL, MAVLINK_TYPE_FLOAT, 0, 76, offsetof(mavlink_fw_soaring_data_t, z2_exp) }, \ - { "ThermalGSNorth", NULL, MAVLINK_TYPE_FLOAT, 0, 80, offsetof(mavlink_fw_soaring_data_t, ThermalGSNorth) }, \ - { "ThermalGSEast", NULL, MAVLINK_TYPE_FLOAT, 0, 84, offsetof(mavlink_fw_soaring_data_t, ThermalGSEast) }, \ - { "TSE_dot", NULL, MAVLINK_TYPE_FLOAT, 0, 88, offsetof(mavlink_fw_soaring_data_t, TSE_dot) }, \ - { "DebugVar1", NULL, MAVLINK_TYPE_FLOAT, 0, 92, offsetof(mavlink_fw_soaring_data_t, DebugVar1) }, \ - { "DebugVar2", NULL, MAVLINK_TYPE_FLOAT, 0, 96, offsetof(mavlink_fw_soaring_data_t, DebugVar2) }, \ - { "ControlMode", NULL, MAVLINK_TYPE_UINT8_T, 0, 100, offsetof(mavlink_fw_soaring_data_t, ControlMode) }, \ - { "valid", NULL, MAVLINK_TYPE_UINT8_T, 0, 101, offsetof(mavlink_fw_soaring_data_t, valid) }, \ - } \ -} -#endif - -/** - * @brief Pack a fw_soaring_data message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param timestamp [ms] Timestamp - * @param timestampModeChanged [ms] Timestamp since last mode change - * @param xW [m/s] Thermal core updraft strength - * @param xR [m] Thermal radius - * @param xLat [deg] Thermal center latitude - * @param xLon [deg] Thermal center longitude - * @param VarW Variance W - * @param VarR Variance R - * @param VarLat Variance Lat - * @param VarLon Variance Lon - * @param LoiterRadius [m] Suggested loiter radius - * @param LoiterDirection Suggested loiter direction - * @param DistToSoarPoint [m] Distance to soar point - * @param vSinkExp [m/s] Expected sink rate at current airspeed, roll and throttle - * @param z1_LocalUpdraftSpeed [m/s] Measurement / updraft speed at current/local airplane position - * @param z2_DeltaRoll [deg] Measurement / roll angle tracking error - * @param z1_exp Expected measurement 1 - * @param z2_exp Expected measurement 2 - * @param ThermalGSNorth [m/s] Thermal drift (from estimator prediction step only) - * @param ThermalGSEast [m/s] Thermal drift (from estimator prediction step only) - * @param TSE_dot [m/s] Total specific energy change (filtered) - * @param DebugVar1 Debug variable 1 - * @param DebugVar2 Debug variable 2 - * @param ControlMode Control Mode [-] - * @param valid Data valid [-] - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_fw_soaring_data_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint64_t timestamp, uint64_t timestampModeChanged, float xW, float xR, float xLat, float xLon, float VarW, float VarR, float VarLat, float VarLon, float LoiterRadius, float LoiterDirection, float DistToSoarPoint, float vSinkExp, float z1_LocalUpdraftSpeed, float z2_DeltaRoll, float z1_exp, float z2_exp, float ThermalGSNorth, float ThermalGSEast, float TSE_dot, float DebugVar1, float DebugVar2, uint8_t ControlMode, uint8_t valid) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FW_SOARING_DATA_LEN]; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_uint64_t(buf, 8, timestampModeChanged); - _mav_put_float(buf, 16, xW); - _mav_put_float(buf, 20, xR); - _mav_put_float(buf, 24, xLat); - _mav_put_float(buf, 28, xLon); - _mav_put_float(buf, 32, VarW); - _mav_put_float(buf, 36, VarR); - _mav_put_float(buf, 40, VarLat); - _mav_put_float(buf, 44, VarLon); - _mav_put_float(buf, 48, LoiterRadius); - _mav_put_float(buf, 52, LoiterDirection); - _mav_put_float(buf, 56, DistToSoarPoint); - _mav_put_float(buf, 60, vSinkExp); - _mav_put_float(buf, 64, z1_LocalUpdraftSpeed); - _mav_put_float(buf, 68, z2_DeltaRoll); - _mav_put_float(buf, 72, z1_exp); - _mav_put_float(buf, 76, z2_exp); - _mav_put_float(buf, 80, ThermalGSNorth); - _mav_put_float(buf, 84, ThermalGSEast); - _mav_put_float(buf, 88, TSE_dot); - _mav_put_float(buf, 92, DebugVar1); - _mav_put_float(buf, 96, DebugVar2); - _mav_put_uint8_t(buf, 100, ControlMode); - _mav_put_uint8_t(buf, 101, valid); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FW_SOARING_DATA_LEN); -#else - mavlink_fw_soaring_data_t packet; - packet.timestamp = timestamp; - packet.timestampModeChanged = timestampModeChanged; - packet.xW = xW; - packet.xR = xR; - packet.xLat = xLat; - packet.xLon = xLon; - packet.VarW = VarW; - packet.VarR = VarR; - packet.VarLat = VarLat; - packet.VarLon = VarLon; - packet.LoiterRadius = LoiterRadius; - packet.LoiterDirection = LoiterDirection; - packet.DistToSoarPoint = DistToSoarPoint; - packet.vSinkExp = vSinkExp; - packet.z1_LocalUpdraftSpeed = z1_LocalUpdraftSpeed; - packet.z2_DeltaRoll = z2_DeltaRoll; - packet.z1_exp = z1_exp; - packet.z2_exp = z2_exp; - packet.ThermalGSNorth = ThermalGSNorth; - packet.ThermalGSEast = ThermalGSEast; - packet.TSE_dot = TSE_dot; - packet.DebugVar1 = DebugVar1; - packet.DebugVar2 = DebugVar2; - packet.ControlMode = ControlMode; - packet.valid = valid; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FW_SOARING_DATA_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_FW_SOARING_DATA; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FW_SOARING_DATA_MIN_LEN, MAVLINK_MSG_ID_FW_SOARING_DATA_LEN, MAVLINK_MSG_ID_FW_SOARING_DATA_CRC); -} - -/** - * @brief Pack a fw_soaring_data message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param timestamp [ms] Timestamp - * @param timestampModeChanged [ms] Timestamp since last mode change - * @param xW [m/s] Thermal core updraft strength - * @param xR [m] Thermal radius - * @param xLat [deg] Thermal center latitude - * @param xLon [deg] Thermal center longitude - * @param VarW Variance W - * @param VarR Variance R - * @param VarLat Variance Lat - * @param VarLon Variance Lon - * @param LoiterRadius [m] Suggested loiter radius - * @param LoiterDirection Suggested loiter direction - * @param DistToSoarPoint [m] Distance to soar point - * @param vSinkExp [m/s] Expected sink rate at current airspeed, roll and throttle - * @param z1_LocalUpdraftSpeed [m/s] Measurement / updraft speed at current/local airplane position - * @param z2_DeltaRoll [deg] Measurement / roll angle tracking error - * @param z1_exp Expected measurement 1 - * @param z2_exp Expected measurement 2 - * @param ThermalGSNorth [m/s] Thermal drift (from estimator prediction step only) - * @param ThermalGSEast [m/s] Thermal drift (from estimator prediction step only) - * @param TSE_dot [m/s] Total specific energy change (filtered) - * @param DebugVar1 Debug variable 1 - * @param DebugVar2 Debug variable 2 - * @param ControlMode Control Mode [-] - * @param valid Data valid [-] - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_fw_soaring_data_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint64_t timestamp,uint64_t timestampModeChanged,float xW,float xR,float xLat,float xLon,float VarW,float VarR,float VarLat,float VarLon,float LoiterRadius,float LoiterDirection,float DistToSoarPoint,float vSinkExp,float z1_LocalUpdraftSpeed,float z2_DeltaRoll,float z1_exp,float z2_exp,float ThermalGSNorth,float ThermalGSEast,float TSE_dot,float DebugVar1,float DebugVar2,uint8_t ControlMode,uint8_t valid) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FW_SOARING_DATA_LEN]; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_uint64_t(buf, 8, timestampModeChanged); - _mav_put_float(buf, 16, xW); - _mav_put_float(buf, 20, xR); - _mav_put_float(buf, 24, xLat); - _mav_put_float(buf, 28, xLon); - _mav_put_float(buf, 32, VarW); - _mav_put_float(buf, 36, VarR); - _mav_put_float(buf, 40, VarLat); - _mav_put_float(buf, 44, VarLon); - _mav_put_float(buf, 48, LoiterRadius); - _mav_put_float(buf, 52, LoiterDirection); - _mav_put_float(buf, 56, DistToSoarPoint); - _mav_put_float(buf, 60, vSinkExp); - _mav_put_float(buf, 64, z1_LocalUpdraftSpeed); - _mav_put_float(buf, 68, z2_DeltaRoll); - _mav_put_float(buf, 72, z1_exp); - _mav_put_float(buf, 76, z2_exp); - _mav_put_float(buf, 80, ThermalGSNorth); - _mav_put_float(buf, 84, ThermalGSEast); - _mav_put_float(buf, 88, TSE_dot); - _mav_put_float(buf, 92, DebugVar1); - _mav_put_float(buf, 96, DebugVar2); - _mav_put_uint8_t(buf, 100, ControlMode); - _mav_put_uint8_t(buf, 101, valid); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FW_SOARING_DATA_LEN); -#else - mavlink_fw_soaring_data_t packet; - packet.timestamp = timestamp; - packet.timestampModeChanged = timestampModeChanged; - packet.xW = xW; - packet.xR = xR; - packet.xLat = xLat; - packet.xLon = xLon; - packet.VarW = VarW; - packet.VarR = VarR; - packet.VarLat = VarLat; - packet.VarLon = VarLon; - packet.LoiterRadius = LoiterRadius; - packet.LoiterDirection = LoiterDirection; - packet.DistToSoarPoint = DistToSoarPoint; - packet.vSinkExp = vSinkExp; - packet.z1_LocalUpdraftSpeed = z1_LocalUpdraftSpeed; - packet.z2_DeltaRoll = z2_DeltaRoll; - packet.z1_exp = z1_exp; - packet.z2_exp = z2_exp; - packet.ThermalGSNorth = ThermalGSNorth; - packet.ThermalGSEast = ThermalGSEast; - packet.TSE_dot = TSE_dot; - packet.DebugVar1 = DebugVar1; - packet.DebugVar2 = DebugVar2; - packet.ControlMode = ControlMode; - packet.valid = valid; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FW_SOARING_DATA_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_FW_SOARING_DATA; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FW_SOARING_DATA_MIN_LEN, MAVLINK_MSG_ID_FW_SOARING_DATA_LEN, MAVLINK_MSG_ID_FW_SOARING_DATA_CRC); -} - -/** - * @brief Encode a fw_soaring_data struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param fw_soaring_data C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_fw_soaring_data_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_fw_soaring_data_t* fw_soaring_data) -{ - return mavlink_msg_fw_soaring_data_pack(system_id, component_id, msg, fw_soaring_data->timestamp, fw_soaring_data->timestampModeChanged, fw_soaring_data->xW, fw_soaring_data->xR, fw_soaring_data->xLat, fw_soaring_data->xLon, fw_soaring_data->VarW, fw_soaring_data->VarR, fw_soaring_data->VarLat, fw_soaring_data->VarLon, fw_soaring_data->LoiterRadius, fw_soaring_data->LoiterDirection, fw_soaring_data->DistToSoarPoint, fw_soaring_data->vSinkExp, fw_soaring_data->z1_LocalUpdraftSpeed, fw_soaring_data->z2_DeltaRoll, fw_soaring_data->z1_exp, fw_soaring_data->z2_exp, fw_soaring_data->ThermalGSNorth, fw_soaring_data->ThermalGSEast, fw_soaring_data->TSE_dot, fw_soaring_data->DebugVar1, fw_soaring_data->DebugVar2, fw_soaring_data->ControlMode, fw_soaring_data->valid); -} - -/** - * @brief Encode a fw_soaring_data struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param fw_soaring_data C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_fw_soaring_data_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_fw_soaring_data_t* fw_soaring_data) -{ - return mavlink_msg_fw_soaring_data_pack_chan(system_id, component_id, chan, msg, fw_soaring_data->timestamp, fw_soaring_data->timestampModeChanged, fw_soaring_data->xW, fw_soaring_data->xR, fw_soaring_data->xLat, fw_soaring_data->xLon, fw_soaring_data->VarW, fw_soaring_data->VarR, fw_soaring_data->VarLat, fw_soaring_data->VarLon, fw_soaring_data->LoiterRadius, fw_soaring_data->LoiterDirection, fw_soaring_data->DistToSoarPoint, fw_soaring_data->vSinkExp, fw_soaring_data->z1_LocalUpdraftSpeed, fw_soaring_data->z2_DeltaRoll, fw_soaring_data->z1_exp, fw_soaring_data->z2_exp, fw_soaring_data->ThermalGSNorth, fw_soaring_data->ThermalGSEast, fw_soaring_data->TSE_dot, fw_soaring_data->DebugVar1, fw_soaring_data->DebugVar2, fw_soaring_data->ControlMode, fw_soaring_data->valid); -} - -/** - * @brief Send a fw_soaring_data message - * @param chan MAVLink channel to send the message - * - * @param timestamp [ms] Timestamp - * @param timestampModeChanged [ms] Timestamp since last mode change - * @param xW [m/s] Thermal core updraft strength - * @param xR [m] Thermal radius - * @param xLat [deg] Thermal center latitude - * @param xLon [deg] Thermal center longitude - * @param VarW Variance W - * @param VarR Variance R - * @param VarLat Variance Lat - * @param VarLon Variance Lon - * @param LoiterRadius [m] Suggested loiter radius - * @param LoiterDirection Suggested loiter direction - * @param DistToSoarPoint [m] Distance to soar point - * @param vSinkExp [m/s] Expected sink rate at current airspeed, roll and throttle - * @param z1_LocalUpdraftSpeed [m/s] Measurement / updraft speed at current/local airplane position - * @param z2_DeltaRoll [deg] Measurement / roll angle tracking error - * @param z1_exp Expected measurement 1 - * @param z2_exp Expected measurement 2 - * @param ThermalGSNorth [m/s] Thermal drift (from estimator prediction step only) - * @param ThermalGSEast [m/s] Thermal drift (from estimator prediction step only) - * @param TSE_dot [m/s] Total specific energy change (filtered) - * @param DebugVar1 Debug variable 1 - * @param DebugVar2 Debug variable 2 - * @param ControlMode Control Mode [-] - * @param valid Data valid [-] - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_fw_soaring_data_send(mavlink_channel_t chan, uint64_t timestamp, uint64_t timestampModeChanged, float xW, float xR, float xLat, float xLon, float VarW, float VarR, float VarLat, float VarLon, float LoiterRadius, float LoiterDirection, float DistToSoarPoint, float vSinkExp, float z1_LocalUpdraftSpeed, float z2_DeltaRoll, float z1_exp, float z2_exp, float ThermalGSNorth, float ThermalGSEast, float TSE_dot, float DebugVar1, float DebugVar2, uint8_t ControlMode, uint8_t valid) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FW_SOARING_DATA_LEN]; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_uint64_t(buf, 8, timestampModeChanged); - _mav_put_float(buf, 16, xW); - _mav_put_float(buf, 20, xR); - _mav_put_float(buf, 24, xLat); - _mav_put_float(buf, 28, xLon); - _mav_put_float(buf, 32, VarW); - _mav_put_float(buf, 36, VarR); - _mav_put_float(buf, 40, VarLat); - _mav_put_float(buf, 44, VarLon); - _mav_put_float(buf, 48, LoiterRadius); - _mav_put_float(buf, 52, LoiterDirection); - _mav_put_float(buf, 56, DistToSoarPoint); - _mav_put_float(buf, 60, vSinkExp); - _mav_put_float(buf, 64, z1_LocalUpdraftSpeed); - _mav_put_float(buf, 68, z2_DeltaRoll); - _mav_put_float(buf, 72, z1_exp); - _mav_put_float(buf, 76, z2_exp); - _mav_put_float(buf, 80, ThermalGSNorth); - _mav_put_float(buf, 84, ThermalGSEast); - _mav_put_float(buf, 88, TSE_dot); - _mav_put_float(buf, 92, DebugVar1); - _mav_put_float(buf, 96, DebugVar2); - _mav_put_uint8_t(buf, 100, ControlMode); - _mav_put_uint8_t(buf, 101, valid); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FW_SOARING_DATA, buf, MAVLINK_MSG_ID_FW_SOARING_DATA_MIN_LEN, MAVLINK_MSG_ID_FW_SOARING_DATA_LEN, MAVLINK_MSG_ID_FW_SOARING_DATA_CRC); -#else - mavlink_fw_soaring_data_t packet; - packet.timestamp = timestamp; - packet.timestampModeChanged = timestampModeChanged; - packet.xW = xW; - packet.xR = xR; - packet.xLat = xLat; - packet.xLon = xLon; - packet.VarW = VarW; - packet.VarR = VarR; - packet.VarLat = VarLat; - packet.VarLon = VarLon; - packet.LoiterRadius = LoiterRadius; - packet.LoiterDirection = LoiterDirection; - packet.DistToSoarPoint = DistToSoarPoint; - packet.vSinkExp = vSinkExp; - packet.z1_LocalUpdraftSpeed = z1_LocalUpdraftSpeed; - packet.z2_DeltaRoll = z2_DeltaRoll; - packet.z1_exp = z1_exp; - packet.z2_exp = z2_exp; - packet.ThermalGSNorth = ThermalGSNorth; - packet.ThermalGSEast = ThermalGSEast; - packet.TSE_dot = TSE_dot; - packet.DebugVar1 = DebugVar1; - packet.DebugVar2 = DebugVar2; - packet.ControlMode = ControlMode; - packet.valid = valid; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FW_SOARING_DATA, (const char *)&packet, MAVLINK_MSG_ID_FW_SOARING_DATA_MIN_LEN, MAVLINK_MSG_ID_FW_SOARING_DATA_LEN, MAVLINK_MSG_ID_FW_SOARING_DATA_CRC); -#endif -} - -/** - * @brief Send a fw_soaring_data message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_fw_soaring_data_send_struct(mavlink_channel_t chan, const mavlink_fw_soaring_data_t* fw_soaring_data) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_fw_soaring_data_send(chan, fw_soaring_data->timestamp, fw_soaring_data->timestampModeChanged, fw_soaring_data->xW, fw_soaring_data->xR, fw_soaring_data->xLat, fw_soaring_data->xLon, fw_soaring_data->VarW, fw_soaring_data->VarR, fw_soaring_data->VarLat, fw_soaring_data->VarLon, fw_soaring_data->LoiterRadius, fw_soaring_data->LoiterDirection, fw_soaring_data->DistToSoarPoint, fw_soaring_data->vSinkExp, fw_soaring_data->z1_LocalUpdraftSpeed, fw_soaring_data->z2_DeltaRoll, fw_soaring_data->z1_exp, fw_soaring_data->z2_exp, fw_soaring_data->ThermalGSNorth, fw_soaring_data->ThermalGSEast, fw_soaring_data->TSE_dot, fw_soaring_data->DebugVar1, fw_soaring_data->DebugVar2, fw_soaring_data->ControlMode, fw_soaring_data->valid); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FW_SOARING_DATA, (const char *)fw_soaring_data, MAVLINK_MSG_ID_FW_SOARING_DATA_MIN_LEN, MAVLINK_MSG_ID_FW_SOARING_DATA_LEN, MAVLINK_MSG_ID_FW_SOARING_DATA_CRC); -#endif -} - -#if MAVLINK_MSG_ID_FW_SOARING_DATA_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_fw_soaring_data_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t timestamp, uint64_t timestampModeChanged, float xW, float xR, float xLat, float xLon, float VarW, float VarR, float VarLat, float VarLon, float LoiterRadius, float LoiterDirection, float DistToSoarPoint, float vSinkExp, float z1_LocalUpdraftSpeed, float z2_DeltaRoll, float z1_exp, float z2_exp, float ThermalGSNorth, float ThermalGSEast, float TSE_dot, float DebugVar1, float DebugVar2, uint8_t ControlMode, uint8_t valid) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_uint64_t(buf, 8, timestampModeChanged); - _mav_put_float(buf, 16, xW); - _mav_put_float(buf, 20, xR); - _mav_put_float(buf, 24, xLat); - _mav_put_float(buf, 28, xLon); - _mav_put_float(buf, 32, VarW); - _mav_put_float(buf, 36, VarR); - _mav_put_float(buf, 40, VarLat); - _mav_put_float(buf, 44, VarLon); - _mav_put_float(buf, 48, LoiterRadius); - _mav_put_float(buf, 52, LoiterDirection); - _mav_put_float(buf, 56, DistToSoarPoint); - _mav_put_float(buf, 60, vSinkExp); - _mav_put_float(buf, 64, z1_LocalUpdraftSpeed); - _mav_put_float(buf, 68, z2_DeltaRoll); - _mav_put_float(buf, 72, z1_exp); - _mav_put_float(buf, 76, z2_exp); - _mav_put_float(buf, 80, ThermalGSNorth); - _mav_put_float(buf, 84, ThermalGSEast); - _mav_put_float(buf, 88, TSE_dot); - _mav_put_float(buf, 92, DebugVar1); - _mav_put_float(buf, 96, DebugVar2); - _mav_put_uint8_t(buf, 100, ControlMode); - _mav_put_uint8_t(buf, 101, valid); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FW_SOARING_DATA, buf, MAVLINK_MSG_ID_FW_SOARING_DATA_MIN_LEN, MAVLINK_MSG_ID_FW_SOARING_DATA_LEN, MAVLINK_MSG_ID_FW_SOARING_DATA_CRC); -#else - mavlink_fw_soaring_data_t *packet = (mavlink_fw_soaring_data_t *)msgbuf; - packet->timestamp = timestamp; - packet->timestampModeChanged = timestampModeChanged; - packet->xW = xW; - packet->xR = xR; - packet->xLat = xLat; - packet->xLon = xLon; - packet->VarW = VarW; - packet->VarR = VarR; - packet->VarLat = VarLat; - packet->VarLon = VarLon; - packet->LoiterRadius = LoiterRadius; - packet->LoiterDirection = LoiterDirection; - packet->DistToSoarPoint = DistToSoarPoint; - packet->vSinkExp = vSinkExp; - packet->z1_LocalUpdraftSpeed = z1_LocalUpdraftSpeed; - packet->z2_DeltaRoll = z2_DeltaRoll; - packet->z1_exp = z1_exp; - packet->z2_exp = z2_exp; - packet->ThermalGSNorth = ThermalGSNorth; - packet->ThermalGSEast = ThermalGSEast; - packet->TSE_dot = TSE_dot; - packet->DebugVar1 = DebugVar1; - packet->DebugVar2 = DebugVar2; - packet->ControlMode = ControlMode; - packet->valid = valid; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FW_SOARING_DATA, (const char *)packet, MAVLINK_MSG_ID_FW_SOARING_DATA_MIN_LEN, MAVLINK_MSG_ID_FW_SOARING_DATA_LEN, MAVLINK_MSG_ID_FW_SOARING_DATA_CRC); -#endif -} -#endif - -#endif - -// MESSAGE FW_SOARING_DATA UNPACKING - - -/** - * @brief Get field timestamp from fw_soaring_data message - * - * @return [ms] Timestamp - */ -static inline uint64_t mavlink_msg_fw_soaring_data_get_timestamp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint64_t(msg, 0); -} - -/** - * @brief Get field timestampModeChanged from fw_soaring_data message - * - * @return [ms] Timestamp since last mode change - */ -static inline uint64_t mavlink_msg_fw_soaring_data_get_timestampModeChanged(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint64_t(msg, 8); -} - -/** - * @brief Get field xW from fw_soaring_data message - * - * @return [m/s] Thermal core updraft strength - */ -static inline float mavlink_msg_fw_soaring_data_get_xW(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 16); -} - -/** - * @brief Get field xR from fw_soaring_data message - * - * @return [m] Thermal radius - */ -static inline float mavlink_msg_fw_soaring_data_get_xR(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 20); -} - -/** - * @brief Get field xLat from fw_soaring_data message - * - * @return [deg] Thermal center latitude - */ -static inline float mavlink_msg_fw_soaring_data_get_xLat(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 24); -} - -/** - * @brief Get field xLon from fw_soaring_data message - * - * @return [deg] Thermal center longitude - */ -static inline float mavlink_msg_fw_soaring_data_get_xLon(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 28); -} - -/** - * @brief Get field VarW from fw_soaring_data message - * - * @return Variance W - */ -static inline float mavlink_msg_fw_soaring_data_get_VarW(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 32); -} - -/** - * @brief Get field VarR from fw_soaring_data message - * - * @return Variance R - */ -static inline float mavlink_msg_fw_soaring_data_get_VarR(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 36); -} - -/** - * @brief Get field VarLat from fw_soaring_data message - * - * @return Variance Lat - */ -static inline float mavlink_msg_fw_soaring_data_get_VarLat(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 40); -} - -/** - * @brief Get field VarLon from fw_soaring_data message - * - * @return Variance Lon - */ -static inline float mavlink_msg_fw_soaring_data_get_VarLon(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 44); -} - -/** - * @brief Get field LoiterRadius from fw_soaring_data message - * - * @return [m] Suggested loiter radius - */ -static inline float mavlink_msg_fw_soaring_data_get_LoiterRadius(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 48); -} - -/** - * @brief Get field LoiterDirection from fw_soaring_data message - * - * @return Suggested loiter direction - */ -static inline float mavlink_msg_fw_soaring_data_get_LoiterDirection(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 52); -} - -/** - * @brief Get field DistToSoarPoint from fw_soaring_data message - * - * @return [m] Distance to soar point - */ -static inline float mavlink_msg_fw_soaring_data_get_DistToSoarPoint(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 56); -} - -/** - * @brief Get field vSinkExp from fw_soaring_data message - * - * @return [m/s] Expected sink rate at current airspeed, roll and throttle - */ -static inline float mavlink_msg_fw_soaring_data_get_vSinkExp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 60); -} - -/** - * @brief Get field z1_LocalUpdraftSpeed from fw_soaring_data message - * - * @return [m/s] Measurement / updraft speed at current/local airplane position - */ -static inline float mavlink_msg_fw_soaring_data_get_z1_LocalUpdraftSpeed(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 64); -} - -/** - * @brief Get field z2_DeltaRoll from fw_soaring_data message - * - * @return [deg] Measurement / roll angle tracking error - */ -static inline float mavlink_msg_fw_soaring_data_get_z2_DeltaRoll(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 68); -} - -/** - * @brief Get field z1_exp from fw_soaring_data message - * - * @return Expected measurement 1 - */ -static inline float mavlink_msg_fw_soaring_data_get_z1_exp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 72); -} - -/** - * @brief Get field z2_exp from fw_soaring_data message - * - * @return Expected measurement 2 - */ -static inline float mavlink_msg_fw_soaring_data_get_z2_exp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 76); -} - -/** - * @brief Get field ThermalGSNorth from fw_soaring_data message - * - * @return [m/s] Thermal drift (from estimator prediction step only) - */ -static inline float mavlink_msg_fw_soaring_data_get_ThermalGSNorth(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 80); -} - -/** - * @brief Get field ThermalGSEast from fw_soaring_data message - * - * @return [m/s] Thermal drift (from estimator prediction step only) - */ -static inline float mavlink_msg_fw_soaring_data_get_ThermalGSEast(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 84); -} - -/** - * @brief Get field TSE_dot from fw_soaring_data message - * - * @return [m/s] Total specific energy change (filtered) - */ -static inline float mavlink_msg_fw_soaring_data_get_TSE_dot(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 88); -} - -/** - * @brief Get field DebugVar1 from fw_soaring_data message - * - * @return Debug variable 1 - */ -static inline float mavlink_msg_fw_soaring_data_get_DebugVar1(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 92); -} - -/** - * @brief Get field DebugVar2 from fw_soaring_data message - * - * @return Debug variable 2 - */ -static inline float mavlink_msg_fw_soaring_data_get_DebugVar2(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 96); -} - -/** - * @brief Get field ControlMode from fw_soaring_data message - * - * @return Control Mode [-] - */ -static inline uint8_t mavlink_msg_fw_soaring_data_get_ControlMode(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 100); -} - -/** - * @brief Get field valid from fw_soaring_data message - * - * @return Data valid [-] - */ -static inline uint8_t mavlink_msg_fw_soaring_data_get_valid(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 101); -} - -/** - * @brief Decode a fw_soaring_data message into a struct - * - * @param msg The message to decode - * @param fw_soaring_data C-struct to decode the message contents into - */ -static inline void mavlink_msg_fw_soaring_data_decode(const mavlink_message_t* msg, mavlink_fw_soaring_data_t* fw_soaring_data) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - fw_soaring_data->timestamp = mavlink_msg_fw_soaring_data_get_timestamp(msg); - fw_soaring_data->timestampModeChanged = mavlink_msg_fw_soaring_data_get_timestampModeChanged(msg); - fw_soaring_data->xW = mavlink_msg_fw_soaring_data_get_xW(msg); - fw_soaring_data->xR = mavlink_msg_fw_soaring_data_get_xR(msg); - fw_soaring_data->xLat = mavlink_msg_fw_soaring_data_get_xLat(msg); - fw_soaring_data->xLon = mavlink_msg_fw_soaring_data_get_xLon(msg); - fw_soaring_data->VarW = mavlink_msg_fw_soaring_data_get_VarW(msg); - fw_soaring_data->VarR = mavlink_msg_fw_soaring_data_get_VarR(msg); - fw_soaring_data->VarLat = mavlink_msg_fw_soaring_data_get_VarLat(msg); - fw_soaring_data->VarLon = mavlink_msg_fw_soaring_data_get_VarLon(msg); - fw_soaring_data->LoiterRadius = mavlink_msg_fw_soaring_data_get_LoiterRadius(msg); - fw_soaring_data->LoiterDirection = mavlink_msg_fw_soaring_data_get_LoiterDirection(msg); - fw_soaring_data->DistToSoarPoint = mavlink_msg_fw_soaring_data_get_DistToSoarPoint(msg); - fw_soaring_data->vSinkExp = mavlink_msg_fw_soaring_data_get_vSinkExp(msg); - fw_soaring_data->z1_LocalUpdraftSpeed = mavlink_msg_fw_soaring_data_get_z1_LocalUpdraftSpeed(msg); - fw_soaring_data->z2_DeltaRoll = mavlink_msg_fw_soaring_data_get_z2_DeltaRoll(msg); - fw_soaring_data->z1_exp = mavlink_msg_fw_soaring_data_get_z1_exp(msg); - fw_soaring_data->z2_exp = mavlink_msg_fw_soaring_data_get_z2_exp(msg); - fw_soaring_data->ThermalGSNorth = mavlink_msg_fw_soaring_data_get_ThermalGSNorth(msg); - fw_soaring_data->ThermalGSEast = mavlink_msg_fw_soaring_data_get_ThermalGSEast(msg); - fw_soaring_data->TSE_dot = mavlink_msg_fw_soaring_data_get_TSE_dot(msg); - fw_soaring_data->DebugVar1 = mavlink_msg_fw_soaring_data_get_DebugVar1(msg); - fw_soaring_data->DebugVar2 = mavlink_msg_fw_soaring_data_get_DebugVar2(msg); - fw_soaring_data->ControlMode = mavlink_msg_fw_soaring_data_get_ControlMode(msg); - fw_soaring_data->valid = mavlink_msg_fw_soaring_data_get_valid(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_FW_SOARING_DATA_LEN? msg->len : MAVLINK_MSG_ID_FW_SOARING_DATA_LEN; - memset(fw_soaring_data, 0, MAVLINK_MSG_ID_FW_SOARING_DATA_LEN); - memcpy(fw_soaring_data, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ASLUAV/mavlink_msg_gsm_link_status.h b/ASLUAV/mavlink_msg_gsm_link_status.h deleted file mode 100644 index 320bf3f87..000000000 --- a/ASLUAV/mavlink_msg_gsm_link_status.h +++ /dev/null @@ -1,363 +0,0 @@ -#pragma once -// MESSAGE GSM_LINK_STATUS PACKING - -#define MAVLINK_MSG_ID_GSM_LINK_STATUS 213 - - -typedef struct __mavlink_gsm_link_status_t { - uint64_t timestamp; /*< [us] Timestamp (of OBC)*/ - uint8_t gsm_modem_type; /*< GSM modem used*/ - uint8_t gsm_link_type; /*< GSM link type*/ - uint8_t rssi; /*< RSSI as reported by modem (unconverted)*/ - uint8_t rsrp_rscp; /*< RSRP (LTE) or RSCP (WCDMA) as reported by modem (unconverted)*/ - uint8_t sinr_ecio; /*< SINR (LTE) or ECIO (WCDMA) as reported by modem (unconverted)*/ - uint8_t rsrq; /*< RSRQ (LTE only) as reported by modem (unconverted)*/ -} mavlink_gsm_link_status_t; - -#define MAVLINK_MSG_ID_GSM_LINK_STATUS_LEN 14 -#define MAVLINK_MSG_ID_GSM_LINK_STATUS_MIN_LEN 14 -#define MAVLINK_MSG_ID_213_LEN 14 -#define MAVLINK_MSG_ID_213_MIN_LEN 14 - -#define MAVLINK_MSG_ID_GSM_LINK_STATUS_CRC 200 -#define MAVLINK_MSG_ID_213_CRC 200 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_GSM_LINK_STATUS { \ - 213, \ - "GSM_LINK_STATUS", \ - 7, \ - { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_gsm_link_status_t, timestamp) }, \ - { "gsm_modem_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_gsm_link_status_t, gsm_modem_type) }, \ - { "gsm_link_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_gsm_link_status_t, gsm_link_type) }, \ - { "rssi", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_gsm_link_status_t, rssi) }, \ - { "rsrp_rscp", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_gsm_link_status_t, rsrp_rscp) }, \ - { "sinr_ecio", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_gsm_link_status_t, sinr_ecio) }, \ - { "rsrq", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_gsm_link_status_t, rsrq) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_GSM_LINK_STATUS { \ - "GSM_LINK_STATUS", \ - 7, \ - { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_gsm_link_status_t, timestamp) }, \ - { "gsm_modem_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_gsm_link_status_t, gsm_modem_type) }, \ - { "gsm_link_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_gsm_link_status_t, gsm_link_type) }, \ - { "rssi", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_gsm_link_status_t, rssi) }, \ - { "rsrp_rscp", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_gsm_link_status_t, rsrp_rscp) }, \ - { "sinr_ecio", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_gsm_link_status_t, sinr_ecio) }, \ - { "rsrq", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_gsm_link_status_t, rsrq) }, \ - } \ -} -#endif - -/** - * @brief Pack a gsm_link_status message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param timestamp [us] Timestamp (of OBC) - * @param gsm_modem_type GSM modem used - * @param gsm_link_type GSM link type - * @param rssi RSSI as reported by modem (unconverted) - * @param rsrp_rscp RSRP (LTE) or RSCP (WCDMA) as reported by modem (unconverted) - * @param sinr_ecio SINR (LTE) or ECIO (WCDMA) as reported by modem (unconverted) - * @param rsrq RSRQ (LTE only) as reported by modem (unconverted) - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_gsm_link_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint64_t timestamp, uint8_t gsm_modem_type, uint8_t gsm_link_type, uint8_t rssi, uint8_t rsrp_rscp, uint8_t sinr_ecio, uint8_t rsrq) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_GSM_LINK_STATUS_LEN]; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_uint8_t(buf, 8, gsm_modem_type); - _mav_put_uint8_t(buf, 9, gsm_link_type); - _mav_put_uint8_t(buf, 10, rssi); - _mav_put_uint8_t(buf, 11, rsrp_rscp); - _mav_put_uint8_t(buf, 12, sinr_ecio); - _mav_put_uint8_t(buf, 13, rsrq); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GSM_LINK_STATUS_LEN); -#else - mavlink_gsm_link_status_t packet; - packet.timestamp = timestamp; - packet.gsm_modem_type = gsm_modem_type; - packet.gsm_link_type = gsm_link_type; - packet.rssi = rssi; - packet.rsrp_rscp = rsrp_rscp; - packet.sinr_ecio = sinr_ecio; - packet.rsrq = rsrq; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GSM_LINK_STATUS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_GSM_LINK_STATUS; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GSM_LINK_STATUS_MIN_LEN, MAVLINK_MSG_ID_GSM_LINK_STATUS_LEN, MAVLINK_MSG_ID_GSM_LINK_STATUS_CRC); -} - -/** - * @brief Pack a gsm_link_status message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param timestamp [us] Timestamp (of OBC) - * @param gsm_modem_type GSM modem used - * @param gsm_link_type GSM link type - * @param rssi RSSI as reported by modem (unconverted) - * @param rsrp_rscp RSRP (LTE) or RSCP (WCDMA) as reported by modem (unconverted) - * @param sinr_ecio SINR (LTE) or ECIO (WCDMA) as reported by modem (unconverted) - * @param rsrq RSRQ (LTE only) as reported by modem (unconverted) - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_gsm_link_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint64_t timestamp,uint8_t gsm_modem_type,uint8_t gsm_link_type,uint8_t rssi,uint8_t rsrp_rscp,uint8_t sinr_ecio,uint8_t rsrq) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_GSM_LINK_STATUS_LEN]; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_uint8_t(buf, 8, gsm_modem_type); - _mav_put_uint8_t(buf, 9, gsm_link_type); - _mav_put_uint8_t(buf, 10, rssi); - _mav_put_uint8_t(buf, 11, rsrp_rscp); - _mav_put_uint8_t(buf, 12, sinr_ecio); - _mav_put_uint8_t(buf, 13, rsrq); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GSM_LINK_STATUS_LEN); -#else - mavlink_gsm_link_status_t packet; - packet.timestamp = timestamp; - packet.gsm_modem_type = gsm_modem_type; - packet.gsm_link_type = gsm_link_type; - packet.rssi = rssi; - packet.rsrp_rscp = rsrp_rscp; - packet.sinr_ecio = sinr_ecio; - packet.rsrq = rsrq; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GSM_LINK_STATUS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_GSM_LINK_STATUS; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GSM_LINK_STATUS_MIN_LEN, MAVLINK_MSG_ID_GSM_LINK_STATUS_LEN, MAVLINK_MSG_ID_GSM_LINK_STATUS_CRC); -} - -/** - * @brief Encode a gsm_link_status struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param gsm_link_status C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_gsm_link_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gsm_link_status_t* gsm_link_status) -{ - return mavlink_msg_gsm_link_status_pack(system_id, component_id, msg, gsm_link_status->timestamp, gsm_link_status->gsm_modem_type, gsm_link_status->gsm_link_type, gsm_link_status->rssi, gsm_link_status->rsrp_rscp, gsm_link_status->sinr_ecio, gsm_link_status->rsrq); -} - -/** - * @brief Encode a gsm_link_status struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param gsm_link_status C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_gsm_link_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gsm_link_status_t* gsm_link_status) -{ - return mavlink_msg_gsm_link_status_pack_chan(system_id, component_id, chan, msg, gsm_link_status->timestamp, gsm_link_status->gsm_modem_type, gsm_link_status->gsm_link_type, gsm_link_status->rssi, gsm_link_status->rsrp_rscp, gsm_link_status->sinr_ecio, gsm_link_status->rsrq); -} - -/** - * @brief Send a gsm_link_status message - * @param chan MAVLink channel to send the message - * - * @param timestamp [us] Timestamp (of OBC) - * @param gsm_modem_type GSM modem used - * @param gsm_link_type GSM link type - * @param rssi RSSI as reported by modem (unconverted) - * @param rsrp_rscp RSRP (LTE) or RSCP (WCDMA) as reported by modem (unconverted) - * @param sinr_ecio SINR (LTE) or ECIO (WCDMA) as reported by modem (unconverted) - * @param rsrq RSRQ (LTE only) as reported by modem (unconverted) - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_gsm_link_status_send(mavlink_channel_t chan, uint64_t timestamp, uint8_t gsm_modem_type, uint8_t gsm_link_type, uint8_t rssi, uint8_t rsrp_rscp, uint8_t sinr_ecio, uint8_t rsrq) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_GSM_LINK_STATUS_LEN]; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_uint8_t(buf, 8, gsm_modem_type); - _mav_put_uint8_t(buf, 9, gsm_link_type); - _mav_put_uint8_t(buf, 10, rssi); - _mav_put_uint8_t(buf, 11, rsrp_rscp); - _mav_put_uint8_t(buf, 12, sinr_ecio); - _mav_put_uint8_t(buf, 13, rsrq); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GSM_LINK_STATUS, buf, MAVLINK_MSG_ID_GSM_LINK_STATUS_MIN_LEN, MAVLINK_MSG_ID_GSM_LINK_STATUS_LEN, MAVLINK_MSG_ID_GSM_LINK_STATUS_CRC); -#else - mavlink_gsm_link_status_t packet; - packet.timestamp = timestamp; - packet.gsm_modem_type = gsm_modem_type; - packet.gsm_link_type = gsm_link_type; - packet.rssi = rssi; - packet.rsrp_rscp = rsrp_rscp; - packet.sinr_ecio = sinr_ecio; - packet.rsrq = rsrq; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GSM_LINK_STATUS, (const char *)&packet, MAVLINK_MSG_ID_GSM_LINK_STATUS_MIN_LEN, MAVLINK_MSG_ID_GSM_LINK_STATUS_LEN, MAVLINK_MSG_ID_GSM_LINK_STATUS_CRC); -#endif -} - -/** - * @brief Send a gsm_link_status message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_gsm_link_status_send_struct(mavlink_channel_t chan, const mavlink_gsm_link_status_t* gsm_link_status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_gsm_link_status_send(chan, gsm_link_status->timestamp, gsm_link_status->gsm_modem_type, gsm_link_status->gsm_link_type, gsm_link_status->rssi, gsm_link_status->rsrp_rscp, gsm_link_status->sinr_ecio, gsm_link_status->rsrq); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GSM_LINK_STATUS, (const char *)gsm_link_status, MAVLINK_MSG_ID_GSM_LINK_STATUS_MIN_LEN, MAVLINK_MSG_ID_GSM_LINK_STATUS_LEN, MAVLINK_MSG_ID_GSM_LINK_STATUS_CRC); -#endif -} - -#if MAVLINK_MSG_ID_GSM_LINK_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_gsm_link_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t timestamp, uint8_t gsm_modem_type, uint8_t gsm_link_type, uint8_t rssi, uint8_t rsrp_rscp, uint8_t sinr_ecio, uint8_t rsrq) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_uint8_t(buf, 8, gsm_modem_type); - _mav_put_uint8_t(buf, 9, gsm_link_type); - _mav_put_uint8_t(buf, 10, rssi); - _mav_put_uint8_t(buf, 11, rsrp_rscp); - _mav_put_uint8_t(buf, 12, sinr_ecio); - _mav_put_uint8_t(buf, 13, rsrq); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GSM_LINK_STATUS, buf, MAVLINK_MSG_ID_GSM_LINK_STATUS_MIN_LEN, MAVLINK_MSG_ID_GSM_LINK_STATUS_LEN, MAVLINK_MSG_ID_GSM_LINK_STATUS_CRC); -#else - mavlink_gsm_link_status_t *packet = (mavlink_gsm_link_status_t *)msgbuf; - packet->timestamp = timestamp; - packet->gsm_modem_type = gsm_modem_type; - packet->gsm_link_type = gsm_link_type; - packet->rssi = rssi; - packet->rsrp_rscp = rsrp_rscp; - packet->sinr_ecio = sinr_ecio; - packet->rsrq = rsrq; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GSM_LINK_STATUS, (const char *)packet, MAVLINK_MSG_ID_GSM_LINK_STATUS_MIN_LEN, MAVLINK_MSG_ID_GSM_LINK_STATUS_LEN, MAVLINK_MSG_ID_GSM_LINK_STATUS_CRC); -#endif -} -#endif - -#endif - -// MESSAGE GSM_LINK_STATUS UNPACKING - - -/** - * @brief Get field timestamp from gsm_link_status message - * - * @return [us] Timestamp (of OBC) - */ -static inline uint64_t mavlink_msg_gsm_link_status_get_timestamp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint64_t(msg, 0); -} - -/** - * @brief Get field gsm_modem_type from gsm_link_status message - * - * @return GSM modem used - */ -static inline uint8_t mavlink_msg_gsm_link_status_get_gsm_modem_type(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 8); -} - -/** - * @brief Get field gsm_link_type from gsm_link_status message - * - * @return GSM link type - */ -static inline uint8_t mavlink_msg_gsm_link_status_get_gsm_link_type(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 9); -} - -/** - * @brief Get field rssi from gsm_link_status message - * - * @return RSSI as reported by modem (unconverted) - */ -static inline uint8_t mavlink_msg_gsm_link_status_get_rssi(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 10); -} - -/** - * @brief Get field rsrp_rscp from gsm_link_status message - * - * @return RSRP (LTE) or RSCP (WCDMA) as reported by modem (unconverted) - */ -static inline uint8_t mavlink_msg_gsm_link_status_get_rsrp_rscp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 11); -} - -/** - * @brief Get field sinr_ecio from gsm_link_status message - * - * @return SINR (LTE) or ECIO (WCDMA) as reported by modem (unconverted) - */ -static inline uint8_t mavlink_msg_gsm_link_status_get_sinr_ecio(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 12); -} - -/** - * @brief Get field rsrq from gsm_link_status message - * - * @return RSRQ (LTE only) as reported by modem (unconverted) - */ -static inline uint8_t mavlink_msg_gsm_link_status_get_rsrq(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 13); -} - -/** - * @brief Decode a gsm_link_status message into a struct - * - * @param msg The message to decode - * @param gsm_link_status C-struct to decode the message contents into - */ -static inline void mavlink_msg_gsm_link_status_decode(const mavlink_message_t* msg, mavlink_gsm_link_status_t* gsm_link_status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - gsm_link_status->timestamp = mavlink_msg_gsm_link_status_get_timestamp(msg); - gsm_link_status->gsm_modem_type = mavlink_msg_gsm_link_status_get_gsm_modem_type(msg); - gsm_link_status->gsm_link_type = mavlink_msg_gsm_link_status_get_gsm_link_type(msg); - gsm_link_status->rssi = mavlink_msg_gsm_link_status_get_rssi(msg); - gsm_link_status->rsrp_rscp = mavlink_msg_gsm_link_status_get_rsrp_rscp(msg); - gsm_link_status->sinr_ecio = mavlink_msg_gsm_link_status_get_sinr_ecio(msg); - gsm_link_status->rsrq = mavlink_msg_gsm_link_status_get_rsrq(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_GSM_LINK_STATUS_LEN? msg->len : MAVLINK_MSG_ID_GSM_LINK_STATUS_LEN; - memset(gsm_link_status, 0, MAVLINK_MSG_ID_GSM_LINK_STATUS_LEN); - memcpy(gsm_link_status, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ASLUAV/mavlink_msg_satcom_link_status.h b/ASLUAV/mavlink_msg_satcom_link_status.h deleted file mode 100644 index 29c4f52b4..000000000 --- a/ASLUAV/mavlink_msg_satcom_link_status.h +++ /dev/null @@ -1,388 +0,0 @@ -#pragma once -// MESSAGE SATCOM_LINK_STATUS PACKING - -#define MAVLINK_MSG_ID_SATCOM_LINK_STATUS 214 - - -typedef struct __mavlink_satcom_link_status_t { - uint64_t timestamp; /*< [us] Timestamp*/ - uint64_t last_heartbeat; /*< [us] Timestamp of the last successful sbd session*/ - uint16_t failed_sessions; /*< Number of failed sessions*/ - uint16_t successful_sessions; /*< Number of successful sessions*/ - uint8_t signal_quality; /*< Signal quality*/ - uint8_t ring_pending; /*< Ring call pending*/ - uint8_t tx_session_pending; /*< Transmission session pending*/ - uint8_t rx_session_pending; /*< Receiving session pending*/ -} mavlink_satcom_link_status_t; - -#define MAVLINK_MSG_ID_SATCOM_LINK_STATUS_LEN 24 -#define MAVLINK_MSG_ID_SATCOM_LINK_STATUS_MIN_LEN 24 -#define MAVLINK_MSG_ID_214_LEN 24 -#define MAVLINK_MSG_ID_214_MIN_LEN 24 - -#define MAVLINK_MSG_ID_SATCOM_LINK_STATUS_CRC 23 -#define MAVLINK_MSG_ID_214_CRC 23 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_SATCOM_LINK_STATUS { \ - 214, \ - "SATCOM_LINK_STATUS", \ - 8, \ - { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_satcom_link_status_t, timestamp) }, \ - { "last_heartbeat", NULL, MAVLINK_TYPE_UINT64_T, 0, 8, offsetof(mavlink_satcom_link_status_t, last_heartbeat) }, \ - { "failed_sessions", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_satcom_link_status_t, failed_sessions) }, \ - { "successful_sessions", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_satcom_link_status_t, successful_sessions) }, \ - { "signal_quality", NULL, MAVLINK_TYPE_UINT8_T, 0, 20, offsetof(mavlink_satcom_link_status_t, signal_quality) }, \ - { "ring_pending", NULL, MAVLINK_TYPE_UINT8_T, 0, 21, offsetof(mavlink_satcom_link_status_t, ring_pending) }, \ - { "tx_session_pending", NULL, MAVLINK_TYPE_UINT8_T, 0, 22, offsetof(mavlink_satcom_link_status_t, tx_session_pending) }, \ - { "rx_session_pending", NULL, MAVLINK_TYPE_UINT8_T, 0, 23, offsetof(mavlink_satcom_link_status_t, rx_session_pending) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_SATCOM_LINK_STATUS { \ - "SATCOM_LINK_STATUS", \ - 8, \ - { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_satcom_link_status_t, timestamp) }, \ - { "last_heartbeat", NULL, MAVLINK_TYPE_UINT64_T, 0, 8, offsetof(mavlink_satcom_link_status_t, last_heartbeat) }, \ - { "failed_sessions", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_satcom_link_status_t, failed_sessions) }, \ - { "successful_sessions", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_satcom_link_status_t, successful_sessions) }, \ - { "signal_quality", NULL, MAVLINK_TYPE_UINT8_T, 0, 20, offsetof(mavlink_satcom_link_status_t, signal_quality) }, \ - { "ring_pending", NULL, MAVLINK_TYPE_UINT8_T, 0, 21, offsetof(mavlink_satcom_link_status_t, ring_pending) }, \ - { "tx_session_pending", NULL, MAVLINK_TYPE_UINT8_T, 0, 22, offsetof(mavlink_satcom_link_status_t, tx_session_pending) }, \ - { "rx_session_pending", NULL, MAVLINK_TYPE_UINT8_T, 0, 23, offsetof(mavlink_satcom_link_status_t, rx_session_pending) }, \ - } \ -} -#endif - -/** - * @brief Pack a satcom_link_status message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param timestamp [us] Timestamp - * @param last_heartbeat [us] Timestamp of the last successful sbd session - * @param failed_sessions Number of failed sessions - * @param successful_sessions Number of successful sessions - * @param signal_quality Signal quality - * @param ring_pending Ring call pending - * @param tx_session_pending Transmission session pending - * @param rx_session_pending Receiving session pending - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_satcom_link_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint64_t timestamp, uint64_t last_heartbeat, uint16_t failed_sessions, uint16_t successful_sessions, uint8_t signal_quality, uint8_t ring_pending, uint8_t tx_session_pending, uint8_t rx_session_pending) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SATCOM_LINK_STATUS_LEN]; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_uint64_t(buf, 8, last_heartbeat); - _mav_put_uint16_t(buf, 16, failed_sessions); - _mav_put_uint16_t(buf, 18, successful_sessions); - _mav_put_uint8_t(buf, 20, signal_quality); - _mav_put_uint8_t(buf, 21, ring_pending); - _mav_put_uint8_t(buf, 22, tx_session_pending); - _mav_put_uint8_t(buf, 23, rx_session_pending); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SATCOM_LINK_STATUS_LEN); -#else - mavlink_satcom_link_status_t packet; - packet.timestamp = timestamp; - packet.last_heartbeat = last_heartbeat; - packet.failed_sessions = failed_sessions; - packet.successful_sessions = successful_sessions; - packet.signal_quality = signal_quality; - packet.ring_pending = ring_pending; - packet.tx_session_pending = tx_session_pending; - packet.rx_session_pending = rx_session_pending; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SATCOM_LINK_STATUS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SATCOM_LINK_STATUS; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SATCOM_LINK_STATUS_MIN_LEN, MAVLINK_MSG_ID_SATCOM_LINK_STATUS_LEN, MAVLINK_MSG_ID_SATCOM_LINK_STATUS_CRC); -} - -/** - * @brief Pack a satcom_link_status message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param timestamp [us] Timestamp - * @param last_heartbeat [us] Timestamp of the last successful sbd session - * @param failed_sessions Number of failed sessions - * @param successful_sessions Number of successful sessions - * @param signal_quality Signal quality - * @param ring_pending Ring call pending - * @param tx_session_pending Transmission session pending - * @param rx_session_pending Receiving session pending - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_satcom_link_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint64_t timestamp,uint64_t last_heartbeat,uint16_t failed_sessions,uint16_t successful_sessions,uint8_t signal_quality,uint8_t ring_pending,uint8_t tx_session_pending,uint8_t rx_session_pending) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SATCOM_LINK_STATUS_LEN]; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_uint64_t(buf, 8, last_heartbeat); - _mav_put_uint16_t(buf, 16, failed_sessions); - _mav_put_uint16_t(buf, 18, successful_sessions); - _mav_put_uint8_t(buf, 20, signal_quality); - _mav_put_uint8_t(buf, 21, ring_pending); - _mav_put_uint8_t(buf, 22, tx_session_pending); - _mav_put_uint8_t(buf, 23, rx_session_pending); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SATCOM_LINK_STATUS_LEN); -#else - mavlink_satcom_link_status_t packet; - packet.timestamp = timestamp; - packet.last_heartbeat = last_heartbeat; - packet.failed_sessions = failed_sessions; - packet.successful_sessions = successful_sessions; - packet.signal_quality = signal_quality; - packet.ring_pending = ring_pending; - packet.tx_session_pending = tx_session_pending; - packet.rx_session_pending = rx_session_pending; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SATCOM_LINK_STATUS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SATCOM_LINK_STATUS; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SATCOM_LINK_STATUS_MIN_LEN, MAVLINK_MSG_ID_SATCOM_LINK_STATUS_LEN, MAVLINK_MSG_ID_SATCOM_LINK_STATUS_CRC); -} - -/** - * @brief Encode a satcom_link_status struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param satcom_link_status C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_satcom_link_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_satcom_link_status_t* satcom_link_status) -{ - return mavlink_msg_satcom_link_status_pack(system_id, component_id, msg, satcom_link_status->timestamp, satcom_link_status->last_heartbeat, satcom_link_status->failed_sessions, satcom_link_status->successful_sessions, satcom_link_status->signal_quality, satcom_link_status->ring_pending, satcom_link_status->tx_session_pending, satcom_link_status->rx_session_pending); -} - -/** - * @brief Encode a satcom_link_status struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param satcom_link_status C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_satcom_link_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_satcom_link_status_t* satcom_link_status) -{ - return mavlink_msg_satcom_link_status_pack_chan(system_id, component_id, chan, msg, satcom_link_status->timestamp, satcom_link_status->last_heartbeat, satcom_link_status->failed_sessions, satcom_link_status->successful_sessions, satcom_link_status->signal_quality, satcom_link_status->ring_pending, satcom_link_status->tx_session_pending, satcom_link_status->rx_session_pending); -} - -/** - * @brief Send a satcom_link_status message - * @param chan MAVLink channel to send the message - * - * @param timestamp [us] Timestamp - * @param last_heartbeat [us] Timestamp of the last successful sbd session - * @param failed_sessions Number of failed sessions - * @param successful_sessions Number of successful sessions - * @param signal_quality Signal quality - * @param ring_pending Ring call pending - * @param tx_session_pending Transmission session pending - * @param rx_session_pending Receiving session pending - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_satcom_link_status_send(mavlink_channel_t chan, uint64_t timestamp, uint64_t last_heartbeat, uint16_t failed_sessions, uint16_t successful_sessions, uint8_t signal_quality, uint8_t ring_pending, uint8_t tx_session_pending, uint8_t rx_session_pending) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SATCOM_LINK_STATUS_LEN]; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_uint64_t(buf, 8, last_heartbeat); - _mav_put_uint16_t(buf, 16, failed_sessions); - _mav_put_uint16_t(buf, 18, successful_sessions); - _mav_put_uint8_t(buf, 20, signal_quality); - _mav_put_uint8_t(buf, 21, ring_pending); - _mav_put_uint8_t(buf, 22, tx_session_pending); - _mav_put_uint8_t(buf, 23, rx_session_pending); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SATCOM_LINK_STATUS, buf, MAVLINK_MSG_ID_SATCOM_LINK_STATUS_MIN_LEN, MAVLINK_MSG_ID_SATCOM_LINK_STATUS_LEN, MAVLINK_MSG_ID_SATCOM_LINK_STATUS_CRC); -#else - mavlink_satcom_link_status_t packet; - packet.timestamp = timestamp; - packet.last_heartbeat = last_heartbeat; - packet.failed_sessions = failed_sessions; - packet.successful_sessions = successful_sessions; - packet.signal_quality = signal_quality; - packet.ring_pending = ring_pending; - packet.tx_session_pending = tx_session_pending; - packet.rx_session_pending = rx_session_pending; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SATCOM_LINK_STATUS, (const char *)&packet, MAVLINK_MSG_ID_SATCOM_LINK_STATUS_MIN_LEN, MAVLINK_MSG_ID_SATCOM_LINK_STATUS_LEN, MAVLINK_MSG_ID_SATCOM_LINK_STATUS_CRC); -#endif -} - -/** - * @brief Send a satcom_link_status message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_satcom_link_status_send_struct(mavlink_channel_t chan, const mavlink_satcom_link_status_t* satcom_link_status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_satcom_link_status_send(chan, satcom_link_status->timestamp, satcom_link_status->last_heartbeat, satcom_link_status->failed_sessions, satcom_link_status->successful_sessions, satcom_link_status->signal_quality, satcom_link_status->ring_pending, satcom_link_status->tx_session_pending, satcom_link_status->rx_session_pending); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SATCOM_LINK_STATUS, (const char *)satcom_link_status, MAVLINK_MSG_ID_SATCOM_LINK_STATUS_MIN_LEN, MAVLINK_MSG_ID_SATCOM_LINK_STATUS_LEN, MAVLINK_MSG_ID_SATCOM_LINK_STATUS_CRC); -#endif -} - -#if MAVLINK_MSG_ID_SATCOM_LINK_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_satcom_link_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t timestamp, uint64_t last_heartbeat, uint16_t failed_sessions, uint16_t successful_sessions, uint8_t signal_quality, uint8_t ring_pending, uint8_t tx_session_pending, uint8_t rx_session_pending) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_uint64_t(buf, 8, last_heartbeat); - _mav_put_uint16_t(buf, 16, failed_sessions); - _mav_put_uint16_t(buf, 18, successful_sessions); - _mav_put_uint8_t(buf, 20, signal_quality); - _mav_put_uint8_t(buf, 21, ring_pending); - _mav_put_uint8_t(buf, 22, tx_session_pending); - _mav_put_uint8_t(buf, 23, rx_session_pending); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SATCOM_LINK_STATUS, buf, MAVLINK_MSG_ID_SATCOM_LINK_STATUS_MIN_LEN, MAVLINK_MSG_ID_SATCOM_LINK_STATUS_LEN, MAVLINK_MSG_ID_SATCOM_LINK_STATUS_CRC); -#else - mavlink_satcom_link_status_t *packet = (mavlink_satcom_link_status_t *)msgbuf; - packet->timestamp = timestamp; - packet->last_heartbeat = last_heartbeat; - packet->failed_sessions = failed_sessions; - packet->successful_sessions = successful_sessions; - packet->signal_quality = signal_quality; - packet->ring_pending = ring_pending; - packet->tx_session_pending = tx_session_pending; - packet->rx_session_pending = rx_session_pending; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SATCOM_LINK_STATUS, (const char *)packet, MAVLINK_MSG_ID_SATCOM_LINK_STATUS_MIN_LEN, MAVLINK_MSG_ID_SATCOM_LINK_STATUS_LEN, MAVLINK_MSG_ID_SATCOM_LINK_STATUS_CRC); -#endif -} -#endif - -#endif - -// MESSAGE SATCOM_LINK_STATUS UNPACKING - - -/** - * @brief Get field timestamp from satcom_link_status message - * - * @return [us] Timestamp - */ -static inline uint64_t mavlink_msg_satcom_link_status_get_timestamp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint64_t(msg, 0); -} - -/** - * @brief Get field last_heartbeat from satcom_link_status message - * - * @return [us] Timestamp of the last successful sbd session - */ -static inline uint64_t mavlink_msg_satcom_link_status_get_last_heartbeat(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint64_t(msg, 8); -} - -/** - * @brief Get field failed_sessions from satcom_link_status message - * - * @return Number of failed sessions - */ -static inline uint16_t mavlink_msg_satcom_link_status_get_failed_sessions(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 16); -} - -/** - * @brief Get field successful_sessions from satcom_link_status message - * - * @return Number of successful sessions - */ -static inline uint16_t mavlink_msg_satcom_link_status_get_successful_sessions(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 18); -} - -/** - * @brief Get field signal_quality from satcom_link_status message - * - * @return Signal quality - */ -static inline uint8_t mavlink_msg_satcom_link_status_get_signal_quality(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 20); -} - -/** - * @brief Get field ring_pending from satcom_link_status message - * - * @return Ring call pending - */ -static inline uint8_t mavlink_msg_satcom_link_status_get_ring_pending(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 21); -} - -/** - * @brief Get field tx_session_pending from satcom_link_status message - * - * @return Transmission session pending - */ -static inline uint8_t mavlink_msg_satcom_link_status_get_tx_session_pending(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 22); -} - -/** - * @brief Get field rx_session_pending from satcom_link_status message - * - * @return Receiving session pending - */ -static inline uint8_t mavlink_msg_satcom_link_status_get_rx_session_pending(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 23); -} - -/** - * @brief Decode a satcom_link_status message into a struct - * - * @param msg The message to decode - * @param satcom_link_status C-struct to decode the message contents into - */ -static inline void mavlink_msg_satcom_link_status_decode(const mavlink_message_t* msg, mavlink_satcom_link_status_t* satcom_link_status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - satcom_link_status->timestamp = mavlink_msg_satcom_link_status_get_timestamp(msg); - satcom_link_status->last_heartbeat = mavlink_msg_satcom_link_status_get_last_heartbeat(msg); - satcom_link_status->failed_sessions = mavlink_msg_satcom_link_status_get_failed_sessions(msg); - satcom_link_status->successful_sessions = mavlink_msg_satcom_link_status_get_successful_sessions(msg); - satcom_link_status->signal_quality = mavlink_msg_satcom_link_status_get_signal_quality(msg); - satcom_link_status->ring_pending = mavlink_msg_satcom_link_status_get_ring_pending(msg); - satcom_link_status->tx_session_pending = mavlink_msg_satcom_link_status_get_tx_session_pending(msg); - satcom_link_status->rx_session_pending = mavlink_msg_satcom_link_status_get_rx_session_pending(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_SATCOM_LINK_STATUS_LEN? msg->len : MAVLINK_MSG_ID_SATCOM_LINK_STATUS_LEN; - memset(satcom_link_status, 0, MAVLINK_MSG_ID_SATCOM_LINK_STATUS_LEN); - memcpy(satcom_link_status, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ASLUAV/mavlink_msg_sens_atmos.h b/ASLUAV/mavlink_msg_sens_atmos.h deleted file mode 100644 index c07c47e26..000000000 --- a/ASLUAV/mavlink_msg_sens_atmos.h +++ /dev/null @@ -1,263 +0,0 @@ -#pragma once -// MESSAGE SENS_ATMOS PACKING - -#define MAVLINK_MSG_ID_SENS_ATMOS 208 - - -typedef struct __mavlink_sens_atmos_t { - uint64_t timestamp; /*< [us] Time since system boot*/ - float TempAmbient; /*< [degC] Ambient temperature*/ - float Humidity; /*< [%] Relative humidity*/ -} mavlink_sens_atmos_t; - -#define MAVLINK_MSG_ID_SENS_ATMOS_LEN 16 -#define MAVLINK_MSG_ID_SENS_ATMOS_MIN_LEN 16 -#define MAVLINK_MSG_ID_208_LEN 16 -#define MAVLINK_MSG_ID_208_MIN_LEN 16 - -#define MAVLINK_MSG_ID_SENS_ATMOS_CRC 144 -#define MAVLINK_MSG_ID_208_CRC 144 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_SENS_ATMOS { \ - 208, \ - "SENS_ATMOS", \ - 3, \ - { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_sens_atmos_t, timestamp) }, \ - { "TempAmbient", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_sens_atmos_t, TempAmbient) }, \ - { "Humidity", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_sens_atmos_t, Humidity) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_SENS_ATMOS { \ - "SENS_ATMOS", \ - 3, \ - { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_sens_atmos_t, timestamp) }, \ - { "TempAmbient", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_sens_atmos_t, TempAmbient) }, \ - { "Humidity", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_sens_atmos_t, Humidity) }, \ - } \ -} -#endif - -/** - * @brief Pack a sens_atmos message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param timestamp [us] Time since system boot - * @param TempAmbient [degC] Ambient temperature - * @param Humidity [%] Relative humidity - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_sens_atmos_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint64_t timestamp, float TempAmbient, float Humidity) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SENS_ATMOS_LEN]; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_float(buf, 8, TempAmbient); - _mav_put_float(buf, 12, Humidity); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SENS_ATMOS_LEN); -#else - mavlink_sens_atmos_t packet; - packet.timestamp = timestamp; - packet.TempAmbient = TempAmbient; - packet.Humidity = Humidity; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SENS_ATMOS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SENS_ATMOS; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SENS_ATMOS_MIN_LEN, MAVLINK_MSG_ID_SENS_ATMOS_LEN, MAVLINK_MSG_ID_SENS_ATMOS_CRC); -} - -/** - * @brief Pack a sens_atmos message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param timestamp [us] Time since system boot - * @param TempAmbient [degC] Ambient temperature - * @param Humidity [%] Relative humidity - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_sens_atmos_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint64_t timestamp,float TempAmbient,float Humidity) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SENS_ATMOS_LEN]; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_float(buf, 8, TempAmbient); - _mav_put_float(buf, 12, Humidity); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SENS_ATMOS_LEN); -#else - mavlink_sens_atmos_t packet; - packet.timestamp = timestamp; - packet.TempAmbient = TempAmbient; - packet.Humidity = Humidity; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SENS_ATMOS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SENS_ATMOS; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SENS_ATMOS_MIN_LEN, MAVLINK_MSG_ID_SENS_ATMOS_LEN, MAVLINK_MSG_ID_SENS_ATMOS_CRC); -} - -/** - * @brief Encode a sens_atmos struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param sens_atmos C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_sens_atmos_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_sens_atmos_t* sens_atmos) -{ - return mavlink_msg_sens_atmos_pack(system_id, component_id, msg, sens_atmos->timestamp, sens_atmos->TempAmbient, sens_atmos->Humidity); -} - -/** - * @brief Encode a sens_atmos struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param sens_atmos C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_sens_atmos_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_sens_atmos_t* sens_atmos) -{ - return mavlink_msg_sens_atmos_pack_chan(system_id, component_id, chan, msg, sens_atmos->timestamp, sens_atmos->TempAmbient, sens_atmos->Humidity); -} - -/** - * @brief Send a sens_atmos message - * @param chan MAVLink channel to send the message - * - * @param timestamp [us] Time since system boot - * @param TempAmbient [degC] Ambient temperature - * @param Humidity [%] Relative humidity - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_sens_atmos_send(mavlink_channel_t chan, uint64_t timestamp, float TempAmbient, float Humidity) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SENS_ATMOS_LEN]; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_float(buf, 8, TempAmbient); - _mav_put_float(buf, 12, Humidity); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_ATMOS, buf, MAVLINK_MSG_ID_SENS_ATMOS_MIN_LEN, MAVLINK_MSG_ID_SENS_ATMOS_LEN, MAVLINK_MSG_ID_SENS_ATMOS_CRC); -#else - mavlink_sens_atmos_t packet; - packet.timestamp = timestamp; - packet.TempAmbient = TempAmbient; - packet.Humidity = Humidity; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_ATMOS, (const char *)&packet, MAVLINK_MSG_ID_SENS_ATMOS_MIN_LEN, MAVLINK_MSG_ID_SENS_ATMOS_LEN, MAVLINK_MSG_ID_SENS_ATMOS_CRC); -#endif -} - -/** - * @brief Send a sens_atmos message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_sens_atmos_send_struct(mavlink_channel_t chan, const mavlink_sens_atmos_t* sens_atmos) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_sens_atmos_send(chan, sens_atmos->timestamp, sens_atmos->TempAmbient, sens_atmos->Humidity); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_ATMOS, (const char *)sens_atmos, MAVLINK_MSG_ID_SENS_ATMOS_MIN_LEN, MAVLINK_MSG_ID_SENS_ATMOS_LEN, MAVLINK_MSG_ID_SENS_ATMOS_CRC); -#endif -} - -#if MAVLINK_MSG_ID_SENS_ATMOS_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_sens_atmos_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t timestamp, float TempAmbient, float Humidity) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_float(buf, 8, TempAmbient); - _mav_put_float(buf, 12, Humidity); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_ATMOS, buf, MAVLINK_MSG_ID_SENS_ATMOS_MIN_LEN, MAVLINK_MSG_ID_SENS_ATMOS_LEN, MAVLINK_MSG_ID_SENS_ATMOS_CRC); -#else - mavlink_sens_atmos_t *packet = (mavlink_sens_atmos_t *)msgbuf; - packet->timestamp = timestamp; - packet->TempAmbient = TempAmbient; - packet->Humidity = Humidity; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_ATMOS, (const char *)packet, MAVLINK_MSG_ID_SENS_ATMOS_MIN_LEN, MAVLINK_MSG_ID_SENS_ATMOS_LEN, MAVLINK_MSG_ID_SENS_ATMOS_CRC); -#endif -} -#endif - -#endif - -// MESSAGE SENS_ATMOS UNPACKING - - -/** - * @brief Get field timestamp from sens_atmos message - * - * @return [us] Time since system boot - */ -static inline uint64_t mavlink_msg_sens_atmos_get_timestamp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint64_t(msg, 0); -} - -/** - * @brief Get field TempAmbient from sens_atmos message - * - * @return [degC] Ambient temperature - */ -static inline float mavlink_msg_sens_atmos_get_TempAmbient(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field Humidity from sens_atmos message - * - * @return [%] Relative humidity - */ -static inline float mavlink_msg_sens_atmos_get_Humidity(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Decode a sens_atmos message into a struct - * - * @param msg The message to decode - * @param sens_atmos C-struct to decode the message contents into - */ -static inline void mavlink_msg_sens_atmos_decode(const mavlink_message_t* msg, mavlink_sens_atmos_t* sens_atmos) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - sens_atmos->timestamp = mavlink_msg_sens_atmos_get_timestamp(msg); - sens_atmos->TempAmbient = mavlink_msg_sens_atmos_get_TempAmbient(msg); - sens_atmos->Humidity = mavlink_msg_sens_atmos_get_Humidity(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_SENS_ATMOS_LEN? msg->len : MAVLINK_MSG_ID_SENS_ATMOS_LEN; - memset(sens_atmos, 0, MAVLINK_MSG_ID_SENS_ATMOS_LEN); - memcpy(sens_atmos, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ASLUAV/mavlink_msg_sens_batmon.h b/ASLUAV/mavlink_msg_sens_batmon.h deleted file mode 100644 index 485af19b3..000000000 --- a/ASLUAV/mavlink_msg_sens_batmon.h +++ /dev/null @@ -1,563 +0,0 @@ -#pragma once -// MESSAGE SENS_BATMON PACKING - -#define MAVLINK_MSG_ID_SENS_BATMON 209 - - -typedef struct __mavlink_sens_batmon_t { - uint64_t batmon_timestamp; /*< [us] Time since system start*/ - float temperature; /*< [degC] Battery pack temperature*/ - uint32_t safetystatus; /*< Battery monitor safetystatus report bits in Hex*/ - uint32_t operationstatus; /*< Battery monitor operation status report bits in Hex*/ - uint16_t voltage; /*< [mV] Battery pack voltage*/ - int16_t current; /*< [mA] Battery pack current*/ - uint16_t batterystatus; /*< Battery monitor status report bits in Hex*/ - uint16_t serialnumber; /*< Battery monitor serial number in Hex*/ - uint16_t cellvoltage1; /*< [mV] Battery pack cell 1 voltage*/ - uint16_t cellvoltage2; /*< [mV] Battery pack cell 2 voltage*/ - uint16_t cellvoltage3; /*< [mV] Battery pack cell 3 voltage*/ - uint16_t cellvoltage4; /*< [mV] Battery pack cell 4 voltage*/ - uint16_t cellvoltage5; /*< [mV] Battery pack cell 5 voltage*/ - uint16_t cellvoltage6; /*< [mV] Battery pack cell 6 voltage*/ - uint8_t SoC; /*< Battery pack state-of-charge*/ -} mavlink_sens_batmon_t; - -#define MAVLINK_MSG_ID_SENS_BATMON_LEN 41 -#define MAVLINK_MSG_ID_SENS_BATMON_MIN_LEN 41 -#define MAVLINK_MSG_ID_209_LEN 41 -#define MAVLINK_MSG_ID_209_MIN_LEN 41 - -#define MAVLINK_MSG_ID_SENS_BATMON_CRC 155 -#define MAVLINK_MSG_ID_209_CRC 155 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_SENS_BATMON { \ - 209, \ - "SENS_BATMON", \ - 15, \ - { { "batmon_timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_sens_batmon_t, batmon_timestamp) }, \ - { "temperature", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_sens_batmon_t, temperature) }, \ - { "voltage", NULL, MAVLINK_TYPE_UINT16_T, 0, 20, offsetof(mavlink_sens_batmon_t, voltage) }, \ - { "current", NULL, MAVLINK_TYPE_INT16_T, 0, 22, offsetof(mavlink_sens_batmon_t, current) }, \ - { "SoC", NULL, MAVLINK_TYPE_UINT8_T, 0, 40, offsetof(mavlink_sens_batmon_t, SoC) }, \ - { "batterystatus", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_sens_batmon_t, batterystatus) }, \ - { "serialnumber", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_sens_batmon_t, serialnumber) }, \ - { "safetystatus", NULL, MAVLINK_TYPE_UINT32_T, 0, 12, offsetof(mavlink_sens_batmon_t, safetystatus) }, \ - { "operationstatus", NULL, MAVLINK_TYPE_UINT32_T, 0, 16, offsetof(mavlink_sens_batmon_t, operationstatus) }, \ - { "cellvoltage1", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_sens_batmon_t, cellvoltage1) }, \ - { "cellvoltage2", NULL, MAVLINK_TYPE_UINT16_T, 0, 30, offsetof(mavlink_sens_batmon_t, cellvoltage2) }, \ - { "cellvoltage3", NULL, MAVLINK_TYPE_UINT16_T, 0, 32, offsetof(mavlink_sens_batmon_t, cellvoltage3) }, \ - { "cellvoltage4", NULL, MAVLINK_TYPE_UINT16_T, 0, 34, offsetof(mavlink_sens_batmon_t, cellvoltage4) }, \ - { "cellvoltage5", NULL, MAVLINK_TYPE_UINT16_T, 0, 36, offsetof(mavlink_sens_batmon_t, cellvoltage5) }, \ - { "cellvoltage6", NULL, MAVLINK_TYPE_UINT16_T, 0, 38, offsetof(mavlink_sens_batmon_t, cellvoltage6) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_SENS_BATMON { \ - "SENS_BATMON", \ - 15, \ - { { "batmon_timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_sens_batmon_t, batmon_timestamp) }, \ - { "temperature", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_sens_batmon_t, temperature) }, \ - { "voltage", NULL, MAVLINK_TYPE_UINT16_T, 0, 20, offsetof(mavlink_sens_batmon_t, voltage) }, \ - { "current", NULL, MAVLINK_TYPE_INT16_T, 0, 22, offsetof(mavlink_sens_batmon_t, current) }, \ - { "SoC", NULL, MAVLINK_TYPE_UINT8_T, 0, 40, offsetof(mavlink_sens_batmon_t, SoC) }, \ - { "batterystatus", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_sens_batmon_t, batterystatus) }, \ - { "serialnumber", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_sens_batmon_t, serialnumber) }, \ - { "safetystatus", NULL, MAVLINK_TYPE_UINT32_T, 0, 12, offsetof(mavlink_sens_batmon_t, safetystatus) }, \ - { "operationstatus", NULL, MAVLINK_TYPE_UINT32_T, 0, 16, offsetof(mavlink_sens_batmon_t, operationstatus) }, \ - { "cellvoltage1", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_sens_batmon_t, cellvoltage1) }, \ - { "cellvoltage2", NULL, MAVLINK_TYPE_UINT16_T, 0, 30, offsetof(mavlink_sens_batmon_t, cellvoltage2) }, \ - { "cellvoltage3", NULL, MAVLINK_TYPE_UINT16_T, 0, 32, offsetof(mavlink_sens_batmon_t, cellvoltage3) }, \ - { "cellvoltage4", NULL, MAVLINK_TYPE_UINT16_T, 0, 34, offsetof(mavlink_sens_batmon_t, cellvoltage4) }, \ - { "cellvoltage5", NULL, MAVLINK_TYPE_UINT16_T, 0, 36, offsetof(mavlink_sens_batmon_t, cellvoltage5) }, \ - { "cellvoltage6", NULL, MAVLINK_TYPE_UINT16_T, 0, 38, offsetof(mavlink_sens_batmon_t, cellvoltage6) }, \ - } \ -} -#endif - -/** - * @brief Pack a sens_batmon message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param batmon_timestamp [us] Time since system start - * @param temperature [degC] Battery pack temperature - * @param voltage [mV] Battery pack voltage - * @param current [mA] Battery pack current - * @param SoC Battery pack state-of-charge - * @param batterystatus Battery monitor status report bits in Hex - * @param serialnumber Battery monitor serial number in Hex - * @param safetystatus Battery monitor safetystatus report bits in Hex - * @param operationstatus Battery monitor operation status report bits in Hex - * @param cellvoltage1 [mV] Battery pack cell 1 voltage - * @param cellvoltage2 [mV] Battery pack cell 2 voltage - * @param cellvoltage3 [mV] Battery pack cell 3 voltage - * @param cellvoltage4 [mV] Battery pack cell 4 voltage - * @param cellvoltage5 [mV] Battery pack cell 5 voltage - * @param cellvoltage6 [mV] Battery pack cell 6 voltage - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_sens_batmon_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint64_t batmon_timestamp, float temperature, uint16_t voltage, int16_t current, uint8_t SoC, uint16_t batterystatus, uint16_t serialnumber, uint32_t safetystatus, uint32_t operationstatus, uint16_t cellvoltage1, uint16_t cellvoltage2, uint16_t cellvoltage3, uint16_t cellvoltage4, uint16_t cellvoltage5, uint16_t cellvoltage6) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SENS_BATMON_LEN]; - _mav_put_uint64_t(buf, 0, batmon_timestamp); - _mav_put_float(buf, 8, temperature); - _mav_put_uint32_t(buf, 12, safetystatus); - _mav_put_uint32_t(buf, 16, operationstatus); - _mav_put_uint16_t(buf, 20, voltage); - _mav_put_int16_t(buf, 22, current); - _mav_put_uint16_t(buf, 24, batterystatus); - _mav_put_uint16_t(buf, 26, serialnumber); - _mav_put_uint16_t(buf, 28, cellvoltage1); - _mav_put_uint16_t(buf, 30, cellvoltage2); - _mav_put_uint16_t(buf, 32, cellvoltage3); - _mav_put_uint16_t(buf, 34, cellvoltage4); - _mav_put_uint16_t(buf, 36, cellvoltage5); - _mav_put_uint16_t(buf, 38, cellvoltage6); - _mav_put_uint8_t(buf, 40, SoC); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SENS_BATMON_LEN); -#else - mavlink_sens_batmon_t packet; - packet.batmon_timestamp = batmon_timestamp; - packet.temperature = temperature; - packet.safetystatus = safetystatus; - packet.operationstatus = operationstatus; - packet.voltage = voltage; - packet.current = current; - packet.batterystatus = batterystatus; - packet.serialnumber = serialnumber; - packet.cellvoltage1 = cellvoltage1; - packet.cellvoltage2 = cellvoltage2; - packet.cellvoltage3 = cellvoltage3; - packet.cellvoltage4 = cellvoltage4; - packet.cellvoltage5 = cellvoltage5; - packet.cellvoltage6 = cellvoltage6; - packet.SoC = SoC; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SENS_BATMON_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SENS_BATMON; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SENS_BATMON_MIN_LEN, MAVLINK_MSG_ID_SENS_BATMON_LEN, MAVLINK_MSG_ID_SENS_BATMON_CRC); -} - -/** - * @brief Pack a sens_batmon message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param batmon_timestamp [us] Time since system start - * @param temperature [degC] Battery pack temperature - * @param voltage [mV] Battery pack voltage - * @param current [mA] Battery pack current - * @param SoC Battery pack state-of-charge - * @param batterystatus Battery monitor status report bits in Hex - * @param serialnumber Battery monitor serial number in Hex - * @param safetystatus Battery monitor safetystatus report bits in Hex - * @param operationstatus Battery monitor operation status report bits in Hex - * @param cellvoltage1 [mV] Battery pack cell 1 voltage - * @param cellvoltage2 [mV] Battery pack cell 2 voltage - * @param cellvoltage3 [mV] Battery pack cell 3 voltage - * @param cellvoltage4 [mV] Battery pack cell 4 voltage - * @param cellvoltage5 [mV] Battery pack cell 5 voltage - * @param cellvoltage6 [mV] Battery pack cell 6 voltage - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_sens_batmon_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint64_t batmon_timestamp,float temperature,uint16_t voltage,int16_t current,uint8_t SoC,uint16_t batterystatus,uint16_t serialnumber,uint32_t safetystatus,uint32_t operationstatus,uint16_t cellvoltage1,uint16_t cellvoltage2,uint16_t cellvoltage3,uint16_t cellvoltage4,uint16_t cellvoltage5,uint16_t cellvoltage6) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SENS_BATMON_LEN]; - _mav_put_uint64_t(buf, 0, batmon_timestamp); - _mav_put_float(buf, 8, temperature); - _mav_put_uint32_t(buf, 12, safetystatus); - _mav_put_uint32_t(buf, 16, operationstatus); - _mav_put_uint16_t(buf, 20, voltage); - _mav_put_int16_t(buf, 22, current); - _mav_put_uint16_t(buf, 24, batterystatus); - _mav_put_uint16_t(buf, 26, serialnumber); - _mav_put_uint16_t(buf, 28, cellvoltage1); - _mav_put_uint16_t(buf, 30, cellvoltage2); - _mav_put_uint16_t(buf, 32, cellvoltage3); - _mav_put_uint16_t(buf, 34, cellvoltage4); - _mav_put_uint16_t(buf, 36, cellvoltage5); - _mav_put_uint16_t(buf, 38, cellvoltage6); - _mav_put_uint8_t(buf, 40, SoC); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SENS_BATMON_LEN); -#else - mavlink_sens_batmon_t packet; - packet.batmon_timestamp = batmon_timestamp; - packet.temperature = temperature; - packet.safetystatus = safetystatus; - packet.operationstatus = operationstatus; - packet.voltage = voltage; - packet.current = current; - packet.batterystatus = batterystatus; - packet.serialnumber = serialnumber; - packet.cellvoltage1 = cellvoltage1; - packet.cellvoltage2 = cellvoltage2; - packet.cellvoltage3 = cellvoltage3; - packet.cellvoltage4 = cellvoltage4; - packet.cellvoltage5 = cellvoltage5; - packet.cellvoltage6 = cellvoltage6; - packet.SoC = SoC; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SENS_BATMON_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SENS_BATMON; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SENS_BATMON_MIN_LEN, MAVLINK_MSG_ID_SENS_BATMON_LEN, MAVLINK_MSG_ID_SENS_BATMON_CRC); -} - -/** - * @brief Encode a sens_batmon struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param sens_batmon C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_sens_batmon_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_sens_batmon_t* sens_batmon) -{ - return mavlink_msg_sens_batmon_pack(system_id, component_id, msg, sens_batmon->batmon_timestamp, sens_batmon->temperature, sens_batmon->voltage, sens_batmon->current, sens_batmon->SoC, sens_batmon->batterystatus, sens_batmon->serialnumber, sens_batmon->safetystatus, sens_batmon->operationstatus, sens_batmon->cellvoltage1, sens_batmon->cellvoltage2, sens_batmon->cellvoltage3, sens_batmon->cellvoltage4, sens_batmon->cellvoltage5, sens_batmon->cellvoltage6); -} - -/** - * @brief Encode a sens_batmon struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param sens_batmon C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_sens_batmon_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_sens_batmon_t* sens_batmon) -{ - return mavlink_msg_sens_batmon_pack_chan(system_id, component_id, chan, msg, sens_batmon->batmon_timestamp, sens_batmon->temperature, sens_batmon->voltage, sens_batmon->current, sens_batmon->SoC, sens_batmon->batterystatus, sens_batmon->serialnumber, sens_batmon->safetystatus, sens_batmon->operationstatus, sens_batmon->cellvoltage1, sens_batmon->cellvoltage2, sens_batmon->cellvoltage3, sens_batmon->cellvoltage4, sens_batmon->cellvoltage5, sens_batmon->cellvoltage6); -} - -/** - * @brief Send a sens_batmon message - * @param chan MAVLink channel to send the message - * - * @param batmon_timestamp [us] Time since system start - * @param temperature [degC] Battery pack temperature - * @param voltage [mV] Battery pack voltage - * @param current [mA] Battery pack current - * @param SoC Battery pack state-of-charge - * @param batterystatus Battery monitor status report bits in Hex - * @param serialnumber Battery monitor serial number in Hex - * @param safetystatus Battery monitor safetystatus report bits in Hex - * @param operationstatus Battery monitor operation status report bits in Hex - * @param cellvoltage1 [mV] Battery pack cell 1 voltage - * @param cellvoltage2 [mV] Battery pack cell 2 voltage - * @param cellvoltage3 [mV] Battery pack cell 3 voltage - * @param cellvoltage4 [mV] Battery pack cell 4 voltage - * @param cellvoltage5 [mV] Battery pack cell 5 voltage - * @param cellvoltage6 [mV] Battery pack cell 6 voltage - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_sens_batmon_send(mavlink_channel_t chan, uint64_t batmon_timestamp, float temperature, uint16_t voltage, int16_t current, uint8_t SoC, uint16_t batterystatus, uint16_t serialnumber, uint32_t safetystatus, uint32_t operationstatus, uint16_t cellvoltage1, uint16_t cellvoltage2, uint16_t cellvoltage3, uint16_t cellvoltage4, uint16_t cellvoltage5, uint16_t cellvoltage6) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SENS_BATMON_LEN]; - _mav_put_uint64_t(buf, 0, batmon_timestamp); - _mav_put_float(buf, 8, temperature); - _mav_put_uint32_t(buf, 12, safetystatus); - _mav_put_uint32_t(buf, 16, operationstatus); - _mav_put_uint16_t(buf, 20, voltage); - _mav_put_int16_t(buf, 22, current); - _mav_put_uint16_t(buf, 24, batterystatus); - _mav_put_uint16_t(buf, 26, serialnumber); - _mav_put_uint16_t(buf, 28, cellvoltage1); - _mav_put_uint16_t(buf, 30, cellvoltage2); - _mav_put_uint16_t(buf, 32, cellvoltage3); - _mav_put_uint16_t(buf, 34, cellvoltage4); - _mav_put_uint16_t(buf, 36, cellvoltage5); - _mav_put_uint16_t(buf, 38, cellvoltage6); - _mav_put_uint8_t(buf, 40, SoC); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_BATMON, buf, MAVLINK_MSG_ID_SENS_BATMON_MIN_LEN, MAVLINK_MSG_ID_SENS_BATMON_LEN, MAVLINK_MSG_ID_SENS_BATMON_CRC); -#else - mavlink_sens_batmon_t packet; - packet.batmon_timestamp = batmon_timestamp; - packet.temperature = temperature; - packet.safetystatus = safetystatus; - packet.operationstatus = operationstatus; - packet.voltage = voltage; - packet.current = current; - packet.batterystatus = batterystatus; - packet.serialnumber = serialnumber; - packet.cellvoltage1 = cellvoltage1; - packet.cellvoltage2 = cellvoltage2; - packet.cellvoltage3 = cellvoltage3; - packet.cellvoltage4 = cellvoltage4; - packet.cellvoltage5 = cellvoltage5; - packet.cellvoltage6 = cellvoltage6; - packet.SoC = SoC; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_BATMON, (const char *)&packet, MAVLINK_MSG_ID_SENS_BATMON_MIN_LEN, MAVLINK_MSG_ID_SENS_BATMON_LEN, MAVLINK_MSG_ID_SENS_BATMON_CRC); -#endif -} - -/** - * @brief Send a sens_batmon message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_sens_batmon_send_struct(mavlink_channel_t chan, const mavlink_sens_batmon_t* sens_batmon) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_sens_batmon_send(chan, sens_batmon->batmon_timestamp, sens_batmon->temperature, sens_batmon->voltage, sens_batmon->current, sens_batmon->SoC, sens_batmon->batterystatus, sens_batmon->serialnumber, sens_batmon->safetystatus, sens_batmon->operationstatus, sens_batmon->cellvoltage1, sens_batmon->cellvoltage2, sens_batmon->cellvoltage3, sens_batmon->cellvoltage4, sens_batmon->cellvoltage5, sens_batmon->cellvoltage6); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_BATMON, (const char *)sens_batmon, MAVLINK_MSG_ID_SENS_BATMON_MIN_LEN, MAVLINK_MSG_ID_SENS_BATMON_LEN, MAVLINK_MSG_ID_SENS_BATMON_CRC); -#endif -} - -#if MAVLINK_MSG_ID_SENS_BATMON_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_sens_batmon_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t batmon_timestamp, float temperature, uint16_t voltage, int16_t current, uint8_t SoC, uint16_t batterystatus, uint16_t serialnumber, uint32_t safetystatus, uint32_t operationstatus, uint16_t cellvoltage1, uint16_t cellvoltage2, uint16_t cellvoltage3, uint16_t cellvoltage4, uint16_t cellvoltage5, uint16_t cellvoltage6) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint64_t(buf, 0, batmon_timestamp); - _mav_put_float(buf, 8, temperature); - _mav_put_uint32_t(buf, 12, safetystatus); - _mav_put_uint32_t(buf, 16, operationstatus); - _mav_put_uint16_t(buf, 20, voltage); - _mav_put_int16_t(buf, 22, current); - _mav_put_uint16_t(buf, 24, batterystatus); - _mav_put_uint16_t(buf, 26, serialnumber); - _mav_put_uint16_t(buf, 28, cellvoltage1); - _mav_put_uint16_t(buf, 30, cellvoltage2); - _mav_put_uint16_t(buf, 32, cellvoltage3); - _mav_put_uint16_t(buf, 34, cellvoltage4); - _mav_put_uint16_t(buf, 36, cellvoltage5); - _mav_put_uint16_t(buf, 38, cellvoltage6); - _mav_put_uint8_t(buf, 40, SoC); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_BATMON, buf, MAVLINK_MSG_ID_SENS_BATMON_MIN_LEN, MAVLINK_MSG_ID_SENS_BATMON_LEN, MAVLINK_MSG_ID_SENS_BATMON_CRC); -#else - mavlink_sens_batmon_t *packet = (mavlink_sens_batmon_t *)msgbuf; - packet->batmon_timestamp = batmon_timestamp; - packet->temperature = temperature; - packet->safetystatus = safetystatus; - packet->operationstatus = operationstatus; - packet->voltage = voltage; - packet->current = current; - packet->batterystatus = batterystatus; - packet->serialnumber = serialnumber; - packet->cellvoltage1 = cellvoltage1; - packet->cellvoltage2 = cellvoltage2; - packet->cellvoltage3 = cellvoltage3; - packet->cellvoltage4 = cellvoltage4; - packet->cellvoltage5 = cellvoltage5; - packet->cellvoltage6 = cellvoltage6; - packet->SoC = SoC; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_BATMON, (const char *)packet, MAVLINK_MSG_ID_SENS_BATMON_MIN_LEN, MAVLINK_MSG_ID_SENS_BATMON_LEN, MAVLINK_MSG_ID_SENS_BATMON_CRC); -#endif -} -#endif - -#endif - -// MESSAGE SENS_BATMON UNPACKING - - -/** - * @brief Get field batmon_timestamp from sens_batmon message - * - * @return [us] Time since system start - */ -static inline uint64_t mavlink_msg_sens_batmon_get_batmon_timestamp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint64_t(msg, 0); -} - -/** - * @brief Get field temperature from sens_batmon message - * - * @return [degC] Battery pack temperature - */ -static inline float mavlink_msg_sens_batmon_get_temperature(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field voltage from sens_batmon message - * - * @return [mV] Battery pack voltage - */ -static inline uint16_t mavlink_msg_sens_batmon_get_voltage(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 20); -} - -/** - * @brief Get field current from sens_batmon message - * - * @return [mA] Battery pack current - */ -static inline int16_t mavlink_msg_sens_batmon_get_current(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 22); -} - -/** - * @brief Get field SoC from sens_batmon message - * - * @return Battery pack state-of-charge - */ -static inline uint8_t mavlink_msg_sens_batmon_get_SoC(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 40); -} - -/** - * @brief Get field batterystatus from sens_batmon message - * - * @return Battery monitor status report bits in Hex - */ -static inline uint16_t mavlink_msg_sens_batmon_get_batterystatus(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 24); -} - -/** - * @brief Get field serialnumber from sens_batmon message - * - * @return Battery monitor serial number in Hex - */ -static inline uint16_t mavlink_msg_sens_batmon_get_serialnumber(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 26); -} - -/** - * @brief Get field safetystatus from sens_batmon message - * - * @return Battery monitor safetystatus report bits in Hex - */ -static inline uint32_t mavlink_msg_sens_batmon_get_safetystatus(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 12); -} - -/** - * @brief Get field operationstatus from sens_batmon message - * - * @return Battery monitor operation status report bits in Hex - */ -static inline uint32_t mavlink_msg_sens_batmon_get_operationstatus(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 16); -} - -/** - * @brief Get field cellvoltage1 from sens_batmon message - * - * @return [mV] Battery pack cell 1 voltage - */ -static inline uint16_t mavlink_msg_sens_batmon_get_cellvoltage1(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 28); -} - -/** - * @brief Get field cellvoltage2 from sens_batmon message - * - * @return [mV] Battery pack cell 2 voltage - */ -static inline uint16_t mavlink_msg_sens_batmon_get_cellvoltage2(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 30); -} - -/** - * @brief Get field cellvoltage3 from sens_batmon message - * - * @return [mV] Battery pack cell 3 voltage - */ -static inline uint16_t mavlink_msg_sens_batmon_get_cellvoltage3(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 32); -} - -/** - * @brief Get field cellvoltage4 from sens_batmon message - * - * @return [mV] Battery pack cell 4 voltage - */ -static inline uint16_t mavlink_msg_sens_batmon_get_cellvoltage4(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 34); -} - -/** - * @brief Get field cellvoltage5 from sens_batmon message - * - * @return [mV] Battery pack cell 5 voltage - */ -static inline uint16_t mavlink_msg_sens_batmon_get_cellvoltage5(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 36); -} - -/** - * @brief Get field cellvoltage6 from sens_batmon message - * - * @return [mV] Battery pack cell 6 voltage - */ -static inline uint16_t mavlink_msg_sens_batmon_get_cellvoltage6(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 38); -} - -/** - * @brief Decode a sens_batmon message into a struct - * - * @param msg The message to decode - * @param sens_batmon C-struct to decode the message contents into - */ -static inline void mavlink_msg_sens_batmon_decode(const mavlink_message_t* msg, mavlink_sens_batmon_t* sens_batmon) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - sens_batmon->batmon_timestamp = mavlink_msg_sens_batmon_get_batmon_timestamp(msg); - sens_batmon->temperature = mavlink_msg_sens_batmon_get_temperature(msg); - sens_batmon->safetystatus = mavlink_msg_sens_batmon_get_safetystatus(msg); - sens_batmon->operationstatus = mavlink_msg_sens_batmon_get_operationstatus(msg); - sens_batmon->voltage = mavlink_msg_sens_batmon_get_voltage(msg); - sens_batmon->current = mavlink_msg_sens_batmon_get_current(msg); - sens_batmon->batterystatus = mavlink_msg_sens_batmon_get_batterystatus(msg); - sens_batmon->serialnumber = mavlink_msg_sens_batmon_get_serialnumber(msg); - sens_batmon->cellvoltage1 = mavlink_msg_sens_batmon_get_cellvoltage1(msg); - sens_batmon->cellvoltage2 = mavlink_msg_sens_batmon_get_cellvoltage2(msg); - sens_batmon->cellvoltage3 = mavlink_msg_sens_batmon_get_cellvoltage3(msg); - sens_batmon->cellvoltage4 = mavlink_msg_sens_batmon_get_cellvoltage4(msg); - sens_batmon->cellvoltage5 = mavlink_msg_sens_batmon_get_cellvoltage5(msg); - sens_batmon->cellvoltage6 = mavlink_msg_sens_batmon_get_cellvoltage6(msg); - sens_batmon->SoC = mavlink_msg_sens_batmon_get_SoC(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_SENS_BATMON_LEN? msg->len : MAVLINK_MSG_ID_SENS_BATMON_LEN; - memset(sens_batmon, 0, MAVLINK_MSG_ID_SENS_BATMON_LEN); - memcpy(sens_batmon, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ASLUAV/mavlink_msg_sens_mppt.h b/ASLUAV/mavlink_msg_sens_mppt.h deleted file mode 100644 index 0d2aed856..000000000 --- a/ASLUAV/mavlink_msg_sens_mppt.h +++ /dev/null @@ -1,513 +0,0 @@ -#pragma once -// MESSAGE SENS_MPPT PACKING - -#define MAVLINK_MSG_ID_SENS_MPPT 202 - - -typedef struct __mavlink_sens_mppt_t { - uint64_t mppt_timestamp; /*< [us] MPPT last timestamp */ - float mppt1_volt; /*< [V] MPPT1 voltage */ - float mppt1_amp; /*< [A] MPPT1 current */ - float mppt2_volt; /*< [V] MPPT2 voltage */ - float mppt2_amp; /*< [A] MPPT2 current */ - float mppt3_volt; /*< [V] MPPT3 voltage */ - float mppt3_amp; /*< [A] MPPT3 current */ - uint16_t mppt1_pwm; /*< [us] MPPT1 pwm */ - uint16_t mppt2_pwm; /*< [us] MPPT2 pwm */ - uint16_t mppt3_pwm; /*< [us] MPPT3 pwm */ - uint8_t mppt1_status; /*< MPPT1 status */ - uint8_t mppt2_status; /*< MPPT2 status */ - uint8_t mppt3_status; /*< MPPT3 status */ -} mavlink_sens_mppt_t; - -#define MAVLINK_MSG_ID_SENS_MPPT_LEN 41 -#define MAVLINK_MSG_ID_SENS_MPPT_MIN_LEN 41 -#define MAVLINK_MSG_ID_202_LEN 41 -#define MAVLINK_MSG_ID_202_MIN_LEN 41 - -#define MAVLINK_MSG_ID_SENS_MPPT_CRC 231 -#define MAVLINK_MSG_ID_202_CRC 231 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_SENS_MPPT { \ - 202, \ - "SENS_MPPT", \ - 13, \ - { { "mppt_timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_sens_mppt_t, mppt_timestamp) }, \ - { "mppt1_volt", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_sens_mppt_t, mppt1_volt) }, \ - { "mppt1_amp", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_sens_mppt_t, mppt1_amp) }, \ - { "mppt1_pwm", NULL, MAVLINK_TYPE_UINT16_T, 0, 32, offsetof(mavlink_sens_mppt_t, mppt1_pwm) }, \ - { "mppt1_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 38, offsetof(mavlink_sens_mppt_t, mppt1_status) }, \ - { "mppt2_volt", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_sens_mppt_t, mppt2_volt) }, \ - { "mppt2_amp", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_sens_mppt_t, mppt2_amp) }, \ - { "mppt2_pwm", NULL, MAVLINK_TYPE_UINT16_T, 0, 34, offsetof(mavlink_sens_mppt_t, mppt2_pwm) }, \ - { "mppt2_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 39, offsetof(mavlink_sens_mppt_t, mppt2_status) }, \ - { "mppt3_volt", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_sens_mppt_t, mppt3_volt) }, \ - { "mppt3_amp", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_sens_mppt_t, mppt3_amp) }, \ - { "mppt3_pwm", NULL, MAVLINK_TYPE_UINT16_T, 0, 36, offsetof(mavlink_sens_mppt_t, mppt3_pwm) }, \ - { "mppt3_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 40, offsetof(mavlink_sens_mppt_t, mppt3_status) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_SENS_MPPT { \ - "SENS_MPPT", \ - 13, \ - { { "mppt_timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_sens_mppt_t, mppt_timestamp) }, \ - { "mppt1_volt", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_sens_mppt_t, mppt1_volt) }, \ - { "mppt1_amp", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_sens_mppt_t, mppt1_amp) }, \ - { "mppt1_pwm", NULL, MAVLINK_TYPE_UINT16_T, 0, 32, offsetof(mavlink_sens_mppt_t, mppt1_pwm) }, \ - { "mppt1_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 38, offsetof(mavlink_sens_mppt_t, mppt1_status) }, \ - { "mppt2_volt", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_sens_mppt_t, mppt2_volt) }, \ - { "mppt2_amp", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_sens_mppt_t, mppt2_amp) }, \ - { "mppt2_pwm", NULL, MAVLINK_TYPE_UINT16_T, 0, 34, offsetof(mavlink_sens_mppt_t, mppt2_pwm) }, \ - { "mppt2_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 39, offsetof(mavlink_sens_mppt_t, mppt2_status) }, \ - { "mppt3_volt", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_sens_mppt_t, mppt3_volt) }, \ - { "mppt3_amp", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_sens_mppt_t, mppt3_amp) }, \ - { "mppt3_pwm", NULL, MAVLINK_TYPE_UINT16_T, 0, 36, offsetof(mavlink_sens_mppt_t, mppt3_pwm) }, \ - { "mppt3_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 40, offsetof(mavlink_sens_mppt_t, mppt3_status) }, \ - } \ -} -#endif - -/** - * @brief Pack a sens_mppt message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param mppt_timestamp [us] MPPT last timestamp - * @param mppt1_volt [V] MPPT1 voltage - * @param mppt1_amp [A] MPPT1 current - * @param mppt1_pwm [us] MPPT1 pwm - * @param mppt1_status MPPT1 status - * @param mppt2_volt [V] MPPT2 voltage - * @param mppt2_amp [A] MPPT2 current - * @param mppt2_pwm [us] MPPT2 pwm - * @param mppt2_status MPPT2 status - * @param mppt3_volt [V] MPPT3 voltage - * @param mppt3_amp [A] MPPT3 current - * @param mppt3_pwm [us] MPPT3 pwm - * @param mppt3_status MPPT3 status - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_sens_mppt_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint64_t mppt_timestamp, float mppt1_volt, float mppt1_amp, uint16_t mppt1_pwm, uint8_t mppt1_status, float mppt2_volt, float mppt2_amp, uint16_t mppt2_pwm, uint8_t mppt2_status, float mppt3_volt, float mppt3_amp, uint16_t mppt3_pwm, uint8_t mppt3_status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SENS_MPPT_LEN]; - _mav_put_uint64_t(buf, 0, mppt_timestamp); - _mav_put_float(buf, 8, mppt1_volt); - _mav_put_float(buf, 12, mppt1_amp); - _mav_put_float(buf, 16, mppt2_volt); - _mav_put_float(buf, 20, mppt2_amp); - _mav_put_float(buf, 24, mppt3_volt); - _mav_put_float(buf, 28, mppt3_amp); - _mav_put_uint16_t(buf, 32, mppt1_pwm); - _mav_put_uint16_t(buf, 34, mppt2_pwm); - _mav_put_uint16_t(buf, 36, mppt3_pwm); - _mav_put_uint8_t(buf, 38, mppt1_status); - _mav_put_uint8_t(buf, 39, mppt2_status); - _mav_put_uint8_t(buf, 40, mppt3_status); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SENS_MPPT_LEN); -#else - mavlink_sens_mppt_t packet; - packet.mppt_timestamp = mppt_timestamp; - packet.mppt1_volt = mppt1_volt; - packet.mppt1_amp = mppt1_amp; - packet.mppt2_volt = mppt2_volt; - packet.mppt2_amp = mppt2_amp; - packet.mppt3_volt = mppt3_volt; - packet.mppt3_amp = mppt3_amp; - packet.mppt1_pwm = mppt1_pwm; - packet.mppt2_pwm = mppt2_pwm; - packet.mppt3_pwm = mppt3_pwm; - packet.mppt1_status = mppt1_status; - packet.mppt2_status = mppt2_status; - packet.mppt3_status = mppt3_status; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SENS_MPPT_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SENS_MPPT; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SENS_MPPT_MIN_LEN, MAVLINK_MSG_ID_SENS_MPPT_LEN, MAVLINK_MSG_ID_SENS_MPPT_CRC); -} - -/** - * @brief Pack a sens_mppt message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param mppt_timestamp [us] MPPT last timestamp - * @param mppt1_volt [V] MPPT1 voltage - * @param mppt1_amp [A] MPPT1 current - * @param mppt1_pwm [us] MPPT1 pwm - * @param mppt1_status MPPT1 status - * @param mppt2_volt [V] MPPT2 voltage - * @param mppt2_amp [A] MPPT2 current - * @param mppt2_pwm [us] MPPT2 pwm - * @param mppt2_status MPPT2 status - * @param mppt3_volt [V] MPPT3 voltage - * @param mppt3_amp [A] MPPT3 current - * @param mppt3_pwm [us] MPPT3 pwm - * @param mppt3_status MPPT3 status - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_sens_mppt_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint64_t mppt_timestamp,float mppt1_volt,float mppt1_amp,uint16_t mppt1_pwm,uint8_t mppt1_status,float mppt2_volt,float mppt2_amp,uint16_t mppt2_pwm,uint8_t mppt2_status,float mppt3_volt,float mppt3_amp,uint16_t mppt3_pwm,uint8_t mppt3_status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SENS_MPPT_LEN]; - _mav_put_uint64_t(buf, 0, mppt_timestamp); - _mav_put_float(buf, 8, mppt1_volt); - _mav_put_float(buf, 12, mppt1_amp); - _mav_put_float(buf, 16, mppt2_volt); - _mav_put_float(buf, 20, mppt2_amp); - _mav_put_float(buf, 24, mppt3_volt); - _mav_put_float(buf, 28, mppt3_amp); - _mav_put_uint16_t(buf, 32, mppt1_pwm); - _mav_put_uint16_t(buf, 34, mppt2_pwm); - _mav_put_uint16_t(buf, 36, mppt3_pwm); - _mav_put_uint8_t(buf, 38, mppt1_status); - _mav_put_uint8_t(buf, 39, mppt2_status); - _mav_put_uint8_t(buf, 40, mppt3_status); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SENS_MPPT_LEN); -#else - mavlink_sens_mppt_t packet; - packet.mppt_timestamp = mppt_timestamp; - packet.mppt1_volt = mppt1_volt; - packet.mppt1_amp = mppt1_amp; - packet.mppt2_volt = mppt2_volt; - packet.mppt2_amp = mppt2_amp; - packet.mppt3_volt = mppt3_volt; - packet.mppt3_amp = mppt3_amp; - packet.mppt1_pwm = mppt1_pwm; - packet.mppt2_pwm = mppt2_pwm; - packet.mppt3_pwm = mppt3_pwm; - packet.mppt1_status = mppt1_status; - packet.mppt2_status = mppt2_status; - packet.mppt3_status = mppt3_status; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SENS_MPPT_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SENS_MPPT; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SENS_MPPT_MIN_LEN, MAVLINK_MSG_ID_SENS_MPPT_LEN, MAVLINK_MSG_ID_SENS_MPPT_CRC); -} - -/** - * @brief Encode a sens_mppt struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param sens_mppt C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_sens_mppt_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_sens_mppt_t* sens_mppt) -{ - return mavlink_msg_sens_mppt_pack(system_id, component_id, msg, sens_mppt->mppt_timestamp, sens_mppt->mppt1_volt, sens_mppt->mppt1_amp, sens_mppt->mppt1_pwm, sens_mppt->mppt1_status, sens_mppt->mppt2_volt, sens_mppt->mppt2_amp, sens_mppt->mppt2_pwm, sens_mppt->mppt2_status, sens_mppt->mppt3_volt, sens_mppt->mppt3_amp, sens_mppt->mppt3_pwm, sens_mppt->mppt3_status); -} - -/** - * @brief Encode a sens_mppt struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param sens_mppt C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_sens_mppt_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_sens_mppt_t* sens_mppt) -{ - return mavlink_msg_sens_mppt_pack_chan(system_id, component_id, chan, msg, sens_mppt->mppt_timestamp, sens_mppt->mppt1_volt, sens_mppt->mppt1_amp, sens_mppt->mppt1_pwm, sens_mppt->mppt1_status, sens_mppt->mppt2_volt, sens_mppt->mppt2_amp, sens_mppt->mppt2_pwm, sens_mppt->mppt2_status, sens_mppt->mppt3_volt, sens_mppt->mppt3_amp, sens_mppt->mppt3_pwm, sens_mppt->mppt3_status); -} - -/** - * @brief Send a sens_mppt message - * @param chan MAVLink channel to send the message - * - * @param mppt_timestamp [us] MPPT last timestamp - * @param mppt1_volt [V] MPPT1 voltage - * @param mppt1_amp [A] MPPT1 current - * @param mppt1_pwm [us] MPPT1 pwm - * @param mppt1_status MPPT1 status - * @param mppt2_volt [V] MPPT2 voltage - * @param mppt2_amp [A] MPPT2 current - * @param mppt2_pwm [us] MPPT2 pwm - * @param mppt2_status MPPT2 status - * @param mppt3_volt [V] MPPT3 voltage - * @param mppt3_amp [A] MPPT3 current - * @param mppt3_pwm [us] MPPT3 pwm - * @param mppt3_status MPPT3 status - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_sens_mppt_send(mavlink_channel_t chan, uint64_t mppt_timestamp, float mppt1_volt, float mppt1_amp, uint16_t mppt1_pwm, uint8_t mppt1_status, float mppt2_volt, float mppt2_amp, uint16_t mppt2_pwm, uint8_t mppt2_status, float mppt3_volt, float mppt3_amp, uint16_t mppt3_pwm, uint8_t mppt3_status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SENS_MPPT_LEN]; - _mav_put_uint64_t(buf, 0, mppt_timestamp); - _mav_put_float(buf, 8, mppt1_volt); - _mav_put_float(buf, 12, mppt1_amp); - _mav_put_float(buf, 16, mppt2_volt); - _mav_put_float(buf, 20, mppt2_amp); - _mav_put_float(buf, 24, mppt3_volt); - _mav_put_float(buf, 28, mppt3_amp); - _mav_put_uint16_t(buf, 32, mppt1_pwm); - _mav_put_uint16_t(buf, 34, mppt2_pwm); - _mav_put_uint16_t(buf, 36, mppt3_pwm); - _mav_put_uint8_t(buf, 38, mppt1_status); - _mav_put_uint8_t(buf, 39, mppt2_status); - _mav_put_uint8_t(buf, 40, mppt3_status); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_MPPT, buf, MAVLINK_MSG_ID_SENS_MPPT_MIN_LEN, MAVLINK_MSG_ID_SENS_MPPT_LEN, MAVLINK_MSG_ID_SENS_MPPT_CRC); -#else - mavlink_sens_mppt_t packet; - packet.mppt_timestamp = mppt_timestamp; - packet.mppt1_volt = mppt1_volt; - packet.mppt1_amp = mppt1_amp; - packet.mppt2_volt = mppt2_volt; - packet.mppt2_amp = mppt2_amp; - packet.mppt3_volt = mppt3_volt; - packet.mppt3_amp = mppt3_amp; - packet.mppt1_pwm = mppt1_pwm; - packet.mppt2_pwm = mppt2_pwm; - packet.mppt3_pwm = mppt3_pwm; - packet.mppt1_status = mppt1_status; - packet.mppt2_status = mppt2_status; - packet.mppt3_status = mppt3_status; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_MPPT, (const char *)&packet, MAVLINK_MSG_ID_SENS_MPPT_MIN_LEN, MAVLINK_MSG_ID_SENS_MPPT_LEN, MAVLINK_MSG_ID_SENS_MPPT_CRC); -#endif -} - -/** - * @brief Send a sens_mppt message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_sens_mppt_send_struct(mavlink_channel_t chan, const mavlink_sens_mppt_t* sens_mppt) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_sens_mppt_send(chan, sens_mppt->mppt_timestamp, sens_mppt->mppt1_volt, sens_mppt->mppt1_amp, sens_mppt->mppt1_pwm, sens_mppt->mppt1_status, sens_mppt->mppt2_volt, sens_mppt->mppt2_amp, sens_mppt->mppt2_pwm, sens_mppt->mppt2_status, sens_mppt->mppt3_volt, sens_mppt->mppt3_amp, sens_mppt->mppt3_pwm, sens_mppt->mppt3_status); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_MPPT, (const char *)sens_mppt, MAVLINK_MSG_ID_SENS_MPPT_MIN_LEN, MAVLINK_MSG_ID_SENS_MPPT_LEN, MAVLINK_MSG_ID_SENS_MPPT_CRC); -#endif -} - -#if MAVLINK_MSG_ID_SENS_MPPT_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_sens_mppt_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t mppt_timestamp, float mppt1_volt, float mppt1_amp, uint16_t mppt1_pwm, uint8_t mppt1_status, float mppt2_volt, float mppt2_amp, uint16_t mppt2_pwm, uint8_t mppt2_status, float mppt3_volt, float mppt3_amp, uint16_t mppt3_pwm, uint8_t mppt3_status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint64_t(buf, 0, mppt_timestamp); - _mav_put_float(buf, 8, mppt1_volt); - _mav_put_float(buf, 12, mppt1_amp); - _mav_put_float(buf, 16, mppt2_volt); - _mav_put_float(buf, 20, mppt2_amp); - _mav_put_float(buf, 24, mppt3_volt); - _mav_put_float(buf, 28, mppt3_amp); - _mav_put_uint16_t(buf, 32, mppt1_pwm); - _mav_put_uint16_t(buf, 34, mppt2_pwm); - _mav_put_uint16_t(buf, 36, mppt3_pwm); - _mav_put_uint8_t(buf, 38, mppt1_status); - _mav_put_uint8_t(buf, 39, mppt2_status); - _mav_put_uint8_t(buf, 40, mppt3_status); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_MPPT, buf, MAVLINK_MSG_ID_SENS_MPPT_MIN_LEN, MAVLINK_MSG_ID_SENS_MPPT_LEN, MAVLINK_MSG_ID_SENS_MPPT_CRC); -#else - mavlink_sens_mppt_t *packet = (mavlink_sens_mppt_t *)msgbuf; - packet->mppt_timestamp = mppt_timestamp; - packet->mppt1_volt = mppt1_volt; - packet->mppt1_amp = mppt1_amp; - packet->mppt2_volt = mppt2_volt; - packet->mppt2_amp = mppt2_amp; - packet->mppt3_volt = mppt3_volt; - packet->mppt3_amp = mppt3_amp; - packet->mppt1_pwm = mppt1_pwm; - packet->mppt2_pwm = mppt2_pwm; - packet->mppt3_pwm = mppt3_pwm; - packet->mppt1_status = mppt1_status; - packet->mppt2_status = mppt2_status; - packet->mppt3_status = mppt3_status; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_MPPT, (const char *)packet, MAVLINK_MSG_ID_SENS_MPPT_MIN_LEN, MAVLINK_MSG_ID_SENS_MPPT_LEN, MAVLINK_MSG_ID_SENS_MPPT_CRC); -#endif -} -#endif - -#endif - -// MESSAGE SENS_MPPT UNPACKING - - -/** - * @brief Get field mppt_timestamp from sens_mppt message - * - * @return [us] MPPT last timestamp - */ -static inline uint64_t mavlink_msg_sens_mppt_get_mppt_timestamp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint64_t(msg, 0); -} - -/** - * @brief Get field mppt1_volt from sens_mppt message - * - * @return [V] MPPT1 voltage - */ -static inline float mavlink_msg_sens_mppt_get_mppt1_volt(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field mppt1_amp from sens_mppt message - * - * @return [A] MPPT1 current - */ -static inline float mavlink_msg_sens_mppt_get_mppt1_amp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Get field mppt1_pwm from sens_mppt message - * - * @return [us] MPPT1 pwm - */ -static inline uint16_t mavlink_msg_sens_mppt_get_mppt1_pwm(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 32); -} - -/** - * @brief Get field mppt1_status from sens_mppt message - * - * @return MPPT1 status - */ -static inline uint8_t mavlink_msg_sens_mppt_get_mppt1_status(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 38); -} - -/** - * @brief Get field mppt2_volt from sens_mppt message - * - * @return [V] MPPT2 voltage - */ -static inline float mavlink_msg_sens_mppt_get_mppt2_volt(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 16); -} - -/** - * @brief Get field mppt2_amp from sens_mppt message - * - * @return [A] MPPT2 current - */ -static inline float mavlink_msg_sens_mppt_get_mppt2_amp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 20); -} - -/** - * @brief Get field mppt2_pwm from sens_mppt message - * - * @return [us] MPPT2 pwm - */ -static inline uint16_t mavlink_msg_sens_mppt_get_mppt2_pwm(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 34); -} - -/** - * @brief Get field mppt2_status from sens_mppt message - * - * @return MPPT2 status - */ -static inline uint8_t mavlink_msg_sens_mppt_get_mppt2_status(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 39); -} - -/** - * @brief Get field mppt3_volt from sens_mppt message - * - * @return [V] MPPT3 voltage - */ -static inline float mavlink_msg_sens_mppt_get_mppt3_volt(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 24); -} - -/** - * @brief Get field mppt3_amp from sens_mppt message - * - * @return [A] MPPT3 current - */ -static inline float mavlink_msg_sens_mppt_get_mppt3_amp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 28); -} - -/** - * @brief Get field mppt3_pwm from sens_mppt message - * - * @return [us] MPPT3 pwm - */ -static inline uint16_t mavlink_msg_sens_mppt_get_mppt3_pwm(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 36); -} - -/** - * @brief Get field mppt3_status from sens_mppt message - * - * @return MPPT3 status - */ -static inline uint8_t mavlink_msg_sens_mppt_get_mppt3_status(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 40); -} - -/** - * @brief Decode a sens_mppt message into a struct - * - * @param msg The message to decode - * @param sens_mppt C-struct to decode the message contents into - */ -static inline void mavlink_msg_sens_mppt_decode(const mavlink_message_t* msg, mavlink_sens_mppt_t* sens_mppt) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - sens_mppt->mppt_timestamp = mavlink_msg_sens_mppt_get_mppt_timestamp(msg); - sens_mppt->mppt1_volt = mavlink_msg_sens_mppt_get_mppt1_volt(msg); - sens_mppt->mppt1_amp = mavlink_msg_sens_mppt_get_mppt1_amp(msg); - sens_mppt->mppt2_volt = mavlink_msg_sens_mppt_get_mppt2_volt(msg); - sens_mppt->mppt2_amp = mavlink_msg_sens_mppt_get_mppt2_amp(msg); - sens_mppt->mppt3_volt = mavlink_msg_sens_mppt_get_mppt3_volt(msg); - sens_mppt->mppt3_amp = mavlink_msg_sens_mppt_get_mppt3_amp(msg); - sens_mppt->mppt1_pwm = mavlink_msg_sens_mppt_get_mppt1_pwm(msg); - sens_mppt->mppt2_pwm = mavlink_msg_sens_mppt_get_mppt2_pwm(msg); - sens_mppt->mppt3_pwm = mavlink_msg_sens_mppt_get_mppt3_pwm(msg); - sens_mppt->mppt1_status = mavlink_msg_sens_mppt_get_mppt1_status(msg); - sens_mppt->mppt2_status = mavlink_msg_sens_mppt_get_mppt2_status(msg); - sens_mppt->mppt3_status = mavlink_msg_sens_mppt_get_mppt3_status(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_SENS_MPPT_LEN? msg->len : MAVLINK_MSG_ID_SENS_MPPT_LEN; - memset(sens_mppt, 0, MAVLINK_MSG_ID_SENS_MPPT_LEN); - memcpy(sens_mppt, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ASLUAV/mavlink_msg_sens_power.h b/ASLUAV/mavlink_msg_sens_power.h deleted file mode 100644 index a4096321c..000000000 --- a/ASLUAV/mavlink_msg_sens_power.h +++ /dev/null @@ -1,288 +0,0 @@ -#pragma once -// MESSAGE SENS_POWER PACKING - -#define MAVLINK_MSG_ID_SENS_POWER 201 - - -typedef struct __mavlink_sens_power_t { - float adc121_vspb_volt; /*< [V] Power board voltage sensor reading*/ - float adc121_cspb_amp; /*< [A] Power board current sensor reading*/ - float adc121_cs1_amp; /*< [A] Board current sensor 1 reading*/ - float adc121_cs2_amp; /*< [A] Board current sensor 2 reading*/ -} mavlink_sens_power_t; - -#define MAVLINK_MSG_ID_SENS_POWER_LEN 16 -#define MAVLINK_MSG_ID_SENS_POWER_MIN_LEN 16 -#define MAVLINK_MSG_ID_201_LEN 16 -#define MAVLINK_MSG_ID_201_MIN_LEN 16 - -#define MAVLINK_MSG_ID_SENS_POWER_CRC 218 -#define MAVLINK_MSG_ID_201_CRC 218 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_SENS_POWER { \ - 201, \ - "SENS_POWER", \ - 4, \ - { { "adc121_vspb_volt", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_sens_power_t, adc121_vspb_volt) }, \ - { "adc121_cspb_amp", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_sens_power_t, adc121_cspb_amp) }, \ - { "adc121_cs1_amp", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_sens_power_t, adc121_cs1_amp) }, \ - { "adc121_cs2_amp", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_sens_power_t, adc121_cs2_amp) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_SENS_POWER { \ - "SENS_POWER", \ - 4, \ - { { "adc121_vspb_volt", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_sens_power_t, adc121_vspb_volt) }, \ - { "adc121_cspb_amp", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_sens_power_t, adc121_cspb_amp) }, \ - { "adc121_cs1_amp", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_sens_power_t, adc121_cs1_amp) }, \ - { "adc121_cs2_amp", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_sens_power_t, adc121_cs2_amp) }, \ - } \ -} -#endif - -/** - * @brief Pack a sens_power message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param adc121_vspb_volt [V] Power board voltage sensor reading - * @param adc121_cspb_amp [A] Power board current sensor reading - * @param adc121_cs1_amp [A] Board current sensor 1 reading - * @param adc121_cs2_amp [A] Board current sensor 2 reading - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_sens_power_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - float adc121_vspb_volt, float adc121_cspb_amp, float adc121_cs1_amp, float adc121_cs2_amp) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SENS_POWER_LEN]; - _mav_put_float(buf, 0, adc121_vspb_volt); - _mav_put_float(buf, 4, adc121_cspb_amp); - _mav_put_float(buf, 8, adc121_cs1_amp); - _mav_put_float(buf, 12, adc121_cs2_amp); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SENS_POWER_LEN); -#else - mavlink_sens_power_t packet; - packet.adc121_vspb_volt = adc121_vspb_volt; - packet.adc121_cspb_amp = adc121_cspb_amp; - packet.adc121_cs1_amp = adc121_cs1_amp; - packet.adc121_cs2_amp = adc121_cs2_amp; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SENS_POWER_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SENS_POWER; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SENS_POWER_MIN_LEN, MAVLINK_MSG_ID_SENS_POWER_LEN, MAVLINK_MSG_ID_SENS_POWER_CRC); -} - -/** - * @brief Pack a sens_power message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param adc121_vspb_volt [V] Power board voltage sensor reading - * @param adc121_cspb_amp [A] Power board current sensor reading - * @param adc121_cs1_amp [A] Board current sensor 1 reading - * @param adc121_cs2_amp [A] Board current sensor 2 reading - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_sens_power_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - float adc121_vspb_volt,float adc121_cspb_amp,float adc121_cs1_amp,float adc121_cs2_amp) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SENS_POWER_LEN]; - _mav_put_float(buf, 0, adc121_vspb_volt); - _mav_put_float(buf, 4, adc121_cspb_amp); - _mav_put_float(buf, 8, adc121_cs1_amp); - _mav_put_float(buf, 12, adc121_cs2_amp); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SENS_POWER_LEN); -#else - mavlink_sens_power_t packet; - packet.adc121_vspb_volt = adc121_vspb_volt; - packet.adc121_cspb_amp = adc121_cspb_amp; - packet.adc121_cs1_amp = adc121_cs1_amp; - packet.adc121_cs2_amp = adc121_cs2_amp; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SENS_POWER_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SENS_POWER; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SENS_POWER_MIN_LEN, MAVLINK_MSG_ID_SENS_POWER_LEN, MAVLINK_MSG_ID_SENS_POWER_CRC); -} - -/** - * @brief Encode a sens_power struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param sens_power C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_sens_power_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_sens_power_t* sens_power) -{ - return mavlink_msg_sens_power_pack(system_id, component_id, msg, sens_power->adc121_vspb_volt, sens_power->adc121_cspb_amp, sens_power->adc121_cs1_amp, sens_power->adc121_cs2_amp); -} - -/** - * @brief Encode a sens_power struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param sens_power C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_sens_power_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_sens_power_t* sens_power) -{ - return mavlink_msg_sens_power_pack_chan(system_id, component_id, chan, msg, sens_power->adc121_vspb_volt, sens_power->adc121_cspb_amp, sens_power->adc121_cs1_amp, sens_power->adc121_cs2_amp); -} - -/** - * @brief Send a sens_power message - * @param chan MAVLink channel to send the message - * - * @param adc121_vspb_volt [V] Power board voltage sensor reading - * @param adc121_cspb_amp [A] Power board current sensor reading - * @param adc121_cs1_amp [A] Board current sensor 1 reading - * @param adc121_cs2_amp [A] Board current sensor 2 reading - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_sens_power_send(mavlink_channel_t chan, float adc121_vspb_volt, float adc121_cspb_amp, float adc121_cs1_amp, float adc121_cs2_amp) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SENS_POWER_LEN]; - _mav_put_float(buf, 0, adc121_vspb_volt); - _mav_put_float(buf, 4, adc121_cspb_amp); - _mav_put_float(buf, 8, adc121_cs1_amp); - _mav_put_float(buf, 12, adc121_cs2_amp); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_POWER, buf, MAVLINK_MSG_ID_SENS_POWER_MIN_LEN, MAVLINK_MSG_ID_SENS_POWER_LEN, MAVLINK_MSG_ID_SENS_POWER_CRC); -#else - mavlink_sens_power_t packet; - packet.adc121_vspb_volt = adc121_vspb_volt; - packet.adc121_cspb_amp = adc121_cspb_amp; - packet.adc121_cs1_amp = adc121_cs1_amp; - packet.adc121_cs2_amp = adc121_cs2_amp; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_POWER, (const char *)&packet, MAVLINK_MSG_ID_SENS_POWER_MIN_LEN, MAVLINK_MSG_ID_SENS_POWER_LEN, MAVLINK_MSG_ID_SENS_POWER_CRC); -#endif -} - -/** - * @brief Send a sens_power message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_sens_power_send_struct(mavlink_channel_t chan, const mavlink_sens_power_t* sens_power) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_sens_power_send(chan, sens_power->adc121_vspb_volt, sens_power->adc121_cspb_amp, sens_power->adc121_cs1_amp, sens_power->adc121_cs2_amp); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_POWER, (const char *)sens_power, MAVLINK_MSG_ID_SENS_POWER_MIN_LEN, MAVLINK_MSG_ID_SENS_POWER_LEN, MAVLINK_MSG_ID_SENS_POWER_CRC); -#endif -} - -#if MAVLINK_MSG_ID_SENS_POWER_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_sens_power_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, float adc121_vspb_volt, float adc121_cspb_amp, float adc121_cs1_amp, float adc121_cs2_amp) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_float(buf, 0, adc121_vspb_volt); - _mav_put_float(buf, 4, adc121_cspb_amp); - _mav_put_float(buf, 8, adc121_cs1_amp); - _mav_put_float(buf, 12, adc121_cs2_amp); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_POWER, buf, MAVLINK_MSG_ID_SENS_POWER_MIN_LEN, MAVLINK_MSG_ID_SENS_POWER_LEN, MAVLINK_MSG_ID_SENS_POWER_CRC); -#else - mavlink_sens_power_t *packet = (mavlink_sens_power_t *)msgbuf; - packet->adc121_vspb_volt = adc121_vspb_volt; - packet->adc121_cspb_amp = adc121_cspb_amp; - packet->adc121_cs1_amp = adc121_cs1_amp; - packet->adc121_cs2_amp = adc121_cs2_amp; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_POWER, (const char *)packet, MAVLINK_MSG_ID_SENS_POWER_MIN_LEN, MAVLINK_MSG_ID_SENS_POWER_LEN, MAVLINK_MSG_ID_SENS_POWER_CRC); -#endif -} -#endif - -#endif - -// MESSAGE SENS_POWER UNPACKING - - -/** - * @brief Get field adc121_vspb_volt from sens_power message - * - * @return [V] Power board voltage sensor reading - */ -static inline float mavlink_msg_sens_power_get_adc121_vspb_volt(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 0); -} - -/** - * @brief Get field adc121_cspb_amp from sens_power message - * - * @return [A] Power board current sensor reading - */ -static inline float mavlink_msg_sens_power_get_adc121_cspb_amp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 4); -} - -/** - * @brief Get field adc121_cs1_amp from sens_power message - * - * @return [A] Board current sensor 1 reading - */ -static inline float mavlink_msg_sens_power_get_adc121_cs1_amp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field adc121_cs2_amp from sens_power message - * - * @return [A] Board current sensor 2 reading - */ -static inline float mavlink_msg_sens_power_get_adc121_cs2_amp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Decode a sens_power message into a struct - * - * @param msg The message to decode - * @param sens_power C-struct to decode the message contents into - */ -static inline void mavlink_msg_sens_power_decode(const mavlink_message_t* msg, mavlink_sens_power_t* sens_power) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - sens_power->adc121_vspb_volt = mavlink_msg_sens_power_get_adc121_vspb_volt(msg); - sens_power->adc121_cspb_amp = mavlink_msg_sens_power_get_adc121_cspb_amp(msg); - sens_power->adc121_cs1_amp = mavlink_msg_sens_power_get_adc121_cs1_amp(msg); - sens_power->adc121_cs2_amp = mavlink_msg_sens_power_get_adc121_cs2_amp(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_SENS_POWER_LEN? msg->len : MAVLINK_MSG_ID_SENS_POWER_LEN; - memset(sens_power, 0, MAVLINK_MSG_ID_SENS_POWER_LEN); - memcpy(sens_power, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ASLUAV/mavlink_msg_sens_power_board.h b/ASLUAV/mavlink_msg_sens_power_board.h deleted file mode 100644 index 20b7a19e8..000000000 --- a/ASLUAV/mavlink_msg_sens_power_board.h +++ /dev/null @@ -1,488 +0,0 @@ -#pragma once -// MESSAGE SENS_POWER_BOARD PACKING - -#define MAVLINK_MSG_ID_SENS_POWER_BOARD 212 - - -typedef struct __mavlink_sens_power_board_t { - uint64_t timestamp; /*< [us] Timestamp*/ - float pwr_brd_system_volt; /*< [V] Power board system voltage*/ - float pwr_brd_servo_volt; /*< [V] Power board servo voltage*/ - float pwr_brd_digital_volt; /*< [V] Power board digital voltage*/ - float pwr_brd_mot_l_amp; /*< [A] Power board left motor current sensor*/ - float pwr_brd_mot_r_amp; /*< [A] Power board right motor current sensor*/ - float pwr_brd_analog_amp; /*< [A] Power board analog current sensor*/ - float pwr_brd_digital_amp; /*< [A] Power board digital current sensor*/ - float pwr_brd_ext_amp; /*< [A] Power board extension current sensor*/ - float pwr_brd_aux_amp; /*< [A] Power board aux current sensor*/ - uint8_t pwr_brd_status; /*< Power board status register*/ - uint8_t pwr_brd_led_status; /*< Power board leds status*/ -} mavlink_sens_power_board_t; - -#define MAVLINK_MSG_ID_SENS_POWER_BOARD_LEN 46 -#define MAVLINK_MSG_ID_SENS_POWER_BOARD_MIN_LEN 46 -#define MAVLINK_MSG_ID_212_LEN 46 -#define MAVLINK_MSG_ID_212_MIN_LEN 46 - -#define MAVLINK_MSG_ID_SENS_POWER_BOARD_CRC 222 -#define MAVLINK_MSG_ID_212_CRC 222 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_SENS_POWER_BOARD { \ - 212, \ - "SENS_POWER_BOARD", \ - 12, \ - { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_sens_power_board_t, timestamp) }, \ - { "pwr_brd_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 44, offsetof(mavlink_sens_power_board_t, pwr_brd_status) }, \ - { "pwr_brd_led_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 45, offsetof(mavlink_sens_power_board_t, pwr_brd_led_status) }, \ - { "pwr_brd_system_volt", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_sens_power_board_t, pwr_brd_system_volt) }, \ - { "pwr_brd_servo_volt", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_sens_power_board_t, pwr_brd_servo_volt) }, \ - { "pwr_brd_digital_volt", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_sens_power_board_t, pwr_brd_digital_volt) }, \ - { "pwr_brd_mot_l_amp", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_sens_power_board_t, pwr_brd_mot_l_amp) }, \ - { "pwr_brd_mot_r_amp", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_sens_power_board_t, pwr_brd_mot_r_amp) }, \ - { "pwr_brd_analog_amp", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_sens_power_board_t, pwr_brd_analog_amp) }, \ - { "pwr_brd_digital_amp", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_sens_power_board_t, pwr_brd_digital_amp) }, \ - { "pwr_brd_ext_amp", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_sens_power_board_t, pwr_brd_ext_amp) }, \ - { "pwr_brd_aux_amp", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_sens_power_board_t, pwr_brd_aux_amp) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_SENS_POWER_BOARD { \ - "SENS_POWER_BOARD", \ - 12, \ - { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_sens_power_board_t, timestamp) }, \ - { "pwr_brd_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 44, offsetof(mavlink_sens_power_board_t, pwr_brd_status) }, \ - { "pwr_brd_led_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 45, offsetof(mavlink_sens_power_board_t, pwr_brd_led_status) }, \ - { "pwr_brd_system_volt", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_sens_power_board_t, pwr_brd_system_volt) }, \ - { "pwr_brd_servo_volt", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_sens_power_board_t, pwr_brd_servo_volt) }, \ - { "pwr_brd_digital_volt", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_sens_power_board_t, pwr_brd_digital_volt) }, \ - { "pwr_brd_mot_l_amp", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_sens_power_board_t, pwr_brd_mot_l_amp) }, \ - { "pwr_brd_mot_r_amp", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_sens_power_board_t, pwr_brd_mot_r_amp) }, \ - { "pwr_brd_analog_amp", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_sens_power_board_t, pwr_brd_analog_amp) }, \ - { "pwr_brd_digital_amp", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_sens_power_board_t, pwr_brd_digital_amp) }, \ - { "pwr_brd_ext_amp", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_sens_power_board_t, pwr_brd_ext_amp) }, \ - { "pwr_brd_aux_amp", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_sens_power_board_t, pwr_brd_aux_amp) }, \ - } \ -} -#endif - -/** - * @brief Pack a sens_power_board message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param timestamp [us] Timestamp - * @param pwr_brd_status Power board status register - * @param pwr_brd_led_status Power board leds status - * @param pwr_brd_system_volt [V] Power board system voltage - * @param pwr_brd_servo_volt [V] Power board servo voltage - * @param pwr_brd_digital_volt [V] Power board digital voltage - * @param pwr_brd_mot_l_amp [A] Power board left motor current sensor - * @param pwr_brd_mot_r_amp [A] Power board right motor current sensor - * @param pwr_brd_analog_amp [A] Power board analog current sensor - * @param pwr_brd_digital_amp [A] Power board digital current sensor - * @param pwr_brd_ext_amp [A] Power board extension current sensor - * @param pwr_brd_aux_amp [A] Power board aux current sensor - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_sens_power_board_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint64_t timestamp, uint8_t pwr_brd_status, uint8_t pwr_brd_led_status, float pwr_brd_system_volt, float pwr_brd_servo_volt, float pwr_brd_digital_volt, float pwr_brd_mot_l_amp, float pwr_brd_mot_r_amp, float pwr_brd_analog_amp, float pwr_brd_digital_amp, float pwr_brd_ext_amp, float pwr_brd_aux_amp) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SENS_POWER_BOARD_LEN]; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_float(buf, 8, pwr_brd_system_volt); - _mav_put_float(buf, 12, pwr_brd_servo_volt); - _mav_put_float(buf, 16, pwr_brd_digital_volt); - _mav_put_float(buf, 20, pwr_brd_mot_l_amp); - _mav_put_float(buf, 24, pwr_brd_mot_r_amp); - _mav_put_float(buf, 28, pwr_brd_analog_amp); - _mav_put_float(buf, 32, pwr_brd_digital_amp); - _mav_put_float(buf, 36, pwr_brd_ext_amp); - _mav_put_float(buf, 40, pwr_brd_aux_amp); - _mav_put_uint8_t(buf, 44, pwr_brd_status); - _mav_put_uint8_t(buf, 45, pwr_brd_led_status); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SENS_POWER_BOARD_LEN); -#else - mavlink_sens_power_board_t packet; - packet.timestamp = timestamp; - packet.pwr_brd_system_volt = pwr_brd_system_volt; - packet.pwr_brd_servo_volt = pwr_brd_servo_volt; - packet.pwr_brd_digital_volt = pwr_brd_digital_volt; - packet.pwr_brd_mot_l_amp = pwr_brd_mot_l_amp; - packet.pwr_brd_mot_r_amp = pwr_brd_mot_r_amp; - packet.pwr_brd_analog_amp = pwr_brd_analog_amp; - packet.pwr_brd_digital_amp = pwr_brd_digital_amp; - packet.pwr_brd_ext_amp = pwr_brd_ext_amp; - packet.pwr_brd_aux_amp = pwr_brd_aux_amp; - packet.pwr_brd_status = pwr_brd_status; - packet.pwr_brd_led_status = pwr_brd_led_status; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SENS_POWER_BOARD_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SENS_POWER_BOARD; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SENS_POWER_BOARD_MIN_LEN, MAVLINK_MSG_ID_SENS_POWER_BOARD_LEN, MAVLINK_MSG_ID_SENS_POWER_BOARD_CRC); -} - -/** - * @brief Pack a sens_power_board message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param timestamp [us] Timestamp - * @param pwr_brd_status Power board status register - * @param pwr_brd_led_status Power board leds status - * @param pwr_brd_system_volt [V] Power board system voltage - * @param pwr_brd_servo_volt [V] Power board servo voltage - * @param pwr_brd_digital_volt [V] Power board digital voltage - * @param pwr_brd_mot_l_amp [A] Power board left motor current sensor - * @param pwr_brd_mot_r_amp [A] Power board right motor current sensor - * @param pwr_brd_analog_amp [A] Power board analog current sensor - * @param pwr_brd_digital_amp [A] Power board digital current sensor - * @param pwr_brd_ext_amp [A] Power board extension current sensor - * @param pwr_brd_aux_amp [A] Power board aux current sensor - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_sens_power_board_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint64_t timestamp,uint8_t pwr_brd_status,uint8_t pwr_brd_led_status,float pwr_brd_system_volt,float pwr_brd_servo_volt,float pwr_brd_digital_volt,float pwr_brd_mot_l_amp,float pwr_brd_mot_r_amp,float pwr_brd_analog_amp,float pwr_brd_digital_amp,float pwr_brd_ext_amp,float pwr_brd_aux_amp) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SENS_POWER_BOARD_LEN]; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_float(buf, 8, pwr_brd_system_volt); - _mav_put_float(buf, 12, pwr_brd_servo_volt); - _mav_put_float(buf, 16, pwr_brd_digital_volt); - _mav_put_float(buf, 20, pwr_brd_mot_l_amp); - _mav_put_float(buf, 24, pwr_brd_mot_r_amp); - _mav_put_float(buf, 28, pwr_brd_analog_amp); - _mav_put_float(buf, 32, pwr_brd_digital_amp); - _mav_put_float(buf, 36, pwr_brd_ext_amp); - _mav_put_float(buf, 40, pwr_brd_aux_amp); - _mav_put_uint8_t(buf, 44, pwr_brd_status); - _mav_put_uint8_t(buf, 45, pwr_brd_led_status); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SENS_POWER_BOARD_LEN); -#else - mavlink_sens_power_board_t packet; - packet.timestamp = timestamp; - packet.pwr_brd_system_volt = pwr_brd_system_volt; - packet.pwr_brd_servo_volt = pwr_brd_servo_volt; - packet.pwr_brd_digital_volt = pwr_brd_digital_volt; - packet.pwr_brd_mot_l_amp = pwr_brd_mot_l_amp; - packet.pwr_brd_mot_r_amp = pwr_brd_mot_r_amp; - packet.pwr_brd_analog_amp = pwr_brd_analog_amp; - packet.pwr_brd_digital_amp = pwr_brd_digital_amp; - packet.pwr_brd_ext_amp = pwr_brd_ext_amp; - packet.pwr_brd_aux_amp = pwr_brd_aux_amp; - packet.pwr_brd_status = pwr_brd_status; - packet.pwr_brd_led_status = pwr_brd_led_status; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SENS_POWER_BOARD_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SENS_POWER_BOARD; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SENS_POWER_BOARD_MIN_LEN, MAVLINK_MSG_ID_SENS_POWER_BOARD_LEN, MAVLINK_MSG_ID_SENS_POWER_BOARD_CRC); -} - -/** - * @brief Encode a sens_power_board struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param sens_power_board C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_sens_power_board_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_sens_power_board_t* sens_power_board) -{ - return mavlink_msg_sens_power_board_pack(system_id, component_id, msg, sens_power_board->timestamp, sens_power_board->pwr_brd_status, sens_power_board->pwr_brd_led_status, sens_power_board->pwr_brd_system_volt, sens_power_board->pwr_brd_servo_volt, sens_power_board->pwr_brd_digital_volt, sens_power_board->pwr_brd_mot_l_amp, sens_power_board->pwr_brd_mot_r_amp, sens_power_board->pwr_brd_analog_amp, sens_power_board->pwr_brd_digital_amp, sens_power_board->pwr_brd_ext_amp, sens_power_board->pwr_brd_aux_amp); -} - -/** - * @brief Encode a sens_power_board struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param sens_power_board C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_sens_power_board_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_sens_power_board_t* sens_power_board) -{ - return mavlink_msg_sens_power_board_pack_chan(system_id, component_id, chan, msg, sens_power_board->timestamp, sens_power_board->pwr_brd_status, sens_power_board->pwr_brd_led_status, sens_power_board->pwr_brd_system_volt, sens_power_board->pwr_brd_servo_volt, sens_power_board->pwr_brd_digital_volt, sens_power_board->pwr_brd_mot_l_amp, sens_power_board->pwr_brd_mot_r_amp, sens_power_board->pwr_brd_analog_amp, sens_power_board->pwr_brd_digital_amp, sens_power_board->pwr_brd_ext_amp, sens_power_board->pwr_brd_aux_amp); -} - -/** - * @brief Send a sens_power_board message - * @param chan MAVLink channel to send the message - * - * @param timestamp [us] Timestamp - * @param pwr_brd_status Power board status register - * @param pwr_brd_led_status Power board leds status - * @param pwr_brd_system_volt [V] Power board system voltage - * @param pwr_brd_servo_volt [V] Power board servo voltage - * @param pwr_brd_digital_volt [V] Power board digital voltage - * @param pwr_brd_mot_l_amp [A] Power board left motor current sensor - * @param pwr_brd_mot_r_amp [A] Power board right motor current sensor - * @param pwr_brd_analog_amp [A] Power board analog current sensor - * @param pwr_brd_digital_amp [A] Power board digital current sensor - * @param pwr_brd_ext_amp [A] Power board extension current sensor - * @param pwr_brd_aux_amp [A] Power board aux current sensor - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_sens_power_board_send(mavlink_channel_t chan, uint64_t timestamp, uint8_t pwr_brd_status, uint8_t pwr_brd_led_status, float pwr_brd_system_volt, float pwr_brd_servo_volt, float pwr_brd_digital_volt, float pwr_brd_mot_l_amp, float pwr_brd_mot_r_amp, float pwr_brd_analog_amp, float pwr_brd_digital_amp, float pwr_brd_ext_amp, float pwr_brd_aux_amp) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SENS_POWER_BOARD_LEN]; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_float(buf, 8, pwr_brd_system_volt); - _mav_put_float(buf, 12, pwr_brd_servo_volt); - _mav_put_float(buf, 16, pwr_brd_digital_volt); - _mav_put_float(buf, 20, pwr_brd_mot_l_amp); - _mav_put_float(buf, 24, pwr_brd_mot_r_amp); - _mav_put_float(buf, 28, pwr_brd_analog_amp); - _mav_put_float(buf, 32, pwr_brd_digital_amp); - _mav_put_float(buf, 36, pwr_brd_ext_amp); - _mav_put_float(buf, 40, pwr_brd_aux_amp); - _mav_put_uint8_t(buf, 44, pwr_brd_status); - _mav_put_uint8_t(buf, 45, pwr_brd_led_status); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_POWER_BOARD, buf, MAVLINK_MSG_ID_SENS_POWER_BOARD_MIN_LEN, MAVLINK_MSG_ID_SENS_POWER_BOARD_LEN, MAVLINK_MSG_ID_SENS_POWER_BOARD_CRC); -#else - mavlink_sens_power_board_t packet; - packet.timestamp = timestamp; - packet.pwr_brd_system_volt = pwr_brd_system_volt; - packet.pwr_brd_servo_volt = pwr_brd_servo_volt; - packet.pwr_brd_digital_volt = pwr_brd_digital_volt; - packet.pwr_brd_mot_l_amp = pwr_brd_mot_l_amp; - packet.pwr_brd_mot_r_amp = pwr_brd_mot_r_amp; - packet.pwr_brd_analog_amp = pwr_brd_analog_amp; - packet.pwr_brd_digital_amp = pwr_brd_digital_amp; - packet.pwr_brd_ext_amp = pwr_brd_ext_amp; - packet.pwr_brd_aux_amp = pwr_brd_aux_amp; - packet.pwr_brd_status = pwr_brd_status; - packet.pwr_brd_led_status = pwr_brd_led_status; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_POWER_BOARD, (const char *)&packet, MAVLINK_MSG_ID_SENS_POWER_BOARD_MIN_LEN, MAVLINK_MSG_ID_SENS_POWER_BOARD_LEN, MAVLINK_MSG_ID_SENS_POWER_BOARD_CRC); -#endif -} - -/** - * @brief Send a sens_power_board message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_sens_power_board_send_struct(mavlink_channel_t chan, const mavlink_sens_power_board_t* sens_power_board) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_sens_power_board_send(chan, sens_power_board->timestamp, sens_power_board->pwr_brd_status, sens_power_board->pwr_brd_led_status, sens_power_board->pwr_brd_system_volt, sens_power_board->pwr_brd_servo_volt, sens_power_board->pwr_brd_digital_volt, sens_power_board->pwr_brd_mot_l_amp, sens_power_board->pwr_brd_mot_r_amp, sens_power_board->pwr_brd_analog_amp, sens_power_board->pwr_brd_digital_amp, sens_power_board->pwr_brd_ext_amp, sens_power_board->pwr_brd_aux_amp); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_POWER_BOARD, (const char *)sens_power_board, MAVLINK_MSG_ID_SENS_POWER_BOARD_MIN_LEN, MAVLINK_MSG_ID_SENS_POWER_BOARD_LEN, MAVLINK_MSG_ID_SENS_POWER_BOARD_CRC); -#endif -} - -#if MAVLINK_MSG_ID_SENS_POWER_BOARD_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_sens_power_board_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t timestamp, uint8_t pwr_brd_status, uint8_t pwr_brd_led_status, float pwr_brd_system_volt, float pwr_brd_servo_volt, float pwr_brd_digital_volt, float pwr_brd_mot_l_amp, float pwr_brd_mot_r_amp, float pwr_brd_analog_amp, float pwr_brd_digital_amp, float pwr_brd_ext_amp, float pwr_brd_aux_amp) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_float(buf, 8, pwr_brd_system_volt); - _mav_put_float(buf, 12, pwr_brd_servo_volt); - _mav_put_float(buf, 16, pwr_brd_digital_volt); - _mav_put_float(buf, 20, pwr_brd_mot_l_amp); - _mav_put_float(buf, 24, pwr_brd_mot_r_amp); - _mav_put_float(buf, 28, pwr_brd_analog_amp); - _mav_put_float(buf, 32, pwr_brd_digital_amp); - _mav_put_float(buf, 36, pwr_brd_ext_amp); - _mav_put_float(buf, 40, pwr_brd_aux_amp); - _mav_put_uint8_t(buf, 44, pwr_brd_status); - _mav_put_uint8_t(buf, 45, pwr_brd_led_status); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_POWER_BOARD, buf, MAVLINK_MSG_ID_SENS_POWER_BOARD_MIN_LEN, MAVLINK_MSG_ID_SENS_POWER_BOARD_LEN, MAVLINK_MSG_ID_SENS_POWER_BOARD_CRC); -#else - mavlink_sens_power_board_t *packet = (mavlink_sens_power_board_t *)msgbuf; - packet->timestamp = timestamp; - packet->pwr_brd_system_volt = pwr_brd_system_volt; - packet->pwr_brd_servo_volt = pwr_brd_servo_volt; - packet->pwr_brd_digital_volt = pwr_brd_digital_volt; - packet->pwr_brd_mot_l_amp = pwr_brd_mot_l_amp; - packet->pwr_brd_mot_r_amp = pwr_brd_mot_r_amp; - packet->pwr_brd_analog_amp = pwr_brd_analog_amp; - packet->pwr_brd_digital_amp = pwr_brd_digital_amp; - packet->pwr_brd_ext_amp = pwr_brd_ext_amp; - packet->pwr_brd_aux_amp = pwr_brd_aux_amp; - packet->pwr_brd_status = pwr_brd_status; - packet->pwr_brd_led_status = pwr_brd_led_status; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENS_POWER_BOARD, (const char *)packet, MAVLINK_MSG_ID_SENS_POWER_BOARD_MIN_LEN, MAVLINK_MSG_ID_SENS_POWER_BOARD_LEN, MAVLINK_MSG_ID_SENS_POWER_BOARD_CRC); -#endif -} -#endif - -#endif - -// MESSAGE SENS_POWER_BOARD UNPACKING - - -/** - * @brief Get field timestamp from sens_power_board message - * - * @return [us] Timestamp - */ -static inline uint64_t mavlink_msg_sens_power_board_get_timestamp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint64_t(msg, 0); -} - -/** - * @brief Get field pwr_brd_status from sens_power_board message - * - * @return Power board status register - */ -static inline uint8_t mavlink_msg_sens_power_board_get_pwr_brd_status(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 44); -} - -/** - * @brief Get field pwr_brd_led_status from sens_power_board message - * - * @return Power board leds status - */ -static inline uint8_t mavlink_msg_sens_power_board_get_pwr_brd_led_status(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 45); -} - -/** - * @brief Get field pwr_brd_system_volt from sens_power_board message - * - * @return [V] Power board system voltage - */ -static inline float mavlink_msg_sens_power_board_get_pwr_brd_system_volt(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field pwr_brd_servo_volt from sens_power_board message - * - * @return [V] Power board servo voltage - */ -static inline float mavlink_msg_sens_power_board_get_pwr_brd_servo_volt(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Get field pwr_brd_digital_volt from sens_power_board message - * - * @return [V] Power board digital voltage - */ -static inline float mavlink_msg_sens_power_board_get_pwr_brd_digital_volt(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 16); -} - -/** - * @brief Get field pwr_brd_mot_l_amp from sens_power_board message - * - * @return [A] Power board left motor current sensor - */ -static inline float mavlink_msg_sens_power_board_get_pwr_brd_mot_l_amp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 20); -} - -/** - * @brief Get field pwr_brd_mot_r_amp from sens_power_board message - * - * @return [A] Power board right motor current sensor - */ -static inline float mavlink_msg_sens_power_board_get_pwr_brd_mot_r_amp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 24); -} - -/** - * @brief Get field pwr_brd_analog_amp from sens_power_board message - * - * @return [A] Power board analog current sensor - */ -static inline float mavlink_msg_sens_power_board_get_pwr_brd_analog_amp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 28); -} - -/** - * @brief Get field pwr_brd_digital_amp from sens_power_board message - * - * @return [A] Power board digital current sensor - */ -static inline float mavlink_msg_sens_power_board_get_pwr_brd_digital_amp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 32); -} - -/** - * @brief Get field pwr_brd_ext_amp from sens_power_board message - * - * @return [A] Power board extension current sensor - */ -static inline float mavlink_msg_sens_power_board_get_pwr_brd_ext_amp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 36); -} - -/** - * @brief Get field pwr_brd_aux_amp from sens_power_board message - * - * @return [A] Power board aux current sensor - */ -static inline float mavlink_msg_sens_power_board_get_pwr_brd_aux_amp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 40); -} - -/** - * @brief Decode a sens_power_board message into a struct - * - * @param msg The message to decode - * @param sens_power_board C-struct to decode the message contents into - */ -static inline void mavlink_msg_sens_power_board_decode(const mavlink_message_t* msg, mavlink_sens_power_board_t* sens_power_board) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - sens_power_board->timestamp = mavlink_msg_sens_power_board_get_timestamp(msg); - sens_power_board->pwr_brd_system_volt = mavlink_msg_sens_power_board_get_pwr_brd_system_volt(msg); - sens_power_board->pwr_brd_servo_volt = mavlink_msg_sens_power_board_get_pwr_brd_servo_volt(msg); - sens_power_board->pwr_brd_digital_volt = mavlink_msg_sens_power_board_get_pwr_brd_digital_volt(msg); - sens_power_board->pwr_brd_mot_l_amp = mavlink_msg_sens_power_board_get_pwr_brd_mot_l_amp(msg); - sens_power_board->pwr_brd_mot_r_amp = mavlink_msg_sens_power_board_get_pwr_brd_mot_r_amp(msg); - sens_power_board->pwr_brd_analog_amp = mavlink_msg_sens_power_board_get_pwr_brd_analog_amp(msg); - sens_power_board->pwr_brd_digital_amp = mavlink_msg_sens_power_board_get_pwr_brd_digital_amp(msg); - sens_power_board->pwr_brd_ext_amp = mavlink_msg_sens_power_board_get_pwr_brd_ext_amp(msg); - sens_power_board->pwr_brd_aux_amp = mavlink_msg_sens_power_board_get_pwr_brd_aux_amp(msg); - sens_power_board->pwr_brd_status = mavlink_msg_sens_power_board_get_pwr_brd_status(msg); - sens_power_board->pwr_brd_led_status = mavlink_msg_sens_power_board_get_pwr_brd_led_status(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_SENS_POWER_BOARD_LEN? msg->len : MAVLINK_MSG_ID_SENS_POWER_BOARD_LEN; - memset(sens_power_board, 0, MAVLINK_MSG_ID_SENS_POWER_BOARD_LEN); - memcpy(sens_power_board, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ASLUAV/mavlink_msg_sensor_airflow_angles.h b/ASLUAV/mavlink_msg_sensor_airflow_angles.h deleted file mode 100644 index 5e35957c3..000000000 --- a/ASLUAV/mavlink_msg_sensor_airflow_angles.h +++ /dev/null @@ -1,313 +0,0 @@ -#pragma once -// MESSAGE SENSOR_AIRFLOW_ANGLES PACKING - -#define MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES 215 - - -typedef struct __mavlink_sensor_airflow_angles_t { - uint64_t timestamp; /*< [us] Timestamp*/ - float angleofattack; /*< [deg] Angle of attack*/ - float sideslip; /*< [deg] Sideslip angle*/ - uint8_t angleofattack_valid; /*< Angle of attack measurement valid*/ - uint8_t sideslip_valid; /*< Sideslip angle measurement valid*/ -} mavlink_sensor_airflow_angles_t; - -#define MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_LEN 18 -#define MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_MIN_LEN 18 -#define MAVLINK_MSG_ID_215_LEN 18 -#define MAVLINK_MSG_ID_215_MIN_LEN 18 - -#define MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_CRC 149 -#define MAVLINK_MSG_ID_215_CRC 149 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_SENSOR_AIRFLOW_ANGLES { \ - 215, \ - "SENSOR_AIRFLOW_ANGLES", \ - 5, \ - { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_sensor_airflow_angles_t, timestamp) }, \ - { "angleofattack", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_sensor_airflow_angles_t, angleofattack) }, \ - { "angleofattack_valid", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_sensor_airflow_angles_t, angleofattack_valid) }, \ - { "sideslip", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_sensor_airflow_angles_t, sideslip) }, \ - { "sideslip_valid", NULL, MAVLINK_TYPE_UINT8_T, 0, 17, offsetof(mavlink_sensor_airflow_angles_t, sideslip_valid) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_SENSOR_AIRFLOW_ANGLES { \ - "SENSOR_AIRFLOW_ANGLES", \ - 5, \ - { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_sensor_airflow_angles_t, timestamp) }, \ - { "angleofattack", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_sensor_airflow_angles_t, angleofattack) }, \ - { "angleofattack_valid", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_sensor_airflow_angles_t, angleofattack_valid) }, \ - { "sideslip", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_sensor_airflow_angles_t, sideslip) }, \ - { "sideslip_valid", NULL, MAVLINK_TYPE_UINT8_T, 0, 17, offsetof(mavlink_sensor_airflow_angles_t, sideslip_valid) }, \ - } \ -} -#endif - -/** - * @brief Pack a sensor_airflow_angles message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param timestamp [us] Timestamp - * @param angleofattack [deg] Angle of attack - * @param angleofattack_valid Angle of attack measurement valid - * @param sideslip [deg] Sideslip angle - * @param sideslip_valid Sideslip angle measurement valid - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_sensor_airflow_angles_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint64_t timestamp, float angleofattack, uint8_t angleofattack_valid, float sideslip, uint8_t sideslip_valid) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_LEN]; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_float(buf, 8, angleofattack); - _mav_put_float(buf, 12, sideslip); - _mav_put_uint8_t(buf, 16, angleofattack_valid); - _mav_put_uint8_t(buf, 17, sideslip_valid); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_LEN); -#else - mavlink_sensor_airflow_angles_t packet; - packet.timestamp = timestamp; - packet.angleofattack = angleofattack; - packet.sideslip = sideslip; - packet.angleofattack_valid = angleofattack_valid; - packet.sideslip_valid = sideslip_valid; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_MIN_LEN, MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_LEN, MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_CRC); -} - -/** - * @brief Pack a sensor_airflow_angles message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param timestamp [us] Timestamp - * @param angleofattack [deg] Angle of attack - * @param angleofattack_valid Angle of attack measurement valid - * @param sideslip [deg] Sideslip angle - * @param sideslip_valid Sideslip angle measurement valid - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_sensor_airflow_angles_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint64_t timestamp,float angleofattack,uint8_t angleofattack_valid,float sideslip,uint8_t sideslip_valid) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_LEN]; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_float(buf, 8, angleofattack); - _mav_put_float(buf, 12, sideslip); - _mav_put_uint8_t(buf, 16, angleofattack_valid); - _mav_put_uint8_t(buf, 17, sideslip_valid); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_LEN); -#else - mavlink_sensor_airflow_angles_t packet; - packet.timestamp = timestamp; - packet.angleofattack = angleofattack; - packet.sideslip = sideslip; - packet.angleofattack_valid = angleofattack_valid; - packet.sideslip_valid = sideslip_valid; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_MIN_LEN, MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_LEN, MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_CRC); -} - -/** - * @brief Encode a sensor_airflow_angles struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param sensor_airflow_angles C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_sensor_airflow_angles_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_sensor_airflow_angles_t* sensor_airflow_angles) -{ - return mavlink_msg_sensor_airflow_angles_pack(system_id, component_id, msg, sensor_airflow_angles->timestamp, sensor_airflow_angles->angleofattack, sensor_airflow_angles->angleofattack_valid, sensor_airflow_angles->sideslip, sensor_airflow_angles->sideslip_valid); -} - -/** - * @brief Encode a sensor_airflow_angles struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param sensor_airflow_angles C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_sensor_airflow_angles_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_sensor_airflow_angles_t* sensor_airflow_angles) -{ - return mavlink_msg_sensor_airflow_angles_pack_chan(system_id, component_id, chan, msg, sensor_airflow_angles->timestamp, sensor_airflow_angles->angleofattack, sensor_airflow_angles->angleofattack_valid, sensor_airflow_angles->sideslip, sensor_airflow_angles->sideslip_valid); -} - -/** - * @brief Send a sensor_airflow_angles message - * @param chan MAVLink channel to send the message - * - * @param timestamp [us] Timestamp - * @param angleofattack [deg] Angle of attack - * @param angleofattack_valid Angle of attack measurement valid - * @param sideslip [deg] Sideslip angle - * @param sideslip_valid Sideslip angle measurement valid - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_sensor_airflow_angles_send(mavlink_channel_t chan, uint64_t timestamp, float angleofattack, uint8_t angleofattack_valid, float sideslip, uint8_t sideslip_valid) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_LEN]; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_float(buf, 8, angleofattack); - _mav_put_float(buf, 12, sideslip); - _mav_put_uint8_t(buf, 16, angleofattack_valid); - _mav_put_uint8_t(buf, 17, sideslip_valid); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES, buf, MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_MIN_LEN, MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_LEN, MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_CRC); -#else - mavlink_sensor_airflow_angles_t packet; - packet.timestamp = timestamp; - packet.angleofattack = angleofattack; - packet.sideslip = sideslip; - packet.angleofattack_valid = angleofattack_valid; - packet.sideslip_valid = sideslip_valid; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES, (const char *)&packet, MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_MIN_LEN, MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_LEN, MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_CRC); -#endif -} - -/** - * @brief Send a sensor_airflow_angles message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_sensor_airflow_angles_send_struct(mavlink_channel_t chan, const mavlink_sensor_airflow_angles_t* sensor_airflow_angles) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_sensor_airflow_angles_send(chan, sensor_airflow_angles->timestamp, sensor_airflow_angles->angleofattack, sensor_airflow_angles->angleofattack_valid, sensor_airflow_angles->sideslip, sensor_airflow_angles->sideslip_valid); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES, (const char *)sensor_airflow_angles, MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_MIN_LEN, MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_LEN, MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_CRC); -#endif -} - -#if MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_sensor_airflow_angles_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t timestamp, float angleofattack, uint8_t angleofattack_valid, float sideslip, uint8_t sideslip_valid) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_float(buf, 8, angleofattack); - _mav_put_float(buf, 12, sideslip); - _mav_put_uint8_t(buf, 16, angleofattack_valid); - _mav_put_uint8_t(buf, 17, sideslip_valid); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES, buf, MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_MIN_LEN, MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_LEN, MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_CRC); -#else - mavlink_sensor_airflow_angles_t *packet = (mavlink_sensor_airflow_angles_t *)msgbuf; - packet->timestamp = timestamp; - packet->angleofattack = angleofattack; - packet->sideslip = sideslip; - packet->angleofattack_valid = angleofattack_valid; - packet->sideslip_valid = sideslip_valid; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES, (const char *)packet, MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_MIN_LEN, MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_LEN, MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_CRC); -#endif -} -#endif - -#endif - -// MESSAGE SENSOR_AIRFLOW_ANGLES UNPACKING - - -/** - * @brief Get field timestamp from sensor_airflow_angles message - * - * @return [us] Timestamp - */ -static inline uint64_t mavlink_msg_sensor_airflow_angles_get_timestamp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint64_t(msg, 0); -} - -/** - * @brief Get field angleofattack from sensor_airflow_angles message - * - * @return [deg] Angle of attack - */ -static inline float mavlink_msg_sensor_airflow_angles_get_angleofattack(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field angleofattack_valid from sensor_airflow_angles message - * - * @return Angle of attack measurement valid - */ -static inline uint8_t mavlink_msg_sensor_airflow_angles_get_angleofattack_valid(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 16); -} - -/** - * @brief Get field sideslip from sensor_airflow_angles message - * - * @return [deg] Sideslip angle - */ -static inline float mavlink_msg_sensor_airflow_angles_get_sideslip(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Get field sideslip_valid from sensor_airflow_angles message - * - * @return Sideslip angle measurement valid - */ -static inline uint8_t mavlink_msg_sensor_airflow_angles_get_sideslip_valid(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 17); -} - -/** - * @brief Decode a sensor_airflow_angles message into a struct - * - * @param msg The message to decode - * @param sensor_airflow_angles C-struct to decode the message contents into - */ -static inline void mavlink_msg_sensor_airflow_angles_decode(const mavlink_message_t* msg, mavlink_sensor_airflow_angles_t* sensor_airflow_angles) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - sensor_airflow_angles->timestamp = mavlink_msg_sensor_airflow_angles_get_timestamp(msg); - sensor_airflow_angles->angleofattack = mavlink_msg_sensor_airflow_angles_get_angleofattack(msg); - sensor_airflow_angles->sideslip = mavlink_msg_sensor_airflow_angles_get_sideslip(msg); - sensor_airflow_angles->angleofattack_valid = mavlink_msg_sensor_airflow_angles_get_angleofattack_valid(msg); - sensor_airflow_angles->sideslip_valid = mavlink_msg_sensor_airflow_angles_get_sideslip_valid(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_LEN? msg->len : MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_LEN; - memset(sensor_airflow_angles, 0, MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_LEN); - memcpy(sensor_airflow_angles, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ASLUAV/mavlink_msg_sensorpod_status.h b/ASLUAV/mavlink_msg_sensorpod_status.h deleted file mode 100644 index 280469cc4..000000000 --- a/ASLUAV/mavlink_msg_sensorpod_status.h +++ /dev/null @@ -1,388 +0,0 @@ -#pragma once -// MESSAGE SENSORPOD_STATUS PACKING - -#define MAVLINK_MSG_ID_SENSORPOD_STATUS 211 - - -typedef struct __mavlink_sensorpod_status_t { - uint64_t timestamp; /*< [ms] Timestamp in linuxtime (since 1.1.1970)*/ - uint16_t free_space; /*< Free space available in recordings directory in [Gb] * 1e2*/ - uint8_t visensor_rate_1; /*< Rate of ROS topic 1*/ - uint8_t visensor_rate_2; /*< Rate of ROS topic 2*/ - uint8_t visensor_rate_3; /*< Rate of ROS topic 3*/ - uint8_t visensor_rate_4; /*< Rate of ROS topic 4*/ - uint8_t recording_nodes_count; /*< Number of recording nodes*/ - uint8_t cpu_temp; /*< [degC] Temperature of sensorpod CPU in*/ -} mavlink_sensorpod_status_t; - -#define MAVLINK_MSG_ID_SENSORPOD_STATUS_LEN 16 -#define MAVLINK_MSG_ID_SENSORPOD_STATUS_MIN_LEN 16 -#define MAVLINK_MSG_ID_211_LEN 16 -#define MAVLINK_MSG_ID_211_MIN_LEN 16 - -#define MAVLINK_MSG_ID_SENSORPOD_STATUS_CRC 54 -#define MAVLINK_MSG_ID_211_CRC 54 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_SENSORPOD_STATUS { \ - 211, \ - "SENSORPOD_STATUS", \ - 8, \ - { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_sensorpod_status_t, timestamp) }, \ - { "visensor_rate_1", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_sensorpod_status_t, visensor_rate_1) }, \ - { "visensor_rate_2", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_sensorpod_status_t, visensor_rate_2) }, \ - { "visensor_rate_3", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_sensorpod_status_t, visensor_rate_3) }, \ - { "visensor_rate_4", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_sensorpod_status_t, visensor_rate_4) }, \ - { "recording_nodes_count", NULL, MAVLINK_TYPE_UINT8_T, 0, 14, offsetof(mavlink_sensorpod_status_t, recording_nodes_count) }, \ - { "cpu_temp", NULL, MAVLINK_TYPE_UINT8_T, 0, 15, offsetof(mavlink_sensorpod_status_t, cpu_temp) }, \ - { "free_space", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_sensorpod_status_t, free_space) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_SENSORPOD_STATUS { \ - "SENSORPOD_STATUS", \ - 8, \ - { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_sensorpod_status_t, timestamp) }, \ - { "visensor_rate_1", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_sensorpod_status_t, visensor_rate_1) }, \ - { "visensor_rate_2", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_sensorpod_status_t, visensor_rate_2) }, \ - { "visensor_rate_3", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_sensorpod_status_t, visensor_rate_3) }, \ - { "visensor_rate_4", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_sensorpod_status_t, visensor_rate_4) }, \ - { "recording_nodes_count", NULL, MAVLINK_TYPE_UINT8_T, 0, 14, offsetof(mavlink_sensorpod_status_t, recording_nodes_count) }, \ - { "cpu_temp", NULL, MAVLINK_TYPE_UINT8_T, 0, 15, offsetof(mavlink_sensorpod_status_t, cpu_temp) }, \ - { "free_space", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_sensorpod_status_t, free_space) }, \ - } \ -} -#endif - -/** - * @brief Pack a sensorpod_status message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param timestamp [ms] Timestamp in linuxtime (since 1.1.1970) - * @param visensor_rate_1 Rate of ROS topic 1 - * @param visensor_rate_2 Rate of ROS topic 2 - * @param visensor_rate_3 Rate of ROS topic 3 - * @param visensor_rate_4 Rate of ROS topic 4 - * @param recording_nodes_count Number of recording nodes - * @param cpu_temp [degC] Temperature of sensorpod CPU in - * @param free_space Free space available in recordings directory in [Gb] * 1e2 - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_sensorpod_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint64_t timestamp, uint8_t visensor_rate_1, uint8_t visensor_rate_2, uint8_t visensor_rate_3, uint8_t visensor_rate_4, uint8_t recording_nodes_count, uint8_t cpu_temp, uint16_t free_space) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SENSORPOD_STATUS_LEN]; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_uint16_t(buf, 8, free_space); - _mav_put_uint8_t(buf, 10, visensor_rate_1); - _mav_put_uint8_t(buf, 11, visensor_rate_2); - _mav_put_uint8_t(buf, 12, visensor_rate_3); - _mav_put_uint8_t(buf, 13, visensor_rate_4); - _mav_put_uint8_t(buf, 14, recording_nodes_count); - _mav_put_uint8_t(buf, 15, cpu_temp); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SENSORPOD_STATUS_LEN); -#else - mavlink_sensorpod_status_t packet; - packet.timestamp = timestamp; - packet.free_space = free_space; - packet.visensor_rate_1 = visensor_rate_1; - packet.visensor_rate_2 = visensor_rate_2; - packet.visensor_rate_3 = visensor_rate_3; - packet.visensor_rate_4 = visensor_rate_4; - packet.recording_nodes_count = recording_nodes_count; - packet.cpu_temp = cpu_temp; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SENSORPOD_STATUS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SENSORPOD_STATUS; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SENSORPOD_STATUS_MIN_LEN, MAVLINK_MSG_ID_SENSORPOD_STATUS_LEN, MAVLINK_MSG_ID_SENSORPOD_STATUS_CRC); -} - -/** - * @brief Pack a sensorpod_status message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param timestamp [ms] Timestamp in linuxtime (since 1.1.1970) - * @param visensor_rate_1 Rate of ROS topic 1 - * @param visensor_rate_2 Rate of ROS topic 2 - * @param visensor_rate_3 Rate of ROS topic 3 - * @param visensor_rate_4 Rate of ROS topic 4 - * @param recording_nodes_count Number of recording nodes - * @param cpu_temp [degC] Temperature of sensorpod CPU in - * @param free_space Free space available in recordings directory in [Gb] * 1e2 - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_sensorpod_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint64_t timestamp,uint8_t visensor_rate_1,uint8_t visensor_rate_2,uint8_t visensor_rate_3,uint8_t visensor_rate_4,uint8_t recording_nodes_count,uint8_t cpu_temp,uint16_t free_space) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SENSORPOD_STATUS_LEN]; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_uint16_t(buf, 8, free_space); - _mav_put_uint8_t(buf, 10, visensor_rate_1); - _mav_put_uint8_t(buf, 11, visensor_rate_2); - _mav_put_uint8_t(buf, 12, visensor_rate_3); - _mav_put_uint8_t(buf, 13, visensor_rate_4); - _mav_put_uint8_t(buf, 14, recording_nodes_count); - _mav_put_uint8_t(buf, 15, cpu_temp); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SENSORPOD_STATUS_LEN); -#else - mavlink_sensorpod_status_t packet; - packet.timestamp = timestamp; - packet.free_space = free_space; - packet.visensor_rate_1 = visensor_rate_1; - packet.visensor_rate_2 = visensor_rate_2; - packet.visensor_rate_3 = visensor_rate_3; - packet.visensor_rate_4 = visensor_rate_4; - packet.recording_nodes_count = recording_nodes_count; - packet.cpu_temp = cpu_temp; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SENSORPOD_STATUS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SENSORPOD_STATUS; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SENSORPOD_STATUS_MIN_LEN, MAVLINK_MSG_ID_SENSORPOD_STATUS_LEN, MAVLINK_MSG_ID_SENSORPOD_STATUS_CRC); -} - -/** - * @brief Encode a sensorpod_status struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param sensorpod_status C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_sensorpod_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_sensorpod_status_t* sensorpod_status) -{ - return mavlink_msg_sensorpod_status_pack(system_id, component_id, msg, sensorpod_status->timestamp, sensorpod_status->visensor_rate_1, sensorpod_status->visensor_rate_2, sensorpod_status->visensor_rate_3, sensorpod_status->visensor_rate_4, sensorpod_status->recording_nodes_count, sensorpod_status->cpu_temp, sensorpod_status->free_space); -} - -/** - * @brief Encode a sensorpod_status struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param sensorpod_status C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_sensorpod_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_sensorpod_status_t* sensorpod_status) -{ - return mavlink_msg_sensorpod_status_pack_chan(system_id, component_id, chan, msg, sensorpod_status->timestamp, sensorpod_status->visensor_rate_1, sensorpod_status->visensor_rate_2, sensorpod_status->visensor_rate_3, sensorpod_status->visensor_rate_4, sensorpod_status->recording_nodes_count, sensorpod_status->cpu_temp, sensorpod_status->free_space); -} - -/** - * @brief Send a sensorpod_status message - * @param chan MAVLink channel to send the message - * - * @param timestamp [ms] Timestamp in linuxtime (since 1.1.1970) - * @param visensor_rate_1 Rate of ROS topic 1 - * @param visensor_rate_2 Rate of ROS topic 2 - * @param visensor_rate_3 Rate of ROS topic 3 - * @param visensor_rate_4 Rate of ROS topic 4 - * @param recording_nodes_count Number of recording nodes - * @param cpu_temp [degC] Temperature of sensorpod CPU in - * @param free_space Free space available in recordings directory in [Gb] * 1e2 - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_sensorpod_status_send(mavlink_channel_t chan, uint64_t timestamp, uint8_t visensor_rate_1, uint8_t visensor_rate_2, uint8_t visensor_rate_3, uint8_t visensor_rate_4, uint8_t recording_nodes_count, uint8_t cpu_temp, uint16_t free_space) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SENSORPOD_STATUS_LEN]; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_uint16_t(buf, 8, free_space); - _mav_put_uint8_t(buf, 10, visensor_rate_1); - _mav_put_uint8_t(buf, 11, visensor_rate_2); - _mav_put_uint8_t(buf, 12, visensor_rate_3); - _mav_put_uint8_t(buf, 13, visensor_rate_4); - _mav_put_uint8_t(buf, 14, recording_nodes_count); - _mav_put_uint8_t(buf, 15, cpu_temp); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENSORPOD_STATUS, buf, MAVLINK_MSG_ID_SENSORPOD_STATUS_MIN_LEN, MAVLINK_MSG_ID_SENSORPOD_STATUS_LEN, MAVLINK_MSG_ID_SENSORPOD_STATUS_CRC); -#else - mavlink_sensorpod_status_t packet; - packet.timestamp = timestamp; - packet.free_space = free_space; - packet.visensor_rate_1 = visensor_rate_1; - packet.visensor_rate_2 = visensor_rate_2; - packet.visensor_rate_3 = visensor_rate_3; - packet.visensor_rate_4 = visensor_rate_4; - packet.recording_nodes_count = recording_nodes_count; - packet.cpu_temp = cpu_temp; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENSORPOD_STATUS, (const char *)&packet, MAVLINK_MSG_ID_SENSORPOD_STATUS_MIN_LEN, MAVLINK_MSG_ID_SENSORPOD_STATUS_LEN, MAVLINK_MSG_ID_SENSORPOD_STATUS_CRC); -#endif -} - -/** - * @brief Send a sensorpod_status message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_sensorpod_status_send_struct(mavlink_channel_t chan, const mavlink_sensorpod_status_t* sensorpod_status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_sensorpod_status_send(chan, sensorpod_status->timestamp, sensorpod_status->visensor_rate_1, sensorpod_status->visensor_rate_2, sensorpod_status->visensor_rate_3, sensorpod_status->visensor_rate_4, sensorpod_status->recording_nodes_count, sensorpod_status->cpu_temp, sensorpod_status->free_space); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENSORPOD_STATUS, (const char *)sensorpod_status, MAVLINK_MSG_ID_SENSORPOD_STATUS_MIN_LEN, MAVLINK_MSG_ID_SENSORPOD_STATUS_LEN, MAVLINK_MSG_ID_SENSORPOD_STATUS_CRC); -#endif -} - -#if MAVLINK_MSG_ID_SENSORPOD_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_sensorpod_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t timestamp, uint8_t visensor_rate_1, uint8_t visensor_rate_2, uint8_t visensor_rate_3, uint8_t visensor_rate_4, uint8_t recording_nodes_count, uint8_t cpu_temp, uint16_t free_space) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint64_t(buf, 0, timestamp); - _mav_put_uint16_t(buf, 8, free_space); - _mav_put_uint8_t(buf, 10, visensor_rate_1); - _mav_put_uint8_t(buf, 11, visensor_rate_2); - _mav_put_uint8_t(buf, 12, visensor_rate_3); - _mav_put_uint8_t(buf, 13, visensor_rate_4); - _mav_put_uint8_t(buf, 14, recording_nodes_count); - _mav_put_uint8_t(buf, 15, cpu_temp); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENSORPOD_STATUS, buf, MAVLINK_MSG_ID_SENSORPOD_STATUS_MIN_LEN, MAVLINK_MSG_ID_SENSORPOD_STATUS_LEN, MAVLINK_MSG_ID_SENSORPOD_STATUS_CRC); -#else - mavlink_sensorpod_status_t *packet = (mavlink_sensorpod_status_t *)msgbuf; - packet->timestamp = timestamp; - packet->free_space = free_space; - packet->visensor_rate_1 = visensor_rate_1; - packet->visensor_rate_2 = visensor_rate_2; - packet->visensor_rate_3 = visensor_rate_3; - packet->visensor_rate_4 = visensor_rate_4; - packet->recording_nodes_count = recording_nodes_count; - packet->cpu_temp = cpu_temp; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENSORPOD_STATUS, (const char *)packet, MAVLINK_MSG_ID_SENSORPOD_STATUS_MIN_LEN, MAVLINK_MSG_ID_SENSORPOD_STATUS_LEN, MAVLINK_MSG_ID_SENSORPOD_STATUS_CRC); -#endif -} -#endif - -#endif - -// MESSAGE SENSORPOD_STATUS UNPACKING - - -/** - * @brief Get field timestamp from sensorpod_status message - * - * @return [ms] Timestamp in linuxtime (since 1.1.1970) - */ -static inline uint64_t mavlink_msg_sensorpod_status_get_timestamp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint64_t(msg, 0); -} - -/** - * @brief Get field visensor_rate_1 from sensorpod_status message - * - * @return Rate of ROS topic 1 - */ -static inline uint8_t mavlink_msg_sensorpod_status_get_visensor_rate_1(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 10); -} - -/** - * @brief Get field visensor_rate_2 from sensorpod_status message - * - * @return Rate of ROS topic 2 - */ -static inline uint8_t mavlink_msg_sensorpod_status_get_visensor_rate_2(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 11); -} - -/** - * @brief Get field visensor_rate_3 from sensorpod_status message - * - * @return Rate of ROS topic 3 - */ -static inline uint8_t mavlink_msg_sensorpod_status_get_visensor_rate_3(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 12); -} - -/** - * @brief Get field visensor_rate_4 from sensorpod_status message - * - * @return Rate of ROS topic 4 - */ -static inline uint8_t mavlink_msg_sensorpod_status_get_visensor_rate_4(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 13); -} - -/** - * @brief Get field recording_nodes_count from sensorpod_status message - * - * @return Number of recording nodes - */ -static inline uint8_t mavlink_msg_sensorpod_status_get_recording_nodes_count(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 14); -} - -/** - * @brief Get field cpu_temp from sensorpod_status message - * - * @return [degC] Temperature of sensorpod CPU in - */ -static inline uint8_t mavlink_msg_sensorpod_status_get_cpu_temp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 15); -} - -/** - * @brief Get field free_space from sensorpod_status message - * - * @return Free space available in recordings directory in [Gb] * 1e2 - */ -static inline uint16_t mavlink_msg_sensorpod_status_get_free_space(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 8); -} - -/** - * @brief Decode a sensorpod_status message into a struct - * - * @param msg The message to decode - * @param sensorpod_status C-struct to decode the message contents into - */ -static inline void mavlink_msg_sensorpod_status_decode(const mavlink_message_t* msg, mavlink_sensorpod_status_t* sensorpod_status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - sensorpod_status->timestamp = mavlink_msg_sensorpod_status_get_timestamp(msg); - sensorpod_status->free_space = mavlink_msg_sensorpod_status_get_free_space(msg); - sensorpod_status->visensor_rate_1 = mavlink_msg_sensorpod_status_get_visensor_rate_1(msg); - sensorpod_status->visensor_rate_2 = mavlink_msg_sensorpod_status_get_visensor_rate_2(msg); - sensorpod_status->visensor_rate_3 = mavlink_msg_sensorpod_status_get_visensor_rate_3(msg); - sensorpod_status->visensor_rate_4 = mavlink_msg_sensorpod_status_get_visensor_rate_4(msg); - sensorpod_status->recording_nodes_count = mavlink_msg_sensorpod_status_get_recording_nodes_count(msg); - sensorpod_status->cpu_temp = mavlink_msg_sensorpod_status_get_cpu_temp(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_SENSORPOD_STATUS_LEN? msg->len : MAVLINK_MSG_ID_SENSORPOD_STATUS_LEN; - memset(sensorpod_status, 0, MAVLINK_MSG_ID_SENSORPOD_STATUS_LEN); - memcpy(sensorpod_status, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ASLUAV/testsuite.h b/ASLUAV/testsuite.h deleted file mode 100644 index 65e12a289..000000000 --- a/ASLUAV/testsuite.h +++ /dev/null @@ -1,1136 +0,0 @@ -/** @file - * @brief MAVLink comm protocol testsuite generated from ASLUAV.xml - * @see http://qgroundcontrol.org/mavlink/ - */ -#pragma once -#ifndef ASLUAV_TESTSUITE_H -#define ASLUAV_TESTSUITE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef MAVLINK_TEST_ALL -#define MAVLINK_TEST_ALL -static void mavlink_test_common(uint8_t, uint8_t, mavlink_message_t *last_msg); -static void mavlink_test_ASLUAV(uint8_t, uint8_t, mavlink_message_t *last_msg); - -static void mavlink_test_all(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) -{ - mavlink_test_common(system_id, component_id, last_msg); - mavlink_test_ASLUAV(system_id, component_id, last_msg); -} -#endif - -#include "../common/testsuite.h" - - -static void mavlink_test_command_int_stamped(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) -{ -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); - if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_COMMAND_INT_STAMPED >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_command_int_stamped_t packet_in = { - 93372036854775807ULL,963497880,101.0,129.0,157.0,185.0,963498920,963499128,269.0,19315,3,70,137,204,15 - }; - mavlink_command_int_stamped_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.vehicle_timestamp = packet_in.vehicle_timestamp; - packet1.utc_time = packet_in.utc_time; - packet1.param1 = packet_in.param1; - packet1.param2 = packet_in.param2; - packet1.param3 = packet_in.param3; - packet1.param4 = packet_in.param4; - packet1.x = packet_in.x; - packet1.y = packet_in.y; - packet1.z = packet_in.z; - packet1.command = packet_in.command; - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - packet1.frame = packet_in.frame; - packet1.current = packet_in.current; - packet1.autocontinue = packet_in.autocontinue; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_COMMAND_INT_STAMPED_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_COMMAND_INT_STAMPED_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_command_int_stamped_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_command_int_stamped_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_command_int_stamped_pack(system_id, component_id, &msg , packet1.utc_time , packet1.vehicle_timestamp , packet1.target_system , packet1.target_component , packet1.frame , packet1.command , packet1.current , packet1.autocontinue , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.x , packet1.y , packet1.z ); - mavlink_msg_command_int_stamped_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_command_int_stamped_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.utc_time , packet1.vehicle_timestamp , packet1.target_system , packet1.target_component , packet1.frame , packet1.command , packet1.current , packet1.autocontinue , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.x , packet1.y , packet1.z ); - mavlink_msg_command_int_stamped_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_COMMAND_LONG_STAMPED >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_command_long_stamped_t packet_in = { - 93372036854775807ULL,963497880,101.0,129.0,157.0,185.0,213.0,241.0,269.0,19315,3,70,137 - }; - mavlink_command_long_stamped_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.vehicle_timestamp = packet_in.vehicle_timestamp; - packet1.utc_time = packet_in.utc_time; - packet1.param1 = packet_in.param1; - packet1.param2 = packet_in.param2; - packet1.param3 = packet_in.param3; - packet1.param4 = packet_in.param4; - packet1.param5 = packet_in.param5; - packet1.param6 = packet_in.param6; - packet1.param7 = packet_in.param7; - packet1.command = packet_in.command; - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - packet1.confirmation = packet_in.confirmation; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_command_long_stamped_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_command_long_stamped_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_command_long_stamped_pack(system_id, component_id, &msg , packet1.utc_time , packet1.vehicle_timestamp , packet1.target_system , packet1.target_component , packet1.command , packet1.confirmation , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.param5 , packet1.param6 , packet1.param7 ); - mavlink_msg_command_long_stamped_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_command_long_stamped_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.utc_time , packet1.vehicle_timestamp , packet1.target_system , packet1.target_component , packet1.command , packet1.confirmation , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.param5 , packet1.param6 , packet1.param7 ); - mavlink_msg_command_long_stamped_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SENS_POWER >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_sens_power_t packet_in = { - 17.0,45.0,73.0,101.0 - }; - mavlink_sens_power_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.adc121_vspb_volt = packet_in.adc121_vspb_volt; - packet1.adc121_cspb_amp = packet_in.adc121_cspb_amp; - packet1.adc121_cs1_amp = packet_in.adc121_cs1_amp; - packet1.adc121_cs2_amp = packet_in.adc121_cs2_amp; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_SENS_POWER_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SENS_POWER_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_sens_power_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_sens_power_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_sens_power_pack(system_id, component_id, &msg , packet1.adc121_vspb_volt , packet1.adc121_cspb_amp , packet1.adc121_cs1_amp , packet1.adc121_cs2_amp ); - mavlink_msg_sens_power_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_sens_power_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.adc121_vspb_volt , packet1.adc121_cspb_amp , packet1.adc121_cs1_amp , packet1.adc121_cs2_amp ); - mavlink_msg_sens_power_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SENS_MPPT >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_sens_mppt_t packet_in = { - 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,18899,19003,19107,247,58,125 - }; - mavlink_sens_mppt_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.mppt_timestamp = packet_in.mppt_timestamp; - packet1.mppt1_volt = packet_in.mppt1_volt; - packet1.mppt1_amp = packet_in.mppt1_amp; - packet1.mppt2_volt = packet_in.mppt2_volt; - packet1.mppt2_amp = packet_in.mppt2_amp; - packet1.mppt3_volt = packet_in.mppt3_volt; - packet1.mppt3_amp = packet_in.mppt3_amp; - packet1.mppt1_pwm = packet_in.mppt1_pwm; - packet1.mppt2_pwm = packet_in.mppt2_pwm; - packet1.mppt3_pwm = packet_in.mppt3_pwm; - packet1.mppt1_status = packet_in.mppt1_status; - packet1.mppt2_status = packet_in.mppt2_status; - packet1.mppt3_status = packet_in.mppt3_status; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_SENS_MPPT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SENS_MPPT_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_sens_mppt_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_sens_mppt_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_sens_mppt_pack(system_id, component_id, &msg , packet1.mppt_timestamp , packet1.mppt1_volt , packet1.mppt1_amp , packet1.mppt1_pwm , packet1.mppt1_status , packet1.mppt2_volt , packet1.mppt2_amp , packet1.mppt2_pwm , packet1.mppt2_status , packet1.mppt3_volt , packet1.mppt3_amp , packet1.mppt3_pwm , packet1.mppt3_status ); - mavlink_msg_sens_mppt_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_sens_mppt_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.mppt_timestamp , packet1.mppt1_volt , packet1.mppt1_amp , packet1.mppt1_pwm , packet1.mppt1_status , packet1.mppt2_volt , packet1.mppt2_amp , packet1.mppt2_pwm , packet1.mppt2_status , packet1.mppt3_volt , packet1.mppt3_amp , packet1.mppt3_pwm , packet1.mppt3_status ); - mavlink_msg_sens_mppt_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ASLCTRL_DATA >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_aslctrl_data_t packet_in = { - 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,241.0,269.0,297.0,325.0,353.0,381.0,409.0,437.0,465.0,493.0,521.0,549.0,577.0,605.0,633.0,661.0,37,104 - }; - mavlink_aslctrl_data_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.timestamp = packet_in.timestamp; - packet1.h = packet_in.h; - packet1.hRef = packet_in.hRef; - packet1.hRef_t = packet_in.hRef_t; - packet1.PitchAngle = packet_in.PitchAngle; - packet1.PitchAngleRef = packet_in.PitchAngleRef; - packet1.q = packet_in.q; - packet1.qRef = packet_in.qRef; - packet1.uElev = packet_in.uElev; - packet1.uThrot = packet_in.uThrot; - packet1.uThrot2 = packet_in.uThrot2; - packet1.nZ = packet_in.nZ; - packet1.AirspeedRef = packet_in.AirspeedRef; - packet1.YawAngle = packet_in.YawAngle; - packet1.YawAngleRef = packet_in.YawAngleRef; - packet1.RollAngle = packet_in.RollAngle; - packet1.RollAngleRef = packet_in.RollAngleRef; - packet1.p = packet_in.p; - packet1.pRef = packet_in.pRef; - packet1.r = packet_in.r; - packet1.rRef = packet_in.rRef; - packet1.uAil = packet_in.uAil; - packet1.uRud = packet_in.uRud; - packet1.aslctrl_mode = packet_in.aslctrl_mode; - packet1.SpoilersEngaged = packet_in.SpoilersEngaged; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_ASLCTRL_DATA_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ASLCTRL_DATA_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_aslctrl_data_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_aslctrl_data_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_aslctrl_data_pack(system_id, component_id, &msg , packet1.timestamp , packet1.aslctrl_mode , packet1.h , packet1.hRef , packet1.hRef_t , packet1.PitchAngle , packet1.PitchAngleRef , packet1.q , packet1.qRef , packet1.uElev , packet1.uThrot , packet1.uThrot2 , packet1.nZ , packet1.AirspeedRef , packet1.SpoilersEngaged , packet1.YawAngle , packet1.YawAngleRef , packet1.RollAngle , packet1.RollAngleRef , packet1.p , packet1.pRef , packet1.r , packet1.rRef , packet1.uAil , packet1.uRud ); - mavlink_msg_aslctrl_data_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_aslctrl_data_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timestamp , packet1.aslctrl_mode , packet1.h , packet1.hRef , packet1.hRef_t , packet1.PitchAngle , packet1.PitchAngleRef , packet1.q , packet1.qRef , packet1.uElev , packet1.uThrot , packet1.uThrot2 , packet1.nZ , packet1.AirspeedRef , packet1.SpoilersEngaged , packet1.YawAngle , packet1.YawAngleRef , packet1.RollAngle , packet1.RollAngleRef , packet1.p , packet1.pRef , packet1.r , packet1.rRef , packet1.uAil , packet1.uRud ); - mavlink_msg_aslctrl_data_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ASLCTRL_DEBUG >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_aslctrl_debug_t packet_in = { - 963497464,45.0,73.0,101.0,129.0,157.0,185.0,213.0,241.0,113,180 - }; - mavlink_aslctrl_debug_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.i32_1 = packet_in.i32_1; - packet1.f_1 = packet_in.f_1; - packet1.f_2 = packet_in.f_2; - packet1.f_3 = packet_in.f_3; - packet1.f_4 = packet_in.f_4; - packet1.f_5 = packet_in.f_5; - packet1.f_6 = packet_in.f_6; - packet1.f_7 = packet_in.f_7; - packet1.f_8 = packet_in.f_8; - packet1.i8_1 = packet_in.i8_1; - packet1.i8_2 = packet_in.i8_2; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_ASLCTRL_DEBUG_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ASLCTRL_DEBUG_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_aslctrl_debug_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_aslctrl_debug_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_aslctrl_debug_pack(system_id, component_id, &msg , packet1.i32_1 , packet1.i8_1 , packet1.i8_2 , packet1.f_1 , packet1.f_2 , packet1.f_3 , packet1.f_4 , packet1.f_5 , packet1.f_6 , packet1.f_7 , packet1.f_8 ); - mavlink_msg_aslctrl_debug_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_aslctrl_debug_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.i32_1 , packet1.i8_1 , packet1.i8_2 , packet1.f_1 , packet1.f_2 , packet1.f_3 , packet1.f_4 , packet1.f_5 , packet1.f_6 , packet1.f_7 , packet1.f_8 ); - mavlink_msg_aslctrl_debug_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ASLUAV_STATUS >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_asluav_status_t packet_in = { - 17.0,17,84,{ 151, 152, 153, 154, 155, 156, 157, 158 } - }; - mavlink_asluav_status_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.Motor_rpm = packet_in.Motor_rpm; - packet1.LED_status = packet_in.LED_status; - packet1.SATCOM_status = packet_in.SATCOM_status; - - mav_array_memcpy(packet1.Servo_status, packet_in.Servo_status, sizeof(uint8_t)*8); - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_ASLUAV_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ASLUAV_STATUS_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_asluav_status_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_asluav_status_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_asluav_status_pack(system_id, component_id, &msg , packet1.LED_status , packet1.SATCOM_status , packet1.Servo_status , packet1.Motor_rpm ); - mavlink_msg_asluav_status_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_asluav_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.LED_status , packet1.SATCOM_status , packet1.Servo_status , packet1.Motor_rpm ); - mavlink_msg_asluav_status_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_EKF_EXT >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_ekf_ext_t packet_in = { - 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0 - }; - mavlink_ekf_ext_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.timestamp = packet_in.timestamp; - packet1.Windspeed = packet_in.Windspeed; - packet1.WindDir = packet_in.WindDir; - packet1.WindZ = packet_in.WindZ; - packet1.Airspeed = packet_in.Airspeed; - packet1.beta = packet_in.beta; - packet1.alpha = packet_in.alpha; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_EKF_EXT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_EKF_EXT_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_ekf_ext_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_ekf_ext_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_ekf_ext_pack(system_id, component_id, &msg , packet1.timestamp , packet1.Windspeed , packet1.WindDir , packet1.WindZ , packet1.Airspeed , packet1.beta , packet1.alpha ); - mavlink_msg_ekf_ext_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_ekf_ext_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timestamp , packet1.Windspeed , packet1.WindDir , packet1.WindZ , packet1.Airspeed , packet1.beta , packet1.alpha ); - mavlink_msg_ekf_ext_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ASL_OBCTRL >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_asl_obctrl_t packet_in = { - 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,101 - }; - mavlink_asl_obctrl_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.timestamp = packet_in.timestamp; - packet1.uElev = packet_in.uElev; - packet1.uThrot = packet_in.uThrot; - packet1.uThrot2 = packet_in.uThrot2; - packet1.uAilL = packet_in.uAilL; - packet1.uAilR = packet_in.uAilR; - packet1.uRud = packet_in.uRud; - packet1.obctrl_status = packet_in.obctrl_status; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_ASL_OBCTRL_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ASL_OBCTRL_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_asl_obctrl_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_asl_obctrl_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_asl_obctrl_pack(system_id, component_id, &msg , packet1.timestamp , packet1.uElev , packet1.uThrot , packet1.uThrot2 , packet1.uAilL , packet1.uAilR , packet1.uRud , packet1.obctrl_status ); - mavlink_msg_asl_obctrl_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_asl_obctrl_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timestamp , packet1.uElev , packet1.uThrot , packet1.uThrot2 , packet1.uAilL , packet1.uAilR , packet1.uRud , packet1.obctrl_status ); - mavlink_msg_asl_obctrl_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SENS_ATMOS >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_sens_atmos_t packet_in = { - 93372036854775807ULL,73.0,101.0 - }; - mavlink_sens_atmos_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.timestamp = packet_in.timestamp; - packet1.TempAmbient = packet_in.TempAmbient; - packet1.Humidity = packet_in.Humidity; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_SENS_ATMOS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SENS_ATMOS_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_sens_atmos_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_sens_atmos_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_sens_atmos_pack(system_id, component_id, &msg , packet1.timestamp , packet1.TempAmbient , packet1.Humidity ); - mavlink_msg_sens_atmos_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_sens_atmos_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timestamp , packet1.TempAmbient , packet1.Humidity ); - mavlink_msg_sens_atmos_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SENS_BATMON >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_sens_batmon_t packet_in = { - 93372036854775807ULL,73.0,963498088,963498296,18275,18379,18483,18587,18691,18795,18899,19003,19107,19211,125 - }; - mavlink_sens_batmon_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.batmon_timestamp = packet_in.batmon_timestamp; - packet1.temperature = packet_in.temperature; - packet1.safetystatus = packet_in.safetystatus; - packet1.operationstatus = packet_in.operationstatus; - packet1.voltage = packet_in.voltage; - packet1.current = packet_in.current; - packet1.batterystatus = packet_in.batterystatus; - packet1.serialnumber = packet_in.serialnumber; - packet1.cellvoltage1 = packet_in.cellvoltage1; - packet1.cellvoltage2 = packet_in.cellvoltage2; - packet1.cellvoltage3 = packet_in.cellvoltage3; - packet1.cellvoltage4 = packet_in.cellvoltage4; - packet1.cellvoltage5 = packet_in.cellvoltage5; - packet1.cellvoltage6 = packet_in.cellvoltage6; - packet1.SoC = packet_in.SoC; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_SENS_BATMON_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SENS_BATMON_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_sens_batmon_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_sens_batmon_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_sens_batmon_pack(system_id, component_id, &msg , packet1.batmon_timestamp , packet1.temperature , packet1.voltage , packet1.current , packet1.SoC , packet1.batterystatus , packet1.serialnumber , packet1.safetystatus , packet1.operationstatus , packet1.cellvoltage1 , packet1.cellvoltage2 , packet1.cellvoltage3 , packet1.cellvoltage4 , packet1.cellvoltage5 , packet1.cellvoltage6 ); - mavlink_msg_sens_batmon_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_sens_batmon_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.batmon_timestamp , packet1.temperature , packet1.voltage , packet1.current , packet1.SoC , packet1.batterystatus , packet1.serialnumber , packet1.safetystatus , packet1.operationstatus , packet1.cellvoltage1 , packet1.cellvoltage2 , packet1.cellvoltage3 , packet1.cellvoltage4 , packet1.cellvoltage5 , packet1.cellvoltage6 ); - mavlink_msg_sens_batmon_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_FW_SOARING_DATA >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_fw_soaring_data_t packet_in = { - 93372036854775807ULL,93372036854776311ULL,129.0,157.0,185.0,213.0,241.0,269.0,297.0,325.0,353.0,381.0,409.0,437.0,465.0,493.0,521.0,549.0,577.0,605.0,633.0,661.0,689.0,49,116 - }; - mavlink_fw_soaring_data_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.timestamp = packet_in.timestamp; - packet1.timestampModeChanged = packet_in.timestampModeChanged; - packet1.xW = packet_in.xW; - packet1.xR = packet_in.xR; - packet1.xLat = packet_in.xLat; - packet1.xLon = packet_in.xLon; - packet1.VarW = packet_in.VarW; - packet1.VarR = packet_in.VarR; - packet1.VarLat = packet_in.VarLat; - packet1.VarLon = packet_in.VarLon; - packet1.LoiterRadius = packet_in.LoiterRadius; - packet1.LoiterDirection = packet_in.LoiterDirection; - packet1.DistToSoarPoint = packet_in.DistToSoarPoint; - packet1.vSinkExp = packet_in.vSinkExp; - packet1.z1_LocalUpdraftSpeed = packet_in.z1_LocalUpdraftSpeed; - packet1.z2_DeltaRoll = packet_in.z2_DeltaRoll; - packet1.z1_exp = packet_in.z1_exp; - packet1.z2_exp = packet_in.z2_exp; - packet1.ThermalGSNorth = packet_in.ThermalGSNorth; - packet1.ThermalGSEast = packet_in.ThermalGSEast; - packet1.TSE_dot = packet_in.TSE_dot; - packet1.DebugVar1 = packet_in.DebugVar1; - packet1.DebugVar2 = packet_in.DebugVar2; - packet1.ControlMode = packet_in.ControlMode; - packet1.valid = packet_in.valid; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_FW_SOARING_DATA_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_FW_SOARING_DATA_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_fw_soaring_data_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_fw_soaring_data_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_fw_soaring_data_pack(system_id, component_id, &msg , packet1.timestamp , packet1.timestampModeChanged , packet1.xW , packet1.xR , packet1.xLat , packet1.xLon , packet1.VarW , packet1.VarR , packet1.VarLat , packet1.VarLon , packet1.LoiterRadius , packet1.LoiterDirection , packet1.DistToSoarPoint , packet1.vSinkExp , packet1.z1_LocalUpdraftSpeed , packet1.z2_DeltaRoll , packet1.z1_exp , packet1.z2_exp , packet1.ThermalGSNorth , packet1.ThermalGSEast , packet1.TSE_dot , packet1.DebugVar1 , packet1.DebugVar2 , packet1.ControlMode , packet1.valid ); - mavlink_msg_fw_soaring_data_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_fw_soaring_data_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timestamp , packet1.timestampModeChanged , packet1.xW , packet1.xR , packet1.xLat , packet1.xLon , packet1.VarW , packet1.VarR , packet1.VarLat , packet1.VarLon , packet1.LoiterRadius , packet1.LoiterDirection , packet1.DistToSoarPoint , packet1.vSinkExp , packet1.z1_LocalUpdraftSpeed , packet1.z2_DeltaRoll , packet1.z1_exp , packet1.z2_exp , packet1.ThermalGSNorth , packet1.ThermalGSEast , packet1.TSE_dot , packet1.DebugVar1 , packet1.DebugVar2 , packet1.ControlMode , packet1.valid ); - mavlink_msg_fw_soaring_data_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SENSORPOD_STATUS >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_sensorpod_status_t packet_in = { - 93372036854775807ULL,17651,163,230,41,108,175,242 - }; - mavlink_sensorpod_status_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.timestamp = packet_in.timestamp; - packet1.free_space = packet_in.free_space; - packet1.visensor_rate_1 = packet_in.visensor_rate_1; - packet1.visensor_rate_2 = packet_in.visensor_rate_2; - packet1.visensor_rate_3 = packet_in.visensor_rate_3; - packet1.visensor_rate_4 = packet_in.visensor_rate_4; - packet1.recording_nodes_count = packet_in.recording_nodes_count; - packet1.cpu_temp = packet_in.cpu_temp; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_SENSORPOD_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SENSORPOD_STATUS_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_sensorpod_status_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_sensorpod_status_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_sensorpod_status_pack(system_id, component_id, &msg , packet1.timestamp , packet1.visensor_rate_1 , packet1.visensor_rate_2 , packet1.visensor_rate_3 , packet1.visensor_rate_4 , packet1.recording_nodes_count , packet1.cpu_temp , packet1.free_space ); - mavlink_msg_sensorpod_status_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_sensorpod_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timestamp , packet1.visensor_rate_1 , packet1.visensor_rate_2 , packet1.visensor_rate_3 , packet1.visensor_rate_4 , packet1.recording_nodes_count , packet1.cpu_temp , packet1.free_space ); - mavlink_msg_sensorpod_status_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SENS_POWER_BOARD >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_sens_power_board_t packet_in = { - 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,241.0,269.0,297.0,137,204 - }; - mavlink_sens_power_board_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.timestamp = packet_in.timestamp; - packet1.pwr_brd_system_volt = packet_in.pwr_brd_system_volt; - packet1.pwr_brd_servo_volt = packet_in.pwr_brd_servo_volt; - packet1.pwr_brd_digital_volt = packet_in.pwr_brd_digital_volt; - packet1.pwr_brd_mot_l_amp = packet_in.pwr_brd_mot_l_amp; - packet1.pwr_brd_mot_r_amp = packet_in.pwr_brd_mot_r_amp; - packet1.pwr_brd_analog_amp = packet_in.pwr_brd_analog_amp; - packet1.pwr_brd_digital_amp = packet_in.pwr_brd_digital_amp; - packet1.pwr_brd_ext_amp = packet_in.pwr_brd_ext_amp; - packet1.pwr_brd_aux_amp = packet_in.pwr_brd_aux_amp; - packet1.pwr_brd_status = packet_in.pwr_brd_status; - packet1.pwr_brd_led_status = packet_in.pwr_brd_led_status; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_SENS_POWER_BOARD_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SENS_POWER_BOARD_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_sens_power_board_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_sens_power_board_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_sens_power_board_pack(system_id, component_id, &msg , packet1.timestamp , packet1.pwr_brd_status , packet1.pwr_brd_led_status , packet1.pwr_brd_system_volt , packet1.pwr_brd_servo_volt , packet1.pwr_brd_digital_volt , packet1.pwr_brd_mot_l_amp , packet1.pwr_brd_mot_r_amp , packet1.pwr_brd_analog_amp , packet1.pwr_brd_digital_amp , packet1.pwr_brd_ext_amp , packet1.pwr_brd_aux_amp ); - mavlink_msg_sens_power_board_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_sens_power_board_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timestamp , packet1.pwr_brd_status , packet1.pwr_brd_led_status , packet1.pwr_brd_system_volt , packet1.pwr_brd_servo_volt , packet1.pwr_brd_digital_volt , packet1.pwr_brd_mot_l_amp , packet1.pwr_brd_mot_r_amp , packet1.pwr_brd_analog_amp , packet1.pwr_brd_digital_amp , packet1.pwr_brd_ext_amp , packet1.pwr_brd_aux_amp ); - mavlink_msg_sens_power_board_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GSM_LINK_STATUS >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_gsm_link_status_t packet_in = { - 93372036854775807ULL,29,96,163,230,41,108 - }; - mavlink_gsm_link_status_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.timestamp = packet_in.timestamp; - packet1.gsm_modem_type = packet_in.gsm_modem_type; - packet1.gsm_link_type = packet_in.gsm_link_type; - packet1.rssi = packet_in.rssi; - packet1.rsrp_rscp = packet_in.rsrp_rscp; - packet1.sinr_ecio = packet_in.sinr_ecio; - packet1.rsrq = packet_in.rsrq; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_GSM_LINK_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GSM_LINK_STATUS_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gsm_link_status_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_gsm_link_status_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gsm_link_status_pack(system_id, component_id, &msg , packet1.timestamp , packet1.gsm_modem_type , packet1.gsm_link_type , packet1.rssi , packet1.rsrp_rscp , packet1.sinr_ecio , packet1.rsrq ); - mavlink_msg_gsm_link_status_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gsm_link_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timestamp , packet1.gsm_modem_type , packet1.gsm_link_type , packet1.rssi , packet1.rsrp_rscp , packet1.sinr_ecio , packet1.rsrq ); - mavlink_msg_gsm_link_status_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SATCOM_LINK_STATUS >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_satcom_link_status_t packet_in = { - 93372036854775807ULL,93372036854776311ULL,18067,18171,65,132,199,10 - }; - mavlink_satcom_link_status_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.timestamp = packet_in.timestamp; - packet1.last_heartbeat = packet_in.last_heartbeat; - packet1.failed_sessions = packet_in.failed_sessions; - packet1.successful_sessions = packet_in.successful_sessions; - packet1.signal_quality = packet_in.signal_quality; - packet1.ring_pending = packet_in.ring_pending; - packet1.tx_session_pending = packet_in.tx_session_pending; - packet1.rx_session_pending = packet_in.rx_session_pending; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_SATCOM_LINK_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SATCOM_LINK_STATUS_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_satcom_link_status_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_satcom_link_status_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_satcom_link_status_pack(system_id, component_id, &msg , packet1.timestamp , packet1.last_heartbeat , packet1.failed_sessions , packet1.successful_sessions , packet1.signal_quality , packet1.ring_pending , packet1.tx_session_pending , packet1.rx_session_pending ); - mavlink_msg_satcom_link_status_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_satcom_link_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timestamp , packet1.last_heartbeat , packet1.failed_sessions , packet1.successful_sessions , packet1.signal_quality , packet1.ring_pending , packet1.tx_session_pending , packet1.rx_session_pending ); - mavlink_msg_satcom_link_status_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_sensor_airflow_angles_t packet_in = { - 93372036854775807ULL,73.0,101.0,53,120 - }; - mavlink_sensor_airflow_angles_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.timestamp = packet_in.timestamp; - packet1.angleofattack = packet_in.angleofattack; - packet1.sideslip = packet_in.sideslip; - packet1.angleofattack_valid = packet_in.angleofattack_valid; - packet1.sideslip_valid = packet_in.sideslip_valid; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SENSOR_AIRFLOW_ANGLES_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_sensor_airflow_angles_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_sensor_airflow_angles_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_sensor_airflow_angles_pack(system_id, component_id, &msg , packet1.timestamp , packet1.angleofattack , packet1.angleofattack_valid , packet1.sideslip , packet1.sideslip_valid ); - mavlink_msg_sensor_airflow_angles_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_sensor_airflow_angles_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timestamp , packet1.angleofattack , packet1.angleofattack_valid , packet1.sideslip , packet1.sideslip_valid ); - mavlink_msg_sensor_airflow_angles_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; i 0 radius to pass by WP. Positive value for clockwise orbit, negative value for counter-clockwise orbit. Allows trajectory control.| Desired yaw angle at waypoint (rotary wing). NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_LOITER_UNLIM=17, /* Loiter around this waypoint an unlimited amount of time |Empty| Empty| Loiter radius around waypoint for forward-only moving vehicles (not multicopters). If positive loiter clockwise, else counter-clockwise| Desired yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_LOITER_TURNS=18, /* Loiter around this waypoint for X turns |Number of turns.| Leave loiter circle only once heading towards the next waypoint (0 = False)| Loiter radius around waypoint for forward-only moving vehicles (not multicopters). If positive loiter clockwise, else counter-clockwise| Loiter circle exit location and/or path to next waypoint ("xtrack") for forward-only moving vehicles (not multicopters). 0 for the vehicle to converge towards the center xtrack when it leaves the loiter (the line between the centers of the current and next waypoint), 1 to converge to the direct line between the location that the vehicle exits the loiter radius and the next waypoint. Otherwise the angle (in degrees) between the tangent of the loiter circle and the center xtrack at which the vehicle must leave the loiter (and converge to the center xtrack). NaN to use the current system default xtrack behaviour.| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_LOITER_TIME=19, /* Loiter at the specified latitude, longitude and altitude for a certain amount of time. Multicopter vehicles stop at the point (within a vehicle-specific acceptance radius). Forward-only moving vehicles (e.g. fixed-wing) circle the point with the specified radius/direction. If the Heading Required parameter (2) is non-zero forward moving aircraft will only leave the loiter circle once heading towards the next waypoint. |Loiter time (only starts once Lat, Lon and Alt is reached).| Leave loiter circle only once heading towards the next waypoint (0 = False)| Loiter radius around waypoint for forward-only moving vehicles (not multicopters). If positive loiter clockwise, else counter-clockwise.| Loiter circle exit location and/or path to next waypoint ("xtrack") for forward-only moving vehicles (not multicopters). 0 for the vehicle to converge towards the center xtrack when it leaves the loiter (the line between the centers of the current and next waypoint), 1 to converge to the direct line between the location that the vehicle exits the loiter radius and the next waypoint. Otherwise the angle (in degrees) between the tangent of the loiter circle and the center xtrack at which the vehicle must leave the loiter (and converge to the center xtrack). NaN to use the current system default xtrack behaviour.| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_RETURN_TO_LAUNCH=20, /* Return to launch location |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_NAV_LAND=21, /* Land at location. |Minimum target altitude if landing is aborted (0 = undefined/use system default).| Precision land mode.| Empty.| Desired yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude.| Longitude.| Landing altitude (ground level in current frame).| */ - MAV_CMD_NAV_TAKEOFF=22, /* Takeoff from ground / hand. Vehicles that support multiple takeoff modes (e.g. VTOL quadplane) should take off using the currently configured mode. |Minimum pitch (if airspeed sensor present), desired pitch without sensor| Empty| Empty| Yaw angle (if magnetometer present), ignored without magnetometer. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_LAND_LOCAL=23, /* Land at local position (local frame only) |Landing target number (if available)| Maximum accepted offset from desired landing position - computed magnitude from spherical coordinates: d = sqrt(x^2 + y^2 + z^2), which gives the maximum accepted distance between the desired landing position and the position where the vehicle is about to land| Landing descend rate| Desired yaw angle| Y-axis position| X-axis position| Z-axis / ground level position| */ - MAV_CMD_NAV_TAKEOFF_LOCAL=24, /* Takeoff from local position (local frame only) |Minimum pitch (if airspeed sensor present), desired pitch without sensor| Empty| Takeoff ascend rate| Yaw angle (if magnetometer or another yaw estimation source present), ignored without one of these| Y-axis position| X-axis position| Z-axis position| */ - MAV_CMD_NAV_FOLLOW=25, /* Vehicle following, i.e. this waypoint represents the position of a moving vehicle |Following logic to use (e.g. loitering or sinusoidal following) - depends on specific autopilot implementation| Ground speed of vehicle to be followed| Radius around waypoint. If positive loiter clockwise, else counter-clockwise| Desired yaw angle.| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_CONTINUE_AND_CHANGE_ALT=30, /* Continue on the current course and climb/descend to specified altitude. When the altitude is reached continue to the next command (i.e., don't proceed to the next command until the desired altitude is reached. |Climb or Descend (0 = Neutral, command completes when within 5m of this command's altitude, 1 = Climbing, command completes when at or above this command's altitude, 2 = Descending, command completes when at or below this command's altitude.| Empty| Empty| Empty| Empty| Empty| Desired altitude| */ - MAV_CMD_NAV_LOITER_TO_ALT=31, /* Begin loiter at the specified Latitude and Longitude. If Lat=Lon=0, then loiter at the current position. Don't consider the navigation command complete (don't leave loiter) until the altitude has been reached. Additionally, if the Heading Required parameter is non-zero the aircraft will not leave the loiter until heading toward the next waypoint. |Leave loiter circle only once heading towards the next waypoint (0 = False)| Loiter radius around waypoint for forward-only moving vehicles (not multicopters). If positive loiter clockwise, negative counter-clockwise, 0 means no change to standard loiter.| Empty| Loiter circle exit location and/or path to next waypoint ("xtrack") for forward-only moving vehicles (not multicopters). 0 for the vehicle to converge towards the center xtrack when it leaves the loiter (the line between the centers of the current and next waypoint), 1 to converge to the direct line between the location that the vehicle exits the loiter radius and the next waypoint. Otherwise the angle (in degrees) between the tangent of the loiter circle and the center xtrack at which the vehicle must leave the loiter (and converge to the center xtrack). NaN to use the current system default xtrack behaviour.| Latitude| Longitude| Altitude| */ - MAV_CMD_DO_FOLLOW=32, /* Begin following a target |System ID (of the FOLLOW_TARGET beacon). Send 0 to disable follow-me and return to the default position hold mode.| Reserved| Reserved| Altitude mode: 0: Keep current altitude, 1: keep altitude difference to target, 2: go to a fixed altitude above home.| Altitude above home. (used if mode=2)| Reserved| Time to land in which the MAV should go to the default position hold mode after a message RX timeout.| */ - MAV_CMD_DO_FOLLOW_REPOSITION=33, /* Reposition the MAV after a follow target command has been sent |Camera q1 (where 0 is on the ray from the camera to the tracking device)| Camera q2| Camera q3| Camera q4| altitude offset from target| X offset from target| Y offset from target| */ - MAV_CMD_DO_ORBIT=34, /* Start orbiting on the circumference of a circle defined by the parameters. Setting any value NaN results in using defaults. |Radius of the circle. positive: Orbit clockwise. negative: Orbit counter-clockwise.| Tangential Velocity. NaN: Vehicle configuration default.| Yaw behavior of the vehicle.| Reserved (e.g. for dynamic center beacon options)| Center point latitude (if no MAV_FRAME specified) / X coordinate according to MAV_FRAME. NaN: Use current vehicle position or current center if already orbiting.| Center point longitude (if no MAV_FRAME specified) / Y coordinate according to MAV_FRAME. NaN: Use current vehicle position or current center if already orbiting.| Center point altitude (MSL) (if no MAV_FRAME specified) / Z coordinate according to MAV_FRAME. NaN: Use current vehicle position or current center if already orbiting.| */ - MAV_CMD_NAV_ROI=80, /* Sets the region of interest (ROI) for a sensor set or the vehicle itself. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. |Region of interest mode.| Waypoint index/ target ID. (see MAV_ROI enum)| ROI index (allows a vehicle to manage multiple ROI's)| Empty| x the location of the fixed ROI (see MAV_FRAME)| y| z| */ - MAV_CMD_NAV_PATHPLANNING=81, /* Control autonomous path planning on the MAV. |0: Disable local obstacle avoidance / local path planning (without resetting map), 1: Enable local path planning, 2: Enable and reset local path planning| 0: Disable full path planning (without resetting map), 1: Enable, 2: Enable and reset map/occupancy grid, 3: Enable and reset planned route, but not occupancy grid| Empty| Yaw angle at goal| Latitude/X of goal| Longitude/Y of goal| Altitude/Z of goal| */ - MAV_CMD_NAV_SPLINE_WAYPOINT=82, /* Navigate to waypoint using a spline path. |Hold time. (ignored by fixed wing, time to stay at waypoint for rotary wing)| Empty| Empty| Empty| Latitude/X of goal| Longitude/Y of goal| Altitude/Z of goal| */ - MAV_CMD_NAV_ALTITUDE_WAIT=83, /* Mission command to wait for an altitude or downwards vertical speed. This is meant for high altitude balloon launches, allowing the aircraft to be idle until either an altitude is reached or a negative vertical speed is reached (indicating early balloon burst). The wiggle time is how often to wiggle the control surfaces to prevent them seizing up. |Altitude.| Descent speed.| How long to wiggle the control surfaces to prevent them seizing up.| Empty.| Empty.| Empty.| Empty.| */ - MAV_CMD_NAV_VTOL_TAKEOFF=84, /* Takeoff from ground using VTOL mode, and transition to forward flight with specified heading. The command should be ignored by vehicles that dont support both VTOL and fixed-wing flight (multicopters, boats,etc.). |Empty| Front transition heading.| Empty| Yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_VTOL_LAND=85, /* Land using VTOL mode |Empty| Empty| Approach altitude (with the same reference as the Altitude field). NaN if unspecified.| Yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude| Longitude| Altitude (ground level)| */ - MAV_CMD_NAV_GUIDED_ENABLE=92, /* hand control over to an external controller |On / Off (> 0.5f on)| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_NAV_DELAY=93, /* Delay the next navigation command a number of seconds or until a specified time |Delay (-1 to enable time-of-day fields)| hour (24h format, UTC, -1 to ignore)| minute (24h format, UTC, -1 to ignore)| second (24h format, UTC, -1 to ignore)| Empty| Empty| Empty| */ - MAV_CMD_NAV_PAYLOAD_PLACE=94, /* Descend and place payload. Vehicle moves to specified location, descends until it detects a hanging payload has reached the ground, and then releases the payload. If ground is not detected before the reaching the maximum descent value (param1), the command will complete without releasing the payload. |Maximum distance to descend.| Empty| Empty| Empty| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_LAST=95, /* NOP - This command is only used to mark the upper limit of the NAV/ACTION commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_CONDITION_DELAY=112, /* Delay mission state machine. |Delay| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_CONDITION_CHANGE_ALT=113, /* Ascend/descend to target altitude at specified rate. Delay mission state machine until desired altitude reached. |Descent / Ascend rate.| Empty| Empty| Empty| Empty| Empty| Target Altitude| */ - MAV_CMD_CONDITION_DISTANCE=114, /* Delay mission state machine until within desired distance of next NAV point. |Distance.| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_CONDITION_YAW=115, /* Reach a certain target angle. |target angle, 0 is north| angular speed| direction: -1: counter clockwise, 1: clockwise| 0: absolute angle, 1: relative offset| Empty| Empty| Empty| */ - MAV_CMD_CONDITION_LAST=159, /* NOP - This command is only used to mark the upper limit of the CONDITION commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_MODE=176, /* Set system mode. |Mode| Custom mode - this is system specific, please refer to the individual autopilot specifications for details.| Custom sub mode - this is system specific, please refer to the individual autopilot specifications for details.| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_JUMP=177, /* Jump to the desired command in the mission list. Repeat this action only the specified number of times |Sequence number| Repeat count| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_CHANGE_SPEED=178, /* Change speed and/or throttle set points. |Speed type (0=Airspeed, 1=Ground Speed, 2=Climb Speed, 3=Descent Speed)| Speed (-1 indicates no change)| Throttle (-1 indicates no change)| 0: absolute, 1: relative| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_HOME=179, /* Changes the home location either to the current location or a specified location. |Use current (1=use current location, 0=use specified location)| Empty| Empty| Yaw angle. NaN to use default heading| Latitude| Longitude| Altitude| */ - MAV_CMD_DO_SET_PARAMETER=180, /* Set a system parameter. Caution! Use of this command requires knowledge of the numeric enumeration value of the parameter. |Parameter number| Parameter value| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_RELAY=181, /* Set a relay to a condition. |Relay instance number.| Setting. (1=on, 0=off, others possible depending on system hardware)| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_REPEAT_RELAY=182, /* Cycle a relay on and off for a desired number of cycles with a desired period. |Relay instance number.| Cycle count.| Cycle time.| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_SERVO=183, /* Set a servo to a desired PWM value. |Servo instance number.| Pulse Width Modulation.| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_REPEAT_SERVO=184, /* Cycle a between its nominal setting and a desired PWM for a desired number of cycles with a desired period. |Servo instance number.| Pulse Width Modulation.| Cycle count.| Cycle time.| Empty| Empty| Empty| */ - MAV_CMD_DO_FLIGHTTERMINATION=185, /* Terminate flight immediately |Flight termination activated if > 0.5| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_CHANGE_ALTITUDE=186, /* Change altitude set point. |Altitude.| Frame of new altitude.| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_ACTUATOR=187, /* Sets actuators (e.g. servos) to a desired value. The actuator numbers are mapped to specific outputs (e.g. on any MAIN or AUX PWM or UAVCAN) using a flight-stack specific mechanism (i.e. a parameter). |Actuator 1 value, scaled from [-1 to 1]. NaN to ignore.| Actuator 2 value, scaled from [-1 to 1]. NaN to ignore.| Actuator 3 value, scaled from [-1 to 1]. NaN to ignore.| Actuator 4 value, scaled from [-1 to 1]. NaN to ignore.| Actuator 5 value, scaled from [-1 to 1]. NaN to ignore.| Actuator 6 value, scaled from [-1 to 1]. NaN to ignore.| Index of actuator set (i.e if set to 1, Actuator 1 becomes Actuator 7)| */ - MAV_CMD_DO_LAND_START=189, /* Mission command to perform a landing. This is used as a marker in a mission to tell the autopilot where a sequence of mission items that represents a landing starts. It may also be sent via a COMMAND_LONG to trigger a landing, in which case the nearest (geographically) landing sequence in the mission will be used. The Latitude/Longitude is optional, and may be set to 0 if not needed. If specified then it will be used to help find the closest landing sequence. |Empty| Empty| Empty| Empty| Latitude| Longitude| Empty| */ - MAV_CMD_DO_RALLY_LAND=190, /* Mission command to perform a landing from a rally point. |Break altitude| Landing speed| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_GO_AROUND=191, /* Mission command to safely abort an autonomous landing. |Altitude| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_REPOSITION=192, /* Reposition the vehicle to a specific WGS84 global position. |Ground speed, less than 0 (-1) for default| Bitmask of option flags.| Reserved| Yaw heading. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.). For planes indicates loiter direction (0: clockwise, 1: counter clockwise)| Latitude| Longitude| Altitude| */ - MAV_CMD_DO_PAUSE_CONTINUE=193, /* If in a GPS controlled position mode, hold the current position or continue. |0: Pause current mission or reposition command, hold current position. 1: Continue mission. A VTOL capable vehicle should enter hover mode (multicopter and VTOL planes). A plane should loiter with the default loiter radius.| Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| */ - MAV_CMD_DO_SET_REVERSE=194, /* Set moving direction to forward or reverse. |Direction (0=Forward, 1=Reverse)| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_ROI_LOCATION=195, /* Sets the region of interest (ROI) to a location. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. This command can be sent to a gimbal manager but not to a gimbal device. A gimbal is not to react to this message. |Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| Empty| Empty| Empty| Latitude of ROI location| Longitude of ROI location| Altitude of ROI location| */ - MAV_CMD_DO_SET_ROI_WPNEXT_OFFSET=196, /* Sets the region of interest (ROI) to be toward next waypoint, with optional pitch/roll/yaw offset. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. This command can be sent to a gimbal manager but not to a gimbal device. A gimbal device is not to react to this message. |Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| Empty| Empty| Empty| Pitch offset from next waypoint, positive pitching up| Roll offset from next waypoint, positive rolling to the right| Yaw offset from next waypoint, positive yawing to the right| */ - MAV_CMD_DO_SET_ROI_NONE=197, /* Cancels any previous ROI command returning the vehicle/sensors to default flight characteristics. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. This command can be sent to a gimbal manager but not to a gimbal device. A gimbal device is not to react to this message. After this command the gimbal manager should go back to manual input if available, and otherwise assume a neutral position. |Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_ROI_SYSID=198, /* Mount tracks system with specified system ID. Determination of target vehicle position may be done with GLOBAL_POSITION_INT or any other means. This command can be sent to a gimbal manager but not to a gimbal device. A gimbal device is not to react to this message. |System ID| Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_DO_CONTROL_VIDEO=200, /* Control onboard camera system. |Camera ID (-1 for all)| Transmission: 0: disabled, 1: enabled compressed, 2: enabled raw| Transmission mode: 0: video stream, >0: single images every n seconds| Recording: 0: disabled, 1: enabled compressed, 2: enabled raw| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_ROI=201, /* Sets the region of interest (ROI) for a sensor set or the vehicle itself. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. |Region of interest mode.| Waypoint index/ target ID (depends on param 1).| Region of interest index. (allows a vehicle to manage multiple ROI's)| Empty| MAV_ROI_WPNEXT: pitch offset from next waypoint, MAV_ROI_LOCATION: latitude| MAV_ROI_WPNEXT: roll offset from next waypoint, MAV_ROI_LOCATION: longitude| MAV_ROI_WPNEXT: yaw offset from next waypoint, MAV_ROI_LOCATION: altitude| */ - MAV_CMD_DO_DIGICAM_CONFIGURE=202, /* Configure digital camera. This is a fallback message for systems that have not yet implemented PARAM_EXT_XXX messages and camera definition files (see https://mavlink.io/en/services/camera_def.html ). |Modes: P, TV, AV, M, Etc.| Shutter speed: Divisor number for one second.| Aperture: F stop number.| ISO number e.g. 80, 100, 200, Etc.| Exposure type enumerator.| Command Identity.| Main engine cut-off time before camera trigger. (0 means no cut-off)| */ - MAV_CMD_DO_DIGICAM_CONTROL=203, /* Control digital camera. This is a fallback message for systems that have not yet implemented PARAM_EXT_XXX messages and camera definition files (see https://mavlink.io/en/services/camera_def.html ). |Session control e.g. show/hide lens| Zoom's absolute position| Zooming step value to offset zoom from the current position| Focus Locking, Unlocking or Re-locking| Shooting Command| Command Identity| Test shot identifier. If set to 1, image will only be captured, but not counted towards internal frame count.| */ - MAV_CMD_DO_MOUNT_CONFIGURE=204, /* Mission command to configure a camera or antenna mount |Mount operation mode| stabilize roll? (1 = yes, 0 = no)| stabilize pitch? (1 = yes, 0 = no)| stabilize yaw? (1 = yes, 0 = no)| roll input (0 = angle body frame, 1 = angular rate, 2 = angle absolute frame)| pitch input (0 = angle body frame, 1 = angular rate, 2 = angle absolute frame)| yaw input (0 = angle body frame, 1 = angular rate, 2 = angle absolute frame)| */ - MAV_CMD_DO_MOUNT_CONTROL=205, /* Mission command to control a camera or antenna mount |pitch depending on mount mode (degrees or degrees/second depending on pitch input).| roll depending on mount mode (degrees or degrees/second depending on roll input).| yaw depending on mount mode (degrees or degrees/second depending on yaw input).| altitude depending on mount mode.| latitude, set if appropriate mount mode.| longitude, set if appropriate mount mode.| Mount mode.| */ - MAV_CMD_DO_SET_CAM_TRIGG_DIST=206, /* Mission command to set camera trigger distance for this flight. The camera is triggered each time this distance is exceeded. This command can also be used to set the shutter integration time for the camera. |Camera trigger distance. 0 to stop triggering.| Camera shutter integration time. -1 or 0 to ignore| Trigger camera once immediately. (0 = no trigger, 1 = trigger)| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_FENCE_ENABLE=207, /* Mission command to enable the geofence |enable? (0=disable, 1=enable, 2=disable_floor_only)| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_PARACHUTE=208, /* Mission item/command to release a parachute or enable/disable auto release. |Action| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_MOTOR_TEST=209, /* Mission command to perform motor test. |Motor instance number. (from 1 to max number of motors on the vehicle)| Throttle type.| Throttle.| Timeout.| Motor count. (number of motors to test to test in sequence, waiting for the timeout above between them; 0=1 motor, 1=1 motor, 2=2 motors...)| Motor test order.| Empty| */ - MAV_CMD_DO_INVERTED_FLIGHT=210, /* Change to/from inverted flight. |Inverted flight. (0=normal, 1=inverted)| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_GRIPPER=211, /* Mission command to operate a gripper. |Gripper instance number.| Gripper action to perform.| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_AUTOTUNE_ENABLE=212, /* Enable/disable autotune. |Enable (1: enable, 0:disable).| Empty.| Empty.| Empty.| Empty.| Empty.| Empty.| */ - MAV_CMD_NAV_SET_YAW_SPEED=213, /* Sets a desired vehicle turn angle and speed change. |Yaw angle to adjust steering by.| Speed.| Final angle. (0=absolute, 1=relative)| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_CAM_TRIGG_INTERVAL=214, /* Mission command to set camera trigger interval for this flight. If triggering is enabled, the camera is triggered each time this interval expires. This command can also be used to set the shutter integration time for the camera. |Camera trigger cycle time. -1 or 0 to ignore.| Camera shutter integration time. Should be less than trigger cycle time. -1 or 0 to ignore.| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_RESUME_REPEAT_DIST=215, /* Set the distance to be repeated on mission resume |Distance.| Empty.| Empty.| Empty.| Empty.| Empty.| Empty.| */ - MAV_CMD_DO_MOUNT_CONTROL_QUAT=220, /* Mission command to control a camera or antenna mount, using a quaternion as reference. |quaternion param q1, w (1 in null-rotation)| quaternion param q2, x (0 in null-rotation)| quaternion param q3, y (0 in null-rotation)| quaternion param q4, z (0 in null-rotation)| Empty| Empty| Empty| */ - MAV_CMD_DO_GUIDED_MASTER=221, /* set id of master controller |System ID| Component ID| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_GUIDED_LIMITS=222, /* Set limits for external control |Timeout - maximum time that external controller will be allowed to control vehicle. 0 means no timeout.| Altitude (MSL) min - if vehicle moves below this alt, the command will be aborted and the mission will continue. 0 means no lower altitude limit.| Altitude (MSL) max - if vehicle moves above this alt, the command will be aborted and the mission will continue. 0 means no upper altitude limit.| Horizontal move limit - if vehicle moves more than this distance from its location at the moment the command was executed, the command will be aborted and the mission will continue. 0 means no horizontal move limit.| Empty| Empty| Empty| */ - MAV_CMD_DO_ENGINE_CONTROL=223, /* Control vehicle engine. This is interpreted by the vehicles engine controller to change the target engine state. It is intended for vehicles with internal combustion engines |0: Stop engine, 1:Start Engine| 0: Warm start, 1:Cold start. Controls use of choke where applicable| Height delay. This is for commanding engine start only after the vehicle has gained the specified height. Used in VTOL vehicles during takeoff to start engine after the aircraft is off the ground. Zero for no delay.| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_MISSION_CURRENT=224, /* Set the mission item with sequence number seq as current item. This means that the MAV will continue to this mission item on the shortest path (not following the mission items in-between). |Mission sequence value to set| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_LAST=240, /* NOP - This command is only used to mark the upper limit of the DO commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_PREFLIGHT_CALIBRATION=241, /* Trigger calibration. This command will be only accepted if in pre-flight mode. Except for Temperature Calibration, only one sensor should be set in a single message and all others should be zero. |1: gyro calibration, 3: gyro temperature calibration| 1: magnetometer calibration| 1: ground pressure calibration| 1: radio RC calibration, 2: RC trim calibration| 1: accelerometer calibration, 2: board level calibration, 3: accelerometer temperature calibration, 4: simple accelerometer calibration| 1: APM: compass/motor interference calibration (PX4: airspeed calibration, deprecated), 2: airspeed calibration| 1: ESC calibration, 3: barometer temperature calibration| */ - MAV_CMD_PREFLIGHT_SET_SENSOR_OFFSETS=242, /* Set sensor offsets. This command will be only accepted if in pre-flight mode. |Sensor to adjust the offsets for: 0: gyros, 1: accelerometer, 2: magnetometer, 3: barometer, 4: optical flow, 5: second magnetometer, 6: third magnetometer| X axis offset (or generic dimension 1), in the sensor's raw units| Y axis offset (or generic dimension 2), in the sensor's raw units| Z axis offset (or generic dimension 3), in the sensor's raw units| Generic dimension 4, in the sensor's raw units| Generic dimension 5, in the sensor's raw units| Generic dimension 6, in the sensor's raw units| */ - MAV_CMD_PREFLIGHT_UAVCAN=243, /* Trigger UAVCAN configuration (actuator ID assignment and direction mapping). Note that this maps to the legacy UAVCAN v0 function UAVCAN_ENUMERATE, which is intended to be executed just once during initial vehicle configuration (it is not a normal pre-flight command and has been poorly named). |1: Trigger actuator ID assignment and direction mapping. 0: Cancel command.| Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| */ - MAV_CMD_PREFLIGHT_STORAGE=245, /* Request storage of different parameter values and logs. This command will be only accepted if in pre-flight mode. |Parameter storage: 0: READ FROM FLASH/EEPROM, 1: WRITE CURRENT TO FLASH/EEPROM, 2: Reset to defaults| Mission storage: 0: READ FROM FLASH/EEPROM, 1: WRITE CURRENT TO FLASH/EEPROM, 2: Reset to defaults| Onboard logging: 0: Ignore, 1: Start default rate logging, -1: Stop logging, > 1: logging rate (e.g. set to 1000 for 1000 Hz logging)| Reserved| Empty| Empty| Empty| */ - MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN=246, /* Request the reboot or shutdown of system components. |0: Do nothing for autopilot, 1: Reboot autopilot, 2: Shutdown autopilot, 3: Reboot autopilot and keep it in the bootloader until upgraded.| 0: Do nothing for onboard computer, 1: Reboot onboard computer, 2: Shutdown onboard computer, 3: Reboot onboard computer and keep it in the bootloader until upgraded.| WIP: 0: Do nothing for camera, 1: Reboot onboard camera, 2: Shutdown onboard camera, 3: Reboot onboard camera and keep it in the bootloader until upgraded| WIP: 0: Do nothing for mount (e.g. gimbal), 1: Reboot mount, 2: Shutdown mount, 3: Reboot mount and keep it in the bootloader until upgraded| Reserved (set to 0)| Reserved (set to 0)| WIP: ID (e.g. camera ID -1 for all IDs)| */ - MAV_CMD_DO_UPGRADE=247, /* Request a target system to start an upgrade of one (or all) of its components. For example, the command might be sent to a companion computer to cause it to upgrade a connected flight controller. The system doing the upgrade will report progress using the normal command protocol sequence for a long running operation. Command protocol information: https://mavlink.io/en/services/command.html. |Component id of the component to be upgraded. If set to 0, all components should be upgraded.| 0: Do not reboot component after the action is executed, 1: Reboot component after the action is executed.| Reserved| Reserved| Reserved| Reserved| WIP: upgrade progress report rate (can be used for more granular control).| */ - MAV_CMD_OVERRIDE_GOTO=252, /* Override current mission with command to pause mission, pause mission and move to position, continue/resume mission. When param 1 indicates that the mission is paused (MAV_GOTO_DO_HOLD), param 2 defines whether it holds in place or moves to another position. |MAV_GOTO_DO_HOLD: pause mission and either hold or move to specified position (depending on param2), MAV_GOTO_DO_CONTINUE: resume mission.| MAV_GOTO_HOLD_AT_CURRENT_POSITION: hold at current position, MAV_GOTO_HOLD_AT_SPECIFIED_POSITION: hold at specified position.| Coordinate frame of hold point.| Desired yaw angle.| Latitude/X position.| Longitude/Y position.| Altitude/Z position.| */ - MAV_CMD_OBLIQUE_SURVEY=260, /* Mission command to set a Camera Auto Mount Pivoting Oblique Survey (Replaces CAM_TRIGG_DIST for this purpose). The camera is triggered each time this distance is exceeded, then the mount moves to the next position. Params 4~6 set-up the angle limits and number of positions for oblique survey, where mount-enabled vehicles automatically roll the camera between shots to emulate an oblique camera setup (providing an increased HFOV). This command can also be used to set the shutter integration time for the camera. |Camera trigger distance. 0 to stop triggering.| Camera shutter integration time. 0 to ignore| The minimum interval in which the camera is capable of taking subsequent pictures repeatedly. 0 to ignore.| Total number of roll positions at which the camera will capture photos (images captures spread evenly across the limits defined by param5).| Angle limits that the camera can be rolled to left and right of center.| Fixed pitch angle that the camera will hold in oblique mode if the mount is actuated in the pitch axis.| Empty| */ - MAV_CMD_MISSION_START=300, /* start running a mission |first_item: the first mission item to run| last_item: the last mission item to run (after this item is run, the mission ends)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_COMPONENT_ARM_DISARM=400, /* Arms / Disarms a component |0: disarm, 1: arm| 0: arm-disarm unless prevented by safety checks (i.e. when landed), 21196: force arming/disarming (e.g. allow arming to override preflight checks and disarming in flight)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_ILLUMINATOR_ON_OFF=405, /* Turns illuminators ON/OFF. An illuminator is a light source that is used for lighting up dark areas external to the sytstem: e.g. a torch or searchlight (as opposed to a light source for illuminating the system itself, e.g. an indicator light). |0: Illuminators OFF, 1: Illuminators ON| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_GET_HOME_POSITION=410, /* Request the home position from the vehicle. |Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| */ - MAV_CMD_INJECT_FAILURE=420, /* Inject artificial failure for testing purposes. Note that autopilots should implement an additional protection before accepting this command such as a specific param setting. |The unit which is affected by the failure.| The type how the failure manifests itself.| Instance affected by failure (0 to signal all).| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_START_RX_PAIR=500, /* Starts receiver pairing. |0:Spektrum.| RC type.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_GET_MESSAGE_INTERVAL=510, /* Request the interval between messages for a particular MAVLink message ID. The receiver should ACK the command and then emit its response in a MESSAGE_INTERVAL message. |The MAVLink message ID| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_SET_MESSAGE_INTERVAL=511, /* Set the interval between messages for a particular MAVLink message ID. This interface replaces REQUEST_DATA_STREAM. |The MAVLink message ID| The interval between two messages. Set to -1 to disable and 0 to request default rate.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Target address of message stream (if message has target address fields). 0: Flight-stack default (recommended), 1: address of requestor, 2: broadcast.| */ - MAV_CMD_REQUEST_MESSAGE=512, /* Request the target system(s) emit a single instance of a specified message (i.e. a "one-shot" version of MAV_CMD_SET_MESSAGE_INTERVAL). |The MAVLink message ID of the requested message.| Use for index ID, if required. Otherwise, the use of this parameter (if any) must be defined in the requested message. By default assumed not used (0).| The use of this parameter (if any), must be defined in the requested message. By default assumed not used (0).| The use of this parameter (if any), must be defined in the requested message. By default assumed not used (0).| The use of this parameter (if any), must be defined in the requested message. By default assumed not used (0).| The use of this parameter (if any), must be defined in the requested message. By default assumed not used (0).| Target address for requested message (if message has target address fields). 0: Flight-stack default, 1: address of requestor, 2: broadcast.| */ - MAV_CMD_REQUEST_PROTOCOL_VERSION=519, /* Request MAVLink protocol version compatibility. All receivers should ACK the command and then emit their capabilities in an PROTOCOL_VERSION message |1: Request supported protocol versions by all nodes on the network| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES=520, /* Request autopilot capabilities. The receiver should ACK the command and then emit its capabilities in an AUTOPILOT_VERSION message |1: Request autopilot version| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_CAMERA_INFORMATION=521, /* Request camera information (CAMERA_INFORMATION). |0: No action 1: Request camera capabilities| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_CAMERA_SETTINGS=522, /* Request camera settings (CAMERA_SETTINGS). |0: No Action 1: Request camera settings| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_STORAGE_INFORMATION=525, /* Request storage information (STORAGE_INFORMATION). Use the command's target_component to target a specific component's storage. |Storage ID (0 for all, 1 for first, 2 for second, etc.)| 0: No Action 1: Request storage information| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_STORAGE_FORMAT=526, /* Format a storage medium. Once format is complete, a STORAGE_INFORMATION message is sent. Use the command's target_component to target a specific component's storage. |Storage ID (1 for first, 2 for second, etc.)| Format storage (and reset image log). 0: No action 1: Format storage| Reset Image Log (without formatting storage medium). This will reset CAMERA_CAPTURE_STATUS.image_count and CAMERA_IMAGE_CAPTURED.image_index. 0: No action 1: Reset Image Log| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_CAMERA_CAPTURE_STATUS=527, /* Request camera capture status (CAMERA_CAPTURE_STATUS) |0: No Action 1: Request camera capture status| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_FLIGHT_INFORMATION=528, /* Request flight information (FLIGHT_INFORMATION) |1: Request flight information| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_RESET_CAMERA_SETTINGS=529, /* Reset all camera settings to Factory Default |0: No Action 1: Reset all settings| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_SET_CAMERA_MODE=530, /* Set camera running mode. Use NaN for reserved values. GCS will send a MAV_CMD_REQUEST_VIDEO_STREAM_STATUS command after a mode change if the camera supports video streaming. |Reserved (Set to 0)| Camera mode| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ - MAV_CMD_SET_CAMERA_ZOOM=531, /* Set camera zoom. Camera must respond with a CAMERA_SETTINGS message (on success). |Zoom type| Zoom value. The range of valid values depend on the zoom type.| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ - MAV_CMD_SET_CAMERA_FOCUS=532, /* Set camera focus. Camera must respond with a CAMERA_SETTINGS message (on success). |Focus type| Focus value| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ - MAV_CMD_JUMP_TAG=600, /* Tagged jump target. Can be jumped to with MAV_CMD_DO_JUMP_TAG. |Tag.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_DO_JUMP_TAG=601, /* Jump to the matching tag in the mission list. Repeat this action for the specified number of times. A mission should contain a single matching tag for each jump. If this is not the case then a jump to a missing tag should complete the mission, and a jump where there are multiple matching tags should always select the one with the lowest mission sequence number. |Target tag to jump to.| Repeat count.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_PARAM_TRANSACTION=900, /* Request to start or end a parameter transaction. Multiple kinds of transport layers can be used to exchange parameters in the transaction (param, param_ext and mavftp). The command response can either be a success/failure or an in progress in case the receiving side takes some time to apply the parameters. |Action to be performed (start, commit, cancel, etc.)| Possible transport layers to set and get parameters via mavlink during a parameter transaction.| Identifier for a specific transaction.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_DO_GIMBAL_MANAGER_PITCHYAW=1000, /* High level setpoint to be sent to a gimbal manager to set a gimbal attitude. It is possible to set combinations of the values below. E.g. an angle as well as a desired angular rate can be used to get to this angle at a certain angular rate, or an angular rate only will result in continuous turning. NaN is to be used to signal unset. Note: a gimbal is never to react to this command but only the gimbal manager. |Pitch angle (positive to pitch up, relative to vehicle for FOLLOW mode, relative to world horizon for LOCK mode).| Yaw angle (positive to yaw to the right, relative to vehicle for FOLLOW mode, absolute to North for LOCK mode).| Pitch rate (positive to pitch up).| Yaw rate (positive to yaw to the right).| Gimbal manager flags to use.| Reserved (default:0)| Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| */ - MAV_CMD_DO_GIMBAL_MANAGER_CONFIGURE=1001, /* Gimbal configuration to set which sysid/compid is in primary and secondary control. |Sysid for primary control (0: no one in control, -1: leave unchanged, -2: set itself in control (for missions where the own sysid is still unknown), -3: remove control if currently in control).| Compid for primary control (0: no one in control, -1: leave unchanged, -2: set itself in control (for missions where the own sysid is still unknown), -3: remove control if currently in control).| Sysid for secondary control (0: no one in control, -1: leave unchanged, -2: set itself in control (for missions where the own sysid is still unknown), -3: remove control if currently in control).| Compid for secondary control (0: no one in control, -1: leave unchanged, -2: set itself in control (for missions where the own sysid is still unknown), -3: remove control if currently in control).| Reserved (default:0)| Reserved (default:0)| Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| */ - MAV_CMD_IMAGE_START_CAPTURE=2000, /* Start image capture sequence. Sends CAMERA_IMAGE_CAPTURED after each capture. Use NaN for reserved values. |Reserved (Set to 0)| Desired elapsed time between two consecutive pictures (in seconds). Minimum values depend on hardware (typically greater than 2 seconds).| Total number of images to capture. 0 to capture forever/until MAV_CMD_IMAGE_STOP_CAPTURE.| Capture sequence number starting from 1. This is only valid for single-capture (param3 == 1), otherwise set to 0. Increment the capture ID for each capture command to prevent double captures when a command is re-transmitted.| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| */ - MAV_CMD_IMAGE_STOP_CAPTURE=2001, /* Stop image capture sequence Use NaN for reserved values. |Reserved (Set to 0)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ - MAV_CMD_REQUEST_CAMERA_IMAGE_CAPTURE=2002, /* Re-request a CAMERA_IMAGE_CAPTURED message. |Sequence number for missing CAMERA_IMAGE_CAPTURED message| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ - MAV_CMD_DO_TRIGGER_CONTROL=2003, /* Enable or disable on-board camera triggering system. |Trigger enable/disable (0 for disable, 1 for start), -1 to ignore| 1 to reset the trigger sequence, -1 or 0 to ignore| 1 to pause triggering, but without switching the camera off or retracting it. -1 to ignore| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_CAMERA_TRACK_POINT=2004, /* If the camera supports point visual tracking (CAMERA_CAP_FLAGS_HAS_TRACKING_POINT is set), this command allows to initiate the tracking. |Point to track x value (normalized 0..1, 0 is left, 1 is right).| Point to track y value (normalized 0..1, 0 is top, 1 is bottom).| Point radius (normalized 0..1, 0 is image left, 1 is image right).| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_CAMERA_TRACK_RECTANGLE=2005, /* If the camera supports rectangle visual tracking (CAMERA_CAP_FLAGS_HAS_TRACKING_RECTANGLE is set), this command allows to initiate the tracking. |Top left corner of rectangle x value (normalized 0..1, 0 is left, 1 is right).| Top left corner of rectangle y value (normalized 0..1, 0 is top, 1 is bottom).| Bottom right corner of rectangle x value (normalized 0..1, 0 is left, 1 is right).| Bottom right corner of rectangle y value (normalized 0..1, 0 is top, 1 is bottom).| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_CAMERA_STOP_TRACKING=2010, /* Stops ongoing tracking. |Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_VIDEO_START_CAPTURE=2500, /* Starts video capture (recording). |Video Stream ID (0 for all streams)| Frequency CAMERA_CAPTURE_STATUS messages should be sent while recording (0 for no messages, otherwise frequency)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| */ - MAV_CMD_VIDEO_STOP_CAPTURE=2501, /* Stop the current video capture (recording). |Video Stream ID (0 for all streams)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| */ - MAV_CMD_VIDEO_START_STREAMING=2502, /* Start video streaming |Video Stream ID (0 for all streams, 1 for first, 2 for second, etc.)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_VIDEO_STOP_STREAMING=2503, /* Stop the given video stream |Video Stream ID (0 for all streams, 1 for first, 2 for second, etc.)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_VIDEO_STREAM_INFORMATION=2504, /* Request video stream information (VIDEO_STREAM_INFORMATION) |Video Stream ID (0 for all streams, 1 for first, 2 for second, etc.)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_VIDEO_STREAM_STATUS=2505, /* Request video stream status (VIDEO_STREAM_STATUS) |Video Stream ID (0 for all streams, 1 for first, 2 for second, etc.)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_LOGGING_START=2510, /* Request to start streaming logging data over MAVLink (see also LOGGING_DATA message) |Format: 0: ULog| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| */ - MAV_CMD_LOGGING_STOP=2511, /* Request to stop streaming log data over MAVLink |Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| */ - MAV_CMD_AIRFRAME_CONFIGURATION=2520, /* |Landing gear ID (default: 0, -1 for all)| Landing gear position (Down: 0, Up: 1, NaN for no change)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| */ - MAV_CMD_CONTROL_HIGH_LATENCY=2600, /* Request to start/stop transmitting over the high latency telemetry |Control transmission over high latency telemetry (0: stop, 1: start)| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_PANORAMA_CREATE=2800, /* Create a panorama at the current position |Viewing angle horizontal of the panorama (+- 0.5 the total angle)| Viewing angle vertical of panorama.| Speed of the horizontal rotation.| Speed of the vertical rotation.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_DO_VTOL_TRANSITION=3000, /* Request VTOL transition |The target VTOL state. Only MAV_VTOL_STATE_MC and MAV_VTOL_STATE_FW can be used.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_ARM_AUTHORIZATION_REQUEST=3001, /* Request authorization to arm the vehicle to a external entity, the arm authorizer is responsible to request all data that is needs from the vehicle before authorize or deny the request. If approved the progress of command_ack message should be set with period of time that this authorization is valid in seconds or in case it was denied it should be set with one of the reasons in ARM_AUTH_DENIED_REASON. - |Vehicle system id, this way ground station can request arm authorization on behalf of any vehicle| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_SET_GUIDED_SUBMODE_STANDARD=4000, /* This command sets the submode to standard guided when vehicle is in guided mode. The vehicle holds position and altitude and the user can input the desired velocities along all three axes. - |Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_SET_GUIDED_SUBMODE_CIRCLE=4001, /* This command sets submode circle when vehicle is in guided mode. Vehicle flies along a circle facing the center of the circle. The user can input the velocity along the circle and change the radius. If no input is given the vehicle will hold position. - |Radius of desired circle in CIRCLE_MODE| User defined| User defined| User defined| Target latitude of center of circle in CIRCLE_MODE| Target longitude of center of circle in CIRCLE_MODE| Reserved (default:0)| */ - MAV_CMD_CONDITION_GATE=4501, /* Delay mission state machine until gate has been reached. |Geometry: 0: orthogonal to path between previous and next waypoint.| Altitude: 0: ignore altitude| Empty| Empty| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_FENCE_RETURN_POINT=5000, /* Fence return point. There can only be one fence return point. - |Reserved| Reserved| Reserved| Reserved| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_FENCE_POLYGON_VERTEX_INCLUSION=5001, /* Fence vertex for an inclusion polygon (the polygon must not be self-intersecting). The vehicle must stay within this area. Minimum of 3 vertices required. - |Polygon vertex count| Vehicle must be inside ALL inclusion zones in a single group, vehicle must be inside at least one group, must be the same for all points in each polygon| Reserved| Reserved| Latitude| Longitude| Reserved| */ - MAV_CMD_NAV_FENCE_POLYGON_VERTEX_EXCLUSION=5002, /* Fence vertex for an exclusion polygon (the polygon must not be self-intersecting). The vehicle must stay outside this area. Minimum of 3 vertices required. - |Polygon vertex count| Reserved| Reserved| Reserved| Latitude| Longitude| Reserved| */ - MAV_CMD_NAV_FENCE_CIRCLE_INCLUSION=5003, /* Circular fence area. The vehicle must stay inside this area. - |Radius.| Vehicle must be inside ALL inclusion zones in a single group, vehicle must be inside at least one group| Reserved| Reserved| Latitude| Longitude| Reserved| */ - MAV_CMD_NAV_FENCE_CIRCLE_EXCLUSION=5004, /* Circular fence area. The vehicle must stay outside this area. - |Radius.| Reserved| Reserved| Reserved| Latitude| Longitude| Reserved| */ - MAV_CMD_NAV_RALLY_POINT=5100, /* Rally point. You can have multiple rally points defined. - |Reserved| Reserved| Reserved| Reserved| Latitude| Longitude| Altitude| */ - MAV_CMD_UAVCAN_GET_NODE_INFO=5200, /* Commands the vehicle to respond with a sequence of messages UAVCAN_NODE_INFO, one message per every UAVCAN node that is online. Note that some of the response messages can be lost, which the receiver can detect easily by checking whether every received UAVCAN_NODE_STATUS has a matching message UAVCAN_NODE_INFO received earlier; if not, this command should be sent again in order to request re-transmission of the node information messages. |Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| */ - MAV_CMD_PAYLOAD_PREPARE_DEPLOY=30001, /* Deploy payload on a Lat / Lon / Alt position. This includes the navigation to reach the required release position and velocity. |Operation mode. 0: prepare single payload deploy (overwriting previous requests), but do not execute it. 1: execute payload deploy immediately (rejecting further deploy commands during execution, but allowing abort). 2: add payload deploy to existing deployment list.| Desired approach vector in compass heading. A negative value indicates the system can define the approach vector at will.| Desired ground speed at release time. This can be overridden by the airframe in case it needs to meet minimum airspeed. A negative value indicates the system can define the ground speed at will.| Minimum altitude clearance to the release position. A negative value indicates the system can define the clearance at will.| Latitude. Note, if used in MISSION_ITEM (deprecated) the units are degrees (unscaled)| Longitude. Note, if used in MISSION_ITEM (deprecated) the units are degrees (unscaled)| Altitude (MSL)| */ - MAV_CMD_PAYLOAD_CONTROL_DEPLOY=30002, /* Control the payload deployment. |Operation mode. 0: Abort deployment, continue normal mission. 1: switch to payload deployment mode. 100: delete first payload deployment request. 101: delete all payload deployment requests.| Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| */ - MAV_CMD_WAYPOINT_USER_1=31000, /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_WAYPOINT_USER_2=31001, /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_WAYPOINT_USER_3=31002, /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_WAYPOINT_USER_4=31003, /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_WAYPOINT_USER_5=31004, /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_SPATIAL_USER_1=31005, /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_SPATIAL_USER_2=31006, /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_SPATIAL_USER_3=31007, /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_SPATIAL_USER_4=31008, /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_SPATIAL_USER_5=31009, /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_USER_1=31010, /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ - MAV_CMD_USER_2=31011, /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ - MAV_CMD_USER_3=31012, /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ - MAV_CMD_USER_4=31013, /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ - MAV_CMD_USER_5=31014, /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ - MAV_CMD_POWER_OFF_INITIATED=42000, /* A system wide power-off event has been initiated. |Empty.| Empty.| Empty.| Empty.| Empty.| Empty.| Empty.| */ - MAV_CMD_SOLO_BTN_FLY_CLICK=42001, /* FLY button has been clicked. |Empty.| Empty.| Empty.| Empty.| Empty.| Empty.| Empty.| */ - MAV_CMD_SOLO_BTN_FLY_HOLD=42002, /* FLY button has been held for 1.5 seconds. |Takeoff altitude.| Empty.| Empty.| Empty.| Empty.| Empty.| Empty.| */ - MAV_CMD_SOLO_BTN_PAUSE_CLICK=42003, /* PAUSE button has been clicked. |1 if Solo is in a shot mode, 0 otherwise.| Empty.| Empty.| Empty.| Empty.| Empty.| Empty.| */ - MAV_CMD_FIXED_MAG_CAL=42004, /* Magnetometer calibration based on fixed position - in earth field given by inclination, declination and intensity. |Magnetic declination.| Magnetic inclination.| Magnetic intensity.| Yaw.| Empty.| Empty.| Empty.| */ - MAV_CMD_FIXED_MAG_CAL_FIELD=42005, /* Magnetometer calibration based on fixed expected field values. |Field strength X.| Field strength Y.| Field strength Z.| Empty.| Empty.| Empty.| Empty.| */ - MAV_CMD_FIXED_MAG_CAL_YAW=42006, /* Magnetometer calibration based on provided known yaw. This allows for fast calibration using WMM field tables in the vehicle, given only the known yaw of the vehicle. If Latitude and longitude are both zero then use the current vehicle location. |Yaw of vehicle in earth frame.| CompassMask, 0 for all.| Latitude.| Longitude.| Empty.| Empty.| Empty.| */ - MAV_CMD_DO_START_MAG_CAL=42424, /* Initiate a magnetometer calibration. |Bitmask of magnetometers to calibrate. Use 0 to calibrate all sensors that can be started (sensors may not start if disabled, unhealthy, etc.). The command will NACK if calibration does not start for a sensor explicitly specified by the bitmask.| Automatically retry on failure (0=no retry, 1=retry).| Save without user input (0=require input, 1=autosave).| Delay.| Autoreboot (0=user reboot, 1=autoreboot).| Empty.| Empty.| */ - MAV_CMD_DO_ACCEPT_MAG_CAL=42425, /* Accept a magnetometer calibration. |Bitmask of magnetometers that calibration is accepted (0 means all).| Empty.| Empty.| Empty.| Empty.| Empty.| Empty.| */ - MAV_CMD_DO_CANCEL_MAG_CAL=42426, /* Cancel a running magnetometer calibration. |Bitmask of magnetometers to cancel a running calibration (0 means all).| Empty.| Empty.| Empty.| Empty.| Empty.| Empty.| */ - MAV_CMD_SET_FACTORY_TEST_MODE=42427, /* Command autopilot to get into factory test/diagnostic mode. |0: activate test mode, 1: exit test mode.| Empty.| Empty.| Empty.| Empty.| Empty.| Empty.| */ - MAV_CMD_DO_SEND_BANNER=42428, /* Reply with the version banner. |Empty.| Empty.| Empty.| Empty.| Empty.| Empty.| Empty.| */ - MAV_CMD_ACCELCAL_VEHICLE_POS=42429, /* Used when doing accelerometer calibration. When sent to the GCS tells it what position to put the vehicle in. When sent to the vehicle says what position the vehicle is in. |Position.| Empty.| Empty.| Empty.| Empty.| Empty.| Empty.| */ - MAV_CMD_GIMBAL_RESET=42501, /* Causes the gimbal to reset and boot as if it was just powered on. |Empty.| Empty.| Empty.| Empty.| Empty.| Empty.| Empty.| */ - MAV_CMD_GIMBAL_AXIS_CALIBRATION_STATUS=42502, /* Reports progress and success or failure of gimbal axis calibration procedure. |Gimbal axis we're reporting calibration progress for.| Current calibration progress for this axis.| Status of the calibration.| Empty.| Empty.| Empty.| Empty.| */ - MAV_CMD_GIMBAL_REQUEST_AXIS_CALIBRATION=42503, /* Starts commutation calibration on the gimbal. |Empty.| Empty.| Empty.| Empty.| Empty.| Empty.| Empty.| */ - MAV_CMD_GIMBAL_FULL_RESET=42505, /* Erases gimbal application and parameters. |Magic number.| Magic number.| Magic number.| Magic number.| Magic number.| Magic number.| Magic number.| */ - MAV_CMD_DO_WINCH=42600, /* Command to operate winch. |Winch instance number.| Action to perform.| Length of cable to release (negative to wind).| Release rate (negative to wind).| Empty.| Empty.| Empty.| */ - MAV_CMD_FLASH_BOOTLOADER=42650, /* Update the bootloader |Empty| Empty| Empty| Empty| Magic number - set to 290876 to actually flash| Empty| Empty| */ - MAV_CMD_BATTERY_RESET=42651, /* Reset battery capacity for batteries that accumulate consumed battery via integration. |Bitmask of batteries to reset. Least significant bit is for the first battery.| Battery percentage remaining to set.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_DEBUG_TRAP=42700, /* Issue a trap signal to the autopilot process, presumably to enter the debugger. |Magic number - set to 32451 to actually trap.| Empty.| Empty.| Empty.| Empty.| Empty.| Empty.| */ - MAV_CMD_SCRIPTING=42701, /* Control onboard scripting. |Scripting command to execute| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_GUIDED_CHANGE_SPEED=43000, /* Change flight speed at a given rate. This slews the vehicle at a controllable rate between it's previous speed and the new one. (affects GUIDED only. Outside GUIDED, aircraft ignores these commands. Designed for onboard companion-computer command-and-control, not normally operator/GCS control.) |Airspeed or groundspeed.| Target Speed| Acceleration rate, 0 to take effect instantly| Empty| Empty| Empty| Empty| */ - MAV_CMD_GUIDED_CHANGE_ALTITUDE=43001, /* Change target altitude at a given rate. This slews the vehicle at a controllable rate between it's previous altitude and the new one. (affects GUIDED only. Outside GUIDED, aircraft ignores these commands. Designed for onboard companion-computer command-and-control, not normally operator/GCS control.) |Empty| Empty| Rate of change, toward new altitude. 0 for maximum rate change. Positive numbers only, as negative numbers will not converge on the new target alt.| Empty| Empty| Empty| Target Altitude| */ - MAV_CMD_GUIDED_CHANGE_HEADING=43002, /* Change to target heading at a given rate, overriding previous heading/s. This slews the vehicle at a controllable rate between it's previous heading and the new one. (affects GUIDED only. Exiting GUIDED returns aircraft to normal behaviour defined elsewhere. Designed for onboard companion-computer command-and-control, not normally operator/GCS control.) |course-over-ground or raw vehicle heading.| Target heading.| Maximum centripetal accelearation, ie rate of change, toward new heading.| Empty| Empty| Empty| Empty| */ - MAV_CMD_ENUM_END=43003, /* | */ -} MAV_CMD; -#endif - -/** @brief */ -#ifndef HAVE_ENUM_SCRIPTING_CMD -#define HAVE_ENUM_SCRIPTING_CMD -typedef enum SCRIPTING_CMD -{ - SCRIPTING_CMD_REPL_START=0, /* Start a REPL session. | */ - SCRIPTING_CMD_REPL_STOP=1, /* End a REPL session. | */ - SCRIPTING_CMD_ENUM_END=2, /* | */ -} SCRIPTING_CMD; -#endif - -/** @brief */ -#ifndef HAVE_ENUM_LIMITS_STATE -#define HAVE_ENUM_LIMITS_STATE -typedef enum LIMITS_STATE -{ - LIMITS_INIT=0, /* Pre-initialization. | */ - LIMITS_DISABLED=1, /* Disabled. | */ - LIMITS_ENABLED=2, /* Checking limits. | */ - LIMITS_TRIGGERED=3, /* A limit has been breached. | */ - LIMITS_RECOVERING=4, /* Taking action e.g. Return/RTL. | */ - LIMITS_RECOVERED=5, /* We're no longer in breach of a limit. | */ - LIMITS_STATE_ENUM_END=6, /* | */ -} LIMITS_STATE; -#endif - -/** @brief */ -#ifndef HAVE_ENUM_LIMIT_MODULE -#define HAVE_ENUM_LIMIT_MODULE -typedef enum LIMIT_MODULE -{ - LIMIT_GPSLOCK=1, /* Pre-initialization. | */ - LIMIT_GEOFENCE=2, /* Disabled. | */ - LIMIT_ALTITUDE=4, /* Checking limits. | */ - LIMIT_MODULE_ENUM_END=5, /* | */ -} LIMIT_MODULE; -#endif - -/** @brief Flags in RALLY_POINT message. */ -#ifndef HAVE_ENUM_RALLY_FLAGS -#define HAVE_ENUM_RALLY_FLAGS -typedef enum RALLY_FLAGS -{ - FAVORABLE_WIND=1, /* Flag set when requiring favorable winds for landing. | */ - LAND_IMMEDIATELY=2, /* Flag set when plane is to immediately descend to break altitude and land without GCS intervention. Flag not set when plane is to loiter at Rally point until commanded to land. | */ - RALLY_FLAGS_ENUM_END=3, /* | */ -} RALLY_FLAGS; -#endif - -/** @brief */ -#ifndef HAVE_ENUM_CAMERA_STATUS_TYPES -#define HAVE_ENUM_CAMERA_STATUS_TYPES -typedef enum CAMERA_STATUS_TYPES -{ - CAMERA_STATUS_TYPE_HEARTBEAT=0, /* Camera heartbeat, announce camera component ID at 1Hz. | */ - CAMERA_STATUS_TYPE_TRIGGER=1, /* Camera image triggered. | */ - CAMERA_STATUS_TYPE_DISCONNECT=2, /* Camera connection lost. | */ - CAMERA_STATUS_TYPE_ERROR=3, /* Camera unknown error. | */ - CAMERA_STATUS_TYPE_LOWBATT=4, /* Camera battery low. Parameter p1 shows reported voltage. | */ - CAMERA_STATUS_TYPE_LOWSTORE=5, /* Camera storage low. Parameter p1 shows reported shots remaining. | */ - CAMERA_STATUS_TYPE_LOWSTOREV=6, /* Camera storage low. Parameter p1 shows reported video minutes remaining. | */ - CAMERA_STATUS_TYPES_ENUM_END=7, /* | */ -} CAMERA_STATUS_TYPES; -#endif - -/** @brief */ -#ifndef HAVE_ENUM_CAMERA_FEEDBACK_FLAGS -#define HAVE_ENUM_CAMERA_FEEDBACK_FLAGS -typedef enum CAMERA_FEEDBACK_FLAGS -{ - CAMERA_FEEDBACK_PHOTO=0, /* Shooting photos, not video. | */ - CAMERA_FEEDBACK_VIDEO=1, /* Shooting video, not stills. | */ - CAMERA_FEEDBACK_BADEXPOSURE=2, /* Unable to achieve requested exposure (e.g. shutter speed too low). | */ - CAMERA_FEEDBACK_CLOSEDLOOP=3, /* Closed loop feedback from camera, we know for sure it has successfully taken a picture. | */ - CAMERA_FEEDBACK_OPENLOOP=4, /* Open loop camera, an image trigger has been requested but we can't know for sure it has successfully taken a picture. | */ - CAMERA_FEEDBACK_FLAGS_ENUM_END=5, /* | */ -} CAMERA_FEEDBACK_FLAGS; -#endif - -/** @brief */ -#ifndef HAVE_ENUM_MAV_MODE_GIMBAL -#define HAVE_ENUM_MAV_MODE_GIMBAL -typedef enum MAV_MODE_GIMBAL -{ - MAV_MODE_GIMBAL_UNINITIALIZED=0, /* Gimbal is powered on but has not started initializing yet. | */ - MAV_MODE_GIMBAL_CALIBRATING_PITCH=1, /* Gimbal is currently running calibration on the pitch axis. | */ - MAV_MODE_GIMBAL_CALIBRATING_ROLL=2, /* Gimbal is currently running calibration on the roll axis. | */ - MAV_MODE_GIMBAL_CALIBRATING_YAW=3, /* Gimbal is currently running calibration on the yaw axis. | */ - MAV_MODE_GIMBAL_INITIALIZED=4, /* Gimbal has finished calibrating and initializing, but is relaxed pending reception of first rate command from copter. | */ - MAV_MODE_GIMBAL_ACTIVE=5, /* Gimbal is actively stabilizing. | */ - MAV_MODE_GIMBAL_RATE_CMD_TIMEOUT=6, /* Gimbal is relaxed because it missed more than 10 expected rate command messages in a row. Gimbal will move back to active mode when it receives a new rate command. | */ - MAV_MODE_GIMBAL_ENUM_END=7, /* | */ -} MAV_MODE_GIMBAL; -#endif - -/** @brief */ -#ifndef HAVE_ENUM_GIMBAL_AXIS -#define HAVE_ENUM_GIMBAL_AXIS -typedef enum GIMBAL_AXIS -{ - GIMBAL_AXIS_YAW=0, /* Gimbal yaw axis. | */ - GIMBAL_AXIS_PITCH=1, /* Gimbal pitch axis. | */ - GIMBAL_AXIS_ROLL=2, /* Gimbal roll axis. | */ - GIMBAL_AXIS_ENUM_END=3, /* | */ -} GIMBAL_AXIS; -#endif - -/** @brief */ -#ifndef HAVE_ENUM_GIMBAL_AXIS_CALIBRATION_STATUS -#define HAVE_ENUM_GIMBAL_AXIS_CALIBRATION_STATUS -typedef enum GIMBAL_AXIS_CALIBRATION_STATUS -{ - GIMBAL_AXIS_CALIBRATION_STATUS_IN_PROGRESS=0, /* Axis calibration is in progress. | */ - GIMBAL_AXIS_CALIBRATION_STATUS_SUCCEEDED=1, /* Axis calibration succeeded. | */ - GIMBAL_AXIS_CALIBRATION_STATUS_FAILED=2, /* Axis calibration failed. | */ - GIMBAL_AXIS_CALIBRATION_STATUS_ENUM_END=3, /* | */ -} GIMBAL_AXIS_CALIBRATION_STATUS; -#endif - -/** @brief */ -#ifndef HAVE_ENUM_GIMBAL_AXIS_CALIBRATION_REQUIRED -#define HAVE_ENUM_GIMBAL_AXIS_CALIBRATION_REQUIRED -typedef enum GIMBAL_AXIS_CALIBRATION_REQUIRED -{ - GIMBAL_AXIS_CALIBRATION_REQUIRED_UNKNOWN=0, /* Whether or not this axis requires calibration is unknown at this time. | */ - GIMBAL_AXIS_CALIBRATION_REQUIRED_TRUE=1, /* This axis requires calibration. | */ - GIMBAL_AXIS_CALIBRATION_REQUIRED_FALSE=2, /* This axis does not require calibration. | */ - GIMBAL_AXIS_CALIBRATION_REQUIRED_ENUM_END=3, /* | */ -} GIMBAL_AXIS_CALIBRATION_REQUIRED; -#endif - -/** @brief */ -#ifndef HAVE_ENUM_GOPRO_HEARTBEAT_STATUS -#define HAVE_ENUM_GOPRO_HEARTBEAT_STATUS -typedef enum GOPRO_HEARTBEAT_STATUS -{ - GOPRO_HEARTBEAT_STATUS_DISCONNECTED=0, /* No GoPro connected. | */ - GOPRO_HEARTBEAT_STATUS_INCOMPATIBLE=1, /* The detected GoPro is not HeroBus compatible. | */ - GOPRO_HEARTBEAT_STATUS_CONNECTED=2, /* A HeroBus compatible GoPro is connected. | */ - GOPRO_HEARTBEAT_STATUS_ERROR=3, /* An unrecoverable error was encountered with the connected GoPro, it may require a power cycle. | */ - GOPRO_HEARTBEAT_STATUS_ENUM_END=4, /* | */ -} GOPRO_HEARTBEAT_STATUS; -#endif - -/** @brief */ -#ifndef HAVE_ENUM_GOPRO_HEARTBEAT_FLAGS -#define HAVE_ENUM_GOPRO_HEARTBEAT_FLAGS -typedef enum GOPRO_HEARTBEAT_FLAGS -{ - GOPRO_FLAG_RECORDING=1, /* GoPro is currently recording. | */ - GOPRO_HEARTBEAT_FLAGS_ENUM_END=2, /* | */ -} GOPRO_HEARTBEAT_FLAGS; -#endif - -/** @brief */ -#ifndef HAVE_ENUM_GOPRO_REQUEST_STATUS -#define HAVE_ENUM_GOPRO_REQUEST_STATUS -typedef enum GOPRO_REQUEST_STATUS -{ - GOPRO_REQUEST_SUCCESS=0, /* The write message with ID indicated succeeded. | */ - GOPRO_REQUEST_FAILED=1, /* The write message with ID indicated failed. | */ - GOPRO_REQUEST_STATUS_ENUM_END=2, /* | */ -} GOPRO_REQUEST_STATUS; -#endif - -/** @brief */ -#ifndef HAVE_ENUM_GOPRO_COMMAND -#define HAVE_ENUM_GOPRO_COMMAND -typedef enum GOPRO_COMMAND -{ - GOPRO_COMMAND_POWER=0, /* (Get/Set). | */ - GOPRO_COMMAND_CAPTURE_MODE=1, /* (Get/Set). | */ - GOPRO_COMMAND_SHUTTER=2, /* (___/Set). | */ - GOPRO_COMMAND_BATTERY=3, /* (Get/___). | */ - GOPRO_COMMAND_MODEL=4, /* (Get/___). | */ - GOPRO_COMMAND_VIDEO_SETTINGS=5, /* (Get/Set). | */ - GOPRO_COMMAND_LOW_LIGHT=6, /* (Get/Set). | */ - GOPRO_COMMAND_PHOTO_RESOLUTION=7, /* (Get/Set). | */ - GOPRO_COMMAND_PHOTO_BURST_RATE=8, /* (Get/Set). | */ - GOPRO_COMMAND_PROTUNE=9, /* (Get/Set). | */ - GOPRO_COMMAND_PROTUNE_WHITE_BALANCE=10, /* (Get/Set) Hero 3+ Only. | */ - GOPRO_COMMAND_PROTUNE_COLOUR=11, /* (Get/Set) Hero 3+ Only. | */ - GOPRO_COMMAND_PROTUNE_GAIN=12, /* (Get/Set) Hero 3+ Only. | */ - GOPRO_COMMAND_PROTUNE_SHARPNESS=13, /* (Get/Set) Hero 3+ Only. | */ - GOPRO_COMMAND_PROTUNE_EXPOSURE=14, /* (Get/Set) Hero 3+ Only. | */ - GOPRO_COMMAND_TIME=15, /* (Get/Set). | */ - GOPRO_COMMAND_CHARGING=16, /* (Get/Set). | */ - GOPRO_COMMAND_ENUM_END=17, /* | */ -} GOPRO_COMMAND; -#endif - -/** @brief */ -#ifndef HAVE_ENUM_GOPRO_CAPTURE_MODE -#define HAVE_ENUM_GOPRO_CAPTURE_MODE -typedef enum GOPRO_CAPTURE_MODE -{ - GOPRO_CAPTURE_MODE_VIDEO=0, /* Video mode. | */ - GOPRO_CAPTURE_MODE_PHOTO=1, /* Photo mode. | */ - GOPRO_CAPTURE_MODE_BURST=2, /* Burst mode, Hero 3+ only. | */ - GOPRO_CAPTURE_MODE_TIME_LAPSE=3, /* Time lapse mode, Hero 3+ only. | */ - GOPRO_CAPTURE_MODE_MULTI_SHOT=4, /* Multi shot mode, Hero 4 only. | */ - GOPRO_CAPTURE_MODE_PLAYBACK=5, /* Playback mode, Hero 4 only, silver only except when LCD or HDMI is connected to black. | */ - GOPRO_CAPTURE_MODE_SETUP=6, /* Playback mode, Hero 4 only. | */ - GOPRO_CAPTURE_MODE_UNKNOWN=255, /* Mode not yet known. | */ - GOPRO_CAPTURE_MODE_ENUM_END=256, /* | */ -} GOPRO_CAPTURE_MODE; -#endif - -/** @brief */ -#ifndef HAVE_ENUM_GOPRO_RESOLUTION -#define HAVE_ENUM_GOPRO_RESOLUTION -typedef enum GOPRO_RESOLUTION -{ - GOPRO_RESOLUTION_480p=0, /* 848 x 480 (480p). | */ - GOPRO_RESOLUTION_720p=1, /* 1280 x 720 (720p). | */ - GOPRO_RESOLUTION_960p=2, /* 1280 x 960 (960p). | */ - GOPRO_RESOLUTION_1080p=3, /* 1920 x 1080 (1080p). | */ - GOPRO_RESOLUTION_1440p=4, /* 1920 x 1440 (1440p). | */ - GOPRO_RESOLUTION_2_7k_17_9=5, /* 2704 x 1440 (2.7k-17:9). | */ - GOPRO_RESOLUTION_2_7k_16_9=6, /* 2704 x 1524 (2.7k-16:9). | */ - GOPRO_RESOLUTION_2_7k_4_3=7, /* 2704 x 2028 (2.7k-4:3). | */ - GOPRO_RESOLUTION_4k_16_9=8, /* 3840 x 2160 (4k-16:9). | */ - GOPRO_RESOLUTION_4k_17_9=9, /* 4096 x 2160 (4k-17:9). | */ - GOPRO_RESOLUTION_720p_SUPERVIEW=10, /* 1280 x 720 (720p-SuperView). | */ - GOPRO_RESOLUTION_1080p_SUPERVIEW=11, /* 1920 x 1080 (1080p-SuperView). | */ - GOPRO_RESOLUTION_2_7k_SUPERVIEW=12, /* 2704 x 1520 (2.7k-SuperView). | */ - GOPRO_RESOLUTION_4k_SUPERVIEW=13, /* 3840 x 2160 (4k-SuperView). | */ - GOPRO_RESOLUTION_ENUM_END=14, /* | */ -} GOPRO_RESOLUTION; -#endif - -/** @brief */ -#ifndef HAVE_ENUM_GOPRO_FRAME_RATE -#define HAVE_ENUM_GOPRO_FRAME_RATE -typedef enum GOPRO_FRAME_RATE -{ - GOPRO_FRAME_RATE_12=0, /* 12 FPS. | */ - GOPRO_FRAME_RATE_15=1, /* 15 FPS. | */ - GOPRO_FRAME_RATE_24=2, /* 24 FPS. | */ - GOPRO_FRAME_RATE_25=3, /* 25 FPS. | */ - GOPRO_FRAME_RATE_30=4, /* 30 FPS. | */ - GOPRO_FRAME_RATE_48=5, /* 48 FPS. | */ - GOPRO_FRAME_RATE_50=6, /* 50 FPS. | */ - GOPRO_FRAME_RATE_60=7, /* 60 FPS. | */ - GOPRO_FRAME_RATE_80=8, /* 80 FPS. | */ - GOPRO_FRAME_RATE_90=9, /* 90 FPS. | */ - GOPRO_FRAME_RATE_100=10, /* 100 FPS. | */ - GOPRO_FRAME_RATE_120=11, /* 120 FPS. | */ - GOPRO_FRAME_RATE_240=12, /* 240 FPS. | */ - GOPRO_FRAME_RATE_12_5=13, /* 12.5 FPS. | */ - GOPRO_FRAME_RATE_ENUM_END=14, /* | */ -} GOPRO_FRAME_RATE; -#endif - -/** @brief */ -#ifndef HAVE_ENUM_GOPRO_FIELD_OF_VIEW -#define HAVE_ENUM_GOPRO_FIELD_OF_VIEW -typedef enum GOPRO_FIELD_OF_VIEW -{ - GOPRO_FIELD_OF_VIEW_WIDE=0, /* 0x00: Wide. | */ - GOPRO_FIELD_OF_VIEW_MEDIUM=1, /* 0x01: Medium. | */ - GOPRO_FIELD_OF_VIEW_NARROW=2, /* 0x02: Narrow. | */ - GOPRO_FIELD_OF_VIEW_ENUM_END=3, /* | */ -} GOPRO_FIELD_OF_VIEW; -#endif - -/** @brief */ -#ifndef HAVE_ENUM_GOPRO_VIDEO_SETTINGS_FLAGS -#define HAVE_ENUM_GOPRO_VIDEO_SETTINGS_FLAGS -typedef enum GOPRO_VIDEO_SETTINGS_FLAGS -{ - GOPRO_VIDEO_SETTINGS_TV_MODE=1, /* 0=NTSC, 1=PAL. | */ - GOPRO_VIDEO_SETTINGS_FLAGS_ENUM_END=2, /* | */ -} GOPRO_VIDEO_SETTINGS_FLAGS; -#endif - -/** @brief */ -#ifndef HAVE_ENUM_GOPRO_PHOTO_RESOLUTION -#define HAVE_ENUM_GOPRO_PHOTO_RESOLUTION -typedef enum GOPRO_PHOTO_RESOLUTION -{ - GOPRO_PHOTO_RESOLUTION_5MP_MEDIUM=0, /* 5MP Medium. | */ - GOPRO_PHOTO_RESOLUTION_7MP_MEDIUM=1, /* 7MP Medium. | */ - GOPRO_PHOTO_RESOLUTION_7MP_WIDE=2, /* 7MP Wide. | */ - GOPRO_PHOTO_RESOLUTION_10MP_WIDE=3, /* 10MP Wide. | */ - GOPRO_PHOTO_RESOLUTION_12MP_WIDE=4, /* 12MP Wide. | */ - GOPRO_PHOTO_RESOLUTION_ENUM_END=5, /* | */ -} GOPRO_PHOTO_RESOLUTION; -#endif - -/** @brief */ -#ifndef HAVE_ENUM_GOPRO_PROTUNE_WHITE_BALANCE -#define HAVE_ENUM_GOPRO_PROTUNE_WHITE_BALANCE -typedef enum GOPRO_PROTUNE_WHITE_BALANCE -{ - GOPRO_PROTUNE_WHITE_BALANCE_AUTO=0, /* Auto. | */ - GOPRO_PROTUNE_WHITE_BALANCE_3000K=1, /* 3000K. | */ - GOPRO_PROTUNE_WHITE_BALANCE_5500K=2, /* 5500K. | */ - GOPRO_PROTUNE_WHITE_BALANCE_6500K=3, /* 6500K. | */ - GOPRO_PROTUNE_WHITE_BALANCE_RAW=4, /* Camera Raw. | */ - GOPRO_PROTUNE_WHITE_BALANCE_ENUM_END=5, /* | */ -} GOPRO_PROTUNE_WHITE_BALANCE; -#endif - -/** @brief */ -#ifndef HAVE_ENUM_GOPRO_PROTUNE_COLOUR -#define HAVE_ENUM_GOPRO_PROTUNE_COLOUR -typedef enum GOPRO_PROTUNE_COLOUR -{ - GOPRO_PROTUNE_COLOUR_STANDARD=0, /* Auto. | */ - GOPRO_PROTUNE_COLOUR_NEUTRAL=1, /* Neutral. | */ - GOPRO_PROTUNE_COLOUR_ENUM_END=2, /* | */ -} GOPRO_PROTUNE_COLOUR; -#endif - -/** @brief */ -#ifndef HAVE_ENUM_GOPRO_PROTUNE_GAIN -#define HAVE_ENUM_GOPRO_PROTUNE_GAIN -typedef enum GOPRO_PROTUNE_GAIN -{ - GOPRO_PROTUNE_GAIN_400=0, /* ISO 400. | */ - GOPRO_PROTUNE_GAIN_800=1, /* ISO 800 (Only Hero 4). | */ - GOPRO_PROTUNE_GAIN_1600=2, /* ISO 1600. | */ - GOPRO_PROTUNE_GAIN_3200=3, /* ISO 3200 (Only Hero 4). | */ - GOPRO_PROTUNE_GAIN_6400=4, /* ISO 6400. | */ - GOPRO_PROTUNE_GAIN_ENUM_END=5, /* | */ -} GOPRO_PROTUNE_GAIN; -#endif - -/** @brief */ -#ifndef HAVE_ENUM_GOPRO_PROTUNE_SHARPNESS -#define HAVE_ENUM_GOPRO_PROTUNE_SHARPNESS -typedef enum GOPRO_PROTUNE_SHARPNESS -{ - GOPRO_PROTUNE_SHARPNESS_LOW=0, /* Low Sharpness. | */ - GOPRO_PROTUNE_SHARPNESS_MEDIUM=1, /* Medium Sharpness. | */ - GOPRO_PROTUNE_SHARPNESS_HIGH=2, /* High Sharpness. | */ - GOPRO_PROTUNE_SHARPNESS_ENUM_END=3, /* | */ -} GOPRO_PROTUNE_SHARPNESS; -#endif - -/** @brief */ -#ifndef HAVE_ENUM_GOPRO_PROTUNE_EXPOSURE -#define HAVE_ENUM_GOPRO_PROTUNE_EXPOSURE -typedef enum GOPRO_PROTUNE_EXPOSURE -{ - GOPRO_PROTUNE_EXPOSURE_NEG_5_0=0, /* -5.0 EV (Hero 3+ Only). | */ - GOPRO_PROTUNE_EXPOSURE_NEG_4_5=1, /* -4.5 EV (Hero 3+ Only). | */ - GOPRO_PROTUNE_EXPOSURE_NEG_4_0=2, /* -4.0 EV (Hero 3+ Only). | */ - GOPRO_PROTUNE_EXPOSURE_NEG_3_5=3, /* -3.5 EV (Hero 3+ Only). | */ - GOPRO_PROTUNE_EXPOSURE_NEG_3_0=4, /* -3.0 EV (Hero 3+ Only). | */ - GOPRO_PROTUNE_EXPOSURE_NEG_2_5=5, /* -2.5 EV (Hero 3+ Only). | */ - GOPRO_PROTUNE_EXPOSURE_NEG_2_0=6, /* -2.0 EV. | */ - GOPRO_PROTUNE_EXPOSURE_NEG_1_5=7, /* -1.5 EV. | */ - GOPRO_PROTUNE_EXPOSURE_NEG_1_0=8, /* -1.0 EV. | */ - GOPRO_PROTUNE_EXPOSURE_NEG_0_5=9, /* -0.5 EV. | */ - GOPRO_PROTUNE_EXPOSURE_ZERO=10, /* 0.0 EV. | */ - GOPRO_PROTUNE_EXPOSURE_POS_0_5=11, /* +0.5 EV. | */ - GOPRO_PROTUNE_EXPOSURE_POS_1_0=12, /* +1.0 EV. | */ - GOPRO_PROTUNE_EXPOSURE_POS_1_5=13, /* +1.5 EV. | */ - GOPRO_PROTUNE_EXPOSURE_POS_2_0=14, /* +2.0 EV. | */ - GOPRO_PROTUNE_EXPOSURE_POS_2_5=15, /* +2.5 EV (Hero 3+ Only). | */ - GOPRO_PROTUNE_EXPOSURE_POS_3_0=16, /* +3.0 EV (Hero 3+ Only). | */ - GOPRO_PROTUNE_EXPOSURE_POS_3_5=17, /* +3.5 EV (Hero 3+ Only). | */ - GOPRO_PROTUNE_EXPOSURE_POS_4_0=18, /* +4.0 EV (Hero 3+ Only). | */ - GOPRO_PROTUNE_EXPOSURE_POS_4_5=19, /* +4.5 EV (Hero 3+ Only). | */ - GOPRO_PROTUNE_EXPOSURE_POS_5_0=20, /* +5.0 EV (Hero 3+ Only). | */ - GOPRO_PROTUNE_EXPOSURE_ENUM_END=21, /* | */ -} GOPRO_PROTUNE_EXPOSURE; -#endif - -/** @brief */ -#ifndef HAVE_ENUM_GOPRO_CHARGING -#define HAVE_ENUM_GOPRO_CHARGING -typedef enum GOPRO_CHARGING -{ - GOPRO_CHARGING_DISABLED=0, /* Charging disabled. | */ - GOPRO_CHARGING_ENABLED=1, /* Charging enabled. | */ - GOPRO_CHARGING_ENUM_END=2, /* | */ -} GOPRO_CHARGING; -#endif - -/** @brief */ -#ifndef HAVE_ENUM_GOPRO_MODEL -#define HAVE_ENUM_GOPRO_MODEL -typedef enum GOPRO_MODEL -{ - GOPRO_MODEL_UNKNOWN=0, /* Unknown gopro model. | */ - GOPRO_MODEL_HERO_3_PLUS_SILVER=1, /* Hero 3+ Silver (HeroBus not supported by GoPro). | */ - GOPRO_MODEL_HERO_3_PLUS_BLACK=2, /* Hero 3+ Black. | */ - GOPRO_MODEL_HERO_4_SILVER=3, /* Hero 4 Silver. | */ - GOPRO_MODEL_HERO_4_BLACK=4, /* Hero 4 Black. | */ - GOPRO_MODEL_ENUM_END=5, /* | */ -} GOPRO_MODEL; -#endif - -/** @brief */ -#ifndef HAVE_ENUM_GOPRO_BURST_RATE -#define HAVE_ENUM_GOPRO_BURST_RATE -typedef enum GOPRO_BURST_RATE -{ - GOPRO_BURST_RATE_3_IN_1_SECOND=0, /* 3 Shots / 1 Second. | */ - GOPRO_BURST_RATE_5_IN_1_SECOND=1, /* 5 Shots / 1 Second. | */ - GOPRO_BURST_RATE_10_IN_1_SECOND=2, /* 10 Shots / 1 Second. | */ - GOPRO_BURST_RATE_10_IN_2_SECOND=3, /* 10 Shots / 2 Second. | */ - GOPRO_BURST_RATE_10_IN_3_SECOND=4, /* 10 Shots / 3 Second (Hero 4 Only). | */ - GOPRO_BURST_RATE_30_IN_1_SECOND=5, /* 30 Shots / 1 Second. | */ - GOPRO_BURST_RATE_30_IN_2_SECOND=6, /* 30 Shots / 2 Second. | */ - GOPRO_BURST_RATE_30_IN_3_SECOND=7, /* 30 Shots / 3 Second. | */ - GOPRO_BURST_RATE_30_IN_6_SECOND=8, /* 30 Shots / 6 Second. | */ - GOPRO_BURST_RATE_ENUM_END=9, /* | */ -} GOPRO_BURST_RATE; -#endif - -/** @brief */ -#ifndef HAVE_ENUM_LED_CONTROL_PATTERN -#define HAVE_ENUM_LED_CONTROL_PATTERN -typedef enum LED_CONTROL_PATTERN -{ - LED_CONTROL_PATTERN_OFF=0, /* LED patterns off (return control to regular vehicle control). | */ - LED_CONTROL_PATTERN_FIRMWAREUPDATE=1, /* LEDs show pattern during firmware update. | */ - LED_CONTROL_PATTERN_CUSTOM=255, /* Custom Pattern using custom bytes fields. | */ - LED_CONTROL_PATTERN_ENUM_END=256, /* | */ -} LED_CONTROL_PATTERN; -#endif - -/** @brief Flags in EKF_STATUS message. */ -#ifndef HAVE_ENUM_EKF_STATUS_FLAGS -#define HAVE_ENUM_EKF_STATUS_FLAGS -typedef enum EKF_STATUS_FLAGS -{ - EKF_ATTITUDE=1, /* Set if EKF's attitude estimate is good. | */ - EKF_VELOCITY_HORIZ=2, /* Set if EKF's horizontal velocity estimate is good. | */ - EKF_VELOCITY_VERT=4, /* Set if EKF's vertical velocity estimate is good. | */ - EKF_POS_HORIZ_REL=8, /* Set if EKF's horizontal position (relative) estimate is good. | */ - EKF_POS_HORIZ_ABS=16, /* Set if EKF's horizontal position (absolute) estimate is good. | */ - EKF_POS_VERT_ABS=32, /* Set if EKF's vertical position (absolute) estimate is good. | */ - EKF_POS_VERT_AGL=64, /* Set if EKF's vertical position (above ground) estimate is good. | */ - EKF_CONST_POS_MODE=128, /* EKF is in constant position mode and does not know it's absolute or relative position. | */ - EKF_PRED_POS_HORIZ_REL=256, /* Set if EKF's predicted horizontal position (relative) estimate is good. | */ - EKF_PRED_POS_HORIZ_ABS=512, /* Set if EKF's predicted horizontal position (absolute) estimate is good. | */ - EKF_UNINITIALIZED=1024, /* Set if EKF has never been healthy. | */ - EKF_STATUS_FLAGS_ENUM_END=1025, /* | */ -} EKF_STATUS_FLAGS; -#endif - -/** @brief */ -#ifndef HAVE_ENUM_PID_TUNING_AXIS -#define HAVE_ENUM_PID_TUNING_AXIS -typedef enum PID_TUNING_AXIS -{ - PID_TUNING_ROLL=1, /* | */ - PID_TUNING_PITCH=2, /* | */ - PID_TUNING_YAW=3, /* | */ - PID_TUNING_ACCZ=4, /* | */ - PID_TUNING_STEER=5, /* | */ - PID_TUNING_LANDING=6, /* | */ - PID_TUNING_AXIS_ENUM_END=7, /* | */ -} PID_TUNING_AXIS; -#endif - -/** @brief Special ACK block numbers control activation of dataflash log streaming. */ -#ifndef HAVE_ENUM_MAV_REMOTE_LOG_DATA_BLOCK_COMMANDS -#define HAVE_ENUM_MAV_REMOTE_LOG_DATA_BLOCK_COMMANDS -typedef enum MAV_REMOTE_LOG_DATA_BLOCK_COMMANDS -{ - MAV_REMOTE_LOG_DATA_BLOCK_STOP=2147483645, /* UAV to stop sending DataFlash blocks. | */ - MAV_REMOTE_LOG_DATA_BLOCK_START=2147483646, /* UAV to start sending DataFlash blocks. | */ - MAV_REMOTE_LOG_DATA_BLOCK_COMMANDS_ENUM_END=2147483647, /* | */ -} MAV_REMOTE_LOG_DATA_BLOCK_COMMANDS; -#endif - -/** @brief Possible remote log data block statuses. */ -#ifndef HAVE_ENUM_MAV_REMOTE_LOG_DATA_BLOCK_STATUSES -#define HAVE_ENUM_MAV_REMOTE_LOG_DATA_BLOCK_STATUSES -typedef enum MAV_REMOTE_LOG_DATA_BLOCK_STATUSES -{ - MAV_REMOTE_LOG_DATA_BLOCK_NACK=0, /* This block has NOT been received. | */ - MAV_REMOTE_LOG_DATA_BLOCK_ACK=1, /* This block has been received. | */ - MAV_REMOTE_LOG_DATA_BLOCK_STATUSES_ENUM_END=2, /* | */ -} MAV_REMOTE_LOG_DATA_BLOCK_STATUSES; -#endif - -/** @brief Bus types for device operations. */ -#ifndef HAVE_ENUM_DEVICE_OP_BUSTYPE -#define HAVE_ENUM_DEVICE_OP_BUSTYPE -typedef enum DEVICE_OP_BUSTYPE -{ - DEVICE_OP_BUSTYPE_I2C=0, /* I2C Device operation. | */ - DEVICE_OP_BUSTYPE_SPI=1, /* SPI Device operation. | */ - DEVICE_OP_BUSTYPE_ENUM_END=2, /* | */ -} DEVICE_OP_BUSTYPE; -#endif - -/** @brief Deepstall flight stage. */ -#ifndef HAVE_ENUM_DEEPSTALL_STAGE -#define HAVE_ENUM_DEEPSTALL_STAGE -typedef enum DEEPSTALL_STAGE -{ - DEEPSTALL_STAGE_FLY_TO_LANDING=0, /* Flying to the landing point. | */ - DEEPSTALL_STAGE_ESTIMATE_WIND=1, /* Building an estimate of the wind. | */ - DEEPSTALL_STAGE_WAIT_FOR_BREAKOUT=2, /* Waiting to breakout of the loiter to fly the approach. | */ - DEEPSTALL_STAGE_FLY_TO_ARC=3, /* Flying to the first arc point to turn around to the landing point. | */ - DEEPSTALL_STAGE_ARC=4, /* Turning around back to the deepstall landing point. | */ - DEEPSTALL_STAGE_APPROACH=5, /* Approaching the landing point. | */ - DEEPSTALL_STAGE_LAND=6, /* Stalling and steering towards the land point. | */ - DEEPSTALL_STAGE_ENUM_END=7, /* | */ -} DEEPSTALL_STAGE; -#endif - -/** @brief A mapping of plane flight modes for custom_mode field of heartbeat. */ -#ifndef HAVE_ENUM_PLANE_MODE -#define HAVE_ENUM_PLANE_MODE -typedef enum PLANE_MODE -{ - PLANE_MODE_MANUAL=0, /* | */ - PLANE_MODE_CIRCLE=1, /* | */ - PLANE_MODE_STABILIZE=2, /* | */ - PLANE_MODE_TRAINING=3, /* | */ - PLANE_MODE_ACRO=4, /* | */ - PLANE_MODE_FLY_BY_WIRE_A=5, /* | */ - PLANE_MODE_FLY_BY_WIRE_B=6, /* | */ - PLANE_MODE_CRUISE=7, /* | */ - PLANE_MODE_AUTOTUNE=8, /* | */ - PLANE_MODE_AUTO=10, /* | */ - PLANE_MODE_RTL=11, /* | */ - PLANE_MODE_LOITER=12, /* | */ - PLANE_MODE_TAKEOFF=13, /* | */ - PLANE_MODE_AVOID_ADSB=14, /* | */ - PLANE_MODE_GUIDED=15, /* | */ - PLANE_MODE_INITIALIZING=16, /* | */ - PLANE_MODE_QSTABILIZE=17, /* | */ - PLANE_MODE_QHOVER=18, /* | */ - PLANE_MODE_QLOITER=19, /* | */ - PLANE_MODE_QLAND=20, /* | */ - PLANE_MODE_QRTL=21, /* | */ - PLANE_MODE_QAUTOTUNE=22, /* | */ - PLANE_MODE_QACRO=23, /* | */ - PLANE_MODE_THERMAL=24, /* | */ - PLANE_MODE_ENUM_END=25, /* | */ -} PLANE_MODE; -#endif - -/** @brief A mapping of copter flight modes for custom_mode field of heartbeat. */ -#ifndef HAVE_ENUM_COPTER_MODE -#define HAVE_ENUM_COPTER_MODE -typedef enum COPTER_MODE -{ - COPTER_MODE_STABILIZE=0, /* | */ - COPTER_MODE_ACRO=1, /* | */ - COPTER_MODE_ALT_HOLD=2, /* | */ - COPTER_MODE_AUTO=3, /* | */ - COPTER_MODE_GUIDED=4, /* | */ - COPTER_MODE_LOITER=5, /* | */ - COPTER_MODE_RTL=6, /* | */ - COPTER_MODE_CIRCLE=7, /* | */ - COPTER_MODE_LAND=9, /* | */ - COPTER_MODE_DRIFT=11, /* | */ - COPTER_MODE_SPORT=13, /* | */ - COPTER_MODE_FLIP=14, /* | */ - COPTER_MODE_AUTOTUNE=15, /* | */ - COPTER_MODE_POSHOLD=16, /* | */ - COPTER_MODE_BRAKE=17, /* | */ - COPTER_MODE_THROW=18, /* | */ - COPTER_MODE_AVOID_ADSB=19, /* | */ - COPTER_MODE_GUIDED_NOGPS=20, /* | */ - COPTER_MODE_SMART_RTL=21, /* | */ - COPTER_MODE_FLOWHOLD=22, /* | */ - COPTER_MODE_FOLLOW=23, /* | */ - COPTER_MODE_ZIGZAG=24, /* | */ - COPTER_MODE_SYSTEMID=25, /* | */ - COPTER_MODE_AUTOROTATE=26, /* | */ - COPTER_MODE_ENUM_END=27, /* | */ -} COPTER_MODE; -#endif - -/** @brief A mapping of sub flight modes for custom_mode field of heartbeat. */ -#ifndef HAVE_ENUM_SUB_MODE -#define HAVE_ENUM_SUB_MODE -typedef enum SUB_MODE -{ - SUB_MODE_STABILIZE=0, /* | */ - SUB_MODE_ACRO=1, /* | */ - SUB_MODE_ALT_HOLD=2, /* | */ - SUB_MODE_AUTO=3, /* | */ - SUB_MODE_GUIDED=4, /* | */ - SUB_MODE_CIRCLE=7, /* | */ - SUB_MODE_SURFACE=9, /* | */ - SUB_MODE_POSHOLD=16, /* | */ - SUB_MODE_MANUAL=19, /* | */ - SUB_MODE_ENUM_END=20, /* | */ -} SUB_MODE; -#endif - -/** @brief A mapping of rover flight modes for custom_mode field of heartbeat. */ -#ifndef HAVE_ENUM_ROVER_MODE -#define HAVE_ENUM_ROVER_MODE -typedef enum ROVER_MODE -{ - ROVER_MODE_MANUAL=0, /* | */ - ROVER_MODE_ACRO=1, /* | */ - ROVER_MODE_STEERING=3, /* | */ - ROVER_MODE_HOLD=4, /* | */ - ROVER_MODE_LOITER=5, /* | */ - ROVER_MODE_FOLLOW=6, /* | */ - ROVER_MODE_SIMPLE=7, /* | */ - ROVER_MODE_AUTO=10, /* | */ - ROVER_MODE_RTL=11, /* | */ - ROVER_MODE_SMART_RTL=12, /* | */ - ROVER_MODE_GUIDED=15, /* | */ - ROVER_MODE_INITIALIZING=16, /* | */ - ROVER_MODE_ENUM_END=17, /* | */ -} ROVER_MODE; -#endif - -/** @brief A mapping of antenna tracker flight modes for custom_mode field of heartbeat. */ -#ifndef HAVE_ENUM_TRACKER_MODE -#define HAVE_ENUM_TRACKER_MODE -typedef enum TRACKER_MODE -{ - TRACKER_MODE_MANUAL=0, /* | */ - TRACKER_MODE_STOP=1, /* | */ - TRACKER_MODE_SCAN=2, /* | */ - TRACKER_MODE_SERVO_TEST=3, /* | */ - TRACKER_MODE_AUTO=10, /* | */ - TRACKER_MODE_INITIALIZING=16, /* | */ - TRACKER_MODE_ENUM_END=17, /* | */ -} TRACKER_MODE; -#endif - -/** @brief The type of parameter for the OSD parameter editor. */ -#ifndef HAVE_ENUM_OSD_PARAM_CONFIG_TYPE -#define HAVE_ENUM_OSD_PARAM_CONFIG_TYPE -typedef enum OSD_PARAM_CONFIG_TYPE -{ - OSD_PARAM_NONE=0, /* | */ - OSD_PARAM_SERIAL_PROTOCOL=1, /* | */ - OSD_PARAM_SERVO_FUNCTION=2, /* | */ - OSD_PARAM_AUX_FUNCTION=3, /* | */ - OSD_PARAM_FLIGHT_MODE=4, /* | */ - OSD_PARAM_FAILSAFE_ACTION=5, /* | */ - OSD_PARAM_FAILSAFE_ACTION_1=6, /* | */ - OSD_PARAM_FAILSAFE_ACTION_2=7, /* | */ - OSD_PARAM_NUM_TYPES=8, /* | */ - OSD_PARAM_CONFIG_TYPE_ENUM_END=9, /* | */ -} OSD_PARAM_CONFIG_TYPE; -#endif - -/** @brief The error type for the OSD parameter editor. */ -#ifndef HAVE_ENUM_OSD_PARAM_CONFIG_ERROR -#define HAVE_ENUM_OSD_PARAM_CONFIG_ERROR -typedef enum OSD_PARAM_CONFIG_ERROR -{ - OSD_PARAM_SUCCESS=0, /* | */ - OSD_PARAM_INVALID_SCREEN=1, /* | */ - OSD_PARAM_INVALID_PARAMETER_INDEX=2, /* | */ - OSD_PARAM_INVALID_PARAMETER=3, /* | */ - OSD_PARAM_CONFIG_ERROR_ENUM_END=4, /* | */ -} OSD_PARAM_CONFIG_ERROR; -#endif - -// MAVLINK VERSION - -#ifndef MAVLINK_VERSION -#define MAVLINK_VERSION 2 -#endif - -#if (MAVLINK_VERSION == 0) -#undef MAVLINK_VERSION -#define MAVLINK_VERSION 2 -#endif - -// MESSAGE DEFINITIONS -#include "./mavlink_msg_sensor_offsets.h" -#include "./mavlink_msg_set_mag_offsets.h" -#include "./mavlink_msg_meminfo.h" -#include "./mavlink_msg_ap_adc.h" -#include "./mavlink_msg_digicam_configure.h" -#include "./mavlink_msg_digicam_control.h" -#include "./mavlink_msg_mount_configure.h" -#include "./mavlink_msg_mount_control.h" -#include "./mavlink_msg_mount_status.h" -#include "./mavlink_msg_fence_point.h" -#include "./mavlink_msg_fence_fetch_point.h" -#include "./mavlink_msg_ahrs.h" -#include "./mavlink_msg_simstate.h" -#include "./mavlink_msg_hwstatus.h" -#include "./mavlink_msg_radio.h" -#include "./mavlink_msg_limits_status.h" -#include "./mavlink_msg_wind.h" -#include "./mavlink_msg_data16.h" -#include "./mavlink_msg_data32.h" -#include "./mavlink_msg_data64.h" -#include "./mavlink_msg_data96.h" -#include "./mavlink_msg_rangefinder.h" -#include "./mavlink_msg_airspeed_autocal.h" -#include "./mavlink_msg_rally_point.h" -#include "./mavlink_msg_rally_fetch_point.h" -#include "./mavlink_msg_compassmot_status.h" -#include "./mavlink_msg_ahrs2.h" -#include "./mavlink_msg_camera_status.h" -#include "./mavlink_msg_camera_feedback.h" -#include "./mavlink_msg_battery2.h" -#include "./mavlink_msg_ahrs3.h" -#include "./mavlink_msg_autopilot_version_request.h" -#include "./mavlink_msg_remote_log_data_block.h" -#include "./mavlink_msg_remote_log_block_status.h" -#include "./mavlink_msg_led_control.h" -#include "./mavlink_msg_mag_cal_progress.h" -#include "./mavlink_msg_ekf_status_report.h" -#include "./mavlink_msg_pid_tuning.h" -#include "./mavlink_msg_deepstall.h" -#include "./mavlink_msg_gimbal_report.h" -#include "./mavlink_msg_gimbal_control.h" -#include "./mavlink_msg_gimbal_torque_cmd_report.h" -#include "./mavlink_msg_gopro_heartbeat.h" -#include "./mavlink_msg_gopro_get_request.h" -#include "./mavlink_msg_gopro_get_response.h" -#include "./mavlink_msg_gopro_set_request.h" -#include "./mavlink_msg_gopro_set_response.h" -#include "./mavlink_msg_rpm.h" -#include "./mavlink_msg_device_op_read.h" -#include "./mavlink_msg_device_op_read_reply.h" -#include "./mavlink_msg_device_op_write.h" -#include "./mavlink_msg_device_op_write_reply.h" -#include "./mavlink_msg_adap_tuning.h" -#include "./mavlink_msg_vision_position_delta.h" -#include "./mavlink_msg_aoa_ssa.h" -#include "./mavlink_msg_esc_telemetry_1_to_4.h" -#include "./mavlink_msg_esc_telemetry_5_to_8.h" -#include "./mavlink_msg_esc_telemetry_9_to_12.h" -#include "./mavlink_msg_osd_param_config.h" -#include "./mavlink_msg_osd_param_config_reply.h" -#include "./mavlink_msg_osd_param_show_config.h" -#include "./mavlink_msg_osd_param_show_config_reply.h" -#include "./mavlink_msg_obstacle_distance_3d.h" - -// base include -#include "../common/common.h" -#include "../uAvionix/uAvionix.h" -#include "../icarous/icarous.h" - -#undef MAVLINK_THIS_XML_IDX -#define MAVLINK_THIS_XML_IDX 0 - -#if MAVLINK_THIS_XML_IDX == MAVLINK_PRIMARY_XML_IDX -# define MAVLINK_MESSAGE_INFO {MAVLINK_MESSAGE_INFO_HEARTBEAT, MAVLINK_MESSAGE_INFO_SYS_STATUS, MAVLINK_MESSAGE_INFO_SYSTEM_TIME, MAVLINK_MESSAGE_INFO_PING, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL_ACK, MAVLINK_MESSAGE_INFO_AUTH_KEY, MAVLINK_MESSAGE_INFO_LINK_NODE_STATUS, MAVLINK_MESSAGE_INFO_SET_MODE, MAVLINK_MESSAGE_INFO_PARAM_ACK_TRANSACTION, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_READ, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_LIST, MAVLINK_MESSAGE_INFO_PARAM_VALUE, MAVLINK_MESSAGE_INFO_PARAM_SET, MAVLINK_MESSAGE_INFO_GPS_RAW_INT, MAVLINK_MESSAGE_INFO_GPS_STATUS, MAVLINK_MESSAGE_INFO_SCALED_IMU, MAVLINK_MESSAGE_INFO_RAW_IMU, MAVLINK_MESSAGE_INFO_RAW_PRESSURE, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE, MAVLINK_MESSAGE_INFO_ATTITUDE, MAVLINK_MESSAGE_INFO_ATTITUDE_QUATERNION, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT, MAVLINK_MESSAGE_INFO_RC_CHANNELS_SCALED, MAVLINK_MESSAGE_INFO_RC_CHANNELS_RAW, MAVLINK_MESSAGE_INFO_SERVO_OUTPUT_RAW, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_PARTIAL_LIST, MAVLINK_MESSAGE_INFO_MISSION_WRITE_PARTIAL_LIST, MAVLINK_MESSAGE_INFO_MISSION_ITEM, MAVLINK_MESSAGE_INFO_MISSION_REQUEST, MAVLINK_MESSAGE_INFO_MISSION_SET_CURRENT, MAVLINK_MESSAGE_INFO_MISSION_CURRENT, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_LIST, MAVLINK_MESSAGE_INFO_MISSION_COUNT, MAVLINK_MESSAGE_INFO_MISSION_CLEAR_ALL, MAVLINK_MESSAGE_INFO_MISSION_ITEM_REACHED, MAVLINK_MESSAGE_INFO_MISSION_ACK, MAVLINK_MESSAGE_INFO_SET_GPS_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_GPS_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_PARAM_MAP_RC, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_INT, MAVLINK_MESSAGE_INFO_MISSION_CHANGED, MAVLINK_MESSAGE_INFO_SAFETY_SET_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_SAFETY_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_ATTITUDE_QUATERNION_COV, MAVLINK_MESSAGE_INFO_NAV_CONTROLLER_OUTPUT, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT_COV, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED_COV, MAVLINK_MESSAGE_INFO_RC_CHANNELS, MAVLINK_MESSAGE_INFO_REQUEST_DATA_STREAM, MAVLINK_MESSAGE_INFO_DATA_STREAM, MAVLINK_MESSAGE_INFO_MANUAL_CONTROL, MAVLINK_MESSAGE_INFO_RC_CHANNELS_OVERRIDE, MAVLINK_MESSAGE_INFO_MISSION_ITEM_INT, MAVLINK_MESSAGE_INFO_VFR_HUD, MAVLINK_MESSAGE_INFO_COMMAND_INT, MAVLINK_MESSAGE_INFO_COMMAND_LONG, MAVLINK_MESSAGE_INFO_COMMAND_ACK, MAVLINK_MESSAGE_INFO_COMMAND_CANCEL, MAVLINK_MESSAGE_INFO_MANUAL_SETPOINT, MAVLINK_MESSAGE_INFO_SET_ATTITUDE_TARGET, MAVLINK_MESSAGE_INFO_ATTITUDE_TARGET, MAVLINK_MESSAGE_INFO_SET_POSITION_TARGET_LOCAL_NED, MAVLINK_MESSAGE_INFO_POSITION_TARGET_LOCAL_NED, MAVLINK_MESSAGE_INFO_SET_POSITION_TARGET_GLOBAL_INT, MAVLINK_MESSAGE_INFO_POSITION_TARGET_GLOBAL_INT, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET, MAVLINK_MESSAGE_INFO_HIL_STATE, MAVLINK_MESSAGE_INFO_HIL_CONTROLS, MAVLINK_MESSAGE_INFO_HIL_RC_INPUTS_RAW, MAVLINK_MESSAGE_INFO_HIL_ACTUATOR_CONTROLS, MAVLINK_MESSAGE_INFO_OPTICAL_FLOW, MAVLINK_MESSAGE_INFO_GLOBAL_VISION_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_VISION_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_VISION_SPEED_ESTIMATE, MAVLINK_MESSAGE_INFO_VICON_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_HIGHRES_IMU, MAVLINK_MESSAGE_INFO_OPTICAL_FLOW_RAD, MAVLINK_MESSAGE_INFO_HIL_SENSOR, MAVLINK_MESSAGE_INFO_SIM_STATE, MAVLINK_MESSAGE_INFO_RADIO_STATUS, MAVLINK_MESSAGE_INFO_FILE_TRANSFER_PROTOCOL, MAVLINK_MESSAGE_INFO_TIMESYNC, MAVLINK_MESSAGE_INFO_CAMERA_TRIGGER, MAVLINK_MESSAGE_INFO_HIL_GPS, MAVLINK_MESSAGE_INFO_HIL_OPTICAL_FLOW, MAVLINK_MESSAGE_INFO_HIL_STATE_QUATERNION, MAVLINK_MESSAGE_INFO_SCALED_IMU2, MAVLINK_MESSAGE_INFO_LOG_REQUEST_LIST, MAVLINK_MESSAGE_INFO_LOG_ENTRY, MAVLINK_MESSAGE_INFO_LOG_REQUEST_DATA, MAVLINK_MESSAGE_INFO_LOG_DATA, MAVLINK_MESSAGE_INFO_LOG_ERASE, MAVLINK_MESSAGE_INFO_LOG_REQUEST_END, MAVLINK_MESSAGE_INFO_GPS_INJECT_DATA, MAVLINK_MESSAGE_INFO_GPS2_RAW, MAVLINK_MESSAGE_INFO_POWER_STATUS, MAVLINK_MESSAGE_INFO_SERIAL_CONTROL, MAVLINK_MESSAGE_INFO_GPS_RTK, MAVLINK_MESSAGE_INFO_GPS2_RTK, MAVLINK_MESSAGE_INFO_SCALED_IMU3, MAVLINK_MESSAGE_INFO_DATA_TRANSMISSION_HANDSHAKE, MAVLINK_MESSAGE_INFO_ENCAPSULATED_DATA, MAVLINK_MESSAGE_INFO_DISTANCE_SENSOR, MAVLINK_MESSAGE_INFO_TERRAIN_REQUEST, MAVLINK_MESSAGE_INFO_TERRAIN_DATA, MAVLINK_MESSAGE_INFO_TERRAIN_CHECK, MAVLINK_MESSAGE_INFO_TERRAIN_REPORT, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE2, MAVLINK_MESSAGE_INFO_ATT_POS_MOCAP, MAVLINK_MESSAGE_INFO_SET_ACTUATOR_CONTROL_TARGET, MAVLINK_MESSAGE_INFO_ACTUATOR_CONTROL_TARGET, MAVLINK_MESSAGE_INFO_ALTITUDE, MAVLINK_MESSAGE_INFO_RESOURCE_REQUEST, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE3, MAVLINK_MESSAGE_INFO_FOLLOW_TARGET, MAVLINK_MESSAGE_INFO_CONTROL_SYSTEM_STATE, MAVLINK_MESSAGE_INFO_BATTERY_STATUS, MAVLINK_MESSAGE_INFO_AUTOPILOT_VERSION, MAVLINK_MESSAGE_INFO_LANDING_TARGET, MAVLINK_MESSAGE_INFO_SENSOR_OFFSETS, MAVLINK_MESSAGE_INFO_SET_MAG_OFFSETS, MAVLINK_MESSAGE_INFO_MEMINFO, MAVLINK_MESSAGE_INFO_AP_ADC, MAVLINK_MESSAGE_INFO_DIGICAM_CONFIGURE, MAVLINK_MESSAGE_INFO_DIGICAM_CONTROL, MAVLINK_MESSAGE_INFO_MOUNT_CONFIGURE, MAVLINK_MESSAGE_INFO_MOUNT_CONTROL, MAVLINK_MESSAGE_INFO_MOUNT_STATUS, MAVLINK_MESSAGE_INFO_FENCE_POINT, MAVLINK_MESSAGE_INFO_FENCE_FETCH_POINT, MAVLINK_MESSAGE_INFO_FENCE_STATUS, MAVLINK_MESSAGE_INFO_AHRS, MAVLINK_MESSAGE_INFO_SIMSTATE, MAVLINK_MESSAGE_INFO_HWSTATUS, MAVLINK_MESSAGE_INFO_RADIO, MAVLINK_MESSAGE_INFO_LIMITS_STATUS, MAVLINK_MESSAGE_INFO_WIND, MAVLINK_MESSAGE_INFO_DATA16, MAVLINK_MESSAGE_INFO_DATA32, MAVLINK_MESSAGE_INFO_DATA64, MAVLINK_MESSAGE_INFO_DATA96, MAVLINK_MESSAGE_INFO_RANGEFINDER, MAVLINK_MESSAGE_INFO_AIRSPEED_AUTOCAL, MAVLINK_MESSAGE_INFO_RALLY_POINT, MAVLINK_MESSAGE_INFO_RALLY_FETCH_POINT, MAVLINK_MESSAGE_INFO_COMPASSMOT_STATUS, MAVLINK_MESSAGE_INFO_AHRS2, MAVLINK_MESSAGE_INFO_CAMERA_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_FEEDBACK, MAVLINK_MESSAGE_INFO_BATTERY2, MAVLINK_MESSAGE_INFO_AHRS3, MAVLINK_MESSAGE_INFO_AUTOPILOT_VERSION_REQUEST, MAVLINK_MESSAGE_INFO_REMOTE_LOG_DATA_BLOCK, MAVLINK_MESSAGE_INFO_REMOTE_LOG_BLOCK_STATUS, MAVLINK_MESSAGE_INFO_LED_CONTROL, MAVLINK_MESSAGE_INFO_MAG_CAL_PROGRESS, MAVLINK_MESSAGE_INFO_MAG_CAL_REPORT, MAVLINK_MESSAGE_INFO_EKF_STATUS_REPORT, MAVLINK_MESSAGE_INFO_PID_TUNING, MAVLINK_MESSAGE_INFO_DEEPSTALL, MAVLINK_MESSAGE_INFO_GIMBAL_REPORT, MAVLINK_MESSAGE_INFO_GIMBAL_CONTROL, MAVLINK_MESSAGE_INFO_GIMBAL_TORQUE_CMD_REPORT, MAVLINK_MESSAGE_INFO_GOPRO_HEARTBEAT, MAVLINK_MESSAGE_INFO_GOPRO_GET_REQUEST, MAVLINK_MESSAGE_INFO_GOPRO_GET_RESPONSE, MAVLINK_MESSAGE_INFO_GOPRO_SET_REQUEST, MAVLINK_MESSAGE_INFO_GOPRO_SET_RESPONSE, MAVLINK_MESSAGE_INFO_EFI_STATUS, MAVLINK_MESSAGE_INFO_RPM, MAVLINK_MESSAGE_INFO_ESTIMATOR_STATUS, MAVLINK_MESSAGE_INFO_WIND_COV, MAVLINK_MESSAGE_INFO_GPS_INPUT, MAVLINK_MESSAGE_INFO_GPS_RTCM_DATA, MAVLINK_MESSAGE_INFO_HIGH_LATENCY, MAVLINK_MESSAGE_INFO_HIGH_LATENCY2, MAVLINK_MESSAGE_INFO_VIBRATION, MAVLINK_MESSAGE_INFO_HOME_POSITION, MAVLINK_MESSAGE_INFO_SET_HOME_POSITION, MAVLINK_MESSAGE_INFO_MESSAGE_INTERVAL, MAVLINK_MESSAGE_INFO_EXTENDED_SYS_STATE, MAVLINK_MESSAGE_INFO_ADSB_VEHICLE, MAVLINK_MESSAGE_INFO_COLLISION, MAVLINK_MESSAGE_INFO_V2_EXTENSION, MAVLINK_MESSAGE_INFO_MEMORY_VECT, MAVLINK_MESSAGE_INFO_DEBUG_VECT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_FLOAT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_INT, MAVLINK_MESSAGE_INFO_STATUSTEXT, MAVLINK_MESSAGE_INFO_DEBUG, MAVLINK_MESSAGE_INFO_SETUP_SIGNING, MAVLINK_MESSAGE_INFO_BUTTON_CHANGE, MAVLINK_MESSAGE_INFO_PLAY_TUNE, MAVLINK_MESSAGE_INFO_CAMERA_INFORMATION, MAVLINK_MESSAGE_INFO_CAMERA_SETTINGS, MAVLINK_MESSAGE_INFO_STORAGE_INFORMATION, MAVLINK_MESSAGE_INFO_CAMERA_CAPTURE_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_IMAGE_CAPTURED, MAVLINK_MESSAGE_INFO_FLIGHT_INFORMATION, MAVLINK_MESSAGE_INFO_MOUNT_ORIENTATION, MAVLINK_MESSAGE_INFO_LOGGING_DATA, MAVLINK_MESSAGE_INFO_LOGGING_DATA_ACKED, MAVLINK_MESSAGE_INFO_LOGGING_ACK, MAVLINK_MESSAGE_INFO_VIDEO_STREAM_INFORMATION, MAVLINK_MESSAGE_INFO_VIDEO_STREAM_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_FOV_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_TRACKING_IMAGE_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_TRACKING_GEO_STATUS, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_INFORMATION, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_STATUS, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_SET_ATTITUDE, MAVLINK_MESSAGE_INFO_GIMBAL_DEVICE_INFORMATION, MAVLINK_MESSAGE_INFO_GIMBAL_DEVICE_SET_ATTITUDE, MAVLINK_MESSAGE_INFO_GIMBAL_DEVICE_ATTITUDE_STATUS, MAVLINK_MESSAGE_INFO_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_SET_PITCHYAW, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_SET_MANUAL_CONTROL, MAVLINK_MESSAGE_INFO_ESC_INFO, MAVLINK_MESSAGE_INFO_ESC_STATUS, MAVLINK_MESSAGE_INFO_WIFI_CONFIG_AP, MAVLINK_MESSAGE_INFO_PROTOCOL_VERSION, MAVLINK_MESSAGE_INFO_AIS_VESSEL, MAVLINK_MESSAGE_INFO_UAVCAN_NODE_STATUS, MAVLINK_MESSAGE_INFO_UAVCAN_NODE_INFO, MAVLINK_MESSAGE_INFO_PARAM_EXT_REQUEST_READ, MAVLINK_MESSAGE_INFO_PARAM_EXT_REQUEST_LIST, MAVLINK_MESSAGE_INFO_PARAM_EXT_VALUE, MAVLINK_MESSAGE_INFO_PARAM_EXT_SET, MAVLINK_MESSAGE_INFO_PARAM_EXT_ACK, MAVLINK_MESSAGE_INFO_OBSTACLE_DISTANCE, MAVLINK_MESSAGE_INFO_ODOMETRY, MAVLINK_MESSAGE_INFO_TRAJECTORY_REPRESENTATION_WAYPOINTS, MAVLINK_MESSAGE_INFO_TRAJECTORY_REPRESENTATION_BEZIER, MAVLINK_MESSAGE_INFO_CELLULAR_STATUS, MAVLINK_MESSAGE_INFO_ISBD_LINK_STATUS, MAVLINK_MESSAGE_INFO_CELLULAR_CONFIG, MAVLINK_MESSAGE_INFO_RAW_RPM, MAVLINK_MESSAGE_INFO_UTM_GLOBAL_POSITION, MAVLINK_MESSAGE_INFO_DEBUG_FLOAT_ARRAY, MAVLINK_MESSAGE_INFO_ORBIT_EXECUTION_STATUS, MAVLINK_MESSAGE_INFO_SMART_BATTERY_INFO, MAVLINK_MESSAGE_INFO_GENERATOR_STATUS, MAVLINK_MESSAGE_INFO_ACTUATOR_OUTPUT_STATUS, MAVLINK_MESSAGE_INFO_TIME_ESTIMATE_TO_TARGET, MAVLINK_MESSAGE_INFO_TUNNEL, MAVLINK_MESSAGE_INFO_ONBOARD_COMPUTER_STATUS, MAVLINK_MESSAGE_INFO_COMPONENT_INFORMATION, MAVLINK_MESSAGE_INFO_PLAY_TUNE_V2, MAVLINK_MESSAGE_INFO_SUPPORTED_TUNES, MAVLINK_MESSAGE_INFO_WHEEL_DISTANCE, MAVLINK_MESSAGE_INFO_WINCH_STATUS, MAVLINK_MESSAGE_INFO_UAVIONIX_ADSB_OUT_CFG, MAVLINK_MESSAGE_INFO_UAVIONIX_ADSB_OUT_DYNAMIC, MAVLINK_MESSAGE_INFO_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT, MAVLINK_MESSAGE_INFO_DEVICE_OP_READ, MAVLINK_MESSAGE_INFO_DEVICE_OP_READ_REPLY, MAVLINK_MESSAGE_INFO_DEVICE_OP_WRITE, MAVLINK_MESSAGE_INFO_DEVICE_OP_WRITE_REPLY, MAVLINK_MESSAGE_INFO_ADAP_TUNING, MAVLINK_MESSAGE_INFO_VISION_POSITION_DELTA, MAVLINK_MESSAGE_INFO_AOA_SSA, MAVLINK_MESSAGE_INFO_ESC_TELEMETRY_1_TO_4, MAVLINK_MESSAGE_INFO_ESC_TELEMETRY_5_TO_8, MAVLINK_MESSAGE_INFO_ESC_TELEMETRY_9_TO_12, MAVLINK_MESSAGE_INFO_OSD_PARAM_CONFIG, MAVLINK_MESSAGE_INFO_OSD_PARAM_CONFIG_REPLY, MAVLINK_MESSAGE_INFO_OSD_PARAM_SHOW_CONFIG, MAVLINK_MESSAGE_INFO_OSD_PARAM_SHOW_CONFIG_REPLY, MAVLINK_MESSAGE_INFO_OBSTACLE_DISTANCE_3D, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_BASIC_ID, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_LOCATION, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_AUTHENTICATION, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_SELF_ID, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_SYSTEM, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_OPERATOR_ID, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_MESSAGE_PACK, MAVLINK_MESSAGE_INFO_ICAROUS_HEARTBEAT, MAVLINK_MESSAGE_INFO_ICAROUS_KINEMATIC_BANDS} -# define MAVLINK_MESSAGE_NAMES {{ "ACTUATOR_CONTROL_TARGET", 140 }, { "ACTUATOR_OUTPUT_STATUS", 375 }, { "ADAP_TUNING", 11010 }, { "ADSB_VEHICLE", 246 }, { "AHRS", 163 }, { "AHRS2", 178 }, { "AHRS3", 182 }, { "AIRSPEED_AUTOCAL", 174 }, { "AIS_VESSEL", 301 }, { "ALTITUDE", 141 }, { "AOA_SSA", 11020 }, { "AP_ADC", 153 }, { "ATTITUDE", 30 }, { "ATTITUDE_QUATERNION", 31 }, { "ATTITUDE_QUATERNION_COV", 61 }, { "ATTITUDE_TARGET", 83 }, { "ATT_POS_MOCAP", 138 }, { "AUTH_KEY", 7 }, { "AUTOPILOT_STATE_FOR_GIMBAL_DEVICE", 286 }, { "AUTOPILOT_VERSION", 148 }, { "AUTOPILOT_VERSION_REQUEST", 183 }, { "BATTERY2", 181 }, { "BATTERY_STATUS", 147 }, { "BUTTON_CHANGE", 257 }, { "CAMERA_CAPTURE_STATUS", 262 }, { "CAMERA_FEEDBACK", 180 }, { "CAMERA_FOV_STATUS", 271 }, { "CAMERA_IMAGE_CAPTURED", 263 }, { "CAMERA_INFORMATION", 259 }, { "CAMERA_SETTINGS", 260 }, { "CAMERA_STATUS", 179 }, { "CAMERA_TRACKING_GEO_STATUS", 276 }, { "CAMERA_TRACKING_IMAGE_STATUS", 275 }, { "CAMERA_TRIGGER", 112 }, { "CELLULAR_CONFIG", 336 }, { "CELLULAR_STATUS", 334 }, { "CHANGE_OPERATOR_CONTROL", 5 }, { "CHANGE_OPERATOR_CONTROL_ACK", 6 }, { "COLLISION", 247 }, { "COMMAND_ACK", 77 }, { "COMMAND_CANCEL", 80 }, { "COMMAND_INT", 75 }, { "COMMAND_LONG", 76 }, { "COMPASSMOT_STATUS", 177 }, { "COMPONENT_INFORMATION", 395 }, { "CONTROL_SYSTEM_STATE", 146 }, { "DATA16", 169 }, { "DATA32", 170 }, { "DATA64", 171 }, { "DATA96", 172 }, { "DATA_STREAM", 67 }, { "DATA_TRANSMISSION_HANDSHAKE", 130 }, { "DEBUG", 254 }, { "DEBUG_FLOAT_ARRAY", 350 }, { "DEBUG_VECT", 250 }, { "DEEPSTALL", 195 }, { "DEVICE_OP_READ", 11000 }, { "DEVICE_OP_READ_REPLY", 11001 }, { "DEVICE_OP_WRITE", 11002 }, { "DEVICE_OP_WRITE_REPLY", 11003 }, { "DIGICAM_CONFIGURE", 154 }, { "DIGICAM_CONTROL", 155 }, { "DISTANCE_SENSOR", 132 }, { "EFI_STATUS", 225 }, { "EKF_STATUS_REPORT", 193 }, { "ENCAPSULATED_DATA", 131 }, { "ESC_INFO", 290 }, { "ESC_STATUS", 291 }, { "ESC_TELEMETRY_1_TO_4", 11030 }, { "ESC_TELEMETRY_5_TO_8", 11031 }, { "ESC_TELEMETRY_9_TO_12", 11032 }, { "ESTIMATOR_STATUS", 230 }, { "EXTENDED_SYS_STATE", 245 }, { "FENCE_FETCH_POINT", 161 }, { "FENCE_POINT", 160 }, { "FENCE_STATUS", 162 }, { "FILE_TRANSFER_PROTOCOL", 110 }, { "FLIGHT_INFORMATION", 264 }, { "FOLLOW_TARGET", 144 }, { "GENERATOR_STATUS", 373 }, { "GIMBAL_CONTROL", 201 }, { "GIMBAL_DEVICE_ATTITUDE_STATUS", 285 }, { "GIMBAL_DEVICE_INFORMATION", 283 }, { "GIMBAL_DEVICE_SET_ATTITUDE", 284 }, { "GIMBAL_MANAGER_INFORMATION", 280 }, { "GIMBAL_MANAGER_SET_ATTITUDE", 282 }, { "GIMBAL_MANAGER_SET_MANUAL_CONTROL", 288 }, { "GIMBAL_MANAGER_SET_PITCHYAW", 287 }, { "GIMBAL_MANAGER_STATUS", 281 }, { "GIMBAL_REPORT", 200 }, { "GIMBAL_TORQUE_CMD_REPORT", 214 }, { "GLOBAL_POSITION_INT", 33 }, { "GLOBAL_POSITION_INT_COV", 63 }, { "GLOBAL_VISION_POSITION_ESTIMATE", 101 }, { "GOPRO_GET_REQUEST", 216 }, { "GOPRO_GET_RESPONSE", 217 }, { "GOPRO_HEARTBEAT", 215 }, { "GOPRO_SET_REQUEST", 218 }, { "GOPRO_SET_RESPONSE", 219 }, { "GPS2_RAW", 124 }, { "GPS2_RTK", 128 }, { "GPS_GLOBAL_ORIGIN", 49 }, { "GPS_INJECT_DATA", 123 }, { "GPS_INPUT", 232 }, { "GPS_RAW_INT", 24 }, { "GPS_RTCM_DATA", 233 }, { "GPS_RTK", 127 }, { "GPS_STATUS", 25 }, { "HEARTBEAT", 0 }, { "HIGHRES_IMU", 105 }, { "HIGH_LATENCY", 234 }, { "HIGH_LATENCY2", 235 }, { "HIL_ACTUATOR_CONTROLS", 93 }, { "HIL_CONTROLS", 91 }, { "HIL_GPS", 113 }, { "HIL_OPTICAL_FLOW", 114 }, { "HIL_RC_INPUTS_RAW", 92 }, { "HIL_SENSOR", 107 }, { "HIL_STATE", 90 }, { "HIL_STATE_QUATERNION", 115 }, { "HOME_POSITION", 242 }, { "HWSTATUS", 165 }, { "ICAROUS_HEARTBEAT", 42000 }, { "ICAROUS_KINEMATIC_BANDS", 42001 }, { "ISBD_LINK_STATUS", 335 }, { "LANDING_TARGET", 149 }, { "LED_CONTROL", 186 }, { "LIMITS_STATUS", 167 }, { "LINK_NODE_STATUS", 8 }, { "LOCAL_POSITION_NED", 32 }, { "LOCAL_POSITION_NED_COV", 64 }, { "LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET", 89 }, { "LOGGING_ACK", 268 }, { "LOGGING_DATA", 266 }, { "LOGGING_DATA_ACKED", 267 }, { "LOG_DATA", 120 }, { "LOG_ENTRY", 118 }, { "LOG_ERASE", 121 }, { "LOG_REQUEST_DATA", 119 }, { "LOG_REQUEST_END", 122 }, { "LOG_REQUEST_LIST", 117 }, { "MAG_CAL_PROGRESS", 191 }, { "MAG_CAL_REPORT", 192 }, { "MANUAL_CONTROL", 69 }, { "MANUAL_SETPOINT", 81 }, { "MEMINFO", 152 }, { "MEMORY_VECT", 249 }, { "MESSAGE_INTERVAL", 244 }, { "MISSION_ACK", 47 }, { "MISSION_CHANGED", 52 }, { "MISSION_CLEAR_ALL", 45 }, { "MISSION_COUNT", 44 }, { "MISSION_CURRENT", 42 }, { "MISSION_ITEM", 39 }, { "MISSION_ITEM_INT", 73 }, { "MISSION_ITEM_REACHED", 46 }, { "MISSION_REQUEST", 40 }, { "MISSION_REQUEST_INT", 51 }, { "MISSION_REQUEST_LIST", 43 }, { "MISSION_REQUEST_PARTIAL_LIST", 37 }, { "MISSION_SET_CURRENT", 41 }, { "MISSION_WRITE_PARTIAL_LIST", 38 }, { "MOUNT_CONFIGURE", 156 }, { "MOUNT_CONTROL", 157 }, { "MOUNT_ORIENTATION", 265 }, { "MOUNT_STATUS", 158 }, { "NAMED_VALUE_FLOAT", 251 }, { "NAMED_VALUE_INT", 252 }, { "NAV_CONTROLLER_OUTPUT", 62 }, { "OBSTACLE_DISTANCE", 330 }, { "OBSTACLE_DISTANCE_3D", 11037 }, { "ODOMETRY", 331 }, { "ONBOARD_COMPUTER_STATUS", 390 }, { "OPEN_DRONE_ID_AUTHENTICATION", 12902 }, { "OPEN_DRONE_ID_BASIC_ID", 12900 }, { "OPEN_DRONE_ID_LOCATION", 12901 }, { "OPEN_DRONE_ID_MESSAGE_PACK", 12915 }, { "OPEN_DRONE_ID_OPERATOR_ID", 12905 }, { "OPEN_DRONE_ID_SELF_ID", 12903 }, { "OPEN_DRONE_ID_SYSTEM", 12904 }, { "OPTICAL_FLOW", 100 }, { "OPTICAL_FLOW_RAD", 106 }, { "ORBIT_EXECUTION_STATUS", 360 }, { "OSD_PARAM_CONFIG", 11033 }, { "OSD_PARAM_CONFIG_REPLY", 11034 }, { "OSD_PARAM_SHOW_CONFIG", 11035 }, { "OSD_PARAM_SHOW_CONFIG_REPLY", 11036 }, { "PARAM_ACK_TRANSACTION", 19 }, { "PARAM_EXT_ACK", 324 }, { "PARAM_EXT_REQUEST_LIST", 321 }, { "PARAM_EXT_REQUEST_READ", 320 }, { "PARAM_EXT_SET", 323 }, { "PARAM_EXT_VALUE", 322 }, { "PARAM_MAP_RC", 50 }, { "PARAM_REQUEST_LIST", 21 }, { "PARAM_REQUEST_READ", 20 }, { "PARAM_SET", 23 }, { "PARAM_VALUE", 22 }, { "PID_TUNING", 194 }, { "PING", 4 }, { "PLAY_TUNE", 258 }, { "PLAY_TUNE_V2", 400 }, { "POSITION_TARGET_GLOBAL_INT", 87 }, { "POSITION_TARGET_LOCAL_NED", 85 }, { "POWER_STATUS", 125 }, { "PROTOCOL_VERSION", 300 }, { "RADIO", 166 }, { "RADIO_STATUS", 109 }, { "RALLY_FETCH_POINT", 176 }, { "RALLY_POINT", 175 }, { "RANGEFINDER", 173 }, { "RAW_IMU", 27 }, { "RAW_PRESSURE", 28 }, { "RAW_RPM", 339 }, { "RC_CHANNELS", 65 }, { "RC_CHANNELS_OVERRIDE", 70 }, { "RC_CHANNELS_RAW", 35 }, { "RC_CHANNELS_SCALED", 34 }, { "REMOTE_LOG_BLOCK_STATUS", 185 }, { "REMOTE_LOG_DATA_BLOCK", 184 }, { "REQUEST_DATA_STREAM", 66 }, { "RESOURCE_REQUEST", 142 }, { "RPM", 226 }, { "SAFETY_ALLOWED_AREA", 55 }, { "SAFETY_SET_ALLOWED_AREA", 54 }, { "SCALED_IMU", 26 }, { "SCALED_IMU2", 116 }, { "SCALED_IMU3", 129 }, { "SCALED_PRESSURE", 29 }, { "SCALED_PRESSURE2", 137 }, { "SCALED_PRESSURE3", 143 }, { "SENSOR_OFFSETS", 150 }, { "SERIAL_CONTROL", 126 }, { "SERVO_OUTPUT_RAW", 36 }, { "SETUP_SIGNING", 256 }, { "SET_ACTUATOR_CONTROL_TARGET", 139 }, { "SET_ATTITUDE_TARGET", 82 }, { "SET_GPS_GLOBAL_ORIGIN", 48 }, { "SET_HOME_POSITION", 243 }, { "SET_MAG_OFFSETS", 151 }, { "SET_MODE", 11 }, { "SET_POSITION_TARGET_GLOBAL_INT", 86 }, { "SET_POSITION_TARGET_LOCAL_NED", 84 }, { "SIMSTATE", 164 }, { "SIM_STATE", 108 }, { "SMART_BATTERY_INFO", 370 }, { "STATUSTEXT", 253 }, { "STORAGE_INFORMATION", 261 }, { "SUPPORTED_TUNES", 401 }, { "SYSTEM_TIME", 2 }, { "SYS_STATUS", 1 }, { "TERRAIN_CHECK", 135 }, { "TERRAIN_DATA", 134 }, { "TERRAIN_REPORT", 136 }, { "TERRAIN_REQUEST", 133 }, { "TIMESYNC", 111 }, { "TIME_ESTIMATE_TO_TARGET", 380 }, { "TRAJECTORY_REPRESENTATION_BEZIER", 333 }, { "TRAJECTORY_REPRESENTATION_WAYPOINTS", 332 }, { "TUNNEL", 385 }, { "UAVCAN_NODE_INFO", 311 }, { "UAVCAN_NODE_STATUS", 310 }, { "UAVIONIX_ADSB_OUT_CFG", 10001 }, { "UAVIONIX_ADSB_OUT_DYNAMIC", 10002 }, { "UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT", 10003 }, { "UTM_GLOBAL_POSITION", 340 }, { "V2_EXTENSION", 248 }, { "VFR_HUD", 74 }, { "VIBRATION", 241 }, { "VICON_POSITION_ESTIMATE", 104 }, { "VIDEO_STREAM_INFORMATION", 269 }, { "VIDEO_STREAM_STATUS", 270 }, { "VISION_POSITION_DELTA", 11011 }, { "VISION_POSITION_ESTIMATE", 102 }, { "VISION_SPEED_ESTIMATE", 103 }, { "WHEEL_DISTANCE", 9000 }, { "WIFI_CONFIG_AP", 299 }, { "WINCH_STATUS", 9005 }, { "WIND", 168 }, { "WIND_COV", 231 }} -# if MAVLINK_COMMAND_24BIT -# include "../mavlink_get_info.h" -# endif -#endif - -#ifdef __cplusplus -} -#endif // __cplusplus -#endif // MAVLINK_ARDUPILOTMEGA_H diff --git a/ardupilotmega/mavlink.h b/ardupilotmega/mavlink.h deleted file mode 100644 index a1fbc2424..000000000 --- a/ardupilotmega/mavlink.h +++ /dev/null @@ -1,34 +0,0 @@ -/** @file - * @brief MAVLink comm protocol built from ardupilotmega.xml - * @see http://mavlink.org - */ -#pragma once -#ifndef MAVLINK_H -#define MAVLINK_H - -#define MAVLINK_PRIMARY_XML_IDX 0 - -#ifndef MAVLINK_STX -#define MAVLINK_STX 253 -#endif - -#ifndef MAVLINK_ENDIAN -#define MAVLINK_ENDIAN MAVLINK_LITTLE_ENDIAN -#endif - -#ifndef MAVLINK_ALIGNED_FIELDS -#define MAVLINK_ALIGNED_FIELDS 1 -#endif - -#ifndef MAVLINK_CRC_EXTRA -#define MAVLINK_CRC_EXTRA 1 -#endif - -#ifndef MAVLINK_COMMAND_24BIT -#define MAVLINK_COMMAND_24BIT 1 -#endif - -#include "version.h" -#include "ardupilotmega.h" - -#endif // MAVLINK_H diff --git a/ardupilotmega/mavlink_msg_adap_tuning.h b/ardupilotmega/mavlink_msg_adap_tuning.h deleted file mode 100644 index ff2669f2b..000000000 --- a/ardupilotmega/mavlink_msg_adap_tuning.h +++ /dev/null @@ -1,513 +0,0 @@ -#pragma once -// MESSAGE ADAP_TUNING PACKING - -#define MAVLINK_MSG_ID_ADAP_TUNING 11010 - - -typedef struct __mavlink_adap_tuning_t { - float desired; /*< [deg/s] Desired rate.*/ - float achieved; /*< [deg/s] Achieved rate.*/ - float error; /*< Error between model and vehicle.*/ - float theta; /*< Theta estimated state predictor.*/ - float omega; /*< Omega estimated state predictor.*/ - float sigma; /*< Sigma estimated state predictor.*/ - float theta_dot; /*< Theta derivative.*/ - float omega_dot; /*< Omega derivative.*/ - float sigma_dot; /*< Sigma derivative.*/ - float f; /*< Projection operator value.*/ - float f_dot; /*< Projection operator derivative.*/ - float u; /*< u adaptive controlled output command.*/ - uint8_t axis; /*< Axis.*/ -} mavlink_adap_tuning_t; - -#define MAVLINK_MSG_ID_ADAP_TUNING_LEN 49 -#define MAVLINK_MSG_ID_ADAP_TUNING_MIN_LEN 49 -#define MAVLINK_MSG_ID_11010_LEN 49 -#define MAVLINK_MSG_ID_11010_MIN_LEN 49 - -#define MAVLINK_MSG_ID_ADAP_TUNING_CRC 46 -#define MAVLINK_MSG_ID_11010_CRC 46 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_ADAP_TUNING { \ - 11010, \ - "ADAP_TUNING", \ - 13, \ - { { "axis", NULL, MAVLINK_TYPE_UINT8_T, 0, 48, offsetof(mavlink_adap_tuning_t, axis) }, \ - { "desired", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_adap_tuning_t, desired) }, \ - { "achieved", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_adap_tuning_t, achieved) }, \ - { "error", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_adap_tuning_t, error) }, \ - { "theta", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_adap_tuning_t, theta) }, \ - { "omega", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_adap_tuning_t, omega) }, \ - { "sigma", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_adap_tuning_t, sigma) }, \ - { "theta_dot", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_adap_tuning_t, theta_dot) }, \ - { "omega_dot", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_adap_tuning_t, omega_dot) }, \ - { "sigma_dot", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_adap_tuning_t, sigma_dot) }, \ - { "f", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_adap_tuning_t, f) }, \ - { "f_dot", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_adap_tuning_t, f_dot) }, \ - { "u", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_adap_tuning_t, u) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_ADAP_TUNING { \ - "ADAP_TUNING", \ - 13, \ - { { "axis", NULL, MAVLINK_TYPE_UINT8_T, 0, 48, offsetof(mavlink_adap_tuning_t, axis) }, \ - { "desired", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_adap_tuning_t, desired) }, \ - { "achieved", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_adap_tuning_t, achieved) }, \ - { "error", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_adap_tuning_t, error) }, \ - { "theta", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_adap_tuning_t, theta) }, \ - { "omega", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_adap_tuning_t, omega) }, \ - { "sigma", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_adap_tuning_t, sigma) }, \ - { "theta_dot", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_adap_tuning_t, theta_dot) }, \ - { "omega_dot", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_adap_tuning_t, omega_dot) }, \ - { "sigma_dot", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_adap_tuning_t, sigma_dot) }, \ - { "f", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_adap_tuning_t, f) }, \ - { "f_dot", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_adap_tuning_t, f_dot) }, \ - { "u", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_adap_tuning_t, u) }, \ - } \ -} -#endif - -/** - * @brief Pack a adap_tuning message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param axis Axis. - * @param desired [deg/s] Desired rate. - * @param achieved [deg/s] Achieved rate. - * @param error Error between model and vehicle. - * @param theta Theta estimated state predictor. - * @param omega Omega estimated state predictor. - * @param sigma Sigma estimated state predictor. - * @param theta_dot Theta derivative. - * @param omega_dot Omega derivative. - * @param sigma_dot Sigma derivative. - * @param f Projection operator value. - * @param f_dot Projection operator derivative. - * @param u u adaptive controlled output command. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_adap_tuning_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t axis, float desired, float achieved, float error, float theta, float omega, float sigma, float theta_dot, float omega_dot, float sigma_dot, float f, float f_dot, float u) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_ADAP_TUNING_LEN]; - _mav_put_float(buf, 0, desired); - _mav_put_float(buf, 4, achieved); - _mav_put_float(buf, 8, error); - _mav_put_float(buf, 12, theta); - _mav_put_float(buf, 16, omega); - _mav_put_float(buf, 20, sigma); - _mav_put_float(buf, 24, theta_dot); - _mav_put_float(buf, 28, omega_dot); - _mav_put_float(buf, 32, sigma_dot); - _mav_put_float(buf, 36, f); - _mav_put_float(buf, 40, f_dot); - _mav_put_float(buf, 44, u); - _mav_put_uint8_t(buf, 48, axis); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ADAP_TUNING_LEN); -#else - mavlink_adap_tuning_t packet; - packet.desired = desired; - packet.achieved = achieved; - packet.error = error; - packet.theta = theta; - packet.omega = omega; - packet.sigma = sigma; - packet.theta_dot = theta_dot; - packet.omega_dot = omega_dot; - packet.sigma_dot = sigma_dot; - packet.f = f; - packet.f_dot = f_dot; - packet.u = u; - packet.axis = axis; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ADAP_TUNING_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_ADAP_TUNING; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ADAP_TUNING_MIN_LEN, MAVLINK_MSG_ID_ADAP_TUNING_LEN, MAVLINK_MSG_ID_ADAP_TUNING_CRC); -} - -/** - * @brief Pack a adap_tuning message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param axis Axis. - * @param desired [deg/s] Desired rate. - * @param achieved [deg/s] Achieved rate. - * @param error Error between model and vehicle. - * @param theta Theta estimated state predictor. - * @param omega Omega estimated state predictor. - * @param sigma Sigma estimated state predictor. - * @param theta_dot Theta derivative. - * @param omega_dot Omega derivative. - * @param sigma_dot Sigma derivative. - * @param f Projection operator value. - * @param f_dot Projection operator derivative. - * @param u u adaptive controlled output command. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_adap_tuning_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t axis,float desired,float achieved,float error,float theta,float omega,float sigma,float theta_dot,float omega_dot,float sigma_dot,float f,float f_dot,float u) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_ADAP_TUNING_LEN]; - _mav_put_float(buf, 0, desired); - _mav_put_float(buf, 4, achieved); - _mav_put_float(buf, 8, error); - _mav_put_float(buf, 12, theta); - _mav_put_float(buf, 16, omega); - _mav_put_float(buf, 20, sigma); - _mav_put_float(buf, 24, theta_dot); - _mav_put_float(buf, 28, omega_dot); - _mav_put_float(buf, 32, sigma_dot); - _mav_put_float(buf, 36, f); - _mav_put_float(buf, 40, f_dot); - _mav_put_float(buf, 44, u); - _mav_put_uint8_t(buf, 48, axis); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ADAP_TUNING_LEN); -#else - mavlink_adap_tuning_t packet; - packet.desired = desired; - packet.achieved = achieved; - packet.error = error; - packet.theta = theta; - packet.omega = omega; - packet.sigma = sigma; - packet.theta_dot = theta_dot; - packet.omega_dot = omega_dot; - packet.sigma_dot = sigma_dot; - packet.f = f; - packet.f_dot = f_dot; - packet.u = u; - packet.axis = axis; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ADAP_TUNING_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_ADAP_TUNING; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ADAP_TUNING_MIN_LEN, MAVLINK_MSG_ID_ADAP_TUNING_LEN, MAVLINK_MSG_ID_ADAP_TUNING_CRC); -} - -/** - * @brief Encode a adap_tuning struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param adap_tuning C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_adap_tuning_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_adap_tuning_t* adap_tuning) -{ - return mavlink_msg_adap_tuning_pack(system_id, component_id, msg, adap_tuning->axis, adap_tuning->desired, adap_tuning->achieved, adap_tuning->error, adap_tuning->theta, adap_tuning->omega, adap_tuning->sigma, adap_tuning->theta_dot, adap_tuning->omega_dot, adap_tuning->sigma_dot, adap_tuning->f, adap_tuning->f_dot, adap_tuning->u); -} - -/** - * @brief Encode a adap_tuning struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param adap_tuning C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_adap_tuning_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_adap_tuning_t* adap_tuning) -{ - return mavlink_msg_adap_tuning_pack_chan(system_id, component_id, chan, msg, adap_tuning->axis, adap_tuning->desired, adap_tuning->achieved, adap_tuning->error, adap_tuning->theta, adap_tuning->omega, adap_tuning->sigma, adap_tuning->theta_dot, adap_tuning->omega_dot, adap_tuning->sigma_dot, adap_tuning->f, adap_tuning->f_dot, adap_tuning->u); -} - -/** - * @brief Send a adap_tuning message - * @param chan MAVLink channel to send the message - * - * @param axis Axis. - * @param desired [deg/s] Desired rate. - * @param achieved [deg/s] Achieved rate. - * @param error Error between model and vehicle. - * @param theta Theta estimated state predictor. - * @param omega Omega estimated state predictor. - * @param sigma Sigma estimated state predictor. - * @param theta_dot Theta derivative. - * @param omega_dot Omega derivative. - * @param sigma_dot Sigma derivative. - * @param f Projection operator value. - * @param f_dot Projection operator derivative. - * @param u u adaptive controlled output command. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_adap_tuning_send(mavlink_channel_t chan, uint8_t axis, float desired, float achieved, float error, float theta, float omega, float sigma, float theta_dot, float omega_dot, float sigma_dot, float f, float f_dot, float u) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_ADAP_TUNING_LEN]; - _mav_put_float(buf, 0, desired); - _mav_put_float(buf, 4, achieved); - _mav_put_float(buf, 8, error); - _mav_put_float(buf, 12, theta); - _mav_put_float(buf, 16, omega); - _mav_put_float(buf, 20, sigma); - _mav_put_float(buf, 24, theta_dot); - _mav_put_float(buf, 28, omega_dot); - _mav_put_float(buf, 32, sigma_dot); - _mav_put_float(buf, 36, f); - _mav_put_float(buf, 40, f_dot); - _mav_put_float(buf, 44, u); - _mav_put_uint8_t(buf, 48, axis); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ADAP_TUNING, buf, MAVLINK_MSG_ID_ADAP_TUNING_MIN_LEN, MAVLINK_MSG_ID_ADAP_TUNING_LEN, MAVLINK_MSG_ID_ADAP_TUNING_CRC); -#else - mavlink_adap_tuning_t packet; - packet.desired = desired; - packet.achieved = achieved; - packet.error = error; - packet.theta = theta; - packet.omega = omega; - packet.sigma = sigma; - packet.theta_dot = theta_dot; - packet.omega_dot = omega_dot; - packet.sigma_dot = sigma_dot; - packet.f = f; - packet.f_dot = f_dot; - packet.u = u; - packet.axis = axis; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ADAP_TUNING, (const char *)&packet, MAVLINK_MSG_ID_ADAP_TUNING_MIN_LEN, MAVLINK_MSG_ID_ADAP_TUNING_LEN, MAVLINK_MSG_ID_ADAP_TUNING_CRC); -#endif -} - -/** - * @brief Send a adap_tuning message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_adap_tuning_send_struct(mavlink_channel_t chan, const mavlink_adap_tuning_t* adap_tuning) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_adap_tuning_send(chan, adap_tuning->axis, adap_tuning->desired, adap_tuning->achieved, adap_tuning->error, adap_tuning->theta, adap_tuning->omega, adap_tuning->sigma, adap_tuning->theta_dot, adap_tuning->omega_dot, adap_tuning->sigma_dot, adap_tuning->f, adap_tuning->f_dot, adap_tuning->u); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ADAP_TUNING, (const char *)adap_tuning, MAVLINK_MSG_ID_ADAP_TUNING_MIN_LEN, MAVLINK_MSG_ID_ADAP_TUNING_LEN, MAVLINK_MSG_ID_ADAP_TUNING_CRC); -#endif -} - -#if MAVLINK_MSG_ID_ADAP_TUNING_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_adap_tuning_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t axis, float desired, float achieved, float error, float theta, float omega, float sigma, float theta_dot, float omega_dot, float sigma_dot, float f, float f_dot, float u) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_float(buf, 0, desired); - _mav_put_float(buf, 4, achieved); - _mav_put_float(buf, 8, error); - _mav_put_float(buf, 12, theta); - _mav_put_float(buf, 16, omega); - _mav_put_float(buf, 20, sigma); - _mav_put_float(buf, 24, theta_dot); - _mav_put_float(buf, 28, omega_dot); - _mav_put_float(buf, 32, sigma_dot); - _mav_put_float(buf, 36, f); - _mav_put_float(buf, 40, f_dot); - _mav_put_float(buf, 44, u); - _mav_put_uint8_t(buf, 48, axis); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ADAP_TUNING, buf, MAVLINK_MSG_ID_ADAP_TUNING_MIN_LEN, MAVLINK_MSG_ID_ADAP_TUNING_LEN, MAVLINK_MSG_ID_ADAP_TUNING_CRC); -#else - mavlink_adap_tuning_t *packet = (mavlink_adap_tuning_t *)msgbuf; - packet->desired = desired; - packet->achieved = achieved; - packet->error = error; - packet->theta = theta; - packet->omega = omega; - packet->sigma = sigma; - packet->theta_dot = theta_dot; - packet->omega_dot = omega_dot; - packet->sigma_dot = sigma_dot; - packet->f = f; - packet->f_dot = f_dot; - packet->u = u; - packet->axis = axis; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ADAP_TUNING, (const char *)packet, MAVLINK_MSG_ID_ADAP_TUNING_MIN_LEN, MAVLINK_MSG_ID_ADAP_TUNING_LEN, MAVLINK_MSG_ID_ADAP_TUNING_CRC); -#endif -} -#endif - -#endif - -// MESSAGE ADAP_TUNING UNPACKING - - -/** - * @brief Get field axis from adap_tuning message - * - * @return Axis. - */ -static inline uint8_t mavlink_msg_adap_tuning_get_axis(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 48); -} - -/** - * @brief Get field desired from adap_tuning message - * - * @return [deg/s] Desired rate. - */ -static inline float mavlink_msg_adap_tuning_get_desired(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 0); -} - -/** - * @brief Get field achieved from adap_tuning message - * - * @return [deg/s] Achieved rate. - */ -static inline float mavlink_msg_adap_tuning_get_achieved(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 4); -} - -/** - * @brief Get field error from adap_tuning message - * - * @return Error between model and vehicle. - */ -static inline float mavlink_msg_adap_tuning_get_error(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field theta from adap_tuning message - * - * @return Theta estimated state predictor. - */ -static inline float mavlink_msg_adap_tuning_get_theta(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Get field omega from adap_tuning message - * - * @return Omega estimated state predictor. - */ -static inline float mavlink_msg_adap_tuning_get_omega(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 16); -} - -/** - * @brief Get field sigma from adap_tuning message - * - * @return Sigma estimated state predictor. - */ -static inline float mavlink_msg_adap_tuning_get_sigma(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 20); -} - -/** - * @brief Get field theta_dot from adap_tuning message - * - * @return Theta derivative. - */ -static inline float mavlink_msg_adap_tuning_get_theta_dot(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 24); -} - -/** - * @brief Get field omega_dot from adap_tuning message - * - * @return Omega derivative. - */ -static inline float mavlink_msg_adap_tuning_get_omega_dot(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 28); -} - -/** - * @brief Get field sigma_dot from adap_tuning message - * - * @return Sigma derivative. - */ -static inline float mavlink_msg_adap_tuning_get_sigma_dot(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 32); -} - -/** - * @brief Get field f from adap_tuning message - * - * @return Projection operator value. - */ -static inline float mavlink_msg_adap_tuning_get_f(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 36); -} - -/** - * @brief Get field f_dot from adap_tuning message - * - * @return Projection operator derivative. - */ -static inline float mavlink_msg_adap_tuning_get_f_dot(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 40); -} - -/** - * @brief Get field u from adap_tuning message - * - * @return u adaptive controlled output command. - */ -static inline float mavlink_msg_adap_tuning_get_u(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 44); -} - -/** - * @brief Decode a adap_tuning message into a struct - * - * @param msg The message to decode - * @param adap_tuning C-struct to decode the message contents into - */ -static inline void mavlink_msg_adap_tuning_decode(const mavlink_message_t* msg, mavlink_adap_tuning_t* adap_tuning) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - adap_tuning->desired = mavlink_msg_adap_tuning_get_desired(msg); - adap_tuning->achieved = mavlink_msg_adap_tuning_get_achieved(msg); - adap_tuning->error = mavlink_msg_adap_tuning_get_error(msg); - adap_tuning->theta = mavlink_msg_adap_tuning_get_theta(msg); - adap_tuning->omega = mavlink_msg_adap_tuning_get_omega(msg); - adap_tuning->sigma = mavlink_msg_adap_tuning_get_sigma(msg); - adap_tuning->theta_dot = mavlink_msg_adap_tuning_get_theta_dot(msg); - adap_tuning->omega_dot = mavlink_msg_adap_tuning_get_omega_dot(msg); - adap_tuning->sigma_dot = mavlink_msg_adap_tuning_get_sigma_dot(msg); - adap_tuning->f = mavlink_msg_adap_tuning_get_f(msg); - adap_tuning->f_dot = mavlink_msg_adap_tuning_get_f_dot(msg); - adap_tuning->u = mavlink_msg_adap_tuning_get_u(msg); - adap_tuning->axis = mavlink_msg_adap_tuning_get_axis(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_ADAP_TUNING_LEN? msg->len : MAVLINK_MSG_ID_ADAP_TUNING_LEN; - memset(adap_tuning, 0, MAVLINK_MSG_ID_ADAP_TUNING_LEN); - memcpy(adap_tuning, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_ahrs.h b/ardupilotmega/mavlink_msg_ahrs.h deleted file mode 100644 index c201a96e4..000000000 --- a/ardupilotmega/mavlink_msg_ahrs.h +++ /dev/null @@ -1,363 +0,0 @@ -#pragma once -// MESSAGE AHRS PACKING - -#define MAVLINK_MSG_ID_AHRS 163 - - -typedef struct __mavlink_ahrs_t { - float omegaIx; /*< [rad/s] X gyro drift estimate.*/ - float omegaIy; /*< [rad/s] Y gyro drift estimate.*/ - float omegaIz; /*< [rad/s] Z gyro drift estimate.*/ - float accel_weight; /*< Average accel_weight.*/ - float renorm_val; /*< Average renormalisation value.*/ - float error_rp; /*< Average error_roll_pitch value.*/ - float error_yaw; /*< Average error_yaw value.*/ -} mavlink_ahrs_t; - -#define MAVLINK_MSG_ID_AHRS_LEN 28 -#define MAVLINK_MSG_ID_AHRS_MIN_LEN 28 -#define MAVLINK_MSG_ID_163_LEN 28 -#define MAVLINK_MSG_ID_163_MIN_LEN 28 - -#define MAVLINK_MSG_ID_AHRS_CRC 127 -#define MAVLINK_MSG_ID_163_CRC 127 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_AHRS { \ - 163, \ - "AHRS", \ - 7, \ - { { "omegaIx", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_ahrs_t, omegaIx) }, \ - { "omegaIy", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_ahrs_t, omegaIy) }, \ - { "omegaIz", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_ahrs_t, omegaIz) }, \ - { "accel_weight", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_ahrs_t, accel_weight) }, \ - { "renorm_val", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_ahrs_t, renorm_val) }, \ - { "error_rp", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_ahrs_t, error_rp) }, \ - { "error_yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_ahrs_t, error_yaw) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_AHRS { \ - "AHRS", \ - 7, \ - { { "omegaIx", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_ahrs_t, omegaIx) }, \ - { "omegaIy", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_ahrs_t, omegaIy) }, \ - { "omegaIz", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_ahrs_t, omegaIz) }, \ - { "accel_weight", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_ahrs_t, accel_weight) }, \ - { "renorm_val", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_ahrs_t, renorm_val) }, \ - { "error_rp", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_ahrs_t, error_rp) }, \ - { "error_yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_ahrs_t, error_yaw) }, \ - } \ -} -#endif - -/** - * @brief Pack a ahrs message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param omegaIx [rad/s] X gyro drift estimate. - * @param omegaIy [rad/s] Y gyro drift estimate. - * @param omegaIz [rad/s] Z gyro drift estimate. - * @param accel_weight Average accel_weight. - * @param renorm_val Average renormalisation value. - * @param error_rp Average error_roll_pitch value. - * @param error_yaw Average error_yaw value. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_ahrs_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - float omegaIx, float omegaIy, float omegaIz, float accel_weight, float renorm_val, float error_rp, float error_yaw) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_AHRS_LEN]; - _mav_put_float(buf, 0, omegaIx); - _mav_put_float(buf, 4, omegaIy); - _mav_put_float(buf, 8, omegaIz); - _mav_put_float(buf, 12, accel_weight); - _mav_put_float(buf, 16, renorm_val); - _mav_put_float(buf, 20, error_rp); - _mav_put_float(buf, 24, error_yaw); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AHRS_LEN); -#else - mavlink_ahrs_t packet; - packet.omegaIx = omegaIx; - packet.omegaIy = omegaIy; - packet.omegaIz = omegaIz; - packet.accel_weight = accel_weight; - packet.renorm_val = renorm_val; - packet.error_rp = error_rp; - packet.error_yaw = error_yaw; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AHRS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_AHRS; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AHRS_MIN_LEN, MAVLINK_MSG_ID_AHRS_LEN, MAVLINK_MSG_ID_AHRS_CRC); -} - -/** - * @brief Pack a ahrs message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param omegaIx [rad/s] X gyro drift estimate. - * @param omegaIy [rad/s] Y gyro drift estimate. - * @param omegaIz [rad/s] Z gyro drift estimate. - * @param accel_weight Average accel_weight. - * @param renorm_val Average renormalisation value. - * @param error_rp Average error_roll_pitch value. - * @param error_yaw Average error_yaw value. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_ahrs_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - float omegaIx,float omegaIy,float omegaIz,float accel_weight,float renorm_val,float error_rp,float error_yaw) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_AHRS_LEN]; - _mav_put_float(buf, 0, omegaIx); - _mav_put_float(buf, 4, omegaIy); - _mav_put_float(buf, 8, omegaIz); - _mav_put_float(buf, 12, accel_weight); - _mav_put_float(buf, 16, renorm_val); - _mav_put_float(buf, 20, error_rp); - _mav_put_float(buf, 24, error_yaw); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AHRS_LEN); -#else - mavlink_ahrs_t packet; - packet.omegaIx = omegaIx; - packet.omegaIy = omegaIy; - packet.omegaIz = omegaIz; - packet.accel_weight = accel_weight; - packet.renorm_val = renorm_val; - packet.error_rp = error_rp; - packet.error_yaw = error_yaw; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AHRS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_AHRS; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AHRS_MIN_LEN, MAVLINK_MSG_ID_AHRS_LEN, MAVLINK_MSG_ID_AHRS_CRC); -} - -/** - * @brief Encode a ahrs struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param ahrs C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_ahrs_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_ahrs_t* ahrs) -{ - return mavlink_msg_ahrs_pack(system_id, component_id, msg, ahrs->omegaIx, ahrs->omegaIy, ahrs->omegaIz, ahrs->accel_weight, ahrs->renorm_val, ahrs->error_rp, ahrs->error_yaw); -} - -/** - * @brief Encode a ahrs struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param ahrs C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_ahrs_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_ahrs_t* ahrs) -{ - return mavlink_msg_ahrs_pack_chan(system_id, component_id, chan, msg, ahrs->omegaIx, ahrs->omegaIy, ahrs->omegaIz, ahrs->accel_weight, ahrs->renorm_val, ahrs->error_rp, ahrs->error_yaw); -} - -/** - * @brief Send a ahrs message - * @param chan MAVLink channel to send the message - * - * @param omegaIx [rad/s] X gyro drift estimate. - * @param omegaIy [rad/s] Y gyro drift estimate. - * @param omegaIz [rad/s] Z gyro drift estimate. - * @param accel_weight Average accel_weight. - * @param renorm_val Average renormalisation value. - * @param error_rp Average error_roll_pitch value. - * @param error_yaw Average error_yaw value. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_ahrs_send(mavlink_channel_t chan, float omegaIx, float omegaIy, float omegaIz, float accel_weight, float renorm_val, float error_rp, float error_yaw) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_AHRS_LEN]; - _mav_put_float(buf, 0, omegaIx); - _mav_put_float(buf, 4, omegaIy); - _mav_put_float(buf, 8, omegaIz); - _mav_put_float(buf, 12, accel_weight); - _mav_put_float(buf, 16, renorm_val); - _mav_put_float(buf, 20, error_rp); - _mav_put_float(buf, 24, error_yaw); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AHRS, buf, MAVLINK_MSG_ID_AHRS_MIN_LEN, MAVLINK_MSG_ID_AHRS_LEN, MAVLINK_MSG_ID_AHRS_CRC); -#else - mavlink_ahrs_t packet; - packet.omegaIx = omegaIx; - packet.omegaIy = omegaIy; - packet.omegaIz = omegaIz; - packet.accel_weight = accel_weight; - packet.renorm_val = renorm_val; - packet.error_rp = error_rp; - packet.error_yaw = error_yaw; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AHRS, (const char *)&packet, MAVLINK_MSG_ID_AHRS_MIN_LEN, MAVLINK_MSG_ID_AHRS_LEN, MAVLINK_MSG_ID_AHRS_CRC); -#endif -} - -/** - * @brief Send a ahrs message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_ahrs_send_struct(mavlink_channel_t chan, const mavlink_ahrs_t* ahrs) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_ahrs_send(chan, ahrs->omegaIx, ahrs->omegaIy, ahrs->omegaIz, ahrs->accel_weight, ahrs->renorm_val, ahrs->error_rp, ahrs->error_yaw); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AHRS, (const char *)ahrs, MAVLINK_MSG_ID_AHRS_MIN_LEN, MAVLINK_MSG_ID_AHRS_LEN, MAVLINK_MSG_ID_AHRS_CRC); -#endif -} - -#if MAVLINK_MSG_ID_AHRS_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_ahrs_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, float omegaIx, float omegaIy, float omegaIz, float accel_weight, float renorm_val, float error_rp, float error_yaw) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_float(buf, 0, omegaIx); - _mav_put_float(buf, 4, omegaIy); - _mav_put_float(buf, 8, omegaIz); - _mav_put_float(buf, 12, accel_weight); - _mav_put_float(buf, 16, renorm_val); - _mav_put_float(buf, 20, error_rp); - _mav_put_float(buf, 24, error_yaw); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AHRS, buf, MAVLINK_MSG_ID_AHRS_MIN_LEN, MAVLINK_MSG_ID_AHRS_LEN, MAVLINK_MSG_ID_AHRS_CRC); -#else - mavlink_ahrs_t *packet = (mavlink_ahrs_t *)msgbuf; - packet->omegaIx = omegaIx; - packet->omegaIy = omegaIy; - packet->omegaIz = omegaIz; - packet->accel_weight = accel_weight; - packet->renorm_val = renorm_val; - packet->error_rp = error_rp; - packet->error_yaw = error_yaw; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AHRS, (const char *)packet, MAVLINK_MSG_ID_AHRS_MIN_LEN, MAVLINK_MSG_ID_AHRS_LEN, MAVLINK_MSG_ID_AHRS_CRC); -#endif -} -#endif - -#endif - -// MESSAGE AHRS UNPACKING - - -/** - * @brief Get field omegaIx from ahrs message - * - * @return [rad/s] X gyro drift estimate. - */ -static inline float mavlink_msg_ahrs_get_omegaIx(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 0); -} - -/** - * @brief Get field omegaIy from ahrs message - * - * @return [rad/s] Y gyro drift estimate. - */ -static inline float mavlink_msg_ahrs_get_omegaIy(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 4); -} - -/** - * @brief Get field omegaIz from ahrs message - * - * @return [rad/s] Z gyro drift estimate. - */ -static inline float mavlink_msg_ahrs_get_omegaIz(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field accel_weight from ahrs message - * - * @return Average accel_weight. - */ -static inline float mavlink_msg_ahrs_get_accel_weight(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Get field renorm_val from ahrs message - * - * @return Average renormalisation value. - */ -static inline float mavlink_msg_ahrs_get_renorm_val(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 16); -} - -/** - * @brief Get field error_rp from ahrs message - * - * @return Average error_roll_pitch value. - */ -static inline float mavlink_msg_ahrs_get_error_rp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 20); -} - -/** - * @brief Get field error_yaw from ahrs message - * - * @return Average error_yaw value. - */ -static inline float mavlink_msg_ahrs_get_error_yaw(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 24); -} - -/** - * @brief Decode a ahrs message into a struct - * - * @param msg The message to decode - * @param ahrs C-struct to decode the message contents into - */ -static inline void mavlink_msg_ahrs_decode(const mavlink_message_t* msg, mavlink_ahrs_t* ahrs) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - ahrs->omegaIx = mavlink_msg_ahrs_get_omegaIx(msg); - ahrs->omegaIy = mavlink_msg_ahrs_get_omegaIy(msg); - ahrs->omegaIz = mavlink_msg_ahrs_get_omegaIz(msg); - ahrs->accel_weight = mavlink_msg_ahrs_get_accel_weight(msg); - ahrs->renorm_val = mavlink_msg_ahrs_get_renorm_val(msg); - ahrs->error_rp = mavlink_msg_ahrs_get_error_rp(msg); - ahrs->error_yaw = mavlink_msg_ahrs_get_error_yaw(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_AHRS_LEN? msg->len : MAVLINK_MSG_ID_AHRS_LEN; - memset(ahrs, 0, MAVLINK_MSG_ID_AHRS_LEN); - memcpy(ahrs, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_ahrs2.h b/ardupilotmega/mavlink_msg_ahrs2.h deleted file mode 100644 index 9713cf2a3..000000000 --- a/ardupilotmega/mavlink_msg_ahrs2.h +++ /dev/null @@ -1,338 +0,0 @@ -#pragma once -// MESSAGE AHRS2 PACKING - -#define MAVLINK_MSG_ID_AHRS2 178 - - -typedef struct __mavlink_ahrs2_t { - float roll; /*< [rad] Roll angle.*/ - float pitch; /*< [rad] Pitch angle.*/ - float yaw; /*< [rad] Yaw angle.*/ - float altitude; /*< [m] Altitude (MSL).*/ - int32_t lat; /*< [degE7] Latitude.*/ - int32_t lng; /*< [degE7] Longitude.*/ -} mavlink_ahrs2_t; - -#define MAVLINK_MSG_ID_AHRS2_LEN 24 -#define MAVLINK_MSG_ID_AHRS2_MIN_LEN 24 -#define MAVLINK_MSG_ID_178_LEN 24 -#define MAVLINK_MSG_ID_178_MIN_LEN 24 - -#define MAVLINK_MSG_ID_AHRS2_CRC 47 -#define MAVLINK_MSG_ID_178_CRC 47 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_AHRS2 { \ - 178, \ - "AHRS2", \ - 6, \ - { { "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_ahrs2_t, roll) }, \ - { "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_ahrs2_t, pitch) }, \ - { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_ahrs2_t, yaw) }, \ - { "altitude", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_ahrs2_t, altitude) }, \ - { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_ahrs2_t, lat) }, \ - { "lng", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_ahrs2_t, lng) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_AHRS2 { \ - "AHRS2", \ - 6, \ - { { "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_ahrs2_t, roll) }, \ - { "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_ahrs2_t, pitch) }, \ - { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_ahrs2_t, yaw) }, \ - { "altitude", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_ahrs2_t, altitude) }, \ - { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_ahrs2_t, lat) }, \ - { "lng", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_ahrs2_t, lng) }, \ - } \ -} -#endif - -/** - * @brief Pack a ahrs2 message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param roll [rad] Roll angle. - * @param pitch [rad] Pitch angle. - * @param yaw [rad] Yaw angle. - * @param altitude [m] Altitude (MSL). - * @param lat [degE7] Latitude. - * @param lng [degE7] Longitude. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_ahrs2_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - float roll, float pitch, float yaw, float altitude, int32_t lat, int32_t lng) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_AHRS2_LEN]; - _mav_put_float(buf, 0, roll); - _mav_put_float(buf, 4, pitch); - _mav_put_float(buf, 8, yaw); - _mav_put_float(buf, 12, altitude); - _mav_put_int32_t(buf, 16, lat); - _mav_put_int32_t(buf, 20, lng); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AHRS2_LEN); -#else - mavlink_ahrs2_t packet; - packet.roll = roll; - packet.pitch = pitch; - packet.yaw = yaw; - packet.altitude = altitude; - packet.lat = lat; - packet.lng = lng; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AHRS2_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_AHRS2; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AHRS2_MIN_LEN, MAVLINK_MSG_ID_AHRS2_LEN, MAVLINK_MSG_ID_AHRS2_CRC); -} - -/** - * @brief Pack a ahrs2 message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param roll [rad] Roll angle. - * @param pitch [rad] Pitch angle. - * @param yaw [rad] Yaw angle. - * @param altitude [m] Altitude (MSL). - * @param lat [degE7] Latitude. - * @param lng [degE7] Longitude. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_ahrs2_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - float roll,float pitch,float yaw,float altitude,int32_t lat,int32_t lng) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_AHRS2_LEN]; - _mav_put_float(buf, 0, roll); - _mav_put_float(buf, 4, pitch); - _mav_put_float(buf, 8, yaw); - _mav_put_float(buf, 12, altitude); - _mav_put_int32_t(buf, 16, lat); - _mav_put_int32_t(buf, 20, lng); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AHRS2_LEN); -#else - mavlink_ahrs2_t packet; - packet.roll = roll; - packet.pitch = pitch; - packet.yaw = yaw; - packet.altitude = altitude; - packet.lat = lat; - packet.lng = lng; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AHRS2_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_AHRS2; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AHRS2_MIN_LEN, MAVLINK_MSG_ID_AHRS2_LEN, MAVLINK_MSG_ID_AHRS2_CRC); -} - -/** - * @brief Encode a ahrs2 struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param ahrs2 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_ahrs2_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_ahrs2_t* ahrs2) -{ - return mavlink_msg_ahrs2_pack(system_id, component_id, msg, ahrs2->roll, ahrs2->pitch, ahrs2->yaw, ahrs2->altitude, ahrs2->lat, ahrs2->lng); -} - -/** - * @brief Encode a ahrs2 struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param ahrs2 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_ahrs2_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_ahrs2_t* ahrs2) -{ - return mavlink_msg_ahrs2_pack_chan(system_id, component_id, chan, msg, ahrs2->roll, ahrs2->pitch, ahrs2->yaw, ahrs2->altitude, ahrs2->lat, ahrs2->lng); -} - -/** - * @brief Send a ahrs2 message - * @param chan MAVLink channel to send the message - * - * @param roll [rad] Roll angle. - * @param pitch [rad] Pitch angle. - * @param yaw [rad] Yaw angle. - * @param altitude [m] Altitude (MSL). - * @param lat [degE7] Latitude. - * @param lng [degE7] Longitude. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_ahrs2_send(mavlink_channel_t chan, float roll, float pitch, float yaw, float altitude, int32_t lat, int32_t lng) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_AHRS2_LEN]; - _mav_put_float(buf, 0, roll); - _mav_put_float(buf, 4, pitch); - _mav_put_float(buf, 8, yaw); - _mav_put_float(buf, 12, altitude); - _mav_put_int32_t(buf, 16, lat); - _mav_put_int32_t(buf, 20, lng); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AHRS2, buf, MAVLINK_MSG_ID_AHRS2_MIN_LEN, MAVLINK_MSG_ID_AHRS2_LEN, MAVLINK_MSG_ID_AHRS2_CRC); -#else - mavlink_ahrs2_t packet; - packet.roll = roll; - packet.pitch = pitch; - packet.yaw = yaw; - packet.altitude = altitude; - packet.lat = lat; - packet.lng = lng; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AHRS2, (const char *)&packet, MAVLINK_MSG_ID_AHRS2_MIN_LEN, MAVLINK_MSG_ID_AHRS2_LEN, MAVLINK_MSG_ID_AHRS2_CRC); -#endif -} - -/** - * @brief Send a ahrs2 message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_ahrs2_send_struct(mavlink_channel_t chan, const mavlink_ahrs2_t* ahrs2) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_ahrs2_send(chan, ahrs2->roll, ahrs2->pitch, ahrs2->yaw, ahrs2->altitude, ahrs2->lat, ahrs2->lng); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AHRS2, (const char *)ahrs2, MAVLINK_MSG_ID_AHRS2_MIN_LEN, MAVLINK_MSG_ID_AHRS2_LEN, MAVLINK_MSG_ID_AHRS2_CRC); -#endif -} - -#if MAVLINK_MSG_ID_AHRS2_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_ahrs2_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, float roll, float pitch, float yaw, float altitude, int32_t lat, int32_t lng) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_float(buf, 0, roll); - _mav_put_float(buf, 4, pitch); - _mav_put_float(buf, 8, yaw); - _mav_put_float(buf, 12, altitude); - _mav_put_int32_t(buf, 16, lat); - _mav_put_int32_t(buf, 20, lng); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AHRS2, buf, MAVLINK_MSG_ID_AHRS2_MIN_LEN, MAVLINK_MSG_ID_AHRS2_LEN, MAVLINK_MSG_ID_AHRS2_CRC); -#else - mavlink_ahrs2_t *packet = (mavlink_ahrs2_t *)msgbuf; - packet->roll = roll; - packet->pitch = pitch; - packet->yaw = yaw; - packet->altitude = altitude; - packet->lat = lat; - packet->lng = lng; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AHRS2, (const char *)packet, MAVLINK_MSG_ID_AHRS2_MIN_LEN, MAVLINK_MSG_ID_AHRS2_LEN, MAVLINK_MSG_ID_AHRS2_CRC); -#endif -} -#endif - -#endif - -// MESSAGE AHRS2 UNPACKING - - -/** - * @brief Get field roll from ahrs2 message - * - * @return [rad] Roll angle. - */ -static inline float mavlink_msg_ahrs2_get_roll(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 0); -} - -/** - * @brief Get field pitch from ahrs2 message - * - * @return [rad] Pitch angle. - */ -static inline float mavlink_msg_ahrs2_get_pitch(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 4); -} - -/** - * @brief Get field yaw from ahrs2 message - * - * @return [rad] Yaw angle. - */ -static inline float mavlink_msg_ahrs2_get_yaw(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field altitude from ahrs2 message - * - * @return [m] Altitude (MSL). - */ -static inline float mavlink_msg_ahrs2_get_altitude(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Get field lat from ahrs2 message - * - * @return [degE7] Latitude. - */ -static inline int32_t mavlink_msg_ahrs2_get_lat(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 16); -} - -/** - * @brief Get field lng from ahrs2 message - * - * @return [degE7] Longitude. - */ -static inline int32_t mavlink_msg_ahrs2_get_lng(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 20); -} - -/** - * @brief Decode a ahrs2 message into a struct - * - * @param msg The message to decode - * @param ahrs2 C-struct to decode the message contents into - */ -static inline void mavlink_msg_ahrs2_decode(const mavlink_message_t* msg, mavlink_ahrs2_t* ahrs2) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - ahrs2->roll = mavlink_msg_ahrs2_get_roll(msg); - ahrs2->pitch = mavlink_msg_ahrs2_get_pitch(msg); - ahrs2->yaw = mavlink_msg_ahrs2_get_yaw(msg); - ahrs2->altitude = mavlink_msg_ahrs2_get_altitude(msg); - ahrs2->lat = mavlink_msg_ahrs2_get_lat(msg); - ahrs2->lng = mavlink_msg_ahrs2_get_lng(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_AHRS2_LEN? msg->len : MAVLINK_MSG_ID_AHRS2_LEN; - memset(ahrs2, 0, MAVLINK_MSG_ID_AHRS2_LEN); - memcpy(ahrs2, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_ahrs3.h b/ardupilotmega/mavlink_msg_ahrs3.h deleted file mode 100644 index 1b20d6606..000000000 --- a/ardupilotmega/mavlink_msg_ahrs3.h +++ /dev/null @@ -1,438 +0,0 @@ -#pragma once -// MESSAGE AHRS3 PACKING - -#define MAVLINK_MSG_ID_AHRS3 182 - - -typedef struct __mavlink_ahrs3_t { - float roll; /*< [rad] Roll angle.*/ - float pitch; /*< [rad] Pitch angle.*/ - float yaw; /*< [rad] Yaw angle.*/ - float altitude; /*< [m] Altitude (MSL).*/ - int32_t lat; /*< [degE7] Latitude.*/ - int32_t lng; /*< [degE7] Longitude.*/ - float v1; /*< Test variable1.*/ - float v2; /*< Test variable2.*/ - float v3; /*< Test variable3.*/ - float v4; /*< Test variable4.*/ -} mavlink_ahrs3_t; - -#define MAVLINK_MSG_ID_AHRS3_LEN 40 -#define MAVLINK_MSG_ID_AHRS3_MIN_LEN 40 -#define MAVLINK_MSG_ID_182_LEN 40 -#define MAVLINK_MSG_ID_182_MIN_LEN 40 - -#define MAVLINK_MSG_ID_AHRS3_CRC 229 -#define MAVLINK_MSG_ID_182_CRC 229 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_AHRS3 { \ - 182, \ - "AHRS3", \ - 10, \ - { { "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_ahrs3_t, roll) }, \ - { "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_ahrs3_t, pitch) }, \ - { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_ahrs3_t, yaw) }, \ - { "altitude", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_ahrs3_t, altitude) }, \ - { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_ahrs3_t, lat) }, \ - { "lng", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_ahrs3_t, lng) }, \ - { "v1", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_ahrs3_t, v1) }, \ - { "v2", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_ahrs3_t, v2) }, \ - { "v3", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_ahrs3_t, v3) }, \ - { "v4", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_ahrs3_t, v4) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_AHRS3 { \ - "AHRS3", \ - 10, \ - { { "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_ahrs3_t, roll) }, \ - { "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_ahrs3_t, pitch) }, \ - { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_ahrs3_t, yaw) }, \ - { "altitude", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_ahrs3_t, altitude) }, \ - { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_ahrs3_t, lat) }, \ - { "lng", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_ahrs3_t, lng) }, \ - { "v1", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_ahrs3_t, v1) }, \ - { "v2", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_ahrs3_t, v2) }, \ - { "v3", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_ahrs3_t, v3) }, \ - { "v4", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_ahrs3_t, v4) }, \ - } \ -} -#endif - -/** - * @brief Pack a ahrs3 message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param roll [rad] Roll angle. - * @param pitch [rad] Pitch angle. - * @param yaw [rad] Yaw angle. - * @param altitude [m] Altitude (MSL). - * @param lat [degE7] Latitude. - * @param lng [degE7] Longitude. - * @param v1 Test variable1. - * @param v2 Test variable2. - * @param v3 Test variable3. - * @param v4 Test variable4. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_ahrs3_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - float roll, float pitch, float yaw, float altitude, int32_t lat, int32_t lng, float v1, float v2, float v3, float v4) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_AHRS3_LEN]; - _mav_put_float(buf, 0, roll); - _mav_put_float(buf, 4, pitch); - _mav_put_float(buf, 8, yaw); - _mav_put_float(buf, 12, altitude); - _mav_put_int32_t(buf, 16, lat); - _mav_put_int32_t(buf, 20, lng); - _mav_put_float(buf, 24, v1); - _mav_put_float(buf, 28, v2); - _mav_put_float(buf, 32, v3); - _mav_put_float(buf, 36, v4); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AHRS3_LEN); -#else - mavlink_ahrs3_t packet; - packet.roll = roll; - packet.pitch = pitch; - packet.yaw = yaw; - packet.altitude = altitude; - packet.lat = lat; - packet.lng = lng; - packet.v1 = v1; - packet.v2 = v2; - packet.v3 = v3; - packet.v4 = v4; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AHRS3_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_AHRS3; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AHRS3_MIN_LEN, MAVLINK_MSG_ID_AHRS3_LEN, MAVLINK_MSG_ID_AHRS3_CRC); -} - -/** - * @brief Pack a ahrs3 message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param roll [rad] Roll angle. - * @param pitch [rad] Pitch angle. - * @param yaw [rad] Yaw angle. - * @param altitude [m] Altitude (MSL). - * @param lat [degE7] Latitude. - * @param lng [degE7] Longitude. - * @param v1 Test variable1. - * @param v2 Test variable2. - * @param v3 Test variable3. - * @param v4 Test variable4. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_ahrs3_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - float roll,float pitch,float yaw,float altitude,int32_t lat,int32_t lng,float v1,float v2,float v3,float v4) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_AHRS3_LEN]; - _mav_put_float(buf, 0, roll); - _mav_put_float(buf, 4, pitch); - _mav_put_float(buf, 8, yaw); - _mav_put_float(buf, 12, altitude); - _mav_put_int32_t(buf, 16, lat); - _mav_put_int32_t(buf, 20, lng); - _mav_put_float(buf, 24, v1); - _mav_put_float(buf, 28, v2); - _mav_put_float(buf, 32, v3); - _mav_put_float(buf, 36, v4); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AHRS3_LEN); -#else - mavlink_ahrs3_t packet; - packet.roll = roll; - packet.pitch = pitch; - packet.yaw = yaw; - packet.altitude = altitude; - packet.lat = lat; - packet.lng = lng; - packet.v1 = v1; - packet.v2 = v2; - packet.v3 = v3; - packet.v4 = v4; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AHRS3_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_AHRS3; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AHRS3_MIN_LEN, MAVLINK_MSG_ID_AHRS3_LEN, MAVLINK_MSG_ID_AHRS3_CRC); -} - -/** - * @brief Encode a ahrs3 struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param ahrs3 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_ahrs3_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_ahrs3_t* ahrs3) -{ - return mavlink_msg_ahrs3_pack(system_id, component_id, msg, ahrs3->roll, ahrs3->pitch, ahrs3->yaw, ahrs3->altitude, ahrs3->lat, ahrs3->lng, ahrs3->v1, ahrs3->v2, ahrs3->v3, ahrs3->v4); -} - -/** - * @brief Encode a ahrs3 struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param ahrs3 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_ahrs3_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_ahrs3_t* ahrs3) -{ - return mavlink_msg_ahrs3_pack_chan(system_id, component_id, chan, msg, ahrs3->roll, ahrs3->pitch, ahrs3->yaw, ahrs3->altitude, ahrs3->lat, ahrs3->lng, ahrs3->v1, ahrs3->v2, ahrs3->v3, ahrs3->v4); -} - -/** - * @brief Send a ahrs3 message - * @param chan MAVLink channel to send the message - * - * @param roll [rad] Roll angle. - * @param pitch [rad] Pitch angle. - * @param yaw [rad] Yaw angle. - * @param altitude [m] Altitude (MSL). - * @param lat [degE7] Latitude. - * @param lng [degE7] Longitude. - * @param v1 Test variable1. - * @param v2 Test variable2. - * @param v3 Test variable3. - * @param v4 Test variable4. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_ahrs3_send(mavlink_channel_t chan, float roll, float pitch, float yaw, float altitude, int32_t lat, int32_t lng, float v1, float v2, float v3, float v4) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_AHRS3_LEN]; - _mav_put_float(buf, 0, roll); - _mav_put_float(buf, 4, pitch); - _mav_put_float(buf, 8, yaw); - _mav_put_float(buf, 12, altitude); - _mav_put_int32_t(buf, 16, lat); - _mav_put_int32_t(buf, 20, lng); - _mav_put_float(buf, 24, v1); - _mav_put_float(buf, 28, v2); - _mav_put_float(buf, 32, v3); - _mav_put_float(buf, 36, v4); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AHRS3, buf, MAVLINK_MSG_ID_AHRS3_MIN_LEN, MAVLINK_MSG_ID_AHRS3_LEN, MAVLINK_MSG_ID_AHRS3_CRC); -#else - mavlink_ahrs3_t packet; - packet.roll = roll; - packet.pitch = pitch; - packet.yaw = yaw; - packet.altitude = altitude; - packet.lat = lat; - packet.lng = lng; - packet.v1 = v1; - packet.v2 = v2; - packet.v3 = v3; - packet.v4 = v4; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AHRS3, (const char *)&packet, MAVLINK_MSG_ID_AHRS3_MIN_LEN, MAVLINK_MSG_ID_AHRS3_LEN, MAVLINK_MSG_ID_AHRS3_CRC); -#endif -} - -/** - * @brief Send a ahrs3 message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_ahrs3_send_struct(mavlink_channel_t chan, const mavlink_ahrs3_t* ahrs3) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_ahrs3_send(chan, ahrs3->roll, ahrs3->pitch, ahrs3->yaw, ahrs3->altitude, ahrs3->lat, ahrs3->lng, ahrs3->v1, ahrs3->v2, ahrs3->v3, ahrs3->v4); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AHRS3, (const char *)ahrs3, MAVLINK_MSG_ID_AHRS3_MIN_LEN, MAVLINK_MSG_ID_AHRS3_LEN, MAVLINK_MSG_ID_AHRS3_CRC); -#endif -} - -#if MAVLINK_MSG_ID_AHRS3_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_ahrs3_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, float roll, float pitch, float yaw, float altitude, int32_t lat, int32_t lng, float v1, float v2, float v3, float v4) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_float(buf, 0, roll); - _mav_put_float(buf, 4, pitch); - _mav_put_float(buf, 8, yaw); - _mav_put_float(buf, 12, altitude); - _mav_put_int32_t(buf, 16, lat); - _mav_put_int32_t(buf, 20, lng); - _mav_put_float(buf, 24, v1); - _mav_put_float(buf, 28, v2); - _mav_put_float(buf, 32, v3); - _mav_put_float(buf, 36, v4); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AHRS3, buf, MAVLINK_MSG_ID_AHRS3_MIN_LEN, MAVLINK_MSG_ID_AHRS3_LEN, MAVLINK_MSG_ID_AHRS3_CRC); -#else - mavlink_ahrs3_t *packet = (mavlink_ahrs3_t *)msgbuf; - packet->roll = roll; - packet->pitch = pitch; - packet->yaw = yaw; - packet->altitude = altitude; - packet->lat = lat; - packet->lng = lng; - packet->v1 = v1; - packet->v2 = v2; - packet->v3 = v3; - packet->v4 = v4; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AHRS3, (const char *)packet, MAVLINK_MSG_ID_AHRS3_MIN_LEN, MAVLINK_MSG_ID_AHRS3_LEN, MAVLINK_MSG_ID_AHRS3_CRC); -#endif -} -#endif - -#endif - -// MESSAGE AHRS3 UNPACKING - - -/** - * @brief Get field roll from ahrs3 message - * - * @return [rad] Roll angle. - */ -static inline float mavlink_msg_ahrs3_get_roll(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 0); -} - -/** - * @brief Get field pitch from ahrs3 message - * - * @return [rad] Pitch angle. - */ -static inline float mavlink_msg_ahrs3_get_pitch(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 4); -} - -/** - * @brief Get field yaw from ahrs3 message - * - * @return [rad] Yaw angle. - */ -static inline float mavlink_msg_ahrs3_get_yaw(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field altitude from ahrs3 message - * - * @return [m] Altitude (MSL). - */ -static inline float mavlink_msg_ahrs3_get_altitude(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Get field lat from ahrs3 message - * - * @return [degE7] Latitude. - */ -static inline int32_t mavlink_msg_ahrs3_get_lat(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 16); -} - -/** - * @brief Get field lng from ahrs3 message - * - * @return [degE7] Longitude. - */ -static inline int32_t mavlink_msg_ahrs3_get_lng(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 20); -} - -/** - * @brief Get field v1 from ahrs3 message - * - * @return Test variable1. - */ -static inline float mavlink_msg_ahrs3_get_v1(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 24); -} - -/** - * @brief Get field v2 from ahrs3 message - * - * @return Test variable2. - */ -static inline float mavlink_msg_ahrs3_get_v2(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 28); -} - -/** - * @brief Get field v3 from ahrs3 message - * - * @return Test variable3. - */ -static inline float mavlink_msg_ahrs3_get_v3(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 32); -} - -/** - * @brief Get field v4 from ahrs3 message - * - * @return Test variable4. - */ -static inline float mavlink_msg_ahrs3_get_v4(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 36); -} - -/** - * @brief Decode a ahrs3 message into a struct - * - * @param msg The message to decode - * @param ahrs3 C-struct to decode the message contents into - */ -static inline void mavlink_msg_ahrs3_decode(const mavlink_message_t* msg, mavlink_ahrs3_t* ahrs3) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - ahrs3->roll = mavlink_msg_ahrs3_get_roll(msg); - ahrs3->pitch = mavlink_msg_ahrs3_get_pitch(msg); - ahrs3->yaw = mavlink_msg_ahrs3_get_yaw(msg); - ahrs3->altitude = mavlink_msg_ahrs3_get_altitude(msg); - ahrs3->lat = mavlink_msg_ahrs3_get_lat(msg); - ahrs3->lng = mavlink_msg_ahrs3_get_lng(msg); - ahrs3->v1 = mavlink_msg_ahrs3_get_v1(msg); - ahrs3->v2 = mavlink_msg_ahrs3_get_v2(msg); - ahrs3->v3 = mavlink_msg_ahrs3_get_v3(msg); - ahrs3->v4 = mavlink_msg_ahrs3_get_v4(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_AHRS3_LEN? msg->len : MAVLINK_MSG_ID_AHRS3_LEN; - memset(ahrs3, 0, MAVLINK_MSG_ID_AHRS3_LEN); - memcpy(ahrs3, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_airspeed_autocal.h b/ardupilotmega/mavlink_msg_airspeed_autocal.h deleted file mode 100644 index 952e07372..000000000 --- a/ardupilotmega/mavlink_msg_airspeed_autocal.h +++ /dev/null @@ -1,488 +0,0 @@ -#pragma once -// MESSAGE AIRSPEED_AUTOCAL PACKING - -#define MAVLINK_MSG_ID_AIRSPEED_AUTOCAL 174 - - -typedef struct __mavlink_airspeed_autocal_t { - float vx; /*< [m/s] GPS velocity north.*/ - float vy; /*< [m/s] GPS velocity east.*/ - float vz; /*< [m/s] GPS velocity down.*/ - float diff_pressure; /*< [Pa] Differential pressure.*/ - float EAS2TAS; /*< Estimated to true airspeed ratio.*/ - float ratio; /*< Airspeed ratio.*/ - float state_x; /*< EKF state x.*/ - float state_y; /*< EKF state y.*/ - float state_z; /*< EKF state z.*/ - float Pax; /*< EKF Pax.*/ - float Pby; /*< EKF Pby.*/ - float Pcz; /*< EKF Pcz.*/ -} mavlink_airspeed_autocal_t; - -#define MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_LEN 48 -#define MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_MIN_LEN 48 -#define MAVLINK_MSG_ID_174_LEN 48 -#define MAVLINK_MSG_ID_174_MIN_LEN 48 - -#define MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_CRC 167 -#define MAVLINK_MSG_ID_174_CRC 167 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_AIRSPEED_AUTOCAL { \ - 174, \ - "AIRSPEED_AUTOCAL", \ - 12, \ - { { "vx", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_airspeed_autocal_t, vx) }, \ - { "vy", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_airspeed_autocal_t, vy) }, \ - { "vz", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_airspeed_autocal_t, vz) }, \ - { "diff_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_airspeed_autocal_t, diff_pressure) }, \ - { "EAS2TAS", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_airspeed_autocal_t, EAS2TAS) }, \ - { "ratio", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_airspeed_autocal_t, ratio) }, \ - { "state_x", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_airspeed_autocal_t, state_x) }, \ - { "state_y", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_airspeed_autocal_t, state_y) }, \ - { "state_z", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_airspeed_autocal_t, state_z) }, \ - { "Pax", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_airspeed_autocal_t, Pax) }, \ - { "Pby", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_airspeed_autocal_t, Pby) }, \ - { "Pcz", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_airspeed_autocal_t, Pcz) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_AIRSPEED_AUTOCAL { \ - "AIRSPEED_AUTOCAL", \ - 12, \ - { { "vx", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_airspeed_autocal_t, vx) }, \ - { "vy", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_airspeed_autocal_t, vy) }, \ - { "vz", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_airspeed_autocal_t, vz) }, \ - { "diff_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_airspeed_autocal_t, diff_pressure) }, \ - { "EAS2TAS", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_airspeed_autocal_t, EAS2TAS) }, \ - { "ratio", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_airspeed_autocal_t, ratio) }, \ - { "state_x", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_airspeed_autocal_t, state_x) }, \ - { "state_y", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_airspeed_autocal_t, state_y) }, \ - { "state_z", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_airspeed_autocal_t, state_z) }, \ - { "Pax", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_airspeed_autocal_t, Pax) }, \ - { "Pby", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_airspeed_autocal_t, Pby) }, \ - { "Pcz", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_airspeed_autocal_t, Pcz) }, \ - } \ -} -#endif - -/** - * @brief Pack a airspeed_autocal message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param vx [m/s] GPS velocity north. - * @param vy [m/s] GPS velocity east. - * @param vz [m/s] GPS velocity down. - * @param diff_pressure [Pa] Differential pressure. - * @param EAS2TAS Estimated to true airspeed ratio. - * @param ratio Airspeed ratio. - * @param state_x EKF state x. - * @param state_y EKF state y. - * @param state_z EKF state z. - * @param Pax EKF Pax. - * @param Pby EKF Pby. - * @param Pcz EKF Pcz. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_airspeed_autocal_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - float vx, float vy, float vz, float diff_pressure, float EAS2TAS, float ratio, float state_x, float state_y, float state_z, float Pax, float Pby, float Pcz) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_LEN]; - _mav_put_float(buf, 0, vx); - _mav_put_float(buf, 4, vy); - _mav_put_float(buf, 8, vz); - _mav_put_float(buf, 12, diff_pressure); - _mav_put_float(buf, 16, EAS2TAS); - _mav_put_float(buf, 20, ratio); - _mav_put_float(buf, 24, state_x); - _mav_put_float(buf, 28, state_y); - _mav_put_float(buf, 32, state_z); - _mav_put_float(buf, 36, Pax); - _mav_put_float(buf, 40, Pby); - _mav_put_float(buf, 44, Pcz); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_LEN); -#else - mavlink_airspeed_autocal_t packet; - packet.vx = vx; - packet.vy = vy; - packet.vz = vz; - packet.diff_pressure = diff_pressure; - packet.EAS2TAS = EAS2TAS; - packet.ratio = ratio; - packet.state_x = state_x; - packet.state_y = state_y; - packet.state_z = state_z; - packet.Pax = Pax; - packet.Pby = Pby; - packet.Pcz = Pcz; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_AIRSPEED_AUTOCAL; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_MIN_LEN, MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_LEN, MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_CRC); -} - -/** - * @brief Pack a airspeed_autocal message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param vx [m/s] GPS velocity north. - * @param vy [m/s] GPS velocity east. - * @param vz [m/s] GPS velocity down. - * @param diff_pressure [Pa] Differential pressure. - * @param EAS2TAS Estimated to true airspeed ratio. - * @param ratio Airspeed ratio. - * @param state_x EKF state x. - * @param state_y EKF state y. - * @param state_z EKF state z. - * @param Pax EKF Pax. - * @param Pby EKF Pby. - * @param Pcz EKF Pcz. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_airspeed_autocal_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - float vx,float vy,float vz,float diff_pressure,float EAS2TAS,float ratio,float state_x,float state_y,float state_z,float Pax,float Pby,float Pcz) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_LEN]; - _mav_put_float(buf, 0, vx); - _mav_put_float(buf, 4, vy); - _mav_put_float(buf, 8, vz); - _mav_put_float(buf, 12, diff_pressure); - _mav_put_float(buf, 16, EAS2TAS); - _mav_put_float(buf, 20, ratio); - _mav_put_float(buf, 24, state_x); - _mav_put_float(buf, 28, state_y); - _mav_put_float(buf, 32, state_z); - _mav_put_float(buf, 36, Pax); - _mav_put_float(buf, 40, Pby); - _mav_put_float(buf, 44, Pcz); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_LEN); -#else - mavlink_airspeed_autocal_t packet; - packet.vx = vx; - packet.vy = vy; - packet.vz = vz; - packet.diff_pressure = diff_pressure; - packet.EAS2TAS = EAS2TAS; - packet.ratio = ratio; - packet.state_x = state_x; - packet.state_y = state_y; - packet.state_z = state_z; - packet.Pax = Pax; - packet.Pby = Pby; - packet.Pcz = Pcz; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_AIRSPEED_AUTOCAL; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_MIN_LEN, MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_LEN, MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_CRC); -} - -/** - * @brief Encode a airspeed_autocal struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param airspeed_autocal C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_airspeed_autocal_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_airspeed_autocal_t* airspeed_autocal) -{ - return mavlink_msg_airspeed_autocal_pack(system_id, component_id, msg, airspeed_autocal->vx, airspeed_autocal->vy, airspeed_autocal->vz, airspeed_autocal->diff_pressure, airspeed_autocal->EAS2TAS, airspeed_autocal->ratio, airspeed_autocal->state_x, airspeed_autocal->state_y, airspeed_autocal->state_z, airspeed_autocal->Pax, airspeed_autocal->Pby, airspeed_autocal->Pcz); -} - -/** - * @brief Encode a airspeed_autocal struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param airspeed_autocal C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_airspeed_autocal_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_airspeed_autocal_t* airspeed_autocal) -{ - return mavlink_msg_airspeed_autocal_pack_chan(system_id, component_id, chan, msg, airspeed_autocal->vx, airspeed_autocal->vy, airspeed_autocal->vz, airspeed_autocal->diff_pressure, airspeed_autocal->EAS2TAS, airspeed_autocal->ratio, airspeed_autocal->state_x, airspeed_autocal->state_y, airspeed_autocal->state_z, airspeed_autocal->Pax, airspeed_autocal->Pby, airspeed_autocal->Pcz); -} - -/** - * @brief Send a airspeed_autocal message - * @param chan MAVLink channel to send the message - * - * @param vx [m/s] GPS velocity north. - * @param vy [m/s] GPS velocity east. - * @param vz [m/s] GPS velocity down. - * @param diff_pressure [Pa] Differential pressure. - * @param EAS2TAS Estimated to true airspeed ratio. - * @param ratio Airspeed ratio. - * @param state_x EKF state x. - * @param state_y EKF state y. - * @param state_z EKF state z. - * @param Pax EKF Pax. - * @param Pby EKF Pby. - * @param Pcz EKF Pcz. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_airspeed_autocal_send(mavlink_channel_t chan, float vx, float vy, float vz, float diff_pressure, float EAS2TAS, float ratio, float state_x, float state_y, float state_z, float Pax, float Pby, float Pcz) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_LEN]; - _mav_put_float(buf, 0, vx); - _mav_put_float(buf, 4, vy); - _mav_put_float(buf, 8, vz); - _mav_put_float(buf, 12, diff_pressure); - _mav_put_float(buf, 16, EAS2TAS); - _mav_put_float(buf, 20, ratio); - _mav_put_float(buf, 24, state_x); - _mav_put_float(buf, 28, state_y); - _mav_put_float(buf, 32, state_z); - _mav_put_float(buf, 36, Pax); - _mav_put_float(buf, 40, Pby); - _mav_put_float(buf, 44, Pcz); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIRSPEED_AUTOCAL, buf, MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_MIN_LEN, MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_LEN, MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_CRC); -#else - mavlink_airspeed_autocal_t packet; - packet.vx = vx; - packet.vy = vy; - packet.vz = vz; - packet.diff_pressure = diff_pressure; - packet.EAS2TAS = EAS2TAS; - packet.ratio = ratio; - packet.state_x = state_x; - packet.state_y = state_y; - packet.state_z = state_z; - packet.Pax = Pax; - packet.Pby = Pby; - packet.Pcz = Pcz; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIRSPEED_AUTOCAL, (const char *)&packet, MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_MIN_LEN, MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_LEN, MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_CRC); -#endif -} - -/** - * @brief Send a airspeed_autocal message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_airspeed_autocal_send_struct(mavlink_channel_t chan, const mavlink_airspeed_autocal_t* airspeed_autocal) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_airspeed_autocal_send(chan, airspeed_autocal->vx, airspeed_autocal->vy, airspeed_autocal->vz, airspeed_autocal->diff_pressure, airspeed_autocal->EAS2TAS, airspeed_autocal->ratio, airspeed_autocal->state_x, airspeed_autocal->state_y, airspeed_autocal->state_z, airspeed_autocal->Pax, airspeed_autocal->Pby, airspeed_autocal->Pcz); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIRSPEED_AUTOCAL, (const char *)airspeed_autocal, MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_MIN_LEN, MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_LEN, MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_CRC); -#endif -} - -#if MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_airspeed_autocal_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, float vx, float vy, float vz, float diff_pressure, float EAS2TAS, float ratio, float state_x, float state_y, float state_z, float Pax, float Pby, float Pcz) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_float(buf, 0, vx); - _mav_put_float(buf, 4, vy); - _mav_put_float(buf, 8, vz); - _mav_put_float(buf, 12, diff_pressure); - _mav_put_float(buf, 16, EAS2TAS); - _mav_put_float(buf, 20, ratio); - _mav_put_float(buf, 24, state_x); - _mav_put_float(buf, 28, state_y); - _mav_put_float(buf, 32, state_z); - _mav_put_float(buf, 36, Pax); - _mav_put_float(buf, 40, Pby); - _mav_put_float(buf, 44, Pcz); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIRSPEED_AUTOCAL, buf, MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_MIN_LEN, MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_LEN, MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_CRC); -#else - mavlink_airspeed_autocal_t *packet = (mavlink_airspeed_autocal_t *)msgbuf; - packet->vx = vx; - packet->vy = vy; - packet->vz = vz; - packet->diff_pressure = diff_pressure; - packet->EAS2TAS = EAS2TAS; - packet->ratio = ratio; - packet->state_x = state_x; - packet->state_y = state_y; - packet->state_z = state_z; - packet->Pax = Pax; - packet->Pby = Pby; - packet->Pcz = Pcz; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIRSPEED_AUTOCAL, (const char *)packet, MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_MIN_LEN, MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_LEN, MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_CRC); -#endif -} -#endif - -#endif - -// MESSAGE AIRSPEED_AUTOCAL UNPACKING - - -/** - * @brief Get field vx from airspeed_autocal message - * - * @return [m/s] GPS velocity north. - */ -static inline float mavlink_msg_airspeed_autocal_get_vx(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 0); -} - -/** - * @brief Get field vy from airspeed_autocal message - * - * @return [m/s] GPS velocity east. - */ -static inline float mavlink_msg_airspeed_autocal_get_vy(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 4); -} - -/** - * @brief Get field vz from airspeed_autocal message - * - * @return [m/s] GPS velocity down. - */ -static inline float mavlink_msg_airspeed_autocal_get_vz(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field diff_pressure from airspeed_autocal message - * - * @return [Pa] Differential pressure. - */ -static inline float mavlink_msg_airspeed_autocal_get_diff_pressure(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Get field EAS2TAS from airspeed_autocal message - * - * @return Estimated to true airspeed ratio. - */ -static inline float mavlink_msg_airspeed_autocal_get_EAS2TAS(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 16); -} - -/** - * @brief Get field ratio from airspeed_autocal message - * - * @return Airspeed ratio. - */ -static inline float mavlink_msg_airspeed_autocal_get_ratio(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 20); -} - -/** - * @brief Get field state_x from airspeed_autocal message - * - * @return EKF state x. - */ -static inline float mavlink_msg_airspeed_autocal_get_state_x(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 24); -} - -/** - * @brief Get field state_y from airspeed_autocal message - * - * @return EKF state y. - */ -static inline float mavlink_msg_airspeed_autocal_get_state_y(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 28); -} - -/** - * @brief Get field state_z from airspeed_autocal message - * - * @return EKF state z. - */ -static inline float mavlink_msg_airspeed_autocal_get_state_z(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 32); -} - -/** - * @brief Get field Pax from airspeed_autocal message - * - * @return EKF Pax. - */ -static inline float mavlink_msg_airspeed_autocal_get_Pax(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 36); -} - -/** - * @brief Get field Pby from airspeed_autocal message - * - * @return EKF Pby. - */ -static inline float mavlink_msg_airspeed_autocal_get_Pby(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 40); -} - -/** - * @brief Get field Pcz from airspeed_autocal message - * - * @return EKF Pcz. - */ -static inline float mavlink_msg_airspeed_autocal_get_Pcz(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 44); -} - -/** - * @brief Decode a airspeed_autocal message into a struct - * - * @param msg The message to decode - * @param airspeed_autocal C-struct to decode the message contents into - */ -static inline void mavlink_msg_airspeed_autocal_decode(const mavlink_message_t* msg, mavlink_airspeed_autocal_t* airspeed_autocal) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - airspeed_autocal->vx = mavlink_msg_airspeed_autocal_get_vx(msg); - airspeed_autocal->vy = mavlink_msg_airspeed_autocal_get_vy(msg); - airspeed_autocal->vz = mavlink_msg_airspeed_autocal_get_vz(msg); - airspeed_autocal->diff_pressure = mavlink_msg_airspeed_autocal_get_diff_pressure(msg); - airspeed_autocal->EAS2TAS = mavlink_msg_airspeed_autocal_get_EAS2TAS(msg); - airspeed_autocal->ratio = mavlink_msg_airspeed_autocal_get_ratio(msg); - airspeed_autocal->state_x = mavlink_msg_airspeed_autocal_get_state_x(msg); - airspeed_autocal->state_y = mavlink_msg_airspeed_autocal_get_state_y(msg); - airspeed_autocal->state_z = mavlink_msg_airspeed_autocal_get_state_z(msg); - airspeed_autocal->Pax = mavlink_msg_airspeed_autocal_get_Pax(msg); - airspeed_autocal->Pby = mavlink_msg_airspeed_autocal_get_Pby(msg); - airspeed_autocal->Pcz = mavlink_msg_airspeed_autocal_get_Pcz(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_LEN? msg->len : MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_LEN; - memset(airspeed_autocal, 0, MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_LEN); - memcpy(airspeed_autocal, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_aoa_ssa.h b/ardupilotmega/mavlink_msg_aoa_ssa.h deleted file mode 100644 index 74a175908..000000000 --- a/ardupilotmega/mavlink_msg_aoa_ssa.h +++ /dev/null @@ -1,263 +0,0 @@ -#pragma once -// MESSAGE AOA_SSA PACKING - -#define MAVLINK_MSG_ID_AOA_SSA 11020 - - -typedef struct __mavlink_aoa_ssa_t { - uint64_t time_usec; /*< [us] Timestamp (since boot or Unix epoch).*/ - float AOA; /*< [deg] Angle of Attack.*/ - float SSA; /*< [deg] Side Slip Angle.*/ -} mavlink_aoa_ssa_t; - -#define MAVLINK_MSG_ID_AOA_SSA_LEN 16 -#define MAVLINK_MSG_ID_AOA_SSA_MIN_LEN 16 -#define MAVLINK_MSG_ID_11020_LEN 16 -#define MAVLINK_MSG_ID_11020_MIN_LEN 16 - -#define MAVLINK_MSG_ID_AOA_SSA_CRC 205 -#define MAVLINK_MSG_ID_11020_CRC 205 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_AOA_SSA { \ - 11020, \ - "AOA_SSA", \ - 3, \ - { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_aoa_ssa_t, time_usec) }, \ - { "AOA", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_aoa_ssa_t, AOA) }, \ - { "SSA", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_aoa_ssa_t, SSA) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_AOA_SSA { \ - "AOA_SSA", \ - 3, \ - { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_aoa_ssa_t, time_usec) }, \ - { "AOA", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_aoa_ssa_t, AOA) }, \ - { "SSA", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_aoa_ssa_t, SSA) }, \ - } \ -} -#endif - -/** - * @brief Pack a aoa_ssa message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param time_usec [us] Timestamp (since boot or Unix epoch). - * @param AOA [deg] Angle of Attack. - * @param SSA [deg] Side Slip Angle. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_aoa_ssa_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint64_t time_usec, float AOA, float SSA) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_AOA_SSA_LEN]; - _mav_put_uint64_t(buf, 0, time_usec); - _mav_put_float(buf, 8, AOA); - _mav_put_float(buf, 12, SSA); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AOA_SSA_LEN); -#else - mavlink_aoa_ssa_t packet; - packet.time_usec = time_usec; - packet.AOA = AOA; - packet.SSA = SSA; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AOA_SSA_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_AOA_SSA; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AOA_SSA_MIN_LEN, MAVLINK_MSG_ID_AOA_SSA_LEN, MAVLINK_MSG_ID_AOA_SSA_CRC); -} - -/** - * @brief Pack a aoa_ssa message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param time_usec [us] Timestamp (since boot or Unix epoch). - * @param AOA [deg] Angle of Attack. - * @param SSA [deg] Side Slip Angle. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_aoa_ssa_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint64_t time_usec,float AOA,float SSA) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_AOA_SSA_LEN]; - _mav_put_uint64_t(buf, 0, time_usec); - _mav_put_float(buf, 8, AOA); - _mav_put_float(buf, 12, SSA); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AOA_SSA_LEN); -#else - mavlink_aoa_ssa_t packet; - packet.time_usec = time_usec; - packet.AOA = AOA; - packet.SSA = SSA; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AOA_SSA_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_AOA_SSA; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AOA_SSA_MIN_LEN, MAVLINK_MSG_ID_AOA_SSA_LEN, MAVLINK_MSG_ID_AOA_SSA_CRC); -} - -/** - * @brief Encode a aoa_ssa struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param aoa_ssa C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_aoa_ssa_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_aoa_ssa_t* aoa_ssa) -{ - return mavlink_msg_aoa_ssa_pack(system_id, component_id, msg, aoa_ssa->time_usec, aoa_ssa->AOA, aoa_ssa->SSA); -} - -/** - * @brief Encode a aoa_ssa struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param aoa_ssa C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_aoa_ssa_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_aoa_ssa_t* aoa_ssa) -{ - return mavlink_msg_aoa_ssa_pack_chan(system_id, component_id, chan, msg, aoa_ssa->time_usec, aoa_ssa->AOA, aoa_ssa->SSA); -} - -/** - * @brief Send a aoa_ssa message - * @param chan MAVLink channel to send the message - * - * @param time_usec [us] Timestamp (since boot or Unix epoch). - * @param AOA [deg] Angle of Attack. - * @param SSA [deg] Side Slip Angle. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_aoa_ssa_send(mavlink_channel_t chan, uint64_t time_usec, float AOA, float SSA) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_AOA_SSA_LEN]; - _mav_put_uint64_t(buf, 0, time_usec); - _mav_put_float(buf, 8, AOA); - _mav_put_float(buf, 12, SSA); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AOA_SSA, buf, MAVLINK_MSG_ID_AOA_SSA_MIN_LEN, MAVLINK_MSG_ID_AOA_SSA_LEN, MAVLINK_MSG_ID_AOA_SSA_CRC); -#else - mavlink_aoa_ssa_t packet; - packet.time_usec = time_usec; - packet.AOA = AOA; - packet.SSA = SSA; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AOA_SSA, (const char *)&packet, MAVLINK_MSG_ID_AOA_SSA_MIN_LEN, MAVLINK_MSG_ID_AOA_SSA_LEN, MAVLINK_MSG_ID_AOA_SSA_CRC); -#endif -} - -/** - * @brief Send a aoa_ssa message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_aoa_ssa_send_struct(mavlink_channel_t chan, const mavlink_aoa_ssa_t* aoa_ssa) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_aoa_ssa_send(chan, aoa_ssa->time_usec, aoa_ssa->AOA, aoa_ssa->SSA); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AOA_SSA, (const char *)aoa_ssa, MAVLINK_MSG_ID_AOA_SSA_MIN_LEN, MAVLINK_MSG_ID_AOA_SSA_LEN, MAVLINK_MSG_ID_AOA_SSA_CRC); -#endif -} - -#if MAVLINK_MSG_ID_AOA_SSA_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_aoa_ssa_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, float AOA, float SSA) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint64_t(buf, 0, time_usec); - _mav_put_float(buf, 8, AOA); - _mav_put_float(buf, 12, SSA); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AOA_SSA, buf, MAVLINK_MSG_ID_AOA_SSA_MIN_LEN, MAVLINK_MSG_ID_AOA_SSA_LEN, MAVLINK_MSG_ID_AOA_SSA_CRC); -#else - mavlink_aoa_ssa_t *packet = (mavlink_aoa_ssa_t *)msgbuf; - packet->time_usec = time_usec; - packet->AOA = AOA; - packet->SSA = SSA; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AOA_SSA, (const char *)packet, MAVLINK_MSG_ID_AOA_SSA_MIN_LEN, MAVLINK_MSG_ID_AOA_SSA_LEN, MAVLINK_MSG_ID_AOA_SSA_CRC); -#endif -} -#endif - -#endif - -// MESSAGE AOA_SSA UNPACKING - - -/** - * @brief Get field time_usec from aoa_ssa message - * - * @return [us] Timestamp (since boot or Unix epoch). - */ -static inline uint64_t mavlink_msg_aoa_ssa_get_time_usec(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint64_t(msg, 0); -} - -/** - * @brief Get field AOA from aoa_ssa message - * - * @return [deg] Angle of Attack. - */ -static inline float mavlink_msg_aoa_ssa_get_AOA(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field SSA from aoa_ssa message - * - * @return [deg] Side Slip Angle. - */ -static inline float mavlink_msg_aoa_ssa_get_SSA(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Decode a aoa_ssa message into a struct - * - * @param msg The message to decode - * @param aoa_ssa C-struct to decode the message contents into - */ -static inline void mavlink_msg_aoa_ssa_decode(const mavlink_message_t* msg, mavlink_aoa_ssa_t* aoa_ssa) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - aoa_ssa->time_usec = mavlink_msg_aoa_ssa_get_time_usec(msg); - aoa_ssa->AOA = mavlink_msg_aoa_ssa_get_AOA(msg); - aoa_ssa->SSA = mavlink_msg_aoa_ssa_get_SSA(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_AOA_SSA_LEN? msg->len : MAVLINK_MSG_ID_AOA_SSA_LEN; - memset(aoa_ssa, 0, MAVLINK_MSG_ID_AOA_SSA_LEN); - memcpy(aoa_ssa, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_ap_adc.h b/ardupilotmega/mavlink_msg_ap_adc.h deleted file mode 100644 index 54dc70367..000000000 --- a/ardupilotmega/mavlink_msg_ap_adc.h +++ /dev/null @@ -1,338 +0,0 @@ -#pragma once -// MESSAGE AP_ADC PACKING - -#define MAVLINK_MSG_ID_AP_ADC 153 - - -typedef struct __mavlink_ap_adc_t { - uint16_t adc1; /*< ADC output 1.*/ - uint16_t adc2; /*< ADC output 2.*/ - uint16_t adc3; /*< ADC output 3.*/ - uint16_t adc4; /*< ADC output 4.*/ - uint16_t adc5; /*< ADC output 5.*/ - uint16_t adc6; /*< ADC output 6.*/ -} mavlink_ap_adc_t; - -#define MAVLINK_MSG_ID_AP_ADC_LEN 12 -#define MAVLINK_MSG_ID_AP_ADC_MIN_LEN 12 -#define MAVLINK_MSG_ID_153_LEN 12 -#define MAVLINK_MSG_ID_153_MIN_LEN 12 - -#define MAVLINK_MSG_ID_AP_ADC_CRC 188 -#define MAVLINK_MSG_ID_153_CRC 188 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_AP_ADC { \ - 153, \ - "AP_ADC", \ - 6, \ - { { "adc1", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_ap_adc_t, adc1) }, \ - { "adc2", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_ap_adc_t, adc2) }, \ - { "adc3", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_ap_adc_t, adc3) }, \ - { "adc4", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_ap_adc_t, adc4) }, \ - { "adc5", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_ap_adc_t, adc5) }, \ - { "adc6", NULL, MAVLINK_TYPE_UINT16_T, 0, 10, offsetof(mavlink_ap_adc_t, adc6) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_AP_ADC { \ - "AP_ADC", \ - 6, \ - { { "adc1", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_ap_adc_t, adc1) }, \ - { "adc2", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_ap_adc_t, adc2) }, \ - { "adc3", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_ap_adc_t, adc3) }, \ - { "adc4", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_ap_adc_t, adc4) }, \ - { "adc5", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_ap_adc_t, adc5) }, \ - { "adc6", NULL, MAVLINK_TYPE_UINT16_T, 0, 10, offsetof(mavlink_ap_adc_t, adc6) }, \ - } \ -} -#endif - -/** - * @brief Pack a ap_adc message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param adc1 ADC output 1. - * @param adc2 ADC output 2. - * @param adc3 ADC output 3. - * @param adc4 ADC output 4. - * @param adc5 ADC output 5. - * @param adc6 ADC output 6. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_ap_adc_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint16_t adc1, uint16_t adc2, uint16_t adc3, uint16_t adc4, uint16_t adc5, uint16_t adc6) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_AP_ADC_LEN]; - _mav_put_uint16_t(buf, 0, adc1); - _mav_put_uint16_t(buf, 2, adc2); - _mav_put_uint16_t(buf, 4, adc3); - _mav_put_uint16_t(buf, 6, adc4); - _mav_put_uint16_t(buf, 8, adc5); - _mav_put_uint16_t(buf, 10, adc6); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AP_ADC_LEN); -#else - mavlink_ap_adc_t packet; - packet.adc1 = adc1; - packet.adc2 = adc2; - packet.adc3 = adc3; - packet.adc4 = adc4; - packet.adc5 = adc5; - packet.adc6 = adc6; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AP_ADC_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_AP_ADC; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AP_ADC_MIN_LEN, MAVLINK_MSG_ID_AP_ADC_LEN, MAVLINK_MSG_ID_AP_ADC_CRC); -} - -/** - * @brief Pack a ap_adc message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param adc1 ADC output 1. - * @param adc2 ADC output 2. - * @param adc3 ADC output 3. - * @param adc4 ADC output 4. - * @param adc5 ADC output 5. - * @param adc6 ADC output 6. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_ap_adc_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint16_t adc1,uint16_t adc2,uint16_t adc3,uint16_t adc4,uint16_t adc5,uint16_t adc6) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_AP_ADC_LEN]; - _mav_put_uint16_t(buf, 0, adc1); - _mav_put_uint16_t(buf, 2, adc2); - _mav_put_uint16_t(buf, 4, adc3); - _mav_put_uint16_t(buf, 6, adc4); - _mav_put_uint16_t(buf, 8, adc5); - _mav_put_uint16_t(buf, 10, adc6); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AP_ADC_LEN); -#else - mavlink_ap_adc_t packet; - packet.adc1 = adc1; - packet.adc2 = adc2; - packet.adc3 = adc3; - packet.adc4 = adc4; - packet.adc5 = adc5; - packet.adc6 = adc6; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AP_ADC_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_AP_ADC; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AP_ADC_MIN_LEN, MAVLINK_MSG_ID_AP_ADC_LEN, MAVLINK_MSG_ID_AP_ADC_CRC); -} - -/** - * @brief Encode a ap_adc struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param ap_adc C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_ap_adc_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_ap_adc_t* ap_adc) -{ - return mavlink_msg_ap_adc_pack(system_id, component_id, msg, ap_adc->adc1, ap_adc->adc2, ap_adc->adc3, ap_adc->adc4, ap_adc->adc5, ap_adc->adc6); -} - -/** - * @brief Encode a ap_adc struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param ap_adc C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_ap_adc_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_ap_adc_t* ap_adc) -{ - return mavlink_msg_ap_adc_pack_chan(system_id, component_id, chan, msg, ap_adc->adc1, ap_adc->adc2, ap_adc->adc3, ap_adc->adc4, ap_adc->adc5, ap_adc->adc6); -} - -/** - * @brief Send a ap_adc message - * @param chan MAVLink channel to send the message - * - * @param adc1 ADC output 1. - * @param adc2 ADC output 2. - * @param adc3 ADC output 3. - * @param adc4 ADC output 4. - * @param adc5 ADC output 5. - * @param adc6 ADC output 6. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_ap_adc_send(mavlink_channel_t chan, uint16_t adc1, uint16_t adc2, uint16_t adc3, uint16_t adc4, uint16_t adc5, uint16_t adc6) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_AP_ADC_LEN]; - _mav_put_uint16_t(buf, 0, adc1); - _mav_put_uint16_t(buf, 2, adc2); - _mav_put_uint16_t(buf, 4, adc3); - _mav_put_uint16_t(buf, 6, adc4); - _mav_put_uint16_t(buf, 8, adc5); - _mav_put_uint16_t(buf, 10, adc6); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AP_ADC, buf, MAVLINK_MSG_ID_AP_ADC_MIN_LEN, MAVLINK_MSG_ID_AP_ADC_LEN, MAVLINK_MSG_ID_AP_ADC_CRC); -#else - mavlink_ap_adc_t packet; - packet.adc1 = adc1; - packet.adc2 = adc2; - packet.adc3 = adc3; - packet.adc4 = adc4; - packet.adc5 = adc5; - packet.adc6 = adc6; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AP_ADC, (const char *)&packet, MAVLINK_MSG_ID_AP_ADC_MIN_LEN, MAVLINK_MSG_ID_AP_ADC_LEN, MAVLINK_MSG_ID_AP_ADC_CRC); -#endif -} - -/** - * @brief Send a ap_adc message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_ap_adc_send_struct(mavlink_channel_t chan, const mavlink_ap_adc_t* ap_adc) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_ap_adc_send(chan, ap_adc->adc1, ap_adc->adc2, ap_adc->adc3, ap_adc->adc4, ap_adc->adc5, ap_adc->adc6); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AP_ADC, (const char *)ap_adc, MAVLINK_MSG_ID_AP_ADC_MIN_LEN, MAVLINK_MSG_ID_AP_ADC_LEN, MAVLINK_MSG_ID_AP_ADC_CRC); -#endif -} - -#if MAVLINK_MSG_ID_AP_ADC_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_ap_adc_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint16_t adc1, uint16_t adc2, uint16_t adc3, uint16_t adc4, uint16_t adc5, uint16_t adc6) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint16_t(buf, 0, adc1); - _mav_put_uint16_t(buf, 2, adc2); - _mav_put_uint16_t(buf, 4, adc3); - _mav_put_uint16_t(buf, 6, adc4); - _mav_put_uint16_t(buf, 8, adc5); - _mav_put_uint16_t(buf, 10, adc6); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AP_ADC, buf, MAVLINK_MSG_ID_AP_ADC_MIN_LEN, MAVLINK_MSG_ID_AP_ADC_LEN, MAVLINK_MSG_ID_AP_ADC_CRC); -#else - mavlink_ap_adc_t *packet = (mavlink_ap_adc_t *)msgbuf; - packet->adc1 = adc1; - packet->adc2 = adc2; - packet->adc3 = adc3; - packet->adc4 = adc4; - packet->adc5 = adc5; - packet->adc6 = adc6; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AP_ADC, (const char *)packet, MAVLINK_MSG_ID_AP_ADC_MIN_LEN, MAVLINK_MSG_ID_AP_ADC_LEN, MAVLINK_MSG_ID_AP_ADC_CRC); -#endif -} -#endif - -#endif - -// MESSAGE AP_ADC UNPACKING - - -/** - * @brief Get field adc1 from ap_adc message - * - * @return ADC output 1. - */ -static inline uint16_t mavlink_msg_ap_adc_get_adc1(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 0); -} - -/** - * @brief Get field adc2 from ap_adc message - * - * @return ADC output 2. - */ -static inline uint16_t mavlink_msg_ap_adc_get_adc2(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 2); -} - -/** - * @brief Get field adc3 from ap_adc message - * - * @return ADC output 3. - */ -static inline uint16_t mavlink_msg_ap_adc_get_adc3(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 4); -} - -/** - * @brief Get field adc4 from ap_adc message - * - * @return ADC output 4. - */ -static inline uint16_t mavlink_msg_ap_adc_get_adc4(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 6); -} - -/** - * @brief Get field adc5 from ap_adc message - * - * @return ADC output 5. - */ -static inline uint16_t mavlink_msg_ap_adc_get_adc5(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 8); -} - -/** - * @brief Get field adc6 from ap_adc message - * - * @return ADC output 6. - */ -static inline uint16_t mavlink_msg_ap_adc_get_adc6(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 10); -} - -/** - * @brief Decode a ap_adc message into a struct - * - * @param msg The message to decode - * @param ap_adc C-struct to decode the message contents into - */ -static inline void mavlink_msg_ap_adc_decode(const mavlink_message_t* msg, mavlink_ap_adc_t* ap_adc) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - ap_adc->adc1 = mavlink_msg_ap_adc_get_adc1(msg); - ap_adc->adc2 = mavlink_msg_ap_adc_get_adc2(msg); - ap_adc->adc3 = mavlink_msg_ap_adc_get_adc3(msg); - ap_adc->adc4 = mavlink_msg_ap_adc_get_adc4(msg); - ap_adc->adc5 = mavlink_msg_ap_adc_get_adc5(msg); - ap_adc->adc6 = mavlink_msg_ap_adc_get_adc6(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_AP_ADC_LEN? msg->len : MAVLINK_MSG_ID_AP_ADC_LEN; - memset(ap_adc, 0, MAVLINK_MSG_ID_AP_ADC_LEN); - memcpy(ap_adc, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_autopilot_version_request.h b/ardupilotmega/mavlink_msg_autopilot_version_request.h deleted file mode 100644 index a24ccf250..000000000 --- a/ardupilotmega/mavlink_msg_autopilot_version_request.h +++ /dev/null @@ -1,238 +0,0 @@ -#pragma once -// MESSAGE AUTOPILOT_VERSION_REQUEST PACKING - -#define MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST 183 - - -typedef struct __mavlink_autopilot_version_request_t { - uint8_t target_system; /*< System ID.*/ - uint8_t target_component; /*< Component ID.*/ -} mavlink_autopilot_version_request_t; - -#define MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_LEN 2 -#define MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_MIN_LEN 2 -#define MAVLINK_MSG_ID_183_LEN 2 -#define MAVLINK_MSG_ID_183_MIN_LEN 2 - -#define MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_CRC 85 -#define MAVLINK_MSG_ID_183_CRC 85 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_AUTOPILOT_VERSION_REQUEST { \ - 183, \ - "AUTOPILOT_VERSION_REQUEST", \ - 2, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_autopilot_version_request_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_autopilot_version_request_t, target_component) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_AUTOPILOT_VERSION_REQUEST { \ - "AUTOPILOT_VERSION_REQUEST", \ - 2, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_autopilot_version_request_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_autopilot_version_request_t, target_component) }, \ - } \ -} -#endif - -/** - * @brief Pack a autopilot_version_request message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param target_system System ID. - * @param target_component Component ID. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_autopilot_version_request_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_LEN]; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_LEN); -#else - mavlink_autopilot_version_request_t packet; - packet.target_system = target_system; - packet.target_component = target_component; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_CRC); -} - -/** - * @brief Pack a autopilot_version_request message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param target_system System ID. - * @param target_component Component ID. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_autopilot_version_request_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_LEN]; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_LEN); -#else - mavlink_autopilot_version_request_t packet; - packet.target_system = target_system; - packet.target_component = target_component; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_CRC); -} - -/** - * @brief Encode a autopilot_version_request struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param autopilot_version_request C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_autopilot_version_request_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_autopilot_version_request_t* autopilot_version_request) -{ - return mavlink_msg_autopilot_version_request_pack(system_id, component_id, msg, autopilot_version_request->target_system, autopilot_version_request->target_component); -} - -/** - * @brief Encode a autopilot_version_request struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param autopilot_version_request C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_autopilot_version_request_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_autopilot_version_request_t* autopilot_version_request) -{ - return mavlink_msg_autopilot_version_request_pack_chan(system_id, component_id, chan, msg, autopilot_version_request->target_system, autopilot_version_request->target_component); -} - -/** - * @brief Send a autopilot_version_request message - * @param chan MAVLink channel to send the message - * - * @param target_system System ID. - * @param target_component Component ID. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_autopilot_version_request_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_LEN]; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST, buf, MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_CRC); -#else - mavlink_autopilot_version_request_t packet; - packet.target_system = target_system; - packet.target_component = target_component; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST, (const char *)&packet, MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_CRC); -#endif -} - -/** - * @brief Send a autopilot_version_request message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_autopilot_version_request_send_struct(mavlink_channel_t chan, const mavlink_autopilot_version_request_t* autopilot_version_request) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_autopilot_version_request_send(chan, autopilot_version_request->target_system, autopilot_version_request->target_component); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST, (const char *)autopilot_version_request, MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_CRC); -#endif -} - -#if MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_autopilot_version_request_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST, buf, MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_CRC); -#else - mavlink_autopilot_version_request_t *packet = (mavlink_autopilot_version_request_t *)msgbuf; - packet->target_system = target_system; - packet->target_component = target_component; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST, (const char *)packet, MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_CRC); -#endif -} -#endif - -#endif - -// MESSAGE AUTOPILOT_VERSION_REQUEST UNPACKING - - -/** - * @brief Get field target_system from autopilot_version_request message - * - * @return System ID. - */ -static inline uint8_t mavlink_msg_autopilot_version_request_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 0); -} - -/** - * @brief Get field target_component from autopilot_version_request message - * - * @return Component ID. - */ -static inline uint8_t mavlink_msg_autopilot_version_request_get_target_component(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 1); -} - -/** - * @brief Decode a autopilot_version_request message into a struct - * - * @param msg The message to decode - * @param autopilot_version_request C-struct to decode the message contents into - */ -static inline void mavlink_msg_autopilot_version_request_decode(const mavlink_message_t* msg, mavlink_autopilot_version_request_t* autopilot_version_request) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - autopilot_version_request->target_system = mavlink_msg_autopilot_version_request_get_target_system(msg); - autopilot_version_request->target_component = mavlink_msg_autopilot_version_request_get_target_component(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_LEN? msg->len : MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_LEN; - memset(autopilot_version_request, 0, MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_LEN); - memcpy(autopilot_version_request, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_battery2.h b/ardupilotmega/mavlink_msg_battery2.h deleted file mode 100644 index cd11156ac..000000000 --- a/ardupilotmega/mavlink_msg_battery2.h +++ /dev/null @@ -1,238 +0,0 @@ -#pragma once -// MESSAGE BATTERY2 PACKING - -#define MAVLINK_MSG_ID_BATTERY2 181 - - -typedef struct __mavlink_battery2_t { - uint16_t voltage; /*< [mV] Voltage.*/ - int16_t current_battery; /*< [cA] Battery current, -1: autopilot does not measure the current.*/ -} mavlink_battery2_t; - -#define MAVLINK_MSG_ID_BATTERY2_LEN 4 -#define MAVLINK_MSG_ID_BATTERY2_MIN_LEN 4 -#define MAVLINK_MSG_ID_181_LEN 4 -#define MAVLINK_MSG_ID_181_MIN_LEN 4 - -#define MAVLINK_MSG_ID_BATTERY2_CRC 174 -#define MAVLINK_MSG_ID_181_CRC 174 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_BATTERY2 { \ - 181, \ - "BATTERY2", \ - 2, \ - { { "voltage", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_battery2_t, voltage) }, \ - { "current_battery", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_battery2_t, current_battery) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_BATTERY2 { \ - "BATTERY2", \ - 2, \ - { { "voltage", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_battery2_t, voltage) }, \ - { "current_battery", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_battery2_t, current_battery) }, \ - } \ -} -#endif - -/** - * @brief Pack a battery2 message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param voltage [mV] Voltage. - * @param current_battery [cA] Battery current, -1: autopilot does not measure the current. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_battery2_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint16_t voltage, int16_t current_battery) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_BATTERY2_LEN]; - _mav_put_uint16_t(buf, 0, voltage); - _mav_put_int16_t(buf, 2, current_battery); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_BATTERY2_LEN); -#else - mavlink_battery2_t packet; - packet.voltage = voltage; - packet.current_battery = current_battery; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_BATTERY2_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_BATTERY2; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_BATTERY2_MIN_LEN, MAVLINK_MSG_ID_BATTERY2_LEN, MAVLINK_MSG_ID_BATTERY2_CRC); -} - -/** - * @brief Pack a battery2 message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param voltage [mV] Voltage. - * @param current_battery [cA] Battery current, -1: autopilot does not measure the current. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_battery2_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint16_t voltage,int16_t current_battery) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_BATTERY2_LEN]; - _mav_put_uint16_t(buf, 0, voltage); - _mav_put_int16_t(buf, 2, current_battery); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_BATTERY2_LEN); -#else - mavlink_battery2_t packet; - packet.voltage = voltage; - packet.current_battery = current_battery; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_BATTERY2_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_BATTERY2; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_BATTERY2_MIN_LEN, MAVLINK_MSG_ID_BATTERY2_LEN, MAVLINK_MSG_ID_BATTERY2_CRC); -} - -/** - * @brief Encode a battery2 struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param battery2 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_battery2_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_battery2_t* battery2) -{ - return mavlink_msg_battery2_pack(system_id, component_id, msg, battery2->voltage, battery2->current_battery); -} - -/** - * @brief Encode a battery2 struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param battery2 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_battery2_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_battery2_t* battery2) -{ - return mavlink_msg_battery2_pack_chan(system_id, component_id, chan, msg, battery2->voltage, battery2->current_battery); -} - -/** - * @brief Send a battery2 message - * @param chan MAVLink channel to send the message - * - * @param voltage [mV] Voltage. - * @param current_battery [cA] Battery current, -1: autopilot does not measure the current. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_battery2_send(mavlink_channel_t chan, uint16_t voltage, int16_t current_battery) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_BATTERY2_LEN]; - _mav_put_uint16_t(buf, 0, voltage); - _mav_put_int16_t(buf, 2, current_battery); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BATTERY2, buf, MAVLINK_MSG_ID_BATTERY2_MIN_LEN, MAVLINK_MSG_ID_BATTERY2_LEN, MAVLINK_MSG_ID_BATTERY2_CRC); -#else - mavlink_battery2_t packet; - packet.voltage = voltage; - packet.current_battery = current_battery; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BATTERY2, (const char *)&packet, MAVLINK_MSG_ID_BATTERY2_MIN_LEN, MAVLINK_MSG_ID_BATTERY2_LEN, MAVLINK_MSG_ID_BATTERY2_CRC); -#endif -} - -/** - * @brief Send a battery2 message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_battery2_send_struct(mavlink_channel_t chan, const mavlink_battery2_t* battery2) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_battery2_send(chan, battery2->voltage, battery2->current_battery); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BATTERY2, (const char *)battery2, MAVLINK_MSG_ID_BATTERY2_MIN_LEN, MAVLINK_MSG_ID_BATTERY2_LEN, MAVLINK_MSG_ID_BATTERY2_CRC); -#endif -} - -#if MAVLINK_MSG_ID_BATTERY2_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_battery2_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint16_t voltage, int16_t current_battery) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint16_t(buf, 0, voltage); - _mav_put_int16_t(buf, 2, current_battery); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BATTERY2, buf, MAVLINK_MSG_ID_BATTERY2_MIN_LEN, MAVLINK_MSG_ID_BATTERY2_LEN, MAVLINK_MSG_ID_BATTERY2_CRC); -#else - mavlink_battery2_t *packet = (mavlink_battery2_t *)msgbuf; - packet->voltage = voltage; - packet->current_battery = current_battery; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BATTERY2, (const char *)packet, MAVLINK_MSG_ID_BATTERY2_MIN_LEN, MAVLINK_MSG_ID_BATTERY2_LEN, MAVLINK_MSG_ID_BATTERY2_CRC); -#endif -} -#endif - -#endif - -// MESSAGE BATTERY2 UNPACKING - - -/** - * @brief Get field voltage from battery2 message - * - * @return [mV] Voltage. - */ -static inline uint16_t mavlink_msg_battery2_get_voltage(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 0); -} - -/** - * @brief Get field current_battery from battery2 message - * - * @return [cA] Battery current, -1: autopilot does not measure the current. - */ -static inline int16_t mavlink_msg_battery2_get_current_battery(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 2); -} - -/** - * @brief Decode a battery2 message into a struct - * - * @param msg The message to decode - * @param battery2 C-struct to decode the message contents into - */ -static inline void mavlink_msg_battery2_decode(const mavlink_message_t* msg, mavlink_battery2_t* battery2) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - battery2->voltage = mavlink_msg_battery2_get_voltage(msg); - battery2->current_battery = mavlink_msg_battery2_get_current_battery(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_BATTERY2_LEN? msg->len : MAVLINK_MSG_ID_BATTERY2_LEN; - memset(battery2, 0, MAVLINK_MSG_ID_BATTERY2_LEN); - memcpy(battery2, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_camera_feedback.h b/ardupilotmega/mavlink_msg_camera_feedback.h deleted file mode 100644 index 4b8b6fff6..000000000 --- a/ardupilotmega/mavlink_msg_camera_feedback.h +++ /dev/null @@ -1,538 +0,0 @@ -#pragma once -// MESSAGE CAMERA_FEEDBACK PACKING - -#define MAVLINK_MSG_ID_CAMERA_FEEDBACK 180 - -MAVPACKED( -typedef struct __mavlink_camera_feedback_t { - uint64_t time_usec; /*< [us] Image timestamp (since UNIX epoch), as passed in by CAMERA_STATUS message (or autopilot if no CCB).*/ - int32_t lat; /*< [degE7] Latitude.*/ - int32_t lng; /*< [degE7] Longitude.*/ - float alt_msl; /*< [m] Altitude (MSL).*/ - float alt_rel; /*< [m] Altitude (Relative to HOME location).*/ - float roll; /*< [deg] Camera Roll angle (earth frame, +-180).*/ - float pitch; /*< [deg] Camera Pitch angle (earth frame, +-180).*/ - float yaw; /*< [deg] Camera Yaw (earth frame, 0-360, true).*/ - float foc_len; /*< [mm] Focal Length.*/ - uint16_t img_idx; /*< Image index.*/ - uint8_t target_system; /*< System ID.*/ - uint8_t cam_idx; /*< Camera ID.*/ - uint8_t flags; /*< Feedback flags.*/ - uint16_t completed_captures; /*< Completed image captures.*/ -}) mavlink_camera_feedback_t; - -#define MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN 47 -#define MAVLINK_MSG_ID_CAMERA_FEEDBACK_MIN_LEN 45 -#define MAVLINK_MSG_ID_180_LEN 47 -#define MAVLINK_MSG_ID_180_MIN_LEN 45 - -#define MAVLINK_MSG_ID_CAMERA_FEEDBACK_CRC 52 -#define MAVLINK_MSG_ID_180_CRC 52 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_CAMERA_FEEDBACK { \ - 180, \ - "CAMERA_FEEDBACK", \ - 14, \ - { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_camera_feedback_t, time_usec) }, \ - { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 42, offsetof(mavlink_camera_feedback_t, target_system) }, \ - { "cam_idx", NULL, MAVLINK_TYPE_UINT8_T, 0, 43, offsetof(mavlink_camera_feedback_t, cam_idx) }, \ - { "img_idx", NULL, MAVLINK_TYPE_UINT16_T, 0, 40, offsetof(mavlink_camera_feedback_t, img_idx) }, \ - { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_camera_feedback_t, lat) }, \ - { "lng", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_camera_feedback_t, lng) }, \ - { "alt_msl", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_camera_feedback_t, alt_msl) }, \ - { "alt_rel", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_camera_feedback_t, alt_rel) }, \ - { "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_camera_feedback_t, roll) }, \ - { "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_camera_feedback_t, pitch) }, \ - { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_camera_feedback_t, yaw) }, \ - { "foc_len", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_camera_feedback_t, foc_len) }, \ - { "flags", NULL, MAVLINK_TYPE_UINT8_T, 0, 44, offsetof(mavlink_camera_feedback_t, flags) }, \ - { "completed_captures", NULL, MAVLINK_TYPE_UINT16_T, 0, 45, offsetof(mavlink_camera_feedback_t, completed_captures) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_CAMERA_FEEDBACK { \ - "CAMERA_FEEDBACK", \ - 14, \ - { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_camera_feedback_t, time_usec) }, \ - { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 42, offsetof(mavlink_camera_feedback_t, target_system) }, \ - { "cam_idx", NULL, MAVLINK_TYPE_UINT8_T, 0, 43, offsetof(mavlink_camera_feedback_t, cam_idx) }, \ - { "img_idx", NULL, MAVLINK_TYPE_UINT16_T, 0, 40, offsetof(mavlink_camera_feedback_t, img_idx) }, \ - { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_camera_feedback_t, lat) }, \ - { "lng", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_camera_feedback_t, lng) }, \ - { "alt_msl", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_camera_feedback_t, alt_msl) }, \ - { "alt_rel", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_camera_feedback_t, alt_rel) }, \ - { "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_camera_feedback_t, roll) }, \ - { "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_camera_feedback_t, pitch) }, \ - { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_camera_feedback_t, yaw) }, \ - { "foc_len", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_camera_feedback_t, foc_len) }, \ - { "flags", NULL, MAVLINK_TYPE_UINT8_T, 0, 44, offsetof(mavlink_camera_feedback_t, flags) }, \ - { "completed_captures", NULL, MAVLINK_TYPE_UINT16_T, 0, 45, offsetof(mavlink_camera_feedback_t, completed_captures) }, \ - } \ -} -#endif - -/** - * @brief Pack a camera_feedback message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param time_usec [us] Image timestamp (since UNIX epoch), as passed in by CAMERA_STATUS message (or autopilot if no CCB). - * @param target_system System ID. - * @param cam_idx Camera ID. - * @param img_idx Image index. - * @param lat [degE7] Latitude. - * @param lng [degE7] Longitude. - * @param alt_msl [m] Altitude (MSL). - * @param alt_rel [m] Altitude (Relative to HOME location). - * @param roll [deg] Camera Roll angle (earth frame, +-180). - * @param pitch [deg] Camera Pitch angle (earth frame, +-180). - * @param yaw [deg] Camera Yaw (earth frame, 0-360, true). - * @param foc_len [mm] Focal Length. - * @param flags Feedback flags. - * @param completed_captures Completed image captures. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_camera_feedback_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint64_t time_usec, uint8_t target_system, uint8_t cam_idx, uint16_t img_idx, int32_t lat, int32_t lng, float alt_msl, float alt_rel, float roll, float pitch, float yaw, float foc_len, uint8_t flags, uint16_t completed_captures) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN]; - _mav_put_uint64_t(buf, 0, time_usec); - _mav_put_int32_t(buf, 8, lat); - _mav_put_int32_t(buf, 12, lng); - _mav_put_float(buf, 16, alt_msl); - _mav_put_float(buf, 20, alt_rel); - _mav_put_float(buf, 24, roll); - _mav_put_float(buf, 28, pitch); - _mav_put_float(buf, 32, yaw); - _mav_put_float(buf, 36, foc_len); - _mav_put_uint16_t(buf, 40, img_idx); - _mav_put_uint8_t(buf, 42, target_system); - _mav_put_uint8_t(buf, 43, cam_idx); - _mav_put_uint8_t(buf, 44, flags); - _mav_put_uint16_t(buf, 45, completed_captures); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN); -#else - mavlink_camera_feedback_t packet; - packet.time_usec = time_usec; - packet.lat = lat; - packet.lng = lng; - packet.alt_msl = alt_msl; - packet.alt_rel = alt_rel; - packet.roll = roll; - packet.pitch = pitch; - packet.yaw = yaw; - packet.foc_len = foc_len; - packet.img_idx = img_idx; - packet.target_system = target_system; - packet.cam_idx = cam_idx; - packet.flags = flags; - packet.completed_captures = completed_captures; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_CAMERA_FEEDBACK; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CAMERA_FEEDBACK_MIN_LEN, MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN, MAVLINK_MSG_ID_CAMERA_FEEDBACK_CRC); -} - -/** - * @brief Pack a camera_feedback message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param time_usec [us] Image timestamp (since UNIX epoch), as passed in by CAMERA_STATUS message (or autopilot if no CCB). - * @param target_system System ID. - * @param cam_idx Camera ID. - * @param img_idx Image index. - * @param lat [degE7] Latitude. - * @param lng [degE7] Longitude. - * @param alt_msl [m] Altitude (MSL). - * @param alt_rel [m] Altitude (Relative to HOME location). - * @param roll [deg] Camera Roll angle (earth frame, +-180). - * @param pitch [deg] Camera Pitch angle (earth frame, +-180). - * @param yaw [deg] Camera Yaw (earth frame, 0-360, true). - * @param foc_len [mm] Focal Length. - * @param flags Feedback flags. - * @param completed_captures Completed image captures. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_camera_feedback_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint64_t time_usec,uint8_t target_system,uint8_t cam_idx,uint16_t img_idx,int32_t lat,int32_t lng,float alt_msl,float alt_rel,float roll,float pitch,float yaw,float foc_len,uint8_t flags,uint16_t completed_captures) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN]; - _mav_put_uint64_t(buf, 0, time_usec); - _mav_put_int32_t(buf, 8, lat); - _mav_put_int32_t(buf, 12, lng); - _mav_put_float(buf, 16, alt_msl); - _mav_put_float(buf, 20, alt_rel); - _mav_put_float(buf, 24, roll); - _mav_put_float(buf, 28, pitch); - _mav_put_float(buf, 32, yaw); - _mav_put_float(buf, 36, foc_len); - _mav_put_uint16_t(buf, 40, img_idx); - _mav_put_uint8_t(buf, 42, target_system); - _mav_put_uint8_t(buf, 43, cam_idx); - _mav_put_uint8_t(buf, 44, flags); - _mav_put_uint16_t(buf, 45, completed_captures); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN); -#else - mavlink_camera_feedback_t packet; - packet.time_usec = time_usec; - packet.lat = lat; - packet.lng = lng; - packet.alt_msl = alt_msl; - packet.alt_rel = alt_rel; - packet.roll = roll; - packet.pitch = pitch; - packet.yaw = yaw; - packet.foc_len = foc_len; - packet.img_idx = img_idx; - packet.target_system = target_system; - packet.cam_idx = cam_idx; - packet.flags = flags; - packet.completed_captures = completed_captures; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_CAMERA_FEEDBACK; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CAMERA_FEEDBACK_MIN_LEN, MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN, MAVLINK_MSG_ID_CAMERA_FEEDBACK_CRC); -} - -/** - * @brief Encode a camera_feedback struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param camera_feedback C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_camera_feedback_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_camera_feedback_t* camera_feedback) -{ - return mavlink_msg_camera_feedback_pack(system_id, component_id, msg, camera_feedback->time_usec, camera_feedback->target_system, camera_feedback->cam_idx, camera_feedback->img_idx, camera_feedback->lat, camera_feedback->lng, camera_feedback->alt_msl, camera_feedback->alt_rel, camera_feedback->roll, camera_feedback->pitch, camera_feedback->yaw, camera_feedback->foc_len, camera_feedback->flags, camera_feedback->completed_captures); -} - -/** - * @brief Encode a camera_feedback struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param camera_feedback C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_camera_feedback_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_camera_feedback_t* camera_feedback) -{ - return mavlink_msg_camera_feedback_pack_chan(system_id, component_id, chan, msg, camera_feedback->time_usec, camera_feedback->target_system, camera_feedback->cam_idx, camera_feedback->img_idx, camera_feedback->lat, camera_feedback->lng, camera_feedback->alt_msl, camera_feedback->alt_rel, camera_feedback->roll, camera_feedback->pitch, camera_feedback->yaw, camera_feedback->foc_len, camera_feedback->flags, camera_feedback->completed_captures); -} - -/** - * @brief Send a camera_feedback message - * @param chan MAVLink channel to send the message - * - * @param time_usec [us] Image timestamp (since UNIX epoch), as passed in by CAMERA_STATUS message (or autopilot if no CCB). - * @param target_system System ID. - * @param cam_idx Camera ID. - * @param img_idx Image index. - * @param lat [degE7] Latitude. - * @param lng [degE7] Longitude. - * @param alt_msl [m] Altitude (MSL). - * @param alt_rel [m] Altitude (Relative to HOME location). - * @param roll [deg] Camera Roll angle (earth frame, +-180). - * @param pitch [deg] Camera Pitch angle (earth frame, +-180). - * @param yaw [deg] Camera Yaw (earth frame, 0-360, true). - * @param foc_len [mm] Focal Length. - * @param flags Feedback flags. - * @param completed_captures Completed image captures. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_camera_feedback_send(mavlink_channel_t chan, uint64_t time_usec, uint8_t target_system, uint8_t cam_idx, uint16_t img_idx, int32_t lat, int32_t lng, float alt_msl, float alt_rel, float roll, float pitch, float yaw, float foc_len, uint8_t flags, uint16_t completed_captures) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN]; - _mav_put_uint64_t(buf, 0, time_usec); - _mav_put_int32_t(buf, 8, lat); - _mav_put_int32_t(buf, 12, lng); - _mav_put_float(buf, 16, alt_msl); - _mav_put_float(buf, 20, alt_rel); - _mav_put_float(buf, 24, roll); - _mav_put_float(buf, 28, pitch); - _mav_put_float(buf, 32, yaw); - _mav_put_float(buf, 36, foc_len); - _mav_put_uint16_t(buf, 40, img_idx); - _mav_put_uint8_t(buf, 42, target_system); - _mav_put_uint8_t(buf, 43, cam_idx); - _mav_put_uint8_t(buf, 44, flags); - _mav_put_uint16_t(buf, 45, completed_captures); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_FEEDBACK, buf, MAVLINK_MSG_ID_CAMERA_FEEDBACK_MIN_LEN, MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN, MAVLINK_MSG_ID_CAMERA_FEEDBACK_CRC); -#else - mavlink_camera_feedback_t packet; - packet.time_usec = time_usec; - packet.lat = lat; - packet.lng = lng; - packet.alt_msl = alt_msl; - packet.alt_rel = alt_rel; - packet.roll = roll; - packet.pitch = pitch; - packet.yaw = yaw; - packet.foc_len = foc_len; - packet.img_idx = img_idx; - packet.target_system = target_system; - packet.cam_idx = cam_idx; - packet.flags = flags; - packet.completed_captures = completed_captures; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_FEEDBACK, (const char *)&packet, MAVLINK_MSG_ID_CAMERA_FEEDBACK_MIN_LEN, MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN, MAVLINK_MSG_ID_CAMERA_FEEDBACK_CRC); -#endif -} - -/** - * @brief Send a camera_feedback message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_camera_feedback_send_struct(mavlink_channel_t chan, const mavlink_camera_feedback_t* camera_feedback) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_camera_feedback_send(chan, camera_feedback->time_usec, camera_feedback->target_system, camera_feedback->cam_idx, camera_feedback->img_idx, camera_feedback->lat, camera_feedback->lng, camera_feedback->alt_msl, camera_feedback->alt_rel, camera_feedback->roll, camera_feedback->pitch, camera_feedback->yaw, camera_feedback->foc_len, camera_feedback->flags, camera_feedback->completed_captures); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_FEEDBACK, (const char *)camera_feedback, MAVLINK_MSG_ID_CAMERA_FEEDBACK_MIN_LEN, MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN, MAVLINK_MSG_ID_CAMERA_FEEDBACK_CRC); -#endif -} - -#if MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_camera_feedback_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint8_t target_system, uint8_t cam_idx, uint16_t img_idx, int32_t lat, int32_t lng, float alt_msl, float alt_rel, float roll, float pitch, float yaw, float foc_len, uint8_t flags, uint16_t completed_captures) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint64_t(buf, 0, time_usec); - _mav_put_int32_t(buf, 8, lat); - _mav_put_int32_t(buf, 12, lng); - _mav_put_float(buf, 16, alt_msl); - _mav_put_float(buf, 20, alt_rel); - _mav_put_float(buf, 24, roll); - _mav_put_float(buf, 28, pitch); - _mav_put_float(buf, 32, yaw); - _mav_put_float(buf, 36, foc_len); - _mav_put_uint16_t(buf, 40, img_idx); - _mav_put_uint8_t(buf, 42, target_system); - _mav_put_uint8_t(buf, 43, cam_idx); - _mav_put_uint8_t(buf, 44, flags); - _mav_put_uint16_t(buf, 45, completed_captures); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_FEEDBACK, buf, MAVLINK_MSG_ID_CAMERA_FEEDBACK_MIN_LEN, MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN, MAVLINK_MSG_ID_CAMERA_FEEDBACK_CRC); -#else - mavlink_camera_feedback_t *packet = (mavlink_camera_feedback_t *)msgbuf; - packet->time_usec = time_usec; - packet->lat = lat; - packet->lng = lng; - packet->alt_msl = alt_msl; - packet->alt_rel = alt_rel; - packet->roll = roll; - packet->pitch = pitch; - packet->yaw = yaw; - packet->foc_len = foc_len; - packet->img_idx = img_idx; - packet->target_system = target_system; - packet->cam_idx = cam_idx; - packet->flags = flags; - packet->completed_captures = completed_captures; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_FEEDBACK, (const char *)packet, MAVLINK_MSG_ID_CAMERA_FEEDBACK_MIN_LEN, MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN, MAVLINK_MSG_ID_CAMERA_FEEDBACK_CRC); -#endif -} -#endif - -#endif - -// MESSAGE CAMERA_FEEDBACK UNPACKING - - -/** - * @brief Get field time_usec from camera_feedback message - * - * @return [us] Image timestamp (since UNIX epoch), as passed in by CAMERA_STATUS message (or autopilot if no CCB). - */ -static inline uint64_t mavlink_msg_camera_feedback_get_time_usec(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint64_t(msg, 0); -} - -/** - * @brief Get field target_system from camera_feedback message - * - * @return System ID. - */ -static inline uint8_t mavlink_msg_camera_feedback_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 42); -} - -/** - * @brief Get field cam_idx from camera_feedback message - * - * @return Camera ID. - */ -static inline uint8_t mavlink_msg_camera_feedback_get_cam_idx(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 43); -} - -/** - * @brief Get field img_idx from camera_feedback message - * - * @return Image index. - */ -static inline uint16_t mavlink_msg_camera_feedback_get_img_idx(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 40); -} - -/** - * @brief Get field lat from camera_feedback message - * - * @return [degE7] Latitude. - */ -static inline int32_t mavlink_msg_camera_feedback_get_lat(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 8); -} - -/** - * @brief Get field lng from camera_feedback message - * - * @return [degE7] Longitude. - */ -static inline int32_t mavlink_msg_camera_feedback_get_lng(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 12); -} - -/** - * @brief Get field alt_msl from camera_feedback message - * - * @return [m] Altitude (MSL). - */ -static inline float mavlink_msg_camera_feedback_get_alt_msl(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 16); -} - -/** - * @brief Get field alt_rel from camera_feedback message - * - * @return [m] Altitude (Relative to HOME location). - */ -static inline float mavlink_msg_camera_feedback_get_alt_rel(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 20); -} - -/** - * @brief Get field roll from camera_feedback message - * - * @return [deg] Camera Roll angle (earth frame, +-180). - */ -static inline float mavlink_msg_camera_feedback_get_roll(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 24); -} - -/** - * @brief Get field pitch from camera_feedback message - * - * @return [deg] Camera Pitch angle (earth frame, +-180). - */ -static inline float mavlink_msg_camera_feedback_get_pitch(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 28); -} - -/** - * @brief Get field yaw from camera_feedback message - * - * @return [deg] Camera Yaw (earth frame, 0-360, true). - */ -static inline float mavlink_msg_camera_feedback_get_yaw(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 32); -} - -/** - * @brief Get field foc_len from camera_feedback message - * - * @return [mm] Focal Length. - */ -static inline float mavlink_msg_camera_feedback_get_foc_len(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 36); -} - -/** - * @brief Get field flags from camera_feedback message - * - * @return Feedback flags. - */ -static inline uint8_t mavlink_msg_camera_feedback_get_flags(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 44); -} - -/** - * @brief Get field completed_captures from camera_feedback message - * - * @return Completed image captures. - */ -static inline uint16_t mavlink_msg_camera_feedback_get_completed_captures(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 45); -} - -/** - * @brief Decode a camera_feedback message into a struct - * - * @param msg The message to decode - * @param camera_feedback C-struct to decode the message contents into - */ -static inline void mavlink_msg_camera_feedback_decode(const mavlink_message_t* msg, mavlink_camera_feedback_t* camera_feedback) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - camera_feedback->time_usec = mavlink_msg_camera_feedback_get_time_usec(msg); - camera_feedback->lat = mavlink_msg_camera_feedback_get_lat(msg); - camera_feedback->lng = mavlink_msg_camera_feedback_get_lng(msg); - camera_feedback->alt_msl = mavlink_msg_camera_feedback_get_alt_msl(msg); - camera_feedback->alt_rel = mavlink_msg_camera_feedback_get_alt_rel(msg); - camera_feedback->roll = mavlink_msg_camera_feedback_get_roll(msg); - camera_feedback->pitch = mavlink_msg_camera_feedback_get_pitch(msg); - camera_feedback->yaw = mavlink_msg_camera_feedback_get_yaw(msg); - camera_feedback->foc_len = mavlink_msg_camera_feedback_get_foc_len(msg); - camera_feedback->img_idx = mavlink_msg_camera_feedback_get_img_idx(msg); - camera_feedback->target_system = mavlink_msg_camera_feedback_get_target_system(msg); - camera_feedback->cam_idx = mavlink_msg_camera_feedback_get_cam_idx(msg); - camera_feedback->flags = mavlink_msg_camera_feedback_get_flags(msg); - camera_feedback->completed_captures = mavlink_msg_camera_feedback_get_completed_captures(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN? msg->len : MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN; - memset(camera_feedback, 0, MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN); - memcpy(camera_feedback, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_camera_status.h b/ardupilotmega/mavlink_msg_camera_status.h deleted file mode 100644 index 4d002f444..000000000 --- a/ardupilotmega/mavlink_msg_camera_status.h +++ /dev/null @@ -1,413 +0,0 @@ -#pragma once -// MESSAGE CAMERA_STATUS PACKING - -#define MAVLINK_MSG_ID_CAMERA_STATUS 179 - - -typedef struct __mavlink_camera_status_t { - uint64_t time_usec; /*< [us] Image timestamp (since UNIX epoch, according to camera clock).*/ - float p1; /*< Parameter 1 (meaning depends on event_id, see CAMERA_STATUS_TYPES enum).*/ - float p2; /*< Parameter 2 (meaning depends on event_id, see CAMERA_STATUS_TYPES enum).*/ - float p3; /*< Parameter 3 (meaning depends on event_id, see CAMERA_STATUS_TYPES enum).*/ - float p4; /*< Parameter 4 (meaning depends on event_id, see CAMERA_STATUS_TYPES enum).*/ - uint16_t img_idx; /*< Image index.*/ - uint8_t target_system; /*< System ID.*/ - uint8_t cam_idx; /*< Camera ID.*/ - uint8_t event_id; /*< Event type.*/ -} mavlink_camera_status_t; - -#define MAVLINK_MSG_ID_CAMERA_STATUS_LEN 29 -#define MAVLINK_MSG_ID_CAMERA_STATUS_MIN_LEN 29 -#define MAVLINK_MSG_ID_179_LEN 29 -#define MAVLINK_MSG_ID_179_MIN_LEN 29 - -#define MAVLINK_MSG_ID_CAMERA_STATUS_CRC 189 -#define MAVLINK_MSG_ID_179_CRC 189 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_CAMERA_STATUS { \ - 179, \ - "CAMERA_STATUS", \ - 9, \ - { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_camera_status_t, time_usec) }, \ - { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_camera_status_t, target_system) }, \ - { "cam_idx", NULL, MAVLINK_TYPE_UINT8_T, 0, 27, offsetof(mavlink_camera_status_t, cam_idx) }, \ - { "img_idx", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_camera_status_t, img_idx) }, \ - { "event_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_camera_status_t, event_id) }, \ - { "p1", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_camera_status_t, p1) }, \ - { "p2", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_camera_status_t, p2) }, \ - { "p3", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_camera_status_t, p3) }, \ - { "p4", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_camera_status_t, p4) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_CAMERA_STATUS { \ - "CAMERA_STATUS", \ - 9, \ - { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_camera_status_t, time_usec) }, \ - { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_camera_status_t, target_system) }, \ - { "cam_idx", NULL, MAVLINK_TYPE_UINT8_T, 0, 27, offsetof(mavlink_camera_status_t, cam_idx) }, \ - { "img_idx", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_camera_status_t, img_idx) }, \ - { "event_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_camera_status_t, event_id) }, \ - { "p1", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_camera_status_t, p1) }, \ - { "p2", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_camera_status_t, p2) }, \ - { "p3", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_camera_status_t, p3) }, \ - { "p4", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_camera_status_t, p4) }, \ - } \ -} -#endif - -/** - * @brief Pack a camera_status message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param time_usec [us] Image timestamp (since UNIX epoch, according to camera clock). - * @param target_system System ID. - * @param cam_idx Camera ID. - * @param img_idx Image index. - * @param event_id Event type. - * @param p1 Parameter 1 (meaning depends on event_id, see CAMERA_STATUS_TYPES enum). - * @param p2 Parameter 2 (meaning depends on event_id, see CAMERA_STATUS_TYPES enum). - * @param p3 Parameter 3 (meaning depends on event_id, see CAMERA_STATUS_TYPES enum). - * @param p4 Parameter 4 (meaning depends on event_id, see CAMERA_STATUS_TYPES enum). - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_camera_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint64_t time_usec, uint8_t target_system, uint8_t cam_idx, uint16_t img_idx, uint8_t event_id, float p1, float p2, float p3, float p4) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_CAMERA_STATUS_LEN]; - _mav_put_uint64_t(buf, 0, time_usec); - _mav_put_float(buf, 8, p1); - _mav_put_float(buf, 12, p2); - _mav_put_float(buf, 16, p3); - _mav_put_float(buf, 20, p4); - _mav_put_uint16_t(buf, 24, img_idx); - _mav_put_uint8_t(buf, 26, target_system); - _mav_put_uint8_t(buf, 27, cam_idx); - _mav_put_uint8_t(buf, 28, event_id); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_STATUS_LEN); -#else - mavlink_camera_status_t packet; - packet.time_usec = time_usec; - packet.p1 = p1; - packet.p2 = p2; - packet.p3 = p3; - packet.p4 = p4; - packet.img_idx = img_idx; - packet.target_system = target_system; - packet.cam_idx = cam_idx; - packet.event_id = event_id; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_STATUS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_CAMERA_STATUS; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CAMERA_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_STATUS_CRC); -} - -/** - * @brief Pack a camera_status message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param time_usec [us] Image timestamp (since UNIX epoch, according to camera clock). - * @param target_system System ID. - * @param cam_idx Camera ID. - * @param img_idx Image index. - * @param event_id Event type. - * @param p1 Parameter 1 (meaning depends on event_id, see CAMERA_STATUS_TYPES enum). - * @param p2 Parameter 2 (meaning depends on event_id, see CAMERA_STATUS_TYPES enum). - * @param p3 Parameter 3 (meaning depends on event_id, see CAMERA_STATUS_TYPES enum). - * @param p4 Parameter 4 (meaning depends on event_id, see CAMERA_STATUS_TYPES enum). - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_camera_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint64_t time_usec,uint8_t target_system,uint8_t cam_idx,uint16_t img_idx,uint8_t event_id,float p1,float p2,float p3,float p4) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_CAMERA_STATUS_LEN]; - _mav_put_uint64_t(buf, 0, time_usec); - _mav_put_float(buf, 8, p1); - _mav_put_float(buf, 12, p2); - _mav_put_float(buf, 16, p3); - _mav_put_float(buf, 20, p4); - _mav_put_uint16_t(buf, 24, img_idx); - _mav_put_uint8_t(buf, 26, target_system); - _mav_put_uint8_t(buf, 27, cam_idx); - _mav_put_uint8_t(buf, 28, event_id); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_STATUS_LEN); -#else - mavlink_camera_status_t packet; - packet.time_usec = time_usec; - packet.p1 = p1; - packet.p2 = p2; - packet.p3 = p3; - packet.p4 = p4; - packet.img_idx = img_idx; - packet.target_system = target_system; - packet.cam_idx = cam_idx; - packet.event_id = event_id; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_STATUS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_CAMERA_STATUS; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CAMERA_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_STATUS_CRC); -} - -/** - * @brief Encode a camera_status struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param camera_status C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_camera_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_camera_status_t* camera_status) -{ - return mavlink_msg_camera_status_pack(system_id, component_id, msg, camera_status->time_usec, camera_status->target_system, camera_status->cam_idx, camera_status->img_idx, camera_status->event_id, camera_status->p1, camera_status->p2, camera_status->p3, camera_status->p4); -} - -/** - * @brief Encode a camera_status struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param camera_status C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_camera_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_camera_status_t* camera_status) -{ - return mavlink_msg_camera_status_pack_chan(system_id, component_id, chan, msg, camera_status->time_usec, camera_status->target_system, camera_status->cam_idx, camera_status->img_idx, camera_status->event_id, camera_status->p1, camera_status->p2, camera_status->p3, camera_status->p4); -} - -/** - * @brief Send a camera_status message - * @param chan MAVLink channel to send the message - * - * @param time_usec [us] Image timestamp (since UNIX epoch, according to camera clock). - * @param target_system System ID. - * @param cam_idx Camera ID. - * @param img_idx Image index. - * @param event_id Event type. - * @param p1 Parameter 1 (meaning depends on event_id, see CAMERA_STATUS_TYPES enum). - * @param p2 Parameter 2 (meaning depends on event_id, see CAMERA_STATUS_TYPES enum). - * @param p3 Parameter 3 (meaning depends on event_id, see CAMERA_STATUS_TYPES enum). - * @param p4 Parameter 4 (meaning depends on event_id, see CAMERA_STATUS_TYPES enum). - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_camera_status_send(mavlink_channel_t chan, uint64_t time_usec, uint8_t target_system, uint8_t cam_idx, uint16_t img_idx, uint8_t event_id, float p1, float p2, float p3, float p4) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_CAMERA_STATUS_LEN]; - _mav_put_uint64_t(buf, 0, time_usec); - _mav_put_float(buf, 8, p1); - _mav_put_float(buf, 12, p2); - _mav_put_float(buf, 16, p3); - _mav_put_float(buf, 20, p4); - _mav_put_uint16_t(buf, 24, img_idx); - _mav_put_uint8_t(buf, 26, target_system); - _mav_put_uint8_t(buf, 27, cam_idx); - _mav_put_uint8_t(buf, 28, event_id); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_STATUS, buf, MAVLINK_MSG_ID_CAMERA_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_STATUS_CRC); -#else - mavlink_camera_status_t packet; - packet.time_usec = time_usec; - packet.p1 = p1; - packet.p2 = p2; - packet.p3 = p3; - packet.p4 = p4; - packet.img_idx = img_idx; - packet.target_system = target_system; - packet.cam_idx = cam_idx; - packet.event_id = event_id; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_STATUS, (const char *)&packet, MAVLINK_MSG_ID_CAMERA_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_STATUS_CRC); -#endif -} - -/** - * @brief Send a camera_status message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_camera_status_send_struct(mavlink_channel_t chan, const mavlink_camera_status_t* camera_status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_camera_status_send(chan, camera_status->time_usec, camera_status->target_system, camera_status->cam_idx, camera_status->img_idx, camera_status->event_id, camera_status->p1, camera_status->p2, camera_status->p3, camera_status->p4); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_STATUS, (const char *)camera_status, MAVLINK_MSG_ID_CAMERA_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_STATUS_CRC); -#endif -} - -#if MAVLINK_MSG_ID_CAMERA_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_camera_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint8_t target_system, uint8_t cam_idx, uint16_t img_idx, uint8_t event_id, float p1, float p2, float p3, float p4) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint64_t(buf, 0, time_usec); - _mav_put_float(buf, 8, p1); - _mav_put_float(buf, 12, p2); - _mav_put_float(buf, 16, p3); - _mav_put_float(buf, 20, p4); - _mav_put_uint16_t(buf, 24, img_idx); - _mav_put_uint8_t(buf, 26, target_system); - _mav_put_uint8_t(buf, 27, cam_idx); - _mav_put_uint8_t(buf, 28, event_id); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_STATUS, buf, MAVLINK_MSG_ID_CAMERA_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_STATUS_CRC); -#else - mavlink_camera_status_t *packet = (mavlink_camera_status_t *)msgbuf; - packet->time_usec = time_usec; - packet->p1 = p1; - packet->p2 = p2; - packet->p3 = p3; - packet->p4 = p4; - packet->img_idx = img_idx; - packet->target_system = target_system; - packet->cam_idx = cam_idx; - packet->event_id = event_id; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_STATUS, (const char *)packet, MAVLINK_MSG_ID_CAMERA_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_STATUS_CRC); -#endif -} -#endif - -#endif - -// MESSAGE CAMERA_STATUS UNPACKING - - -/** - * @brief Get field time_usec from camera_status message - * - * @return [us] Image timestamp (since UNIX epoch, according to camera clock). - */ -static inline uint64_t mavlink_msg_camera_status_get_time_usec(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint64_t(msg, 0); -} - -/** - * @brief Get field target_system from camera_status message - * - * @return System ID. - */ -static inline uint8_t mavlink_msg_camera_status_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 26); -} - -/** - * @brief Get field cam_idx from camera_status message - * - * @return Camera ID. - */ -static inline uint8_t mavlink_msg_camera_status_get_cam_idx(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 27); -} - -/** - * @brief Get field img_idx from camera_status message - * - * @return Image index. - */ -static inline uint16_t mavlink_msg_camera_status_get_img_idx(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 24); -} - -/** - * @brief Get field event_id from camera_status message - * - * @return Event type. - */ -static inline uint8_t mavlink_msg_camera_status_get_event_id(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 28); -} - -/** - * @brief Get field p1 from camera_status message - * - * @return Parameter 1 (meaning depends on event_id, see CAMERA_STATUS_TYPES enum). - */ -static inline float mavlink_msg_camera_status_get_p1(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field p2 from camera_status message - * - * @return Parameter 2 (meaning depends on event_id, see CAMERA_STATUS_TYPES enum). - */ -static inline float mavlink_msg_camera_status_get_p2(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Get field p3 from camera_status message - * - * @return Parameter 3 (meaning depends on event_id, see CAMERA_STATUS_TYPES enum). - */ -static inline float mavlink_msg_camera_status_get_p3(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 16); -} - -/** - * @brief Get field p4 from camera_status message - * - * @return Parameter 4 (meaning depends on event_id, see CAMERA_STATUS_TYPES enum). - */ -static inline float mavlink_msg_camera_status_get_p4(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 20); -} - -/** - * @brief Decode a camera_status message into a struct - * - * @param msg The message to decode - * @param camera_status C-struct to decode the message contents into - */ -static inline void mavlink_msg_camera_status_decode(const mavlink_message_t* msg, mavlink_camera_status_t* camera_status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - camera_status->time_usec = mavlink_msg_camera_status_get_time_usec(msg); - camera_status->p1 = mavlink_msg_camera_status_get_p1(msg); - camera_status->p2 = mavlink_msg_camera_status_get_p2(msg); - camera_status->p3 = mavlink_msg_camera_status_get_p3(msg); - camera_status->p4 = mavlink_msg_camera_status_get_p4(msg); - camera_status->img_idx = mavlink_msg_camera_status_get_img_idx(msg); - camera_status->target_system = mavlink_msg_camera_status_get_target_system(msg); - camera_status->cam_idx = mavlink_msg_camera_status_get_cam_idx(msg); - camera_status->event_id = mavlink_msg_camera_status_get_event_id(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_CAMERA_STATUS_LEN? msg->len : MAVLINK_MSG_ID_CAMERA_STATUS_LEN; - memset(camera_status, 0, MAVLINK_MSG_ID_CAMERA_STATUS_LEN); - memcpy(camera_status, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_compassmot_status.h b/ardupilotmega/mavlink_msg_compassmot_status.h deleted file mode 100644 index 6bad800a9..000000000 --- a/ardupilotmega/mavlink_msg_compassmot_status.h +++ /dev/null @@ -1,338 +0,0 @@ -#pragma once -// MESSAGE COMPASSMOT_STATUS PACKING - -#define MAVLINK_MSG_ID_COMPASSMOT_STATUS 177 - - -typedef struct __mavlink_compassmot_status_t { - float current; /*< [A] Current.*/ - float CompensationX; /*< Motor Compensation X.*/ - float CompensationY; /*< Motor Compensation Y.*/ - float CompensationZ; /*< Motor Compensation Z.*/ - uint16_t throttle; /*< [d%] Throttle.*/ - uint16_t interference; /*< [%] Interference.*/ -} mavlink_compassmot_status_t; - -#define MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN 20 -#define MAVLINK_MSG_ID_COMPASSMOT_STATUS_MIN_LEN 20 -#define MAVLINK_MSG_ID_177_LEN 20 -#define MAVLINK_MSG_ID_177_MIN_LEN 20 - -#define MAVLINK_MSG_ID_COMPASSMOT_STATUS_CRC 240 -#define MAVLINK_MSG_ID_177_CRC 240 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_COMPASSMOT_STATUS { \ - 177, \ - "COMPASSMOT_STATUS", \ - 6, \ - { { "throttle", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_compassmot_status_t, throttle) }, \ - { "current", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_compassmot_status_t, current) }, \ - { "interference", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_compassmot_status_t, interference) }, \ - { "CompensationX", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_compassmot_status_t, CompensationX) }, \ - { "CompensationY", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_compassmot_status_t, CompensationY) }, \ - { "CompensationZ", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_compassmot_status_t, CompensationZ) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_COMPASSMOT_STATUS { \ - "COMPASSMOT_STATUS", \ - 6, \ - { { "throttle", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_compassmot_status_t, throttle) }, \ - { "current", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_compassmot_status_t, current) }, \ - { "interference", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_compassmot_status_t, interference) }, \ - { "CompensationX", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_compassmot_status_t, CompensationX) }, \ - { "CompensationY", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_compassmot_status_t, CompensationY) }, \ - { "CompensationZ", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_compassmot_status_t, CompensationZ) }, \ - } \ -} -#endif - -/** - * @brief Pack a compassmot_status message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param throttle [d%] Throttle. - * @param current [A] Current. - * @param interference [%] Interference. - * @param CompensationX Motor Compensation X. - * @param CompensationY Motor Compensation Y. - * @param CompensationZ Motor Compensation Z. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_compassmot_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint16_t throttle, float current, uint16_t interference, float CompensationX, float CompensationY, float CompensationZ) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN]; - _mav_put_float(buf, 0, current); - _mav_put_float(buf, 4, CompensationX); - _mav_put_float(buf, 8, CompensationY); - _mav_put_float(buf, 12, CompensationZ); - _mav_put_uint16_t(buf, 16, throttle); - _mav_put_uint16_t(buf, 18, interference); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN); -#else - mavlink_compassmot_status_t packet; - packet.current = current; - packet.CompensationX = CompensationX; - packet.CompensationY = CompensationY; - packet.CompensationZ = CompensationZ; - packet.throttle = throttle; - packet.interference = interference; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_COMPASSMOT_STATUS; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_COMPASSMOT_STATUS_MIN_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_CRC); -} - -/** - * @brief Pack a compassmot_status message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param throttle [d%] Throttle. - * @param current [A] Current. - * @param interference [%] Interference. - * @param CompensationX Motor Compensation X. - * @param CompensationY Motor Compensation Y. - * @param CompensationZ Motor Compensation Z. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_compassmot_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint16_t throttle,float current,uint16_t interference,float CompensationX,float CompensationY,float CompensationZ) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN]; - _mav_put_float(buf, 0, current); - _mav_put_float(buf, 4, CompensationX); - _mav_put_float(buf, 8, CompensationY); - _mav_put_float(buf, 12, CompensationZ); - _mav_put_uint16_t(buf, 16, throttle); - _mav_put_uint16_t(buf, 18, interference); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN); -#else - mavlink_compassmot_status_t packet; - packet.current = current; - packet.CompensationX = CompensationX; - packet.CompensationY = CompensationY; - packet.CompensationZ = CompensationZ; - packet.throttle = throttle; - packet.interference = interference; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_COMPASSMOT_STATUS; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_COMPASSMOT_STATUS_MIN_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_CRC); -} - -/** - * @brief Encode a compassmot_status struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param compassmot_status C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_compassmot_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_compassmot_status_t* compassmot_status) -{ - return mavlink_msg_compassmot_status_pack(system_id, component_id, msg, compassmot_status->throttle, compassmot_status->current, compassmot_status->interference, compassmot_status->CompensationX, compassmot_status->CompensationY, compassmot_status->CompensationZ); -} - -/** - * @brief Encode a compassmot_status struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param compassmot_status C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_compassmot_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_compassmot_status_t* compassmot_status) -{ - return mavlink_msg_compassmot_status_pack_chan(system_id, component_id, chan, msg, compassmot_status->throttle, compassmot_status->current, compassmot_status->interference, compassmot_status->CompensationX, compassmot_status->CompensationY, compassmot_status->CompensationZ); -} - -/** - * @brief Send a compassmot_status message - * @param chan MAVLink channel to send the message - * - * @param throttle [d%] Throttle. - * @param current [A] Current. - * @param interference [%] Interference. - * @param CompensationX Motor Compensation X. - * @param CompensationY Motor Compensation Y. - * @param CompensationZ Motor Compensation Z. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_compassmot_status_send(mavlink_channel_t chan, uint16_t throttle, float current, uint16_t interference, float CompensationX, float CompensationY, float CompensationZ) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN]; - _mav_put_float(buf, 0, current); - _mav_put_float(buf, 4, CompensationX); - _mav_put_float(buf, 8, CompensationY); - _mav_put_float(buf, 12, CompensationZ); - _mav_put_uint16_t(buf, 16, throttle); - _mav_put_uint16_t(buf, 18, interference); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPASSMOT_STATUS, buf, MAVLINK_MSG_ID_COMPASSMOT_STATUS_MIN_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_CRC); -#else - mavlink_compassmot_status_t packet; - packet.current = current; - packet.CompensationX = CompensationX; - packet.CompensationY = CompensationY; - packet.CompensationZ = CompensationZ; - packet.throttle = throttle; - packet.interference = interference; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPASSMOT_STATUS, (const char *)&packet, MAVLINK_MSG_ID_COMPASSMOT_STATUS_MIN_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_CRC); -#endif -} - -/** - * @brief Send a compassmot_status message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_compassmot_status_send_struct(mavlink_channel_t chan, const mavlink_compassmot_status_t* compassmot_status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_compassmot_status_send(chan, compassmot_status->throttle, compassmot_status->current, compassmot_status->interference, compassmot_status->CompensationX, compassmot_status->CompensationY, compassmot_status->CompensationZ); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPASSMOT_STATUS, (const char *)compassmot_status, MAVLINK_MSG_ID_COMPASSMOT_STATUS_MIN_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_CRC); -#endif -} - -#if MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_compassmot_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint16_t throttle, float current, uint16_t interference, float CompensationX, float CompensationY, float CompensationZ) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_float(buf, 0, current); - _mav_put_float(buf, 4, CompensationX); - _mav_put_float(buf, 8, CompensationY); - _mav_put_float(buf, 12, CompensationZ); - _mav_put_uint16_t(buf, 16, throttle); - _mav_put_uint16_t(buf, 18, interference); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPASSMOT_STATUS, buf, MAVLINK_MSG_ID_COMPASSMOT_STATUS_MIN_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_CRC); -#else - mavlink_compassmot_status_t *packet = (mavlink_compassmot_status_t *)msgbuf; - packet->current = current; - packet->CompensationX = CompensationX; - packet->CompensationY = CompensationY; - packet->CompensationZ = CompensationZ; - packet->throttle = throttle; - packet->interference = interference; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPASSMOT_STATUS, (const char *)packet, MAVLINK_MSG_ID_COMPASSMOT_STATUS_MIN_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN, MAVLINK_MSG_ID_COMPASSMOT_STATUS_CRC); -#endif -} -#endif - -#endif - -// MESSAGE COMPASSMOT_STATUS UNPACKING - - -/** - * @brief Get field throttle from compassmot_status message - * - * @return [d%] Throttle. - */ -static inline uint16_t mavlink_msg_compassmot_status_get_throttle(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 16); -} - -/** - * @brief Get field current from compassmot_status message - * - * @return [A] Current. - */ -static inline float mavlink_msg_compassmot_status_get_current(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 0); -} - -/** - * @brief Get field interference from compassmot_status message - * - * @return [%] Interference. - */ -static inline uint16_t mavlink_msg_compassmot_status_get_interference(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 18); -} - -/** - * @brief Get field CompensationX from compassmot_status message - * - * @return Motor Compensation X. - */ -static inline float mavlink_msg_compassmot_status_get_CompensationX(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 4); -} - -/** - * @brief Get field CompensationY from compassmot_status message - * - * @return Motor Compensation Y. - */ -static inline float mavlink_msg_compassmot_status_get_CompensationY(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field CompensationZ from compassmot_status message - * - * @return Motor Compensation Z. - */ -static inline float mavlink_msg_compassmot_status_get_CompensationZ(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Decode a compassmot_status message into a struct - * - * @param msg The message to decode - * @param compassmot_status C-struct to decode the message contents into - */ -static inline void mavlink_msg_compassmot_status_decode(const mavlink_message_t* msg, mavlink_compassmot_status_t* compassmot_status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - compassmot_status->current = mavlink_msg_compassmot_status_get_current(msg); - compassmot_status->CompensationX = mavlink_msg_compassmot_status_get_CompensationX(msg); - compassmot_status->CompensationY = mavlink_msg_compassmot_status_get_CompensationY(msg); - compassmot_status->CompensationZ = mavlink_msg_compassmot_status_get_CompensationZ(msg); - compassmot_status->throttle = mavlink_msg_compassmot_status_get_throttle(msg); - compassmot_status->interference = mavlink_msg_compassmot_status_get_interference(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN? msg->len : MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN; - memset(compassmot_status, 0, MAVLINK_MSG_ID_COMPASSMOT_STATUS_LEN); - memcpy(compassmot_status, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_data16.h b/ardupilotmega/mavlink_msg_data16.h deleted file mode 100644 index 3ef331d1a..000000000 --- a/ardupilotmega/mavlink_msg_data16.h +++ /dev/null @@ -1,255 +0,0 @@ -#pragma once -// MESSAGE DATA16 PACKING - -#define MAVLINK_MSG_ID_DATA16 169 - - -typedef struct __mavlink_data16_t { - uint8_t type; /*< Data type.*/ - uint8_t len; /*< [bytes] Data length.*/ - uint8_t data[16]; /*< Raw data.*/ -} mavlink_data16_t; - -#define MAVLINK_MSG_ID_DATA16_LEN 18 -#define MAVLINK_MSG_ID_DATA16_MIN_LEN 18 -#define MAVLINK_MSG_ID_169_LEN 18 -#define MAVLINK_MSG_ID_169_MIN_LEN 18 - -#define MAVLINK_MSG_ID_DATA16_CRC 234 -#define MAVLINK_MSG_ID_169_CRC 234 - -#define MAVLINK_MSG_DATA16_FIELD_DATA_LEN 16 - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_DATA16 { \ - 169, \ - "DATA16", \ - 3, \ - { { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_data16_t, type) }, \ - { "len", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_data16_t, len) }, \ - { "data", NULL, MAVLINK_TYPE_UINT8_T, 16, 2, offsetof(mavlink_data16_t, data) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_DATA16 { \ - "DATA16", \ - 3, \ - { { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_data16_t, type) }, \ - { "len", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_data16_t, len) }, \ - { "data", NULL, MAVLINK_TYPE_UINT8_T, 16, 2, offsetof(mavlink_data16_t, data) }, \ - } \ -} -#endif - -/** - * @brief Pack a data16 message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param type Data type. - * @param len [bytes] Data length. - * @param data Raw data. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_data16_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t type, uint8_t len, const uint8_t *data) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DATA16_LEN]; - _mav_put_uint8_t(buf, 0, type); - _mav_put_uint8_t(buf, 1, len); - _mav_put_uint8_t_array(buf, 2, data, 16); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DATA16_LEN); -#else - mavlink_data16_t packet; - packet.type = type; - packet.len = len; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*16); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DATA16_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_DATA16; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DATA16_MIN_LEN, MAVLINK_MSG_ID_DATA16_LEN, MAVLINK_MSG_ID_DATA16_CRC); -} - -/** - * @brief Pack a data16 message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param type Data type. - * @param len [bytes] Data length. - * @param data Raw data. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_data16_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t type,uint8_t len,const uint8_t *data) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DATA16_LEN]; - _mav_put_uint8_t(buf, 0, type); - _mav_put_uint8_t(buf, 1, len); - _mav_put_uint8_t_array(buf, 2, data, 16); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DATA16_LEN); -#else - mavlink_data16_t packet; - packet.type = type; - packet.len = len; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*16); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DATA16_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_DATA16; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_DATA16_MIN_LEN, MAVLINK_MSG_ID_DATA16_LEN, MAVLINK_MSG_ID_DATA16_CRC); -} - -/** - * @brief Encode a data16 struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param data16 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_data16_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_data16_t* data16) -{ - return mavlink_msg_data16_pack(system_id, component_id, msg, data16->type, data16->len, data16->data); -} - -/** - * @brief Encode a data16 struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param data16 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_data16_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_data16_t* data16) -{ - return mavlink_msg_data16_pack_chan(system_id, component_id, chan, msg, data16->type, data16->len, data16->data); -} - -/** - * @brief Send a data16 message - * @param chan MAVLink channel to send the message - * - * @param type Data type. - * @param len [bytes] Data length. - * @param data Raw data. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_data16_send(mavlink_channel_t chan, uint8_t type, uint8_t len, const uint8_t *data) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DATA16_LEN]; - _mav_put_uint8_t(buf, 0, type); - _mav_put_uint8_t(buf, 1, len); - _mav_put_uint8_t_array(buf, 2, data, 16); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA16, buf, MAVLINK_MSG_ID_DATA16_MIN_LEN, MAVLINK_MSG_ID_DATA16_LEN, MAVLINK_MSG_ID_DATA16_CRC); -#else - mavlink_data16_t packet; - packet.type = type; - packet.len = len; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*16); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA16, (const char *)&packet, MAVLINK_MSG_ID_DATA16_MIN_LEN, MAVLINK_MSG_ID_DATA16_LEN, MAVLINK_MSG_ID_DATA16_CRC); -#endif -} - -/** - * @brief Send a data16 message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_data16_send_struct(mavlink_channel_t chan, const mavlink_data16_t* data16) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_data16_send(chan, data16->type, data16->len, data16->data); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA16, (const char *)data16, MAVLINK_MSG_ID_DATA16_MIN_LEN, MAVLINK_MSG_ID_DATA16_LEN, MAVLINK_MSG_ID_DATA16_CRC); -#endif -} - -#if MAVLINK_MSG_ID_DATA16_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_data16_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t type, uint8_t len, const uint8_t *data) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint8_t(buf, 0, type); - _mav_put_uint8_t(buf, 1, len); - _mav_put_uint8_t_array(buf, 2, data, 16); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA16, buf, MAVLINK_MSG_ID_DATA16_MIN_LEN, MAVLINK_MSG_ID_DATA16_LEN, MAVLINK_MSG_ID_DATA16_CRC); -#else - mavlink_data16_t *packet = (mavlink_data16_t *)msgbuf; - packet->type = type; - packet->len = len; - mav_array_memcpy(packet->data, data, sizeof(uint8_t)*16); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA16, (const char *)packet, MAVLINK_MSG_ID_DATA16_MIN_LEN, MAVLINK_MSG_ID_DATA16_LEN, MAVLINK_MSG_ID_DATA16_CRC); -#endif -} -#endif - -#endif - -// MESSAGE DATA16 UNPACKING - - -/** - * @brief Get field type from data16 message - * - * @return Data type. - */ -static inline uint8_t mavlink_msg_data16_get_type(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 0); -} - -/** - * @brief Get field len from data16 message - * - * @return [bytes] Data length. - */ -static inline uint8_t mavlink_msg_data16_get_len(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 1); -} - -/** - * @brief Get field data from data16 message - * - * @return Raw data. - */ -static inline uint16_t mavlink_msg_data16_get_data(const mavlink_message_t* msg, uint8_t *data) -{ - return _MAV_RETURN_uint8_t_array(msg, data, 16, 2); -} - -/** - * @brief Decode a data16 message into a struct - * - * @param msg The message to decode - * @param data16 C-struct to decode the message contents into - */ -static inline void mavlink_msg_data16_decode(const mavlink_message_t* msg, mavlink_data16_t* data16) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - data16->type = mavlink_msg_data16_get_type(msg); - data16->len = mavlink_msg_data16_get_len(msg); - mavlink_msg_data16_get_data(msg, data16->data); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_DATA16_LEN? msg->len : MAVLINK_MSG_ID_DATA16_LEN; - memset(data16, 0, MAVLINK_MSG_ID_DATA16_LEN); - memcpy(data16, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_data32.h b/ardupilotmega/mavlink_msg_data32.h deleted file mode 100644 index 00fe36894..000000000 --- a/ardupilotmega/mavlink_msg_data32.h +++ /dev/null @@ -1,255 +0,0 @@ -#pragma once -// MESSAGE DATA32 PACKING - -#define MAVLINK_MSG_ID_DATA32 170 - - -typedef struct __mavlink_data32_t { - uint8_t type; /*< Data type.*/ - uint8_t len; /*< [bytes] Data length.*/ - uint8_t data[32]; /*< Raw data.*/ -} mavlink_data32_t; - -#define MAVLINK_MSG_ID_DATA32_LEN 34 -#define MAVLINK_MSG_ID_DATA32_MIN_LEN 34 -#define MAVLINK_MSG_ID_170_LEN 34 -#define MAVLINK_MSG_ID_170_MIN_LEN 34 - -#define MAVLINK_MSG_ID_DATA32_CRC 73 -#define MAVLINK_MSG_ID_170_CRC 73 - -#define MAVLINK_MSG_DATA32_FIELD_DATA_LEN 32 - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_DATA32 { \ - 170, \ - "DATA32", \ - 3, \ - { { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_data32_t, type) }, \ - { "len", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_data32_t, len) }, \ - { "data", NULL, MAVLINK_TYPE_UINT8_T, 32, 2, offsetof(mavlink_data32_t, data) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_DATA32 { \ - "DATA32", \ - 3, \ - { { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_data32_t, type) }, \ - { "len", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_data32_t, len) }, \ - { "data", NULL, MAVLINK_TYPE_UINT8_T, 32, 2, offsetof(mavlink_data32_t, data) }, \ - } \ -} -#endif - -/** - * @brief Pack a data32 message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param type Data type. - * @param len [bytes] Data length. - * @param data Raw data. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_data32_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t type, uint8_t len, const uint8_t *data) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DATA32_LEN]; - _mav_put_uint8_t(buf, 0, type); - _mav_put_uint8_t(buf, 1, len); - _mav_put_uint8_t_array(buf, 2, data, 32); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DATA32_LEN); -#else - mavlink_data32_t packet; - packet.type = type; - packet.len = len; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*32); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DATA32_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_DATA32; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DATA32_MIN_LEN, MAVLINK_MSG_ID_DATA32_LEN, MAVLINK_MSG_ID_DATA32_CRC); -} - -/** - * @brief Pack a data32 message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param type Data type. - * @param len [bytes] Data length. - * @param data Raw data. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_data32_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t type,uint8_t len,const uint8_t *data) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DATA32_LEN]; - _mav_put_uint8_t(buf, 0, type); - _mav_put_uint8_t(buf, 1, len); - _mav_put_uint8_t_array(buf, 2, data, 32); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DATA32_LEN); -#else - mavlink_data32_t packet; - packet.type = type; - packet.len = len; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*32); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DATA32_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_DATA32; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_DATA32_MIN_LEN, MAVLINK_MSG_ID_DATA32_LEN, MAVLINK_MSG_ID_DATA32_CRC); -} - -/** - * @brief Encode a data32 struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param data32 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_data32_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_data32_t* data32) -{ - return mavlink_msg_data32_pack(system_id, component_id, msg, data32->type, data32->len, data32->data); -} - -/** - * @brief Encode a data32 struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param data32 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_data32_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_data32_t* data32) -{ - return mavlink_msg_data32_pack_chan(system_id, component_id, chan, msg, data32->type, data32->len, data32->data); -} - -/** - * @brief Send a data32 message - * @param chan MAVLink channel to send the message - * - * @param type Data type. - * @param len [bytes] Data length. - * @param data Raw data. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_data32_send(mavlink_channel_t chan, uint8_t type, uint8_t len, const uint8_t *data) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DATA32_LEN]; - _mav_put_uint8_t(buf, 0, type); - _mav_put_uint8_t(buf, 1, len); - _mav_put_uint8_t_array(buf, 2, data, 32); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA32, buf, MAVLINK_MSG_ID_DATA32_MIN_LEN, MAVLINK_MSG_ID_DATA32_LEN, MAVLINK_MSG_ID_DATA32_CRC); -#else - mavlink_data32_t packet; - packet.type = type; - packet.len = len; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*32); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA32, (const char *)&packet, MAVLINK_MSG_ID_DATA32_MIN_LEN, MAVLINK_MSG_ID_DATA32_LEN, MAVLINK_MSG_ID_DATA32_CRC); -#endif -} - -/** - * @brief Send a data32 message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_data32_send_struct(mavlink_channel_t chan, const mavlink_data32_t* data32) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_data32_send(chan, data32->type, data32->len, data32->data); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA32, (const char *)data32, MAVLINK_MSG_ID_DATA32_MIN_LEN, MAVLINK_MSG_ID_DATA32_LEN, MAVLINK_MSG_ID_DATA32_CRC); -#endif -} - -#if MAVLINK_MSG_ID_DATA32_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_data32_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t type, uint8_t len, const uint8_t *data) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint8_t(buf, 0, type); - _mav_put_uint8_t(buf, 1, len); - _mav_put_uint8_t_array(buf, 2, data, 32); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA32, buf, MAVLINK_MSG_ID_DATA32_MIN_LEN, MAVLINK_MSG_ID_DATA32_LEN, MAVLINK_MSG_ID_DATA32_CRC); -#else - mavlink_data32_t *packet = (mavlink_data32_t *)msgbuf; - packet->type = type; - packet->len = len; - mav_array_memcpy(packet->data, data, sizeof(uint8_t)*32); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA32, (const char *)packet, MAVLINK_MSG_ID_DATA32_MIN_LEN, MAVLINK_MSG_ID_DATA32_LEN, MAVLINK_MSG_ID_DATA32_CRC); -#endif -} -#endif - -#endif - -// MESSAGE DATA32 UNPACKING - - -/** - * @brief Get field type from data32 message - * - * @return Data type. - */ -static inline uint8_t mavlink_msg_data32_get_type(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 0); -} - -/** - * @brief Get field len from data32 message - * - * @return [bytes] Data length. - */ -static inline uint8_t mavlink_msg_data32_get_len(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 1); -} - -/** - * @brief Get field data from data32 message - * - * @return Raw data. - */ -static inline uint16_t mavlink_msg_data32_get_data(const mavlink_message_t* msg, uint8_t *data) -{ - return _MAV_RETURN_uint8_t_array(msg, data, 32, 2); -} - -/** - * @brief Decode a data32 message into a struct - * - * @param msg The message to decode - * @param data32 C-struct to decode the message contents into - */ -static inline void mavlink_msg_data32_decode(const mavlink_message_t* msg, mavlink_data32_t* data32) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - data32->type = mavlink_msg_data32_get_type(msg); - data32->len = mavlink_msg_data32_get_len(msg); - mavlink_msg_data32_get_data(msg, data32->data); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_DATA32_LEN? msg->len : MAVLINK_MSG_ID_DATA32_LEN; - memset(data32, 0, MAVLINK_MSG_ID_DATA32_LEN); - memcpy(data32, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_data64.h b/ardupilotmega/mavlink_msg_data64.h deleted file mode 100644 index 471e2ce07..000000000 --- a/ardupilotmega/mavlink_msg_data64.h +++ /dev/null @@ -1,255 +0,0 @@ -#pragma once -// MESSAGE DATA64 PACKING - -#define MAVLINK_MSG_ID_DATA64 171 - - -typedef struct __mavlink_data64_t { - uint8_t type; /*< Data type.*/ - uint8_t len; /*< [bytes] Data length.*/ - uint8_t data[64]; /*< Raw data.*/ -} mavlink_data64_t; - -#define MAVLINK_MSG_ID_DATA64_LEN 66 -#define MAVLINK_MSG_ID_DATA64_MIN_LEN 66 -#define MAVLINK_MSG_ID_171_LEN 66 -#define MAVLINK_MSG_ID_171_MIN_LEN 66 - -#define MAVLINK_MSG_ID_DATA64_CRC 181 -#define MAVLINK_MSG_ID_171_CRC 181 - -#define MAVLINK_MSG_DATA64_FIELD_DATA_LEN 64 - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_DATA64 { \ - 171, \ - "DATA64", \ - 3, \ - { { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_data64_t, type) }, \ - { "len", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_data64_t, len) }, \ - { "data", NULL, MAVLINK_TYPE_UINT8_T, 64, 2, offsetof(mavlink_data64_t, data) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_DATA64 { \ - "DATA64", \ - 3, \ - { { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_data64_t, type) }, \ - { "len", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_data64_t, len) }, \ - { "data", NULL, MAVLINK_TYPE_UINT8_T, 64, 2, offsetof(mavlink_data64_t, data) }, \ - } \ -} -#endif - -/** - * @brief Pack a data64 message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param type Data type. - * @param len [bytes] Data length. - * @param data Raw data. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_data64_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t type, uint8_t len, const uint8_t *data) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DATA64_LEN]; - _mav_put_uint8_t(buf, 0, type); - _mav_put_uint8_t(buf, 1, len); - _mav_put_uint8_t_array(buf, 2, data, 64); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DATA64_LEN); -#else - mavlink_data64_t packet; - packet.type = type; - packet.len = len; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*64); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DATA64_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_DATA64; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DATA64_MIN_LEN, MAVLINK_MSG_ID_DATA64_LEN, MAVLINK_MSG_ID_DATA64_CRC); -} - -/** - * @brief Pack a data64 message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param type Data type. - * @param len [bytes] Data length. - * @param data Raw data. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_data64_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t type,uint8_t len,const uint8_t *data) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DATA64_LEN]; - _mav_put_uint8_t(buf, 0, type); - _mav_put_uint8_t(buf, 1, len); - _mav_put_uint8_t_array(buf, 2, data, 64); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DATA64_LEN); -#else - mavlink_data64_t packet; - packet.type = type; - packet.len = len; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*64); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DATA64_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_DATA64; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_DATA64_MIN_LEN, MAVLINK_MSG_ID_DATA64_LEN, MAVLINK_MSG_ID_DATA64_CRC); -} - -/** - * @brief Encode a data64 struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param data64 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_data64_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_data64_t* data64) -{ - return mavlink_msg_data64_pack(system_id, component_id, msg, data64->type, data64->len, data64->data); -} - -/** - * @brief Encode a data64 struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param data64 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_data64_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_data64_t* data64) -{ - return mavlink_msg_data64_pack_chan(system_id, component_id, chan, msg, data64->type, data64->len, data64->data); -} - -/** - * @brief Send a data64 message - * @param chan MAVLink channel to send the message - * - * @param type Data type. - * @param len [bytes] Data length. - * @param data Raw data. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_data64_send(mavlink_channel_t chan, uint8_t type, uint8_t len, const uint8_t *data) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DATA64_LEN]; - _mav_put_uint8_t(buf, 0, type); - _mav_put_uint8_t(buf, 1, len); - _mav_put_uint8_t_array(buf, 2, data, 64); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA64, buf, MAVLINK_MSG_ID_DATA64_MIN_LEN, MAVLINK_MSG_ID_DATA64_LEN, MAVLINK_MSG_ID_DATA64_CRC); -#else - mavlink_data64_t packet; - packet.type = type; - packet.len = len; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*64); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA64, (const char *)&packet, MAVLINK_MSG_ID_DATA64_MIN_LEN, MAVLINK_MSG_ID_DATA64_LEN, MAVLINK_MSG_ID_DATA64_CRC); -#endif -} - -/** - * @brief Send a data64 message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_data64_send_struct(mavlink_channel_t chan, const mavlink_data64_t* data64) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_data64_send(chan, data64->type, data64->len, data64->data); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA64, (const char *)data64, MAVLINK_MSG_ID_DATA64_MIN_LEN, MAVLINK_MSG_ID_DATA64_LEN, MAVLINK_MSG_ID_DATA64_CRC); -#endif -} - -#if MAVLINK_MSG_ID_DATA64_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_data64_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t type, uint8_t len, const uint8_t *data) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint8_t(buf, 0, type); - _mav_put_uint8_t(buf, 1, len); - _mav_put_uint8_t_array(buf, 2, data, 64); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA64, buf, MAVLINK_MSG_ID_DATA64_MIN_LEN, MAVLINK_MSG_ID_DATA64_LEN, MAVLINK_MSG_ID_DATA64_CRC); -#else - mavlink_data64_t *packet = (mavlink_data64_t *)msgbuf; - packet->type = type; - packet->len = len; - mav_array_memcpy(packet->data, data, sizeof(uint8_t)*64); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA64, (const char *)packet, MAVLINK_MSG_ID_DATA64_MIN_LEN, MAVLINK_MSG_ID_DATA64_LEN, MAVLINK_MSG_ID_DATA64_CRC); -#endif -} -#endif - -#endif - -// MESSAGE DATA64 UNPACKING - - -/** - * @brief Get field type from data64 message - * - * @return Data type. - */ -static inline uint8_t mavlink_msg_data64_get_type(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 0); -} - -/** - * @brief Get field len from data64 message - * - * @return [bytes] Data length. - */ -static inline uint8_t mavlink_msg_data64_get_len(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 1); -} - -/** - * @brief Get field data from data64 message - * - * @return Raw data. - */ -static inline uint16_t mavlink_msg_data64_get_data(const mavlink_message_t* msg, uint8_t *data) -{ - return _MAV_RETURN_uint8_t_array(msg, data, 64, 2); -} - -/** - * @brief Decode a data64 message into a struct - * - * @param msg The message to decode - * @param data64 C-struct to decode the message contents into - */ -static inline void mavlink_msg_data64_decode(const mavlink_message_t* msg, mavlink_data64_t* data64) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - data64->type = mavlink_msg_data64_get_type(msg); - data64->len = mavlink_msg_data64_get_len(msg); - mavlink_msg_data64_get_data(msg, data64->data); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_DATA64_LEN? msg->len : MAVLINK_MSG_ID_DATA64_LEN; - memset(data64, 0, MAVLINK_MSG_ID_DATA64_LEN); - memcpy(data64, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_data96.h b/ardupilotmega/mavlink_msg_data96.h deleted file mode 100644 index ec8efe51e..000000000 --- a/ardupilotmega/mavlink_msg_data96.h +++ /dev/null @@ -1,255 +0,0 @@ -#pragma once -// MESSAGE DATA96 PACKING - -#define MAVLINK_MSG_ID_DATA96 172 - - -typedef struct __mavlink_data96_t { - uint8_t type; /*< Data type.*/ - uint8_t len; /*< [bytes] Data length.*/ - uint8_t data[96]; /*< Raw data.*/ -} mavlink_data96_t; - -#define MAVLINK_MSG_ID_DATA96_LEN 98 -#define MAVLINK_MSG_ID_DATA96_MIN_LEN 98 -#define MAVLINK_MSG_ID_172_LEN 98 -#define MAVLINK_MSG_ID_172_MIN_LEN 98 - -#define MAVLINK_MSG_ID_DATA96_CRC 22 -#define MAVLINK_MSG_ID_172_CRC 22 - -#define MAVLINK_MSG_DATA96_FIELD_DATA_LEN 96 - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_DATA96 { \ - 172, \ - "DATA96", \ - 3, \ - { { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_data96_t, type) }, \ - { "len", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_data96_t, len) }, \ - { "data", NULL, MAVLINK_TYPE_UINT8_T, 96, 2, offsetof(mavlink_data96_t, data) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_DATA96 { \ - "DATA96", \ - 3, \ - { { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_data96_t, type) }, \ - { "len", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_data96_t, len) }, \ - { "data", NULL, MAVLINK_TYPE_UINT8_T, 96, 2, offsetof(mavlink_data96_t, data) }, \ - } \ -} -#endif - -/** - * @brief Pack a data96 message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param type Data type. - * @param len [bytes] Data length. - * @param data Raw data. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_data96_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t type, uint8_t len, const uint8_t *data) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DATA96_LEN]; - _mav_put_uint8_t(buf, 0, type); - _mav_put_uint8_t(buf, 1, len); - _mav_put_uint8_t_array(buf, 2, data, 96); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DATA96_LEN); -#else - mavlink_data96_t packet; - packet.type = type; - packet.len = len; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*96); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DATA96_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_DATA96; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DATA96_MIN_LEN, MAVLINK_MSG_ID_DATA96_LEN, MAVLINK_MSG_ID_DATA96_CRC); -} - -/** - * @brief Pack a data96 message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param type Data type. - * @param len [bytes] Data length. - * @param data Raw data. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_data96_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t type,uint8_t len,const uint8_t *data) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DATA96_LEN]; - _mav_put_uint8_t(buf, 0, type); - _mav_put_uint8_t(buf, 1, len); - _mav_put_uint8_t_array(buf, 2, data, 96); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DATA96_LEN); -#else - mavlink_data96_t packet; - packet.type = type; - packet.len = len; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*96); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DATA96_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_DATA96; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_DATA96_MIN_LEN, MAVLINK_MSG_ID_DATA96_LEN, MAVLINK_MSG_ID_DATA96_CRC); -} - -/** - * @brief Encode a data96 struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param data96 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_data96_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_data96_t* data96) -{ - return mavlink_msg_data96_pack(system_id, component_id, msg, data96->type, data96->len, data96->data); -} - -/** - * @brief Encode a data96 struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param data96 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_data96_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_data96_t* data96) -{ - return mavlink_msg_data96_pack_chan(system_id, component_id, chan, msg, data96->type, data96->len, data96->data); -} - -/** - * @brief Send a data96 message - * @param chan MAVLink channel to send the message - * - * @param type Data type. - * @param len [bytes] Data length. - * @param data Raw data. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_data96_send(mavlink_channel_t chan, uint8_t type, uint8_t len, const uint8_t *data) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DATA96_LEN]; - _mav_put_uint8_t(buf, 0, type); - _mav_put_uint8_t(buf, 1, len); - _mav_put_uint8_t_array(buf, 2, data, 96); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA96, buf, MAVLINK_MSG_ID_DATA96_MIN_LEN, MAVLINK_MSG_ID_DATA96_LEN, MAVLINK_MSG_ID_DATA96_CRC); -#else - mavlink_data96_t packet; - packet.type = type; - packet.len = len; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*96); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA96, (const char *)&packet, MAVLINK_MSG_ID_DATA96_MIN_LEN, MAVLINK_MSG_ID_DATA96_LEN, MAVLINK_MSG_ID_DATA96_CRC); -#endif -} - -/** - * @brief Send a data96 message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_data96_send_struct(mavlink_channel_t chan, const mavlink_data96_t* data96) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_data96_send(chan, data96->type, data96->len, data96->data); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA96, (const char *)data96, MAVLINK_MSG_ID_DATA96_MIN_LEN, MAVLINK_MSG_ID_DATA96_LEN, MAVLINK_MSG_ID_DATA96_CRC); -#endif -} - -#if MAVLINK_MSG_ID_DATA96_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_data96_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t type, uint8_t len, const uint8_t *data) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint8_t(buf, 0, type); - _mav_put_uint8_t(buf, 1, len); - _mav_put_uint8_t_array(buf, 2, data, 96); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA96, buf, MAVLINK_MSG_ID_DATA96_MIN_LEN, MAVLINK_MSG_ID_DATA96_LEN, MAVLINK_MSG_ID_DATA96_CRC); -#else - mavlink_data96_t *packet = (mavlink_data96_t *)msgbuf; - packet->type = type; - packet->len = len; - mav_array_memcpy(packet->data, data, sizeof(uint8_t)*96); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA96, (const char *)packet, MAVLINK_MSG_ID_DATA96_MIN_LEN, MAVLINK_MSG_ID_DATA96_LEN, MAVLINK_MSG_ID_DATA96_CRC); -#endif -} -#endif - -#endif - -// MESSAGE DATA96 UNPACKING - - -/** - * @brief Get field type from data96 message - * - * @return Data type. - */ -static inline uint8_t mavlink_msg_data96_get_type(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 0); -} - -/** - * @brief Get field len from data96 message - * - * @return [bytes] Data length. - */ -static inline uint8_t mavlink_msg_data96_get_len(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 1); -} - -/** - * @brief Get field data from data96 message - * - * @return Raw data. - */ -static inline uint16_t mavlink_msg_data96_get_data(const mavlink_message_t* msg, uint8_t *data) -{ - return _MAV_RETURN_uint8_t_array(msg, data, 96, 2); -} - -/** - * @brief Decode a data96 message into a struct - * - * @param msg The message to decode - * @param data96 C-struct to decode the message contents into - */ -static inline void mavlink_msg_data96_decode(const mavlink_message_t* msg, mavlink_data96_t* data96) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - data96->type = mavlink_msg_data96_get_type(msg); - data96->len = mavlink_msg_data96_get_len(msg); - mavlink_msg_data96_get_data(msg, data96->data); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_DATA96_LEN? msg->len : MAVLINK_MSG_ID_DATA96_LEN; - memset(data96, 0, MAVLINK_MSG_ID_DATA96_LEN); - memcpy(data96, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_deepstall.h b/ardupilotmega/mavlink_msg_deepstall.h deleted file mode 100644 index e3961642a..000000000 --- a/ardupilotmega/mavlink_msg_deepstall.h +++ /dev/null @@ -1,438 +0,0 @@ -#pragma once -// MESSAGE DEEPSTALL PACKING - -#define MAVLINK_MSG_ID_DEEPSTALL 195 - - -typedef struct __mavlink_deepstall_t { - int32_t landing_lat; /*< [degE7] Landing latitude.*/ - int32_t landing_lon; /*< [degE7] Landing longitude.*/ - int32_t path_lat; /*< [degE7] Final heading start point, latitude.*/ - int32_t path_lon; /*< [degE7] Final heading start point, longitude.*/ - int32_t arc_entry_lat; /*< [degE7] Arc entry point, latitude.*/ - int32_t arc_entry_lon; /*< [degE7] Arc entry point, longitude.*/ - float altitude; /*< [m] Altitude.*/ - float expected_travel_distance; /*< [m] Distance the aircraft expects to travel during the deepstall.*/ - float cross_track_error; /*< [m] Deepstall cross track error (only valid when in DEEPSTALL_STAGE_LAND).*/ - uint8_t stage; /*< Deepstall stage.*/ -} mavlink_deepstall_t; - -#define MAVLINK_MSG_ID_DEEPSTALL_LEN 37 -#define MAVLINK_MSG_ID_DEEPSTALL_MIN_LEN 37 -#define MAVLINK_MSG_ID_195_LEN 37 -#define MAVLINK_MSG_ID_195_MIN_LEN 37 - -#define MAVLINK_MSG_ID_DEEPSTALL_CRC 120 -#define MAVLINK_MSG_ID_195_CRC 120 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_DEEPSTALL { \ - 195, \ - "DEEPSTALL", \ - 10, \ - { { "landing_lat", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_deepstall_t, landing_lat) }, \ - { "landing_lon", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_deepstall_t, landing_lon) }, \ - { "path_lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_deepstall_t, path_lat) }, \ - { "path_lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_deepstall_t, path_lon) }, \ - { "arc_entry_lat", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_deepstall_t, arc_entry_lat) }, \ - { "arc_entry_lon", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_deepstall_t, arc_entry_lon) }, \ - { "altitude", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_deepstall_t, altitude) }, \ - { "expected_travel_distance", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_deepstall_t, expected_travel_distance) }, \ - { "cross_track_error", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_deepstall_t, cross_track_error) }, \ - { "stage", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_deepstall_t, stage) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_DEEPSTALL { \ - "DEEPSTALL", \ - 10, \ - { { "landing_lat", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_deepstall_t, landing_lat) }, \ - { "landing_lon", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_deepstall_t, landing_lon) }, \ - { "path_lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_deepstall_t, path_lat) }, \ - { "path_lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_deepstall_t, path_lon) }, \ - { "arc_entry_lat", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_deepstall_t, arc_entry_lat) }, \ - { "arc_entry_lon", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_deepstall_t, arc_entry_lon) }, \ - { "altitude", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_deepstall_t, altitude) }, \ - { "expected_travel_distance", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_deepstall_t, expected_travel_distance) }, \ - { "cross_track_error", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_deepstall_t, cross_track_error) }, \ - { "stage", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_deepstall_t, stage) }, \ - } \ -} -#endif - -/** - * @brief Pack a deepstall message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param landing_lat [degE7] Landing latitude. - * @param landing_lon [degE7] Landing longitude. - * @param path_lat [degE7] Final heading start point, latitude. - * @param path_lon [degE7] Final heading start point, longitude. - * @param arc_entry_lat [degE7] Arc entry point, latitude. - * @param arc_entry_lon [degE7] Arc entry point, longitude. - * @param altitude [m] Altitude. - * @param expected_travel_distance [m] Distance the aircraft expects to travel during the deepstall. - * @param cross_track_error [m] Deepstall cross track error (only valid when in DEEPSTALL_STAGE_LAND). - * @param stage Deepstall stage. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_deepstall_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - int32_t landing_lat, int32_t landing_lon, int32_t path_lat, int32_t path_lon, int32_t arc_entry_lat, int32_t arc_entry_lon, float altitude, float expected_travel_distance, float cross_track_error, uint8_t stage) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DEEPSTALL_LEN]; - _mav_put_int32_t(buf, 0, landing_lat); - _mav_put_int32_t(buf, 4, landing_lon); - _mav_put_int32_t(buf, 8, path_lat); - _mav_put_int32_t(buf, 12, path_lon); - _mav_put_int32_t(buf, 16, arc_entry_lat); - _mav_put_int32_t(buf, 20, arc_entry_lon); - _mav_put_float(buf, 24, altitude); - _mav_put_float(buf, 28, expected_travel_distance); - _mav_put_float(buf, 32, cross_track_error); - _mav_put_uint8_t(buf, 36, stage); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DEEPSTALL_LEN); -#else - mavlink_deepstall_t packet; - packet.landing_lat = landing_lat; - packet.landing_lon = landing_lon; - packet.path_lat = path_lat; - packet.path_lon = path_lon; - packet.arc_entry_lat = arc_entry_lat; - packet.arc_entry_lon = arc_entry_lon; - packet.altitude = altitude; - packet.expected_travel_distance = expected_travel_distance; - packet.cross_track_error = cross_track_error; - packet.stage = stage; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DEEPSTALL_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_DEEPSTALL; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DEEPSTALL_MIN_LEN, MAVLINK_MSG_ID_DEEPSTALL_LEN, MAVLINK_MSG_ID_DEEPSTALL_CRC); -} - -/** - * @brief Pack a deepstall message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param landing_lat [degE7] Landing latitude. - * @param landing_lon [degE7] Landing longitude. - * @param path_lat [degE7] Final heading start point, latitude. - * @param path_lon [degE7] Final heading start point, longitude. - * @param arc_entry_lat [degE7] Arc entry point, latitude. - * @param arc_entry_lon [degE7] Arc entry point, longitude. - * @param altitude [m] Altitude. - * @param expected_travel_distance [m] Distance the aircraft expects to travel during the deepstall. - * @param cross_track_error [m] Deepstall cross track error (only valid when in DEEPSTALL_STAGE_LAND). - * @param stage Deepstall stage. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_deepstall_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - int32_t landing_lat,int32_t landing_lon,int32_t path_lat,int32_t path_lon,int32_t arc_entry_lat,int32_t arc_entry_lon,float altitude,float expected_travel_distance,float cross_track_error,uint8_t stage) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DEEPSTALL_LEN]; - _mav_put_int32_t(buf, 0, landing_lat); - _mav_put_int32_t(buf, 4, landing_lon); - _mav_put_int32_t(buf, 8, path_lat); - _mav_put_int32_t(buf, 12, path_lon); - _mav_put_int32_t(buf, 16, arc_entry_lat); - _mav_put_int32_t(buf, 20, arc_entry_lon); - _mav_put_float(buf, 24, altitude); - _mav_put_float(buf, 28, expected_travel_distance); - _mav_put_float(buf, 32, cross_track_error); - _mav_put_uint8_t(buf, 36, stage); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DEEPSTALL_LEN); -#else - mavlink_deepstall_t packet; - packet.landing_lat = landing_lat; - packet.landing_lon = landing_lon; - packet.path_lat = path_lat; - packet.path_lon = path_lon; - packet.arc_entry_lat = arc_entry_lat; - packet.arc_entry_lon = arc_entry_lon; - packet.altitude = altitude; - packet.expected_travel_distance = expected_travel_distance; - packet.cross_track_error = cross_track_error; - packet.stage = stage; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DEEPSTALL_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_DEEPSTALL; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_DEEPSTALL_MIN_LEN, MAVLINK_MSG_ID_DEEPSTALL_LEN, MAVLINK_MSG_ID_DEEPSTALL_CRC); -} - -/** - * @brief Encode a deepstall struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param deepstall C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_deepstall_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_deepstall_t* deepstall) -{ - return mavlink_msg_deepstall_pack(system_id, component_id, msg, deepstall->landing_lat, deepstall->landing_lon, deepstall->path_lat, deepstall->path_lon, deepstall->arc_entry_lat, deepstall->arc_entry_lon, deepstall->altitude, deepstall->expected_travel_distance, deepstall->cross_track_error, deepstall->stage); -} - -/** - * @brief Encode a deepstall struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param deepstall C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_deepstall_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_deepstall_t* deepstall) -{ - return mavlink_msg_deepstall_pack_chan(system_id, component_id, chan, msg, deepstall->landing_lat, deepstall->landing_lon, deepstall->path_lat, deepstall->path_lon, deepstall->arc_entry_lat, deepstall->arc_entry_lon, deepstall->altitude, deepstall->expected_travel_distance, deepstall->cross_track_error, deepstall->stage); -} - -/** - * @brief Send a deepstall message - * @param chan MAVLink channel to send the message - * - * @param landing_lat [degE7] Landing latitude. - * @param landing_lon [degE7] Landing longitude. - * @param path_lat [degE7] Final heading start point, latitude. - * @param path_lon [degE7] Final heading start point, longitude. - * @param arc_entry_lat [degE7] Arc entry point, latitude. - * @param arc_entry_lon [degE7] Arc entry point, longitude. - * @param altitude [m] Altitude. - * @param expected_travel_distance [m] Distance the aircraft expects to travel during the deepstall. - * @param cross_track_error [m] Deepstall cross track error (only valid when in DEEPSTALL_STAGE_LAND). - * @param stage Deepstall stage. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_deepstall_send(mavlink_channel_t chan, int32_t landing_lat, int32_t landing_lon, int32_t path_lat, int32_t path_lon, int32_t arc_entry_lat, int32_t arc_entry_lon, float altitude, float expected_travel_distance, float cross_track_error, uint8_t stage) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DEEPSTALL_LEN]; - _mav_put_int32_t(buf, 0, landing_lat); - _mav_put_int32_t(buf, 4, landing_lon); - _mav_put_int32_t(buf, 8, path_lat); - _mav_put_int32_t(buf, 12, path_lon); - _mav_put_int32_t(buf, 16, arc_entry_lat); - _mav_put_int32_t(buf, 20, arc_entry_lon); - _mav_put_float(buf, 24, altitude); - _mav_put_float(buf, 28, expected_travel_distance); - _mav_put_float(buf, 32, cross_track_error); - _mav_put_uint8_t(buf, 36, stage); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEEPSTALL, buf, MAVLINK_MSG_ID_DEEPSTALL_MIN_LEN, MAVLINK_MSG_ID_DEEPSTALL_LEN, MAVLINK_MSG_ID_DEEPSTALL_CRC); -#else - mavlink_deepstall_t packet; - packet.landing_lat = landing_lat; - packet.landing_lon = landing_lon; - packet.path_lat = path_lat; - packet.path_lon = path_lon; - packet.arc_entry_lat = arc_entry_lat; - packet.arc_entry_lon = arc_entry_lon; - packet.altitude = altitude; - packet.expected_travel_distance = expected_travel_distance; - packet.cross_track_error = cross_track_error; - packet.stage = stage; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEEPSTALL, (const char *)&packet, MAVLINK_MSG_ID_DEEPSTALL_MIN_LEN, MAVLINK_MSG_ID_DEEPSTALL_LEN, MAVLINK_MSG_ID_DEEPSTALL_CRC); -#endif -} - -/** - * @brief Send a deepstall message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_deepstall_send_struct(mavlink_channel_t chan, const mavlink_deepstall_t* deepstall) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_deepstall_send(chan, deepstall->landing_lat, deepstall->landing_lon, deepstall->path_lat, deepstall->path_lon, deepstall->arc_entry_lat, deepstall->arc_entry_lon, deepstall->altitude, deepstall->expected_travel_distance, deepstall->cross_track_error, deepstall->stage); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEEPSTALL, (const char *)deepstall, MAVLINK_MSG_ID_DEEPSTALL_MIN_LEN, MAVLINK_MSG_ID_DEEPSTALL_LEN, MAVLINK_MSG_ID_DEEPSTALL_CRC); -#endif -} - -#if MAVLINK_MSG_ID_DEEPSTALL_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_deepstall_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, int32_t landing_lat, int32_t landing_lon, int32_t path_lat, int32_t path_lon, int32_t arc_entry_lat, int32_t arc_entry_lon, float altitude, float expected_travel_distance, float cross_track_error, uint8_t stage) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_int32_t(buf, 0, landing_lat); - _mav_put_int32_t(buf, 4, landing_lon); - _mav_put_int32_t(buf, 8, path_lat); - _mav_put_int32_t(buf, 12, path_lon); - _mav_put_int32_t(buf, 16, arc_entry_lat); - _mav_put_int32_t(buf, 20, arc_entry_lon); - _mav_put_float(buf, 24, altitude); - _mav_put_float(buf, 28, expected_travel_distance); - _mav_put_float(buf, 32, cross_track_error); - _mav_put_uint8_t(buf, 36, stage); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEEPSTALL, buf, MAVLINK_MSG_ID_DEEPSTALL_MIN_LEN, MAVLINK_MSG_ID_DEEPSTALL_LEN, MAVLINK_MSG_ID_DEEPSTALL_CRC); -#else - mavlink_deepstall_t *packet = (mavlink_deepstall_t *)msgbuf; - packet->landing_lat = landing_lat; - packet->landing_lon = landing_lon; - packet->path_lat = path_lat; - packet->path_lon = path_lon; - packet->arc_entry_lat = arc_entry_lat; - packet->arc_entry_lon = arc_entry_lon; - packet->altitude = altitude; - packet->expected_travel_distance = expected_travel_distance; - packet->cross_track_error = cross_track_error; - packet->stage = stage; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEEPSTALL, (const char *)packet, MAVLINK_MSG_ID_DEEPSTALL_MIN_LEN, MAVLINK_MSG_ID_DEEPSTALL_LEN, MAVLINK_MSG_ID_DEEPSTALL_CRC); -#endif -} -#endif - -#endif - -// MESSAGE DEEPSTALL UNPACKING - - -/** - * @brief Get field landing_lat from deepstall message - * - * @return [degE7] Landing latitude. - */ -static inline int32_t mavlink_msg_deepstall_get_landing_lat(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 0); -} - -/** - * @brief Get field landing_lon from deepstall message - * - * @return [degE7] Landing longitude. - */ -static inline int32_t mavlink_msg_deepstall_get_landing_lon(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 4); -} - -/** - * @brief Get field path_lat from deepstall message - * - * @return [degE7] Final heading start point, latitude. - */ -static inline int32_t mavlink_msg_deepstall_get_path_lat(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 8); -} - -/** - * @brief Get field path_lon from deepstall message - * - * @return [degE7] Final heading start point, longitude. - */ -static inline int32_t mavlink_msg_deepstall_get_path_lon(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 12); -} - -/** - * @brief Get field arc_entry_lat from deepstall message - * - * @return [degE7] Arc entry point, latitude. - */ -static inline int32_t mavlink_msg_deepstall_get_arc_entry_lat(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 16); -} - -/** - * @brief Get field arc_entry_lon from deepstall message - * - * @return [degE7] Arc entry point, longitude. - */ -static inline int32_t mavlink_msg_deepstall_get_arc_entry_lon(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 20); -} - -/** - * @brief Get field altitude from deepstall message - * - * @return [m] Altitude. - */ -static inline float mavlink_msg_deepstall_get_altitude(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 24); -} - -/** - * @brief Get field expected_travel_distance from deepstall message - * - * @return [m] Distance the aircraft expects to travel during the deepstall. - */ -static inline float mavlink_msg_deepstall_get_expected_travel_distance(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 28); -} - -/** - * @brief Get field cross_track_error from deepstall message - * - * @return [m] Deepstall cross track error (only valid when in DEEPSTALL_STAGE_LAND). - */ -static inline float mavlink_msg_deepstall_get_cross_track_error(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 32); -} - -/** - * @brief Get field stage from deepstall message - * - * @return Deepstall stage. - */ -static inline uint8_t mavlink_msg_deepstall_get_stage(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 36); -} - -/** - * @brief Decode a deepstall message into a struct - * - * @param msg The message to decode - * @param deepstall C-struct to decode the message contents into - */ -static inline void mavlink_msg_deepstall_decode(const mavlink_message_t* msg, mavlink_deepstall_t* deepstall) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - deepstall->landing_lat = mavlink_msg_deepstall_get_landing_lat(msg); - deepstall->landing_lon = mavlink_msg_deepstall_get_landing_lon(msg); - deepstall->path_lat = mavlink_msg_deepstall_get_path_lat(msg); - deepstall->path_lon = mavlink_msg_deepstall_get_path_lon(msg); - deepstall->arc_entry_lat = mavlink_msg_deepstall_get_arc_entry_lat(msg); - deepstall->arc_entry_lon = mavlink_msg_deepstall_get_arc_entry_lon(msg); - deepstall->altitude = mavlink_msg_deepstall_get_altitude(msg); - deepstall->expected_travel_distance = mavlink_msg_deepstall_get_expected_travel_distance(msg); - deepstall->cross_track_error = mavlink_msg_deepstall_get_cross_track_error(msg); - deepstall->stage = mavlink_msg_deepstall_get_stage(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_DEEPSTALL_LEN? msg->len : MAVLINK_MSG_ID_DEEPSTALL_LEN; - memset(deepstall, 0, MAVLINK_MSG_ID_DEEPSTALL_LEN); - memcpy(deepstall, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_device_op_read.h b/ardupilotmega/mavlink_msg_device_op_read.h deleted file mode 100644 index d9923152c..000000000 --- a/ardupilotmega/mavlink_msg_device_op_read.h +++ /dev/null @@ -1,430 +0,0 @@ -#pragma once -// MESSAGE DEVICE_OP_READ PACKING - -#define MAVLINK_MSG_ID_DEVICE_OP_READ 11000 - - -typedef struct __mavlink_device_op_read_t { - uint32_t request_id; /*< Request ID - copied to reply.*/ - uint8_t target_system; /*< System ID.*/ - uint8_t target_component; /*< Component ID.*/ - uint8_t bustype; /*< The bus type.*/ - uint8_t bus; /*< Bus number.*/ - uint8_t address; /*< Bus address.*/ - char busname[40]; /*< Name of device on bus (for SPI).*/ - uint8_t regstart; /*< First register to read.*/ - uint8_t count; /*< Count of registers to read.*/ - uint8_t bank; /*< Bank number.*/ -} mavlink_device_op_read_t; - -#define MAVLINK_MSG_ID_DEVICE_OP_READ_LEN 52 -#define MAVLINK_MSG_ID_DEVICE_OP_READ_MIN_LEN 51 -#define MAVLINK_MSG_ID_11000_LEN 52 -#define MAVLINK_MSG_ID_11000_MIN_LEN 51 - -#define MAVLINK_MSG_ID_DEVICE_OP_READ_CRC 134 -#define MAVLINK_MSG_ID_11000_CRC 134 - -#define MAVLINK_MSG_DEVICE_OP_READ_FIELD_BUSNAME_LEN 40 - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_DEVICE_OP_READ { \ - 11000, \ - "DEVICE_OP_READ", \ - 10, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_device_op_read_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_device_op_read_t, target_component) }, \ - { "request_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_device_op_read_t, request_id) }, \ - { "bustype", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_device_op_read_t, bustype) }, \ - { "bus", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_device_op_read_t, bus) }, \ - { "address", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_device_op_read_t, address) }, \ - { "busname", NULL, MAVLINK_TYPE_CHAR, 40, 9, offsetof(mavlink_device_op_read_t, busname) }, \ - { "regstart", NULL, MAVLINK_TYPE_UINT8_T, 0, 49, offsetof(mavlink_device_op_read_t, regstart) }, \ - { "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 50, offsetof(mavlink_device_op_read_t, count) }, \ - { "bank", NULL, MAVLINK_TYPE_UINT8_T, 0, 51, offsetof(mavlink_device_op_read_t, bank) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_DEVICE_OP_READ { \ - "DEVICE_OP_READ", \ - 10, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_device_op_read_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_device_op_read_t, target_component) }, \ - { "request_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_device_op_read_t, request_id) }, \ - { "bustype", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_device_op_read_t, bustype) }, \ - { "bus", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_device_op_read_t, bus) }, \ - { "address", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_device_op_read_t, address) }, \ - { "busname", NULL, MAVLINK_TYPE_CHAR, 40, 9, offsetof(mavlink_device_op_read_t, busname) }, \ - { "regstart", NULL, MAVLINK_TYPE_UINT8_T, 0, 49, offsetof(mavlink_device_op_read_t, regstart) }, \ - { "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 50, offsetof(mavlink_device_op_read_t, count) }, \ - { "bank", NULL, MAVLINK_TYPE_UINT8_T, 0, 51, offsetof(mavlink_device_op_read_t, bank) }, \ - } \ -} -#endif - -/** - * @brief Pack a device_op_read message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param target_system System ID. - * @param target_component Component ID. - * @param request_id Request ID - copied to reply. - * @param bustype The bus type. - * @param bus Bus number. - * @param address Bus address. - * @param busname Name of device on bus (for SPI). - * @param regstart First register to read. - * @param count Count of registers to read. - * @param bank Bank number. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_device_op_read_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, uint32_t request_id, uint8_t bustype, uint8_t bus, uint8_t address, const char *busname, uint8_t regstart, uint8_t count, uint8_t bank) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DEVICE_OP_READ_LEN]; - _mav_put_uint32_t(buf, 0, request_id); - _mav_put_uint8_t(buf, 4, target_system); - _mav_put_uint8_t(buf, 5, target_component); - _mav_put_uint8_t(buf, 6, bustype); - _mav_put_uint8_t(buf, 7, bus); - _mav_put_uint8_t(buf, 8, address); - _mav_put_uint8_t(buf, 49, regstart); - _mav_put_uint8_t(buf, 50, count); - _mav_put_uint8_t(buf, 51, bank); - _mav_put_char_array(buf, 9, busname, 40); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DEVICE_OP_READ_LEN); -#else - mavlink_device_op_read_t packet; - packet.request_id = request_id; - packet.target_system = target_system; - packet.target_component = target_component; - packet.bustype = bustype; - packet.bus = bus; - packet.address = address; - packet.regstart = regstart; - packet.count = count; - packet.bank = bank; - mav_array_memcpy(packet.busname, busname, sizeof(char)*40); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DEVICE_OP_READ_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_DEVICE_OP_READ; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DEVICE_OP_READ_MIN_LEN, MAVLINK_MSG_ID_DEVICE_OP_READ_LEN, MAVLINK_MSG_ID_DEVICE_OP_READ_CRC); -} - -/** - * @brief Pack a device_op_read message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param target_system System ID. - * @param target_component Component ID. - * @param request_id Request ID - copied to reply. - * @param bustype The bus type. - * @param bus Bus number. - * @param address Bus address. - * @param busname Name of device on bus (for SPI). - * @param regstart First register to read. - * @param count Count of registers to read. - * @param bank Bank number. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_device_op_read_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,uint32_t request_id,uint8_t bustype,uint8_t bus,uint8_t address,const char *busname,uint8_t regstart,uint8_t count,uint8_t bank) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DEVICE_OP_READ_LEN]; - _mav_put_uint32_t(buf, 0, request_id); - _mav_put_uint8_t(buf, 4, target_system); - _mav_put_uint8_t(buf, 5, target_component); - _mav_put_uint8_t(buf, 6, bustype); - _mav_put_uint8_t(buf, 7, bus); - _mav_put_uint8_t(buf, 8, address); - _mav_put_uint8_t(buf, 49, regstart); - _mav_put_uint8_t(buf, 50, count); - _mav_put_uint8_t(buf, 51, bank); - _mav_put_char_array(buf, 9, busname, 40); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DEVICE_OP_READ_LEN); -#else - mavlink_device_op_read_t packet; - packet.request_id = request_id; - packet.target_system = target_system; - packet.target_component = target_component; - packet.bustype = bustype; - packet.bus = bus; - packet.address = address; - packet.regstart = regstart; - packet.count = count; - packet.bank = bank; - mav_array_memcpy(packet.busname, busname, sizeof(char)*40); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DEVICE_OP_READ_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_DEVICE_OP_READ; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_DEVICE_OP_READ_MIN_LEN, MAVLINK_MSG_ID_DEVICE_OP_READ_LEN, MAVLINK_MSG_ID_DEVICE_OP_READ_CRC); -} - -/** - * @brief Encode a device_op_read struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param device_op_read C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_device_op_read_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_device_op_read_t* device_op_read) -{ - return mavlink_msg_device_op_read_pack(system_id, component_id, msg, device_op_read->target_system, device_op_read->target_component, device_op_read->request_id, device_op_read->bustype, device_op_read->bus, device_op_read->address, device_op_read->busname, device_op_read->regstart, device_op_read->count, device_op_read->bank); -} - -/** - * @brief Encode a device_op_read struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param device_op_read C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_device_op_read_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_device_op_read_t* device_op_read) -{ - return mavlink_msg_device_op_read_pack_chan(system_id, component_id, chan, msg, device_op_read->target_system, device_op_read->target_component, device_op_read->request_id, device_op_read->bustype, device_op_read->bus, device_op_read->address, device_op_read->busname, device_op_read->regstart, device_op_read->count, device_op_read->bank); -} - -/** - * @brief Send a device_op_read message - * @param chan MAVLink channel to send the message - * - * @param target_system System ID. - * @param target_component Component ID. - * @param request_id Request ID - copied to reply. - * @param bustype The bus type. - * @param bus Bus number. - * @param address Bus address. - * @param busname Name of device on bus (for SPI). - * @param regstart First register to read. - * @param count Count of registers to read. - * @param bank Bank number. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_device_op_read_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint32_t request_id, uint8_t bustype, uint8_t bus, uint8_t address, const char *busname, uint8_t regstart, uint8_t count, uint8_t bank) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DEVICE_OP_READ_LEN]; - _mav_put_uint32_t(buf, 0, request_id); - _mav_put_uint8_t(buf, 4, target_system); - _mav_put_uint8_t(buf, 5, target_component); - _mav_put_uint8_t(buf, 6, bustype); - _mav_put_uint8_t(buf, 7, bus); - _mav_put_uint8_t(buf, 8, address); - _mav_put_uint8_t(buf, 49, regstart); - _mav_put_uint8_t(buf, 50, count); - _mav_put_uint8_t(buf, 51, bank); - _mav_put_char_array(buf, 9, busname, 40); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEVICE_OP_READ, buf, MAVLINK_MSG_ID_DEVICE_OP_READ_MIN_LEN, MAVLINK_MSG_ID_DEVICE_OP_READ_LEN, MAVLINK_MSG_ID_DEVICE_OP_READ_CRC); -#else - mavlink_device_op_read_t packet; - packet.request_id = request_id; - packet.target_system = target_system; - packet.target_component = target_component; - packet.bustype = bustype; - packet.bus = bus; - packet.address = address; - packet.regstart = regstart; - packet.count = count; - packet.bank = bank; - mav_array_memcpy(packet.busname, busname, sizeof(char)*40); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEVICE_OP_READ, (const char *)&packet, MAVLINK_MSG_ID_DEVICE_OP_READ_MIN_LEN, MAVLINK_MSG_ID_DEVICE_OP_READ_LEN, MAVLINK_MSG_ID_DEVICE_OP_READ_CRC); -#endif -} - -/** - * @brief Send a device_op_read message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_device_op_read_send_struct(mavlink_channel_t chan, const mavlink_device_op_read_t* device_op_read) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_device_op_read_send(chan, device_op_read->target_system, device_op_read->target_component, device_op_read->request_id, device_op_read->bustype, device_op_read->bus, device_op_read->address, device_op_read->busname, device_op_read->regstart, device_op_read->count, device_op_read->bank); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEVICE_OP_READ, (const char *)device_op_read, MAVLINK_MSG_ID_DEVICE_OP_READ_MIN_LEN, MAVLINK_MSG_ID_DEVICE_OP_READ_LEN, MAVLINK_MSG_ID_DEVICE_OP_READ_CRC); -#endif -} - -#if MAVLINK_MSG_ID_DEVICE_OP_READ_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_device_op_read_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint32_t request_id, uint8_t bustype, uint8_t bus, uint8_t address, const char *busname, uint8_t regstart, uint8_t count, uint8_t bank) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint32_t(buf, 0, request_id); - _mav_put_uint8_t(buf, 4, target_system); - _mav_put_uint8_t(buf, 5, target_component); - _mav_put_uint8_t(buf, 6, bustype); - _mav_put_uint8_t(buf, 7, bus); - _mav_put_uint8_t(buf, 8, address); - _mav_put_uint8_t(buf, 49, regstart); - _mav_put_uint8_t(buf, 50, count); - _mav_put_uint8_t(buf, 51, bank); - _mav_put_char_array(buf, 9, busname, 40); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEVICE_OP_READ, buf, MAVLINK_MSG_ID_DEVICE_OP_READ_MIN_LEN, MAVLINK_MSG_ID_DEVICE_OP_READ_LEN, MAVLINK_MSG_ID_DEVICE_OP_READ_CRC); -#else - mavlink_device_op_read_t *packet = (mavlink_device_op_read_t *)msgbuf; - packet->request_id = request_id; - packet->target_system = target_system; - packet->target_component = target_component; - packet->bustype = bustype; - packet->bus = bus; - packet->address = address; - packet->regstart = regstart; - packet->count = count; - packet->bank = bank; - mav_array_memcpy(packet->busname, busname, sizeof(char)*40); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEVICE_OP_READ, (const char *)packet, MAVLINK_MSG_ID_DEVICE_OP_READ_MIN_LEN, MAVLINK_MSG_ID_DEVICE_OP_READ_LEN, MAVLINK_MSG_ID_DEVICE_OP_READ_CRC); -#endif -} -#endif - -#endif - -// MESSAGE DEVICE_OP_READ UNPACKING - - -/** - * @brief Get field target_system from device_op_read message - * - * @return System ID. - */ -static inline uint8_t mavlink_msg_device_op_read_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 4); -} - -/** - * @brief Get field target_component from device_op_read message - * - * @return Component ID. - */ -static inline uint8_t mavlink_msg_device_op_read_get_target_component(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 5); -} - -/** - * @brief Get field request_id from device_op_read message - * - * @return Request ID - copied to reply. - */ -static inline uint32_t mavlink_msg_device_op_read_get_request_id(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 0); -} - -/** - * @brief Get field bustype from device_op_read message - * - * @return The bus type. - */ -static inline uint8_t mavlink_msg_device_op_read_get_bustype(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 6); -} - -/** - * @brief Get field bus from device_op_read message - * - * @return Bus number. - */ -static inline uint8_t mavlink_msg_device_op_read_get_bus(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 7); -} - -/** - * @brief Get field address from device_op_read message - * - * @return Bus address. - */ -static inline uint8_t mavlink_msg_device_op_read_get_address(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 8); -} - -/** - * @brief Get field busname from device_op_read message - * - * @return Name of device on bus (for SPI). - */ -static inline uint16_t mavlink_msg_device_op_read_get_busname(const mavlink_message_t* msg, char *busname) -{ - return _MAV_RETURN_char_array(msg, busname, 40, 9); -} - -/** - * @brief Get field regstart from device_op_read message - * - * @return First register to read. - */ -static inline uint8_t mavlink_msg_device_op_read_get_regstart(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 49); -} - -/** - * @brief Get field count from device_op_read message - * - * @return Count of registers to read. - */ -static inline uint8_t mavlink_msg_device_op_read_get_count(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 50); -} - -/** - * @brief Get field bank from device_op_read message - * - * @return Bank number. - */ -static inline uint8_t mavlink_msg_device_op_read_get_bank(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 51); -} - -/** - * @brief Decode a device_op_read message into a struct - * - * @param msg The message to decode - * @param device_op_read C-struct to decode the message contents into - */ -static inline void mavlink_msg_device_op_read_decode(const mavlink_message_t* msg, mavlink_device_op_read_t* device_op_read) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - device_op_read->request_id = mavlink_msg_device_op_read_get_request_id(msg); - device_op_read->target_system = mavlink_msg_device_op_read_get_target_system(msg); - device_op_read->target_component = mavlink_msg_device_op_read_get_target_component(msg); - device_op_read->bustype = mavlink_msg_device_op_read_get_bustype(msg); - device_op_read->bus = mavlink_msg_device_op_read_get_bus(msg); - device_op_read->address = mavlink_msg_device_op_read_get_address(msg); - mavlink_msg_device_op_read_get_busname(msg, device_op_read->busname); - device_op_read->regstart = mavlink_msg_device_op_read_get_regstart(msg); - device_op_read->count = mavlink_msg_device_op_read_get_count(msg); - device_op_read->bank = mavlink_msg_device_op_read_get_bank(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_DEVICE_OP_READ_LEN? msg->len : MAVLINK_MSG_ID_DEVICE_OP_READ_LEN; - memset(device_op_read, 0, MAVLINK_MSG_ID_DEVICE_OP_READ_LEN); - memcpy(device_op_read, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_device_op_read_reply.h b/ardupilotmega/mavlink_msg_device_op_read_reply.h deleted file mode 100644 index f5f056f22..000000000 --- a/ardupilotmega/mavlink_msg_device_op_read_reply.h +++ /dev/null @@ -1,330 +0,0 @@ -#pragma once -// MESSAGE DEVICE_OP_READ_REPLY PACKING - -#define MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY 11001 - - -typedef struct __mavlink_device_op_read_reply_t { - uint32_t request_id; /*< Request ID - copied from request.*/ - uint8_t result; /*< 0 for success, anything else is failure code.*/ - uint8_t regstart; /*< Starting register.*/ - uint8_t count; /*< Count of bytes read.*/ - uint8_t data[128]; /*< Reply data.*/ - uint8_t bank; /*< Bank number.*/ -} mavlink_device_op_read_reply_t; - -#define MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_LEN 136 -#define MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_MIN_LEN 135 -#define MAVLINK_MSG_ID_11001_LEN 136 -#define MAVLINK_MSG_ID_11001_MIN_LEN 135 - -#define MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_CRC 15 -#define MAVLINK_MSG_ID_11001_CRC 15 - -#define MAVLINK_MSG_DEVICE_OP_READ_REPLY_FIELD_DATA_LEN 128 - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_DEVICE_OP_READ_REPLY { \ - 11001, \ - "DEVICE_OP_READ_REPLY", \ - 6, \ - { { "request_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_device_op_read_reply_t, request_id) }, \ - { "result", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_device_op_read_reply_t, result) }, \ - { "regstart", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_device_op_read_reply_t, regstart) }, \ - { "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_device_op_read_reply_t, count) }, \ - { "data", NULL, MAVLINK_TYPE_UINT8_T, 128, 7, offsetof(mavlink_device_op_read_reply_t, data) }, \ - { "bank", NULL, MAVLINK_TYPE_UINT8_T, 0, 135, offsetof(mavlink_device_op_read_reply_t, bank) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_DEVICE_OP_READ_REPLY { \ - "DEVICE_OP_READ_REPLY", \ - 6, \ - { { "request_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_device_op_read_reply_t, request_id) }, \ - { "result", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_device_op_read_reply_t, result) }, \ - { "regstart", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_device_op_read_reply_t, regstart) }, \ - { "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_device_op_read_reply_t, count) }, \ - { "data", NULL, MAVLINK_TYPE_UINT8_T, 128, 7, offsetof(mavlink_device_op_read_reply_t, data) }, \ - { "bank", NULL, MAVLINK_TYPE_UINT8_T, 0, 135, offsetof(mavlink_device_op_read_reply_t, bank) }, \ - } \ -} -#endif - -/** - * @brief Pack a device_op_read_reply message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param request_id Request ID - copied from request. - * @param result 0 for success, anything else is failure code. - * @param regstart Starting register. - * @param count Count of bytes read. - * @param data Reply data. - * @param bank Bank number. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_device_op_read_reply_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint32_t request_id, uint8_t result, uint8_t regstart, uint8_t count, const uint8_t *data, uint8_t bank) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_LEN]; - _mav_put_uint32_t(buf, 0, request_id); - _mav_put_uint8_t(buf, 4, result); - _mav_put_uint8_t(buf, 5, regstart); - _mav_put_uint8_t(buf, 6, count); - _mav_put_uint8_t(buf, 135, bank); - _mav_put_uint8_t_array(buf, 7, data, 128); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_LEN); -#else - mavlink_device_op_read_reply_t packet; - packet.request_id = request_id; - packet.result = result; - packet.regstart = regstart; - packet.count = count; - packet.bank = bank; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*128); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_MIN_LEN, MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_LEN, MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_CRC); -} - -/** - * @brief Pack a device_op_read_reply message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param request_id Request ID - copied from request. - * @param result 0 for success, anything else is failure code. - * @param regstart Starting register. - * @param count Count of bytes read. - * @param data Reply data. - * @param bank Bank number. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_device_op_read_reply_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint32_t request_id,uint8_t result,uint8_t regstart,uint8_t count,const uint8_t *data,uint8_t bank) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_LEN]; - _mav_put_uint32_t(buf, 0, request_id); - _mav_put_uint8_t(buf, 4, result); - _mav_put_uint8_t(buf, 5, regstart); - _mav_put_uint8_t(buf, 6, count); - _mav_put_uint8_t(buf, 135, bank); - _mav_put_uint8_t_array(buf, 7, data, 128); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_LEN); -#else - mavlink_device_op_read_reply_t packet; - packet.request_id = request_id; - packet.result = result; - packet.regstart = regstart; - packet.count = count; - packet.bank = bank; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*128); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_MIN_LEN, MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_LEN, MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_CRC); -} - -/** - * @brief Encode a device_op_read_reply struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param device_op_read_reply C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_device_op_read_reply_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_device_op_read_reply_t* device_op_read_reply) -{ - return mavlink_msg_device_op_read_reply_pack(system_id, component_id, msg, device_op_read_reply->request_id, device_op_read_reply->result, device_op_read_reply->regstart, device_op_read_reply->count, device_op_read_reply->data, device_op_read_reply->bank); -} - -/** - * @brief Encode a device_op_read_reply struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param device_op_read_reply C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_device_op_read_reply_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_device_op_read_reply_t* device_op_read_reply) -{ - return mavlink_msg_device_op_read_reply_pack_chan(system_id, component_id, chan, msg, device_op_read_reply->request_id, device_op_read_reply->result, device_op_read_reply->regstart, device_op_read_reply->count, device_op_read_reply->data, device_op_read_reply->bank); -} - -/** - * @brief Send a device_op_read_reply message - * @param chan MAVLink channel to send the message - * - * @param request_id Request ID - copied from request. - * @param result 0 for success, anything else is failure code. - * @param regstart Starting register. - * @param count Count of bytes read. - * @param data Reply data. - * @param bank Bank number. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_device_op_read_reply_send(mavlink_channel_t chan, uint32_t request_id, uint8_t result, uint8_t regstart, uint8_t count, const uint8_t *data, uint8_t bank) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_LEN]; - _mav_put_uint32_t(buf, 0, request_id); - _mav_put_uint8_t(buf, 4, result); - _mav_put_uint8_t(buf, 5, regstart); - _mav_put_uint8_t(buf, 6, count); - _mav_put_uint8_t(buf, 135, bank); - _mav_put_uint8_t_array(buf, 7, data, 128); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY, buf, MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_MIN_LEN, MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_LEN, MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_CRC); -#else - mavlink_device_op_read_reply_t packet; - packet.request_id = request_id; - packet.result = result; - packet.regstart = regstart; - packet.count = count; - packet.bank = bank; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*128); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY, (const char *)&packet, MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_MIN_LEN, MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_LEN, MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_CRC); -#endif -} - -/** - * @brief Send a device_op_read_reply message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_device_op_read_reply_send_struct(mavlink_channel_t chan, const mavlink_device_op_read_reply_t* device_op_read_reply) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_device_op_read_reply_send(chan, device_op_read_reply->request_id, device_op_read_reply->result, device_op_read_reply->regstart, device_op_read_reply->count, device_op_read_reply->data, device_op_read_reply->bank); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY, (const char *)device_op_read_reply, MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_MIN_LEN, MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_LEN, MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_CRC); -#endif -} - -#if MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_device_op_read_reply_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t request_id, uint8_t result, uint8_t regstart, uint8_t count, const uint8_t *data, uint8_t bank) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint32_t(buf, 0, request_id); - _mav_put_uint8_t(buf, 4, result); - _mav_put_uint8_t(buf, 5, regstart); - _mav_put_uint8_t(buf, 6, count); - _mav_put_uint8_t(buf, 135, bank); - _mav_put_uint8_t_array(buf, 7, data, 128); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY, buf, MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_MIN_LEN, MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_LEN, MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_CRC); -#else - mavlink_device_op_read_reply_t *packet = (mavlink_device_op_read_reply_t *)msgbuf; - packet->request_id = request_id; - packet->result = result; - packet->regstart = regstart; - packet->count = count; - packet->bank = bank; - mav_array_memcpy(packet->data, data, sizeof(uint8_t)*128); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY, (const char *)packet, MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_MIN_LEN, MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_LEN, MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_CRC); -#endif -} -#endif - -#endif - -// MESSAGE DEVICE_OP_READ_REPLY UNPACKING - - -/** - * @brief Get field request_id from device_op_read_reply message - * - * @return Request ID - copied from request. - */ -static inline uint32_t mavlink_msg_device_op_read_reply_get_request_id(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 0); -} - -/** - * @brief Get field result from device_op_read_reply message - * - * @return 0 for success, anything else is failure code. - */ -static inline uint8_t mavlink_msg_device_op_read_reply_get_result(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 4); -} - -/** - * @brief Get field regstart from device_op_read_reply message - * - * @return Starting register. - */ -static inline uint8_t mavlink_msg_device_op_read_reply_get_regstart(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 5); -} - -/** - * @brief Get field count from device_op_read_reply message - * - * @return Count of bytes read. - */ -static inline uint8_t mavlink_msg_device_op_read_reply_get_count(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 6); -} - -/** - * @brief Get field data from device_op_read_reply message - * - * @return Reply data. - */ -static inline uint16_t mavlink_msg_device_op_read_reply_get_data(const mavlink_message_t* msg, uint8_t *data) -{ - return _MAV_RETURN_uint8_t_array(msg, data, 128, 7); -} - -/** - * @brief Get field bank from device_op_read_reply message - * - * @return Bank number. - */ -static inline uint8_t mavlink_msg_device_op_read_reply_get_bank(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 135); -} - -/** - * @brief Decode a device_op_read_reply message into a struct - * - * @param msg The message to decode - * @param device_op_read_reply C-struct to decode the message contents into - */ -static inline void mavlink_msg_device_op_read_reply_decode(const mavlink_message_t* msg, mavlink_device_op_read_reply_t* device_op_read_reply) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - device_op_read_reply->request_id = mavlink_msg_device_op_read_reply_get_request_id(msg); - device_op_read_reply->result = mavlink_msg_device_op_read_reply_get_result(msg); - device_op_read_reply->regstart = mavlink_msg_device_op_read_reply_get_regstart(msg); - device_op_read_reply->count = mavlink_msg_device_op_read_reply_get_count(msg); - mavlink_msg_device_op_read_reply_get_data(msg, device_op_read_reply->data); - device_op_read_reply->bank = mavlink_msg_device_op_read_reply_get_bank(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_LEN? msg->len : MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_LEN; - memset(device_op_read_reply, 0, MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_LEN); - memcpy(device_op_read_reply, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_device_op_write.h b/ardupilotmega/mavlink_msg_device_op_write.h deleted file mode 100644 index c0bc77c41..000000000 --- a/ardupilotmega/mavlink_msg_device_op_write.h +++ /dev/null @@ -1,456 +0,0 @@ -#pragma once -// MESSAGE DEVICE_OP_WRITE PACKING - -#define MAVLINK_MSG_ID_DEVICE_OP_WRITE 11002 - - -typedef struct __mavlink_device_op_write_t { - uint32_t request_id; /*< Request ID - copied to reply.*/ - uint8_t target_system; /*< System ID.*/ - uint8_t target_component; /*< Component ID.*/ - uint8_t bustype; /*< The bus type.*/ - uint8_t bus; /*< Bus number.*/ - uint8_t address; /*< Bus address.*/ - char busname[40]; /*< Name of device on bus (for SPI).*/ - uint8_t regstart; /*< First register to write.*/ - uint8_t count; /*< Count of registers to write.*/ - uint8_t data[128]; /*< Write data.*/ - uint8_t bank; /*< Bank number.*/ -} mavlink_device_op_write_t; - -#define MAVLINK_MSG_ID_DEVICE_OP_WRITE_LEN 180 -#define MAVLINK_MSG_ID_DEVICE_OP_WRITE_MIN_LEN 179 -#define MAVLINK_MSG_ID_11002_LEN 180 -#define MAVLINK_MSG_ID_11002_MIN_LEN 179 - -#define MAVLINK_MSG_ID_DEVICE_OP_WRITE_CRC 234 -#define MAVLINK_MSG_ID_11002_CRC 234 - -#define MAVLINK_MSG_DEVICE_OP_WRITE_FIELD_BUSNAME_LEN 40 -#define MAVLINK_MSG_DEVICE_OP_WRITE_FIELD_DATA_LEN 128 - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_DEVICE_OP_WRITE { \ - 11002, \ - "DEVICE_OP_WRITE", \ - 11, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_device_op_write_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_device_op_write_t, target_component) }, \ - { "request_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_device_op_write_t, request_id) }, \ - { "bustype", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_device_op_write_t, bustype) }, \ - { "bus", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_device_op_write_t, bus) }, \ - { "address", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_device_op_write_t, address) }, \ - { "busname", NULL, MAVLINK_TYPE_CHAR, 40, 9, offsetof(mavlink_device_op_write_t, busname) }, \ - { "regstart", NULL, MAVLINK_TYPE_UINT8_T, 0, 49, offsetof(mavlink_device_op_write_t, regstart) }, \ - { "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 50, offsetof(mavlink_device_op_write_t, count) }, \ - { "data", NULL, MAVLINK_TYPE_UINT8_T, 128, 51, offsetof(mavlink_device_op_write_t, data) }, \ - { "bank", NULL, MAVLINK_TYPE_UINT8_T, 0, 179, offsetof(mavlink_device_op_write_t, bank) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_DEVICE_OP_WRITE { \ - "DEVICE_OP_WRITE", \ - 11, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_device_op_write_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_device_op_write_t, target_component) }, \ - { "request_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_device_op_write_t, request_id) }, \ - { "bustype", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_device_op_write_t, bustype) }, \ - { "bus", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_device_op_write_t, bus) }, \ - { "address", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_device_op_write_t, address) }, \ - { "busname", NULL, MAVLINK_TYPE_CHAR, 40, 9, offsetof(mavlink_device_op_write_t, busname) }, \ - { "regstart", NULL, MAVLINK_TYPE_UINT8_T, 0, 49, offsetof(mavlink_device_op_write_t, regstart) }, \ - { "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 50, offsetof(mavlink_device_op_write_t, count) }, \ - { "data", NULL, MAVLINK_TYPE_UINT8_T, 128, 51, offsetof(mavlink_device_op_write_t, data) }, \ - { "bank", NULL, MAVLINK_TYPE_UINT8_T, 0, 179, offsetof(mavlink_device_op_write_t, bank) }, \ - } \ -} -#endif - -/** - * @brief Pack a device_op_write message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param target_system System ID. - * @param target_component Component ID. - * @param request_id Request ID - copied to reply. - * @param bustype The bus type. - * @param bus Bus number. - * @param address Bus address. - * @param busname Name of device on bus (for SPI). - * @param regstart First register to write. - * @param count Count of registers to write. - * @param data Write data. - * @param bank Bank number. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_device_op_write_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, uint32_t request_id, uint8_t bustype, uint8_t bus, uint8_t address, const char *busname, uint8_t regstart, uint8_t count, const uint8_t *data, uint8_t bank) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DEVICE_OP_WRITE_LEN]; - _mav_put_uint32_t(buf, 0, request_id); - _mav_put_uint8_t(buf, 4, target_system); - _mav_put_uint8_t(buf, 5, target_component); - _mav_put_uint8_t(buf, 6, bustype); - _mav_put_uint8_t(buf, 7, bus); - _mav_put_uint8_t(buf, 8, address); - _mav_put_uint8_t(buf, 49, regstart); - _mav_put_uint8_t(buf, 50, count); - _mav_put_uint8_t(buf, 179, bank); - _mav_put_char_array(buf, 9, busname, 40); - _mav_put_uint8_t_array(buf, 51, data, 128); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DEVICE_OP_WRITE_LEN); -#else - mavlink_device_op_write_t packet; - packet.request_id = request_id; - packet.target_system = target_system; - packet.target_component = target_component; - packet.bustype = bustype; - packet.bus = bus; - packet.address = address; - packet.regstart = regstart; - packet.count = count; - packet.bank = bank; - mav_array_memcpy(packet.busname, busname, sizeof(char)*40); - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*128); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DEVICE_OP_WRITE_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_DEVICE_OP_WRITE; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DEVICE_OP_WRITE_MIN_LEN, MAVLINK_MSG_ID_DEVICE_OP_WRITE_LEN, MAVLINK_MSG_ID_DEVICE_OP_WRITE_CRC); -} - -/** - * @brief Pack a device_op_write message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param target_system System ID. - * @param target_component Component ID. - * @param request_id Request ID - copied to reply. - * @param bustype The bus type. - * @param bus Bus number. - * @param address Bus address. - * @param busname Name of device on bus (for SPI). - * @param regstart First register to write. - * @param count Count of registers to write. - * @param data Write data. - * @param bank Bank number. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_device_op_write_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,uint32_t request_id,uint8_t bustype,uint8_t bus,uint8_t address,const char *busname,uint8_t regstart,uint8_t count,const uint8_t *data,uint8_t bank) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DEVICE_OP_WRITE_LEN]; - _mav_put_uint32_t(buf, 0, request_id); - _mav_put_uint8_t(buf, 4, target_system); - _mav_put_uint8_t(buf, 5, target_component); - _mav_put_uint8_t(buf, 6, bustype); - _mav_put_uint8_t(buf, 7, bus); - _mav_put_uint8_t(buf, 8, address); - _mav_put_uint8_t(buf, 49, regstart); - _mav_put_uint8_t(buf, 50, count); - _mav_put_uint8_t(buf, 179, bank); - _mav_put_char_array(buf, 9, busname, 40); - _mav_put_uint8_t_array(buf, 51, data, 128); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DEVICE_OP_WRITE_LEN); -#else - mavlink_device_op_write_t packet; - packet.request_id = request_id; - packet.target_system = target_system; - packet.target_component = target_component; - packet.bustype = bustype; - packet.bus = bus; - packet.address = address; - packet.regstart = regstart; - packet.count = count; - packet.bank = bank; - mav_array_memcpy(packet.busname, busname, sizeof(char)*40); - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*128); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DEVICE_OP_WRITE_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_DEVICE_OP_WRITE; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_DEVICE_OP_WRITE_MIN_LEN, MAVLINK_MSG_ID_DEVICE_OP_WRITE_LEN, MAVLINK_MSG_ID_DEVICE_OP_WRITE_CRC); -} - -/** - * @brief Encode a device_op_write struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param device_op_write C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_device_op_write_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_device_op_write_t* device_op_write) -{ - return mavlink_msg_device_op_write_pack(system_id, component_id, msg, device_op_write->target_system, device_op_write->target_component, device_op_write->request_id, device_op_write->bustype, device_op_write->bus, device_op_write->address, device_op_write->busname, device_op_write->regstart, device_op_write->count, device_op_write->data, device_op_write->bank); -} - -/** - * @brief Encode a device_op_write struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param device_op_write C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_device_op_write_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_device_op_write_t* device_op_write) -{ - return mavlink_msg_device_op_write_pack_chan(system_id, component_id, chan, msg, device_op_write->target_system, device_op_write->target_component, device_op_write->request_id, device_op_write->bustype, device_op_write->bus, device_op_write->address, device_op_write->busname, device_op_write->regstart, device_op_write->count, device_op_write->data, device_op_write->bank); -} - -/** - * @brief Send a device_op_write message - * @param chan MAVLink channel to send the message - * - * @param target_system System ID. - * @param target_component Component ID. - * @param request_id Request ID - copied to reply. - * @param bustype The bus type. - * @param bus Bus number. - * @param address Bus address. - * @param busname Name of device on bus (for SPI). - * @param regstart First register to write. - * @param count Count of registers to write. - * @param data Write data. - * @param bank Bank number. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_device_op_write_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint32_t request_id, uint8_t bustype, uint8_t bus, uint8_t address, const char *busname, uint8_t regstart, uint8_t count, const uint8_t *data, uint8_t bank) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DEVICE_OP_WRITE_LEN]; - _mav_put_uint32_t(buf, 0, request_id); - _mav_put_uint8_t(buf, 4, target_system); - _mav_put_uint8_t(buf, 5, target_component); - _mav_put_uint8_t(buf, 6, bustype); - _mav_put_uint8_t(buf, 7, bus); - _mav_put_uint8_t(buf, 8, address); - _mav_put_uint8_t(buf, 49, regstart); - _mav_put_uint8_t(buf, 50, count); - _mav_put_uint8_t(buf, 179, bank); - _mav_put_char_array(buf, 9, busname, 40); - _mav_put_uint8_t_array(buf, 51, data, 128); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEVICE_OP_WRITE, buf, MAVLINK_MSG_ID_DEVICE_OP_WRITE_MIN_LEN, MAVLINK_MSG_ID_DEVICE_OP_WRITE_LEN, MAVLINK_MSG_ID_DEVICE_OP_WRITE_CRC); -#else - mavlink_device_op_write_t packet; - packet.request_id = request_id; - packet.target_system = target_system; - packet.target_component = target_component; - packet.bustype = bustype; - packet.bus = bus; - packet.address = address; - packet.regstart = regstart; - packet.count = count; - packet.bank = bank; - mav_array_memcpy(packet.busname, busname, sizeof(char)*40); - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*128); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEVICE_OP_WRITE, (const char *)&packet, MAVLINK_MSG_ID_DEVICE_OP_WRITE_MIN_LEN, MAVLINK_MSG_ID_DEVICE_OP_WRITE_LEN, MAVLINK_MSG_ID_DEVICE_OP_WRITE_CRC); -#endif -} - -/** - * @brief Send a device_op_write message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_device_op_write_send_struct(mavlink_channel_t chan, const mavlink_device_op_write_t* device_op_write) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_device_op_write_send(chan, device_op_write->target_system, device_op_write->target_component, device_op_write->request_id, device_op_write->bustype, device_op_write->bus, device_op_write->address, device_op_write->busname, device_op_write->regstart, device_op_write->count, device_op_write->data, device_op_write->bank); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEVICE_OP_WRITE, (const char *)device_op_write, MAVLINK_MSG_ID_DEVICE_OP_WRITE_MIN_LEN, MAVLINK_MSG_ID_DEVICE_OP_WRITE_LEN, MAVLINK_MSG_ID_DEVICE_OP_WRITE_CRC); -#endif -} - -#if MAVLINK_MSG_ID_DEVICE_OP_WRITE_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_device_op_write_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint32_t request_id, uint8_t bustype, uint8_t bus, uint8_t address, const char *busname, uint8_t regstart, uint8_t count, const uint8_t *data, uint8_t bank) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint32_t(buf, 0, request_id); - _mav_put_uint8_t(buf, 4, target_system); - _mav_put_uint8_t(buf, 5, target_component); - _mav_put_uint8_t(buf, 6, bustype); - _mav_put_uint8_t(buf, 7, bus); - _mav_put_uint8_t(buf, 8, address); - _mav_put_uint8_t(buf, 49, regstart); - _mav_put_uint8_t(buf, 50, count); - _mav_put_uint8_t(buf, 179, bank); - _mav_put_char_array(buf, 9, busname, 40); - _mav_put_uint8_t_array(buf, 51, data, 128); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEVICE_OP_WRITE, buf, MAVLINK_MSG_ID_DEVICE_OP_WRITE_MIN_LEN, MAVLINK_MSG_ID_DEVICE_OP_WRITE_LEN, MAVLINK_MSG_ID_DEVICE_OP_WRITE_CRC); -#else - mavlink_device_op_write_t *packet = (mavlink_device_op_write_t *)msgbuf; - packet->request_id = request_id; - packet->target_system = target_system; - packet->target_component = target_component; - packet->bustype = bustype; - packet->bus = bus; - packet->address = address; - packet->regstart = regstart; - packet->count = count; - packet->bank = bank; - mav_array_memcpy(packet->busname, busname, sizeof(char)*40); - mav_array_memcpy(packet->data, data, sizeof(uint8_t)*128); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEVICE_OP_WRITE, (const char *)packet, MAVLINK_MSG_ID_DEVICE_OP_WRITE_MIN_LEN, MAVLINK_MSG_ID_DEVICE_OP_WRITE_LEN, MAVLINK_MSG_ID_DEVICE_OP_WRITE_CRC); -#endif -} -#endif - -#endif - -// MESSAGE DEVICE_OP_WRITE UNPACKING - - -/** - * @brief Get field target_system from device_op_write message - * - * @return System ID. - */ -static inline uint8_t mavlink_msg_device_op_write_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 4); -} - -/** - * @brief Get field target_component from device_op_write message - * - * @return Component ID. - */ -static inline uint8_t mavlink_msg_device_op_write_get_target_component(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 5); -} - -/** - * @brief Get field request_id from device_op_write message - * - * @return Request ID - copied to reply. - */ -static inline uint32_t mavlink_msg_device_op_write_get_request_id(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 0); -} - -/** - * @brief Get field bustype from device_op_write message - * - * @return The bus type. - */ -static inline uint8_t mavlink_msg_device_op_write_get_bustype(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 6); -} - -/** - * @brief Get field bus from device_op_write message - * - * @return Bus number. - */ -static inline uint8_t mavlink_msg_device_op_write_get_bus(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 7); -} - -/** - * @brief Get field address from device_op_write message - * - * @return Bus address. - */ -static inline uint8_t mavlink_msg_device_op_write_get_address(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 8); -} - -/** - * @brief Get field busname from device_op_write message - * - * @return Name of device on bus (for SPI). - */ -static inline uint16_t mavlink_msg_device_op_write_get_busname(const mavlink_message_t* msg, char *busname) -{ - return _MAV_RETURN_char_array(msg, busname, 40, 9); -} - -/** - * @brief Get field regstart from device_op_write message - * - * @return First register to write. - */ -static inline uint8_t mavlink_msg_device_op_write_get_regstart(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 49); -} - -/** - * @brief Get field count from device_op_write message - * - * @return Count of registers to write. - */ -static inline uint8_t mavlink_msg_device_op_write_get_count(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 50); -} - -/** - * @brief Get field data from device_op_write message - * - * @return Write data. - */ -static inline uint16_t mavlink_msg_device_op_write_get_data(const mavlink_message_t* msg, uint8_t *data) -{ - return _MAV_RETURN_uint8_t_array(msg, data, 128, 51); -} - -/** - * @brief Get field bank from device_op_write message - * - * @return Bank number. - */ -static inline uint8_t mavlink_msg_device_op_write_get_bank(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 179); -} - -/** - * @brief Decode a device_op_write message into a struct - * - * @param msg The message to decode - * @param device_op_write C-struct to decode the message contents into - */ -static inline void mavlink_msg_device_op_write_decode(const mavlink_message_t* msg, mavlink_device_op_write_t* device_op_write) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - device_op_write->request_id = mavlink_msg_device_op_write_get_request_id(msg); - device_op_write->target_system = mavlink_msg_device_op_write_get_target_system(msg); - device_op_write->target_component = mavlink_msg_device_op_write_get_target_component(msg); - device_op_write->bustype = mavlink_msg_device_op_write_get_bustype(msg); - device_op_write->bus = mavlink_msg_device_op_write_get_bus(msg); - device_op_write->address = mavlink_msg_device_op_write_get_address(msg); - mavlink_msg_device_op_write_get_busname(msg, device_op_write->busname); - device_op_write->regstart = mavlink_msg_device_op_write_get_regstart(msg); - device_op_write->count = mavlink_msg_device_op_write_get_count(msg); - mavlink_msg_device_op_write_get_data(msg, device_op_write->data); - device_op_write->bank = mavlink_msg_device_op_write_get_bank(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_DEVICE_OP_WRITE_LEN? msg->len : MAVLINK_MSG_ID_DEVICE_OP_WRITE_LEN; - memset(device_op_write, 0, MAVLINK_MSG_ID_DEVICE_OP_WRITE_LEN); - memcpy(device_op_write, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_device_op_write_reply.h b/ardupilotmega/mavlink_msg_device_op_write_reply.h deleted file mode 100644 index 7b321f10d..000000000 --- a/ardupilotmega/mavlink_msg_device_op_write_reply.h +++ /dev/null @@ -1,238 +0,0 @@ -#pragma once -// MESSAGE DEVICE_OP_WRITE_REPLY PACKING - -#define MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY 11003 - - -typedef struct __mavlink_device_op_write_reply_t { - uint32_t request_id; /*< Request ID - copied from request.*/ - uint8_t result; /*< 0 for success, anything else is failure code.*/ -} mavlink_device_op_write_reply_t; - -#define MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_LEN 5 -#define MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_MIN_LEN 5 -#define MAVLINK_MSG_ID_11003_LEN 5 -#define MAVLINK_MSG_ID_11003_MIN_LEN 5 - -#define MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_CRC 64 -#define MAVLINK_MSG_ID_11003_CRC 64 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_DEVICE_OP_WRITE_REPLY { \ - 11003, \ - "DEVICE_OP_WRITE_REPLY", \ - 2, \ - { { "request_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_device_op_write_reply_t, request_id) }, \ - { "result", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_device_op_write_reply_t, result) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_DEVICE_OP_WRITE_REPLY { \ - "DEVICE_OP_WRITE_REPLY", \ - 2, \ - { { "request_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_device_op_write_reply_t, request_id) }, \ - { "result", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_device_op_write_reply_t, result) }, \ - } \ -} -#endif - -/** - * @brief Pack a device_op_write_reply message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param request_id Request ID - copied from request. - * @param result 0 for success, anything else is failure code. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_device_op_write_reply_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint32_t request_id, uint8_t result) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_LEN]; - _mav_put_uint32_t(buf, 0, request_id); - _mav_put_uint8_t(buf, 4, result); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_LEN); -#else - mavlink_device_op_write_reply_t packet; - packet.request_id = request_id; - packet.result = result; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_MIN_LEN, MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_LEN, MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_CRC); -} - -/** - * @brief Pack a device_op_write_reply message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param request_id Request ID - copied from request. - * @param result 0 for success, anything else is failure code. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_device_op_write_reply_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint32_t request_id,uint8_t result) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_LEN]; - _mav_put_uint32_t(buf, 0, request_id); - _mav_put_uint8_t(buf, 4, result); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_LEN); -#else - mavlink_device_op_write_reply_t packet; - packet.request_id = request_id; - packet.result = result; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_MIN_LEN, MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_LEN, MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_CRC); -} - -/** - * @brief Encode a device_op_write_reply struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param device_op_write_reply C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_device_op_write_reply_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_device_op_write_reply_t* device_op_write_reply) -{ - return mavlink_msg_device_op_write_reply_pack(system_id, component_id, msg, device_op_write_reply->request_id, device_op_write_reply->result); -} - -/** - * @brief Encode a device_op_write_reply struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param device_op_write_reply C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_device_op_write_reply_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_device_op_write_reply_t* device_op_write_reply) -{ - return mavlink_msg_device_op_write_reply_pack_chan(system_id, component_id, chan, msg, device_op_write_reply->request_id, device_op_write_reply->result); -} - -/** - * @brief Send a device_op_write_reply message - * @param chan MAVLink channel to send the message - * - * @param request_id Request ID - copied from request. - * @param result 0 for success, anything else is failure code. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_device_op_write_reply_send(mavlink_channel_t chan, uint32_t request_id, uint8_t result) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_LEN]; - _mav_put_uint32_t(buf, 0, request_id); - _mav_put_uint8_t(buf, 4, result); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY, buf, MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_MIN_LEN, MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_LEN, MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_CRC); -#else - mavlink_device_op_write_reply_t packet; - packet.request_id = request_id; - packet.result = result; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY, (const char *)&packet, MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_MIN_LEN, MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_LEN, MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_CRC); -#endif -} - -/** - * @brief Send a device_op_write_reply message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_device_op_write_reply_send_struct(mavlink_channel_t chan, const mavlink_device_op_write_reply_t* device_op_write_reply) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_device_op_write_reply_send(chan, device_op_write_reply->request_id, device_op_write_reply->result); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY, (const char *)device_op_write_reply, MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_MIN_LEN, MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_LEN, MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_CRC); -#endif -} - -#if MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_device_op_write_reply_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t request_id, uint8_t result) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint32_t(buf, 0, request_id); - _mav_put_uint8_t(buf, 4, result); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY, buf, MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_MIN_LEN, MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_LEN, MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_CRC); -#else - mavlink_device_op_write_reply_t *packet = (mavlink_device_op_write_reply_t *)msgbuf; - packet->request_id = request_id; - packet->result = result; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY, (const char *)packet, MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_MIN_LEN, MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_LEN, MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_CRC); -#endif -} -#endif - -#endif - -// MESSAGE DEVICE_OP_WRITE_REPLY UNPACKING - - -/** - * @brief Get field request_id from device_op_write_reply message - * - * @return Request ID - copied from request. - */ -static inline uint32_t mavlink_msg_device_op_write_reply_get_request_id(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 0); -} - -/** - * @brief Get field result from device_op_write_reply message - * - * @return 0 for success, anything else is failure code. - */ -static inline uint8_t mavlink_msg_device_op_write_reply_get_result(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 4); -} - -/** - * @brief Decode a device_op_write_reply message into a struct - * - * @param msg The message to decode - * @param device_op_write_reply C-struct to decode the message contents into - */ -static inline void mavlink_msg_device_op_write_reply_decode(const mavlink_message_t* msg, mavlink_device_op_write_reply_t* device_op_write_reply) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - device_op_write_reply->request_id = mavlink_msg_device_op_write_reply_get_request_id(msg); - device_op_write_reply->result = mavlink_msg_device_op_write_reply_get_result(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_LEN? msg->len : MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_LEN; - memset(device_op_write_reply, 0, MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_LEN); - memcpy(device_op_write_reply, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_digicam_configure.h b/ardupilotmega/mavlink_msg_digicam_configure.h deleted file mode 100644 index 255536e8d..000000000 --- a/ardupilotmega/mavlink_msg_digicam_configure.h +++ /dev/null @@ -1,463 +0,0 @@ -#pragma once -// MESSAGE DIGICAM_CONFIGURE PACKING - -#define MAVLINK_MSG_ID_DIGICAM_CONFIGURE 154 - - -typedef struct __mavlink_digicam_configure_t { - float extra_value; /*< Correspondent value to given extra_param.*/ - uint16_t shutter_speed; /*< Divisor number //e.g. 1000 means 1/1000 (0 means ignore).*/ - uint8_t target_system; /*< System ID.*/ - uint8_t target_component; /*< Component ID.*/ - uint8_t mode; /*< Mode enumeration from 1 to N //P, TV, AV, M, etc. (0 means ignore).*/ - uint8_t aperture; /*< F stop number x 10 //e.g. 28 means 2.8 (0 means ignore).*/ - uint8_t iso; /*< ISO enumeration from 1 to N //e.g. 80, 100, 200, Etc (0 means ignore).*/ - uint8_t exposure_type; /*< Exposure type enumeration from 1 to N (0 means ignore).*/ - uint8_t command_id; /*< Command Identity (incremental loop: 0 to 255). //A command sent multiple times will be executed or pooled just once.*/ - uint8_t engine_cut_off; /*< [ds] Main engine cut-off time before camera trigger (0 means no cut-off).*/ - uint8_t extra_param; /*< Extra parameters enumeration (0 means ignore).*/ -} mavlink_digicam_configure_t; - -#define MAVLINK_MSG_ID_DIGICAM_CONFIGURE_LEN 15 -#define MAVLINK_MSG_ID_DIGICAM_CONFIGURE_MIN_LEN 15 -#define MAVLINK_MSG_ID_154_LEN 15 -#define MAVLINK_MSG_ID_154_MIN_LEN 15 - -#define MAVLINK_MSG_ID_DIGICAM_CONFIGURE_CRC 84 -#define MAVLINK_MSG_ID_154_CRC 84 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_DIGICAM_CONFIGURE { \ - 154, \ - "DIGICAM_CONFIGURE", \ - 11, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_digicam_configure_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_digicam_configure_t, target_component) }, \ - { "mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_digicam_configure_t, mode) }, \ - { "shutter_speed", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_digicam_configure_t, shutter_speed) }, \ - { "aperture", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_digicam_configure_t, aperture) }, \ - { "iso", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_digicam_configure_t, iso) }, \ - { "exposure_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_digicam_configure_t, exposure_type) }, \ - { "command_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_digicam_configure_t, command_id) }, \ - { "engine_cut_off", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_digicam_configure_t, engine_cut_off) }, \ - { "extra_param", NULL, MAVLINK_TYPE_UINT8_T, 0, 14, offsetof(mavlink_digicam_configure_t, extra_param) }, \ - { "extra_value", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_digicam_configure_t, extra_value) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_DIGICAM_CONFIGURE { \ - "DIGICAM_CONFIGURE", \ - 11, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_digicam_configure_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_digicam_configure_t, target_component) }, \ - { "mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_digicam_configure_t, mode) }, \ - { "shutter_speed", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_digicam_configure_t, shutter_speed) }, \ - { "aperture", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_digicam_configure_t, aperture) }, \ - { "iso", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_digicam_configure_t, iso) }, \ - { "exposure_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_digicam_configure_t, exposure_type) }, \ - { "command_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_digicam_configure_t, command_id) }, \ - { "engine_cut_off", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_digicam_configure_t, engine_cut_off) }, \ - { "extra_param", NULL, MAVLINK_TYPE_UINT8_T, 0, 14, offsetof(mavlink_digicam_configure_t, extra_param) }, \ - { "extra_value", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_digicam_configure_t, extra_value) }, \ - } \ -} -#endif - -/** - * @brief Pack a digicam_configure message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param target_system System ID. - * @param target_component Component ID. - * @param mode Mode enumeration from 1 to N //P, TV, AV, M, etc. (0 means ignore). - * @param shutter_speed Divisor number //e.g. 1000 means 1/1000 (0 means ignore). - * @param aperture F stop number x 10 //e.g. 28 means 2.8 (0 means ignore). - * @param iso ISO enumeration from 1 to N //e.g. 80, 100, 200, Etc (0 means ignore). - * @param exposure_type Exposure type enumeration from 1 to N (0 means ignore). - * @param command_id Command Identity (incremental loop: 0 to 255). //A command sent multiple times will be executed or pooled just once. - * @param engine_cut_off [ds] Main engine cut-off time before camera trigger (0 means no cut-off). - * @param extra_param Extra parameters enumeration (0 means ignore). - * @param extra_value Correspondent value to given extra_param. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_digicam_configure_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, uint8_t mode, uint16_t shutter_speed, uint8_t aperture, uint8_t iso, uint8_t exposure_type, uint8_t command_id, uint8_t engine_cut_off, uint8_t extra_param, float extra_value) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DIGICAM_CONFIGURE_LEN]; - _mav_put_float(buf, 0, extra_value); - _mav_put_uint16_t(buf, 4, shutter_speed); - _mav_put_uint8_t(buf, 6, target_system); - _mav_put_uint8_t(buf, 7, target_component); - _mav_put_uint8_t(buf, 8, mode); - _mav_put_uint8_t(buf, 9, aperture); - _mav_put_uint8_t(buf, 10, iso); - _mav_put_uint8_t(buf, 11, exposure_type); - _mav_put_uint8_t(buf, 12, command_id); - _mav_put_uint8_t(buf, 13, engine_cut_off); - _mav_put_uint8_t(buf, 14, extra_param); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DIGICAM_CONFIGURE_LEN); -#else - mavlink_digicam_configure_t packet; - packet.extra_value = extra_value; - packet.shutter_speed = shutter_speed; - packet.target_system = target_system; - packet.target_component = target_component; - packet.mode = mode; - packet.aperture = aperture; - packet.iso = iso; - packet.exposure_type = exposure_type; - packet.command_id = command_id; - packet.engine_cut_off = engine_cut_off; - packet.extra_param = extra_param; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DIGICAM_CONFIGURE_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_DIGICAM_CONFIGURE; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DIGICAM_CONFIGURE_MIN_LEN, MAVLINK_MSG_ID_DIGICAM_CONFIGURE_LEN, MAVLINK_MSG_ID_DIGICAM_CONFIGURE_CRC); -} - -/** - * @brief Pack a digicam_configure message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param target_system System ID. - * @param target_component Component ID. - * @param mode Mode enumeration from 1 to N //P, TV, AV, M, etc. (0 means ignore). - * @param shutter_speed Divisor number //e.g. 1000 means 1/1000 (0 means ignore). - * @param aperture F stop number x 10 //e.g. 28 means 2.8 (0 means ignore). - * @param iso ISO enumeration from 1 to N //e.g. 80, 100, 200, Etc (0 means ignore). - * @param exposure_type Exposure type enumeration from 1 to N (0 means ignore). - * @param command_id Command Identity (incremental loop: 0 to 255). //A command sent multiple times will be executed or pooled just once. - * @param engine_cut_off [ds] Main engine cut-off time before camera trigger (0 means no cut-off). - * @param extra_param Extra parameters enumeration (0 means ignore). - * @param extra_value Correspondent value to given extra_param. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_digicam_configure_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,uint8_t mode,uint16_t shutter_speed,uint8_t aperture,uint8_t iso,uint8_t exposure_type,uint8_t command_id,uint8_t engine_cut_off,uint8_t extra_param,float extra_value) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DIGICAM_CONFIGURE_LEN]; - _mav_put_float(buf, 0, extra_value); - _mav_put_uint16_t(buf, 4, shutter_speed); - _mav_put_uint8_t(buf, 6, target_system); - _mav_put_uint8_t(buf, 7, target_component); - _mav_put_uint8_t(buf, 8, mode); - _mav_put_uint8_t(buf, 9, aperture); - _mav_put_uint8_t(buf, 10, iso); - _mav_put_uint8_t(buf, 11, exposure_type); - _mav_put_uint8_t(buf, 12, command_id); - _mav_put_uint8_t(buf, 13, engine_cut_off); - _mav_put_uint8_t(buf, 14, extra_param); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DIGICAM_CONFIGURE_LEN); -#else - mavlink_digicam_configure_t packet; - packet.extra_value = extra_value; - packet.shutter_speed = shutter_speed; - packet.target_system = target_system; - packet.target_component = target_component; - packet.mode = mode; - packet.aperture = aperture; - packet.iso = iso; - packet.exposure_type = exposure_type; - packet.command_id = command_id; - packet.engine_cut_off = engine_cut_off; - packet.extra_param = extra_param; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DIGICAM_CONFIGURE_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_DIGICAM_CONFIGURE; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_DIGICAM_CONFIGURE_MIN_LEN, MAVLINK_MSG_ID_DIGICAM_CONFIGURE_LEN, MAVLINK_MSG_ID_DIGICAM_CONFIGURE_CRC); -} - -/** - * @brief Encode a digicam_configure struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param digicam_configure C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_digicam_configure_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_digicam_configure_t* digicam_configure) -{ - return mavlink_msg_digicam_configure_pack(system_id, component_id, msg, digicam_configure->target_system, digicam_configure->target_component, digicam_configure->mode, digicam_configure->shutter_speed, digicam_configure->aperture, digicam_configure->iso, digicam_configure->exposure_type, digicam_configure->command_id, digicam_configure->engine_cut_off, digicam_configure->extra_param, digicam_configure->extra_value); -} - -/** - * @brief Encode a digicam_configure struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param digicam_configure C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_digicam_configure_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_digicam_configure_t* digicam_configure) -{ - return mavlink_msg_digicam_configure_pack_chan(system_id, component_id, chan, msg, digicam_configure->target_system, digicam_configure->target_component, digicam_configure->mode, digicam_configure->shutter_speed, digicam_configure->aperture, digicam_configure->iso, digicam_configure->exposure_type, digicam_configure->command_id, digicam_configure->engine_cut_off, digicam_configure->extra_param, digicam_configure->extra_value); -} - -/** - * @brief Send a digicam_configure message - * @param chan MAVLink channel to send the message - * - * @param target_system System ID. - * @param target_component Component ID. - * @param mode Mode enumeration from 1 to N //P, TV, AV, M, etc. (0 means ignore). - * @param shutter_speed Divisor number //e.g. 1000 means 1/1000 (0 means ignore). - * @param aperture F stop number x 10 //e.g. 28 means 2.8 (0 means ignore). - * @param iso ISO enumeration from 1 to N //e.g. 80, 100, 200, Etc (0 means ignore). - * @param exposure_type Exposure type enumeration from 1 to N (0 means ignore). - * @param command_id Command Identity (incremental loop: 0 to 255). //A command sent multiple times will be executed or pooled just once. - * @param engine_cut_off [ds] Main engine cut-off time before camera trigger (0 means no cut-off). - * @param extra_param Extra parameters enumeration (0 means ignore). - * @param extra_value Correspondent value to given extra_param. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_digicam_configure_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t mode, uint16_t shutter_speed, uint8_t aperture, uint8_t iso, uint8_t exposure_type, uint8_t command_id, uint8_t engine_cut_off, uint8_t extra_param, float extra_value) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DIGICAM_CONFIGURE_LEN]; - _mav_put_float(buf, 0, extra_value); - _mav_put_uint16_t(buf, 4, shutter_speed); - _mav_put_uint8_t(buf, 6, target_system); - _mav_put_uint8_t(buf, 7, target_component); - _mav_put_uint8_t(buf, 8, mode); - _mav_put_uint8_t(buf, 9, aperture); - _mav_put_uint8_t(buf, 10, iso); - _mav_put_uint8_t(buf, 11, exposure_type); - _mav_put_uint8_t(buf, 12, command_id); - _mav_put_uint8_t(buf, 13, engine_cut_off); - _mav_put_uint8_t(buf, 14, extra_param); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DIGICAM_CONFIGURE, buf, MAVLINK_MSG_ID_DIGICAM_CONFIGURE_MIN_LEN, MAVLINK_MSG_ID_DIGICAM_CONFIGURE_LEN, MAVLINK_MSG_ID_DIGICAM_CONFIGURE_CRC); -#else - mavlink_digicam_configure_t packet; - packet.extra_value = extra_value; - packet.shutter_speed = shutter_speed; - packet.target_system = target_system; - packet.target_component = target_component; - packet.mode = mode; - packet.aperture = aperture; - packet.iso = iso; - packet.exposure_type = exposure_type; - packet.command_id = command_id; - packet.engine_cut_off = engine_cut_off; - packet.extra_param = extra_param; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DIGICAM_CONFIGURE, (const char *)&packet, MAVLINK_MSG_ID_DIGICAM_CONFIGURE_MIN_LEN, MAVLINK_MSG_ID_DIGICAM_CONFIGURE_LEN, MAVLINK_MSG_ID_DIGICAM_CONFIGURE_CRC); -#endif -} - -/** - * @brief Send a digicam_configure message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_digicam_configure_send_struct(mavlink_channel_t chan, const mavlink_digicam_configure_t* digicam_configure) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_digicam_configure_send(chan, digicam_configure->target_system, digicam_configure->target_component, digicam_configure->mode, digicam_configure->shutter_speed, digicam_configure->aperture, digicam_configure->iso, digicam_configure->exposure_type, digicam_configure->command_id, digicam_configure->engine_cut_off, digicam_configure->extra_param, digicam_configure->extra_value); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DIGICAM_CONFIGURE, (const char *)digicam_configure, MAVLINK_MSG_ID_DIGICAM_CONFIGURE_MIN_LEN, MAVLINK_MSG_ID_DIGICAM_CONFIGURE_LEN, MAVLINK_MSG_ID_DIGICAM_CONFIGURE_CRC); -#endif -} - -#if MAVLINK_MSG_ID_DIGICAM_CONFIGURE_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_digicam_configure_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t mode, uint16_t shutter_speed, uint8_t aperture, uint8_t iso, uint8_t exposure_type, uint8_t command_id, uint8_t engine_cut_off, uint8_t extra_param, float extra_value) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_float(buf, 0, extra_value); - _mav_put_uint16_t(buf, 4, shutter_speed); - _mav_put_uint8_t(buf, 6, target_system); - _mav_put_uint8_t(buf, 7, target_component); - _mav_put_uint8_t(buf, 8, mode); - _mav_put_uint8_t(buf, 9, aperture); - _mav_put_uint8_t(buf, 10, iso); - _mav_put_uint8_t(buf, 11, exposure_type); - _mav_put_uint8_t(buf, 12, command_id); - _mav_put_uint8_t(buf, 13, engine_cut_off); - _mav_put_uint8_t(buf, 14, extra_param); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DIGICAM_CONFIGURE, buf, MAVLINK_MSG_ID_DIGICAM_CONFIGURE_MIN_LEN, MAVLINK_MSG_ID_DIGICAM_CONFIGURE_LEN, MAVLINK_MSG_ID_DIGICAM_CONFIGURE_CRC); -#else - mavlink_digicam_configure_t *packet = (mavlink_digicam_configure_t *)msgbuf; - packet->extra_value = extra_value; - packet->shutter_speed = shutter_speed; - packet->target_system = target_system; - packet->target_component = target_component; - packet->mode = mode; - packet->aperture = aperture; - packet->iso = iso; - packet->exposure_type = exposure_type; - packet->command_id = command_id; - packet->engine_cut_off = engine_cut_off; - packet->extra_param = extra_param; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DIGICAM_CONFIGURE, (const char *)packet, MAVLINK_MSG_ID_DIGICAM_CONFIGURE_MIN_LEN, MAVLINK_MSG_ID_DIGICAM_CONFIGURE_LEN, MAVLINK_MSG_ID_DIGICAM_CONFIGURE_CRC); -#endif -} -#endif - -#endif - -// MESSAGE DIGICAM_CONFIGURE UNPACKING - - -/** - * @brief Get field target_system from digicam_configure message - * - * @return System ID. - */ -static inline uint8_t mavlink_msg_digicam_configure_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 6); -} - -/** - * @brief Get field target_component from digicam_configure message - * - * @return Component ID. - */ -static inline uint8_t mavlink_msg_digicam_configure_get_target_component(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 7); -} - -/** - * @brief Get field mode from digicam_configure message - * - * @return Mode enumeration from 1 to N //P, TV, AV, M, etc. (0 means ignore). - */ -static inline uint8_t mavlink_msg_digicam_configure_get_mode(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 8); -} - -/** - * @brief Get field shutter_speed from digicam_configure message - * - * @return Divisor number //e.g. 1000 means 1/1000 (0 means ignore). - */ -static inline uint16_t mavlink_msg_digicam_configure_get_shutter_speed(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 4); -} - -/** - * @brief Get field aperture from digicam_configure message - * - * @return F stop number x 10 //e.g. 28 means 2.8 (0 means ignore). - */ -static inline uint8_t mavlink_msg_digicam_configure_get_aperture(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 9); -} - -/** - * @brief Get field iso from digicam_configure message - * - * @return ISO enumeration from 1 to N //e.g. 80, 100, 200, Etc (0 means ignore). - */ -static inline uint8_t mavlink_msg_digicam_configure_get_iso(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 10); -} - -/** - * @brief Get field exposure_type from digicam_configure message - * - * @return Exposure type enumeration from 1 to N (0 means ignore). - */ -static inline uint8_t mavlink_msg_digicam_configure_get_exposure_type(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 11); -} - -/** - * @brief Get field command_id from digicam_configure message - * - * @return Command Identity (incremental loop: 0 to 255). //A command sent multiple times will be executed or pooled just once. - */ -static inline uint8_t mavlink_msg_digicam_configure_get_command_id(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 12); -} - -/** - * @brief Get field engine_cut_off from digicam_configure message - * - * @return [ds] Main engine cut-off time before camera trigger (0 means no cut-off). - */ -static inline uint8_t mavlink_msg_digicam_configure_get_engine_cut_off(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 13); -} - -/** - * @brief Get field extra_param from digicam_configure message - * - * @return Extra parameters enumeration (0 means ignore). - */ -static inline uint8_t mavlink_msg_digicam_configure_get_extra_param(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 14); -} - -/** - * @brief Get field extra_value from digicam_configure message - * - * @return Correspondent value to given extra_param. - */ -static inline float mavlink_msg_digicam_configure_get_extra_value(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 0); -} - -/** - * @brief Decode a digicam_configure message into a struct - * - * @param msg The message to decode - * @param digicam_configure C-struct to decode the message contents into - */ -static inline void mavlink_msg_digicam_configure_decode(const mavlink_message_t* msg, mavlink_digicam_configure_t* digicam_configure) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - digicam_configure->extra_value = mavlink_msg_digicam_configure_get_extra_value(msg); - digicam_configure->shutter_speed = mavlink_msg_digicam_configure_get_shutter_speed(msg); - digicam_configure->target_system = mavlink_msg_digicam_configure_get_target_system(msg); - digicam_configure->target_component = mavlink_msg_digicam_configure_get_target_component(msg); - digicam_configure->mode = mavlink_msg_digicam_configure_get_mode(msg); - digicam_configure->aperture = mavlink_msg_digicam_configure_get_aperture(msg); - digicam_configure->iso = mavlink_msg_digicam_configure_get_iso(msg); - digicam_configure->exposure_type = mavlink_msg_digicam_configure_get_exposure_type(msg); - digicam_configure->command_id = mavlink_msg_digicam_configure_get_command_id(msg); - digicam_configure->engine_cut_off = mavlink_msg_digicam_configure_get_engine_cut_off(msg); - digicam_configure->extra_param = mavlink_msg_digicam_configure_get_extra_param(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_DIGICAM_CONFIGURE_LEN? msg->len : MAVLINK_MSG_ID_DIGICAM_CONFIGURE_LEN; - memset(digicam_configure, 0, MAVLINK_MSG_ID_DIGICAM_CONFIGURE_LEN); - memcpy(digicam_configure, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_digicam_control.h b/ardupilotmega/mavlink_msg_digicam_control.h deleted file mode 100644 index 6b144cc82..000000000 --- a/ardupilotmega/mavlink_msg_digicam_control.h +++ /dev/null @@ -1,438 +0,0 @@ -#pragma once -// MESSAGE DIGICAM_CONTROL PACKING - -#define MAVLINK_MSG_ID_DIGICAM_CONTROL 155 - - -typedef struct __mavlink_digicam_control_t { - float extra_value; /*< Correspondent value to given extra_param.*/ - uint8_t target_system; /*< System ID.*/ - uint8_t target_component; /*< Component ID.*/ - uint8_t session; /*< 0: stop, 1: start or keep it up //Session control e.g. show/hide lens.*/ - uint8_t zoom_pos; /*< 1 to N //Zoom's absolute position (0 means ignore).*/ - int8_t zoom_step; /*< -100 to 100 //Zooming step value to offset zoom from the current position.*/ - uint8_t focus_lock; /*< 0: unlock focus or keep unlocked, 1: lock focus or keep locked, 3: re-lock focus.*/ - uint8_t shot; /*< 0: ignore, 1: shot or start filming.*/ - uint8_t command_id; /*< Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once.*/ - uint8_t extra_param; /*< Extra parameters enumeration (0 means ignore).*/ -} mavlink_digicam_control_t; - -#define MAVLINK_MSG_ID_DIGICAM_CONTROL_LEN 13 -#define MAVLINK_MSG_ID_DIGICAM_CONTROL_MIN_LEN 13 -#define MAVLINK_MSG_ID_155_LEN 13 -#define MAVLINK_MSG_ID_155_MIN_LEN 13 - -#define MAVLINK_MSG_ID_DIGICAM_CONTROL_CRC 22 -#define MAVLINK_MSG_ID_155_CRC 22 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_DIGICAM_CONTROL { \ - 155, \ - "DIGICAM_CONTROL", \ - 10, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_digicam_control_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_digicam_control_t, target_component) }, \ - { "session", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_digicam_control_t, session) }, \ - { "zoom_pos", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_digicam_control_t, zoom_pos) }, \ - { "zoom_step", NULL, MAVLINK_TYPE_INT8_T, 0, 8, offsetof(mavlink_digicam_control_t, zoom_step) }, \ - { "focus_lock", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_digicam_control_t, focus_lock) }, \ - { "shot", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_digicam_control_t, shot) }, \ - { "command_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_digicam_control_t, command_id) }, \ - { "extra_param", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_digicam_control_t, extra_param) }, \ - { "extra_value", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_digicam_control_t, extra_value) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_DIGICAM_CONTROL { \ - "DIGICAM_CONTROL", \ - 10, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_digicam_control_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_digicam_control_t, target_component) }, \ - { "session", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_digicam_control_t, session) }, \ - { "zoom_pos", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_digicam_control_t, zoom_pos) }, \ - { "zoom_step", NULL, MAVLINK_TYPE_INT8_T, 0, 8, offsetof(mavlink_digicam_control_t, zoom_step) }, \ - { "focus_lock", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_digicam_control_t, focus_lock) }, \ - { "shot", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_digicam_control_t, shot) }, \ - { "command_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_digicam_control_t, command_id) }, \ - { "extra_param", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_digicam_control_t, extra_param) }, \ - { "extra_value", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_digicam_control_t, extra_value) }, \ - } \ -} -#endif - -/** - * @brief Pack a digicam_control message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param target_system System ID. - * @param target_component Component ID. - * @param session 0: stop, 1: start or keep it up //Session control e.g. show/hide lens. - * @param zoom_pos 1 to N //Zoom's absolute position (0 means ignore). - * @param zoom_step -100 to 100 //Zooming step value to offset zoom from the current position. - * @param focus_lock 0: unlock focus or keep unlocked, 1: lock focus or keep locked, 3: re-lock focus. - * @param shot 0: ignore, 1: shot or start filming. - * @param command_id Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once. - * @param extra_param Extra parameters enumeration (0 means ignore). - * @param extra_value Correspondent value to given extra_param. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_digicam_control_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, uint8_t session, uint8_t zoom_pos, int8_t zoom_step, uint8_t focus_lock, uint8_t shot, uint8_t command_id, uint8_t extra_param, float extra_value) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DIGICAM_CONTROL_LEN]; - _mav_put_float(buf, 0, extra_value); - _mav_put_uint8_t(buf, 4, target_system); - _mav_put_uint8_t(buf, 5, target_component); - _mav_put_uint8_t(buf, 6, session); - _mav_put_uint8_t(buf, 7, zoom_pos); - _mav_put_int8_t(buf, 8, zoom_step); - _mav_put_uint8_t(buf, 9, focus_lock); - _mav_put_uint8_t(buf, 10, shot); - _mav_put_uint8_t(buf, 11, command_id); - _mav_put_uint8_t(buf, 12, extra_param); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DIGICAM_CONTROL_LEN); -#else - mavlink_digicam_control_t packet; - packet.extra_value = extra_value; - packet.target_system = target_system; - packet.target_component = target_component; - packet.session = session; - packet.zoom_pos = zoom_pos; - packet.zoom_step = zoom_step; - packet.focus_lock = focus_lock; - packet.shot = shot; - packet.command_id = command_id; - packet.extra_param = extra_param; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DIGICAM_CONTROL_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_DIGICAM_CONTROL; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DIGICAM_CONTROL_MIN_LEN, MAVLINK_MSG_ID_DIGICAM_CONTROL_LEN, MAVLINK_MSG_ID_DIGICAM_CONTROL_CRC); -} - -/** - * @brief Pack a digicam_control message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param target_system System ID. - * @param target_component Component ID. - * @param session 0: stop, 1: start or keep it up //Session control e.g. show/hide lens. - * @param zoom_pos 1 to N //Zoom's absolute position (0 means ignore). - * @param zoom_step -100 to 100 //Zooming step value to offset zoom from the current position. - * @param focus_lock 0: unlock focus or keep unlocked, 1: lock focus or keep locked, 3: re-lock focus. - * @param shot 0: ignore, 1: shot or start filming. - * @param command_id Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once. - * @param extra_param Extra parameters enumeration (0 means ignore). - * @param extra_value Correspondent value to given extra_param. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_digicam_control_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,uint8_t session,uint8_t zoom_pos,int8_t zoom_step,uint8_t focus_lock,uint8_t shot,uint8_t command_id,uint8_t extra_param,float extra_value) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DIGICAM_CONTROL_LEN]; - _mav_put_float(buf, 0, extra_value); - _mav_put_uint8_t(buf, 4, target_system); - _mav_put_uint8_t(buf, 5, target_component); - _mav_put_uint8_t(buf, 6, session); - _mav_put_uint8_t(buf, 7, zoom_pos); - _mav_put_int8_t(buf, 8, zoom_step); - _mav_put_uint8_t(buf, 9, focus_lock); - _mav_put_uint8_t(buf, 10, shot); - _mav_put_uint8_t(buf, 11, command_id); - _mav_put_uint8_t(buf, 12, extra_param); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DIGICAM_CONTROL_LEN); -#else - mavlink_digicam_control_t packet; - packet.extra_value = extra_value; - packet.target_system = target_system; - packet.target_component = target_component; - packet.session = session; - packet.zoom_pos = zoom_pos; - packet.zoom_step = zoom_step; - packet.focus_lock = focus_lock; - packet.shot = shot; - packet.command_id = command_id; - packet.extra_param = extra_param; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DIGICAM_CONTROL_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_DIGICAM_CONTROL; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_DIGICAM_CONTROL_MIN_LEN, MAVLINK_MSG_ID_DIGICAM_CONTROL_LEN, MAVLINK_MSG_ID_DIGICAM_CONTROL_CRC); -} - -/** - * @brief Encode a digicam_control struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param digicam_control C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_digicam_control_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_digicam_control_t* digicam_control) -{ - return mavlink_msg_digicam_control_pack(system_id, component_id, msg, digicam_control->target_system, digicam_control->target_component, digicam_control->session, digicam_control->zoom_pos, digicam_control->zoom_step, digicam_control->focus_lock, digicam_control->shot, digicam_control->command_id, digicam_control->extra_param, digicam_control->extra_value); -} - -/** - * @brief Encode a digicam_control struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param digicam_control C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_digicam_control_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_digicam_control_t* digicam_control) -{ - return mavlink_msg_digicam_control_pack_chan(system_id, component_id, chan, msg, digicam_control->target_system, digicam_control->target_component, digicam_control->session, digicam_control->zoom_pos, digicam_control->zoom_step, digicam_control->focus_lock, digicam_control->shot, digicam_control->command_id, digicam_control->extra_param, digicam_control->extra_value); -} - -/** - * @brief Send a digicam_control message - * @param chan MAVLink channel to send the message - * - * @param target_system System ID. - * @param target_component Component ID. - * @param session 0: stop, 1: start or keep it up //Session control e.g. show/hide lens. - * @param zoom_pos 1 to N //Zoom's absolute position (0 means ignore). - * @param zoom_step -100 to 100 //Zooming step value to offset zoom from the current position. - * @param focus_lock 0: unlock focus or keep unlocked, 1: lock focus or keep locked, 3: re-lock focus. - * @param shot 0: ignore, 1: shot or start filming. - * @param command_id Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once. - * @param extra_param Extra parameters enumeration (0 means ignore). - * @param extra_value Correspondent value to given extra_param. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_digicam_control_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t session, uint8_t zoom_pos, int8_t zoom_step, uint8_t focus_lock, uint8_t shot, uint8_t command_id, uint8_t extra_param, float extra_value) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_DIGICAM_CONTROL_LEN]; - _mav_put_float(buf, 0, extra_value); - _mav_put_uint8_t(buf, 4, target_system); - _mav_put_uint8_t(buf, 5, target_component); - _mav_put_uint8_t(buf, 6, session); - _mav_put_uint8_t(buf, 7, zoom_pos); - _mav_put_int8_t(buf, 8, zoom_step); - _mav_put_uint8_t(buf, 9, focus_lock); - _mav_put_uint8_t(buf, 10, shot); - _mav_put_uint8_t(buf, 11, command_id); - _mav_put_uint8_t(buf, 12, extra_param); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DIGICAM_CONTROL, buf, MAVLINK_MSG_ID_DIGICAM_CONTROL_MIN_LEN, MAVLINK_MSG_ID_DIGICAM_CONTROL_LEN, MAVLINK_MSG_ID_DIGICAM_CONTROL_CRC); -#else - mavlink_digicam_control_t packet; - packet.extra_value = extra_value; - packet.target_system = target_system; - packet.target_component = target_component; - packet.session = session; - packet.zoom_pos = zoom_pos; - packet.zoom_step = zoom_step; - packet.focus_lock = focus_lock; - packet.shot = shot; - packet.command_id = command_id; - packet.extra_param = extra_param; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DIGICAM_CONTROL, (const char *)&packet, MAVLINK_MSG_ID_DIGICAM_CONTROL_MIN_LEN, MAVLINK_MSG_ID_DIGICAM_CONTROL_LEN, MAVLINK_MSG_ID_DIGICAM_CONTROL_CRC); -#endif -} - -/** - * @brief Send a digicam_control message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_digicam_control_send_struct(mavlink_channel_t chan, const mavlink_digicam_control_t* digicam_control) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_digicam_control_send(chan, digicam_control->target_system, digicam_control->target_component, digicam_control->session, digicam_control->zoom_pos, digicam_control->zoom_step, digicam_control->focus_lock, digicam_control->shot, digicam_control->command_id, digicam_control->extra_param, digicam_control->extra_value); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DIGICAM_CONTROL, (const char *)digicam_control, MAVLINK_MSG_ID_DIGICAM_CONTROL_MIN_LEN, MAVLINK_MSG_ID_DIGICAM_CONTROL_LEN, MAVLINK_MSG_ID_DIGICAM_CONTROL_CRC); -#endif -} - -#if MAVLINK_MSG_ID_DIGICAM_CONTROL_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_digicam_control_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t session, uint8_t zoom_pos, int8_t zoom_step, uint8_t focus_lock, uint8_t shot, uint8_t command_id, uint8_t extra_param, float extra_value) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_float(buf, 0, extra_value); - _mav_put_uint8_t(buf, 4, target_system); - _mav_put_uint8_t(buf, 5, target_component); - _mav_put_uint8_t(buf, 6, session); - _mav_put_uint8_t(buf, 7, zoom_pos); - _mav_put_int8_t(buf, 8, zoom_step); - _mav_put_uint8_t(buf, 9, focus_lock); - _mav_put_uint8_t(buf, 10, shot); - _mav_put_uint8_t(buf, 11, command_id); - _mav_put_uint8_t(buf, 12, extra_param); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DIGICAM_CONTROL, buf, MAVLINK_MSG_ID_DIGICAM_CONTROL_MIN_LEN, MAVLINK_MSG_ID_DIGICAM_CONTROL_LEN, MAVLINK_MSG_ID_DIGICAM_CONTROL_CRC); -#else - mavlink_digicam_control_t *packet = (mavlink_digicam_control_t *)msgbuf; - packet->extra_value = extra_value; - packet->target_system = target_system; - packet->target_component = target_component; - packet->session = session; - packet->zoom_pos = zoom_pos; - packet->zoom_step = zoom_step; - packet->focus_lock = focus_lock; - packet->shot = shot; - packet->command_id = command_id; - packet->extra_param = extra_param; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DIGICAM_CONTROL, (const char *)packet, MAVLINK_MSG_ID_DIGICAM_CONTROL_MIN_LEN, MAVLINK_MSG_ID_DIGICAM_CONTROL_LEN, MAVLINK_MSG_ID_DIGICAM_CONTROL_CRC); -#endif -} -#endif - -#endif - -// MESSAGE DIGICAM_CONTROL UNPACKING - - -/** - * @brief Get field target_system from digicam_control message - * - * @return System ID. - */ -static inline uint8_t mavlink_msg_digicam_control_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 4); -} - -/** - * @brief Get field target_component from digicam_control message - * - * @return Component ID. - */ -static inline uint8_t mavlink_msg_digicam_control_get_target_component(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 5); -} - -/** - * @brief Get field session from digicam_control message - * - * @return 0: stop, 1: start or keep it up //Session control e.g. show/hide lens. - */ -static inline uint8_t mavlink_msg_digicam_control_get_session(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 6); -} - -/** - * @brief Get field zoom_pos from digicam_control message - * - * @return 1 to N //Zoom's absolute position (0 means ignore). - */ -static inline uint8_t mavlink_msg_digicam_control_get_zoom_pos(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 7); -} - -/** - * @brief Get field zoom_step from digicam_control message - * - * @return -100 to 100 //Zooming step value to offset zoom from the current position. - */ -static inline int8_t mavlink_msg_digicam_control_get_zoom_step(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int8_t(msg, 8); -} - -/** - * @brief Get field focus_lock from digicam_control message - * - * @return 0: unlock focus or keep unlocked, 1: lock focus or keep locked, 3: re-lock focus. - */ -static inline uint8_t mavlink_msg_digicam_control_get_focus_lock(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 9); -} - -/** - * @brief Get field shot from digicam_control message - * - * @return 0: ignore, 1: shot or start filming. - */ -static inline uint8_t mavlink_msg_digicam_control_get_shot(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 10); -} - -/** - * @brief Get field command_id from digicam_control message - * - * @return Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once. - */ -static inline uint8_t mavlink_msg_digicam_control_get_command_id(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 11); -} - -/** - * @brief Get field extra_param from digicam_control message - * - * @return Extra parameters enumeration (0 means ignore). - */ -static inline uint8_t mavlink_msg_digicam_control_get_extra_param(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 12); -} - -/** - * @brief Get field extra_value from digicam_control message - * - * @return Correspondent value to given extra_param. - */ -static inline float mavlink_msg_digicam_control_get_extra_value(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 0); -} - -/** - * @brief Decode a digicam_control message into a struct - * - * @param msg The message to decode - * @param digicam_control C-struct to decode the message contents into - */ -static inline void mavlink_msg_digicam_control_decode(const mavlink_message_t* msg, mavlink_digicam_control_t* digicam_control) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - digicam_control->extra_value = mavlink_msg_digicam_control_get_extra_value(msg); - digicam_control->target_system = mavlink_msg_digicam_control_get_target_system(msg); - digicam_control->target_component = mavlink_msg_digicam_control_get_target_component(msg); - digicam_control->session = mavlink_msg_digicam_control_get_session(msg); - digicam_control->zoom_pos = mavlink_msg_digicam_control_get_zoom_pos(msg); - digicam_control->zoom_step = mavlink_msg_digicam_control_get_zoom_step(msg); - digicam_control->focus_lock = mavlink_msg_digicam_control_get_focus_lock(msg); - digicam_control->shot = mavlink_msg_digicam_control_get_shot(msg); - digicam_control->command_id = mavlink_msg_digicam_control_get_command_id(msg); - digicam_control->extra_param = mavlink_msg_digicam_control_get_extra_param(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_DIGICAM_CONTROL_LEN? msg->len : MAVLINK_MSG_ID_DIGICAM_CONTROL_LEN; - memset(digicam_control, 0, MAVLINK_MSG_ID_DIGICAM_CONTROL_LEN); - memcpy(digicam_control, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_ekf_status_report.h b/ardupilotmega/mavlink_msg_ekf_status_report.h deleted file mode 100644 index 395e11d46..000000000 --- a/ardupilotmega/mavlink_msg_ekf_status_report.h +++ /dev/null @@ -1,363 +0,0 @@ -#pragma once -// MESSAGE EKF_STATUS_REPORT PACKING - -#define MAVLINK_MSG_ID_EKF_STATUS_REPORT 193 - -MAVPACKED( -typedef struct __mavlink_ekf_status_report_t { - float velocity_variance; /*< Velocity variance.*/ - float pos_horiz_variance; /*< Horizontal Position variance.*/ - float pos_vert_variance; /*< Vertical Position variance.*/ - float compass_variance; /*< Compass variance.*/ - float terrain_alt_variance; /*< Terrain Altitude variance.*/ - uint16_t flags; /*< Flags.*/ - float airspeed_variance; /*< Airspeed variance.*/ -}) mavlink_ekf_status_report_t; - -#define MAVLINK_MSG_ID_EKF_STATUS_REPORT_LEN 26 -#define MAVLINK_MSG_ID_EKF_STATUS_REPORT_MIN_LEN 22 -#define MAVLINK_MSG_ID_193_LEN 26 -#define MAVLINK_MSG_ID_193_MIN_LEN 22 - -#define MAVLINK_MSG_ID_EKF_STATUS_REPORT_CRC 71 -#define MAVLINK_MSG_ID_193_CRC 71 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_EKF_STATUS_REPORT { \ - 193, \ - "EKF_STATUS_REPORT", \ - 7, \ - { { "flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 20, offsetof(mavlink_ekf_status_report_t, flags) }, \ - { "velocity_variance", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_ekf_status_report_t, velocity_variance) }, \ - { "pos_horiz_variance", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_ekf_status_report_t, pos_horiz_variance) }, \ - { "pos_vert_variance", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_ekf_status_report_t, pos_vert_variance) }, \ - { "compass_variance", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_ekf_status_report_t, compass_variance) }, \ - { "terrain_alt_variance", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_ekf_status_report_t, terrain_alt_variance) }, \ - { "airspeed_variance", NULL, MAVLINK_TYPE_FLOAT, 0, 22, offsetof(mavlink_ekf_status_report_t, airspeed_variance) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_EKF_STATUS_REPORT { \ - "EKF_STATUS_REPORT", \ - 7, \ - { { "flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 20, offsetof(mavlink_ekf_status_report_t, flags) }, \ - { "velocity_variance", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_ekf_status_report_t, velocity_variance) }, \ - { "pos_horiz_variance", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_ekf_status_report_t, pos_horiz_variance) }, \ - { "pos_vert_variance", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_ekf_status_report_t, pos_vert_variance) }, \ - { "compass_variance", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_ekf_status_report_t, compass_variance) }, \ - { "terrain_alt_variance", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_ekf_status_report_t, terrain_alt_variance) }, \ - { "airspeed_variance", NULL, MAVLINK_TYPE_FLOAT, 0, 22, offsetof(mavlink_ekf_status_report_t, airspeed_variance) }, \ - } \ -} -#endif - -/** - * @brief Pack a ekf_status_report message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param flags Flags. - * @param velocity_variance Velocity variance. - * @param pos_horiz_variance Horizontal Position variance. - * @param pos_vert_variance Vertical Position variance. - * @param compass_variance Compass variance. - * @param terrain_alt_variance Terrain Altitude variance. - * @param airspeed_variance Airspeed variance. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_ekf_status_report_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint16_t flags, float velocity_variance, float pos_horiz_variance, float pos_vert_variance, float compass_variance, float terrain_alt_variance, float airspeed_variance) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_EKF_STATUS_REPORT_LEN]; - _mav_put_float(buf, 0, velocity_variance); - _mav_put_float(buf, 4, pos_horiz_variance); - _mav_put_float(buf, 8, pos_vert_variance); - _mav_put_float(buf, 12, compass_variance); - _mav_put_float(buf, 16, terrain_alt_variance); - _mav_put_uint16_t(buf, 20, flags); - _mav_put_float(buf, 22, airspeed_variance); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_EKF_STATUS_REPORT_LEN); -#else - mavlink_ekf_status_report_t packet; - packet.velocity_variance = velocity_variance; - packet.pos_horiz_variance = pos_horiz_variance; - packet.pos_vert_variance = pos_vert_variance; - packet.compass_variance = compass_variance; - packet.terrain_alt_variance = terrain_alt_variance; - packet.flags = flags; - packet.airspeed_variance = airspeed_variance; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_EKF_STATUS_REPORT_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_EKF_STATUS_REPORT; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_EKF_STATUS_REPORT_MIN_LEN, MAVLINK_MSG_ID_EKF_STATUS_REPORT_LEN, MAVLINK_MSG_ID_EKF_STATUS_REPORT_CRC); -} - -/** - * @brief Pack a ekf_status_report message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param flags Flags. - * @param velocity_variance Velocity variance. - * @param pos_horiz_variance Horizontal Position variance. - * @param pos_vert_variance Vertical Position variance. - * @param compass_variance Compass variance. - * @param terrain_alt_variance Terrain Altitude variance. - * @param airspeed_variance Airspeed variance. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_ekf_status_report_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint16_t flags,float velocity_variance,float pos_horiz_variance,float pos_vert_variance,float compass_variance,float terrain_alt_variance,float airspeed_variance) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_EKF_STATUS_REPORT_LEN]; - _mav_put_float(buf, 0, velocity_variance); - _mav_put_float(buf, 4, pos_horiz_variance); - _mav_put_float(buf, 8, pos_vert_variance); - _mav_put_float(buf, 12, compass_variance); - _mav_put_float(buf, 16, terrain_alt_variance); - _mav_put_uint16_t(buf, 20, flags); - _mav_put_float(buf, 22, airspeed_variance); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_EKF_STATUS_REPORT_LEN); -#else - mavlink_ekf_status_report_t packet; - packet.velocity_variance = velocity_variance; - packet.pos_horiz_variance = pos_horiz_variance; - packet.pos_vert_variance = pos_vert_variance; - packet.compass_variance = compass_variance; - packet.terrain_alt_variance = terrain_alt_variance; - packet.flags = flags; - packet.airspeed_variance = airspeed_variance; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_EKF_STATUS_REPORT_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_EKF_STATUS_REPORT; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_EKF_STATUS_REPORT_MIN_LEN, MAVLINK_MSG_ID_EKF_STATUS_REPORT_LEN, MAVLINK_MSG_ID_EKF_STATUS_REPORT_CRC); -} - -/** - * @brief Encode a ekf_status_report struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param ekf_status_report C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_ekf_status_report_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_ekf_status_report_t* ekf_status_report) -{ - return mavlink_msg_ekf_status_report_pack(system_id, component_id, msg, ekf_status_report->flags, ekf_status_report->velocity_variance, ekf_status_report->pos_horiz_variance, ekf_status_report->pos_vert_variance, ekf_status_report->compass_variance, ekf_status_report->terrain_alt_variance, ekf_status_report->airspeed_variance); -} - -/** - * @brief Encode a ekf_status_report struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param ekf_status_report C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_ekf_status_report_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_ekf_status_report_t* ekf_status_report) -{ - return mavlink_msg_ekf_status_report_pack_chan(system_id, component_id, chan, msg, ekf_status_report->flags, ekf_status_report->velocity_variance, ekf_status_report->pos_horiz_variance, ekf_status_report->pos_vert_variance, ekf_status_report->compass_variance, ekf_status_report->terrain_alt_variance, ekf_status_report->airspeed_variance); -} - -/** - * @brief Send a ekf_status_report message - * @param chan MAVLink channel to send the message - * - * @param flags Flags. - * @param velocity_variance Velocity variance. - * @param pos_horiz_variance Horizontal Position variance. - * @param pos_vert_variance Vertical Position variance. - * @param compass_variance Compass variance. - * @param terrain_alt_variance Terrain Altitude variance. - * @param airspeed_variance Airspeed variance. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_ekf_status_report_send(mavlink_channel_t chan, uint16_t flags, float velocity_variance, float pos_horiz_variance, float pos_vert_variance, float compass_variance, float terrain_alt_variance, float airspeed_variance) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_EKF_STATUS_REPORT_LEN]; - _mav_put_float(buf, 0, velocity_variance); - _mav_put_float(buf, 4, pos_horiz_variance); - _mav_put_float(buf, 8, pos_vert_variance); - _mav_put_float(buf, 12, compass_variance); - _mav_put_float(buf, 16, terrain_alt_variance); - _mav_put_uint16_t(buf, 20, flags); - _mav_put_float(buf, 22, airspeed_variance); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EKF_STATUS_REPORT, buf, MAVLINK_MSG_ID_EKF_STATUS_REPORT_MIN_LEN, MAVLINK_MSG_ID_EKF_STATUS_REPORT_LEN, MAVLINK_MSG_ID_EKF_STATUS_REPORT_CRC); -#else - mavlink_ekf_status_report_t packet; - packet.velocity_variance = velocity_variance; - packet.pos_horiz_variance = pos_horiz_variance; - packet.pos_vert_variance = pos_vert_variance; - packet.compass_variance = compass_variance; - packet.terrain_alt_variance = terrain_alt_variance; - packet.flags = flags; - packet.airspeed_variance = airspeed_variance; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EKF_STATUS_REPORT, (const char *)&packet, MAVLINK_MSG_ID_EKF_STATUS_REPORT_MIN_LEN, MAVLINK_MSG_ID_EKF_STATUS_REPORT_LEN, MAVLINK_MSG_ID_EKF_STATUS_REPORT_CRC); -#endif -} - -/** - * @brief Send a ekf_status_report message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_ekf_status_report_send_struct(mavlink_channel_t chan, const mavlink_ekf_status_report_t* ekf_status_report) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_ekf_status_report_send(chan, ekf_status_report->flags, ekf_status_report->velocity_variance, ekf_status_report->pos_horiz_variance, ekf_status_report->pos_vert_variance, ekf_status_report->compass_variance, ekf_status_report->terrain_alt_variance, ekf_status_report->airspeed_variance); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EKF_STATUS_REPORT, (const char *)ekf_status_report, MAVLINK_MSG_ID_EKF_STATUS_REPORT_MIN_LEN, MAVLINK_MSG_ID_EKF_STATUS_REPORT_LEN, MAVLINK_MSG_ID_EKF_STATUS_REPORT_CRC); -#endif -} - -#if MAVLINK_MSG_ID_EKF_STATUS_REPORT_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_ekf_status_report_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint16_t flags, float velocity_variance, float pos_horiz_variance, float pos_vert_variance, float compass_variance, float terrain_alt_variance, float airspeed_variance) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_float(buf, 0, velocity_variance); - _mav_put_float(buf, 4, pos_horiz_variance); - _mav_put_float(buf, 8, pos_vert_variance); - _mav_put_float(buf, 12, compass_variance); - _mav_put_float(buf, 16, terrain_alt_variance); - _mav_put_uint16_t(buf, 20, flags); - _mav_put_float(buf, 22, airspeed_variance); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EKF_STATUS_REPORT, buf, MAVLINK_MSG_ID_EKF_STATUS_REPORT_MIN_LEN, MAVLINK_MSG_ID_EKF_STATUS_REPORT_LEN, MAVLINK_MSG_ID_EKF_STATUS_REPORT_CRC); -#else - mavlink_ekf_status_report_t *packet = (mavlink_ekf_status_report_t *)msgbuf; - packet->velocity_variance = velocity_variance; - packet->pos_horiz_variance = pos_horiz_variance; - packet->pos_vert_variance = pos_vert_variance; - packet->compass_variance = compass_variance; - packet->terrain_alt_variance = terrain_alt_variance; - packet->flags = flags; - packet->airspeed_variance = airspeed_variance; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EKF_STATUS_REPORT, (const char *)packet, MAVLINK_MSG_ID_EKF_STATUS_REPORT_MIN_LEN, MAVLINK_MSG_ID_EKF_STATUS_REPORT_LEN, MAVLINK_MSG_ID_EKF_STATUS_REPORT_CRC); -#endif -} -#endif - -#endif - -// MESSAGE EKF_STATUS_REPORT UNPACKING - - -/** - * @brief Get field flags from ekf_status_report message - * - * @return Flags. - */ -static inline uint16_t mavlink_msg_ekf_status_report_get_flags(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 20); -} - -/** - * @brief Get field velocity_variance from ekf_status_report message - * - * @return Velocity variance. - */ -static inline float mavlink_msg_ekf_status_report_get_velocity_variance(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 0); -} - -/** - * @brief Get field pos_horiz_variance from ekf_status_report message - * - * @return Horizontal Position variance. - */ -static inline float mavlink_msg_ekf_status_report_get_pos_horiz_variance(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 4); -} - -/** - * @brief Get field pos_vert_variance from ekf_status_report message - * - * @return Vertical Position variance. - */ -static inline float mavlink_msg_ekf_status_report_get_pos_vert_variance(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field compass_variance from ekf_status_report message - * - * @return Compass variance. - */ -static inline float mavlink_msg_ekf_status_report_get_compass_variance(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Get field terrain_alt_variance from ekf_status_report message - * - * @return Terrain Altitude variance. - */ -static inline float mavlink_msg_ekf_status_report_get_terrain_alt_variance(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 16); -} - -/** - * @brief Get field airspeed_variance from ekf_status_report message - * - * @return Airspeed variance. - */ -static inline float mavlink_msg_ekf_status_report_get_airspeed_variance(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 22); -} - -/** - * @brief Decode a ekf_status_report message into a struct - * - * @param msg The message to decode - * @param ekf_status_report C-struct to decode the message contents into - */ -static inline void mavlink_msg_ekf_status_report_decode(const mavlink_message_t* msg, mavlink_ekf_status_report_t* ekf_status_report) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - ekf_status_report->velocity_variance = mavlink_msg_ekf_status_report_get_velocity_variance(msg); - ekf_status_report->pos_horiz_variance = mavlink_msg_ekf_status_report_get_pos_horiz_variance(msg); - ekf_status_report->pos_vert_variance = mavlink_msg_ekf_status_report_get_pos_vert_variance(msg); - ekf_status_report->compass_variance = mavlink_msg_ekf_status_report_get_compass_variance(msg); - ekf_status_report->terrain_alt_variance = mavlink_msg_ekf_status_report_get_terrain_alt_variance(msg); - ekf_status_report->flags = mavlink_msg_ekf_status_report_get_flags(msg); - ekf_status_report->airspeed_variance = mavlink_msg_ekf_status_report_get_airspeed_variance(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_EKF_STATUS_REPORT_LEN? msg->len : MAVLINK_MSG_ID_EKF_STATUS_REPORT_LEN; - memset(ekf_status_report, 0, MAVLINK_MSG_ID_EKF_STATUS_REPORT_LEN); - memcpy(ekf_status_report, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_esc_telemetry_1_to_4.h b/ardupilotmega/mavlink_msg_esc_telemetry_1_to_4.h deleted file mode 100644 index ecd27b35b..000000000 --- a/ardupilotmega/mavlink_msg_esc_telemetry_1_to_4.h +++ /dev/null @@ -1,343 +0,0 @@ -#pragma once -// MESSAGE ESC_TELEMETRY_1_TO_4 PACKING - -#define MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4 11030 - - -typedef struct __mavlink_esc_telemetry_1_to_4_t { - uint16_t voltage[4]; /*< [cV] Voltage.*/ - uint16_t current[4]; /*< [cA] Current.*/ - uint16_t totalcurrent[4]; /*< [mAh] Total current.*/ - uint16_t rpm[4]; /*< [rpm] RPM (eRPM).*/ - uint16_t count[4]; /*< count of telemetry packets received (wraps at 65535).*/ - uint8_t temperature[4]; /*< [degC] Temperature.*/ -} mavlink_esc_telemetry_1_to_4_t; - -#define MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_LEN 44 -#define MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_MIN_LEN 44 -#define MAVLINK_MSG_ID_11030_LEN 44 -#define MAVLINK_MSG_ID_11030_MIN_LEN 44 - -#define MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_CRC 144 -#define MAVLINK_MSG_ID_11030_CRC 144 - -#define MAVLINK_MSG_ESC_TELEMETRY_1_TO_4_FIELD_VOLTAGE_LEN 4 -#define MAVLINK_MSG_ESC_TELEMETRY_1_TO_4_FIELD_CURRENT_LEN 4 -#define MAVLINK_MSG_ESC_TELEMETRY_1_TO_4_FIELD_TOTALCURRENT_LEN 4 -#define MAVLINK_MSG_ESC_TELEMETRY_1_TO_4_FIELD_RPM_LEN 4 -#define MAVLINK_MSG_ESC_TELEMETRY_1_TO_4_FIELD_COUNT_LEN 4 -#define MAVLINK_MSG_ESC_TELEMETRY_1_TO_4_FIELD_TEMPERATURE_LEN 4 - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_ESC_TELEMETRY_1_TO_4 { \ - 11030, \ - "ESC_TELEMETRY_1_TO_4", \ - 6, \ - { { "temperature", NULL, MAVLINK_TYPE_UINT8_T, 4, 40, offsetof(mavlink_esc_telemetry_1_to_4_t, temperature) }, \ - { "voltage", NULL, MAVLINK_TYPE_UINT16_T, 4, 0, offsetof(mavlink_esc_telemetry_1_to_4_t, voltage) }, \ - { "current", NULL, MAVLINK_TYPE_UINT16_T, 4, 8, offsetof(mavlink_esc_telemetry_1_to_4_t, current) }, \ - { "totalcurrent", NULL, MAVLINK_TYPE_UINT16_T, 4, 16, offsetof(mavlink_esc_telemetry_1_to_4_t, totalcurrent) }, \ - { "rpm", NULL, MAVLINK_TYPE_UINT16_T, 4, 24, offsetof(mavlink_esc_telemetry_1_to_4_t, rpm) }, \ - { "count", NULL, MAVLINK_TYPE_UINT16_T, 4, 32, offsetof(mavlink_esc_telemetry_1_to_4_t, count) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_ESC_TELEMETRY_1_TO_4 { \ - "ESC_TELEMETRY_1_TO_4", \ - 6, \ - { { "temperature", NULL, MAVLINK_TYPE_UINT8_T, 4, 40, offsetof(mavlink_esc_telemetry_1_to_4_t, temperature) }, \ - { "voltage", NULL, MAVLINK_TYPE_UINT16_T, 4, 0, offsetof(mavlink_esc_telemetry_1_to_4_t, voltage) }, \ - { "current", NULL, MAVLINK_TYPE_UINT16_T, 4, 8, offsetof(mavlink_esc_telemetry_1_to_4_t, current) }, \ - { "totalcurrent", NULL, MAVLINK_TYPE_UINT16_T, 4, 16, offsetof(mavlink_esc_telemetry_1_to_4_t, totalcurrent) }, \ - { "rpm", NULL, MAVLINK_TYPE_UINT16_T, 4, 24, offsetof(mavlink_esc_telemetry_1_to_4_t, rpm) }, \ - { "count", NULL, MAVLINK_TYPE_UINT16_T, 4, 32, offsetof(mavlink_esc_telemetry_1_to_4_t, count) }, \ - } \ -} -#endif - -/** - * @brief Pack a esc_telemetry_1_to_4 message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param temperature [degC] Temperature. - * @param voltage [cV] Voltage. - * @param current [cA] Current. - * @param totalcurrent [mAh] Total current. - * @param rpm [rpm] RPM (eRPM). - * @param count count of telemetry packets received (wraps at 65535). - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_esc_telemetry_1_to_4_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - const uint8_t *temperature, const uint16_t *voltage, const uint16_t *current, const uint16_t *totalcurrent, const uint16_t *rpm, const uint16_t *count) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_LEN]; - - _mav_put_uint16_t_array(buf, 0, voltage, 4); - _mav_put_uint16_t_array(buf, 8, current, 4); - _mav_put_uint16_t_array(buf, 16, totalcurrent, 4); - _mav_put_uint16_t_array(buf, 24, rpm, 4); - _mav_put_uint16_t_array(buf, 32, count, 4); - _mav_put_uint8_t_array(buf, 40, temperature, 4); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_LEN); -#else - mavlink_esc_telemetry_1_to_4_t packet; - - mav_array_memcpy(packet.voltage, voltage, sizeof(uint16_t)*4); - mav_array_memcpy(packet.current, current, sizeof(uint16_t)*4); - mav_array_memcpy(packet.totalcurrent, totalcurrent, sizeof(uint16_t)*4); - mav_array_memcpy(packet.rpm, rpm, sizeof(uint16_t)*4); - mav_array_memcpy(packet.count, count, sizeof(uint16_t)*4); - mav_array_memcpy(packet.temperature, temperature, sizeof(uint8_t)*4); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_MIN_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_CRC); -} - -/** - * @brief Pack a esc_telemetry_1_to_4 message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param temperature [degC] Temperature. - * @param voltage [cV] Voltage. - * @param current [cA] Current. - * @param totalcurrent [mAh] Total current. - * @param rpm [rpm] RPM (eRPM). - * @param count count of telemetry packets received (wraps at 65535). - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_esc_telemetry_1_to_4_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - const uint8_t *temperature,const uint16_t *voltage,const uint16_t *current,const uint16_t *totalcurrent,const uint16_t *rpm,const uint16_t *count) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_LEN]; - - _mav_put_uint16_t_array(buf, 0, voltage, 4); - _mav_put_uint16_t_array(buf, 8, current, 4); - _mav_put_uint16_t_array(buf, 16, totalcurrent, 4); - _mav_put_uint16_t_array(buf, 24, rpm, 4); - _mav_put_uint16_t_array(buf, 32, count, 4); - _mav_put_uint8_t_array(buf, 40, temperature, 4); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_LEN); -#else - mavlink_esc_telemetry_1_to_4_t packet; - - mav_array_memcpy(packet.voltage, voltage, sizeof(uint16_t)*4); - mav_array_memcpy(packet.current, current, sizeof(uint16_t)*4); - mav_array_memcpy(packet.totalcurrent, totalcurrent, sizeof(uint16_t)*4); - mav_array_memcpy(packet.rpm, rpm, sizeof(uint16_t)*4); - mav_array_memcpy(packet.count, count, sizeof(uint16_t)*4); - mav_array_memcpy(packet.temperature, temperature, sizeof(uint8_t)*4); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_MIN_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_CRC); -} - -/** - * @brief Encode a esc_telemetry_1_to_4 struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param esc_telemetry_1_to_4 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_esc_telemetry_1_to_4_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_esc_telemetry_1_to_4_t* esc_telemetry_1_to_4) -{ - return mavlink_msg_esc_telemetry_1_to_4_pack(system_id, component_id, msg, esc_telemetry_1_to_4->temperature, esc_telemetry_1_to_4->voltage, esc_telemetry_1_to_4->current, esc_telemetry_1_to_4->totalcurrent, esc_telemetry_1_to_4->rpm, esc_telemetry_1_to_4->count); -} - -/** - * @brief Encode a esc_telemetry_1_to_4 struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param esc_telemetry_1_to_4 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_esc_telemetry_1_to_4_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_esc_telemetry_1_to_4_t* esc_telemetry_1_to_4) -{ - return mavlink_msg_esc_telemetry_1_to_4_pack_chan(system_id, component_id, chan, msg, esc_telemetry_1_to_4->temperature, esc_telemetry_1_to_4->voltage, esc_telemetry_1_to_4->current, esc_telemetry_1_to_4->totalcurrent, esc_telemetry_1_to_4->rpm, esc_telemetry_1_to_4->count); -} - -/** - * @brief Send a esc_telemetry_1_to_4 message - * @param chan MAVLink channel to send the message - * - * @param temperature [degC] Temperature. - * @param voltage [cV] Voltage. - * @param current [cA] Current. - * @param totalcurrent [mAh] Total current. - * @param rpm [rpm] RPM (eRPM). - * @param count count of telemetry packets received (wraps at 65535). - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_esc_telemetry_1_to_4_send(mavlink_channel_t chan, const uint8_t *temperature, const uint16_t *voltage, const uint16_t *current, const uint16_t *totalcurrent, const uint16_t *rpm, const uint16_t *count) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_LEN]; - - _mav_put_uint16_t_array(buf, 0, voltage, 4); - _mav_put_uint16_t_array(buf, 8, current, 4); - _mav_put_uint16_t_array(buf, 16, totalcurrent, 4); - _mav_put_uint16_t_array(buf, 24, rpm, 4); - _mav_put_uint16_t_array(buf, 32, count, 4); - _mav_put_uint8_t_array(buf, 40, temperature, 4); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4, buf, MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_MIN_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_CRC); -#else - mavlink_esc_telemetry_1_to_4_t packet; - - mav_array_memcpy(packet.voltage, voltage, sizeof(uint16_t)*4); - mav_array_memcpy(packet.current, current, sizeof(uint16_t)*4); - mav_array_memcpy(packet.totalcurrent, totalcurrent, sizeof(uint16_t)*4); - mav_array_memcpy(packet.rpm, rpm, sizeof(uint16_t)*4); - mav_array_memcpy(packet.count, count, sizeof(uint16_t)*4); - mav_array_memcpy(packet.temperature, temperature, sizeof(uint8_t)*4); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4, (const char *)&packet, MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_MIN_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_CRC); -#endif -} - -/** - * @brief Send a esc_telemetry_1_to_4 message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_esc_telemetry_1_to_4_send_struct(mavlink_channel_t chan, const mavlink_esc_telemetry_1_to_4_t* esc_telemetry_1_to_4) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_esc_telemetry_1_to_4_send(chan, esc_telemetry_1_to_4->temperature, esc_telemetry_1_to_4->voltage, esc_telemetry_1_to_4->current, esc_telemetry_1_to_4->totalcurrent, esc_telemetry_1_to_4->rpm, esc_telemetry_1_to_4->count); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4, (const char *)esc_telemetry_1_to_4, MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_MIN_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_CRC); -#endif -} - -#if MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_esc_telemetry_1_to_4_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, const uint8_t *temperature, const uint16_t *voltage, const uint16_t *current, const uint16_t *totalcurrent, const uint16_t *rpm, const uint16_t *count) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - - _mav_put_uint16_t_array(buf, 0, voltage, 4); - _mav_put_uint16_t_array(buf, 8, current, 4); - _mav_put_uint16_t_array(buf, 16, totalcurrent, 4); - _mav_put_uint16_t_array(buf, 24, rpm, 4); - _mav_put_uint16_t_array(buf, 32, count, 4); - _mav_put_uint8_t_array(buf, 40, temperature, 4); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4, buf, MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_MIN_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_CRC); -#else - mavlink_esc_telemetry_1_to_4_t *packet = (mavlink_esc_telemetry_1_to_4_t *)msgbuf; - - mav_array_memcpy(packet->voltage, voltage, sizeof(uint16_t)*4); - mav_array_memcpy(packet->current, current, sizeof(uint16_t)*4); - mav_array_memcpy(packet->totalcurrent, totalcurrent, sizeof(uint16_t)*4); - mav_array_memcpy(packet->rpm, rpm, sizeof(uint16_t)*4); - mav_array_memcpy(packet->count, count, sizeof(uint16_t)*4); - mav_array_memcpy(packet->temperature, temperature, sizeof(uint8_t)*4); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4, (const char *)packet, MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_MIN_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_CRC); -#endif -} -#endif - -#endif - -// MESSAGE ESC_TELEMETRY_1_TO_4 UNPACKING - - -/** - * @brief Get field temperature from esc_telemetry_1_to_4 message - * - * @return [degC] Temperature. - */ -static inline uint16_t mavlink_msg_esc_telemetry_1_to_4_get_temperature(const mavlink_message_t* msg, uint8_t *temperature) -{ - return _MAV_RETURN_uint8_t_array(msg, temperature, 4, 40); -} - -/** - * @brief Get field voltage from esc_telemetry_1_to_4 message - * - * @return [cV] Voltage. - */ -static inline uint16_t mavlink_msg_esc_telemetry_1_to_4_get_voltage(const mavlink_message_t* msg, uint16_t *voltage) -{ - return _MAV_RETURN_uint16_t_array(msg, voltage, 4, 0); -} - -/** - * @brief Get field current from esc_telemetry_1_to_4 message - * - * @return [cA] Current. - */ -static inline uint16_t mavlink_msg_esc_telemetry_1_to_4_get_current(const mavlink_message_t* msg, uint16_t *current) -{ - return _MAV_RETURN_uint16_t_array(msg, current, 4, 8); -} - -/** - * @brief Get field totalcurrent from esc_telemetry_1_to_4 message - * - * @return [mAh] Total current. - */ -static inline uint16_t mavlink_msg_esc_telemetry_1_to_4_get_totalcurrent(const mavlink_message_t* msg, uint16_t *totalcurrent) -{ - return _MAV_RETURN_uint16_t_array(msg, totalcurrent, 4, 16); -} - -/** - * @brief Get field rpm from esc_telemetry_1_to_4 message - * - * @return [rpm] RPM (eRPM). - */ -static inline uint16_t mavlink_msg_esc_telemetry_1_to_4_get_rpm(const mavlink_message_t* msg, uint16_t *rpm) -{ - return _MAV_RETURN_uint16_t_array(msg, rpm, 4, 24); -} - -/** - * @brief Get field count from esc_telemetry_1_to_4 message - * - * @return count of telemetry packets received (wraps at 65535). - */ -static inline uint16_t mavlink_msg_esc_telemetry_1_to_4_get_count(const mavlink_message_t* msg, uint16_t *count) -{ - return _MAV_RETURN_uint16_t_array(msg, count, 4, 32); -} - -/** - * @brief Decode a esc_telemetry_1_to_4 message into a struct - * - * @param msg The message to decode - * @param esc_telemetry_1_to_4 C-struct to decode the message contents into - */ -static inline void mavlink_msg_esc_telemetry_1_to_4_decode(const mavlink_message_t* msg, mavlink_esc_telemetry_1_to_4_t* esc_telemetry_1_to_4) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_esc_telemetry_1_to_4_get_voltage(msg, esc_telemetry_1_to_4->voltage); - mavlink_msg_esc_telemetry_1_to_4_get_current(msg, esc_telemetry_1_to_4->current); - mavlink_msg_esc_telemetry_1_to_4_get_totalcurrent(msg, esc_telemetry_1_to_4->totalcurrent); - mavlink_msg_esc_telemetry_1_to_4_get_rpm(msg, esc_telemetry_1_to_4->rpm); - mavlink_msg_esc_telemetry_1_to_4_get_count(msg, esc_telemetry_1_to_4->count); - mavlink_msg_esc_telemetry_1_to_4_get_temperature(msg, esc_telemetry_1_to_4->temperature); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_LEN? msg->len : MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_LEN; - memset(esc_telemetry_1_to_4, 0, MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_LEN); - memcpy(esc_telemetry_1_to_4, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_esc_telemetry_5_to_8.h b/ardupilotmega/mavlink_msg_esc_telemetry_5_to_8.h deleted file mode 100644 index 98d9ce725..000000000 --- a/ardupilotmega/mavlink_msg_esc_telemetry_5_to_8.h +++ /dev/null @@ -1,343 +0,0 @@ -#pragma once -// MESSAGE ESC_TELEMETRY_5_TO_8 PACKING - -#define MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8 11031 - - -typedef struct __mavlink_esc_telemetry_5_to_8_t { - uint16_t voltage[4]; /*< [cV] Voltage.*/ - uint16_t current[4]; /*< [cA] Current.*/ - uint16_t totalcurrent[4]; /*< [mAh] Total current.*/ - uint16_t rpm[4]; /*< [rpm] RPM (eRPM).*/ - uint16_t count[4]; /*< count of telemetry packets received (wraps at 65535).*/ - uint8_t temperature[4]; /*< [degC] Temperature.*/ -} mavlink_esc_telemetry_5_to_8_t; - -#define MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_LEN 44 -#define MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_MIN_LEN 44 -#define MAVLINK_MSG_ID_11031_LEN 44 -#define MAVLINK_MSG_ID_11031_MIN_LEN 44 - -#define MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_CRC 133 -#define MAVLINK_MSG_ID_11031_CRC 133 - -#define MAVLINK_MSG_ESC_TELEMETRY_5_TO_8_FIELD_VOLTAGE_LEN 4 -#define MAVLINK_MSG_ESC_TELEMETRY_5_TO_8_FIELD_CURRENT_LEN 4 -#define MAVLINK_MSG_ESC_TELEMETRY_5_TO_8_FIELD_TOTALCURRENT_LEN 4 -#define MAVLINK_MSG_ESC_TELEMETRY_5_TO_8_FIELD_RPM_LEN 4 -#define MAVLINK_MSG_ESC_TELEMETRY_5_TO_8_FIELD_COUNT_LEN 4 -#define MAVLINK_MSG_ESC_TELEMETRY_5_TO_8_FIELD_TEMPERATURE_LEN 4 - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_ESC_TELEMETRY_5_TO_8 { \ - 11031, \ - "ESC_TELEMETRY_5_TO_8", \ - 6, \ - { { "temperature", NULL, MAVLINK_TYPE_UINT8_T, 4, 40, offsetof(mavlink_esc_telemetry_5_to_8_t, temperature) }, \ - { "voltage", NULL, MAVLINK_TYPE_UINT16_T, 4, 0, offsetof(mavlink_esc_telemetry_5_to_8_t, voltage) }, \ - { "current", NULL, MAVLINK_TYPE_UINT16_T, 4, 8, offsetof(mavlink_esc_telemetry_5_to_8_t, current) }, \ - { "totalcurrent", NULL, MAVLINK_TYPE_UINT16_T, 4, 16, offsetof(mavlink_esc_telemetry_5_to_8_t, totalcurrent) }, \ - { "rpm", NULL, MAVLINK_TYPE_UINT16_T, 4, 24, offsetof(mavlink_esc_telemetry_5_to_8_t, rpm) }, \ - { "count", NULL, MAVLINK_TYPE_UINT16_T, 4, 32, offsetof(mavlink_esc_telemetry_5_to_8_t, count) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_ESC_TELEMETRY_5_TO_8 { \ - "ESC_TELEMETRY_5_TO_8", \ - 6, \ - { { "temperature", NULL, MAVLINK_TYPE_UINT8_T, 4, 40, offsetof(mavlink_esc_telemetry_5_to_8_t, temperature) }, \ - { "voltage", NULL, MAVLINK_TYPE_UINT16_T, 4, 0, offsetof(mavlink_esc_telemetry_5_to_8_t, voltage) }, \ - { "current", NULL, MAVLINK_TYPE_UINT16_T, 4, 8, offsetof(mavlink_esc_telemetry_5_to_8_t, current) }, \ - { "totalcurrent", NULL, MAVLINK_TYPE_UINT16_T, 4, 16, offsetof(mavlink_esc_telemetry_5_to_8_t, totalcurrent) }, \ - { "rpm", NULL, MAVLINK_TYPE_UINT16_T, 4, 24, offsetof(mavlink_esc_telemetry_5_to_8_t, rpm) }, \ - { "count", NULL, MAVLINK_TYPE_UINT16_T, 4, 32, offsetof(mavlink_esc_telemetry_5_to_8_t, count) }, \ - } \ -} -#endif - -/** - * @brief Pack a esc_telemetry_5_to_8 message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param temperature [degC] Temperature. - * @param voltage [cV] Voltage. - * @param current [cA] Current. - * @param totalcurrent [mAh] Total current. - * @param rpm [rpm] RPM (eRPM). - * @param count count of telemetry packets received (wraps at 65535). - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_esc_telemetry_5_to_8_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - const uint8_t *temperature, const uint16_t *voltage, const uint16_t *current, const uint16_t *totalcurrent, const uint16_t *rpm, const uint16_t *count) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_LEN]; - - _mav_put_uint16_t_array(buf, 0, voltage, 4); - _mav_put_uint16_t_array(buf, 8, current, 4); - _mav_put_uint16_t_array(buf, 16, totalcurrent, 4); - _mav_put_uint16_t_array(buf, 24, rpm, 4); - _mav_put_uint16_t_array(buf, 32, count, 4); - _mav_put_uint8_t_array(buf, 40, temperature, 4); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_LEN); -#else - mavlink_esc_telemetry_5_to_8_t packet; - - mav_array_memcpy(packet.voltage, voltage, sizeof(uint16_t)*4); - mav_array_memcpy(packet.current, current, sizeof(uint16_t)*4); - mav_array_memcpy(packet.totalcurrent, totalcurrent, sizeof(uint16_t)*4); - mav_array_memcpy(packet.rpm, rpm, sizeof(uint16_t)*4); - mav_array_memcpy(packet.count, count, sizeof(uint16_t)*4); - mav_array_memcpy(packet.temperature, temperature, sizeof(uint8_t)*4); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_MIN_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_CRC); -} - -/** - * @brief Pack a esc_telemetry_5_to_8 message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param temperature [degC] Temperature. - * @param voltage [cV] Voltage. - * @param current [cA] Current. - * @param totalcurrent [mAh] Total current. - * @param rpm [rpm] RPM (eRPM). - * @param count count of telemetry packets received (wraps at 65535). - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_esc_telemetry_5_to_8_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - const uint8_t *temperature,const uint16_t *voltage,const uint16_t *current,const uint16_t *totalcurrent,const uint16_t *rpm,const uint16_t *count) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_LEN]; - - _mav_put_uint16_t_array(buf, 0, voltage, 4); - _mav_put_uint16_t_array(buf, 8, current, 4); - _mav_put_uint16_t_array(buf, 16, totalcurrent, 4); - _mav_put_uint16_t_array(buf, 24, rpm, 4); - _mav_put_uint16_t_array(buf, 32, count, 4); - _mav_put_uint8_t_array(buf, 40, temperature, 4); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_LEN); -#else - mavlink_esc_telemetry_5_to_8_t packet; - - mav_array_memcpy(packet.voltage, voltage, sizeof(uint16_t)*4); - mav_array_memcpy(packet.current, current, sizeof(uint16_t)*4); - mav_array_memcpy(packet.totalcurrent, totalcurrent, sizeof(uint16_t)*4); - mav_array_memcpy(packet.rpm, rpm, sizeof(uint16_t)*4); - mav_array_memcpy(packet.count, count, sizeof(uint16_t)*4); - mav_array_memcpy(packet.temperature, temperature, sizeof(uint8_t)*4); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_MIN_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_CRC); -} - -/** - * @brief Encode a esc_telemetry_5_to_8 struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param esc_telemetry_5_to_8 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_esc_telemetry_5_to_8_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_esc_telemetry_5_to_8_t* esc_telemetry_5_to_8) -{ - return mavlink_msg_esc_telemetry_5_to_8_pack(system_id, component_id, msg, esc_telemetry_5_to_8->temperature, esc_telemetry_5_to_8->voltage, esc_telemetry_5_to_8->current, esc_telemetry_5_to_8->totalcurrent, esc_telemetry_5_to_8->rpm, esc_telemetry_5_to_8->count); -} - -/** - * @brief Encode a esc_telemetry_5_to_8 struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param esc_telemetry_5_to_8 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_esc_telemetry_5_to_8_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_esc_telemetry_5_to_8_t* esc_telemetry_5_to_8) -{ - return mavlink_msg_esc_telemetry_5_to_8_pack_chan(system_id, component_id, chan, msg, esc_telemetry_5_to_8->temperature, esc_telemetry_5_to_8->voltage, esc_telemetry_5_to_8->current, esc_telemetry_5_to_8->totalcurrent, esc_telemetry_5_to_8->rpm, esc_telemetry_5_to_8->count); -} - -/** - * @brief Send a esc_telemetry_5_to_8 message - * @param chan MAVLink channel to send the message - * - * @param temperature [degC] Temperature. - * @param voltage [cV] Voltage. - * @param current [cA] Current. - * @param totalcurrent [mAh] Total current. - * @param rpm [rpm] RPM (eRPM). - * @param count count of telemetry packets received (wraps at 65535). - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_esc_telemetry_5_to_8_send(mavlink_channel_t chan, const uint8_t *temperature, const uint16_t *voltage, const uint16_t *current, const uint16_t *totalcurrent, const uint16_t *rpm, const uint16_t *count) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_LEN]; - - _mav_put_uint16_t_array(buf, 0, voltage, 4); - _mav_put_uint16_t_array(buf, 8, current, 4); - _mav_put_uint16_t_array(buf, 16, totalcurrent, 4); - _mav_put_uint16_t_array(buf, 24, rpm, 4); - _mav_put_uint16_t_array(buf, 32, count, 4); - _mav_put_uint8_t_array(buf, 40, temperature, 4); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8, buf, MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_MIN_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_CRC); -#else - mavlink_esc_telemetry_5_to_8_t packet; - - mav_array_memcpy(packet.voltage, voltage, sizeof(uint16_t)*4); - mav_array_memcpy(packet.current, current, sizeof(uint16_t)*4); - mav_array_memcpy(packet.totalcurrent, totalcurrent, sizeof(uint16_t)*4); - mav_array_memcpy(packet.rpm, rpm, sizeof(uint16_t)*4); - mav_array_memcpy(packet.count, count, sizeof(uint16_t)*4); - mav_array_memcpy(packet.temperature, temperature, sizeof(uint8_t)*4); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8, (const char *)&packet, MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_MIN_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_CRC); -#endif -} - -/** - * @brief Send a esc_telemetry_5_to_8 message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_esc_telemetry_5_to_8_send_struct(mavlink_channel_t chan, const mavlink_esc_telemetry_5_to_8_t* esc_telemetry_5_to_8) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_esc_telemetry_5_to_8_send(chan, esc_telemetry_5_to_8->temperature, esc_telemetry_5_to_8->voltage, esc_telemetry_5_to_8->current, esc_telemetry_5_to_8->totalcurrent, esc_telemetry_5_to_8->rpm, esc_telemetry_5_to_8->count); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8, (const char *)esc_telemetry_5_to_8, MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_MIN_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_CRC); -#endif -} - -#if MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_esc_telemetry_5_to_8_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, const uint8_t *temperature, const uint16_t *voltage, const uint16_t *current, const uint16_t *totalcurrent, const uint16_t *rpm, const uint16_t *count) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - - _mav_put_uint16_t_array(buf, 0, voltage, 4); - _mav_put_uint16_t_array(buf, 8, current, 4); - _mav_put_uint16_t_array(buf, 16, totalcurrent, 4); - _mav_put_uint16_t_array(buf, 24, rpm, 4); - _mav_put_uint16_t_array(buf, 32, count, 4); - _mav_put_uint8_t_array(buf, 40, temperature, 4); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8, buf, MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_MIN_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_CRC); -#else - mavlink_esc_telemetry_5_to_8_t *packet = (mavlink_esc_telemetry_5_to_8_t *)msgbuf; - - mav_array_memcpy(packet->voltage, voltage, sizeof(uint16_t)*4); - mav_array_memcpy(packet->current, current, sizeof(uint16_t)*4); - mav_array_memcpy(packet->totalcurrent, totalcurrent, sizeof(uint16_t)*4); - mav_array_memcpy(packet->rpm, rpm, sizeof(uint16_t)*4); - mav_array_memcpy(packet->count, count, sizeof(uint16_t)*4); - mav_array_memcpy(packet->temperature, temperature, sizeof(uint8_t)*4); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8, (const char *)packet, MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_MIN_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_CRC); -#endif -} -#endif - -#endif - -// MESSAGE ESC_TELEMETRY_5_TO_8 UNPACKING - - -/** - * @brief Get field temperature from esc_telemetry_5_to_8 message - * - * @return [degC] Temperature. - */ -static inline uint16_t mavlink_msg_esc_telemetry_5_to_8_get_temperature(const mavlink_message_t* msg, uint8_t *temperature) -{ - return _MAV_RETURN_uint8_t_array(msg, temperature, 4, 40); -} - -/** - * @brief Get field voltage from esc_telemetry_5_to_8 message - * - * @return [cV] Voltage. - */ -static inline uint16_t mavlink_msg_esc_telemetry_5_to_8_get_voltage(const mavlink_message_t* msg, uint16_t *voltage) -{ - return _MAV_RETURN_uint16_t_array(msg, voltage, 4, 0); -} - -/** - * @brief Get field current from esc_telemetry_5_to_8 message - * - * @return [cA] Current. - */ -static inline uint16_t mavlink_msg_esc_telemetry_5_to_8_get_current(const mavlink_message_t* msg, uint16_t *current) -{ - return _MAV_RETURN_uint16_t_array(msg, current, 4, 8); -} - -/** - * @brief Get field totalcurrent from esc_telemetry_5_to_8 message - * - * @return [mAh] Total current. - */ -static inline uint16_t mavlink_msg_esc_telemetry_5_to_8_get_totalcurrent(const mavlink_message_t* msg, uint16_t *totalcurrent) -{ - return _MAV_RETURN_uint16_t_array(msg, totalcurrent, 4, 16); -} - -/** - * @brief Get field rpm from esc_telemetry_5_to_8 message - * - * @return [rpm] RPM (eRPM). - */ -static inline uint16_t mavlink_msg_esc_telemetry_5_to_8_get_rpm(const mavlink_message_t* msg, uint16_t *rpm) -{ - return _MAV_RETURN_uint16_t_array(msg, rpm, 4, 24); -} - -/** - * @brief Get field count from esc_telemetry_5_to_8 message - * - * @return count of telemetry packets received (wraps at 65535). - */ -static inline uint16_t mavlink_msg_esc_telemetry_5_to_8_get_count(const mavlink_message_t* msg, uint16_t *count) -{ - return _MAV_RETURN_uint16_t_array(msg, count, 4, 32); -} - -/** - * @brief Decode a esc_telemetry_5_to_8 message into a struct - * - * @param msg The message to decode - * @param esc_telemetry_5_to_8 C-struct to decode the message contents into - */ -static inline void mavlink_msg_esc_telemetry_5_to_8_decode(const mavlink_message_t* msg, mavlink_esc_telemetry_5_to_8_t* esc_telemetry_5_to_8) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_esc_telemetry_5_to_8_get_voltage(msg, esc_telemetry_5_to_8->voltage); - mavlink_msg_esc_telemetry_5_to_8_get_current(msg, esc_telemetry_5_to_8->current); - mavlink_msg_esc_telemetry_5_to_8_get_totalcurrent(msg, esc_telemetry_5_to_8->totalcurrent); - mavlink_msg_esc_telemetry_5_to_8_get_rpm(msg, esc_telemetry_5_to_8->rpm); - mavlink_msg_esc_telemetry_5_to_8_get_count(msg, esc_telemetry_5_to_8->count); - mavlink_msg_esc_telemetry_5_to_8_get_temperature(msg, esc_telemetry_5_to_8->temperature); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_LEN? msg->len : MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_LEN; - memset(esc_telemetry_5_to_8, 0, MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_LEN); - memcpy(esc_telemetry_5_to_8, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_esc_telemetry_9_to_12.h b/ardupilotmega/mavlink_msg_esc_telemetry_9_to_12.h deleted file mode 100644 index 9660bc389..000000000 --- a/ardupilotmega/mavlink_msg_esc_telemetry_9_to_12.h +++ /dev/null @@ -1,343 +0,0 @@ -#pragma once -// MESSAGE ESC_TELEMETRY_9_TO_12 PACKING - -#define MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12 11032 - - -typedef struct __mavlink_esc_telemetry_9_to_12_t { - uint16_t voltage[4]; /*< [cV] Voltage.*/ - uint16_t current[4]; /*< [cA] Current.*/ - uint16_t totalcurrent[4]; /*< [mAh] Total current.*/ - uint16_t rpm[4]; /*< [rpm] RPM (eRPM).*/ - uint16_t count[4]; /*< count of telemetry packets received (wraps at 65535).*/ - uint8_t temperature[4]; /*< [degC] Temperature.*/ -} mavlink_esc_telemetry_9_to_12_t; - -#define MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_LEN 44 -#define MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_MIN_LEN 44 -#define MAVLINK_MSG_ID_11032_LEN 44 -#define MAVLINK_MSG_ID_11032_MIN_LEN 44 - -#define MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_CRC 85 -#define MAVLINK_MSG_ID_11032_CRC 85 - -#define MAVLINK_MSG_ESC_TELEMETRY_9_TO_12_FIELD_VOLTAGE_LEN 4 -#define MAVLINK_MSG_ESC_TELEMETRY_9_TO_12_FIELD_CURRENT_LEN 4 -#define MAVLINK_MSG_ESC_TELEMETRY_9_TO_12_FIELD_TOTALCURRENT_LEN 4 -#define MAVLINK_MSG_ESC_TELEMETRY_9_TO_12_FIELD_RPM_LEN 4 -#define MAVLINK_MSG_ESC_TELEMETRY_9_TO_12_FIELD_COUNT_LEN 4 -#define MAVLINK_MSG_ESC_TELEMETRY_9_TO_12_FIELD_TEMPERATURE_LEN 4 - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_ESC_TELEMETRY_9_TO_12 { \ - 11032, \ - "ESC_TELEMETRY_9_TO_12", \ - 6, \ - { { "temperature", NULL, MAVLINK_TYPE_UINT8_T, 4, 40, offsetof(mavlink_esc_telemetry_9_to_12_t, temperature) }, \ - { "voltage", NULL, MAVLINK_TYPE_UINT16_T, 4, 0, offsetof(mavlink_esc_telemetry_9_to_12_t, voltage) }, \ - { "current", NULL, MAVLINK_TYPE_UINT16_T, 4, 8, offsetof(mavlink_esc_telemetry_9_to_12_t, current) }, \ - { "totalcurrent", NULL, MAVLINK_TYPE_UINT16_T, 4, 16, offsetof(mavlink_esc_telemetry_9_to_12_t, totalcurrent) }, \ - { "rpm", NULL, MAVLINK_TYPE_UINT16_T, 4, 24, offsetof(mavlink_esc_telemetry_9_to_12_t, rpm) }, \ - { "count", NULL, MAVLINK_TYPE_UINT16_T, 4, 32, offsetof(mavlink_esc_telemetry_9_to_12_t, count) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_ESC_TELEMETRY_9_TO_12 { \ - "ESC_TELEMETRY_9_TO_12", \ - 6, \ - { { "temperature", NULL, MAVLINK_TYPE_UINT8_T, 4, 40, offsetof(mavlink_esc_telemetry_9_to_12_t, temperature) }, \ - { "voltage", NULL, MAVLINK_TYPE_UINT16_T, 4, 0, offsetof(mavlink_esc_telemetry_9_to_12_t, voltage) }, \ - { "current", NULL, MAVLINK_TYPE_UINT16_T, 4, 8, offsetof(mavlink_esc_telemetry_9_to_12_t, current) }, \ - { "totalcurrent", NULL, MAVLINK_TYPE_UINT16_T, 4, 16, offsetof(mavlink_esc_telemetry_9_to_12_t, totalcurrent) }, \ - { "rpm", NULL, MAVLINK_TYPE_UINT16_T, 4, 24, offsetof(mavlink_esc_telemetry_9_to_12_t, rpm) }, \ - { "count", NULL, MAVLINK_TYPE_UINT16_T, 4, 32, offsetof(mavlink_esc_telemetry_9_to_12_t, count) }, \ - } \ -} -#endif - -/** - * @brief Pack a esc_telemetry_9_to_12 message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param temperature [degC] Temperature. - * @param voltage [cV] Voltage. - * @param current [cA] Current. - * @param totalcurrent [mAh] Total current. - * @param rpm [rpm] RPM (eRPM). - * @param count count of telemetry packets received (wraps at 65535). - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_esc_telemetry_9_to_12_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - const uint8_t *temperature, const uint16_t *voltage, const uint16_t *current, const uint16_t *totalcurrent, const uint16_t *rpm, const uint16_t *count) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_LEN]; - - _mav_put_uint16_t_array(buf, 0, voltage, 4); - _mav_put_uint16_t_array(buf, 8, current, 4); - _mav_put_uint16_t_array(buf, 16, totalcurrent, 4); - _mav_put_uint16_t_array(buf, 24, rpm, 4); - _mav_put_uint16_t_array(buf, 32, count, 4); - _mav_put_uint8_t_array(buf, 40, temperature, 4); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_LEN); -#else - mavlink_esc_telemetry_9_to_12_t packet; - - mav_array_memcpy(packet.voltage, voltage, sizeof(uint16_t)*4); - mav_array_memcpy(packet.current, current, sizeof(uint16_t)*4); - mav_array_memcpy(packet.totalcurrent, totalcurrent, sizeof(uint16_t)*4); - mav_array_memcpy(packet.rpm, rpm, sizeof(uint16_t)*4); - mav_array_memcpy(packet.count, count, sizeof(uint16_t)*4); - mav_array_memcpy(packet.temperature, temperature, sizeof(uint8_t)*4); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_MIN_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_CRC); -} - -/** - * @brief Pack a esc_telemetry_9_to_12 message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param temperature [degC] Temperature. - * @param voltage [cV] Voltage. - * @param current [cA] Current. - * @param totalcurrent [mAh] Total current. - * @param rpm [rpm] RPM (eRPM). - * @param count count of telemetry packets received (wraps at 65535). - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_esc_telemetry_9_to_12_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - const uint8_t *temperature,const uint16_t *voltage,const uint16_t *current,const uint16_t *totalcurrent,const uint16_t *rpm,const uint16_t *count) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_LEN]; - - _mav_put_uint16_t_array(buf, 0, voltage, 4); - _mav_put_uint16_t_array(buf, 8, current, 4); - _mav_put_uint16_t_array(buf, 16, totalcurrent, 4); - _mav_put_uint16_t_array(buf, 24, rpm, 4); - _mav_put_uint16_t_array(buf, 32, count, 4); - _mav_put_uint8_t_array(buf, 40, temperature, 4); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_LEN); -#else - mavlink_esc_telemetry_9_to_12_t packet; - - mav_array_memcpy(packet.voltage, voltage, sizeof(uint16_t)*4); - mav_array_memcpy(packet.current, current, sizeof(uint16_t)*4); - mav_array_memcpy(packet.totalcurrent, totalcurrent, sizeof(uint16_t)*4); - mav_array_memcpy(packet.rpm, rpm, sizeof(uint16_t)*4); - mav_array_memcpy(packet.count, count, sizeof(uint16_t)*4); - mav_array_memcpy(packet.temperature, temperature, sizeof(uint8_t)*4); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_MIN_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_CRC); -} - -/** - * @brief Encode a esc_telemetry_9_to_12 struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param esc_telemetry_9_to_12 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_esc_telemetry_9_to_12_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_esc_telemetry_9_to_12_t* esc_telemetry_9_to_12) -{ - return mavlink_msg_esc_telemetry_9_to_12_pack(system_id, component_id, msg, esc_telemetry_9_to_12->temperature, esc_telemetry_9_to_12->voltage, esc_telemetry_9_to_12->current, esc_telemetry_9_to_12->totalcurrent, esc_telemetry_9_to_12->rpm, esc_telemetry_9_to_12->count); -} - -/** - * @brief Encode a esc_telemetry_9_to_12 struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param esc_telemetry_9_to_12 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_esc_telemetry_9_to_12_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_esc_telemetry_9_to_12_t* esc_telemetry_9_to_12) -{ - return mavlink_msg_esc_telemetry_9_to_12_pack_chan(system_id, component_id, chan, msg, esc_telemetry_9_to_12->temperature, esc_telemetry_9_to_12->voltage, esc_telemetry_9_to_12->current, esc_telemetry_9_to_12->totalcurrent, esc_telemetry_9_to_12->rpm, esc_telemetry_9_to_12->count); -} - -/** - * @brief Send a esc_telemetry_9_to_12 message - * @param chan MAVLink channel to send the message - * - * @param temperature [degC] Temperature. - * @param voltage [cV] Voltage. - * @param current [cA] Current. - * @param totalcurrent [mAh] Total current. - * @param rpm [rpm] RPM (eRPM). - * @param count count of telemetry packets received (wraps at 65535). - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_esc_telemetry_9_to_12_send(mavlink_channel_t chan, const uint8_t *temperature, const uint16_t *voltage, const uint16_t *current, const uint16_t *totalcurrent, const uint16_t *rpm, const uint16_t *count) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_LEN]; - - _mav_put_uint16_t_array(buf, 0, voltage, 4); - _mav_put_uint16_t_array(buf, 8, current, 4); - _mav_put_uint16_t_array(buf, 16, totalcurrent, 4); - _mav_put_uint16_t_array(buf, 24, rpm, 4); - _mav_put_uint16_t_array(buf, 32, count, 4); - _mav_put_uint8_t_array(buf, 40, temperature, 4); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12, buf, MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_MIN_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_CRC); -#else - mavlink_esc_telemetry_9_to_12_t packet; - - mav_array_memcpy(packet.voltage, voltage, sizeof(uint16_t)*4); - mav_array_memcpy(packet.current, current, sizeof(uint16_t)*4); - mav_array_memcpy(packet.totalcurrent, totalcurrent, sizeof(uint16_t)*4); - mav_array_memcpy(packet.rpm, rpm, sizeof(uint16_t)*4); - mav_array_memcpy(packet.count, count, sizeof(uint16_t)*4); - mav_array_memcpy(packet.temperature, temperature, sizeof(uint8_t)*4); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12, (const char *)&packet, MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_MIN_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_CRC); -#endif -} - -/** - * @brief Send a esc_telemetry_9_to_12 message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_esc_telemetry_9_to_12_send_struct(mavlink_channel_t chan, const mavlink_esc_telemetry_9_to_12_t* esc_telemetry_9_to_12) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_esc_telemetry_9_to_12_send(chan, esc_telemetry_9_to_12->temperature, esc_telemetry_9_to_12->voltage, esc_telemetry_9_to_12->current, esc_telemetry_9_to_12->totalcurrent, esc_telemetry_9_to_12->rpm, esc_telemetry_9_to_12->count); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12, (const char *)esc_telemetry_9_to_12, MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_MIN_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_CRC); -#endif -} - -#if MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_esc_telemetry_9_to_12_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, const uint8_t *temperature, const uint16_t *voltage, const uint16_t *current, const uint16_t *totalcurrent, const uint16_t *rpm, const uint16_t *count) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - - _mav_put_uint16_t_array(buf, 0, voltage, 4); - _mav_put_uint16_t_array(buf, 8, current, 4); - _mav_put_uint16_t_array(buf, 16, totalcurrent, 4); - _mav_put_uint16_t_array(buf, 24, rpm, 4); - _mav_put_uint16_t_array(buf, 32, count, 4); - _mav_put_uint8_t_array(buf, 40, temperature, 4); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12, buf, MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_MIN_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_CRC); -#else - mavlink_esc_telemetry_9_to_12_t *packet = (mavlink_esc_telemetry_9_to_12_t *)msgbuf; - - mav_array_memcpy(packet->voltage, voltage, sizeof(uint16_t)*4); - mav_array_memcpy(packet->current, current, sizeof(uint16_t)*4); - mav_array_memcpy(packet->totalcurrent, totalcurrent, sizeof(uint16_t)*4); - mav_array_memcpy(packet->rpm, rpm, sizeof(uint16_t)*4); - mav_array_memcpy(packet->count, count, sizeof(uint16_t)*4); - mav_array_memcpy(packet->temperature, temperature, sizeof(uint8_t)*4); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12, (const char *)packet, MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_MIN_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_LEN, MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_CRC); -#endif -} -#endif - -#endif - -// MESSAGE ESC_TELEMETRY_9_TO_12 UNPACKING - - -/** - * @brief Get field temperature from esc_telemetry_9_to_12 message - * - * @return [degC] Temperature. - */ -static inline uint16_t mavlink_msg_esc_telemetry_9_to_12_get_temperature(const mavlink_message_t* msg, uint8_t *temperature) -{ - return _MAV_RETURN_uint8_t_array(msg, temperature, 4, 40); -} - -/** - * @brief Get field voltage from esc_telemetry_9_to_12 message - * - * @return [cV] Voltage. - */ -static inline uint16_t mavlink_msg_esc_telemetry_9_to_12_get_voltage(const mavlink_message_t* msg, uint16_t *voltage) -{ - return _MAV_RETURN_uint16_t_array(msg, voltage, 4, 0); -} - -/** - * @brief Get field current from esc_telemetry_9_to_12 message - * - * @return [cA] Current. - */ -static inline uint16_t mavlink_msg_esc_telemetry_9_to_12_get_current(const mavlink_message_t* msg, uint16_t *current) -{ - return _MAV_RETURN_uint16_t_array(msg, current, 4, 8); -} - -/** - * @brief Get field totalcurrent from esc_telemetry_9_to_12 message - * - * @return [mAh] Total current. - */ -static inline uint16_t mavlink_msg_esc_telemetry_9_to_12_get_totalcurrent(const mavlink_message_t* msg, uint16_t *totalcurrent) -{ - return _MAV_RETURN_uint16_t_array(msg, totalcurrent, 4, 16); -} - -/** - * @brief Get field rpm from esc_telemetry_9_to_12 message - * - * @return [rpm] RPM (eRPM). - */ -static inline uint16_t mavlink_msg_esc_telemetry_9_to_12_get_rpm(const mavlink_message_t* msg, uint16_t *rpm) -{ - return _MAV_RETURN_uint16_t_array(msg, rpm, 4, 24); -} - -/** - * @brief Get field count from esc_telemetry_9_to_12 message - * - * @return count of telemetry packets received (wraps at 65535). - */ -static inline uint16_t mavlink_msg_esc_telemetry_9_to_12_get_count(const mavlink_message_t* msg, uint16_t *count) -{ - return _MAV_RETURN_uint16_t_array(msg, count, 4, 32); -} - -/** - * @brief Decode a esc_telemetry_9_to_12 message into a struct - * - * @param msg The message to decode - * @param esc_telemetry_9_to_12 C-struct to decode the message contents into - */ -static inline void mavlink_msg_esc_telemetry_9_to_12_decode(const mavlink_message_t* msg, mavlink_esc_telemetry_9_to_12_t* esc_telemetry_9_to_12) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_esc_telemetry_9_to_12_get_voltage(msg, esc_telemetry_9_to_12->voltage); - mavlink_msg_esc_telemetry_9_to_12_get_current(msg, esc_telemetry_9_to_12->current); - mavlink_msg_esc_telemetry_9_to_12_get_totalcurrent(msg, esc_telemetry_9_to_12->totalcurrent); - mavlink_msg_esc_telemetry_9_to_12_get_rpm(msg, esc_telemetry_9_to_12->rpm); - mavlink_msg_esc_telemetry_9_to_12_get_count(msg, esc_telemetry_9_to_12->count); - mavlink_msg_esc_telemetry_9_to_12_get_temperature(msg, esc_telemetry_9_to_12->temperature); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_LEN? msg->len : MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_LEN; - memset(esc_telemetry_9_to_12, 0, MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_LEN); - memcpy(esc_telemetry_9_to_12, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_fence_fetch_point.h b/ardupilotmega/mavlink_msg_fence_fetch_point.h deleted file mode 100644 index ce2f54e77..000000000 --- a/ardupilotmega/mavlink_msg_fence_fetch_point.h +++ /dev/null @@ -1,263 +0,0 @@ -#pragma once -// MESSAGE FENCE_FETCH_POINT PACKING - -#define MAVLINK_MSG_ID_FENCE_FETCH_POINT 161 - - -typedef struct __mavlink_fence_fetch_point_t { - uint8_t target_system; /*< System ID.*/ - uint8_t target_component; /*< Component ID.*/ - uint8_t idx; /*< Point index (first point is 1, 0 is for return point).*/ -} mavlink_fence_fetch_point_t; - -#define MAVLINK_MSG_ID_FENCE_FETCH_POINT_LEN 3 -#define MAVLINK_MSG_ID_FENCE_FETCH_POINT_MIN_LEN 3 -#define MAVLINK_MSG_ID_161_LEN 3 -#define MAVLINK_MSG_ID_161_MIN_LEN 3 - -#define MAVLINK_MSG_ID_FENCE_FETCH_POINT_CRC 68 -#define MAVLINK_MSG_ID_161_CRC 68 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_FENCE_FETCH_POINT { \ - 161, \ - "FENCE_FETCH_POINT", \ - 3, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_fence_fetch_point_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_fence_fetch_point_t, target_component) }, \ - { "idx", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_fence_fetch_point_t, idx) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_FENCE_FETCH_POINT { \ - "FENCE_FETCH_POINT", \ - 3, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_fence_fetch_point_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_fence_fetch_point_t, target_component) }, \ - { "idx", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_fence_fetch_point_t, idx) }, \ - } \ -} -#endif - -/** - * @brief Pack a fence_fetch_point message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param target_system System ID. - * @param target_component Component ID. - * @param idx Point index (first point is 1, 0 is for return point). - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_fence_fetch_point_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, uint8_t idx) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FENCE_FETCH_POINT_LEN]; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, idx); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FENCE_FETCH_POINT_LEN); -#else - mavlink_fence_fetch_point_t packet; - packet.target_system = target_system; - packet.target_component = target_component; - packet.idx = idx; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FENCE_FETCH_POINT_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_FENCE_FETCH_POINT; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FENCE_FETCH_POINT_MIN_LEN, MAVLINK_MSG_ID_FENCE_FETCH_POINT_LEN, MAVLINK_MSG_ID_FENCE_FETCH_POINT_CRC); -} - -/** - * @brief Pack a fence_fetch_point message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param target_system System ID. - * @param target_component Component ID. - * @param idx Point index (first point is 1, 0 is for return point). - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_fence_fetch_point_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,uint8_t idx) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FENCE_FETCH_POINT_LEN]; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, idx); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FENCE_FETCH_POINT_LEN); -#else - mavlink_fence_fetch_point_t packet; - packet.target_system = target_system; - packet.target_component = target_component; - packet.idx = idx; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FENCE_FETCH_POINT_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_FENCE_FETCH_POINT; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FENCE_FETCH_POINT_MIN_LEN, MAVLINK_MSG_ID_FENCE_FETCH_POINT_LEN, MAVLINK_MSG_ID_FENCE_FETCH_POINT_CRC); -} - -/** - * @brief Encode a fence_fetch_point struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param fence_fetch_point C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_fence_fetch_point_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_fence_fetch_point_t* fence_fetch_point) -{ - return mavlink_msg_fence_fetch_point_pack(system_id, component_id, msg, fence_fetch_point->target_system, fence_fetch_point->target_component, fence_fetch_point->idx); -} - -/** - * @brief Encode a fence_fetch_point struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param fence_fetch_point C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_fence_fetch_point_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_fence_fetch_point_t* fence_fetch_point) -{ - return mavlink_msg_fence_fetch_point_pack_chan(system_id, component_id, chan, msg, fence_fetch_point->target_system, fence_fetch_point->target_component, fence_fetch_point->idx); -} - -/** - * @brief Send a fence_fetch_point message - * @param chan MAVLink channel to send the message - * - * @param target_system System ID. - * @param target_component Component ID. - * @param idx Point index (first point is 1, 0 is for return point). - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_fence_fetch_point_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t idx) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FENCE_FETCH_POINT_LEN]; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, idx); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FENCE_FETCH_POINT, buf, MAVLINK_MSG_ID_FENCE_FETCH_POINT_MIN_LEN, MAVLINK_MSG_ID_FENCE_FETCH_POINT_LEN, MAVLINK_MSG_ID_FENCE_FETCH_POINT_CRC); -#else - mavlink_fence_fetch_point_t packet; - packet.target_system = target_system; - packet.target_component = target_component; - packet.idx = idx; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FENCE_FETCH_POINT, (const char *)&packet, MAVLINK_MSG_ID_FENCE_FETCH_POINT_MIN_LEN, MAVLINK_MSG_ID_FENCE_FETCH_POINT_LEN, MAVLINK_MSG_ID_FENCE_FETCH_POINT_CRC); -#endif -} - -/** - * @brief Send a fence_fetch_point message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_fence_fetch_point_send_struct(mavlink_channel_t chan, const mavlink_fence_fetch_point_t* fence_fetch_point) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_fence_fetch_point_send(chan, fence_fetch_point->target_system, fence_fetch_point->target_component, fence_fetch_point->idx); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FENCE_FETCH_POINT, (const char *)fence_fetch_point, MAVLINK_MSG_ID_FENCE_FETCH_POINT_MIN_LEN, MAVLINK_MSG_ID_FENCE_FETCH_POINT_LEN, MAVLINK_MSG_ID_FENCE_FETCH_POINT_CRC); -#endif -} - -#if MAVLINK_MSG_ID_FENCE_FETCH_POINT_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_fence_fetch_point_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t idx) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, idx); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FENCE_FETCH_POINT, buf, MAVLINK_MSG_ID_FENCE_FETCH_POINT_MIN_LEN, MAVLINK_MSG_ID_FENCE_FETCH_POINT_LEN, MAVLINK_MSG_ID_FENCE_FETCH_POINT_CRC); -#else - mavlink_fence_fetch_point_t *packet = (mavlink_fence_fetch_point_t *)msgbuf; - packet->target_system = target_system; - packet->target_component = target_component; - packet->idx = idx; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FENCE_FETCH_POINT, (const char *)packet, MAVLINK_MSG_ID_FENCE_FETCH_POINT_MIN_LEN, MAVLINK_MSG_ID_FENCE_FETCH_POINT_LEN, MAVLINK_MSG_ID_FENCE_FETCH_POINT_CRC); -#endif -} -#endif - -#endif - -// MESSAGE FENCE_FETCH_POINT UNPACKING - - -/** - * @brief Get field target_system from fence_fetch_point message - * - * @return System ID. - */ -static inline uint8_t mavlink_msg_fence_fetch_point_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 0); -} - -/** - * @brief Get field target_component from fence_fetch_point message - * - * @return Component ID. - */ -static inline uint8_t mavlink_msg_fence_fetch_point_get_target_component(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 1); -} - -/** - * @brief Get field idx from fence_fetch_point message - * - * @return Point index (first point is 1, 0 is for return point). - */ -static inline uint8_t mavlink_msg_fence_fetch_point_get_idx(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 2); -} - -/** - * @brief Decode a fence_fetch_point message into a struct - * - * @param msg The message to decode - * @param fence_fetch_point C-struct to decode the message contents into - */ -static inline void mavlink_msg_fence_fetch_point_decode(const mavlink_message_t* msg, mavlink_fence_fetch_point_t* fence_fetch_point) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - fence_fetch_point->target_system = mavlink_msg_fence_fetch_point_get_target_system(msg); - fence_fetch_point->target_component = mavlink_msg_fence_fetch_point_get_target_component(msg); - fence_fetch_point->idx = mavlink_msg_fence_fetch_point_get_idx(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_FENCE_FETCH_POINT_LEN? msg->len : MAVLINK_MSG_ID_FENCE_FETCH_POINT_LEN; - memset(fence_fetch_point, 0, MAVLINK_MSG_ID_FENCE_FETCH_POINT_LEN); - memcpy(fence_fetch_point, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_fence_point.h b/ardupilotmega/mavlink_msg_fence_point.h deleted file mode 100644 index 41140ac34..000000000 --- a/ardupilotmega/mavlink_msg_fence_point.h +++ /dev/null @@ -1,338 +0,0 @@ -#pragma once -// MESSAGE FENCE_POINT PACKING - -#define MAVLINK_MSG_ID_FENCE_POINT 160 - - -typedef struct __mavlink_fence_point_t { - float lat; /*< [deg] Latitude of point.*/ - float lng; /*< [deg] Longitude of point.*/ - uint8_t target_system; /*< System ID.*/ - uint8_t target_component; /*< Component ID.*/ - uint8_t idx; /*< Point index (first point is 1, 0 is for return point).*/ - uint8_t count; /*< Total number of points (for sanity checking).*/ -} mavlink_fence_point_t; - -#define MAVLINK_MSG_ID_FENCE_POINT_LEN 12 -#define MAVLINK_MSG_ID_FENCE_POINT_MIN_LEN 12 -#define MAVLINK_MSG_ID_160_LEN 12 -#define MAVLINK_MSG_ID_160_MIN_LEN 12 - -#define MAVLINK_MSG_ID_FENCE_POINT_CRC 78 -#define MAVLINK_MSG_ID_160_CRC 78 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_FENCE_POINT { \ - 160, \ - "FENCE_POINT", \ - 6, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_fence_point_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_fence_point_t, target_component) }, \ - { "idx", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_fence_point_t, idx) }, \ - { "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_fence_point_t, count) }, \ - { "lat", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_fence_point_t, lat) }, \ - { "lng", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_fence_point_t, lng) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_FENCE_POINT { \ - "FENCE_POINT", \ - 6, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_fence_point_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_fence_point_t, target_component) }, \ - { "idx", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_fence_point_t, idx) }, \ - { "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_fence_point_t, count) }, \ - { "lat", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_fence_point_t, lat) }, \ - { "lng", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_fence_point_t, lng) }, \ - } \ -} -#endif - -/** - * @brief Pack a fence_point message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param target_system System ID. - * @param target_component Component ID. - * @param idx Point index (first point is 1, 0 is for return point). - * @param count Total number of points (for sanity checking). - * @param lat [deg] Latitude of point. - * @param lng [deg] Longitude of point. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_fence_point_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, uint8_t idx, uint8_t count, float lat, float lng) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FENCE_POINT_LEN]; - _mav_put_float(buf, 0, lat); - _mav_put_float(buf, 4, lng); - _mav_put_uint8_t(buf, 8, target_system); - _mav_put_uint8_t(buf, 9, target_component); - _mav_put_uint8_t(buf, 10, idx); - _mav_put_uint8_t(buf, 11, count); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FENCE_POINT_LEN); -#else - mavlink_fence_point_t packet; - packet.lat = lat; - packet.lng = lng; - packet.target_system = target_system; - packet.target_component = target_component; - packet.idx = idx; - packet.count = count; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FENCE_POINT_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_FENCE_POINT; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FENCE_POINT_MIN_LEN, MAVLINK_MSG_ID_FENCE_POINT_LEN, MAVLINK_MSG_ID_FENCE_POINT_CRC); -} - -/** - * @brief Pack a fence_point message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param target_system System ID. - * @param target_component Component ID. - * @param idx Point index (first point is 1, 0 is for return point). - * @param count Total number of points (for sanity checking). - * @param lat [deg] Latitude of point. - * @param lng [deg] Longitude of point. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_fence_point_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,uint8_t idx,uint8_t count,float lat,float lng) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FENCE_POINT_LEN]; - _mav_put_float(buf, 0, lat); - _mav_put_float(buf, 4, lng); - _mav_put_uint8_t(buf, 8, target_system); - _mav_put_uint8_t(buf, 9, target_component); - _mav_put_uint8_t(buf, 10, idx); - _mav_put_uint8_t(buf, 11, count); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FENCE_POINT_LEN); -#else - mavlink_fence_point_t packet; - packet.lat = lat; - packet.lng = lng; - packet.target_system = target_system; - packet.target_component = target_component; - packet.idx = idx; - packet.count = count; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FENCE_POINT_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_FENCE_POINT; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FENCE_POINT_MIN_LEN, MAVLINK_MSG_ID_FENCE_POINT_LEN, MAVLINK_MSG_ID_FENCE_POINT_CRC); -} - -/** - * @brief Encode a fence_point struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param fence_point C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_fence_point_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_fence_point_t* fence_point) -{ - return mavlink_msg_fence_point_pack(system_id, component_id, msg, fence_point->target_system, fence_point->target_component, fence_point->idx, fence_point->count, fence_point->lat, fence_point->lng); -} - -/** - * @brief Encode a fence_point struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param fence_point C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_fence_point_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_fence_point_t* fence_point) -{ - return mavlink_msg_fence_point_pack_chan(system_id, component_id, chan, msg, fence_point->target_system, fence_point->target_component, fence_point->idx, fence_point->count, fence_point->lat, fence_point->lng); -} - -/** - * @brief Send a fence_point message - * @param chan MAVLink channel to send the message - * - * @param target_system System ID. - * @param target_component Component ID. - * @param idx Point index (first point is 1, 0 is for return point). - * @param count Total number of points (for sanity checking). - * @param lat [deg] Latitude of point. - * @param lng [deg] Longitude of point. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_fence_point_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t idx, uint8_t count, float lat, float lng) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FENCE_POINT_LEN]; - _mav_put_float(buf, 0, lat); - _mav_put_float(buf, 4, lng); - _mav_put_uint8_t(buf, 8, target_system); - _mav_put_uint8_t(buf, 9, target_component); - _mav_put_uint8_t(buf, 10, idx); - _mav_put_uint8_t(buf, 11, count); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FENCE_POINT, buf, MAVLINK_MSG_ID_FENCE_POINT_MIN_LEN, MAVLINK_MSG_ID_FENCE_POINT_LEN, MAVLINK_MSG_ID_FENCE_POINT_CRC); -#else - mavlink_fence_point_t packet; - packet.lat = lat; - packet.lng = lng; - packet.target_system = target_system; - packet.target_component = target_component; - packet.idx = idx; - packet.count = count; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FENCE_POINT, (const char *)&packet, MAVLINK_MSG_ID_FENCE_POINT_MIN_LEN, MAVLINK_MSG_ID_FENCE_POINT_LEN, MAVLINK_MSG_ID_FENCE_POINT_CRC); -#endif -} - -/** - * @brief Send a fence_point message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_fence_point_send_struct(mavlink_channel_t chan, const mavlink_fence_point_t* fence_point) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_fence_point_send(chan, fence_point->target_system, fence_point->target_component, fence_point->idx, fence_point->count, fence_point->lat, fence_point->lng); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FENCE_POINT, (const char *)fence_point, MAVLINK_MSG_ID_FENCE_POINT_MIN_LEN, MAVLINK_MSG_ID_FENCE_POINT_LEN, MAVLINK_MSG_ID_FENCE_POINT_CRC); -#endif -} - -#if MAVLINK_MSG_ID_FENCE_POINT_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_fence_point_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t idx, uint8_t count, float lat, float lng) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_float(buf, 0, lat); - _mav_put_float(buf, 4, lng); - _mav_put_uint8_t(buf, 8, target_system); - _mav_put_uint8_t(buf, 9, target_component); - _mav_put_uint8_t(buf, 10, idx); - _mav_put_uint8_t(buf, 11, count); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FENCE_POINT, buf, MAVLINK_MSG_ID_FENCE_POINT_MIN_LEN, MAVLINK_MSG_ID_FENCE_POINT_LEN, MAVLINK_MSG_ID_FENCE_POINT_CRC); -#else - mavlink_fence_point_t *packet = (mavlink_fence_point_t *)msgbuf; - packet->lat = lat; - packet->lng = lng; - packet->target_system = target_system; - packet->target_component = target_component; - packet->idx = idx; - packet->count = count; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FENCE_POINT, (const char *)packet, MAVLINK_MSG_ID_FENCE_POINT_MIN_LEN, MAVLINK_MSG_ID_FENCE_POINT_LEN, MAVLINK_MSG_ID_FENCE_POINT_CRC); -#endif -} -#endif - -#endif - -// MESSAGE FENCE_POINT UNPACKING - - -/** - * @brief Get field target_system from fence_point message - * - * @return System ID. - */ -static inline uint8_t mavlink_msg_fence_point_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 8); -} - -/** - * @brief Get field target_component from fence_point message - * - * @return Component ID. - */ -static inline uint8_t mavlink_msg_fence_point_get_target_component(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 9); -} - -/** - * @brief Get field idx from fence_point message - * - * @return Point index (first point is 1, 0 is for return point). - */ -static inline uint8_t mavlink_msg_fence_point_get_idx(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 10); -} - -/** - * @brief Get field count from fence_point message - * - * @return Total number of points (for sanity checking). - */ -static inline uint8_t mavlink_msg_fence_point_get_count(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 11); -} - -/** - * @brief Get field lat from fence_point message - * - * @return [deg] Latitude of point. - */ -static inline float mavlink_msg_fence_point_get_lat(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 0); -} - -/** - * @brief Get field lng from fence_point message - * - * @return [deg] Longitude of point. - */ -static inline float mavlink_msg_fence_point_get_lng(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 4); -} - -/** - * @brief Decode a fence_point message into a struct - * - * @param msg The message to decode - * @param fence_point C-struct to decode the message contents into - */ -static inline void mavlink_msg_fence_point_decode(const mavlink_message_t* msg, mavlink_fence_point_t* fence_point) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - fence_point->lat = mavlink_msg_fence_point_get_lat(msg); - fence_point->lng = mavlink_msg_fence_point_get_lng(msg); - fence_point->target_system = mavlink_msg_fence_point_get_target_system(msg); - fence_point->target_component = mavlink_msg_fence_point_get_target_component(msg); - fence_point->idx = mavlink_msg_fence_point_get_idx(msg); - fence_point->count = mavlink_msg_fence_point_get_count(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_FENCE_POINT_LEN? msg->len : MAVLINK_MSG_ID_FENCE_POINT_LEN; - memset(fence_point, 0, MAVLINK_MSG_ID_FENCE_POINT_LEN); - memcpy(fence_point, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_gimbal_control.h b/ardupilotmega/mavlink_msg_gimbal_control.h deleted file mode 100644 index 71c972c90..000000000 --- a/ardupilotmega/mavlink_msg_gimbal_control.h +++ /dev/null @@ -1,313 +0,0 @@ -#pragma once -// MESSAGE GIMBAL_CONTROL PACKING - -#define MAVLINK_MSG_ID_GIMBAL_CONTROL 201 - - -typedef struct __mavlink_gimbal_control_t { - float demanded_rate_x; /*< [rad/s] Demanded angular rate X.*/ - float demanded_rate_y; /*< [rad/s] Demanded angular rate Y.*/ - float demanded_rate_z; /*< [rad/s] Demanded angular rate Z.*/ - uint8_t target_system; /*< System ID.*/ - uint8_t target_component; /*< Component ID.*/ -} mavlink_gimbal_control_t; - -#define MAVLINK_MSG_ID_GIMBAL_CONTROL_LEN 14 -#define MAVLINK_MSG_ID_GIMBAL_CONTROL_MIN_LEN 14 -#define MAVLINK_MSG_ID_201_LEN 14 -#define MAVLINK_MSG_ID_201_MIN_LEN 14 - -#define MAVLINK_MSG_ID_GIMBAL_CONTROL_CRC 205 -#define MAVLINK_MSG_ID_201_CRC 205 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_GIMBAL_CONTROL { \ - 201, \ - "GIMBAL_CONTROL", \ - 5, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_gimbal_control_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_gimbal_control_t, target_component) }, \ - { "demanded_rate_x", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_gimbal_control_t, demanded_rate_x) }, \ - { "demanded_rate_y", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_gimbal_control_t, demanded_rate_y) }, \ - { "demanded_rate_z", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_gimbal_control_t, demanded_rate_z) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_GIMBAL_CONTROL { \ - "GIMBAL_CONTROL", \ - 5, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_gimbal_control_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_gimbal_control_t, target_component) }, \ - { "demanded_rate_x", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_gimbal_control_t, demanded_rate_x) }, \ - { "demanded_rate_y", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_gimbal_control_t, demanded_rate_y) }, \ - { "demanded_rate_z", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_gimbal_control_t, demanded_rate_z) }, \ - } \ -} -#endif - -/** - * @brief Pack a gimbal_control message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param target_system System ID. - * @param target_component Component ID. - * @param demanded_rate_x [rad/s] Demanded angular rate X. - * @param demanded_rate_y [rad/s] Demanded angular rate Y. - * @param demanded_rate_z [rad/s] Demanded angular rate Z. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_gimbal_control_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, float demanded_rate_x, float demanded_rate_y, float demanded_rate_z) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_GIMBAL_CONTROL_LEN]; - _mav_put_float(buf, 0, demanded_rate_x); - _mav_put_float(buf, 4, demanded_rate_y); - _mav_put_float(buf, 8, demanded_rate_z); - _mav_put_uint8_t(buf, 12, target_system); - _mav_put_uint8_t(buf, 13, target_component); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GIMBAL_CONTROL_LEN); -#else - mavlink_gimbal_control_t packet; - packet.demanded_rate_x = demanded_rate_x; - packet.demanded_rate_y = demanded_rate_y; - packet.demanded_rate_z = demanded_rate_z; - packet.target_system = target_system; - packet.target_component = target_component; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_CONTROL_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_GIMBAL_CONTROL; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GIMBAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_CONTROL_LEN, MAVLINK_MSG_ID_GIMBAL_CONTROL_CRC); -} - -/** - * @brief Pack a gimbal_control message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param target_system System ID. - * @param target_component Component ID. - * @param demanded_rate_x [rad/s] Demanded angular rate X. - * @param demanded_rate_y [rad/s] Demanded angular rate Y. - * @param demanded_rate_z [rad/s] Demanded angular rate Z. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_gimbal_control_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,float demanded_rate_x,float demanded_rate_y,float demanded_rate_z) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_GIMBAL_CONTROL_LEN]; - _mav_put_float(buf, 0, demanded_rate_x); - _mav_put_float(buf, 4, demanded_rate_y); - _mav_put_float(buf, 8, demanded_rate_z); - _mav_put_uint8_t(buf, 12, target_system); - _mav_put_uint8_t(buf, 13, target_component); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GIMBAL_CONTROL_LEN); -#else - mavlink_gimbal_control_t packet; - packet.demanded_rate_x = demanded_rate_x; - packet.demanded_rate_y = demanded_rate_y; - packet.demanded_rate_z = demanded_rate_z; - packet.target_system = target_system; - packet.target_component = target_component; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_CONTROL_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_GIMBAL_CONTROL; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GIMBAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_CONTROL_LEN, MAVLINK_MSG_ID_GIMBAL_CONTROL_CRC); -} - -/** - * @brief Encode a gimbal_control struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param gimbal_control C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_gimbal_control_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gimbal_control_t* gimbal_control) -{ - return mavlink_msg_gimbal_control_pack(system_id, component_id, msg, gimbal_control->target_system, gimbal_control->target_component, gimbal_control->demanded_rate_x, gimbal_control->demanded_rate_y, gimbal_control->demanded_rate_z); -} - -/** - * @brief Encode a gimbal_control struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param gimbal_control C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_gimbal_control_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gimbal_control_t* gimbal_control) -{ - return mavlink_msg_gimbal_control_pack_chan(system_id, component_id, chan, msg, gimbal_control->target_system, gimbal_control->target_component, gimbal_control->demanded_rate_x, gimbal_control->demanded_rate_y, gimbal_control->demanded_rate_z); -} - -/** - * @brief Send a gimbal_control message - * @param chan MAVLink channel to send the message - * - * @param target_system System ID. - * @param target_component Component ID. - * @param demanded_rate_x [rad/s] Demanded angular rate X. - * @param demanded_rate_y [rad/s] Demanded angular rate Y. - * @param demanded_rate_z [rad/s] Demanded angular rate Z. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_gimbal_control_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, float demanded_rate_x, float demanded_rate_y, float demanded_rate_z) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_GIMBAL_CONTROL_LEN]; - _mav_put_float(buf, 0, demanded_rate_x); - _mav_put_float(buf, 4, demanded_rate_y); - _mav_put_float(buf, 8, demanded_rate_z); - _mav_put_uint8_t(buf, 12, target_system); - _mav_put_uint8_t(buf, 13, target_component); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_CONTROL, buf, MAVLINK_MSG_ID_GIMBAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_CONTROL_LEN, MAVLINK_MSG_ID_GIMBAL_CONTROL_CRC); -#else - mavlink_gimbal_control_t packet; - packet.demanded_rate_x = demanded_rate_x; - packet.demanded_rate_y = demanded_rate_y; - packet.demanded_rate_z = demanded_rate_z; - packet.target_system = target_system; - packet.target_component = target_component; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_CONTROL, (const char *)&packet, MAVLINK_MSG_ID_GIMBAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_CONTROL_LEN, MAVLINK_MSG_ID_GIMBAL_CONTROL_CRC); -#endif -} - -/** - * @brief Send a gimbal_control message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_gimbal_control_send_struct(mavlink_channel_t chan, const mavlink_gimbal_control_t* gimbal_control) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_gimbal_control_send(chan, gimbal_control->target_system, gimbal_control->target_component, gimbal_control->demanded_rate_x, gimbal_control->demanded_rate_y, gimbal_control->demanded_rate_z); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_CONTROL, (const char *)gimbal_control, MAVLINK_MSG_ID_GIMBAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_CONTROL_LEN, MAVLINK_MSG_ID_GIMBAL_CONTROL_CRC); -#endif -} - -#if MAVLINK_MSG_ID_GIMBAL_CONTROL_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_gimbal_control_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, float demanded_rate_x, float demanded_rate_y, float demanded_rate_z) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_float(buf, 0, demanded_rate_x); - _mav_put_float(buf, 4, demanded_rate_y); - _mav_put_float(buf, 8, demanded_rate_z); - _mav_put_uint8_t(buf, 12, target_system); - _mav_put_uint8_t(buf, 13, target_component); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_CONTROL, buf, MAVLINK_MSG_ID_GIMBAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_CONTROL_LEN, MAVLINK_MSG_ID_GIMBAL_CONTROL_CRC); -#else - mavlink_gimbal_control_t *packet = (mavlink_gimbal_control_t *)msgbuf; - packet->demanded_rate_x = demanded_rate_x; - packet->demanded_rate_y = demanded_rate_y; - packet->demanded_rate_z = demanded_rate_z; - packet->target_system = target_system; - packet->target_component = target_component; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_CONTROL, (const char *)packet, MAVLINK_MSG_ID_GIMBAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_CONTROL_LEN, MAVLINK_MSG_ID_GIMBAL_CONTROL_CRC); -#endif -} -#endif - -#endif - -// MESSAGE GIMBAL_CONTROL UNPACKING - - -/** - * @brief Get field target_system from gimbal_control message - * - * @return System ID. - */ -static inline uint8_t mavlink_msg_gimbal_control_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 12); -} - -/** - * @brief Get field target_component from gimbal_control message - * - * @return Component ID. - */ -static inline uint8_t mavlink_msg_gimbal_control_get_target_component(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 13); -} - -/** - * @brief Get field demanded_rate_x from gimbal_control message - * - * @return [rad/s] Demanded angular rate X. - */ -static inline float mavlink_msg_gimbal_control_get_demanded_rate_x(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 0); -} - -/** - * @brief Get field demanded_rate_y from gimbal_control message - * - * @return [rad/s] Demanded angular rate Y. - */ -static inline float mavlink_msg_gimbal_control_get_demanded_rate_y(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 4); -} - -/** - * @brief Get field demanded_rate_z from gimbal_control message - * - * @return [rad/s] Demanded angular rate Z. - */ -static inline float mavlink_msg_gimbal_control_get_demanded_rate_z(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Decode a gimbal_control message into a struct - * - * @param msg The message to decode - * @param gimbal_control C-struct to decode the message contents into - */ -static inline void mavlink_msg_gimbal_control_decode(const mavlink_message_t* msg, mavlink_gimbal_control_t* gimbal_control) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - gimbal_control->demanded_rate_x = mavlink_msg_gimbal_control_get_demanded_rate_x(msg); - gimbal_control->demanded_rate_y = mavlink_msg_gimbal_control_get_demanded_rate_y(msg); - gimbal_control->demanded_rate_z = mavlink_msg_gimbal_control_get_demanded_rate_z(msg); - gimbal_control->target_system = mavlink_msg_gimbal_control_get_target_system(msg); - gimbal_control->target_component = mavlink_msg_gimbal_control_get_target_component(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_GIMBAL_CONTROL_LEN? msg->len : MAVLINK_MSG_ID_GIMBAL_CONTROL_LEN; - memset(gimbal_control, 0, MAVLINK_MSG_ID_GIMBAL_CONTROL_LEN); - memcpy(gimbal_control, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_gimbal_report.h b/ardupilotmega/mavlink_msg_gimbal_report.h deleted file mode 100644 index 651991014..000000000 --- a/ardupilotmega/mavlink_msg_gimbal_report.h +++ /dev/null @@ -1,488 +0,0 @@ -#pragma once -// MESSAGE GIMBAL_REPORT PACKING - -#define MAVLINK_MSG_ID_GIMBAL_REPORT 200 - - -typedef struct __mavlink_gimbal_report_t { - float delta_time; /*< [s] Time since last update.*/ - float delta_angle_x; /*< [rad] Delta angle X.*/ - float delta_angle_y; /*< [rad] Delta angle Y.*/ - float delta_angle_z; /*< [rad] Delta angle X.*/ - float delta_velocity_x; /*< [m/s] Delta velocity X.*/ - float delta_velocity_y; /*< [m/s] Delta velocity Y.*/ - float delta_velocity_z; /*< [m/s] Delta velocity Z.*/ - float joint_roll; /*< [rad] Joint ROLL.*/ - float joint_el; /*< [rad] Joint EL.*/ - float joint_az; /*< [rad] Joint AZ.*/ - uint8_t target_system; /*< System ID.*/ - uint8_t target_component; /*< Component ID.*/ -} mavlink_gimbal_report_t; - -#define MAVLINK_MSG_ID_GIMBAL_REPORT_LEN 42 -#define MAVLINK_MSG_ID_GIMBAL_REPORT_MIN_LEN 42 -#define MAVLINK_MSG_ID_200_LEN 42 -#define MAVLINK_MSG_ID_200_MIN_LEN 42 - -#define MAVLINK_MSG_ID_GIMBAL_REPORT_CRC 134 -#define MAVLINK_MSG_ID_200_CRC 134 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_GIMBAL_REPORT { \ - 200, \ - "GIMBAL_REPORT", \ - 12, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 40, offsetof(mavlink_gimbal_report_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 41, offsetof(mavlink_gimbal_report_t, target_component) }, \ - { "delta_time", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_gimbal_report_t, delta_time) }, \ - { "delta_angle_x", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_gimbal_report_t, delta_angle_x) }, \ - { "delta_angle_y", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_gimbal_report_t, delta_angle_y) }, \ - { "delta_angle_z", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_gimbal_report_t, delta_angle_z) }, \ - { "delta_velocity_x", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_gimbal_report_t, delta_velocity_x) }, \ - { "delta_velocity_y", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_gimbal_report_t, delta_velocity_y) }, \ - { "delta_velocity_z", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_gimbal_report_t, delta_velocity_z) }, \ - { "joint_roll", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_gimbal_report_t, joint_roll) }, \ - { "joint_el", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_gimbal_report_t, joint_el) }, \ - { "joint_az", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_gimbal_report_t, joint_az) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_GIMBAL_REPORT { \ - "GIMBAL_REPORT", \ - 12, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 40, offsetof(mavlink_gimbal_report_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 41, offsetof(mavlink_gimbal_report_t, target_component) }, \ - { "delta_time", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_gimbal_report_t, delta_time) }, \ - { "delta_angle_x", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_gimbal_report_t, delta_angle_x) }, \ - { "delta_angle_y", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_gimbal_report_t, delta_angle_y) }, \ - { "delta_angle_z", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_gimbal_report_t, delta_angle_z) }, \ - { "delta_velocity_x", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_gimbal_report_t, delta_velocity_x) }, \ - { "delta_velocity_y", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_gimbal_report_t, delta_velocity_y) }, \ - { "delta_velocity_z", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_gimbal_report_t, delta_velocity_z) }, \ - { "joint_roll", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_gimbal_report_t, joint_roll) }, \ - { "joint_el", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_gimbal_report_t, joint_el) }, \ - { "joint_az", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_gimbal_report_t, joint_az) }, \ - } \ -} -#endif - -/** - * @brief Pack a gimbal_report message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param target_system System ID. - * @param target_component Component ID. - * @param delta_time [s] Time since last update. - * @param delta_angle_x [rad] Delta angle X. - * @param delta_angle_y [rad] Delta angle Y. - * @param delta_angle_z [rad] Delta angle X. - * @param delta_velocity_x [m/s] Delta velocity X. - * @param delta_velocity_y [m/s] Delta velocity Y. - * @param delta_velocity_z [m/s] Delta velocity Z. - * @param joint_roll [rad] Joint ROLL. - * @param joint_el [rad] Joint EL. - * @param joint_az [rad] Joint AZ. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_gimbal_report_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, float delta_time, float delta_angle_x, float delta_angle_y, float delta_angle_z, float delta_velocity_x, float delta_velocity_y, float delta_velocity_z, float joint_roll, float joint_el, float joint_az) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_GIMBAL_REPORT_LEN]; - _mav_put_float(buf, 0, delta_time); - _mav_put_float(buf, 4, delta_angle_x); - _mav_put_float(buf, 8, delta_angle_y); - _mav_put_float(buf, 12, delta_angle_z); - _mav_put_float(buf, 16, delta_velocity_x); - _mav_put_float(buf, 20, delta_velocity_y); - _mav_put_float(buf, 24, delta_velocity_z); - _mav_put_float(buf, 28, joint_roll); - _mav_put_float(buf, 32, joint_el); - _mav_put_float(buf, 36, joint_az); - _mav_put_uint8_t(buf, 40, target_system); - _mav_put_uint8_t(buf, 41, target_component); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GIMBAL_REPORT_LEN); -#else - mavlink_gimbal_report_t packet; - packet.delta_time = delta_time; - packet.delta_angle_x = delta_angle_x; - packet.delta_angle_y = delta_angle_y; - packet.delta_angle_z = delta_angle_z; - packet.delta_velocity_x = delta_velocity_x; - packet.delta_velocity_y = delta_velocity_y; - packet.delta_velocity_z = delta_velocity_z; - packet.joint_roll = joint_roll; - packet.joint_el = joint_el; - packet.joint_az = joint_az; - packet.target_system = target_system; - packet.target_component = target_component; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_REPORT_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_GIMBAL_REPORT; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GIMBAL_REPORT_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_REPORT_LEN, MAVLINK_MSG_ID_GIMBAL_REPORT_CRC); -} - -/** - * @brief Pack a gimbal_report message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param target_system System ID. - * @param target_component Component ID. - * @param delta_time [s] Time since last update. - * @param delta_angle_x [rad] Delta angle X. - * @param delta_angle_y [rad] Delta angle Y. - * @param delta_angle_z [rad] Delta angle X. - * @param delta_velocity_x [m/s] Delta velocity X. - * @param delta_velocity_y [m/s] Delta velocity Y. - * @param delta_velocity_z [m/s] Delta velocity Z. - * @param joint_roll [rad] Joint ROLL. - * @param joint_el [rad] Joint EL. - * @param joint_az [rad] Joint AZ. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_gimbal_report_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,float delta_time,float delta_angle_x,float delta_angle_y,float delta_angle_z,float delta_velocity_x,float delta_velocity_y,float delta_velocity_z,float joint_roll,float joint_el,float joint_az) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_GIMBAL_REPORT_LEN]; - _mav_put_float(buf, 0, delta_time); - _mav_put_float(buf, 4, delta_angle_x); - _mav_put_float(buf, 8, delta_angle_y); - _mav_put_float(buf, 12, delta_angle_z); - _mav_put_float(buf, 16, delta_velocity_x); - _mav_put_float(buf, 20, delta_velocity_y); - _mav_put_float(buf, 24, delta_velocity_z); - _mav_put_float(buf, 28, joint_roll); - _mav_put_float(buf, 32, joint_el); - _mav_put_float(buf, 36, joint_az); - _mav_put_uint8_t(buf, 40, target_system); - _mav_put_uint8_t(buf, 41, target_component); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GIMBAL_REPORT_LEN); -#else - mavlink_gimbal_report_t packet; - packet.delta_time = delta_time; - packet.delta_angle_x = delta_angle_x; - packet.delta_angle_y = delta_angle_y; - packet.delta_angle_z = delta_angle_z; - packet.delta_velocity_x = delta_velocity_x; - packet.delta_velocity_y = delta_velocity_y; - packet.delta_velocity_z = delta_velocity_z; - packet.joint_roll = joint_roll; - packet.joint_el = joint_el; - packet.joint_az = joint_az; - packet.target_system = target_system; - packet.target_component = target_component; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_REPORT_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_GIMBAL_REPORT; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GIMBAL_REPORT_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_REPORT_LEN, MAVLINK_MSG_ID_GIMBAL_REPORT_CRC); -} - -/** - * @brief Encode a gimbal_report struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param gimbal_report C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_gimbal_report_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gimbal_report_t* gimbal_report) -{ - return mavlink_msg_gimbal_report_pack(system_id, component_id, msg, gimbal_report->target_system, gimbal_report->target_component, gimbal_report->delta_time, gimbal_report->delta_angle_x, gimbal_report->delta_angle_y, gimbal_report->delta_angle_z, gimbal_report->delta_velocity_x, gimbal_report->delta_velocity_y, gimbal_report->delta_velocity_z, gimbal_report->joint_roll, gimbal_report->joint_el, gimbal_report->joint_az); -} - -/** - * @brief Encode a gimbal_report struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param gimbal_report C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_gimbal_report_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gimbal_report_t* gimbal_report) -{ - return mavlink_msg_gimbal_report_pack_chan(system_id, component_id, chan, msg, gimbal_report->target_system, gimbal_report->target_component, gimbal_report->delta_time, gimbal_report->delta_angle_x, gimbal_report->delta_angle_y, gimbal_report->delta_angle_z, gimbal_report->delta_velocity_x, gimbal_report->delta_velocity_y, gimbal_report->delta_velocity_z, gimbal_report->joint_roll, gimbal_report->joint_el, gimbal_report->joint_az); -} - -/** - * @brief Send a gimbal_report message - * @param chan MAVLink channel to send the message - * - * @param target_system System ID. - * @param target_component Component ID. - * @param delta_time [s] Time since last update. - * @param delta_angle_x [rad] Delta angle X. - * @param delta_angle_y [rad] Delta angle Y. - * @param delta_angle_z [rad] Delta angle X. - * @param delta_velocity_x [m/s] Delta velocity X. - * @param delta_velocity_y [m/s] Delta velocity Y. - * @param delta_velocity_z [m/s] Delta velocity Z. - * @param joint_roll [rad] Joint ROLL. - * @param joint_el [rad] Joint EL. - * @param joint_az [rad] Joint AZ. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_gimbal_report_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, float delta_time, float delta_angle_x, float delta_angle_y, float delta_angle_z, float delta_velocity_x, float delta_velocity_y, float delta_velocity_z, float joint_roll, float joint_el, float joint_az) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_GIMBAL_REPORT_LEN]; - _mav_put_float(buf, 0, delta_time); - _mav_put_float(buf, 4, delta_angle_x); - _mav_put_float(buf, 8, delta_angle_y); - _mav_put_float(buf, 12, delta_angle_z); - _mav_put_float(buf, 16, delta_velocity_x); - _mav_put_float(buf, 20, delta_velocity_y); - _mav_put_float(buf, 24, delta_velocity_z); - _mav_put_float(buf, 28, joint_roll); - _mav_put_float(buf, 32, joint_el); - _mav_put_float(buf, 36, joint_az); - _mav_put_uint8_t(buf, 40, target_system); - _mav_put_uint8_t(buf, 41, target_component); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_REPORT, buf, MAVLINK_MSG_ID_GIMBAL_REPORT_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_REPORT_LEN, MAVLINK_MSG_ID_GIMBAL_REPORT_CRC); -#else - mavlink_gimbal_report_t packet; - packet.delta_time = delta_time; - packet.delta_angle_x = delta_angle_x; - packet.delta_angle_y = delta_angle_y; - packet.delta_angle_z = delta_angle_z; - packet.delta_velocity_x = delta_velocity_x; - packet.delta_velocity_y = delta_velocity_y; - packet.delta_velocity_z = delta_velocity_z; - packet.joint_roll = joint_roll; - packet.joint_el = joint_el; - packet.joint_az = joint_az; - packet.target_system = target_system; - packet.target_component = target_component; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_REPORT, (const char *)&packet, MAVLINK_MSG_ID_GIMBAL_REPORT_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_REPORT_LEN, MAVLINK_MSG_ID_GIMBAL_REPORT_CRC); -#endif -} - -/** - * @brief Send a gimbal_report message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_gimbal_report_send_struct(mavlink_channel_t chan, const mavlink_gimbal_report_t* gimbal_report) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_gimbal_report_send(chan, gimbal_report->target_system, gimbal_report->target_component, gimbal_report->delta_time, gimbal_report->delta_angle_x, gimbal_report->delta_angle_y, gimbal_report->delta_angle_z, gimbal_report->delta_velocity_x, gimbal_report->delta_velocity_y, gimbal_report->delta_velocity_z, gimbal_report->joint_roll, gimbal_report->joint_el, gimbal_report->joint_az); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_REPORT, (const char *)gimbal_report, MAVLINK_MSG_ID_GIMBAL_REPORT_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_REPORT_LEN, MAVLINK_MSG_ID_GIMBAL_REPORT_CRC); -#endif -} - -#if MAVLINK_MSG_ID_GIMBAL_REPORT_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_gimbal_report_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, float delta_time, float delta_angle_x, float delta_angle_y, float delta_angle_z, float delta_velocity_x, float delta_velocity_y, float delta_velocity_z, float joint_roll, float joint_el, float joint_az) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_float(buf, 0, delta_time); - _mav_put_float(buf, 4, delta_angle_x); - _mav_put_float(buf, 8, delta_angle_y); - _mav_put_float(buf, 12, delta_angle_z); - _mav_put_float(buf, 16, delta_velocity_x); - _mav_put_float(buf, 20, delta_velocity_y); - _mav_put_float(buf, 24, delta_velocity_z); - _mav_put_float(buf, 28, joint_roll); - _mav_put_float(buf, 32, joint_el); - _mav_put_float(buf, 36, joint_az); - _mav_put_uint8_t(buf, 40, target_system); - _mav_put_uint8_t(buf, 41, target_component); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_REPORT, buf, MAVLINK_MSG_ID_GIMBAL_REPORT_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_REPORT_LEN, MAVLINK_MSG_ID_GIMBAL_REPORT_CRC); -#else - mavlink_gimbal_report_t *packet = (mavlink_gimbal_report_t *)msgbuf; - packet->delta_time = delta_time; - packet->delta_angle_x = delta_angle_x; - packet->delta_angle_y = delta_angle_y; - packet->delta_angle_z = delta_angle_z; - packet->delta_velocity_x = delta_velocity_x; - packet->delta_velocity_y = delta_velocity_y; - packet->delta_velocity_z = delta_velocity_z; - packet->joint_roll = joint_roll; - packet->joint_el = joint_el; - packet->joint_az = joint_az; - packet->target_system = target_system; - packet->target_component = target_component; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_REPORT, (const char *)packet, MAVLINK_MSG_ID_GIMBAL_REPORT_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_REPORT_LEN, MAVLINK_MSG_ID_GIMBAL_REPORT_CRC); -#endif -} -#endif - -#endif - -// MESSAGE GIMBAL_REPORT UNPACKING - - -/** - * @brief Get field target_system from gimbal_report message - * - * @return System ID. - */ -static inline uint8_t mavlink_msg_gimbal_report_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 40); -} - -/** - * @brief Get field target_component from gimbal_report message - * - * @return Component ID. - */ -static inline uint8_t mavlink_msg_gimbal_report_get_target_component(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 41); -} - -/** - * @brief Get field delta_time from gimbal_report message - * - * @return [s] Time since last update. - */ -static inline float mavlink_msg_gimbal_report_get_delta_time(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 0); -} - -/** - * @brief Get field delta_angle_x from gimbal_report message - * - * @return [rad] Delta angle X. - */ -static inline float mavlink_msg_gimbal_report_get_delta_angle_x(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 4); -} - -/** - * @brief Get field delta_angle_y from gimbal_report message - * - * @return [rad] Delta angle Y. - */ -static inline float mavlink_msg_gimbal_report_get_delta_angle_y(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field delta_angle_z from gimbal_report message - * - * @return [rad] Delta angle X. - */ -static inline float mavlink_msg_gimbal_report_get_delta_angle_z(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Get field delta_velocity_x from gimbal_report message - * - * @return [m/s] Delta velocity X. - */ -static inline float mavlink_msg_gimbal_report_get_delta_velocity_x(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 16); -} - -/** - * @brief Get field delta_velocity_y from gimbal_report message - * - * @return [m/s] Delta velocity Y. - */ -static inline float mavlink_msg_gimbal_report_get_delta_velocity_y(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 20); -} - -/** - * @brief Get field delta_velocity_z from gimbal_report message - * - * @return [m/s] Delta velocity Z. - */ -static inline float mavlink_msg_gimbal_report_get_delta_velocity_z(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 24); -} - -/** - * @brief Get field joint_roll from gimbal_report message - * - * @return [rad] Joint ROLL. - */ -static inline float mavlink_msg_gimbal_report_get_joint_roll(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 28); -} - -/** - * @brief Get field joint_el from gimbal_report message - * - * @return [rad] Joint EL. - */ -static inline float mavlink_msg_gimbal_report_get_joint_el(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 32); -} - -/** - * @brief Get field joint_az from gimbal_report message - * - * @return [rad] Joint AZ. - */ -static inline float mavlink_msg_gimbal_report_get_joint_az(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 36); -} - -/** - * @brief Decode a gimbal_report message into a struct - * - * @param msg The message to decode - * @param gimbal_report C-struct to decode the message contents into - */ -static inline void mavlink_msg_gimbal_report_decode(const mavlink_message_t* msg, mavlink_gimbal_report_t* gimbal_report) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - gimbal_report->delta_time = mavlink_msg_gimbal_report_get_delta_time(msg); - gimbal_report->delta_angle_x = mavlink_msg_gimbal_report_get_delta_angle_x(msg); - gimbal_report->delta_angle_y = mavlink_msg_gimbal_report_get_delta_angle_y(msg); - gimbal_report->delta_angle_z = mavlink_msg_gimbal_report_get_delta_angle_z(msg); - gimbal_report->delta_velocity_x = mavlink_msg_gimbal_report_get_delta_velocity_x(msg); - gimbal_report->delta_velocity_y = mavlink_msg_gimbal_report_get_delta_velocity_y(msg); - gimbal_report->delta_velocity_z = mavlink_msg_gimbal_report_get_delta_velocity_z(msg); - gimbal_report->joint_roll = mavlink_msg_gimbal_report_get_joint_roll(msg); - gimbal_report->joint_el = mavlink_msg_gimbal_report_get_joint_el(msg); - gimbal_report->joint_az = mavlink_msg_gimbal_report_get_joint_az(msg); - gimbal_report->target_system = mavlink_msg_gimbal_report_get_target_system(msg); - gimbal_report->target_component = mavlink_msg_gimbal_report_get_target_component(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_GIMBAL_REPORT_LEN? msg->len : MAVLINK_MSG_ID_GIMBAL_REPORT_LEN; - memset(gimbal_report, 0, MAVLINK_MSG_ID_GIMBAL_REPORT_LEN); - memcpy(gimbal_report, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_gimbal_torque_cmd_report.h b/ardupilotmega/mavlink_msg_gimbal_torque_cmd_report.h deleted file mode 100644 index d4eb57c2d..000000000 --- a/ardupilotmega/mavlink_msg_gimbal_torque_cmd_report.h +++ /dev/null @@ -1,313 +0,0 @@ -#pragma once -// MESSAGE GIMBAL_TORQUE_CMD_REPORT PACKING - -#define MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT 214 - - -typedef struct __mavlink_gimbal_torque_cmd_report_t { - int16_t rl_torque_cmd; /*< Roll Torque Command.*/ - int16_t el_torque_cmd; /*< Elevation Torque Command.*/ - int16_t az_torque_cmd; /*< Azimuth Torque Command.*/ - uint8_t target_system; /*< System ID.*/ - uint8_t target_component; /*< Component ID.*/ -} mavlink_gimbal_torque_cmd_report_t; - -#define MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN 8 -#define MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_MIN_LEN 8 -#define MAVLINK_MSG_ID_214_LEN 8 -#define MAVLINK_MSG_ID_214_MIN_LEN 8 - -#define MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_CRC 69 -#define MAVLINK_MSG_ID_214_CRC 69 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_GIMBAL_TORQUE_CMD_REPORT { \ - 214, \ - "GIMBAL_TORQUE_CMD_REPORT", \ - 5, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_gimbal_torque_cmd_report_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_gimbal_torque_cmd_report_t, target_component) }, \ - { "rl_torque_cmd", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_gimbal_torque_cmd_report_t, rl_torque_cmd) }, \ - { "el_torque_cmd", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_gimbal_torque_cmd_report_t, el_torque_cmd) }, \ - { "az_torque_cmd", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_gimbal_torque_cmd_report_t, az_torque_cmd) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_GIMBAL_TORQUE_CMD_REPORT { \ - "GIMBAL_TORQUE_CMD_REPORT", \ - 5, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_gimbal_torque_cmd_report_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_gimbal_torque_cmd_report_t, target_component) }, \ - { "rl_torque_cmd", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_gimbal_torque_cmd_report_t, rl_torque_cmd) }, \ - { "el_torque_cmd", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_gimbal_torque_cmd_report_t, el_torque_cmd) }, \ - { "az_torque_cmd", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_gimbal_torque_cmd_report_t, az_torque_cmd) }, \ - } \ -} -#endif - -/** - * @brief Pack a gimbal_torque_cmd_report message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param target_system System ID. - * @param target_component Component ID. - * @param rl_torque_cmd Roll Torque Command. - * @param el_torque_cmd Elevation Torque Command. - * @param az_torque_cmd Azimuth Torque Command. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_gimbal_torque_cmd_report_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, int16_t rl_torque_cmd, int16_t el_torque_cmd, int16_t az_torque_cmd) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN]; - _mav_put_int16_t(buf, 0, rl_torque_cmd); - _mav_put_int16_t(buf, 2, el_torque_cmd); - _mav_put_int16_t(buf, 4, az_torque_cmd); - _mav_put_uint8_t(buf, 6, target_system); - _mav_put_uint8_t(buf, 7, target_component); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN); -#else - mavlink_gimbal_torque_cmd_report_t packet; - packet.rl_torque_cmd = rl_torque_cmd; - packet.el_torque_cmd = el_torque_cmd; - packet.az_torque_cmd = az_torque_cmd; - packet.target_system = target_system; - packet.target_component = target_component; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_CRC); -} - -/** - * @brief Pack a gimbal_torque_cmd_report message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param target_system System ID. - * @param target_component Component ID. - * @param rl_torque_cmd Roll Torque Command. - * @param el_torque_cmd Elevation Torque Command. - * @param az_torque_cmd Azimuth Torque Command. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_gimbal_torque_cmd_report_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,int16_t rl_torque_cmd,int16_t el_torque_cmd,int16_t az_torque_cmd) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN]; - _mav_put_int16_t(buf, 0, rl_torque_cmd); - _mav_put_int16_t(buf, 2, el_torque_cmd); - _mav_put_int16_t(buf, 4, az_torque_cmd); - _mav_put_uint8_t(buf, 6, target_system); - _mav_put_uint8_t(buf, 7, target_component); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN); -#else - mavlink_gimbal_torque_cmd_report_t packet; - packet.rl_torque_cmd = rl_torque_cmd; - packet.el_torque_cmd = el_torque_cmd; - packet.az_torque_cmd = az_torque_cmd; - packet.target_system = target_system; - packet.target_component = target_component; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_CRC); -} - -/** - * @brief Encode a gimbal_torque_cmd_report struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param gimbal_torque_cmd_report C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_gimbal_torque_cmd_report_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gimbal_torque_cmd_report_t* gimbal_torque_cmd_report) -{ - return mavlink_msg_gimbal_torque_cmd_report_pack(system_id, component_id, msg, gimbal_torque_cmd_report->target_system, gimbal_torque_cmd_report->target_component, gimbal_torque_cmd_report->rl_torque_cmd, gimbal_torque_cmd_report->el_torque_cmd, gimbal_torque_cmd_report->az_torque_cmd); -} - -/** - * @brief Encode a gimbal_torque_cmd_report struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param gimbal_torque_cmd_report C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_gimbal_torque_cmd_report_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gimbal_torque_cmd_report_t* gimbal_torque_cmd_report) -{ - return mavlink_msg_gimbal_torque_cmd_report_pack_chan(system_id, component_id, chan, msg, gimbal_torque_cmd_report->target_system, gimbal_torque_cmd_report->target_component, gimbal_torque_cmd_report->rl_torque_cmd, gimbal_torque_cmd_report->el_torque_cmd, gimbal_torque_cmd_report->az_torque_cmd); -} - -/** - * @brief Send a gimbal_torque_cmd_report message - * @param chan MAVLink channel to send the message - * - * @param target_system System ID. - * @param target_component Component ID. - * @param rl_torque_cmd Roll Torque Command. - * @param el_torque_cmd Elevation Torque Command. - * @param az_torque_cmd Azimuth Torque Command. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_gimbal_torque_cmd_report_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, int16_t rl_torque_cmd, int16_t el_torque_cmd, int16_t az_torque_cmd) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN]; - _mav_put_int16_t(buf, 0, rl_torque_cmd); - _mav_put_int16_t(buf, 2, el_torque_cmd); - _mav_put_int16_t(buf, 4, az_torque_cmd); - _mav_put_uint8_t(buf, 6, target_system); - _mav_put_uint8_t(buf, 7, target_component); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT, buf, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_CRC); -#else - mavlink_gimbal_torque_cmd_report_t packet; - packet.rl_torque_cmd = rl_torque_cmd; - packet.el_torque_cmd = el_torque_cmd; - packet.az_torque_cmd = az_torque_cmd; - packet.target_system = target_system; - packet.target_component = target_component; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT, (const char *)&packet, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_CRC); -#endif -} - -/** - * @brief Send a gimbal_torque_cmd_report message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_gimbal_torque_cmd_report_send_struct(mavlink_channel_t chan, const mavlink_gimbal_torque_cmd_report_t* gimbal_torque_cmd_report) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_gimbal_torque_cmd_report_send(chan, gimbal_torque_cmd_report->target_system, gimbal_torque_cmd_report->target_component, gimbal_torque_cmd_report->rl_torque_cmd, gimbal_torque_cmd_report->el_torque_cmd, gimbal_torque_cmd_report->az_torque_cmd); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT, (const char *)gimbal_torque_cmd_report, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_CRC); -#endif -} - -#if MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_gimbal_torque_cmd_report_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, int16_t rl_torque_cmd, int16_t el_torque_cmd, int16_t az_torque_cmd) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_int16_t(buf, 0, rl_torque_cmd); - _mav_put_int16_t(buf, 2, el_torque_cmd); - _mav_put_int16_t(buf, 4, az_torque_cmd); - _mav_put_uint8_t(buf, 6, target_system); - _mav_put_uint8_t(buf, 7, target_component); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT, buf, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_CRC); -#else - mavlink_gimbal_torque_cmd_report_t *packet = (mavlink_gimbal_torque_cmd_report_t *)msgbuf; - packet->rl_torque_cmd = rl_torque_cmd; - packet->el_torque_cmd = el_torque_cmd; - packet->az_torque_cmd = az_torque_cmd; - packet->target_system = target_system; - packet->target_component = target_component; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT, (const char *)packet, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_CRC); -#endif -} -#endif - -#endif - -// MESSAGE GIMBAL_TORQUE_CMD_REPORT UNPACKING - - -/** - * @brief Get field target_system from gimbal_torque_cmd_report message - * - * @return System ID. - */ -static inline uint8_t mavlink_msg_gimbal_torque_cmd_report_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 6); -} - -/** - * @brief Get field target_component from gimbal_torque_cmd_report message - * - * @return Component ID. - */ -static inline uint8_t mavlink_msg_gimbal_torque_cmd_report_get_target_component(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 7); -} - -/** - * @brief Get field rl_torque_cmd from gimbal_torque_cmd_report message - * - * @return Roll Torque Command. - */ -static inline int16_t mavlink_msg_gimbal_torque_cmd_report_get_rl_torque_cmd(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 0); -} - -/** - * @brief Get field el_torque_cmd from gimbal_torque_cmd_report message - * - * @return Elevation Torque Command. - */ -static inline int16_t mavlink_msg_gimbal_torque_cmd_report_get_el_torque_cmd(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 2); -} - -/** - * @brief Get field az_torque_cmd from gimbal_torque_cmd_report message - * - * @return Azimuth Torque Command. - */ -static inline int16_t mavlink_msg_gimbal_torque_cmd_report_get_az_torque_cmd(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 4); -} - -/** - * @brief Decode a gimbal_torque_cmd_report message into a struct - * - * @param msg The message to decode - * @param gimbal_torque_cmd_report C-struct to decode the message contents into - */ -static inline void mavlink_msg_gimbal_torque_cmd_report_decode(const mavlink_message_t* msg, mavlink_gimbal_torque_cmd_report_t* gimbal_torque_cmd_report) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - gimbal_torque_cmd_report->rl_torque_cmd = mavlink_msg_gimbal_torque_cmd_report_get_rl_torque_cmd(msg); - gimbal_torque_cmd_report->el_torque_cmd = mavlink_msg_gimbal_torque_cmd_report_get_el_torque_cmd(msg); - gimbal_torque_cmd_report->az_torque_cmd = mavlink_msg_gimbal_torque_cmd_report_get_az_torque_cmd(msg); - gimbal_torque_cmd_report->target_system = mavlink_msg_gimbal_torque_cmd_report_get_target_system(msg); - gimbal_torque_cmd_report->target_component = mavlink_msg_gimbal_torque_cmd_report_get_target_component(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN? msg->len : MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN; - memset(gimbal_torque_cmd_report, 0, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN); - memcpy(gimbal_torque_cmd_report, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_gopro_get_request.h b/ardupilotmega/mavlink_msg_gopro_get_request.h deleted file mode 100644 index aa2630a5d..000000000 --- a/ardupilotmega/mavlink_msg_gopro_get_request.h +++ /dev/null @@ -1,263 +0,0 @@ -#pragma once -// MESSAGE GOPRO_GET_REQUEST PACKING - -#define MAVLINK_MSG_ID_GOPRO_GET_REQUEST 216 - - -typedef struct __mavlink_gopro_get_request_t { - uint8_t target_system; /*< System ID.*/ - uint8_t target_component; /*< Component ID.*/ - uint8_t cmd_id; /*< Command ID.*/ -} mavlink_gopro_get_request_t; - -#define MAVLINK_MSG_ID_GOPRO_GET_REQUEST_LEN 3 -#define MAVLINK_MSG_ID_GOPRO_GET_REQUEST_MIN_LEN 3 -#define MAVLINK_MSG_ID_216_LEN 3 -#define MAVLINK_MSG_ID_216_MIN_LEN 3 - -#define MAVLINK_MSG_ID_GOPRO_GET_REQUEST_CRC 50 -#define MAVLINK_MSG_ID_216_CRC 50 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_GOPRO_GET_REQUEST { \ - 216, \ - "GOPRO_GET_REQUEST", \ - 3, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_gopro_get_request_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_gopro_get_request_t, target_component) }, \ - { "cmd_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_gopro_get_request_t, cmd_id) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_GOPRO_GET_REQUEST { \ - "GOPRO_GET_REQUEST", \ - 3, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_gopro_get_request_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_gopro_get_request_t, target_component) }, \ - { "cmd_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_gopro_get_request_t, cmd_id) }, \ - } \ -} -#endif - -/** - * @brief Pack a gopro_get_request message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param target_system System ID. - * @param target_component Component ID. - * @param cmd_id Command ID. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_gopro_get_request_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, uint8_t cmd_id) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_GOPRO_GET_REQUEST_LEN]; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, cmd_id); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GOPRO_GET_REQUEST_LEN); -#else - mavlink_gopro_get_request_t packet; - packet.target_system = target_system; - packet.target_component = target_component; - packet.cmd_id = cmd_id; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GOPRO_GET_REQUEST_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_GOPRO_GET_REQUEST; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GOPRO_GET_REQUEST_MIN_LEN, MAVLINK_MSG_ID_GOPRO_GET_REQUEST_LEN, MAVLINK_MSG_ID_GOPRO_GET_REQUEST_CRC); -} - -/** - * @brief Pack a gopro_get_request message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param target_system System ID. - * @param target_component Component ID. - * @param cmd_id Command ID. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_gopro_get_request_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,uint8_t cmd_id) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_GOPRO_GET_REQUEST_LEN]; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, cmd_id); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GOPRO_GET_REQUEST_LEN); -#else - mavlink_gopro_get_request_t packet; - packet.target_system = target_system; - packet.target_component = target_component; - packet.cmd_id = cmd_id; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GOPRO_GET_REQUEST_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_GOPRO_GET_REQUEST; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GOPRO_GET_REQUEST_MIN_LEN, MAVLINK_MSG_ID_GOPRO_GET_REQUEST_LEN, MAVLINK_MSG_ID_GOPRO_GET_REQUEST_CRC); -} - -/** - * @brief Encode a gopro_get_request struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param gopro_get_request C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_gopro_get_request_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gopro_get_request_t* gopro_get_request) -{ - return mavlink_msg_gopro_get_request_pack(system_id, component_id, msg, gopro_get_request->target_system, gopro_get_request->target_component, gopro_get_request->cmd_id); -} - -/** - * @brief Encode a gopro_get_request struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param gopro_get_request C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_gopro_get_request_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gopro_get_request_t* gopro_get_request) -{ - return mavlink_msg_gopro_get_request_pack_chan(system_id, component_id, chan, msg, gopro_get_request->target_system, gopro_get_request->target_component, gopro_get_request->cmd_id); -} - -/** - * @brief Send a gopro_get_request message - * @param chan MAVLink channel to send the message - * - * @param target_system System ID. - * @param target_component Component ID. - * @param cmd_id Command ID. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_gopro_get_request_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t cmd_id) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_GOPRO_GET_REQUEST_LEN]; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, cmd_id); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_GET_REQUEST, buf, MAVLINK_MSG_ID_GOPRO_GET_REQUEST_MIN_LEN, MAVLINK_MSG_ID_GOPRO_GET_REQUEST_LEN, MAVLINK_MSG_ID_GOPRO_GET_REQUEST_CRC); -#else - mavlink_gopro_get_request_t packet; - packet.target_system = target_system; - packet.target_component = target_component; - packet.cmd_id = cmd_id; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_GET_REQUEST, (const char *)&packet, MAVLINK_MSG_ID_GOPRO_GET_REQUEST_MIN_LEN, MAVLINK_MSG_ID_GOPRO_GET_REQUEST_LEN, MAVLINK_MSG_ID_GOPRO_GET_REQUEST_CRC); -#endif -} - -/** - * @brief Send a gopro_get_request message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_gopro_get_request_send_struct(mavlink_channel_t chan, const mavlink_gopro_get_request_t* gopro_get_request) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_gopro_get_request_send(chan, gopro_get_request->target_system, gopro_get_request->target_component, gopro_get_request->cmd_id); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_GET_REQUEST, (const char *)gopro_get_request, MAVLINK_MSG_ID_GOPRO_GET_REQUEST_MIN_LEN, MAVLINK_MSG_ID_GOPRO_GET_REQUEST_LEN, MAVLINK_MSG_ID_GOPRO_GET_REQUEST_CRC); -#endif -} - -#if MAVLINK_MSG_ID_GOPRO_GET_REQUEST_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_gopro_get_request_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t cmd_id) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, cmd_id); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_GET_REQUEST, buf, MAVLINK_MSG_ID_GOPRO_GET_REQUEST_MIN_LEN, MAVLINK_MSG_ID_GOPRO_GET_REQUEST_LEN, MAVLINK_MSG_ID_GOPRO_GET_REQUEST_CRC); -#else - mavlink_gopro_get_request_t *packet = (mavlink_gopro_get_request_t *)msgbuf; - packet->target_system = target_system; - packet->target_component = target_component; - packet->cmd_id = cmd_id; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_GET_REQUEST, (const char *)packet, MAVLINK_MSG_ID_GOPRO_GET_REQUEST_MIN_LEN, MAVLINK_MSG_ID_GOPRO_GET_REQUEST_LEN, MAVLINK_MSG_ID_GOPRO_GET_REQUEST_CRC); -#endif -} -#endif - -#endif - -// MESSAGE GOPRO_GET_REQUEST UNPACKING - - -/** - * @brief Get field target_system from gopro_get_request message - * - * @return System ID. - */ -static inline uint8_t mavlink_msg_gopro_get_request_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 0); -} - -/** - * @brief Get field target_component from gopro_get_request message - * - * @return Component ID. - */ -static inline uint8_t mavlink_msg_gopro_get_request_get_target_component(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 1); -} - -/** - * @brief Get field cmd_id from gopro_get_request message - * - * @return Command ID. - */ -static inline uint8_t mavlink_msg_gopro_get_request_get_cmd_id(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 2); -} - -/** - * @brief Decode a gopro_get_request message into a struct - * - * @param msg The message to decode - * @param gopro_get_request C-struct to decode the message contents into - */ -static inline void mavlink_msg_gopro_get_request_decode(const mavlink_message_t* msg, mavlink_gopro_get_request_t* gopro_get_request) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - gopro_get_request->target_system = mavlink_msg_gopro_get_request_get_target_system(msg); - gopro_get_request->target_component = mavlink_msg_gopro_get_request_get_target_component(msg); - gopro_get_request->cmd_id = mavlink_msg_gopro_get_request_get_cmd_id(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_GOPRO_GET_REQUEST_LEN? msg->len : MAVLINK_MSG_ID_GOPRO_GET_REQUEST_LEN; - memset(gopro_get_request, 0, MAVLINK_MSG_ID_GOPRO_GET_REQUEST_LEN); - memcpy(gopro_get_request, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_gopro_get_response.h b/ardupilotmega/mavlink_msg_gopro_get_response.h deleted file mode 100644 index b1eee0b18..000000000 --- a/ardupilotmega/mavlink_msg_gopro_get_response.h +++ /dev/null @@ -1,255 +0,0 @@ -#pragma once -// MESSAGE GOPRO_GET_RESPONSE PACKING - -#define MAVLINK_MSG_ID_GOPRO_GET_RESPONSE 217 - - -typedef struct __mavlink_gopro_get_response_t { - uint8_t cmd_id; /*< Command ID.*/ - uint8_t status; /*< Status.*/ - uint8_t value[4]; /*< Value.*/ -} mavlink_gopro_get_response_t; - -#define MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN 6 -#define MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_MIN_LEN 6 -#define MAVLINK_MSG_ID_217_LEN 6 -#define MAVLINK_MSG_ID_217_MIN_LEN 6 - -#define MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_CRC 202 -#define MAVLINK_MSG_ID_217_CRC 202 - -#define MAVLINK_MSG_GOPRO_GET_RESPONSE_FIELD_VALUE_LEN 4 - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_GOPRO_GET_RESPONSE { \ - 217, \ - "GOPRO_GET_RESPONSE", \ - 3, \ - { { "cmd_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_gopro_get_response_t, cmd_id) }, \ - { "status", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_gopro_get_response_t, status) }, \ - { "value", NULL, MAVLINK_TYPE_UINT8_T, 4, 2, offsetof(mavlink_gopro_get_response_t, value) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_GOPRO_GET_RESPONSE { \ - "GOPRO_GET_RESPONSE", \ - 3, \ - { { "cmd_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_gopro_get_response_t, cmd_id) }, \ - { "status", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_gopro_get_response_t, status) }, \ - { "value", NULL, MAVLINK_TYPE_UINT8_T, 4, 2, offsetof(mavlink_gopro_get_response_t, value) }, \ - } \ -} -#endif - -/** - * @brief Pack a gopro_get_response message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param cmd_id Command ID. - * @param status Status. - * @param value Value. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_gopro_get_response_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t cmd_id, uint8_t status, const uint8_t *value) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN]; - _mav_put_uint8_t(buf, 0, cmd_id); - _mav_put_uint8_t(buf, 1, status); - _mav_put_uint8_t_array(buf, 2, value, 4); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN); -#else - mavlink_gopro_get_response_t packet; - packet.cmd_id = cmd_id; - packet.status = status; - mav_array_memcpy(packet.value, value, sizeof(uint8_t)*4); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_GOPRO_GET_RESPONSE; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_MIN_LEN, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_CRC); -} - -/** - * @brief Pack a gopro_get_response message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param cmd_id Command ID. - * @param status Status. - * @param value Value. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_gopro_get_response_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t cmd_id,uint8_t status,const uint8_t *value) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN]; - _mav_put_uint8_t(buf, 0, cmd_id); - _mav_put_uint8_t(buf, 1, status); - _mav_put_uint8_t_array(buf, 2, value, 4); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN); -#else - mavlink_gopro_get_response_t packet; - packet.cmd_id = cmd_id; - packet.status = status; - mav_array_memcpy(packet.value, value, sizeof(uint8_t)*4); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_GOPRO_GET_RESPONSE; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_MIN_LEN, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_CRC); -} - -/** - * @brief Encode a gopro_get_response struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param gopro_get_response C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_gopro_get_response_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gopro_get_response_t* gopro_get_response) -{ - return mavlink_msg_gopro_get_response_pack(system_id, component_id, msg, gopro_get_response->cmd_id, gopro_get_response->status, gopro_get_response->value); -} - -/** - * @brief Encode a gopro_get_response struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param gopro_get_response C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_gopro_get_response_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gopro_get_response_t* gopro_get_response) -{ - return mavlink_msg_gopro_get_response_pack_chan(system_id, component_id, chan, msg, gopro_get_response->cmd_id, gopro_get_response->status, gopro_get_response->value); -} - -/** - * @brief Send a gopro_get_response message - * @param chan MAVLink channel to send the message - * - * @param cmd_id Command ID. - * @param status Status. - * @param value Value. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_gopro_get_response_send(mavlink_channel_t chan, uint8_t cmd_id, uint8_t status, const uint8_t *value) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN]; - _mav_put_uint8_t(buf, 0, cmd_id); - _mav_put_uint8_t(buf, 1, status); - _mav_put_uint8_t_array(buf, 2, value, 4); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE, buf, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_MIN_LEN, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_CRC); -#else - mavlink_gopro_get_response_t packet; - packet.cmd_id = cmd_id; - packet.status = status; - mav_array_memcpy(packet.value, value, sizeof(uint8_t)*4); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE, (const char *)&packet, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_MIN_LEN, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_CRC); -#endif -} - -/** - * @brief Send a gopro_get_response message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_gopro_get_response_send_struct(mavlink_channel_t chan, const mavlink_gopro_get_response_t* gopro_get_response) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_gopro_get_response_send(chan, gopro_get_response->cmd_id, gopro_get_response->status, gopro_get_response->value); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE, (const char *)gopro_get_response, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_MIN_LEN, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_CRC); -#endif -} - -#if MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_gopro_get_response_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t cmd_id, uint8_t status, const uint8_t *value) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint8_t(buf, 0, cmd_id); - _mav_put_uint8_t(buf, 1, status); - _mav_put_uint8_t_array(buf, 2, value, 4); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE, buf, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_MIN_LEN, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_CRC); -#else - mavlink_gopro_get_response_t *packet = (mavlink_gopro_get_response_t *)msgbuf; - packet->cmd_id = cmd_id; - packet->status = status; - mav_array_memcpy(packet->value, value, sizeof(uint8_t)*4); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE, (const char *)packet, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_MIN_LEN, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_CRC); -#endif -} -#endif - -#endif - -// MESSAGE GOPRO_GET_RESPONSE UNPACKING - - -/** - * @brief Get field cmd_id from gopro_get_response message - * - * @return Command ID. - */ -static inline uint8_t mavlink_msg_gopro_get_response_get_cmd_id(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 0); -} - -/** - * @brief Get field status from gopro_get_response message - * - * @return Status. - */ -static inline uint8_t mavlink_msg_gopro_get_response_get_status(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 1); -} - -/** - * @brief Get field value from gopro_get_response message - * - * @return Value. - */ -static inline uint16_t mavlink_msg_gopro_get_response_get_value(const mavlink_message_t* msg, uint8_t *value) -{ - return _MAV_RETURN_uint8_t_array(msg, value, 4, 2); -} - -/** - * @brief Decode a gopro_get_response message into a struct - * - * @param msg The message to decode - * @param gopro_get_response C-struct to decode the message contents into - */ -static inline void mavlink_msg_gopro_get_response_decode(const mavlink_message_t* msg, mavlink_gopro_get_response_t* gopro_get_response) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - gopro_get_response->cmd_id = mavlink_msg_gopro_get_response_get_cmd_id(msg); - gopro_get_response->status = mavlink_msg_gopro_get_response_get_status(msg); - mavlink_msg_gopro_get_response_get_value(msg, gopro_get_response->value); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN? msg->len : MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN; - memset(gopro_get_response, 0, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN); - memcpy(gopro_get_response, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_gopro_heartbeat.h b/ardupilotmega/mavlink_msg_gopro_heartbeat.h deleted file mode 100644 index 5fc364406..000000000 --- a/ardupilotmega/mavlink_msg_gopro_heartbeat.h +++ /dev/null @@ -1,263 +0,0 @@ -#pragma once -// MESSAGE GOPRO_HEARTBEAT PACKING - -#define MAVLINK_MSG_ID_GOPRO_HEARTBEAT 215 - - -typedef struct __mavlink_gopro_heartbeat_t { - uint8_t status; /*< Status.*/ - uint8_t capture_mode; /*< Current capture mode.*/ - uint8_t flags; /*< Additional status bits.*/ -} mavlink_gopro_heartbeat_t; - -#define MAVLINK_MSG_ID_GOPRO_HEARTBEAT_LEN 3 -#define MAVLINK_MSG_ID_GOPRO_HEARTBEAT_MIN_LEN 3 -#define MAVLINK_MSG_ID_215_LEN 3 -#define MAVLINK_MSG_ID_215_MIN_LEN 3 - -#define MAVLINK_MSG_ID_GOPRO_HEARTBEAT_CRC 101 -#define MAVLINK_MSG_ID_215_CRC 101 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_GOPRO_HEARTBEAT { \ - 215, \ - "GOPRO_HEARTBEAT", \ - 3, \ - { { "status", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_gopro_heartbeat_t, status) }, \ - { "capture_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_gopro_heartbeat_t, capture_mode) }, \ - { "flags", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_gopro_heartbeat_t, flags) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_GOPRO_HEARTBEAT { \ - "GOPRO_HEARTBEAT", \ - 3, \ - { { "status", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_gopro_heartbeat_t, status) }, \ - { "capture_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_gopro_heartbeat_t, capture_mode) }, \ - { "flags", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_gopro_heartbeat_t, flags) }, \ - } \ -} -#endif - -/** - * @brief Pack a gopro_heartbeat message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param status Status. - * @param capture_mode Current capture mode. - * @param flags Additional status bits. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_gopro_heartbeat_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t status, uint8_t capture_mode, uint8_t flags) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_GOPRO_HEARTBEAT_LEN]; - _mav_put_uint8_t(buf, 0, status); - _mav_put_uint8_t(buf, 1, capture_mode); - _mav_put_uint8_t(buf, 2, flags); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GOPRO_HEARTBEAT_LEN); -#else - mavlink_gopro_heartbeat_t packet; - packet.status = status; - packet.capture_mode = capture_mode; - packet.flags = flags; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GOPRO_HEARTBEAT_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_GOPRO_HEARTBEAT; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GOPRO_HEARTBEAT_MIN_LEN, MAVLINK_MSG_ID_GOPRO_HEARTBEAT_LEN, MAVLINK_MSG_ID_GOPRO_HEARTBEAT_CRC); -} - -/** - * @brief Pack a gopro_heartbeat message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param status Status. - * @param capture_mode Current capture mode. - * @param flags Additional status bits. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_gopro_heartbeat_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t status,uint8_t capture_mode,uint8_t flags) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_GOPRO_HEARTBEAT_LEN]; - _mav_put_uint8_t(buf, 0, status); - _mav_put_uint8_t(buf, 1, capture_mode); - _mav_put_uint8_t(buf, 2, flags); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GOPRO_HEARTBEAT_LEN); -#else - mavlink_gopro_heartbeat_t packet; - packet.status = status; - packet.capture_mode = capture_mode; - packet.flags = flags; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GOPRO_HEARTBEAT_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_GOPRO_HEARTBEAT; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GOPRO_HEARTBEAT_MIN_LEN, MAVLINK_MSG_ID_GOPRO_HEARTBEAT_LEN, MAVLINK_MSG_ID_GOPRO_HEARTBEAT_CRC); -} - -/** - * @brief Encode a gopro_heartbeat struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param gopro_heartbeat C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_gopro_heartbeat_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gopro_heartbeat_t* gopro_heartbeat) -{ - return mavlink_msg_gopro_heartbeat_pack(system_id, component_id, msg, gopro_heartbeat->status, gopro_heartbeat->capture_mode, gopro_heartbeat->flags); -} - -/** - * @brief Encode a gopro_heartbeat struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param gopro_heartbeat C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_gopro_heartbeat_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gopro_heartbeat_t* gopro_heartbeat) -{ - return mavlink_msg_gopro_heartbeat_pack_chan(system_id, component_id, chan, msg, gopro_heartbeat->status, gopro_heartbeat->capture_mode, gopro_heartbeat->flags); -} - -/** - * @brief Send a gopro_heartbeat message - * @param chan MAVLink channel to send the message - * - * @param status Status. - * @param capture_mode Current capture mode. - * @param flags Additional status bits. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_gopro_heartbeat_send(mavlink_channel_t chan, uint8_t status, uint8_t capture_mode, uint8_t flags) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_GOPRO_HEARTBEAT_LEN]; - _mav_put_uint8_t(buf, 0, status); - _mav_put_uint8_t(buf, 1, capture_mode); - _mav_put_uint8_t(buf, 2, flags); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_HEARTBEAT, buf, MAVLINK_MSG_ID_GOPRO_HEARTBEAT_MIN_LEN, MAVLINK_MSG_ID_GOPRO_HEARTBEAT_LEN, MAVLINK_MSG_ID_GOPRO_HEARTBEAT_CRC); -#else - mavlink_gopro_heartbeat_t packet; - packet.status = status; - packet.capture_mode = capture_mode; - packet.flags = flags; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_HEARTBEAT, (const char *)&packet, MAVLINK_MSG_ID_GOPRO_HEARTBEAT_MIN_LEN, MAVLINK_MSG_ID_GOPRO_HEARTBEAT_LEN, MAVLINK_MSG_ID_GOPRO_HEARTBEAT_CRC); -#endif -} - -/** - * @brief Send a gopro_heartbeat message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_gopro_heartbeat_send_struct(mavlink_channel_t chan, const mavlink_gopro_heartbeat_t* gopro_heartbeat) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_gopro_heartbeat_send(chan, gopro_heartbeat->status, gopro_heartbeat->capture_mode, gopro_heartbeat->flags); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_HEARTBEAT, (const char *)gopro_heartbeat, MAVLINK_MSG_ID_GOPRO_HEARTBEAT_MIN_LEN, MAVLINK_MSG_ID_GOPRO_HEARTBEAT_LEN, MAVLINK_MSG_ID_GOPRO_HEARTBEAT_CRC); -#endif -} - -#if MAVLINK_MSG_ID_GOPRO_HEARTBEAT_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_gopro_heartbeat_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t status, uint8_t capture_mode, uint8_t flags) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint8_t(buf, 0, status); - _mav_put_uint8_t(buf, 1, capture_mode); - _mav_put_uint8_t(buf, 2, flags); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_HEARTBEAT, buf, MAVLINK_MSG_ID_GOPRO_HEARTBEAT_MIN_LEN, MAVLINK_MSG_ID_GOPRO_HEARTBEAT_LEN, MAVLINK_MSG_ID_GOPRO_HEARTBEAT_CRC); -#else - mavlink_gopro_heartbeat_t *packet = (mavlink_gopro_heartbeat_t *)msgbuf; - packet->status = status; - packet->capture_mode = capture_mode; - packet->flags = flags; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_HEARTBEAT, (const char *)packet, MAVLINK_MSG_ID_GOPRO_HEARTBEAT_MIN_LEN, MAVLINK_MSG_ID_GOPRO_HEARTBEAT_LEN, MAVLINK_MSG_ID_GOPRO_HEARTBEAT_CRC); -#endif -} -#endif - -#endif - -// MESSAGE GOPRO_HEARTBEAT UNPACKING - - -/** - * @brief Get field status from gopro_heartbeat message - * - * @return Status. - */ -static inline uint8_t mavlink_msg_gopro_heartbeat_get_status(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 0); -} - -/** - * @brief Get field capture_mode from gopro_heartbeat message - * - * @return Current capture mode. - */ -static inline uint8_t mavlink_msg_gopro_heartbeat_get_capture_mode(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 1); -} - -/** - * @brief Get field flags from gopro_heartbeat message - * - * @return Additional status bits. - */ -static inline uint8_t mavlink_msg_gopro_heartbeat_get_flags(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 2); -} - -/** - * @brief Decode a gopro_heartbeat message into a struct - * - * @param msg The message to decode - * @param gopro_heartbeat C-struct to decode the message contents into - */ -static inline void mavlink_msg_gopro_heartbeat_decode(const mavlink_message_t* msg, mavlink_gopro_heartbeat_t* gopro_heartbeat) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - gopro_heartbeat->status = mavlink_msg_gopro_heartbeat_get_status(msg); - gopro_heartbeat->capture_mode = mavlink_msg_gopro_heartbeat_get_capture_mode(msg); - gopro_heartbeat->flags = mavlink_msg_gopro_heartbeat_get_flags(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_GOPRO_HEARTBEAT_LEN? msg->len : MAVLINK_MSG_ID_GOPRO_HEARTBEAT_LEN; - memset(gopro_heartbeat, 0, MAVLINK_MSG_ID_GOPRO_HEARTBEAT_LEN); - memcpy(gopro_heartbeat, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_gopro_set_request.h b/ardupilotmega/mavlink_msg_gopro_set_request.h deleted file mode 100644 index 771c6149e..000000000 --- a/ardupilotmega/mavlink_msg_gopro_set_request.h +++ /dev/null @@ -1,280 +0,0 @@ -#pragma once -// MESSAGE GOPRO_SET_REQUEST PACKING - -#define MAVLINK_MSG_ID_GOPRO_SET_REQUEST 218 - - -typedef struct __mavlink_gopro_set_request_t { - uint8_t target_system; /*< System ID.*/ - uint8_t target_component; /*< Component ID.*/ - uint8_t cmd_id; /*< Command ID.*/ - uint8_t value[4]; /*< Value.*/ -} mavlink_gopro_set_request_t; - -#define MAVLINK_MSG_ID_GOPRO_SET_REQUEST_LEN 7 -#define MAVLINK_MSG_ID_GOPRO_SET_REQUEST_MIN_LEN 7 -#define MAVLINK_MSG_ID_218_LEN 7 -#define MAVLINK_MSG_ID_218_MIN_LEN 7 - -#define MAVLINK_MSG_ID_GOPRO_SET_REQUEST_CRC 17 -#define MAVLINK_MSG_ID_218_CRC 17 - -#define MAVLINK_MSG_GOPRO_SET_REQUEST_FIELD_VALUE_LEN 4 - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_GOPRO_SET_REQUEST { \ - 218, \ - "GOPRO_SET_REQUEST", \ - 4, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_gopro_set_request_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_gopro_set_request_t, target_component) }, \ - { "cmd_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_gopro_set_request_t, cmd_id) }, \ - { "value", NULL, MAVLINK_TYPE_UINT8_T, 4, 3, offsetof(mavlink_gopro_set_request_t, value) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_GOPRO_SET_REQUEST { \ - "GOPRO_SET_REQUEST", \ - 4, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_gopro_set_request_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_gopro_set_request_t, target_component) }, \ - { "cmd_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_gopro_set_request_t, cmd_id) }, \ - { "value", NULL, MAVLINK_TYPE_UINT8_T, 4, 3, offsetof(mavlink_gopro_set_request_t, value) }, \ - } \ -} -#endif - -/** - * @brief Pack a gopro_set_request message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param target_system System ID. - * @param target_component Component ID. - * @param cmd_id Command ID. - * @param value Value. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_gopro_set_request_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, uint8_t cmd_id, const uint8_t *value) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_GOPRO_SET_REQUEST_LEN]; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, cmd_id); - _mav_put_uint8_t_array(buf, 3, value, 4); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GOPRO_SET_REQUEST_LEN); -#else - mavlink_gopro_set_request_t packet; - packet.target_system = target_system; - packet.target_component = target_component; - packet.cmd_id = cmd_id; - mav_array_memcpy(packet.value, value, sizeof(uint8_t)*4); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GOPRO_SET_REQUEST_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_GOPRO_SET_REQUEST; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GOPRO_SET_REQUEST_MIN_LEN, MAVLINK_MSG_ID_GOPRO_SET_REQUEST_LEN, MAVLINK_MSG_ID_GOPRO_SET_REQUEST_CRC); -} - -/** - * @brief Pack a gopro_set_request message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param target_system System ID. - * @param target_component Component ID. - * @param cmd_id Command ID. - * @param value Value. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_gopro_set_request_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,uint8_t cmd_id,const uint8_t *value) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_GOPRO_SET_REQUEST_LEN]; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, cmd_id); - _mav_put_uint8_t_array(buf, 3, value, 4); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GOPRO_SET_REQUEST_LEN); -#else - mavlink_gopro_set_request_t packet; - packet.target_system = target_system; - packet.target_component = target_component; - packet.cmd_id = cmd_id; - mav_array_memcpy(packet.value, value, sizeof(uint8_t)*4); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GOPRO_SET_REQUEST_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_GOPRO_SET_REQUEST; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GOPRO_SET_REQUEST_MIN_LEN, MAVLINK_MSG_ID_GOPRO_SET_REQUEST_LEN, MAVLINK_MSG_ID_GOPRO_SET_REQUEST_CRC); -} - -/** - * @brief Encode a gopro_set_request struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param gopro_set_request C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_gopro_set_request_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gopro_set_request_t* gopro_set_request) -{ - return mavlink_msg_gopro_set_request_pack(system_id, component_id, msg, gopro_set_request->target_system, gopro_set_request->target_component, gopro_set_request->cmd_id, gopro_set_request->value); -} - -/** - * @brief Encode a gopro_set_request struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param gopro_set_request C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_gopro_set_request_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gopro_set_request_t* gopro_set_request) -{ - return mavlink_msg_gopro_set_request_pack_chan(system_id, component_id, chan, msg, gopro_set_request->target_system, gopro_set_request->target_component, gopro_set_request->cmd_id, gopro_set_request->value); -} - -/** - * @brief Send a gopro_set_request message - * @param chan MAVLink channel to send the message - * - * @param target_system System ID. - * @param target_component Component ID. - * @param cmd_id Command ID. - * @param value Value. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_gopro_set_request_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t cmd_id, const uint8_t *value) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_GOPRO_SET_REQUEST_LEN]; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, cmd_id); - _mav_put_uint8_t_array(buf, 3, value, 4); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_SET_REQUEST, buf, MAVLINK_MSG_ID_GOPRO_SET_REQUEST_MIN_LEN, MAVLINK_MSG_ID_GOPRO_SET_REQUEST_LEN, MAVLINK_MSG_ID_GOPRO_SET_REQUEST_CRC); -#else - mavlink_gopro_set_request_t packet; - packet.target_system = target_system; - packet.target_component = target_component; - packet.cmd_id = cmd_id; - mav_array_memcpy(packet.value, value, sizeof(uint8_t)*4); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_SET_REQUEST, (const char *)&packet, MAVLINK_MSG_ID_GOPRO_SET_REQUEST_MIN_LEN, MAVLINK_MSG_ID_GOPRO_SET_REQUEST_LEN, MAVLINK_MSG_ID_GOPRO_SET_REQUEST_CRC); -#endif -} - -/** - * @brief Send a gopro_set_request message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_gopro_set_request_send_struct(mavlink_channel_t chan, const mavlink_gopro_set_request_t* gopro_set_request) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_gopro_set_request_send(chan, gopro_set_request->target_system, gopro_set_request->target_component, gopro_set_request->cmd_id, gopro_set_request->value); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_SET_REQUEST, (const char *)gopro_set_request, MAVLINK_MSG_ID_GOPRO_SET_REQUEST_MIN_LEN, MAVLINK_MSG_ID_GOPRO_SET_REQUEST_LEN, MAVLINK_MSG_ID_GOPRO_SET_REQUEST_CRC); -#endif -} - -#if MAVLINK_MSG_ID_GOPRO_SET_REQUEST_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_gopro_set_request_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t cmd_id, const uint8_t *value) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, cmd_id); - _mav_put_uint8_t_array(buf, 3, value, 4); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_SET_REQUEST, buf, MAVLINK_MSG_ID_GOPRO_SET_REQUEST_MIN_LEN, MAVLINK_MSG_ID_GOPRO_SET_REQUEST_LEN, MAVLINK_MSG_ID_GOPRO_SET_REQUEST_CRC); -#else - mavlink_gopro_set_request_t *packet = (mavlink_gopro_set_request_t *)msgbuf; - packet->target_system = target_system; - packet->target_component = target_component; - packet->cmd_id = cmd_id; - mav_array_memcpy(packet->value, value, sizeof(uint8_t)*4); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_SET_REQUEST, (const char *)packet, MAVLINK_MSG_ID_GOPRO_SET_REQUEST_MIN_LEN, MAVLINK_MSG_ID_GOPRO_SET_REQUEST_LEN, MAVLINK_MSG_ID_GOPRO_SET_REQUEST_CRC); -#endif -} -#endif - -#endif - -// MESSAGE GOPRO_SET_REQUEST UNPACKING - - -/** - * @brief Get field target_system from gopro_set_request message - * - * @return System ID. - */ -static inline uint8_t mavlink_msg_gopro_set_request_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 0); -} - -/** - * @brief Get field target_component from gopro_set_request message - * - * @return Component ID. - */ -static inline uint8_t mavlink_msg_gopro_set_request_get_target_component(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 1); -} - -/** - * @brief Get field cmd_id from gopro_set_request message - * - * @return Command ID. - */ -static inline uint8_t mavlink_msg_gopro_set_request_get_cmd_id(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 2); -} - -/** - * @brief Get field value from gopro_set_request message - * - * @return Value. - */ -static inline uint16_t mavlink_msg_gopro_set_request_get_value(const mavlink_message_t* msg, uint8_t *value) -{ - return _MAV_RETURN_uint8_t_array(msg, value, 4, 3); -} - -/** - * @brief Decode a gopro_set_request message into a struct - * - * @param msg The message to decode - * @param gopro_set_request C-struct to decode the message contents into - */ -static inline void mavlink_msg_gopro_set_request_decode(const mavlink_message_t* msg, mavlink_gopro_set_request_t* gopro_set_request) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - gopro_set_request->target_system = mavlink_msg_gopro_set_request_get_target_system(msg); - gopro_set_request->target_component = mavlink_msg_gopro_set_request_get_target_component(msg); - gopro_set_request->cmd_id = mavlink_msg_gopro_set_request_get_cmd_id(msg); - mavlink_msg_gopro_set_request_get_value(msg, gopro_set_request->value); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_GOPRO_SET_REQUEST_LEN? msg->len : MAVLINK_MSG_ID_GOPRO_SET_REQUEST_LEN; - memset(gopro_set_request, 0, MAVLINK_MSG_ID_GOPRO_SET_REQUEST_LEN); - memcpy(gopro_set_request, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_gopro_set_response.h b/ardupilotmega/mavlink_msg_gopro_set_response.h deleted file mode 100644 index 1a187cae5..000000000 --- a/ardupilotmega/mavlink_msg_gopro_set_response.h +++ /dev/null @@ -1,238 +0,0 @@ -#pragma once -// MESSAGE GOPRO_SET_RESPONSE PACKING - -#define MAVLINK_MSG_ID_GOPRO_SET_RESPONSE 219 - - -typedef struct __mavlink_gopro_set_response_t { - uint8_t cmd_id; /*< Command ID.*/ - uint8_t status; /*< Status.*/ -} mavlink_gopro_set_response_t; - -#define MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN 2 -#define MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_MIN_LEN 2 -#define MAVLINK_MSG_ID_219_LEN 2 -#define MAVLINK_MSG_ID_219_MIN_LEN 2 - -#define MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_CRC 162 -#define MAVLINK_MSG_ID_219_CRC 162 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_GOPRO_SET_RESPONSE { \ - 219, \ - "GOPRO_SET_RESPONSE", \ - 2, \ - { { "cmd_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_gopro_set_response_t, cmd_id) }, \ - { "status", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_gopro_set_response_t, status) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_GOPRO_SET_RESPONSE { \ - "GOPRO_SET_RESPONSE", \ - 2, \ - { { "cmd_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_gopro_set_response_t, cmd_id) }, \ - { "status", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_gopro_set_response_t, status) }, \ - } \ -} -#endif - -/** - * @brief Pack a gopro_set_response message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param cmd_id Command ID. - * @param status Status. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_gopro_set_response_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t cmd_id, uint8_t status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN]; - _mav_put_uint8_t(buf, 0, cmd_id); - _mav_put_uint8_t(buf, 1, status); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN); -#else - mavlink_gopro_set_response_t packet; - packet.cmd_id = cmd_id; - packet.status = status; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_GOPRO_SET_RESPONSE; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_MIN_LEN, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_CRC); -} - -/** - * @brief Pack a gopro_set_response message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param cmd_id Command ID. - * @param status Status. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_gopro_set_response_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t cmd_id,uint8_t status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN]; - _mav_put_uint8_t(buf, 0, cmd_id); - _mav_put_uint8_t(buf, 1, status); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN); -#else - mavlink_gopro_set_response_t packet; - packet.cmd_id = cmd_id; - packet.status = status; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_GOPRO_SET_RESPONSE; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_MIN_LEN, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_CRC); -} - -/** - * @brief Encode a gopro_set_response struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param gopro_set_response C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_gopro_set_response_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gopro_set_response_t* gopro_set_response) -{ - return mavlink_msg_gopro_set_response_pack(system_id, component_id, msg, gopro_set_response->cmd_id, gopro_set_response->status); -} - -/** - * @brief Encode a gopro_set_response struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param gopro_set_response C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_gopro_set_response_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gopro_set_response_t* gopro_set_response) -{ - return mavlink_msg_gopro_set_response_pack_chan(system_id, component_id, chan, msg, gopro_set_response->cmd_id, gopro_set_response->status); -} - -/** - * @brief Send a gopro_set_response message - * @param chan MAVLink channel to send the message - * - * @param cmd_id Command ID. - * @param status Status. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_gopro_set_response_send(mavlink_channel_t chan, uint8_t cmd_id, uint8_t status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN]; - _mav_put_uint8_t(buf, 0, cmd_id); - _mav_put_uint8_t(buf, 1, status); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE, buf, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_MIN_LEN, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_CRC); -#else - mavlink_gopro_set_response_t packet; - packet.cmd_id = cmd_id; - packet.status = status; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE, (const char *)&packet, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_MIN_LEN, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_CRC); -#endif -} - -/** - * @brief Send a gopro_set_response message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_gopro_set_response_send_struct(mavlink_channel_t chan, const mavlink_gopro_set_response_t* gopro_set_response) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_gopro_set_response_send(chan, gopro_set_response->cmd_id, gopro_set_response->status); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE, (const char *)gopro_set_response, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_MIN_LEN, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_CRC); -#endif -} - -#if MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_gopro_set_response_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t cmd_id, uint8_t status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint8_t(buf, 0, cmd_id); - _mav_put_uint8_t(buf, 1, status); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE, buf, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_MIN_LEN, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_CRC); -#else - mavlink_gopro_set_response_t *packet = (mavlink_gopro_set_response_t *)msgbuf; - packet->cmd_id = cmd_id; - packet->status = status; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE, (const char *)packet, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_MIN_LEN, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_CRC); -#endif -} -#endif - -#endif - -// MESSAGE GOPRO_SET_RESPONSE UNPACKING - - -/** - * @brief Get field cmd_id from gopro_set_response message - * - * @return Command ID. - */ -static inline uint8_t mavlink_msg_gopro_set_response_get_cmd_id(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 0); -} - -/** - * @brief Get field status from gopro_set_response message - * - * @return Status. - */ -static inline uint8_t mavlink_msg_gopro_set_response_get_status(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 1); -} - -/** - * @brief Decode a gopro_set_response message into a struct - * - * @param msg The message to decode - * @param gopro_set_response C-struct to decode the message contents into - */ -static inline void mavlink_msg_gopro_set_response_decode(const mavlink_message_t* msg, mavlink_gopro_set_response_t* gopro_set_response) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - gopro_set_response->cmd_id = mavlink_msg_gopro_set_response_get_cmd_id(msg); - gopro_set_response->status = mavlink_msg_gopro_set_response_get_status(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN? msg->len : MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN; - memset(gopro_set_response, 0, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN); - memcpy(gopro_set_response, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_hwstatus.h b/ardupilotmega/mavlink_msg_hwstatus.h deleted file mode 100644 index b36c60d91..000000000 --- a/ardupilotmega/mavlink_msg_hwstatus.h +++ /dev/null @@ -1,238 +0,0 @@ -#pragma once -// MESSAGE HWSTATUS PACKING - -#define MAVLINK_MSG_ID_HWSTATUS 165 - - -typedef struct __mavlink_hwstatus_t { - uint16_t Vcc; /*< [mV] Board voltage.*/ - uint8_t I2Cerr; /*< I2C error count.*/ -} mavlink_hwstatus_t; - -#define MAVLINK_MSG_ID_HWSTATUS_LEN 3 -#define MAVLINK_MSG_ID_HWSTATUS_MIN_LEN 3 -#define MAVLINK_MSG_ID_165_LEN 3 -#define MAVLINK_MSG_ID_165_MIN_LEN 3 - -#define MAVLINK_MSG_ID_HWSTATUS_CRC 21 -#define MAVLINK_MSG_ID_165_CRC 21 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_HWSTATUS { \ - 165, \ - "HWSTATUS", \ - 2, \ - { { "Vcc", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_hwstatus_t, Vcc) }, \ - { "I2Cerr", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_hwstatus_t, I2Cerr) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_HWSTATUS { \ - "HWSTATUS", \ - 2, \ - { { "Vcc", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_hwstatus_t, Vcc) }, \ - { "I2Cerr", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_hwstatus_t, I2Cerr) }, \ - } \ -} -#endif - -/** - * @brief Pack a hwstatus message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param Vcc [mV] Board voltage. - * @param I2Cerr I2C error count. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_hwstatus_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint16_t Vcc, uint8_t I2Cerr) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_HWSTATUS_LEN]; - _mav_put_uint16_t(buf, 0, Vcc); - _mav_put_uint8_t(buf, 2, I2Cerr); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HWSTATUS_LEN); -#else - mavlink_hwstatus_t packet; - packet.Vcc = Vcc; - packet.I2Cerr = I2Cerr; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HWSTATUS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_HWSTATUS; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HWSTATUS_MIN_LEN, MAVLINK_MSG_ID_HWSTATUS_LEN, MAVLINK_MSG_ID_HWSTATUS_CRC); -} - -/** - * @brief Pack a hwstatus message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param Vcc [mV] Board voltage. - * @param I2Cerr I2C error count. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_hwstatus_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint16_t Vcc,uint8_t I2Cerr) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_HWSTATUS_LEN]; - _mav_put_uint16_t(buf, 0, Vcc); - _mav_put_uint8_t(buf, 2, I2Cerr); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HWSTATUS_LEN); -#else - mavlink_hwstatus_t packet; - packet.Vcc = Vcc; - packet.I2Cerr = I2Cerr; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HWSTATUS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_HWSTATUS; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HWSTATUS_MIN_LEN, MAVLINK_MSG_ID_HWSTATUS_LEN, MAVLINK_MSG_ID_HWSTATUS_CRC); -} - -/** - * @brief Encode a hwstatus struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param hwstatus C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_hwstatus_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_hwstatus_t* hwstatus) -{ - return mavlink_msg_hwstatus_pack(system_id, component_id, msg, hwstatus->Vcc, hwstatus->I2Cerr); -} - -/** - * @brief Encode a hwstatus struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param hwstatus C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_hwstatus_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_hwstatus_t* hwstatus) -{ - return mavlink_msg_hwstatus_pack_chan(system_id, component_id, chan, msg, hwstatus->Vcc, hwstatus->I2Cerr); -} - -/** - * @brief Send a hwstatus message - * @param chan MAVLink channel to send the message - * - * @param Vcc [mV] Board voltage. - * @param I2Cerr I2C error count. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_hwstatus_send(mavlink_channel_t chan, uint16_t Vcc, uint8_t I2Cerr) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_HWSTATUS_LEN]; - _mav_put_uint16_t(buf, 0, Vcc); - _mav_put_uint8_t(buf, 2, I2Cerr); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HWSTATUS, buf, MAVLINK_MSG_ID_HWSTATUS_MIN_LEN, MAVLINK_MSG_ID_HWSTATUS_LEN, MAVLINK_MSG_ID_HWSTATUS_CRC); -#else - mavlink_hwstatus_t packet; - packet.Vcc = Vcc; - packet.I2Cerr = I2Cerr; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HWSTATUS, (const char *)&packet, MAVLINK_MSG_ID_HWSTATUS_MIN_LEN, MAVLINK_MSG_ID_HWSTATUS_LEN, MAVLINK_MSG_ID_HWSTATUS_CRC); -#endif -} - -/** - * @brief Send a hwstatus message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_hwstatus_send_struct(mavlink_channel_t chan, const mavlink_hwstatus_t* hwstatus) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_hwstatus_send(chan, hwstatus->Vcc, hwstatus->I2Cerr); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HWSTATUS, (const char *)hwstatus, MAVLINK_MSG_ID_HWSTATUS_MIN_LEN, MAVLINK_MSG_ID_HWSTATUS_LEN, MAVLINK_MSG_ID_HWSTATUS_CRC); -#endif -} - -#if MAVLINK_MSG_ID_HWSTATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_hwstatus_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint16_t Vcc, uint8_t I2Cerr) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint16_t(buf, 0, Vcc); - _mav_put_uint8_t(buf, 2, I2Cerr); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HWSTATUS, buf, MAVLINK_MSG_ID_HWSTATUS_MIN_LEN, MAVLINK_MSG_ID_HWSTATUS_LEN, MAVLINK_MSG_ID_HWSTATUS_CRC); -#else - mavlink_hwstatus_t *packet = (mavlink_hwstatus_t *)msgbuf; - packet->Vcc = Vcc; - packet->I2Cerr = I2Cerr; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HWSTATUS, (const char *)packet, MAVLINK_MSG_ID_HWSTATUS_MIN_LEN, MAVLINK_MSG_ID_HWSTATUS_LEN, MAVLINK_MSG_ID_HWSTATUS_CRC); -#endif -} -#endif - -#endif - -// MESSAGE HWSTATUS UNPACKING - - -/** - * @brief Get field Vcc from hwstatus message - * - * @return [mV] Board voltage. - */ -static inline uint16_t mavlink_msg_hwstatus_get_Vcc(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 0); -} - -/** - * @brief Get field I2Cerr from hwstatus message - * - * @return I2C error count. - */ -static inline uint8_t mavlink_msg_hwstatus_get_I2Cerr(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 2); -} - -/** - * @brief Decode a hwstatus message into a struct - * - * @param msg The message to decode - * @param hwstatus C-struct to decode the message contents into - */ -static inline void mavlink_msg_hwstatus_decode(const mavlink_message_t* msg, mavlink_hwstatus_t* hwstatus) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - hwstatus->Vcc = mavlink_msg_hwstatus_get_Vcc(msg); - hwstatus->I2Cerr = mavlink_msg_hwstatus_get_I2Cerr(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_HWSTATUS_LEN? msg->len : MAVLINK_MSG_ID_HWSTATUS_LEN; - memset(hwstatus, 0, MAVLINK_MSG_ID_HWSTATUS_LEN); - memcpy(hwstatus, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_led_control.h b/ardupilotmega/mavlink_msg_led_control.h deleted file mode 100644 index 4a66f7d0a..000000000 --- a/ardupilotmega/mavlink_msg_led_control.h +++ /dev/null @@ -1,330 +0,0 @@ -#pragma once -// MESSAGE LED_CONTROL PACKING - -#define MAVLINK_MSG_ID_LED_CONTROL 186 - - -typedef struct __mavlink_led_control_t { - uint8_t target_system; /*< System ID.*/ - uint8_t target_component; /*< Component ID.*/ - uint8_t instance; /*< Instance (LED instance to control or 255 for all LEDs).*/ - uint8_t pattern; /*< Pattern (see LED_PATTERN_ENUM).*/ - uint8_t custom_len; /*< Custom Byte Length.*/ - uint8_t custom_bytes[24]; /*< Custom Bytes.*/ -} mavlink_led_control_t; - -#define MAVLINK_MSG_ID_LED_CONTROL_LEN 29 -#define MAVLINK_MSG_ID_LED_CONTROL_MIN_LEN 29 -#define MAVLINK_MSG_ID_186_LEN 29 -#define MAVLINK_MSG_ID_186_MIN_LEN 29 - -#define MAVLINK_MSG_ID_LED_CONTROL_CRC 72 -#define MAVLINK_MSG_ID_186_CRC 72 - -#define MAVLINK_MSG_LED_CONTROL_FIELD_CUSTOM_BYTES_LEN 24 - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_LED_CONTROL { \ - 186, \ - "LED_CONTROL", \ - 6, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_led_control_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_led_control_t, target_component) }, \ - { "instance", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_led_control_t, instance) }, \ - { "pattern", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_led_control_t, pattern) }, \ - { "custom_len", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_led_control_t, custom_len) }, \ - { "custom_bytes", NULL, MAVLINK_TYPE_UINT8_T, 24, 5, offsetof(mavlink_led_control_t, custom_bytes) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_LED_CONTROL { \ - "LED_CONTROL", \ - 6, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_led_control_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_led_control_t, target_component) }, \ - { "instance", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_led_control_t, instance) }, \ - { "pattern", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_led_control_t, pattern) }, \ - { "custom_len", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_led_control_t, custom_len) }, \ - { "custom_bytes", NULL, MAVLINK_TYPE_UINT8_T, 24, 5, offsetof(mavlink_led_control_t, custom_bytes) }, \ - } \ -} -#endif - -/** - * @brief Pack a led_control message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param target_system System ID. - * @param target_component Component ID. - * @param instance Instance (LED instance to control or 255 for all LEDs). - * @param pattern Pattern (see LED_PATTERN_ENUM). - * @param custom_len Custom Byte Length. - * @param custom_bytes Custom Bytes. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_led_control_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, uint8_t instance, uint8_t pattern, uint8_t custom_len, const uint8_t *custom_bytes) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_LED_CONTROL_LEN]; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, instance); - _mav_put_uint8_t(buf, 3, pattern); - _mav_put_uint8_t(buf, 4, custom_len); - _mav_put_uint8_t_array(buf, 5, custom_bytes, 24); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LED_CONTROL_LEN); -#else - mavlink_led_control_t packet; - packet.target_system = target_system; - packet.target_component = target_component; - packet.instance = instance; - packet.pattern = pattern; - packet.custom_len = custom_len; - mav_array_memcpy(packet.custom_bytes, custom_bytes, sizeof(uint8_t)*24); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LED_CONTROL_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_LED_CONTROL; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LED_CONTROL_MIN_LEN, MAVLINK_MSG_ID_LED_CONTROL_LEN, MAVLINK_MSG_ID_LED_CONTROL_CRC); -} - -/** - * @brief Pack a led_control message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param target_system System ID. - * @param target_component Component ID. - * @param instance Instance (LED instance to control or 255 for all LEDs). - * @param pattern Pattern (see LED_PATTERN_ENUM). - * @param custom_len Custom Byte Length. - * @param custom_bytes Custom Bytes. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_led_control_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,uint8_t instance,uint8_t pattern,uint8_t custom_len,const uint8_t *custom_bytes) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_LED_CONTROL_LEN]; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, instance); - _mav_put_uint8_t(buf, 3, pattern); - _mav_put_uint8_t(buf, 4, custom_len); - _mav_put_uint8_t_array(buf, 5, custom_bytes, 24); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LED_CONTROL_LEN); -#else - mavlink_led_control_t packet; - packet.target_system = target_system; - packet.target_component = target_component; - packet.instance = instance; - packet.pattern = pattern; - packet.custom_len = custom_len; - mav_array_memcpy(packet.custom_bytes, custom_bytes, sizeof(uint8_t)*24); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LED_CONTROL_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_LED_CONTROL; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_LED_CONTROL_MIN_LEN, MAVLINK_MSG_ID_LED_CONTROL_LEN, MAVLINK_MSG_ID_LED_CONTROL_CRC); -} - -/** - * @brief Encode a led_control struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param led_control C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_led_control_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_led_control_t* led_control) -{ - return mavlink_msg_led_control_pack(system_id, component_id, msg, led_control->target_system, led_control->target_component, led_control->instance, led_control->pattern, led_control->custom_len, led_control->custom_bytes); -} - -/** - * @brief Encode a led_control struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param led_control C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_led_control_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_led_control_t* led_control) -{ - return mavlink_msg_led_control_pack_chan(system_id, component_id, chan, msg, led_control->target_system, led_control->target_component, led_control->instance, led_control->pattern, led_control->custom_len, led_control->custom_bytes); -} - -/** - * @brief Send a led_control message - * @param chan MAVLink channel to send the message - * - * @param target_system System ID. - * @param target_component Component ID. - * @param instance Instance (LED instance to control or 255 for all LEDs). - * @param pattern Pattern (see LED_PATTERN_ENUM). - * @param custom_len Custom Byte Length. - * @param custom_bytes Custom Bytes. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_led_control_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t instance, uint8_t pattern, uint8_t custom_len, const uint8_t *custom_bytes) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_LED_CONTROL_LEN]; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, instance); - _mav_put_uint8_t(buf, 3, pattern); - _mav_put_uint8_t(buf, 4, custom_len); - _mav_put_uint8_t_array(buf, 5, custom_bytes, 24); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LED_CONTROL, buf, MAVLINK_MSG_ID_LED_CONTROL_MIN_LEN, MAVLINK_MSG_ID_LED_CONTROL_LEN, MAVLINK_MSG_ID_LED_CONTROL_CRC); -#else - mavlink_led_control_t packet; - packet.target_system = target_system; - packet.target_component = target_component; - packet.instance = instance; - packet.pattern = pattern; - packet.custom_len = custom_len; - mav_array_memcpy(packet.custom_bytes, custom_bytes, sizeof(uint8_t)*24); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LED_CONTROL, (const char *)&packet, MAVLINK_MSG_ID_LED_CONTROL_MIN_LEN, MAVLINK_MSG_ID_LED_CONTROL_LEN, MAVLINK_MSG_ID_LED_CONTROL_CRC); -#endif -} - -/** - * @brief Send a led_control message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_led_control_send_struct(mavlink_channel_t chan, const mavlink_led_control_t* led_control) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_led_control_send(chan, led_control->target_system, led_control->target_component, led_control->instance, led_control->pattern, led_control->custom_len, led_control->custom_bytes); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LED_CONTROL, (const char *)led_control, MAVLINK_MSG_ID_LED_CONTROL_MIN_LEN, MAVLINK_MSG_ID_LED_CONTROL_LEN, MAVLINK_MSG_ID_LED_CONTROL_CRC); -#endif -} - -#if MAVLINK_MSG_ID_LED_CONTROL_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_led_control_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t instance, uint8_t pattern, uint8_t custom_len, const uint8_t *custom_bytes) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, instance); - _mav_put_uint8_t(buf, 3, pattern); - _mav_put_uint8_t(buf, 4, custom_len); - _mav_put_uint8_t_array(buf, 5, custom_bytes, 24); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LED_CONTROL, buf, MAVLINK_MSG_ID_LED_CONTROL_MIN_LEN, MAVLINK_MSG_ID_LED_CONTROL_LEN, MAVLINK_MSG_ID_LED_CONTROL_CRC); -#else - mavlink_led_control_t *packet = (mavlink_led_control_t *)msgbuf; - packet->target_system = target_system; - packet->target_component = target_component; - packet->instance = instance; - packet->pattern = pattern; - packet->custom_len = custom_len; - mav_array_memcpy(packet->custom_bytes, custom_bytes, sizeof(uint8_t)*24); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LED_CONTROL, (const char *)packet, MAVLINK_MSG_ID_LED_CONTROL_MIN_LEN, MAVLINK_MSG_ID_LED_CONTROL_LEN, MAVLINK_MSG_ID_LED_CONTROL_CRC); -#endif -} -#endif - -#endif - -// MESSAGE LED_CONTROL UNPACKING - - -/** - * @brief Get field target_system from led_control message - * - * @return System ID. - */ -static inline uint8_t mavlink_msg_led_control_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 0); -} - -/** - * @brief Get field target_component from led_control message - * - * @return Component ID. - */ -static inline uint8_t mavlink_msg_led_control_get_target_component(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 1); -} - -/** - * @brief Get field instance from led_control message - * - * @return Instance (LED instance to control or 255 for all LEDs). - */ -static inline uint8_t mavlink_msg_led_control_get_instance(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 2); -} - -/** - * @brief Get field pattern from led_control message - * - * @return Pattern (see LED_PATTERN_ENUM). - */ -static inline uint8_t mavlink_msg_led_control_get_pattern(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 3); -} - -/** - * @brief Get field custom_len from led_control message - * - * @return Custom Byte Length. - */ -static inline uint8_t mavlink_msg_led_control_get_custom_len(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 4); -} - -/** - * @brief Get field custom_bytes from led_control message - * - * @return Custom Bytes. - */ -static inline uint16_t mavlink_msg_led_control_get_custom_bytes(const mavlink_message_t* msg, uint8_t *custom_bytes) -{ - return _MAV_RETURN_uint8_t_array(msg, custom_bytes, 24, 5); -} - -/** - * @brief Decode a led_control message into a struct - * - * @param msg The message to decode - * @param led_control C-struct to decode the message contents into - */ -static inline void mavlink_msg_led_control_decode(const mavlink_message_t* msg, mavlink_led_control_t* led_control) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - led_control->target_system = mavlink_msg_led_control_get_target_system(msg); - led_control->target_component = mavlink_msg_led_control_get_target_component(msg); - led_control->instance = mavlink_msg_led_control_get_instance(msg); - led_control->pattern = mavlink_msg_led_control_get_pattern(msg); - led_control->custom_len = mavlink_msg_led_control_get_custom_len(msg); - mavlink_msg_led_control_get_custom_bytes(msg, led_control->custom_bytes); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_LED_CONTROL_LEN? msg->len : MAVLINK_MSG_ID_LED_CONTROL_LEN; - memset(led_control, 0, MAVLINK_MSG_ID_LED_CONTROL_LEN); - memcpy(led_control, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_limits_status.h b/ardupilotmega/mavlink_msg_limits_status.h deleted file mode 100644 index c35312025..000000000 --- a/ardupilotmega/mavlink_msg_limits_status.h +++ /dev/null @@ -1,413 +0,0 @@ -#pragma once -// MESSAGE LIMITS_STATUS PACKING - -#define MAVLINK_MSG_ID_LIMITS_STATUS 167 - - -typedef struct __mavlink_limits_status_t { - uint32_t last_trigger; /*< [ms] Time (since boot) of last breach.*/ - uint32_t last_action; /*< [ms] Time (since boot) of last recovery action.*/ - uint32_t last_recovery; /*< [ms] Time (since boot) of last successful recovery.*/ - uint32_t last_clear; /*< [ms] Time (since boot) of last all-clear.*/ - uint16_t breach_count; /*< Number of fence breaches.*/ - uint8_t limits_state; /*< State of AP_Limits.*/ - uint8_t mods_enabled; /*< AP_Limit_Module bitfield of enabled modules.*/ - uint8_t mods_required; /*< AP_Limit_Module bitfield of required modules.*/ - uint8_t mods_triggered; /*< AP_Limit_Module bitfield of triggered modules.*/ -} mavlink_limits_status_t; - -#define MAVLINK_MSG_ID_LIMITS_STATUS_LEN 22 -#define MAVLINK_MSG_ID_LIMITS_STATUS_MIN_LEN 22 -#define MAVLINK_MSG_ID_167_LEN 22 -#define MAVLINK_MSG_ID_167_MIN_LEN 22 - -#define MAVLINK_MSG_ID_LIMITS_STATUS_CRC 144 -#define MAVLINK_MSG_ID_167_CRC 144 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_LIMITS_STATUS { \ - 167, \ - "LIMITS_STATUS", \ - 9, \ - { { "limits_state", NULL, MAVLINK_TYPE_UINT8_T, 0, 18, offsetof(mavlink_limits_status_t, limits_state) }, \ - { "last_trigger", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_limits_status_t, last_trigger) }, \ - { "last_action", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_limits_status_t, last_action) }, \ - { "last_recovery", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_limits_status_t, last_recovery) }, \ - { "last_clear", NULL, MAVLINK_TYPE_UINT32_T, 0, 12, offsetof(mavlink_limits_status_t, last_clear) }, \ - { "breach_count", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_limits_status_t, breach_count) }, \ - { "mods_enabled", NULL, MAVLINK_TYPE_UINT8_T, 0, 19, offsetof(mavlink_limits_status_t, mods_enabled) }, \ - { "mods_required", NULL, MAVLINK_TYPE_UINT8_T, 0, 20, offsetof(mavlink_limits_status_t, mods_required) }, \ - { "mods_triggered", NULL, MAVLINK_TYPE_UINT8_T, 0, 21, offsetof(mavlink_limits_status_t, mods_triggered) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_LIMITS_STATUS { \ - "LIMITS_STATUS", \ - 9, \ - { { "limits_state", NULL, MAVLINK_TYPE_UINT8_T, 0, 18, offsetof(mavlink_limits_status_t, limits_state) }, \ - { "last_trigger", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_limits_status_t, last_trigger) }, \ - { "last_action", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_limits_status_t, last_action) }, \ - { "last_recovery", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_limits_status_t, last_recovery) }, \ - { "last_clear", NULL, MAVLINK_TYPE_UINT32_T, 0, 12, offsetof(mavlink_limits_status_t, last_clear) }, \ - { "breach_count", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_limits_status_t, breach_count) }, \ - { "mods_enabled", NULL, MAVLINK_TYPE_UINT8_T, 0, 19, offsetof(mavlink_limits_status_t, mods_enabled) }, \ - { "mods_required", NULL, MAVLINK_TYPE_UINT8_T, 0, 20, offsetof(mavlink_limits_status_t, mods_required) }, \ - { "mods_triggered", NULL, MAVLINK_TYPE_UINT8_T, 0, 21, offsetof(mavlink_limits_status_t, mods_triggered) }, \ - } \ -} -#endif - -/** - * @brief Pack a limits_status message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param limits_state State of AP_Limits. - * @param last_trigger [ms] Time (since boot) of last breach. - * @param last_action [ms] Time (since boot) of last recovery action. - * @param last_recovery [ms] Time (since boot) of last successful recovery. - * @param last_clear [ms] Time (since boot) of last all-clear. - * @param breach_count Number of fence breaches. - * @param mods_enabled AP_Limit_Module bitfield of enabled modules. - * @param mods_required AP_Limit_Module bitfield of required modules. - * @param mods_triggered AP_Limit_Module bitfield of triggered modules. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_limits_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t limits_state, uint32_t last_trigger, uint32_t last_action, uint32_t last_recovery, uint32_t last_clear, uint16_t breach_count, uint8_t mods_enabled, uint8_t mods_required, uint8_t mods_triggered) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_LIMITS_STATUS_LEN]; - _mav_put_uint32_t(buf, 0, last_trigger); - _mav_put_uint32_t(buf, 4, last_action); - _mav_put_uint32_t(buf, 8, last_recovery); - _mav_put_uint32_t(buf, 12, last_clear); - _mav_put_uint16_t(buf, 16, breach_count); - _mav_put_uint8_t(buf, 18, limits_state); - _mav_put_uint8_t(buf, 19, mods_enabled); - _mav_put_uint8_t(buf, 20, mods_required); - _mav_put_uint8_t(buf, 21, mods_triggered); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LIMITS_STATUS_LEN); -#else - mavlink_limits_status_t packet; - packet.last_trigger = last_trigger; - packet.last_action = last_action; - packet.last_recovery = last_recovery; - packet.last_clear = last_clear; - packet.breach_count = breach_count; - packet.limits_state = limits_state; - packet.mods_enabled = mods_enabled; - packet.mods_required = mods_required; - packet.mods_triggered = mods_triggered; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LIMITS_STATUS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_LIMITS_STATUS; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LIMITS_STATUS_MIN_LEN, MAVLINK_MSG_ID_LIMITS_STATUS_LEN, MAVLINK_MSG_ID_LIMITS_STATUS_CRC); -} - -/** - * @brief Pack a limits_status message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param limits_state State of AP_Limits. - * @param last_trigger [ms] Time (since boot) of last breach. - * @param last_action [ms] Time (since boot) of last recovery action. - * @param last_recovery [ms] Time (since boot) of last successful recovery. - * @param last_clear [ms] Time (since boot) of last all-clear. - * @param breach_count Number of fence breaches. - * @param mods_enabled AP_Limit_Module bitfield of enabled modules. - * @param mods_required AP_Limit_Module bitfield of required modules. - * @param mods_triggered AP_Limit_Module bitfield of triggered modules. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_limits_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t limits_state,uint32_t last_trigger,uint32_t last_action,uint32_t last_recovery,uint32_t last_clear,uint16_t breach_count,uint8_t mods_enabled,uint8_t mods_required,uint8_t mods_triggered) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_LIMITS_STATUS_LEN]; - _mav_put_uint32_t(buf, 0, last_trigger); - _mav_put_uint32_t(buf, 4, last_action); - _mav_put_uint32_t(buf, 8, last_recovery); - _mav_put_uint32_t(buf, 12, last_clear); - _mav_put_uint16_t(buf, 16, breach_count); - _mav_put_uint8_t(buf, 18, limits_state); - _mav_put_uint8_t(buf, 19, mods_enabled); - _mav_put_uint8_t(buf, 20, mods_required); - _mav_put_uint8_t(buf, 21, mods_triggered); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LIMITS_STATUS_LEN); -#else - mavlink_limits_status_t packet; - packet.last_trigger = last_trigger; - packet.last_action = last_action; - packet.last_recovery = last_recovery; - packet.last_clear = last_clear; - packet.breach_count = breach_count; - packet.limits_state = limits_state; - packet.mods_enabled = mods_enabled; - packet.mods_required = mods_required; - packet.mods_triggered = mods_triggered; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LIMITS_STATUS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_LIMITS_STATUS; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_LIMITS_STATUS_MIN_LEN, MAVLINK_MSG_ID_LIMITS_STATUS_LEN, MAVLINK_MSG_ID_LIMITS_STATUS_CRC); -} - -/** - * @brief Encode a limits_status struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param limits_status C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_limits_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_limits_status_t* limits_status) -{ - return mavlink_msg_limits_status_pack(system_id, component_id, msg, limits_status->limits_state, limits_status->last_trigger, limits_status->last_action, limits_status->last_recovery, limits_status->last_clear, limits_status->breach_count, limits_status->mods_enabled, limits_status->mods_required, limits_status->mods_triggered); -} - -/** - * @brief Encode a limits_status struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param limits_status C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_limits_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_limits_status_t* limits_status) -{ - return mavlink_msg_limits_status_pack_chan(system_id, component_id, chan, msg, limits_status->limits_state, limits_status->last_trigger, limits_status->last_action, limits_status->last_recovery, limits_status->last_clear, limits_status->breach_count, limits_status->mods_enabled, limits_status->mods_required, limits_status->mods_triggered); -} - -/** - * @brief Send a limits_status message - * @param chan MAVLink channel to send the message - * - * @param limits_state State of AP_Limits. - * @param last_trigger [ms] Time (since boot) of last breach. - * @param last_action [ms] Time (since boot) of last recovery action. - * @param last_recovery [ms] Time (since boot) of last successful recovery. - * @param last_clear [ms] Time (since boot) of last all-clear. - * @param breach_count Number of fence breaches. - * @param mods_enabled AP_Limit_Module bitfield of enabled modules. - * @param mods_required AP_Limit_Module bitfield of required modules. - * @param mods_triggered AP_Limit_Module bitfield of triggered modules. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_limits_status_send(mavlink_channel_t chan, uint8_t limits_state, uint32_t last_trigger, uint32_t last_action, uint32_t last_recovery, uint32_t last_clear, uint16_t breach_count, uint8_t mods_enabled, uint8_t mods_required, uint8_t mods_triggered) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_LIMITS_STATUS_LEN]; - _mav_put_uint32_t(buf, 0, last_trigger); - _mav_put_uint32_t(buf, 4, last_action); - _mav_put_uint32_t(buf, 8, last_recovery); - _mav_put_uint32_t(buf, 12, last_clear); - _mav_put_uint16_t(buf, 16, breach_count); - _mav_put_uint8_t(buf, 18, limits_state); - _mav_put_uint8_t(buf, 19, mods_enabled); - _mav_put_uint8_t(buf, 20, mods_required); - _mav_put_uint8_t(buf, 21, mods_triggered); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LIMITS_STATUS, buf, MAVLINK_MSG_ID_LIMITS_STATUS_MIN_LEN, MAVLINK_MSG_ID_LIMITS_STATUS_LEN, MAVLINK_MSG_ID_LIMITS_STATUS_CRC); -#else - mavlink_limits_status_t packet; - packet.last_trigger = last_trigger; - packet.last_action = last_action; - packet.last_recovery = last_recovery; - packet.last_clear = last_clear; - packet.breach_count = breach_count; - packet.limits_state = limits_state; - packet.mods_enabled = mods_enabled; - packet.mods_required = mods_required; - packet.mods_triggered = mods_triggered; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LIMITS_STATUS, (const char *)&packet, MAVLINK_MSG_ID_LIMITS_STATUS_MIN_LEN, MAVLINK_MSG_ID_LIMITS_STATUS_LEN, MAVLINK_MSG_ID_LIMITS_STATUS_CRC); -#endif -} - -/** - * @brief Send a limits_status message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_limits_status_send_struct(mavlink_channel_t chan, const mavlink_limits_status_t* limits_status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_limits_status_send(chan, limits_status->limits_state, limits_status->last_trigger, limits_status->last_action, limits_status->last_recovery, limits_status->last_clear, limits_status->breach_count, limits_status->mods_enabled, limits_status->mods_required, limits_status->mods_triggered); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LIMITS_STATUS, (const char *)limits_status, MAVLINK_MSG_ID_LIMITS_STATUS_MIN_LEN, MAVLINK_MSG_ID_LIMITS_STATUS_LEN, MAVLINK_MSG_ID_LIMITS_STATUS_CRC); -#endif -} - -#if MAVLINK_MSG_ID_LIMITS_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_limits_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t limits_state, uint32_t last_trigger, uint32_t last_action, uint32_t last_recovery, uint32_t last_clear, uint16_t breach_count, uint8_t mods_enabled, uint8_t mods_required, uint8_t mods_triggered) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint32_t(buf, 0, last_trigger); - _mav_put_uint32_t(buf, 4, last_action); - _mav_put_uint32_t(buf, 8, last_recovery); - _mav_put_uint32_t(buf, 12, last_clear); - _mav_put_uint16_t(buf, 16, breach_count); - _mav_put_uint8_t(buf, 18, limits_state); - _mav_put_uint8_t(buf, 19, mods_enabled); - _mav_put_uint8_t(buf, 20, mods_required); - _mav_put_uint8_t(buf, 21, mods_triggered); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LIMITS_STATUS, buf, MAVLINK_MSG_ID_LIMITS_STATUS_MIN_LEN, MAVLINK_MSG_ID_LIMITS_STATUS_LEN, MAVLINK_MSG_ID_LIMITS_STATUS_CRC); -#else - mavlink_limits_status_t *packet = (mavlink_limits_status_t *)msgbuf; - packet->last_trigger = last_trigger; - packet->last_action = last_action; - packet->last_recovery = last_recovery; - packet->last_clear = last_clear; - packet->breach_count = breach_count; - packet->limits_state = limits_state; - packet->mods_enabled = mods_enabled; - packet->mods_required = mods_required; - packet->mods_triggered = mods_triggered; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LIMITS_STATUS, (const char *)packet, MAVLINK_MSG_ID_LIMITS_STATUS_MIN_LEN, MAVLINK_MSG_ID_LIMITS_STATUS_LEN, MAVLINK_MSG_ID_LIMITS_STATUS_CRC); -#endif -} -#endif - -#endif - -// MESSAGE LIMITS_STATUS UNPACKING - - -/** - * @brief Get field limits_state from limits_status message - * - * @return State of AP_Limits. - */ -static inline uint8_t mavlink_msg_limits_status_get_limits_state(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 18); -} - -/** - * @brief Get field last_trigger from limits_status message - * - * @return [ms] Time (since boot) of last breach. - */ -static inline uint32_t mavlink_msg_limits_status_get_last_trigger(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 0); -} - -/** - * @brief Get field last_action from limits_status message - * - * @return [ms] Time (since boot) of last recovery action. - */ -static inline uint32_t mavlink_msg_limits_status_get_last_action(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 4); -} - -/** - * @brief Get field last_recovery from limits_status message - * - * @return [ms] Time (since boot) of last successful recovery. - */ -static inline uint32_t mavlink_msg_limits_status_get_last_recovery(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 8); -} - -/** - * @brief Get field last_clear from limits_status message - * - * @return [ms] Time (since boot) of last all-clear. - */ -static inline uint32_t mavlink_msg_limits_status_get_last_clear(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 12); -} - -/** - * @brief Get field breach_count from limits_status message - * - * @return Number of fence breaches. - */ -static inline uint16_t mavlink_msg_limits_status_get_breach_count(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 16); -} - -/** - * @brief Get field mods_enabled from limits_status message - * - * @return AP_Limit_Module bitfield of enabled modules. - */ -static inline uint8_t mavlink_msg_limits_status_get_mods_enabled(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 19); -} - -/** - * @brief Get field mods_required from limits_status message - * - * @return AP_Limit_Module bitfield of required modules. - */ -static inline uint8_t mavlink_msg_limits_status_get_mods_required(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 20); -} - -/** - * @brief Get field mods_triggered from limits_status message - * - * @return AP_Limit_Module bitfield of triggered modules. - */ -static inline uint8_t mavlink_msg_limits_status_get_mods_triggered(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 21); -} - -/** - * @brief Decode a limits_status message into a struct - * - * @param msg The message to decode - * @param limits_status C-struct to decode the message contents into - */ -static inline void mavlink_msg_limits_status_decode(const mavlink_message_t* msg, mavlink_limits_status_t* limits_status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - limits_status->last_trigger = mavlink_msg_limits_status_get_last_trigger(msg); - limits_status->last_action = mavlink_msg_limits_status_get_last_action(msg); - limits_status->last_recovery = mavlink_msg_limits_status_get_last_recovery(msg); - limits_status->last_clear = mavlink_msg_limits_status_get_last_clear(msg); - limits_status->breach_count = mavlink_msg_limits_status_get_breach_count(msg); - limits_status->limits_state = mavlink_msg_limits_status_get_limits_state(msg); - limits_status->mods_enabled = mavlink_msg_limits_status_get_mods_enabled(msg); - limits_status->mods_required = mavlink_msg_limits_status_get_mods_required(msg); - limits_status->mods_triggered = mavlink_msg_limits_status_get_mods_triggered(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_LIMITS_STATUS_LEN? msg->len : MAVLINK_MSG_ID_LIMITS_STATUS_LEN; - memset(limits_status, 0, MAVLINK_MSG_ID_LIMITS_STATUS_LEN); - memcpy(limits_status, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_mag_cal_progress.h b/ardupilotmega/mavlink_msg_mag_cal_progress.h deleted file mode 100644 index 018469ed1..000000000 --- a/ardupilotmega/mavlink_msg_mag_cal_progress.h +++ /dev/null @@ -1,405 +0,0 @@ -#pragma once -// MESSAGE MAG_CAL_PROGRESS PACKING - -#define MAVLINK_MSG_ID_MAG_CAL_PROGRESS 191 - - -typedef struct __mavlink_mag_cal_progress_t { - float direction_x; /*< Body frame direction vector for display.*/ - float direction_y; /*< Body frame direction vector for display.*/ - float direction_z; /*< Body frame direction vector for display.*/ - uint8_t compass_id; /*< Compass being calibrated.*/ - uint8_t cal_mask; /*< Bitmask of compasses being calibrated.*/ - uint8_t cal_status; /*< Calibration Status.*/ - uint8_t attempt; /*< Attempt number.*/ - uint8_t completion_pct; /*< [%] Completion percentage.*/ - uint8_t completion_mask[10]; /*< Bitmask of sphere sections (see http://en.wikipedia.org/wiki/Geodesic_grid).*/ -} mavlink_mag_cal_progress_t; - -#define MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN 27 -#define MAVLINK_MSG_ID_MAG_CAL_PROGRESS_MIN_LEN 27 -#define MAVLINK_MSG_ID_191_LEN 27 -#define MAVLINK_MSG_ID_191_MIN_LEN 27 - -#define MAVLINK_MSG_ID_MAG_CAL_PROGRESS_CRC 92 -#define MAVLINK_MSG_ID_191_CRC 92 - -#define MAVLINK_MSG_MAG_CAL_PROGRESS_FIELD_COMPLETION_MASK_LEN 10 - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_MAG_CAL_PROGRESS { \ - 191, \ - "MAG_CAL_PROGRESS", \ - 9, \ - { { "compass_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_mag_cal_progress_t, compass_id) }, \ - { "cal_mask", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_mag_cal_progress_t, cal_mask) }, \ - { "cal_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 14, offsetof(mavlink_mag_cal_progress_t, cal_status) }, \ - { "attempt", NULL, MAVLINK_TYPE_UINT8_T, 0, 15, offsetof(mavlink_mag_cal_progress_t, attempt) }, \ - { "completion_pct", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_mag_cal_progress_t, completion_pct) }, \ - { "completion_mask", NULL, MAVLINK_TYPE_UINT8_T, 10, 17, offsetof(mavlink_mag_cal_progress_t, completion_mask) }, \ - { "direction_x", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_mag_cal_progress_t, direction_x) }, \ - { "direction_y", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_mag_cal_progress_t, direction_y) }, \ - { "direction_z", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_mag_cal_progress_t, direction_z) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_MAG_CAL_PROGRESS { \ - "MAG_CAL_PROGRESS", \ - 9, \ - { { "compass_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_mag_cal_progress_t, compass_id) }, \ - { "cal_mask", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_mag_cal_progress_t, cal_mask) }, \ - { "cal_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 14, offsetof(mavlink_mag_cal_progress_t, cal_status) }, \ - { "attempt", NULL, MAVLINK_TYPE_UINT8_T, 0, 15, offsetof(mavlink_mag_cal_progress_t, attempt) }, \ - { "completion_pct", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_mag_cal_progress_t, completion_pct) }, \ - { "completion_mask", NULL, MAVLINK_TYPE_UINT8_T, 10, 17, offsetof(mavlink_mag_cal_progress_t, completion_mask) }, \ - { "direction_x", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_mag_cal_progress_t, direction_x) }, \ - { "direction_y", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_mag_cal_progress_t, direction_y) }, \ - { "direction_z", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_mag_cal_progress_t, direction_z) }, \ - } \ -} -#endif - -/** - * @brief Pack a mag_cal_progress message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param compass_id Compass being calibrated. - * @param cal_mask Bitmask of compasses being calibrated. - * @param cal_status Calibration Status. - * @param attempt Attempt number. - * @param completion_pct [%] Completion percentage. - * @param completion_mask Bitmask of sphere sections (see http://en.wikipedia.org/wiki/Geodesic_grid). - * @param direction_x Body frame direction vector for display. - * @param direction_y Body frame direction vector for display. - * @param direction_z Body frame direction vector for display. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_mag_cal_progress_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t compass_id, uint8_t cal_mask, uint8_t cal_status, uint8_t attempt, uint8_t completion_pct, const uint8_t *completion_mask, float direction_x, float direction_y, float direction_z) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN]; - _mav_put_float(buf, 0, direction_x); - _mav_put_float(buf, 4, direction_y); - _mav_put_float(buf, 8, direction_z); - _mav_put_uint8_t(buf, 12, compass_id); - _mav_put_uint8_t(buf, 13, cal_mask); - _mav_put_uint8_t(buf, 14, cal_status); - _mav_put_uint8_t(buf, 15, attempt); - _mav_put_uint8_t(buf, 16, completion_pct); - _mav_put_uint8_t_array(buf, 17, completion_mask, 10); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN); -#else - mavlink_mag_cal_progress_t packet; - packet.direction_x = direction_x; - packet.direction_y = direction_y; - packet.direction_z = direction_z; - packet.compass_id = compass_id; - packet.cal_mask = cal_mask; - packet.cal_status = cal_status; - packet.attempt = attempt; - packet.completion_pct = completion_pct; - mav_array_memcpy(packet.completion_mask, completion_mask, sizeof(uint8_t)*10); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_MAG_CAL_PROGRESS; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_MIN_LEN, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_CRC); -} - -/** - * @brief Pack a mag_cal_progress message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param compass_id Compass being calibrated. - * @param cal_mask Bitmask of compasses being calibrated. - * @param cal_status Calibration Status. - * @param attempt Attempt number. - * @param completion_pct [%] Completion percentage. - * @param completion_mask Bitmask of sphere sections (see http://en.wikipedia.org/wiki/Geodesic_grid). - * @param direction_x Body frame direction vector for display. - * @param direction_y Body frame direction vector for display. - * @param direction_z Body frame direction vector for display. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_mag_cal_progress_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t compass_id,uint8_t cal_mask,uint8_t cal_status,uint8_t attempt,uint8_t completion_pct,const uint8_t *completion_mask,float direction_x,float direction_y,float direction_z) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN]; - _mav_put_float(buf, 0, direction_x); - _mav_put_float(buf, 4, direction_y); - _mav_put_float(buf, 8, direction_z); - _mav_put_uint8_t(buf, 12, compass_id); - _mav_put_uint8_t(buf, 13, cal_mask); - _mav_put_uint8_t(buf, 14, cal_status); - _mav_put_uint8_t(buf, 15, attempt); - _mav_put_uint8_t(buf, 16, completion_pct); - _mav_put_uint8_t_array(buf, 17, completion_mask, 10); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN); -#else - mavlink_mag_cal_progress_t packet; - packet.direction_x = direction_x; - packet.direction_y = direction_y; - packet.direction_z = direction_z; - packet.compass_id = compass_id; - packet.cal_mask = cal_mask; - packet.cal_status = cal_status; - packet.attempt = attempt; - packet.completion_pct = completion_pct; - mav_array_memcpy(packet.completion_mask, completion_mask, sizeof(uint8_t)*10); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_MAG_CAL_PROGRESS; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_MIN_LEN, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_CRC); -} - -/** - * @brief Encode a mag_cal_progress struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param mag_cal_progress C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_mag_cal_progress_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_mag_cal_progress_t* mag_cal_progress) -{ - return mavlink_msg_mag_cal_progress_pack(system_id, component_id, msg, mag_cal_progress->compass_id, mag_cal_progress->cal_mask, mag_cal_progress->cal_status, mag_cal_progress->attempt, mag_cal_progress->completion_pct, mag_cal_progress->completion_mask, mag_cal_progress->direction_x, mag_cal_progress->direction_y, mag_cal_progress->direction_z); -} - -/** - * @brief Encode a mag_cal_progress struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param mag_cal_progress C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_mag_cal_progress_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_mag_cal_progress_t* mag_cal_progress) -{ - return mavlink_msg_mag_cal_progress_pack_chan(system_id, component_id, chan, msg, mag_cal_progress->compass_id, mag_cal_progress->cal_mask, mag_cal_progress->cal_status, mag_cal_progress->attempt, mag_cal_progress->completion_pct, mag_cal_progress->completion_mask, mag_cal_progress->direction_x, mag_cal_progress->direction_y, mag_cal_progress->direction_z); -} - -/** - * @brief Send a mag_cal_progress message - * @param chan MAVLink channel to send the message - * - * @param compass_id Compass being calibrated. - * @param cal_mask Bitmask of compasses being calibrated. - * @param cal_status Calibration Status. - * @param attempt Attempt number. - * @param completion_pct [%] Completion percentage. - * @param completion_mask Bitmask of sphere sections (see http://en.wikipedia.org/wiki/Geodesic_grid). - * @param direction_x Body frame direction vector for display. - * @param direction_y Body frame direction vector for display. - * @param direction_z Body frame direction vector for display. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_mag_cal_progress_send(mavlink_channel_t chan, uint8_t compass_id, uint8_t cal_mask, uint8_t cal_status, uint8_t attempt, uint8_t completion_pct, const uint8_t *completion_mask, float direction_x, float direction_y, float direction_z) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN]; - _mav_put_float(buf, 0, direction_x); - _mav_put_float(buf, 4, direction_y); - _mav_put_float(buf, 8, direction_z); - _mav_put_uint8_t(buf, 12, compass_id); - _mav_put_uint8_t(buf, 13, cal_mask); - _mav_put_uint8_t(buf, 14, cal_status); - _mav_put_uint8_t(buf, 15, attempt); - _mav_put_uint8_t(buf, 16, completion_pct); - _mav_put_uint8_t_array(buf, 17, completion_mask, 10); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MAG_CAL_PROGRESS, buf, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_MIN_LEN, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_CRC); -#else - mavlink_mag_cal_progress_t packet; - packet.direction_x = direction_x; - packet.direction_y = direction_y; - packet.direction_z = direction_z; - packet.compass_id = compass_id; - packet.cal_mask = cal_mask; - packet.cal_status = cal_status; - packet.attempt = attempt; - packet.completion_pct = completion_pct; - mav_array_memcpy(packet.completion_mask, completion_mask, sizeof(uint8_t)*10); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MAG_CAL_PROGRESS, (const char *)&packet, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_MIN_LEN, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_CRC); -#endif -} - -/** - * @brief Send a mag_cal_progress message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_mag_cal_progress_send_struct(mavlink_channel_t chan, const mavlink_mag_cal_progress_t* mag_cal_progress) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_mag_cal_progress_send(chan, mag_cal_progress->compass_id, mag_cal_progress->cal_mask, mag_cal_progress->cal_status, mag_cal_progress->attempt, mag_cal_progress->completion_pct, mag_cal_progress->completion_mask, mag_cal_progress->direction_x, mag_cal_progress->direction_y, mag_cal_progress->direction_z); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MAG_CAL_PROGRESS, (const char *)mag_cal_progress, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_MIN_LEN, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_CRC); -#endif -} - -#if MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_mag_cal_progress_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t compass_id, uint8_t cal_mask, uint8_t cal_status, uint8_t attempt, uint8_t completion_pct, const uint8_t *completion_mask, float direction_x, float direction_y, float direction_z) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_float(buf, 0, direction_x); - _mav_put_float(buf, 4, direction_y); - _mav_put_float(buf, 8, direction_z); - _mav_put_uint8_t(buf, 12, compass_id); - _mav_put_uint8_t(buf, 13, cal_mask); - _mav_put_uint8_t(buf, 14, cal_status); - _mav_put_uint8_t(buf, 15, attempt); - _mav_put_uint8_t(buf, 16, completion_pct); - _mav_put_uint8_t_array(buf, 17, completion_mask, 10); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MAG_CAL_PROGRESS, buf, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_MIN_LEN, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_CRC); -#else - mavlink_mag_cal_progress_t *packet = (mavlink_mag_cal_progress_t *)msgbuf; - packet->direction_x = direction_x; - packet->direction_y = direction_y; - packet->direction_z = direction_z; - packet->compass_id = compass_id; - packet->cal_mask = cal_mask; - packet->cal_status = cal_status; - packet->attempt = attempt; - packet->completion_pct = completion_pct; - mav_array_memcpy(packet->completion_mask, completion_mask, sizeof(uint8_t)*10); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MAG_CAL_PROGRESS, (const char *)packet, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_MIN_LEN, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_CRC); -#endif -} -#endif - -#endif - -// MESSAGE MAG_CAL_PROGRESS UNPACKING - - -/** - * @brief Get field compass_id from mag_cal_progress message - * - * @return Compass being calibrated. - */ -static inline uint8_t mavlink_msg_mag_cal_progress_get_compass_id(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 12); -} - -/** - * @brief Get field cal_mask from mag_cal_progress message - * - * @return Bitmask of compasses being calibrated. - */ -static inline uint8_t mavlink_msg_mag_cal_progress_get_cal_mask(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 13); -} - -/** - * @brief Get field cal_status from mag_cal_progress message - * - * @return Calibration Status. - */ -static inline uint8_t mavlink_msg_mag_cal_progress_get_cal_status(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 14); -} - -/** - * @brief Get field attempt from mag_cal_progress message - * - * @return Attempt number. - */ -static inline uint8_t mavlink_msg_mag_cal_progress_get_attempt(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 15); -} - -/** - * @brief Get field completion_pct from mag_cal_progress message - * - * @return [%] Completion percentage. - */ -static inline uint8_t mavlink_msg_mag_cal_progress_get_completion_pct(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 16); -} - -/** - * @brief Get field completion_mask from mag_cal_progress message - * - * @return Bitmask of sphere sections (see http://en.wikipedia.org/wiki/Geodesic_grid). - */ -static inline uint16_t mavlink_msg_mag_cal_progress_get_completion_mask(const mavlink_message_t* msg, uint8_t *completion_mask) -{ - return _MAV_RETURN_uint8_t_array(msg, completion_mask, 10, 17); -} - -/** - * @brief Get field direction_x from mag_cal_progress message - * - * @return Body frame direction vector for display. - */ -static inline float mavlink_msg_mag_cal_progress_get_direction_x(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 0); -} - -/** - * @brief Get field direction_y from mag_cal_progress message - * - * @return Body frame direction vector for display. - */ -static inline float mavlink_msg_mag_cal_progress_get_direction_y(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 4); -} - -/** - * @brief Get field direction_z from mag_cal_progress message - * - * @return Body frame direction vector for display. - */ -static inline float mavlink_msg_mag_cal_progress_get_direction_z(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Decode a mag_cal_progress message into a struct - * - * @param msg The message to decode - * @param mag_cal_progress C-struct to decode the message contents into - */ -static inline void mavlink_msg_mag_cal_progress_decode(const mavlink_message_t* msg, mavlink_mag_cal_progress_t* mag_cal_progress) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mag_cal_progress->direction_x = mavlink_msg_mag_cal_progress_get_direction_x(msg); - mag_cal_progress->direction_y = mavlink_msg_mag_cal_progress_get_direction_y(msg); - mag_cal_progress->direction_z = mavlink_msg_mag_cal_progress_get_direction_z(msg); - mag_cal_progress->compass_id = mavlink_msg_mag_cal_progress_get_compass_id(msg); - mag_cal_progress->cal_mask = mavlink_msg_mag_cal_progress_get_cal_mask(msg); - mag_cal_progress->cal_status = mavlink_msg_mag_cal_progress_get_cal_status(msg); - mag_cal_progress->attempt = mavlink_msg_mag_cal_progress_get_attempt(msg); - mag_cal_progress->completion_pct = mavlink_msg_mag_cal_progress_get_completion_pct(msg); - mavlink_msg_mag_cal_progress_get_completion_mask(msg, mag_cal_progress->completion_mask); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN? msg->len : MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN; - memset(mag_cal_progress, 0, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN); - memcpy(mag_cal_progress, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_meminfo.h b/ardupilotmega/mavlink_msg_meminfo.h deleted file mode 100644 index 05e08f60d..000000000 --- a/ardupilotmega/mavlink_msg_meminfo.h +++ /dev/null @@ -1,263 +0,0 @@ -#pragma once -// MESSAGE MEMINFO PACKING - -#define MAVLINK_MSG_ID_MEMINFO 152 - - -typedef struct __mavlink_meminfo_t { - uint16_t brkval; /*< Heap top.*/ - uint16_t freemem; /*< [bytes] Free memory.*/ - uint32_t freemem32; /*< [bytes] Free memory (32 bit).*/ -} mavlink_meminfo_t; - -#define MAVLINK_MSG_ID_MEMINFO_LEN 8 -#define MAVLINK_MSG_ID_MEMINFO_MIN_LEN 4 -#define MAVLINK_MSG_ID_152_LEN 8 -#define MAVLINK_MSG_ID_152_MIN_LEN 4 - -#define MAVLINK_MSG_ID_MEMINFO_CRC 208 -#define MAVLINK_MSG_ID_152_CRC 208 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_MEMINFO { \ - 152, \ - "MEMINFO", \ - 3, \ - { { "brkval", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_meminfo_t, brkval) }, \ - { "freemem", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_meminfo_t, freemem) }, \ - { "freemem32", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_meminfo_t, freemem32) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_MEMINFO { \ - "MEMINFO", \ - 3, \ - { { "brkval", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_meminfo_t, brkval) }, \ - { "freemem", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_meminfo_t, freemem) }, \ - { "freemem32", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_meminfo_t, freemem32) }, \ - } \ -} -#endif - -/** - * @brief Pack a meminfo message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param brkval Heap top. - * @param freemem [bytes] Free memory. - * @param freemem32 [bytes] Free memory (32 bit). - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_meminfo_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint16_t brkval, uint16_t freemem, uint32_t freemem32) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_MEMINFO_LEN]; - _mav_put_uint16_t(buf, 0, brkval); - _mav_put_uint16_t(buf, 2, freemem); - _mav_put_uint32_t(buf, 4, freemem32); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MEMINFO_LEN); -#else - mavlink_meminfo_t packet; - packet.brkval = brkval; - packet.freemem = freemem; - packet.freemem32 = freemem32; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MEMINFO_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_MEMINFO; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MEMINFO_MIN_LEN, MAVLINK_MSG_ID_MEMINFO_LEN, MAVLINK_MSG_ID_MEMINFO_CRC); -} - -/** - * @brief Pack a meminfo message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param brkval Heap top. - * @param freemem [bytes] Free memory. - * @param freemem32 [bytes] Free memory (32 bit). - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_meminfo_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint16_t brkval,uint16_t freemem,uint32_t freemem32) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_MEMINFO_LEN]; - _mav_put_uint16_t(buf, 0, brkval); - _mav_put_uint16_t(buf, 2, freemem); - _mav_put_uint32_t(buf, 4, freemem32); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MEMINFO_LEN); -#else - mavlink_meminfo_t packet; - packet.brkval = brkval; - packet.freemem = freemem; - packet.freemem32 = freemem32; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MEMINFO_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_MEMINFO; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_MEMINFO_MIN_LEN, MAVLINK_MSG_ID_MEMINFO_LEN, MAVLINK_MSG_ID_MEMINFO_CRC); -} - -/** - * @brief Encode a meminfo struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param meminfo C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_meminfo_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_meminfo_t* meminfo) -{ - return mavlink_msg_meminfo_pack(system_id, component_id, msg, meminfo->brkval, meminfo->freemem, meminfo->freemem32); -} - -/** - * @brief Encode a meminfo struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param meminfo C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_meminfo_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_meminfo_t* meminfo) -{ - return mavlink_msg_meminfo_pack_chan(system_id, component_id, chan, msg, meminfo->brkval, meminfo->freemem, meminfo->freemem32); -} - -/** - * @brief Send a meminfo message - * @param chan MAVLink channel to send the message - * - * @param brkval Heap top. - * @param freemem [bytes] Free memory. - * @param freemem32 [bytes] Free memory (32 bit). - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_meminfo_send(mavlink_channel_t chan, uint16_t brkval, uint16_t freemem, uint32_t freemem32) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_MEMINFO_LEN]; - _mav_put_uint16_t(buf, 0, brkval); - _mav_put_uint16_t(buf, 2, freemem); - _mav_put_uint32_t(buf, 4, freemem32); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MEMINFO, buf, MAVLINK_MSG_ID_MEMINFO_MIN_LEN, MAVLINK_MSG_ID_MEMINFO_LEN, MAVLINK_MSG_ID_MEMINFO_CRC); -#else - mavlink_meminfo_t packet; - packet.brkval = brkval; - packet.freemem = freemem; - packet.freemem32 = freemem32; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MEMINFO, (const char *)&packet, MAVLINK_MSG_ID_MEMINFO_MIN_LEN, MAVLINK_MSG_ID_MEMINFO_LEN, MAVLINK_MSG_ID_MEMINFO_CRC); -#endif -} - -/** - * @brief Send a meminfo message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_meminfo_send_struct(mavlink_channel_t chan, const mavlink_meminfo_t* meminfo) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_meminfo_send(chan, meminfo->brkval, meminfo->freemem, meminfo->freemem32); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MEMINFO, (const char *)meminfo, MAVLINK_MSG_ID_MEMINFO_MIN_LEN, MAVLINK_MSG_ID_MEMINFO_LEN, MAVLINK_MSG_ID_MEMINFO_CRC); -#endif -} - -#if MAVLINK_MSG_ID_MEMINFO_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_meminfo_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint16_t brkval, uint16_t freemem, uint32_t freemem32) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint16_t(buf, 0, brkval); - _mav_put_uint16_t(buf, 2, freemem); - _mav_put_uint32_t(buf, 4, freemem32); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MEMINFO, buf, MAVLINK_MSG_ID_MEMINFO_MIN_LEN, MAVLINK_MSG_ID_MEMINFO_LEN, MAVLINK_MSG_ID_MEMINFO_CRC); -#else - mavlink_meminfo_t *packet = (mavlink_meminfo_t *)msgbuf; - packet->brkval = brkval; - packet->freemem = freemem; - packet->freemem32 = freemem32; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MEMINFO, (const char *)packet, MAVLINK_MSG_ID_MEMINFO_MIN_LEN, MAVLINK_MSG_ID_MEMINFO_LEN, MAVLINK_MSG_ID_MEMINFO_CRC); -#endif -} -#endif - -#endif - -// MESSAGE MEMINFO UNPACKING - - -/** - * @brief Get field brkval from meminfo message - * - * @return Heap top. - */ -static inline uint16_t mavlink_msg_meminfo_get_brkval(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 0); -} - -/** - * @brief Get field freemem from meminfo message - * - * @return [bytes] Free memory. - */ -static inline uint16_t mavlink_msg_meminfo_get_freemem(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 2); -} - -/** - * @brief Get field freemem32 from meminfo message - * - * @return [bytes] Free memory (32 bit). - */ -static inline uint32_t mavlink_msg_meminfo_get_freemem32(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 4); -} - -/** - * @brief Decode a meminfo message into a struct - * - * @param msg The message to decode - * @param meminfo C-struct to decode the message contents into - */ -static inline void mavlink_msg_meminfo_decode(const mavlink_message_t* msg, mavlink_meminfo_t* meminfo) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - meminfo->brkval = mavlink_msg_meminfo_get_brkval(msg); - meminfo->freemem = mavlink_msg_meminfo_get_freemem(msg); - meminfo->freemem32 = mavlink_msg_meminfo_get_freemem32(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_MEMINFO_LEN? msg->len : MAVLINK_MSG_ID_MEMINFO_LEN; - memset(meminfo, 0, MAVLINK_MSG_ID_MEMINFO_LEN); - memcpy(meminfo, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_mount_configure.h b/ardupilotmega/mavlink_msg_mount_configure.h deleted file mode 100644 index 941a8d34c..000000000 --- a/ardupilotmega/mavlink_msg_mount_configure.h +++ /dev/null @@ -1,338 +0,0 @@ -#pragma once -// MESSAGE MOUNT_CONFIGURE PACKING - -#define MAVLINK_MSG_ID_MOUNT_CONFIGURE 156 - - -typedef struct __mavlink_mount_configure_t { - uint8_t target_system; /*< System ID.*/ - uint8_t target_component; /*< Component ID.*/ - uint8_t mount_mode; /*< Mount operating mode.*/ - uint8_t stab_roll; /*< (1 = yes, 0 = no).*/ - uint8_t stab_pitch; /*< (1 = yes, 0 = no).*/ - uint8_t stab_yaw; /*< (1 = yes, 0 = no).*/ -} mavlink_mount_configure_t; - -#define MAVLINK_MSG_ID_MOUNT_CONFIGURE_LEN 6 -#define MAVLINK_MSG_ID_MOUNT_CONFIGURE_MIN_LEN 6 -#define MAVLINK_MSG_ID_156_LEN 6 -#define MAVLINK_MSG_ID_156_MIN_LEN 6 - -#define MAVLINK_MSG_ID_MOUNT_CONFIGURE_CRC 19 -#define MAVLINK_MSG_ID_156_CRC 19 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_MOUNT_CONFIGURE { \ - 156, \ - "MOUNT_CONFIGURE", \ - 6, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_mount_configure_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_mount_configure_t, target_component) }, \ - { "mount_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_mount_configure_t, mount_mode) }, \ - { "stab_roll", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_mount_configure_t, stab_roll) }, \ - { "stab_pitch", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_mount_configure_t, stab_pitch) }, \ - { "stab_yaw", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_mount_configure_t, stab_yaw) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_MOUNT_CONFIGURE { \ - "MOUNT_CONFIGURE", \ - 6, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_mount_configure_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_mount_configure_t, target_component) }, \ - { "mount_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_mount_configure_t, mount_mode) }, \ - { "stab_roll", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_mount_configure_t, stab_roll) }, \ - { "stab_pitch", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_mount_configure_t, stab_pitch) }, \ - { "stab_yaw", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_mount_configure_t, stab_yaw) }, \ - } \ -} -#endif - -/** - * @brief Pack a mount_configure message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param target_system System ID. - * @param target_component Component ID. - * @param mount_mode Mount operating mode. - * @param stab_roll (1 = yes, 0 = no). - * @param stab_pitch (1 = yes, 0 = no). - * @param stab_yaw (1 = yes, 0 = no). - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_mount_configure_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, uint8_t mount_mode, uint8_t stab_roll, uint8_t stab_pitch, uint8_t stab_yaw) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_MOUNT_CONFIGURE_LEN]; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, mount_mode); - _mav_put_uint8_t(buf, 3, stab_roll); - _mav_put_uint8_t(buf, 4, stab_pitch); - _mav_put_uint8_t(buf, 5, stab_yaw); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MOUNT_CONFIGURE_LEN); -#else - mavlink_mount_configure_t packet; - packet.target_system = target_system; - packet.target_component = target_component; - packet.mount_mode = mount_mode; - packet.stab_roll = stab_roll; - packet.stab_pitch = stab_pitch; - packet.stab_yaw = stab_yaw; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MOUNT_CONFIGURE_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_MOUNT_CONFIGURE; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MOUNT_CONFIGURE_MIN_LEN, MAVLINK_MSG_ID_MOUNT_CONFIGURE_LEN, MAVLINK_MSG_ID_MOUNT_CONFIGURE_CRC); -} - -/** - * @brief Pack a mount_configure message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param target_system System ID. - * @param target_component Component ID. - * @param mount_mode Mount operating mode. - * @param stab_roll (1 = yes, 0 = no). - * @param stab_pitch (1 = yes, 0 = no). - * @param stab_yaw (1 = yes, 0 = no). - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_mount_configure_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,uint8_t mount_mode,uint8_t stab_roll,uint8_t stab_pitch,uint8_t stab_yaw) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_MOUNT_CONFIGURE_LEN]; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, mount_mode); - _mav_put_uint8_t(buf, 3, stab_roll); - _mav_put_uint8_t(buf, 4, stab_pitch); - _mav_put_uint8_t(buf, 5, stab_yaw); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MOUNT_CONFIGURE_LEN); -#else - mavlink_mount_configure_t packet; - packet.target_system = target_system; - packet.target_component = target_component; - packet.mount_mode = mount_mode; - packet.stab_roll = stab_roll; - packet.stab_pitch = stab_pitch; - packet.stab_yaw = stab_yaw; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MOUNT_CONFIGURE_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_MOUNT_CONFIGURE; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_MOUNT_CONFIGURE_MIN_LEN, MAVLINK_MSG_ID_MOUNT_CONFIGURE_LEN, MAVLINK_MSG_ID_MOUNT_CONFIGURE_CRC); -} - -/** - * @brief Encode a mount_configure struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param mount_configure C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_mount_configure_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_mount_configure_t* mount_configure) -{ - return mavlink_msg_mount_configure_pack(system_id, component_id, msg, mount_configure->target_system, mount_configure->target_component, mount_configure->mount_mode, mount_configure->stab_roll, mount_configure->stab_pitch, mount_configure->stab_yaw); -} - -/** - * @brief Encode a mount_configure struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param mount_configure C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_mount_configure_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_mount_configure_t* mount_configure) -{ - return mavlink_msg_mount_configure_pack_chan(system_id, component_id, chan, msg, mount_configure->target_system, mount_configure->target_component, mount_configure->mount_mode, mount_configure->stab_roll, mount_configure->stab_pitch, mount_configure->stab_yaw); -} - -/** - * @brief Send a mount_configure message - * @param chan MAVLink channel to send the message - * - * @param target_system System ID. - * @param target_component Component ID. - * @param mount_mode Mount operating mode. - * @param stab_roll (1 = yes, 0 = no). - * @param stab_pitch (1 = yes, 0 = no). - * @param stab_yaw (1 = yes, 0 = no). - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_mount_configure_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t mount_mode, uint8_t stab_roll, uint8_t stab_pitch, uint8_t stab_yaw) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_MOUNT_CONFIGURE_LEN]; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, mount_mode); - _mav_put_uint8_t(buf, 3, stab_roll); - _mav_put_uint8_t(buf, 4, stab_pitch); - _mav_put_uint8_t(buf, 5, stab_yaw); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONFIGURE, buf, MAVLINK_MSG_ID_MOUNT_CONFIGURE_MIN_LEN, MAVLINK_MSG_ID_MOUNT_CONFIGURE_LEN, MAVLINK_MSG_ID_MOUNT_CONFIGURE_CRC); -#else - mavlink_mount_configure_t packet; - packet.target_system = target_system; - packet.target_component = target_component; - packet.mount_mode = mount_mode; - packet.stab_roll = stab_roll; - packet.stab_pitch = stab_pitch; - packet.stab_yaw = stab_yaw; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONFIGURE, (const char *)&packet, MAVLINK_MSG_ID_MOUNT_CONFIGURE_MIN_LEN, MAVLINK_MSG_ID_MOUNT_CONFIGURE_LEN, MAVLINK_MSG_ID_MOUNT_CONFIGURE_CRC); -#endif -} - -/** - * @brief Send a mount_configure message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_mount_configure_send_struct(mavlink_channel_t chan, const mavlink_mount_configure_t* mount_configure) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_mount_configure_send(chan, mount_configure->target_system, mount_configure->target_component, mount_configure->mount_mode, mount_configure->stab_roll, mount_configure->stab_pitch, mount_configure->stab_yaw); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONFIGURE, (const char *)mount_configure, MAVLINK_MSG_ID_MOUNT_CONFIGURE_MIN_LEN, MAVLINK_MSG_ID_MOUNT_CONFIGURE_LEN, MAVLINK_MSG_ID_MOUNT_CONFIGURE_CRC); -#endif -} - -#if MAVLINK_MSG_ID_MOUNT_CONFIGURE_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_mount_configure_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t mount_mode, uint8_t stab_roll, uint8_t stab_pitch, uint8_t stab_yaw) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, mount_mode); - _mav_put_uint8_t(buf, 3, stab_roll); - _mav_put_uint8_t(buf, 4, stab_pitch); - _mav_put_uint8_t(buf, 5, stab_yaw); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONFIGURE, buf, MAVLINK_MSG_ID_MOUNT_CONFIGURE_MIN_LEN, MAVLINK_MSG_ID_MOUNT_CONFIGURE_LEN, MAVLINK_MSG_ID_MOUNT_CONFIGURE_CRC); -#else - mavlink_mount_configure_t *packet = (mavlink_mount_configure_t *)msgbuf; - packet->target_system = target_system; - packet->target_component = target_component; - packet->mount_mode = mount_mode; - packet->stab_roll = stab_roll; - packet->stab_pitch = stab_pitch; - packet->stab_yaw = stab_yaw; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONFIGURE, (const char *)packet, MAVLINK_MSG_ID_MOUNT_CONFIGURE_MIN_LEN, MAVLINK_MSG_ID_MOUNT_CONFIGURE_LEN, MAVLINK_MSG_ID_MOUNT_CONFIGURE_CRC); -#endif -} -#endif - -#endif - -// MESSAGE MOUNT_CONFIGURE UNPACKING - - -/** - * @brief Get field target_system from mount_configure message - * - * @return System ID. - */ -static inline uint8_t mavlink_msg_mount_configure_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 0); -} - -/** - * @brief Get field target_component from mount_configure message - * - * @return Component ID. - */ -static inline uint8_t mavlink_msg_mount_configure_get_target_component(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 1); -} - -/** - * @brief Get field mount_mode from mount_configure message - * - * @return Mount operating mode. - */ -static inline uint8_t mavlink_msg_mount_configure_get_mount_mode(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 2); -} - -/** - * @brief Get field stab_roll from mount_configure message - * - * @return (1 = yes, 0 = no). - */ -static inline uint8_t mavlink_msg_mount_configure_get_stab_roll(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 3); -} - -/** - * @brief Get field stab_pitch from mount_configure message - * - * @return (1 = yes, 0 = no). - */ -static inline uint8_t mavlink_msg_mount_configure_get_stab_pitch(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 4); -} - -/** - * @brief Get field stab_yaw from mount_configure message - * - * @return (1 = yes, 0 = no). - */ -static inline uint8_t mavlink_msg_mount_configure_get_stab_yaw(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 5); -} - -/** - * @brief Decode a mount_configure message into a struct - * - * @param msg The message to decode - * @param mount_configure C-struct to decode the message contents into - */ -static inline void mavlink_msg_mount_configure_decode(const mavlink_message_t* msg, mavlink_mount_configure_t* mount_configure) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mount_configure->target_system = mavlink_msg_mount_configure_get_target_system(msg); - mount_configure->target_component = mavlink_msg_mount_configure_get_target_component(msg); - mount_configure->mount_mode = mavlink_msg_mount_configure_get_mount_mode(msg); - mount_configure->stab_roll = mavlink_msg_mount_configure_get_stab_roll(msg); - mount_configure->stab_pitch = mavlink_msg_mount_configure_get_stab_pitch(msg); - mount_configure->stab_yaw = mavlink_msg_mount_configure_get_stab_yaw(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_MOUNT_CONFIGURE_LEN? msg->len : MAVLINK_MSG_ID_MOUNT_CONFIGURE_LEN; - memset(mount_configure, 0, MAVLINK_MSG_ID_MOUNT_CONFIGURE_LEN); - memcpy(mount_configure, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_mount_control.h b/ardupilotmega/mavlink_msg_mount_control.h deleted file mode 100644 index aba4bc2ea..000000000 --- a/ardupilotmega/mavlink_msg_mount_control.h +++ /dev/null @@ -1,338 +0,0 @@ -#pragma once -// MESSAGE MOUNT_CONTROL PACKING - -#define MAVLINK_MSG_ID_MOUNT_CONTROL 157 - - -typedef struct __mavlink_mount_control_t { - int32_t input_a; /*< Pitch (centi-degrees) or lat (degE7), depending on mount mode.*/ - int32_t input_b; /*< Roll (centi-degrees) or lon (degE7) depending on mount mode.*/ - int32_t input_c; /*< Yaw (centi-degrees) or alt (cm) depending on mount mode.*/ - uint8_t target_system; /*< System ID.*/ - uint8_t target_component; /*< Component ID.*/ - uint8_t save_position; /*< If "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING).*/ -} mavlink_mount_control_t; - -#define MAVLINK_MSG_ID_MOUNT_CONTROL_LEN 15 -#define MAVLINK_MSG_ID_MOUNT_CONTROL_MIN_LEN 15 -#define MAVLINK_MSG_ID_157_LEN 15 -#define MAVLINK_MSG_ID_157_MIN_LEN 15 - -#define MAVLINK_MSG_ID_MOUNT_CONTROL_CRC 21 -#define MAVLINK_MSG_ID_157_CRC 21 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_MOUNT_CONTROL { \ - 157, \ - "MOUNT_CONTROL", \ - 6, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_mount_control_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_mount_control_t, target_component) }, \ - { "input_a", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_mount_control_t, input_a) }, \ - { "input_b", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_mount_control_t, input_b) }, \ - { "input_c", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_mount_control_t, input_c) }, \ - { "save_position", NULL, MAVLINK_TYPE_UINT8_T, 0, 14, offsetof(mavlink_mount_control_t, save_position) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_MOUNT_CONTROL { \ - "MOUNT_CONTROL", \ - 6, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_mount_control_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_mount_control_t, target_component) }, \ - { "input_a", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_mount_control_t, input_a) }, \ - { "input_b", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_mount_control_t, input_b) }, \ - { "input_c", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_mount_control_t, input_c) }, \ - { "save_position", NULL, MAVLINK_TYPE_UINT8_T, 0, 14, offsetof(mavlink_mount_control_t, save_position) }, \ - } \ -} -#endif - -/** - * @brief Pack a mount_control message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param target_system System ID. - * @param target_component Component ID. - * @param input_a Pitch (centi-degrees) or lat (degE7), depending on mount mode. - * @param input_b Roll (centi-degrees) or lon (degE7) depending on mount mode. - * @param input_c Yaw (centi-degrees) or alt (cm) depending on mount mode. - * @param save_position If "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING). - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_mount_control_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, int32_t input_a, int32_t input_b, int32_t input_c, uint8_t save_position) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_MOUNT_CONTROL_LEN]; - _mav_put_int32_t(buf, 0, input_a); - _mav_put_int32_t(buf, 4, input_b); - _mav_put_int32_t(buf, 8, input_c); - _mav_put_uint8_t(buf, 12, target_system); - _mav_put_uint8_t(buf, 13, target_component); - _mav_put_uint8_t(buf, 14, save_position); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN); -#else - mavlink_mount_control_t packet; - packet.input_a = input_a; - packet.input_b = input_b; - packet.input_c = input_c; - packet.target_system = target_system; - packet.target_component = target_component; - packet.save_position = save_position; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_MOUNT_CONTROL; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MOUNT_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_CRC); -} - -/** - * @brief Pack a mount_control message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param target_system System ID. - * @param target_component Component ID. - * @param input_a Pitch (centi-degrees) or lat (degE7), depending on mount mode. - * @param input_b Roll (centi-degrees) or lon (degE7) depending on mount mode. - * @param input_c Yaw (centi-degrees) or alt (cm) depending on mount mode. - * @param save_position If "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING). - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_mount_control_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,int32_t input_a,int32_t input_b,int32_t input_c,uint8_t save_position) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_MOUNT_CONTROL_LEN]; - _mav_put_int32_t(buf, 0, input_a); - _mav_put_int32_t(buf, 4, input_b); - _mav_put_int32_t(buf, 8, input_c); - _mav_put_uint8_t(buf, 12, target_system); - _mav_put_uint8_t(buf, 13, target_component); - _mav_put_uint8_t(buf, 14, save_position); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN); -#else - mavlink_mount_control_t packet; - packet.input_a = input_a; - packet.input_b = input_b; - packet.input_c = input_c; - packet.target_system = target_system; - packet.target_component = target_component; - packet.save_position = save_position; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_MOUNT_CONTROL; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_MOUNT_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_CRC); -} - -/** - * @brief Encode a mount_control struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param mount_control C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_mount_control_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_mount_control_t* mount_control) -{ - return mavlink_msg_mount_control_pack(system_id, component_id, msg, mount_control->target_system, mount_control->target_component, mount_control->input_a, mount_control->input_b, mount_control->input_c, mount_control->save_position); -} - -/** - * @brief Encode a mount_control struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param mount_control C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_mount_control_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_mount_control_t* mount_control) -{ - return mavlink_msg_mount_control_pack_chan(system_id, component_id, chan, msg, mount_control->target_system, mount_control->target_component, mount_control->input_a, mount_control->input_b, mount_control->input_c, mount_control->save_position); -} - -/** - * @brief Send a mount_control message - * @param chan MAVLink channel to send the message - * - * @param target_system System ID. - * @param target_component Component ID. - * @param input_a Pitch (centi-degrees) or lat (degE7), depending on mount mode. - * @param input_b Roll (centi-degrees) or lon (degE7) depending on mount mode. - * @param input_c Yaw (centi-degrees) or alt (cm) depending on mount mode. - * @param save_position If "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING). - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_mount_control_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, int32_t input_a, int32_t input_b, int32_t input_c, uint8_t save_position) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_MOUNT_CONTROL_LEN]; - _mav_put_int32_t(buf, 0, input_a); - _mav_put_int32_t(buf, 4, input_b); - _mav_put_int32_t(buf, 8, input_c); - _mav_put_uint8_t(buf, 12, target_system); - _mav_put_uint8_t(buf, 13, target_component); - _mav_put_uint8_t(buf, 14, save_position); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, buf, MAVLINK_MSG_ID_MOUNT_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_CRC); -#else - mavlink_mount_control_t packet; - packet.input_a = input_a; - packet.input_b = input_b; - packet.input_c = input_c; - packet.target_system = target_system; - packet.target_component = target_component; - packet.save_position = save_position; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, (const char *)&packet, MAVLINK_MSG_ID_MOUNT_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_CRC); -#endif -} - -/** - * @brief Send a mount_control message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_mount_control_send_struct(mavlink_channel_t chan, const mavlink_mount_control_t* mount_control) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_mount_control_send(chan, mount_control->target_system, mount_control->target_component, mount_control->input_a, mount_control->input_b, mount_control->input_c, mount_control->save_position); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, (const char *)mount_control, MAVLINK_MSG_ID_MOUNT_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_CRC); -#endif -} - -#if MAVLINK_MSG_ID_MOUNT_CONTROL_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_mount_control_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, int32_t input_a, int32_t input_b, int32_t input_c, uint8_t save_position) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_int32_t(buf, 0, input_a); - _mav_put_int32_t(buf, 4, input_b); - _mav_put_int32_t(buf, 8, input_c); - _mav_put_uint8_t(buf, 12, target_system); - _mav_put_uint8_t(buf, 13, target_component); - _mav_put_uint8_t(buf, 14, save_position); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, buf, MAVLINK_MSG_ID_MOUNT_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_CRC); -#else - mavlink_mount_control_t *packet = (mavlink_mount_control_t *)msgbuf; - packet->input_a = input_a; - packet->input_b = input_b; - packet->input_c = input_c; - packet->target_system = target_system; - packet->target_component = target_component; - packet->save_position = save_position; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, (const char *)packet, MAVLINK_MSG_ID_MOUNT_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_CRC); -#endif -} -#endif - -#endif - -// MESSAGE MOUNT_CONTROL UNPACKING - - -/** - * @brief Get field target_system from mount_control message - * - * @return System ID. - */ -static inline uint8_t mavlink_msg_mount_control_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 12); -} - -/** - * @brief Get field target_component from mount_control message - * - * @return Component ID. - */ -static inline uint8_t mavlink_msg_mount_control_get_target_component(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 13); -} - -/** - * @brief Get field input_a from mount_control message - * - * @return Pitch (centi-degrees) or lat (degE7), depending on mount mode. - */ -static inline int32_t mavlink_msg_mount_control_get_input_a(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 0); -} - -/** - * @brief Get field input_b from mount_control message - * - * @return Roll (centi-degrees) or lon (degE7) depending on mount mode. - */ -static inline int32_t mavlink_msg_mount_control_get_input_b(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 4); -} - -/** - * @brief Get field input_c from mount_control message - * - * @return Yaw (centi-degrees) or alt (cm) depending on mount mode. - */ -static inline int32_t mavlink_msg_mount_control_get_input_c(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 8); -} - -/** - * @brief Get field save_position from mount_control message - * - * @return If "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING). - */ -static inline uint8_t mavlink_msg_mount_control_get_save_position(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 14); -} - -/** - * @brief Decode a mount_control message into a struct - * - * @param msg The message to decode - * @param mount_control C-struct to decode the message contents into - */ -static inline void mavlink_msg_mount_control_decode(const mavlink_message_t* msg, mavlink_mount_control_t* mount_control) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mount_control->input_a = mavlink_msg_mount_control_get_input_a(msg); - mount_control->input_b = mavlink_msg_mount_control_get_input_b(msg); - mount_control->input_c = mavlink_msg_mount_control_get_input_c(msg); - mount_control->target_system = mavlink_msg_mount_control_get_target_system(msg); - mount_control->target_component = mavlink_msg_mount_control_get_target_component(msg); - mount_control->save_position = mavlink_msg_mount_control_get_save_position(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_MOUNT_CONTROL_LEN? msg->len : MAVLINK_MSG_ID_MOUNT_CONTROL_LEN; - memset(mount_control, 0, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN); - memcpy(mount_control, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_mount_status.h b/ardupilotmega/mavlink_msg_mount_status.h deleted file mode 100644 index c5ef87b17..000000000 --- a/ardupilotmega/mavlink_msg_mount_status.h +++ /dev/null @@ -1,313 +0,0 @@ -#pragma once -// MESSAGE MOUNT_STATUS PACKING - -#define MAVLINK_MSG_ID_MOUNT_STATUS 158 - - -typedef struct __mavlink_mount_status_t { - int32_t pointing_a; /*< [cdeg] Pitch.*/ - int32_t pointing_b; /*< [cdeg] Roll.*/ - int32_t pointing_c; /*< [cdeg] Yaw.*/ - uint8_t target_system; /*< System ID.*/ - uint8_t target_component; /*< Component ID.*/ -} mavlink_mount_status_t; - -#define MAVLINK_MSG_ID_MOUNT_STATUS_LEN 14 -#define MAVLINK_MSG_ID_MOUNT_STATUS_MIN_LEN 14 -#define MAVLINK_MSG_ID_158_LEN 14 -#define MAVLINK_MSG_ID_158_MIN_LEN 14 - -#define MAVLINK_MSG_ID_MOUNT_STATUS_CRC 134 -#define MAVLINK_MSG_ID_158_CRC 134 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_MOUNT_STATUS { \ - 158, \ - "MOUNT_STATUS", \ - 5, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_mount_status_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_mount_status_t, target_component) }, \ - { "pointing_a", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_mount_status_t, pointing_a) }, \ - { "pointing_b", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_mount_status_t, pointing_b) }, \ - { "pointing_c", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_mount_status_t, pointing_c) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_MOUNT_STATUS { \ - "MOUNT_STATUS", \ - 5, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_mount_status_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_mount_status_t, target_component) }, \ - { "pointing_a", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_mount_status_t, pointing_a) }, \ - { "pointing_b", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_mount_status_t, pointing_b) }, \ - { "pointing_c", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_mount_status_t, pointing_c) }, \ - } \ -} -#endif - -/** - * @brief Pack a mount_status message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param target_system System ID. - * @param target_component Component ID. - * @param pointing_a [cdeg] Pitch. - * @param pointing_b [cdeg] Roll. - * @param pointing_c [cdeg] Yaw. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_mount_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, int32_t pointing_a, int32_t pointing_b, int32_t pointing_c) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_MOUNT_STATUS_LEN]; - _mav_put_int32_t(buf, 0, pointing_a); - _mav_put_int32_t(buf, 4, pointing_b); - _mav_put_int32_t(buf, 8, pointing_c); - _mav_put_uint8_t(buf, 12, target_system); - _mav_put_uint8_t(buf, 13, target_component); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MOUNT_STATUS_LEN); -#else - mavlink_mount_status_t packet; - packet.pointing_a = pointing_a; - packet.pointing_b = pointing_b; - packet.pointing_c = pointing_c; - packet.target_system = target_system; - packet.target_component = target_component; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MOUNT_STATUS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_MOUNT_STATUS; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MOUNT_STATUS_MIN_LEN, MAVLINK_MSG_ID_MOUNT_STATUS_LEN, MAVLINK_MSG_ID_MOUNT_STATUS_CRC); -} - -/** - * @brief Pack a mount_status message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param target_system System ID. - * @param target_component Component ID. - * @param pointing_a [cdeg] Pitch. - * @param pointing_b [cdeg] Roll. - * @param pointing_c [cdeg] Yaw. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_mount_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,int32_t pointing_a,int32_t pointing_b,int32_t pointing_c) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_MOUNT_STATUS_LEN]; - _mav_put_int32_t(buf, 0, pointing_a); - _mav_put_int32_t(buf, 4, pointing_b); - _mav_put_int32_t(buf, 8, pointing_c); - _mav_put_uint8_t(buf, 12, target_system); - _mav_put_uint8_t(buf, 13, target_component); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MOUNT_STATUS_LEN); -#else - mavlink_mount_status_t packet; - packet.pointing_a = pointing_a; - packet.pointing_b = pointing_b; - packet.pointing_c = pointing_c; - packet.target_system = target_system; - packet.target_component = target_component; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MOUNT_STATUS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_MOUNT_STATUS; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_MOUNT_STATUS_MIN_LEN, MAVLINK_MSG_ID_MOUNT_STATUS_LEN, MAVLINK_MSG_ID_MOUNT_STATUS_CRC); -} - -/** - * @brief Encode a mount_status struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param mount_status C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_mount_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_mount_status_t* mount_status) -{ - return mavlink_msg_mount_status_pack(system_id, component_id, msg, mount_status->target_system, mount_status->target_component, mount_status->pointing_a, mount_status->pointing_b, mount_status->pointing_c); -} - -/** - * @brief Encode a mount_status struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param mount_status C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_mount_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_mount_status_t* mount_status) -{ - return mavlink_msg_mount_status_pack_chan(system_id, component_id, chan, msg, mount_status->target_system, mount_status->target_component, mount_status->pointing_a, mount_status->pointing_b, mount_status->pointing_c); -} - -/** - * @brief Send a mount_status message - * @param chan MAVLink channel to send the message - * - * @param target_system System ID. - * @param target_component Component ID. - * @param pointing_a [cdeg] Pitch. - * @param pointing_b [cdeg] Roll. - * @param pointing_c [cdeg] Yaw. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_mount_status_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, int32_t pointing_a, int32_t pointing_b, int32_t pointing_c) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_MOUNT_STATUS_LEN]; - _mav_put_int32_t(buf, 0, pointing_a); - _mav_put_int32_t(buf, 4, pointing_b); - _mav_put_int32_t(buf, 8, pointing_c); - _mav_put_uint8_t(buf, 12, target_system); - _mav_put_uint8_t(buf, 13, target_component); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_STATUS, buf, MAVLINK_MSG_ID_MOUNT_STATUS_MIN_LEN, MAVLINK_MSG_ID_MOUNT_STATUS_LEN, MAVLINK_MSG_ID_MOUNT_STATUS_CRC); -#else - mavlink_mount_status_t packet; - packet.pointing_a = pointing_a; - packet.pointing_b = pointing_b; - packet.pointing_c = pointing_c; - packet.target_system = target_system; - packet.target_component = target_component; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_STATUS, (const char *)&packet, MAVLINK_MSG_ID_MOUNT_STATUS_MIN_LEN, MAVLINK_MSG_ID_MOUNT_STATUS_LEN, MAVLINK_MSG_ID_MOUNT_STATUS_CRC); -#endif -} - -/** - * @brief Send a mount_status message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_mount_status_send_struct(mavlink_channel_t chan, const mavlink_mount_status_t* mount_status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_mount_status_send(chan, mount_status->target_system, mount_status->target_component, mount_status->pointing_a, mount_status->pointing_b, mount_status->pointing_c); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_STATUS, (const char *)mount_status, MAVLINK_MSG_ID_MOUNT_STATUS_MIN_LEN, MAVLINK_MSG_ID_MOUNT_STATUS_LEN, MAVLINK_MSG_ID_MOUNT_STATUS_CRC); -#endif -} - -#if MAVLINK_MSG_ID_MOUNT_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_mount_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, int32_t pointing_a, int32_t pointing_b, int32_t pointing_c) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_int32_t(buf, 0, pointing_a); - _mav_put_int32_t(buf, 4, pointing_b); - _mav_put_int32_t(buf, 8, pointing_c); - _mav_put_uint8_t(buf, 12, target_system); - _mav_put_uint8_t(buf, 13, target_component); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_STATUS, buf, MAVLINK_MSG_ID_MOUNT_STATUS_MIN_LEN, MAVLINK_MSG_ID_MOUNT_STATUS_LEN, MAVLINK_MSG_ID_MOUNT_STATUS_CRC); -#else - mavlink_mount_status_t *packet = (mavlink_mount_status_t *)msgbuf; - packet->pointing_a = pointing_a; - packet->pointing_b = pointing_b; - packet->pointing_c = pointing_c; - packet->target_system = target_system; - packet->target_component = target_component; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_STATUS, (const char *)packet, MAVLINK_MSG_ID_MOUNT_STATUS_MIN_LEN, MAVLINK_MSG_ID_MOUNT_STATUS_LEN, MAVLINK_MSG_ID_MOUNT_STATUS_CRC); -#endif -} -#endif - -#endif - -// MESSAGE MOUNT_STATUS UNPACKING - - -/** - * @brief Get field target_system from mount_status message - * - * @return System ID. - */ -static inline uint8_t mavlink_msg_mount_status_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 12); -} - -/** - * @brief Get field target_component from mount_status message - * - * @return Component ID. - */ -static inline uint8_t mavlink_msg_mount_status_get_target_component(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 13); -} - -/** - * @brief Get field pointing_a from mount_status message - * - * @return [cdeg] Pitch. - */ -static inline int32_t mavlink_msg_mount_status_get_pointing_a(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 0); -} - -/** - * @brief Get field pointing_b from mount_status message - * - * @return [cdeg] Roll. - */ -static inline int32_t mavlink_msg_mount_status_get_pointing_b(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 4); -} - -/** - * @brief Get field pointing_c from mount_status message - * - * @return [cdeg] Yaw. - */ -static inline int32_t mavlink_msg_mount_status_get_pointing_c(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 8); -} - -/** - * @brief Decode a mount_status message into a struct - * - * @param msg The message to decode - * @param mount_status C-struct to decode the message contents into - */ -static inline void mavlink_msg_mount_status_decode(const mavlink_message_t* msg, mavlink_mount_status_t* mount_status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mount_status->pointing_a = mavlink_msg_mount_status_get_pointing_a(msg); - mount_status->pointing_b = mavlink_msg_mount_status_get_pointing_b(msg); - mount_status->pointing_c = mavlink_msg_mount_status_get_pointing_c(msg); - mount_status->target_system = mavlink_msg_mount_status_get_target_system(msg); - mount_status->target_component = mavlink_msg_mount_status_get_target_component(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_MOUNT_STATUS_LEN? msg->len : MAVLINK_MSG_ID_MOUNT_STATUS_LEN; - memset(mount_status, 0, MAVLINK_MSG_ID_MOUNT_STATUS_LEN); - memcpy(mount_status, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_obstacle_distance_3d.h b/ardupilotmega/mavlink_msg_obstacle_distance_3d.h deleted file mode 100644 index ee06d7e56..000000000 --- a/ardupilotmega/mavlink_msg_obstacle_distance_3d.h +++ /dev/null @@ -1,413 +0,0 @@ -#pragma once -// MESSAGE OBSTACLE_DISTANCE_3D PACKING - -#define MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D 11037 - - -typedef struct __mavlink_obstacle_distance_3d_t { - uint32_t time_boot_ms; /*< [ms] Timestamp (time since system boot).*/ - float x; /*< [m] X position of the obstacle.*/ - float y; /*< [m] Y position of the obstacle.*/ - float z; /*< [m] Z position of the obstacle.*/ - float min_distance; /*< [m] Minimum distance the sensor can measure.*/ - float max_distance; /*< [m] Maximum distance the sensor can measure.*/ - uint16_t obstacle_id; /*< Unique ID given to each obstacle so that its movement can be tracked. Use UINT16_MAX if object ID is unknown or cannot be determined.*/ - uint8_t sensor_type; /*< Class id of the distance sensor type.*/ - uint8_t frame; /*< Coordinate frame of reference.*/ -} mavlink_obstacle_distance_3d_t; - -#define MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_LEN 28 -#define MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_MIN_LEN 28 -#define MAVLINK_MSG_ID_11037_LEN 28 -#define MAVLINK_MSG_ID_11037_MIN_LEN 28 - -#define MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_CRC 130 -#define MAVLINK_MSG_ID_11037_CRC 130 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_OBSTACLE_DISTANCE_3D { \ - 11037, \ - "OBSTACLE_DISTANCE_3D", \ - 9, \ - { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_obstacle_distance_3d_t, time_boot_ms) }, \ - { "sensor_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_obstacle_distance_3d_t, sensor_type) }, \ - { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 27, offsetof(mavlink_obstacle_distance_3d_t, frame) }, \ - { "obstacle_id", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_obstacle_distance_3d_t, obstacle_id) }, \ - { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_obstacle_distance_3d_t, x) }, \ - { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_obstacle_distance_3d_t, y) }, \ - { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_obstacle_distance_3d_t, z) }, \ - { "min_distance", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_obstacle_distance_3d_t, min_distance) }, \ - { "max_distance", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_obstacle_distance_3d_t, max_distance) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_OBSTACLE_DISTANCE_3D { \ - "OBSTACLE_DISTANCE_3D", \ - 9, \ - { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_obstacle_distance_3d_t, time_boot_ms) }, \ - { "sensor_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_obstacle_distance_3d_t, sensor_type) }, \ - { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 27, offsetof(mavlink_obstacle_distance_3d_t, frame) }, \ - { "obstacle_id", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_obstacle_distance_3d_t, obstacle_id) }, \ - { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_obstacle_distance_3d_t, x) }, \ - { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_obstacle_distance_3d_t, y) }, \ - { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_obstacle_distance_3d_t, z) }, \ - { "min_distance", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_obstacle_distance_3d_t, min_distance) }, \ - { "max_distance", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_obstacle_distance_3d_t, max_distance) }, \ - } \ -} -#endif - -/** - * @brief Pack a obstacle_distance_3d message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param time_boot_ms [ms] Timestamp (time since system boot). - * @param sensor_type Class id of the distance sensor type. - * @param frame Coordinate frame of reference. - * @param obstacle_id Unique ID given to each obstacle so that its movement can be tracked. Use UINT16_MAX if object ID is unknown or cannot be determined. - * @param x [m] X position of the obstacle. - * @param y [m] Y position of the obstacle. - * @param z [m] Z position of the obstacle. - * @param min_distance [m] Minimum distance the sensor can measure. - * @param max_distance [m] Maximum distance the sensor can measure. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_obstacle_distance_3d_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint32_t time_boot_ms, uint8_t sensor_type, uint8_t frame, uint16_t obstacle_id, float x, float y, float z, float min_distance, float max_distance) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_LEN]; - _mav_put_uint32_t(buf, 0, time_boot_ms); - _mav_put_float(buf, 4, x); - _mav_put_float(buf, 8, y); - _mav_put_float(buf, 12, z); - _mav_put_float(buf, 16, min_distance); - _mav_put_float(buf, 20, max_distance); - _mav_put_uint16_t(buf, 24, obstacle_id); - _mav_put_uint8_t(buf, 26, sensor_type); - _mav_put_uint8_t(buf, 27, frame); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_LEN); -#else - mavlink_obstacle_distance_3d_t packet; - packet.time_boot_ms = time_boot_ms; - packet.x = x; - packet.y = y; - packet.z = z; - packet.min_distance = min_distance; - packet.max_distance = max_distance; - packet.obstacle_id = obstacle_id; - packet.sensor_type = sensor_type; - packet.frame = frame; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_MIN_LEN, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_LEN, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_CRC); -} - -/** - * @brief Pack a obstacle_distance_3d message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param time_boot_ms [ms] Timestamp (time since system boot). - * @param sensor_type Class id of the distance sensor type. - * @param frame Coordinate frame of reference. - * @param obstacle_id Unique ID given to each obstacle so that its movement can be tracked. Use UINT16_MAX if object ID is unknown or cannot be determined. - * @param x [m] X position of the obstacle. - * @param y [m] Y position of the obstacle. - * @param z [m] Z position of the obstacle. - * @param min_distance [m] Minimum distance the sensor can measure. - * @param max_distance [m] Maximum distance the sensor can measure. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_obstacle_distance_3d_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint32_t time_boot_ms,uint8_t sensor_type,uint8_t frame,uint16_t obstacle_id,float x,float y,float z,float min_distance,float max_distance) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_LEN]; - _mav_put_uint32_t(buf, 0, time_boot_ms); - _mav_put_float(buf, 4, x); - _mav_put_float(buf, 8, y); - _mav_put_float(buf, 12, z); - _mav_put_float(buf, 16, min_distance); - _mav_put_float(buf, 20, max_distance); - _mav_put_uint16_t(buf, 24, obstacle_id); - _mav_put_uint8_t(buf, 26, sensor_type); - _mav_put_uint8_t(buf, 27, frame); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_LEN); -#else - mavlink_obstacle_distance_3d_t packet; - packet.time_boot_ms = time_boot_ms; - packet.x = x; - packet.y = y; - packet.z = z; - packet.min_distance = min_distance; - packet.max_distance = max_distance; - packet.obstacle_id = obstacle_id; - packet.sensor_type = sensor_type; - packet.frame = frame; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_MIN_LEN, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_LEN, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_CRC); -} - -/** - * @brief Encode a obstacle_distance_3d struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param obstacle_distance_3d C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_obstacle_distance_3d_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_obstacle_distance_3d_t* obstacle_distance_3d) -{ - return mavlink_msg_obstacle_distance_3d_pack(system_id, component_id, msg, obstacle_distance_3d->time_boot_ms, obstacle_distance_3d->sensor_type, obstacle_distance_3d->frame, obstacle_distance_3d->obstacle_id, obstacle_distance_3d->x, obstacle_distance_3d->y, obstacle_distance_3d->z, obstacle_distance_3d->min_distance, obstacle_distance_3d->max_distance); -} - -/** - * @brief Encode a obstacle_distance_3d struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param obstacle_distance_3d C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_obstacle_distance_3d_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_obstacle_distance_3d_t* obstacle_distance_3d) -{ - return mavlink_msg_obstacle_distance_3d_pack_chan(system_id, component_id, chan, msg, obstacle_distance_3d->time_boot_ms, obstacle_distance_3d->sensor_type, obstacle_distance_3d->frame, obstacle_distance_3d->obstacle_id, obstacle_distance_3d->x, obstacle_distance_3d->y, obstacle_distance_3d->z, obstacle_distance_3d->min_distance, obstacle_distance_3d->max_distance); -} - -/** - * @brief Send a obstacle_distance_3d message - * @param chan MAVLink channel to send the message - * - * @param time_boot_ms [ms] Timestamp (time since system boot). - * @param sensor_type Class id of the distance sensor type. - * @param frame Coordinate frame of reference. - * @param obstacle_id Unique ID given to each obstacle so that its movement can be tracked. Use UINT16_MAX if object ID is unknown or cannot be determined. - * @param x [m] X position of the obstacle. - * @param y [m] Y position of the obstacle. - * @param z [m] Z position of the obstacle. - * @param min_distance [m] Minimum distance the sensor can measure. - * @param max_distance [m] Maximum distance the sensor can measure. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_obstacle_distance_3d_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t sensor_type, uint8_t frame, uint16_t obstacle_id, float x, float y, float z, float min_distance, float max_distance) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_LEN]; - _mav_put_uint32_t(buf, 0, time_boot_ms); - _mav_put_float(buf, 4, x); - _mav_put_float(buf, 8, y); - _mav_put_float(buf, 12, z); - _mav_put_float(buf, 16, min_distance); - _mav_put_float(buf, 20, max_distance); - _mav_put_uint16_t(buf, 24, obstacle_id); - _mav_put_uint8_t(buf, 26, sensor_type); - _mav_put_uint8_t(buf, 27, frame); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D, buf, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_MIN_LEN, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_LEN, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_CRC); -#else - mavlink_obstacle_distance_3d_t packet; - packet.time_boot_ms = time_boot_ms; - packet.x = x; - packet.y = y; - packet.z = z; - packet.min_distance = min_distance; - packet.max_distance = max_distance; - packet.obstacle_id = obstacle_id; - packet.sensor_type = sensor_type; - packet.frame = frame; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D, (const char *)&packet, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_MIN_LEN, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_LEN, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_CRC); -#endif -} - -/** - * @brief Send a obstacle_distance_3d message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_obstacle_distance_3d_send_struct(mavlink_channel_t chan, const mavlink_obstacle_distance_3d_t* obstacle_distance_3d) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_obstacle_distance_3d_send(chan, obstacle_distance_3d->time_boot_ms, obstacle_distance_3d->sensor_type, obstacle_distance_3d->frame, obstacle_distance_3d->obstacle_id, obstacle_distance_3d->x, obstacle_distance_3d->y, obstacle_distance_3d->z, obstacle_distance_3d->min_distance, obstacle_distance_3d->max_distance); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D, (const char *)obstacle_distance_3d, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_MIN_LEN, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_LEN, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_CRC); -#endif -} - -#if MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_obstacle_distance_3d_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t sensor_type, uint8_t frame, uint16_t obstacle_id, float x, float y, float z, float min_distance, float max_distance) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint32_t(buf, 0, time_boot_ms); - _mav_put_float(buf, 4, x); - _mav_put_float(buf, 8, y); - _mav_put_float(buf, 12, z); - _mav_put_float(buf, 16, min_distance); - _mav_put_float(buf, 20, max_distance); - _mav_put_uint16_t(buf, 24, obstacle_id); - _mav_put_uint8_t(buf, 26, sensor_type); - _mav_put_uint8_t(buf, 27, frame); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D, buf, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_MIN_LEN, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_LEN, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_CRC); -#else - mavlink_obstacle_distance_3d_t *packet = (mavlink_obstacle_distance_3d_t *)msgbuf; - packet->time_boot_ms = time_boot_ms; - packet->x = x; - packet->y = y; - packet->z = z; - packet->min_distance = min_distance; - packet->max_distance = max_distance; - packet->obstacle_id = obstacle_id; - packet->sensor_type = sensor_type; - packet->frame = frame; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D, (const char *)packet, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_MIN_LEN, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_LEN, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_CRC); -#endif -} -#endif - -#endif - -// MESSAGE OBSTACLE_DISTANCE_3D UNPACKING - - -/** - * @brief Get field time_boot_ms from obstacle_distance_3d message - * - * @return [ms] Timestamp (time since system boot). - */ -static inline uint32_t mavlink_msg_obstacle_distance_3d_get_time_boot_ms(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 0); -} - -/** - * @brief Get field sensor_type from obstacle_distance_3d message - * - * @return Class id of the distance sensor type. - */ -static inline uint8_t mavlink_msg_obstacle_distance_3d_get_sensor_type(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 26); -} - -/** - * @brief Get field frame from obstacle_distance_3d message - * - * @return Coordinate frame of reference. - */ -static inline uint8_t mavlink_msg_obstacle_distance_3d_get_frame(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 27); -} - -/** - * @brief Get field obstacle_id from obstacle_distance_3d message - * - * @return Unique ID given to each obstacle so that its movement can be tracked. Use UINT16_MAX if object ID is unknown or cannot be determined. - */ -static inline uint16_t mavlink_msg_obstacle_distance_3d_get_obstacle_id(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 24); -} - -/** - * @brief Get field x from obstacle_distance_3d message - * - * @return [m] X position of the obstacle. - */ -static inline float mavlink_msg_obstacle_distance_3d_get_x(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 4); -} - -/** - * @brief Get field y from obstacle_distance_3d message - * - * @return [m] Y position of the obstacle. - */ -static inline float mavlink_msg_obstacle_distance_3d_get_y(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field z from obstacle_distance_3d message - * - * @return [m] Z position of the obstacle. - */ -static inline float mavlink_msg_obstacle_distance_3d_get_z(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Get field min_distance from obstacle_distance_3d message - * - * @return [m] Minimum distance the sensor can measure. - */ -static inline float mavlink_msg_obstacle_distance_3d_get_min_distance(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 16); -} - -/** - * @brief Get field max_distance from obstacle_distance_3d message - * - * @return [m] Maximum distance the sensor can measure. - */ -static inline float mavlink_msg_obstacle_distance_3d_get_max_distance(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 20); -} - -/** - * @brief Decode a obstacle_distance_3d message into a struct - * - * @param msg The message to decode - * @param obstacle_distance_3d C-struct to decode the message contents into - */ -static inline void mavlink_msg_obstacle_distance_3d_decode(const mavlink_message_t* msg, mavlink_obstacle_distance_3d_t* obstacle_distance_3d) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - obstacle_distance_3d->time_boot_ms = mavlink_msg_obstacle_distance_3d_get_time_boot_ms(msg); - obstacle_distance_3d->x = mavlink_msg_obstacle_distance_3d_get_x(msg); - obstacle_distance_3d->y = mavlink_msg_obstacle_distance_3d_get_y(msg); - obstacle_distance_3d->z = mavlink_msg_obstacle_distance_3d_get_z(msg); - obstacle_distance_3d->min_distance = mavlink_msg_obstacle_distance_3d_get_min_distance(msg); - obstacle_distance_3d->max_distance = mavlink_msg_obstacle_distance_3d_get_max_distance(msg); - obstacle_distance_3d->obstacle_id = mavlink_msg_obstacle_distance_3d_get_obstacle_id(msg); - obstacle_distance_3d->sensor_type = mavlink_msg_obstacle_distance_3d_get_sensor_type(msg); - obstacle_distance_3d->frame = mavlink_msg_obstacle_distance_3d_get_frame(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_LEN? msg->len : MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_LEN; - memset(obstacle_distance_3d, 0, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_LEN); - memcpy(obstacle_distance_3d, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_osd_param_config.h b/ardupilotmega/mavlink_msg_osd_param_config.h deleted file mode 100644 index f17ccbf4e..000000000 --- a/ardupilotmega/mavlink_msg_osd_param_config.h +++ /dev/null @@ -1,430 +0,0 @@ -#pragma once -// MESSAGE OSD_PARAM_CONFIG PACKING - -#define MAVLINK_MSG_ID_OSD_PARAM_CONFIG 11033 - - -typedef struct __mavlink_osd_param_config_t { - uint32_t request_id; /*< Request ID - copied to reply.*/ - float min_value; /*< OSD parameter minimum value.*/ - float max_value; /*< OSD parameter maximum value.*/ - float increment; /*< OSD parameter increment.*/ - uint8_t target_system; /*< System ID.*/ - uint8_t target_component; /*< Component ID.*/ - uint8_t osd_screen; /*< OSD parameter screen index.*/ - uint8_t osd_index; /*< OSD parameter display index.*/ - char param_id[16]; /*< Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string*/ - uint8_t config_type; /*< Config type.*/ -} mavlink_osd_param_config_t; - -#define MAVLINK_MSG_ID_OSD_PARAM_CONFIG_LEN 37 -#define MAVLINK_MSG_ID_OSD_PARAM_CONFIG_MIN_LEN 37 -#define MAVLINK_MSG_ID_11033_LEN 37 -#define MAVLINK_MSG_ID_11033_MIN_LEN 37 - -#define MAVLINK_MSG_ID_OSD_PARAM_CONFIG_CRC 195 -#define MAVLINK_MSG_ID_11033_CRC 195 - -#define MAVLINK_MSG_OSD_PARAM_CONFIG_FIELD_PARAM_ID_LEN 16 - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_OSD_PARAM_CONFIG { \ - 11033, \ - "OSD_PARAM_CONFIG", \ - 10, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_osd_param_config_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 17, offsetof(mavlink_osd_param_config_t, target_component) }, \ - { "request_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_osd_param_config_t, request_id) }, \ - { "osd_screen", NULL, MAVLINK_TYPE_UINT8_T, 0, 18, offsetof(mavlink_osd_param_config_t, osd_screen) }, \ - { "osd_index", NULL, MAVLINK_TYPE_UINT8_T, 0, 19, offsetof(mavlink_osd_param_config_t, osd_index) }, \ - { "param_id", NULL, MAVLINK_TYPE_CHAR, 16, 20, offsetof(mavlink_osd_param_config_t, param_id) }, \ - { "config_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_osd_param_config_t, config_type) }, \ - { "min_value", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_osd_param_config_t, min_value) }, \ - { "max_value", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_osd_param_config_t, max_value) }, \ - { "increment", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_osd_param_config_t, increment) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_OSD_PARAM_CONFIG { \ - "OSD_PARAM_CONFIG", \ - 10, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_osd_param_config_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 17, offsetof(mavlink_osd_param_config_t, target_component) }, \ - { "request_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_osd_param_config_t, request_id) }, \ - { "osd_screen", NULL, MAVLINK_TYPE_UINT8_T, 0, 18, offsetof(mavlink_osd_param_config_t, osd_screen) }, \ - { "osd_index", NULL, MAVLINK_TYPE_UINT8_T, 0, 19, offsetof(mavlink_osd_param_config_t, osd_index) }, \ - { "param_id", NULL, MAVLINK_TYPE_CHAR, 16, 20, offsetof(mavlink_osd_param_config_t, param_id) }, \ - { "config_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_osd_param_config_t, config_type) }, \ - { "min_value", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_osd_param_config_t, min_value) }, \ - { "max_value", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_osd_param_config_t, max_value) }, \ - { "increment", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_osd_param_config_t, increment) }, \ - } \ -} -#endif - -/** - * @brief Pack a osd_param_config message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param target_system System ID. - * @param target_component Component ID. - * @param request_id Request ID - copied to reply. - * @param osd_screen OSD parameter screen index. - * @param osd_index OSD parameter display index. - * @param param_id Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string - * @param config_type Config type. - * @param min_value OSD parameter minimum value. - * @param max_value OSD parameter maximum value. - * @param increment OSD parameter increment. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_osd_param_config_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, uint32_t request_id, uint8_t osd_screen, uint8_t osd_index, const char *param_id, uint8_t config_type, float min_value, float max_value, float increment) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_OSD_PARAM_CONFIG_LEN]; - _mav_put_uint32_t(buf, 0, request_id); - _mav_put_float(buf, 4, min_value); - _mav_put_float(buf, 8, max_value); - _mav_put_float(buf, 12, increment); - _mav_put_uint8_t(buf, 16, target_system); - _mav_put_uint8_t(buf, 17, target_component); - _mav_put_uint8_t(buf, 18, osd_screen); - _mav_put_uint8_t(buf, 19, osd_index); - _mav_put_uint8_t(buf, 36, config_type); - _mav_put_char_array(buf, 20, param_id, 16); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_LEN); -#else - mavlink_osd_param_config_t packet; - packet.request_id = request_id; - packet.min_value = min_value; - packet.max_value = max_value; - packet.increment = increment; - packet.target_system = target_system; - packet.target_component = target_component; - packet.osd_screen = osd_screen; - packet.osd_index = osd_index; - packet.config_type = config_type; - mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_OSD_PARAM_CONFIG; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_MIN_LEN, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_LEN, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_CRC); -} - -/** - * @brief Pack a osd_param_config message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param target_system System ID. - * @param target_component Component ID. - * @param request_id Request ID - copied to reply. - * @param osd_screen OSD parameter screen index. - * @param osd_index OSD parameter display index. - * @param param_id Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string - * @param config_type Config type. - * @param min_value OSD parameter minimum value. - * @param max_value OSD parameter maximum value. - * @param increment OSD parameter increment. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_osd_param_config_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,uint32_t request_id,uint8_t osd_screen,uint8_t osd_index,const char *param_id,uint8_t config_type,float min_value,float max_value,float increment) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_OSD_PARAM_CONFIG_LEN]; - _mav_put_uint32_t(buf, 0, request_id); - _mav_put_float(buf, 4, min_value); - _mav_put_float(buf, 8, max_value); - _mav_put_float(buf, 12, increment); - _mav_put_uint8_t(buf, 16, target_system); - _mav_put_uint8_t(buf, 17, target_component); - _mav_put_uint8_t(buf, 18, osd_screen); - _mav_put_uint8_t(buf, 19, osd_index); - _mav_put_uint8_t(buf, 36, config_type); - _mav_put_char_array(buf, 20, param_id, 16); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_LEN); -#else - mavlink_osd_param_config_t packet; - packet.request_id = request_id; - packet.min_value = min_value; - packet.max_value = max_value; - packet.increment = increment; - packet.target_system = target_system; - packet.target_component = target_component; - packet.osd_screen = osd_screen; - packet.osd_index = osd_index; - packet.config_type = config_type; - mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_OSD_PARAM_CONFIG; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_MIN_LEN, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_LEN, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_CRC); -} - -/** - * @brief Encode a osd_param_config struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param osd_param_config C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_osd_param_config_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_osd_param_config_t* osd_param_config) -{ - return mavlink_msg_osd_param_config_pack(system_id, component_id, msg, osd_param_config->target_system, osd_param_config->target_component, osd_param_config->request_id, osd_param_config->osd_screen, osd_param_config->osd_index, osd_param_config->param_id, osd_param_config->config_type, osd_param_config->min_value, osd_param_config->max_value, osd_param_config->increment); -} - -/** - * @brief Encode a osd_param_config struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param osd_param_config C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_osd_param_config_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_osd_param_config_t* osd_param_config) -{ - return mavlink_msg_osd_param_config_pack_chan(system_id, component_id, chan, msg, osd_param_config->target_system, osd_param_config->target_component, osd_param_config->request_id, osd_param_config->osd_screen, osd_param_config->osd_index, osd_param_config->param_id, osd_param_config->config_type, osd_param_config->min_value, osd_param_config->max_value, osd_param_config->increment); -} - -/** - * @brief Send a osd_param_config message - * @param chan MAVLink channel to send the message - * - * @param target_system System ID. - * @param target_component Component ID. - * @param request_id Request ID - copied to reply. - * @param osd_screen OSD parameter screen index. - * @param osd_index OSD parameter display index. - * @param param_id Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string - * @param config_type Config type. - * @param min_value OSD parameter minimum value. - * @param max_value OSD parameter maximum value. - * @param increment OSD parameter increment. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_osd_param_config_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint32_t request_id, uint8_t osd_screen, uint8_t osd_index, const char *param_id, uint8_t config_type, float min_value, float max_value, float increment) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_OSD_PARAM_CONFIG_LEN]; - _mav_put_uint32_t(buf, 0, request_id); - _mav_put_float(buf, 4, min_value); - _mav_put_float(buf, 8, max_value); - _mav_put_float(buf, 12, increment); - _mav_put_uint8_t(buf, 16, target_system); - _mav_put_uint8_t(buf, 17, target_component); - _mav_put_uint8_t(buf, 18, osd_screen); - _mav_put_uint8_t(buf, 19, osd_index); - _mav_put_uint8_t(buf, 36, config_type); - _mav_put_char_array(buf, 20, param_id, 16); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OSD_PARAM_CONFIG, buf, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_MIN_LEN, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_LEN, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_CRC); -#else - mavlink_osd_param_config_t packet; - packet.request_id = request_id; - packet.min_value = min_value; - packet.max_value = max_value; - packet.increment = increment; - packet.target_system = target_system; - packet.target_component = target_component; - packet.osd_screen = osd_screen; - packet.osd_index = osd_index; - packet.config_type = config_type; - mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OSD_PARAM_CONFIG, (const char *)&packet, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_MIN_LEN, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_LEN, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_CRC); -#endif -} - -/** - * @brief Send a osd_param_config message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_osd_param_config_send_struct(mavlink_channel_t chan, const mavlink_osd_param_config_t* osd_param_config) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_osd_param_config_send(chan, osd_param_config->target_system, osd_param_config->target_component, osd_param_config->request_id, osd_param_config->osd_screen, osd_param_config->osd_index, osd_param_config->param_id, osd_param_config->config_type, osd_param_config->min_value, osd_param_config->max_value, osd_param_config->increment); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OSD_PARAM_CONFIG, (const char *)osd_param_config, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_MIN_LEN, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_LEN, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_CRC); -#endif -} - -#if MAVLINK_MSG_ID_OSD_PARAM_CONFIG_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_osd_param_config_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint32_t request_id, uint8_t osd_screen, uint8_t osd_index, const char *param_id, uint8_t config_type, float min_value, float max_value, float increment) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint32_t(buf, 0, request_id); - _mav_put_float(buf, 4, min_value); - _mav_put_float(buf, 8, max_value); - _mav_put_float(buf, 12, increment); - _mav_put_uint8_t(buf, 16, target_system); - _mav_put_uint8_t(buf, 17, target_component); - _mav_put_uint8_t(buf, 18, osd_screen); - _mav_put_uint8_t(buf, 19, osd_index); - _mav_put_uint8_t(buf, 36, config_type); - _mav_put_char_array(buf, 20, param_id, 16); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OSD_PARAM_CONFIG, buf, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_MIN_LEN, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_LEN, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_CRC); -#else - mavlink_osd_param_config_t *packet = (mavlink_osd_param_config_t *)msgbuf; - packet->request_id = request_id; - packet->min_value = min_value; - packet->max_value = max_value; - packet->increment = increment; - packet->target_system = target_system; - packet->target_component = target_component; - packet->osd_screen = osd_screen; - packet->osd_index = osd_index; - packet->config_type = config_type; - mav_array_memcpy(packet->param_id, param_id, sizeof(char)*16); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OSD_PARAM_CONFIG, (const char *)packet, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_MIN_LEN, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_LEN, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_CRC); -#endif -} -#endif - -#endif - -// MESSAGE OSD_PARAM_CONFIG UNPACKING - - -/** - * @brief Get field target_system from osd_param_config message - * - * @return System ID. - */ -static inline uint8_t mavlink_msg_osd_param_config_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 16); -} - -/** - * @brief Get field target_component from osd_param_config message - * - * @return Component ID. - */ -static inline uint8_t mavlink_msg_osd_param_config_get_target_component(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 17); -} - -/** - * @brief Get field request_id from osd_param_config message - * - * @return Request ID - copied to reply. - */ -static inline uint32_t mavlink_msg_osd_param_config_get_request_id(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 0); -} - -/** - * @brief Get field osd_screen from osd_param_config message - * - * @return OSD parameter screen index. - */ -static inline uint8_t mavlink_msg_osd_param_config_get_osd_screen(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 18); -} - -/** - * @brief Get field osd_index from osd_param_config message - * - * @return OSD parameter display index. - */ -static inline uint8_t mavlink_msg_osd_param_config_get_osd_index(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 19); -} - -/** - * @brief Get field param_id from osd_param_config message - * - * @return Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string - */ -static inline uint16_t mavlink_msg_osd_param_config_get_param_id(const mavlink_message_t* msg, char *param_id) -{ - return _MAV_RETURN_char_array(msg, param_id, 16, 20); -} - -/** - * @brief Get field config_type from osd_param_config message - * - * @return Config type. - */ -static inline uint8_t mavlink_msg_osd_param_config_get_config_type(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 36); -} - -/** - * @brief Get field min_value from osd_param_config message - * - * @return OSD parameter minimum value. - */ -static inline float mavlink_msg_osd_param_config_get_min_value(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 4); -} - -/** - * @brief Get field max_value from osd_param_config message - * - * @return OSD parameter maximum value. - */ -static inline float mavlink_msg_osd_param_config_get_max_value(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field increment from osd_param_config message - * - * @return OSD parameter increment. - */ -static inline float mavlink_msg_osd_param_config_get_increment(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Decode a osd_param_config message into a struct - * - * @param msg The message to decode - * @param osd_param_config C-struct to decode the message contents into - */ -static inline void mavlink_msg_osd_param_config_decode(const mavlink_message_t* msg, mavlink_osd_param_config_t* osd_param_config) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - osd_param_config->request_id = mavlink_msg_osd_param_config_get_request_id(msg); - osd_param_config->min_value = mavlink_msg_osd_param_config_get_min_value(msg); - osd_param_config->max_value = mavlink_msg_osd_param_config_get_max_value(msg); - osd_param_config->increment = mavlink_msg_osd_param_config_get_increment(msg); - osd_param_config->target_system = mavlink_msg_osd_param_config_get_target_system(msg); - osd_param_config->target_component = mavlink_msg_osd_param_config_get_target_component(msg); - osd_param_config->osd_screen = mavlink_msg_osd_param_config_get_osd_screen(msg); - osd_param_config->osd_index = mavlink_msg_osd_param_config_get_osd_index(msg); - mavlink_msg_osd_param_config_get_param_id(msg, osd_param_config->param_id); - osd_param_config->config_type = mavlink_msg_osd_param_config_get_config_type(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_OSD_PARAM_CONFIG_LEN? msg->len : MAVLINK_MSG_ID_OSD_PARAM_CONFIG_LEN; - memset(osd_param_config, 0, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_LEN); - memcpy(osd_param_config, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_osd_param_config_reply.h b/ardupilotmega/mavlink_msg_osd_param_config_reply.h deleted file mode 100644 index 89fb5f546..000000000 --- a/ardupilotmega/mavlink_msg_osd_param_config_reply.h +++ /dev/null @@ -1,238 +0,0 @@ -#pragma once -// MESSAGE OSD_PARAM_CONFIG_REPLY PACKING - -#define MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY 11034 - - -typedef struct __mavlink_osd_param_config_reply_t { - uint32_t request_id; /*< Request ID - copied from request.*/ - uint8_t result; /*< Config error type.*/ -} mavlink_osd_param_config_reply_t; - -#define MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_LEN 5 -#define MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_MIN_LEN 5 -#define MAVLINK_MSG_ID_11034_LEN 5 -#define MAVLINK_MSG_ID_11034_MIN_LEN 5 - -#define MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_CRC 79 -#define MAVLINK_MSG_ID_11034_CRC 79 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_OSD_PARAM_CONFIG_REPLY { \ - 11034, \ - "OSD_PARAM_CONFIG_REPLY", \ - 2, \ - { { "request_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_osd_param_config_reply_t, request_id) }, \ - { "result", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_osd_param_config_reply_t, result) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_OSD_PARAM_CONFIG_REPLY { \ - "OSD_PARAM_CONFIG_REPLY", \ - 2, \ - { { "request_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_osd_param_config_reply_t, request_id) }, \ - { "result", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_osd_param_config_reply_t, result) }, \ - } \ -} -#endif - -/** - * @brief Pack a osd_param_config_reply message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param request_id Request ID - copied from request. - * @param result Config error type. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_osd_param_config_reply_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint32_t request_id, uint8_t result) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_LEN]; - _mav_put_uint32_t(buf, 0, request_id); - _mav_put_uint8_t(buf, 4, result); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_LEN); -#else - mavlink_osd_param_config_reply_t packet; - packet.request_id = request_id; - packet.result = result; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_MIN_LEN, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_LEN, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_CRC); -} - -/** - * @brief Pack a osd_param_config_reply message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param request_id Request ID - copied from request. - * @param result Config error type. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_osd_param_config_reply_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint32_t request_id,uint8_t result) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_LEN]; - _mav_put_uint32_t(buf, 0, request_id); - _mav_put_uint8_t(buf, 4, result); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_LEN); -#else - mavlink_osd_param_config_reply_t packet; - packet.request_id = request_id; - packet.result = result; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_MIN_LEN, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_LEN, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_CRC); -} - -/** - * @brief Encode a osd_param_config_reply struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param osd_param_config_reply C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_osd_param_config_reply_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_osd_param_config_reply_t* osd_param_config_reply) -{ - return mavlink_msg_osd_param_config_reply_pack(system_id, component_id, msg, osd_param_config_reply->request_id, osd_param_config_reply->result); -} - -/** - * @brief Encode a osd_param_config_reply struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param osd_param_config_reply C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_osd_param_config_reply_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_osd_param_config_reply_t* osd_param_config_reply) -{ - return mavlink_msg_osd_param_config_reply_pack_chan(system_id, component_id, chan, msg, osd_param_config_reply->request_id, osd_param_config_reply->result); -} - -/** - * @brief Send a osd_param_config_reply message - * @param chan MAVLink channel to send the message - * - * @param request_id Request ID - copied from request. - * @param result Config error type. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_osd_param_config_reply_send(mavlink_channel_t chan, uint32_t request_id, uint8_t result) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_LEN]; - _mav_put_uint32_t(buf, 0, request_id); - _mav_put_uint8_t(buf, 4, result); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY, buf, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_MIN_LEN, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_LEN, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_CRC); -#else - mavlink_osd_param_config_reply_t packet; - packet.request_id = request_id; - packet.result = result; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY, (const char *)&packet, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_MIN_LEN, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_LEN, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_CRC); -#endif -} - -/** - * @brief Send a osd_param_config_reply message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_osd_param_config_reply_send_struct(mavlink_channel_t chan, const mavlink_osd_param_config_reply_t* osd_param_config_reply) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_osd_param_config_reply_send(chan, osd_param_config_reply->request_id, osd_param_config_reply->result); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY, (const char *)osd_param_config_reply, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_MIN_LEN, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_LEN, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_CRC); -#endif -} - -#if MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_osd_param_config_reply_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t request_id, uint8_t result) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint32_t(buf, 0, request_id); - _mav_put_uint8_t(buf, 4, result); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY, buf, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_MIN_LEN, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_LEN, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_CRC); -#else - mavlink_osd_param_config_reply_t *packet = (mavlink_osd_param_config_reply_t *)msgbuf; - packet->request_id = request_id; - packet->result = result; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY, (const char *)packet, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_MIN_LEN, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_LEN, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_CRC); -#endif -} -#endif - -#endif - -// MESSAGE OSD_PARAM_CONFIG_REPLY UNPACKING - - -/** - * @brief Get field request_id from osd_param_config_reply message - * - * @return Request ID - copied from request. - */ -static inline uint32_t mavlink_msg_osd_param_config_reply_get_request_id(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 0); -} - -/** - * @brief Get field result from osd_param_config_reply message - * - * @return Config error type. - */ -static inline uint8_t mavlink_msg_osd_param_config_reply_get_result(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 4); -} - -/** - * @brief Decode a osd_param_config_reply message into a struct - * - * @param msg The message to decode - * @param osd_param_config_reply C-struct to decode the message contents into - */ -static inline void mavlink_msg_osd_param_config_reply_decode(const mavlink_message_t* msg, mavlink_osd_param_config_reply_t* osd_param_config_reply) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - osd_param_config_reply->request_id = mavlink_msg_osd_param_config_reply_get_request_id(msg); - osd_param_config_reply->result = mavlink_msg_osd_param_config_reply_get_result(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_LEN? msg->len : MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_LEN; - memset(osd_param_config_reply, 0, MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_LEN); - memcpy(osd_param_config_reply, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_osd_param_show_config.h b/ardupilotmega/mavlink_msg_osd_param_show_config.h deleted file mode 100644 index b404672bf..000000000 --- a/ardupilotmega/mavlink_msg_osd_param_show_config.h +++ /dev/null @@ -1,313 +0,0 @@ -#pragma once -// MESSAGE OSD_PARAM_SHOW_CONFIG PACKING - -#define MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG 11035 - - -typedef struct __mavlink_osd_param_show_config_t { - uint32_t request_id; /*< Request ID - copied to reply.*/ - uint8_t target_system; /*< System ID.*/ - uint8_t target_component; /*< Component ID.*/ - uint8_t osd_screen; /*< OSD parameter screen index.*/ - uint8_t osd_index; /*< OSD parameter display index.*/ -} mavlink_osd_param_show_config_t; - -#define MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_LEN 8 -#define MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_MIN_LEN 8 -#define MAVLINK_MSG_ID_11035_LEN 8 -#define MAVLINK_MSG_ID_11035_MIN_LEN 8 - -#define MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_CRC 128 -#define MAVLINK_MSG_ID_11035_CRC 128 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_OSD_PARAM_SHOW_CONFIG { \ - 11035, \ - "OSD_PARAM_SHOW_CONFIG", \ - 5, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_osd_param_show_config_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_osd_param_show_config_t, target_component) }, \ - { "request_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_osd_param_show_config_t, request_id) }, \ - { "osd_screen", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_osd_param_show_config_t, osd_screen) }, \ - { "osd_index", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_osd_param_show_config_t, osd_index) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_OSD_PARAM_SHOW_CONFIG { \ - "OSD_PARAM_SHOW_CONFIG", \ - 5, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_osd_param_show_config_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_osd_param_show_config_t, target_component) }, \ - { "request_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_osd_param_show_config_t, request_id) }, \ - { "osd_screen", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_osd_param_show_config_t, osd_screen) }, \ - { "osd_index", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_osd_param_show_config_t, osd_index) }, \ - } \ -} -#endif - -/** - * @brief Pack a osd_param_show_config message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param target_system System ID. - * @param target_component Component ID. - * @param request_id Request ID - copied to reply. - * @param osd_screen OSD parameter screen index. - * @param osd_index OSD parameter display index. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_osd_param_show_config_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, uint32_t request_id, uint8_t osd_screen, uint8_t osd_index) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_LEN]; - _mav_put_uint32_t(buf, 0, request_id); - _mav_put_uint8_t(buf, 4, target_system); - _mav_put_uint8_t(buf, 5, target_component); - _mav_put_uint8_t(buf, 6, osd_screen); - _mav_put_uint8_t(buf, 7, osd_index); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_LEN); -#else - mavlink_osd_param_show_config_t packet; - packet.request_id = request_id; - packet.target_system = target_system; - packet.target_component = target_component; - packet.osd_screen = osd_screen; - packet.osd_index = osd_index; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_MIN_LEN, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_LEN, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_CRC); -} - -/** - * @brief Pack a osd_param_show_config message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param target_system System ID. - * @param target_component Component ID. - * @param request_id Request ID - copied to reply. - * @param osd_screen OSD parameter screen index. - * @param osd_index OSD parameter display index. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_osd_param_show_config_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,uint32_t request_id,uint8_t osd_screen,uint8_t osd_index) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_LEN]; - _mav_put_uint32_t(buf, 0, request_id); - _mav_put_uint8_t(buf, 4, target_system); - _mav_put_uint8_t(buf, 5, target_component); - _mav_put_uint8_t(buf, 6, osd_screen); - _mav_put_uint8_t(buf, 7, osd_index); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_LEN); -#else - mavlink_osd_param_show_config_t packet; - packet.request_id = request_id; - packet.target_system = target_system; - packet.target_component = target_component; - packet.osd_screen = osd_screen; - packet.osd_index = osd_index; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_MIN_LEN, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_LEN, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_CRC); -} - -/** - * @brief Encode a osd_param_show_config struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param osd_param_show_config C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_osd_param_show_config_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_osd_param_show_config_t* osd_param_show_config) -{ - return mavlink_msg_osd_param_show_config_pack(system_id, component_id, msg, osd_param_show_config->target_system, osd_param_show_config->target_component, osd_param_show_config->request_id, osd_param_show_config->osd_screen, osd_param_show_config->osd_index); -} - -/** - * @brief Encode a osd_param_show_config struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param osd_param_show_config C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_osd_param_show_config_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_osd_param_show_config_t* osd_param_show_config) -{ - return mavlink_msg_osd_param_show_config_pack_chan(system_id, component_id, chan, msg, osd_param_show_config->target_system, osd_param_show_config->target_component, osd_param_show_config->request_id, osd_param_show_config->osd_screen, osd_param_show_config->osd_index); -} - -/** - * @brief Send a osd_param_show_config message - * @param chan MAVLink channel to send the message - * - * @param target_system System ID. - * @param target_component Component ID. - * @param request_id Request ID - copied to reply. - * @param osd_screen OSD parameter screen index. - * @param osd_index OSD parameter display index. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_osd_param_show_config_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint32_t request_id, uint8_t osd_screen, uint8_t osd_index) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_LEN]; - _mav_put_uint32_t(buf, 0, request_id); - _mav_put_uint8_t(buf, 4, target_system); - _mav_put_uint8_t(buf, 5, target_component); - _mav_put_uint8_t(buf, 6, osd_screen); - _mav_put_uint8_t(buf, 7, osd_index); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG, buf, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_MIN_LEN, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_LEN, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_CRC); -#else - mavlink_osd_param_show_config_t packet; - packet.request_id = request_id; - packet.target_system = target_system; - packet.target_component = target_component; - packet.osd_screen = osd_screen; - packet.osd_index = osd_index; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG, (const char *)&packet, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_MIN_LEN, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_LEN, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_CRC); -#endif -} - -/** - * @brief Send a osd_param_show_config message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_osd_param_show_config_send_struct(mavlink_channel_t chan, const mavlink_osd_param_show_config_t* osd_param_show_config) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_osd_param_show_config_send(chan, osd_param_show_config->target_system, osd_param_show_config->target_component, osd_param_show_config->request_id, osd_param_show_config->osd_screen, osd_param_show_config->osd_index); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG, (const char *)osd_param_show_config, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_MIN_LEN, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_LEN, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_CRC); -#endif -} - -#if MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_osd_param_show_config_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint32_t request_id, uint8_t osd_screen, uint8_t osd_index) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint32_t(buf, 0, request_id); - _mav_put_uint8_t(buf, 4, target_system); - _mav_put_uint8_t(buf, 5, target_component); - _mav_put_uint8_t(buf, 6, osd_screen); - _mav_put_uint8_t(buf, 7, osd_index); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG, buf, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_MIN_LEN, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_LEN, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_CRC); -#else - mavlink_osd_param_show_config_t *packet = (mavlink_osd_param_show_config_t *)msgbuf; - packet->request_id = request_id; - packet->target_system = target_system; - packet->target_component = target_component; - packet->osd_screen = osd_screen; - packet->osd_index = osd_index; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG, (const char *)packet, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_MIN_LEN, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_LEN, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_CRC); -#endif -} -#endif - -#endif - -// MESSAGE OSD_PARAM_SHOW_CONFIG UNPACKING - - -/** - * @brief Get field target_system from osd_param_show_config message - * - * @return System ID. - */ -static inline uint8_t mavlink_msg_osd_param_show_config_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 4); -} - -/** - * @brief Get field target_component from osd_param_show_config message - * - * @return Component ID. - */ -static inline uint8_t mavlink_msg_osd_param_show_config_get_target_component(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 5); -} - -/** - * @brief Get field request_id from osd_param_show_config message - * - * @return Request ID - copied to reply. - */ -static inline uint32_t mavlink_msg_osd_param_show_config_get_request_id(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 0); -} - -/** - * @brief Get field osd_screen from osd_param_show_config message - * - * @return OSD parameter screen index. - */ -static inline uint8_t mavlink_msg_osd_param_show_config_get_osd_screen(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 6); -} - -/** - * @brief Get field osd_index from osd_param_show_config message - * - * @return OSD parameter display index. - */ -static inline uint8_t mavlink_msg_osd_param_show_config_get_osd_index(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 7); -} - -/** - * @brief Decode a osd_param_show_config message into a struct - * - * @param msg The message to decode - * @param osd_param_show_config C-struct to decode the message contents into - */ -static inline void mavlink_msg_osd_param_show_config_decode(const mavlink_message_t* msg, mavlink_osd_param_show_config_t* osd_param_show_config) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - osd_param_show_config->request_id = mavlink_msg_osd_param_show_config_get_request_id(msg); - osd_param_show_config->target_system = mavlink_msg_osd_param_show_config_get_target_system(msg); - osd_param_show_config->target_component = mavlink_msg_osd_param_show_config_get_target_component(msg); - osd_param_show_config->osd_screen = mavlink_msg_osd_param_show_config_get_osd_screen(msg); - osd_param_show_config->osd_index = mavlink_msg_osd_param_show_config_get_osd_index(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_LEN? msg->len : MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_LEN; - memset(osd_param_show_config, 0, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_LEN); - memcpy(osd_param_show_config, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_osd_param_show_config_reply.h b/ardupilotmega/mavlink_msg_osd_param_show_config_reply.h deleted file mode 100644 index 33a7e6317..000000000 --- a/ardupilotmega/mavlink_msg_osd_param_show_config_reply.h +++ /dev/null @@ -1,355 +0,0 @@ -#pragma once -// MESSAGE OSD_PARAM_SHOW_CONFIG_REPLY PACKING - -#define MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY 11036 - - -typedef struct __mavlink_osd_param_show_config_reply_t { - uint32_t request_id; /*< Request ID - copied from request.*/ - float min_value; /*< OSD parameter minimum value.*/ - float max_value; /*< OSD parameter maximum value.*/ - float increment; /*< OSD parameter increment.*/ - uint8_t result; /*< Config error type.*/ - char param_id[16]; /*< Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string*/ - uint8_t config_type; /*< Config type.*/ -} mavlink_osd_param_show_config_reply_t; - -#define MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_LEN 34 -#define MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_MIN_LEN 34 -#define MAVLINK_MSG_ID_11036_LEN 34 -#define MAVLINK_MSG_ID_11036_MIN_LEN 34 - -#define MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_CRC 177 -#define MAVLINK_MSG_ID_11036_CRC 177 - -#define MAVLINK_MSG_OSD_PARAM_SHOW_CONFIG_REPLY_FIELD_PARAM_ID_LEN 16 - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_OSD_PARAM_SHOW_CONFIG_REPLY { \ - 11036, \ - "OSD_PARAM_SHOW_CONFIG_REPLY", \ - 7, \ - { { "request_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_osd_param_show_config_reply_t, request_id) }, \ - { "result", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_osd_param_show_config_reply_t, result) }, \ - { "param_id", NULL, MAVLINK_TYPE_CHAR, 16, 17, offsetof(mavlink_osd_param_show_config_reply_t, param_id) }, \ - { "config_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_osd_param_show_config_reply_t, config_type) }, \ - { "min_value", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_osd_param_show_config_reply_t, min_value) }, \ - { "max_value", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_osd_param_show_config_reply_t, max_value) }, \ - { "increment", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_osd_param_show_config_reply_t, increment) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_OSD_PARAM_SHOW_CONFIG_REPLY { \ - "OSD_PARAM_SHOW_CONFIG_REPLY", \ - 7, \ - { { "request_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_osd_param_show_config_reply_t, request_id) }, \ - { "result", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_osd_param_show_config_reply_t, result) }, \ - { "param_id", NULL, MAVLINK_TYPE_CHAR, 16, 17, offsetof(mavlink_osd_param_show_config_reply_t, param_id) }, \ - { "config_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_osd_param_show_config_reply_t, config_type) }, \ - { "min_value", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_osd_param_show_config_reply_t, min_value) }, \ - { "max_value", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_osd_param_show_config_reply_t, max_value) }, \ - { "increment", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_osd_param_show_config_reply_t, increment) }, \ - } \ -} -#endif - -/** - * @brief Pack a osd_param_show_config_reply message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param request_id Request ID - copied from request. - * @param result Config error type. - * @param param_id Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string - * @param config_type Config type. - * @param min_value OSD parameter minimum value. - * @param max_value OSD parameter maximum value. - * @param increment OSD parameter increment. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_osd_param_show_config_reply_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint32_t request_id, uint8_t result, const char *param_id, uint8_t config_type, float min_value, float max_value, float increment) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_LEN]; - _mav_put_uint32_t(buf, 0, request_id); - _mav_put_float(buf, 4, min_value); - _mav_put_float(buf, 8, max_value); - _mav_put_float(buf, 12, increment); - _mav_put_uint8_t(buf, 16, result); - _mav_put_uint8_t(buf, 33, config_type); - _mav_put_char_array(buf, 17, param_id, 16); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_LEN); -#else - mavlink_osd_param_show_config_reply_t packet; - packet.request_id = request_id; - packet.min_value = min_value; - packet.max_value = max_value; - packet.increment = increment; - packet.result = result; - packet.config_type = config_type; - mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_MIN_LEN, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_LEN, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_CRC); -} - -/** - * @brief Pack a osd_param_show_config_reply message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param request_id Request ID - copied from request. - * @param result Config error type. - * @param param_id Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string - * @param config_type Config type. - * @param min_value OSD parameter minimum value. - * @param max_value OSD parameter maximum value. - * @param increment OSD parameter increment. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_osd_param_show_config_reply_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint32_t request_id,uint8_t result,const char *param_id,uint8_t config_type,float min_value,float max_value,float increment) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_LEN]; - _mav_put_uint32_t(buf, 0, request_id); - _mav_put_float(buf, 4, min_value); - _mav_put_float(buf, 8, max_value); - _mav_put_float(buf, 12, increment); - _mav_put_uint8_t(buf, 16, result); - _mav_put_uint8_t(buf, 33, config_type); - _mav_put_char_array(buf, 17, param_id, 16); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_LEN); -#else - mavlink_osd_param_show_config_reply_t packet; - packet.request_id = request_id; - packet.min_value = min_value; - packet.max_value = max_value; - packet.increment = increment; - packet.result = result; - packet.config_type = config_type; - mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_MIN_LEN, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_LEN, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_CRC); -} - -/** - * @brief Encode a osd_param_show_config_reply struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param osd_param_show_config_reply C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_osd_param_show_config_reply_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_osd_param_show_config_reply_t* osd_param_show_config_reply) -{ - return mavlink_msg_osd_param_show_config_reply_pack(system_id, component_id, msg, osd_param_show_config_reply->request_id, osd_param_show_config_reply->result, osd_param_show_config_reply->param_id, osd_param_show_config_reply->config_type, osd_param_show_config_reply->min_value, osd_param_show_config_reply->max_value, osd_param_show_config_reply->increment); -} - -/** - * @brief Encode a osd_param_show_config_reply struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param osd_param_show_config_reply C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_osd_param_show_config_reply_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_osd_param_show_config_reply_t* osd_param_show_config_reply) -{ - return mavlink_msg_osd_param_show_config_reply_pack_chan(system_id, component_id, chan, msg, osd_param_show_config_reply->request_id, osd_param_show_config_reply->result, osd_param_show_config_reply->param_id, osd_param_show_config_reply->config_type, osd_param_show_config_reply->min_value, osd_param_show_config_reply->max_value, osd_param_show_config_reply->increment); -} - -/** - * @brief Send a osd_param_show_config_reply message - * @param chan MAVLink channel to send the message - * - * @param request_id Request ID - copied from request. - * @param result Config error type. - * @param param_id Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string - * @param config_type Config type. - * @param min_value OSD parameter minimum value. - * @param max_value OSD parameter maximum value. - * @param increment OSD parameter increment. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_osd_param_show_config_reply_send(mavlink_channel_t chan, uint32_t request_id, uint8_t result, const char *param_id, uint8_t config_type, float min_value, float max_value, float increment) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_LEN]; - _mav_put_uint32_t(buf, 0, request_id); - _mav_put_float(buf, 4, min_value); - _mav_put_float(buf, 8, max_value); - _mav_put_float(buf, 12, increment); - _mav_put_uint8_t(buf, 16, result); - _mav_put_uint8_t(buf, 33, config_type); - _mav_put_char_array(buf, 17, param_id, 16); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY, buf, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_MIN_LEN, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_LEN, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_CRC); -#else - mavlink_osd_param_show_config_reply_t packet; - packet.request_id = request_id; - packet.min_value = min_value; - packet.max_value = max_value; - packet.increment = increment; - packet.result = result; - packet.config_type = config_type; - mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY, (const char *)&packet, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_MIN_LEN, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_LEN, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_CRC); -#endif -} - -/** - * @brief Send a osd_param_show_config_reply message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_osd_param_show_config_reply_send_struct(mavlink_channel_t chan, const mavlink_osd_param_show_config_reply_t* osd_param_show_config_reply) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_osd_param_show_config_reply_send(chan, osd_param_show_config_reply->request_id, osd_param_show_config_reply->result, osd_param_show_config_reply->param_id, osd_param_show_config_reply->config_type, osd_param_show_config_reply->min_value, osd_param_show_config_reply->max_value, osd_param_show_config_reply->increment); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY, (const char *)osd_param_show_config_reply, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_MIN_LEN, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_LEN, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_CRC); -#endif -} - -#if MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_osd_param_show_config_reply_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t request_id, uint8_t result, const char *param_id, uint8_t config_type, float min_value, float max_value, float increment) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint32_t(buf, 0, request_id); - _mav_put_float(buf, 4, min_value); - _mav_put_float(buf, 8, max_value); - _mav_put_float(buf, 12, increment); - _mav_put_uint8_t(buf, 16, result); - _mav_put_uint8_t(buf, 33, config_type); - _mav_put_char_array(buf, 17, param_id, 16); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY, buf, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_MIN_LEN, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_LEN, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_CRC); -#else - mavlink_osd_param_show_config_reply_t *packet = (mavlink_osd_param_show_config_reply_t *)msgbuf; - packet->request_id = request_id; - packet->min_value = min_value; - packet->max_value = max_value; - packet->increment = increment; - packet->result = result; - packet->config_type = config_type; - mav_array_memcpy(packet->param_id, param_id, sizeof(char)*16); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY, (const char *)packet, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_MIN_LEN, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_LEN, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_CRC); -#endif -} -#endif - -#endif - -// MESSAGE OSD_PARAM_SHOW_CONFIG_REPLY UNPACKING - - -/** - * @brief Get field request_id from osd_param_show_config_reply message - * - * @return Request ID - copied from request. - */ -static inline uint32_t mavlink_msg_osd_param_show_config_reply_get_request_id(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 0); -} - -/** - * @brief Get field result from osd_param_show_config_reply message - * - * @return Config error type. - */ -static inline uint8_t mavlink_msg_osd_param_show_config_reply_get_result(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 16); -} - -/** - * @brief Get field param_id from osd_param_show_config_reply message - * - * @return Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string - */ -static inline uint16_t mavlink_msg_osd_param_show_config_reply_get_param_id(const mavlink_message_t* msg, char *param_id) -{ - return _MAV_RETURN_char_array(msg, param_id, 16, 17); -} - -/** - * @brief Get field config_type from osd_param_show_config_reply message - * - * @return Config type. - */ -static inline uint8_t mavlink_msg_osd_param_show_config_reply_get_config_type(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 33); -} - -/** - * @brief Get field min_value from osd_param_show_config_reply message - * - * @return OSD parameter minimum value. - */ -static inline float mavlink_msg_osd_param_show_config_reply_get_min_value(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 4); -} - -/** - * @brief Get field max_value from osd_param_show_config_reply message - * - * @return OSD parameter maximum value. - */ -static inline float mavlink_msg_osd_param_show_config_reply_get_max_value(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field increment from osd_param_show_config_reply message - * - * @return OSD parameter increment. - */ -static inline float mavlink_msg_osd_param_show_config_reply_get_increment(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Decode a osd_param_show_config_reply message into a struct - * - * @param msg The message to decode - * @param osd_param_show_config_reply C-struct to decode the message contents into - */ -static inline void mavlink_msg_osd_param_show_config_reply_decode(const mavlink_message_t* msg, mavlink_osd_param_show_config_reply_t* osd_param_show_config_reply) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - osd_param_show_config_reply->request_id = mavlink_msg_osd_param_show_config_reply_get_request_id(msg); - osd_param_show_config_reply->min_value = mavlink_msg_osd_param_show_config_reply_get_min_value(msg); - osd_param_show_config_reply->max_value = mavlink_msg_osd_param_show_config_reply_get_max_value(msg); - osd_param_show_config_reply->increment = mavlink_msg_osd_param_show_config_reply_get_increment(msg); - osd_param_show_config_reply->result = mavlink_msg_osd_param_show_config_reply_get_result(msg); - mavlink_msg_osd_param_show_config_reply_get_param_id(msg, osd_param_show_config_reply->param_id); - osd_param_show_config_reply->config_type = mavlink_msg_osd_param_show_config_reply_get_config_type(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_LEN? msg->len : MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_LEN; - memset(osd_param_show_config_reply, 0, MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_LEN); - memcpy(osd_param_show_config_reply, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_pid_tuning.h b/ardupilotmega/mavlink_msg_pid_tuning.h deleted file mode 100644 index d333d3c43..000000000 --- a/ardupilotmega/mavlink_msg_pid_tuning.h +++ /dev/null @@ -1,363 +0,0 @@ -#pragma once -// MESSAGE PID_TUNING PACKING - -#define MAVLINK_MSG_ID_PID_TUNING 194 - - -typedef struct __mavlink_pid_tuning_t { - float desired; /*< Desired rate.*/ - float achieved; /*< Achieved rate.*/ - float FF; /*< FF component.*/ - float P; /*< P component.*/ - float I; /*< I component.*/ - float D; /*< D component.*/ - uint8_t axis; /*< Axis.*/ -} mavlink_pid_tuning_t; - -#define MAVLINK_MSG_ID_PID_TUNING_LEN 25 -#define MAVLINK_MSG_ID_PID_TUNING_MIN_LEN 25 -#define MAVLINK_MSG_ID_194_LEN 25 -#define MAVLINK_MSG_ID_194_MIN_LEN 25 - -#define MAVLINK_MSG_ID_PID_TUNING_CRC 98 -#define MAVLINK_MSG_ID_194_CRC 98 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_PID_TUNING { \ - 194, \ - "PID_TUNING", \ - 7, \ - { { "axis", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_pid_tuning_t, axis) }, \ - { "desired", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_pid_tuning_t, desired) }, \ - { "achieved", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_pid_tuning_t, achieved) }, \ - { "FF", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_pid_tuning_t, FF) }, \ - { "P", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_pid_tuning_t, P) }, \ - { "I", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_pid_tuning_t, I) }, \ - { "D", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_pid_tuning_t, D) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_PID_TUNING { \ - "PID_TUNING", \ - 7, \ - { { "axis", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_pid_tuning_t, axis) }, \ - { "desired", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_pid_tuning_t, desired) }, \ - { "achieved", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_pid_tuning_t, achieved) }, \ - { "FF", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_pid_tuning_t, FF) }, \ - { "P", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_pid_tuning_t, P) }, \ - { "I", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_pid_tuning_t, I) }, \ - { "D", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_pid_tuning_t, D) }, \ - } \ -} -#endif - -/** - * @brief Pack a pid_tuning message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param axis Axis. - * @param desired Desired rate. - * @param achieved Achieved rate. - * @param FF FF component. - * @param P P component. - * @param I I component. - * @param D D component. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_pid_tuning_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t axis, float desired, float achieved, float FF, float P, float I, float D) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_PID_TUNING_LEN]; - _mav_put_float(buf, 0, desired); - _mav_put_float(buf, 4, achieved); - _mav_put_float(buf, 8, FF); - _mav_put_float(buf, 12, P); - _mav_put_float(buf, 16, I); - _mav_put_float(buf, 20, D); - _mav_put_uint8_t(buf, 24, axis); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PID_TUNING_LEN); -#else - mavlink_pid_tuning_t packet; - packet.desired = desired; - packet.achieved = achieved; - packet.FF = FF; - packet.P = P; - packet.I = I; - packet.D = D; - packet.axis = axis; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PID_TUNING_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_PID_TUNING; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PID_TUNING_MIN_LEN, MAVLINK_MSG_ID_PID_TUNING_LEN, MAVLINK_MSG_ID_PID_TUNING_CRC); -} - -/** - * @brief Pack a pid_tuning message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param axis Axis. - * @param desired Desired rate. - * @param achieved Achieved rate. - * @param FF FF component. - * @param P P component. - * @param I I component. - * @param D D component. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_pid_tuning_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t axis,float desired,float achieved,float FF,float P,float I,float D) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_PID_TUNING_LEN]; - _mav_put_float(buf, 0, desired); - _mav_put_float(buf, 4, achieved); - _mav_put_float(buf, 8, FF); - _mav_put_float(buf, 12, P); - _mav_put_float(buf, 16, I); - _mav_put_float(buf, 20, D); - _mav_put_uint8_t(buf, 24, axis); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PID_TUNING_LEN); -#else - mavlink_pid_tuning_t packet; - packet.desired = desired; - packet.achieved = achieved; - packet.FF = FF; - packet.P = P; - packet.I = I; - packet.D = D; - packet.axis = axis; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PID_TUNING_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_PID_TUNING; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_PID_TUNING_MIN_LEN, MAVLINK_MSG_ID_PID_TUNING_LEN, MAVLINK_MSG_ID_PID_TUNING_CRC); -} - -/** - * @brief Encode a pid_tuning struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param pid_tuning C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_pid_tuning_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_pid_tuning_t* pid_tuning) -{ - return mavlink_msg_pid_tuning_pack(system_id, component_id, msg, pid_tuning->axis, pid_tuning->desired, pid_tuning->achieved, pid_tuning->FF, pid_tuning->P, pid_tuning->I, pid_tuning->D); -} - -/** - * @brief Encode a pid_tuning struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param pid_tuning C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_pid_tuning_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_pid_tuning_t* pid_tuning) -{ - return mavlink_msg_pid_tuning_pack_chan(system_id, component_id, chan, msg, pid_tuning->axis, pid_tuning->desired, pid_tuning->achieved, pid_tuning->FF, pid_tuning->P, pid_tuning->I, pid_tuning->D); -} - -/** - * @brief Send a pid_tuning message - * @param chan MAVLink channel to send the message - * - * @param axis Axis. - * @param desired Desired rate. - * @param achieved Achieved rate. - * @param FF FF component. - * @param P P component. - * @param I I component. - * @param D D component. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_pid_tuning_send(mavlink_channel_t chan, uint8_t axis, float desired, float achieved, float FF, float P, float I, float D) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_PID_TUNING_LEN]; - _mav_put_float(buf, 0, desired); - _mav_put_float(buf, 4, achieved); - _mav_put_float(buf, 8, FF); - _mav_put_float(buf, 12, P); - _mav_put_float(buf, 16, I); - _mav_put_float(buf, 20, D); - _mav_put_uint8_t(buf, 24, axis); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PID_TUNING, buf, MAVLINK_MSG_ID_PID_TUNING_MIN_LEN, MAVLINK_MSG_ID_PID_TUNING_LEN, MAVLINK_MSG_ID_PID_TUNING_CRC); -#else - mavlink_pid_tuning_t packet; - packet.desired = desired; - packet.achieved = achieved; - packet.FF = FF; - packet.P = P; - packet.I = I; - packet.D = D; - packet.axis = axis; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PID_TUNING, (const char *)&packet, MAVLINK_MSG_ID_PID_TUNING_MIN_LEN, MAVLINK_MSG_ID_PID_TUNING_LEN, MAVLINK_MSG_ID_PID_TUNING_CRC); -#endif -} - -/** - * @brief Send a pid_tuning message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_pid_tuning_send_struct(mavlink_channel_t chan, const mavlink_pid_tuning_t* pid_tuning) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_pid_tuning_send(chan, pid_tuning->axis, pid_tuning->desired, pid_tuning->achieved, pid_tuning->FF, pid_tuning->P, pid_tuning->I, pid_tuning->D); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PID_TUNING, (const char *)pid_tuning, MAVLINK_MSG_ID_PID_TUNING_MIN_LEN, MAVLINK_MSG_ID_PID_TUNING_LEN, MAVLINK_MSG_ID_PID_TUNING_CRC); -#endif -} - -#if MAVLINK_MSG_ID_PID_TUNING_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_pid_tuning_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t axis, float desired, float achieved, float FF, float P, float I, float D) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_float(buf, 0, desired); - _mav_put_float(buf, 4, achieved); - _mav_put_float(buf, 8, FF); - _mav_put_float(buf, 12, P); - _mav_put_float(buf, 16, I); - _mav_put_float(buf, 20, D); - _mav_put_uint8_t(buf, 24, axis); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PID_TUNING, buf, MAVLINK_MSG_ID_PID_TUNING_MIN_LEN, MAVLINK_MSG_ID_PID_TUNING_LEN, MAVLINK_MSG_ID_PID_TUNING_CRC); -#else - mavlink_pid_tuning_t *packet = (mavlink_pid_tuning_t *)msgbuf; - packet->desired = desired; - packet->achieved = achieved; - packet->FF = FF; - packet->P = P; - packet->I = I; - packet->D = D; - packet->axis = axis; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PID_TUNING, (const char *)packet, MAVLINK_MSG_ID_PID_TUNING_MIN_LEN, MAVLINK_MSG_ID_PID_TUNING_LEN, MAVLINK_MSG_ID_PID_TUNING_CRC); -#endif -} -#endif - -#endif - -// MESSAGE PID_TUNING UNPACKING - - -/** - * @brief Get field axis from pid_tuning message - * - * @return Axis. - */ -static inline uint8_t mavlink_msg_pid_tuning_get_axis(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 24); -} - -/** - * @brief Get field desired from pid_tuning message - * - * @return Desired rate. - */ -static inline float mavlink_msg_pid_tuning_get_desired(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 0); -} - -/** - * @brief Get field achieved from pid_tuning message - * - * @return Achieved rate. - */ -static inline float mavlink_msg_pid_tuning_get_achieved(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 4); -} - -/** - * @brief Get field FF from pid_tuning message - * - * @return FF component. - */ -static inline float mavlink_msg_pid_tuning_get_FF(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field P from pid_tuning message - * - * @return P component. - */ -static inline float mavlink_msg_pid_tuning_get_P(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Get field I from pid_tuning message - * - * @return I component. - */ -static inline float mavlink_msg_pid_tuning_get_I(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 16); -} - -/** - * @brief Get field D from pid_tuning message - * - * @return D component. - */ -static inline float mavlink_msg_pid_tuning_get_D(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 20); -} - -/** - * @brief Decode a pid_tuning message into a struct - * - * @param msg The message to decode - * @param pid_tuning C-struct to decode the message contents into - */ -static inline void mavlink_msg_pid_tuning_decode(const mavlink_message_t* msg, mavlink_pid_tuning_t* pid_tuning) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - pid_tuning->desired = mavlink_msg_pid_tuning_get_desired(msg); - pid_tuning->achieved = mavlink_msg_pid_tuning_get_achieved(msg); - pid_tuning->FF = mavlink_msg_pid_tuning_get_FF(msg); - pid_tuning->P = mavlink_msg_pid_tuning_get_P(msg); - pid_tuning->I = mavlink_msg_pid_tuning_get_I(msg); - pid_tuning->D = mavlink_msg_pid_tuning_get_D(msg); - pid_tuning->axis = mavlink_msg_pid_tuning_get_axis(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_PID_TUNING_LEN? msg->len : MAVLINK_MSG_ID_PID_TUNING_LEN; - memset(pid_tuning, 0, MAVLINK_MSG_ID_PID_TUNING_LEN); - memcpy(pid_tuning, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_radio.h b/ardupilotmega/mavlink_msg_radio.h deleted file mode 100644 index 76ffe43ae..000000000 --- a/ardupilotmega/mavlink_msg_radio.h +++ /dev/null @@ -1,363 +0,0 @@ -#pragma once -// MESSAGE RADIO PACKING - -#define MAVLINK_MSG_ID_RADIO 166 - - -typedef struct __mavlink_radio_t { - uint16_t rxerrors; /*< Receive errors.*/ - uint16_t fixed; /*< Count of error corrected packets.*/ - uint8_t rssi; /*< Local signal strength.*/ - uint8_t remrssi; /*< Remote signal strength.*/ - uint8_t txbuf; /*< [%] How full the tx buffer is.*/ - uint8_t noise; /*< Background noise level.*/ - uint8_t remnoise; /*< Remote background noise level.*/ -} mavlink_radio_t; - -#define MAVLINK_MSG_ID_RADIO_LEN 9 -#define MAVLINK_MSG_ID_RADIO_MIN_LEN 9 -#define MAVLINK_MSG_ID_166_LEN 9 -#define MAVLINK_MSG_ID_166_MIN_LEN 9 - -#define MAVLINK_MSG_ID_RADIO_CRC 21 -#define MAVLINK_MSG_ID_166_CRC 21 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_RADIO { \ - 166, \ - "RADIO", \ - 7, \ - { { "rssi", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_radio_t, rssi) }, \ - { "remrssi", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_radio_t, remrssi) }, \ - { "txbuf", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_radio_t, txbuf) }, \ - { "noise", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_radio_t, noise) }, \ - { "remnoise", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_radio_t, remnoise) }, \ - { "rxerrors", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_radio_t, rxerrors) }, \ - { "fixed", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_radio_t, fixed) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_RADIO { \ - "RADIO", \ - 7, \ - { { "rssi", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_radio_t, rssi) }, \ - { "remrssi", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_radio_t, remrssi) }, \ - { "txbuf", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_radio_t, txbuf) }, \ - { "noise", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_radio_t, noise) }, \ - { "remnoise", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_radio_t, remnoise) }, \ - { "rxerrors", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_radio_t, rxerrors) }, \ - { "fixed", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_radio_t, fixed) }, \ - } \ -} -#endif - -/** - * @brief Pack a radio message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param rssi Local signal strength. - * @param remrssi Remote signal strength. - * @param txbuf [%] How full the tx buffer is. - * @param noise Background noise level. - * @param remnoise Remote background noise level. - * @param rxerrors Receive errors. - * @param fixed Count of error corrected packets. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_radio_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t rssi, uint8_t remrssi, uint8_t txbuf, uint8_t noise, uint8_t remnoise, uint16_t rxerrors, uint16_t fixed) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_RADIO_LEN]; - _mav_put_uint16_t(buf, 0, rxerrors); - _mav_put_uint16_t(buf, 2, fixed); - _mav_put_uint8_t(buf, 4, rssi); - _mav_put_uint8_t(buf, 5, remrssi); - _mav_put_uint8_t(buf, 6, txbuf); - _mav_put_uint8_t(buf, 7, noise); - _mav_put_uint8_t(buf, 8, remnoise); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RADIO_LEN); -#else - mavlink_radio_t packet; - packet.rxerrors = rxerrors; - packet.fixed = fixed; - packet.rssi = rssi; - packet.remrssi = remrssi; - packet.txbuf = txbuf; - packet.noise = noise; - packet.remnoise = remnoise; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RADIO_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_RADIO; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RADIO_MIN_LEN, MAVLINK_MSG_ID_RADIO_LEN, MAVLINK_MSG_ID_RADIO_CRC); -} - -/** - * @brief Pack a radio message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param rssi Local signal strength. - * @param remrssi Remote signal strength. - * @param txbuf [%] How full the tx buffer is. - * @param noise Background noise level. - * @param remnoise Remote background noise level. - * @param rxerrors Receive errors. - * @param fixed Count of error corrected packets. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_radio_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t rssi,uint8_t remrssi,uint8_t txbuf,uint8_t noise,uint8_t remnoise,uint16_t rxerrors,uint16_t fixed) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_RADIO_LEN]; - _mav_put_uint16_t(buf, 0, rxerrors); - _mav_put_uint16_t(buf, 2, fixed); - _mav_put_uint8_t(buf, 4, rssi); - _mav_put_uint8_t(buf, 5, remrssi); - _mav_put_uint8_t(buf, 6, txbuf); - _mav_put_uint8_t(buf, 7, noise); - _mav_put_uint8_t(buf, 8, remnoise); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RADIO_LEN); -#else - mavlink_radio_t packet; - packet.rxerrors = rxerrors; - packet.fixed = fixed; - packet.rssi = rssi; - packet.remrssi = remrssi; - packet.txbuf = txbuf; - packet.noise = noise; - packet.remnoise = remnoise; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RADIO_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_RADIO; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_RADIO_MIN_LEN, MAVLINK_MSG_ID_RADIO_LEN, MAVLINK_MSG_ID_RADIO_CRC); -} - -/** - * @brief Encode a radio struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param radio C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_radio_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_radio_t* radio) -{ - return mavlink_msg_radio_pack(system_id, component_id, msg, radio->rssi, radio->remrssi, radio->txbuf, radio->noise, radio->remnoise, radio->rxerrors, radio->fixed); -} - -/** - * @brief Encode a radio struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param radio C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_radio_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_radio_t* radio) -{ - return mavlink_msg_radio_pack_chan(system_id, component_id, chan, msg, radio->rssi, radio->remrssi, radio->txbuf, radio->noise, radio->remnoise, radio->rxerrors, radio->fixed); -} - -/** - * @brief Send a radio message - * @param chan MAVLink channel to send the message - * - * @param rssi Local signal strength. - * @param remrssi Remote signal strength. - * @param txbuf [%] How full the tx buffer is. - * @param noise Background noise level. - * @param remnoise Remote background noise level. - * @param rxerrors Receive errors. - * @param fixed Count of error corrected packets. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_radio_send(mavlink_channel_t chan, uint8_t rssi, uint8_t remrssi, uint8_t txbuf, uint8_t noise, uint8_t remnoise, uint16_t rxerrors, uint16_t fixed) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_RADIO_LEN]; - _mav_put_uint16_t(buf, 0, rxerrors); - _mav_put_uint16_t(buf, 2, fixed); - _mav_put_uint8_t(buf, 4, rssi); - _mav_put_uint8_t(buf, 5, remrssi); - _mav_put_uint8_t(buf, 6, txbuf); - _mav_put_uint8_t(buf, 7, noise); - _mav_put_uint8_t(buf, 8, remnoise); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIO, buf, MAVLINK_MSG_ID_RADIO_MIN_LEN, MAVLINK_MSG_ID_RADIO_LEN, MAVLINK_MSG_ID_RADIO_CRC); -#else - mavlink_radio_t packet; - packet.rxerrors = rxerrors; - packet.fixed = fixed; - packet.rssi = rssi; - packet.remrssi = remrssi; - packet.txbuf = txbuf; - packet.noise = noise; - packet.remnoise = remnoise; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIO, (const char *)&packet, MAVLINK_MSG_ID_RADIO_MIN_LEN, MAVLINK_MSG_ID_RADIO_LEN, MAVLINK_MSG_ID_RADIO_CRC); -#endif -} - -/** - * @brief Send a radio message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_radio_send_struct(mavlink_channel_t chan, const mavlink_radio_t* radio) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_radio_send(chan, radio->rssi, radio->remrssi, radio->txbuf, radio->noise, radio->remnoise, radio->rxerrors, radio->fixed); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIO, (const char *)radio, MAVLINK_MSG_ID_RADIO_MIN_LEN, MAVLINK_MSG_ID_RADIO_LEN, MAVLINK_MSG_ID_RADIO_CRC); -#endif -} - -#if MAVLINK_MSG_ID_RADIO_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_radio_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t rssi, uint8_t remrssi, uint8_t txbuf, uint8_t noise, uint8_t remnoise, uint16_t rxerrors, uint16_t fixed) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint16_t(buf, 0, rxerrors); - _mav_put_uint16_t(buf, 2, fixed); - _mav_put_uint8_t(buf, 4, rssi); - _mav_put_uint8_t(buf, 5, remrssi); - _mav_put_uint8_t(buf, 6, txbuf); - _mav_put_uint8_t(buf, 7, noise); - _mav_put_uint8_t(buf, 8, remnoise); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIO, buf, MAVLINK_MSG_ID_RADIO_MIN_LEN, MAVLINK_MSG_ID_RADIO_LEN, MAVLINK_MSG_ID_RADIO_CRC); -#else - mavlink_radio_t *packet = (mavlink_radio_t *)msgbuf; - packet->rxerrors = rxerrors; - packet->fixed = fixed; - packet->rssi = rssi; - packet->remrssi = remrssi; - packet->txbuf = txbuf; - packet->noise = noise; - packet->remnoise = remnoise; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIO, (const char *)packet, MAVLINK_MSG_ID_RADIO_MIN_LEN, MAVLINK_MSG_ID_RADIO_LEN, MAVLINK_MSG_ID_RADIO_CRC); -#endif -} -#endif - -#endif - -// MESSAGE RADIO UNPACKING - - -/** - * @brief Get field rssi from radio message - * - * @return Local signal strength. - */ -static inline uint8_t mavlink_msg_radio_get_rssi(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 4); -} - -/** - * @brief Get field remrssi from radio message - * - * @return Remote signal strength. - */ -static inline uint8_t mavlink_msg_radio_get_remrssi(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 5); -} - -/** - * @brief Get field txbuf from radio message - * - * @return [%] How full the tx buffer is. - */ -static inline uint8_t mavlink_msg_radio_get_txbuf(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 6); -} - -/** - * @brief Get field noise from radio message - * - * @return Background noise level. - */ -static inline uint8_t mavlink_msg_radio_get_noise(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 7); -} - -/** - * @brief Get field remnoise from radio message - * - * @return Remote background noise level. - */ -static inline uint8_t mavlink_msg_radio_get_remnoise(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 8); -} - -/** - * @brief Get field rxerrors from radio message - * - * @return Receive errors. - */ -static inline uint16_t mavlink_msg_radio_get_rxerrors(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 0); -} - -/** - * @brief Get field fixed from radio message - * - * @return Count of error corrected packets. - */ -static inline uint16_t mavlink_msg_radio_get_fixed(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 2); -} - -/** - * @brief Decode a radio message into a struct - * - * @param msg The message to decode - * @param radio C-struct to decode the message contents into - */ -static inline void mavlink_msg_radio_decode(const mavlink_message_t* msg, mavlink_radio_t* radio) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - radio->rxerrors = mavlink_msg_radio_get_rxerrors(msg); - radio->fixed = mavlink_msg_radio_get_fixed(msg); - radio->rssi = mavlink_msg_radio_get_rssi(msg); - radio->remrssi = mavlink_msg_radio_get_remrssi(msg); - radio->txbuf = mavlink_msg_radio_get_txbuf(msg); - radio->noise = mavlink_msg_radio_get_noise(msg); - radio->remnoise = mavlink_msg_radio_get_remnoise(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_RADIO_LEN? msg->len : MAVLINK_MSG_ID_RADIO_LEN; - memset(radio, 0, MAVLINK_MSG_ID_RADIO_LEN); - memcpy(radio, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_rally_fetch_point.h b/ardupilotmega/mavlink_msg_rally_fetch_point.h deleted file mode 100644 index f9c08d104..000000000 --- a/ardupilotmega/mavlink_msg_rally_fetch_point.h +++ /dev/null @@ -1,263 +0,0 @@ -#pragma once -// MESSAGE RALLY_FETCH_POINT PACKING - -#define MAVLINK_MSG_ID_RALLY_FETCH_POINT 176 - - -typedef struct __mavlink_rally_fetch_point_t { - uint8_t target_system; /*< System ID.*/ - uint8_t target_component; /*< Component ID.*/ - uint8_t idx; /*< Point index (first point is 0).*/ -} mavlink_rally_fetch_point_t; - -#define MAVLINK_MSG_ID_RALLY_FETCH_POINT_LEN 3 -#define MAVLINK_MSG_ID_RALLY_FETCH_POINT_MIN_LEN 3 -#define MAVLINK_MSG_ID_176_LEN 3 -#define MAVLINK_MSG_ID_176_MIN_LEN 3 - -#define MAVLINK_MSG_ID_RALLY_FETCH_POINT_CRC 234 -#define MAVLINK_MSG_ID_176_CRC 234 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_RALLY_FETCH_POINT { \ - 176, \ - "RALLY_FETCH_POINT", \ - 3, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_rally_fetch_point_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_rally_fetch_point_t, target_component) }, \ - { "idx", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_rally_fetch_point_t, idx) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_RALLY_FETCH_POINT { \ - "RALLY_FETCH_POINT", \ - 3, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_rally_fetch_point_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_rally_fetch_point_t, target_component) }, \ - { "idx", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_rally_fetch_point_t, idx) }, \ - } \ -} -#endif - -/** - * @brief Pack a rally_fetch_point message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param target_system System ID. - * @param target_component Component ID. - * @param idx Point index (first point is 0). - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_rally_fetch_point_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, uint8_t idx) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_RALLY_FETCH_POINT_LEN]; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, idx); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RALLY_FETCH_POINT_LEN); -#else - mavlink_rally_fetch_point_t packet; - packet.target_system = target_system; - packet.target_component = target_component; - packet.idx = idx; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RALLY_FETCH_POINT_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_RALLY_FETCH_POINT; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RALLY_FETCH_POINT_MIN_LEN, MAVLINK_MSG_ID_RALLY_FETCH_POINT_LEN, MAVLINK_MSG_ID_RALLY_FETCH_POINT_CRC); -} - -/** - * @brief Pack a rally_fetch_point message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param target_system System ID. - * @param target_component Component ID. - * @param idx Point index (first point is 0). - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_rally_fetch_point_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,uint8_t idx) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_RALLY_FETCH_POINT_LEN]; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, idx); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RALLY_FETCH_POINT_LEN); -#else - mavlink_rally_fetch_point_t packet; - packet.target_system = target_system; - packet.target_component = target_component; - packet.idx = idx; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RALLY_FETCH_POINT_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_RALLY_FETCH_POINT; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_RALLY_FETCH_POINT_MIN_LEN, MAVLINK_MSG_ID_RALLY_FETCH_POINT_LEN, MAVLINK_MSG_ID_RALLY_FETCH_POINT_CRC); -} - -/** - * @brief Encode a rally_fetch_point struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param rally_fetch_point C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_rally_fetch_point_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_rally_fetch_point_t* rally_fetch_point) -{ - return mavlink_msg_rally_fetch_point_pack(system_id, component_id, msg, rally_fetch_point->target_system, rally_fetch_point->target_component, rally_fetch_point->idx); -} - -/** - * @brief Encode a rally_fetch_point struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param rally_fetch_point C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_rally_fetch_point_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_rally_fetch_point_t* rally_fetch_point) -{ - return mavlink_msg_rally_fetch_point_pack_chan(system_id, component_id, chan, msg, rally_fetch_point->target_system, rally_fetch_point->target_component, rally_fetch_point->idx); -} - -/** - * @brief Send a rally_fetch_point message - * @param chan MAVLink channel to send the message - * - * @param target_system System ID. - * @param target_component Component ID. - * @param idx Point index (first point is 0). - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_rally_fetch_point_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t idx) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_RALLY_FETCH_POINT_LEN]; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, idx); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RALLY_FETCH_POINT, buf, MAVLINK_MSG_ID_RALLY_FETCH_POINT_MIN_LEN, MAVLINK_MSG_ID_RALLY_FETCH_POINT_LEN, MAVLINK_MSG_ID_RALLY_FETCH_POINT_CRC); -#else - mavlink_rally_fetch_point_t packet; - packet.target_system = target_system; - packet.target_component = target_component; - packet.idx = idx; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RALLY_FETCH_POINT, (const char *)&packet, MAVLINK_MSG_ID_RALLY_FETCH_POINT_MIN_LEN, MAVLINK_MSG_ID_RALLY_FETCH_POINT_LEN, MAVLINK_MSG_ID_RALLY_FETCH_POINT_CRC); -#endif -} - -/** - * @brief Send a rally_fetch_point message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_rally_fetch_point_send_struct(mavlink_channel_t chan, const mavlink_rally_fetch_point_t* rally_fetch_point) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_rally_fetch_point_send(chan, rally_fetch_point->target_system, rally_fetch_point->target_component, rally_fetch_point->idx); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RALLY_FETCH_POINT, (const char *)rally_fetch_point, MAVLINK_MSG_ID_RALLY_FETCH_POINT_MIN_LEN, MAVLINK_MSG_ID_RALLY_FETCH_POINT_LEN, MAVLINK_MSG_ID_RALLY_FETCH_POINT_CRC); -#endif -} - -#if MAVLINK_MSG_ID_RALLY_FETCH_POINT_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_rally_fetch_point_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t idx) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, idx); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RALLY_FETCH_POINT, buf, MAVLINK_MSG_ID_RALLY_FETCH_POINT_MIN_LEN, MAVLINK_MSG_ID_RALLY_FETCH_POINT_LEN, MAVLINK_MSG_ID_RALLY_FETCH_POINT_CRC); -#else - mavlink_rally_fetch_point_t *packet = (mavlink_rally_fetch_point_t *)msgbuf; - packet->target_system = target_system; - packet->target_component = target_component; - packet->idx = idx; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RALLY_FETCH_POINT, (const char *)packet, MAVLINK_MSG_ID_RALLY_FETCH_POINT_MIN_LEN, MAVLINK_MSG_ID_RALLY_FETCH_POINT_LEN, MAVLINK_MSG_ID_RALLY_FETCH_POINT_CRC); -#endif -} -#endif - -#endif - -// MESSAGE RALLY_FETCH_POINT UNPACKING - - -/** - * @brief Get field target_system from rally_fetch_point message - * - * @return System ID. - */ -static inline uint8_t mavlink_msg_rally_fetch_point_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 0); -} - -/** - * @brief Get field target_component from rally_fetch_point message - * - * @return Component ID. - */ -static inline uint8_t mavlink_msg_rally_fetch_point_get_target_component(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 1); -} - -/** - * @brief Get field idx from rally_fetch_point message - * - * @return Point index (first point is 0). - */ -static inline uint8_t mavlink_msg_rally_fetch_point_get_idx(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 2); -} - -/** - * @brief Decode a rally_fetch_point message into a struct - * - * @param msg The message to decode - * @param rally_fetch_point C-struct to decode the message contents into - */ -static inline void mavlink_msg_rally_fetch_point_decode(const mavlink_message_t* msg, mavlink_rally_fetch_point_t* rally_fetch_point) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - rally_fetch_point->target_system = mavlink_msg_rally_fetch_point_get_target_system(msg); - rally_fetch_point->target_component = mavlink_msg_rally_fetch_point_get_target_component(msg); - rally_fetch_point->idx = mavlink_msg_rally_fetch_point_get_idx(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_RALLY_FETCH_POINT_LEN? msg->len : MAVLINK_MSG_ID_RALLY_FETCH_POINT_LEN; - memset(rally_fetch_point, 0, MAVLINK_MSG_ID_RALLY_FETCH_POINT_LEN); - memcpy(rally_fetch_point, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_rally_point.h b/ardupilotmega/mavlink_msg_rally_point.h deleted file mode 100644 index 1d214d9ac..000000000 --- a/ardupilotmega/mavlink_msg_rally_point.h +++ /dev/null @@ -1,438 +0,0 @@ -#pragma once -// MESSAGE RALLY_POINT PACKING - -#define MAVLINK_MSG_ID_RALLY_POINT 175 - - -typedef struct __mavlink_rally_point_t { - int32_t lat; /*< [degE7] Latitude of point.*/ - int32_t lng; /*< [degE7] Longitude of point.*/ - int16_t alt; /*< [m] Transit / loiter altitude relative to home.*/ - int16_t break_alt; /*< [m] Break altitude relative to home.*/ - uint16_t land_dir; /*< [cdeg] Heading to aim for when landing.*/ - uint8_t target_system; /*< System ID.*/ - uint8_t target_component; /*< Component ID.*/ - uint8_t idx; /*< Point index (first point is 0).*/ - uint8_t count; /*< Total number of points (for sanity checking).*/ - uint8_t flags; /*< Configuration flags.*/ -} mavlink_rally_point_t; - -#define MAVLINK_MSG_ID_RALLY_POINT_LEN 19 -#define MAVLINK_MSG_ID_RALLY_POINT_MIN_LEN 19 -#define MAVLINK_MSG_ID_175_LEN 19 -#define MAVLINK_MSG_ID_175_MIN_LEN 19 - -#define MAVLINK_MSG_ID_RALLY_POINT_CRC 138 -#define MAVLINK_MSG_ID_175_CRC 138 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_RALLY_POINT { \ - 175, \ - "RALLY_POINT", \ - 10, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 14, offsetof(mavlink_rally_point_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 15, offsetof(mavlink_rally_point_t, target_component) }, \ - { "idx", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_rally_point_t, idx) }, \ - { "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 17, offsetof(mavlink_rally_point_t, count) }, \ - { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_rally_point_t, lat) }, \ - { "lng", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_rally_point_t, lng) }, \ - { "alt", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_rally_point_t, alt) }, \ - { "break_alt", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_rally_point_t, break_alt) }, \ - { "land_dir", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_rally_point_t, land_dir) }, \ - { "flags", NULL, MAVLINK_TYPE_UINT8_T, 0, 18, offsetof(mavlink_rally_point_t, flags) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_RALLY_POINT { \ - "RALLY_POINT", \ - 10, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 14, offsetof(mavlink_rally_point_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 15, offsetof(mavlink_rally_point_t, target_component) }, \ - { "idx", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_rally_point_t, idx) }, \ - { "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 17, offsetof(mavlink_rally_point_t, count) }, \ - { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_rally_point_t, lat) }, \ - { "lng", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_rally_point_t, lng) }, \ - { "alt", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_rally_point_t, alt) }, \ - { "break_alt", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_rally_point_t, break_alt) }, \ - { "land_dir", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_rally_point_t, land_dir) }, \ - { "flags", NULL, MAVLINK_TYPE_UINT8_T, 0, 18, offsetof(mavlink_rally_point_t, flags) }, \ - } \ -} -#endif - -/** - * @brief Pack a rally_point message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param target_system System ID. - * @param target_component Component ID. - * @param idx Point index (first point is 0). - * @param count Total number of points (for sanity checking). - * @param lat [degE7] Latitude of point. - * @param lng [degE7] Longitude of point. - * @param alt [m] Transit / loiter altitude relative to home. - * @param break_alt [m] Break altitude relative to home. - * @param land_dir [cdeg] Heading to aim for when landing. - * @param flags Configuration flags. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_rally_point_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, uint8_t idx, uint8_t count, int32_t lat, int32_t lng, int16_t alt, int16_t break_alt, uint16_t land_dir, uint8_t flags) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_RALLY_POINT_LEN]; - _mav_put_int32_t(buf, 0, lat); - _mav_put_int32_t(buf, 4, lng); - _mav_put_int16_t(buf, 8, alt); - _mav_put_int16_t(buf, 10, break_alt); - _mav_put_uint16_t(buf, 12, land_dir); - _mav_put_uint8_t(buf, 14, target_system); - _mav_put_uint8_t(buf, 15, target_component); - _mav_put_uint8_t(buf, 16, idx); - _mav_put_uint8_t(buf, 17, count); - _mav_put_uint8_t(buf, 18, flags); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RALLY_POINT_LEN); -#else - mavlink_rally_point_t packet; - packet.lat = lat; - packet.lng = lng; - packet.alt = alt; - packet.break_alt = break_alt; - packet.land_dir = land_dir; - packet.target_system = target_system; - packet.target_component = target_component; - packet.idx = idx; - packet.count = count; - packet.flags = flags; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RALLY_POINT_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_RALLY_POINT; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RALLY_POINT_MIN_LEN, MAVLINK_MSG_ID_RALLY_POINT_LEN, MAVLINK_MSG_ID_RALLY_POINT_CRC); -} - -/** - * @brief Pack a rally_point message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param target_system System ID. - * @param target_component Component ID. - * @param idx Point index (first point is 0). - * @param count Total number of points (for sanity checking). - * @param lat [degE7] Latitude of point. - * @param lng [degE7] Longitude of point. - * @param alt [m] Transit / loiter altitude relative to home. - * @param break_alt [m] Break altitude relative to home. - * @param land_dir [cdeg] Heading to aim for when landing. - * @param flags Configuration flags. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_rally_point_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,uint8_t idx,uint8_t count,int32_t lat,int32_t lng,int16_t alt,int16_t break_alt,uint16_t land_dir,uint8_t flags) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_RALLY_POINT_LEN]; - _mav_put_int32_t(buf, 0, lat); - _mav_put_int32_t(buf, 4, lng); - _mav_put_int16_t(buf, 8, alt); - _mav_put_int16_t(buf, 10, break_alt); - _mav_put_uint16_t(buf, 12, land_dir); - _mav_put_uint8_t(buf, 14, target_system); - _mav_put_uint8_t(buf, 15, target_component); - _mav_put_uint8_t(buf, 16, idx); - _mav_put_uint8_t(buf, 17, count); - _mav_put_uint8_t(buf, 18, flags); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RALLY_POINT_LEN); -#else - mavlink_rally_point_t packet; - packet.lat = lat; - packet.lng = lng; - packet.alt = alt; - packet.break_alt = break_alt; - packet.land_dir = land_dir; - packet.target_system = target_system; - packet.target_component = target_component; - packet.idx = idx; - packet.count = count; - packet.flags = flags; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RALLY_POINT_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_RALLY_POINT; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_RALLY_POINT_MIN_LEN, MAVLINK_MSG_ID_RALLY_POINT_LEN, MAVLINK_MSG_ID_RALLY_POINT_CRC); -} - -/** - * @brief Encode a rally_point struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param rally_point C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_rally_point_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_rally_point_t* rally_point) -{ - return mavlink_msg_rally_point_pack(system_id, component_id, msg, rally_point->target_system, rally_point->target_component, rally_point->idx, rally_point->count, rally_point->lat, rally_point->lng, rally_point->alt, rally_point->break_alt, rally_point->land_dir, rally_point->flags); -} - -/** - * @brief Encode a rally_point struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param rally_point C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_rally_point_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_rally_point_t* rally_point) -{ - return mavlink_msg_rally_point_pack_chan(system_id, component_id, chan, msg, rally_point->target_system, rally_point->target_component, rally_point->idx, rally_point->count, rally_point->lat, rally_point->lng, rally_point->alt, rally_point->break_alt, rally_point->land_dir, rally_point->flags); -} - -/** - * @brief Send a rally_point message - * @param chan MAVLink channel to send the message - * - * @param target_system System ID. - * @param target_component Component ID. - * @param idx Point index (first point is 0). - * @param count Total number of points (for sanity checking). - * @param lat [degE7] Latitude of point. - * @param lng [degE7] Longitude of point. - * @param alt [m] Transit / loiter altitude relative to home. - * @param break_alt [m] Break altitude relative to home. - * @param land_dir [cdeg] Heading to aim for when landing. - * @param flags Configuration flags. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_rally_point_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t idx, uint8_t count, int32_t lat, int32_t lng, int16_t alt, int16_t break_alt, uint16_t land_dir, uint8_t flags) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_RALLY_POINT_LEN]; - _mav_put_int32_t(buf, 0, lat); - _mav_put_int32_t(buf, 4, lng); - _mav_put_int16_t(buf, 8, alt); - _mav_put_int16_t(buf, 10, break_alt); - _mav_put_uint16_t(buf, 12, land_dir); - _mav_put_uint8_t(buf, 14, target_system); - _mav_put_uint8_t(buf, 15, target_component); - _mav_put_uint8_t(buf, 16, idx); - _mav_put_uint8_t(buf, 17, count); - _mav_put_uint8_t(buf, 18, flags); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RALLY_POINT, buf, MAVLINK_MSG_ID_RALLY_POINT_MIN_LEN, MAVLINK_MSG_ID_RALLY_POINT_LEN, MAVLINK_MSG_ID_RALLY_POINT_CRC); -#else - mavlink_rally_point_t packet; - packet.lat = lat; - packet.lng = lng; - packet.alt = alt; - packet.break_alt = break_alt; - packet.land_dir = land_dir; - packet.target_system = target_system; - packet.target_component = target_component; - packet.idx = idx; - packet.count = count; - packet.flags = flags; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RALLY_POINT, (const char *)&packet, MAVLINK_MSG_ID_RALLY_POINT_MIN_LEN, MAVLINK_MSG_ID_RALLY_POINT_LEN, MAVLINK_MSG_ID_RALLY_POINT_CRC); -#endif -} - -/** - * @brief Send a rally_point message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_rally_point_send_struct(mavlink_channel_t chan, const mavlink_rally_point_t* rally_point) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_rally_point_send(chan, rally_point->target_system, rally_point->target_component, rally_point->idx, rally_point->count, rally_point->lat, rally_point->lng, rally_point->alt, rally_point->break_alt, rally_point->land_dir, rally_point->flags); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RALLY_POINT, (const char *)rally_point, MAVLINK_MSG_ID_RALLY_POINT_MIN_LEN, MAVLINK_MSG_ID_RALLY_POINT_LEN, MAVLINK_MSG_ID_RALLY_POINT_CRC); -#endif -} - -#if MAVLINK_MSG_ID_RALLY_POINT_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_rally_point_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t idx, uint8_t count, int32_t lat, int32_t lng, int16_t alt, int16_t break_alt, uint16_t land_dir, uint8_t flags) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_int32_t(buf, 0, lat); - _mav_put_int32_t(buf, 4, lng); - _mav_put_int16_t(buf, 8, alt); - _mav_put_int16_t(buf, 10, break_alt); - _mav_put_uint16_t(buf, 12, land_dir); - _mav_put_uint8_t(buf, 14, target_system); - _mav_put_uint8_t(buf, 15, target_component); - _mav_put_uint8_t(buf, 16, idx); - _mav_put_uint8_t(buf, 17, count); - _mav_put_uint8_t(buf, 18, flags); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RALLY_POINT, buf, MAVLINK_MSG_ID_RALLY_POINT_MIN_LEN, MAVLINK_MSG_ID_RALLY_POINT_LEN, MAVLINK_MSG_ID_RALLY_POINT_CRC); -#else - mavlink_rally_point_t *packet = (mavlink_rally_point_t *)msgbuf; - packet->lat = lat; - packet->lng = lng; - packet->alt = alt; - packet->break_alt = break_alt; - packet->land_dir = land_dir; - packet->target_system = target_system; - packet->target_component = target_component; - packet->idx = idx; - packet->count = count; - packet->flags = flags; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RALLY_POINT, (const char *)packet, MAVLINK_MSG_ID_RALLY_POINT_MIN_LEN, MAVLINK_MSG_ID_RALLY_POINT_LEN, MAVLINK_MSG_ID_RALLY_POINT_CRC); -#endif -} -#endif - -#endif - -// MESSAGE RALLY_POINT UNPACKING - - -/** - * @brief Get field target_system from rally_point message - * - * @return System ID. - */ -static inline uint8_t mavlink_msg_rally_point_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 14); -} - -/** - * @brief Get field target_component from rally_point message - * - * @return Component ID. - */ -static inline uint8_t mavlink_msg_rally_point_get_target_component(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 15); -} - -/** - * @brief Get field idx from rally_point message - * - * @return Point index (first point is 0). - */ -static inline uint8_t mavlink_msg_rally_point_get_idx(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 16); -} - -/** - * @brief Get field count from rally_point message - * - * @return Total number of points (for sanity checking). - */ -static inline uint8_t mavlink_msg_rally_point_get_count(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 17); -} - -/** - * @brief Get field lat from rally_point message - * - * @return [degE7] Latitude of point. - */ -static inline int32_t mavlink_msg_rally_point_get_lat(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 0); -} - -/** - * @brief Get field lng from rally_point message - * - * @return [degE7] Longitude of point. - */ -static inline int32_t mavlink_msg_rally_point_get_lng(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 4); -} - -/** - * @brief Get field alt from rally_point message - * - * @return [m] Transit / loiter altitude relative to home. - */ -static inline int16_t mavlink_msg_rally_point_get_alt(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 8); -} - -/** - * @brief Get field break_alt from rally_point message - * - * @return [m] Break altitude relative to home. - */ -static inline int16_t mavlink_msg_rally_point_get_break_alt(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 10); -} - -/** - * @brief Get field land_dir from rally_point message - * - * @return [cdeg] Heading to aim for when landing. - */ -static inline uint16_t mavlink_msg_rally_point_get_land_dir(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 12); -} - -/** - * @brief Get field flags from rally_point message - * - * @return Configuration flags. - */ -static inline uint8_t mavlink_msg_rally_point_get_flags(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 18); -} - -/** - * @brief Decode a rally_point message into a struct - * - * @param msg The message to decode - * @param rally_point C-struct to decode the message contents into - */ -static inline void mavlink_msg_rally_point_decode(const mavlink_message_t* msg, mavlink_rally_point_t* rally_point) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - rally_point->lat = mavlink_msg_rally_point_get_lat(msg); - rally_point->lng = mavlink_msg_rally_point_get_lng(msg); - rally_point->alt = mavlink_msg_rally_point_get_alt(msg); - rally_point->break_alt = mavlink_msg_rally_point_get_break_alt(msg); - rally_point->land_dir = mavlink_msg_rally_point_get_land_dir(msg); - rally_point->target_system = mavlink_msg_rally_point_get_target_system(msg); - rally_point->target_component = mavlink_msg_rally_point_get_target_component(msg); - rally_point->idx = mavlink_msg_rally_point_get_idx(msg); - rally_point->count = mavlink_msg_rally_point_get_count(msg); - rally_point->flags = mavlink_msg_rally_point_get_flags(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_RALLY_POINT_LEN? msg->len : MAVLINK_MSG_ID_RALLY_POINT_LEN; - memset(rally_point, 0, MAVLINK_MSG_ID_RALLY_POINT_LEN); - memcpy(rally_point, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_rangefinder.h b/ardupilotmega/mavlink_msg_rangefinder.h deleted file mode 100644 index b75fedf20..000000000 --- a/ardupilotmega/mavlink_msg_rangefinder.h +++ /dev/null @@ -1,238 +0,0 @@ -#pragma once -// MESSAGE RANGEFINDER PACKING - -#define MAVLINK_MSG_ID_RANGEFINDER 173 - - -typedef struct __mavlink_rangefinder_t { - float distance; /*< [m] Distance.*/ - float voltage; /*< [V] Raw voltage if available, zero otherwise.*/ -} mavlink_rangefinder_t; - -#define MAVLINK_MSG_ID_RANGEFINDER_LEN 8 -#define MAVLINK_MSG_ID_RANGEFINDER_MIN_LEN 8 -#define MAVLINK_MSG_ID_173_LEN 8 -#define MAVLINK_MSG_ID_173_MIN_LEN 8 - -#define MAVLINK_MSG_ID_RANGEFINDER_CRC 83 -#define MAVLINK_MSG_ID_173_CRC 83 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_RANGEFINDER { \ - 173, \ - "RANGEFINDER", \ - 2, \ - { { "distance", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_rangefinder_t, distance) }, \ - { "voltage", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_rangefinder_t, voltage) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_RANGEFINDER { \ - "RANGEFINDER", \ - 2, \ - { { "distance", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_rangefinder_t, distance) }, \ - { "voltage", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_rangefinder_t, voltage) }, \ - } \ -} -#endif - -/** - * @brief Pack a rangefinder message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param distance [m] Distance. - * @param voltage [V] Raw voltage if available, zero otherwise. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_rangefinder_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - float distance, float voltage) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_RANGEFINDER_LEN]; - _mav_put_float(buf, 0, distance); - _mav_put_float(buf, 4, voltage); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RANGEFINDER_LEN); -#else - mavlink_rangefinder_t packet; - packet.distance = distance; - packet.voltage = voltage; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RANGEFINDER_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_RANGEFINDER; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RANGEFINDER_MIN_LEN, MAVLINK_MSG_ID_RANGEFINDER_LEN, MAVLINK_MSG_ID_RANGEFINDER_CRC); -} - -/** - * @brief Pack a rangefinder message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param distance [m] Distance. - * @param voltage [V] Raw voltage if available, zero otherwise. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_rangefinder_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - float distance,float voltage) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_RANGEFINDER_LEN]; - _mav_put_float(buf, 0, distance); - _mav_put_float(buf, 4, voltage); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RANGEFINDER_LEN); -#else - mavlink_rangefinder_t packet; - packet.distance = distance; - packet.voltage = voltage; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RANGEFINDER_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_RANGEFINDER; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_RANGEFINDER_MIN_LEN, MAVLINK_MSG_ID_RANGEFINDER_LEN, MAVLINK_MSG_ID_RANGEFINDER_CRC); -} - -/** - * @brief Encode a rangefinder struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param rangefinder C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_rangefinder_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_rangefinder_t* rangefinder) -{ - return mavlink_msg_rangefinder_pack(system_id, component_id, msg, rangefinder->distance, rangefinder->voltage); -} - -/** - * @brief Encode a rangefinder struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param rangefinder C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_rangefinder_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_rangefinder_t* rangefinder) -{ - return mavlink_msg_rangefinder_pack_chan(system_id, component_id, chan, msg, rangefinder->distance, rangefinder->voltage); -} - -/** - * @brief Send a rangefinder message - * @param chan MAVLink channel to send the message - * - * @param distance [m] Distance. - * @param voltage [V] Raw voltage if available, zero otherwise. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_rangefinder_send(mavlink_channel_t chan, float distance, float voltage) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_RANGEFINDER_LEN]; - _mav_put_float(buf, 0, distance); - _mav_put_float(buf, 4, voltage); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RANGEFINDER, buf, MAVLINK_MSG_ID_RANGEFINDER_MIN_LEN, MAVLINK_MSG_ID_RANGEFINDER_LEN, MAVLINK_MSG_ID_RANGEFINDER_CRC); -#else - mavlink_rangefinder_t packet; - packet.distance = distance; - packet.voltage = voltage; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RANGEFINDER, (const char *)&packet, MAVLINK_MSG_ID_RANGEFINDER_MIN_LEN, MAVLINK_MSG_ID_RANGEFINDER_LEN, MAVLINK_MSG_ID_RANGEFINDER_CRC); -#endif -} - -/** - * @brief Send a rangefinder message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_rangefinder_send_struct(mavlink_channel_t chan, const mavlink_rangefinder_t* rangefinder) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_rangefinder_send(chan, rangefinder->distance, rangefinder->voltage); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RANGEFINDER, (const char *)rangefinder, MAVLINK_MSG_ID_RANGEFINDER_MIN_LEN, MAVLINK_MSG_ID_RANGEFINDER_LEN, MAVLINK_MSG_ID_RANGEFINDER_CRC); -#endif -} - -#if MAVLINK_MSG_ID_RANGEFINDER_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_rangefinder_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, float distance, float voltage) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_float(buf, 0, distance); - _mav_put_float(buf, 4, voltage); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RANGEFINDER, buf, MAVLINK_MSG_ID_RANGEFINDER_MIN_LEN, MAVLINK_MSG_ID_RANGEFINDER_LEN, MAVLINK_MSG_ID_RANGEFINDER_CRC); -#else - mavlink_rangefinder_t *packet = (mavlink_rangefinder_t *)msgbuf; - packet->distance = distance; - packet->voltage = voltage; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RANGEFINDER, (const char *)packet, MAVLINK_MSG_ID_RANGEFINDER_MIN_LEN, MAVLINK_MSG_ID_RANGEFINDER_LEN, MAVLINK_MSG_ID_RANGEFINDER_CRC); -#endif -} -#endif - -#endif - -// MESSAGE RANGEFINDER UNPACKING - - -/** - * @brief Get field distance from rangefinder message - * - * @return [m] Distance. - */ -static inline float mavlink_msg_rangefinder_get_distance(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 0); -} - -/** - * @brief Get field voltage from rangefinder message - * - * @return [V] Raw voltage if available, zero otherwise. - */ -static inline float mavlink_msg_rangefinder_get_voltage(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 4); -} - -/** - * @brief Decode a rangefinder message into a struct - * - * @param msg The message to decode - * @param rangefinder C-struct to decode the message contents into - */ -static inline void mavlink_msg_rangefinder_decode(const mavlink_message_t* msg, mavlink_rangefinder_t* rangefinder) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - rangefinder->distance = mavlink_msg_rangefinder_get_distance(msg); - rangefinder->voltage = mavlink_msg_rangefinder_get_voltage(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_RANGEFINDER_LEN? msg->len : MAVLINK_MSG_ID_RANGEFINDER_LEN; - memset(rangefinder, 0, MAVLINK_MSG_ID_RANGEFINDER_LEN); - memcpy(rangefinder, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_remote_log_block_status.h b/ardupilotmega/mavlink_msg_remote_log_block_status.h deleted file mode 100644 index 1a8f0eab3..000000000 --- a/ardupilotmega/mavlink_msg_remote_log_block_status.h +++ /dev/null @@ -1,288 +0,0 @@ -#pragma once -// MESSAGE REMOTE_LOG_BLOCK_STATUS PACKING - -#define MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS 185 - - -typedef struct __mavlink_remote_log_block_status_t { - uint32_t seqno; /*< Log data block sequence number.*/ - uint8_t target_system; /*< System ID.*/ - uint8_t target_component; /*< Component ID.*/ - uint8_t status; /*< Log data block status.*/ -} mavlink_remote_log_block_status_t; - -#define MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_LEN 7 -#define MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_MIN_LEN 7 -#define MAVLINK_MSG_ID_185_LEN 7 -#define MAVLINK_MSG_ID_185_MIN_LEN 7 - -#define MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_CRC 186 -#define MAVLINK_MSG_ID_185_CRC 186 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_REMOTE_LOG_BLOCK_STATUS { \ - 185, \ - "REMOTE_LOG_BLOCK_STATUS", \ - 4, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_remote_log_block_status_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_remote_log_block_status_t, target_component) }, \ - { "seqno", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_remote_log_block_status_t, seqno) }, \ - { "status", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_remote_log_block_status_t, status) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_REMOTE_LOG_BLOCK_STATUS { \ - "REMOTE_LOG_BLOCK_STATUS", \ - 4, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_remote_log_block_status_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_remote_log_block_status_t, target_component) }, \ - { "seqno", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_remote_log_block_status_t, seqno) }, \ - { "status", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_remote_log_block_status_t, status) }, \ - } \ -} -#endif - -/** - * @brief Pack a remote_log_block_status message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param target_system System ID. - * @param target_component Component ID. - * @param seqno Log data block sequence number. - * @param status Log data block status. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_remote_log_block_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, uint32_t seqno, uint8_t status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_LEN]; - _mav_put_uint32_t(buf, 0, seqno); - _mav_put_uint8_t(buf, 4, target_system); - _mav_put_uint8_t(buf, 5, target_component); - _mav_put_uint8_t(buf, 6, status); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_LEN); -#else - mavlink_remote_log_block_status_t packet; - packet.seqno = seqno; - packet.target_system = target_system; - packet.target_component = target_component; - packet.status = status; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_MIN_LEN, MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_LEN, MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_CRC); -} - -/** - * @brief Pack a remote_log_block_status message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param target_system System ID. - * @param target_component Component ID. - * @param seqno Log data block sequence number. - * @param status Log data block status. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_remote_log_block_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,uint32_t seqno,uint8_t status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_LEN]; - _mav_put_uint32_t(buf, 0, seqno); - _mav_put_uint8_t(buf, 4, target_system); - _mav_put_uint8_t(buf, 5, target_component); - _mav_put_uint8_t(buf, 6, status); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_LEN); -#else - mavlink_remote_log_block_status_t packet; - packet.seqno = seqno; - packet.target_system = target_system; - packet.target_component = target_component; - packet.status = status; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_MIN_LEN, MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_LEN, MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_CRC); -} - -/** - * @brief Encode a remote_log_block_status struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param remote_log_block_status C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_remote_log_block_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_remote_log_block_status_t* remote_log_block_status) -{ - return mavlink_msg_remote_log_block_status_pack(system_id, component_id, msg, remote_log_block_status->target_system, remote_log_block_status->target_component, remote_log_block_status->seqno, remote_log_block_status->status); -} - -/** - * @brief Encode a remote_log_block_status struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param remote_log_block_status C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_remote_log_block_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_remote_log_block_status_t* remote_log_block_status) -{ - return mavlink_msg_remote_log_block_status_pack_chan(system_id, component_id, chan, msg, remote_log_block_status->target_system, remote_log_block_status->target_component, remote_log_block_status->seqno, remote_log_block_status->status); -} - -/** - * @brief Send a remote_log_block_status message - * @param chan MAVLink channel to send the message - * - * @param target_system System ID. - * @param target_component Component ID. - * @param seqno Log data block sequence number. - * @param status Log data block status. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_remote_log_block_status_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint32_t seqno, uint8_t status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_LEN]; - _mav_put_uint32_t(buf, 0, seqno); - _mav_put_uint8_t(buf, 4, target_system); - _mav_put_uint8_t(buf, 5, target_component); - _mav_put_uint8_t(buf, 6, status); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS, buf, MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_MIN_LEN, MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_LEN, MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_CRC); -#else - mavlink_remote_log_block_status_t packet; - packet.seqno = seqno; - packet.target_system = target_system; - packet.target_component = target_component; - packet.status = status; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS, (const char *)&packet, MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_MIN_LEN, MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_LEN, MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_CRC); -#endif -} - -/** - * @brief Send a remote_log_block_status message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_remote_log_block_status_send_struct(mavlink_channel_t chan, const mavlink_remote_log_block_status_t* remote_log_block_status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_remote_log_block_status_send(chan, remote_log_block_status->target_system, remote_log_block_status->target_component, remote_log_block_status->seqno, remote_log_block_status->status); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS, (const char *)remote_log_block_status, MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_MIN_LEN, MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_LEN, MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_CRC); -#endif -} - -#if MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_remote_log_block_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint32_t seqno, uint8_t status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint32_t(buf, 0, seqno); - _mav_put_uint8_t(buf, 4, target_system); - _mav_put_uint8_t(buf, 5, target_component); - _mav_put_uint8_t(buf, 6, status); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS, buf, MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_MIN_LEN, MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_LEN, MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_CRC); -#else - mavlink_remote_log_block_status_t *packet = (mavlink_remote_log_block_status_t *)msgbuf; - packet->seqno = seqno; - packet->target_system = target_system; - packet->target_component = target_component; - packet->status = status; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS, (const char *)packet, MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_MIN_LEN, MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_LEN, MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_CRC); -#endif -} -#endif - -#endif - -// MESSAGE REMOTE_LOG_BLOCK_STATUS UNPACKING - - -/** - * @brief Get field target_system from remote_log_block_status message - * - * @return System ID. - */ -static inline uint8_t mavlink_msg_remote_log_block_status_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 4); -} - -/** - * @brief Get field target_component from remote_log_block_status message - * - * @return Component ID. - */ -static inline uint8_t mavlink_msg_remote_log_block_status_get_target_component(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 5); -} - -/** - * @brief Get field seqno from remote_log_block_status message - * - * @return Log data block sequence number. - */ -static inline uint32_t mavlink_msg_remote_log_block_status_get_seqno(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 0); -} - -/** - * @brief Get field status from remote_log_block_status message - * - * @return Log data block status. - */ -static inline uint8_t mavlink_msg_remote_log_block_status_get_status(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 6); -} - -/** - * @brief Decode a remote_log_block_status message into a struct - * - * @param msg The message to decode - * @param remote_log_block_status C-struct to decode the message contents into - */ -static inline void mavlink_msg_remote_log_block_status_decode(const mavlink_message_t* msg, mavlink_remote_log_block_status_t* remote_log_block_status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - remote_log_block_status->seqno = mavlink_msg_remote_log_block_status_get_seqno(msg); - remote_log_block_status->target_system = mavlink_msg_remote_log_block_status_get_target_system(msg); - remote_log_block_status->target_component = mavlink_msg_remote_log_block_status_get_target_component(msg); - remote_log_block_status->status = mavlink_msg_remote_log_block_status_get_status(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_LEN? msg->len : MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_LEN; - memset(remote_log_block_status, 0, MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_LEN); - memcpy(remote_log_block_status, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_remote_log_data_block.h b/ardupilotmega/mavlink_msg_remote_log_data_block.h deleted file mode 100644 index 2ed0ce6f0..000000000 --- a/ardupilotmega/mavlink_msg_remote_log_data_block.h +++ /dev/null @@ -1,280 +0,0 @@ -#pragma once -// MESSAGE REMOTE_LOG_DATA_BLOCK PACKING - -#define MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK 184 - - -typedef struct __mavlink_remote_log_data_block_t { - uint32_t seqno; /*< Log data block sequence number.*/ - uint8_t target_system; /*< System ID.*/ - uint8_t target_component; /*< Component ID.*/ - uint8_t data[200]; /*< Log data block.*/ -} mavlink_remote_log_data_block_t; - -#define MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_LEN 206 -#define MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_MIN_LEN 206 -#define MAVLINK_MSG_ID_184_LEN 206 -#define MAVLINK_MSG_ID_184_MIN_LEN 206 - -#define MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_CRC 159 -#define MAVLINK_MSG_ID_184_CRC 159 - -#define MAVLINK_MSG_REMOTE_LOG_DATA_BLOCK_FIELD_DATA_LEN 200 - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_REMOTE_LOG_DATA_BLOCK { \ - 184, \ - "REMOTE_LOG_DATA_BLOCK", \ - 4, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_remote_log_data_block_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_remote_log_data_block_t, target_component) }, \ - { "seqno", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_remote_log_data_block_t, seqno) }, \ - { "data", NULL, MAVLINK_TYPE_UINT8_T, 200, 6, offsetof(mavlink_remote_log_data_block_t, data) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_REMOTE_LOG_DATA_BLOCK { \ - "REMOTE_LOG_DATA_BLOCK", \ - 4, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_remote_log_data_block_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_remote_log_data_block_t, target_component) }, \ - { "seqno", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_remote_log_data_block_t, seqno) }, \ - { "data", NULL, MAVLINK_TYPE_UINT8_T, 200, 6, offsetof(mavlink_remote_log_data_block_t, data) }, \ - } \ -} -#endif - -/** - * @brief Pack a remote_log_data_block message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param target_system System ID. - * @param target_component Component ID. - * @param seqno Log data block sequence number. - * @param data Log data block. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_remote_log_data_block_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, uint32_t seqno, const uint8_t *data) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_LEN]; - _mav_put_uint32_t(buf, 0, seqno); - _mav_put_uint8_t(buf, 4, target_system); - _mav_put_uint8_t(buf, 5, target_component); - _mav_put_uint8_t_array(buf, 6, data, 200); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_LEN); -#else - mavlink_remote_log_data_block_t packet; - packet.seqno = seqno; - packet.target_system = target_system; - packet.target_component = target_component; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*200); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_MIN_LEN, MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_LEN, MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_CRC); -} - -/** - * @brief Pack a remote_log_data_block message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param target_system System ID. - * @param target_component Component ID. - * @param seqno Log data block sequence number. - * @param data Log data block. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_remote_log_data_block_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,uint32_t seqno,const uint8_t *data) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_LEN]; - _mav_put_uint32_t(buf, 0, seqno); - _mav_put_uint8_t(buf, 4, target_system); - _mav_put_uint8_t(buf, 5, target_component); - _mav_put_uint8_t_array(buf, 6, data, 200); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_LEN); -#else - mavlink_remote_log_data_block_t packet; - packet.seqno = seqno; - packet.target_system = target_system; - packet.target_component = target_component; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*200); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_MIN_LEN, MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_LEN, MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_CRC); -} - -/** - * @brief Encode a remote_log_data_block struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param remote_log_data_block C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_remote_log_data_block_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_remote_log_data_block_t* remote_log_data_block) -{ - return mavlink_msg_remote_log_data_block_pack(system_id, component_id, msg, remote_log_data_block->target_system, remote_log_data_block->target_component, remote_log_data_block->seqno, remote_log_data_block->data); -} - -/** - * @brief Encode a remote_log_data_block struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param remote_log_data_block C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_remote_log_data_block_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_remote_log_data_block_t* remote_log_data_block) -{ - return mavlink_msg_remote_log_data_block_pack_chan(system_id, component_id, chan, msg, remote_log_data_block->target_system, remote_log_data_block->target_component, remote_log_data_block->seqno, remote_log_data_block->data); -} - -/** - * @brief Send a remote_log_data_block message - * @param chan MAVLink channel to send the message - * - * @param target_system System ID. - * @param target_component Component ID. - * @param seqno Log data block sequence number. - * @param data Log data block. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_remote_log_data_block_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint32_t seqno, const uint8_t *data) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_LEN]; - _mav_put_uint32_t(buf, 0, seqno); - _mav_put_uint8_t(buf, 4, target_system); - _mav_put_uint8_t(buf, 5, target_component); - _mav_put_uint8_t_array(buf, 6, data, 200); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK, buf, MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_MIN_LEN, MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_LEN, MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_CRC); -#else - mavlink_remote_log_data_block_t packet; - packet.seqno = seqno; - packet.target_system = target_system; - packet.target_component = target_component; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*200); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK, (const char *)&packet, MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_MIN_LEN, MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_LEN, MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_CRC); -#endif -} - -/** - * @brief Send a remote_log_data_block message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_remote_log_data_block_send_struct(mavlink_channel_t chan, const mavlink_remote_log_data_block_t* remote_log_data_block) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_remote_log_data_block_send(chan, remote_log_data_block->target_system, remote_log_data_block->target_component, remote_log_data_block->seqno, remote_log_data_block->data); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK, (const char *)remote_log_data_block, MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_MIN_LEN, MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_LEN, MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_CRC); -#endif -} - -#if MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_remote_log_data_block_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint32_t seqno, const uint8_t *data) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint32_t(buf, 0, seqno); - _mav_put_uint8_t(buf, 4, target_system); - _mav_put_uint8_t(buf, 5, target_component); - _mav_put_uint8_t_array(buf, 6, data, 200); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK, buf, MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_MIN_LEN, MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_LEN, MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_CRC); -#else - mavlink_remote_log_data_block_t *packet = (mavlink_remote_log_data_block_t *)msgbuf; - packet->seqno = seqno; - packet->target_system = target_system; - packet->target_component = target_component; - mav_array_memcpy(packet->data, data, sizeof(uint8_t)*200); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK, (const char *)packet, MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_MIN_LEN, MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_LEN, MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_CRC); -#endif -} -#endif - -#endif - -// MESSAGE REMOTE_LOG_DATA_BLOCK UNPACKING - - -/** - * @brief Get field target_system from remote_log_data_block message - * - * @return System ID. - */ -static inline uint8_t mavlink_msg_remote_log_data_block_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 4); -} - -/** - * @brief Get field target_component from remote_log_data_block message - * - * @return Component ID. - */ -static inline uint8_t mavlink_msg_remote_log_data_block_get_target_component(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 5); -} - -/** - * @brief Get field seqno from remote_log_data_block message - * - * @return Log data block sequence number. - */ -static inline uint32_t mavlink_msg_remote_log_data_block_get_seqno(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 0); -} - -/** - * @brief Get field data from remote_log_data_block message - * - * @return Log data block. - */ -static inline uint16_t mavlink_msg_remote_log_data_block_get_data(const mavlink_message_t* msg, uint8_t *data) -{ - return _MAV_RETURN_uint8_t_array(msg, data, 200, 6); -} - -/** - * @brief Decode a remote_log_data_block message into a struct - * - * @param msg The message to decode - * @param remote_log_data_block C-struct to decode the message contents into - */ -static inline void mavlink_msg_remote_log_data_block_decode(const mavlink_message_t* msg, mavlink_remote_log_data_block_t* remote_log_data_block) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - remote_log_data_block->seqno = mavlink_msg_remote_log_data_block_get_seqno(msg); - remote_log_data_block->target_system = mavlink_msg_remote_log_data_block_get_target_system(msg); - remote_log_data_block->target_component = mavlink_msg_remote_log_data_block_get_target_component(msg); - mavlink_msg_remote_log_data_block_get_data(msg, remote_log_data_block->data); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_LEN? msg->len : MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_LEN; - memset(remote_log_data_block, 0, MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_LEN); - memcpy(remote_log_data_block, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_rpm.h b/ardupilotmega/mavlink_msg_rpm.h deleted file mode 100644 index 760658754..000000000 --- a/ardupilotmega/mavlink_msg_rpm.h +++ /dev/null @@ -1,238 +0,0 @@ -#pragma once -// MESSAGE RPM PACKING - -#define MAVLINK_MSG_ID_RPM 226 - - -typedef struct __mavlink_rpm_t { - float rpm1; /*< RPM Sensor1.*/ - float rpm2; /*< RPM Sensor2.*/ -} mavlink_rpm_t; - -#define MAVLINK_MSG_ID_RPM_LEN 8 -#define MAVLINK_MSG_ID_RPM_MIN_LEN 8 -#define MAVLINK_MSG_ID_226_LEN 8 -#define MAVLINK_MSG_ID_226_MIN_LEN 8 - -#define MAVLINK_MSG_ID_RPM_CRC 207 -#define MAVLINK_MSG_ID_226_CRC 207 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_RPM { \ - 226, \ - "RPM", \ - 2, \ - { { "rpm1", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_rpm_t, rpm1) }, \ - { "rpm2", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_rpm_t, rpm2) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_RPM { \ - "RPM", \ - 2, \ - { { "rpm1", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_rpm_t, rpm1) }, \ - { "rpm2", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_rpm_t, rpm2) }, \ - } \ -} -#endif - -/** - * @brief Pack a rpm message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param rpm1 RPM Sensor1. - * @param rpm2 RPM Sensor2. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_rpm_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - float rpm1, float rpm2) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_RPM_LEN]; - _mav_put_float(buf, 0, rpm1); - _mav_put_float(buf, 4, rpm2); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RPM_LEN); -#else - mavlink_rpm_t packet; - packet.rpm1 = rpm1; - packet.rpm2 = rpm2; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RPM_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_RPM; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RPM_MIN_LEN, MAVLINK_MSG_ID_RPM_LEN, MAVLINK_MSG_ID_RPM_CRC); -} - -/** - * @brief Pack a rpm message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param rpm1 RPM Sensor1. - * @param rpm2 RPM Sensor2. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_rpm_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - float rpm1,float rpm2) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_RPM_LEN]; - _mav_put_float(buf, 0, rpm1); - _mav_put_float(buf, 4, rpm2); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RPM_LEN); -#else - mavlink_rpm_t packet; - packet.rpm1 = rpm1; - packet.rpm2 = rpm2; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RPM_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_RPM; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_RPM_MIN_LEN, MAVLINK_MSG_ID_RPM_LEN, MAVLINK_MSG_ID_RPM_CRC); -} - -/** - * @brief Encode a rpm struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param rpm C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_rpm_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_rpm_t* rpm) -{ - return mavlink_msg_rpm_pack(system_id, component_id, msg, rpm->rpm1, rpm->rpm2); -} - -/** - * @brief Encode a rpm struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param rpm C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_rpm_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_rpm_t* rpm) -{ - return mavlink_msg_rpm_pack_chan(system_id, component_id, chan, msg, rpm->rpm1, rpm->rpm2); -} - -/** - * @brief Send a rpm message - * @param chan MAVLink channel to send the message - * - * @param rpm1 RPM Sensor1. - * @param rpm2 RPM Sensor2. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_rpm_send(mavlink_channel_t chan, float rpm1, float rpm2) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_RPM_LEN]; - _mav_put_float(buf, 0, rpm1); - _mav_put_float(buf, 4, rpm2); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RPM, buf, MAVLINK_MSG_ID_RPM_MIN_LEN, MAVLINK_MSG_ID_RPM_LEN, MAVLINK_MSG_ID_RPM_CRC); -#else - mavlink_rpm_t packet; - packet.rpm1 = rpm1; - packet.rpm2 = rpm2; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RPM, (const char *)&packet, MAVLINK_MSG_ID_RPM_MIN_LEN, MAVLINK_MSG_ID_RPM_LEN, MAVLINK_MSG_ID_RPM_CRC); -#endif -} - -/** - * @brief Send a rpm message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_rpm_send_struct(mavlink_channel_t chan, const mavlink_rpm_t* rpm) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_rpm_send(chan, rpm->rpm1, rpm->rpm2); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RPM, (const char *)rpm, MAVLINK_MSG_ID_RPM_MIN_LEN, MAVLINK_MSG_ID_RPM_LEN, MAVLINK_MSG_ID_RPM_CRC); -#endif -} - -#if MAVLINK_MSG_ID_RPM_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_rpm_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, float rpm1, float rpm2) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_float(buf, 0, rpm1); - _mav_put_float(buf, 4, rpm2); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RPM, buf, MAVLINK_MSG_ID_RPM_MIN_LEN, MAVLINK_MSG_ID_RPM_LEN, MAVLINK_MSG_ID_RPM_CRC); -#else - mavlink_rpm_t *packet = (mavlink_rpm_t *)msgbuf; - packet->rpm1 = rpm1; - packet->rpm2 = rpm2; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RPM, (const char *)packet, MAVLINK_MSG_ID_RPM_MIN_LEN, MAVLINK_MSG_ID_RPM_LEN, MAVLINK_MSG_ID_RPM_CRC); -#endif -} -#endif - -#endif - -// MESSAGE RPM UNPACKING - - -/** - * @brief Get field rpm1 from rpm message - * - * @return RPM Sensor1. - */ -static inline float mavlink_msg_rpm_get_rpm1(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 0); -} - -/** - * @brief Get field rpm2 from rpm message - * - * @return RPM Sensor2. - */ -static inline float mavlink_msg_rpm_get_rpm2(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 4); -} - -/** - * @brief Decode a rpm message into a struct - * - * @param msg The message to decode - * @param rpm C-struct to decode the message contents into - */ -static inline void mavlink_msg_rpm_decode(const mavlink_message_t* msg, mavlink_rpm_t* rpm) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - rpm->rpm1 = mavlink_msg_rpm_get_rpm1(msg); - rpm->rpm2 = mavlink_msg_rpm_get_rpm2(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_RPM_LEN? msg->len : MAVLINK_MSG_ID_RPM_LEN; - memset(rpm, 0, MAVLINK_MSG_ID_RPM_LEN); - memcpy(rpm, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_sensor_offsets.h b/ardupilotmega/mavlink_msg_sensor_offsets.h deleted file mode 100644 index 8de1894bf..000000000 --- a/ardupilotmega/mavlink_msg_sensor_offsets.h +++ /dev/null @@ -1,488 +0,0 @@ -#pragma once -// MESSAGE SENSOR_OFFSETS PACKING - -#define MAVLINK_MSG_ID_SENSOR_OFFSETS 150 - - -typedef struct __mavlink_sensor_offsets_t { - float mag_declination; /*< [rad] Magnetic declination.*/ - int32_t raw_press; /*< Raw pressure from barometer.*/ - int32_t raw_temp; /*< Raw temperature from barometer.*/ - float gyro_cal_x; /*< Gyro X calibration.*/ - float gyro_cal_y; /*< Gyro Y calibration.*/ - float gyro_cal_z; /*< Gyro Z calibration.*/ - float accel_cal_x; /*< Accel X calibration.*/ - float accel_cal_y; /*< Accel Y calibration.*/ - float accel_cal_z; /*< Accel Z calibration.*/ - int16_t mag_ofs_x; /*< Magnetometer X offset.*/ - int16_t mag_ofs_y; /*< Magnetometer Y offset.*/ - int16_t mag_ofs_z; /*< Magnetometer Z offset.*/ -} mavlink_sensor_offsets_t; - -#define MAVLINK_MSG_ID_SENSOR_OFFSETS_LEN 42 -#define MAVLINK_MSG_ID_SENSOR_OFFSETS_MIN_LEN 42 -#define MAVLINK_MSG_ID_150_LEN 42 -#define MAVLINK_MSG_ID_150_MIN_LEN 42 - -#define MAVLINK_MSG_ID_SENSOR_OFFSETS_CRC 134 -#define MAVLINK_MSG_ID_150_CRC 134 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_SENSOR_OFFSETS { \ - 150, \ - "SENSOR_OFFSETS", \ - 12, \ - { { "mag_ofs_x", NULL, MAVLINK_TYPE_INT16_T, 0, 36, offsetof(mavlink_sensor_offsets_t, mag_ofs_x) }, \ - { "mag_ofs_y", NULL, MAVLINK_TYPE_INT16_T, 0, 38, offsetof(mavlink_sensor_offsets_t, mag_ofs_y) }, \ - { "mag_ofs_z", NULL, MAVLINK_TYPE_INT16_T, 0, 40, offsetof(mavlink_sensor_offsets_t, mag_ofs_z) }, \ - { "mag_declination", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_sensor_offsets_t, mag_declination) }, \ - { "raw_press", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_sensor_offsets_t, raw_press) }, \ - { "raw_temp", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_sensor_offsets_t, raw_temp) }, \ - { "gyro_cal_x", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_sensor_offsets_t, gyro_cal_x) }, \ - { "gyro_cal_y", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_sensor_offsets_t, gyro_cal_y) }, \ - { "gyro_cal_z", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_sensor_offsets_t, gyro_cal_z) }, \ - { "accel_cal_x", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_sensor_offsets_t, accel_cal_x) }, \ - { "accel_cal_y", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_sensor_offsets_t, accel_cal_y) }, \ - { "accel_cal_z", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_sensor_offsets_t, accel_cal_z) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_SENSOR_OFFSETS { \ - "SENSOR_OFFSETS", \ - 12, \ - { { "mag_ofs_x", NULL, MAVLINK_TYPE_INT16_T, 0, 36, offsetof(mavlink_sensor_offsets_t, mag_ofs_x) }, \ - { "mag_ofs_y", NULL, MAVLINK_TYPE_INT16_T, 0, 38, offsetof(mavlink_sensor_offsets_t, mag_ofs_y) }, \ - { "mag_ofs_z", NULL, MAVLINK_TYPE_INT16_T, 0, 40, offsetof(mavlink_sensor_offsets_t, mag_ofs_z) }, \ - { "mag_declination", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_sensor_offsets_t, mag_declination) }, \ - { "raw_press", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_sensor_offsets_t, raw_press) }, \ - { "raw_temp", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_sensor_offsets_t, raw_temp) }, \ - { "gyro_cal_x", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_sensor_offsets_t, gyro_cal_x) }, \ - { "gyro_cal_y", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_sensor_offsets_t, gyro_cal_y) }, \ - { "gyro_cal_z", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_sensor_offsets_t, gyro_cal_z) }, \ - { "accel_cal_x", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_sensor_offsets_t, accel_cal_x) }, \ - { "accel_cal_y", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_sensor_offsets_t, accel_cal_y) }, \ - { "accel_cal_z", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_sensor_offsets_t, accel_cal_z) }, \ - } \ -} -#endif - -/** - * @brief Pack a sensor_offsets message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param mag_ofs_x Magnetometer X offset. - * @param mag_ofs_y Magnetometer Y offset. - * @param mag_ofs_z Magnetometer Z offset. - * @param mag_declination [rad] Magnetic declination. - * @param raw_press Raw pressure from barometer. - * @param raw_temp Raw temperature from barometer. - * @param gyro_cal_x Gyro X calibration. - * @param gyro_cal_y Gyro Y calibration. - * @param gyro_cal_z Gyro Z calibration. - * @param accel_cal_x Accel X calibration. - * @param accel_cal_y Accel Y calibration. - * @param accel_cal_z Accel Z calibration. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_sensor_offsets_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - int16_t mag_ofs_x, int16_t mag_ofs_y, int16_t mag_ofs_z, float mag_declination, int32_t raw_press, int32_t raw_temp, float gyro_cal_x, float gyro_cal_y, float gyro_cal_z, float accel_cal_x, float accel_cal_y, float accel_cal_z) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SENSOR_OFFSETS_LEN]; - _mav_put_float(buf, 0, mag_declination); - _mav_put_int32_t(buf, 4, raw_press); - _mav_put_int32_t(buf, 8, raw_temp); - _mav_put_float(buf, 12, gyro_cal_x); - _mav_put_float(buf, 16, gyro_cal_y); - _mav_put_float(buf, 20, gyro_cal_z); - _mav_put_float(buf, 24, accel_cal_x); - _mav_put_float(buf, 28, accel_cal_y); - _mav_put_float(buf, 32, accel_cal_z); - _mav_put_int16_t(buf, 36, mag_ofs_x); - _mav_put_int16_t(buf, 38, mag_ofs_y); - _mav_put_int16_t(buf, 40, mag_ofs_z); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SENSOR_OFFSETS_LEN); -#else - mavlink_sensor_offsets_t packet; - packet.mag_declination = mag_declination; - packet.raw_press = raw_press; - packet.raw_temp = raw_temp; - packet.gyro_cal_x = gyro_cal_x; - packet.gyro_cal_y = gyro_cal_y; - packet.gyro_cal_z = gyro_cal_z; - packet.accel_cal_x = accel_cal_x; - packet.accel_cal_y = accel_cal_y; - packet.accel_cal_z = accel_cal_z; - packet.mag_ofs_x = mag_ofs_x; - packet.mag_ofs_y = mag_ofs_y; - packet.mag_ofs_z = mag_ofs_z; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SENSOR_OFFSETS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SENSOR_OFFSETS; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SENSOR_OFFSETS_MIN_LEN, MAVLINK_MSG_ID_SENSOR_OFFSETS_LEN, MAVLINK_MSG_ID_SENSOR_OFFSETS_CRC); -} - -/** - * @brief Pack a sensor_offsets message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param mag_ofs_x Magnetometer X offset. - * @param mag_ofs_y Magnetometer Y offset. - * @param mag_ofs_z Magnetometer Z offset. - * @param mag_declination [rad] Magnetic declination. - * @param raw_press Raw pressure from barometer. - * @param raw_temp Raw temperature from barometer. - * @param gyro_cal_x Gyro X calibration. - * @param gyro_cal_y Gyro Y calibration. - * @param gyro_cal_z Gyro Z calibration. - * @param accel_cal_x Accel X calibration. - * @param accel_cal_y Accel Y calibration. - * @param accel_cal_z Accel Z calibration. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_sensor_offsets_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - int16_t mag_ofs_x,int16_t mag_ofs_y,int16_t mag_ofs_z,float mag_declination,int32_t raw_press,int32_t raw_temp,float gyro_cal_x,float gyro_cal_y,float gyro_cal_z,float accel_cal_x,float accel_cal_y,float accel_cal_z) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SENSOR_OFFSETS_LEN]; - _mav_put_float(buf, 0, mag_declination); - _mav_put_int32_t(buf, 4, raw_press); - _mav_put_int32_t(buf, 8, raw_temp); - _mav_put_float(buf, 12, gyro_cal_x); - _mav_put_float(buf, 16, gyro_cal_y); - _mav_put_float(buf, 20, gyro_cal_z); - _mav_put_float(buf, 24, accel_cal_x); - _mav_put_float(buf, 28, accel_cal_y); - _mav_put_float(buf, 32, accel_cal_z); - _mav_put_int16_t(buf, 36, mag_ofs_x); - _mav_put_int16_t(buf, 38, mag_ofs_y); - _mav_put_int16_t(buf, 40, mag_ofs_z); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SENSOR_OFFSETS_LEN); -#else - mavlink_sensor_offsets_t packet; - packet.mag_declination = mag_declination; - packet.raw_press = raw_press; - packet.raw_temp = raw_temp; - packet.gyro_cal_x = gyro_cal_x; - packet.gyro_cal_y = gyro_cal_y; - packet.gyro_cal_z = gyro_cal_z; - packet.accel_cal_x = accel_cal_x; - packet.accel_cal_y = accel_cal_y; - packet.accel_cal_z = accel_cal_z; - packet.mag_ofs_x = mag_ofs_x; - packet.mag_ofs_y = mag_ofs_y; - packet.mag_ofs_z = mag_ofs_z; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SENSOR_OFFSETS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SENSOR_OFFSETS; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SENSOR_OFFSETS_MIN_LEN, MAVLINK_MSG_ID_SENSOR_OFFSETS_LEN, MAVLINK_MSG_ID_SENSOR_OFFSETS_CRC); -} - -/** - * @brief Encode a sensor_offsets struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param sensor_offsets C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_sensor_offsets_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_sensor_offsets_t* sensor_offsets) -{ - return mavlink_msg_sensor_offsets_pack(system_id, component_id, msg, sensor_offsets->mag_ofs_x, sensor_offsets->mag_ofs_y, sensor_offsets->mag_ofs_z, sensor_offsets->mag_declination, sensor_offsets->raw_press, sensor_offsets->raw_temp, sensor_offsets->gyro_cal_x, sensor_offsets->gyro_cal_y, sensor_offsets->gyro_cal_z, sensor_offsets->accel_cal_x, sensor_offsets->accel_cal_y, sensor_offsets->accel_cal_z); -} - -/** - * @brief Encode a sensor_offsets struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param sensor_offsets C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_sensor_offsets_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_sensor_offsets_t* sensor_offsets) -{ - return mavlink_msg_sensor_offsets_pack_chan(system_id, component_id, chan, msg, sensor_offsets->mag_ofs_x, sensor_offsets->mag_ofs_y, sensor_offsets->mag_ofs_z, sensor_offsets->mag_declination, sensor_offsets->raw_press, sensor_offsets->raw_temp, sensor_offsets->gyro_cal_x, sensor_offsets->gyro_cal_y, sensor_offsets->gyro_cal_z, sensor_offsets->accel_cal_x, sensor_offsets->accel_cal_y, sensor_offsets->accel_cal_z); -} - -/** - * @brief Send a sensor_offsets message - * @param chan MAVLink channel to send the message - * - * @param mag_ofs_x Magnetometer X offset. - * @param mag_ofs_y Magnetometer Y offset. - * @param mag_ofs_z Magnetometer Z offset. - * @param mag_declination [rad] Magnetic declination. - * @param raw_press Raw pressure from barometer. - * @param raw_temp Raw temperature from barometer. - * @param gyro_cal_x Gyro X calibration. - * @param gyro_cal_y Gyro Y calibration. - * @param gyro_cal_z Gyro Z calibration. - * @param accel_cal_x Accel X calibration. - * @param accel_cal_y Accel Y calibration. - * @param accel_cal_z Accel Z calibration. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_sensor_offsets_send(mavlink_channel_t chan, int16_t mag_ofs_x, int16_t mag_ofs_y, int16_t mag_ofs_z, float mag_declination, int32_t raw_press, int32_t raw_temp, float gyro_cal_x, float gyro_cal_y, float gyro_cal_z, float accel_cal_x, float accel_cal_y, float accel_cal_z) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SENSOR_OFFSETS_LEN]; - _mav_put_float(buf, 0, mag_declination); - _mav_put_int32_t(buf, 4, raw_press); - _mav_put_int32_t(buf, 8, raw_temp); - _mav_put_float(buf, 12, gyro_cal_x); - _mav_put_float(buf, 16, gyro_cal_y); - _mav_put_float(buf, 20, gyro_cal_z); - _mav_put_float(buf, 24, accel_cal_x); - _mav_put_float(buf, 28, accel_cal_y); - _mav_put_float(buf, 32, accel_cal_z); - _mav_put_int16_t(buf, 36, mag_ofs_x); - _mav_put_int16_t(buf, 38, mag_ofs_y); - _mav_put_int16_t(buf, 40, mag_ofs_z); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENSOR_OFFSETS, buf, MAVLINK_MSG_ID_SENSOR_OFFSETS_MIN_LEN, MAVLINK_MSG_ID_SENSOR_OFFSETS_LEN, MAVLINK_MSG_ID_SENSOR_OFFSETS_CRC); -#else - mavlink_sensor_offsets_t packet; - packet.mag_declination = mag_declination; - packet.raw_press = raw_press; - packet.raw_temp = raw_temp; - packet.gyro_cal_x = gyro_cal_x; - packet.gyro_cal_y = gyro_cal_y; - packet.gyro_cal_z = gyro_cal_z; - packet.accel_cal_x = accel_cal_x; - packet.accel_cal_y = accel_cal_y; - packet.accel_cal_z = accel_cal_z; - packet.mag_ofs_x = mag_ofs_x; - packet.mag_ofs_y = mag_ofs_y; - packet.mag_ofs_z = mag_ofs_z; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENSOR_OFFSETS, (const char *)&packet, MAVLINK_MSG_ID_SENSOR_OFFSETS_MIN_LEN, MAVLINK_MSG_ID_SENSOR_OFFSETS_LEN, MAVLINK_MSG_ID_SENSOR_OFFSETS_CRC); -#endif -} - -/** - * @brief Send a sensor_offsets message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_sensor_offsets_send_struct(mavlink_channel_t chan, const mavlink_sensor_offsets_t* sensor_offsets) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_sensor_offsets_send(chan, sensor_offsets->mag_ofs_x, sensor_offsets->mag_ofs_y, sensor_offsets->mag_ofs_z, sensor_offsets->mag_declination, sensor_offsets->raw_press, sensor_offsets->raw_temp, sensor_offsets->gyro_cal_x, sensor_offsets->gyro_cal_y, sensor_offsets->gyro_cal_z, sensor_offsets->accel_cal_x, sensor_offsets->accel_cal_y, sensor_offsets->accel_cal_z); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENSOR_OFFSETS, (const char *)sensor_offsets, MAVLINK_MSG_ID_SENSOR_OFFSETS_MIN_LEN, MAVLINK_MSG_ID_SENSOR_OFFSETS_LEN, MAVLINK_MSG_ID_SENSOR_OFFSETS_CRC); -#endif -} - -#if MAVLINK_MSG_ID_SENSOR_OFFSETS_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_sensor_offsets_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, int16_t mag_ofs_x, int16_t mag_ofs_y, int16_t mag_ofs_z, float mag_declination, int32_t raw_press, int32_t raw_temp, float gyro_cal_x, float gyro_cal_y, float gyro_cal_z, float accel_cal_x, float accel_cal_y, float accel_cal_z) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_float(buf, 0, mag_declination); - _mav_put_int32_t(buf, 4, raw_press); - _mav_put_int32_t(buf, 8, raw_temp); - _mav_put_float(buf, 12, gyro_cal_x); - _mav_put_float(buf, 16, gyro_cal_y); - _mav_put_float(buf, 20, gyro_cal_z); - _mav_put_float(buf, 24, accel_cal_x); - _mav_put_float(buf, 28, accel_cal_y); - _mav_put_float(buf, 32, accel_cal_z); - _mav_put_int16_t(buf, 36, mag_ofs_x); - _mav_put_int16_t(buf, 38, mag_ofs_y); - _mav_put_int16_t(buf, 40, mag_ofs_z); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENSOR_OFFSETS, buf, MAVLINK_MSG_ID_SENSOR_OFFSETS_MIN_LEN, MAVLINK_MSG_ID_SENSOR_OFFSETS_LEN, MAVLINK_MSG_ID_SENSOR_OFFSETS_CRC); -#else - mavlink_sensor_offsets_t *packet = (mavlink_sensor_offsets_t *)msgbuf; - packet->mag_declination = mag_declination; - packet->raw_press = raw_press; - packet->raw_temp = raw_temp; - packet->gyro_cal_x = gyro_cal_x; - packet->gyro_cal_y = gyro_cal_y; - packet->gyro_cal_z = gyro_cal_z; - packet->accel_cal_x = accel_cal_x; - packet->accel_cal_y = accel_cal_y; - packet->accel_cal_z = accel_cal_z; - packet->mag_ofs_x = mag_ofs_x; - packet->mag_ofs_y = mag_ofs_y; - packet->mag_ofs_z = mag_ofs_z; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENSOR_OFFSETS, (const char *)packet, MAVLINK_MSG_ID_SENSOR_OFFSETS_MIN_LEN, MAVLINK_MSG_ID_SENSOR_OFFSETS_LEN, MAVLINK_MSG_ID_SENSOR_OFFSETS_CRC); -#endif -} -#endif - -#endif - -// MESSAGE SENSOR_OFFSETS UNPACKING - - -/** - * @brief Get field mag_ofs_x from sensor_offsets message - * - * @return Magnetometer X offset. - */ -static inline int16_t mavlink_msg_sensor_offsets_get_mag_ofs_x(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 36); -} - -/** - * @brief Get field mag_ofs_y from sensor_offsets message - * - * @return Magnetometer Y offset. - */ -static inline int16_t mavlink_msg_sensor_offsets_get_mag_ofs_y(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 38); -} - -/** - * @brief Get field mag_ofs_z from sensor_offsets message - * - * @return Magnetometer Z offset. - */ -static inline int16_t mavlink_msg_sensor_offsets_get_mag_ofs_z(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 40); -} - -/** - * @brief Get field mag_declination from sensor_offsets message - * - * @return [rad] Magnetic declination. - */ -static inline float mavlink_msg_sensor_offsets_get_mag_declination(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 0); -} - -/** - * @brief Get field raw_press from sensor_offsets message - * - * @return Raw pressure from barometer. - */ -static inline int32_t mavlink_msg_sensor_offsets_get_raw_press(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 4); -} - -/** - * @brief Get field raw_temp from sensor_offsets message - * - * @return Raw temperature from barometer. - */ -static inline int32_t mavlink_msg_sensor_offsets_get_raw_temp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 8); -} - -/** - * @brief Get field gyro_cal_x from sensor_offsets message - * - * @return Gyro X calibration. - */ -static inline float mavlink_msg_sensor_offsets_get_gyro_cal_x(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Get field gyro_cal_y from sensor_offsets message - * - * @return Gyro Y calibration. - */ -static inline float mavlink_msg_sensor_offsets_get_gyro_cal_y(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 16); -} - -/** - * @brief Get field gyro_cal_z from sensor_offsets message - * - * @return Gyro Z calibration. - */ -static inline float mavlink_msg_sensor_offsets_get_gyro_cal_z(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 20); -} - -/** - * @brief Get field accel_cal_x from sensor_offsets message - * - * @return Accel X calibration. - */ -static inline float mavlink_msg_sensor_offsets_get_accel_cal_x(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 24); -} - -/** - * @brief Get field accel_cal_y from sensor_offsets message - * - * @return Accel Y calibration. - */ -static inline float mavlink_msg_sensor_offsets_get_accel_cal_y(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 28); -} - -/** - * @brief Get field accel_cal_z from sensor_offsets message - * - * @return Accel Z calibration. - */ -static inline float mavlink_msg_sensor_offsets_get_accel_cal_z(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 32); -} - -/** - * @brief Decode a sensor_offsets message into a struct - * - * @param msg The message to decode - * @param sensor_offsets C-struct to decode the message contents into - */ -static inline void mavlink_msg_sensor_offsets_decode(const mavlink_message_t* msg, mavlink_sensor_offsets_t* sensor_offsets) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - sensor_offsets->mag_declination = mavlink_msg_sensor_offsets_get_mag_declination(msg); - sensor_offsets->raw_press = mavlink_msg_sensor_offsets_get_raw_press(msg); - sensor_offsets->raw_temp = mavlink_msg_sensor_offsets_get_raw_temp(msg); - sensor_offsets->gyro_cal_x = mavlink_msg_sensor_offsets_get_gyro_cal_x(msg); - sensor_offsets->gyro_cal_y = mavlink_msg_sensor_offsets_get_gyro_cal_y(msg); - sensor_offsets->gyro_cal_z = mavlink_msg_sensor_offsets_get_gyro_cal_z(msg); - sensor_offsets->accel_cal_x = mavlink_msg_sensor_offsets_get_accel_cal_x(msg); - sensor_offsets->accel_cal_y = mavlink_msg_sensor_offsets_get_accel_cal_y(msg); - sensor_offsets->accel_cal_z = mavlink_msg_sensor_offsets_get_accel_cal_z(msg); - sensor_offsets->mag_ofs_x = mavlink_msg_sensor_offsets_get_mag_ofs_x(msg); - sensor_offsets->mag_ofs_y = mavlink_msg_sensor_offsets_get_mag_ofs_y(msg); - sensor_offsets->mag_ofs_z = mavlink_msg_sensor_offsets_get_mag_ofs_z(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_SENSOR_OFFSETS_LEN? msg->len : MAVLINK_MSG_ID_SENSOR_OFFSETS_LEN; - memset(sensor_offsets, 0, MAVLINK_MSG_ID_SENSOR_OFFSETS_LEN); - memcpy(sensor_offsets, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_set_mag_offsets.h b/ardupilotmega/mavlink_msg_set_mag_offsets.h deleted file mode 100644 index a385294a2..000000000 --- a/ardupilotmega/mavlink_msg_set_mag_offsets.h +++ /dev/null @@ -1,313 +0,0 @@ -#pragma once -// MESSAGE SET_MAG_OFFSETS PACKING - -#define MAVLINK_MSG_ID_SET_MAG_OFFSETS 151 - - -typedef struct __mavlink_set_mag_offsets_t { - int16_t mag_ofs_x; /*< Magnetometer X offset.*/ - int16_t mag_ofs_y; /*< Magnetometer Y offset.*/ - int16_t mag_ofs_z; /*< Magnetometer Z offset.*/ - uint8_t target_system; /*< System ID.*/ - uint8_t target_component; /*< Component ID.*/ -} mavlink_set_mag_offsets_t; - -#define MAVLINK_MSG_ID_SET_MAG_OFFSETS_LEN 8 -#define MAVLINK_MSG_ID_SET_MAG_OFFSETS_MIN_LEN 8 -#define MAVLINK_MSG_ID_151_LEN 8 -#define MAVLINK_MSG_ID_151_MIN_LEN 8 - -#define MAVLINK_MSG_ID_SET_MAG_OFFSETS_CRC 219 -#define MAVLINK_MSG_ID_151_CRC 219 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_SET_MAG_OFFSETS { \ - 151, \ - "SET_MAG_OFFSETS", \ - 5, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_set_mag_offsets_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_set_mag_offsets_t, target_component) }, \ - { "mag_ofs_x", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_set_mag_offsets_t, mag_ofs_x) }, \ - { "mag_ofs_y", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_set_mag_offsets_t, mag_ofs_y) }, \ - { "mag_ofs_z", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_set_mag_offsets_t, mag_ofs_z) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_SET_MAG_OFFSETS { \ - "SET_MAG_OFFSETS", \ - 5, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_set_mag_offsets_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_set_mag_offsets_t, target_component) }, \ - { "mag_ofs_x", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_set_mag_offsets_t, mag_ofs_x) }, \ - { "mag_ofs_y", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_set_mag_offsets_t, mag_ofs_y) }, \ - { "mag_ofs_z", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_set_mag_offsets_t, mag_ofs_z) }, \ - } \ -} -#endif - -/** - * @brief Pack a set_mag_offsets message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param target_system System ID. - * @param target_component Component ID. - * @param mag_ofs_x Magnetometer X offset. - * @param mag_ofs_y Magnetometer Y offset. - * @param mag_ofs_z Magnetometer Z offset. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_set_mag_offsets_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, int16_t mag_ofs_x, int16_t mag_ofs_y, int16_t mag_ofs_z) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SET_MAG_OFFSETS_LEN]; - _mav_put_int16_t(buf, 0, mag_ofs_x); - _mav_put_int16_t(buf, 2, mag_ofs_y); - _mav_put_int16_t(buf, 4, mag_ofs_z); - _mav_put_uint8_t(buf, 6, target_system); - _mav_put_uint8_t(buf, 7, target_component); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_MAG_OFFSETS_LEN); -#else - mavlink_set_mag_offsets_t packet; - packet.mag_ofs_x = mag_ofs_x; - packet.mag_ofs_y = mag_ofs_y; - packet.mag_ofs_z = mag_ofs_z; - packet.target_system = target_system; - packet.target_component = target_component; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_MAG_OFFSETS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SET_MAG_OFFSETS; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SET_MAG_OFFSETS_MIN_LEN, MAVLINK_MSG_ID_SET_MAG_OFFSETS_LEN, MAVLINK_MSG_ID_SET_MAG_OFFSETS_CRC); -} - -/** - * @brief Pack a set_mag_offsets message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param target_system System ID. - * @param target_component Component ID. - * @param mag_ofs_x Magnetometer X offset. - * @param mag_ofs_y Magnetometer Y offset. - * @param mag_ofs_z Magnetometer Z offset. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_set_mag_offsets_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,int16_t mag_ofs_x,int16_t mag_ofs_y,int16_t mag_ofs_z) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SET_MAG_OFFSETS_LEN]; - _mav_put_int16_t(buf, 0, mag_ofs_x); - _mav_put_int16_t(buf, 2, mag_ofs_y); - _mav_put_int16_t(buf, 4, mag_ofs_z); - _mav_put_uint8_t(buf, 6, target_system); - _mav_put_uint8_t(buf, 7, target_component); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_MAG_OFFSETS_LEN); -#else - mavlink_set_mag_offsets_t packet; - packet.mag_ofs_x = mag_ofs_x; - packet.mag_ofs_y = mag_ofs_y; - packet.mag_ofs_z = mag_ofs_z; - packet.target_system = target_system; - packet.target_component = target_component; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_MAG_OFFSETS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SET_MAG_OFFSETS; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SET_MAG_OFFSETS_MIN_LEN, MAVLINK_MSG_ID_SET_MAG_OFFSETS_LEN, MAVLINK_MSG_ID_SET_MAG_OFFSETS_CRC); -} - -/** - * @brief Encode a set_mag_offsets struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param set_mag_offsets C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_set_mag_offsets_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_set_mag_offsets_t* set_mag_offsets) -{ - return mavlink_msg_set_mag_offsets_pack(system_id, component_id, msg, set_mag_offsets->target_system, set_mag_offsets->target_component, set_mag_offsets->mag_ofs_x, set_mag_offsets->mag_ofs_y, set_mag_offsets->mag_ofs_z); -} - -/** - * @brief Encode a set_mag_offsets struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param set_mag_offsets C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_set_mag_offsets_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_set_mag_offsets_t* set_mag_offsets) -{ - return mavlink_msg_set_mag_offsets_pack_chan(system_id, component_id, chan, msg, set_mag_offsets->target_system, set_mag_offsets->target_component, set_mag_offsets->mag_ofs_x, set_mag_offsets->mag_ofs_y, set_mag_offsets->mag_ofs_z); -} - -/** - * @brief Send a set_mag_offsets message - * @param chan MAVLink channel to send the message - * - * @param target_system System ID. - * @param target_component Component ID. - * @param mag_ofs_x Magnetometer X offset. - * @param mag_ofs_y Magnetometer Y offset. - * @param mag_ofs_z Magnetometer Z offset. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_set_mag_offsets_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, int16_t mag_ofs_x, int16_t mag_ofs_y, int16_t mag_ofs_z) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SET_MAG_OFFSETS_LEN]; - _mav_put_int16_t(buf, 0, mag_ofs_x); - _mav_put_int16_t(buf, 2, mag_ofs_y); - _mav_put_int16_t(buf, 4, mag_ofs_z); - _mav_put_uint8_t(buf, 6, target_system); - _mav_put_uint8_t(buf, 7, target_component); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_MAG_OFFSETS, buf, MAVLINK_MSG_ID_SET_MAG_OFFSETS_MIN_LEN, MAVLINK_MSG_ID_SET_MAG_OFFSETS_LEN, MAVLINK_MSG_ID_SET_MAG_OFFSETS_CRC); -#else - mavlink_set_mag_offsets_t packet; - packet.mag_ofs_x = mag_ofs_x; - packet.mag_ofs_y = mag_ofs_y; - packet.mag_ofs_z = mag_ofs_z; - packet.target_system = target_system; - packet.target_component = target_component; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_MAG_OFFSETS, (const char *)&packet, MAVLINK_MSG_ID_SET_MAG_OFFSETS_MIN_LEN, MAVLINK_MSG_ID_SET_MAG_OFFSETS_LEN, MAVLINK_MSG_ID_SET_MAG_OFFSETS_CRC); -#endif -} - -/** - * @brief Send a set_mag_offsets message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_set_mag_offsets_send_struct(mavlink_channel_t chan, const mavlink_set_mag_offsets_t* set_mag_offsets) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_set_mag_offsets_send(chan, set_mag_offsets->target_system, set_mag_offsets->target_component, set_mag_offsets->mag_ofs_x, set_mag_offsets->mag_ofs_y, set_mag_offsets->mag_ofs_z); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_MAG_OFFSETS, (const char *)set_mag_offsets, MAVLINK_MSG_ID_SET_MAG_OFFSETS_MIN_LEN, MAVLINK_MSG_ID_SET_MAG_OFFSETS_LEN, MAVLINK_MSG_ID_SET_MAG_OFFSETS_CRC); -#endif -} - -#if MAVLINK_MSG_ID_SET_MAG_OFFSETS_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_set_mag_offsets_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, int16_t mag_ofs_x, int16_t mag_ofs_y, int16_t mag_ofs_z) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_int16_t(buf, 0, mag_ofs_x); - _mav_put_int16_t(buf, 2, mag_ofs_y); - _mav_put_int16_t(buf, 4, mag_ofs_z); - _mav_put_uint8_t(buf, 6, target_system); - _mav_put_uint8_t(buf, 7, target_component); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_MAG_OFFSETS, buf, MAVLINK_MSG_ID_SET_MAG_OFFSETS_MIN_LEN, MAVLINK_MSG_ID_SET_MAG_OFFSETS_LEN, MAVLINK_MSG_ID_SET_MAG_OFFSETS_CRC); -#else - mavlink_set_mag_offsets_t *packet = (mavlink_set_mag_offsets_t *)msgbuf; - packet->mag_ofs_x = mag_ofs_x; - packet->mag_ofs_y = mag_ofs_y; - packet->mag_ofs_z = mag_ofs_z; - packet->target_system = target_system; - packet->target_component = target_component; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_MAG_OFFSETS, (const char *)packet, MAVLINK_MSG_ID_SET_MAG_OFFSETS_MIN_LEN, MAVLINK_MSG_ID_SET_MAG_OFFSETS_LEN, MAVLINK_MSG_ID_SET_MAG_OFFSETS_CRC); -#endif -} -#endif - -#endif - -// MESSAGE SET_MAG_OFFSETS UNPACKING - - -/** - * @brief Get field target_system from set_mag_offsets message - * - * @return System ID. - */ -static inline uint8_t mavlink_msg_set_mag_offsets_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 6); -} - -/** - * @brief Get field target_component from set_mag_offsets message - * - * @return Component ID. - */ -static inline uint8_t mavlink_msg_set_mag_offsets_get_target_component(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 7); -} - -/** - * @brief Get field mag_ofs_x from set_mag_offsets message - * - * @return Magnetometer X offset. - */ -static inline int16_t mavlink_msg_set_mag_offsets_get_mag_ofs_x(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 0); -} - -/** - * @brief Get field mag_ofs_y from set_mag_offsets message - * - * @return Magnetometer Y offset. - */ -static inline int16_t mavlink_msg_set_mag_offsets_get_mag_ofs_y(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 2); -} - -/** - * @brief Get field mag_ofs_z from set_mag_offsets message - * - * @return Magnetometer Z offset. - */ -static inline int16_t mavlink_msg_set_mag_offsets_get_mag_ofs_z(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 4); -} - -/** - * @brief Decode a set_mag_offsets message into a struct - * - * @param msg The message to decode - * @param set_mag_offsets C-struct to decode the message contents into - */ -static inline void mavlink_msg_set_mag_offsets_decode(const mavlink_message_t* msg, mavlink_set_mag_offsets_t* set_mag_offsets) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - set_mag_offsets->mag_ofs_x = mavlink_msg_set_mag_offsets_get_mag_ofs_x(msg); - set_mag_offsets->mag_ofs_y = mavlink_msg_set_mag_offsets_get_mag_ofs_y(msg); - set_mag_offsets->mag_ofs_z = mavlink_msg_set_mag_offsets_get_mag_ofs_z(msg); - set_mag_offsets->target_system = mavlink_msg_set_mag_offsets_get_target_system(msg); - set_mag_offsets->target_component = mavlink_msg_set_mag_offsets_get_target_component(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_SET_MAG_OFFSETS_LEN? msg->len : MAVLINK_MSG_ID_SET_MAG_OFFSETS_LEN; - memset(set_mag_offsets, 0, MAVLINK_MSG_ID_SET_MAG_OFFSETS_LEN); - memcpy(set_mag_offsets, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_simstate.h b/ardupilotmega/mavlink_msg_simstate.h deleted file mode 100644 index 54cdce4d9..000000000 --- a/ardupilotmega/mavlink_msg_simstate.h +++ /dev/null @@ -1,463 +0,0 @@ -#pragma once -// MESSAGE SIMSTATE PACKING - -#define MAVLINK_MSG_ID_SIMSTATE 164 - - -typedef struct __mavlink_simstate_t { - float roll; /*< [rad] Roll angle.*/ - float pitch; /*< [rad] Pitch angle.*/ - float yaw; /*< [rad] Yaw angle.*/ - float xacc; /*< [m/s/s] X acceleration.*/ - float yacc; /*< [m/s/s] Y acceleration.*/ - float zacc; /*< [m/s/s] Z acceleration.*/ - float xgyro; /*< [rad/s] Angular speed around X axis.*/ - float ygyro; /*< [rad/s] Angular speed around Y axis.*/ - float zgyro; /*< [rad/s] Angular speed around Z axis.*/ - int32_t lat; /*< [degE7] Latitude.*/ - int32_t lng; /*< [degE7] Longitude.*/ -} mavlink_simstate_t; - -#define MAVLINK_MSG_ID_SIMSTATE_LEN 44 -#define MAVLINK_MSG_ID_SIMSTATE_MIN_LEN 44 -#define MAVLINK_MSG_ID_164_LEN 44 -#define MAVLINK_MSG_ID_164_MIN_LEN 44 - -#define MAVLINK_MSG_ID_SIMSTATE_CRC 154 -#define MAVLINK_MSG_ID_164_CRC 154 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_SIMSTATE { \ - 164, \ - "SIMSTATE", \ - 11, \ - { { "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_simstate_t, roll) }, \ - { "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_simstate_t, pitch) }, \ - { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_simstate_t, yaw) }, \ - { "xacc", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_simstate_t, xacc) }, \ - { "yacc", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_simstate_t, yacc) }, \ - { "zacc", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_simstate_t, zacc) }, \ - { "xgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_simstate_t, xgyro) }, \ - { "ygyro", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_simstate_t, ygyro) }, \ - { "zgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_simstate_t, zgyro) }, \ - { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 36, offsetof(mavlink_simstate_t, lat) }, \ - { "lng", NULL, MAVLINK_TYPE_INT32_T, 0, 40, offsetof(mavlink_simstate_t, lng) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_SIMSTATE { \ - "SIMSTATE", \ - 11, \ - { { "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_simstate_t, roll) }, \ - { "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_simstate_t, pitch) }, \ - { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_simstate_t, yaw) }, \ - { "xacc", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_simstate_t, xacc) }, \ - { "yacc", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_simstate_t, yacc) }, \ - { "zacc", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_simstate_t, zacc) }, \ - { "xgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_simstate_t, xgyro) }, \ - { "ygyro", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_simstate_t, ygyro) }, \ - { "zgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_simstate_t, zgyro) }, \ - { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 36, offsetof(mavlink_simstate_t, lat) }, \ - { "lng", NULL, MAVLINK_TYPE_INT32_T, 0, 40, offsetof(mavlink_simstate_t, lng) }, \ - } \ -} -#endif - -/** - * @brief Pack a simstate message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param roll [rad] Roll angle. - * @param pitch [rad] Pitch angle. - * @param yaw [rad] Yaw angle. - * @param xacc [m/s/s] X acceleration. - * @param yacc [m/s/s] Y acceleration. - * @param zacc [m/s/s] Z acceleration. - * @param xgyro [rad/s] Angular speed around X axis. - * @param ygyro [rad/s] Angular speed around Y axis. - * @param zgyro [rad/s] Angular speed around Z axis. - * @param lat [degE7] Latitude. - * @param lng [degE7] Longitude. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_simstate_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - float roll, float pitch, float yaw, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, int32_t lat, int32_t lng) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SIMSTATE_LEN]; - _mav_put_float(buf, 0, roll); - _mav_put_float(buf, 4, pitch); - _mav_put_float(buf, 8, yaw); - _mav_put_float(buf, 12, xacc); - _mav_put_float(buf, 16, yacc); - _mav_put_float(buf, 20, zacc); - _mav_put_float(buf, 24, xgyro); - _mav_put_float(buf, 28, ygyro); - _mav_put_float(buf, 32, zgyro); - _mav_put_int32_t(buf, 36, lat); - _mav_put_int32_t(buf, 40, lng); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SIMSTATE_LEN); -#else - mavlink_simstate_t packet; - packet.roll = roll; - packet.pitch = pitch; - packet.yaw = yaw; - packet.xacc = xacc; - packet.yacc = yacc; - packet.zacc = zacc; - packet.xgyro = xgyro; - packet.ygyro = ygyro; - packet.zgyro = zgyro; - packet.lat = lat; - packet.lng = lng; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SIMSTATE_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SIMSTATE; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SIMSTATE_MIN_LEN, MAVLINK_MSG_ID_SIMSTATE_LEN, MAVLINK_MSG_ID_SIMSTATE_CRC); -} - -/** - * @brief Pack a simstate message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param roll [rad] Roll angle. - * @param pitch [rad] Pitch angle. - * @param yaw [rad] Yaw angle. - * @param xacc [m/s/s] X acceleration. - * @param yacc [m/s/s] Y acceleration. - * @param zacc [m/s/s] Z acceleration. - * @param xgyro [rad/s] Angular speed around X axis. - * @param ygyro [rad/s] Angular speed around Y axis. - * @param zgyro [rad/s] Angular speed around Z axis. - * @param lat [degE7] Latitude. - * @param lng [degE7] Longitude. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_simstate_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - float roll,float pitch,float yaw,float xacc,float yacc,float zacc,float xgyro,float ygyro,float zgyro,int32_t lat,int32_t lng) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SIMSTATE_LEN]; - _mav_put_float(buf, 0, roll); - _mav_put_float(buf, 4, pitch); - _mav_put_float(buf, 8, yaw); - _mav_put_float(buf, 12, xacc); - _mav_put_float(buf, 16, yacc); - _mav_put_float(buf, 20, zacc); - _mav_put_float(buf, 24, xgyro); - _mav_put_float(buf, 28, ygyro); - _mav_put_float(buf, 32, zgyro); - _mav_put_int32_t(buf, 36, lat); - _mav_put_int32_t(buf, 40, lng); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SIMSTATE_LEN); -#else - mavlink_simstate_t packet; - packet.roll = roll; - packet.pitch = pitch; - packet.yaw = yaw; - packet.xacc = xacc; - packet.yacc = yacc; - packet.zacc = zacc; - packet.xgyro = xgyro; - packet.ygyro = ygyro; - packet.zgyro = zgyro; - packet.lat = lat; - packet.lng = lng; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SIMSTATE_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SIMSTATE; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SIMSTATE_MIN_LEN, MAVLINK_MSG_ID_SIMSTATE_LEN, MAVLINK_MSG_ID_SIMSTATE_CRC); -} - -/** - * @brief Encode a simstate struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param simstate C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_simstate_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_simstate_t* simstate) -{ - return mavlink_msg_simstate_pack(system_id, component_id, msg, simstate->roll, simstate->pitch, simstate->yaw, simstate->xacc, simstate->yacc, simstate->zacc, simstate->xgyro, simstate->ygyro, simstate->zgyro, simstate->lat, simstate->lng); -} - -/** - * @brief Encode a simstate struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param simstate C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_simstate_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_simstate_t* simstate) -{ - return mavlink_msg_simstate_pack_chan(system_id, component_id, chan, msg, simstate->roll, simstate->pitch, simstate->yaw, simstate->xacc, simstate->yacc, simstate->zacc, simstate->xgyro, simstate->ygyro, simstate->zgyro, simstate->lat, simstate->lng); -} - -/** - * @brief Send a simstate message - * @param chan MAVLink channel to send the message - * - * @param roll [rad] Roll angle. - * @param pitch [rad] Pitch angle. - * @param yaw [rad] Yaw angle. - * @param xacc [m/s/s] X acceleration. - * @param yacc [m/s/s] Y acceleration. - * @param zacc [m/s/s] Z acceleration. - * @param xgyro [rad/s] Angular speed around X axis. - * @param ygyro [rad/s] Angular speed around Y axis. - * @param zgyro [rad/s] Angular speed around Z axis. - * @param lat [degE7] Latitude. - * @param lng [degE7] Longitude. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_simstate_send(mavlink_channel_t chan, float roll, float pitch, float yaw, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, int32_t lat, int32_t lng) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SIMSTATE_LEN]; - _mav_put_float(buf, 0, roll); - _mav_put_float(buf, 4, pitch); - _mav_put_float(buf, 8, yaw); - _mav_put_float(buf, 12, xacc); - _mav_put_float(buf, 16, yacc); - _mav_put_float(buf, 20, zacc); - _mav_put_float(buf, 24, xgyro); - _mav_put_float(buf, 28, ygyro); - _mav_put_float(buf, 32, zgyro); - _mav_put_int32_t(buf, 36, lat); - _mav_put_int32_t(buf, 40, lng); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SIMSTATE, buf, MAVLINK_MSG_ID_SIMSTATE_MIN_LEN, MAVLINK_MSG_ID_SIMSTATE_LEN, MAVLINK_MSG_ID_SIMSTATE_CRC); -#else - mavlink_simstate_t packet; - packet.roll = roll; - packet.pitch = pitch; - packet.yaw = yaw; - packet.xacc = xacc; - packet.yacc = yacc; - packet.zacc = zacc; - packet.xgyro = xgyro; - packet.ygyro = ygyro; - packet.zgyro = zgyro; - packet.lat = lat; - packet.lng = lng; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SIMSTATE, (const char *)&packet, MAVLINK_MSG_ID_SIMSTATE_MIN_LEN, MAVLINK_MSG_ID_SIMSTATE_LEN, MAVLINK_MSG_ID_SIMSTATE_CRC); -#endif -} - -/** - * @brief Send a simstate message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_simstate_send_struct(mavlink_channel_t chan, const mavlink_simstate_t* simstate) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_simstate_send(chan, simstate->roll, simstate->pitch, simstate->yaw, simstate->xacc, simstate->yacc, simstate->zacc, simstate->xgyro, simstate->ygyro, simstate->zgyro, simstate->lat, simstate->lng); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SIMSTATE, (const char *)simstate, MAVLINK_MSG_ID_SIMSTATE_MIN_LEN, MAVLINK_MSG_ID_SIMSTATE_LEN, MAVLINK_MSG_ID_SIMSTATE_CRC); -#endif -} - -#if MAVLINK_MSG_ID_SIMSTATE_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_simstate_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, float roll, float pitch, float yaw, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, int32_t lat, int32_t lng) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_float(buf, 0, roll); - _mav_put_float(buf, 4, pitch); - _mav_put_float(buf, 8, yaw); - _mav_put_float(buf, 12, xacc); - _mav_put_float(buf, 16, yacc); - _mav_put_float(buf, 20, zacc); - _mav_put_float(buf, 24, xgyro); - _mav_put_float(buf, 28, ygyro); - _mav_put_float(buf, 32, zgyro); - _mav_put_int32_t(buf, 36, lat); - _mav_put_int32_t(buf, 40, lng); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SIMSTATE, buf, MAVLINK_MSG_ID_SIMSTATE_MIN_LEN, MAVLINK_MSG_ID_SIMSTATE_LEN, MAVLINK_MSG_ID_SIMSTATE_CRC); -#else - mavlink_simstate_t *packet = (mavlink_simstate_t *)msgbuf; - packet->roll = roll; - packet->pitch = pitch; - packet->yaw = yaw; - packet->xacc = xacc; - packet->yacc = yacc; - packet->zacc = zacc; - packet->xgyro = xgyro; - packet->ygyro = ygyro; - packet->zgyro = zgyro; - packet->lat = lat; - packet->lng = lng; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SIMSTATE, (const char *)packet, MAVLINK_MSG_ID_SIMSTATE_MIN_LEN, MAVLINK_MSG_ID_SIMSTATE_LEN, MAVLINK_MSG_ID_SIMSTATE_CRC); -#endif -} -#endif - -#endif - -// MESSAGE SIMSTATE UNPACKING - - -/** - * @brief Get field roll from simstate message - * - * @return [rad] Roll angle. - */ -static inline float mavlink_msg_simstate_get_roll(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 0); -} - -/** - * @brief Get field pitch from simstate message - * - * @return [rad] Pitch angle. - */ -static inline float mavlink_msg_simstate_get_pitch(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 4); -} - -/** - * @brief Get field yaw from simstate message - * - * @return [rad] Yaw angle. - */ -static inline float mavlink_msg_simstate_get_yaw(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field xacc from simstate message - * - * @return [m/s/s] X acceleration. - */ -static inline float mavlink_msg_simstate_get_xacc(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Get field yacc from simstate message - * - * @return [m/s/s] Y acceleration. - */ -static inline float mavlink_msg_simstate_get_yacc(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 16); -} - -/** - * @brief Get field zacc from simstate message - * - * @return [m/s/s] Z acceleration. - */ -static inline float mavlink_msg_simstate_get_zacc(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 20); -} - -/** - * @brief Get field xgyro from simstate message - * - * @return [rad/s] Angular speed around X axis. - */ -static inline float mavlink_msg_simstate_get_xgyro(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 24); -} - -/** - * @brief Get field ygyro from simstate message - * - * @return [rad/s] Angular speed around Y axis. - */ -static inline float mavlink_msg_simstate_get_ygyro(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 28); -} - -/** - * @brief Get field zgyro from simstate message - * - * @return [rad/s] Angular speed around Z axis. - */ -static inline float mavlink_msg_simstate_get_zgyro(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 32); -} - -/** - * @brief Get field lat from simstate message - * - * @return [degE7] Latitude. - */ -static inline int32_t mavlink_msg_simstate_get_lat(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 36); -} - -/** - * @brief Get field lng from simstate message - * - * @return [degE7] Longitude. - */ -static inline int32_t mavlink_msg_simstate_get_lng(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 40); -} - -/** - * @brief Decode a simstate message into a struct - * - * @param msg The message to decode - * @param simstate C-struct to decode the message contents into - */ -static inline void mavlink_msg_simstate_decode(const mavlink_message_t* msg, mavlink_simstate_t* simstate) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - simstate->roll = mavlink_msg_simstate_get_roll(msg); - simstate->pitch = mavlink_msg_simstate_get_pitch(msg); - simstate->yaw = mavlink_msg_simstate_get_yaw(msg); - simstate->xacc = mavlink_msg_simstate_get_xacc(msg); - simstate->yacc = mavlink_msg_simstate_get_yacc(msg); - simstate->zacc = mavlink_msg_simstate_get_zacc(msg); - simstate->xgyro = mavlink_msg_simstate_get_xgyro(msg); - simstate->ygyro = mavlink_msg_simstate_get_ygyro(msg); - simstate->zgyro = mavlink_msg_simstate_get_zgyro(msg); - simstate->lat = mavlink_msg_simstate_get_lat(msg); - simstate->lng = mavlink_msg_simstate_get_lng(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_SIMSTATE_LEN? msg->len : MAVLINK_MSG_ID_SIMSTATE_LEN; - memset(simstate, 0, MAVLINK_MSG_ID_SIMSTATE_LEN); - memcpy(simstate, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_vision_position_delta.h b/ardupilotmega/mavlink_msg_vision_position_delta.h deleted file mode 100644 index f2606c310..000000000 --- a/ardupilotmega/mavlink_msg_vision_position_delta.h +++ /dev/null @@ -1,306 +0,0 @@ -#pragma once -// MESSAGE VISION_POSITION_DELTA PACKING - -#define MAVLINK_MSG_ID_VISION_POSITION_DELTA 11011 - - -typedef struct __mavlink_vision_position_delta_t { - uint64_t time_usec; /*< [us] Timestamp (synced to UNIX time or since system boot).*/ - uint64_t time_delta_usec; /*< [us] Time since the last reported camera frame.*/ - float angle_delta[3]; /*< Defines a rotation vector in body frame that rotates the vehicle from the previous to the current orientation.*/ - float position_delta[3]; /*< [m] Change in position from previous to current frame rotated into body frame (0=forward, 1=right, 2=down).*/ - float confidence; /*< [%] Normalised confidence value from 0 to 100.*/ -} mavlink_vision_position_delta_t; - -#define MAVLINK_MSG_ID_VISION_POSITION_DELTA_LEN 44 -#define MAVLINK_MSG_ID_VISION_POSITION_DELTA_MIN_LEN 44 -#define MAVLINK_MSG_ID_11011_LEN 44 -#define MAVLINK_MSG_ID_11011_MIN_LEN 44 - -#define MAVLINK_MSG_ID_VISION_POSITION_DELTA_CRC 106 -#define MAVLINK_MSG_ID_11011_CRC 106 - -#define MAVLINK_MSG_VISION_POSITION_DELTA_FIELD_ANGLE_DELTA_LEN 3 -#define MAVLINK_MSG_VISION_POSITION_DELTA_FIELD_POSITION_DELTA_LEN 3 - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_VISION_POSITION_DELTA { \ - 11011, \ - "VISION_POSITION_DELTA", \ - 5, \ - { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_vision_position_delta_t, time_usec) }, \ - { "time_delta_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 8, offsetof(mavlink_vision_position_delta_t, time_delta_usec) }, \ - { "angle_delta", NULL, MAVLINK_TYPE_FLOAT, 3, 16, offsetof(mavlink_vision_position_delta_t, angle_delta) }, \ - { "position_delta", NULL, MAVLINK_TYPE_FLOAT, 3, 28, offsetof(mavlink_vision_position_delta_t, position_delta) }, \ - { "confidence", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_vision_position_delta_t, confidence) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_VISION_POSITION_DELTA { \ - "VISION_POSITION_DELTA", \ - 5, \ - { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_vision_position_delta_t, time_usec) }, \ - { "time_delta_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 8, offsetof(mavlink_vision_position_delta_t, time_delta_usec) }, \ - { "angle_delta", NULL, MAVLINK_TYPE_FLOAT, 3, 16, offsetof(mavlink_vision_position_delta_t, angle_delta) }, \ - { "position_delta", NULL, MAVLINK_TYPE_FLOAT, 3, 28, offsetof(mavlink_vision_position_delta_t, position_delta) }, \ - { "confidence", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_vision_position_delta_t, confidence) }, \ - } \ -} -#endif - -/** - * @brief Pack a vision_position_delta message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param time_usec [us] Timestamp (synced to UNIX time or since system boot). - * @param time_delta_usec [us] Time since the last reported camera frame. - * @param angle_delta Defines a rotation vector in body frame that rotates the vehicle from the previous to the current orientation. - * @param position_delta [m] Change in position from previous to current frame rotated into body frame (0=forward, 1=right, 2=down). - * @param confidence [%] Normalised confidence value from 0 to 100. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_vision_position_delta_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint64_t time_usec, uint64_t time_delta_usec, const float *angle_delta, const float *position_delta, float confidence) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_VISION_POSITION_DELTA_LEN]; - _mav_put_uint64_t(buf, 0, time_usec); - _mav_put_uint64_t(buf, 8, time_delta_usec); - _mav_put_float(buf, 40, confidence); - _mav_put_float_array(buf, 16, angle_delta, 3); - _mav_put_float_array(buf, 28, position_delta, 3); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VISION_POSITION_DELTA_LEN); -#else - mavlink_vision_position_delta_t packet; - packet.time_usec = time_usec; - packet.time_delta_usec = time_delta_usec; - packet.confidence = confidence; - mav_array_memcpy(packet.angle_delta, angle_delta, sizeof(float)*3); - mav_array_memcpy(packet.position_delta, position_delta, sizeof(float)*3); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VISION_POSITION_DELTA_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_VISION_POSITION_DELTA; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_VISION_POSITION_DELTA_MIN_LEN, MAVLINK_MSG_ID_VISION_POSITION_DELTA_LEN, MAVLINK_MSG_ID_VISION_POSITION_DELTA_CRC); -} - -/** - * @brief Pack a vision_position_delta message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param time_usec [us] Timestamp (synced to UNIX time or since system boot). - * @param time_delta_usec [us] Time since the last reported camera frame. - * @param angle_delta Defines a rotation vector in body frame that rotates the vehicle from the previous to the current orientation. - * @param position_delta [m] Change in position from previous to current frame rotated into body frame (0=forward, 1=right, 2=down). - * @param confidence [%] Normalised confidence value from 0 to 100. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_vision_position_delta_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint64_t time_usec,uint64_t time_delta_usec,const float *angle_delta,const float *position_delta,float confidence) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_VISION_POSITION_DELTA_LEN]; - _mav_put_uint64_t(buf, 0, time_usec); - _mav_put_uint64_t(buf, 8, time_delta_usec); - _mav_put_float(buf, 40, confidence); - _mav_put_float_array(buf, 16, angle_delta, 3); - _mav_put_float_array(buf, 28, position_delta, 3); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VISION_POSITION_DELTA_LEN); -#else - mavlink_vision_position_delta_t packet; - packet.time_usec = time_usec; - packet.time_delta_usec = time_delta_usec; - packet.confidence = confidence; - mav_array_memcpy(packet.angle_delta, angle_delta, sizeof(float)*3); - mav_array_memcpy(packet.position_delta, position_delta, sizeof(float)*3); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VISION_POSITION_DELTA_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_VISION_POSITION_DELTA; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_VISION_POSITION_DELTA_MIN_LEN, MAVLINK_MSG_ID_VISION_POSITION_DELTA_LEN, MAVLINK_MSG_ID_VISION_POSITION_DELTA_CRC); -} - -/** - * @brief Encode a vision_position_delta struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param vision_position_delta C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_vision_position_delta_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_vision_position_delta_t* vision_position_delta) -{ - return mavlink_msg_vision_position_delta_pack(system_id, component_id, msg, vision_position_delta->time_usec, vision_position_delta->time_delta_usec, vision_position_delta->angle_delta, vision_position_delta->position_delta, vision_position_delta->confidence); -} - -/** - * @brief Encode a vision_position_delta struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param vision_position_delta C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_vision_position_delta_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_vision_position_delta_t* vision_position_delta) -{ - return mavlink_msg_vision_position_delta_pack_chan(system_id, component_id, chan, msg, vision_position_delta->time_usec, vision_position_delta->time_delta_usec, vision_position_delta->angle_delta, vision_position_delta->position_delta, vision_position_delta->confidence); -} - -/** - * @brief Send a vision_position_delta message - * @param chan MAVLink channel to send the message - * - * @param time_usec [us] Timestamp (synced to UNIX time or since system boot). - * @param time_delta_usec [us] Time since the last reported camera frame. - * @param angle_delta Defines a rotation vector in body frame that rotates the vehicle from the previous to the current orientation. - * @param position_delta [m] Change in position from previous to current frame rotated into body frame (0=forward, 1=right, 2=down). - * @param confidence [%] Normalised confidence value from 0 to 100. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_vision_position_delta_send(mavlink_channel_t chan, uint64_t time_usec, uint64_t time_delta_usec, const float *angle_delta, const float *position_delta, float confidence) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_VISION_POSITION_DELTA_LEN]; - _mav_put_uint64_t(buf, 0, time_usec); - _mav_put_uint64_t(buf, 8, time_delta_usec); - _mav_put_float(buf, 40, confidence); - _mav_put_float_array(buf, 16, angle_delta, 3); - _mav_put_float_array(buf, 28, position_delta, 3); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VISION_POSITION_DELTA, buf, MAVLINK_MSG_ID_VISION_POSITION_DELTA_MIN_LEN, MAVLINK_MSG_ID_VISION_POSITION_DELTA_LEN, MAVLINK_MSG_ID_VISION_POSITION_DELTA_CRC); -#else - mavlink_vision_position_delta_t packet; - packet.time_usec = time_usec; - packet.time_delta_usec = time_delta_usec; - packet.confidence = confidence; - mav_array_memcpy(packet.angle_delta, angle_delta, sizeof(float)*3); - mav_array_memcpy(packet.position_delta, position_delta, sizeof(float)*3); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VISION_POSITION_DELTA, (const char *)&packet, MAVLINK_MSG_ID_VISION_POSITION_DELTA_MIN_LEN, MAVLINK_MSG_ID_VISION_POSITION_DELTA_LEN, MAVLINK_MSG_ID_VISION_POSITION_DELTA_CRC); -#endif -} - -/** - * @brief Send a vision_position_delta message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_vision_position_delta_send_struct(mavlink_channel_t chan, const mavlink_vision_position_delta_t* vision_position_delta) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_vision_position_delta_send(chan, vision_position_delta->time_usec, vision_position_delta->time_delta_usec, vision_position_delta->angle_delta, vision_position_delta->position_delta, vision_position_delta->confidence); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VISION_POSITION_DELTA, (const char *)vision_position_delta, MAVLINK_MSG_ID_VISION_POSITION_DELTA_MIN_LEN, MAVLINK_MSG_ID_VISION_POSITION_DELTA_LEN, MAVLINK_MSG_ID_VISION_POSITION_DELTA_CRC); -#endif -} - -#if MAVLINK_MSG_ID_VISION_POSITION_DELTA_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_vision_position_delta_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint64_t time_delta_usec, const float *angle_delta, const float *position_delta, float confidence) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint64_t(buf, 0, time_usec); - _mav_put_uint64_t(buf, 8, time_delta_usec); - _mav_put_float(buf, 40, confidence); - _mav_put_float_array(buf, 16, angle_delta, 3); - _mav_put_float_array(buf, 28, position_delta, 3); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VISION_POSITION_DELTA, buf, MAVLINK_MSG_ID_VISION_POSITION_DELTA_MIN_LEN, MAVLINK_MSG_ID_VISION_POSITION_DELTA_LEN, MAVLINK_MSG_ID_VISION_POSITION_DELTA_CRC); -#else - mavlink_vision_position_delta_t *packet = (mavlink_vision_position_delta_t *)msgbuf; - packet->time_usec = time_usec; - packet->time_delta_usec = time_delta_usec; - packet->confidence = confidence; - mav_array_memcpy(packet->angle_delta, angle_delta, sizeof(float)*3); - mav_array_memcpy(packet->position_delta, position_delta, sizeof(float)*3); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VISION_POSITION_DELTA, (const char *)packet, MAVLINK_MSG_ID_VISION_POSITION_DELTA_MIN_LEN, MAVLINK_MSG_ID_VISION_POSITION_DELTA_LEN, MAVLINK_MSG_ID_VISION_POSITION_DELTA_CRC); -#endif -} -#endif - -#endif - -// MESSAGE VISION_POSITION_DELTA UNPACKING - - -/** - * @brief Get field time_usec from vision_position_delta message - * - * @return [us] Timestamp (synced to UNIX time or since system boot). - */ -static inline uint64_t mavlink_msg_vision_position_delta_get_time_usec(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint64_t(msg, 0); -} - -/** - * @brief Get field time_delta_usec from vision_position_delta message - * - * @return [us] Time since the last reported camera frame. - */ -static inline uint64_t mavlink_msg_vision_position_delta_get_time_delta_usec(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint64_t(msg, 8); -} - -/** - * @brief Get field angle_delta from vision_position_delta message - * - * @return Defines a rotation vector in body frame that rotates the vehicle from the previous to the current orientation. - */ -static inline uint16_t mavlink_msg_vision_position_delta_get_angle_delta(const mavlink_message_t* msg, float *angle_delta) -{ - return _MAV_RETURN_float_array(msg, angle_delta, 3, 16); -} - -/** - * @brief Get field position_delta from vision_position_delta message - * - * @return [m] Change in position from previous to current frame rotated into body frame (0=forward, 1=right, 2=down). - */ -static inline uint16_t mavlink_msg_vision_position_delta_get_position_delta(const mavlink_message_t* msg, float *position_delta) -{ - return _MAV_RETURN_float_array(msg, position_delta, 3, 28); -} - -/** - * @brief Get field confidence from vision_position_delta message - * - * @return [%] Normalised confidence value from 0 to 100. - */ -static inline float mavlink_msg_vision_position_delta_get_confidence(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 40); -} - -/** - * @brief Decode a vision_position_delta message into a struct - * - * @param msg The message to decode - * @param vision_position_delta C-struct to decode the message contents into - */ -static inline void mavlink_msg_vision_position_delta_decode(const mavlink_message_t* msg, mavlink_vision_position_delta_t* vision_position_delta) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - vision_position_delta->time_usec = mavlink_msg_vision_position_delta_get_time_usec(msg); - vision_position_delta->time_delta_usec = mavlink_msg_vision_position_delta_get_time_delta_usec(msg); - mavlink_msg_vision_position_delta_get_angle_delta(msg, vision_position_delta->angle_delta); - mavlink_msg_vision_position_delta_get_position_delta(msg, vision_position_delta->position_delta); - vision_position_delta->confidence = mavlink_msg_vision_position_delta_get_confidence(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_VISION_POSITION_DELTA_LEN? msg->len : MAVLINK_MSG_ID_VISION_POSITION_DELTA_LEN; - memset(vision_position_delta, 0, MAVLINK_MSG_ID_VISION_POSITION_DELTA_LEN); - memcpy(vision_position_delta, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/mavlink_msg_wind.h b/ardupilotmega/mavlink_msg_wind.h deleted file mode 100644 index 77b1c1039..000000000 --- a/ardupilotmega/mavlink_msg_wind.h +++ /dev/null @@ -1,263 +0,0 @@ -#pragma once -// MESSAGE WIND PACKING - -#define MAVLINK_MSG_ID_WIND 168 - - -typedef struct __mavlink_wind_t { - float direction; /*< [deg] Wind direction (that wind is coming from).*/ - float speed; /*< [m/s] Wind speed in ground plane.*/ - float speed_z; /*< [m/s] Vertical wind speed.*/ -} mavlink_wind_t; - -#define MAVLINK_MSG_ID_WIND_LEN 12 -#define MAVLINK_MSG_ID_WIND_MIN_LEN 12 -#define MAVLINK_MSG_ID_168_LEN 12 -#define MAVLINK_MSG_ID_168_MIN_LEN 12 - -#define MAVLINK_MSG_ID_WIND_CRC 1 -#define MAVLINK_MSG_ID_168_CRC 1 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_WIND { \ - 168, \ - "WIND", \ - 3, \ - { { "direction", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_wind_t, direction) }, \ - { "speed", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_wind_t, speed) }, \ - { "speed_z", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_wind_t, speed_z) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_WIND { \ - "WIND", \ - 3, \ - { { "direction", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_wind_t, direction) }, \ - { "speed", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_wind_t, speed) }, \ - { "speed_z", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_wind_t, speed_z) }, \ - } \ -} -#endif - -/** - * @brief Pack a wind message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param direction [deg] Wind direction (that wind is coming from). - * @param speed [m/s] Wind speed in ground plane. - * @param speed_z [m/s] Vertical wind speed. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_wind_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - float direction, float speed, float speed_z) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_WIND_LEN]; - _mav_put_float(buf, 0, direction); - _mav_put_float(buf, 4, speed); - _mav_put_float(buf, 8, speed_z); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_WIND_LEN); -#else - mavlink_wind_t packet; - packet.direction = direction; - packet.speed = speed; - packet.speed_z = speed_z; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_WIND_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_WIND; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_WIND_MIN_LEN, MAVLINK_MSG_ID_WIND_LEN, MAVLINK_MSG_ID_WIND_CRC); -} - -/** - * @brief Pack a wind message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param direction [deg] Wind direction (that wind is coming from). - * @param speed [m/s] Wind speed in ground plane. - * @param speed_z [m/s] Vertical wind speed. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_wind_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - float direction,float speed,float speed_z) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_WIND_LEN]; - _mav_put_float(buf, 0, direction); - _mav_put_float(buf, 4, speed); - _mav_put_float(buf, 8, speed_z); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_WIND_LEN); -#else - mavlink_wind_t packet; - packet.direction = direction; - packet.speed = speed; - packet.speed_z = speed_z; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_WIND_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_WIND; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_WIND_MIN_LEN, MAVLINK_MSG_ID_WIND_LEN, MAVLINK_MSG_ID_WIND_CRC); -} - -/** - * @brief Encode a wind struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param wind C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_wind_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_wind_t* wind) -{ - return mavlink_msg_wind_pack(system_id, component_id, msg, wind->direction, wind->speed, wind->speed_z); -} - -/** - * @brief Encode a wind struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param wind C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_wind_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_wind_t* wind) -{ - return mavlink_msg_wind_pack_chan(system_id, component_id, chan, msg, wind->direction, wind->speed, wind->speed_z); -} - -/** - * @brief Send a wind message - * @param chan MAVLink channel to send the message - * - * @param direction [deg] Wind direction (that wind is coming from). - * @param speed [m/s] Wind speed in ground plane. - * @param speed_z [m/s] Vertical wind speed. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_wind_send(mavlink_channel_t chan, float direction, float speed, float speed_z) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_WIND_LEN]; - _mav_put_float(buf, 0, direction); - _mav_put_float(buf, 4, speed); - _mav_put_float(buf, 8, speed_z); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WIND, buf, MAVLINK_MSG_ID_WIND_MIN_LEN, MAVLINK_MSG_ID_WIND_LEN, MAVLINK_MSG_ID_WIND_CRC); -#else - mavlink_wind_t packet; - packet.direction = direction; - packet.speed = speed; - packet.speed_z = speed_z; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WIND, (const char *)&packet, MAVLINK_MSG_ID_WIND_MIN_LEN, MAVLINK_MSG_ID_WIND_LEN, MAVLINK_MSG_ID_WIND_CRC); -#endif -} - -/** - * @brief Send a wind message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_wind_send_struct(mavlink_channel_t chan, const mavlink_wind_t* wind) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_wind_send(chan, wind->direction, wind->speed, wind->speed_z); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WIND, (const char *)wind, MAVLINK_MSG_ID_WIND_MIN_LEN, MAVLINK_MSG_ID_WIND_LEN, MAVLINK_MSG_ID_WIND_CRC); -#endif -} - -#if MAVLINK_MSG_ID_WIND_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_wind_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, float direction, float speed, float speed_z) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_float(buf, 0, direction); - _mav_put_float(buf, 4, speed); - _mav_put_float(buf, 8, speed_z); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WIND, buf, MAVLINK_MSG_ID_WIND_MIN_LEN, MAVLINK_MSG_ID_WIND_LEN, MAVLINK_MSG_ID_WIND_CRC); -#else - mavlink_wind_t *packet = (mavlink_wind_t *)msgbuf; - packet->direction = direction; - packet->speed = speed; - packet->speed_z = speed_z; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WIND, (const char *)packet, MAVLINK_MSG_ID_WIND_MIN_LEN, MAVLINK_MSG_ID_WIND_LEN, MAVLINK_MSG_ID_WIND_CRC); -#endif -} -#endif - -#endif - -// MESSAGE WIND UNPACKING - - -/** - * @brief Get field direction from wind message - * - * @return [deg] Wind direction (that wind is coming from). - */ -static inline float mavlink_msg_wind_get_direction(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 0); -} - -/** - * @brief Get field speed from wind message - * - * @return [m/s] Wind speed in ground plane. - */ -static inline float mavlink_msg_wind_get_speed(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 4); -} - -/** - * @brief Get field speed_z from wind message - * - * @return [m/s] Vertical wind speed. - */ -static inline float mavlink_msg_wind_get_speed_z(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Decode a wind message into a struct - * - * @param msg The message to decode - * @param wind C-struct to decode the message contents into - */ -static inline void mavlink_msg_wind_decode(const mavlink_message_t* msg, mavlink_wind_t* wind) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - wind->direction = mavlink_msg_wind_get_direction(msg); - wind->speed = mavlink_msg_wind_get_speed(msg); - wind->speed_z = mavlink_msg_wind_get_speed_z(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_WIND_LEN? msg->len : MAVLINK_MSG_ID_WIND_LEN; - memset(wind, 0, MAVLINK_MSG_ID_WIND_LEN); - memcpy(wind, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/ardupilotmega/testsuite.h b/ardupilotmega/testsuite.h deleted file mode 100644 index 532700ae1..000000000 --- a/ardupilotmega/testsuite.h +++ /dev/null @@ -1,3830 +0,0 @@ -/** @file - * @brief MAVLink comm protocol testsuite generated from ardupilotmega.xml - * @see http://qgroundcontrol.org/mavlink/ - */ -#pragma once -#ifndef ARDUPILOTMEGA_TESTSUITE_H -#define ARDUPILOTMEGA_TESTSUITE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef MAVLINK_TEST_ALL -#define MAVLINK_TEST_ALL -static void mavlink_test_common(uint8_t, uint8_t, mavlink_message_t *last_msg); -static void mavlink_test_uAvionix(uint8_t, uint8_t, mavlink_message_t *last_msg); -static void mavlink_test_icarous(uint8_t, uint8_t, mavlink_message_t *last_msg); -static void mavlink_test_ardupilotmega(uint8_t, uint8_t, mavlink_message_t *last_msg); - -static void mavlink_test_all(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) -{ - mavlink_test_common(system_id, component_id, last_msg); - mavlink_test_uAvionix(system_id, component_id, last_msg); - mavlink_test_icarous(system_id, component_id, last_msg); - mavlink_test_ardupilotmega(system_id, component_id, last_msg); -} -#endif - -#include "../common/testsuite.h" -#include "../uAvionix/testsuite.h" -#include "../icarous/testsuite.h" - - -static void mavlink_test_sensor_offsets(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) -{ -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); - if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SENSOR_OFFSETS >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_sensor_offsets_t packet_in = { - 17.0,963497672,963497880,101.0,129.0,157.0,185.0,213.0,241.0,19107,19211,19315 - }; - mavlink_sensor_offsets_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.mag_declination = packet_in.mag_declination; - packet1.raw_press = packet_in.raw_press; - packet1.raw_temp = packet_in.raw_temp; - packet1.gyro_cal_x = packet_in.gyro_cal_x; - packet1.gyro_cal_y = packet_in.gyro_cal_y; - packet1.gyro_cal_z = packet_in.gyro_cal_z; - packet1.accel_cal_x = packet_in.accel_cal_x; - packet1.accel_cal_y = packet_in.accel_cal_y; - packet1.accel_cal_z = packet_in.accel_cal_z; - packet1.mag_ofs_x = packet_in.mag_ofs_x; - packet1.mag_ofs_y = packet_in.mag_ofs_y; - packet1.mag_ofs_z = packet_in.mag_ofs_z; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_SENSOR_OFFSETS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SENSOR_OFFSETS_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_sensor_offsets_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_sensor_offsets_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_sensor_offsets_pack(system_id, component_id, &msg , packet1.mag_ofs_x , packet1.mag_ofs_y , packet1.mag_ofs_z , packet1.mag_declination , packet1.raw_press , packet1.raw_temp , packet1.gyro_cal_x , packet1.gyro_cal_y , packet1.gyro_cal_z , packet1.accel_cal_x , packet1.accel_cal_y , packet1.accel_cal_z ); - mavlink_msg_sensor_offsets_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_sensor_offsets_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.mag_ofs_x , packet1.mag_ofs_y , packet1.mag_ofs_z , packet1.mag_declination , packet1.raw_press , packet1.raw_temp , packet1.gyro_cal_x , packet1.gyro_cal_y , packet1.gyro_cal_z , packet1.accel_cal_x , packet1.accel_cal_y , packet1.accel_cal_z ); - mavlink_msg_sensor_offsets_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SET_MAG_OFFSETS >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_set_mag_offsets_t packet_in = { - 17235,17339,17443,151,218 - }; - mavlink_set_mag_offsets_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.mag_ofs_x = packet_in.mag_ofs_x; - packet1.mag_ofs_y = packet_in.mag_ofs_y; - packet1.mag_ofs_z = packet_in.mag_ofs_z; - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_SET_MAG_OFFSETS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SET_MAG_OFFSETS_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_set_mag_offsets_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_set_mag_offsets_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_set_mag_offsets_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.mag_ofs_x , packet1.mag_ofs_y , packet1.mag_ofs_z ); - mavlink_msg_set_mag_offsets_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_set_mag_offsets_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.mag_ofs_x , packet1.mag_ofs_y , packet1.mag_ofs_z ); - mavlink_msg_set_mag_offsets_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MEMINFO >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_meminfo_t packet_in = { - 17235,17339,963497672 - }; - mavlink_meminfo_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.brkval = packet_in.brkval; - packet1.freemem = packet_in.freemem; - packet1.freemem32 = packet_in.freemem32; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_MEMINFO_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MEMINFO_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_meminfo_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_meminfo_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_meminfo_pack(system_id, component_id, &msg , packet1.brkval , packet1.freemem , packet1.freemem32 ); - mavlink_msg_meminfo_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_meminfo_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.brkval , packet1.freemem , packet1.freemem32 ); - mavlink_msg_meminfo_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_AP_ADC >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_ap_adc_t packet_in = { - 17235,17339,17443,17547,17651,17755 - }; - mavlink_ap_adc_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.adc1 = packet_in.adc1; - packet1.adc2 = packet_in.adc2; - packet1.adc3 = packet_in.adc3; - packet1.adc4 = packet_in.adc4; - packet1.adc5 = packet_in.adc5; - packet1.adc6 = packet_in.adc6; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_AP_ADC_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_AP_ADC_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_ap_adc_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_ap_adc_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_ap_adc_pack(system_id, component_id, &msg , packet1.adc1 , packet1.adc2 , packet1.adc3 , packet1.adc4 , packet1.adc5 , packet1.adc6 ); - mavlink_msg_ap_adc_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_ap_adc_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.adc1 , packet1.adc2 , packet1.adc3 , packet1.adc4 , packet1.adc5 , packet1.adc6 ); - mavlink_msg_ap_adc_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_DIGICAM_CONFIGURE >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_digicam_configure_t packet_in = { - 17.0,17443,151,218,29,96,163,230,41,108,175 - }; - mavlink_digicam_configure_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.extra_value = packet_in.extra_value; - packet1.shutter_speed = packet_in.shutter_speed; - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - packet1.mode = packet_in.mode; - packet1.aperture = packet_in.aperture; - packet1.iso = packet_in.iso; - packet1.exposure_type = packet_in.exposure_type; - packet1.command_id = packet_in.command_id; - packet1.engine_cut_off = packet_in.engine_cut_off; - packet1.extra_param = packet_in.extra_param; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_DIGICAM_CONFIGURE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_DIGICAM_CONFIGURE_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_digicam_configure_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_digicam_configure_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_digicam_configure_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.mode , packet1.shutter_speed , packet1.aperture , packet1.iso , packet1.exposure_type , packet1.command_id , packet1.engine_cut_off , packet1.extra_param , packet1.extra_value ); - mavlink_msg_digicam_configure_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_digicam_configure_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.mode , packet1.shutter_speed , packet1.aperture , packet1.iso , packet1.exposure_type , packet1.command_id , packet1.engine_cut_off , packet1.extra_param , packet1.extra_value ); - mavlink_msg_digicam_configure_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_DIGICAM_CONTROL >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_digicam_control_t packet_in = { - 17.0,17,84,151,218,29,96,163,230,41 - }; - mavlink_digicam_control_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.extra_value = packet_in.extra_value; - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - packet1.session = packet_in.session; - packet1.zoom_pos = packet_in.zoom_pos; - packet1.zoom_step = packet_in.zoom_step; - packet1.focus_lock = packet_in.focus_lock; - packet1.shot = packet_in.shot; - packet1.command_id = packet_in.command_id; - packet1.extra_param = packet_in.extra_param; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_DIGICAM_CONTROL_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_DIGICAM_CONTROL_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_digicam_control_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_digicam_control_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_digicam_control_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.session , packet1.zoom_pos , packet1.zoom_step , packet1.focus_lock , packet1.shot , packet1.command_id , packet1.extra_param , packet1.extra_value ); - mavlink_msg_digicam_control_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_digicam_control_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.session , packet1.zoom_pos , packet1.zoom_step , packet1.focus_lock , packet1.shot , packet1.command_id , packet1.extra_param , packet1.extra_value ); - mavlink_msg_digicam_control_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MOUNT_CONFIGURE >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_mount_configure_t packet_in = { - 5,72,139,206,17,84 - }; - mavlink_mount_configure_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - packet1.mount_mode = packet_in.mount_mode; - packet1.stab_roll = packet_in.stab_roll; - packet1.stab_pitch = packet_in.stab_pitch; - packet1.stab_yaw = packet_in.stab_yaw; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_MOUNT_CONFIGURE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MOUNT_CONFIGURE_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_mount_configure_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_mount_configure_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_mount_configure_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.mount_mode , packet1.stab_roll , packet1.stab_pitch , packet1.stab_yaw ); - mavlink_msg_mount_configure_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_mount_configure_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.mount_mode , packet1.stab_roll , packet1.stab_pitch , packet1.stab_yaw ); - mavlink_msg_mount_configure_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MOUNT_CONTROL >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_mount_control_t packet_in = { - 963497464,963497672,963497880,41,108,175 - }; - mavlink_mount_control_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.input_a = packet_in.input_a; - packet1.input_b = packet_in.input_b; - packet1.input_c = packet_in.input_c; - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - packet1.save_position = packet_in.save_position; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_MOUNT_CONTROL_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MOUNT_CONTROL_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_mount_control_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_mount_control_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_mount_control_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.input_a , packet1.input_b , packet1.input_c , packet1.save_position ); - mavlink_msg_mount_control_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_mount_control_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.input_a , packet1.input_b , packet1.input_c , packet1.save_position ); - mavlink_msg_mount_control_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MOUNT_STATUS >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_mount_status_t packet_in = { - 963497464,963497672,963497880,41,108 - }; - mavlink_mount_status_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.pointing_a = packet_in.pointing_a; - packet1.pointing_b = packet_in.pointing_b; - packet1.pointing_c = packet_in.pointing_c; - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_MOUNT_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MOUNT_STATUS_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_mount_status_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_mount_status_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_mount_status_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.pointing_a , packet1.pointing_b , packet1.pointing_c ); - mavlink_msg_mount_status_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_mount_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.pointing_a , packet1.pointing_b , packet1.pointing_c ); - mavlink_msg_mount_status_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_FENCE_POINT >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_fence_point_t packet_in = { - 17.0,45.0,29,96,163,230 - }; - mavlink_fence_point_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.lat = packet_in.lat; - packet1.lng = packet_in.lng; - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - packet1.idx = packet_in.idx; - packet1.count = packet_in.count; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_FENCE_POINT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_FENCE_POINT_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_fence_point_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_fence_point_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_fence_point_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.idx , packet1.count , packet1.lat , packet1.lng ); - mavlink_msg_fence_point_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_fence_point_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.idx , packet1.count , packet1.lat , packet1.lng ); - mavlink_msg_fence_point_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_FENCE_FETCH_POINT >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_fence_fetch_point_t packet_in = { - 5,72,139 - }; - mavlink_fence_fetch_point_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - packet1.idx = packet_in.idx; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_FENCE_FETCH_POINT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_FENCE_FETCH_POINT_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_fence_fetch_point_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_fence_fetch_point_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_fence_fetch_point_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.idx ); - mavlink_msg_fence_fetch_point_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_fence_fetch_point_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.idx ); - mavlink_msg_fence_fetch_point_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_AHRS >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_ahrs_t packet_in = { - 17.0,45.0,73.0,101.0,129.0,157.0,185.0 - }; - mavlink_ahrs_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.omegaIx = packet_in.omegaIx; - packet1.omegaIy = packet_in.omegaIy; - packet1.omegaIz = packet_in.omegaIz; - packet1.accel_weight = packet_in.accel_weight; - packet1.renorm_val = packet_in.renorm_val; - packet1.error_rp = packet_in.error_rp; - packet1.error_yaw = packet_in.error_yaw; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_AHRS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_AHRS_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_ahrs_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_ahrs_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_ahrs_pack(system_id, component_id, &msg , packet1.omegaIx , packet1.omegaIy , packet1.omegaIz , packet1.accel_weight , packet1.renorm_val , packet1.error_rp , packet1.error_yaw ); - mavlink_msg_ahrs_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_ahrs_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.omegaIx , packet1.omegaIy , packet1.omegaIz , packet1.accel_weight , packet1.renorm_val , packet1.error_rp , packet1.error_yaw ); - mavlink_msg_ahrs_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SIMSTATE >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_simstate_t packet_in = { - 17.0,45.0,73.0,101.0,129.0,157.0,185.0,213.0,241.0,963499336,963499544 - }; - mavlink_simstate_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.roll = packet_in.roll; - packet1.pitch = packet_in.pitch; - packet1.yaw = packet_in.yaw; - packet1.xacc = packet_in.xacc; - packet1.yacc = packet_in.yacc; - packet1.zacc = packet_in.zacc; - packet1.xgyro = packet_in.xgyro; - packet1.ygyro = packet_in.ygyro; - packet1.zgyro = packet_in.zgyro; - packet1.lat = packet_in.lat; - packet1.lng = packet_in.lng; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_SIMSTATE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SIMSTATE_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_simstate_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_simstate_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_simstate_pack(system_id, component_id, &msg , packet1.roll , packet1.pitch , packet1.yaw , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.lat , packet1.lng ); - mavlink_msg_simstate_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_simstate_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.roll , packet1.pitch , packet1.yaw , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.lat , packet1.lng ); - mavlink_msg_simstate_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_HWSTATUS >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_hwstatus_t packet_in = { - 17235,139 - }; - mavlink_hwstatus_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.Vcc = packet_in.Vcc; - packet1.I2Cerr = packet_in.I2Cerr; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_HWSTATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_HWSTATUS_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_hwstatus_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_hwstatus_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_hwstatus_pack(system_id, component_id, &msg , packet1.Vcc , packet1.I2Cerr ); - mavlink_msg_hwstatus_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_hwstatus_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.Vcc , packet1.I2Cerr ); - mavlink_msg_hwstatus_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_RADIO >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_radio_t packet_in = { - 17235,17339,17,84,151,218,29 - }; - mavlink_radio_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.rxerrors = packet_in.rxerrors; - packet1.fixed = packet_in.fixed; - packet1.rssi = packet_in.rssi; - packet1.remrssi = packet_in.remrssi; - packet1.txbuf = packet_in.txbuf; - packet1.noise = packet_in.noise; - packet1.remnoise = packet_in.remnoise; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_RADIO_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_RADIO_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_radio_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_radio_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_radio_pack(system_id, component_id, &msg , packet1.rssi , packet1.remrssi , packet1.txbuf , packet1.noise , packet1.remnoise , packet1.rxerrors , packet1.fixed ); - mavlink_msg_radio_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_radio_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.rssi , packet1.remrssi , packet1.txbuf , packet1.noise , packet1.remnoise , packet1.rxerrors , packet1.fixed ); - mavlink_msg_radio_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_LIMITS_STATUS >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_limits_status_t packet_in = { - 963497464,963497672,963497880,963498088,18067,187,254,65,132 - }; - mavlink_limits_status_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.last_trigger = packet_in.last_trigger; - packet1.last_action = packet_in.last_action; - packet1.last_recovery = packet_in.last_recovery; - packet1.last_clear = packet_in.last_clear; - packet1.breach_count = packet_in.breach_count; - packet1.limits_state = packet_in.limits_state; - packet1.mods_enabled = packet_in.mods_enabled; - packet1.mods_required = packet_in.mods_required; - packet1.mods_triggered = packet_in.mods_triggered; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_LIMITS_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_LIMITS_STATUS_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_limits_status_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_limits_status_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_limits_status_pack(system_id, component_id, &msg , packet1.limits_state , packet1.last_trigger , packet1.last_action , packet1.last_recovery , packet1.last_clear , packet1.breach_count , packet1.mods_enabled , packet1.mods_required , packet1.mods_triggered ); - mavlink_msg_limits_status_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_limits_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.limits_state , packet1.last_trigger , packet1.last_action , packet1.last_recovery , packet1.last_clear , packet1.breach_count , packet1.mods_enabled , packet1.mods_required , packet1.mods_triggered ); - mavlink_msg_limits_status_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_WIND >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_wind_t packet_in = { - 17.0,45.0,73.0 - }; - mavlink_wind_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.direction = packet_in.direction; - packet1.speed = packet_in.speed; - packet1.speed_z = packet_in.speed_z; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_WIND_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_WIND_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_wind_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_wind_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_wind_pack(system_id, component_id, &msg , packet1.direction , packet1.speed , packet1.speed_z ); - mavlink_msg_wind_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_wind_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.direction , packet1.speed , packet1.speed_z ); - mavlink_msg_wind_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_DATA16 >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_data16_t packet_in = { - 5,72,{ 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154 } - }; - mavlink_data16_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.type = packet_in.type; - packet1.len = packet_in.len; - - mav_array_memcpy(packet1.data, packet_in.data, sizeof(uint8_t)*16); - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_DATA16_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_DATA16_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_data16_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_data16_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_data16_pack(system_id, component_id, &msg , packet1.type , packet1.len , packet1.data ); - mavlink_msg_data16_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_data16_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.type , packet1.len , packet1.data ); - mavlink_msg_data16_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_DATA32 >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_data32_t packet_in = { - 5,72,{ 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170 } - }; - mavlink_data32_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.type = packet_in.type; - packet1.len = packet_in.len; - - mav_array_memcpy(packet1.data, packet_in.data, sizeof(uint8_t)*32); - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_DATA32_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_DATA32_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_data32_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_data32_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_data32_pack(system_id, component_id, &msg , packet1.type , packet1.len , packet1.data ); - mavlink_msg_data32_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_data32_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.type , packet1.len , packet1.data ); - mavlink_msg_data32_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_DATA64 >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_data64_t packet_in = { - 5,72,{ 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202 } - }; - mavlink_data64_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.type = packet_in.type; - packet1.len = packet_in.len; - - mav_array_memcpy(packet1.data, packet_in.data, sizeof(uint8_t)*64); - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_DATA64_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_DATA64_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_data64_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_data64_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_data64_pack(system_id, component_id, &msg , packet1.type , packet1.len , packet1.data ); - mavlink_msg_data64_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_data64_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.type , packet1.len , packet1.data ); - mavlink_msg_data64_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_DATA96 >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_data96_t packet_in = { - 5,72,{ 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234 } - }; - mavlink_data96_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.type = packet_in.type; - packet1.len = packet_in.len; - - mav_array_memcpy(packet1.data, packet_in.data, sizeof(uint8_t)*96); - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_DATA96_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_DATA96_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_data96_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_data96_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_data96_pack(system_id, component_id, &msg , packet1.type , packet1.len , packet1.data ); - mavlink_msg_data96_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_data96_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.type , packet1.len , packet1.data ); - mavlink_msg_data96_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_RANGEFINDER >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_rangefinder_t packet_in = { - 17.0,45.0 - }; - mavlink_rangefinder_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.distance = packet_in.distance; - packet1.voltage = packet_in.voltage; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_RANGEFINDER_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_RANGEFINDER_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_rangefinder_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_rangefinder_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_rangefinder_pack(system_id, component_id, &msg , packet1.distance , packet1.voltage ); - mavlink_msg_rangefinder_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_rangefinder_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.distance , packet1.voltage ); - mavlink_msg_rangefinder_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_AIRSPEED_AUTOCAL >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_airspeed_autocal_t packet_in = { - 17.0,45.0,73.0,101.0,129.0,157.0,185.0,213.0,241.0,269.0,297.0,325.0 - }; - mavlink_airspeed_autocal_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.vx = packet_in.vx; - packet1.vy = packet_in.vy; - packet1.vz = packet_in.vz; - packet1.diff_pressure = packet_in.diff_pressure; - packet1.EAS2TAS = packet_in.EAS2TAS; - packet1.ratio = packet_in.ratio; - packet1.state_x = packet_in.state_x; - packet1.state_y = packet_in.state_y; - packet1.state_z = packet_in.state_z; - packet1.Pax = packet_in.Pax; - packet1.Pby = packet_in.Pby; - packet1.Pcz = packet_in.Pcz; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_AIRSPEED_AUTOCAL_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_airspeed_autocal_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_airspeed_autocal_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_airspeed_autocal_pack(system_id, component_id, &msg , packet1.vx , packet1.vy , packet1.vz , packet1.diff_pressure , packet1.EAS2TAS , packet1.ratio , packet1.state_x , packet1.state_y , packet1.state_z , packet1.Pax , packet1.Pby , packet1.Pcz ); - mavlink_msg_airspeed_autocal_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_airspeed_autocal_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.vx , packet1.vy , packet1.vz , packet1.diff_pressure , packet1.EAS2TAS , packet1.ratio , packet1.state_x , packet1.state_y , packet1.state_z , packet1.Pax , packet1.Pby , packet1.Pcz ); - mavlink_msg_airspeed_autocal_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_RALLY_POINT >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_rally_point_t packet_in = { - 963497464,963497672,17651,17755,17859,175,242,53,120,187 - }; - mavlink_rally_point_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.lat = packet_in.lat; - packet1.lng = packet_in.lng; - packet1.alt = packet_in.alt; - packet1.break_alt = packet_in.break_alt; - packet1.land_dir = packet_in.land_dir; - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - packet1.idx = packet_in.idx; - packet1.count = packet_in.count; - packet1.flags = packet_in.flags; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_RALLY_POINT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_RALLY_POINT_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_rally_point_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_rally_point_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_rally_point_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.idx , packet1.count , packet1.lat , packet1.lng , packet1.alt , packet1.break_alt , packet1.land_dir , packet1.flags ); - mavlink_msg_rally_point_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_rally_point_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.idx , packet1.count , packet1.lat , packet1.lng , packet1.alt , packet1.break_alt , packet1.land_dir , packet1.flags ); - mavlink_msg_rally_point_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_RALLY_FETCH_POINT >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_rally_fetch_point_t packet_in = { - 5,72,139 - }; - mavlink_rally_fetch_point_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - packet1.idx = packet_in.idx; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_RALLY_FETCH_POINT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_RALLY_FETCH_POINT_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_rally_fetch_point_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_rally_fetch_point_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_rally_fetch_point_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.idx ); - mavlink_msg_rally_fetch_point_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_rally_fetch_point_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.idx ); - mavlink_msg_rally_fetch_point_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_COMPASSMOT_STATUS >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_compassmot_status_t packet_in = { - 17.0,45.0,73.0,101.0,18067,18171 - }; - mavlink_compassmot_status_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.current = packet_in.current; - packet1.CompensationX = packet_in.CompensationX; - packet1.CompensationY = packet_in.CompensationY; - packet1.CompensationZ = packet_in.CompensationZ; - packet1.throttle = packet_in.throttle; - packet1.interference = packet_in.interference; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_COMPASSMOT_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_COMPASSMOT_STATUS_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_compassmot_status_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_compassmot_status_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_compassmot_status_pack(system_id, component_id, &msg , packet1.throttle , packet1.current , packet1.interference , packet1.CompensationX , packet1.CompensationY , packet1.CompensationZ ); - mavlink_msg_compassmot_status_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_compassmot_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.throttle , packet1.current , packet1.interference , packet1.CompensationX , packet1.CompensationY , packet1.CompensationZ ); - mavlink_msg_compassmot_status_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_AHRS2 >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_ahrs2_t packet_in = { - 17.0,45.0,73.0,101.0,963498296,963498504 - }; - mavlink_ahrs2_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.roll = packet_in.roll; - packet1.pitch = packet_in.pitch; - packet1.yaw = packet_in.yaw; - packet1.altitude = packet_in.altitude; - packet1.lat = packet_in.lat; - packet1.lng = packet_in.lng; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_AHRS2_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_AHRS2_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_ahrs2_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_ahrs2_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_ahrs2_pack(system_id, component_id, &msg , packet1.roll , packet1.pitch , packet1.yaw , packet1.altitude , packet1.lat , packet1.lng ); - mavlink_msg_ahrs2_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_ahrs2_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.roll , packet1.pitch , packet1.yaw , packet1.altitude , packet1.lat , packet1.lng ); - mavlink_msg_ahrs2_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_CAMERA_STATUS >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_camera_status_t packet_in = { - 93372036854775807ULL,73.0,101.0,129.0,157.0,18483,211,22,89 - }; - mavlink_camera_status_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.time_usec = packet_in.time_usec; - packet1.p1 = packet_in.p1; - packet1.p2 = packet_in.p2; - packet1.p3 = packet_in.p3; - packet1.p4 = packet_in.p4; - packet1.img_idx = packet_in.img_idx; - packet1.target_system = packet_in.target_system; - packet1.cam_idx = packet_in.cam_idx; - packet1.event_id = packet_in.event_id; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_CAMERA_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_CAMERA_STATUS_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_camera_status_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_camera_status_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_camera_status_pack(system_id, component_id, &msg , packet1.time_usec , packet1.target_system , packet1.cam_idx , packet1.img_idx , packet1.event_id , packet1.p1 , packet1.p2 , packet1.p3 , packet1.p4 ); - mavlink_msg_camera_status_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_camera_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.target_system , packet1.cam_idx , packet1.img_idx , packet1.event_id , packet1.p1 , packet1.p2 , packet1.p3 , packet1.p4 ); - mavlink_msg_camera_status_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_CAMERA_FEEDBACK >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_camera_feedback_t packet_in = { - 93372036854775807ULL,963497880,963498088,129.0,157.0,185.0,213.0,241.0,269.0,19315,3,70,137,19575 - }; - mavlink_camera_feedback_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.time_usec = packet_in.time_usec; - packet1.lat = packet_in.lat; - packet1.lng = packet_in.lng; - packet1.alt_msl = packet_in.alt_msl; - packet1.alt_rel = packet_in.alt_rel; - packet1.roll = packet_in.roll; - packet1.pitch = packet_in.pitch; - packet1.yaw = packet_in.yaw; - packet1.foc_len = packet_in.foc_len; - packet1.img_idx = packet_in.img_idx; - packet1.target_system = packet_in.target_system; - packet1.cam_idx = packet_in.cam_idx; - packet1.flags = packet_in.flags; - packet1.completed_captures = packet_in.completed_captures; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_CAMERA_FEEDBACK_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_CAMERA_FEEDBACK_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_camera_feedback_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_camera_feedback_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_camera_feedback_pack(system_id, component_id, &msg , packet1.time_usec , packet1.target_system , packet1.cam_idx , packet1.img_idx , packet1.lat , packet1.lng , packet1.alt_msl , packet1.alt_rel , packet1.roll , packet1.pitch , packet1.yaw , packet1.foc_len , packet1.flags , packet1.completed_captures ); - mavlink_msg_camera_feedback_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_camera_feedback_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.target_system , packet1.cam_idx , packet1.img_idx , packet1.lat , packet1.lng , packet1.alt_msl , packet1.alt_rel , packet1.roll , packet1.pitch , packet1.yaw , packet1.foc_len , packet1.flags , packet1.completed_captures ); - mavlink_msg_camera_feedback_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_BATTERY2 >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_battery2_t packet_in = { - 17235,17339 - }; - mavlink_battery2_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.voltage = packet_in.voltage; - packet1.current_battery = packet_in.current_battery; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_BATTERY2_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_BATTERY2_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_battery2_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_battery2_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_battery2_pack(system_id, component_id, &msg , packet1.voltage , packet1.current_battery ); - mavlink_msg_battery2_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_battery2_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.voltage , packet1.current_battery ); - mavlink_msg_battery2_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_AHRS3 >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_ahrs3_t packet_in = { - 17.0,45.0,73.0,101.0,963498296,963498504,185.0,213.0,241.0,269.0 - }; - mavlink_ahrs3_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.roll = packet_in.roll; - packet1.pitch = packet_in.pitch; - packet1.yaw = packet_in.yaw; - packet1.altitude = packet_in.altitude; - packet1.lat = packet_in.lat; - packet1.lng = packet_in.lng; - packet1.v1 = packet_in.v1; - packet1.v2 = packet_in.v2; - packet1.v3 = packet_in.v3; - packet1.v4 = packet_in.v4; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_AHRS3_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_AHRS3_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_ahrs3_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_ahrs3_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_ahrs3_pack(system_id, component_id, &msg , packet1.roll , packet1.pitch , packet1.yaw , packet1.altitude , packet1.lat , packet1.lng , packet1.v1 , packet1.v2 , packet1.v3 , packet1.v4 ); - mavlink_msg_ahrs3_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_ahrs3_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.roll , packet1.pitch , packet1.yaw , packet1.altitude , packet1.lat , packet1.lng , packet1.v1 , packet1.v2 , packet1.v3 , packet1.v4 ); - mavlink_msg_ahrs3_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_autopilot_version_request_t packet_in = { - 5,72 - }; - mavlink_autopilot_version_request_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_autopilot_version_request_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_autopilot_version_request_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_autopilot_version_request_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component ); - mavlink_msg_autopilot_version_request_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_autopilot_version_request_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component ); - mavlink_msg_autopilot_version_request_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_remote_log_data_block_t packet_in = { - 963497464,17,84,{ 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94 } - }; - mavlink_remote_log_data_block_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.seqno = packet_in.seqno; - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - - mav_array_memcpy(packet1.data, packet_in.data, sizeof(uint8_t)*200); - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_remote_log_data_block_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_remote_log_data_block_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_remote_log_data_block_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.seqno , packet1.data ); - mavlink_msg_remote_log_data_block_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_remote_log_data_block_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.seqno , packet1.data ); - mavlink_msg_remote_log_data_block_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_remote_log_block_status_t packet_in = { - 963497464,17,84,151 - }; - mavlink_remote_log_block_status_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.seqno = packet_in.seqno; - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - packet1.status = packet_in.status; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_remote_log_block_status_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_remote_log_block_status_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_remote_log_block_status_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.seqno , packet1.status ); - mavlink_msg_remote_log_block_status_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_remote_log_block_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.seqno , packet1.status ); - mavlink_msg_remote_log_block_status_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_LED_CONTROL >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_led_control_t packet_in = { - 5,72,139,206,17,{ 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107 } - }; - mavlink_led_control_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - packet1.instance = packet_in.instance; - packet1.pattern = packet_in.pattern; - packet1.custom_len = packet_in.custom_len; - - mav_array_memcpy(packet1.custom_bytes, packet_in.custom_bytes, sizeof(uint8_t)*24); - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_LED_CONTROL_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_LED_CONTROL_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_led_control_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_led_control_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_led_control_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.instance , packet1.pattern , packet1.custom_len , packet1.custom_bytes ); - mavlink_msg_led_control_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_led_control_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.instance , packet1.pattern , packet1.custom_len , packet1.custom_bytes ); - mavlink_msg_led_control_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MAG_CAL_PROGRESS >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_mag_cal_progress_t packet_in = { - 17.0,45.0,73.0,41,108,175,242,53,{ 120, 121, 122, 123, 124, 125, 126, 127, 128, 129 } - }; - mavlink_mag_cal_progress_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.direction_x = packet_in.direction_x; - packet1.direction_y = packet_in.direction_y; - packet1.direction_z = packet_in.direction_z; - packet1.compass_id = packet_in.compass_id; - packet1.cal_mask = packet_in.cal_mask; - packet1.cal_status = packet_in.cal_status; - packet1.attempt = packet_in.attempt; - packet1.completion_pct = packet_in.completion_pct; - - mav_array_memcpy(packet1.completion_mask, packet_in.completion_mask, sizeof(uint8_t)*10); - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_MAG_CAL_PROGRESS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MAG_CAL_PROGRESS_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_mag_cal_progress_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_mag_cal_progress_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_mag_cal_progress_pack(system_id, component_id, &msg , packet1.compass_id , packet1.cal_mask , packet1.cal_status , packet1.attempt , packet1.completion_pct , packet1.completion_mask , packet1.direction_x , packet1.direction_y , packet1.direction_z ); - mavlink_msg_mag_cal_progress_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_mag_cal_progress_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.compass_id , packet1.cal_mask , packet1.cal_status , packet1.attempt , packet1.completion_pct , packet1.completion_mask , packet1.direction_x , packet1.direction_y , packet1.direction_z ); - mavlink_msg_mag_cal_progress_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_EKF_STATUS_REPORT >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_ekf_status_report_t packet_in = { - 17.0,45.0,73.0,101.0,129.0,18275,171.0 - }; - mavlink_ekf_status_report_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.velocity_variance = packet_in.velocity_variance; - packet1.pos_horiz_variance = packet_in.pos_horiz_variance; - packet1.pos_vert_variance = packet_in.pos_vert_variance; - packet1.compass_variance = packet_in.compass_variance; - packet1.terrain_alt_variance = packet_in.terrain_alt_variance; - packet1.flags = packet_in.flags; - packet1.airspeed_variance = packet_in.airspeed_variance; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_EKF_STATUS_REPORT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_EKF_STATUS_REPORT_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_ekf_status_report_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_ekf_status_report_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_ekf_status_report_pack(system_id, component_id, &msg , packet1.flags , packet1.velocity_variance , packet1.pos_horiz_variance , packet1.pos_vert_variance , packet1.compass_variance , packet1.terrain_alt_variance , packet1.airspeed_variance ); - mavlink_msg_ekf_status_report_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_ekf_status_report_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.flags , packet1.velocity_variance , packet1.pos_horiz_variance , packet1.pos_vert_variance , packet1.compass_variance , packet1.terrain_alt_variance , packet1.airspeed_variance ); - mavlink_msg_ekf_status_report_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_PID_TUNING >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_pid_tuning_t packet_in = { - 17.0,45.0,73.0,101.0,129.0,157.0,77 - }; - mavlink_pid_tuning_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.desired = packet_in.desired; - packet1.achieved = packet_in.achieved; - packet1.FF = packet_in.FF; - packet1.P = packet_in.P; - packet1.I = packet_in.I; - packet1.D = packet_in.D; - packet1.axis = packet_in.axis; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_PID_TUNING_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_PID_TUNING_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_pid_tuning_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_pid_tuning_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_pid_tuning_pack(system_id, component_id, &msg , packet1.axis , packet1.desired , packet1.achieved , packet1.FF , packet1.P , packet1.I , packet1.D ); - mavlink_msg_pid_tuning_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_pid_tuning_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.axis , packet1.desired , packet1.achieved , packet1.FF , packet1.P , packet1.I , packet1.D ); - mavlink_msg_pid_tuning_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_DEEPSTALL >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_deepstall_t packet_in = { - 963497464,963497672,963497880,963498088,963498296,963498504,185.0,213.0,241.0,113 - }; - mavlink_deepstall_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.landing_lat = packet_in.landing_lat; - packet1.landing_lon = packet_in.landing_lon; - packet1.path_lat = packet_in.path_lat; - packet1.path_lon = packet_in.path_lon; - packet1.arc_entry_lat = packet_in.arc_entry_lat; - packet1.arc_entry_lon = packet_in.arc_entry_lon; - packet1.altitude = packet_in.altitude; - packet1.expected_travel_distance = packet_in.expected_travel_distance; - packet1.cross_track_error = packet_in.cross_track_error; - packet1.stage = packet_in.stage; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_DEEPSTALL_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_DEEPSTALL_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_deepstall_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_deepstall_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_deepstall_pack(system_id, component_id, &msg , packet1.landing_lat , packet1.landing_lon , packet1.path_lat , packet1.path_lon , packet1.arc_entry_lat , packet1.arc_entry_lon , packet1.altitude , packet1.expected_travel_distance , packet1.cross_track_error , packet1.stage ); - mavlink_msg_deepstall_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_deepstall_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.landing_lat , packet1.landing_lon , packet1.path_lat , packet1.path_lon , packet1.arc_entry_lat , packet1.arc_entry_lon , packet1.altitude , packet1.expected_travel_distance , packet1.cross_track_error , packet1.stage ); - mavlink_msg_deepstall_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GIMBAL_REPORT >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_gimbal_report_t packet_in = { - 17.0,45.0,73.0,101.0,129.0,157.0,185.0,213.0,241.0,269.0,125,192 - }; - mavlink_gimbal_report_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.delta_time = packet_in.delta_time; - packet1.delta_angle_x = packet_in.delta_angle_x; - packet1.delta_angle_y = packet_in.delta_angle_y; - packet1.delta_angle_z = packet_in.delta_angle_z; - packet1.delta_velocity_x = packet_in.delta_velocity_x; - packet1.delta_velocity_y = packet_in.delta_velocity_y; - packet1.delta_velocity_z = packet_in.delta_velocity_z; - packet1.joint_roll = packet_in.joint_roll; - packet1.joint_el = packet_in.joint_el; - packet1.joint_az = packet_in.joint_az; - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_GIMBAL_REPORT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GIMBAL_REPORT_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gimbal_report_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_gimbal_report_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gimbal_report_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.delta_time , packet1.delta_angle_x , packet1.delta_angle_y , packet1.delta_angle_z , packet1.delta_velocity_x , packet1.delta_velocity_y , packet1.delta_velocity_z , packet1.joint_roll , packet1.joint_el , packet1.joint_az ); - mavlink_msg_gimbal_report_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gimbal_report_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.delta_time , packet1.delta_angle_x , packet1.delta_angle_y , packet1.delta_angle_z , packet1.delta_velocity_x , packet1.delta_velocity_y , packet1.delta_velocity_z , packet1.joint_roll , packet1.joint_el , packet1.joint_az ); - mavlink_msg_gimbal_report_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GIMBAL_CONTROL >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_gimbal_control_t packet_in = { - 17.0,45.0,73.0,41,108 - }; - mavlink_gimbal_control_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.demanded_rate_x = packet_in.demanded_rate_x; - packet1.demanded_rate_y = packet_in.demanded_rate_y; - packet1.demanded_rate_z = packet_in.demanded_rate_z; - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_GIMBAL_CONTROL_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GIMBAL_CONTROL_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gimbal_control_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_gimbal_control_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gimbal_control_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.demanded_rate_x , packet1.demanded_rate_y , packet1.demanded_rate_z ); - mavlink_msg_gimbal_control_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gimbal_control_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.demanded_rate_x , packet1.demanded_rate_y , packet1.demanded_rate_z ); - mavlink_msg_gimbal_control_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_gimbal_torque_cmd_report_t packet_in = { - 17235,17339,17443,151,218 - }; - mavlink_gimbal_torque_cmd_report_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.rl_torque_cmd = packet_in.rl_torque_cmd; - packet1.el_torque_cmd = packet_in.el_torque_cmd; - packet1.az_torque_cmd = packet_in.az_torque_cmd; - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gimbal_torque_cmd_report_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_gimbal_torque_cmd_report_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gimbal_torque_cmd_report_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.rl_torque_cmd , packet1.el_torque_cmd , packet1.az_torque_cmd ); - mavlink_msg_gimbal_torque_cmd_report_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gimbal_torque_cmd_report_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.rl_torque_cmd , packet1.el_torque_cmd , packet1.az_torque_cmd ); - mavlink_msg_gimbal_torque_cmd_report_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GOPRO_HEARTBEAT >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_gopro_heartbeat_t packet_in = { - 5,72,139 - }; - mavlink_gopro_heartbeat_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.status = packet_in.status; - packet1.capture_mode = packet_in.capture_mode; - packet1.flags = packet_in.flags; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_GOPRO_HEARTBEAT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GOPRO_HEARTBEAT_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gopro_heartbeat_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_gopro_heartbeat_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gopro_heartbeat_pack(system_id, component_id, &msg , packet1.status , packet1.capture_mode , packet1.flags ); - mavlink_msg_gopro_heartbeat_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gopro_heartbeat_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.status , packet1.capture_mode , packet1.flags ); - mavlink_msg_gopro_heartbeat_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GOPRO_GET_REQUEST >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_gopro_get_request_t packet_in = { - 5,72,139 - }; - mavlink_gopro_get_request_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - packet1.cmd_id = packet_in.cmd_id; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_GOPRO_GET_REQUEST_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GOPRO_GET_REQUEST_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gopro_get_request_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_gopro_get_request_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gopro_get_request_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.cmd_id ); - mavlink_msg_gopro_get_request_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gopro_get_request_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.cmd_id ); - mavlink_msg_gopro_get_request_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GOPRO_GET_RESPONSE >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_gopro_get_response_t packet_in = { - 5,72,{ 139, 140, 141, 142 } - }; - mavlink_gopro_get_response_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.cmd_id = packet_in.cmd_id; - packet1.status = packet_in.status; - - mav_array_memcpy(packet1.value, packet_in.value, sizeof(uint8_t)*4); - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gopro_get_response_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_gopro_get_response_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gopro_get_response_pack(system_id, component_id, &msg , packet1.cmd_id , packet1.status , packet1.value ); - mavlink_msg_gopro_get_response_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gopro_get_response_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.cmd_id , packet1.status , packet1.value ); - mavlink_msg_gopro_get_response_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GOPRO_SET_REQUEST >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_gopro_set_request_t packet_in = { - 5,72,139,{ 206, 207, 208, 209 } - }; - mavlink_gopro_set_request_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - packet1.cmd_id = packet_in.cmd_id; - - mav_array_memcpy(packet1.value, packet_in.value, sizeof(uint8_t)*4); - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_GOPRO_SET_REQUEST_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GOPRO_SET_REQUEST_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gopro_set_request_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_gopro_set_request_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gopro_set_request_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.cmd_id , packet1.value ); - mavlink_msg_gopro_set_request_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gopro_set_request_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.cmd_id , packet1.value ); - mavlink_msg_gopro_set_request_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GOPRO_SET_RESPONSE >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_gopro_set_response_t packet_in = { - 5,72 - }; - mavlink_gopro_set_response_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.cmd_id = packet_in.cmd_id; - packet1.status = packet_in.status; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gopro_set_response_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_gopro_set_response_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gopro_set_response_pack(system_id, component_id, &msg , packet1.cmd_id , packet1.status ); - mavlink_msg_gopro_set_response_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gopro_set_response_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.cmd_id , packet1.status ); - mavlink_msg_gopro_set_response_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_RPM >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_rpm_t packet_in = { - 17.0,45.0 - }; - mavlink_rpm_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.rpm1 = packet_in.rpm1; - packet1.rpm2 = packet_in.rpm2; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_RPM_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_RPM_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_rpm_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_rpm_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_rpm_pack(system_id, component_id, &msg , packet1.rpm1 , packet1.rpm2 ); - mavlink_msg_rpm_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_rpm_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.rpm1 , packet1.rpm2 ); - mavlink_msg_rpm_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_DEVICE_OP_READ >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_device_op_read_t packet_in = { - 963497464,17,84,151,218,29,"JKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUV",216,27,94 - }; - mavlink_device_op_read_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.request_id = packet_in.request_id; - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - packet1.bustype = packet_in.bustype; - packet1.bus = packet_in.bus; - packet1.address = packet_in.address; - packet1.regstart = packet_in.regstart; - packet1.count = packet_in.count; - packet1.bank = packet_in.bank; - - mav_array_memcpy(packet1.busname, packet_in.busname, sizeof(char)*40); - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_DEVICE_OP_READ_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_DEVICE_OP_READ_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_device_op_read_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_device_op_read_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_device_op_read_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.request_id , packet1.bustype , packet1.bus , packet1.address , packet1.busname , packet1.regstart , packet1.count , packet1.bank ); - mavlink_msg_device_op_read_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_device_op_read_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.request_id , packet1.bustype , packet1.bus , packet1.address , packet1.busname , packet1.regstart , packet1.count , packet1.bank ); - mavlink_msg_device_op_read_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_device_op_read_reply_t packet_in = { - 963497464,17,84,151,{ 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89 },90 - }; - mavlink_device_op_read_reply_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.request_id = packet_in.request_id; - packet1.result = packet_in.result; - packet1.regstart = packet_in.regstart; - packet1.count = packet_in.count; - packet1.bank = packet_in.bank; - - mav_array_memcpy(packet1.data, packet_in.data, sizeof(uint8_t)*128); - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_device_op_read_reply_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_device_op_read_reply_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_device_op_read_reply_pack(system_id, component_id, &msg , packet1.request_id , packet1.result , packet1.regstart , packet1.count , packet1.data , packet1.bank ); - mavlink_msg_device_op_read_reply_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_device_op_read_reply_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.request_id , packet1.result , packet1.regstart , packet1.count , packet1.data , packet1.bank ); - mavlink_msg_device_op_read_reply_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_DEVICE_OP_WRITE >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_device_op_write_t packet_in = { - 963497464,17,84,151,218,29,"JKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUV",216,27,{ 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221 },222 - }; - mavlink_device_op_write_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.request_id = packet_in.request_id; - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - packet1.bustype = packet_in.bustype; - packet1.bus = packet_in.bus; - packet1.address = packet_in.address; - packet1.regstart = packet_in.regstart; - packet1.count = packet_in.count; - packet1.bank = packet_in.bank; - - mav_array_memcpy(packet1.busname, packet_in.busname, sizeof(char)*40); - mav_array_memcpy(packet1.data, packet_in.data, sizeof(uint8_t)*128); - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_DEVICE_OP_WRITE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_DEVICE_OP_WRITE_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_device_op_write_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_device_op_write_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_device_op_write_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.request_id , packet1.bustype , packet1.bus , packet1.address , packet1.busname , packet1.regstart , packet1.count , packet1.data , packet1.bank ); - mavlink_msg_device_op_write_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_device_op_write_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.request_id , packet1.bustype , packet1.bus , packet1.address , packet1.busname , packet1.regstart , packet1.count , packet1.data , packet1.bank ); - mavlink_msg_device_op_write_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_device_op_write_reply_t packet_in = { - 963497464,17 - }; - mavlink_device_op_write_reply_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.request_id = packet_in.request_id; - packet1.result = packet_in.result; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_device_op_write_reply_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_device_op_write_reply_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_device_op_write_reply_pack(system_id, component_id, &msg , packet1.request_id , packet1.result ); - mavlink_msg_device_op_write_reply_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_device_op_write_reply_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.request_id , packet1.result ); - mavlink_msg_device_op_write_reply_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ADAP_TUNING >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_adap_tuning_t packet_in = { - 17.0,45.0,73.0,101.0,129.0,157.0,185.0,213.0,241.0,269.0,297.0,325.0,149 - }; - mavlink_adap_tuning_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.desired = packet_in.desired; - packet1.achieved = packet_in.achieved; - packet1.error = packet_in.error; - packet1.theta = packet_in.theta; - packet1.omega = packet_in.omega; - packet1.sigma = packet_in.sigma; - packet1.theta_dot = packet_in.theta_dot; - packet1.omega_dot = packet_in.omega_dot; - packet1.sigma_dot = packet_in.sigma_dot; - packet1.f = packet_in.f; - packet1.f_dot = packet_in.f_dot; - packet1.u = packet_in.u; - packet1.axis = packet_in.axis; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_ADAP_TUNING_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ADAP_TUNING_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_adap_tuning_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_adap_tuning_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_adap_tuning_pack(system_id, component_id, &msg , packet1.axis , packet1.desired , packet1.achieved , packet1.error , packet1.theta , packet1.omega , packet1.sigma , packet1.theta_dot , packet1.omega_dot , packet1.sigma_dot , packet1.f , packet1.f_dot , packet1.u ); - mavlink_msg_adap_tuning_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_adap_tuning_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.axis , packet1.desired , packet1.achieved , packet1.error , packet1.theta , packet1.omega , packet1.sigma , packet1.theta_dot , packet1.omega_dot , packet1.sigma_dot , packet1.f , packet1.f_dot , packet1.u ); - mavlink_msg_adap_tuning_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_VISION_POSITION_DELTA >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_vision_position_delta_t packet_in = { - 93372036854775807ULL,93372036854776311ULL,{ 129.0, 130.0, 131.0 },{ 213.0, 214.0, 215.0 },297.0 - }; - mavlink_vision_position_delta_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.time_usec = packet_in.time_usec; - packet1.time_delta_usec = packet_in.time_delta_usec; - packet1.confidence = packet_in.confidence; - - mav_array_memcpy(packet1.angle_delta, packet_in.angle_delta, sizeof(float)*3); - mav_array_memcpy(packet1.position_delta, packet_in.position_delta, sizeof(float)*3); - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_VISION_POSITION_DELTA_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_VISION_POSITION_DELTA_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_vision_position_delta_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_vision_position_delta_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_vision_position_delta_pack(system_id, component_id, &msg , packet1.time_usec , packet1.time_delta_usec , packet1.angle_delta , packet1.position_delta , packet1.confidence ); - mavlink_msg_vision_position_delta_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_vision_position_delta_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.time_delta_usec , packet1.angle_delta , packet1.position_delta , packet1.confidence ); - mavlink_msg_vision_position_delta_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_AOA_SSA >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_aoa_ssa_t packet_in = { - 93372036854775807ULL,73.0,101.0 - }; - mavlink_aoa_ssa_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.time_usec = packet_in.time_usec; - packet1.AOA = packet_in.AOA; - packet1.SSA = packet_in.SSA; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_AOA_SSA_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_AOA_SSA_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_aoa_ssa_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_aoa_ssa_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_aoa_ssa_pack(system_id, component_id, &msg , packet1.time_usec , packet1.AOA , packet1.SSA ); - mavlink_msg_aoa_ssa_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_aoa_ssa_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.AOA , packet1.SSA ); - mavlink_msg_aoa_ssa_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4 >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_esc_telemetry_1_to_4_t packet_in = { - { 17235, 17236, 17237, 17238 },{ 17651, 17652, 17653, 17654 },{ 18067, 18068, 18069, 18070 },{ 18483, 18484, 18485, 18486 },{ 18899, 18900, 18901, 18902 },{ 125, 126, 127, 128 } - }; - mavlink_esc_telemetry_1_to_4_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - - mav_array_memcpy(packet1.voltage, packet_in.voltage, sizeof(uint16_t)*4); - mav_array_memcpy(packet1.current, packet_in.current, sizeof(uint16_t)*4); - mav_array_memcpy(packet1.totalcurrent, packet_in.totalcurrent, sizeof(uint16_t)*4); - mav_array_memcpy(packet1.rpm, packet_in.rpm, sizeof(uint16_t)*4); - mav_array_memcpy(packet1.count, packet_in.count, sizeof(uint16_t)*4); - mav_array_memcpy(packet1.temperature, packet_in.temperature, sizeof(uint8_t)*4); - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ESC_TELEMETRY_1_TO_4_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_esc_telemetry_1_to_4_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_esc_telemetry_1_to_4_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_esc_telemetry_1_to_4_pack(system_id, component_id, &msg , packet1.temperature , packet1.voltage , packet1.current , packet1.totalcurrent , packet1.rpm , packet1.count ); - mavlink_msg_esc_telemetry_1_to_4_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_esc_telemetry_1_to_4_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.temperature , packet1.voltage , packet1.current , packet1.totalcurrent , packet1.rpm , packet1.count ); - mavlink_msg_esc_telemetry_1_to_4_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8 >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_esc_telemetry_5_to_8_t packet_in = { - { 17235, 17236, 17237, 17238 },{ 17651, 17652, 17653, 17654 },{ 18067, 18068, 18069, 18070 },{ 18483, 18484, 18485, 18486 },{ 18899, 18900, 18901, 18902 },{ 125, 126, 127, 128 } - }; - mavlink_esc_telemetry_5_to_8_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - - mav_array_memcpy(packet1.voltage, packet_in.voltage, sizeof(uint16_t)*4); - mav_array_memcpy(packet1.current, packet_in.current, sizeof(uint16_t)*4); - mav_array_memcpy(packet1.totalcurrent, packet_in.totalcurrent, sizeof(uint16_t)*4); - mav_array_memcpy(packet1.rpm, packet_in.rpm, sizeof(uint16_t)*4); - mav_array_memcpy(packet1.count, packet_in.count, sizeof(uint16_t)*4); - mav_array_memcpy(packet1.temperature, packet_in.temperature, sizeof(uint8_t)*4); - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ESC_TELEMETRY_5_TO_8_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_esc_telemetry_5_to_8_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_esc_telemetry_5_to_8_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_esc_telemetry_5_to_8_pack(system_id, component_id, &msg , packet1.temperature , packet1.voltage , packet1.current , packet1.totalcurrent , packet1.rpm , packet1.count ); - mavlink_msg_esc_telemetry_5_to_8_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_esc_telemetry_5_to_8_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.temperature , packet1.voltage , packet1.current , packet1.totalcurrent , packet1.rpm , packet1.count ); - mavlink_msg_esc_telemetry_5_to_8_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12 >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_esc_telemetry_9_to_12_t packet_in = { - { 17235, 17236, 17237, 17238 },{ 17651, 17652, 17653, 17654 },{ 18067, 18068, 18069, 18070 },{ 18483, 18484, 18485, 18486 },{ 18899, 18900, 18901, 18902 },{ 125, 126, 127, 128 } - }; - mavlink_esc_telemetry_9_to_12_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - - mav_array_memcpy(packet1.voltage, packet_in.voltage, sizeof(uint16_t)*4); - mav_array_memcpy(packet1.current, packet_in.current, sizeof(uint16_t)*4); - mav_array_memcpy(packet1.totalcurrent, packet_in.totalcurrent, sizeof(uint16_t)*4); - mav_array_memcpy(packet1.rpm, packet_in.rpm, sizeof(uint16_t)*4); - mav_array_memcpy(packet1.count, packet_in.count, sizeof(uint16_t)*4); - mav_array_memcpy(packet1.temperature, packet_in.temperature, sizeof(uint8_t)*4); - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ESC_TELEMETRY_9_TO_12_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_esc_telemetry_9_to_12_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_esc_telemetry_9_to_12_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_esc_telemetry_9_to_12_pack(system_id, component_id, &msg , packet1.temperature , packet1.voltage , packet1.current , packet1.totalcurrent , packet1.rpm , packet1.count ); - mavlink_msg_esc_telemetry_9_to_12_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_esc_telemetry_9_to_12_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.temperature , packet1.voltage , packet1.current , packet1.totalcurrent , packet1.rpm , packet1.count ); - mavlink_msg_esc_telemetry_9_to_12_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_OSD_PARAM_CONFIG >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_osd_param_config_t packet_in = { - 963497464,45.0,73.0,101.0,53,120,187,254,"UVWXYZABCDEFGHI",113 - }; - mavlink_osd_param_config_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.request_id = packet_in.request_id; - packet1.min_value = packet_in.min_value; - packet1.max_value = packet_in.max_value; - packet1.increment = packet_in.increment; - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - packet1.osd_screen = packet_in.osd_screen; - packet1.osd_index = packet_in.osd_index; - packet1.config_type = packet_in.config_type; - - mav_array_memcpy(packet1.param_id, packet_in.param_id, sizeof(char)*16); - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_OSD_PARAM_CONFIG_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_OSD_PARAM_CONFIG_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_osd_param_config_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_osd_param_config_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_osd_param_config_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.request_id , packet1.osd_screen , packet1.osd_index , packet1.param_id , packet1.config_type , packet1.min_value , packet1.max_value , packet1.increment ); - mavlink_msg_osd_param_config_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_osd_param_config_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.request_id , packet1.osd_screen , packet1.osd_index , packet1.param_id , packet1.config_type , packet1.min_value , packet1.max_value , packet1.increment ); - mavlink_msg_osd_param_config_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_osd_param_config_reply_t packet_in = { - 963497464,17 - }; - mavlink_osd_param_config_reply_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.request_id = packet_in.request_id; - packet1.result = packet_in.result; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_OSD_PARAM_CONFIG_REPLY_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_osd_param_config_reply_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_osd_param_config_reply_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_osd_param_config_reply_pack(system_id, component_id, &msg , packet1.request_id , packet1.result ); - mavlink_msg_osd_param_config_reply_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_osd_param_config_reply_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.request_id , packet1.result ); - mavlink_msg_osd_param_config_reply_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_osd_param_show_config_t packet_in = { - 963497464,17,84,151,218 - }; - mavlink_osd_param_show_config_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.request_id = packet_in.request_id; - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - packet1.osd_screen = packet_in.osd_screen; - packet1.osd_index = packet_in.osd_index; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_osd_param_show_config_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_osd_param_show_config_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_osd_param_show_config_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.request_id , packet1.osd_screen , packet1.osd_index ); - mavlink_msg_osd_param_show_config_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_osd_param_show_config_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.request_id , packet1.osd_screen , packet1.osd_index ); - mavlink_msg_osd_param_show_config_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_osd_param_show_config_reply_t packet_in = { - 963497464,45.0,73.0,101.0,53,"RSTUVWXYZABCDEF",168 - }; - mavlink_osd_param_show_config_reply_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.request_id = packet_in.request_id; - packet1.min_value = packet_in.min_value; - packet1.max_value = packet_in.max_value; - packet1.increment = packet_in.increment; - packet1.result = packet_in.result; - packet1.config_type = packet_in.config_type; - - mav_array_memcpy(packet1.param_id, packet_in.param_id, sizeof(char)*16); - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_OSD_PARAM_SHOW_CONFIG_REPLY_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_osd_param_show_config_reply_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_osd_param_show_config_reply_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_osd_param_show_config_reply_pack(system_id, component_id, &msg , packet1.request_id , packet1.result , packet1.param_id , packet1.config_type , packet1.min_value , packet1.max_value , packet1.increment ); - mavlink_msg_osd_param_show_config_reply_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_osd_param_show_config_reply_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.request_id , packet1.result , packet1.param_id , packet1.config_type , packet1.min_value , packet1.max_value , packet1.increment ); - mavlink_msg_osd_param_show_config_reply_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_obstacle_distance_3d_t packet_in = { - 963497464,45.0,73.0,101.0,129.0,157.0,18483,211,22 - }; - mavlink_obstacle_distance_3d_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.time_boot_ms = packet_in.time_boot_ms; - packet1.x = packet_in.x; - packet1.y = packet_in.y; - packet1.z = packet_in.z; - packet1.min_distance = packet_in.min_distance; - packet1.max_distance = packet_in.max_distance; - packet1.obstacle_id = packet_in.obstacle_id; - packet1.sensor_type = packet_in.sensor_type; - packet1.frame = packet_in.frame; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_OBSTACLE_DISTANCE_3D_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_obstacle_distance_3d_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_obstacle_distance_3d_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_obstacle_distance_3d_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.sensor_type , packet1.frame , packet1.obstacle_id , packet1.x , packet1.y , packet1.z , packet1.min_distance , packet1.max_distance ); - mavlink_msg_obstacle_distance_3d_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_obstacle_distance_3d_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.sensor_type , packet1.frame , packet1.obstacle_id , packet1.x , packet1.y , packet1.z , packet1.min_distance , packet1.max_distance ); - mavlink_msg_obstacle_distance_3d_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; i 0 radius to pass by WP. Positive value for clockwise orbit, negative value for counter-clockwise orbit. Allows trajectory control.| Desired yaw angle at waypoint (rotary wing). NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude| Longitude| Altitude| */ + MAV_CMD_NAV_LOITER_UNLIM=17, /* Loiter around this waypoint an unlimited amount of time |Empty| Empty| Loiter radius around waypoint for forward-only moving vehicles (not multicopters). If positive loiter clockwise, else counter-clockwise| Desired yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude| Longitude| Altitude| */ + MAV_CMD_NAV_LOITER_TURNS=18, /* Loiter around this waypoint for X turns |Number of turns.| Leave loiter circle only when track heads towards the next waypoint (MAV_BOOL_FALSE: Leave when turns complete). Values not equal to 0 or 1 are invalid.| Loiter radius around waypoint for forward-only moving vehicles (not multicopters). If positive loiter clockwise, else counter-clockwise| Loiter circle exit location and/or path to next waypoint ("xtrack") for forward-only moving vehicles (not multicopters). 0 for the vehicle to converge towards the center xtrack when it leaves the loiter (the line between the centers of the current and next waypoint), 1 to converge to the direct line between the location that the vehicle exits the loiter radius and the next waypoint. Otherwise the angle (in degrees) between the tangent of the loiter circle and the center xtrack at which the vehicle must leave the loiter (and converge to the center xtrack). NaN to use the current system default xtrack behaviour.| Latitude| Longitude| Altitude| */ + MAV_CMD_NAV_LOITER_TIME=19, /* Loiter at the specified latitude, longitude and altitude for a certain amount of time. Multicopter vehicles stop at the point (within a vehicle-specific acceptance radius). Forward-only moving vehicles (e.g. fixed-wing) circle the point with the specified radius/direction. If the Heading Required parameter (2) is non-zero forward moving aircraft will only leave the loiter circle once heading towards the next waypoint. |Loiter time (only starts once Lat, Lon and Alt is reached).| Leave loiter circle only when track heading towards the next waypoint (MAV_BOOL_FALSE: Leave on time expiry). Values not equal to 0 or 1 are invalid.| Loiter radius around waypoint for forward-only moving vehicles (not multicopters). If positive loiter clockwise, else counter-clockwise.| Loiter circle exit location and/or path to next waypoint ("xtrack") for forward-only moving vehicles (not multicopters). 0 for the vehicle to converge towards the center xtrack when it leaves the loiter (the line between the centers of the current and next waypoint), 1 to converge to the direct line between the location that the vehicle exits the loiter radius and the next waypoint. Otherwise the angle (in degrees) between the tangent of the loiter circle and the center xtrack at which the vehicle must leave the loiter (and converge to the center xtrack). NaN to use the current system default xtrack behaviour.| Latitude| Longitude| Altitude| */ + MAV_CMD_NAV_RETURN_TO_LAUNCH=20, /* Return to launch location |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_NAV_LAND=21, /* Land at location. |Minimum target altitude if landing is aborted (0 = undefined/use system default).| Precision land mode.| Empty.| Desired yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude.| Longitude.| Landing altitude (ground level in current frame).| */ + MAV_CMD_NAV_TAKEOFF=22, /* Takeoff from ground / hand. Vehicles that support multiple takeoff modes (e.g. VTOL quadplane) should take off using the currently configured mode. |Minimum pitch (if airspeed sensor present), desired pitch without sensor| Empty| Empty| Yaw angle (if magnetometer present), ignored without magnetometer. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude| Longitude| Altitude| */ + MAV_CMD_NAV_LAND_LOCAL=23, /* Land at local position (local frame only) |Landing target number (if available)| Maximum accepted offset from desired landing position - computed magnitude from spherical coordinates: d = sqrt(x^2 + y^2 + z^2), which gives the maximum accepted distance between the desired landing position and the position where the vehicle is about to land| Landing descend rate| Desired yaw angle| Y-axis position| X-axis position| Z-axis / ground level position| */ + MAV_CMD_NAV_TAKEOFF_LOCAL=24, /* Takeoff from local position (local frame only) |Minimum pitch (if airspeed sensor present), desired pitch without sensor| Empty| Takeoff ascend rate| Yaw angle (if magnetometer or another yaw estimation source present), ignored without one of these| Y-axis position| X-axis position| Z-axis position| */ + MAV_CMD_NAV_FOLLOW=25, /* Vehicle following, i.e. this waypoint represents the position of a moving vehicle |Following logic to use (e.g. loitering or sinusoidal following) - depends on specific autopilot implementation| Ground speed of vehicle to be followed| Radius around waypoint. If positive loiter clockwise, else counter-clockwise| Desired yaw angle.| Latitude| Longitude| Altitude| */ + MAV_CMD_NAV_CONTINUE_AND_CHANGE_ALT=30, /* Continue on the current course and climb/descend to specified altitude. When the altitude is reached continue to the next command (i.e., don't proceed to the next command until the desired altitude is reached. |Climb or Descend (0 = Neutral, command completes when within 5m of this command's altitude, 1 = Climbing, command completes when at or above this command's altitude, 2 = Descending, command completes when at or below this command's altitude.| Empty| Empty| Empty| Empty| Empty| Desired altitude| */ + MAV_CMD_NAV_LOITER_TO_ALT=31, /* Begin loiter at the specified Latitude and Longitude. If Lat=Lon=0, then loiter at the current position. Don't consider the navigation command complete (don't leave loiter) until the altitude has been reached. Additionally, if the Heading Required parameter is non-zero the aircraft will not leave the loiter until heading toward the next waypoint. |Leave loiter circle only when track heading towards the next waypoint (MAV_BOOL_FALSE: Leave when altitude reached). Values not equal to 0 or 1 are invalid.| Loiter radius around waypoint for forward-only moving vehicles (not multicopters). If positive loiter clockwise, negative counter-clockwise, 0 means no change to standard loiter.| Empty| Loiter circle exit location and/or path to next waypoint ("xtrack") for forward-only moving vehicles (not multicopters). 0 for the vehicle to converge towards the center xtrack when it leaves the loiter (the line between the centers of the current and next waypoint), 1 to converge to the direct line between the location that the vehicle exits the loiter radius and the next waypoint. Otherwise the angle (in degrees) between the tangent of the loiter circle and the center xtrack at which the vehicle must leave the loiter (and converge to the center xtrack). NaN to use the current system default xtrack behaviour.| Latitude| Longitude| Altitude| */ + MAV_CMD_DO_FOLLOW=32, /* Begin following a target |System ID (of the FOLLOW_TARGET beacon). Send 0 to disable follow-me and return to the default position hold mode.| Reserved| Reserved| Altitude mode: 0: Keep current altitude, 1: keep altitude difference to target, 2: go to a fixed altitude above home.| Altitude above home. (used if mode=2)| Reserved| Time to land in which the MAV should go to the default position hold mode after a message RX timeout.| */ + MAV_CMD_DO_FOLLOW_REPOSITION=33, /* Reposition the MAV after a follow target command has been sent |Camera q1 (where 0 is on the ray from the camera to the tracking device)| Camera q2| Camera q3| Camera q4| altitude offset from target| X offset from target| Y offset from target| */ + MAV_CMD_DO_ORBIT=34, /* Start orbiting on the circumference of a circle defined by the parameters. Setting values to NaN/INT32_MAX (as appropriate) results in using defaults. |Radius of the circle. Positive: orbit clockwise. Negative: orbit counter-clockwise. NaN: Use vehicle default radius, or current radius if already orbiting.| Tangential Velocity. NaN: Use vehicle default velocity, or current velocity if already orbiting.| Yaw behavior of the vehicle.| Orbit around the centre point for this many radians (i.e. for a three-quarter orbit set 270*Pi/180). 0: Orbit forever. NaN: Use vehicle default, or current value if already orbiting.| Center point latitude (if no MAV_FRAME specified) / X coordinate according to MAV_FRAME. INT32_MAX (or NaN if sent in COMMAND_LONG): Use current vehicle position, or current center if already orbiting.| Center point longitude (if no MAV_FRAME specified) / Y coordinate according to MAV_FRAME. INT32_MAX (or NaN if sent in COMMAND_LONG): Use current vehicle position, or current center if already orbiting.| Center point altitude (MSL) (if no MAV_FRAME specified) / Z coordinate according to MAV_FRAME. NaN: Use current vehicle altitude.| */ + MAV_CMD_DO_FIGURE_EIGHT=35, /* Fly a figure eight path as defined by the parameters. + Set parameters to NaN/INT32_MAX (as appropriate) to use system-default values. + The command is intended for fixed wing vehicles (and VTOL hybrids flying in fixed-wing mode), allowing POI tracking for gimbals that don't support infinite rotation. + This command only defines the flight path. Speed should be set independently (use e.g. MAV_CMD_DO_CHANGE_SPEED). + Yaw and other degrees of freedom are not specified, and will be flight-stack specific (on vehicles where they can be controlled independent of the heading). + |Major axis radius of the figure eight. Positive: orbit the north circle clockwise. Negative: orbit the north circle counter-clockwise. + NaN: The radius will be set to 2.5 times the minor radius and direction is clockwise. + Must be greater or equal to two times the minor radius for feasible values.| Minor axis radius of the figure eight. Defines the radius of the two circles that make up the figure. Negative value has no effect. + NaN: The radius will be set to the default loiter radius.| Reserved (default:NaN)| Orientation of the figure eight major axis with respect to true north (range: [-pi,pi]). NaN: use default orientation aligned to true north.| Center point latitude/X coordinate according to MAV_FRAME. If no MAV_FRAME specified, MAV_FRAME_GLOBAL is assumed. + INT32_MAX or NaN: Use current vehicle position, or current center if already loitering.| Center point longitude/Y coordinate according to MAV_FRAME. If no MAV_FRAME specified, MAV_FRAME_GLOBAL is assumed. + INT32_MAX or NaN: Use current vehicle position, or current center if already loitering.| Center point altitude MSL/Z coordinate according to MAV_FRAME. If no MAV_FRAME specified, MAV_FRAME_GLOBAL is assumed. + INT32_MAX or NaN: Use current vehicle altitude.| */ + MAV_CMD_NAV_ROI=80, /* Sets the region of interest (ROI) for a sensor set or the vehicle itself. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. |Region of interest mode.| Waypoint index/ target ID. (see MAV_ROI enum)| ROI index (allows a vehicle to manage multiple ROI's)| Empty| x the location of the fixed ROI (see MAV_FRAME)| y| z| */ + MAV_CMD_NAV_PATHPLANNING=81, /* Control autonomous path planning on the MAV. |0: Disable local obstacle avoidance / local path planning (without resetting map), 1: Enable local path planning, 2: Enable and reset local path planning| 0: Disable full path planning (without resetting map), 1: Enable, 2: Enable and reset map/occupancy grid, 3: Enable and reset planned route, but not occupancy grid| Empty| Yaw angle at goal| Latitude/X of goal| Longitude/Y of goal| Altitude/Z of goal| */ + MAV_CMD_NAV_SPLINE_WAYPOINT=82, /* Navigate to waypoint using a spline path. |Hold time. (ignored by fixed wing, time to stay at waypoint for rotary wing)| Empty| Empty| Empty| Latitude/X of goal| Longitude/Y of goal| Altitude/Z of goal| */ + MAV_CMD_NAV_VTOL_TAKEOFF=84, /* Takeoff from ground using VTOL mode, and transition to forward flight with specified heading. The command should be ignored by vehicles that dont support both VTOL and fixed-wing flight (multicopters, boats,etc.). |Empty| Front transition heading.| Empty| Yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude| Longitude| Altitude| */ + MAV_CMD_NAV_VTOL_LAND=85, /* Land using VTOL mode |Landing behaviour.| Empty| Approach altitude (with the same reference as the Altitude field). NaN if unspecified.| Yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude| Longitude| Altitude (ground level) relative to the current coordinate frame. NaN to use system default landing altitude (ignore value).| */ + MAV_CMD_NAV_GUIDED_ENABLE=92, /* Hand control over to an external controller |Guided mode on (MAV_BOOL_FALSE: Off). Values not equal to 0 or 1 are invalid.| Empty| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_NAV_DELAY=93, /* Delay the next navigation command a number of seconds or until a specified time |Delay (-1 to enable time-of-day fields)| hour (24h format, UTC, -1 to ignore)| minute (24h format, UTC, -1 to ignore)| second (24h format, UTC, -1 to ignore)| Empty| Empty| Empty| */ + MAV_CMD_NAV_PAYLOAD_PLACE=94, /* Descend and place payload. Vehicle moves to specified location, descends until it detects a hanging payload has reached the ground, and then releases the payload. If ground is not detected before the reaching the maximum descent value (param1), the command will complete without releasing the payload. |Maximum distance to descend.| Empty| Empty| Empty| Latitude| Longitude| Altitude| */ + MAV_CMD_NAV_LAST=95, /* NOP - This command is only used to mark the upper limit of the NAV/ACTION commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_CONDITION_DELAY=112, /* Delay mission state machine. |Delay| Empty| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_CONDITION_CHANGE_ALT=113, /* Ascend/descend to target altitude at specified rate. Delay mission state machine until desired altitude reached. |Descent / Ascend rate.| Empty| Empty| Empty| Empty| Empty| Target Altitude| */ + MAV_CMD_CONDITION_DISTANCE=114, /* Delay mission state machine until within desired distance of next NAV point. |Distance.| Empty| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_CONDITION_YAW=115, /* Reach a certain target angle. |target angle [0-360]. Absolute angles: 0 is north. Relative angle: 0 is initial yaw. Direction set by param3.| angular speed| direction: -1: counter clockwise, 0: shortest direction, 1: clockwise| Relative offset (MAV_BOOL_FALSE: absolute angle). Values not equal to 0 or 1 are invalid.| Empty| Empty| Empty| */ + MAV_CMD_CONDITION_LAST=159, /* NOP - This command is only used to mark the upper limit of the CONDITION commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_SET_MODE=176, /* Set system mode. |Mode flags. MAV_MODE values can be used to set some mode flag combinations.| Custom system-specific mode (see target autopilot specifications for mode information). If MAV_MODE_FLAG_CUSTOM_MODE_ENABLED is set in param1 (mode) this mode is used: otherwise the field is ignored.| Custom sub mode - this is system specific, please refer to the individual autopilot specifications for details.| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_JUMP=177, /* Jump to the desired command in the mission list. Repeat this action only the specified number of times |Sequence number| Repeat count| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_CHANGE_SPEED=178, /* Change speed and/or throttle set points. The value persists until it is overridden or there is a mode change |Speed type of value set in param2 (such as airspeed, ground speed, and so on)| Speed (-1 indicates no change, -2 indicates return to default vehicle speed)| Throttle (-1 indicates no change, -2 indicates return to default vehicle throttle value)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_DO_SET_HOME=179, /* + Sets the home position to either to the current position or a specified position. + The home position is the default position that the system will return to and land on. + The position is set automatically by the system during the takeoff (and may also be set using this command). + Note: the current home position may be emitted in a HOME_POSITION message on request (using MAV_CMD_REQUEST_MESSAGE with param1=242). + |Use current location (MAV_BOOL_FALSE: use specified location). Values not equal to 0 or 1 are invalid.| Roll angle (of surface). Range: -180..180 degrees. NAN or 0 means value not set. 0.01 indicates zero roll.| Pitch angle (of surface). Range: -90..90 degrees. NAN or 0 means value not set. 0.01 means zero pitch.| Yaw angle. NaN to use default heading. Range: -180..180 degrees.| Latitude| Longitude| Altitude| */ + MAV_CMD_DO_SET_PARAMETER=180, /* Set a system parameter. Caution! Use of this command requires knowledge of the numeric enumeration value of the parameter. |Parameter number| Parameter value| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_SET_RELAY=181, /* Set a relay to a condition. |Relay instance number.| Setting. (1=on, 0=off, others possible depending on system hardware)| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_REPEAT_RELAY=182, /* Cycle a relay on and off for a desired number of cycles with a desired period. |Relay instance number.| Cycle count.| Cycle time.| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_SET_SERVO=183, /* Set a servo to a desired PWM value. |Servo instance number.| Pulse Width Modulation.| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_REPEAT_SERVO=184, /* Cycle a between its nominal setting and a desired PWM for a desired number of cycles with a desired period. |Servo instance number.| Pulse Width Modulation.| Cycle count.| Cycle time.| Empty| Empty| Empty| */ + MAV_CMD_DO_FLIGHTTERMINATION=185, /* Terminate flight immediately. + Flight termination immediately and irreversibly terminates the current flight, returning the vehicle to ground. + The vehicle will ignore RC or other input until it has been power-cycled. + Termination may trigger safety measures, including: disabling motors and deployment of parachute on multicopters, and setting flight surfaces to initiate a landing pattern on fixed-wing). + On multicopters without a parachute it may trigger a crash landing. + Support for this command can be tested using the protocol bit: MAV_PROTOCOL_CAPABILITY_FLIGHT_TERMINATION. + Support for this command can also be tested by sending the command with param1=0 (< 0.5); the ACK should be either MAV_RESULT_FAILED or MAV_RESULT_UNSUPPORTED. + |Flight termination activated if > 0.5. Otherwise not activated and ACK with MAV_RESULT_FAILED.| Empty| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_CHANGE_ALTITUDE=186, /* Change altitude set point. |Altitude.| Frame of new altitude.| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_SET_ACTUATOR=187, /* Sets actuators (e.g. servos) to a desired value. The actuator numbers are mapped to specific outputs (e.g. on any MAIN or AUX PWM or UAVCAN) using a flight-stack specific mechanism (i.e. a parameter). |Actuator 1 value, scaled from [-1 to 1]. NaN to ignore.| Actuator 2 value, scaled from [-1 to 1]. NaN to ignore.| Actuator 3 value, scaled from [-1 to 1]. NaN to ignore.| Actuator 4 value, scaled from [-1 to 1]. NaN to ignore.| Actuator 5 value, scaled from [-1 to 1]. NaN to ignore.| Actuator 6 value, scaled from [-1 to 1]. NaN to ignore.| Index of actuator set (i.e if set to 1, Actuator 1 becomes Actuator 7)| */ + MAV_CMD_DO_RETURN_PATH_START=188, /* Mission item to specify the start of a failsafe/landing return-path segment (the end of the segment is the next MAV_CMD_DO_LAND_START item). + A vehicle that is using missions for landing (e.g. in a return mode) will join the mission on the closest path of the return-path segment (instead of MAV_CMD_DO_LAND_START or the nearest waypoint). + The main use case is to minimize the failsafe flight path in corridor missions, where the inbound/outbound paths are constrained (by geofences) to the same particular path. + The MAV_CMD_NAV_RETURN_PATH_START would be placed at the start of the return path. + If a failsafe occurs on the outbound path the vehicle will move to the nearest point on the return path (which is parallel for this kind of mission), effectively turning round and following the shortest path to landing. + If a failsafe occurs on the inbound path the vehicle is already on the return segment and will continue to landing. + The Latitude/Longitude/Altitude are optional, and may be set to 0 if not needed. + If specified, the item defines the waypoint at which the return segment starts. + If sent using as a command, the vehicle will perform a mission landing (using the land segment if defined) or reject the command if mission landings are not supported, or no mission landing is defined. When used as a command any position information in the command is ignored. + |Empty| Empty| Empty| Empty| Latitudee. 0: not used.| Longitudee. 0: not used.| Altitudee. 0: not used.| */ + MAV_CMD_DO_LAND_START=189, /* Mission item to mark the start of a mission landing pattern, or a command to land with a mission landing pattern. + + When used in a mission, this is a marker for the start of a sequence of mission items that represent a landing pattern. + It should be followed by a navigation item that defines the first waypoint of the landing sequence. + The start marker positional params are used only for selecting what landing pattern to use if several are defined in the mission (the selected pattern will be the one with the marker position that is closest to the vehicle when a landing is commanded). + If the marker item position has zero-values for latitude, longitude, and altitude, then landing pattern selection is instead based on the position of the first waypoint in the landing sequence. + + When sent as a command it triggers a landing using a mission landing pattern. + The location parameters are not used in this case, and should be set to 0. + |Empty| Empty| Empty| Empty| Latitude for landing sequence selection, or 0 (see description). Ignored in commands (set 0).| Longitude for landing sequence selection, or 0 (see description). Ignored in commands (set 0).| Altitude for landing sequence selection, or 0 (see description). Ignored in commands (set 0).| */ + MAV_CMD_DO_RALLY_LAND=190, /* Mission command to perform a landing from a rally point. |Break altitude| Landing speed| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_GO_AROUND=191, /* Mission command to safely abort an autonomous landing. |Altitude| Empty| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_REPOSITION=192, /* Reposition the vehicle to a specific WGS84 global position. This command is intended for guided commands (for missions use MAV_CMD_NAV_WAYPOINT instead). |Ground speed, less than 0 (-1) for default| Bitmask of option flags.| Loiter radius for planes. Positive values only, direction is controlled by Yaw value. A value of zero or NaN is ignored. | Yaw heading (heading reference defined in Bitmask field). NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.). For planes indicates loiter direction (0: clockwise, 1: counter clockwise)| Latitude| Longitude| Altitude| */ + MAV_CMD_DO_PAUSE_CONTINUE=193, /* If in a GPS controlled position mode, hold the current position or continue. |Continue mission (MAV_BOOL_TRUE), Pause current mission or reposition command, hold current position (MAV_BOOL_FALSE). Values not equal to 0 or 1 are invalid. A VTOL capable vehicle should enter hover mode (multicopter and VTOL planes). A plane should loiter with the default loiter radius.| Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| */ + MAV_CMD_DO_SET_REVERSE=194, /* Set moving direction to forward or reverse. |Reverse direction (MAV_BOOL_FALSE: Forward direction). Values not equal to 0 or 1 are invalid.| Empty| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_SET_ROI_LOCATION=195, /* Sets the region of interest (ROI) to a location. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. This command can be sent to a gimbal manager but not to a gimbal device. A gimbal is not to react to this message. |Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| Empty| Empty| Empty| Latitude of ROI location| Longitude of ROI location| Altitude of ROI location| */ + MAV_CMD_DO_SET_ROI_WPNEXT_OFFSET=196, /* Sets the region of interest (ROI) to be toward next waypoint, with optional pitch/roll/yaw offset. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. This command can be sent to a gimbal manager but not to a gimbal device. A gimbal device is not to react to this message. |Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| Empty| Empty| Empty| Pitch offset from next waypoint, positive pitching up| Roll offset from next waypoint, positive rolling to the right| Yaw offset from next waypoint, positive yawing to the right| */ + MAV_CMD_DO_SET_ROI_NONE=197, /* Cancels any previous ROI command returning the vehicle/sensors to default flight characteristics. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. This command can be sent to a gimbal manager but not to a gimbal device. A gimbal device is not to react to this message. After this command the gimbal manager should go back to manual input if available, and otherwise assume a neutral position. |Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| Empty| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_SET_ROI_SYSID=198, /* Mount tracks system with specified system ID. Determination of target vehicle position may be done with GLOBAL_POSITION_INT or any other means. This command can be sent to a gimbal manager but not to a gimbal device. A gimbal device is not to react to this message. |System ID| Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_DO_CONTROL_VIDEO=200, /* Control onboard camera system. |Camera ID (-1 for all)| Transmission: 0: disabled, 1: enabled compressed, 2: enabled raw| Transmission mode: 0: video stream, >0: single images every n seconds| Recording: 0: disabled, 1: enabled compressed, 2: enabled raw| Empty| Empty| Empty| */ + MAV_CMD_DO_SET_ROI=201, /* Sets the region of interest (ROI) for a sensor set or the vehicle itself. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. |Region of interest mode.| Waypoint index/ target ID (depends on param 1).| Region of interest index. (allows a vehicle to manage multiple ROI's)| Empty| MAV_ROI_WPNEXT: pitch offset from next waypoint, MAV_ROI_LOCATION: latitude| MAV_ROI_WPNEXT: roll offset from next waypoint, MAV_ROI_LOCATION: longitude| MAV_ROI_WPNEXT: yaw offset from next waypoint, MAV_ROI_LOCATION: altitude| */ + MAV_CMD_DO_DIGICAM_CONFIGURE=202, /* Configure digital camera. This is a fallback message for systems that have not yet implemented PARAM_EXT_XXX messages and camera definition files (see https://mavlink.io/en/services/camera_def.html ). |Modes: P, TV, AV, M, Etc.| Shutter speed: Divisor number for one second.| Aperture: F stop number.| ISO number e.g. 80, 100, 200, Etc.| Exposure type enumerator.| Command Identity.| Main engine cut-off time before camera trigger. (0 means no cut-off)| */ + MAV_CMD_DO_DIGICAM_CONTROL=203, /* Control digital camera. This is a fallback message for systems that have not yet implemented PARAM_EXT_XXX messages and camera definition files (see https://mavlink.io/en/services/camera_def.html ). |Session control e.g. show/hide lens| Zoom's absolute position| Zooming step value to offset zoom from the current position| Focus Locking, Unlocking or Re-locking| Shooting Command| Command Identity| Test shot identifier. If set to 1, image will only be captured, but not counted towards internal frame count.| */ + MAV_CMD_DO_MOUNT_CONFIGURE=204, /* Mission command to configure a camera or antenna mount |Mount operation mode| Stabilize roll (MAV_BOOL_TRUE). Values not equal to 0 or 1 are invalid.| Stabilize pitch (MAV_BOOL_TRUE). Values not equal to 0 or 1 are invalid.| Stabilize yaw (MAV_BOOL_TRUE). Values not equal to 0 or 1 are invalid.| Roll input (0 = angle body frame, 1 = angular rate, 2 = angle absolute frame)| Pitch input (0 = angle body frame, 1 = angular rate, 2 = angle absolute frame)| Yaw input (0 = angle body frame, 1 = angular rate, 2 = angle absolute frame)| */ + MAV_CMD_DO_MOUNT_CONTROL=205, /* Mission command to control a camera or antenna mount |pitch depending on mount mode (degrees or degrees/second depending on pitch input).| roll depending on mount mode (degrees or degrees/second depending on roll input).| yaw depending on mount mode (degrees or degrees/second depending on yaw input).| altitude depending on mount mode.| latitude, set if appropriate mount mode.| longitude, set if appropriate mount mode.| Mount mode.| */ + MAV_CMD_DO_SET_CAM_TRIGG_DIST=206, /* Mission command to set camera trigger distance for this flight. The camera is triggered each time this distance is exceeded. This command can also be used to set the shutter integration time for the camera. |Camera trigger distance. 0 to stop triggering.| Camera shutter integration time. -1 or 0 to ignore| Trigger camera once, immediately (MAV_BOOL_TRUE). Values not equal to 0 or 1 are invalid.| Target camera ID. 7 to 255: MAVLink camera component id. 1 to 6 for cameras attached to the autopilot, which don't have a distinct component id. 0: all cameras. This is used to target specific autopilot-connected cameras. It is also used to target specific cameras when the MAV_CMD is used in a mission.| Empty| Empty| Empty| */ + MAV_CMD_DO_FENCE_ENABLE=207, /* + Enable the geofence. + This can be used in a mission or via the command protocol. + The persistence/lifetime of the setting is undefined. + Depending on flight stack implementation it may persist until superseded, or it may revert to a system default at the end of a mission. + Flight stacks typically reset the setting to system defaults on reboot. + |enable? (0=disable, 1=enable, 2=disable_floor_only)| Fence types to enable or disable as a bitmask. 0: field is unused/all fences should be enabled or disabled (for compatibility reasons). Parameter is ignored if param1=2.| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_PARACHUTE=208, /* Mission item/command to release a parachute or enable/disable auto release. |Action| Empty| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_MOTOR_TEST=209, /* Command to perform motor test. |Motor instance number (from 1 to max number of motors on the vehicle).| Throttle type (whether the Throttle Value in param3 is a percentage, PWM value, etc.)| Throttle value.| Timeout between tests that are run in sequence.| Motor count. Number of motors to test in sequence: 0/1=one motor, 2= two motors, etc. The Timeout (param4) is used between tests.| Motor test order.| Empty| */ + MAV_CMD_DO_INVERTED_FLIGHT=210, /* Change to/from inverted flight. |Inverted flight (MAV_BOOL_False: normal flight). Values not equal to 0 or 1 are invalid.| Empty| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_GRIPPER=211, /* Mission command to operate a gripper. |Gripper ID. 1-6 for an autopilot connected gripper. In missions this may be set to 1-6 for an autopilot gripper, or the gripper component id for a MAVLink gripper. 0 targets all grippers.| Gripper action to perform.| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_AUTOTUNE_ENABLE=212, /* Enable/disable autotune. |Enable autotune (MAV_BOOL_FALSE: disable autotune). Values not equal to 0 or 1 are invalid.| Specify axes for which autotuning is enabled/disabled. 0 indicates the field is unused (for compatibility reasons). If 0 the autopilot will follow its default behaviour, which is usually to tune all axes.| Empty.| Empty.| Empty.| Empty.| Empty.| */ + MAV_CMD_NAV_SET_YAW_SPEED=213, /* Sets a desired vehicle turn angle and speed change. |Yaw angle to adjust steering by.| Speed.| Relative final angle (MAV_BOOL_FALSE: Absolute angle). Values not equal to 0 or 1 are invalid.| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_SET_CAM_TRIGG_INTERVAL=214, /* Mission command to set camera trigger interval for this flight. If triggering is enabled, the camera is triggered each time this interval expires. This command can also be used to set the shutter integration time for the camera. |Camera trigger cycle time. -1 or 0 to ignore.| Camera shutter integration time. Should be less than trigger cycle time. -1 or 0 to ignore.| Target camera ID. 7 to 255: MAVLink camera component id. 1 to 6 for cameras attached to the autopilot, which don't have a distinct component id. 0: all cameras. This is used to target specific autopilot-connected cameras. It is also used to target specific cameras when the MAV_CMD is used in a mission.| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_MOUNT_CONTROL_QUAT=220, /* Mission command to control a camera or antenna mount, using a quaternion as reference. |quaternion param q1, w (1 in null-rotation)| quaternion param q2, x (0 in null-rotation)| quaternion param q3, y (0 in null-rotation)| quaternion param q4, z (0 in null-rotation)| Empty| Empty| Empty| */ + MAV_CMD_DO_GUIDED_MASTER=221, /* set id of master controller |System ID| Component ID| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_GUIDED_LIMITS=222, /* Set limits for external control |Timeout - maximum time that external controller will be allowed to control vehicle. 0 means no timeout.| Altitude (MSL) min - if vehicle moves below this alt, the command will be aborted and the mission will continue. 0 means no lower altitude limit.| Altitude (MSL) max - if vehicle moves above this alt, the command will be aborted and the mission will continue. 0 means no upper altitude limit.| Horizontal move limit - if vehicle moves more than this distance from its location at the moment the command was executed, the command will be aborted and the mission will continue. 0 means no horizontal move limit.| Empty| Empty| Empty| */ + MAV_CMD_DO_ENGINE_CONTROL=223, /* Control vehicle engine. This is interpreted by the vehicles engine controller to change the target engine state. It is intended for vehicles with internal combustion engines |Start engine (MAV_BOOL_False: Stop engine). Values not equal to 0 or 1 are invalid.| Cold start engine (MAV_BOOL_FALSE: Warm start). Values not equal to 0 or 1 are invalid. Controls use of choke where applicable| Height delay. This is for commanding engine start only after the vehicle has gained the specified height. Used in VTOL vehicles during takeoff to start engine after the aircraft is off the ground. Zero for no delay.| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_SET_MISSION_CURRENT=224, /* + Set the mission item with sequence number seq as the current item and emit MISSION_CURRENT (whether or not the mission number changed). + If a mission is currently being executed, the system will continue to this new mission item on the shortest path, skipping any intermediate mission items. + Note that mission jump repeat counters are not reset unless param2 is set (see MAV_CMD_DO_JUMP param2). + + This command may trigger a mission state-machine change on some systems: for example from MISSION_STATE_NOT_STARTED or MISSION_STATE_PAUSED to MISSION_STATE_ACTIVE. + If the system is in mission mode, on those systems this command might therefore start, restart or resume the mission. + If the system is not in mission mode this command must not trigger a switch to mission mode. + + The mission may be "reset" using param2. + Resetting sets jump counters to initial values (to reset counters without changing the current mission item set the param1 to `-1`). + Resetting also explicitly changes a mission state of MISSION_STATE_COMPLETE to MISSION_STATE_PAUSED or MISSION_STATE_ACTIVE, potentially allowing it to resume when it is (next) in a mission mode. + + The command will ACK with MAV_RESULT_FAILED if the sequence number is out of range (including if there is no mission item). + |Mission sequence value to set. -1 for the current mission item (use to reset mission without changing current mission item).| Reset mission (MAV_BOOL_TRUE). Values not equal to 0 or 1 are invalid. Resets jump counters to initial values and changes mission state "completed" to be "active" or "paused".| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_SET_PARACHUTE_ARM=225, /* Command to arm/disarm parachute module trigger sources. |Arm flags of parachute trigger sources| Bitmask of arm flags (in param1) that should be modified| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_DO_LAST=240, /* NOP - This command is only used to mark the upper limit of the DO commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_PREFLIGHT_CALIBRATION=241, /* Trigger calibration. This command will be only accepted if in pre-flight mode. Except for Temperature Calibration, only one sensor should be set in a single message and all others should be zero. |1: gyro calibration, 3: gyro temperature calibration| Magnetometer calibration. Values not equal to 0 or 1 are invalid.| Ground pressure calibration. Values not equal to 0 or 1 are invalid.| 1: radio RC calibration, 2: RC trim calibration| 1: accelerometer calibration, 2: board level calibration, 3: accelerometer temperature calibration, 4: simple accelerometer calibration| 1: APM: compass/motor interference calibration (PX4: airspeed calibration, deprecated), 2: airspeed calibration| 1: ESC calibration, 3: barometer temperature calibration| */ + MAV_CMD_PREFLIGHT_SET_SENSOR_OFFSETS=242, /* Set sensor offsets. This command will be only accepted if in pre-flight mode. |Sensor to adjust the offsets for: 0: gyros, 1: accelerometer, 2: magnetometer, 3: barometer, 4: optical flow, 5: second magnetometer, 6: third magnetometer| X axis offset (or generic dimension 1), in the sensor's raw units| Y axis offset (or generic dimension 2), in the sensor's raw units| Z axis offset (or generic dimension 3), in the sensor's raw units| Generic dimension 4, in the sensor's raw units| Generic dimension 5, in the sensor's raw units| Generic dimension 6, in the sensor's raw units| */ + MAV_CMD_PREFLIGHT_UAVCAN=243, /* Trigger UAVCAN configuration (actuator ID assignment and direction mapping). Note that this maps to the legacy UAVCAN v0 function UAVCAN_ENUMERATE, which is intended to be executed just once during initial vehicle configuration (it is not a normal pre-flight command and has been poorly named). |1: Trigger actuator ID assignment and direction mapping. 0: Cancel command.| Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| */ + MAV_CMD_PREFLIGHT_STORAGE=245, /* Request storage of different parameter values and logs. This command will be only accepted if in pre-flight mode. |Action to perform on the persistent parameter storage| Action to perform on the persistent mission storage| Onboard logging: 0: Ignore, 1: Start default rate logging, -1: Stop logging, > 1: logging rate (e.g. set to 1000 for 1000 Hz logging)| Reserved| Empty| Empty| Empty| */ + MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN=246, /* Request the reboot or shutdown of system components. |Action to take for autopilot.| Action to take for onboard computer.| Action to take for component specified in param4.| MAVLink Component ID targeted in param3 (0 for all components).| Reserved (set to 0)| Conditions under which reboot/shutdown is allowed.| WIP: ID (e.g. camera ID -1 for all IDs)| */ + MAV_CMD_DO_UPGRADE=247, /* Request a target system to start an upgrade of one (or all) of its components. + For example, the command might be sent to a companion computer to cause it to upgrade a connected flight controller. + The system doing the upgrade will report progress using the normal command protocol sequence for a long running operation. + Command protocol information: https://mavlink.io/en/services/command.html. |Component id of the component to be upgraded. If set to 0, all components should be upgraded.| 0: Do not reboot component after the action is executed, 1: Reboot component after the action is executed.| Reserved| Reserved| Reserved| Reserved| WIP: upgrade progress report rate (can be used for more granular control).| */ + MAV_CMD_OVERRIDE_GOTO=252, /* Override current mission with command to pause mission, pause mission and move to position, continue/resume mission. When param 1 indicates that the mission is paused (MAV_GOTO_DO_HOLD), param 2 defines whether it holds in place or moves to another position. |MAV_GOTO_DO_HOLD: pause mission and either hold or move to specified position (depending on param2), MAV_GOTO_DO_CONTINUE: resume mission.| MAV_GOTO_HOLD_AT_CURRENT_POSITION: hold at current position, MAV_GOTO_HOLD_AT_SPECIFIED_POSITION: hold at specified position.| Coordinate frame of hold point.| Desired yaw angle.| Latitude/X position.| Longitude/Y position.| Altitude/Z position.| */ + MAV_CMD_OBLIQUE_SURVEY=260, /* Mission command to set a Camera Auto Mount Pivoting Oblique Survey (Replaces CAM_TRIGG_DIST for this purpose). The camera is triggered each time this distance is exceeded, then the mount moves to the next position. Params 4~6 set-up the angle limits and number of positions for oblique survey, where mount-enabled vehicles automatically roll the camera between shots to emulate an oblique camera setup (providing an increased HFOV). This command can also be used to set the shutter integration time for the camera. |Camera trigger distance. 0 to stop triggering.| Camera shutter integration time. 0 to ignore| The minimum interval in which the camera is capable of taking subsequent pictures repeatedly. 0 to ignore.| Total number of roll positions at which the camera will capture photos (images captures spread evenly across the limits defined by param5).| Angle limits that the camera can be rolled to left and right of center.| Fixed pitch angle that the camera will hold in oblique mode if the mount is actuated in the pitch axis.| Empty| */ + MAV_CMD_DO_SET_STANDARD_MODE=262, /* Enable the specified standard MAVLink mode. + If the specified mode is not supported, the vehicle should ACK with MAV_RESULT_FAILED. + See https://mavlink.io/en/services/standard_modes.html + |The mode to set.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ + MAV_CMD_MISSION_START=300, /* start running a mission |first_item: the first mission item to run| last_item: the last mission item to run (after this item is run, the mission ends)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_ACTUATOR_GROUP_TEST=309, /* Command to test groups of related actuators together. + This might include groups such as the actuators that contribute to roll, pitch, or yaw torque, actuators that contribute to thrust in x, y, z axis, tilt mechanisms, flaps and spoilers, and so on. + This is similar to MAV_CMD_ACTUATOR_TEST, except that multiple actuators may be affected. + Different groups may also affect the same actuators (as in the case of controls that affect torque in different axes). + Autopilots must NACK this command with MAV_RESULT_TEMPORARILY_REJECTED while armed. + |Actuator group to check, such as actuators related to roll torque.| Value to set. This is a normalized value across the full range of the tested group [-1,1].| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_ACTUATOR_TEST=310, /* Actuator testing command. This is similar to MAV_CMD_DO_MOTOR_TEST but operates on the level of output functions, i.e. it is possible to test Motor1 independent from which output it is configured on. Autopilots must NACK this command with MAV_RESULT_TEMPORARILY_REJECTED while armed. |Output value: 1 means maximum positive output, 0 to center servos or minimum motor thrust (expected to spin), -1 for maximum negative (if not supported by the motors, i.e. motor is not reversible, smaller than 0 maps to NaN). And NaN maps to disarmed (stop the motors).| Timeout after which the test command expires and the output is restored to the previous value. A timeout has to be set for safety reasons. A timeout of 0 means to restore the previous value immediately.| Reserved (default:0)| Reserved (default:0)| Actuator Output function| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_CONFIGURE_ACTUATOR=311, /* Actuator configuration command. |Actuator configuration action| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Actuator Output function| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_COMPONENT_ARM_DISARM=400, /* Arms / Disarms a component |Arm (MAV_BOOL_FALSE: disarm). Values not equal to 0 or 1 are invalid.| 0: arm-disarm unless prevented by safety checks (i.e. when landed), 21196: force arming/disarming (e.g. allow arming to override preflight checks and disarming in flight)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_RUN_PREARM_CHECKS=401, /* Instructs a target system to run pre-arm checks. + This allows preflight checks to be run on demand, which may be useful on systems that normally run them at low rate, or which do not trigger checks when the armable state might have changed. + This command should return MAV_RESULT_ACCEPTED if it will run the checks. + The results of the checks are usually then reported in SYS_STATUS messages (this is system-specific). + The command should return MAV_RESULT_TEMPORARILY_REJECTED if the system is already armed. + |Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_ILLUMINATOR_ON_OFF=405, /* Turns illuminators ON/OFF. An illuminator is a light source that is used for lighting up dark areas external to the system: e.g. a torch or searchlight (as opposed to a light source for illuminating the system itself, e.g. an indicator light). |Illuminators on/off (MAV_BOOL_TRUE: illuminators on). Values not equal to 0 or 1 are invalid.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_DO_ILLUMINATOR_CONFIGURE=406, /* Configures illuminator settings. An illuminator is a light source that is used for lighting up dark areas external to the system: e.g. a torch or searchlight (as opposed to a light source for illuminating the system itself, e.g. an indicator light). |Mode| 0%: Off, 100%: Max Brightness| Strobe period in seconds where 0 means strobing is not used| Strobe duty cycle where 100% means it is on constantly and 0 means strobing is not used| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_GET_HOME_POSITION=410, /* Request the home position from the vehicle. + The vehicle will ACK the command and then emit the HOME_POSITION message. |Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| */ + MAV_CMD_INJECT_FAILURE=420, /* Inject artificial failure for testing purposes. Note that autopilots should implement an additional protection before accepting this command such as a specific param setting. |The unit which is affected by the failure.| The type how the failure manifests itself.| Instance affected by failure (0 to signal all).| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_START_RX_PAIR=500, /* Starts receiver pairing. |RC type.| RC sub type.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_GET_MESSAGE_INTERVAL=510, /* + Request the interval between messages for a particular MAVLink message ID. + The receiver should ACK the command and then emit its response in a MESSAGE_INTERVAL message. + |The MAVLink message ID| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_SET_MESSAGE_INTERVAL=511, /* Set the interval between messages for a particular MAVLink message ID. This interface replaces REQUEST_DATA_STREAM. |The MAVLink message ID| The interval between two messages. -1: disable. 0: request default rate (which may be zero).| Use for index ID, if required. Otherwise, the use of this parameter (if any) must be defined in the requested message. By default assumed not used (0). When used as an index ID, 0 means "all instances", "1" means the first instance in the sequence (the emitted message will have an id of 0 if message ids are 0-indexed, or 1 if index numbers start from one).| The use of this parameter (if any), must be defined in the requested message. By default assumed not used (0).| The use of this parameter (if any), must be defined in the requested message. By default assumed not used (0/NaN).| The use of this parameter (if any), must be defined in the requested message. By default assumed not used (0/NaN).| Target address of message stream (if message has target address fields). 0: Flight-stack default (recommended), 1: address of requester, 2: broadcast.| */ + MAV_CMD_REQUEST_MESSAGE=512, /* Request the target system(s) emit a single instance of a specified message (i.e. a "one-shot" version of MAV_CMD_SET_MESSAGE_INTERVAL). |The MAVLink message ID of the requested message.| Use for index ID, if required. Otherwise, the use of this parameter (if any) must be defined in the requested message. By default assumed not used (0).| The use of this parameter (if any), must be defined in the requested message. By default assumed not used (0).| The use of this parameter (if any), must be defined in the requested message. By default assumed not used (0).| The use of this parameter (if any), must be defined in the requested message. By default assumed not used (0).| The use of this parameter (if any), must be defined in the requested message. By default assumed not used (0).| Target address for requested message (if message has target address fields). 0: Flight-stack default, 1: address of requester, 2: broadcast.| */ + MAV_CMD_REQUEST_PROTOCOL_VERSION=519, /* Request MAVLink protocol version compatibility. All receivers should ACK the command and then emit their capabilities in an PROTOCOL_VERSION message |Request supported protocol versions by all nodes on the network (MAV_BOOL_TRUE). Values not equal to 0 or 1 are invalid.| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES=520, /* Request autopilot capabilities. The receiver should ACK the command and then emit its capabilities in an AUTOPILOT_VERSION message |Request autopilot version (MAV_BOOL_TRUE). Values not equal to 0 or 1 are invalid.| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_REQUEST_CAMERA_INFORMATION=521, /* Request camera information (CAMERA_INFORMATION). |Request camera capabilities (MAV_BOOL_TRUE). Values not equal to 0 or 1 are invalid.| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_REQUEST_CAMERA_SETTINGS=522, /* Request camera settings (CAMERA_SETTINGS). |Request camera settings (MAV_BOOL_TRUE). Values not equal to 0 or 1 are invalid.| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_REQUEST_STORAGE_INFORMATION=525, /* Request storage information (STORAGE_INFORMATION). Use the command's target_component to target a specific component's storage. |Storage ID (0 for all, 1 for first, 2 for second, etc.)| Request storage information (MAV_BOOL_TRUE). Values not equal to 0 or 1 are invalid.| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_STORAGE_FORMAT=526, /* Format a storage medium. Once format is complete, a STORAGE_INFORMATION message is sent. Use the command's target_component to target a specific component's storage. |Storage ID (1 for first, 2 for second, etc.)| Format storage (and reset image log). Values not equal to 0 or 1 are invalid.| Reset Image Log (without formatting storage medium). This will reset CAMERA_CAPTURE_STATUS.image_count and CAMERA_IMAGE_CAPTURED.image_index. Values not equal to 0 or 1 are invalid.| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_REQUEST_CAMERA_CAPTURE_STATUS=527, /* Request camera capture status (CAMERA_CAPTURE_STATUS) |Request camera capture status (MAV_BOOL_TRUE). Values not equal to 0 or 1 are invalid.| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_REQUEST_FLIGHT_INFORMATION=528, /* Request flight information (FLIGHT_INFORMATION) |Request flight information (MAV_BOOL_TRUE). Values not equal to 0 or 1 are invalid.| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_RESET_CAMERA_SETTINGS=529, /* Reset all camera settings to Factory Default |Reset all settings (MAV_BOOL_TRUE). Values not equal to 0 or 1 are invalid.| Target camera ID. 7 to 255: MAVLink camera component id. 1 to 6 for cameras attached to the autopilot, which don't have a distinct component id. 0: all cameras. This is used to target specific autopilot-connected cameras. It is also used to target specific cameras when the MAV_CMD is used in a mission.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_SET_CAMERA_MODE=530, /* Set camera running mode. Use NaN for reserved values. GCS will send a MAV_CMD_REQUEST_VIDEO_STREAM_STATUS command after a mode change if the camera supports video streaming. |Target camera ID. 7 to 255: MAVLink camera component id. 1 to 6 for cameras attached to the autopilot, which don't have a distinct component id. 0: all cameras. This is used to target specific autopilot-connected cameras. It is also used to target specific cameras when the MAV_CMD is used in a mission.| Camera mode| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ + MAV_CMD_SET_CAMERA_ZOOM=531, /* Set camera zoom. Camera must respond with a CAMERA_SETTINGS message (on success). |Zoom type| Zoom value. The range of valid values depend on the zoom type.| Target camera ID. 7 to 255: MAVLink camera component id. 1 to 6 for cameras attached to the autopilot, which don't have a distinct component id. 0: all cameras. This is used to target specific autopilot-connected cameras. It is also used to target specific cameras when the MAV_CMD is used in a mission.| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_SET_CAMERA_FOCUS=532, /* Set camera focus. Camera must respond with a CAMERA_SETTINGS message (on success). |Focus type| Focus value| Target camera ID. 7 to 255: MAVLink camera component id. 1 to 6 for cameras attached to the autopilot, which don't have a distinct component id. 0: all cameras. This is used to target specific autopilot-connected cameras. It is also used to target specific cameras when the MAV_CMD is used in a mission.| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_SET_STORAGE_USAGE=533, /* Set that a particular storage is the preferred location for saving photos, videos, and/or other media (e.g. to set that an SD card is used for storing videos). + There can only be one preferred save location for each particular media type: setting a media usage flag will clear/reset that same flag if set on any other storage. + If no flag is set the system should use its default storage. + A target system can choose to always use default storage, in which case it should ACK the command with MAV_RESULT_UNSUPPORTED. + A target system can choose to not allow a particular storage to be set as preferred storage, in which case it should ACK the command with MAV_RESULT_DENIED. |Storage ID (1 for first, 2 for second, etc.)| Usage flags| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_SET_CAMERA_SOURCE=534, /* Set camera source. Changes the camera's active sources on cameras with multiple image sensors. |Component Id of camera to address or 1-6 for non-MAVLink cameras, 0 for all cameras.| Primary Source| Secondary Source. If non-zero the second source will be displayed as picture-in-picture.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_JUMP_TAG=600, /* Tagged jump target. Can be jumped to with MAV_CMD_DO_JUMP_TAG. |Tag.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_DO_JUMP_TAG=601, /* Jump to the matching tag in the mission list. Repeat this action for the specified number of times. A mission should contain a single matching tag for each jump. If this is not the case then a jump to a missing tag should complete the mission, and a jump where there are multiple matching tags should always select the one with the lowest mission sequence number. |Target tag to jump to.| Repeat count.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_DO_SET_SYS_CMP_ID=610, /* + Set system and component id. + This allows moving of a system and all its components to a new system id, or moving a particular component to a new system/component id. + Recipients must reject command addressed to broadcast system ID. + |New system ID for target component(s). 0: ignore and reject command (broadcast system ID not allowed).| New component ID for target component(s). 0: ignore (component IDs don't change).| Reboot components after ID change. Any non-zero value triggers the reboot.| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_DO_SET_GLOBAL_ORIGIN=611, /* Sets the GNSS coordinates of the vehicle local origin (0,0,0) position. + Vehicle should emit GPS_GLOBAL_ORIGIN irrespective of whether the origin is changed. + This enables transform between the local coordinate frame and the global (GNSS) coordinate frame, which may be necessary when (for example) indoor and outdoor settings are connected and the MAV should move from in- to outdoor. + This command supersedes SET_GPS_GLOBAL_ORIGIN. + Should be sent in a COMMAND_INT (Expected frame is MAV_FRAME_GLOBAL, and this should be assumed when sent in COMMAND_LONG). + |Empty| Empty| Empty| Empty| Latitude| Longitude| Altitude| */ + MAV_CMD_EXTERNAL_ATTITUDE_ESTIMATE=620, /* Set an external estimate of vehicle attitude. + This might be used to provide an initial attitude (especially heading) estimate to the estimator (EKF). Angles are defined in a 3-2-1 (yaw-pitch-roll) intrinsic Tait-Bryan sequence. + |Roll angle. Set to NaN if unknown.| Pitch angle. Set to NaN if unknown.| Yaw/heading (relative to true north) angle. Set to NaN if unknown.| Estimated 1 sigma accuracy of roll and pitch angles. Set to NaN if unknown.| Empty| Empty| Estimated 1 sigma accuracy of yaw angle. Set to NaN if unknown.| */ + MAV_CMD_PARAM_TRANSACTION=900, /* Request to start or end a parameter transaction. Multiple kinds of transport layers can be used to exchange parameters in the transaction (param, param_ext and mavftp). The command response can either be a success/failure or an in progress in case the receiving side takes some time to apply the parameters. |Action to be performed (start, commit, cancel, etc.)| Possible transport layers to set and get parameters via mavlink during a parameter transaction.| Identifier for a specific transaction.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_DO_GIMBAL_MANAGER_PITCHYAW=1000, /* Set gimbal manager pitch/yaw setpoints (low rate command). It is possible to set combinations of the values below. E.g. an angle as well as a desired angular rate can be used to get to this angle at a certain angular rate, or an angular rate only will result in continuous turning. NaN is to be used to signal unset. Note: only the gimbal manager will react to this command - it will be ignored by a gimbal device. Use GIMBAL_MANAGER_SET_PITCHYAW if you need to stream pitch/yaw setpoints at higher rate. |Pitch angle (positive to pitch up, relative to vehicle for FOLLOW mode, relative to world horizon for LOCK mode).| Yaw angle (positive to yaw to the right, relative to vehicle for FOLLOW mode, absolute to North for LOCK mode).| Pitch rate (positive to pitch up).| Yaw rate (positive to yaw to the right).| Gimbal manager flags to use.| Reserved (default:0)| Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| */ + MAV_CMD_DO_GIMBAL_MANAGER_CONFIGURE=1001, /* Gimbal configuration to set which sysid/compid is in primary and secondary control. |Sysid for primary control (0: no one in control, -1: leave unchanged, -2: set itself in control (for missions where the own sysid is still unknown), -3: remove control if currently in control).| Compid for primary control (0: no one in control, -1: leave unchanged, -2: set itself in control (for missions where the own sysid is still unknown), -3: remove control if currently in control).| Sysid for secondary control (0: no one in control, -1: leave unchanged, -2: set itself in control (for missions where the own sysid is still unknown), -3: remove control if currently in control).| Compid for secondary control (0: no one in control, -1: leave unchanged, -2: set itself in control (for missions where the own sysid is still unknown), -3: remove control if currently in control).| Reserved (default:0)| Reserved (default:0)| Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| */ + MAV_CMD_IMAGE_START_CAPTURE=2000, /* Start image capture sequence. CAMERA_IMAGE_CAPTURED must be emitted after each capture. + + Param1 (id) may be used to specify the target camera: 0: all cameras, 1 to 6: autopilot-connected cameras, 7-255: MAVLink camera component ID. + It is needed in order to target specific cameras connected to the autopilot, or specific sensors in a multi-sensor camera (neither of which have a distinct MAVLink component ID). + It is also needed to specify the target camera in missions. + + When used in a mission, an autopilot should execute the MAV_CMD for a specified local camera (param1 = 1-6), or resend it as a command if it is intended for a MAVLink camera (param1 = 7 - 255), setting the command's target_component as the param1 value (and setting param1 in the command to zero). + If the param1 is 0 the autopilot should do both. + + When sent in a command the target MAVLink address is set using target_component. + If addressed specifically to an autopilot: param1 should be used in the same way as it is for missions (though command should NACK with MAV_RESULT_DENIED if a specified local camera does not exist). + If addressed to a MAVLink camera, param 1 can be used to address all cameras (0), or to separately address 1 to 7 individual sensors. Other values should be NACKed with MAV_RESULT_DENIED. + If the command is broadcast (target_component is 0) then param 1 should be set to 0 (any other value should be NACKED with MAV_RESULT_DENIED). An autopilot would trigger any local cameras and forward the command to all channels. + |Target camera ID. 7 to 255: MAVLink camera component id. 1 to 6 for cameras attached to the autopilot, which don't have a distinct component id. 0: all cameras. This is used to target specific autopilot-connected cameras. It is also used to target specific cameras when the MAV_CMD is used in a mission.| Desired elapsed time between two consecutive pictures (in seconds). Minimum values depend on hardware (typically greater than 2 seconds).| Total number of images to capture. 0 to capture forever/until MAV_CMD_IMAGE_STOP_CAPTURE.| Capture sequence number starting from 1. This is only valid for single-capture (param3 == 1), otherwise set to 0. Increment the capture ID for each capture command to prevent double captures when a command is re-transmitted.| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ + MAV_CMD_IMAGE_STOP_CAPTURE=2001, /* Stop image capture sequence. + + Param1 (id) may be used to specify the target camera: 0: all cameras, 1 to 6: autopilot-connected cameras, 7-255: MAVLink camera component ID. + It is needed in order to target specific cameras connected to the autopilot, or specific sensors in a multi-sensor camera (neither of which have a distinct MAVLink component ID). + It is also needed to specify the target camera in missions. + + When used in a mission, an autopilot should execute the MAV_CMD for a specified local camera (param1 = 1-6), or resend it as a command if it is intended for a MAVLink camera (param1 = 7 - 255), setting the command's target_component as the param1 value (and setting param1 in the command to zero). + If the param1 is 0 the autopilot should do both. + + When sent in a command the target MAVLink address is set using target_component. + If addressed specifically to an autopilot: param1 should be used in the same way as it is for missions (though command should NACK with MAV_RESULT_DENIED if a specified local camera does not exist). + If addressed to a MAVLink camera, param1 can be used to address all cameras (0), or to separately address 1 to 7 individual sensors. Other values should be NACKed with MAV_RESULT_DENIED. + If the command is broadcast (target_component is 0) then param 1 should be set to 0 (any other value should be NACKED with MAV_RESULT_DENIED). An autopilot would trigger any local cameras and forward the command to all channels. + |Target camera ID. 7 to 255: MAVLink camera component id. 1 to 6 for cameras attached to the autopilot, which don't have a distinct component id. 0: all cameras. This is used to target specific autopilot-connected cameras. It is also used to target specific cameras when the MAV_CMD is used in a mission.| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ + MAV_CMD_REQUEST_CAMERA_IMAGE_CAPTURE=2002, /* Re-request a CAMERA_IMAGE_CAPTURED message. |Sequence number for missing CAMERA_IMAGE_CAPTURED message| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ + MAV_CMD_DO_TRIGGER_CONTROL=2003, /* Enable or disable on-board camera triggering system. |Trigger enable/disable (0 for disable, 1 for start), -1 to ignore| 1 to reset the trigger sequence, -1 or 0 to ignore| 1 to pause triggering, but without switching the camera off or retracting it. -1 to ignore| Target camera ID. 7 to 255: MAVLink camera component id. 1 to 6 for cameras attached to the autopilot, which don't have a distinct component id. 0: all cameras. This is used to target specific autopilot-connected cameras. It is also used to target specific cameras when the MAV_CMD is used in a mission.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_CAMERA_TRACK_POINT=2004, /* If the camera supports point visual tracking (CAMERA_CAP_FLAGS_HAS_TRACKING_POINT is set), initiate tracking at a point in an image. |Point to track x value (normalized 0..1, 0 is left, 1 is right).| Point to track y value (normalized 0..1, 0 is top, 1 is bottom).| Point radius (normalized 0..1, 0 is one pixel, 1 is full image width).| Target camera ID. 7 to 255: MAVLink camera component id. 1 to 6 for cameras attached to the autopilot, which don't have a distinct component id. 0: all cameras. This is used to target specific autopilot-connected cameras. It is also used to target specific cameras when the MAV_CMD is used in a mission.| Identifier of the frame on which to initiate tracking.| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_CAMERA_TRACK_RECTANGLE=2005, /* If the camera supports rectangle visual tracking (CAMERA_CAP_FLAGS_HAS_TRACKING_RECTANGLE is set), initiate tracking of a rectangular area in an image. |Top left corner of rectangle x value (normalized 0..1, 0 is left, 1 is right).| Top left corner of rectangle y value (normalized 0..1, 0 is top, 1 is bottom).| Bottom right corner of rectangle x value (normalized 0..1, 0 is left, 1 is right).| Bottom right corner of rectangle y value (normalized 0..1, 0 is top, 1 is bottom).| Target camera ID. 7 to 255: MAVLink camera component id. 1 to 6 for cameras attached to the autopilot, which don't have a distinct component id. 0: all cameras. This is used to target specific autopilot-connected cameras. It is also used to target specific cameras when the MAV_CMD is used in a mission.| Identifier of the frame on which to initiate tracking.| Reserved (default:0)| */ + MAV_CMD_CAMERA_TRACK_OBJECT=2006, /* Start tracking an object by referencing it's ID || Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_CAMERA_STOP_TRACKING=2010, /* Stops ongoing tracking. |Target camera ID. 7 to 255: MAVLink camera component id. 1 to 6 for cameras attached to the autopilot, which don't have a distinct component id. 0: all cameras. This is used to target specific autopilot-connected cameras. It is also used to target specific cameras when the MAV_CMD is used in a mission.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_CAMERA_START_MTI=2020, /* Enable Moving Target Indicators (MTI) on streamed video. + Support for feature can be checked with CAMERA_CAP_FLAGS_HAS_MTI, and disabled with MAV_CMD_CAMERA_STOP_MTI. |Target camera ID. 7 to 255: MAVLink camera component id. 1 to 6 for cameras attached to the autopilot, which don't have a distinct component id. 0: all cameras. This is used to target specific autopilot-connected cameras. It is also used to target specific cameras when the MAV_CMD is used in a mission.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_CAMERA_STOP_MTI=2021, /* Disable Moving Target Indicators (MTI) on streamed video. |Target camera ID. 7 to 255: MAVLink camera component id. 1 to 6 for cameras attached to the autopilot, which don't have a distinct component id. 0: all cameras. This is used to target specific autopilot-connected cameras. It is also used to target specific cameras when the MAV_CMD is used in a mission.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_CAMERA_TRACKING_ADJUSTMENT=2099, /* Provides fine adjustments to a tracking window position in the video feed. The position adjustments are sent as relative step changes from the current tracking point. |Timestamp (UNIX epoch time)| Horizontal adjustment in steps relative to the current position. Negative values shift the target left; positive values shift it right.| Vertical adjustment in steps relative to the current position. Negative values shift the target upward; positive values shift it downward.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_VIDEO_START_CAPTURE=2500, /* Starts video capture (recording). |Video Stream ID (0 for all streams)| Frequency CAMERA_CAPTURE_STATUS messages should be sent while recording (0 for no messages, otherwise frequency)| Target camera ID. 7 to 255: MAVLink camera component id. 1 to 6 for cameras attached to the autopilot, which don't have a distinct component id. 0: all cameras. This is used to target specific autopilot-connected cameras. It is also used to target specific cameras when the MAV_CMD is used in a mission.| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ + MAV_CMD_VIDEO_STOP_CAPTURE=2501, /* Stop the current video capture (recording). |Video Stream ID (0 for all streams)| Target camera ID. 7 to 255: MAVLink camera component id. 1 to 6 for cameras attached to the autopilot, which don't have a distinct component id. 0: all cameras. This is used to target specific autopilot-connected cameras. It is also used to target specific cameras when the MAV_CMD is used in a mission.| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ + MAV_CMD_VIDEO_START_STREAMING=2502, /* Start video streaming |Video Stream ID (0 for all streams, 1 for first, 2 for second, etc.)| Target camera ID. 7 to 255: MAVLink camera component id. 1 to 6 for cameras attached to the autopilot, which don't have a distinct component id. 0: all cameras. This is used to target specific autopilot-connected cameras. It is also used to target specific cameras when the MAV_CMD is used in a mission.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_VIDEO_STOP_STREAMING=2503, /* Stop the given video stream |Video Stream ID (0 for all streams, 1 for first, 2 for second, etc.)| Target camera ID. 7 to 255: MAVLink camera component id. 1 to 6 for cameras attached to the autopilot, which don't have a distinct component id. 0: all cameras. This is used to target specific autopilot-connected cameras. It is also used to target specific cameras when the MAV_CMD is used in a mission.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_REQUEST_VIDEO_STREAM_INFORMATION=2504, /* Request video stream information (VIDEO_STREAM_INFORMATION) |Video Stream ID (0 for all streams, 1 for first, 2 for second, etc.)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_REQUEST_VIDEO_STREAM_STATUS=2505, /* Request video stream status (VIDEO_STREAM_STATUS) |Video Stream ID (0 for all streams, 1 for first, 2 for second, etc.)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_LOGGING_START=2510, /* Request to start streaming logging data over MAVLink (see also LOGGING_DATA message) |Format: 0: ULog| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| */ + MAV_CMD_LOGGING_STOP=2511, /* Request to stop streaming log data over MAVLink |Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| */ + MAV_CMD_AIRFRAME_CONFIGURATION=2520, /* |Landing gear ID (default: 0, -1 for all)| Landing gear position (Down: 0, Up: 1, NaN for no change)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ + MAV_CMD_CONTROL_HIGH_LATENCY=2600, /* Request to start/stop transmitting over the high latency telemetry |Start transmission over high latency telemetry (MAV_BOOL_FALSE: stop transmission). Values not equal to 0 or 1 are invalid.| Empty| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_PANORAMA_CREATE=2800, /* Create a panorama at the current position |Viewing angle horizontal of the panorama (+- 0.5 the total angle)| Viewing angle vertical of panorama.| Speed of the horizontal rotation.| Speed of the vertical rotation.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_DO_VTOL_TRANSITION=3000, /* Request VTOL transition |The target VTOL state. For normal transitions, only MAV_VTOL_STATE_MC and MAV_VTOL_STATE_FW can be used.| Force immediate transition to the specified MAV_VTOL_STATE. 1: Force immediate, 0: normal transition. Can be used, for example, to trigger an emergency "Quadchute". Caution: Can be dangerous/damage vehicle, depending on autopilot implementation of this command.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_ARM_AUTHORIZATION_REQUEST=3001, /* Request authorization to arm the vehicle to a external entity, the arm authorizer is responsible to request all data that is needs from the vehicle before authorize or deny the request. + If approved the COMMAND_ACK message progress field should be set with period of time that this authorization is valid in seconds. + If the authorization is denied COMMAND_ACK.result_param2 should be set with one of the reasons in ARM_AUTH_DENIED_REASON. + |Vehicle system id, this way ground station can request arm authorization on behalf of any vehicle| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_SET_GUIDED_SUBMODE_STANDARD=4000, /* This command sets the submode to standard guided when vehicle is in guided mode. The vehicle holds position and altitude and the user can input the desired velocities along all three axes. + |Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ + MAV_CMD_SET_GUIDED_SUBMODE_CIRCLE=4001, /* This command sets submode circle when vehicle is in guided mode. Vehicle flies along a circle facing the center of the circle. The user can input the velocity along the circle and change the radius. If no input is given the vehicle will hold position. + |Radius of desired circle in CIRCLE_MODE| User defined| User defined| User defined| Target latitude of center of circle in CIRCLE_MODE| Target longitude of center of circle in CIRCLE_MODE| Reserved (default:0)| */ + MAV_CMD_CONDITION_GATE=4501, /* Delay mission state machine until gate has been reached. |Geometry: 0: orthogonal to path between previous and next waypoint.| Use altitude (MAV_BOOL_FALSE: ignore altitude). Values not equal to 0 or 1 are invalid.| Empty| Empty| Latitude| Longitude| Altitude| */ + MAV_CMD_NAV_FENCE_RETURN_POINT=5000, /* Fence return point (there can only be one such point in a geofence definition). If rally points are supported they should be used instead. |Reserved| Reserved| Reserved| Reserved| Latitude| Longitude| Altitude| */ + MAV_CMD_NAV_FENCE_POLYGON_VERTEX_INCLUSION=5001, /* Fence vertex for an inclusion polygon (the polygon must not be self-intersecting). The vehicle must stay within this area. Minimum of 3 vertices required. + The vertices for a polygon must be sent sequentially, each with param1 set to the total number of vertices in the polygon. + |Polygon vertex count. This is the number of vertices in the current polygon (all vertices will have the same number).| Vehicle must be inside ALL inclusion zones in a single group, vehicle must be inside at least one group, must be the same for all points in each polygon| Reserved| Reserved| Latitude| Longitude| Reserved| */ + MAV_CMD_NAV_FENCE_POLYGON_VERTEX_EXCLUSION=5002, /* Fence vertex for an exclusion polygon (the polygon must not be self-intersecting). The vehicle must stay outside this area. Minimum of 3 vertices required. + The vertices for a polygon must be sent sequentially, each with param1 set to the total number of vertices in the polygon. + |Polygon vertex count. This is the number of vertices in the current polygon (all vertices will have the same number).| Reserved| Reserved| Reserved| Latitude| Longitude| Reserved| */ + MAV_CMD_NAV_FENCE_CIRCLE_INCLUSION=5003, /* Circular fence area. The vehicle must stay inside this area. + |Radius.| Vehicle must be inside ALL inclusion zones in a single group, vehicle must be inside at least one group| Reserved| Reserved| Latitude| Longitude| Reserved| */ + MAV_CMD_NAV_FENCE_CIRCLE_EXCLUSION=5004, /* Circular fence area. The vehicle must stay outside this area. + |Radius.| Reserved| Reserved| Reserved| Latitude| Longitude| Reserved| */ + MAV_CMD_NAV_RALLY_POINT=5100, /* Rally point. You can have multiple rally points defined. + |Reserved| Reserved| Reserved| Reserved| Latitude| Longitude| Altitude| */ + MAV_CMD_UAVCAN_GET_NODE_INFO=5200, /* Commands the vehicle to respond with a sequence of messages UAVCAN_NODE_INFO, one message per every UAVCAN node that is online. Note that some of the response messages can be lost, which the receiver can detect easily by checking whether every received UAVCAN_NODE_STATUS has a matching message UAVCAN_NODE_INFO received earlier; if not, this command should be sent again in order to request re-transmission of the node information messages. |Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| */ + MAV_CMD_DO_SET_SAFETY_SWITCH_STATE=5300, /* Change state of safety switch. |New safety switch state.| Empty.| Empty.| Empty| Empty.| Empty.| Empty.| */ + MAV_CMD_DO_ADSB_OUT_IDENT=10001, /* Trigger the start of an ADSB-out IDENT. This should only be used when requested to do so by an Air Traffic Controller in controlled airspace. This starts the IDENT which is then typically held for 18 seconds by the hardware per the Mode A, C, and S transponder spec. |Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| */ + MAV_CMD_ODID_SET_EMERGENCY=12900, /* Used to manually set/unset emergency status for remote id. + This is for compliance with MOC ASTM docs, specifically F358 section 7.7: "Emergency Status Indicator". + The requirement can also be satisfied by automatic setting of the emergency status by flight stack, and that approach is preferred. + See https://mavlink.io/en/services/opendroneid.html for more information. + |Set/unset emergency 0: unset, 1: set| Reserved (default:NaN)| Reserved (default:NaN)| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_CONTROL_TAKEOVER=13670, /* Commands to take over control from the safety driver. This command cannot give control to safety driver. |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_ENGINE_LEG_TRIM=13671, /* Set engine leg trim position. Can execute trim for individual legs or all legs at once. |Engine leg selection bitmask.| Executes engine leg trimming for all selected engines(0: Down, 1:up)| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_SET_ENGINE_STATE=13672, /* Commands the desired state for vehicle engines. |Engine selection bitmask.| Commanded engine state for the selected engines.| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_SET_SHIP_APPROACH_SECTORS=13673, /* Set the user defined ship approach sectors. These sector represent approach vectors for the drone's landing sequence, with a 360/8 degree arc. |Approach sector bitmask.| Empty| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_PAYLOAD_PREPARE_DEPLOY=30001, /* Deploy payload on a Lat / Lon / Alt position. This includes the navigation to reach the required release position and velocity. |Operation mode. 0: prepare single payload deploy (overwriting previous requests), but do not execute it. 1: execute payload deploy immediately (rejecting further deploy commands during execution, but allowing abort). 2: add payload deploy to existing deployment list.| Desired approach vector in compass heading. A negative value indicates the system can define the approach vector at will.| Desired ground speed at release time. This can be overridden by the airframe in case it needs to meet minimum airspeed. A negative value indicates the system can define the ground speed at will.| Minimum altitude clearance to the release position. A negative value indicates the system can define the clearance at will.| Latitude.| Longitude.| Altitude (MSL)| */ + MAV_CMD_PAYLOAD_CONTROL_DEPLOY=30002, /* Control the payload deployment. |Operation mode. 0: Abort deployment, continue normal mission. 1: switch to payload deployment mode. 100: delete first payload deployment request. 101: delete all payload deployment requests.| Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| */ + MAV_CMD_WAYPOINT_USER_1=31000, /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ + MAV_CMD_WAYPOINT_USER_2=31001, /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ + MAV_CMD_WAYPOINT_USER_3=31002, /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ + MAV_CMD_WAYPOINT_USER_4=31003, /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ + MAV_CMD_WAYPOINT_USER_5=31004, /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ + MAV_CMD_SPATIAL_USER_1=31005, /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ + MAV_CMD_SPATIAL_USER_2=31006, /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ + MAV_CMD_SPATIAL_USER_3=31007, /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ + MAV_CMD_SPATIAL_USER_4=31008, /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ + MAV_CMD_SPATIAL_USER_5=31009, /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ + MAV_CMD_USER_1=31010, /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ + MAV_CMD_USER_2=31011, /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ + MAV_CMD_USER_3=31012, /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ + MAV_CMD_USER_4=31013, /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ + MAV_CMD_USER_5=31014, /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ + MAV_CMD_CAN_FORWARD=32000, /* Request forwarding of CAN packets from the given CAN bus to this component. CAN Frames are sent using CAN_FRAME and CANFD_FRAME messages |Bus number (0 to disable forwarding, 1 for first bus, 2 for 2nd bus, 3 for 3rd bus).| Empty.| Empty.| Empty.| Empty.| Empty.| Empty.| */ + MAV_CMD_REQUEST_OPERATOR_CONTROL=32100, /* Request GCS control of a system (or of a specific component in a system). + + A controlled system should only accept MAVLink commands and command-like messages that are sent by its controlling GCS, or from other components with the same system id. + Commands from other systems should be rejected with MAV_RESULT_FAILED (except for this command, which may be acknowledged with MAV_RESULT_ACCEPTED if control is granted). + Command-like messages should be ignored (or rejected if that is supported by their associated protocol). + + GCS control of the whole system is managed via a single component that we will refer to here as the "system manager component". + This component streams the CONTROL_STATUS message and sets the GCS_CONTROL_STATUS_FLAGS_SYSTEM_MANAGER flag. + Other components in the system should monitor for the CONTROL_STATUS message with this flag, and set their controlling GCS to match its published system id. + A GCS that wants to control the system should also monitor for the same message and flag, and address the MAV_CMD_REQUEST_OPERATOR_CONTROL to its component id. + Note that integrators are required to ensure that there is only one system manager component in the system (i.e. one component emitting the message with GCS_CONTROL_STATUS_FLAGS_SYSTEM_MANAGER set). + + The MAV_CMD_REQUEST_OPERATOR_CONTROL command is sent by a GCS to the system manager component to request or release control of a system, specifying whether subsequent takeover requests from another GCS are automatically granted, or require permission. + + The system manager component should grant control to the GCS if the system does not require takeover permission (or is uncontrolled) and ACK the request with MAV_RESULT_ACCEPTED. + The system manager component should then stream CONTROL_STATUS indicating its controlling system: all other components with the same system id should monitor this message and set their own controlling GCS to match that of the system manager component. + + If the system manager component cannot grant control (because takeover requires permission), the request should be rejected with MAV_RESULT_FAILED. + The system manager component should then send this same command to the current owning GCS in order to notify of the request. + The owning GCS would ACK with MAV_RESULT_ACCEPTED, and might choose to release control of the vehicle, or re-request control with the takeover bit set to allow permission. + In case it choses to re-request control with takeover bit set to allow permission, requester GCS will only have 10 seconds to get control, otherwise owning GCS will re-request control with takeover bit set to disallow permission, and requester GCS will need repeat the request if still interested in getting control. + Note that the pilots of both GCS should coordinate safe handover offline. + + Note that in most systems the only controlled component will be the "system manager component", and that will be the autopilot. + However separate GCS control of a particular component is also permitted, if supported by the component. + In this case the GCS will address MAV_CMD_REQUEST_OPERATOR_CONTROL to the specific component it wants to control. + The component will then stream CONTROL_STATUS for its controlling GCS (it must not set GCS_CONTROL_STATUS_FLAGS_SYSTEM_MANAGER). + The component should fall back to the system GCS (if any) when it is not directly controlled, and may stop emitting CONTROL_STATUS. + The flow is otherwise the same as for requesting control over the whole system. + |System ID of GCS requesting control. 0 when command sent from GCS to autopilot (autopilot determines requesting GCS sysid from message header). Sysid of GCS requesting control when command sent by autopilot to controlling GCS.| 0: Release control, 1: Request control.| Enable automatic granting of ownership on request (by default reject request and notify current owner). 0: Ask current owner and reject request, 1: Allow automatic takeover.| Timeout in seconds before a request to a GCS to allow takeover is assumed to be rejected. This is used to display the timeout graphically on requester and GCS in control.| Empty| Empty| Empty| */ + MAV_CMD_FIXED_MAG_CAL_YAW=42006, /* Magnetometer calibration based on provided known yaw. This allows for fast calibration using WMM field tables in the vehicle, given only the known yaw of the vehicle. If Latitude and longitude are both zero then use the current vehicle location. |Yaw of vehicle in earth frame.| CompassMask, 0 for all.| Latitude.| Longitude.| Empty.| Empty.| Empty.| */ + MAV_CMD_DO_WINCH=42600, /* Command to operate winch. |Winch instance number.| Action to perform.| Length of line to release (negative to wind).| Release rate (negative to wind).| Empty.| Empty.| Empty.| */ + MAV_CMD_EXTERNAL_POSITION_ESTIMATE=43003, /* Provide an external position estimate for use when dead-reckoning. This is meant to be used for occasional position resets that may be provided by a external system such as a remote pilot using landmarks over a video link. |Timestamp that this message was sent as a time in the transmitters time domain. The sender should wrap this time back to zero based on required timing accuracy for the application and the limitations of a 32 bit float. For example, wrapping at 10 hours would give approximately 1ms accuracy. Recipient must handle time wrap in any timing jitter correction applied to this field. Wrap rollover time should not be at not more than 250 seconds, which would give approximately 10 microsecond accuracy.| The time spent in processing the sensor data that is the basis for this position. The recipient can use this to improve time alignment of the data. Set to zero if not known.| estimated one standard deviation accuracy of the measurement. Set to NaN if not known.| Empty| Latitude| Longitude| Altitude, not used. Should be sent as NaN. May be supported in a future version of this message.| */ + MAV_CMD_EXTERNAL_WIND_ESTIMATE=43004, /* Set an external estimate of wind direction and speed. + This might be used to provide an initial wind estimate to the estimator (EKF) in the case where the vehicle is wind dead-reckoning, extending the time when operating without GPS before before position drift builds to an unsafe level. For this use case the command might reasonably be sent every few minutes when operating at altitude, and the value is cleared if the estimator resets itself. + |Horizontal wind speed.| Estimated 1 sigma accuracy of wind speed. Set to NaN if unknown.| Azimuth (relative to true north) from where the wind is blowing.| Estimated 1 sigma accuracy of wind direction. Set to NaN if unknown.| Empty| Empty| Empty| */ + MAV_CMD_ENUM_END=43005, /* | */ +} MAV_CMD; +#endif + +/** @brief List of the currently active control entity. */ +#ifndef HAVE_ENUM_CURRENT_CONTROL_ENTITY +#define HAVE_ENUM_CURRENT_CONTROL_ENTITY +typedef enum CURRENT_CONTROL_ENTITY +{ + CURRENT_CONTROL_ENTITY_NONE=0, /* Setting if no entity has control ownership. | */ + CURRENT_CONTROL_ENTITY_OWNER=1, /* Setting if the receiving GCS is the control entity. | */ + CURRENT_CONTROL_ENTITY_OTHER=2, /* Setting if a GCS other than the receiving GCS is the control entity. | */ + CURRENT_CONTROL_ENTITY_ENUM_END=3, /* | */ +} CURRENT_CONTROL_ENTITY; +#endif + +/** @brief Selection of control target for changing ownership. */ +#ifndef HAVE_ENUM_CONTROL_TARGET_REQUEST +#define HAVE_ENUM_CONTROL_TARGET_REQUEST +typedef enum CONTROL_TARGET_REQUEST +{ + CONTROL_TARGET_ALL=0, /* Request change control ownership of both flight control and payload control. | */ + CONTROL_TARGET_FLIGHT=1, /* Request change control ownership of the flight control. | */ + CONTROL_TARGET_PAYLOAD=2, /* Request change control ownership of the payload control. | */ + CONTROL_TARGET_REQUEST_ENUM_END=3, /* | */ +} CONTROL_TARGET_REQUEST; +#endif + +/** @brief Error code for the control request response. */ +#ifndef HAVE_ENUM_CONTROL_REQUEST_ERROR_CODE +#define HAVE_ENUM_CONTROL_REQUEST_ERROR_CODE +typedef enum CONTROL_REQUEST_ERROR_CODE +{ + CONTROL_REQUEST_PROCESSED=0, /* Code indicating successful processing of the request. | */ + CONTROL_REQUEST_DENIED=1, /* Error code indicating that the control request has been denied by the target system. | */ + CONTROL_REQUEST_HANDOFF_TIMEOUT=2, /* Error Code indicating timeout on the handoff request. | */ + CONTROL_REQUEST_DENIED_CONCURRENT=3, /* Error Code indicating another control request is in process. | */ + CONTROL_REQUEST_NO_CONTROL_AUTHORITY=4, /* Error Code indicating no enough authority to take control ownership. | */ + CONTROL_REQUEST_NO_PRIORITY_AUTHORITY=5, /* Error Code indicating no enough priority authority control ownership. | */ + CONTROL_REQUEST_ERROR_CODE_ENUM_END=6, /* | */ +} CONTROL_REQUEST_ERROR_CODE; +#endif + +/** @brief Decision of the GCS to a handoff request. */ +#ifndef HAVE_ENUM_HANDOFF_DECISION +#define HAVE_ENUM_HANDOFF_DECISION +typedef enum HANDOFF_DECISION +{ + HANDOFF_DECISION_ACCEPT=0, /* Decision to accept the handoff and release control ownership. | */ + HANDOFF_DECISION_DENIED=1, /* Decision to deny the handoff request and keep control ownership. | */ + HANDOFF_DECISION_ENUM_END=2, /* | */ +} HANDOFF_DECISION; +#endif + +/** @brief Possible transport layers to set and get parameters via mavlink during a parameter transaction. */ +#ifndef HAVE_ENUM_PARAM_TRANSACTION_TRANSPORT +#define HAVE_ENUM_PARAM_TRANSACTION_TRANSPORT +typedef enum PARAM_TRANSACTION_TRANSPORT +{ + PARAM_TRANSACTION_TRANSPORT_PARAM=0, /* Transaction over param transport. | */ + PARAM_TRANSACTION_TRANSPORT_PARAM_EXT=1, /* Transaction over param_ext transport. | */ + PARAM_TRANSACTION_TRANSPORT_ENUM_END=2, /* | */ +} PARAM_TRANSACTION_TRANSPORT; +#endif + +/** @brief Possible parameter transaction actions. */ +#ifndef HAVE_ENUM_PARAM_TRANSACTION_ACTION +#define HAVE_ENUM_PARAM_TRANSACTION_ACTION +typedef enum PARAM_TRANSACTION_ACTION +{ + PARAM_TRANSACTION_ACTION_START=0, /* Commit the current parameter transaction. | */ + PARAM_TRANSACTION_ACTION_COMMIT=1, /* Commit the current parameter transaction. | */ + PARAM_TRANSACTION_ACTION_CANCEL=2, /* Cancel the current parameter transaction. | */ + PARAM_TRANSACTION_ACTION_ENUM_END=3, /* | */ +} PARAM_TRANSACTION_ACTION; +#endif + +/** @brief Defines the position status of a engine leg trim. */ +#ifndef HAVE_ENUM_ENGINE_LEG_TRIM_STATE +#define HAVE_ENUM_ENGINE_LEG_TRIM_STATE +typedef enum ENGINE_LEG_TRIM_STATE +{ + ENGINE_LEG_TRIM_NONE=0, /* ENGINE_LEF_TRIM_NONE indicates no engine leg trim system is present. | */ + ENGINE_LEG_TRIM_STOWED=1, /* ENGINE_LEG_TRIM_STOWED means leg is lifted and the engine should not be started. | */ + ENGINE_LEG_TRIM_CRUISE=2, /* ENGINE_LEG_TRIM_CRUISE defines the active operational position of the engine leg. | */ + ENGINE_LEG_TRIM_FAULT=3, /* ENGINE_LEG_TRIM_FAULT indicates a faulty state in the engine leg trimming system. | */ + ENGINE_LEG_TRIM_STATE_ENUM_END=4, /* | */ +} ENGINE_LEG_TRIM_STATE; +#endif + +/** @brief Defines health state of a rudder. */ +#ifndef HAVE_ENUM_RUDDER_STATE +#define HAVE_ENUM_RUDDER_STATE +typedef enum RUDDER_STATE +{ + RUDDER_NONE=0, /* RUDDER_NONE indicates no rudder system is present. | */ + RUDDER_OK=1, /* RUDDER_OK indicates the rudder is operating correctly. | */ + RUDDER_FAULT=2, /* RUDDER_FAULT indicates a fault in the rudder system. | */ + RUDDER_STATE_ENUM_END=3, /* | */ +} RUDDER_STATE; +#endif + +/** @brief Defines the operation state of an engine. */ +#ifndef HAVE_ENUM_ENGINE_STATE +#define HAVE_ENUM_ENGINE_STATE +typedef enum ENGINE_STATE +{ + ENGINE_NONE=0, /* ENGINE_NONE indicates engine is not running and ignition is off. | */ + ENGINE_STOPPED=1, /* ENGINE_STOPPED indicates the engine is not running, but ignition is on. | */ + ENGINE_STARTING=2, /* ENGINE_STARTING indicates the engine is starting. | */ + ENGINE_RUNNING=3, /* ENGINE_RUNNING indicates the engine is running. | */ + ENGINE_FAULT=4, /* ENGINE_FAULT indicates a fault in the engine system. | */ + ENGINE_STATE_ENUM_END=5, /* | */ +} ENGINE_STATE; +#endif + +/** @brief Defines the operation state of a transmission. */ +#ifndef HAVE_ENUM_TRANSMISSION_STATE +#define HAVE_ENUM_TRANSMISSION_STATE +typedef enum TRANSMISSION_STATE +{ + TRANSMISSION_NONE=0, /* TRANSMISSION_NONE indicates no transmission system is present. | */ + TRANSMISSION_NEUTRAL=1, /* TRANSMISSION_NEUTRAL indicates the transmission is in neutral. | */ + TRANSMISSION_FORWARD=2, /* TRANSMISSION_FORWARD indicates the transmission is in forward. | */ + TRANSMISSION_REVERSE=3, /* TRANSMISSION_REVERSE indicates the transmission is in reverse. | */ + TRANSMISSION_FAULT=4, /* TRANSMISSION_FAULT indicates a fault in the transmission system. | */ + TRANSMISSION_STATE_ENUM_END=5, /* | */ +} TRANSMISSION_STATE; +#endif + +/** @brief Defines the type of fluid contained in a tank. */ +#ifndef HAVE_ENUM_FLUID_TANK_TYPE +#define HAVE_ENUM_FLUID_TANK_TYPE +typedef enum FLUID_TANK_TYPE +{ + TANK_TYPE_FUEL=0, /* TANK_TYPE_FUEL indicates the tank contains fuel. | */ + TANK_TYPE_WATER=1, /* TANK_TYPE_WATER indicates the tank contains fresh water. | */ + TANK_TYPE_GRAY_WATER=2, /* TANK_TYPE_GRAY_WATER indicates the tank contains gray water. | */ + TANK_TYPE_LIVE_WELL=3, /* TANK_TYPE_LIVE_WELL indicates the tank is a live well. | */ + TANK_TYPE_OIL=4, /* TANK_TYPE_OIL indicates the tank contains engine or hydraulic oil. | */ + TANK_TYPE_BLACK_WATER=5, /* TANK_TYPE_BLACK_WATER indicates the tank contains black water. | */ + FLUID_TANK_TYPE_ENUM_END=6, /* | */ +} FLUID_TANK_TYPE; +#endif + +/** @brief Defines the type of sensor used for measuring speed through water. */ +#ifndef HAVE_ENUM_SPEED_WATER_REFERENCED_TYPE +#define HAVE_ENUM_SPEED_WATER_REFERENCED_TYPE +typedef enum SPEED_WATER_REFERENCED_TYPE +{ + REFERENCED_TYPE_PADDLE_WHEEL=0, /* REFERENCED_TYPE_PADDLE_WHEEL indicates speed is measured using a paddle wheel sensor. | */ + REFERENCED_TYPE_PITOT_TUBE=1, /* REFERENCED_TYPE_PITOT_TUBE indicates speed is measured using a pitot tube. | */ + REFERENCED_TYPE_DOPPLER=2, /* REFERENCED_TYPE_DOPPLER indicates speed is measured using a Doppler-based sensor. | */ + REFERENCED_TYPE_CORRELATION=3, /* REFERENCED_TYPE_CORRELATION indicates speed is measured using a correlation-based sensor. | */ + REFERENCED_TYPE_ELECTRO_MAGNETIC=4, /* REFERENCED_TYPE_ELECTRO_MAGNETIC indicates speed is measured using an electromagnetic flow sensor. | */ + SPEED_WATER_REFERENCED_TYPE_ENUM_END=5, /* | */ +} SPEED_WATER_REFERENCED_TYPE; +#endif + +/** @brief Specifies the frame of reference used for wind direction and speed measurements. */ +#ifndef HAVE_ENUM_WIND_REFERENCE +#define HAVE_ENUM_WIND_REFERENCE +typedef enum WIND_REFERENCE +{ + REFERENCE_TRUE=0, /* REFERENCE_TRUE Wind referenced to geographic (true) North. | */ + REFERENCE_MAGNETIC=1, /* REFERENCE_MAGNETIC Wind referenced to magnetic North. | */ + REFERENCE_APPARENT=2, /* REFERENCE_APPARENT Apparent wind relative to the vessel. | */ + REFERENCE_TRUE_BOAT_REFERENCED=3, /* REFERENCE_TRUE_BOAT_REFERENCED True wind direction relative to the boat's heading, corrected for vessel movement but not Earth-referenced.. | */ + REFERENCE_TRUE_WATER_REFERENCED=4, /* REFERENCE_TRUE_WATER_REFERENCED True wind direction relative to the water surface. | */ + WIND_REFERENCE_ENUM_END=5, /* | */ +} WIND_REFERENCE; +#endif + +/** @brief Type of navigation angle measurement. */ +#ifndef HAVE_ENUM_NAVIGATION_ANGLE_TYPE +#define HAVE_ENUM_NAVIGATION_ANGLE_TYPE +typedef enum NAVIGATION_ANGLE_TYPE +{ + NAVIGATION_ANGLE_TYPE_RELATIVE=0, /* Navigation angle measured with respect to vehicle's heading. | */ + NAVIGATION_ANGLE_TYPE_TRUE=1, /* Navigation angle measured with respect to True North. | */ + NAVIGATION_ANGLE_TYPE_MAGNETIC=2, /* Navigation angle measured with respect to Magnetic North. | */ + NAVIGATION_ANGLE_TYPE_ENUM_END=3, /* | */ +} NAVIGATION_ANGLE_TYPE; +#endif + +/** @brief Target track status. */ +#ifndef HAVE_ENUM_TARGET_TRACK_STATUS +#define HAVE_ENUM_TARGET_TRACK_STATUS +typedef enum TARGET_TRACK_STATUS +{ + TARGET_TRACK_STATUS_UNKNOWN=0, /* Target track status is unknown. | */ + TARGET_TRACK_STATUS_LOST=1, /* Target track lost. | */ + TARGET_TRACK_STATUS_QUERY=2, /* Target track status is being queried. | */ + TARGET_TRACK_STATUS_TRACKING=3, /* Target is being tracked. | */ + TARGET_TRACK_STATUS_ENUM_END=4, /* | */ +} TARGET_TRACK_STATUS; +#endif + +/** @brief Type of target acquisition. */ +#ifndef HAVE_ENUM_TARGET_TRACK_ACQUISITION_TYPE +#define HAVE_ENUM_TARGET_TRACK_ACQUISITION_TYPE +typedef enum TARGET_TRACK_ACQUISITION_TYPE +{ + TARGET_TRACK_ACQUISITION_TYPE_AUTO=0, /* Automatic target acquisition. | */ + TARGET_TRACK_ACQUISITION_TYPE_MANUAL=1, /* Manual target acquisition. | */ + TARGET_TRACK_ACQUISITION_TYPE_REPORTED=2, /* Target acquisition is reported by another system. | */ + TARGET_TRACK_ACQUISITION_TYPE_ENUM_END=3, /* | */ +} TARGET_TRACK_ACQUISITION_TYPE; +#endif + +/** @brief Parachute trigger sources. */ +#ifndef HAVE_ENUM_PARACHUTE_TRIGGER_FLAGS +#define HAVE_ENUM_PARACHUTE_TRIGGER_FLAGS +typedef enum PARACHUTE_TRIGGER_FLAGS +{ + PARACHUTE_TRIGGER_FLAGS_MANUAL=1, /* Manual trigger (ground based control via parachute-specific RF channel) | */ + PARACHUTE_TRIGGER_FLAGS_ATS=2, /* Automatic trigger system (ATS) | */ + PARACHUTE_TRIGGER_FLAGS_FC=4, /* Flight controller trigger (e.g. MAVLink from FC, PWM, DroneCan, RC Control) | */ + PARACHUTE_TRIGGER_FLAGS_OFFBOARD=8, /* Offboard computer trigger (via MAVLink) | */ + PARACHUTE_TRIGGER_FLAGS_GEOFENCE=16, /* Geofence trigger (by parachute). Parachute uses MAVLink mission protocol to fetch geofence. | */ + PARACHUTE_TRIGGER_FLAGS_FTS_PRECHECKING=32, /* FTS (flight termination system) pre-checking protocol trigger | */ + PARACHUTE_TRIGGER_FLAGS_ATS_AUTO_ARM=64, /* Auto-arming of parachute automatic trigger system (ATS). This allows a parachute to enable ATS after detecting that it has reached a desired altitude. | */ + PARACHUTE_TRIGGER_FLAGS_ATS_AUTO_DISARM=128, /* Auto-disarming of parachute automatic trigger system (ATS). This allows a parachute to disable ATS after detecting that it is below a desired altitude. | */ + PARACHUTE_TRIGGER_FLAGS_ENUM_END=129, /* | */ +} PARACHUTE_TRIGGER_FLAGS; +#endif + +/** @brief Parachute deployment trigger source */ +#ifndef HAVE_ENUM_PARACHUTE_DEPLOYMENT_TRIGGER +#define HAVE_ENUM_PARACHUTE_DEPLOYMENT_TRIGGER +typedef enum PARACHUTE_DEPLOYMENT_TRIGGER +{ + PARACHUTE_DEPLOYMENT_TRIGGER_NONE=0, /* None (parachute has not deployed) | */ + PARACHUTE_DEPLOYMENT_TRIGGER_MANUAL=1, /* Manual | */ + PARACHUTE_DEPLOYMENT_TRIGGER_ATS=2, /* Automatic trigger system (ATS) | */ + PARACHUTE_DEPLOYMENT_TRIGGER_DRONE=3, /* Drone | */ + PARACHUTE_DEPLOYMENT_TRIGGER_MAVLINK=4, /* MAVLink, e.g. from an offboard computer | */ + PARACHUTE_DEPLOYMENT_TRIGGER_GEOFENCE=5, /* Geofence | */ + PARACHUTE_DEPLOYMENT_TRIGGER_FTS_PRECHECKING=6, /* Flight Termination System (FTS) pre-checking protocol | */ + PARACHUTE_DEPLOYMENT_TRIGGER_ENUM_END=7, /* | */ +} PARACHUTE_DEPLOYMENT_TRIGGER; +#endif + +/** @brief Parachute module safety-related flags. */ +#ifndef HAVE_ENUM_PARACHUTE_SAFETY_FLAGS +#define HAVE_ENUM_PARACHUTE_SAFETY_FLAGS +typedef enum PARACHUTE_SAFETY_FLAGS +{ + PARACHUTE_SAFETY_FLAGS_GROUND_CLEARED=1, /* This is used to indicate that the parachute module has cleared a safe distance from the ground for deployment. | */ + PARACHUTE_SAFETY_FLAGS_ON_GROUND=2, /* This is used to indicate that the parachute's own sensor has confirmed it is stably on the ground. | */ + PARACHUTE_SAFETY_FLAGS_GEOFENCE_MISSION_SET=4, /* This is used to indicate that the parachute module has downloaded geofence mission successfully and can be triggered by geofence source. | */ + PARACHUTE_SAFETY_FLAGS_ENUM_END=5, /* | */ +} PARACHUTE_SAFETY_FLAGS; +#endif + +/** @brief Parachute module error flags (bitmap, 0 means no error) */ +#ifndef HAVE_ENUM_PARACHUTE_ERROR_FLAGS +#define HAVE_ENUM_PARACHUTE_ERROR_FLAGS +typedef enum PARACHUTE_ERROR_FLAGS +{ + PARACHUTE_ERROR_FLAGS_BAROMETER_ERROR=1, /* There is an error with the parachute barometer | */ + PARACHUTE_ERROR_FLAGS_IMU_ERROR=2, /* There is an error with the parachute IMU | */ + PARACHUTE_ERROR_FLAGS_RF_CONNECTION_ERROR=4, /* There is an error with the parachute's RF that is used for manual control | */ + PARACHUTE_ERROR_FLAGS_LOW_POWER=8, /* Parachute module has low power | */ + PARACHUTE_ERROR_FLAGS_FC_CONNECTION_ERROR=16, /* There is an error with the connection between parachute and flight controller (FC) | */ + PARACHUTE_ERROR_FLAGS_EFTS_CONNECTION_ERROR=32, /* There is an error with the connection between parachute and Electrical Flight Termination System (EFTS) | */ + PARACHUTE_ERROR_FLAGS_POD_CONNECTION_ERROR=64, /* There is an error with the parachute pod | */ + PARACHUTE_ERROR_FLAGS_EFTS_DIAGNOSE=128, /* Parachute Electrical Flight Termination System (EFTS) diagnosis failed | */ + PARACHUTE_ERROR_FLAGS_CHARGING_FAILED=256, /* Parachute module charging failed | */ + PARACHUTE_ERROR_FLAGS_EXTERNAL_POWER_ERROR=512, /* There is an error with the parachute external power source | */ + PARACHUTE_ERROR_FLAGS_GS_CONNECTION_ERROR=1024, /* There is an error with the connection between parachute and Ground Station (GS) | */ + PARACHUTE_ERROR_FLAGS_GPS_ERROR=2048, /* There is an error with the parachute's GPS | */ + PARACHUTE_ERROR_FLAGS_SUBSYSTEM_CONNECTION_ERROR=4096, /* There is an error with the connection between parachute and subsystem (e.g. remote controller, expansion board, etc.) | */ + PARACHUTE_ERROR_FLAGS_SUBSYSTEM_FW_ERROR=8192, /* There is an error with the parachute subsystem firmware (e.g. wrong firmware version) | */ + PARACHUTE_ERROR_FLAGS_RESERVED_1=16384, /* Reserved for future use | */ + PARACHUTE_ERROR_FLAGS_RESERVED_2=32768, /* Reserved for future use | */ + PARACHUTE_ERROR_FLAGS_LOGGING_ERROR=65536, /* There is an error with the parachute's internal logging system | */ + PARACHUTE_ERROR_FLAGS_MODULE_RETIRED=131072, /* This parachute module is retired (i.e. too many deployments) | */ + PARACHUTE_ERROR_FLAGS_GLOW_WIRE_ERROR=262144, /* There is an error with the parachute glow wire | */ + PARACHUTE_ERROR_FLAGS_OFFBOARD_CONNECTION_ERROR=524288, /* There is an error with the MAVLink connection between parachute and offboard computer | */ + PARACHUTE_ERROR_FLAGS_IMU_CALIBRATION_ERROR=1048576, /* Parachute's internal IMU calibration failed | */ + PARACHUTE_ERROR_FLAGS_ENUM_END=1048577, /* | */ +} PARACHUTE_ERROR_FLAGS; +#endif + +// MAVLINK VERSION + +#ifndef MAVLINK_VERSION +#define MAVLINK_VERSION 0 +#endif + +#if (MAVLINK_VERSION == 0) +#undef MAVLINK_VERSION +#define MAVLINK_VERSION 0 +#endif + +// MESSAGE DEFINITIONS +#include "./mavlink_msg_param_ack_transaction.h" +#include "./mavlink_msg_parachute_status.h" +#include "./mavlink_msg_beacon_position.h" +#include "./mavlink_msg_radiation_detector_counts.h" +#include "./mavlink_msg_radiation_detector_spectrum.h" +#include "./mavlink_msg_radiation_detector_cps.h" +#include "./mavlink_msg_tracker_status.h" +#include "./mavlink_msg_tracker_detection_2d.h" +#include "./mavlink_msg_joystick_state.h" +#include "./mavlink_msg_pixel_to_lla_request.h" +#include "./mavlink_msg_pixel_to_lla_ack.h" +#include "./mavlink_msg_pixel_to_lla_result.h" +#include "./mavlink_msg_motor_info.h" +#include "./mavlink_msg_control_status_report.h" +#include "./mavlink_msg_request_control.h" +#include "./mavlink_msg_request_control_ack.h" +#include "./mavlink_msg_release_control.h" +#include "./mavlink_msg_request_handoff.h" +#include "./mavlink_msg_handoff_respond.h" +#include "./mavlink_msg_unique_identifier.h" +#include "./mavlink_msg_boat_actuator_status.h" +#include "./mavlink_msg_boat_engine_status.h" +#include "./mavlink_msg_fluid_level.h" +#include "./mavlink_msg_vessel_speed.h" +#include "./mavlink_msg_water_depth_raw.h" +#include "./mavlink_msg_wind_data_raw.h" +#include "./mavlink_msg_radar_target_track.h" +#include "./mavlink_msg_ship_approach_sectors_status.h" + +// base include +#include "../development/development.h" + + +#if MAVLINK_AUTERION_XML_HASH == MAVLINK_PRIMARY_XML_HASH +# define MAVLINK_MESSAGE_INFO {MAVLINK_MESSAGE_INFO_HEARTBEAT, MAVLINK_MESSAGE_INFO_SYS_STATUS, MAVLINK_MESSAGE_INFO_SYSTEM_TIME, MAVLINK_MESSAGE_INFO_PING, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL_ACK, MAVLINK_MESSAGE_INFO_AUTH_KEY, MAVLINK_MESSAGE_INFO_LINK_NODE_STATUS, MAVLINK_MESSAGE_INFO_SET_MODE, MAVLINK_MESSAGE_INFO_PARAM_ACK_TRANSACTION, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_READ, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_LIST, MAVLINK_MESSAGE_INFO_PARAM_VALUE, MAVLINK_MESSAGE_INFO_PARAM_SET, MAVLINK_MESSAGE_INFO_GPS_RAW_INT, MAVLINK_MESSAGE_INFO_GPS_STATUS, MAVLINK_MESSAGE_INFO_SCALED_IMU, MAVLINK_MESSAGE_INFO_RAW_IMU, MAVLINK_MESSAGE_INFO_RAW_PRESSURE, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE, MAVLINK_MESSAGE_INFO_ATTITUDE, MAVLINK_MESSAGE_INFO_ATTITUDE_QUATERNION, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT, MAVLINK_MESSAGE_INFO_RC_CHANNELS_SCALED, MAVLINK_MESSAGE_INFO_RC_CHANNELS_RAW, MAVLINK_MESSAGE_INFO_SERVO_OUTPUT_RAW, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_PARTIAL_LIST, MAVLINK_MESSAGE_INFO_MISSION_WRITE_PARTIAL_LIST, MAVLINK_MESSAGE_INFO_MISSION_ITEM, MAVLINK_MESSAGE_INFO_MISSION_REQUEST, MAVLINK_MESSAGE_INFO_MISSION_SET_CURRENT, MAVLINK_MESSAGE_INFO_MISSION_CURRENT, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_LIST, MAVLINK_MESSAGE_INFO_MISSION_COUNT, MAVLINK_MESSAGE_INFO_MISSION_CLEAR_ALL, MAVLINK_MESSAGE_INFO_MISSION_ITEM_REACHED, MAVLINK_MESSAGE_INFO_MISSION_ACK, MAVLINK_MESSAGE_INFO_SET_GPS_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_GPS_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_PARAM_MAP_RC, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_INT, MAVLINK_MESSAGE_INFO_SAFETY_SET_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_SAFETY_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_ATTITUDE_QUATERNION_COV, MAVLINK_MESSAGE_INFO_NAV_CONTROLLER_OUTPUT, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT_COV, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED_COV, MAVLINK_MESSAGE_INFO_RC_CHANNELS, MAVLINK_MESSAGE_INFO_REQUEST_DATA_STREAM, MAVLINK_MESSAGE_INFO_DATA_STREAM, MAVLINK_MESSAGE_INFO_MANUAL_CONTROL, MAVLINK_MESSAGE_INFO_RC_CHANNELS_OVERRIDE, MAVLINK_MESSAGE_INFO_MISSION_ITEM_INT, MAVLINK_MESSAGE_INFO_VFR_HUD, MAVLINK_MESSAGE_INFO_COMMAND_INT, MAVLINK_MESSAGE_INFO_COMMAND_LONG, MAVLINK_MESSAGE_INFO_COMMAND_ACK, MAVLINK_MESSAGE_INFO_COMMAND_CANCEL, MAVLINK_MESSAGE_INFO_MANUAL_SETPOINT, MAVLINK_MESSAGE_INFO_SET_ATTITUDE_TARGET, MAVLINK_MESSAGE_INFO_ATTITUDE_TARGET, MAVLINK_MESSAGE_INFO_SET_POSITION_TARGET_LOCAL_NED, MAVLINK_MESSAGE_INFO_POSITION_TARGET_LOCAL_NED, MAVLINK_MESSAGE_INFO_SET_POSITION_TARGET_GLOBAL_INT, MAVLINK_MESSAGE_INFO_POSITION_TARGET_GLOBAL_INT, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET, MAVLINK_MESSAGE_INFO_HIL_STATE, MAVLINK_MESSAGE_INFO_HIL_CONTROLS, MAVLINK_MESSAGE_INFO_HIL_RC_INPUTS_RAW, MAVLINK_MESSAGE_INFO_HIL_ACTUATOR_CONTROLS, MAVLINK_MESSAGE_INFO_OPTICAL_FLOW, MAVLINK_MESSAGE_INFO_GLOBAL_VISION_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_VISION_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_VISION_SPEED_ESTIMATE, MAVLINK_MESSAGE_INFO_VICON_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_HIGHRES_IMU, MAVLINK_MESSAGE_INFO_OPTICAL_FLOW_RAD, MAVLINK_MESSAGE_INFO_HIL_SENSOR, MAVLINK_MESSAGE_INFO_SIM_STATE, MAVLINK_MESSAGE_INFO_RADIO_STATUS, MAVLINK_MESSAGE_INFO_FILE_TRANSFER_PROTOCOL, MAVLINK_MESSAGE_INFO_TIMESYNC, MAVLINK_MESSAGE_INFO_CAMERA_TRIGGER, MAVLINK_MESSAGE_INFO_HIL_GPS, MAVLINK_MESSAGE_INFO_HIL_OPTICAL_FLOW, MAVLINK_MESSAGE_INFO_HIL_STATE_QUATERNION, MAVLINK_MESSAGE_INFO_SCALED_IMU2, MAVLINK_MESSAGE_INFO_LOG_REQUEST_LIST, MAVLINK_MESSAGE_INFO_LOG_ENTRY, MAVLINK_MESSAGE_INFO_LOG_REQUEST_DATA, MAVLINK_MESSAGE_INFO_LOG_DATA, MAVLINK_MESSAGE_INFO_LOG_ERASE, MAVLINK_MESSAGE_INFO_LOG_REQUEST_END, MAVLINK_MESSAGE_INFO_GPS_INJECT_DATA, MAVLINK_MESSAGE_INFO_GPS2_RAW, MAVLINK_MESSAGE_INFO_POWER_STATUS, MAVLINK_MESSAGE_INFO_SERIAL_CONTROL, MAVLINK_MESSAGE_INFO_GPS_RTK, MAVLINK_MESSAGE_INFO_GPS2_RTK, MAVLINK_MESSAGE_INFO_SCALED_IMU3, MAVLINK_MESSAGE_INFO_DATA_TRANSMISSION_HANDSHAKE, MAVLINK_MESSAGE_INFO_ENCAPSULATED_DATA, MAVLINK_MESSAGE_INFO_DISTANCE_SENSOR, MAVLINK_MESSAGE_INFO_TERRAIN_REQUEST, MAVLINK_MESSAGE_INFO_TERRAIN_DATA, MAVLINK_MESSAGE_INFO_TERRAIN_CHECK, MAVLINK_MESSAGE_INFO_TERRAIN_REPORT, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE2, MAVLINK_MESSAGE_INFO_ATT_POS_MOCAP, MAVLINK_MESSAGE_INFO_SET_ACTUATOR_CONTROL_TARGET, MAVLINK_MESSAGE_INFO_ACTUATOR_CONTROL_TARGET, MAVLINK_MESSAGE_INFO_ALTITUDE, MAVLINK_MESSAGE_INFO_RESOURCE_REQUEST, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE3, MAVLINK_MESSAGE_INFO_FOLLOW_TARGET, MAVLINK_MESSAGE_INFO_CONTROL_SYSTEM_STATE, MAVLINK_MESSAGE_INFO_BATTERY_STATUS, MAVLINK_MESSAGE_INFO_AUTOPILOT_VERSION, MAVLINK_MESSAGE_INFO_LANDING_TARGET, MAVLINK_MESSAGE_INFO_FENCE_STATUS, MAVLINK_MESSAGE_INFO_MAG_CAL_REPORT, MAVLINK_MESSAGE_INFO_EFI_STATUS, MAVLINK_MESSAGE_INFO_ESTIMATOR_STATUS, MAVLINK_MESSAGE_INFO_WIND_COV, MAVLINK_MESSAGE_INFO_GPS_INPUT, MAVLINK_MESSAGE_INFO_GPS_RTCM_DATA, MAVLINK_MESSAGE_INFO_HIGH_LATENCY, MAVLINK_MESSAGE_INFO_HIGH_LATENCY2, MAVLINK_MESSAGE_INFO_VIBRATION, MAVLINK_MESSAGE_INFO_HOME_POSITION, MAVLINK_MESSAGE_INFO_SET_HOME_POSITION, MAVLINK_MESSAGE_INFO_MESSAGE_INTERVAL, MAVLINK_MESSAGE_INFO_EXTENDED_SYS_STATE, MAVLINK_MESSAGE_INFO_ADSB_VEHICLE, MAVLINK_MESSAGE_INFO_COLLISION, MAVLINK_MESSAGE_INFO_V2_EXTENSION, MAVLINK_MESSAGE_INFO_MEMORY_VECT, MAVLINK_MESSAGE_INFO_DEBUG_VECT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_FLOAT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_INT, MAVLINK_MESSAGE_INFO_STATUSTEXT, MAVLINK_MESSAGE_INFO_DEBUG, MAVLINK_MESSAGE_INFO_SETUP_SIGNING, MAVLINK_MESSAGE_INFO_BUTTON_CHANGE, MAVLINK_MESSAGE_INFO_PLAY_TUNE, MAVLINK_MESSAGE_INFO_CAMERA_INFORMATION, MAVLINK_MESSAGE_INFO_CAMERA_SETTINGS, MAVLINK_MESSAGE_INFO_STORAGE_INFORMATION, MAVLINK_MESSAGE_INFO_CAMERA_CAPTURE_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_IMAGE_CAPTURED, MAVLINK_MESSAGE_INFO_FLIGHT_INFORMATION, MAVLINK_MESSAGE_INFO_MOUNT_ORIENTATION, MAVLINK_MESSAGE_INFO_LOGGING_DATA, MAVLINK_MESSAGE_INFO_LOGGING_DATA_ACKED, MAVLINK_MESSAGE_INFO_LOGGING_ACK, MAVLINK_MESSAGE_INFO_VIDEO_STREAM_INFORMATION, MAVLINK_MESSAGE_INFO_VIDEO_STREAM_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_FOV_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_TRACKING_IMAGE_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_TRACKING_GEO_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_THERMAL_RANGE, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_INFORMATION, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_STATUS, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_SET_ATTITUDE, MAVLINK_MESSAGE_INFO_GIMBAL_DEVICE_INFORMATION, MAVLINK_MESSAGE_INFO_GIMBAL_DEVICE_SET_ATTITUDE, MAVLINK_MESSAGE_INFO_GIMBAL_DEVICE_ATTITUDE_STATUS, MAVLINK_MESSAGE_INFO_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_SET_PITCHYAW, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_SET_MANUAL_CONTROL, MAVLINK_MESSAGE_INFO_ESC_INFO, MAVLINK_MESSAGE_INFO_ESC_STATUS, MAVLINK_MESSAGE_INFO_AIRSPEED, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION, MAVLINK_MESSAGE_INFO_WIFI_CONFIG_AP, MAVLINK_MESSAGE_INFO_PROTOCOL_VERSION, MAVLINK_MESSAGE_INFO_AIS_VESSEL, MAVLINK_MESSAGE_INFO_UAVCAN_NODE_STATUS, MAVLINK_MESSAGE_INFO_UAVCAN_NODE_INFO, MAVLINK_MESSAGE_INFO_PARAM_EXT_REQUEST_READ, MAVLINK_MESSAGE_INFO_PARAM_EXT_REQUEST_LIST, MAVLINK_MESSAGE_INFO_PARAM_EXT_VALUE, MAVLINK_MESSAGE_INFO_PARAM_EXT_SET, MAVLINK_MESSAGE_INFO_PARAM_EXT_ACK, MAVLINK_MESSAGE_INFO_OBSTACLE_DISTANCE, MAVLINK_MESSAGE_INFO_ODOMETRY, MAVLINK_MESSAGE_INFO_TRAJECTORY_REPRESENTATION_WAYPOINTS, MAVLINK_MESSAGE_INFO_TRAJECTORY_REPRESENTATION_BEZIER, MAVLINK_MESSAGE_INFO_CELLULAR_STATUS, MAVLINK_MESSAGE_INFO_ISBD_LINK_STATUS, MAVLINK_MESSAGE_INFO_CELLULAR_CONFIG, MAVLINK_MESSAGE_INFO_CELLULAR_MODEM_INFORMATION, MAVLINK_MESSAGE_INFO_RAW_RPM, MAVLINK_MESSAGE_INFO_UTM_GLOBAL_POSITION, MAVLINK_MESSAGE_INFO_PARAM_ERROR, MAVLINK_MESSAGE_INFO_DEBUG_FLOAT_ARRAY, MAVLINK_MESSAGE_INFO_SET_VELOCITY_LIMITS, MAVLINK_MESSAGE_INFO_VELOCITY_LIMITS, MAVLINK_MESSAGE_INFO_ORBIT_EXECUTION_STATUS, MAVLINK_MESSAGE_INFO_FIGURE_EIGHT_EXECUTION_STATUS, MAVLINK_MESSAGE_INFO_BATTERY_STATUS_V2, MAVLINK_MESSAGE_INFO_SMART_BATTERY_INFO, MAVLINK_MESSAGE_INFO_FUEL_STATUS, MAVLINK_MESSAGE_INFO_BATTERY_INFO, MAVLINK_MESSAGE_INFO_GENERATOR_STATUS, MAVLINK_MESSAGE_INFO_ACTUATOR_OUTPUT_STATUS, MAVLINK_MESSAGE_INFO_TIME_ESTIMATE_TO_TARGET, MAVLINK_MESSAGE_INFO_TUNNEL, MAVLINK_MESSAGE_INFO_CAN_FRAME, MAVLINK_MESSAGE_INFO_CANFD_FRAME, MAVLINK_MESSAGE_INFO_CAN_FILTER_MODIFY, MAVLINK_MESSAGE_INFO_ONBOARD_COMPUTER_STATUS, MAVLINK_MESSAGE_INFO_COMPONENT_INFORMATION, MAVLINK_MESSAGE_INFO_COMPONENT_INFORMATION_BASIC, MAVLINK_MESSAGE_INFO_COMPONENT_METADATA, MAVLINK_MESSAGE_INFO_PLAY_TUNE_V2, MAVLINK_MESSAGE_INFO_SUPPORTED_TUNES, MAVLINK_MESSAGE_INFO_EVENT, MAVLINK_MESSAGE_INFO_CURRENT_EVENT_SEQUENCE, MAVLINK_MESSAGE_INFO_REQUEST_EVENT, MAVLINK_MESSAGE_INFO_RESPONSE_EVENT_ERROR, MAVLINK_MESSAGE_INFO_GROUP_START, MAVLINK_MESSAGE_INFO_GROUP_END, MAVLINK_MESSAGE_INFO_RADIO_RC_CHANNELS, MAVLINK_MESSAGE_INFO_PARACHUTE_STATUS, MAVLINK_MESSAGE_INFO_AVAILABLE_MODES, MAVLINK_MESSAGE_INFO_CURRENT_MODE, MAVLINK_MESSAGE_INFO_AVAILABLE_MODES_MONITOR, MAVLINK_MESSAGE_INFO_ILLUMINATOR_STATUS, MAVLINK_MESSAGE_INFO_GNSS_INTEGRITY, MAVLINK_MESSAGE_INFO_BEACON_POSITION, MAVLINK_MESSAGE_INFO_RADIATION_DETECTOR_COUNTS, MAVLINK_MESSAGE_INFO_RADIATION_DETECTOR_SPECTRUM, MAVLINK_MESSAGE_INFO_RADIATION_DETECTOR_CPS, MAVLINK_MESSAGE_INFO_TRACKER_STATUS, MAVLINK_MESSAGE_INFO_TRACKER_DETECTION_2D, MAVLINK_MESSAGE_INFO_TARGET_ABSOLUTE, MAVLINK_MESSAGE_INFO_TARGET_RELATIVE, MAVLINK_MESSAGE_INFO_CONTROL_STATUS, MAVLINK_MESSAGE_INFO_JOYSTICK_STATE, MAVLINK_MESSAGE_INFO_PIXEL_TO_LLA_REQUEST, MAVLINK_MESSAGE_INFO_PIXEL_TO_LLA_ACK, MAVLINK_MESSAGE_INFO_PIXEL_TO_LLA_RESULT, MAVLINK_MESSAGE_INFO_WHEEL_DISTANCE, MAVLINK_MESSAGE_INFO_WINCH_STATUS, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_BASIC_ID, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_LOCATION, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_AUTHENTICATION, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_SELF_ID, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_SYSTEM, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_OPERATOR_ID, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_MESSAGE_PACK, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_ARM_STATUS, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_SYSTEM_UPDATE, MAVLINK_MESSAGE_INFO_HYGROMETER_SENSOR, MAVLINK_MESSAGE_INFO_MOTOR_INFO, MAVLINK_MESSAGE_INFO_CONTROL_STATUS_REPORT, MAVLINK_MESSAGE_INFO_REQUEST_CONTROL, MAVLINK_MESSAGE_INFO_REQUEST_CONTROL_ACK, MAVLINK_MESSAGE_INFO_RELEASE_CONTROL, MAVLINK_MESSAGE_INFO_REQUEST_HANDOFF, MAVLINK_MESSAGE_INFO_HANDOFF_RESPOND, MAVLINK_MESSAGE_INFO_UNIQUE_IDENTIFIER, MAVLINK_MESSAGE_INFO_BOAT_ACTUATOR_STATUS, MAVLINK_MESSAGE_INFO_BOAT_ENGINE_STATUS, MAVLINK_MESSAGE_INFO_FLUID_LEVEL, MAVLINK_MESSAGE_INFO_VESSEL_SPEED, MAVLINK_MESSAGE_INFO_WATER_DEPTH_RAW, MAVLINK_MESSAGE_INFO_WIND_DATA_RAW, MAVLINK_MESSAGE_INFO_RADAR_TARGET_TRACK, MAVLINK_MESSAGE_INFO_SHIP_APPROACH_SECTORS_STATUS} +# define MAVLINK_MESSAGE_NAMES {{ "ACTUATOR_CONTROL_TARGET", 140 }, { "ACTUATOR_OUTPUT_STATUS", 375 }, { "ADSB_VEHICLE", 246 }, { "AIRSPEED", 295 }, { "AIS_VESSEL", 301 }, { "ALTITUDE", 141 }, { "ATTITUDE", 30 }, { "ATTITUDE_QUATERNION", 31 }, { "ATTITUDE_QUATERNION_COV", 61 }, { "ATTITUDE_TARGET", 83 }, { "ATT_POS_MOCAP", 138 }, { "AUTH_KEY", 7 }, { "AUTOPILOT_STATE_FOR_GIMBAL_DEVICE", 286 }, { "AUTOPILOT_VERSION", 148 }, { "AVAILABLE_MODES", 435 }, { "AVAILABLE_MODES_MONITOR", 437 }, { "BATTERY_INFO", 372 }, { "BATTERY_STATUS", 147 }, { "BATTERY_STATUS_V2", 369 }, { "BEACON_POSITION", 447 }, { "BOAT_ACTUATOR_STATUS", 13666 }, { "BOAT_ENGINE_STATUS", 13667 }, { "BUTTON_CHANGE", 257 }, { "CAMERA_CAPTURE_STATUS", 262 }, { "CAMERA_FOV_STATUS", 271 }, { "CAMERA_IMAGE_CAPTURED", 263 }, { "CAMERA_INFORMATION", 259 }, { "CAMERA_SETTINGS", 260 }, { "CAMERA_THERMAL_RANGE", 277 }, { "CAMERA_TRACKING_GEO_STATUS", 276 }, { "CAMERA_TRACKING_IMAGE_STATUS", 275 }, { "CAMERA_TRIGGER", 112 }, { "CANFD_FRAME", 387 }, { "CAN_FILTER_MODIFY", 388 }, { "CAN_FRAME", 386 }, { "CELLULAR_CONFIG", 336 }, { "CELLULAR_MODEM_INFORMATION", 337 }, { "CELLULAR_STATUS", 334 }, { "CHANGE_OPERATOR_CONTROL", 5 }, { "CHANGE_OPERATOR_CONTROL_ACK", 6 }, { "COLLISION", 247 }, { "COMMAND_ACK", 77 }, { "COMMAND_CANCEL", 80 }, { "COMMAND_INT", 75 }, { "COMMAND_LONG", 76 }, { "COMPONENT_INFORMATION", 395 }, { "COMPONENT_INFORMATION_BASIC", 396 }, { "COMPONENT_METADATA", 397 }, { "CONTROL_STATUS", 512 }, { "CONTROL_STATUS_REPORT", 13441 }, { "CONTROL_SYSTEM_STATE", 146 }, { "CURRENT_EVENT_SEQUENCE", 411 }, { "CURRENT_MODE", 436 }, { "DATA_STREAM", 67 }, { "DATA_TRANSMISSION_HANDSHAKE", 130 }, { "DEBUG", 254 }, { "DEBUG_FLOAT_ARRAY", 350 }, { "DEBUG_VECT", 250 }, { "DISTANCE_SENSOR", 132 }, { "EFI_STATUS", 225 }, { "ENCAPSULATED_DATA", 131 }, { "ESC_INFO", 290 }, { "ESC_STATUS", 291 }, { "ESTIMATOR_STATUS", 230 }, { "EVENT", 410 }, { "EXTENDED_SYS_STATE", 245 }, { "FENCE_STATUS", 162 }, { "FIGURE_EIGHT_EXECUTION_STATUS", 361 }, { "FILE_TRANSFER_PROTOCOL", 110 }, { "FLIGHT_INFORMATION", 264 }, { "FLUID_LEVEL", 13668 }, { "FOLLOW_TARGET", 144 }, { "FUEL_STATUS", 371 }, { "GENERATOR_STATUS", 373 }, { "GIMBAL_DEVICE_ATTITUDE_STATUS", 285 }, { "GIMBAL_DEVICE_INFORMATION", 283 }, { "GIMBAL_DEVICE_SET_ATTITUDE", 284 }, { "GIMBAL_MANAGER_INFORMATION", 280 }, { "GIMBAL_MANAGER_SET_ATTITUDE", 282 }, { "GIMBAL_MANAGER_SET_MANUAL_CONTROL", 288 }, { "GIMBAL_MANAGER_SET_PITCHYAW", 287 }, { "GIMBAL_MANAGER_STATUS", 281 }, { "GLOBAL_POSITION", 296 }, { "GLOBAL_POSITION_INT", 33 }, { "GLOBAL_POSITION_INT_COV", 63 }, { "GLOBAL_VISION_POSITION_ESTIMATE", 101 }, { "GNSS_INTEGRITY", 441 }, { "GPS2_RAW", 124 }, { "GPS2_RTK", 128 }, { "GPS_GLOBAL_ORIGIN", 49 }, { "GPS_INJECT_DATA", 123 }, { "GPS_INPUT", 232 }, { "GPS_RAW_INT", 24 }, { "GPS_RTCM_DATA", 233 }, { "GPS_RTK", 127 }, { "GPS_STATUS", 25 }, { "GROUP_END", 415 }, { "GROUP_START", 414 }, { "HANDOFF_RESPOND", 13446 }, { "HEARTBEAT", 0 }, { "HIGHRES_IMU", 105 }, { "HIGH_LATENCY", 234 }, { "HIGH_LATENCY2", 235 }, { "HIL_ACTUATOR_CONTROLS", 93 }, { "HIL_CONTROLS", 91 }, { "HIL_GPS", 113 }, { "HIL_OPTICAL_FLOW", 114 }, { "HIL_RC_INPUTS_RAW", 92 }, { "HIL_SENSOR", 107 }, { "HIL_STATE", 90 }, { "HIL_STATE_QUATERNION", 115 }, { "HOME_POSITION", 242 }, { "HYGROMETER_SENSOR", 12920 }, { "ILLUMINATOR_STATUS", 440 }, { "ISBD_LINK_STATUS", 335 }, { "JOYSTICK_STATE", 513 }, { "LANDING_TARGET", 149 }, { "LINK_NODE_STATUS", 8 }, { "LOCAL_POSITION_NED", 32 }, { "LOCAL_POSITION_NED_COV", 64 }, { "LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET", 89 }, { "LOGGING_ACK", 268 }, { "LOGGING_DATA", 266 }, { "LOGGING_DATA_ACKED", 267 }, { "LOG_DATA", 120 }, { "LOG_ENTRY", 118 }, { "LOG_ERASE", 121 }, { "LOG_REQUEST_DATA", 119 }, { "LOG_REQUEST_END", 122 }, { "LOG_REQUEST_LIST", 117 }, { "MAG_CAL_REPORT", 192 }, { "MANUAL_CONTROL", 69 }, { "MANUAL_SETPOINT", 81 }, { "MEMORY_VECT", 249 }, { "MESSAGE_INTERVAL", 244 }, { "MISSION_ACK", 47 }, { "MISSION_CLEAR_ALL", 45 }, { "MISSION_COUNT", 44 }, { "MISSION_CURRENT", 42 }, { "MISSION_ITEM", 39 }, { "MISSION_ITEM_INT", 73 }, { "MISSION_ITEM_REACHED", 46 }, { "MISSION_REQUEST", 40 }, { "MISSION_REQUEST_INT", 51 }, { "MISSION_REQUEST_LIST", 43 }, { "MISSION_REQUEST_PARTIAL_LIST", 37 }, { "MISSION_SET_CURRENT", 41 }, { "MISSION_WRITE_PARTIAL_LIST", 38 }, { "MOTOR_INFO", 13000 }, { "MOUNT_ORIENTATION", 265 }, { "NAMED_VALUE_FLOAT", 251 }, { "NAMED_VALUE_INT", 252 }, { "NAV_CONTROLLER_OUTPUT", 62 }, { "OBSTACLE_DISTANCE", 330 }, { "ODOMETRY", 331 }, { "ONBOARD_COMPUTER_STATUS", 390 }, { "OPEN_DRONE_ID_ARM_STATUS", 12918 }, { "OPEN_DRONE_ID_AUTHENTICATION", 12902 }, { "OPEN_DRONE_ID_BASIC_ID", 12900 }, { "OPEN_DRONE_ID_LOCATION", 12901 }, { "OPEN_DRONE_ID_MESSAGE_PACK", 12915 }, { "OPEN_DRONE_ID_OPERATOR_ID", 12905 }, { "OPEN_DRONE_ID_SELF_ID", 12903 }, { "OPEN_DRONE_ID_SYSTEM", 12904 }, { "OPEN_DRONE_ID_SYSTEM_UPDATE", 12919 }, { "OPTICAL_FLOW", 100 }, { "OPTICAL_FLOW_RAD", 106 }, { "ORBIT_EXECUTION_STATUS", 360 }, { "PARACHUTE_STATUS", 430 }, { "PARAM_ACK_TRANSACTION", 19 }, { "PARAM_ERROR", 345 }, { "PARAM_EXT_ACK", 324 }, { "PARAM_EXT_REQUEST_LIST", 321 }, { "PARAM_EXT_REQUEST_READ", 320 }, { "PARAM_EXT_SET", 323 }, { "PARAM_EXT_VALUE", 322 }, { "PARAM_MAP_RC", 50 }, { "PARAM_REQUEST_LIST", 21 }, { "PARAM_REQUEST_READ", 20 }, { "PARAM_SET", 23 }, { "PARAM_VALUE", 22 }, { "PING", 4 }, { "PIXEL_TO_LLA_ACK", 601 }, { "PIXEL_TO_LLA_REQUEST", 600 }, { "PIXEL_TO_LLA_RESULT", 602 }, { "PLAY_TUNE", 258 }, { "PLAY_TUNE_V2", 400 }, { "POSITION_TARGET_GLOBAL_INT", 87 }, { "POSITION_TARGET_LOCAL_NED", 85 }, { "POWER_STATUS", 125 }, { "PROTOCOL_VERSION", 300 }, { "RADAR_TARGET_TRACK", 13672 }, { "RADIATION_DETECTOR_COUNTS", 460 }, { "RADIATION_DETECTOR_CPS", 462 }, { "RADIATION_DETECTOR_SPECTRUM", 461 }, { "RADIO_RC_CHANNELS", 420 }, { "RADIO_STATUS", 109 }, { "RAW_IMU", 27 }, { "RAW_PRESSURE", 28 }, { "RAW_RPM", 339 }, { "RC_CHANNELS", 65 }, { "RC_CHANNELS_OVERRIDE", 70 }, { "RC_CHANNELS_RAW", 35 }, { "RC_CHANNELS_SCALED", 34 }, { "RELEASE_CONTROL", 13444 }, { "REQUEST_CONTROL", 13442 }, { "REQUEST_CONTROL_ACK", 13443 }, { "REQUEST_DATA_STREAM", 66 }, { "REQUEST_EVENT", 412 }, { "REQUEST_HANDOFF", 13445 }, { "RESOURCE_REQUEST", 142 }, { "RESPONSE_EVENT_ERROR", 413 }, { "SAFETY_ALLOWED_AREA", 55 }, { "SAFETY_SET_ALLOWED_AREA", 54 }, { "SCALED_IMU", 26 }, { "SCALED_IMU2", 116 }, { "SCALED_IMU3", 129 }, { "SCALED_PRESSURE", 29 }, { "SCALED_PRESSURE2", 137 }, { "SCALED_PRESSURE3", 143 }, { "SERIAL_CONTROL", 126 }, { "SERVO_OUTPUT_RAW", 36 }, { "SETUP_SIGNING", 256 }, { "SET_ACTUATOR_CONTROL_TARGET", 139 }, { "SET_ATTITUDE_TARGET", 82 }, { "SET_GPS_GLOBAL_ORIGIN", 48 }, { "SET_HOME_POSITION", 243 }, { "SET_MODE", 11 }, { "SET_POSITION_TARGET_GLOBAL_INT", 86 }, { "SET_POSITION_TARGET_LOCAL_NED", 84 }, { "SET_VELOCITY_LIMITS", 354 }, { "SHIP_APPROACH_SECTORS_STATUS", 13680 }, { "SIM_STATE", 108 }, { "SMART_BATTERY_INFO", 370 }, { "STATUSTEXT", 253 }, { "STORAGE_INFORMATION", 261 }, { "SUPPORTED_TUNES", 401 }, { "SYSTEM_TIME", 2 }, { "SYS_STATUS", 1 }, { "TARGET_ABSOLUTE", 510 }, { "TARGET_RELATIVE", 511 }, { "TERRAIN_CHECK", 135 }, { "TERRAIN_DATA", 134 }, { "TERRAIN_REPORT", 136 }, { "TERRAIN_REQUEST", 133 }, { "TIMESYNC", 111 }, { "TIME_ESTIMATE_TO_TARGET", 380 }, { "TRACKER_DETECTION_2D", 501 }, { "TRACKER_STATUS", 500 }, { "TRAJECTORY_REPRESENTATION_BEZIER", 333 }, { "TRAJECTORY_REPRESENTATION_WAYPOINTS", 332 }, { "TUNNEL", 385 }, { "UAVCAN_NODE_INFO", 311 }, { "UAVCAN_NODE_STATUS", 310 }, { "UNIQUE_IDENTIFIER", 13470 }, { "UTM_GLOBAL_POSITION", 340 }, { "V2_EXTENSION", 248 }, { "VELOCITY_LIMITS", 355 }, { "VESSEL_SPEED", 13669 }, { "VFR_HUD", 74 }, { "VIBRATION", 241 }, { "VICON_POSITION_ESTIMATE", 104 }, { "VIDEO_STREAM_INFORMATION", 269 }, { "VIDEO_STREAM_STATUS", 270 }, { "VISION_POSITION_ESTIMATE", 102 }, { "VISION_SPEED_ESTIMATE", 103 }, { "WATER_DEPTH_RAW", 13670 }, { "WHEEL_DISTANCE", 9000 }, { "WIFI_CONFIG_AP", 299 }, { "WINCH_STATUS", 9005 }, { "WIND_COV", 231 }, { "WIND_DATA_RAW", 13671 }} +# if MAVLINK_COMMAND_24BIT +# include "../mavlink_get_info.h" +# endif +#endif + +#ifdef __cplusplus +} +#endif // __cplusplus +#endif // MAVLINK_AUTERION_H diff --git a/autoquad/mavlink.h b/auterion/mavlink.h similarity index 77% rename from autoquad/mavlink.h rename to auterion/mavlink.h index 98638c862..b8ea8e506 100644 --- a/autoquad/mavlink.h +++ b/auterion/mavlink.h @@ -1,12 +1,12 @@ /** @file - * @brief MAVLink comm protocol built from autoquad.xml + * @brief MAVLink comm protocol built from auterion.xml * @see http://mavlink.org */ #pragma once #ifndef MAVLINK_H #define MAVLINK_H -#define MAVLINK_PRIMARY_XML_IDX 0 +#define MAVLINK_PRIMARY_XML_HASH 8761095721367388540 #ifndef MAVLINK_STX #define MAVLINK_STX 253 @@ -29,6 +29,6 @@ #endif #include "version.h" -#include "autoquad.h" +#include "auterion.h" #endif // MAVLINK_H diff --git a/auterion/mavlink_msg_beacon_position.h b/auterion/mavlink_msg_beacon_position.h new file mode 100644 index 000000000..21afbddd9 --- /dev/null +++ b/auterion/mavlink_msg_beacon_position.h @@ -0,0 +1,456 @@ +#pragma once +// MESSAGE BEACON_POSITION PACKING + +#define MAVLINK_MSG_ID_BEACON_POSITION 447 + + +typedef struct __mavlink_beacon_position_t { + uint32_t beacon_id; /*< Unique Beacon ID*/ + int32_t latitude; /*< [degE7] Latitude (WGS84), in degrees * 1E7*/ + int32_t longitude; /*< [degE7] Longitude (WGS84), in degrees * 1E7*/ + float altitude; /*< [m] Altitude (MSL), in meters*/ + float distance; /*< [m] Distance to the Beacon, in meters*/ + int32_t delay; /*< [ms] Time between generating the value and request, in milliseconds*/ + int32_t link_quality; /*< Value indicating the Signal to noise ratio (in units of dB)*/ + uint8_t gps_status; /*< Status indicating the quality of the GPS Data. 0=invalid 1=lat long valid, alt invalid 2=valid*/ +} mavlink_beacon_position_t; + +#define MAVLINK_MSG_ID_BEACON_POSITION_LEN 29 +#define MAVLINK_MSG_ID_BEACON_POSITION_MIN_LEN 29 +#define MAVLINK_MSG_ID_447_LEN 29 +#define MAVLINK_MSG_ID_447_MIN_LEN 29 + +#define MAVLINK_MSG_ID_BEACON_POSITION_CRC 101 +#define MAVLINK_MSG_ID_447_CRC 101 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_BEACON_POSITION { \ + 447, \ + "BEACON_POSITION", \ + 8, \ + { { "beacon_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_beacon_position_t, beacon_id) }, \ + { "latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_beacon_position_t, latitude) }, \ + { "longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_beacon_position_t, longitude) }, \ + { "altitude", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_beacon_position_t, altitude) }, \ + { "distance", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_beacon_position_t, distance) }, \ + { "delay", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_beacon_position_t, delay) }, \ + { "gps_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_beacon_position_t, gps_status) }, \ + { "link_quality", NULL, MAVLINK_TYPE_INT32_T, 0, 24, offsetof(mavlink_beacon_position_t, link_quality) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_BEACON_POSITION { \ + "BEACON_POSITION", \ + 8, \ + { { "beacon_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_beacon_position_t, beacon_id) }, \ + { "latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_beacon_position_t, latitude) }, \ + { "longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_beacon_position_t, longitude) }, \ + { "altitude", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_beacon_position_t, altitude) }, \ + { "distance", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_beacon_position_t, distance) }, \ + { "delay", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_beacon_position_t, delay) }, \ + { "gps_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_beacon_position_t, gps_status) }, \ + { "link_quality", NULL, MAVLINK_TYPE_INT32_T, 0, 24, offsetof(mavlink_beacon_position_t, link_quality) }, \ + } \ +} +#endif + +/** + * @brief Pack a beacon_position message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param beacon_id Unique Beacon ID + * @param latitude [degE7] Latitude (WGS84), in degrees * 1E7 + * @param longitude [degE7] Longitude (WGS84), in degrees * 1E7 + * @param altitude [m] Altitude (MSL), in meters + * @param distance [m] Distance to the Beacon, in meters + * @param delay [ms] Time between generating the value and request, in milliseconds + * @param gps_status Status indicating the quality of the GPS Data. 0=invalid 1=lat long valid, alt invalid 2=valid + * @param link_quality Value indicating the Signal to noise ratio (in units of dB) + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_beacon_position_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint32_t beacon_id, int32_t latitude, int32_t longitude, float altitude, float distance, int32_t delay, uint8_t gps_status, int32_t link_quality) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_BEACON_POSITION_LEN]; + _mav_put_uint32_t(buf, 0, beacon_id); + _mav_put_int32_t(buf, 4, latitude); + _mav_put_int32_t(buf, 8, longitude); + _mav_put_float(buf, 12, altitude); + _mav_put_float(buf, 16, distance); + _mav_put_int32_t(buf, 20, delay); + _mav_put_int32_t(buf, 24, link_quality); + _mav_put_uint8_t(buf, 28, gps_status); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_BEACON_POSITION_LEN); +#else + mavlink_beacon_position_t packet; + packet.beacon_id = beacon_id; + packet.latitude = latitude; + packet.longitude = longitude; + packet.altitude = altitude; + packet.distance = distance; + packet.delay = delay; + packet.link_quality = link_quality; + packet.gps_status = gps_status; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_BEACON_POSITION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_BEACON_POSITION; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_BEACON_POSITION_MIN_LEN, MAVLINK_MSG_ID_BEACON_POSITION_LEN, MAVLINK_MSG_ID_BEACON_POSITION_CRC); +} + +/** + * @brief Pack a beacon_position message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param beacon_id Unique Beacon ID + * @param latitude [degE7] Latitude (WGS84), in degrees * 1E7 + * @param longitude [degE7] Longitude (WGS84), in degrees * 1E7 + * @param altitude [m] Altitude (MSL), in meters + * @param distance [m] Distance to the Beacon, in meters + * @param delay [ms] Time between generating the value and request, in milliseconds + * @param gps_status Status indicating the quality of the GPS Data. 0=invalid 1=lat long valid, alt invalid 2=valid + * @param link_quality Value indicating the Signal to noise ratio (in units of dB) + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_beacon_position_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t beacon_id, int32_t latitude, int32_t longitude, float altitude, float distance, int32_t delay, uint8_t gps_status, int32_t link_quality) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_BEACON_POSITION_LEN]; + _mav_put_uint32_t(buf, 0, beacon_id); + _mav_put_int32_t(buf, 4, latitude); + _mav_put_int32_t(buf, 8, longitude); + _mav_put_float(buf, 12, altitude); + _mav_put_float(buf, 16, distance); + _mav_put_int32_t(buf, 20, delay); + _mav_put_int32_t(buf, 24, link_quality); + _mav_put_uint8_t(buf, 28, gps_status); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_BEACON_POSITION_LEN); +#else + mavlink_beacon_position_t packet; + packet.beacon_id = beacon_id; + packet.latitude = latitude; + packet.longitude = longitude; + packet.altitude = altitude; + packet.distance = distance; + packet.delay = delay; + packet.link_quality = link_quality; + packet.gps_status = gps_status; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_BEACON_POSITION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_BEACON_POSITION; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_BEACON_POSITION_MIN_LEN, MAVLINK_MSG_ID_BEACON_POSITION_LEN, MAVLINK_MSG_ID_BEACON_POSITION_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_BEACON_POSITION_MIN_LEN, MAVLINK_MSG_ID_BEACON_POSITION_LEN); +#endif +} + +/** + * @brief Pack a beacon_position message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param beacon_id Unique Beacon ID + * @param latitude [degE7] Latitude (WGS84), in degrees * 1E7 + * @param longitude [degE7] Longitude (WGS84), in degrees * 1E7 + * @param altitude [m] Altitude (MSL), in meters + * @param distance [m] Distance to the Beacon, in meters + * @param delay [ms] Time between generating the value and request, in milliseconds + * @param gps_status Status indicating the quality of the GPS Data. 0=invalid 1=lat long valid, alt invalid 2=valid + * @param link_quality Value indicating the Signal to noise ratio (in units of dB) + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_beacon_position_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint32_t beacon_id,int32_t latitude,int32_t longitude,float altitude,float distance,int32_t delay,uint8_t gps_status,int32_t link_quality) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_BEACON_POSITION_LEN]; + _mav_put_uint32_t(buf, 0, beacon_id); + _mav_put_int32_t(buf, 4, latitude); + _mav_put_int32_t(buf, 8, longitude); + _mav_put_float(buf, 12, altitude); + _mav_put_float(buf, 16, distance); + _mav_put_int32_t(buf, 20, delay); + _mav_put_int32_t(buf, 24, link_quality); + _mav_put_uint8_t(buf, 28, gps_status); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_BEACON_POSITION_LEN); +#else + mavlink_beacon_position_t packet; + packet.beacon_id = beacon_id; + packet.latitude = latitude; + packet.longitude = longitude; + packet.altitude = altitude; + packet.distance = distance; + packet.delay = delay; + packet.link_quality = link_quality; + packet.gps_status = gps_status; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_BEACON_POSITION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_BEACON_POSITION; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_BEACON_POSITION_MIN_LEN, MAVLINK_MSG_ID_BEACON_POSITION_LEN, MAVLINK_MSG_ID_BEACON_POSITION_CRC); +} + +/** + * @brief Encode a beacon_position struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param beacon_position C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_beacon_position_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_beacon_position_t* beacon_position) +{ + return mavlink_msg_beacon_position_pack(system_id, component_id, msg, beacon_position->beacon_id, beacon_position->latitude, beacon_position->longitude, beacon_position->altitude, beacon_position->distance, beacon_position->delay, beacon_position->gps_status, beacon_position->link_quality); +} + +/** + * @brief Encode a beacon_position struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param beacon_position C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_beacon_position_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_beacon_position_t* beacon_position) +{ + return mavlink_msg_beacon_position_pack_chan(system_id, component_id, chan, msg, beacon_position->beacon_id, beacon_position->latitude, beacon_position->longitude, beacon_position->altitude, beacon_position->distance, beacon_position->delay, beacon_position->gps_status, beacon_position->link_quality); +} + +/** + * @brief Encode a beacon_position struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param beacon_position C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_beacon_position_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_beacon_position_t* beacon_position) +{ + return mavlink_msg_beacon_position_pack_status(system_id, component_id, _status, msg, beacon_position->beacon_id, beacon_position->latitude, beacon_position->longitude, beacon_position->altitude, beacon_position->distance, beacon_position->delay, beacon_position->gps_status, beacon_position->link_quality); +} + +/** + * @brief Send a beacon_position message + * @param chan MAVLink channel to send the message + * + * @param beacon_id Unique Beacon ID + * @param latitude [degE7] Latitude (WGS84), in degrees * 1E7 + * @param longitude [degE7] Longitude (WGS84), in degrees * 1E7 + * @param altitude [m] Altitude (MSL), in meters + * @param distance [m] Distance to the Beacon, in meters + * @param delay [ms] Time between generating the value and request, in milliseconds + * @param gps_status Status indicating the quality of the GPS Data. 0=invalid 1=lat long valid, alt invalid 2=valid + * @param link_quality Value indicating the Signal to noise ratio (in units of dB) + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_beacon_position_send(mavlink_channel_t chan, uint32_t beacon_id, int32_t latitude, int32_t longitude, float altitude, float distance, int32_t delay, uint8_t gps_status, int32_t link_quality) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_BEACON_POSITION_LEN]; + _mav_put_uint32_t(buf, 0, beacon_id); + _mav_put_int32_t(buf, 4, latitude); + _mav_put_int32_t(buf, 8, longitude); + _mav_put_float(buf, 12, altitude); + _mav_put_float(buf, 16, distance); + _mav_put_int32_t(buf, 20, delay); + _mav_put_int32_t(buf, 24, link_quality); + _mav_put_uint8_t(buf, 28, gps_status); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BEACON_POSITION, buf, MAVLINK_MSG_ID_BEACON_POSITION_MIN_LEN, MAVLINK_MSG_ID_BEACON_POSITION_LEN, MAVLINK_MSG_ID_BEACON_POSITION_CRC); +#else + mavlink_beacon_position_t packet; + packet.beacon_id = beacon_id; + packet.latitude = latitude; + packet.longitude = longitude; + packet.altitude = altitude; + packet.distance = distance; + packet.delay = delay; + packet.link_quality = link_quality; + packet.gps_status = gps_status; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BEACON_POSITION, (const char *)&packet, MAVLINK_MSG_ID_BEACON_POSITION_MIN_LEN, MAVLINK_MSG_ID_BEACON_POSITION_LEN, MAVLINK_MSG_ID_BEACON_POSITION_CRC); +#endif +} + +/** + * @brief Send a beacon_position message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_beacon_position_send_struct(mavlink_channel_t chan, const mavlink_beacon_position_t* beacon_position) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_beacon_position_send(chan, beacon_position->beacon_id, beacon_position->latitude, beacon_position->longitude, beacon_position->altitude, beacon_position->distance, beacon_position->delay, beacon_position->gps_status, beacon_position->link_quality); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BEACON_POSITION, (const char *)beacon_position, MAVLINK_MSG_ID_BEACON_POSITION_MIN_LEN, MAVLINK_MSG_ID_BEACON_POSITION_LEN, MAVLINK_MSG_ID_BEACON_POSITION_CRC); +#endif +} + +#if MAVLINK_MSG_ID_BEACON_POSITION_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_beacon_position_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t beacon_id, int32_t latitude, int32_t longitude, float altitude, float distance, int32_t delay, uint8_t gps_status, int32_t link_quality) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint32_t(buf, 0, beacon_id); + _mav_put_int32_t(buf, 4, latitude); + _mav_put_int32_t(buf, 8, longitude); + _mav_put_float(buf, 12, altitude); + _mav_put_float(buf, 16, distance); + _mav_put_int32_t(buf, 20, delay); + _mav_put_int32_t(buf, 24, link_quality); + _mav_put_uint8_t(buf, 28, gps_status); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BEACON_POSITION, buf, MAVLINK_MSG_ID_BEACON_POSITION_MIN_LEN, MAVLINK_MSG_ID_BEACON_POSITION_LEN, MAVLINK_MSG_ID_BEACON_POSITION_CRC); +#else + mavlink_beacon_position_t *packet = (mavlink_beacon_position_t *)msgbuf; + packet->beacon_id = beacon_id; + packet->latitude = latitude; + packet->longitude = longitude; + packet->altitude = altitude; + packet->distance = distance; + packet->delay = delay; + packet->link_quality = link_quality; + packet->gps_status = gps_status; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BEACON_POSITION, (const char *)packet, MAVLINK_MSG_ID_BEACON_POSITION_MIN_LEN, MAVLINK_MSG_ID_BEACON_POSITION_LEN, MAVLINK_MSG_ID_BEACON_POSITION_CRC); +#endif +} +#endif + +#endif + +// MESSAGE BEACON_POSITION UNPACKING + + +/** + * @brief Get field beacon_id from beacon_position message + * + * @return Unique Beacon ID + */ +static inline uint32_t mavlink_msg_beacon_position_get_beacon_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 0); +} + +/** + * @brief Get field latitude from beacon_position message + * + * @return [degE7] Latitude (WGS84), in degrees * 1E7 + */ +static inline int32_t mavlink_msg_beacon_position_get_latitude(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 4); +} + +/** + * @brief Get field longitude from beacon_position message + * + * @return [degE7] Longitude (WGS84), in degrees * 1E7 + */ +static inline int32_t mavlink_msg_beacon_position_get_longitude(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 8); +} + +/** + * @brief Get field altitude from beacon_position message + * + * @return [m] Altitude (MSL), in meters + */ +static inline float mavlink_msg_beacon_position_get_altitude(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 12); +} + +/** + * @brief Get field distance from beacon_position message + * + * @return [m] Distance to the Beacon, in meters + */ +static inline float mavlink_msg_beacon_position_get_distance(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 16); +} + +/** + * @brief Get field delay from beacon_position message + * + * @return [ms] Time between generating the value and request, in milliseconds + */ +static inline int32_t mavlink_msg_beacon_position_get_delay(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 20); +} + +/** + * @brief Get field gps_status from beacon_position message + * + * @return Status indicating the quality of the GPS Data. 0=invalid 1=lat long valid, alt invalid 2=valid + */ +static inline uint8_t mavlink_msg_beacon_position_get_gps_status(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 28); +} + +/** + * @brief Get field link_quality from beacon_position message + * + * @return Value indicating the Signal to noise ratio (in units of dB) + */ +static inline int32_t mavlink_msg_beacon_position_get_link_quality(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 24); +} + +/** + * @brief Decode a beacon_position message into a struct + * + * @param msg The message to decode + * @param beacon_position C-struct to decode the message contents into + */ +static inline void mavlink_msg_beacon_position_decode(const mavlink_message_t* msg, mavlink_beacon_position_t* beacon_position) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + beacon_position->beacon_id = mavlink_msg_beacon_position_get_beacon_id(msg); + beacon_position->latitude = mavlink_msg_beacon_position_get_latitude(msg); + beacon_position->longitude = mavlink_msg_beacon_position_get_longitude(msg); + beacon_position->altitude = mavlink_msg_beacon_position_get_altitude(msg); + beacon_position->distance = mavlink_msg_beacon_position_get_distance(msg); + beacon_position->delay = mavlink_msg_beacon_position_get_delay(msg); + beacon_position->link_quality = mavlink_msg_beacon_position_get_link_quality(msg); + beacon_position->gps_status = mavlink_msg_beacon_position_get_gps_status(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_BEACON_POSITION_LEN? msg->len : MAVLINK_MSG_ID_BEACON_POSITION_LEN; + memset(beacon_position, 0, MAVLINK_MSG_ID_BEACON_POSITION_LEN); + memcpy(beacon_position, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/auterion/mavlink_msg_boat_actuator_status.h b/auterion/mavlink_msg_boat_actuator_status.h new file mode 100644 index 000000000..8f4af1992 --- /dev/null +++ b/auterion/mavlink_msg_boat_actuator_status.h @@ -0,0 +1,365 @@ +#pragma once +// MESSAGE BOAT_ACTUATOR_STATUS PACKING + +#define MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS 13666 + + +typedef struct __mavlink_boat_actuator_status_t { + uint64_t time_usec; /*< [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.*/ + float engine_leg_trim_position[6]; /*< [deg] Engine leg trim position.*/ + float rudder_position[6]; /*< [deg] Rudder position.*/ + uint8_t engine_leg_trim_state[6]; /*< Engine leg trim state.*/ + uint8_t rudder_state[6]; /*< Rudder state.*/ +} mavlink_boat_actuator_status_t; + +#define MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_LEN 68 +#define MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_MIN_LEN 68 +#define MAVLINK_MSG_ID_13666_LEN 68 +#define MAVLINK_MSG_ID_13666_MIN_LEN 68 + +#define MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_CRC 246 +#define MAVLINK_MSG_ID_13666_CRC 246 + +#define MAVLINK_MSG_BOAT_ACTUATOR_STATUS_FIELD_ENGINE_LEG_TRIM_POSITION_LEN 6 +#define MAVLINK_MSG_BOAT_ACTUATOR_STATUS_FIELD_RUDDER_POSITION_LEN 6 +#define MAVLINK_MSG_BOAT_ACTUATOR_STATUS_FIELD_ENGINE_LEG_TRIM_STATE_LEN 6 +#define MAVLINK_MSG_BOAT_ACTUATOR_STATUS_FIELD_RUDDER_STATE_LEN 6 + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_BOAT_ACTUATOR_STATUS { \ + 13666, \ + "BOAT_ACTUATOR_STATUS", \ + 5, \ + { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_boat_actuator_status_t, time_usec) }, \ + { "engine_leg_trim_state", NULL, MAVLINK_TYPE_UINT8_T, 6, 56, offsetof(mavlink_boat_actuator_status_t, engine_leg_trim_state) }, \ + { "engine_leg_trim_position", NULL, MAVLINK_TYPE_FLOAT, 6, 8, offsetof(mavlink_boat_actuator_status_t, engine_leg_trim_position) }, \ + { "rudder_state", NULL, MAVLINK_TYPE_UINT8_T, 6, 62, offsetof(mavlink_boat_actuator_status_t, rudder_state) }, \ + { "rudder_position", NULL, MAVLINK_TYPE_FLOAT, 6, 32, offsetof(mavlink_boat_actuator_status_t, rudder_position) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_BOAT_ACTUATOR_STATUS { \ + "BOAT_ACTUATOR_STATUS", \ + 5, \ + { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_boat_actuator_status_t, time_usec) }, \ + { "engine_leg_trim_state", NULL, MAVLINK_TYPE_UINT8_T, 6, 56, offsetof(mavlink_boat_actuator_status_t, engine_leg_trim_state) }, \ + { "engine_leg_trim_position", NULL, MAVLINK_TYPE_FLOAT, 6, 8, offsetof(mavlink_boat_actuator_status_t, engine_leg_trim_position) }, \ + { "rudder_state", NULL, MAVLINK_TYPE_UINT8_T, 6, 62, offsetof(mavlink_boat_actuator_status_t, rudder_state) }, \ + { "rudder_position", NULL, MAVLINK_TYPE_FLOAT, 6, 32, offsetof(mavlink_boat_actuator_status_t, rudder_position) }, \ + } \ +} +#endif + +/** + * @brief Pack a boat_actuator_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param engine_leg_trim_state Engine leg trim state. + * @param engine_leg_trim_position [deg] Engine leg trim position. + * @param rudder_state Rudder state. + * @param rudder_position [deg] Rudder position. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_boat_actuator_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint64_t time_usec, const uint8_t *engine_leg_trim_state, const float *engine_leg_trim_position, const uint8_t *rudder_state, const float *rudder_position) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float_array(buf, 8, engine_leg_trim_position, 6); + _mav_put_float_array(buf, 32, rudder_position, 6); + _mav_put_uint8_t_array(buf, 56, engine_leg_trim_state, 6); + _mav_put_uint8_t_array(buf, 62, rudder_state, 6); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_LEN); +#else + mavlink_boat_actuator_status_t packet; + packet.time_usec = time_usec; + mav_array_assign_float(packet.engine_leg_trim_position, engine_leg_trim_position, 6); + mav_array_assign_float(packet.rudder_position, rudder_position, 6); + mav_array_assign_uint8_t(packet.engine_leg_trim_state, engine_leg_trim_state, 6); + mav_array_assign_uint8_t(packet.rudder_state, rudder_state, 6); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_LEN, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_CRC); +} + +/** + * @brief Pack a boat_actuator_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param engine_leg_trim_state Engine leg trim state. + * @param engine_leg_trim_position [deg] Engine leg trim position. + * @param rudder_state Rudder state. + * @param rudder_position [deg] Rudder position. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_boat_actuator_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, const uint8_t *engine_leg_trim_state, const float *engine_leg_trim_position, const uint8_t *rudder_state, const float *rudder_position) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float_array(buf, 8, engine_leg_trim_position, 6); + _mav_put_float_array(buf, 32, rudder_position, 6); + _mav_put_uint8_t_array(buf, 56, engine_leg_trim_state, 6); + _mav_put_uint8_t_array(buf, 62, rudder_state, 6); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_LEN); +#else + mavlink_boat_actuator_status_t packet; + packet.time_usec = time_usec; + mav_array_memcpy(packet.engine_leg_trim_position, engine_leg_trim_position, sizeof(float)*6); + mav_array_memcpy(packet.rudder_position, rudder_position, sizeof(float)*6); + mav_array_memcpy(packet.engine_leg_trim_state, engine_leg_trim_state, sizeof(uint8_t)*6); + mav_array_memcpy(packet.rudder_state, rudder_state, sizeof(uint8_t)*6); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_LEN, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_LEN); +#endif +} + +/** + * @brief Pack a boat_actuator_status message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param engine_leg_trim_state Engine leg trim state. + * @param engine_leg_trim_position [deg] Engine leg trim position. + * @param rudder_state Rudder state. + * @param rudder_position [deg] Rudder position. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_boat_actuator_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint64_t time_usec,const uint8_t *engine_leg_trim_state,const float *engine_leg_trim_position,const uint8_t *rudder_state,const float *rudder_position) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float_array(buf, 8, engine_leg_trim_position, 6); + _mav_put_float_array(buf, 32, rudder_position, 6); + _mav_put_uint8_t_array(buf, 56, engine_leg_trim_state, 6); + _mav_put_uint8_t_array(buf, 62, rudder_state, 6); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_LEN); +#else + mavlink_boat_actuator_status_t packet; + packet.time_usec = time_usec; + mav_array_assign_float(packet.engine_leg_trim_position, engine_leg_trim_position, 6); + mav_array_assign_float(packet.rudder_position, rudder_position, 6); + mav_array_assign_uint8_t(packet.engine_leg_trim_state, engine_leg_trim_state, 6); + mav_array_assign_uint8_t(packet.rudder_state, rudder_state, 6); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_LEN, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_CRC); +} + +/** + * @brief Encode a boat_actuator_status struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param boat_actuator_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_boat_actuator_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_boat_actuator_status_t* boat_actuator_status) +{ + return mavlink_msg_boat_actuator_status_pack(system_id, component_id, msg, boat_actuator_status->time_usec, boat_actuator_status->engine_leg_trim_state, boat_actuator_status->engine_leg_trim_position, boat_actuator_status->rudder_state, boat_actuator_status->rudder_position); +} + +/** + * @brief Encode a boat_actuator_status struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param boat_actuator_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_boat_actuator_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_boat_actuator_status_t* boat_actuator_status) +{ + return mavlink_msg_boat_actuator_status_pack_chan(system_id, component_id, chan, msg, boat_actuator_status->time_usec, boat_actuator_status->engine_leg_trim_state, boat_actuator_status->engine_leg_trim_position, boat_actuator_status->rudder_state, boat_actuator_status->rudder_position); +} + +/** + * @brief Encode a boat_actuator_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param boat_actuator_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_boat_actuator_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_boat_actuator_status_t* boat_actuator_status) +{ + return mavlink_msg_boat_actuator_status_pack_status(system_id, component_id, _status, msg, boat_actuator_status->time_usec, boat_actuator_status->engine_leg_trim_state, boat_actuator_status->engine_leg_trim_position, boat_actuator_status->rudder_state, boat_actuator_status->rudder_position); +} + +/** + * @brief Send a boat_actuator_status message + * @param chan MAVLink channel to send the message + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param engine_leg_trim_state Engine leg trim state. + * @param engine_leg_trim_position [deg] Engine leg trim position. + * @param rudder_state Rudder state. + * @param rudder_position [deg] Rudder position. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_boat_actuator_status_send(mavlink_channel_t chan, uint64_t time_usec, const uint8_t *engine_leg_trim_state, const float *engine_leg_trim_position, const uint8_t *rudder_state, const float *rudder_position) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float_array(buf, 8, engine_leg_trim_position, 6); + _mav_put_float_array(buf, 32, rudder_position, 6); + _mav_put_uint8_t_array(buf, 56, engine_leg_trim_state, 6); + _mav_put_uint8_t_array(buf, 62, rudder_state, 6); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS, buf, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_LEN, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_CRC); +#else + mavlink_boat_actuator_status_t packet; + packet.time_usec = time_usec; + mav_array_assign_float(packet.engine_leg_trim_position, engine_leg_trim_position, 6); + mav_array_assign_float(packet.rudder_position, rudder_position, 6); + mav_array_assign_uint8_t(packet.engine_leg_trim_state, engine_leg_trim_state, 6); + mav_array_assign_uint8_t(packet.rudder_state, rudder_state, 6); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS, (const char *)&packet, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_LEN, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_CRC); +#endif +} + +/** + * @brief Send a boat_actuator_status message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_boat_actuator_status_send_struct(mavlink_channel_t chan, const mavlink_boat_actuator_status_t* boat_actuator_status) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_boat_actuator_status_send(chan, boat_actuator_status->time_usec, boat_actuator_status->engine_leg_trim_state, boat_actuator_status->engine_leg_trim_position, boat_actuator_status->rudder_state, boat_actuator_status->rudder_position); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS, (const char *)boat_actuator_status, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_LEN, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_CRC); +#endif +} + +#if MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_boat_actuator_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, const uint8_t *engine_leg_trim_state, const float *engine_leg_trim_position, const uint8_t *rudder_state, const float *rudder_position) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float_array(buf, 8, engine_leg_trim_position, 6); + _mav_put_float_array(buf, 32, rudder_position, 6); + _mav_put_uint8_t_array(buf, 56, engine_leg_trim_state, 6); + _mav_put_uint8_t_array(buf, 62, rudder_state, 6); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS, buf, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_LEN, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_CRC); +#else + mavlink_boat_actuator_status_t *packet = (mavlink_boat_actuator_status_t *)msgbuf; + packet->time_usec = time_usec; + mav_array_assign_float(packet->engine_leg_trim_position, engine_leg_trim_position, 6); + mav_array_assign_float(packet->rudder_position, rudder_position, 6); + mav_array_assign_uint8_t(packet->engine_leg_trim_state, engine_leg_trim_state, 6); + mav_array_assign_uint8_t(packet->rudder_state, rudder_state, 6); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS, (const char *)packet, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_LEN, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_CRC); +#endif +} +#endif + +#endif + +// MESSAGE BOAT_ACTUATOR_STATUS UNPACKING + + +/** + * @brief Get field time_usec from boat_actuator_status message + * + * @return [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + */ +static inline uint64_t mavlink_msg_boat_actuator_status_get_time_usec(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 0); +} + +/** + * @brief Get field engine_leg_trim_state from boat_actuator_status message + * + * @return Engine leg trim state. + */ +static inline uint16_t mavlink_msg_boat_actuator_status_get_engine_leg_trim_state(const mavlink_message_t* msg, uint8_t *engine_leg_trim_state) +{ + return _MAV_RETURN_uint8_t_array(msg, engine_leg_trim_state, 6, 56); +} + +/** + * @brief Get field engine_leg_trim_position from boat_actuator_status message + * + * @return [deg] Engine leg trim position. + */ +static inline uint16_t mavlink_msg_boat_actuator_status_get_engine_leg_trim_position(const mavlink_message_t* msg, float *engine_leg_trim_position) +{ + return _MAV_RETURN_float_array(msg, engine_leg_trim_position, 6, 8); +} + +/** + * @brief Get field rudder_state from boat_actuator_status message + * + * @return Rudder state. + */ +static inline uint16_t mavlink_msg_boat_actuator_status_get_rudder_state(const mavlink_message_t* msg, uint8_t *rudder_state) +{ + return _MAV_RETURN_uint8_t_array(msg, rudder_state, 6, 62); +} + +/** + * @brief Get field rudder_position from boat_actuator_status message + * + * @return [deg] Rudder position. + */ +static inline uint16_t mavlink_msg_boat_actuator_status_get_rudder_position(const mavlink_message_t* msg, float *rudder_position) +{ + return _MAV_RETURN_float_array(msg, rudder_position, 6, 32); +} + +/** + * @brief Decode a boat_actuator_status message into a struct + * + * @param msg The message to decode + * @param boat_actuator_status C-struct to decode the message contents into + */ +static inline void mavlink_msg_boat_actuator_status_decode(const mavlink_message_t* msg, mavlink_boat_actuator_status_t* boat_actuator_status) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + boat_actuator_status->time_usec = mavlink_msg_boat_actuator_status_get_time_usec(msg); + mavlink_msg_boat_actuator_status_get_engine_leg_trim_position(msg, boat_actuator_status->engine_leg_trim_position); + mavlink_msg_boat_actuator_status_get_rudder_position(msg, boat_actuator_status->rudder_position); + mavlink_msg_boat_actuator_status_get_engine_leg_trim_state(msg, boat_actuator_status->engine_leg_trim_state); + mavlink_msg_boat_actuator_status_get_rudder_state(msg, boat_actuator_status->rudder_state); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_LEN? msg->len : MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_LEN; + memset(boat_actuator_status, 0, MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_LEN); + memcpy(boat_actuator_status, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/auterion/mavlink_msg_boat_engine_status.h b/auterion/mavlink_msg_boat_engine_status.h new file mode 100644 index 000000000..c1a193e1c --- /dev/null +++ b/auterion/mavlink_msg_boat_engine_status.h @@ -0,0 +1,480 @@ +#pragma once +// MESSAGE BOAT_ENGINE_STATUS PACKING + +#define MAVLINK_MSG_ID_BOAT_ENGINE_STATUS 13667 + + +typedef struct __mavlink_boat_engine_status_t { + uint64_t time_usec; /*< [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.*/ + float fuel_consumption_rate; /*< [L/h] Fuel consumption rate.*/ + float oil_pressure[6]; /*< [kPa] Engine oil pressure.*/ + float engine_coolant_temperature[6]; /*< [degC] Engine coolant temperature.*/ + uint16_t engine_rpm[6]; /*< [rpm] Engine RPM.*/ + uint8_t engine_state[6]; /*< Engine state.*/ + uint8_t engine_load[6]; /*< [%] Engine load.*/ + uint8_t throttle_position[6]; /*< [%] Throttle position.*/ + uint8_t transmission_state[6]; /*< Transmission state.*/ +} mavlink_boat_engine_status_t; + +#define MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_LEN 96 +#define MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_MIN_LEN 96 +#define MAVLINK_MSG_ID_13667_LEN 96 +#define MAVLINK_MSG_ID_13667_MIN_LEN 96 + +#define MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_CRC 208 +#define MAVLINK_MSG_ID_13667_CRC 208 + +#define MAVLINK_MSG_BOAT_ENGINE_STATUS_FIELD_OIL_PRESSURE_LEN 6 +#define MAVLINK_MSG_BOAT_ENGINE_STATUS_FIELD_ENGINE_COOLANT_TEMPERATURE_LEN 6 +#define MAVLINK_MSG_BOAT_ENGINE_STATUS_FIELD_ENGINE_RPM_LEN 6 +#define MAVLINK_MSG_BOAT_ENGINE_STATUS_FIELD_ENGINE_STATE_LEN 6 +#define MAVLINK_MSG_BOAT_ENGINE_STATUS_FIELD_ENGINE_LOAD_LEN 6 +#define MAVLINK_MSG_BOAT_ENGINE_STATUS_FIELD_THROTTLE_POSITION_LEN 6 +#define MAVLINK_MSG_BOAT_ENGINE_STATUS_FIELD_TRANSMISSION_STATE_LEN 6 + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_BOAT_ENGINE_STATUS { \ + 13667, \ + "BOAT_ENGINE_STATUS", \ + 9, \ + { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_boat_engine_status_t, time_usec) }, \ + { "engine_state", NULL, MAVLINK_TYPE_UINT8_T, 6, 72, offsetof(mavlink_boat_engine_status_t, engine_state) }, \ + { "engine_load", NULL, MAVLINK_TYPE_UINT8_T, 6, 78, offsetof(mavlink_boat_engine_status_t, engine_load) }, \ + { "engine_rpm", NULL, MAVLINK_TYPE_UINT16_T, 6, 60, offsetof(mavlink_boat_engine_status_t, engine_rpm) }, \ + { "fuel_consumption_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_boat_engine_status_t, fuel_consumption_rate) }, \ + { "oil_pressure", NULL, MAVLINK_TYPE_FLOAT, 6, 12, offsetof(mavlink_boat_engine_status_t, oil_pressure) }, \ + { "throttle_position", NULL, MAVLINK_TYPE_UINT8_T, 6, 84, offsetof(mavlink_boat_engine_status_t, throttle_position) }, \ + { "engine_coolant_temperature", NULL, MAVLINK_TYPE_FLOAT, 6, 36, offsetof(mavlink_boat_engine_status_t, engine_coolant_temperature) }, \ + { "transmission_state", NULL, MAVLINK_TYPE_UINT8_T, 6, 90, offsetof(mavlink_boat_engine_status_t, transmission_state) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_BOAT_ENGINE_STATUS { \ + "BOAT_ENGINE_STATUS", \ + 9, \ + { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_boat_engine_status_t, time_usec) }, \ + { "engine_state", NULL, MAVLINK_TYPE_UINT8_T, 6, 72, offsetof(mavlink_boat_engine_status_t, engine_state) }, \ + { "engine_load", NULL, MAVLINK_TYPE_UINT8_T, 6, 78, offsetof(mavlink_boat_engine_status_t, engine_load) }, \ + { "engine_rpm", NULL, MAVLINK_TYPE_UINT16_T, 6, 60, offsetof(mavlink_boat_engine_status_t, engine_rpm) }, \ + { "fuel_consumption_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_boat_engine_status_t, fuel_consumption_rate) }, \ + { "oil_pressure", NULL, MAVLINK_TYPE_FLOAT, 6, 12, offsetof(mavlink_boat_engine_status_t, oil_pressure) }, \ + { "throttle_position", NULL, MAVLINK_TYPE_UINT8_T, 6, 84, offsetof(mavlink_boat_engine_status_t, throttle_position) }, \ + { "engine_coolant_temperature", NULL, MAVLINK_TYPE_FLOAT, 6, 36, offsetof(mavlink_boat_engine_status_t, engine_coolant_temperature) }, \ + { "transmission_state", NULL, MAVLINK_TYPE_UINT8_T, 6, 90, offsetof(mavlink_boat_engine_status_t, transmission_state) }, \ + } \ +} +#endif + +/** + * @brief Pack a boat_engine_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param engine_state Engine state. + * @param engine_load [%] Engine load. + * @param engine_rpm [rpm] Engine RPM. + * @param fuel_consumption_rate [L/h] Fuel consumption rate. + * @param oil_pressure [kPa] Engine oil pressure. + * @param throttle_position [%] Throttle position. + * @param engine_coolant_temperature [degC] Engine coolant temperature. + * @param transmission_state Transmission state. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_boat_engine_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint64_t time_usec, const uint8_t *engine_state, const uint8_t *engine_load, const uint16_t *engine_rpm, float fuel_consumption_rate, const float *oil_pressure, const uint8_t *throttle_position, const float *engine_coolant_temperature, const uint8_t *transmission_state) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, fuel_consumption_rate); + _mav_put_float_array(buf, 12, oil_pressure, 6); + _mav_put_float_array(buf, 36, engine_coolant_temperature, 6); + _mav_put_uint16_t_array(buf, 60, engine_rpm, 6); + _mav_put_uint8_t_array(buf, 72, engine_state, 6); + _mav_put_uint8_t_array(buf, 78, engine_load, 6); + _mav_put_uint8_t_array(buf, 84, throttle_position, 6); + _mav_put_uint8_t_array(buf, 90, transmission_state, 6); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_LEN); +#else + mavlink_boat_engine_status_t packet; + packet.time_usec = time_usec; + packet.fuel_consumption_rate = fuel_consumption_rate; + mav_array_assign_float(packet.oil_pressure, oil_pressure, 6); + mav_array_assign_float(packet.engine_coolant_temperature, engine_coolant_temperature, 6); + mav_array_assign_uint16_t(packet.engine_rpm, engine_rpm, 6); + mav_array_assign_uint8_t(packet.engine_state, engine_state, 6); + mav_array_assign_uint8_t(packet.engine_load, engine_load, 6); + mav_array_assign_uint8_t(packet.throttle_position, throttle_position, 6); + mav_array_assign_uint8_t(packet.transmission_state, transmission_state, 6); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_BOAT_ENGINE_STATUS; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_MIN_LEN, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_LEN, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_CRC); +} + +/** + * @brief Pack a boat_engine_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param engine_state Engine state. + * @param engine_load [%] Engine load. + * @param engine_rpm [rpm] Engine RPM. + * @param fuel_consumption_rate [L/h] Fuel consumption rate. + * @param oil_pressure [kPa] Engine oil pressure. + * @param throttle_position [%] Throttle position. + * @param engine_coolant_temperature [degC] Engine coolant temperature. + * @param transmission_state Transmission state. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_boat_engine_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, const uint8_t *engine_state, const uint8_t *engine_load, const uint16_t *engine_rpm, float fuel_consumption_rate, const float *oil_pressure, const uint8_t *throttle_position, const float *engine_coolant_temperature, const uint8_t *transmission_state) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, fuel_consumption_rate); + _mav_put_float_array(buf, 12, oil_pressure, 6); + _mav_put_float_array(buf, 36, engine_coolant_temperature, 6); + _mav_put_uint16_t_array(buf, 60, engine_rpm, 6); + _mav_put_uint8_t_array(buf, 72, engine_state, 6); + _mav_put_uint8_t_array(buf, 78, engine_load, 6); + _mav_put_uint8_t_array(buf, 84, throttle_position, 6); + _mav_put_uint8_t_array(buf, 90, transmission_state, 6); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_LEN); +#else + mavlink_boat_engine_status_t packet; + packet.time_usec = time_usec; + packet.fuel_consumption_rate = fuel_consumption_rate; + mav_array_memcpy(packet.oil_pressure, oil_pressure, sizeof(float)*6); + mav_array_memcpy(packet.engine_coolant_temperature, engine_coolant_temperature, sizeof(float)*6); + mav_array_memcpy(packet.engine_rpm, engine_rpm, sizeof(uint16_t)*6); + mav_array_memcpy(packet.engine_state, engine_state, sizeof(uint8_t)*6); + mav_array_memcpy(packet.engine_load, engine_load, sizeof(uint8_t)*6); + mav_array_memcpy(packet.throttle_position, throttle_position, sizeof(uint8_t)*6); + mav_array_memcpy(packet.transmission_state, transmission_state, sizeof(uint8_t)*6); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_BOAT_ENGINE_STATUS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_MIN_LEN, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_LEN, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_MIN_LEN, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_LEN); +#endif +} + +/** + * @brief Pack a boat_engine_status message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param engine_state Engine state. + * @param engine_load [%] Engine load. + * @param engine_rpm [rpm] Engine RPM. + * @param fuel_consumption_rate [L/h] Fuel consumption rate. + * @param oil_pressure [kPa] Engine oil pressure. + * @param throttle_position [%] Throttle position. + * @param engine_coolant_temperature [degC] Engine coolant temperature. + * @param transmission_state Transmission state. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_boat_engine_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint64_t time_usec,const uint8_t *engine_state,const uint8_t *engine_load,const uint16_t *engine_rpm,float fuel_consumption_rate,const float *oil_pressure,const uint8_t *throttle_position,const float *engine_coolant_temperature,const uint8_t *transmission_state) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, fuel_consumption_rate); + _mav_put_float_array(buf, 12, oil_pressure, 6); + _mav_put_float_array(buf, 36, engine_coolant_temperature, 6); + _mav_put_uint16_t_array(buf, 60, engine_rpm, 6); + _mav_put_uint8_t_array(buf, 72, engine_state, 6); + _mav_put_uint8_t_array(buf, 78, engine_load, 6); + _mav_put_uint8_t_array(buf, 84, throttle_position, 6); + _mav_put_uint8_t_array(buf, 90, transmission_state, 6); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_LEN); +#else + mavlink_boat_engine_status_t packet; + packet.time_usec = time_usec; + packet.fuel_consumption_rate = fuel_consumption_rate; + mav_array_assign_float(packet.oil_pressure, oil_pressure, 6); + mav_array_assign_float(packet.engine_coolant_temperature, engine_coolant_temperature, 6); + mav_array_assign_uint16_t(packet.engine_rpm, engine_rpm, 6); + mav_array_assign_uint8_t(packet.engine_state, engine_state, 6); + mav_array_assign_uint8_t(packet.engine_load, engine_load, 6); + mav_array_assign_uint8_t(packet.throttle_position, throttle_position, 6); + mav_array_assign_uint8_t(packet.transmission_state, transmission_state, 6); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_BOAT_ENGINE_STATUS; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_MIN_LEN, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_LEN, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_CRC); +} + +/** + * @brief Encode a boat_engine_status struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param boat_engine_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_boat_engine_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_boat_engine_status_t* boat_engine_status) +{ + return mavlink_msg_boat_engine_status_pack(system_id, component_id, msg, boat_engine_status->time_usec, boat_engine_status->engine_state, boat_engine_status->engine_load, boat_engine_status->engine_rpm, boat_engine_status->fuel_consumption_rate, boat_engine_status->oil_pressure, boat_engine_status->throttle_position, boat_engine_status->engine_coolant_temperature, boat_engine_status->transmission_state); +} + +/** + * @brief Encode a boat_engine_status struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param boat_engine_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_boat_engine_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_boat_engine_status_t* boat_engine_status) +{ + return mavlink_msg_boat_engine_status_pack_chan(system_id, component_id, chan, msg, boat_engine_status->time_usec, boat_engine_status->engine_state, boat_engine_status->engine_load, boat_engine_status->engine_rpm, boat_engine_status->fuel_consumption_rate, boat_engine_status->oil_pressure, boat_engine_status->throttle_position, boat_engine_status->engine_coolant_temperature, boat_engine_status->transmission_state); +} + +/** + * @brief Encode a boat_engine_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param boat_engine_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_boat_engine_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_boat_engine_status_t* boat_engine_status) +{ + return mavlink_msg_boat_engine_status_pack_status(system_id, component_id, _status, msg, boat_engine_status->time_usec, boat_engine_status->engine_state, boat_engine_status->engine_load, boat_engine_status->engine_rpm, boat_engine_status->fuel_consumption_rate, boat_engine_status->oil_pressure, boat_engine_status->throttle_position, boat_engine_status->engine_coolant_temperature, boat_engine_status->transmission_state); +} + +/** + * @brief Send a boat_engine_status message + * @param chan MAVLink channel to send the message + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param engine_state Engine state. + * @param engine_load [%] Engine load. + * @param engine_rpm [rpm] Engine RPM. + * @param fuel_consumption_rate [L/h] Fuel consumption rate. + * @param oil_pressure [kPa] Engine oil pressure. + * @param throttle_position [%] Throttle position. + * @param engine_coolant_temperature [degC] Engine coolant temperature. + * @param transmission_state Transmission state. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_boat_engine_status_send(mavlink_channel_t chan, uint64_t time_usec, const uint8_t *engine_state, const uint8_t *engine_load, const uint16_t *engine_rpm, float fuel_consumption_rate, const float *oil_pressure, const uint8_t *throttle_position, const float *engine_coolant_temperature, const uint8_t *transmission_state) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, fuel_consumption_rate); + _mav_put_float_array(buf, 12, oil_pressure, 6); + _mav_put_float_array(buf, 36, engine_coolant_temperature, 6); + _mav_put_uint16_t_array(buf, 60, engine_rpm, 6); + _mav_put_uint8_t_array(buf, 72, engine_state, 6); + _mav_put_uint8_t_array(buf, 78, engine_load, 6); + _mav_put_uint8_t_array(buf, 84, throttle_position, 6); + _mav_put_uint8_t_array(buf, 90, transmission_state, 6); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS, buf, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_MIN_LEN, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_LEN, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_CRC); +#else + mavlink_boat_engine_status_t packet; + packet.time_usec = time_usec; + packet.fuel_consumption_rate = fuel_consumption_rate; + mav_array_assign_float(packet.oil_pressure, oil_pressure, 6); + mav_array_assign_float(packet.engine_coolant_temperature, engine_coolant_temperature, 6); + mav_array_assign_uint16_t(packet.engine_rpm, engine_rpm, 6); + mav_array_assign_uint8_t(packet.engine_state, engine_state, 6); + mav_array_assign_uint8_t(packet.engine_load, engine_load, 6); + mav_array_assign_uint8_t(packet.throttle_position, throttle_position, 6); + mav_array_assign_uint8_t(packet.transmission_state, transmission_state, 6); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS, (const char *)&packet, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_MIN_LEN, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_LEN, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_CRC); +#endif +} + +/** + * @brief Send a boat_engine_status message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_boat_engine_status_send_struct(mavlink_channel_t chan, const mavlink_boat_engine_status_t* boat_engine_status) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_boat_engine_status_send(chan, boat_engine_status->time_usec, boat_engine_status->engine_state, boat_engine_status->engine_load, boat_engine_status->engine_rpm, boat_engine_status->fuel_consumption_rate, boat_engine_status->oil_pressure, boat_engine_status->throttle_position, boat_engine_status->engine_coolant_temperature, boat_engine_status->transmission_state); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS, (const char *)boat_engine_status, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_MIN_LEN, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_LEN, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_CRC); +#endif +} + +#if MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_boat_engine_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, const uint8_t *engine_state, const uint8_t *engine_load, const uint16_t *engine_rpm, float fuel_consumption_rate, const float *oil_pressure, const uint8_t *throttle_position, const float *engine_coolant_temperature, const uint8_t *transmission_state) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, fuel_consumption_rate); + _mav_put_float_array(buf, 12, oil_pressure, 6); + _mav_put_float_array(buf, 36, engine_coolant_temperature, 6); + _mav_put_uint16_t_array(buf, 60, engine_rpm, 6); + _mav_put_uint8_t_array(buf, 72, engine_state, 6); + _mav_put_uint8_t_array(buf, 78, engine_load, 6); + _mav_put_uint8_t_array(buf, 84, throttle_position, 6); + _mav_put_uint8_t_array(buf, 90, transmission_state, 6); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS, buf, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_MIN_LEN, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_LEN, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_CRC); +#else + mavlink_boat_engine_status_t *packet = (mavlink_boat_engine_status_t *)msgbuf; + packet->time_usec = time_usec; + packet->fuel_consumption_rate = fuel_consumption_rate; + mav_array_assign_float(packet->oil_pressure, oil_pressure, 6); + mav_array_assign_float(packet->engine_coolant_temperature, engine_coolant_temperature, 6); + mav_array_assign_uint16_t(packet->engine_rpm, engine_rpm, 6); + mav_array_assign_uint8_t(packet->engine_state, engine_state, 6); + mav_array_assign_uint8_t(packet->engine_load, engine_load, 6); + mav_array_assign_uint8_t(packet->throttle_position, throttle_position, 6); + mav_array_assign_uint8_t(packet->transmission_state, transmission_state, 6); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS, (const char *)packet, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_MIN_LEN, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_LEN, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_CRC); +#endif +} +#endif + +#endif + +// MESSAGE BOAT_ENGINE_STATUS UNPACKING + + +/** + * @brief Get field time_usec from boat_engine_status message + * + * @return [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + */ +static inline uint64_t mavlink_msg_boat_engine_status_get_time_usec(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 0); +} + +/** + * @brief Get field engine_state from boat_engine_status message + * + * @return Engine state. + */ +static inline uint16_t mavlink_msg_boat_engine_status_get_engine_state(const mavlink_message_t* msg, uint8_t *engine_state) +{ + return _MAV_RETURN_uint8_t_array(msg, engine_state, 6, 72); +} + +/** + * @brief Get field engine_load from boat_engine_status message + * + * @return [%] Engine load. + */ +static inline uint16_t mavlink_msg_boat_engine_status_get_engine_load(const mavlink_message_t* msg, uint8_t *engine_load) +{ + return _MAV_RETURN_uint8_t_array(msg, engine_load, 6, 78); +} + +/** + * @brief Get field engine_rpm from boat_engine_status message + * + * @return [rpm] Engine RPM. + */ +static inline uint16_t mavlink_msg_boat_engine_status_get_engine_rpm(const mavlink_message_t* msg, uint16_t *engine_rpm) +{ + return _MAV_RETURN_uint16_t_array(msg, engine_rpm, 6, 60); +} + +/** + * @brief Get field fuel_consumption_rate from boat_engine_status message + * + * @return [L/h] Fuel consumption rate. + */ +static inline float mavlink_msg_boat_engine_status_get_fuel_consumption_rate(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 8); +} + +/** + * @brief Get field oil_pressure from boat_engine_status message + * + * @return [kPa] Engine oil pressure. + */ +static inline uint16_t mavlink_msg_boat_engine_status_get_oil_pressure(const mavlink_message_t* msg, float *oil_pressure) +{ + return _MAV_RETURN_float_array(msg, oil_pressure, 6, 12); +} + +/** + * @brief Get field throttle_position from boat_engine_status message + * + * @return [%] Throttle position. + */ +static inline uint16_t mavlink_msg_boat_engine_status_get_throttle_position(const mavlink_message_t* msg, uint8_t *throttle_position) +{ + return _MAV_RETURN_uint8_t_array(msg, throttle_position, 6, 84); +} + +/** + * @brief Get field engine_coolant_temperature from boat_engine_status message + * + * @return [degC] Engine coolant temperature. + */ +static inline uint16_t mavlink_msg_boat_engine_status_get_engine_coolant_temperature(const mavlink_message_t* msg, float *engine_coolant_temperature) +{ + return _MAV_RETURN_float_array(msg, engine_coolant_temperature, 6, 36); +} + +/** + * @brief Get field transmission_state from boat_engine_status message + * + * @return Transmission state. + */ +static inline uint16_t mavlink_msg_boat_engine_status_get_transmission_state(const mavlink_message_t* msg, uint8_t *transmission_state) +{ + return _MAV_RETURN_uint8_t_array(msg, transmission_state, 6, 90); +} + +/** + * @brief Decode a boat_engine_status message into a struct + * + * @param msg The message to decode + * @param boat_engine_status C-struct to decode the message contents into + */ +static inline void mavlink_msg_boat_engine_status_decode(const mavlink_message_t* msg, mavlink_boat_engine_status_t* boat_engine_status) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + boat_engine_status->time_usec = mavlink_msg_boat_engine_status_get_time_usec(msg); + boat_engine_status->fuel_consumption_rate = mavlink_msg_boat_engine_status_get_fuel_consumption_rate(msg); + mavlink_msg_boat_engine_status_get_oil_pressure(msg, boat_engine_status->oil_pressure); + mavlink_msg_boat_engine_status_get_engine_coolant_temperature(msg, boat_engine_status->engine_coolant_temperature); + mavlink_msg_boat_engine_status_get_engine_rpm(msg, boat_engine_status->engine_rpm); + mavlink_msg_boat_engine_status_get_engine_state(msg, boat_engine_status->engine_state); + mavlink_msg_boat_engine_status_get_engine_load(msg, boat_engine_status->engine_load); + mavlink_msg_boat_engine_status_get_throttle_position(msg, boat_engine_status->throttle_position); + mavlink_msg_boat_engine_status_get_transmission_state(msg, boat_engine_status->transmission_state); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_LEN? msg->len : MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_LEN; + memset(boat_engine_status, 0, MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_LEN); + memcpy(boat_engine_status, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/auterion/mavlink_msg_control_status_report.h b/auterion/mavlink_msg_control_status_report.h new file mode 100644 index 000000000..05b718cba --- /dev/null +++ b/auterion/mavlink_msg_control_status_report.h @@ -0,0 +1,288 @@ +#pragma once +// MESSAGE CONTROL_STATUS_REPORT PACKING + +#define MAVLINK_MSG_ID_CONTROL_STATUS_REPORT 13441 + + +typedef struct __mavlink_control_status_report_t { + uint8_t current_flight_controller; /*< Current flight control entity.*/ + uint8_t current_payload_controller; /*< Current payload control entity.*/ +} mavlink_control_status_report_t; + +#define MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_LEN 2 +#define MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_MIN_LEN 2 +#define MAVLINK_MSG_ID_13441_LEN 2 +#define MAVLINK_MSG_ID_13441_MIN_LEN 2 + +#define MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_CRC 21 +#define MAVLINK_MSG_ID_13441_CRC 21 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_CONTROL_STATUS_REPORT { \ + 13441, \ + "CONTROL_STATUS_REPORT", \ + 2, \ + { { "current_flight_controller", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_control_status_report_t, current_flight_controller) }, \ + { "current_payload_controller", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_control_status_report_t, current_payload_controller) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_CONTROL_STATUS_REPORT { \ + "CONTROL_STATUS_REPORT", \ + 2, \ + { { "current_flight_controller", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_control_status_report_t, current_flight_controller) }, \ + { "current_payload_controller", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_control_status_report_t, current_payload_controller) }, \ + } \ +} +#endif + +/** + * @brief Pack a control_status_report message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param current_flight_controller Current flight control entity. + * @param current_payload_controller Current payload control entity. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_control_status_report_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t current_flight_controller, uint8_t current_payload_controller) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_LEN]; + _mav_put_uint8_t(buf, 0, current_flight_controller); + _mav_put_uint8_t(buf, 1, current_payload_controller); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_LEN); +#else + mavlink_control_status_report_t packet; + packet.current_flight_controller = current_flight_controller; + packet.current_payload_controller = current_payload_controller; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CONTROL_STATUS_REPORT; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_MIN_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_CRC); +} + +/** + * @brief Pack a control_status_report message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param current_flight_controller Current flight control entity. + * @param current_payload_controller Current payload control entity. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_control_status_report_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t current_flight_controller, uint8_t current_payload_controller) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_LEN]; + _mav_put_uint8_t(buf, 0, current_flight_controller); + _mav_put_uint8_t(buf, 1, current_payload_controller); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_LEN); +#else + mavlink_control_status_report_t packet; + packet.current_flight_controller = current_flight_controller; + packet.current_payload_controller = current_payload_controller; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CONTROL_STATUS_REPORT; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_MIN_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_MIN_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_LEN); +#endif +} + +/** + * @brief Pack a control_status_report message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param current_flight_controller Current flight control entity. + * @param current_payload_controller Current payload control entity. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_control_status_report_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t current_flight_controller,uint8_t current_payload_controller) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_LEN]; + _mav_put_uint8_t(buf, 0, current_flight_controller); + _mav_put_uint8_t(buf, 1, current_payload_controller); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_LEN); +#else + mavlink_control_status_report_t packet; + packet.current_flight_controller = current_flight_controller; + packet.current_payload_controller = current_payload_controller; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CONTROL_STATUS_REPORT; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_MIN_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_CRC); +} + +/** + * @brief Encode a control_status_report struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param control_status_report C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_control_status_report_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_control_status_report_t* control_status_report) +{ + return mavlink_msg_control_status_report_pack(system_id, component_id, msg, control_status_report->current_flight_controller, control_status_report->current_payload_controller); +} + +/** + * @brief Encode a control_status_report struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param control_status_report C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_control_status_report_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_control_status_report_t* control_status_report) +{ + return mavlink_msg_control_status_report_pack_chan(system_id, component_id, chan, msg, control_status_report->current_flight_controller, control_status_report->current_payload_controller); +} + +/** + * @brief Encode a control_status_report struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param control_status_report C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_control_status_report_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_control_status_report_t* control_status_report) +{ + return mavlink_msg_control_status_report_pack_status(system_id, component_id, _status, msg, control_status_report->current_flight_controller, control_status_report->current_payload_controller); +} + +/** + * @brief Send a control_status_report message + * @param chan MAVLink channel to send the message + * + * @param current_flight_controller Current flight control entity. + * @param current_payload_controller Current payload control entity. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_control_status_report_send(mavlink_channel_t chan, uint8_t current_flight_controller, uint8_t current_payload_controller) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_LEN]; + _mav_put_uint8_t(buf, 0, current_flight_controller); + _mav_put_uint8_t(buf, 1, current_payload_controller); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT, buf, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_MIN_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_CRC); +#else + mavlink_control_status_report_t packet; + packet.current_flight_controller = current_flight_controller; + packet.current_payload_controller = current_payload_controller; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT, (const char *)&packet, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_MIN_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_CRC); +#endif +} + +/** + * @brief Send a control_status_report message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_control_status_report_send_struct(mavlink_channel_t chan, const mavlink_control_status_report_t* control_status_report) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_control_status_report_send(chan, control_status_report->current_flight_controller, control_status_report->current_payload_controller); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT, (const char *)control_status_report, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_MIN_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_CRC); +#endif +} + +#if MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_control_status_report_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t current_flight_controller, uint8_t current_payload_controller) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint8_t(buf, 0, current_flight_controller); + _mav_put_uint8_t(buf, 1, current_payload_controller); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT, buf, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_MIN_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_CRC); +#else + mavlink_control_status_report_t *packet = (mavlink_control_status_report_t *)msgbuf; + packet->current_flight_controller = current_flight_controller; + packet->current_payload_controller = current_payload_controller; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT, (const char *)packet, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_MIN_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_CRC); +#endif +} +#endif + +#endif + +// MESSAGE CONTROL_STATUS_REPORT UNPACKING + + +/** + * @brief Get field current_flight_controller from control_status_report message + * + * @return Current flight control entity. + */ +static inline uint8_t mavlink_msg_control_status_report_get_current_flight_controller(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 0); +} + +/** + * @brief Get field current_payload_controller from control_status_report message + * + * @return Current payload control entity. + */ +static inline uint8_t mavlink_msg_control_status_report_get_current_payload_controller(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 1); +} + +/** + * @brief Decode a control_status_report message into a struct + * + * @param msg The message to decode + * @param control_status_report C-struct to decode the message contents into + */ +static inline void mavlink_msg_control_status_report_decode(const mavlink_message_t* msg, mavlink_control_status_report_t* control_status_report) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + control_status_report->current_flight_controller = mavlink_msg_control_status_report_get_current_flight_controller(msg); + control_status_report->current_payload_controller = mavlink_msg_control_status_report_get_current_payload_controller(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_LEN? msg->len : MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_LEN; + memset(control_status_report, 0, MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_LEN); + memcpy(control_status_report, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/auterion/mavlink_msg_fluid_level.h b/auterion/mavlink_msg_fluid_level.h new file mode 100644 index 000000000..3cf04a196 --- /dev/null +++ b/auterion/mavlink_msg_fluid_level.h @@ -0,0 +1,372 @@ +#pragma once +// MESSAGE FLUID_LEVEL PACKING + +#define MAVLINK_MSG_ID_FLUID_LEVEL 13668 + + +typedef struct __mavlink_fluid_level_t { + uint64_t time_usec; /*< [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.*/ + float level; /*< [%] Fluid level in percentage of full tank.*/ + float capacity; /*< [l] Fluid capacity left in tank in liters.*/ + uint8_t instance; /*< Fluid tank instance.*/ + uint8_t type; /*< Fluid tank type.*/ +} mavlink_fluid_level_t; + +#define MAVLINK_MSG_ID_FLUID_LEVEL_LEN 18 +#define MAVLINK_MSG_ID_FLUID_LEVEL_MIN_LEN 18 +#define MAVLINK_MSG_ID_13668_LEN 18 +#define MAVLINK_MSG_ID_13668_MIN_LEN 18 + +#define MAVLINK_MSG_ID_FLUID_LEVEL_CRC 138 +#define MAVLINK_MSG_ID_13668_CRC 138 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_FLUID_LEVEL { \ + 13668, \ + "FLUID_LEVEL", \ + 5, \ + { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_fluid_level_t, time_usec) }, \ + { "instance", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_fluid_level_t, instance) }, \ + { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 17, offsetof(mavlink_fluid_level_t, type) }, \ + { "level", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_fluid_level_t, level) }, \ + { "capacity", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_fluid_level_t, capacity) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_FLUID_LEVEL { \ + "FLUID_LEVEL", \ + 5, \ + { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_fluid_level_t, time_usec) }, \ + { "instance", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_fluid_level_t, instance) }, \ + { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 17, offsetof(mavlink_fluid_level_t, type) }, \ + { "level", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_fluid_level_t, level) }, \ + { "capacity", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_fluid_level_t, capacity) }, \ + } \ +} +#endif + +/** + * @brief Pack a fluid_level message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param instance Fluid tank instance. + * @param type Fluid tank type. + * @param level [%] Fluid level in percentage of full tank. + * @param capacity [l] Fluid capacity left in tank in liters. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_fluid_level_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint64_t time_usec, uint8_t instance, uint8_t type, float level, float capacity) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_FLUID_LEVEL_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, level); + _mav_put_float(buf, 12, capacity); + _mav_put_uint8_t(buf, 16, instance); + _mav_put_uint8_t(buf, 17, type); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FLUID_LEVEL_LEN); +#else + mavlink_fluid_level_t packet; + packet.time_usec = time_usec; + packet.level = level; + packet.capacity = capacity; + packet.instance = instance; + packet.type = type; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FLUID_LEVEL_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_FLUID_LEVEL; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FLUID_LEVEL_MIN_LEN, MAVLINK_MSG_ID_FLUID_LEVEL_LEN, MAVLINK_MSG_ID_FLUID_LEVEL_CRC); +} + +/** + * @brief Pack a fluid_level message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param instance Fluid tank instance. + * @param type Fluid tank type. + * @param level [%] Fluid level in percentage of full tank. + * @param capacity [l] Fluid capacity left in tank in liters. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_fluid_level_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, uint8_t instance, uint8_t type, float level, float capacity) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_FLUID_LEVEL_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, level); + _mav_put_float(buf, 12, capacity); + _mav_put_uint8_t(buf, 16, instance); + _mav_put_uint8_t(buf, 17, type); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FLUID_LEVEL_LEN); +#else + mavlink_fluid_level_t packet; + packet.time_usec = time_usec; + packet.level = level; + packet.capacity = capacity; + packet.instance = instance; + packet.type = type; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FLUID_LEVEL_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_FLUID_LEVEL; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_FLUID_LEVEL_MIN_LEN, MAVLINK_MSG_ID_FLUID_LEVEL_LEN, MAVLINK_MSG_ID_FLUID_LEVEL_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_FLUID_LEVEL_MIN_LEN, MAVLINK_MSG_ID_FLUID_LEVEL_LEN); +#endif +} + +/** + * @brief Pack a fluid_level message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param instance Fluid tank instance. + * @param type Fluid tank type. + * @param level [%] Fluid level in percentage of full tank. + * @param capacity [l] Fluid capacity left in tank in liters. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_fluid_level_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint64_t time_usec,uint8_t instance,uint8_t type,float level,float capacity) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_FLUID_LEVEL_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, level); + _mav_put_float(buf, 12, capacity); + _mav_put_uint8_t(buf, 16, instance); + _mav_put_uint8_t(buf, 17, type); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FLUID_LEVEL_LEN); +#else + mavlink_fluid_level_t packet; + packet.time_usec = time_usec; + packet.level = level; + packet.capacity = capacity; + packet.instance = instance; + packet.type = type; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FLUID_LEVEL_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_FLUID_LEVEL; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FLUID_LEVEL_MIN_LEN, MAVLINK_MSG_ID_FLUID_LEVEL_LEN, MAVLINK_MSG_ID_FLUID_LEVEL_CRC); +} + +/** + * @brief Encode a fluid_level struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param fluid_level C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_fluid_level_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_fluid_level_t* fluid_level) +{ + return mavlink_msg_fluid_level_pack(system_id, component_id, msg, fluid_level->time_usec, fluid_level->instance, fluid_level->type, fluid_level->level, fluid_level->capacity); +} + +/** + * @brief Encode a fluid_level struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param fluid_level C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_fluid_level_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_fluid_level_t* fluid_level) +{ + return mavlink_msg_fluid_level_pack_chan(system_id, component_id, chan, msg, fluid_level->time_usec, fluid_level->instance, fluid_level->type, fluid_level->level, fluid_level->capacity); +} + +/** + * @brief Encode a fluid_level struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param fluid_level C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_fluid_level_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_fluid_level_t* fluid_level) +{ + return mavlink_msg_fluid_level_pack_status(system_id, component_id, _status, msg, fluid_level->time_usec, fluid_level->instance, fluid_level->type, fluid_level->level, fluid_level->capacity); +} + +/** + * @brief Send a fluid_level message + * @param chan MAVLink channel to send the message + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param instance Fluid tank instance. + * @param type Fluid tank type. + * @param level [%] Fluid level in percentage of full tank. + * @param capacity [l] Fluid capacity left in tank in liters. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_fluid_level_send(mavlink_channel_t chan, uint64_t time_usec, uint8_t instance, uint8_t type, float level, float capacity) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_FLUID_LEVEL_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, level); + _mav_put_float(buf, 12, capacity); + _mav_put_uint8_t(buf, 16, instance); + _mav_put_uint8_t(buf, 17, type); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLUID_LEVEL, buf, MAVLINK_MSG_ID_FLUID_LEVEL_MIN_LEN, MAVLINK_MSG_ID_FLUID_LEVEL_LEN, MAVLINK_MSG_ID_FLUID_LEVEL_CRC); +#else + mavlink_fluid_level_t packet; + packet.time_usec = time_usec; + packet.level = level; + packet.capacity = capacity; + packet.instance = instance; + packet.type = type; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLUID_LEVEL, (const char *)&packet, MAVLINK_MSG_ID_FLUID_LEVEL_MIN_LEN, MAVLINK_MSG_ID_FLUID_LEVEL_LEN, MAVLINK_MSG_ID_FLUID_LEVEL_CRC); +#endif +} + +/** + * @brief Send a fluid_level message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_fluid_level_send_struct(mavlink_channel_t chan, const mavlink_fluid_level_t* fluid_level) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_fluid_level_send(chan, fluid_level->time_usec, fluid_level->instance, fluid_level->type, fluid_level->level, fluid_level->capacity); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLUID_LEVEL, (const char *)fluid_level, MAVLINK_MSG_ID_FLUID_LEVEL_MIN_LEN, MAVLINK_MSG_ID_FLUID_LEVEL_LEN, MAVLINK_MSG_ID_FLUID_LEVEL_CRC); +#endif +} + +#if MAVLINK_MSG_ID_FLUID_LEVEL_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_fluid_level_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint8_t instance, uint8_t type, float level, float capacity) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, level); + _mav_put_float(buf, 12, capacity); + _mav_put_uint8_t(buf, 16, instance); + _mav_put_uint8_t(buf, 17, type); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLUID_LEVEL, buf, MAVLINK_MSG_ID_FLUID_LEVEL_MIN_LEN, MAVLINK_MSG_ID_FLUID_LEVEL_LEN, MAVLINK_MSG_ID_FLUID_LEVEL_CRC); +#else + mavlink_fluid_level_t *packet = (mavlink_fluid_level_t *)msgbuf; + packet->time_usec = time_usec; + packet->level = level; + packet->capacity = capacity; + packet->instance = instance; + packet->type = type; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLUID_LEVEL, (const char *)packet, MAVLINK_MSG_ID_FLUID_LEVEL_MIN_LEN, MAVLINK_MSG_ID_FLUID_LEVEL_LEN, MAVLINK_MSG_ID_FLUID_LEVEL_CRC); +#endif +} +#endif + +#endif + +// MESSAGE FLUID_LEVEL UNPACKING + + +/** + * @brief Get field time_usec from fluid_level message + * + * @return [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + */ +static inline uint64_t mavlink_msg_fluid_level_get_time_usec(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 0); +} + +/** + * @brief Get field instance from fluid_level message + * + * @return Fluid tank instance. + */ +static inline uint8_t mavlink_msg_fluid_level_get_instance(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 16); +} + +/** + * @brief Get field type from fluid_level message + * + * @return Fluid tank type. + */ +static inline uint8_t mavlink_msg_fluid_level_get_type(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 17); +} + +/** + * @brief Get field level from fluid_level message + * + * @return [%] Fluid level in percentage of full tank. + */ +static inline float mavlink_msg_fluid_level_get_level(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 8); +} + +/** + * @brief Get field capacity from fluid_level message + * + * @return [l] Fluid capacity left in tank in liters. + */ +static inline float mavlink_msg_fluid_level_get_capacity(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 12); +} + +/** + * @brief Decode a fluid_level message into a struct + * + * @param msg The message to decode + * @param fluid_level C-struct to decode the message contents into + */ +static inline void mavlink_msg_fluid_level_decode(const mavlink_message_t* msg, mavlink_fluid_level_t* fluid_level) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + fluid_level->time_usec = mavlink_msg_fluid_level_get_time_usec(msg); + fluid_level->level = mavlink_msg_fluid_level_get_level(msg); + fluid_level->capacity = mavlink_msg_fluid_level_get_capacity(msg); + fluid_level->instance = mavlink_msg_fluid_level_get_instance(msg); + fluid_level->type = mavlink_msg_fluid_level_get_type(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_FLUID_LEVEL_LEN? msg->len : MAVLINK_MSG_ID_FLUID_LEVEL_LEN; + memset(fluid_level, 0, MAVLINK_MSG_ID_FLUID_LEVEL_LEN); + memcpy(fluid_level, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/auterion/mavlink_msg_global_position.h b/auterion/mavlink_msg_global_position.h new file mode 100644 index 000000000..bd5abd68c --- /dev/null +++ b/auterion/mavlink_msg_global_position.h @@ -0,0 +1,652 @@ +#pragma once +// MESSAGE GLOBAL_POSITION PACKING + +#define MAVLINK_MSG_ID_GLOBAL_POSITION 13296 + + +typedef struct __mavlink_global_position_t { + uint64_t time_usec; /*< [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.*/ + int32_t lat; /*< [degE7] Latitude (WGS84)*/ + int32_t lon; /*< [degE7] Longitude (WGS84)*/ + float alt; /*< [m] Altitude (MSL - position-system specific value)*/ + float alt_ellipsoid; /*< [m] Altitude (WGS84)*/ + float eph; /*< [m] Standard deviation of horizontal position error*/ + float epv; /*< [m] Standard deviation of vertical position error*/ + float vx; /*< [m/s] Ground X Speed (Latitude, positive north)*/ + float vy; /*< [m/s] Ground Y Speed (Longitude, positive east)*/ + float vz; /*< [m/s] Ground Z Speed (Altitude, positive down)*/ + float h_sacc; /*< [m/s] Standard deviation of horizontal velocity error*/ + float v_sacc; /*< [m/s] Standard deviation of vertical velocity error*/ + float hdg; /*< [deg] Vehicle heading (yaw angle). Range is 0.0..359.99 degrees relative to North.*/ + float hdg_acc; /*< [deg] Standard deviation of heading error*/ + uint8_t id; /*< Sensor ID*/ +} mavlink_global_position_t; + +#define MAVLINK_MSG_ID_GLOBAL_POSITION_LEN 61 +#define MAVLINK_MSG_ID_GLOBAL_POSITION_MIN_LEN 61 +#define MAVLINK_MSG_ID_13296_LEN 61 +#define MAVLINK_MSG_ID_13296_MIN_LEN 61 + +#define MAVLINK_MSG_ID_GLOBAL_POSITION_CRC 138 +#define MAVLINK_MSG_ID_13296_CRC 138 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_GLOBAL_POSITION { \ + 13296, \ + "GLOBAL_POSITION", \ + 15, \ + { { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 60, offsetof(mavlink_global_position_t, id) }, \ + { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_global_position_t, time_usec) }, \ + { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_global_position_t, lat) }, \ + { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_global_position_t, lon) }, \ + { "alt", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_global_position_t, alt) }, \ + { "alt_ellipsoid", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_global_position_t, alt_ellipsoid) }, \ + { "eph", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_global_position_t, eph) }, \ + { "epv", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_global_position_t, epv) }, \ + { "vx", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_global_position_t, vx) }, \ + { "vy", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_global_position_t, vy) }, \ + { "vz", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_global_position_t, vz) }, \ + { "h_sacc", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_global_position_t, h_sacc) }, \ + { "v_sacc", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_global_position_t, v_sacc) }, \ + { "hdg", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_global_position_t, hdg) }, \ + { "hdg_acc", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_global_position_t, hdg_acc) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_GLOBAL_POSITION { \ + "GLOBAL_POSITION", \ + 15, \ + { { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 60, offsetof(mavlink_global_position_t, id) }, \ + { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_global_position_t, time_usec) }, \ + { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_global_position_t, lat) }, \ + { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_global_position_t, lon) }, \ + { "alt", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_global_position_t, alt) }, \ + { "alt_ellipsoid", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_global_position_t, alt_ellipsoid) }, \ + { "eph", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_global_position_t, eph) }, \ + { "epv", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_global_position_t, epv) }, \ + { "vx", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_global_position_t, vx) }, \ + { "vy", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_global_position_t, vy) }, \ + { "vz", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_global_position_t, vz) }, \ + { "h_sacc", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_global_position_t, h_sacc) }, \ + { "v_sacc", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_global_position_t, v_sacc) }, \ + { "hdg", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_global_position_t, hdg) }, \ + { "hdg_acc", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_global_position_t, hdg_acc) }, \ + } \ +} +#endif + +/** + * @brief Pack a global_position message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param id Sensor ID + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param lat [degE7] Latitude (WGS84) + * @param lon [degE7] Longitude (WGS84) + * @param alt [m] Altitude (MSL - position-system specific value) + * @param alt_ellipsoid [m] Altitude (WGS84) + * @param eph [m] Standard deviation of horizontal position error + * @param epv [m] Standard deviation of vertical position error + * @param vx [m/s] Ground X Speed (Latitude, positive north) + * @param vy [m/s] Ground Y Speed (Longitude, positive east) + * @param vz [m/s] Ground Z Speed (Altitude, positive down) + * @param h_sacc [m/s] Standard deviation of horizontal velocity error + * @param v_sacc [m/s] Standard deviation of vertical velocity error + * @param hdg [deg] Vehicle heading (yaw angle). Range is 0.0..359.99 degrees relative to North. + * @param hdg_acc [deg] Standard deviation of heading error + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_global_position_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t id, uint64_t time_usec, int32_t lat, int32_t lon, float alt, float alt_ellipsoid, float eph, float epv, float vx, float vy, float vz, float h_sacc, float v_sacc, float hdg, float hdg_acc) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GLOBAL_POSITION_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_float(buf, 16, alt); + _mav_put_float(buf, 20, alt_ellipsoid); + _mav_put_float(buf, 24, eph); + _mav_put_float(buf, 28, epv); + _mav_put_float(buf, 32, vx); + _mav_put_float(buf, 36, vy); + _mav_put_float(buf, 40, vz); + _mav_put_float(buf, 44, h_sacc); + _mav_put_float(buf, 48, v_sacc); + _mav_put_float(buf, 52, hdg); + _mav_put_float(buf, 56, hdg_acc); + _mav_put_uint8_t(buf, 60, id); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GLOBAL_POSITION_LEN); +#else + mavlink_global_position_t packet; + packet.time_usec = time_usec; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.alt_ellipsoid = alt_ellipsoid; + packet.eph = eph; + packet.epv = epv; + packet.vx = vx; + packet.vy = vy; + packet.vz = vz; + packet.h_sacc = h_sacc; + packet.v_sacc = v_sacc; + packet.hdg = hdg; + packet.hdg_acc = hdg_acc; + packet.id = id; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_POSITION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GLOBAL_POSITION; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_CRC); +} + +/** + * @brief Pack a global_position message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param id Sensor ID + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param lat [degE7] Latitude (WGS84) + * @param lon [degE7] Longitude (WGS84) + * @param alt [m] Altitude (MSL - position-system specific value) + * @param alt_ellipsoid [m] Altitude (WGS84) + * @param eph [m] Standard deviation of horizontal position error + * @param epv [m] Standard deviation of vertical position error + * @param vx [m/s] Ground X Speed (Latitude, positive north) + * @param vy [m/s] Ground Y Speed (Longitude, positive east) + * @param vz [m/s] Ground Z Speed (Altitude, positive down) + * @param h_sacc [m/s] Standard deviation of horizontal velocity error + * @param v_sacc [m/s] Standard deviation of vertical velocity error + * @param hdg [deg] Vehicle heading (yaw angle). Range is 0.0..359.99 degrees relative to North. + * @param hdg_acc [deg] Standard deviation of heading error + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_global_position_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t id, uint64_t time_usec, int32_t lat, int32_t lon, float alt, float alt_ellipsoid, float eph, float epv, float vx, float vy, float vz, float h_sacc, float v_sacc, float hdg, float hdg_acc) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GLOBAL_POSITION_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_float(buf, 16, alt); + _mav_put_float(buf, 20, alt_ellipsoid); + _mav_put_float(buf, 24, eph); + _mav_put_float(buf, 28, epv); + _mav_put_float(buf, 32, vx); + _mav_put_float(buf, 36, vy); + _mav_put_float(buf, 40, vz); + _mav_put_float(buf, 44, h_sacc); + _mav_put_float(buf, 48, v_sacc); + _mav_put_float(buf, 52, hdg); + _mav_put_float(buf, 56, hdg_acc); + _mav_put_uint8_t(buf, 60, id); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GLOBAL_POSITION_LEN); +#else + mavlink_global_position_t packet; + packet.time_usec = time_usec; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.alt_ellipsoid = alt_ellipsoid; + packet.eph = eph; + packet.epv = epv; + packet.vx = vx; + packet.vy = vy; + packet.vz = vz; + packet.h_sacc = h_sacc; + packet.v_sacc = v_sacc; + packet.hdg = hdg; + packet.hdg_acc = hdg_acc; + packet.id = id; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_POSITION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GLOBAL_POSITION; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_LEN); +#endif +} + +/** + * @brief Pack a global_position message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param id Sensor ID + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param lat [degE7] Latitude (WGS84) + * @param lon [degE7] Longitude (WGS84) + * @param alt [m] Altitude (MSL - position-system specific value) + * @param alt_ellipsoid [m] Altitude (WGS84) + * @param eph [m] Standard deviation of horizontal position error + * @param epv [m] Standard deviation of vertical position error + * @param vx [m/s] Ground X Speed (Latitude, positive north) + * @param vy [m/s] Ground Y Speed (Longitude, positive east) + * @param vz [m/s] Ground Z Speed (Altitude, positive down) + * @param h_sacc [m/s] Standard deviation of horizontal velocity error + * @param v_sacc [m/s] Standard deviation of vertical velocity error + * @param hdg [deg] Vehicle heading (yaw angle). Range is 0.0..359.99 degrees relative to North. + * @param hdg_acc [deg] Standard deviation of heading error + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_global_position_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t id,uint64_t time_usec,int32_t lat,int32_t lon,float alt,float alt_ellipsoid,float eph,float epv,float vx,float vy,float vz,float h_sacc,float v_sacc,float hdg,float hdg_acc) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GLOBAL_POSITION_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_float(buf, 16, alt); + _mav_put_float(buf, 20, alt_ellipsoid); + _mav_put_float(buf, 24, eph); + _mav_put_float(buf, 28, epv); + _mav_put_float(buf, 32, vx); + _mav_put_float(buf, 36, vy); + _mav_put_float(buf, 40, vz); + _mav_put_float(buf, 44, h_sacc); + _mav_put_float(buf, 48, v_sacc); + _mav_put_float(buf, 52, hdg); + _mav_put_float(buf, 56, hdg_acc); + _mav_put_uint8_t(buf, 60, id); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GLOBAL_POSITION_LEN); +#else + mavlink_global_position_t packet; + packet.time_usec = time_usec; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.alt_ellipsoid = alt_ellipsoid; + packet.eph = eph; + packet.epv = epv; + packet.vx = vx; + packet.vy = vy; + packet.vz = vz; + packet.h_sacc = h_sacc; + packet.v_sacc = v_sacc; + packet.hdg = hdg; + packet.hdg_acc = hdg_acc; + packet.id = id; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_POSITION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GLOBAL_POSITION; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_CRC); +} + +/** + * @brief Encode a global_position struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param global_position C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_global_position_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_global_position_t* global_position) +{ + return mavlink_msg_global_position_pack(system_id, component_id, msg, global_position->id, global_position->time_usec, global_position->lat, global_position->lon, global_position->alt, global_position->alt_ellipsoid, global_position->eph, global_position->epv, global_position->vx, global_position->vy, global_position->vz, global_position->h_sacc, global_position->v_sacc, global_position->hdg, global_position->hdg_acc); +} + +/** + * @brief Encode a global_position struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param global_position C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_global_position_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_global_position_t* global_position) +{ + return mavlink_msg_global_position_pack_chan(system_id, component_id, chan, msg, global_position->id, global_position->time_usec, global_position->lat, global_position->lon, global_position->alt, global_position->alt_ellipsoid, global_position->eph, global_position->epv, global_position->vx, global_position->vy, global_position->vz, global_position->h_sacc, global_position->v_sacc, global_position->hdg, global_position->hdg_acc); +} + +/** + * @brief Encode a global_position struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param global_position C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_global_position_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_global_position_t* global_position) +{ + return mavlink_msg_global_position_pack_status(system_id, component_id, _status, msg, global_position->id, global_position->time_usec, global_position->lat, global_position->lon, global_position->alt, global_position->alt_ellipsoid, global_position->eph, global_position->epv, global_position->vx, global_position->vy, global_position->vz, global_position->h_sacc, global_position->v_sacc, global_position->hdg, global_position->hdg_acc); +} + +/** + * @brief Send a global_position message + * @param chan MAVLink channel to send the message + * + * @param id Sensor ID + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param lat [degE7] Latitude (WGS84) + * @param lon [degE7] Longitude (WGS84) + * @param alt [m] Altitude (MSL - position-system specific value) + * @param alt_ellipsoid [m] Altitude (WGS84) + * @param eph [m] Standard deviation of horizontal position error + * @param epv [m] Standard deviation of vertical position error + * @param vx [m/s] Ground X Speed (Latitude, positive north) + * @param vy [m/s] Ground Y Speed (Longitude, positive east) + * @param vz [m/s] Ground Z Speed (Altitude, positive down) + * @param h_sacc [m/s] Standard deviation of horizontal velocity error + * @param v_sacc [m/s] Standard deviation of vertical velocity error + * @param hdg [deg] Vehicle heading (yaw angle). Range is 0.0..359.99 degrees relative to North. + * @param hdg_acc [deg] Standard deviation of heading error + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_global_position_send(mavlink_channel_t chan, uint8_t id, uint64_t time_usec, int32_t lat, int32_t lon, float alt, float alt_ellipsoid, float eph, float epv, float vx, float vy, float vz, float h_sacc, float v_sacc, float hdg, float hdg_acc) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GLOBAL_POSITION_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_float(buf, 16, alt); + _mav_put_float(buf, 20, alt_ellipsoid); + _mav_put_float(buf, 24, eph); + _mav_put_float(buf, 28, epv); + _mav_put_float(buf, 32, vx); + _mav_put_float(buf, 36, vy); + _mav_put_float(buf, 40, vz); + _mav_put_float(buf, 44, h_sacc); + _mav_put_float(buf, 48, v_sacc); + _mav_put_float(buf, 52, hdg); + _mav_put_float(buf, 56, hdg_acc); + _mav_put_uint8_t(buf, 60, id); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION, buf, MAVLINK_MSG_ID_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_CRC); +#else + mavlink_global_position_t packet; + packet.time_usec = time_usec; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.alt_ellipsoid = alt_ellipsoid; + packet.eph = eph; + packet.epv = epv; + packet.vx = vx; + packet.vy = vy; + packet.vz = vz; + packet.h_sacc = h_sacc; + packet.v_sacc = v_sacc; + packet.hdg = hdg; + packet.hdg_acc = hdg_acc; + packet.id = id; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION, (const char *)&packet, MAVLINK_MSG_ID_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_CRC); +#endif +} + +/** + * @brief Send a global_position message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_global_position_send_struct(mavlink_channel_t chan, const mavlink_global_position_t* global_position) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_global_position_send(chan, global_position->id, global_position->time_usec, global_position->lat, global_position->lon, global_position->alt, global_position->alt_ellipsoid, global_position->eph, global_position->epv, global_position->vx, global_position->vy, global_position->vz, global_position->h_sacc, global_position->v_sacc, global_position->hdg, global_position->hdg_acc); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION, (const char *)global_position, MAVLINK_MSG_ID_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_CRC); +#endif +} + +#if MAVLINK_MSG_ID_GLOBAL_POSITION_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by re-using + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_global_position_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t id, uint64_t time_usec, int32_t lat, int32_t lon, float alt, float alt_ellipsoid, float eph, float epv, float vx, float vy, float vz, float h_sacc, float v_sacc, float hdg, float hdg_acc) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_float(buf, 16, alt); + _mav_put_float(buf, 20, alt_ellipsoid); + _mav_put_float(buf, 24, eph); + _mav_put_float(buf, 28, epv); + _mav_put_float(buf, 32, vx); + _mav_put_float(buf, 36, vy); + _mav_put_float(buf, 40, vz); + _mav_put_float(buf, 44, h_sacc); + _mav_put_float(buf, 48, v_sacc); + _mav_put_float(buf, 52, hdg); + _mav_put_float(buf, 56, hdg_acc); + _mav_put_uint8_t(buf, 60, id); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION, buf, MAVLINK_MSG_ID_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_CRC); +#else + mavlink_global_position_t *packet = (mavlink_global_position_t *)msgbuf; + packet->time_usec = time_usec; + packet->lat = lat; + packet->lon = lon; + packet->alt = alt; + packet->alt_ellipsoid = alt_ellipsoid; + packet->eph = eph; + packet->epv = epv; + packet->vx = vx; + packet->vy = vy; + packet->vz = vz; + packet->h_sacc = h_sacc; + packet->v_sacc = v_sacc; + packet->hdg = hdg; + packet->hdg_acc = hdg_acc; + packet->id = id; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION, (const char *)packet, MAVLINK_MSG_ID_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_CRC); +#endif +} +#endif + +#endif + +// MESSAGE GLOBAL_POSITION UNPACKING + + +/** + * @brief Get field id from global_position message + * + * @return Sensor ID + */ +static inline uint8_t mavlink_msg_global_position_get_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 60); +} + +/** + * @brief Get field time_usec from global_position message + * + * @return [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + */ +static inline uint64_t mavlink_msg_global_position_get_time_usec(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 0); +} + +/** + * @brief Get field lat from global_position message + * + * @return [degE7] Latitude (WGS84) + */ +static inline int32_t mavlink_msg_global_position_get_lat(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 8); +} + +/** + * @brief Get field lon from global_position message + * + * @return [degE7] Longitude (WGS84) + */ +static inline int32_t mavlink_msg_global_position_get_lon(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 12); +} + +/** + * @brief Get field alt from global_position message + * + * @return [m] Altitude (MSL - position-system specific value) + */ +static inline float mavlink_msg_global_position_get_alt(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 16); +} + +/** + * @brief Get field alt_ellipsoid from global_position message + * + * @return [m] Altitude (WGS84) + */ +static inline float mavlink_msg_global_position_get_alt_ellipsoid(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 20); +} + +/** + * @brief Get field eph from global_position message + * + * @return [m] Standard deviation of horizontal position error + */ +static inline float mavlink_msg_global_position_get_eph(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 24); +} + +/** + * @brief Get field epv from global_position message + * + * @return [m] Standard deviation of vertical position error + */ +static inline float mavlink_msg_global_position_get_epv(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 28); +} + +/** + * @brief Get field vx from global_position message + * + * @return [m/s] Ground X Speed (Latitude, positive north) + */ +static inline float mavlink_msg_global_position_get_vx(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 32); +} + +/** + * @brief Get field vy from global_position message + * + * @return [m/s] Ground Y Speed (Longitude, positive east) + */ +static inline float mavlink_msg_global_position_get_vy(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 36); +} + +/** + * @brief Get field vz from global_position message + * + * @return [m/s] Ground Z Speed (Altitude, positive down) + */ +static inline float mavlink_msg_global_position_get_vz(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 40); +} + +/** + * @brief Get field h_sacc from global_position message + * + * @return [m/s] Standard deviation of horizontal velocity error + */ +static inline float mavlink_msg_global_position_get_h_sacc(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 44); +} + +/** + * @brief Get field v_sacc from global_position message + * + * @return [m/s] Standard deviation of vertical velocity error + */ +static inline float mavlink_msg_global_position_get_v_sacc(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 48); +} + +/** + * @brief Get field hdg from global_position message + * + * @return [deg] Vehicle heading (yaw angle). Range is 0.0..359.99 degrees relative to North. + */ +static inline float mavlink_msg_global_position_get_hdg(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 52); +} + +/** + * @brief Get field hdg_acc from global_position message + * + * @return [deg] Standard deviation of heading error + */ +static inline float mavlink_msg_global_position_get_hdg_acc(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 56); +} + +/** + * @brief Decode a global_position message into a struct + * + * @param msg The message to decode + * @param global_position C-struct to decode the message contents into + */ +static inline void mavlink_msg_global_position_decode(const mavlink_message_t* msg, mavlink_global_position_t* global_position) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + global_position->time_usec = mavlink_msg_global_position_get_time_usec(msg); + global_position->lat = mavlink_msg_global_position_get_lat(msg); + global_position->lon = mavlink_msg_global_position_get_lon(msg); + global_position->alt = mavlink_msg_global_position_get_alt(msg); + global_position->alt_ellipsoid = mavlink_msg_global_position_get_alt_ellipsoid(msg); + global_position->eph = mavlink_msg_global_position_get_eph(msg); + global_position->epv = mavlink_msg_global_position_get_epv(msg); + global_position->vx = mavlink_msg_global_position_get_vx(msg); + global_position->vy = mavlink_msg_global_position_get_vy(msg); + global_position->vz = mavlink_msg_global_position_get_vz(msg); + global_position->h_sacc = mavlink_msg_global_position_get_h_sacc(msg); + global_position->v_sacc = mavlink_msg_global_position_get_v_sacc(msg); + global_position->hdg = mavlink_msg_global_position_get_hdg(msg); + global_position->hdg_acc = mavlink_msg_global_position_get_hdg_acc(msg); + global_position->id = mavlink_msg_global_position_get_id(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_GLOBAL_POSITION_LEN? msg->len : MAVLINK_MSG_ID_GLOBAL_POSITION_LEN; + memset(global_position, 0, MAVLINK_MSG_ID_GLOBAL_POSITION_LEN); + memcpy(global_position, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/auterion/mavlink_msg_handoff_respond.h b/auterion/mavlink_msg_handoff_respond.h new file mode 100644 index 000000000..2659383a5 --- /dev/null +++ b/auterion/mavlink_msg_handoff_respond.h @@ -0,0 +1,288 @@ +#pragma once +// MESSAGE HANDOFF_RESPOND PACKING + +#define MAVLINK_MSG_ID_HANDOFF_RESPOND 13446 + + +typedef struct __mavlink_handoff_respond_t { + uint8_t control_target; /*< Control target to handoff.*/ + uint8_t handoff_decision; /*< Control target decision.*/ +} mavlink_handoff_respond_t; + +#define MAVLINK_MSG_ID_HANDOFF_RESPOND_LEN 2 +#define MAVLINK_MSG_ID_HANDOFF_RESPOND_MIN_LEN 2 +#define MAVLINK_MSG_ID_13446_LEN 2 +#define MAVLINK_MSG_ID_13446_MIN_LEN 2 + +#define MAVLINK_MSG_ID_HANDOFF_RESPOND_CRC 47 +#define MAVLINK_MSG_ID_13446_CRC 47 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_HANDOFF_RESPOND { \ + 13446, \ + "HANDOFF_RESPOND", \ + 2, \ + { { "control_target", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_handoff_respond_t, control_target) }, \ + { "handoff_decision", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_handoff_respond_t, handoff_decision) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_HANDOFF_RESPOND { \ + "HANDOFF_RESPOND", \ + 2, \ + { { "control_target", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_handoff_respond_t, control_target) }, \ + { "handoff_decision", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_handoff_respond_t, handoff_decision) }, \ + } \ +} +#endif + +/** + * @brief Pack a handoff_respond message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param control_target Control target to handoff. + * @param handoff_decision Control target decision. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_handoff_respond_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t control_target, uint8_t handoff_decision) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_HANDOFF_RESPOND_LEN]; + _mav_put_uint8_t(buf, 0, control_target); + _mav_put_uint8_t(buf, 1, handoff_decision); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HANDOFF_RESPOND_LEN); +#else + mavlink_handoff_respond_t packet; + packet.control_target = control_target; + packet.handoff_decision = handoff_decision; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HANDOFF_RESPOND_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_HANDOFF_RESPOND; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HANDOFF_RESPOND_MIN_LEN, MAVLINK_MSG_ID_HANDOFF_RESPOND_LEN, MAVLINK_MSG_ID_HANDOFF_RESPOND_CRC); +} + +/** + * @brief Pack a handoff_respond message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param control_target Control target to handoff. + * @param handoff_decision Control target decision. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_handoff_respond_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t control_target, uint8_t handoff_decision) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_HANDOFF_RESPOND_LEN]; + _mav_put_uint8_t(buf, 0, control_target); + _mav_put_uint8_t(buf, 1, handoff_decision); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HANDOFF_RESPOND_LEN); +#else + mavlink_handoff_respond_t packet; + packet.control_target = control_target; + packet.handoff_decision = handoff_decision; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HANDOFF_RESPOND_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_HANDOFF_RESPOND; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HANDOFF_RESPOND_MIN_LEN, MAVLINK_MSG_ID_HANDOFF_RESPOND_LEN, MAVLINK_MSG_ID_HANDOFF_RESPOND_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HANDOFF_RESPOND_MIN_LEN, MAVLINK_MSG_ID_HANDOFF_RESPOND_LEN); +#endif +} + +/** + * @brief Pack a handoff_respond message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param control_target Control target to handoff. + * @param handoff_decision Control target decision. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_handoff_respond_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t control_target,uint8_t handoff_decision) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_HANDOFF_RESPOND_LEN]; + _mav_put_uint8_t(buf, 0, control_target); + _mav_put_uint8_t(buf, 1, handoff_decision); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HANDOFF_RESPOND_LEN); +#else + mavlink_handoff_respond_t packet; + packet.control_target = control_target; + packet.handoff_decision = handoff_decision; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HANDOFF_RESPOND_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_HANDOFF_RESPOND; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HANDOFF_RESPOND_MIN_LEN, MAVLINK_MSG_ID_HANDOFF_RESPOND_LEN, MAVLINK_MSG_ID_HANDOFF_RESPOND_CRC); +} + +/** + * @brief Encode a handoff_respond struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param handoff_respond C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_handoff_respond_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_handoff_respond_t* handoff_respond) +{ + return mavlink_msg_handoff_respond_pack(system_id, component_id, msg, handoff_respond->control_target, handoff_respond->handoff_decision); +} + +/** + * @brief Encode a handoff_respond struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param handoff_respond C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_handoff_respond_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_handoff_respond_t* handoff_respond) +{ + return mavlink_msg_handoff_respond_pack_chan(system_id, component_id, chan, msg, handoff_respond->control_target, handoff_respond->handoff_decision); +} + +/** + * @brief Encode a handoff_respond struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param handoff_respond C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_handoff_respond_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_handoff_respond_t* handoff_respond) +{ + return mavlink_msg_handoff_respond_pack_status(system_id, component_id, _status, msg, handoff_respond->control_target, handoff_respond->handoff_decision); +} + +/** + * @brief Send a handoff_respond message + * @param chan MAVLink channel to send the message + * + * @param control_target Control target to handoff. + * @param handoff_decision Control target decision. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_handoff_respond_send(mavlink_channel_t chan, uint8_t control_target, uint8_t handoff_decision) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_HANDOFF_RESPOND_LEN]; + _mav_put_uint8_t(buf, 0, control_target); + _mav_put_uint8_t(buf, 1, handoff_decision); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HANDOFF_RESPOND, buf, MAVLINK_MSG_ID_HANDOFF_RESPOND_MIN_LEN, MAVLINK_MSG_ID_HANDOFF_RESPOND_LEN, MAVLINK_MSG_ID_HANDOFF_RESPOND_CRC); +#else + mavlink_handoff_respond_t packet; + packet.control_target = control_target; + packet.handoff_decision = handoff_decision; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HANDOFF_RESPOND, (const char *)&packet, MAVLINK_MSG_ID_HANDOFF_RESPOND_MIN_LEN, MAVLINK_MSG_ID_HANDOFF_RESPOND_LEN, MAVLINK_MSG_ID_HANDOFF_RESPOND_CRC); +#endif +} + +/** + * @brief Send a handoff_respond message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_handoff_respond_send_struct(mavlink_channel_t chan, const mavlink_handoff_respond_t* handoff_respond) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_handoff_respond_send(chan, handoff_respond->control_target, handoff_respond->handoff_decision); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HANDOFF_RESPOND, (const char *)handoff_respond, MAVLINK_MSG_ID_HANDOFF_RESPOND_MIN_LEN, MAVLINK_MSG_ID_HANDOFF_RESPOND_LEN, MAVLINK_MSG_ID_HANDOFF_RESPOND_CRC); +#endif +} + +#if MAVLINK_MSG_ID_HANDOFF_RESPOND_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_handoff_respond_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t control_target, uint8_t handoff_decision) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint8_t(buf, 0, control_target); + _mav_put_uint8_t(buf, 1, handoff_decision); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HANDOFF_RESPOND, buf, MAVLINK_MSG_ID_HANDOFF_RESPOND_MIN_LEN, MAVLINK_MSG_ID_HANDOFF_RESPOND_LEN, MAVLINK_MSG_ID_HANDOFF_RESPOND_CRC); +#else + mavlink_handoff_respond_t *packet = (mavlink_handoff_respond_t *)msgbuf; + packet->control_target = control_target; + packet->handoff_decision = handoff_decision; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HANDOFF_RESPOND, (const char *)packet, MAVLINK_MSG_ID_HANDOFF_RESPOND_MIN_LEN, MAVLINK_MSG_ID_HANDOFF_RESPOND_LEN, MAVLINK_MSG_ID_HANDOFF_RESPOND_CRC); +#endif +} +#endif + +#endif + +// MESSAGE HANDOFF_RESPOND UNPACKING + + +/** + * @brief Get field control_target from handoff_respond message + * + * @return Control target to handoff. + */ +static inline uint8_t mavlink_msg_handoff_respond_get_control_target(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 0); +} + +/** + * @brief Get field handoff_decision from handoff_respond message + * + * @return Control target decision. + */ +static inline uint8_t mavlink_msg_handoff_respond_get_handoff_decision(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 1); +} + +/** + * @brief Decode a handoff_respond message into a struct + * + * @param msg The message to decode + * @param handoff_respond C-struct to decode the message contents into + */ +static inline void mavlink_msg_handoff_respond_decode(const mavlink_message_t* msg, mavlink_handoff_respond_t* handoff_respond) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + handoff_respond->control_target = mavlink_msg_handoff_respond_get_control_target(msg); + handoff_respond->handoff_decision = mavlink_msg_handoff_respond_get_handoff_decision(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_HANDOFF_RESPOND_LEN? msg->len : MAVLINK_MSG_ID_HANDOFF_RESPOND_LEN; + memset(handoff_respond, 0, MAVLINK_MSG_ID_HANDOFF_RESPOND_LEN); + memcpy(handoff_respond, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/auterion/mavlink_msg_joystick_state.h b/auterion/mavlink_msg_joystick_state.h new file mode 100644 index 000000000..bcd3acec6 --- /dev/null +++ b/auterion/mavlink_msg_joystick_state.h @@ -0,0 +1,335 @@ +#pragma once +// MESSAGE JOYSTICK_STATE PACKING + +#define MAVLINK_MSG_ID_JOYSTICK_STATE 513 + + +typedef struct __mavlink_joystick_state_t { + uint64_t time_usec; /*< [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.*/ + uint16_t axis_value[10]; /*< Value of each joystick axis*/ + uint8_t type; /*< Type of the MAV (quadrotor, helicopter, etc.), MAV_TYPE_JOYSTICK = 43*/ + uint8_t button_value[20]; /*< Value of each joystick button*/ +} mavlink_joystick_state_t; + +#define MAVLINK_MSG_ID_JOYSTICK_STATE_LEN 49 +#define MAVLINK_MSG_ID_JOYSTICK_STATE_MIN_LEN 49 +#define MAVLINK_MSG_ID_513_LEN 49 +#define MAVLINK_MSG_ID_513_MIN_LEN 49 + +#define MAVLINK_MSG_ID_JOYSTICK_STATE_CRC 138 +#define MAVLINK_MSG_ID_513_CRC 138 + +#define MAVLINK_MSG_JOYSTICK_STATE_FIELD_AXIS_VALUE_LEN 10 +#define MAVLINK_MSG_JOYSTICK_STATE_FIELD_BUTTON_VALUE_LEN 20 + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_JOYSTICK_STATE { \ + 513, \ + "JOYSTICK_STATE", \ + 4, \ + { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_joystick_state_t, time_usec) }, \ + { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_joystick_state_t, type) }, \ + { "axis_value", NULL, MAVLINK_TYPE_UINT16_T, 10, 8, offsetof(mavlink_joystick_state_t, axis_value) }, \ + { "button_value", NULL, MAVLINK_TYPE_UINT8_T, 20, 29, offsetof(mavlink_joystick_state_t, button_value) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_JOYSTICK_STATE { \ + "JOYSTICK_STATE", \ + 4, \ + { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_joystick_state_t, time_usec) }, \ + { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_joystick_state_t, type) }, \ + { "axis_value", NULL, MAVLINK_TYPE_UINT16_T, 10, 8, offsetof(mavlink_joystick_state_t, axis_value) }, \ + { "button_value", NULL, MAVLINK_TYPE_UINT8_T, 20, 29, offsetof(mavlink_joystick_state_t, button_value) }, \ + } \ +} +#endif + +/** + * @brief Pack a joystick_state message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param type Type of the MAV (quadrotor, helicopter, etc.), MAV_TYPE_JOYSTICK = 43 + * @param axis_value Value of each joystick axis + * @param button_value Value of each joystick button + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_joystick_state_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint64_t time_usec, uint8_t type, const uint16_t *axis_value, const uint8_t *button_value) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_JOYSTICK_STATE_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint8_t(buf, 28, type); + _mav_put_uint16_t_array(buf, 8, axis_value, 10); + _mav_put_uint8_t_array(buf, 29, button_value, 20); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_JOYSTICK_STATE_LEN); +#else + mavlink_joystick_state_t packet; + packet.time_usec = time_usec; + packet.type = type; + mav_array_assign_uint16_t(packet.axis_value, axis_value, 10); + mav_array_assign_uint8_t(packet.button_value, button_value, 20); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_JOYSTICK_STATE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_JOYSTICK_STATE; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_JOYSTICK_STATE_MIN_LEN, MAVLINK_MSG_ID_JOYSTICK_STATE_LEN, MAVLINK_MSG_ID_JOYSTICK_STATE_CRC); +} + +/** + * @brief Pack a joystick_state message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param type Type of the MAV (quadrotor, helicopter, etc.), MAV_TYPE_JOYSTICK = 43 + * @param axis_value Value of each joystick axis + * @param button_value Value of each joystick button + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_joystick_state_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, uint8_t type, const uint16_t *axis_value, const uint8_t *button_value) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_JOYSTICK_STATE_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint8_t(buf, 28, type); + _mav_put_uint16_t_array(buf, 8, axis_value, 10); + _mav_put_uint8_t_array(buf, 29, button_value, 20); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_JOYSTICK_STATE_LEN); +#else + mavlink_joystick_state_t packet; + packet.time_usec = time_usec; + packet.type = type; + mav_array_memcpy(packet.axis_value, axis_value, sizeof(uint16_t)*10); + mav_array_memcpy(packet.button_value, button_value, sizeof(uint8_t)*20); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_JOYSTICK_STATE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_JOYSTICK_STATE; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_JOYSTICK_STATE_MIN_LEN, MAVLINK_MSG_ID_JOYSTICK_STATE_LEN, MAVLINK_MSG_ID_JOYSTICK_STATE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_JOYSTICK_STATE_MIN_LEN, MAVLINK_MSG_ID_JOYSTICK_STATE_LEN); +#endif +} + +/** + * @brief Pack a joystick_state message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param type Type of the MAV (quadrotor, helicopter, etc.), MAV_TYPE_JOYSTICK = 43 + * @param axis_value Value of each joystick axis + * @param button_value Value of each joystick button + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_joystick_state_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint64_t time_usec,uint8_t type,const uint16_t *axis_value,const uint8_t *button_value) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_JOYSTICK_STATE_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint8_t(buf, 28, type); + _mav_put_uint16_t_array(buf, 8, axis_value, 10); + _mav_put_uint8_t_array(buf, 29, button_value, 20); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_JOYSTICK_STATE_LEN); +#else + mavlink_joystick_state_t packet; + packet.time_usec = time_usec; + packet.type = type; + mav_array_assign_uint16_t(packet.axis_value, axis_value, 10); + mav_array_assign_uint8_t(packet.button_value, button_value, 20); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_JOYSTICK_STATE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_JOYSTICK_STATE; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_JOYSTICK_STATE_MIN_LEN, MAVLINK_MSG_ID_JOYSTICK_STATE_LEN, MAVLINK_MSG_ID_JOYSTICK_STATE_CRC); +} + +/** + * @brief Encode a joystick_state struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param joystick_state C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_joystick_state_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_joystick_state_t* joystick_state) +{ + return mavlink_msg_joystick_state_pack(system_id, component_id, msg, joystick_state->time_usec, joystick_state->type, joystick_state->axis_value, joystick_state->button_value); +} + +/** + * @brief Encode a joystick_state struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param joystick_state C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_joystick_state_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_joystick_state_t* joystick_state) +{ + return mavlink_msg_joystick_state_pack_chan(system_id, component_id, chan, msg, joystick_state->time_usec, joystick_state->type, joystick_state->axis_value, joystick_state->button_value); +} + +/** + * @brief Encode a joystick_state struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param joystick_state C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_joystick_state_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_joystick_state_t* joystick_state) +{ + return mavlink_msg_joystick_state_pack_status(system_id, component_id, _status, msg, joystick_state->time_usec, joystick_state->type, joystick_state->axis_value, joystick_state->button_value); +} + +/** + * @brief Send a joystick_state message + * @param chan MAVLink channel to send the message + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param type Type of the MAV (quadrotor, helicopter, etc.), MAV_TYPE_JOYSTICK = 43 + * @param axis_value Value of each joystick axis + * @param button_value Value of each joystick button + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_joystick_state_send(mavlink_channel_t chan, uint64_t time_usec, uint8_t type, const uint16_t *axis_value, const uint8_t *button_value) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_JOYSTICK_STATE_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint8_t(buf, 28, type); + _mav_put_uint16_t_array(buf, 8, axis_value, 10); + _mav_put_uint8_t_array(buf, 29, button_value, 20); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_JOYSTICK_STATE, buf, MAVLINK_MSG_ID_JOYSTICK_STATE_MIN_LEN, MAVLINK_MSG_ID_JOYSTICK_STATE_LEN, MAVLINK_MSG_ID_JOYSTICK_STATE_CRC); +#else + mavlink_joystick_state_t packet; + packet.time_usec = time_usec; + packet.type = type; + mav_array_assign_uint16_t(packet.axis_value, axis_value, 10); + mav_array_assign_uint8_t(packet.button_value, button_value, 20); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_JOYSTICK_STATE, (const char *)&packet, MAVLINK_MSG_ID_JOYSTICK_STATE_MIN_LEN, MAVLINK_MSG_ID_JOYSTICK_STATE_LEN, MAVLINK_MSG_ID_JOYSTICK_STATE_CRC); +#endif +} + +/** + * @brief Send a joystick_state message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_joystick_state_send_struct(mavlink_channel_t chan, const mavlink_joystick_state_t* joystick_state) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_joystick_state_send(chan, joystick_state->time_usec, joystick_state->type, joystick_state->axis_value, joystick_state->button_value); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_JOYSTICK_STATE, (const char *)joystick_state, MAVLINK_MSG_ID_JOYSTICK_STATE_MIN_LEN, MAVLINK_MSG_ID_JOYSTICK_STATE_LEN, MAVLINK_MSG_ID_JOYSTICK_STATE_CRC); +#endif +} + +#if MAVLINK_MSG_ID_JOYSTICK_STATE_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_joystick_state_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint8_t type, const uint16_t *axis_value, const uint8_t *button_value) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint8_t(buf, 28, type); + _mav_put_uint16_t_array(buf, 8, axis_value, 10); + _mav_put_uint8_t_array(buf, 29, button_value, 20); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_JOYSTICK_STATE, buf, MAVLINK_MSG_ID_JOYSTICK_STATE_MIN_LEN, MAVLINK_MSG_ID_JOYSTICK_STATE_LEN, MAVLINK_MSG_ID_JOYSTICK_STATE_CRC); +#else + mavlink_joystick_state_t *packet = (mavlink_joystick_state_t *)msgbuf; + packet->time_usec = time_usec; + packet->type = type; + mav_array_assign_uint16_t(packet->axis_value, axis_value, 10); + mav_array_assign_uint8_t(packet->button_value, button_value, 20); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_JOYSTICK_STATE, (const char *)packet, MAVLINK_MSG_ID_JOYSTICK_STATE_MIN_LEN, MAVLINK_MSG_ID_JOYSTICK_STATE_LEN, MAVLINK_MSG_ID_JOYSTICK_STATE_CRC); +#endif +} +#endif + +#endif + +// MESSAGE JOYSTICK_STATE UNPACKING + + +/** + * @brief Get field time_usec from joystick_state message + * + * @return [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + */ +static inline uint64_t mavlink_msg_joystick_state_get_time_usec(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 0); +} + +/** + * @brief Get field type from joystick_state message + * + * @return Type of the MAV (quadrotor, helicopter, etc.), MAV_TYPE_JOYSTICK = 43 + */ +static inline uint8_t mavlink_msg_joystick_state_get_type(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 28); +} + +/** + * @brief Get field axis_value from joystick_state message + * + * @return Value of each joystick axis + */ +static inline uint16_t mavlink_msg_joystick_state_get_axis_value(const mavlink_message_t* msg, uint16_t *axis_value) +{ + return _MAV_RETURN_uint16_t_array(msg, axis_value, 10, 8); +} + +/** + * @brief Get field button_value from joystick_state message + * + * @return Value of each joystick button + */ +static inline uint16_t mavlink_msg_joystick_state_get_button_value(const mavlink_message_t* msg, uint8_t *button_value) +{ + return _MAV_RETURN_uint8_t_array(msg, button_value, 20, 29); +} + +/** + * @brief Decode a joystick_state message into a struct + * + * @param msg The message to decode + * @param joystick_state C-struct to decode the message contents into + */ +static inline void mavlink_msg_joystick_state_decode(const mavlink_message_t* msg, mavlink_joystick_state_t* joystick_state) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + joystick_state->time_usec = mavlink_msg_joystick_state_get_time_usec(msg); + mavlink_msg_joystick_state_get_axis_value(msg, joystick_state->axis_value); + joystick_state->type = mavlink_msg_joystick_state_get_type(msg); + mavlink_msg_joystick_state_get_button_value(msg, joystick_state->button_value); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_JOYSTICK_STATE_LEN? msg->len : MAVLINK_MSG_ID_JOYSTICK_STATE_LEN; + memset(joystick_state, 0, MAVLINK_MSG_ID_JOYSTICK_STATE_LEN); + memcpy(joystick_state, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/auterion/mavlink_msg_motor_info.h b/auterion/mavlink_msg_motor_info.h new file mode 100644 index 000000000..45653b2d1 --- /dev/null +++ b/auterion/mavlink_msg_motor_info.h @@ -0,0 +1,344 @@ +#pragma once +// MESSAGE MOTOR_INFO PACKING + +#define MAVLINK_MSG_ID_MOTOR_INFO 13000 + + +typedef struct __mavlink_motor_info_t { + uint64_t total_time; /*< [s] Total accumulated usage time*/ + int16_t temperature; /*< [cdegC] Temperature of motor. INT16_MAX if unknown.*/ + uint8_t index; /*< Motor index number starting with index 1. 0 if unknown. */ + uint8_t type; /*< The type of motor, TODO: define an enum */ +} mavlink_motor_info_t; + +#define MAVLINK_MSG_ID_MOTOR_INFO_LEN 12 +#define MAVLINK_MSG_ID_MOTOR_INFO_MIN_LEN 12 +#define MAVLINK_MSG_ID_13000_LEN 12 +#define MAVLINK_MSG_ID_13000_MIN_LEN 12 + +#define MAVLINK_MSG_ID_MOTOR_INFO_CRC 8 +#define MAVLINK_MSG_ID_13000_CRC 8 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_MOTOR_INFO { \ + 13000, \ + "MOTOR_INFO", \ + 4, \ + { { "index", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_motor_info_t, index) }, \ + { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_motor_info_t, type) }, \ + { "total_time", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_motor_info_t, total_time) }, \ + { "temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_motor_info_t, temperature) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_MOTOR_INFO { \ + "MOTOR_INFO", \ + 4, \ + { { "index", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_motor_info_t, index) }, \ + { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_motor_info_t, type) }, \ + { "total_time", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_motor_info_t, total_time) }, \ + { "temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_motor_info_t, temperature) }, \ + } \ +} +#endif + +/** + * @brief Pack a motor_info message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param index Motor index number starting with index 1. 0 if unknown. + * @param type The type of motor, TODO: define an enum + * @param total_time [s] Total accumulated usage time + * @param temperature [cdegC] Temperature of motor. INT16_MAX if unknown. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_motor_info_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t index, uint8_t type, uint64_t total_time, int16_t temperature) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_MOTOR_INFO_LEN]; + _mav_put_uint64_t(buf, 0, total_time); + _mav_put_int16_t(buf, 8, temperature); + _mav_put_uint8_t(buf, 10, index); + _mav_put_uint8_t(buf, 11, type); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MOTOR_INFO_LEN); +#else + mavlink_motor_info_t packet; + packet.total_time = total_time; + packet.temperature = temperature; + packet.index = index; + packet.type = type; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MOTOR_INFO_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_MOTOR_INFO; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MOTOR_INFO_MIN_LEN, MAVLINK_MSG_ID_MOTOR_INFO_LEN, MAVLINK_MSG_ID_MOTOR_INFO_CRC); +} + +/** + * @brief Pack a motor_info message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param index Motor index number starting with index 1. 0 if unknown. + * @param type The type of motor, TODO: define an enum + * @param total_time [s] Total accumulated usage time + * @param temperature [cdegC] Temperature of motor. INT16_MAX if unknown. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_motor_info_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t index, uint8_t type, uint64_t total_time, int16_t temperature) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_MOTOR_INFO_LEN]; + _mav_put_uint64_t(buf, 0, total_time); + _mav_put_int16_t(buf, 8, temperature); + _mav_put_uint8_t(buf, 10, index); + _mav_put_uint8_t(buf, 11, type); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MOTOR_INFO_LEN); +#else + mavlink_motor_info_t packet; + packet.total_time = total_time; + packet.temperature = temperature; + packet.index = index; + packet.type = type; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MOTOR_INFO_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_MOTOR_INFO; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MOTOR_INFO_MIN_LEN, MAVLINK_MSG_ID_MOTOR_INFO_LEN, MAVLINK_MSG_ID_MOTOR_INFO_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MOTOR_INFO_MIN_LEN, MAVLINK_MSG_ID_MOTOR_INFO_LEN); +#endif +} + +/** + * @brief Pack a motor_info message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param index Motor index number starting with index 1. 0 if unknown. + * @param type The type of motor, TODO: define an enum + * @param total_time [s] Total accumulated usage time + * @param temperature [cdegC] Temperature of motor. INT16_MAX if unknown. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_motor_info_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t index,uint8_t type,uint64_t total_time,int16_t temperature) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_MOTOR_INFO_LEN]; + _mav_put_uint64_t(buf, 0, total_time); + _mav_put_int16_t(buf, 8, temperature); + _mav_put_uint8_t(buf, 10, index); + _mav_put_uint8_t(buf, 11, type); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MOTOR_INFO_LEN); +#else + mavlink_motor_info_t packet; + packet.total_time = total_time; + packet.temperature = temperature; + packet.index = index; + packet.type = type; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MOTOR_INFO_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_MOTOR_INFO; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_MOTOR_INFO_MIN_LEN, MAVLINK_MSG_ID_MOTOR_INFO_LEN, MAVLINK_MSG_ID_MOTOR_INFO_CRC); +} + +/** + * @brief Encode a motor_info struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param motor_info C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_motor_info_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_motor_info_t* motor_info) +{ + return mavlink_msg_motor_info_pack(system_id, component_id, msg, motor_info->index, motor_info->type, motor_info->total_time, motor_info->temperature); +} + +/** + * @brief Encode a motor_info struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param motor_info C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_motor_info_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_motor_info_t* motor_info) +{ + return mavlink_msg_motor_info_pack_chan(system_id, component_id, chan, msg, motor_info->index, motor_info->type, motor_info->total_time, motor_info->temperature); +} + +/** + * @brief Encode a motor_info struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param motor_info C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_motor_info_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_motor_info_t* motor_info) +{ + return mavlink_msg_motor_info_pack_status(system_id, component_id, _status, msg, motor_info->index, motor_info->type, motor_info->total_time, motor_info->temperature); +} + +/** + * @brief Send a motor_info message + * @param chan MAVLink channel to send the message + * + * @param index Motor index number starting with index 1. 0 if unknown. + * @param type The type of motor, TODO: define an enum + * @param total_time [s] Total accumulated usage time + * @param temperature [cdegC] Temperature of motor. INT16_MAX if unknown. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_motor_info_send(mavlink_channel_t chan, uint8_t index, uint8_t type, uint64_t total_time, int16_t temperature) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_MOTOR_INFO_LEN]; + _mav_put_uint64_t(buf, 0, total_time); + _mav_put_int16_t(buf, 8, temperature); + _mav_put_uint8_t(buf, 10, index); + _mav_put_uint8_t(buf, 11, type); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOTOR_INFO, buf, MAVLINK_MSG_ID_MOTOR_INFO_MIN_LEN, MAVLINK_MSG_ID_MOTOR_INFO_LEN, MAVLINK_MSG_ID_MOTOR_INFO_CRC); +#else + mavlink_motor_info_t packet; + packet.total_time = total_time; + packet.temperature = temperature; + packet.index = index; + packet.type = type; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOTOR_INFO, (const char *)&packet, MAVLINK_MSG_ID_MOTOR_INFO_MIN_LEN, MAVLINK_MSG_ID_MOTOR_INFO_LEN, MAVLINK_MSG_ID_MOTOR_INFO_CRC); +#endif +} + +/** + * @brief Send a motor_info message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_motor_info_send_struct(mavlink_channel_t chan, const mavlink_motor_info_t* motor_info) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_motor_info_send(chan, motor_info->index, motor_info->type, motor_info->total_time, motor_info->temperature); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOTOR_INFO, (const char *)motor_info, MAVLINK_MSG_ID_MOTOR_INFO_MIN_LEN, MAVLINK_MSG_ID_MOTOR_INFO_LEN, MAVLINK_MSG_ID_MOTOR_INFO_CRC); +#endif +} + +#if MAVLINK_MSG_ID_MOTOR_INFO_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_motor_info_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t index, uint8_t type, uint64_t total_time, int16_t temperature) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint64_t(buf, 0, total_time); + _mav_put_int16_t(buf, 8, temperature); + _mav_put_uint8_t(buf, 10, index); + _mav_put_uint8_t(buf, 11, type); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOTOR_INFO, buf, MAVLINK_MSG_ID_MOTOR_INFO_MIN_LEN, MAVLINK_MSG_ID_MOTOR_INFO_LEN, MAVLINK_MSG_ID_MOTOR_INFO_CRC); +#else + mavlink_motor_info_t *packet = (mavlink_motor_info_t *)msgbuf; + packet->total_time = total_time; + packet->temperature = temperature; + packet->index = index; + packet->type = type; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOTOR_INFO, (const char *)packet, MAVLINK_MSG_ID_MOTOR_INFO_MIN_LEN, MAVLINK_MSG_ID_MOTOR_INFO_LEN, MAVLINK_MSG_ID_MOTOR_INFO_CRC); +#endif +} +#endif + +#endif + +// MESSAGE MOTOR_INFO UNPACKING + + +/** + * @brief Get field index from motor_info message + * + * @return Motor index number starting with index 1. 0 if unknown. + */ +static inline uint8_t mavlink_msg_motor_info_get_index(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 10); +} + +/** + * @brief Get field type from motor_info message + * + * @return The type of motor, TODO: define an enum + */ +static inline uint8_t mavlink_msg_motor_info_get_type(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 11); +} + +/** + * @brief Get field total_time from motor_info message + * + * @return [s] Total accumulated usage time + */ +static inline uint64_t mavlink_msg_motor_info_get_total_time(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 0); +} + +/** + * @brief Get field temperature from motor_info message + * + * @return [cdegC] Temperature of motor. INT16_MAX if unknown. + */ +static inline int16_t mavlink_msg_motor_info_get_temperature(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int16_t(msg, 8); +} + +/** + * @brief Decode a motor_info message into a struct + * + * @param msg The message to decode + * @param motor_info C-struct to decode the message contents into + */ +static inline void mavlink_msg_motor_info_decode(const mavlink_message_t* msg, mavlink_motor_info_t* motor_info) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + motor_info->total_time = mavlink_msg_motor_info_get_total_time(msg); + motor_info->temperature = mavlink_msg_motor_info_get_temperature(msg); + motor_info->index = mavlink_msg_motor_info_get_index(msg); + motor_info->type = mavlink_msg_motor_info_get_type(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_MOTOR_INFO_LEN? msg->len : MAVLINK_MSG_ID_MOTOR_INFO_LEN; + memset(motor_info, 0, MAVLINK_MSG_ID_MOTOR_INFO_LEN); + memcpy(motor_info, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/auterion/mavlink_msg_parachute_status.h b/auterion/mavlink_msg_parachute_status.h new file mode 100644 index 000000000..cc7c05b26 --- /dev/null +++ b/auterion/mavlink_msg_parachute_status.h @@ -0,0 +1,418 @@ +#pragma once +// MESSAGE PARACHUTE_STATUS PACKING + +#define MAVLINK_MSG_ID_PARACHUTE_STATUS 430 + + +typedef struct __mavlink_parachute_status_t { + uint32_t time_boot_ms; /*< [ms] Uptime in ms*/ + uint32_t error_status; /*< Errors*/ + uint8_t arm_status; /*< Parachute arming status*/ + uint8_t deployment_status; /*< Parachute deployment status*/ + uint8_t safety_status; /*< Parachute safety status*/ + uint8_t ats_arm_altitude; /*< [m] Parachute Automatic Trigger System (ATS) auto-arming/disarming altitude in meters*/ + char parachute_packed_date[11]; /*< Parachute packed date (YYYY-MM-DD) in ASCII characters, 0 terminated. All 0: field not provided.*/ +} mavlink_parachute_status_t; + +#define MAVLINK_MSG_ID_PARACHUTE_STATUS_LEN 23 +#define MAVLINK_MSG_ID_PARACHUTE_STATUS_MIN_LEN 23 +#define MAVLINK_MSG_ID_430_LEN 23 +#define MAVLINK_MSG_ID_430_MIN_LEN 23 + +#define MAVLINK_MSG_ID_PARACHUTE_STATUS_CRC 85 +#define MAVLINK_MSG_ID_430_CRC 85 + +#define MAVLINK_MSG_PARACHUTE_STATUS_FIELD_PARACHUTE_PACKED_DATE_LEN 11 + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_PARACHUTE_STATUS { \ + 430, \ + "PARACHUTE_STATUS", \ + 7, \ + { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_parachute_status_t, time_boot_ms) }, \ + { "error_status", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_parachute_status_t, error_status) }, \ + { "arm_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_parachute_status_t, arm_status) }, \ + { "deployment_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_parachute_status_t, deployment_status) }, \ + { "safety_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_parachute_status_t, safety_status) }, \ + { "ats_arm_altitude", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_parachute_status_t, ats_arm_altitude) }, \ + { "parachute_packed_date", NULL, MAVLINK_TYPE_CHAR, 11, 12, offsetof(mavlink_parachute_status_t, parachute_packed_date) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_PARACHUTE_STATUS { \ + "PARACHUTE_STATUS", \ + 7, \ + { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_parachute_status_t, time_boot_ms) }, \ + { "error_status", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_parachute_status_t, error_status) }, \ + { "arm_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_parachute_status_t, arm_status) }, \ + { "deployment_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_parachute_status_t, deployment_status) }, \ + { "safety_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_parachute_status_t, safety_status) }, \ + { "ats_arm_altitude", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_parachute_status_t, ats_arm_altitude) }, \ + { "parachute_packed_date", NULL, MAVLINK_TYPE_CHAR, 11, 12, offsetof(mavlink_parachute_status_t, parachute_packed_date) }, \ + } \ +} +#endif + +/** + * @brief Pack a parachute_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Uptime in ms + * @param error_status Errors + * @param arm_status Parachute arming status + * @param deployment_status Parachute deployment status + * @param safety_status Parachute safety status + * @param ats_arm_altitude [m] Parachute Automatic Trigger System (ATS) auto-arming/disarming altitude in meters + * @param parachute_packed_date Parachute packed date (YYYY-MM-DD) in ASCII characters, 0 terminated. All 0: field not provided. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_parachute_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint32_t time_boot_ms, uint32_t error_status, uint8_t arm_status, uint8_t deployment_status, uint8_t safety_status, uint8_t ats_arm_altitude, const char *parachute_packed_date) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PARACHUTE_STATUS_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_uint32_t(buf, 4, error_status); + _mav_put_uint8_t(buf, 8, arm_status); + _mav_put_uint8_t(buf, 9, deployment_status); + _mav_put_uint8_t(buf, 10, safety_status); + _mav_put_uint8_t(buf, 11, ats_arm_altitude); + _mav_put_char_array(buf, 12, parachute_packed_date, 11); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PARACHUTE_STATUS_LEN); +#else + mavlink_parachute_status_t packet; + packet.time_boot_ms = time_boot_ms; + packet.error_status = error_status; + packet.arm_status = arm_status; + packet.deployment_status = deployment_status; + packet.safety_status = safety_status; + packet.ats_arm_altitude = ats_arm_altitude; + mav_array_assign_char(packet.parachute_packed_date, parachute_packed_date, 11); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARACHUTE_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_PARACHUTE_STATUS; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PARACHUTE_STATUS_MIN_LEN, MAVLINK_MSG_ID_PARACHUTE_STATUS_LEN, MAVLINK_MSG_ID_PARACHUTE_STATUS_CRC); +} + +/** + * @brief Pack a parachute_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Uptime in ms + * @param error_status Errors + * @param arm_status Parachute arming status + * @param deployment_status Parachute deployment status + * @param safety_status Parachute safety status + * @param ats_arm_altitude [m] Parachute Automatic Trigger System (ATS) auto-arming/disarming altitude in meters + * @param parachute_packed_date Parachute packed date (YYYY-MM-DD) in ASCII characters, 0 terminated. All 0: field not provided. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_parachute_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, uint32_t error_status, uint8_t arm_status, uint8_t deployment_status, uint8_t safety_status, uint8_t ats_arm_altitude, const char *parachute_packed_date) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PARACHUTE_STATUS_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_uint32_t(buf, 4, error_status); + _mav_put_uint8_t(buf, 8, arm_status); + _mav_put_uint8_t(buf, 9, deployment_status); + _mav_put_uint8_t(buf, 10, safety_status); + _mav_put_uint8_t(buf, 11, ats_arm_altitude); + _mav_put_char_array(buf, 12, parachute_packed_date, 11); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PARACHUTE_STATUS_LEN); +#else + mavlink_parachute_status_t packet; + packet.time_boot_ms = time_boot_ms; + packet.error_status = error_status; + packet.arm_status = arm_status; + packet.deployment_status = deployment_status; + packet.safety_status = safety_status; + packet.ats_arm_altitude = ats_arm_altitude; + mav_array_memcpy(packet.parachute_packed_date, parachute_packed_date, sizeof(char)*11); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARACHUTE_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_PARACHUTE_STATUS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PARACHUTE_STATUS_MIN_LEN, MAVLINK_MSG_ID_PARACHUTE_STATUS_LEN, MAVLINK_MSG_ID_PARACHUTE_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PARACHUTE_STATUS_MIN_LEN, MAVLINK_MSG_ID_PARACHUTE_STATUS_LEN); +#endif +} + +/** + * @brief Pack a parachute_status message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param time_boot_ms [ms] Uptime in ms + * @param error_status Errors + * @param arm_status Parachute arming status + * @param deployment_status Parachute deployment status + * @param safety_status Parachute safety status + * @param ats_arm_altitude [m] Parachute Automatic Trigger System (ATS) auto-arming/disarming altitude in meters + * @param parachute_packed_date Parachute packed date (YYYY-MM-DD) in ASCII characters, 0 terminated. All 0: field not provided. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_parachute_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint32_t time_boot_ms,uint32_t error_status,uint8_t arm_status,uint8_t deployment_status,uint8_t safety_status,uint8_t ats_arm_altitude,const char *parachute_packed_date) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PARACHUTE_STATUS_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_uint32_t(buf, 4, error_status); + _mav_put_uint8_t(buf, 8, arm_status); + _mav_put_uint8_t(buf, 9, deployment_status); + _mav_put_uint8_t(buf, 10, safety_status); + _mav_put_uint8_t(buf, 11, ats_arm_altitude); + _mav_put_char_array(buf, 12, parachute_packed_date, 11); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PARACHUTE_STATUS_LEN); +#else + mavlink_parachute_status_t packet; + packet.time_boot_ms = time_boot_ms; + packet.error_status = error_status; + packet.arm_status = arm_status; + packet.deployment_status = deployment_status; + packet.safety_status = safety_status; + packet.ats_arm_altitude = ats_arm_altitude; + mav_array_assign_char(packet.parachute_packed_date, parachute_packed_date, 11); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARACHUTE_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_PARACHUTE_STATUS; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_PARACHUTE_STATUS_MIN_LEN, MAVLINK_MSG_ID_PARACHUTE_STATUS_LEN, MAVLINK_MSG_ID_PARACHUTE_STATUS_CRC); +} + +/** + * @brief Encode a parachute_status struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param parachute_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_parachute_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_parachute_status_t* parachute_status) +{ + return mavlink_msg_parachute_status_pack(system_id, component_id, msg, parachute_status->time_boot_ms, parachute_status->error_status, parachute_status->arm_status, parachute_status->deployment_status, parachute_status->safety_status, parachute_status->ats_arm_altitude, parachute_status->parachute_packed_date); +} + +/** + * @brief Encode a parachute_status struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param parachute_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_parachute_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_parachute_status_t* parachute_status) +{ + return mavlink_msg_parachute_status_pack_chan(system_id, component_id, chan, msg, parachute_status->time_boot_ms, parachute_status->error_status, parachute_status->arm_status, parachute_status->deployment_status, parachute_status->safety_status, parachute_status->ats_arm_altitude, parachute_status->parachute_packed_date); +} + +/** + * @brief Encode a parachute_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param parachute_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_parachute_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_parachute_status_t* parachute_status) +{ + return mavlink_msg_parachute_status_pack_status(system_id, component_id, _status, msg, parachute_status->time_boot_ms, parachute_status->error_status, parachute_status->arm_status, parachute_status->deployment_status, parachute_status->safety_status, parachute_status->ats_arm_altitude, parachute_status->parachute_packed_date); +} + +/** + * @brief Send a parachute_status message + * @param chan MAVLink channel to send the message + * + * @param time_boot_ms [ms] Uptime in ms + * @param error_status Errors + * @param arm_status Parachute arming status + * @param deployment_status Parachute deployment status + * @param safety_status Parachute safety status + * @param ats_arm_altitude [m] Parachute Automatic Trigger System (ATS) auto-arming/disarming altitude in meters + * @param parachute_packed_date Parachute packed date (YYYY-MM-DD) in ASCII characters, 0 terminated. All 0: field not provided. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_parachute_status_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint32_t error_status, uint8_t arm_status, uint8_t deployment_status, uint8_t safety_status, uint8_t ats_arm_altitude, const char *parachute_packed_date) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PARACHUTE_STATUS_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_uint32_t(buf, 4, error_status); + _mav_put_uint8_t(buf, 8, arm_status); + _mav_put_uint8_t(buf, 9, deployment_status); + _mav_put_uint8_t(buf, 10, safety_status); + _mav_put_uint8_t(buf, 11, ats_arm_altitude); + _mav_put_char_array(buf, 12, parachute_packed_date, 11); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARACHUTE_STATUS, buf, MAVLINK_MSG_ID_PARACHUTE_STATUS_MIN_LEN, MAVLINK_MSG_ID_PARACHUTE_STATUS_LEN, MAVLINK_MSG_ID_PARACHUTE_STATUS_CRC); +#else + mavlink_parachute_status_t packet; + packet.time_boot_ms = time_boot_ms; + packet.error_status = error_status; + packet.arm_status = arm_status; + packet.deployment_status = deployment_status; + packet.safety_status = safety_status; + packet.ats_arm_altitude = ats_arm_altitude; + mav_array_assign_char(packet.parachute_packed_date, parachute_packed_date, 11); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARACHUTE_STATUS, (const char *)&packet, MAVLINK_MSG_ID_PARACHUTE_STATUS_MIN_LEN, MAVLINK_MSG_ID_PARACHUTE_STATUS_LEN, MAVLINK_MSG_ID_PARACHUTE_STATUS_CRC); +#endif +} + +/** + * @brief Send a parachute_status message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_parachute_status_send_struct(mavlink_channel_t chan, const mavlink_parachute_status_t* parachute_status) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_parachute_status_send(chan, parachute_status->time_boot_ms, parachute_status->error_status, parachute_status->arm_status, parachute_status->deployment_status, parachute_status->safety_status, parachute_status->ats_arm_altitude, parachute_status->parachute_packed_date); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARACHUTE_STATUS, (const char *)parachute_status, MAVLINK_MSG_ID_PARACHUTE_STATUS_MIN_LEN, MAVLINK_MSG_ID_PARACHUTE_STATUS_LEN, MAVLINK_MSG_ID_PARACHUTE_STATUS_CRC); +#endif +} + +#if MAVLINK_MSG_ID_PARACHUTE_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_parachute_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint32_t error_status, uint8_t arm_status, uint8_t deployment_status, uint8_t safety_status, uint8_t ats_arm_altitude, const char *parachute_packed_date) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_uint32_t(buf, 4, error_status); + _mav_put_uint8_t(buf, 8, arm_status); + _mav_put_uint8_t(buf, 9, deployment_status); + _mav_put_uint8_t(buf, 10, safety_status); + _mav_put_uint8_t(buf, 11, ats_arm_altitude); + _mav_put_char_array(buf, 12, parachute_packed_date, 11); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARACHUTE_STATUS, buf, MAVLINK_MSG_ID_PARACHUTE_STATUS_MIN_LEN, MAVLINK_MSG_ID_PARACHUTE_STATUS_LEN, MAVLINK_MSG_ID_PARACHUTE_STATUS_CRC); +#else + mavlink_parachute_status_t *packet = (mavlink_parachute_status_t *)msgbuf; + packet->time_boot_ms = time_boot_ms; + packet->error_status = error_status; + packet->arm_status = arm_status; + packet->deployment_status = deployment_status; + packet->safety_status = safety_status; + packet->ats_arm_altitude = ats_arm_altitude; + mav_array_assign_char(packet->parachute_packed_date, parachute_packed_date, 11); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARACHUTE_STATUS, (const char *)packet, MAVLINK_MSG_ID_PARACHUTE_STATUS_MIN_LEN, MAVLINK_MSG_ID_PARACHUTE_STATUS_LEN, MAVLINK_MSG_ID_PARACHUTE_STATUS_CRC); +#endif +} +#endif + +#endif + +// MESSAGE PARACHUTE_STATUS UNPACKING + + +/** + * @brief Get field time_boot_ms from parachute_status message + * + * @return [ms] Uptime in ms + */ +static inline uint32_t mavlink_msg_parachute_status_get_time_boot_ms(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 0); +} + +/** + * @brief Get field error_status from parachute_status message + * + * @return Errors + */ +static inline uint32_t mavlink_msg_parachute_status_get_error_status(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 4); +} + +/** + * @brief Get field arm_status from parachute_status message + * + * @return Parachute arming status + */ +static inline uint8_t mavlink_msg_parachute_status_get_arm_status(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 8); +} + +/** + * @brief Get field deployment_status from parachute_status message + * + * @return Parachute deployment status + */ +static inline uint8_t mavlink_msg_parachute_status_get_deployment_status(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 9); +} + +/** + * @brief Get field safety_status from parachute_status message + * + * @return Parachute safety status + */ +static inline uint8_t mavlink_msg_parachute_status_get_safety_status(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 10); +} + +/** + * @brief Get field ats_arm_altitude from parachute_status message + * + * @return [m] Parachute Automatic Trigger System (ATS) auto-arming/disarming altitude in meters + */ +static inline uint8_t mavlink_msg_parachute_status_get_ats_arm_altitude(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 11); +} + +/** + * @brief Get field parachute_packed_date from parachute_status message + * + * @return Parachute packed date (YYYY-MM-DD) in ASCII characters, 0 terminated. All 0: field not provided. + */ +static inline uint16_t mavlink_msg_parachute_status_get_parachute_packed_date(const mavlink_message_t* msg, char *parachute_packed_date) +{ + return _MAV_RETURN_char_array(msg, parachute_packed_date, 11, 12); +} + +/** + * @brief Decode a parachute_status message into a struct + * + * @param msg The message to decode + * @param parachute_status C-struct to decode the message contents into + */ +static inline void mavlink_msg_parachute_status_decode(const mavlink_message_t* msg, mavlink_parachute_status_t* parachute_status) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + parachute_status->time_boot_ms = mavlink_msg_parachute_status_get_time_boot_ms(msg); + parachute_status->error_status = mavlink_msg_parachute_status_get_error_status(msg); + parachute_status->arm_status = mavlink_msg_parachute_status_get_arm_status(msg); + parachute_status->deployment_status = mavlink_msg_parachute_status_get_deployment_status(msg); + parachute_status->safety_status = mavlink_msg_parachute_status_get_safety_status(msg); + parachute_status->ats_arm_altitude = mavlink_msg_parachute_status_get_ats_arm_altitude(msg); + mavlink_msg_parachute_status_get_parachute_packed_date(msg, parachute_status->parachute_packed_date); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_PARACHUTE_STATUS_LEN? msg->len : MAVLINK_MSG_ID_PARACHUTE_STATUS_LEN; + memset(parachute_status, 0, MAVLINK_MSG_ID_PARACHUTE_STATUS_LEN); + memcpy(parachute_status, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/common/mavlink_msg_param_ack_transaction.h b/auterion/mavlink_msg_param_ack_transaction.h similarity index 81% rename from common/mavlink_msg_param_ack_transaction.h rename to auterion/mavlink_msg_param_ack_transaction.h index 404b084ab..48c4f98bb 100644 --- a/common/mavlink_msg_param_ack_transaction.h +++ b/auterion/mavlink_msg_param_ack_transaction.h @@ -83,7 +83,7 @@ static inline uint16_t mavlink_msg_param_ack_transaction_pack(uint8_t system_id, packet.target_component = target_component; packet.param_type = param_type; packet.param_result = param_result; - mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); + mav_array_assign_char(packet.param_id, param_id, 16); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_LEN); #endif @@ -91,6 +91,52 @@ static inline uint16_t mavlink_msg_param_ack_transaction_pack(uint8_t system_id, return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_MIN_LEN, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_LEN, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_CRC); } +/** + * @brief Pack a param_ack_transaction message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system Id of system that sent PARAM_SET message. + * @param target_component Id of system that sent PARAM_SET message. + * @param param_id Parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string + * @param param_value Parameter value (new value if PARAM_ACCEPTED, current value otherwise) + * @param param_type Parameter type. + * @param param_result Result code. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_param_ack_transaction_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, const char *param_id, float param_value, uint8_t param_type, uint8_t param_result) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_LEN]; + _mav_put_float(buf, 0, param_value); + _mav_put_uint8_t(buf, 4, target_system); + _mav_put_uint8_t(buf, 5, target_component); + _mav_put_uint8_t(buf, 22, param_type); + _mav_put_uint8_t(buf, 23, param_result); + _mav_put_char_array(buf, 6, param_id, 16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_LEN); +#else + mavlink_param_ack_transaction_t packet; + packet.param_value = param_value; + packet.target_system = target_system; + packet.target_component = target_component; + packet.param_type = param_type; + packet.param_result = param_result; + mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_MIN_LEN, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_LEN, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_MIN_LEN, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_LEN); +#endif +} + /** * @brief Pack a param_ack_transaction message on a channel * @param system_id ID of this system @@ -125,7 +171,7 @@ static inline uint16_t mavlink_msg_param_ack_transaction_pack_chan(uint8_t syste packet.target_component = target_component; packet.param_type = param_type; packet.param_result = param_result; - mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); + mav_array_assign_char(packet.param_id, param_id, 16); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_LEN); #endif @@ -160,6 +206,20 @@ static inline uint16_t mavlink_msg_param_ack_transaction_encode_chan(uint8_t sys return mavlink_msg_param_ack_transaction_pack_chan(system_id, component_id, chan, msg, param_ack_transaction->target_system, param_ack_transaction->target_component, param_ack_transaction->param_id, param_ack_transaction->param_value, param_ack_transaction->param_type, param_ack_transaction->param_result); } +/** + * @brief Encode a param_ack_transaction struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param param_ack_transaction C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_param_ack_transaction_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_param_ack_transaction_t* param_ack_transaction) +{ + return mavlink_msg_param_ack_transaction_pack_status(system_id, component_id, _status, msg, param_ack_transaction->target_system, param_ack_transaction->target_component, param_ack_transaction->param_id, param_ack_transaction->param_value, param_ack_transaction->param_type, param_ack_transaction->param_result); +} + /** * @brief Send a param_ack_transaction message * @param chan MAVLink channel to send the message @@ -191,7 +251,7 @@ static inline void mavlink_msg_param_ack_transaction_send(mavlink_channel_t chan packet.target_component = target_component; packet.param_type = param_type; packet.param_result = param_result; - mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); + mav_array_assign_char(packet.param_id, param_id, 16); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION, (const char *)&packet, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_MIN_LEN, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_LEN, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_CRC); #endif } @@ -212,7 +272,7 @@ static inline void mavlink_msg_param_ack_transaction_send_struct(mavlink_channel #if MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -236,7 +296,7 @@ static inline void mavlink_msg_param_ack_transaction_send_buf(mavlink_message_t packet->target_component = target_component; packet->param_type = param_type; packet->param_result = param_result; - mav_array_memcpy(packet->param_id, param_id, sizeof(char)*16); + mav_array_assign_char(packet->param_id, param_id, 16); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION, (const char *)packet, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_MIN_LEN, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_LEN, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_CRC); #endif } diff --git a/auterion/mavlink_msg_pixel_to_lla_ack.h b/auterion/mavlink_msg_pixel_to_lla_ack.h new file mode 100644 index 000000000..c7690883d --- /dev/null +++ b/auterion/mavlink_msg_pixel_to_lla_ack.h @@ -0,0 +1,306 @@ +#pragma once +// MESSAGE PIXEL_TO_LLA_ACK PACKING + +#define MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK 601 + + +typedef struct __mavlink_pixel_to_lla_ack_t { + uint64_t uid; /*< Unique ID of the request.*/ + uint8_t status; /*< 0 = Rejected, 1 = Accepted (with an optional error message).*/ + char error_message[100]; /*< Optional error message in case of rejection. Max length 100 characters.*/ +} mavlink_pixel_to_lla_ack_t; + +#define MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_LEN 109 +#define MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_MIN_LEN 109 +#define MAVLINK_MSG_ID_601_LEN 109 +#define MAVLINK_MSG_ID_601_MIN_LEN 109 + +#define MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_CRC 190 +#define MAVLINK_MSG_ID_601_CRC 190 + +#define MAVLINK_MSG_PIXEL_TO_LLA_ACK_FIELD_ERROR_MESSAGE_LEN 100 + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_PIXEL_TO_LLA_ACK { \ + 601, \ + "PIXEL_TO_LLA_ACK", \ + 3, \ + { { "uid", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_pixel_to_lla_ack_t, uid) }, \ + { "status", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_pixel_to_lla_ack_t, status) }, \ + { "error_message", NULL, MAVLINK_TYPE_CHAR, 100, 9, offsetof(mavlink_pixel_to_lla_ack_t, error_message) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_PIXEL_TO_LLA_ACK { \ + "PIXEL_TO_LLA_ACK", \ + 3, \ + { { "uid", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_pixel_to_lla_ack_t, uid) }, \ + { "status", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_pixel_to_lla_ack_t, status) }, \ + { "error_message", NULL, MAVLINK_TYPE_CHAR, 100, 9, offsetof(mavlink_pixel_to_lla_ack_t, error_message) }, \ + } \ +} +#endif + +/** + * @brief Pack a pixel_to_lla_ack message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param uid Unique ID of the request. + * @param status 0 = Rejected, 1 = Accepted (with an optional error message). + * @param error_message Optional error message in case of rejection. Max length 100 characters. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_pixel_to_lla_ack_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint64_t uid, uint8_t status, const char *error_message) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_LEN]; + _mav_put_uint64_t(buf, 0, uid); + _mav_put_uint8_t(buf, 8, status); + _mav_put_char_array(buf, 9, error_message, 100); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_LEN); +#else + mavlink_pixel_to_lla_ack_t packet; + packet.uid = uid; + packet.status = status; + mav_array_assign_char(packet.error_message, error_message, 100); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_MIN_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_CRC); +} + +/** + * @brief Pack a pixel_to_lla_ack message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param uid Unique ID of the request. + * @param status 0 = Rejected, 1 = Accepted (with an optional error message). + * @param error_message Optional error message in case of rejection. Max length 100 characters. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_pixel_to_lla_ack_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t uid, uint8_t status, const char *error_message) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_LEN]; + _mav_put_uint64_t(buf, 0, uid); + _mav_put_uint8_t(buf, 8, status); + _mav_put_char_array(buf, 9, error_message, 100); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_LEN); +#else + mavlink_pixel_to_lla_ack_t packet; + packet.uid = uid; + packet.status = status; + mav_array_memcpy(packet.error_message, error_message, sizeof(char)*100); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_MIN_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_MIN_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_LEN); +#endif +} + +/** + * @brief Pack a pixel_to_lla_ack message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param uid Unique ID of the request. + * @param status 0 = Rejected, 1 = Accepted (with an optional error message). + * @param error_message Optional error message in case of rejection. Max length 100 characters. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_pixel_to_lla_ack_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint64_t uid,uint8_t status,const char *error_message) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_LEN]; + _mav_put_uint64_t(buf, 0, uid); + _mav_put_uint8_t(buf, 8, status); + _mav_put_char_array(buf, 9, error_message, 100); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_LEN); +#else + mavlink_pixel_to_lla_ack_t packet; + packet.uid = uid; + packet.status = status; + mav_array_assign_char(packet.error_message, error_message, 100); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_MIN_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_CRC); +} + +/** + * @brief Encode a pixel_to_lla_ack struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param pixel_to_lla_ack C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_pixel_to_lla_ack_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_pixel_to_lla_ack_t* pixel_to_lla_ack) +{ + return mavlink_msg_pixel_to_lla_ack_pack(system_id, component_id, msg, pixel_to_lla_ack->uid, pixel_to_lla_ack->status, pixel_to_lla_ack->error_message); +} + +/** + * @brief Encode a pixel_to_lla_ack struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param pixel_to_lla_ack C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_pixel_to_lla_ack_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_pixel_to_lla_ack_t* pixel_to_lla_ack) +{ + return mavlink_msg_pixel_to_lla_ack_pack_chan(system_id, component_id, chan, msg, pixel_to_lla_ack->uid, pixel_to_lla_ack->status, pixel_to_lla_ack->error_message); +} + +/** + * @brief Encode a pixel_to_lla_ack struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param pixel_to_lla_ack C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_pixel_to_lla_ack_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_pixel_to_lla_ack_t* pixel_to_lla_ack) +{ + return mavlink_msg_pixel_to_lla_ack_pack_status(system_id, component_id, _status, msg, pixel_to_lla_ack->uid, pixel_to_lla_ack->status, pixel_to_lla_ack->error_message); +} + +/** + * @brief Send a pixel_to_lla_ack message + * @param chan MAVLink channel to send the message + * + * @param uid Unique ID of the request. + * @param status 0 = Rejected, 1 = Accepted (with an optional error message). + * @param error_message Optional error message in case of rejection. Max length 100 characters. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_pixel_to_lla_ack_send(mavlink_channel_t chan, uint64_t uid, uint8_t status, const char *error_message) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_LEN]; + _mav_put_uint64_t(buf, 0, uid); + _mav_put_uint8_t(buf, 8, status); + _mav_put_char_array(buf, 9, error_message, 100); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK, buf, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_MIN_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_CRC); +#else + mavlink_pixel_to_lla_ack_t packet; + packet.uid = uid; + packet.status = status; + mav_array_assign_char(packet.error_message, error_message, 100); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK, (const char *)&packet, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_MIN_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_CRC); +#endif +} + +/** + * @brief Send a pixel_to_lla_ack message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_pixel_to_lla_ack_send_struct(mavlink_channel_t chan, const mavlink_pixel_to_lla_ack_t* pixel_to_lla_ack) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_pixel_to_lla_ack_send(chan, pixel_to_lla_ack->uid, pixel_to_lla_ack->status, pixel_to_lla_ack->error_message); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK, (const char *)pixel_to_lla_ack, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_MIN_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_CRC); +#endif +} + +#if MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_pixel_to_lla_ack_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t uid, uint8_t status, const char *error_message) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint64_t(buf, 0, uid); + _mav_put_uint8_t(buf, 8, status); + _mav_put_char_array(buf, 9, error_message, 100); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK, buf, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_MIN_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_CRC); +#else + mavlink_pixel_to_lla_ack_t *packet = (mavlink_pixel_to_lla_ack_t *)msgbuf; + packet->uid = uid; + packet->status = status; + mav_array_assign_char(packet->error_message, error_message, 100); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK, (const char *)packet, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_MIN_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_CRC); +#endif +} +#endif + +#endif + +// MESSAGE PIXEL_TO_LLA_ACK UNPACKING + + +/** + * @brief Get field uid from pixel_to_lla_ack message + * + * @return Unique ID of the request. + */ +static inline uint64_t mavlink_msg_pixel_to_lla_ack_get_uid(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 0); +} + +/** + * @brief Get field status from pixel_to_lla_ack message + * + * @return 0 = Rejected, 1 = Accepted (with an optional error message). + */ +static inline uint8_t mavlink_msg_pixel_to_lla_ack_get_status(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 8); +} + +/** + * @brief Get field error_message from pixel_to_lla_ack message + * + * @return Optional error message in case of rejection. Max length 100 characters. + */ +static inline uint16_t mavlink_msg_pixel_to_lla_ack_get_error_message(const mavlink_message_t* msg, char *error_message) +{ + return _MAV_RETURN_char_array(msg, error_message, 100, 9); +} + +/** + * @brief Decode a pixel_to_lla_ack message into a struct + * + * @param msg The message to decode + * @param pixel_to_lla_ack C-struct to decode the message contents into + */ +static inline void mavlink_msg_pixel_to_lla_ack_decode(const mavlink_message_t* msg, mavlink_pixel_to_lla_ack_t* pixel_to_lla_ack) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + pixel_to_lla_ack->uid = mavlink_msg_pixel_to_lla_ack_get_uid(msg); + pixel_to_lla_ack->status = mavlink_msg_pixel_to_lla_ack_get_status(msg); + mavlink_msg_pixel_to_lla_ack_get_error_message(msg, pixel_to_lla_ack->error_message); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_LEN? msg->len : MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_LEN; + memset(pixel_to_lla_ack, 0, MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_LEN); + memcpy(pixel_to_lla_ack, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/auterion/mavlink_msg_pixel_to_lla_request.h b/auterion/mavlink_msg_pixel_to_lla_request.h new file mode 100644 index 000000000..03a9fb852 --- /dev/null +++ b/auterion/mavlink_msg_pixel_to_lla_request.h @@ -0,0 +1,372 @@ +#pragma once +// MESSAGE PIXEL_TO_LLA_REQUEST PACKING + +#define MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST 600 + + +typedef struct __mavlink_pixel_to_lla_request_t { + uint64_t uid; /*< Unique ID of the request.*/ + uint64_t img_unix_ts; /*< [us] Unix time stamp of the image.*/ + float img_rel_x; /*< Relative image x coordinate (left to right axis) in the range of [0.0, 1.0].*/ + float img_rel_y; /*< Relative image y coordinate (top to bottom axis) in the range of [0.0, 1.0].*/ + uint8_t camera_id; /*< Camera ID of the image source.*/ +} mavlink_pixel_to_lla_request_t; + +#define MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_LEN 25 +#define MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_MIN_LEN 25 +#define MAVLINK_MSG_ID_600_LEN 25 +#define MAVLINK_MSG_ID_600_MIN_LEN 25 + +#define MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_CRC 239 +#define MAVLINK_MSG_ID_600_CRC 239 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_PIXEL_TO_LLA_REQUEST { \ + 600, \ + "PIXEL_TO_LLA_REQUEST", \ + 5, \ + { { "camera_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_pixel_to_lla_request_t, camera_id) }, \ + { "uid", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_pixel_to_lla_request_t, uid) }, \ + { "img_unix_ts", NULL, MAVLINK_TYPE_UINT64_T, 0, 8, offsetof(mavlink_pixel_to_lla_request_t, img_unix_ts) }, \ + { "img_rel_x", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_pixel_to_lla_request_t, img_rel_x) }, \ + { "img_rel_y", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_pixel_to_lla_request_t, img_rel_y) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_PIXEL_TO_LLA_REQUEST { \ + "PIXEL_TO_LLA_REQUEST", \ + 5, \ + { { "camera_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_pixel_to_lla_request_t, camera_id) }, \ + { "uid", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_pixel_to_lla_request_t, uid) }, \ + { "img_unix_ts", NULL, MAVLINK_TYPE_UINT64_T, 0, 8, offsetof(mavlink_pixel_to_lla_request_t, img_unix_ts) }, \ + { "img_rel_x", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_pixel_to_lla_request_t, img_rel_x) }, \ + { "img_rel_y", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_pixel_to_lla_request_t, img_rel_y) }, \ + } \ +} +#endif + +/** + * @brief Pack a pixel_to_lla_request message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param camera_id Camera ID of the image source. + * @param uid Unique ID of the request. + * @param img_unix_ts [us] Unix time stamp of the image. + * @param img_rel_x Relative image x coordinate (left to right axis) in the range of [0.0, 1.0]. + * @param img_rel_y Relative image y coordinate (top to bottom axis) in the range of [0.0, 1.0]. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_pixel_to_lla_request_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t camera_id, uint64_t uid, uint64_t img_unix_ts, float img_rel_x, float img_rel_y) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_LEN]; + _mav_put_uint64_t(buf, 0, uid); + _mav_put_uint64_t(buf, 8, img_unix_ts); + _mav_put_float(buf, 16, img_rel_x); + _mav_put_float(buf, 20, img_rel_y); + _mav_put_uint8_t(buf, 24, camera_id); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_LEN); +#else + mavlink_pixel_to_lla_request_t packet; + packet.uid = uid; + packet.img_unix_ts = img_unix_ts; + packet.img_rel_x = img_rel_x; + packet.img_rel_y = img_rel_y; + packet.camera_id = camera_id; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_MIN_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_CRC); +} + +/** + * @brief Pack a pixel_to_lla_request message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param camera_id Camera ID of the image source. + * @param uid Unique ID of the request. + * @param img_unix_ts [us] Unix time stamp of the image. + * @param img_rel_x Relative image x coordinate (left to right axis) in the range of [0.0, 1.0]. + * @param img_rel_y Relative image y coordinate (top to bottom axis) in the range of [0.0, 1.0]. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_pixel_to_lla_request_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t camera_id, uint64_t uid, uint64_t img_unix_ts, float img_rel_x, float img_rel_y) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_LEN]; + _mav_put_uint64_t(buf, 0, uid); + _mav_put_uint64_t(buf, 8, img_unix_ts); + _mav_put_float(buf, 16, img_rel_x); + _mav_put_float(buf, 20, img_rel_y); + _mav_put_uint8_t(buf, 24, camera_id); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_LEN); +#else + mavlink_pixel_to_lla_request_t packet; + packet.uid = uid; + packet.img_unix_ts = img_unix_ts; + packet.img_rel_x = img_rel_x; + packet.img_rel_y = img_rel_y; + packet.camera_id = camera_id; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_MIN_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_MIN_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_LEN); +#endif +} + +/** + * @brief Pack a pixel_to_lla_request message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param camera_id Camera ID of the image source. + * @param uid Unique ID of the request. + * @param img_unix_ts [us] Unix time stamp of the image. + * @param img_rel_x Relative image x coordinate (left to right axis) in the range of [0.0, 1.0]. + * @param img_rel_y Relative image y coordinate (top to bottom axis) in the range of [0.0, 1.0]. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_pixel_to_lla_request_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t camera_id,uint64_t uid,uint64_t img_unix_ts,float img_rel_x,float img_rel_y) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_LEN]; + _mav_put_uint64_t(buf, 0, uid); + _mav_put_uint64_t(buf, 8, img_unix_ts); + _mav_put_float(buf, 16, img_rel_x); + _mav_put_float(buf, 20, img_rel_y); + _mav_put_uint8_t(buf, 24, camera_id); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_LEN); +#else + mavlink_pixel_to_lla_request_t packet; + packet.uid = uid; + packet.img_unix_ts = img_unix_ts; + packet.img_rel_x = img_rel_x; + packet.img_rel_y = img_rel_y; + packet.camera_id = camera_id; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_MIN_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_CRC); +} + +/** + * @brief Encode a pixel_to_lla_request struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param pixel_to_lla_request C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_pixel_to_lla_request_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_pixel_to_lla_request_t* pixel_to_lla_request) +{ + return mavlink_msg_pixel_to_lla_request_pack(system_id, component_id, msg, pixel_to_lla_request->camera_id, pixel_to_lla_request->uid, pixel_to_lla_request->img_unix_ts, pixel_to_lla_request->img_rel_x, pixel_to_lla_request->img_rel_y); +} + +/** + * @brief Encode a pixel_to_lla_request struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param pixel_to_lla_request C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_pixel_to_lla_request_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_pixel_to_lla_request_t* pixel_to_lla_request) +{ + return mavlink_msg_pixel_to_lla_request_pack_chan(system_id, component_id, chan, msg, pixel_to_lla_request->camera_id, pixel_to_lla_request->uid, pixel_to_lla_request->img_unix_ts, pixel_to_lla_request->img_rel_x, pixel_to_lla_request->img_rel_y); +} + +/** + * @brief Encode a pixel_to_lla_request struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param pixel_to_lla_request C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_pixel_to_lla_request_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_pixel_to_lla_request_t* pixel_to_lla_request) +{ + return mavlink_msg_pixel_to_lla_request_pack_status(system_id, component_id, _status, msg, pixel_to_lla_request->camera_id, pixel_to_lla_request->uid, pixel_to_lla_request->img_unix_ts, pixel_to_lla_request->img_rel_x, pixel_to_lla_request->img_rel_y); +} + +/** + * @brief Send a pixel_to_lla_request message + * @param chan MAVLink channel to send the message + * + * @param camera_id Camera ID of the image source. + * @param uid Unique ID of the request. + * @param img_unix_ts [us] Unix time stamp of the image. + * @param img_rel_x Relative image x coordinate (left to right axis) in the range of [0.0, 1.0]. + * @param img_rel_y Relative image y coordinate (top to bottom axis) in the range of [0.0, 1.0]. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_pixel_to_lla_request_send(mavlink_channel_t chan, uint8_t camera_id, uint64_t uid, uint64_t img_unix_ts, float img_rel_x, float img_rel_y) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_LEN]; + _mav_put_uint64_t(buf, 0, uid); + _mav_put_uint64_t(buf, 8, img_unix_ts); + _mav_put_float(buf, 16, img_rel_x); + _mav_put_float(buf, 20, img_rel_y); + _mav_put_uint8_t(buf, 24, camera_id); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST, buf, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_MIN_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_CRC); +#else + mavlink_pixel_to_lla_request_t packet; + packet.uid = uid; + packet.img_unix_ts = img_unix_ts; + packet.img_rel_x = img_rel_x; + packet.img_rel_y = img_rel_y; + packet.camera_id = camera_id; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST, (const char *)&packet, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_MIN_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_CRC); +#endif +} + +/** + * @brief Send a pixel_to_lla_request message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_pixel_to_lla_request_send_struct(mavlink_channel_t chan, const mavlink_pixel_to_lla_request_t* pixel_to_lla_request) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_pixel_to_lla_request_send(chan, pixel_to_lla_request->camera_id, pixel_to_lla_request->uid, pixel_to_lla_request->img_unix_ts, pixel_to_lla_request->img_rel_x, pixel_to_lla_request->img_rel_y); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST, (const char *)pixel_to_lla_request, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_MIN_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_CRC); +#endif +} + +#if MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_pixel_to_lla_request_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t camera_id, uint64_t uid, uint64_t img_unix_ts, float img_rel_x, float img_rel_y) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint64_t(buf, 0, uid); + _mav_put_uint64_t(buf, 8, img_unix_ts); + _mav_put_float(buf, 16, img_rel_x); + _mav_put_float(buf, 20, img_rel_y); + _mav_put_uint8_t(buf, 24, camera_id); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST, buf, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_MIN_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_CRC); +#else + mavlink_pixel_to_lla_request_t *packet = (mavlink_pixel_to_lla_request_t *)msgbuf; + packet->uid = uid; + packet->img_unix_ts = img_unix_ts; + packet->img_rel_x = img_rel_x; + packet->img_rel_y = img_rel_y; + packet->camera_id = camera_id; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST, (const char *)packet, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_MIN_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_CRC); +#endif +} +#endif + +#endif + +// MESSAGE PIXEL_TO_LLA_REQUEST UNPACKING + + +/** + * @brief Get field camera_id from pixel_to_lla_request message + * + * @return Camera ID of the image source. + */ +static inline uint8_t mavlink_msg_pixel_to_lla_request_get_camera_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 24); +} + +/** + * @brief Get field uid from pixel_to_lla_request message + * + * @return Unique ID of the request. + */ +static inline uint64_t mavlink_msg_pixel_to_lla_request_get_uid(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 0); +} + +/** + * @brief Get field img_unix_ts from pixel_to_lla_request message + * + * @return [us] Unix time stamp of the image. + */ +static inline uint64_t mavlink_msg_pixel_to_lla_request_get_img_unix_ts(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 8); +} + +/** + * @brief Get field img_rel_x from pixel_to_lla_request message + * + * @return Relative image x coordinate (left to right axis) in the range of [0.0, 1.0]. + */ +static inline float mavlink_msg_pixel_to_lla_request_get_img_rel_x(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 16); +} + +/** + * @brief Get field img_rel_y from pixel_to_lla_request message + * + * @return Relative image y coordinate (top to bottom axis) in the range of [0.0, 1.0]. + */ +static inline float mavlink_msg_pixel_to_lla_request_get_img_rel_y(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 20); +} + +/** + * @brief Decode a pixel_to_lla_request message into a struct + * + * @param msg The message to decode + * @param pixel_to_lla_request C-struct to decode the message contents into + */ +static inline void mavlink_msg_pixel_to_lla_request_decode(const mavlink_message_t* msg, mavlink_pixel_to_lla_request_t* pixel_to_lla_request) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + pixel_to_lla_request->uid = mavlink_msg_pixel_to_lla_request_get_uid(msg); + pixel_to_lla_request->img_unix_ts = mavlink_msg_pixel_to_lla_request_get_img_unix_ts(msg); + pixel_to_lla_request->img_rel_x = mavlink_msg_pixel_to_lla_request_get_img_rel_x(msg); + pixel_to_lla_request->img_rel_y = mavlink_msg_pixel_to_lla_request_get_img_rel_y(msg); + pixel_to_lla_request->camera_id = mavlink_msg_pixel_to_lla_request_get_camera_id(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_LEN? msg->len : MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_LEN; + memset(pixel_to_lla_request, 0, MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_LEN); + memcpy(pixel_to_lla_request, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/auterion/mavlink_msg_pixel_to_lla_result.h b/auterion/mavlink_msg_pixel_to_lla_result.h new file mode 100644 index 000000000..0a0b8fc1c --- /dev/null +++ b/auterion/mavlink_msg_pixel_to_lla_result.h @@ -0,0 +1,419 @@ +#pragma once +// MESSAGE PIXEL_TO_LLA_RESULT PACKING + +#define MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT 602 + + +typedef struct __mavlink_pixel_to_lla_result_t { + uint64_t uid; /*< Unique ID of the request.*/ + double latitude; /*< [deg] Latitude of the requested pixel (degrees, WGS84).*/ + double longitude; /*< [deg] Longitude of the requested pixel (degrees, WGS84).*/ + double altitude; /*< [m] Altitude of the requested pixel (meters, WGS84 ellipsoid).*/ + float ned_homography_matrix[9]; /*< 3x3 matrix for NED (North-East-Down) homography transform of the image. Row-major order.*/ + uint8_t status; /*< 0 = Failure, 1 = Success. If failure, error_message will provide details.*/ + char error_message[100]; /*< Optional error message in case of failure. Max length 100 characters.*/ +} mavlink_pixel_to_lla_result_t; + +#define MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_LEN 169 +#define MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_MIN_LEN 169 +#define MAVLINK_MSG_ID_602_LEN 169 +#define MAVLINK_MSG_ID_602_MIN_LEN 169 + +#define MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_CRC 202 +#define MAVLINK_MSG_ID_602_CRC 202 + +#define MAVLINK_MSG_PIXEL_TO_LLA_RESULT_FIELD_NED_HOMOGRAPHY_MATRIX_LEN 9 +#define MAVLINK_MSG_PIXEL_TO_LLA_RESULT_FIELD_ERROR_MESSAGE_LEN 100 + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_PIXEL_TO_LLA_RESULT { \ + 602, \ + "PIXEL_TO_LLA_RESULT", \ + 7, \ + { { "uid", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_pixel_to_lla_result_t, uid) }, \ + { "status", NULL, MAVLINK_TYPE_UINT8_T, 0, 68, offsetof(mavlink_pixel_to_lla_result_t, status) }, \ + { "latitude", NULL, MAVLINK_TYPE_DOUBLE, 0, 8, offsetof(mavlink_pixel_to_lla_result_t, latitude) }, \ + { "longitude", NULL, MAVLINK_TYPE_DOUBLE, 0, 16, offsetof(mavlink_pixel_to_lla_result_t, longitude) }, \ + { "altitude", NULL, MAVLINK_TYPE_DOUBLE, 0, 24, offsetof(mavlink_pixel_to_lla_result_t, altitude) }, \ + { "ned_homography_matrix", NULL, MAVLINK_TYPE_FLOAT, 9, 32, offsetof(mavlink_pixel_to_lla_result_t, ned_homography_matrix) }, \ + { "error_message", NULL, MAVLINK_TYPE_CHAR, 100, 69, offsetof(mavlink_pixel_to_lla_result_t, error_message) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_PIXEL_TO_LLA_RESULT { \ + "PIXEL_TO_LLA_RESULT", \ + 7, \ + { { "uid", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_pixel_to_lla_result_t, uid) }, \ + { "status", NULL, MAVLINK_TYPE_UINT8_T, 0, 68, offsetof(mavlink_pixel_to_lla_result_t, status) }, \ + { "latitude", NULL, MAVLINK_TYPE_DOUBLE, 0, 8, offsetof(mavlink_pixel_to_lla_result_t, latitude) }, \ + { "longitude", NULL, MAVLINK_TYPE_DOUBLE, 0, 16, offsetof(mavlink_pixel_to_lla_result_t, longitude) }, \ + { "altitude", NULL, MAVLINK_TYPE_DOUBLE, 0, 24, offsetof(mavlink_pixel_to_lla_result_t, altitude) }, \ + { "ned_homography_matrix", NULL, MAVLINK_TYPE_FLOAT, 9, 32, offsetof(mavlink_pixel_to_lla_result_t, ned_homography_matrix) }, \ + { "error_message", NULL, MAVLINK_TYPE_CHAR, 100, 69, offsetof(mavlink_pixel_to_lla_result_t, error_message) }, \ + } \ +} +#endif + +/** + * @brief Pack a pixel_to_lla_result message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param uid Unique ID of the request. + * @param status 0 = Failure, 1 = Success. If failure, error_message will provide details. + * @param latitude [deg] Latitude of the requested pixel (degrees, WGS84). + * @param longitude [deg] Longitude of the requested pixel (degrees, WGS84). + * @param altitude [m] Altitude of the requested pixel (meters, WGS84 ellipsoid). + * @param ned_homography_matrix 3x3 matrix for NED (North-East-Down) homography transform of the image. Row-major order. + * @param error_message Optional error message in case of failure. Max length 100 characters. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_pixel_to_lla_result_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint64_t uid, uint8_t status, double latitude, double longitude, double altitude, const float *ned_homography_matrix, const char *error_message) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_LEN]; + _mav_put_uint64_t(buf, 0, uid); + _mav_put_double(buf, 8, latitude); + _mav_put_double(buf, 16, longitude); + _mav_put_double(buf, 24, altitude); + _mav_put_uint8_t(buf, 68, status); + _mav_put_float_array(buf, 32, ned_homography_matrix, 9); + _mav_put_char_array(buf, 69, error_message, 100); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_LEN); +#else + mavlink_pixel_to_lla_result_t packet; + packet.uid = uid; + packet.latitude = latitude; + packet.longitude = longitude; + packet.altitude = altitude; + packet.status = status; + mav_array_assign_float(packet.ned_homography_matrix, ned_homography_matrix, 9); + mav_array_assign_char(packet.error_message, error_message, 100); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_MIN_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_CRC); +} + +/** + * @brief Pack a pixel_to_lla_result message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param uid Unique ID of the request. + * @param status 0 = Failure, 1 = Success. If failure, error_message will provide details. + * @param latitude [deg] Latitude of the requested pixel (degrees, WGS84). + * @param longitude [deg] Longitude of the requested pixel (degrees, WGS84). + * @param altitude [m] Altitude of the requested pixel (meters, WGS84 ellipsoid). + * @param ned_homography_matrix 3x3 matrix for NED (North-East-Down) homography transform of the image. Row-major order. + * @param error_message Optional error message in case of failure. Max length 100 characters. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_pixel_to_lla_result_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t uid, uint8_t status, double latitude, double longitude, double altitude, const float *ned_homography_matrix, const char *error_message) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_LEN]; + _mav_put_uint64_t(buf, 0, uid); + _mav_put_double(buf, 8, latitude); + _mav_put_double(buf, 16, longitude); + _mav_put_double(buf, 24, altitude); + _mav_put_uint8_t(buf, 68, status); + _mav_put_float_array(buf, 32, ned_homography_matrix, 9); + _mav_put_char_array(buf, 69, error_message, 100); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_LEN); +#else + mavlink_pixel_to_lla_result_t packet; + packet.uid = uid; + packet.latitude = latitude; + packet.longitude = longitude; + packet.altitude = altitude; + packet.status = status; + mav_array_memcpy(packet.ned_homography_matrix, ned_homography_matrix, sizeof(float)*9); + mav_array_memcpy(packet.error_message, error_message, sizeof(char)*100); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_MIN_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_MIN_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_LEN); +#endif +} + +/** + * @brief Pack a pixel_to_lla_result message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param uid Unique ID of the request. + * @param status 0 = Failure, 1 = Success. If failure, error_message will provide details. + * @param latitude [deg] Latitude of the requested pixel (degrees, WGS84). + * @param longitude [deg] Longitude of the requested pixel (degrees, WGS84). + * @param altitude [m] Altitude of the requested pixel (meters, WGS84 ellipsoid). + * @param ned_homography_matrix 3x3 matrix for NED (North-East-Down) homography transform of the image. Row-major order. + * @param error_message Optional error message in case of failure. Max length 100 characters. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_pixel_to_lla_result_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint64_t uid,uint8_t status,double latitude,double longitude,double altitude,const float *ned_homography_matrix,const char *error_message) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_LEN]; + _mav_put_uint64_t(buf, 0, uid); + _mav_put_double(buf, 8, latitude); + _mav_put_double(buf, 16, longitude); + _mav_put_double(buf, 24, altitude); + _mav_put_uint8_t(buf, 68, status); + _mav_put_float_array(buf, 32, ned_homography_matrix, 9); + _mav_put_char_array(buf, 69, error_message, 100); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_LEN); +#else + mavlink_pixel_to_lla_result_t packet; + packet.uid = uid; + packet.latitude = latitude; + packet.longitude = longitude; + packet.altitude = altitude; + packet.status = status; + mav_array_assign_float(packet.ned_homography_matrix, ned_homography_matrix, 9); + mav_array_assign_char(packet.error_message, error_message, 100); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_MIN_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_CRC); +} + +/** + * @brief Encode a pixel_to_lla_result struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param pixel_to_lla_result C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_pixel_to_lla_result_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_pixel_to_lla_result_t* pixel_to_lla_result) +{ + return mavlink_msg_pixel_to_lla_result_pack(system_id, component_id, msg, pixel_to_lla_result->uid, pixel_to_lla_result->status, pixel_to_lla_result->latitude, pixel_to_lla_result->longitude, pixel_to_lla_result->altitude, pixel_to_lla_result->ned_homography_matrix, pixel_to_lla_result->error_message); +} + +/** + * @brief Encode a pixel_to_lla_result struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param pixel_to_lla_result C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_pixel_to_lla_result_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_pixel_to_lla_result_t* pixel_to_lla_result) +{ + return mavlink_msg_pixel_to_lla_result_pack_chan(system_id, component_id, chan, msg, pixel_to_lla_result->uid, pixel_to_lla_result->status, pixel_to_lla_result->latitude, pixel_to_lla_result->longitude, pixel_to_lla_result->altitude, pixel_to_lla_result->ned_homography_matrix, pixel_to_lla_result->error_message); +} + +/** + * @brief Encode a pixel_to_lla_result struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param pixel_to_lla_result C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_pixel_to_lla_result_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_pixel_to_lla_result_t* pixel_to_lla_result) +{ + return mavlink_msg_pixel_to_lla_result_pack_status(system_id, component_id, _status, msg, pixel_to_lla_result->uid, pixel_to_lla_result->status, pixel_to_lla_result->latitude, pixel_to_lla_result->longitude, pixel_to_lla_result->altitude, pixel_to_lla_result->ned_homography_matrix, pixel_to_lla_result->error_message); +} + +/** + * @brief Send a pixel_to_lla_result message + * @param chan MAVLink channel to send the message + * + * @param uid Unique ID of the request. + * @param status 0 = Failure, 1 = Success. If failure, error_message will provide details. + * @param latitude [deg] Latitude of the requested pixel (degrees, WGS84). + * @param longitude [deg] Longitude of the requested pixel (degrees, WGS84). + * @param altitude [m] Altitude of the requested pixel (meters, WGS84 ellipsoid). + * @param ned_homography_matrix 3x3 matrix for NED (North-East-Down) homography transform of the image. Row-major order. + * @param error_message Optional error message in case of failure. Max length 100 characters. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_pixel_to_lla_result_send(mavlink_channel_t chan, uint64_t uid, uint8_t status, double latitude, double longitude, double altitude, const float *ned_homography_matrix, const char *error_message) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_LEN]; + _mav_put_uint64_t(buf, 0, uid); + _mav_put_double(buf, 8, latitude); + _mav_put_double(buf, 16, longitude); + _mav_put_double(buf, 24, altitude); + _mav_put_uint8_t(buf, 68, status); + _mav_put_float_array(buf, 32, ned_homography_matrix, 9); + _mav_put_char_array(buf, 69, error_message, 100); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT, buf, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_MIN_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_CRC); +#else + mavlink_pixel_to_lla_result_t packet; + packet.uid = uid; + packet.latitude = latitude; + packet.longitude = longitude; + packet.altitude = altitude; + packet.status = status; + mav_array_assign_float(packet.ned_homography_matrix, ned_homography_matrix, 9); + mav_array_assign_char(packet.error_message, error_message, 100); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT, (const char *)&packet, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_MIN_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_CRC); +#endif +} + +/** + * @brief Send a pixel_to_lla_result message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_pixel_to_lla_result_send_struct(mavlink_channel_t chan, const mavlink_pixel_to_lla_result_t* pixel_to_lla_result) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_pixel_to_lla_result_send(chan, pixel_to_lla_result->uid, pixel_to_lla_result->status, pixel_to_lla_result->latitude, pixel_to_lla_result->longitude, pixel_to_lla_result->altitude, pixel_to_lla_result->ned_homography_matrix, pixel_to_lla_result->error_message); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT, (const char *)pixel_to_lla_result, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_MIN_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_CRC); +#endif +} + +#if MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_pixel_to_lla_result_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t uid, uint8_t status, double latitude, double longitude, double altitude, const float *ned_homography_matrix, const char *error_message) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint64_t(buf, 0, uid); + _mav_put_double(buf, 8, latitude); + _mav_put_double(buf, 16, longitude); + _mav_put_double(buf, 24, altitude); + _mav_put_uint8_t(buf, 68, status); + _mav_put_float_array(buf, 32, ned_homography_matrix, 9); + _mav_put_char_array(buf, 69, error_message, 100); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT, buf, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_MIN_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_CRC); +#else + mavlink_pixel_to_lla_result_t *packet = (mavlink_pixel_to_lla_result_t *)msgbuf; + packet->uid = uid; + packet->latitude = latitude; + packet->longitude = longitude; + packet->altitude = altitude; + packet->status = status; + mav_array_assign_float(packet->ned_homography_matrix, ned_homography_matrix, 9); + mav_array_assign_char(packet->error_message, error_message, 100); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT, (const char *)packet, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_MIN_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_LEN, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_CRC); +#endif +} +#endif + +#endif + +// MESSAGE PIXEL_TO_LLA_RESULT UNPACKING + + +/** + * @brief Get field uid from pixel_to_lla_result message + * + * @return Unique ID of the request. + */ +static inline uint64_t mavlink_msg_pixel_to_lla_result_get_uid(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 0); +} + +/** + * @brief Get field status from pixel_to_lla_result message + * + * @return 0 = Failure, 1 = Success. If failure, error_message will provide details. + */ +static inline uint8_t mavlink_msg_pixel_to_lla_result_get_status(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 68); +} + +/** + * @brief Get field latitude from pixel_to_lla_result message + * + * @return [deg] Latitude of the requested pixel (degrees, WGS84). + */ +static inline double mavlink_msg_pixel_to_lla_result_get_latitude(const mavlink_message_t* msg) +{ + return _MAV_RETURN_double(msg, 8); +} + +/** + * @brief Get field longitude from pixel_to_lla_result message + * + * @return [deg] Longitude of the requested pixel (degrees, WGS84). + */ +static inline double mavlink_msg_pixel_to_lla_result_get_longitude(const mavlink_message_t* msg) +{ + return _MAV_RETURN_double(msg, 16); +} + +/** + * @brief Get field altitude from pixel_to_lla_result message + * + * @return [m] Altitude of the requested pixel (meters, WGS84 ellipsoid). + */ +static inline double mavlink_msg_pixel_to_lla_result_get_altitude(const mavlink_message_t* msg) +{ + return _MAV_RETURN_double(msg, 24); +} + +/** + * @brief Get field ned_homography_matrix from pixel_to_lla_result message + * + * @return 3x3 matrix for NED (North-East-Down) homography transform of the image. Row-major order. + */ +static inline uint16_t mavlink_msg_pixel_to_lla_result_get_ned_homography_matrix(const mavlink_message_t* msg, float *ned_homography_matrix) +{ + return _MAV_RETURN_float_array(msg, ned_homography_matrix, 9, 32); +} + +/** + * @brief Get field error_message from pixel_to_lla_result message + * + * @return Optional error message in case of failure. Max length 100 characters. + */ +static inline uint16_t mavlink_msg_pixel_to_lla_result_get_error_message(const mavlink_message_t* msg, char *error_message) +{ + return _MAV_RETURN_char_array(msg, error_message, 100, 69); +} + +/** + * @brief Decode a pixel_to_lla_result message into a struct + * + * @param msg The message to decode + * @param pixel_to_lla_result C-struct to decode the message contents into + */ +static inline void mavlink_msg_pixel_to_lla_result_decode(const mavlink_message_t* msg, mavlink_pixel_to_lla_result_t* pixel_to_lla_result) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + pixel_to_lla_result->uid = mavlink_msg_pixel_to_lla_result_get_uid(msg); + pixel_to_lla_result->latitude = mavlink_msg_pixel_to_lla_result_get_latitude(msg); + pixel_to_lla_result->longitude = mavlink_msg_pixel_to_lla_result_get_longitude(msg); + pixel_to_lla_result->altitude = mavlink_msg_pixel_to_lla_result_get_altitude(msg); + mavlink_msg_pixel_to_lla_result_get_ned_homography_matrix(msg, pixel_to_lla_result->ned_homography_matrix); + pixel_to_lla_result->status = mavlink_msg_pixel_to_lla_result_get_status(msg); + mavlink_msg_pixel_to_lla_result_get_error_message(msg, pixel_to_lla_result->error_message); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_LEN? msg->len : MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_LEN; + memset(pixel_to_lla_result, 0, MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_LEN); + memcpy(pixel_to_lla_result, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/auterion/mavlink_msg_radar_target_track.h b/auterion/mavlink_msg_radar_target_track.h new file mode 100644 index 000000000..92ff195de --- /dev/null +++ b/auterion/mavlink_msg_radar_target_track.h @@ -0,0 +1,586 @@ +#pragma once +// MESSAGE RADAR_TARGET_TRACK PACKING + +#define MAVLINK_MSG_ID_RADAR_TARGET_TRACK 13672 + + +typedef struct __mavlink_radar_target_track_t { + uint64_t time_usec; /*< [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.*/ + float distance_to_target; /*< [m] Distance of the vehicle to the target in meters.*/ + float bearing_to_target; /*< [deg] Bearing of the target in degrees. See bearing_type field for reference frame.*/ + float target_speed; /*< [m/s] Target's absolute speed over ground. Measured in meters per second. */ + float target_course; /*< [deg] Target's course. Measured in degrees. See course_type field for reference frame.*/ + float distance_to_closest_point_of_approach; /*< [m] Distance to the closest point of approach. Measured in meters.*/ + float time_to_closest_point_of_approach; /*< [s] Time to the closest point of approach. Measured in seconds.*/ + uint16_t target_number; /*< Numeric ID of a particular target. Each target has a unique numeric ID.*/ + uint8_t bearing_type; /*< Type of bearing measurement.*/ + uint8_t course_type; /*< Type of course measurement.*/ + char target_name[20]; /*< Name of the target.*/ + uint8_t target_track_status; /*< Status of the target track.*/ + uint8_t target_track_acquisition_type; /*< Type of target acquisition.*/ +} mavlink_radar_target_track_t; + +#define MAVLINK_MSG_ID_RADAR_TARGET_TRACK_LEN 58 +#define MAVLINK_MSG_ID_RADAR_TARGET_TRACK_MIN_LEN 58 +#define MAVLINK_MSG_ID_13672_LEN 58 +#define MAVLINK_MSG_ID_13672_MIN_LEN 58 + +#define MAVLINK_MSG_ID_RADAR_TARGET_TRACK_CRC 130 +#define MAVLINK_MSG_ID_13672_CRC 130 + +#define MAVLINK_MSG_RADAR_TARGET_TRACK_FIELD_TARGET_NAME_LEN 20 + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_RADAR_TARGET_TRACK { \ + 13672, \ + "RADAR_TARGET_TRACK", \ + 13, \ + { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_radar_target_track_t, time_usec) }, \ + { "target_number", NULL, MAVLINK_TYPE_UINT16_T, 0, 32, offsetof(mavlink_radar_target_track_t, target_number) }, \ + { "distance_to_target", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_radar_target_track_t, distance_to_target) }, \ + { "bearing_to_target", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_radar_target_track_t, bearing_to_target) }, \ + { "bearing_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_radar_target_track_t, bearing_type) }, \ + { "target_speed", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_radar_target_track_t, target_speed) }, \ + { "target_course", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_radar_target_track_t, target_course) }, \ + { "course_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 35, offsetof(mavlink_radar_target_track_t, course_type) }, \ + { "distance_to_closest_point_of_approach", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_radar_target_track_t, distance_to_closest_point_of_approach) }, \ + { "time_to_closest_point_of_approach", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_radar_target_track_t, time_to_closest_point_of_approach) }, \ + { "target_name", NULL, MAVLINK_TYPE_CHAR, 20, 36, offsetof(mavlink_radar_target_track_t, target_name) }, \ + { "target_track_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 56, offsetof(mavlink_radar_target_track_t, target_track_status) }, \ + { "target_track_acquisition_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 57, offsetof(mavlink_radar_target_track_t, target_track_acquisition_type) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_RADAR_TARGET_TRACK { \ + "RADAR_TARGET_TRACK", \ + 13, \ + { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_radar_target_track_t, time_usec) }, \ + { "target_number", NULL, MAVLINK_TYPE_UINT16_T, 0, 32, offsetof(mavlink_radar_target_track_t, target_number) }, \ + { "distance_to_target", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_radar_target_track_t, distance_to_target) }, \ + { "bearing_to_target", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_radar_target_track_t, bearing_to_target) }, \ + { "bearing_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_radar_target_track_t, bearing_type) }, \ + { "target_speed", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_radar_target_track_t, target_speed) }, \ + { "target_course", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_radar_target_track_t, target_course) }, \ + { "course_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 35, offsetof(mavlink_radar_target_track_t, course_type) }, \ + { "distance_to_closest_point_of_approach", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_radar_target_track_t, distance_to_closest_point_of_approach) }, \ + { "time_to_closest_point_of_approach", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_radar_target_track_t, time_to_closest_point_of_approach) }, \ + { "target_name", NULL, MAVLINK_TYPE_CHAR, 20, 36, offsetof(mavlink_radar_target_track_t, target_name) }, \ + { "target_track_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 56, offsetof(mavlink_radar_target_track_t, target_track_status) }, \ + { "target_track_acquisition_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 57, offsetof(mavlink_radar_target_track_t, target_track_acquisition_type) }, \ + } \ +} +#endif + +/** + * @brief Pack a radar_target_track message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param target_number Numeric ID of a particular target. Each target has a unique numeric ID. + * @param distance_to_target [m] Distance of the vehicle to the target in meters. + * @param bearing_to_target [deg] Bearing of the target in degrees. See bearing_type field for reference frame. + * @param bearing_type Type of bearing measurement. + * @param target_speed [m/s] Target's absolute speed over ground. Measured in meters per second. + * @param target_course [deg] Target's course. Measured in degrees. See course_type field for reference frame. + * @param course_type Type of course measurement. + * @param distance_to_closest_point_of_approach [m] Distance to the closest point of approach. Measured in meters. + * @param time_to_closest_point_of_approach [s] Time to the closest point of approach. Measured in seconds. + * @param target_name Name of the target. + * @param target_track_status Status of the target track. + * @param target_track_acquisition_type Type of target acquisition. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_radar_target_track_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint64_t time_usec, uint16_t target_number, float distance_to_target, float bearing_to_target, uint8_t bearing_type, float target_speed, float target_course, uint8_t course_type, float distance_to_closest_point_of_approach, float time_to_closest_point_of_approach, const char *target_name, uint8_t target_track_status, uint8_t target_track_acquisition_type) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RADAR_TARGET_TRACK_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, distance_to_target); + _mav_put_float(buf, 12, bearing_to_target); + _mav_put_float(buf, 16, target_speed); + _mav_put_float(buf, 20, target_course); + _mav_put_float(buf, 24, distance_to_closest_point_of_approach); + _mav_put_float(buf, 28, time_to_closest_point_of_approach); + _mav_put_uint16_t(buf, 32, target_number); + _mav_put_uint8_t(buf, 34, bearing_type); + _mav_put_uint8_t(buf, 35, course_type); + _mav_put_uint8_t(buf, 56, target_track_status); + _mav_put_uint8_t(buf, 57, target_track_acquisition_type); + _mav_put_char_array(buf, 36, target_name, 20); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_LEN); +#else + mavlink_radar_target_track_t packet; + packet.time_usec = time_usec; + packet.distance_to_target = distance_to_target; + packet.bearing_to_target = bearing_to_target; + packet.target_speed = target_speed; + packet.target_course = target_course; + packet.distance_to_closest_point_of_approach = distance_to_closest_point_of_approach; + packet.time_to_closest_point_of_approach = time_to_closest_point_of_approach; + packet.target_number = target_number; + packet.bearing_type = bearing_type; + packet.course_type = course_type; + packet.target_track_status = target_track_status; + packet.target_track_acquisition_type = target_track_acquisition_type; + mav_array_assign_char(packet.target_name, target_name, 20); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_RADAR_TARGET_TRACK; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_MIN_LEN, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_LEN, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_CRC); +} + +/** + * @brief Pack a radar_target_track message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param target_number Numeric ID of a particular target. Each target has a unique numeric ID. + * @param distance_to_target [m] Distance of the vehicle to the target in meters. + * @param bearing_to_target [deg] Bearing of the target in degrees. See bearing_type field for reference frame. + * @param bearing_type Type of bearing measurement. + * @param target_speed [m/s] Target's absolute speed over ground. Measured in meters per second. + * @param target_course [deg] Target's course. Measured in degrees. See course_type field for reference frame. + * @param course_type Type of course measurement. + * @param distance_to_closest_point_of_approach [m] Distance to the closest point of approach. Measured in meters. + * @param time_to_closest_point_of_approach [s] Time to the closest point of approach. Measured in seconds. + * @param target_name Name of the target. + * @param target_track_status Status of the target track. + * @param target_track_acquisition_type Type of target acquisition. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_radar_target_track_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, uint16_t target_number, float distance_to_target, float bearing_to_target, uint8_t bearing_type, float target_speed, float target_course, uint8_t course_type, float distance_to_closest_point_of_approach, float time_to_closest_point_of_approach, const char *target_name, uint8_t target_track_status, uint8_t target_track_acquisition_type) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RADAR_TARGET_TRACK_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, distance_to_target); + _mav_put_float(buf, 12, bearing_to_target); + _mav_put_float(buf, 16, target_speed); + _mav_put_float(buf, 20, target_course); + _mav_put_float(buf, 24, distance_to_closest_point_of_approach); + _mav_put_float(buf, 28, time_to_closest_point_of_approach); + _mav_put_uint16_t(buf, 32, target_number); + _mav_put_uint8_t(buf, 34, bearing_type); + _mav_put_uint8_t(buf, 35, course_type); + _mav_put_uint8_t(buf, 56, target_track_status); + _mav_put_uint8_t(buf, 57, target_track_acquisition_type); + _mav_put_char_array(buf, 36, target_name, 20); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_LEN); +#else + mavlink_radar_target_track_t packet; + packet.time_usec = time_usec; + packet.distance_to_target = distance_to_target; + packet.bearing_to_target = bearing_to_target; + packet.target_speed = target_speed; + packet.target_course = target_course; + packet.distance_to_closest_point_of_approach = distance_to_closest_point_of_approach; + packet.time_to_closest_point_of_approach = time_to_closest_point_of_approach; + packet.target_number = target_number; + packet.bearing_type = bearing_type; + packet.course_type = course_type; + packet.target_track_status = target_track_status; + packet.target_track_acquisition_type = target_track_acquisition_type; + mav_array_memcpy(packet.target_name, target_name, sizeof(char)*20); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_RADAR_TARGET_TRACK; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_MIN_LEN, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_LEN, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_MIN_LEN, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_LEN); +#endif +} + +/** + * @brief Pack a radar_target_track message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param target_number Numeric ID of a particular target. Each target has a unique numeric ID. + * @param distance_to_target [m] Distance of the vehicle to the target in meters. + * @param bearing_to_target [deg] Bearing of the target in degrees. See bearing_type field for reference frame. + * @param bearing_type Type of bearing measurement. + * @param target_speed [m/s] Target's absolute speed over ground. Measured in meters per second. + * @param target_course [deg] Target's course. Measured in degrees. See course_type field for reference frame. + * @param course_type Type of course measurement. + * @param distance_to_closest_point_of_approach [m] Distance to the closest point of approach. Measured in meters. + * @param time_to_closest_point_of_approach [s] Time to the closest point of approach. Measured in seconds. + * @param target_name Name of the target. + * @param target_track_status Status of the target track. + * @param target_track_acquisition_type Type of target acquisition. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_radar_target_track_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint64_t time_usec,uint16_t target_number,float distance_to_target,float bearing_to_target,uint8_t bearing_type,float target_speed,float target_course,uint8_t course_type,float distance_to_closest_point_of_approach,float time_to_closest_point_of_approach,const char *target_name,uint8_t target_track_status,uint8_t target_track_acquisition_type) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RADAR_TARGET_TRACK_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, distance_to_target); + _mav_put_float(buf, 12, bearing_to_target); + _mav_put_float(buf, 16, target_speed); + _mav_put_float(buf, 20, target_course); + _mav_put_float(buf, 24, distance_to_closest_point_of_approach); + _mav_put_float(buf, 28, time_to_closest_point_of_approach); + _mav_put_uint16_t(buf, 32, target_number); + _mav_put_uint8_t(buf, 34, bearing_type); + _mav_put_uint8_t(buf, 35, course_type); + _mav_put_uint8_t(buf, 56, target_track_status); + _mav_put_uint8_t(buf, 57, target_track_acquisition_type); + _mav_put_char_array(buf, 36, target_name, 20); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_LEN); +#else + mavlink_radar_target_track_t packet; + packet.time_usec = time_usec; + packet.distance_to_target = distance_to_target; + packet.bearing_to_target = bearing_to_target; + packet.target_speed = target_speed; + packet.target_course = target_course; + packet.distance_to_closest_point_of_approach = distance_to_closest_point_of_approach; + packet.time_to_closest_point_of_approach = time_to_closest_point_of_approach; + packet.target_number = target_number; + packet.bearing_type = bearing_type; + packet.course_type = course_type; + packet.target_track_status = target_track_status; + packet.target_track_acquisition_type = target_track_acquisition_type; + mav_array_assign_char(packet.target_name, target_name, 20); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_RADAR_TARGET_TRACK; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_MIN_LEN, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_LEN, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_CRC); +} + +/** + * @brief Encode a radar_target_track struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param radar_target_track C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_radar_target_track_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_radar_target_track_t* radar_target_track) +{ + return mavlink_msg_radar_target_track_pack(system_id, component_id, msg, radar_target_track->time_usec, radar_target_track->target_number, radar_target_track->distance_to_target, radar_target_track->bearing_to_target, radar_target_track->bearing_type, radar_target_track->target_speed, radar_target_track->target_course, radar_target_track->course_type, radar_target_track->distance_to_closest_point_of_approach, radar_target_track->time_to_closest_point_of_approach, radar_target_track->target_name, radar_target_track->target_track_status, radar_target_track->target_track_acquisition_type); +} + +/** + * @brief Encode a radar_target_track struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param radar_target_track C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_radar_target_track_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_radar_target_track_t* radar_target_track) +{ + return mavlink_msg_radar_target_track_pack_chan(system_id, component_id, chan, msg, radar_target_track->time_usec, radar_target_track->target_number, radar_target_track->distance_to_target, radar_target_track->bearing_to_target, radar_target_track->bearing_type, radar_target_track->target_speed, radar_target_track->target_course, radar_target_track->course_type, radar_target_track->distance_to_closest_point_of_approach, radar_target_track->time_to_closest_point_of_approach, radar_target_track->target_name, radar_target_track->target_track_status, radar_target_track->target_track_acquisition_type); +} + +/** + * @brief Encode a radar_target_track struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param radar_target_track C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_radar_target_track_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_radar_target_track_t* radar_target_track) +{ + return mavlink_msg_radar_target_track_pack_status(system_id, component_id, _status, msg, radar_target_track->time_usec, radar_target_track->target_number, radar_target_track->distance_to_target, radar_target_track->bearing_to_target, radar_target_track->bearing_type, radar_target_track->target_speed, radar_target_track->target_course, radar_target_track->course_type, radar_target_track->distance_to_closest_point_of_approach, radar_target_track->time_to_closest_point_of_approach, radar_target_track->target_name, radar_target_track->target_track_status, radar_target_track->target_track_acquisition_type); +} + +/** + * @brief Send a radar_target_track message + * @param chan MAVLink channel to send the message + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param target_number Numeric ID of a particular target. Each target has a unique numeric ID. + * @param distance_to_target [m] Distance of the vehicle to the target in meters. + * @param bearing_to_target [deg] Bearing of the target in degrees. See bearing_type field for reference frame. + * @param bearing_type Type of bearing measurement. + * @param target_speed [m/s] Target's absolute speed over ground. Measured in meters per second. + * @param target_course [deg] Target's course. Measured in degrees. See course_type field for reference frame. + * @param course_type Type of course measurement. + * @param distance_to_closest_point_of_approach [m] Distance to the closest point of approach. Measured in meters. + * @param time_to_closest_point_of_approach [s] Time to the closest point of approach. Measured in seconds. + * @param target_name Name of the target. + * @param target_track_status Status of the target track. + * @param target_track_acquisition_type Type of target acquisition. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_radar_target_track_send(mavlink_channel_t chan, uint64_t time_usec, uint16_t target_number, float distance_to_target, float bearing_to_target, uint8_t bearing_type, float target_speed, float target_course, uint8_t course_type, float distance_to_closest_point_of_approach, float time_to_closest_point_of_approach, const char *target_name, uint8_t target_track_status, uint8_t target_track_acquisition_type) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RADAR_TARGET_TRACK_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, distance_to_target); + _mav_put_float(buf, 12, bearing_to_target); + _mav_put_float(buf, 16, target_speed); + _mav_put_float(buf, 20, target_course); + _mav_put_float(buf, 24, distance_to_closest_point_of_approach); + _mav_put_float(buf, 28, time_to_closest_point_of_approach); + _mav_put_uint16_t(buf, 32, target_number); + _mav_put_uint8_t(buf, 34, bearing_type); + _mav_put_uint8_t(buf, 35, course_type); + _mav_put_uint8_t(buf, 56, target_track_status); + _mav_put_uint8_t(buf, 57, target_track_acquisition_type); + _mav_put_char_array(buf, 36, target_name, 20); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADAR_TARGET_TRACK, buf, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_MIN_LEN, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_LEN, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_CRC); +#else + mavlink_radar_target_track_t packet; + packet.time_usec = time_usec; + packet.distance_to_target = distance_to_target; + packet.bearing_to_target = bearing_to_target; + packet.target_speed = target_speed; + packet.target_course = target_course; + packet.distance_to_closest_point_of_approach = distance_to_closest_point_of_approach; + packet.time_to_closest_point_of_approach = time_to_closest_point_of_approach; + packet.target_number = target_number; + packet.bearing_type = bearing_type; + packet.course_type = course_type; + packet.target_track_status = target_track_status; + packet.target_track_acquisition_type = target_track_acquisition_type; + mav_array_assign_char(packet.target_name, target_name, 20); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADAR_TARGET_TRACK, (const char *)&packet, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_MIN_LEN, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_LEN, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_CRC); +#endif +} + +/** + * @brief Send a radar_target_track message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_radar_target_track_send_struct(mavlink_channel_t chan, const mavlink_radar_target_track_t* radar_target_track) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_radar_target_track_send(chan, radar_target_track->time_usec, radar_target_track->target_number, radar_target_track->distance_to_target, radar_target_track->bearing_to_target, radar_target_track->bearing_type, radar_target_track->target_speed, radar_target_track->target_course, radar_target_track->course_type, radar_target_track->distance_to_closest_point_of_approach, radar_target_track->time_to_closest_point_of_approach, radar_target_track->target_name, radar_target_track->target_track_status, radar_target_track->target_track_acquisition_type); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADAR_TARGET_TRACK, (const char *)radar_target_track, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_MIN_LEN, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_LEN, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_CRC); +#endif +} + +#if MAVLINK_MSG_ID_RADAR_TARGET_TRACK_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_radar_target_track_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint16_t target_number, float distance_to_target, float bearing_to_target, uint8_t bearing_type, float target_speed, float target_course, uint8_t course_type, float distance_to_closest_point_of_approach, float time_to_closest_point_of_approach, const char *target_name, uint8_t target_track_status, uint8_t target_track_acquisition_type) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, distance_to_target); + _mav_put_float(buf, 12, bearing_to_target); + _mav_put_float(buf, 16, target_speed); + _mav_put_float(buf, 20, target_course); + _mav_put_float(buf, 24, distance_to_closest_point_of_approach); + _mav_put_float(buf, 28, time_to_closest_point_of_approach); + _mav_put_uint16_t(buf, 32, target_number); + _mav_put_uint8_t(buf, 34, bearing_type); + _mav_put_uint8_t(buf, 35, course_type); + _mav_put_uint8_t(buf, 56, target_track_status); + _mav_put_uint8_t(buf, 57, target_track_acquisition_type); + _mav_put_char_array(buf, 36, target_name, 20); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADAR_TARGET_TRACK, buf, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_MIN_LEN, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_LEN, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_CRC); +#else + mavlink_radar_target_track_t *packet = (mavlink_radar_target_track_t *)msgbuf; + packet->time_usec = time_usec; + packet->distance_to_target = distance_to_target; + packet->bearing_to_target = bearing_to_target; + packet->target_speed = target_speed; + packet->target_course = target_course; + packet->distance_to_closest_point_of_approach = distance_to_closest_point_of_approach; + packet->time_to_closest_point_of_approach = time_to_closest_point_of_approach; + packet->target_number = target_number; + packet->bearing_type = bearing_type; + packet->course_type = course_type; + packet->target_track_status = target_track_status; + packet->target_track_acquisition_type = target_track_acquisition_type; + mav_array_assign_char(packet->target_name, target_name, 20); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADAR_TARGET_TRACK, (const char *)packet, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_MIN_LEN, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_LEN, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_CRC); +#endif +} +#endif + +#endif + +// MESSAGE RADAR_TARGET_TRACK UNPACKING + + +/** + * @brief Get field time_usec from radar_target_track message + * + * @return [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + */ +static inline uint64_t mavlink_msg_radar_target_track_get_time_usec(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 0); +} + +/** + * @brief Get field target_number from radar_target_track message + * + * @return Numeric ID of a particular target. Each target has a unique numeric ID. + */ +static inline uint16_t mavlink_msg_radar_target_track_get_target_number(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 32); +} + +/** + * @brief Get field distance_to_target from radar_target_track message + * + * @return [m] Distance of the vehicle to the target in meters. + */ +static inline float mavlink_msg_radar_target_track_get_distance_to_target(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 8); +} + +/** + * @brief Get field bearing_to_target from radar_target_track message + * + * @return [deg] Bearing of the target in degrees. See bearing_type field for reference frame. + */ +static inline float mavlink_msg_radar_target_track_get_bearing_to_target(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 12); +} + +/** + * @brief Get field bearing_type from radar_target_track message + * + * @return Type of bearing measurement. + */ +static inline uint8_t mavlink_msg_radar_target_track_get_bearing_type(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 34); +} + +/** + * @brief Get field target_speed from radar_target_track message + * + * @return [m/s] Target's absolute speed over ground. Measured in meters per second. + */ +static inline float mavlink_msg_radar_target_track_get_target_speed(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 16); +} + +/** + * @brief Get field target_course from radar_target_track message + * + * @return [deg] Target's course. Measured in degrees. See course_type field for reference frame. + */ +static inline float mavlink_msg_radar_target_track_get_target_course(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 20); +} + +/** + * @brief Get field course_type from radar_target_track message + * + * @return Type of course measurement. + */ +static inline uint8_t mavlink_msg_radar_target_track_get_course_type(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 35); +} + +/** + * @brief Get field distance_to_closest_point_of_approach from radar_target_track message + * + * @return [m] Distance to the closest point of approach. Measured in meters. + */ +static inline float mavlink_msg_radar_target_track_get_distance_to_closest_point_of_approach(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 24); +} + +/** + * @brief Get field time_to_closest_point_of_approach from radar_target_track message + * + * @return [s] Time to the closest point of approach. Measured in seconds. + */ +static inline float mavlink_msg_radar_target_track_get_time_to_closest_point_of_approach(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 28); +} + +/** + * @brief Get field target_name from radar_target_track message + * + * @return Name of the target. + */ +static inline uint16_t mavlink_msg_radar_target_track_get_target_name(const mavlink_message_t* msg, char *target_name) +{ + return _MAV_RETURN_char_array(msg, target_name, 20, 36); +} + +/** + * @brief Get field target_track_status from radar_target_track message + * + * @return Status of the target track. + */ +static inline uint8_t mavlink_msg_radar_target_track_get_target_track_status(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 56); +} + +/** + * @brief Get field target_track_acquisition_type from radar_target_track message + * + * @return Type of target acquisition. + */ +static inline uint8_t mavlink_msg_radar_target_track_get_target_track_acquisition_type(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 57); +} + +/** + * @brief Decode a radar_target_track message into a struct + * + * @param msg The message to decode + * @param radar_target_track C-struct to decode the message contents into + */ +static inline void mavlink_msg_radar_target_track_decode(const mavlink_message_t* msg, mavlink_radar_target_track_t* radar_target_track) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + radar_target_track->time_usec = mavlink_msg_radar_target_track_get_time_usec(msg); + radar_target_track->distance_to_target = mavlink_msg_radar_target_track_get_distance_to_target(msg); + radar_target_track->bearing_to_target = mavlink_msg_radar_target_track_get_bearing_to_target(msg); + radar_target_track->target_speed = mavlink_msg_radar_target_track_get_target_speed(msg); + radar_target_track->target_course = mavlink_msg_radar_target_track_get_target_course(msg); + radar_target_track->distance_to_closest_point_of_approach = mavlink_msg_radar_target_track_get_distance_to_closest_point_of_approach(msg); + radar_target_track->time_to_closest_point_of_approach = mavlink_msg_radar_target_track_get_time_to_closest_point_of_approach(msg); + radar_target_track->target_number = mavlink_msg_radar_target_track_get_target_number(msg); + radar_target_track->bearing_type = mavlink_msg_radar_target_track_get_bearing_type(msg); + radar_target_track->course_type = mavlink_msg_radar_target_track_get_course_type(msg); + mavlink_msg_radar_target_track_get_target_name(msg, radar_target_track->target_name); + radar_target_track->target_track_status = mavlink_msg_radar_target_track_get_target_track_status(msg); + radar_target_track->target_track_acquisition_type = mavlink_msg_radar_target_track_get_target_track_acquisition_type(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_RADAR_TARGET_TRACK_LEN? msg->len : MAVLINK_MSG_ID_RADAR_TARGET_TRACK_LEN; + memset(radar_target_track, 0, MAVLINK_MSG_ID_RADAR_TARGET_TRACK_LEN); + memcpy(radar_target_track, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/auterion/mavlink_msg_radiation_detector_counts.h b/auterion/mavlink_msg_radiation_detector_counts.h new file mode 100644 index 000000000..77ba81ec4 --- /dev/null +++ b/auterion/mavlink_msg_radiation_detector_counts.h @@ -0,0 +1,372 @@ +#pragma once +// MESSAGE RADIATION_DETECTOR_COUNTS PACKING + +#define MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS 460 + + +typedef struct __mavlink_radiation_detector_counts_t { + double timestamp; /*< [s] Timestamp of measurement(UNIX Epoch time or time since detector boot)*/ + uint64_t counts; /*< Accumulated detector counts*/ + uint64_t integration_time_usec; /*< [us] Integration period*/ + uint32_t serial_no; /*< Detector serial number*/ + uint32_t rate; /*< Detector count in the current dt integration period.*/ +} mavlink_radiation_detector_counts_t; + +#define MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_LEN 32 +#define MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_MIN_LEN 32 +#define MAVLINK_MSG_ID_460_LEN 32 +#define MAVLINK_MSG_ID_460_MIN_LEN 32 + +#define MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_CRC 228 +#define MAVLINK_MSG_ID_460_CRC 228 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_RADIATION_DETECTOR_COUNTS { \ + 460, \ + "RADIATION_DETECTOR_COUNTS", \ + 5, \ + { { "serial_no", NULL, MAVLINK_TYPE_UINT32_T, 0, 24, offsetof(mavlink_radiation_detector_counts_t, serial_no) }, \ + { "timestamp", NULL, MAVLINK_TYPE_DOUBLE, 0, 0, offsetof(mavlink_radiation_detector_counts_t, timestamp) }, \ + { "counts", NULL, MAVLINK_TYPE_UINT64_T, 0, 8, offsetof(mavlink_radiation_detector_counts_t, counts) }, \ + { "rate", NULL, MAVLINK_TYPE_UINT32_T, 0, 28, offsetof(mavlink_radiation_detector_counts_t, rate) }, \ + { "integration_time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 16, offsetof(mavlink_radiation_detector_counts_t, integration_time_usec) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_RADIATION_DETECTOR_COUNTS { \ + "RADIATION_DETECTOR_COUNTS", \ + 5, \ + { { "serial_no", NULL, MAVLINK_TYPE_UINT32_T, 0, 24, offsetof(mavlink_radiation_detector_counts_t, serial_no) }, \ + { "timestamp", NULL, MAVLINK_TYPE_DOUBLE, 0, 0, offsetof(mavlink_radiation_detector_counts_t, timestamp) }, \ + { "counts", NULL, MAVLINK_TYPE_UINT64_T, 0, 8, offsetof(mavlink_radiation_detector_counts_t, counts) }, \ + { "rate", NULL, MAVLINK_TYPE_UINT32_T, 0, 28, offsetof(mavlink_radiation_detector_counts_t, rate) }, \ + { "integration_time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 16, offsetof(mavlink_radiation_detector_counts_t, integration_time_usec) }, \ + } \ +} +#endif + +/** + * @brief Pack a radiation_detector_counts message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param serial_no Detector serial number + * @param timestamp [s] Timestamp of measurement(UNIX Epoch time or time since detector boot) + * @param counts Accumulated detector counts + * @param rate Detector count in the current dt integration period. + * @param integration_time_usec [us] Integration period + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_radiation_detector_counts_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint32_t serial_no, double timestamp, uint64_t counts, uint32_t rate, uint64_t integration_time_usec) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_LEN]; + _mav_put_double(buf, 0, timestamp); + _mav_put_uint64_t(buf, 8, counts); + _mav_put_uint64_t(buf, 16, integration_time_usec); + _mav_put_uint32_t(buf, 24, serial_no); + _mav_put_uint32_t(buf, 28, rate); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_LEN); +#else + mavlink_radiation_detector_counts_t packet; + packet.timestamp = timestamp; + packet.counts = counts; + packet.integration_time_usec = integration_time_usec; + packet.serial_no = serial_no; + packet.rate = rate; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_MIN_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_CRC); +} + +/** + * @brief Pack a radiation_detector_counts message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param serial_no Detector serial number + * @param timestamp [s] Timestamp of measurement(UNIX Epoch time or time since detector boot) + * @param counts Accumulated detector counts + * @param rate Detector count in the current dt integration period. + * @param integration_time_usec [us] Integration period + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_radiation_detector_counts_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t serial_no, double timestamp, uint64_t counts, uint32_t rate, uint64_t integration_time_usec) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_LEN]; + _mav_put_double(buf, 0, timestamp); + _mav_put_uint64_t(buf, 8, counts); + _mav_put_uint64_t(buf, 16, integration_time_usec); + _mav_put_uint32_t(buf, 24, serial_no); + _mav_put_uint32_t(buf, 28, rate); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_LEN); +#else + mavlink_radiation_detector_counts_t packet; + packet.timestamp = timestamp; + packet.counts = counts; + packet.integration_time_usec = integration_time_usec; + packet.serial_no = serial_no; + packet.rate = rate; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_MIN_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_MIN_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_LEN); +#endif +} + +/** + * @brief Pack a radiation_detector_counts message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param serial_no Detector serial number + * @param timestamp [s] Timestamp of measurement(UNIX Epoch time or time since detector boot) + * @param counts Accumulated detector counts + * @param rate Detector count in the current dt integration period. + * @param integration_time_usec [us] Integration period + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_radiation_detector_counts_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint32_t serial_no,double timestamp,uint64_t counts,uint32_t rate,uint64_t integration_time_usec) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_LEN]; + _mav_put_double(buf, 0, timestamp); + _mav_put_uint64_t(buf, 8, counts); + _mav_put_uint64_t(buf, 16, integration_time_usec); + _mav_put_uint32_t(buf, 24, serial_no); + _mav_put_uint32_t(buf, 28, rate); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_LEN); +#else + mavlink_radiation_detector_counts_t packet; + packet.timestamp = timestamp; + packet.counts = counts; + packet.integration_time_usec = integration_time_usec; + packet.serial_no = serial_no; + packet.rate = rate; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_MIN_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_CRC); +} + +/** + * @brief Encode a radiation_detector_counts struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param radiation_detector_counts C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_radiation_detector_counts_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_radiation_detector_counts_t* radiation_detector_counts) +{ + return mavlink_msg_radiation_detector_counts_pack(system_id, component_id, msg, radiation_detector_counts->serial_no, radiation_detector_counts->timestamp, radiation_detector_counts->counts, radiation_detector_counts->rate, radiation_detector_counts->integration_time_usec); +} + +/** + * @brief Encode a radiation_detector_counts struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param radiation_detector_counts C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_radiation_detector_counts_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_radiation_detector_counts_t* radiation_detector_counts) +{ + return mavlink_msg_radiation_detector_counts_pack_chan(system_id, component_id, chan, msg, radiation_detector_counts->serial_no, radiation_detector_counts->timestamp, radiation_detector_counts->counts, radiation_detector_counts->rate, radiation_detector_counts->integration_time_usec); +} + +/** + * @brief Encode a radiation_detector_counts struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param radiation_detector_counts C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_radiation_detector_counts_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_radiation_detector_counts_t* radiation_detector_counts) +{ + return mavlink_msg_radiation_detector_counts_pack_status(system_id, component_id, _status, msg, radiation_detector_counts->serial_no, radiation_detector_counts->timestamp, radiation_detector_counts->counts, radiation_detector_counts->rate, radiation_detector_counts->integration_time_usec); +} + +/** + * @brief Send a radiation_detector_counts message + * @param chan MAVLink channel to send the message + * + * @param serial_no Detector serial number + * @param timestamp [s] Timestamp of measurement(UNIX Epoch time or time since detector boot) + * @param counts Accumulated detector counts + * @param rate Detector count in the current dt integration period. + * @param integration_time_usec [us] Integration period + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_radiation_detector_counts_send(mavlink_channel_t chan, uint32_t serial_no, double timestamp, uint64_t counts, uint32_t rate, uint64_t integration_time_usec) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_LEN]; + _mav_put_double(buf, 0, timestamp); + _mav_put_uint64_t(buf, 8, counts); + _mav_put_uint64_t(buf, 16, integration_time_usec); + _mav_put_uint32_t(buf, 24, serial_no); + _mav_put_uint32_t(buf, 28, rate); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS, buf, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_MIN_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_CRC); +#else + mavlink_radiation_detector_counts_t packet; + packet.timestamp = timestamp; + packet.counts = counts; + packet.integration_time_usec = integration_time_usec; + packet.serial_no = serial_no; + packet.rate = rate; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS, (const char *)&packet, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_MIN_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_CRC); +#endif +} + +/** + * @brief Send a radiation_detector_counts message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_radiation_detector_counts_send_struct(mavlink_channel_t chan, const mavlink_radiation_detector_counts_t* radiation_detector_counts) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_radiation_detector_counts_send(chan, radiation_detector_counts->serial_no, radiation_detector_counts->timestamp, radiation_detector_counts->counts, radiation_detector_counts->rate, radiation_detector_counts->integration_time_usec); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS, (const char *)radiation_detector_counts, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_MIN_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_CRC); +#endif +} + +#if MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_radiation_detector_counts_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t serial_no, double timestamp, uint64_t counts, uint32_t rate, uint64_t integration_time_usec) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_double(buf, 0, timestamp); + _mav_put_uint64_t(buf, 8, counts); + _mav_put_uint64_t(buf, 16, integration_time_usec); + _mav_put_uint32_t(buf, 24, serial_no); + _mav_put_uint32_t(buf, 28, rate); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS, buf, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_MIN_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_CRC); +#else + mavlink_radiation_detector_counts_t *packet = (mavlink_radiation_detector_counts_t *)msgbuf; + packet->timestamp = timestamp; + packet->counts = counts; + packet->integration_time_usec = integration_time_usec; + packet->serial_no = serial_no; + packet->rate = rate; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS, (const char *)packet, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_MIN_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_CRC); +#endif +} +#endif + +#endif + +// MESSAGE RADIATION_DETECTOR_COUNTS UNPACKING + + +/** + * @brief Get field serial_no from radiation_detector_counts message + * + * @return Detector serial number + */ +static inline uint32_t mavlink_msg_radiation_detector_counts_get_serial_no(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 24); +} + +/** + * @brief Get field timestamp from radiation_detector_counts message + * + * @return [s] Timestamp of measurement(UNIX Epoch time or time since detector boot) + */ +static inline double mavlink_msg_radiation_detector_counts_get_timestamp(const mavlink_message_t* msg) +{ + return _MAV_RETURN_double(msg, 0); +} + +/** + * @brief Get field counts from radiation_detector_counts message + * + * @return Accumulated detector counts + */ +static inline uint64_t mavlink_msg_radiation_detector_counts_get_counts(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 8); +} + +/** + * @brief Get field rate from radiation_detector_counts message + * + * @return Detector count in the current dt integration period. + */ +static inline uint32_t mavlink_msg_radiation_detector_counts_get_rate(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 28); +} + +/** + * @brief Get field integration_time_usec from radiation_detector_counts message + * + * @return [us] Integration period + */ +static inline uint64_t mavlink_msg_radiation_detector_counts_get_integration_time_usec(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 16); +} + +/** + * @brief Decode a radiation_detector_counts message into a struct + * + * @param msg The message to decode + * @param radiation_detector_counts C-struct to decode the message contents into + */ +static inline void mavlink_msg_radiation_detector_counts_decode(const mavlink_message_t* msg, mavlink_radiation_detector_counts_t* radiation_detector_counts) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + radiation_detector_counts->timestamp = mavlink_msg_radiation_detector_counts_get_timestamp(msg); + radiation_detector_counts->counts = mavlink_msg_radiation_detector_counts_get_counts(msg); + radiation_detector_counts->integration_time_usec = mavlink_msg_radiation_detector_counts_get_integration_time_usec(msg); + radiation_detector_counts->serial_no = mavlink_msg_radiation_detector_counts_get_serial_no(msg); + radiation_detector_counts->rate = mavlink_msg_radiation_detector_counts_get_rate(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_LEN? msg->len : MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_LEN; + memset(radiation_detector_counts, 0, MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_LEN); + memcpy(radiation_detector_counts, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/auterion/mavlink_msg_radiation_detector_cps.h b/auterion/mavlink_msg_radiation_detector_cps.h new file mode 100644 index 000000000..2269e7622 --- /dev/null +++ b/auterion/mavlink_msg_radiation_detector_cps.h @@ -0,0 +1,344 @@ +#pragma once +// MESSAGE RADIATION_DETECTOR_CPS PACKING + +#define MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS 462 + + +typedef struct __mavlink_radiation_detector_cps_t { + double timestamp; /*< [s] Time of data measurement*/ + uint32_t serial_no; /*< Detector serial number*/ + uint32_t cps; /*< Detector value scaled by factor*/ + float dt; /*< [s] delta-t integration period*/ +} mavlink_radiation_detector_cps_t; + +#define MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_LEN 20 +#define MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_MIN_LEN 20 +#define MAVLINK_MSG_ID_462_LEN 20 +#define MAVLINK_MSG_ID_462_MIN_LEN 20 + +#define MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_CRC 193 +#define MAVLINK_MSG_ID_462_CRC 193 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_RADIATION_DETECTOR_CPS { \ + 462, \ + "RADIATION_DETECTOR_CPS", \ + 4, \ + { { "serial_no", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_radiation_detector_cps_t, serial_no) }, \ + { "timestamp", NULL, MAVLINK_TYPE_DOUBLE, 0, 0, offsetof(mavlink_radiation_detector_cps_t, timestamp) }, \ + { "cps", NULL, MAVLINK_TYPE_UINT32_T, 0, 12, offsetof(mavlink_radiation_detector_cps_t, cps) }, \ + { "dt", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_radiation_detector_cps_t, dt) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_RADIATION_DETECTOR_CPS { \ + "RADIATION_DETECTOR_CPS", \ + 4, \ + { { "serial_no", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_radiation_detector_cps_t, serial_no) }, \ + { "timestamp", NULL, MAVLINK_TYPE_DOUBLE, 0, 0, offsetof(mavlink_radiation_detector_cps_t, timestamp) }, \ + { "cps", NULL, MAVLINK_TYPE_UINT32_T, 0, 12, offsetof(mavlink_radiation_detector_cps_t, cps) }, \ + { "dt", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_radiation_detector_cps_t, dt) }, \ + } \ +} +#endif + +/** + * @brief Pack a radiation_detector_cps message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param serial_no Detector serial number + * @param timestamp [s] Time of data measurement + * @param cps Detector value scaled by factor + * @param dt [s] delta-t integration period + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_radiation_detector_cps_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint32_t serial_no, double timestamp, uint32_t cps, float dt) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_LEN]; + _mav_put_double(buf, 0, timestamp); + _mav_put_uint32_t(buf, 8, serial_no); + _mav_put_uint32_t(buf, 12, cps); + _mav_put_float(buf, 16, dt); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_LEN); +#else + mavlink_radiation_detector_cps_t packet; + packet.timestamp = timestamp; + packet.serial_no = serial_no; + packet.cps = cps; + packet.dt = dt; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_MIN_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_CRC); +} + +/** + * @brief Pack a radiation_detector_cps message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param serial_no Detector serial number + * @param timestamp [s] Time of data measurement + * @param cps Detector value scaled by factor + * @param dt [s] delta-t integration period + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_radiation_detector_cps_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t serial_no, double timestamp, uint32_t cps, float dt) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_LEN]; + _mav_put_double(buf, 0, timestamp); + _mav_put_uint32_t(buf, 8, serial_no); + _mav_put_uint32_t(buf, 12, cps); + _mav_put_float(buf, 16, dt); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_LEN); +#else + mavlink_radiation_detector_cps_t packet; + packet.timestamp = timestamp; + packet.serial_no = serial_no; + packet.cps = cps; + packet.dt = dt; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_MIN_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_MIN_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_LEN); +#endif +} + +/** + * @brief Pack a radiation_detector_cps message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param serial_no Detector serial number + * @param timestamp [s] Time of data measurement + * @param cps Detector value scaled by factor + * @param dt [s] delta-t integration period + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_radiation_detector_cps_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint32_t serial_no,double timestamp,uint32_t cps,float dt) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_LEN]; + _mav_put_double(buf, 0, timestamp); + _mav_put_uint32_t(buf, 8, serial_no); + _mav_put_uint32_t(buf, 12, cps); + _mav_put_float(buf, 16, dt); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_LEN); +#else + mavlink_radiation_detector_cps_t packet; + packet.timestamp = timestamp; + packet.serial_no = serial_no; + packet.cps = cps; + packet.dt = dt; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_MIN_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_CRC); +} + +/** + * @brief Encode a radiation_detector_cps struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param radiation_detector_cps C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_radiation_detector_cps_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_radiation_detector_cps_t* radiation_detector_cps) +{ + return mavlink_msg_radiation_detector_cps_pack(system_id, component_id, msg, radiation_detector_cps->serial_no, radiation_detector_cps->timestamp, radiation_detector_cps->cps, radiation_detector_cps->dt); +} + +/** + * @brief Encode a radiation_detector_cps struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param radiation_detector_cps C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_radiation_detector_cps_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_radiation_detector_cps_t* radiation_detector_cps) +{ + return mavlink_msg_radiation_detector_cps_pack_chan(system_id, component_id, chan, msg, radiation_detector_cps->serial_no, radiation_detector_cps->timestamp, radiation_detector_cps->cps, radiation_detector_cps->dt); +} + +/** + * @brief Encode a radiation_detector_cps struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param radiation_detector_cps C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_radiation_detector_cps_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_radiation_detector_cps_t* radiation_detector_cps) +{ + return mavlink_msg_radiation_detector_cps_pack_status(system_id, component_id, _status, msg, radiation_detector_cps->serial_no, radiation_detector_cps->timestamp, radiation_detector_cps->cps, radiation_detector_cps->dt); +} + +/** + * @brief Send a radiation_detector_cps message + * @param chan MAVLink channel to send the message + * + * @param serial_no Detector serial number + * @param timestamp [s] Time of data measurement + * @param cps Detector value scaled by factor + * @param dt [s] delta-t integration period + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_radiation_detector_cps_send(mavlink_channel_t chan, uint32_t serial_no, double timestamp, uint32_t cps, float dt) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_LEN]; + _mav_put_double(buf, 0, timestamp); + _mav_put_uint32_t(buf, 8, serial_no); + _mav_put_uint32_t(buf, 12, cps); + _mav_put_float(buf, 16, dt); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS, buf, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_MIN_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_CRC); +#else + mavlink_radiation_detector_cps_t packet; + packet.timestamp = timestamp; + packet.serial_no = serial_no; + packet.cps = cps; + packet.dt = dt; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS, (const char *)&packet, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_MIN_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_CRC); +#endif +} + +/** + * @brief Send a radiation_detector_cps message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_radiation_detector_cps_send_struct(mavlink_channel_t chan, const mavlink_radiation_detector_cps_t* radiation_detector_cps) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_radiation_detector_cps_send(chan, radiation_detector_cps->serial_no, radiation_detector_cps->timestamp, radiation_detector_cps->cps, radiation_detector_cps->dt); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS, (const char *)radiation_detector_cps, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_MIN_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_CRC); +#endif +} + +#if MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_radiation_detector_cps_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t serial_no, double timestamp, uint32_t cps, float dt) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_double(buf, 0, timestamp); + _mav_put_uint32_t(buf, 8, serial_no); + _mav_put_uint32_t(buf, 12, cps); + _mav_put_float(buf, 16, dt); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS, buf, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_MIN_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_CRC); +#else + mavlink_radiation_detector_cps_t *packet = (mavlink_radiation_detector_cps_t *)msgbuf; + packet->timestamp = timestamp; + packet->serial_no = serial_no; + packet->cps = cps; + packet->dt = dt; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS, (const char *)packet, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_MIN_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_CRC); +#endif +} +#endif + +#endif + +// MESSAGE RADIATION_DETECTOR_CPS UNPACKING + + +/** + * @brief Get field serial_no from radiation_detector_cps message + * + * @return Detector serial number + */ +static inline uint32_t mavlink_msg_radiation_detector_cps_get_serial_no(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 8); +} + +/** + * @brief Get field timestamp from radiation_detector_cps message + * + * @return [s] Time of data measurement + */ +static inline double mavlink_msg_radiation_detector_cps_get_timestamp(const mavlink_message_t* msg) +{ + return _MAV_RETURN_double(msg, 0); +} + +/** + * @brief Get field cps from radiation_detector_cps message + * + * @return Detector value scaled by factor + */ +static inline uint32_t mavlink_msg_radiation_detector_cps_get_cps(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 12); +} + +/** + * @brief Get field dt from radiation_detector_cps message + * + * @return [s] delta-t integration period + */ +static inline float mavlink_msg_radiation_detector_cps_get_dt(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 16); +} + +/** + * @brief Decode a radiation_detector_cps message into a struct + * + * @param msg The message to decode + * @param radiation_detector_cps C-struct to decode the message contents into + */ +static inline void mavlink_msg_radiation_detector_cps_decode(const mavlink_message_t* msg, mavlink_radiation_detector_cps_t* radiation_detector_cps) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + radiation_detector_cps->timestamp = mavlink_msg_radiation_detector_cps_get_timestamp(msg); + radiation_detector_cps->serial_no = mavlink_msg_radiation_detector_cps_get_serial_no(msg); + radiation_detector_cps->cps = mavlink_msg_radiation_detector_cps_get_cps(msg); + radiation_detector_cps->dt = mavlink_msg_radiation_detector_cps_get_dt(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_LEN? msg->len : MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_LEN; + memset(radiation_detector_cps, 0, MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_LEN); + memcpy(radiation_detector_cps, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/auterion/mavlink_msg_radiation_detector_spectrum.h b/auterion/mavlink_msg_radiation_detector_spectrum.h new file mode 100644 index 000000000..440e75076 --- /dev/null +++ b/auterion/mavlink_msg_radiation_detector_spectrum.h @@ -0,0 +1,334 @@ +#pragma once +// MESSAGE RADIATION_DETECTOR_SPECTRUM PACKING + +#define MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM 461 + + +typedef struct __mavlink_radiation_detector_spectrum_t { + uint32_t serial_no; /*< Detector serial number*/ + uint8_t msg_no; /*< Message number [0;255]*/ + uint8_t seq_no; /*< Sequence number [0;127]*/ + uint8_t segment[249]; /*< One segment of a spectrum PDU*/ +} mavlink_radiation_detector_spectrum_t; + +#define MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_LEN 255 +#define MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_MIN_LEN 255 +#define MAVLINK_MSG_ID_461_LEN 255 +#define MAVLINK_MSG_ID_461_MIN_LEN 255 + +#define MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_CRC 235 +#define MAVLINK_MSG_ID_461_CRC 235 + +#define MAVLINK_MSG_RADIATION_DETECTOR_SPECTRUM_FIELD_SEGMENT_LEN 249 + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_RADIATION_DETECTOR_SPECTRUM { \ + 461, \ + "RADIATION_DETECTOR_SPECTRUM", \ + 4, \ + { { "serial_no", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_radiation_detector_spectrum_t, serial_no) }, \ + { "msg_no", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_radiation_detector_spectrum_t, msg_no) }, \ + { "seq_no", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_radiation_detector_spectrum_t, seq_no) }, \ + { "segment", NULL, MAVLINK_TYPE_UINT8_T, 249, 6, offsetof(mavlink_radiation_detector_spectrum_t, segment) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_RADIATION_DETECTOR_SPECTRUM { \ + "RADIATION_DETECTOR_SPECTRUM", \ + 4, \ + { { "serial_no", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_radiation_detector_spectrum_t, serial_no) }, \ + { "msg_no", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_radiation_detector_spectrum_t, msg_no) }, \ + { "seq_no", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_radiation_detector_spectrum_t, seq_no) }, \ + { "segment", NULL, MAVLINK_TYPE_UINT8_T, 249, 6, offsetof(mavlink_radiation_detector_spectrum_t, segment) }, \ + } \ +} +#endif + +/** + * @brief Pack a radiation_detector_spectrum message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param serial_no Detector serial number + * @param msg_no Message number [0;255] + * @param seq_no Sequence number [0;127] + * @param segment One segment of a spectrum PDU + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_radiation_detector_spectrum_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint32_t serial_no, uint8_t msg_no, uint8_t seq_no, const uint8_t *segment) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_LEN]; + _mav_put_uint32_t(buf, 0, serial_no); + _mav_put_uint8_t(buf, 4, msg_no); + _mav_put_uint8_t(buf, 5, seq_no); + _mav_put_uint8_t_array(buf, 6, segment, 249); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_LEN); +#else + mavlink_radiation_detector_spectrum_t packet; + packet.serial_no = serial_no; + packet.msg_no = msg_no; + packet.seq_no = seq_no; + mav_array_assign_uint8_t(packet.segment, segment, 249); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_MIN_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_CRC); +} + +/** + * @brief Pack a radiation_detector_spectrum message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param serial_no Detector serial number + * @param msg_no Message number [0;255] + * @param seq_no Sequence number [0;127] + * @param segment One segment of a spectrum PDU + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_radiation_detector_spectrum_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t serial_no, uint8_t msg_no, uint8_t seq_no, const uint8_t *segment) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_LEN]; + _mav_put_uint32_t(buf, 0, serial_no); + _mav_put_uint8_t(buf, 4, msg_no); + _mav_put_uint8_t(buf, 5, seq_no); + _mav_put_uint8_t_array(buf, 6, segment, 249); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_LEN); +#else + mavlink_radiation_detector_spectrum_t packet; + packet.serial_no = serial_no; + packet.msg_no = msg_no; + packet.seq_no = seq_no; + mav_array_memcpy(packet.segment, segment, sizeof(uint8_t)*249); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_MIN_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_MIN_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_LEN); +#endif +} + +/** + * @brief Pack a radiation_detector_spectrum message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param serial_no Detector serial number + * @param msg_no Message number [0;255] + * @param seq_no Sequence number [0;127] + * @param segment One segment of a spectrum PDU + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_radiation_detector_spectrum_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint32_t serial_no,uint8_t msg_no,uint8_t seq_no,const uint8_t *segment) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_LEN]; + _mav_put_uint32_t(buf, 0, serial_no); + _mav_put_uint8_t(buf, 4, msg_no); + _mav_put_uint8_t(buf, 5, seq_no); + _mav_put_uint8_t_array(buf, 6, segment, 249); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_LEN); +#else + mavlink_radiation_detector_spectrum_t packet; + packet.serial_no = serial_no; + packet.msg_no = msg_no; + packet.seq_no = seq_no; + mav_array_assign_uint8_t(packet.segment, segment, 249); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_MIN_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_CRC); +} + +/** + * @brief Encode a radiation_detector_spectrum struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param radiation_detector_spectrum C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_radiation_detector_spectrum_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_radiation_detector_spectrum_t* radiation_detector_spectrum) +{ + return mavlink_msg_radiation_detector_spectrum_pack(system_id, component_id, msg, radiation_detector_spectrum->serial_no, radiation_detector_spectrum->msg_no, radiation_detector_spectrum->seq_no, radiation_detector_spectrum->segment); +} + +/** + * @brief Encode a radiation_detector_spectrum struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param radiation_detector_spectrum C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_radiation_detector_spectrum_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_radiation_detector_spectrum_t* radiation_detector_spectrum) +{ + return mavlink_msg_radiation_detector_spectrum_pack_chan(system_id, component_id, chan, msg, radiation_detector_spectrum->serial_no, radiation_detector_spectrum->msg_no, radiation_detector_spectrum->seq_no, radiation_detector_spectrum->segment); +} + +/** + * @brief Encode a radiation_detector_spectrum struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param radiation_detector_spectrum C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_radiation_detector_spectrum_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_radiation_detector_spectrum_t* radiation_detector_spectrum) +{ + return mavlink_msg_radiation_detector_spectrum_pack_status(system_id, component_id, _status, msg, radiation_detector_spectrum->serial_no, radiation_detector_spectrum->msg_no, radiation_detector_spectrum->seq_no, radiation_detector_spectrum->segment); +} + +/** + * @brief Send a radiation_detector_spectrum message + * @param chan MAVLink channel to send the message + * + * @param serial_no Detector serial number + * @param msg_no Message number [0;255] + * @param seq_no Sequence number [0;127] + * @param segment One segment of a spectrum PDU + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_radiation_detector_spectrum_send(mavlink_channel_t chan, uint32_t serial_no, uint8_t msg_no, uint8_t seq_no, const uint8_t *segment) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_LEN]; + _mav_put_uint32_t(buf, 0, serial_no); + _mav_put_uint8_t(buf, 4, msg_no); + _mav_put_uint8_t(buf, 5, seq_no); + _mav_put_uint8_t_array(buf, 6, segment, 249); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM, buf, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_MIN_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_CRC); +#else + mavlink_radiation_detector_spectrum_t packet; + packet.serial_no = serial_no; + packet.msg_no = msg_no; + packet.seq_no = seq_no; + mav_array_assign_uint8_t(packet.segment, segment, 249); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM, (const char *)&packet, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_MIN_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_CRC); +#endif +} + +/** + * @brief Send a radiation_detector_spectrum message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_radiation_detector_spectrum_send_struct(mavlink_channel_t chan, const mavlink_radiation_detector_spectrum_t* radiation_detector_spectrum) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_radiation_detector_spectrum_send(chan, radiation_detector_spectrum->serial_no, radiation_detector_spectrum->msg_no, radiation_detector_spectrum->seq_no, radiation_detector_spectrum->segment); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM, (const char *)radiation_detector_spectrum, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_MIN_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_CRC); +#endif +} + +#if MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_radiation_detector_spectrum_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t serial_no, uint8_t msg_no, uint8_t seq_no, const uint8_t *segment) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint32_t(buf, 0, serial_no); + _mav_put_uint8_t(buf, 4, msg_no); + _mav_put_uint8_t(buf, 5, seq_no); + _mav_put_uint8_t_array(buf, 6, segment, 249); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM, buf, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_MIN_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_CRC); +#else + mavlink_radiation_detector_spectrum_t *packet = (mavlink_radiation_detector_spectrum_t *)msgbuf; + packet->serial_no = serial_no; + packet->msg_no = msg_no; + packet->seq_no = seq_no; + mav_array_assign_uint8_t(packet->segment, segment, 249); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM, (const char *)packet, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_MIN_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_LEN, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_CRC); +#endif +} +#endif + +#endif + +// MESSAGE RADIATION_DETECTOR_SPECTRUM UNPACKING + + +/** + * @brief Get field serial_no from radiation_detector_spectrum message + * + * @return Detector serial number + */ +static inline uint32_t mavlink_msg_radiation_detector_spectrum_get_serial_no(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 0); +} + +/** + * @brief Get field msg_no from radiation_detector_spectrum message + * + * @return Message number [0;255] + */ +static inline uint8_t mavlink_msg_radiation_detector_spectrum_get_msg_no(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 4); +} + +/** + * @brief Get field seq_no from radiation_detector_spectrum message + * + * @return Sequence number [0;127] + */ +static inline uint8_t mavlink_msg_radiation_detector_spectrum_get_seq_no(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 5); +} + +/** + * @brief Get field segment from radiation_detector_spectrum message + * + * @return One segment of a spectrum PDU + */ +static inline uint16_t mavlink_msg_radiation_detector_spectrum_get_segment(const mavlink_message_t* msg, uint8_t *segment) +{ + return _MAV_RETURN_uint8_t_array(msg, segment, 249, 6); +} + +/** + * @brief Decode a radiation_detector_spectrum message into a struct + * + * @param msg The message to decode + * @param radiation_detector_spectrum C-struct to decode the message contents into + */ +static inline void mavlink_msg_radiation_detector_spectrum_decode(const mavlink_message_t* msg, mavlink_radiation_detector_spectrum_t* radiation_detector_spectrum) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + radiation_detector_spectrum->serial_no = mavlink_msg_radiation_detector_spectrum_get_serial_no(msg); + radiation_detector_spectrum->msg_no = mavlink_msg_radiation_detector_spectrum_get_msg_no(msg); + radiation_detector_spectrum->seq_no = mavlink_msg_radiation_detector_spectrum_get_seq_no(msg); + mavlink_msg_radiation_detector_spectrum_get_segment(msg, radiation_detector_spectrum->segment); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_LEN? msg->len : MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_LEN; + memset(radiation_detector_spectrum, 0, MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_LEN); + memcpy(radiation_detector_spectrum, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/auterion/mavlink_msg_release_control.h b/auterion/mavlink_msg_release_control.h new file mode 100644 index 000000000..fca869d6f --- /dev/null +++ b/auterion/mavlink_msg_release_control.h @@ -0,0 +1,260 @@ +#pragma once +// MESSAGE RELEASE_CONTROL PACKING + +#define MAVLINK_MSG_ID_RELEASE_CONTROL 13444 + + +typedef struct __mavlink_release_control_t { + uint8_t control_target; /*< Control target to release own ownership.*/ +} mavlink_release_control_t; + +#define MAVLINK_MSG_ID_RELEASE_CONTROL_LEN 1 +#define MAVLINK_MSG_ID_RELEASE_CONTROL_MIN_LEN 1 +#define MAVLINK_MSG_ID_13444_LEN 1 +#define MAVLINK_MSG_ID_13444_MIN_LEN 1 + +#define MAVLINK_MSG_ID_RELEASE_CONTROL_CRC 235 +#define MAVLINK_MSG_ID_13444_CRC 235 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_RELEASE_CONTROL { \ + 13444, \ + "RELEASE_CONTROL", \ + 1, \ + { { "control_target", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_release_control_t, control_target) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_RELEASE_CONTROL { \ + "RELEASE_CONTROL", \ + 1, \ + { { "control_target", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_release_control_t, control_target) }, \ + } \ +} +#endif + +/** + * @brief Pack a release_control message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param control_target Control target to release own ownership. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_release_control_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t control_target) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RELEASE_CONTROL_LEN]; + _mav_put_uint8_t(buf, 0, control_target); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RELEASE_CONTROL_LEN); +#else + mavlink_release_control_t packet; + packet.control_target = control_target; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RELEASE_CONTROL_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_RELEASE_CONTROL; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RELEASE_CONTROL_MIN_LEN, MAVLINK_MSG_ID_RELEASE_CONTROL_LEN, MAVLINK_MSG_ID_RELEASE_CONTROL_CRC); +} + +/** + * @brief Pack a release_control message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param control_target Control target to release own ownership. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_release_control_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t control_target) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RELEASE_CONTROL_LEN]; + _mav_put_uint8_t(buf, 0, control_target); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RELEASE_CONTROL_LEN); +#else + mavlink_release_control_t packet; + packet.control_target = control_target; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RELEASE_CONTROL_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_RELEASE_CONTROL; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RELEASE_CONTROL_MIN_LEN, MAVLINK_MSG_ID_RELEASE_CONTROL_LEN, MAVLINK_MSG_ID_RELEASE_CONTROL_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RELEASE_CONTROL_MIN_LEN, MAVLINK_MSG_ID_RELEASE_CONTROL_LEN); +#endif +} + +/** + * @brief Pack a release_control message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param control_target Control target to release own ownership. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_release_control_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t control_target) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RELEASE_CONTROL_LEN]; + _mav_put_uint8_t(buf, 0, control_target); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RELEASE_CONTROL_LEN); +#else + mavlink_release_control_t packet; + packet.control_target = control_target; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RELEASE_CONTROL_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_RELEASE_CONTROL; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_RELEASE_CONTROL_MIN_LEN, MAVLINK_MSG_ID_RELEASE_CONTROL_LEN, MAVLINK_MSG_ID_RELEASE_CONTROL_CRC); +} + +/** + * @brief Encode a release_control struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param release_control C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_release_control_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_release_control_t* release_control) +{ + return mavlink_msg_release_control_pack(system_id, component_id, msg, release_control->control_target); +} + +/** + * @brief Encode a release_control struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param release_control C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_release_control_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_release_control_t* release_control) +{ + return mavlink_msg_release_control_pack_chan(system_id, component_id, chan, msg, release_control->control_target); +} + +/** + * @brief Encode a release_control struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param release_control C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_release_control_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_release_control_t* release_control) +{ + return mavlink_msg_release_control_pack_status(system_id, component_id, _status, msg, release_control->control_target); +} + +/** + * @brief Send a release_control message + * @param chan MAVLink channel to send the message + * + * @param control_target Control target to release own ownership. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_release_control_send(mavlink_channel_t chan, uint8_t control_target) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RELEASE_CONTROL_LEN]; + _mav_put_uint8_t(buf, 0, control_target); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RELEASE_CONTROL, buf, MAVLINK_MSG_ID_RELEASE_CONTROL_MIN_LEN, MAVLINK_MSG_ID_RELEASE_CONTROL_LEN, MAVLINK_MSG_ID_RELEASE_CONTROL_CRC); +#else + mavlink_release_control_t packet; + packet.control_target = control_target; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RELEASE_CONTROL, (const char *)&packet, MAVLINK_MSG_ID_RELEASE_CONTROL_MIN_LEN, MAVLINK_MSG_ID_RELEASE_CONTROL_LEN, MAVLINK_MSG_ID_RELEASE_CONTROL_CRC); +#endif +} + +/** + * @brief Send a release_control message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_release_control_send_struct(mavlink_channel_t chan, const mavlink_release_control_t* release_control) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_release_control_send(chan, release_control->control_target); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RELEASE_CONTROL, (const char *)release_control, MAVLINK_MSG_ID_RELEASE_CONTROL_MIN_LEN, MAVLINK_MSG_ID_RELEASE_CONTROL_LEN, MAVLINK_MSG_ID_RELEASE_CONTROL_CRC); +#endif +} + +#if MAVLINK_MSG_ID_RELEASE_CONTROL_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_release_control_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t control_target) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint8_t(buf, 0, control_target); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RELEASE_CONTROL, buf, MAVLINK_MSG_ID_RELEASE_CONTROL_MIN_LEN, MAVLINK_MSG_ID_RELEASE_CONTROL_LEN, MAVLINK_MSG_ID_RELEASE_CONTROL_CRC); +#else + mavlink_release_control_t *packet = (mavlink_release_control_t *)msgbuf; + packet->control_target = control_target; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RELEASE_CONTROL, (const char *)packet, MAVLINK_MSG_ID_RELEASE_CONTROL_MIN_LEN, MAVLINK_MSG_ID_RELEASE_CONTROL_LEN, MAVLINK_MSG_ID_RELEASE_CONTROL_CRC); +#endif +} +#endif + +#endif + +// MESSAGE RELEASE_CONTROL UNPACKING + + +/** + * @brief Get field control_target from release_control message + * + * @return Control target to release own ownership. + */ +static inline uint8_t mavlink_msg_release_control_get_control_target(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 0); +} + +/** + * @brief Decode a release_control message into a struct + * + * @param msg The message to decode + * @param release_control C-struct to decode the message contents into + */ +static inline void mavlink_msg_release_control_decode(const mavlink_message_t* msg, mavlink_release_control_t* release_control) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + release_control->control_target = mavlink_msg_release_control_get_control_target(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_RELEASE_CONTROL_LEN? msg->len : MAVLINK_MSG_ID_RELEASE_CONTROL_LEN; + memset(release_control, 0, MAVLINK_MSG_ID_RELEASE_CONTROL_LEN); + memcpy(release_control, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/auterion/mavlink_msg_request_control.h b/auterion/mavlink_msg_request_control.h new file mode 100644 index 000000000..099f22fde --- /dev/null +++ b/auterion/mavlink_msg_request_control.h @@ -0,0 +1,347 @@ +#pragma once +// MESSAGE REQUEST_CONTROL PACKING + +#define MAVLINK_MSG_ID_REQUEST_CONTROL 13442 + + +typedef struct __mavlink_request_control_t { + uint8_t control_target; /*< Control target to change to own ownership.*/ + uint8_t request_priority; /*< Priority of the control request. If the priority is higher than the priority + of the current control entity, control is given without handoff request. + The priority request should be authenticated on the target system before granting this privilegs. Default value of 0.*/ + char requester_id[40]; /*< Identification of the control entity requesting ownership.*/ + char reason[100]; /*< Reason for taking ownership.*/ +} mavlink_request_control_t; + +#define MAVLINK_MSG_ID_REQUEST_CONTROL_LEN 142 +#define MAVLINK_MSG_ID_REQUEST_CONTROL_MIN_LEN 142 +#define MAVLINK_MSG_ID_13442_LEN 142 +#define MAVLINK_MSG_ID_13442_MIN_LEN 142 + +#define MAVLINK_MSG_ID_REQUEST_CONTROL_CRC 172 +#define MAVLINK_MSG_ID_13442_CRC 172 + +#define MAVLINK_MSG_REQUEST_CONTROL_FIELD_REQUESTER_ID_LEN 40 +#define MAVLINK_MSG_REQUEST_CONTROL_FIELD_REASON_LEN 100 + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_REQUEST_CONTROL { \ + 13442, \ + "REQUEST_CONTROL", \ + 4, \ + { { "control_target", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_request_control_t, control_target) }, \ + { "request_priority", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_request_control_t, request_priority) }, \ + { "requester_id", NULL, MAVLINK_TYPE_CHAR, 40, 2, offsetof(mavlink_request_control_t, requester_id) }, \ + { "reason", NULL, MAVLINK_TYPE_CHAR, 100, 42, offsetof(mavlink_request_control_t, reason) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_REQUEST_CONTROL { \ + "REQUEST_CONTROL", \ + 4, \ + { { "control_target", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_request_control_t, control_target) }, \ + { "request_priority", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_request_control_t, request_priority) }, \ + { "requester_id", NULL, MAVLINK_TYPE_CHAR, 40, 2, offsetof(mavlink_request_control_t, requester_id) }, \ + { "reason", NULL, MAVLINK_TYPE_CHAR, 100, 42, offsetof(mavlink_request_control_t, reason) }, \ + } \ +} +#endif + +/** + * @brief Pack a request_control message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param control_target Control target to change to own ownership. + * @param request_priority Priority of the control request. If the priority is higher than the priority + of the current control entity, control is given without handoff request. + The priority request should be authenticated on the target system before granting this privilegs. Default value of 0. + * @param requester_id Identification of the control entity requesting ownership. + * @param reason Reason for taking ownership. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_request_control_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t control_target, uint8_t request_priority, const char *requester_id, const char *reason) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_REQUEST_CONTROL_LEN]; + _mav_put_uint8_t(buf, 0, control_target); + _mav_put_uint8_t(buf, 1, request_priority); + _mav_put_char_array(buf, 2, requester_id, 40); + _mav_put_char_array(buf, 42, reason, 100); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_REQUEST_CONTROL_LEN); +#else + mavlink_request_control_t packet; + packet.control_target = control_target; + packet.request_priority = request_priority; + mav_array_assign_char(packet.requester_id, requester_id, 40); + mav_array_assign_char(packet.reason, reason, 100); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_REQUEST_CONTROL_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_REQUEST_CONTROL; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_REQUEST_CONTROL_MIN_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_CRC); +} + +/** + * @brief Pack a request_control message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param control_target Control target to change to own ownership. + * @param request_priority Priority of the control request. If the priority is higher than the priority + of the current control entity, control is given without handoff request. + The priority request should be authenticated on the target system before granting this privilegs. Default value of 0. + * @param requester_id Identification of the control entity requesting ownership. + * @param reason Reason for taking ownership. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_request_control_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t control_target, uint8_t request_priority, const char *requester_id, const char *reason) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_REQUEST_CONTROL_LEN]; + _mav_put_uint8_t(buf, 0, control_target); + _mav_put_uint8_t(buf, 1, request_priority); + _mav_put_char_array(buf, 2, requester_id, 40); + _mav_put_char_array(buf, 42, reason, 100); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_REQUEST_CONTROL_LEN); +#else + mavlink_request_control_t packet; + packet.control_target = control_target; + packet.request_priority = request_priority; + mav_array_memcpy(packet.requester_id, requester_id, sizeof(char)*40); + mav_array_memcpy(packet.reason, reason, sizeof(char)*100); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_REQUEST_CONTROL_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_REQUEST_CONTROL; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_REQUEST_CONTROL_MIN_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_REQUEST_CONTROL_MIN_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_LEN); +#endif +} + +/** + * @brief Pack a request_control message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param control_target Control target to change to own ownership. + * @param request_priority Priority of the control request. If the priority is higher than the priority + of the current control entity, control is given without handoff request. + The priority request should be authenticated on the target system before granting this privilegs. Default value of 0. + * @param requester_id Identification of the control entity requesting ownership. + * @param reason Reason for taking ownership. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_request_control_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t control_target,uint8_t request_priority,const char *requester_id,const char *reason) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_REQUEST_CONTROL_LEN]; + _mav_put_uint8_t(buf, 0, control_target); + _mav_put_uint8_t(buf, 1, request_priority); + _mav_put_char_array(buf, 2, requester_id, 40); + _mav_put_char_array(buf, 42, reason, 100); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_REQUEST_CONTROL_LEN); +#else + mavlink_request_control_t packet; + packet.control_target = control_target; + packet.request_priority = request_priority; + mav_array_assign_char(packet.requester_id, requester_id, 40); + mav_array_assign_char(packet.reason, reason, 100); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_REQUEST_CONTROL_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_REQUEST_CONTROL; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_REQUEST_CONTROL_MIN_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_CRC); +} + +/** + * @brief Encode a request_control struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param request_control C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_request_control_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_request_control_t* request_control) +{ + return mavlink_msg_request_control_pack(system_id, component_id, msg, request_control->control_target, request_control->request_priority, request_control->requester_id, request_control->reason); +} + +/** + * @brief Encode a request_control struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param request_control C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_request_control_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_request_control_t* request_control) +{ + return mavlink_msg_request_control_pack_chan(system_id, component_id, chan, msg, request_control->control_target, request_control->request_priority, request_control->requester_id, request_control->reason); +} + +/** + * @brief Encode a request_control struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param request_control C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_request_control_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_request_control_t* request_control) +{ + return mavlink_msg_request_control_pack_status(system_id, component_id, _status, msg, request_control->control_target, request_control->request_priority, request_control->requester_id, request_control->reason); +} + +/** + * @brief Send a request_control message + * @param chan MAVLink channel to send the message + * + * @param control_target Control target to change to own ownership. + * @param request_priority Priority of the control request. If the priority is higher than the priority + of the current control entity, control is given without handoff request. + The priority request should be authenticated on the target system before granting this privilegs. Default value of 0. + * @param requester_id Identification of the control entity requesting ownership. + * @param reason Reason for taking ownership. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_request_control_send(mavlink_channel_t chan, uint8_t control_target, uint8_t request_priority, const char *requester_id, const char *reason) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_REQUEST_CONTROL_LEN]; + _mav_put_uint8_t(buf, 0, control_target); + _mav_put_uint8_t(buf, 1, request_priority); + _mav_put_char_array(buf, 2, requester_id, 40); + _mav_put_char_array(buf, 42, reason, 100); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REQUEST_CONTROL, buf, MAVLINK_MSG_ID_REQUEST_CONTROL_MIN_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_CRC); +#else + mavlink_request_control_t packet; + packet.control_target = control_target; + packet.request_priority = request_priority; + mav_array_assign_char(packet.requester_id, requester_id, 40); + mav_array_assign_char(packet.reason, reason, 100); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REQUEST_CONTROL, (const char *)&packet, MAVLINK_MSG_ID_REQUEST_CONTROL_MIN_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_CRC); +#endif +} + +/** + * @brief Send a request_control message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_request_control_send_struct(mavlink_channel_t chan, const mavlink_request_control_t* request_control) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_request_control_send(chan, request_control->control_target, request_control->request_priority, request_control->requester_id, request_control->reason); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REQUEST_CONTROL, (const char *)request_control, MAVLINK_MSG_ID_REQUEST_CONTROL_MIN_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_CRC); +#endif +} + +#if MAVLINK_MSG_ID_REQUEST_CONTROL_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_request_control_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t control_target, uint8_t request_priority, const char *requester_id, const char *reason) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint8_t(buf, 0, control_target); + _mav_put_uint8_t(buf, 1, request_priority); + _mav_put_char_array(buf, 2, requester_id, 40); + _mav_put_char_array(buf, 42, reason, 100); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REQUEST_CONTROL, buf, MAVLINK_MSG_ID_REQUEST_CONTROL_MIN_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_CRC); +#else + mavlink_request_control_t *packet = (mavlink_request_control_t *)msgbuf; + packet->control_target = control_target; + packet->request_priority = request_priority; + mav_array_assign_char(packet->requester_id, requester_id, 40); + mav_array_assign_char(packet->reason, reason, 100); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REQUEST_CONTROL, (const char *)packet, MAVLINK_MSG_ID_REQUEST_CONTROL_MIN_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_CRC); +#endif +} +#endif + +#endif + +// MESSAGE REQUEST_CONTROL UNPACKING + + +/** + * @brief Get field control_target from request_control message + * + * @return Control target to change to own ownership. + */ +static inline uint8_t mavlink_msg_request_control_get_control_target(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 0); +} + +/** + * @brief Get field request_priority from request_control message + * + * @return Priority of the control request. If the priority is higher than the priority + of the current control entity, control is given without handoff request. + The priority request should be authenticated on the target system before granting this privilegs. Default value of 0. + */ +static inline uint8_t mavlink_msg_request_control_get_request_priority(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 1); +} + +/** + * @brief Get field requester_id from request_control message + * + * @return Identification of the control entity requesting ownership. + */ +static inline uint16_t mavlink_msg_request_control_get_requester_id(const mavlink_message_t* msg, char *requester_id) +{ + return _MAV_RETURN_char_array(msg, requester_id, 40, 2); +} + +/** + * @brief Get field reason from request_control message + * + * @return Reason for taking ownership. + */ +static inline uint16_t mavlink_msg_request_control_get_reason(const mavlink_message_t* msg, char *reason) +{ + return _MAV_RETURN_char_array(msg, reason, 100, 42); +} + +/** + * @brief Decode a request_control message into a struct + * + * @param msg The message to decode + * @param request_control C-struct to decode the message contents into + */ +static inline void mavlink_msg_request_control_decode(const mavlink_message_t* msg, mavlink_request_control_t* request_control) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + request_control->control_target = mavlink_msg_request_control_get_control_target(msg); + request_control->request_priority = mavlink_msg_request_control_get_request_priority(msg); + mavlink_msg_request_control_get_requester_id(msg, request_control->requester_id); + mavlink_msg_request_control_get_reason(msg, request_control->reason); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_REQUEST_CONTROL_LEN? msg->len : MAVLINK_MSG_ID_REQUEST_CONTROL_LEN; + memset(request_control, 0, MAVLINK_MSG_ID_REQUEST_CONTROL_LEN); + memcpy(request_control, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/auterion/mavlink_msg_request_control_ack.h b/auterion/mavlink_msg_request_control_ack.h new file mode 100644 index 000000000..2f837cac6 --- /dev/null +++ b/auterion/mavlink_msg_request_control_ack.h @@ -0,0 +1,288 @@ +#pragma once +// MESSAGE REQUEST_CONTROL_ACK PACKING + +#define MAVLINK_MSG_ID_REQUEST_CONTROL_ACK 13443 + + +typedef struct __mavlink_request_control_ack_t { + uint8_t control_target; /*< Control target which was processed.*/ + uint8_t error_code; /*< Error code response.*/ +} mavlink_request_control_ack_t; + +#define MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_LEN 2 +#define MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_MIN_LEN 2 +#define MAVLINK_MSG_ID_13443_LEN 2 +#define MAVLINK_MSG_ID_13443_MIN_LEN 2 + +#define MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_CRC 131 +#define MAVLINK_MSG_ID_13443_CRC 131 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_REQUEST_CONTROL_ACK { \ + 13443, \ + "REQUEST_CONTROL_ACK", \ + 2, \ + { { "control_target", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_request_control_ack_t, control_target) }, \ + { "error_code", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_request_control_ack_t, error_code) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_REQUEST_CONTROL_ACK { \ + "REQUEST_CONTROL_ACK", \ + 2, \ + { { "control_target", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_request_control_ack_t, control_target) }, \ + { "error_code", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_request_control_ack_t, error_code) }, \ + } \ +} +#endif + +/** + * @brief Pack a request_control_ack message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param control_target Control target which was processed. + * @param error_code Error code response. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_request_control_ack_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t control_target, uint8_t error_code) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_LEN]; + _mav_put_uint8_t(buf, 0, control_target); + _mav_put_uint8_t(buf, 1, error_code); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_LEN); +#else + mavlink_request_control_ack_t packet; + packet.control_target = control_target; + packet.error_code = error_code; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_REQUEST_CONTROL_ACK; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_MIN_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_CRC); +} + +/** + * @brief Pack a request_control_ack message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param control_target Control target which was processed. + * @param error_code Error code response. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_request_control_ack_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t control_target, uint8_t error_code) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_LEN]; + _mav_put_uint8_t(buf, 0, control_target); + _mav_put_uint8_t(buf, 1, error_code); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_LEN); +#else + mavlink_request_control_ack_t packet; + packet.control_target = control_target; + packet.error_code = error_code; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_REQUEST_CONTROL_ACK; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_MIN_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_MIN_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_LEN); +#endif +} + +/** + * @brief Pack a request_control_ack message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param control_target Control target which was processed. + * @param error_code Error code response. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_request_control_ack_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t control_target,uint8_t error_code) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_LEN]; + _mav_put_uint8_t(buf, 0, control_target); + _mav_put_uint8_t(buf, 1, error_code); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_LEN); +#else + mavlink_request_control_ack_t packet; + packet.control_target = control_target; + packet.error_code = error_code; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_REQUEST_CONTROL_ACK; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_MIN_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_CRC); +} + +/** + * @brief Encode a request_control_ack struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param request_control_ack C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_request_control_ack_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_request_control_ack_t* request_control_ack) +{ + return mavlink_msg_request_control_ack_pack(system_id, component_id, msg, request_control_ack->control_target, request_control_ack->error_code); +} + +/** + * @brief Encode a request_control_ack struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param request_control_ack C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_request_control_ack_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_request_control_ack_t* request_control_ack) +{ + return mavlink_msg_request_control_ack_pack_chan(system_id, component_id, chan, msg, request_control_ack->control_target, request_control_ack->error_code); +} + +/** + * @brief Encode a request_control_ack struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param request_control_ack C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_request_control_ack_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_request_control_ack_t* request_control_ack) +{ + return mavlink_msg_request_control_ack_pack_status(system_id, component_id, _status, msg, request_control_ack->control_target, request_control_ack->error_code); +} + +/** + * @brief Send a request_control_ack message + * @param chan MAVLink channel to send the message + * + * @param control_target Control target which was processed. + * @param error_code Error code response. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_request_control_ack_send(mavlink_channel_t chan, uint8_t control_target, uint8_t error_code) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_LEN]; + _mav_put_uint8_t(buf, 0, control_target); + _mav_put_uint8_t(buf, 1, error_code); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK, buf, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_MIN_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_CRC); +#else + mavlink_request_control_ack_t packet; + packet.control_target = control_target; + packet.error_code = error_code; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK, (const char *)&packet, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_MIN_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_CRC); +#endif +} + +/** + * @brief Send a request_control_ack message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_request_control_ack_send_struct(mavlink_channel_t chan, const mavlink_request_control_ack_t* request_control_ack) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_request_control_ack_send(chan, request_control_ack->control_target, request_control_ack->error_code); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK, (const char *)request_control_ack, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_MIN_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_CRC); +#endif +} + +#if MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_request_control_ack_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t control_target, uint8_t error_code) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint8_t(buf, 0, control_target); + _mav_put_uint8_t(buf, 1, error_code); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK, buf, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_MIN_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_CRC); +#else + mavlink_request_control_ack_t *packet = (mavlink_request_control_ack_t *)msgbuf; + packet->control_target = control_target; + packet->error_code = error_code; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK, (const char *)packet, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_MIN_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_LEN, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_CRC); +#endif +} +#endif + +#endif + +// MESSAGE REQUEST_CONTROL_ACK UNPACKING + + +/** + * @brief Get field control_target from request_control_ack message + * + * @return Control target which was processed. + */ +static inline uint8_t mavlink_msg_request_control_ack_get_control_target(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 0); +} + +/** + * @brief Get field error_code from request_control_ack message + * + * @return Error code response. + */ +static inline uint8_t mavlink_msg_request_control_ack_get_error_code(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 1); +} + +/** + * @brief Decode a request_control_ack message into a struct + * + * @param msg The message to decode + * @param request_control_ack C-struct to decode the message contents into + */ +static inline void mavlink_msg_request_control_ack_decode(const mavlink_message_t* msg, mavlink_request_control_ack_t* request_control_ack) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + request_control_ack->control_target = mavlink_msg_request_control_ack_get_control_target(msg); + request_control_ack->error_code = mavlink_msg_request_control_ack_get_error_code(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_LEN? msg->len : MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_LEN; + memset(request_control_ack, 0, MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_LEN); + memcpy(request_control_ack, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/auterion/mavlink_msg_request_handoff.h b/auterion/mavlink_msg_request_handoff.h new file mode 100644 index 000000000..0b04c1ba7 --- /dev/null +++ b/auterion/mavlink_msg_request_handoff.h @@ -0,0 +1,307 @@ +#pragma once +// MESSAGE REQUEST_HANDOFF PACKING + +#define MAVLINK_MSG_ID_REQUEST_HANDOFF 13445 + + +typedef struct __mavlink_request_handoff_t { + uint8_t control_target; /*< Control target to handoff control ownership.*/ + char requester_id[40]; /*< Identification of the control entity requesting ownership.*/ + char reason[100]; /*< Reason from the control entity requesting ownership.*/ +} mavlink_request_handoff_t; + +#define MAVLINK_MSG_ID_REQUEST_HANDOFF_LEN 141 +#define MAVLINK_MSG_ID_REQUEST_HANDOFF_MIN_LEN 141 +#define MAVLINK_MSG_ID_13445_LEN 141 +#define MAVLINK_MSG_ID_13445_MIN_LEN 141 + +#define MAVLINK_MSG_ID_REQUEST_HANDOFF_CRC 195 +#define MAVLINK_MSG_ID_13445_CRC 195 + +#define MAVLINK_MSG_REQUEST_HANDOFF_FIELD_REQUESTER_ID_LEN 40 +#define MAVLINK_MSG_REQUEST_HANDOFF_FIELD_REASON_LEN 100 + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_REQUEST_HANDOFF { \ + 13445, \ + "REQUEST_HANDOFF", \ + 3, \ + { { "control_target", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_request_handoff_t, control_target) }, \ + { "requester_id", NULL, MAVLINK_TYPE_CHAR, 40, 1, offsetof(mavlink_request_handoff_t, requester_id) }, \ + { "reason", NULL, MAVLINK_TYPE_CHAR, 100, 41, offsetof(mavlink_request_handoff_t, reason) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_REQUEST_HANDOFF { \ + "REQUEST_HANDOFF", \ + 3, \ + { { "control_target", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_request_handoff_t, control_target) }, \ + { "requester_id", NULL, MAVLINK_TYPE_CHAR, 40, 1, offsetof(mavlink_request_handoff_t, requester_id) }, \ + { "reason", NULL, MAVLINK_TYPE_CHAR, 100, 41, offsetof(mavlink_request_handoff_t, reason) }, \ + } \ +} +#endif + +/** + * @brief Pack a request_handoff message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param control_target Control target to handoff control ownership. + * @param requester_id Identification of the control entity requesting ownership. + * @param reason Reason from the control entity requesting ownership. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_request_handoff_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t control_target, const char *requester_id, const char *reason) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_REQUEST_HANDOFF_LEN]; + _mav_put_uint8_t(buf, 0, control_target); + _mav_put_char_array(buf, 1, requester_id, 40); + _mav_put_char_array(buf, 41, reason, 100); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_REQUEST_HANDOFF_LEN); +#else + mavlink_request_handoff_t packet; + packet.control_target = control_target; + mav_array_assign_char(packet.requester_id, requester_id, 40); + mav_array_assign_char(packet.reason, reason, 100); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_REQUEST_HANDOFF_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_REQUEST_HANDOFF; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_REQUEST_HANDOFF_MIN_LEN, MAVLINK_MSG_ID_REQUEST_HANDOFF_LEN, MAVLINK_MSG_ID_REQUEST_HANDOFF_CRC); +} + +/** + * @brief Pack a request_handoff message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param control_target Control target to handoff control ownership. + * @param requester_id Identification of the control entity requesting ownership. + * @param reason Reason from the control entity requesting ownership. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_request_handoff_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t control_target, const char *requester_id, const char *reason) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_REQUEST_HANDOFF_LEN]; + _mav_put_uint8_t(buf, 0, control_target); + _mav_put_char_array(buf, 1, requester_id, 40); + _mav_put_char_array(buf, 41, reason, 100); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_REQUEST_HANDOFF_LEN); +#else + mavlink_request_handoff_t packet; + packet.control_target = control_target; + mav_array_memcpy(packet.requester_id, requester_id, sizeof(char)*40); + mav_array_memcpy(packet.reason, reason, sizeof(char)*100); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_REQUEST_HANDOFF_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_REQUEST_HANDOFF; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_REQUEST_HANDOFF_MIN_LEN, MAVLINK_MSG_ID_REQUEST_HANDOFF_LEN, MAVLINK_MSG_ID_REQUEST_HANDOFF_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_REQUEST_HANDOFF_MIN_LEN, MAVLINK_MSG_ID_REQUEST_HANDOFF_LEN); +#endif +} + +/** + * @brief Pack a request_handoff message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param control_target Control target to handoff control ownership. + * @param requester_id Identification of the control entity requesting ownership. + * @param reason Reason from the control entity requesting ownership. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_request_handoff_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t control_target,const char *requester_id,const char *reason) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_REQUEST_HANDOFF_LEN]; + _mav_put_uint8_t(buf, 0, control_target); + _mav_put_char_array(buf, 1, requester_id, 40); + _mav_put_char_array(buf, 41, reason, 100); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_REQUEST_HANDOFF_LEN); +#else + mavlink_request_handoff_t packet; + packet.control_target = control_target; + mav_array_assign_char(packet.requester_id, requester_id, 40); + mav_array_assign_char(packet.reason, reason, 100); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_REQUEST_HANDOFF_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_REQUEST_HANDOFF; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_REQUEST_HANDOFF_MIN_LEN, MAVLINK_MSG_ID_REQUEST_HANDOFF_LEN, MAVLINK_MSG_ID_REQUEST_HANDOFF_CRC); +} + +/** + * @brief Encode a request_handoff struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param request_handoff C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_request_handoff_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_request_handoff_t* request_handoff) +{ + return mavlink_msg_request_handoff_pack(system_id, component_id, msg, request_handoff->control_target, request_handoff->requester_id, request_handoff->reason); +} + +/** + * @brief Encode a request_handoff struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param request_handoff C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_request_handoff_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_request_handoff_t* request_handoff) +{ + return mavlink_msg_request_handoff_pack_chan(system_id, component_id, chan, msg, request_handoff->control_target, request_handoff->requester_id, request_handoff->reason); +} + +/** + * @brief Encode a request_handoff struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param request_handoff C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_request_handoff_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_request_handoff_t* request_handoff) +{ + return mavlink_msg_request_handoff_pack_status(system_id, component_id, _status, msg, request_handoff->control_target, request_handoff->requester_id, request_handoff->reason); +} + +/** + * @brief Send a request_handoff message + * @param chan MAVLink channel to send the message + * + * @param control_target Control target to handoff control ownership. + * @param requester_id Identification of the control entity requesting ownership. + * @param reason Reason from the control entity requesting ownership. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_request_handoff_send(mavlink_channel_t chan, uint8_t control_target, const char *requester_id, const char *reason) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_REQUEST_HANDOFF_LEN]; + _mav_put_uint8_t(buf, 0, control_target); + _mav_put_char_array(buf, 1, requester_id, 40); + _mav_put_char_array(buf, 41, reason, 100); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REQUEST_HANDOFF, buf, MAVLINK_MSG_ID_REQUEST_HANDOFF_MIN_LEN, MAVLINK_MSG_ID_REQUEST_HANDOFF_LEN, MAVLINK_MSG_ID_REQUEST_HANDOFF_CRC); +#else + mavlink_request_handoff_t packet; + packet.control_target = control_target; + mav_array_assign_char(packet.requester_id, requester_id, 40); + mav_array_assign_char(packet.reason, reason, 100); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REQUEST_HANDOFF, (const char *)&packet, MAVLINK_MSG_ID_REQUEST_HANDOFF_MIN_LEN, MAVLINK_MSG_ID_REQUEST_HANDOFF_LEN, MAVLINK_MSG_ID_REQUEST_HANDOFF_CRC); +#endif +} + +/** + * @brief Send a request_handoff message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_request_handoff_send_struct(mavlink_channel_t chan, const mavlink_request_handoff_t* request_handoff) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_request_handoff_send(chan, request_handoff->control_target, request_handoff->requester_id, request_handoff->reason); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REQUEST_HANDOFF, (const char *)request_handoff, MAVLINK_MSG_ID_REQUEST_HANDOFF_MIN_LEN, MAVLINK_MSG_ID_REQUEST_HANDOFF_LEN, MAVLINK_MSG_ID_REQUEST_HANDOFF_CRC); +#endif +} + +#if MAVLINK_MSG_ID_REQUEST_HANDOFF_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_request_handoff_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t control_target, const char *requester_id, const char *reason) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint8_t(buf, 0, control_target); + _mav_put_char_array(buf, 1, requester_id, 40); + _mav_put_char_array(buf, 41, reason, 100); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REQUEST_HANDOFF, buf, MAVLINK_MSG_ID_REQUEST_HANDOFF_MIN_LEN, MAVLINK_MSG_ID_REQUEST_HANDOFF_LEN, MAVLINK_MSG_ID_REQUEST_HANDOFF_CRC); +#else + mavlink_request_handoff_t *packet = (mavlink_request_handoff_t *)msgbuf; + packet->control_target = control_target; + mav_array_assign_char(packet->requester_id, requester_id, 40); + mav_array_assign_char(packet->reason, reason, 100); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REQUEST_HANDOFF, (const char *)packet, MAVLINK_MSG_ID_REQUEST_HANDOFF_MIN_LEN, MAVLINK_MSG_ID_REQUEST_HANDOFF_LEN, MAVLINK_MSG_ID_REQUEST_HANDOFF_CRC); +#endif +} +#endif + +#endif + +// MESSAGE REQUEST_HANDOFF UNPACKING + + +/** + * @brief Get field control_target from request_handoff message + * + * @return Control target to handoff control ownership. + */ +static inline uint8_t mavlink_msg_request_handoff_get_control_target(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 0); +} + +/** + * @brief Get field requester_id from request_handoff message + * + * @return Identification of the control entity requesting ownership. + */ +static inline uint16_t mavlink_msg_request_handoff_get_requester_id(const mavlink_message_t* msg, char *requester_id) +{ + return _MAV_RETURN_char_array(msg, requester_id, 40, 1); +} + +/** + * @brief Get field reason from request_handoff message + * + * @return Reason from the control entity requesting ownership. + */ +static inline uint16_t mavlink_msg_request_handoff_get_reason(const mavlink_message_t* msg, char *reason) +{ + return _MAV_RETURN_char_array(msg, reason, 100, 41); +} + +/** + * @brief Decode a request_handoff message into a struct + * + * @param msg The message to decode + * @param request_handoff C-struct to decode the message contents into + */ +static inline void mavlink_msg_request_handoff_decode(const mavlink_message_t* msg, mavlink_request_handoff_t* request_handoff) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + request_handoff->control_target = mavlink_msg_request_handoff_get_control_target(msg); + mavlink_msg_request_handoff_get_requester_id(msg, request_handoff->requester_id); + mavlink_msg_request_handoff_get_reason(msg, request_handoff->reason); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_REQUEST_HANDOFF_LEN? msg->len : MAVLINK_MSG_ID_REQUEST_HANDOFF_LEN; + memset(request_handoff, 0, MAVLINK_MSG_ID_REQUEST_HANDOFF_LEN); + memcpy(request_handoff, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/auterion/mavlink_msg_ship_approach_sectors_status.h b/auterion/mavlink_msg_ship_approach_sectors_status.h new file mode 100644 index 000000000..b28761c4e --- /dev/null +++ b/auterion/mavlink_msg_ship_approach_sectors_status.h @@ -0,0 +1,260 @@ +#pragma once +// MESSAGE SHIP_APPROACH_SECTORS_STATUS PACKING + +#define MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS 13680 + + +typedef struct __mavlink_ship_approach_sectors_status_t { + uint8_t sectors; /*< Bitmap indicating which ship approach sectors are set. In clockwise order.*/ +} mavlink_ship_approach_sectors_status_t; + +#define MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_LEN 1 +#define MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_MIN_LEN 1 +#define MAVLINK_MSG_ID_13680_LEN 1 +#define MAVLINK_MSG_ID_13680_MIN_LEN 1 + +#define MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_CRC 38 +#define MAVLINK_MSG_ID_13680_CRC 38 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_SHIP_APPROACH_SECTORS_STATUS { \ + 13680, \ + "SHIP_APPROACH_SECTORS_STATUS", \ + 1, \ + { { "sectors", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_ship_approach_sectors_status_t, sectors) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_SHIP_APPROACH_SECTORS_STATUS { \ + "SHIP_APPROACH_SECTORS_STATUS", \ + 1, \ + { { "sectors", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_ship_approach_sectors_status_t, sectors) }, \ + } \ +} +#endif + +/** + * @brief Pack a ship_approach_sectors_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param sectors Bitmap indicating which ship approach sectors are set. In clockwise order. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_ship_approach_sectors_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t sectors) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_LEN]; + _mav_put_uint8_t(buf, 0, sectors); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_LEN); +#else + mavlink_ship_approach_sectors_status_t packet; + packet.sectors = sectors; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_MIN_LEN, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_LEN, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_CRC); +} + +/** + * @brief Pack a ship_approach_sectors_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param sectors Bitmap indicating which ship approach sectors are set. In clockwise order. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_ship_approach_sectors_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t sectors) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_LEN]; + _mav_put_uint8_t(buf, 0, sectors); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_LEN); +#else + mavlink_ship_approach_sectors_status_t packet; + packet.sectors = sectors; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_MIN_LEN, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_LEN, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_MIN_LEN, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_LEN); +#endif +} + +/** + * @brief Pack a ship_approach_sectors_status message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param sectors Bitmap indicating which ship approach sectors are set. In clockwise order. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_ship_approach_sectors_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t sectors) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_LEN]; + _mav_put_uint8_t(buf, 0, sectors); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_LEN); +#else + mavlink_ship_approach_sectors_status_t packet; + packet.sectors = sectors; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_MIN_LEN, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_LEN, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_CRC); +} + +/** + * @brief Encode a ship_approach_sectors_status struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param ship_approach_sectors_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_ship_approach_sectors_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_ship_approach_sectors_status_t* ship_approach_sectors_status) +{ + return mavlink_msg_ship_approach_sectors_status_pack(system_id, component_id, msg, ship_approach_sectors_status->sectors); +} + +/** + * @brief Encode a ship_approach_sectors_status struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param ship_approach_sectors_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_ship_approach_sectors_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_ship_approach_sectors_status_t* ship_approach_sectors_status) +{ + return mavlink_msg_ship_approach_sectors_status_pack_chan(system_id, component_id, chan, msg, ship_approach_sectors_status->sectors); +} + +/** + * @brief Encode a ship_approach_sectors_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param ship_approach_sectors_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_ship_approach_sectors_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_ship_approach_sectors_status_t* ship_approach_sectors_status) +{ + return mavlink_msg_ship_approach_sectors_status_pack_status(system_id, component_id, _status, msg, ship_approach_sectors_status->sectors); +} + +/** + * @brief Send a ship_approach_sectors_status message + * @param chan MAVLink channel to send the message + * + * @param sectors Bitmap indicating which ship approach sectors are set. In clockwise order. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_ship_approach_sectors_status_send(mavlink_channel_t chan, uint8_t sectors) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_LEN]; + _mav_put_uint8_t(buf, 0, sectors); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS, buf, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_MIN_LEN, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_LEN, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_CRC); +#else + mavlink_ship_approach_sectors_status_t packet; + packet.sectors = sectors; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS, (const char *)&packet, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_MIN_LEN, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_LEN, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_CRC); +#endif +} + +/** + * @brief Send a ship_approach_sectors_status message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_ship_approach_sectors_status_send_struct(mavlink_channel_t chan, const mavlink_ship_approach_sectors_status_t* ship_approach_sectors_status) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_ship_approach_sectors_status_send(chan, ship_approach_sectors_status->sectors); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS, (const char *)ship_approach_sectors_status, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_MIN_LEN, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_LEN, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_CRC); +#endif +} + +#if MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_ship_approach_sectors_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t sectors) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint8_t(buf, 0, sectors); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS, buf, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_MIN_LEN, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_LEN, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_CRC); +#else + mavlink_ship_approach_sectors_status_t *packet = (mavlink_ship_approach_sectors_status_t *)msgbuf; + packet->sectors = sectors; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS, (const char *)packet, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_MIN_LEN, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_LEN, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_CRC); +#endif +} +#endif + +#endif + +// MESSAGE SHIP_APPROACH_SECTORS_STATUS UNPACKING + + +/** + * @brief Get field sectors from ship_approach_sectors_status message + * + * @return Bitmap indicating which ship approach sectors are set. In clockwise order. + */ +static inline uint8_t mavlink_msg_ship_approach_sectors_status_get_sectors(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 0); +} + +/** + * @brief Decode a ship_approach_sectors_status message into a struct + * + * @param msg The message to decode + * @param ship_approach_sectors_status C-struct to decode the message contents into + */ +static inline void mavlink_msg_ship_approach_sectors_status_decode(const mavlink_message_t* msg, mavlink_ship_approach_sectors_status_t* ship_approach_sectors_status) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + ship_approach_sectors_status->sectors = mavlink_msg_ship_approach_sectors_status_get_sectors(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_LEN? msg->len : MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_LEN; + memset(ship_approach_sectors_status, 0, MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_LEN); + memcpy(ship_approach_sectors_status, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/auterion/mavlink_msg_tracker_detection_2d.h b/auterion/mavlink_msg_tracker_detection_2d.h new file mode 100644 index 000000000..6bfb223dd --- /dev/null +++ b/auterion/mavlink_msg_tracker_detection_2d.h @@ -0,0 +1,680 @@ +#pragma once +// MESSAGE TRACKER_DETECTION_2D PACKING + +#define MAVLINK_MSG_ID_TRACKER_DETECTION_2D 501 + + +typedef struct __mavlink_tracker_detection_2d_t { + uint64_t img_ts; /*< [us] Time stamp of the image.*/ + uint64_t img_id; /*< Unique ID specifiying the video frame (image) in the message sender video stream.*/ + uint32_t object_id; /*< Unique ID representing the object. */ + uint32_t class_id; /*< Unique ID specifiying the class of the object.*/ + int32_t lat; /*< [degE7] Latitude in WGS84 coordinate frame of the detected object. NAN if unknown.*/ + int32_t lon; /*< [degE7] Longitude in WGS84 coordinate frame of the detected object. NAN if unknown.*/ + float alt; /*< [m] Altitude in EGM96 coordiante frame of the detected object. NAN if unknown.*/ + float vel_n; /*< [m/s] North velocity of the object in global frame. NAN if unknown.*/ + float vel_e; /*< [m/s] East velocity of the object in global frame. NAN if unknown.*/ + float vel_up; /*< [m/s] Up velocity of the object in global frame. NAN if unknown.*/ + uint16_t bbox_top_left_x; /*< [c%] Relative image x coordinate (left to right axis) in the range of [0.00, 100.00] describing the top left corner of the bounding box .*/ + uint16_t bbox_top_left_y; /*< [c%] Relative image y coordinate (top to bottom axis) in the range of [0.00, 100.00] describing the top left corner of the bounding box.*/ + uint16_t bbox_bot_right_x; /*< [c%] Relative image x coordinate (left to right axis) in the range of [0.00, 100.00] describing the bottom right corner of the bounding box.*/ + uint16_t bbox_bot_right_y; /*< [c%] Relative image y coordinate (top to bottom axis) in the range of [0.00, 100.00] describing the bottom left corner of the bounding box.*/ + uint8_t tracking_status; /*< 0: not tracked, 1: tracked.*/ + uint8_t confidence; /*< [%] Confidence score in the range of [0, 100] for the classifcation.*/ +} mavlink_tracker_detection_2d_t; + +#define MAVLINK_MSG_ID_TRACKER_DETECTION_2D_LEN 58 +#define MAVLINK_MSG_ID_TRACKER_DETECTION_2D_MIN_LEN 58 +#define MAVLINK_MSG_ID_501_LEN 58 +#define MAVLINK_MSG_ID_501_MIN_LEN 58 + +#define MAVLINK_MSG_ID_TRACKER_DETECTION_2D_CRC 178 +#define MAVLINK_MSG_ID_501_CRC 178 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_TRACKER_DETECTION_2D { \ + 501, \ + "TRACKER_DETECTION_2D", \ + 16, \ + { { "img_ts", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_tracker_detection_2d_t, img_ts) }, \ + { "img_id", NULL, MAVLINK_TYPE_UINT64_T, 0, 8, offsetof(mavlink_tracker_detection_2d_t, img_id) }, \ + { "object_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 16, offsetof(mavlink_tracker_detection_2d_t, object_id) }, \ + { "class_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_tracker_detection_2d_t, class_id) }, \ + { "tracking_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 56, offsetof(mavlink_tracker_detection_2d_t, tracking_status) }, \ + { "confidence", NULL, MAVLINK_TYPE_UINT8_T, 0, 57, offsetof(mavlink_tracker_detection_2d_t, confidence) }, \ + { "bbox_top_left_x", NULL, MAVLINK_TYPE_UINT16_T, 0, 48, offsetof(mavlink_tracker_detection_2d_t, bbox_top_left_x) }, \ + { "bbox_top_left_y", NULL, MAVLINK_TYPE_UINT16_T, 0, 50, offsetof(mavlink_tracker_detection_2d_t, bbox_top_left_y) }, \ + { "bbox_bot_right_x", NULL, MAVLINK_TYPE_UINT16_T, 0, 52, offsetof(mavlink_tracker_detection_2d_t, bbox_bot_right_x) }, \ + { "bbox_bot_right_y", NULL, MAVLINK_TYPE_UINT16_T, 0, 54, offsetof(mavlink_tracker_detection_2d_t, bbox_bot_right_y) }, \ + { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 24, offsetof(mavlink_tracker_detection_2d_t, lat) }, \ + { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 28, offsetof(mavlink_tracker_detection_2d_t, lon) }, \ + { "alt", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_tracker_detection_2d_t, alt) }, \ + { "vel_n", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_tracker_detection_2d_t, vel_n) }, \ + { "vel_e", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_tracker_detection_2d_t, vel_e) }, \ + { "vel_up", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_tracker_detection_2d_t, vel_up) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_TRACKER_DETECTION_2D { \ + "TRACKER_DETECTION_2D", \ + 16, \ + { { "img_ts", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_tracker_detection_2d_t, img_ts) }, \ + { "img_id", NULL, MAVLINK_TYPE_UINT64_T, 0, 8, offsetof(mavlink_tracker_detection_2d_t, img_id) }, \ + { "object_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 16, offsetof(mavlink_tracker_detection_2d_t, object_id) }, \ + { "class_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_tracker_detection_2d_t, class_id) }, \ + { "tracking_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 56, offsetof(mavlink_tracker_detection_2d_t, tracking_status) }, \ + { "confidence", NULL, MAVLINK_TYPE_UINT8_T, 0, 57, offsetof(mavlink_tracker_detection_2d_t, confidence) }, \ + { "bbox_top_left_x", NULL, MAVLINK_TYPE_UINT16_T, 0, 48, offsetof(mavlink_tracker_detection_2d_t, bbox_top_left_x) }, \ + { "bbox_top_left_y", NULL, MAVLINK_TYPE_UINT16_T, 0, 50, offsetof(mavlink_tracker_detection_2d_t, bbox_top_left_y) }, \ + { "bbox_bot_right_x", NULL, MAVLINK_TYPE_UINT16_T, 0, 52, offsetof(mavlink_tracker_detection_2d_t, bbox_bot_right_x) }, \ + { "bbox_bot_right_y", NULL, MAVLINK_TYPE_UINT16_T, 0, 54, offsetof(mavlink_tracker_detection_2d_t, bbox_bot_right_y) }, \ + { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 24, offsetof(mavlink_tracker_detection_2d_t, lat) }, \ + { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 28, offsetof(mavlink_tracker_detection_2d_t, lon) }, \ + { "alt", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_tracker_detection_2d_t, alt) }, \ + { "vel_n", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_tracker_detection_2d_t, vel_n) }, \ + { "vel_e", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_tracker_detection_2d_t, vel_e) }, \ + { "vel_up", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_tracker_detection_2d_t, vel_up) }, \ + } \ +} +#endif + +/** + * @brief Pack a tracker_detection_2d message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param img_ts [us] Time stamp of the image. + * @param img_id Unique ID specifiying the video frame (image) in the message sender video stream. + * @param object_id Unique ID representing the object. + * @param class_id Unique ID specifiying the class of the object. + * @param tracking_status 0: not tracked, 1: tracked. + * @param confidence [%] Confidence score in the range of [0, 100] for the classifcation. + * @param bbox_top_left_x [c%] Relative image x coordinate (left to right axis) in the range of [0.00, 100.00] describing the top left corner of the bounding box . + * @param bbox_top_left_y [c%] Relative image y coordinate (top to bottom axis) in the range of [0.00, 100.00] describing the top left corner of the bounding box. + * @param bbox_bot_right_x [c%] Relative image x coordinate (left to right axis) in the range of [0.00, 100.00] describing the bottom right corner of the bounding box. + * @param bbox_bot_right_y [c%] Relative image y coordinate (top to bottom axis) in the range of [0.00, 100.00] describing the bottom left corner of the bounding box. + * @param lat [degE7] Latitude in WGS84 coordinate frame of the detected object. NAN if unknown. + * @param lon [degE7] Longitude in WGS84 coordinate frame of the detected object. NAN if unknown. + * @param alt [m] Altitude in EGM96 coordiante frame of the detected object. NAN if unknown. + * @param vel_n [m/s] North velocity of the object in global frame. NAN if unknown. + * @param vel_e [m/s] East velocity of the object in global frame. NAN if unknown. + * @param vel_up [m/s] Up velocity of the object in global frame. NAN if unknown. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_tracker_detection_2d_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint64_t img_ts, uint64_t img_id, uint32_t object_id, uint32_t class_id, uint8_t tracking_status, uint8_t confidence, uint16_t bbox_top_left_x, uint16_t bbox_top_left_y, uint16_t bbox_bot_right_x, uint16_t bbox_bot_right_y, int32_t lat, int32_t lon, float alt, float vel_n, float vel_e, float vel_up) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_TRACKER_DETECTION_2D_LEN]; + _mav_put_uint64_t(buf, 0, img_ts); + _mav_put_uint64_t(buf, 8, img_id); + _mav_put_uint32_t(buf, 16, object_id); + _mav_put_uint32_t(buf, 20, class_id); + _mav_put_int32_t(buf, 24, lat); + _mav_put_int32_t(buf, 28, lon); + _mav_put_float(buf, 32, alt); + _mav_put_float(buf, 36, vel_n); + _mav_put_float(buf, 40, vel_e); + _mav_put_float(buf, 44, vel_up); + _mav_put_uint16_t(buf, 48, bbox_top_left_x); + _mav_put_uint16_t(buf, 50, bbox_top_left_y); + _mav_put_uint16_t(buf, 52, bbox_bot_right_x); + _mav_put_uint16_t(buf, 54, bbox_bot_right_y); + _mav_put_uint8_t(buf, 56, tracking_status); + _mav_put_uint8_t(buf, 57, confidence); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_LEN); +#else + mavlink_tracker_detection_2d_t packet; + packet.img_ts = img_ts; + packet.img_id = img_id; + packet.object_id = object_id; + packet.class_id = class_id; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.vel_n = vel_n; + packet.vel_e = vel_e; + packet.vel_up = vel_up; + packet.bbox_top_left_x = bbox_top_left_x; + packet.bbox_top_left_y = bbox_top_left_y; + packet.bbox_bot_right_x = bbox_bot_right_x; + packet.bbox_bot_right_y = bbox_bot_right_y; + packet.tracking_status = tracking_status; + packet.confidence = confidence; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_TRACKER_DETECTION_2D; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_MIN_LEN, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_LEN, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_CRC); +} + +/** + * @brief Pack a tracker_detection_2d message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param img_ts [us] Time stamp of the image. + * @param img_id Unique ID specifiying the video frame (image) in the message sender video stream. + * @param object_id Unique ID representing the object. + * @param class_id Unique ID specifiying the class of the object. + * @param tracking_status 0: not tracked, 1: tracked. + * @param confidence [%] Confidence score in the range of [0, 100] for the classifcation. + * @param bbox_top_left_x [c%] Relative image x coordinate (left to right axis) in the range of [0.00, 100.00] describing the top left corner of the bounding box . + * @param bbox_top_left_y [c%] Relative image y coordinate (top to bottom axis) in the range of [0.00, 100.00] describing the top left corner of the bounding box. + * @param bbox_bot_right_x [c%] Relative image x coordinate (left to right axis) in the range of [0.00, 100.00] describing the bottom right corner of the bounding box. + * @param bbox_bot_right_y [c%] Relative image y coordinate (top to bottom axis) in the range of [0.00, 100.00] describing the bottom left corner of the bounding box. + * @param lat [degE7] Latitude in WGS84 coordinate frame of the detected object. NAN if unknown. + * @param lon [degE7] Longitude in WGS84 coordinate frame of the detected object. NAN if unknown. + * @param alt [m] Altitude in EGM96 coordiante frame of the detected object. NAN if unknown. + * @param vel_n [m/s] North velocity of the object in global frame. NAN if unknown. + * @param vel_e [m/s] East velocity of the object in global frame. NAN if unknown. + * @param vel_up [m/s] Up velocity of the object in global frame. NAN if unknown. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_tracker_detection_2d_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t img_ts, uint64_t img_id, uint32_t object_id, uint32_t class_id, uint8_t tracking_status, uint8_t confidence, uint16_t bbox_top_left_x, uint16_t bbox_top_left_y, uint16_t bbox_bot_right_x, uint16_t bbox_bot_right_y, int32_t lat, int32_t lon, float alt, float vel_n, float vel_e, float vel_up) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_TRACKER_DETECTION_2D_LEN]; + _mav_put_uint64_t(buf, 0, img_ts); + _mav_put_uint64_t(buf, 8, img_id); + _mav_put_uint32_t(buf, 16, object_id); + _mav_put_uint32_t(buf, 20, class_id); + _mav_put_int32_t(buf, 24, lat); + _mav_put_int32_t(buf, 28, lon); + _mav_put_float(buf, 32, alt); + _mav_put_float(buf, 36, vel_n); + _mav_put_float(buf, 40, vel_e); + _mav_put_float(buf, 44, vel_up); + _mav_put_uint16_t(buf, 48, bbox_top_left_x); + _mav_put_uint16_t(buf, 50, bbox_top_left_y); + _mav_put_uint16_t(buf, 52, bbox_bot_right_x); + _mav_put_uint16_t(buf, 54, bbox_bot_right_y); + _mav_put_uint8_t(buf, 56, tracking_status); + _mav_put_uint8_t(buf, 57, confidence); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_LEN); +#else + mavlink_tracker_detection_2d_t packet; + packet.img_ts = img_ts; + packet.img_id = img_id; + packet.object_id = object_id; + packet.class_id = class_id; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.vel_n = vel_n; + packet.vel_e = vel_e; + packet.vel_up = vel_up; + packet.bbox_top_left_x = bbox_top_left_x; + packet.bbox_top_left_y = bbox_top_left_y; + packet.bbox_bot_right_x = bbox_bot_right_x; + packet.bbox_bot_right_y = bbox_bot_right_y; + packet.tracking_status = tracking_status; + packet.confidence = confidence; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_TRACKER_DETECTION_2D; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_MIN_LEN, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_LEN, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_MIN_LEN, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_LEN); +#endif +} + +/** + * @brief Pack a tracker_detection_2d message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param img_ts [us] Time stamp of the image. + * @param img_id Unique ID specifiying the video frame (image) in the message sender video stream. + * @param object_id Unique ID representing the object. + * @param class_id Unique ID specifiying the class of the object. + * @param tracking_status 0: not tracked, 1: tracked. + * @param confidence [%] Confidence score in the range of [0, 100] for the classifcation. + * @param bbox_top_left_x [c%] Relative image x coordinate (left to right axis) in the range of [0.00, 100.00] describing the top left corner of the bounding box . + * @param bbox_top_left_y [c%] Relative image y coordinate (top to bottom axis) in the range of [0.00, 100.00] describing the top left corner of the bounding box. + * @param bbox_bot_right_x [c%] Relative image x coordinate (left to right axis) in the range of [0.00, 100.00] describing the bottom right corner of the bounding box. + * @param bbox_bot_right_y [c%] Relative image y coordinate (top to bottom axis) in the range of [0.00, 100.00] describing the bottom left corner of the bounding box. + * @param lat [degE7] Latitude in WGS84 coordinate frame of the detected object. NAN if unknown. + * @param lon [degE7] Longitude in WGS84 coordinate frame of the detected object. NAN if unknown. + * @param alt [m] Altitude in EGM96 coordiante frame of the detected object. NAN if unknown. + * @param vel_n [m/s] North velocity of the object in global frame. NAN if unknown. + * @param vel_e [m/s] East velocity of the object in global frame. NAN if unknown. + * @param vel_up [m/s] Up velocity of the object in global frame. NAN if unknown. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_tracker_detection_2d_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint64_t img_ts,uint64_t img_id,uint32_t object_id,uint32_t class_id,uint8_t tracking_status,uint8_t confidence,uint16_t bbox_top_left_x,uint16_t bbox_top_left_y,uint16_t bbox_bot_right_x,uint16_t bbox_bot_right_y,int32_t lat,int32_t lon,float alt,float vel_n,float vel_e,float vel_up) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_TRACKER_DETECTION_2D_LEN]; + _mav_put_uint64_t(buf, 0, img_ts); + _mav_put_uint64_t(buf, 8, img_id); + _mav_put_uint32_t(buf, 16, object_id); + _mav_put_uint32_t(buf, 20, class_id); + _mav_put_int32_t(buf, 24, lat); + _mav_put_int32_t(buf, 28, lon); + _mav_put_float(buf, 32, alt); + _mav_put_float(buf, 36, vel_n); + _mav_put_float(buf, 40, vel_e); + _mav_put_float(buf, 44, vel_up); + _mav_put_uint16_t(buf, 48, bbox_top_left_x); + _mav_put_uint16_t(buf, 50, bbox_top_left_y); + _mav_put_uint16_t(buf, 52, bbox_bot_right_x); + _mav_put_uint16_t(buf, 54, bbox_bot_right_y); + _mav_put_uint8_t(buf, 56, tracking_status); + _mav_put_uint8_t(buf, 57, confidence); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_LEN); +#else + mavlink_tracker_detection_2d_t packet; + packet.img_ts = img_ts; + packet.img_id = img_id; + packet.object_id = object_id; + packet.class_id = class_id; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.vel_n = vel_n; + packet.vel_e = vel_e; + packet.vel_up = vel_up; + packet.bbox_top_left_x = bbox_top_left_x; + packet.bbox_top_left_y = bbox_top_left_y; + packet.bbox_bot_right_x = bbox_bot_right_x; + packet.bbox_bot_right_y = bbox_bot_right_y; + packet.tracking_status = tracking_status; + packet.confidence = confidence; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_TRACKER_DETECTION_2D; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_MIN_LEN, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_LEN, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_CRC); +} + +/** + * @brief Encode a tracker_detection_2d struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param tracker_detection_2d C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_tracker_detection_2d_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_tracker_detection_2d_t* tracker_detection_2d) +{ + return mavlink_msg_tracker_detection_2d_pack(system_id, component_id, msg, tracker_detection_2d->img_ts, tracker_detection_2d->img_id, tracker_detection_2d->object_id, tracker_detection_2d->class_id, tracker_detection_2d->tracking_status, tracker_detection_2d->confidence, tracker_detection_2d->bbox_top_left_x, tracker_detection_2d->bbox_top_left_y, tracker_detection_2d->bbox_bot_right_x, tracker_detection_2d->bbox_bot_right_y, tracker_detection_2d->lat, tracker_detection_2d->lon, tracker_detection_2d->alt, tracker_detection_2d->vel_n, tracker_detection_2d->vel_e, tracker_detection_2d->vel_up); +} + +/** + * @brief Encode a tracker_detection_2d struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param tracker_detection_2d C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_tracker_detection_2d_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_tracker_detection_2d_t* tracker_detection_2d) +{ + return mavlink_msg_tracker_detection_2d_pack_chan(system_id, component_id, chan, msg, tracker_detection_2d->img_ts, tracker_detection_2d->img_id, tracker_detection_2d->object_id, tracker_detection_2d->class_id, tracker_detection_2d->tracking_status, tracker_detection_2d->confidence, tracker_detection_2d->bbox_top_left_x, tracker_detection_2d->bbox_top_left_y, tracker_detection_2d->bbox_bot_right_x, tracker_detection_2d->bbox_bot_right_y, tracker_detection_2d->lat, tracker_detection_2d->lon, tracker_detection_2d->alt, tracker_detection_2d->vel_n, tracker_detection_2d->vel_e, tracker_detection_2d->vel_up); +} + +/** + * @brief Encode a tracker_detection_2d struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param tracker_detection_2d C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_tracker_detection_2d_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_tracker_detection_2d_t* tracker_detection_2d) +{ + return mavlink_msg_tracker_detection_2d_pack_status(system_id, component_id, _status, msg, tracker_detection_2d->img_ts, tracker_detection_2d->img_id, tracker_detection_2d->object_id, tracker_detection_2d->class_id, tracker_detection_2d->tracking_status, tracker_detection_2d->confidence, tracker_detection_2d->bbox_top_left_x, tracker_detection_2d->bbox_top_left_y, tracker_detection_2d->bbox_bot_right_x, tracker_detection_2d->bbox_bot_right_y, tracker_detection_2d->lat, tracker_detection_2d->lon, tracker_detection_2d->alt, tracker_detection_2d->vel_n, tracker_detection_2d->vel_e, tracker_detection_2d->vel_up); +} + +/** + * @brief Send a tracker_detection_2d message + * @param chan MAVLink channel to send the message + * + * @param img_ts [us] Time stamp of the image. + * @param img_id Unique ID specifiying the video frame (image) in the message sender video stream. + * @param object_id Unique ID representing the object. + * @param class_id Unique ID specifiying the class of the object. + * @param tracking_status 0: not tracked, 1: tracked. + * @param confidence [%] Confidence score in the range of [0, 100] for the classifcation. + * @param bbox_top_left_x [c%] Relative image x coordinate (left to right axis) in the range of [0.00, 100.00] describing the top left corner of the bounding box . + * @param bbox_top_left_y [c%] Relative image y coordinate (top to bottom axis) in the range of [0.00, 100.00] describing the top left corner of the bounding box. + * @param bbox_bot_right_x [c%] Relative image x coordinate (left to right axis) in the range of [0.00, 100.00] describing the bottom right corner of the bounding box. + * @param bbox_bot_right_y [c%] Relative image y coordinate (top to bottom axis) in the range of [0.00, 100.00] describing the bottom left corner of the bounding box. + * @param lat [degE7] Latitude in WGS84 coordinate frame of the detected object. NAN if unknown. + * @param lon [degE7] Longitude in WGS84 coordinate frame of the detected object. NAN if unknown. + * @param alt [m] Altitude in EGM96 coordiante frame of the detected object. NAN if unknown. + * @param vel_n [m/s] North velocity of the object in global frame. NAN if unknown. + * @param vel_e [m/s] East velocity of the object in global frame. NAN if unknown. + * @param vel_up [m/s] Up velocity of the object in global frame. NAN if unknown. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_tracker_detection_2d_send(mavlink_channel_t chan, uint64_t img_ts, uint64_t img_id, uint32_t object_id, uint32_t class_id, uint8_t tracking_status, uint8_t confidence, uint16_t bbox_top_left_x, uint16_t bbox_top_left_y, uint16_t bbox_bot_right_x, uint16_t bbox_bot_right_y, int32_t lat, int32_t lon, float alt, float vel_n, float vel_e, float vel_up) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_TRACKER_DETECTION_2D_LEN]; + _mav_put_uint64_t(buf, 0, img_ts); + _mav_put_uint64_t(buf, 8, img_id); + _mav_put_uint32_t(buf, 16, object_id); + _mav_put_uint32_t(buf, 20, class_id); + _mav_put_int32_t(buf, 24, lat); + _mav_put_int32_t(buf, 28, lon); + _mav_put_float(buf, 32, alt); + _mav_put_float(buf, 36, vel_n); + _mav_put_float(buf, 40, vel_e); + _mav_put_float(buf, 44, vel_up); + _mav_put_uint16_t(buf, 48, bbox_top_left_x); + _mav_put_uint16_t(buf, 50, bbox_top_left_y); + _mav_put_uint16_t(buf, 52, bbox_bot_right_x); + _mav_put_uint16_t(buf, 54, bbox_bot_right_y); + _mav_put_uint8_t(buf, 56, tracking_status); + _mav_put_uint8_t(buf, 57, confidence); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TRACKER_DETECTION_2D, buf, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_MIN_LEN, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_LEN, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_CRC); +#else + mavlink_tracker_detection_2d_t packet; + packet.img_ts = img_ts; + packet.img_id = img_id; + packet.object_id = object_id; + packet.class_id = class_id; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.vel_n = vel_n; + packet.vel_e = vel_e; + packet.vel_up = vel_up; + packet.bbox_top_left_x = bbox_top_left_x; + packet.bbox_top_left_y = bbox_top_left_y; + packet.bbox_bot_right_x = bbox_bot_right_x; + packet.bbox_bot_right_y = bbox_bot_right_y; + packet.tracking_status = tracking_status; + packet.confidence = confidence; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TRACKER_DETECTION_2D, (const char *)&packet, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_MIN_LEN, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_LEN, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_CRC); +#endif +} + +/** + * @brief Send a tracker_detection_2d message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_tracker_detection_2d_send_struct(mavlink_channel_t chan, const mavlink_tracker_detection_2d_t* tracker_detection_2d) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_tracker_detection_2d_send(chan, tracker_detection_2d->img_ts, tracker_detection_2d->img_id, tracker_detection_2d->object_id, tracker_detection_2d->class_id, tracker_detection_2d->tracking_status, tracker_detection_2d->confidence, tracker_detection_2d->bbox_top_left_x, tracker_detection_2d->bbox_top_left_y, tracker_detection_2d->bbox_bot_right_x, tracker_detection_2d->bbox_bot_right_y, tracker_detection_2d->lat, tracker_detection_2d->lon, tracker_detection_2d->alt, tracker_detection_2d->vel_n, tracker_detection_2d->vel_e, tracker_detection_2d->vel_up); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TRACKER_DETECTION_2D, (const char *)tracker_detection_2d, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_MIN_LEN, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_LEN, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_CRC); +#endif +} + +#if MAVLINK_MSG_ID_TRACKER_DETECTION_2D_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_tracker_detection_2d_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t img_ts, uint64_t img_id, uint32_t object_id, uint32_t class_id, uint8_t tracking_status, uint8_t confidence, uint16_t bbox_top_left_x, uint16_t bbox_top_left_y, uint16_t bbox_bot_right_x, uint16_t bbox_bot_right_y, int32_t lat, int32_t lon, float alt, float vel_n, float vel_e, float vel_up) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint64_t(buf, 0, img_ts); + _mav_put_uint64_t(buf, 8, img_id); + _mav_put_uint32_t(buf, 16, object_id); + _mav_put_uint32_t(buf, 20, class_id); + _mav_put_int32_t(buf, 24, lat); + _mav_put_int32_t(buf, 28, lon); + _mav_put_float(buf, 32, alt); + _mav_put_float(buf, 36, vel_n); + _mav_put_float(buf, 40, vel_e); + _mav_put_float(buf, 44, vel_up); + _mav_put_uint16_t(buf, 48, bbox_top_left_x); + _mav_put_uint16_t(buf, 50, bbox_top_left_y); + _mav_put_uint16_t(buf, 52, bbox_bot_right_x); + _mav_put_uint16_t(buf, 54, bbox_bot_right_y); + _mav_put_uint8_t(buf, 56, tracking_status); + _mav_put_uint8_t(buf, 57, confidence); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TRACKER_DETECTION_2D, buf, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_MIN_LEN, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_LEN, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_CRC); +#else + mavlink_tracker_detection_2d_t *packet = (mavlink_tracker_detection_2d_t *)msgbuf; + packet->img_ts = img_ts; + packet->img_id = img_id; + packet->object_id = object_id; + packet->class_id = class_id; + packet->lat = lat; + packet->lon = lon; + packet->alt = alt; + packet->vel_n = vel_n; + packet->vel_e = vel_e; + packet->vel_up = vel_up; + packet->bbox_top_left_x = bbox_top_left_x; + packet->bbox_top_left_y = bbox_top_left_y; + packet->bbox_bot_right_x = bbox_bot_right_x; + packet->bbox_bot_right_y = bbox_bot_right_y; + packet->tracking_status = tracking_status; + packet->confidence = confidence; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TRACKER_DETECTION_2D, (const char *)packet, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_MIN_LEN, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_LEN, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_CRC); +#endif +} +#endif + +#endif + +// MESSAGE TRACKER_DETECTION_2D UNPACKING + + +/** + * @brief Get field img_ts from tracker_detection_2d message + * + * @return [us] Time stamp of the image. + */ +static inline uint64_t mavlink_msg_tracker_detection_2d_get_img_ts(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 0); +} + +/** + * @brief Get field img_id from tracker_detection_2d message + * + * @return Unique ID specifiying the video frame (image) in the message sender video stream. + */ +static inline uint64_t mavlink_msg_tracker_detection_2d_get_img_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 8); +} + +/** + * @brief Get field object_id from tracker_detection_2d message + * + * @return Unique ID representing the object. + */ +static inline uint32_t mavlink_msg_tracker_detection_2d_get_object_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 16); +} + +/** + * @brief Get field class_id from tracker_detection_2d message + * + * @return Unique ID specifiying the class of the object. + */ +static inline uint32_t mavlink_msg_tracker_detection_2d_get_class_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 20); +} + +/** + * @brief Get field tracking_status from tracker_detection_2d message + * + * @return 0: not tracked, 1: tracked. + */ +static inline uint8_t mavlink_msg_tracker_detection_2d_get_tracking_status(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 56); +} + +/** + * @brief Get field confidence from tracker_detection_2d message + * + * @return [%] Confidence score in the range of [0, 100] for the classifcation. + */ +static inline uint8_t mavlink_msg_tracker_detection_2d_get_confidence(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 57); +} + +/** + * @brief Get field bbox_top_left_x from tracker_detection_2d message + * + * @return [c%] Relative image x coordinate (left to right axis) in the range of [0.00, 100.00] describing the top left corner of the bounding box . + */ +static inline uint16_t mavlink_msg_tracker_detection_2d_get_bbox_top_left_x(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 48); +} + +/** + * @brief Get field bbox_top_left_y from tracker_detection_2d message + * + * @return [c%] Relative image y coordinate (top to bottom axis) in the range of [0.00, 100.00] describing the top left corner of the bounding box. + */ +static inline uint16_t mavlink_msg_tracker_detection_2d_get_bbox_top_left_y(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 50); +} + +/** + * @brief Get field bbox_bot_right_x from tracker_detection_2d message + * + * @return [c%] Relative image x coordinate (left to right axis) in the range of [0.00, 100.00] describing the bottom right corner of the bounding box. + */ +static inline uint16_t mavlink_msg_tracker_detection_2d_get_bbox_bot_right_x(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 52); +} + +/** + * @brief Get field bbox_bot_right_y from tracker_detection_2d message + * + * @return [c%] Relative image y coordinate (top to bottom axis) in the range of [0.00, 100.00] describing the bottom left corner of the bounding box. + */ +static inline uint16_t mavlink_msg_tracker_detection_2d_get_bbox_bot_right_y(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 54); +} + +/** + * @brief Get field lat from tracker_detection_2d message + * + * @return [degE7] Latitude in WGS84 coordinate frame of the detected object. NAN if unknown. + */ +static inline int32_t mavlink_msg_tracker_detection_2d_get_lat(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 24); +} + +/** + * @brief Get field lon from tracker_detection_2d message + * + * @return [degE7] Longitude in WGS84 coordinate frame of the detected object. NAN if unknown. + */ +static inline int32_t mavlink_msg_tracker_detection_2d_get_lon(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 28); +} + +/** + * @brief Get field alt from tracker_detection_2d message + * + * @return [m] Altitude in EGM96 coordiante frame of the detected object. NAN if unknown. + */ +static inline float mavlink_msg_tracker_detection_2d_get_alt(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 32); +} + +/** + * @brief Get field vel_n from tracker_detection_2d message + * + * @return [m/s] North velocity of the object in global frame. NAN if unknown. + */ +static inline float mavlink_msg_tracker_detection_2d_get_vel_n(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 36); +} + +/** + * @brief Get field vel_e from tracker_detection_2d message + * + * @return [m/s] East velocity of the object in global frame. NAN if unknown. + */ +static inline float mavlink_msg_tracker_detection_2d_get_vel_e(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 40); +} + +/** + * @brief Get field vel_up from tracker_detection_2d message + * + * @return [m/s] Up velocity of the object in global frame. NAN if unknown. + */ +static inline float mavlink_msg_tracker_detection_2d_get_vel_up(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 44); +} + +/** + * @brief Decode a tracker_detection_2d message into a struct + * + * @param msg The message to decode + * @param tracker_detection_2d C-struct to decode the message contents into + */ +static inline void mavlink_msg_tracker_detection_2d_decode(const mavlink_message_t* msg, mavlink_tracker_detection_2d_t* tracker_detection_2d) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + tracker_detection_2d->img_ts = mavlink_msg_tracker_detection_2d_get_img_ts(msg); + tracker_detection_2d->img_id = mavlink_msg_tracker_detection_2d_get_img_id(msg); + tracker_detection_2d->object_id = mavlink_msg_tracker_detection_2d_get_object_id(msg); + tracker_detection_2d->class_id = mavlink_msg_tracker_detection_2d_get_class_id(msg); + tracker_detection_2d->lat = mavlink_msg_tracker_detection_2d_get_lat(msg); + tracker_detection_2d->lon = mavlink_msg_tracker_detection_2d_get_lon(msg); + tracker_detection_2d->alt = mavlink_msg_tracker_detection_2d_get_alt(msg); + tracker_detection_2d->vel_n = mavlink_msg_tracker_detection_2d_get_vel_n(msg); + tracker_detection_2d->vel_e = mavlink_msg_tracker_detection_2d_get_vel_e(msg); + tracker_detection_2d->vel_up = mavlink_msg_tracker_detection_2d_get_vel_up(msg); + tracker_detection_2d->bbox_top_left_x = mavlink_msg_tracker_detection_2d_get_bbox_top_left_x(msg); + tracker_detection_2d->bbox_top_left_y = mavlink_msg_tracker_detection_2d_get_bbox_top_left_y(msg); + tracker_detection_2d->bbox_bot_right_x = mavlink_msg_tracker_detection_2d_get_bbox_bot_right_x(msg); + tracker_detection_2d->bbox_bot_right_y = mavlink_msg_tracker_detection_2d_get_bbox_bot_right_y(msg); + tracker_detection_2d->tracking_status = mavlink_msg_tracker_detection_2d_get_tracking_status(msg); + tracker_detection_2d->confidence = mavlink_msg_tracker_detection_2d_get_confidence(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_TRACKER_DETECTION_2D_LEN? msg->len : MAVLINK_MSG_ID_TRACKER_DETECTION_2D_LEN; + memset(tracker_detection_2d, 0, MAVLINK_MSG_ID_TRACKER_DETECTION_2D_LEN); + memcpy(tracker_detection_2d, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/auterion/mavlink_msg_tracker_status.h b/auterion/mavlink_msg_tracker_status.h new file mode 100644 index 000000000..fb757448f --- /dev/null +++ b/auterion/mavlink_msg_tracker_status.h @@ -0,0 +1,316 @@ +#pragma once +// MESSAGE TRACKER_STATUS PACKING + +#define MAVLINK_MSG_ID_TRACKER_STATUS 500 + + +typedef struct __mavlink_tracker_status_t { + uint32_t tracked_object_id; /*< The UID of the object currently being tracked.*/ + uint16_t number_objects_detected; /*< Number of objects currently detected.*/ + uint8_t tracker_status; /*< */ +} mavlink_tracker_status_t; + +#define MAVLINK_MSG_ID_TRACKER_STATUS_LEN 7 +#define MAVLINK_MSG_ID_TRACKER_STATUS_MIN_LEN 7 +#define MAVLINK_MSG_ID_500_LEN 7 +#define MAVLINK_MSG_ID_500_MIN_LEN 7 + +#define MAVLINK_MSG_ID_TRACKER_STATUS_CRC 245 +#define MAVLINK_MSG_ID_500_CRC 245 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_TRACKER_STATUS { \ + 500, \ + "TRACKER_STATUS", \ + 3, \ + { { "tracker_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_tracker_status_t, tracker_status) }, \ + { "number_objects_detected", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_tracker_status_t, number_objects_detected) }, \ + { "tracked_object_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_tracker_status_t, tracked_object_id) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_TRACKER_STATUS { \ + "TRACKER_STATUS", \ + 3, \ + { { "tracker_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_tracker_status_t, tracker_status) }, \ + { "number_objects_detected", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_tracker_status_t, number_objects_detected) }, \ + { "tracked_object_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_tracker_status_t, tracked_object_id) }, \ + } \ +} +#endif + +/** + * @brief Pack a tracker_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param tracker_status + * @param number_objects_detected Number of objects currently detected. + * @param tracked_object_id The UID of the object currently being tracked. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_tracker_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t tracker_status, uint16_t number_objects_detected, uint32_t tracked_object_id) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_TRACKER_STATUS_LEN]; + _mav_put_uint32_t(buf, 0, tracked_object_id); + _mav_put_uint16_t(buf, 4, number_objects_detected); + _mav_put_uint8_t(buf, 6, tracker_status); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TRACKER_STATUS_LEN); +#else + mavlink_tracker_status_t packet; + packet.tracked_object_id = tracked_object_id; + packet.number_objects_detected = number_objects_detected; + packet.tracker_status = tracker_status; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TRACKER_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_TRACKER_STATUS; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_TRACKER_STATUS_MIN_LEN, MAVLINK_MSG_ID_TRACKER_STATUS_LEN, MAVLINK_MSG_ID_TRACKER_STATUS_CRC); +} + +/** + * @brief Pack a tracker_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param tracker_status + * @param number_objects_detected Number of objects currently detected. + * @param tracked_object_id The UID of the object currently being tracked. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_tracker_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t tracker_status, uint16_t number_objects_detected, uint32_t tracked_object_id) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_TRACKER_STATUS_LEN]; + _mav_put_uint32_t(buf, 0, tracked_object_id); + _mav_put_uint16_t(buf, 4, number_objects_detected); + _mav_put_uint8_t(buf, 6, tracker_status); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TRACKER_STATUS_LEN); +#else + mavlink_tracker_status_t packet; + packet.tracked_object_id = tracked_object_id; + packet.number_objects_detected = number_objects_detected; + packet.tracker_status = tracker_status; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TRACKER_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_TRACKER_STATUS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_TRACKER_STATUS_MIN_LEN, MAVLINK_MSG_ID_TRACKER_STATUS_LEN, MAVLINK_MSG_ID_TRACKER_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_TRACKER_STATUS_MIN_LEN, MAVLINK_MSG_ID_TRACKER_STATUS_LEN); +#endif +} + +/** + * @brief Pack a tracker_status message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param tracker_status + * @param number_objects_detected Number of objects currently detected. + * @param tracked_object_id The UID of the object currently being tracked. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_tracker_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t tracker_status,uint16_t number_objects_detected,uint32_t tracked_object_id) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_TRACKER_STATUS_LEN]; + _mav_put_uint32_t(buf, 0, tracked_object_id); + _mav_put_uint16_t(buf, 4, number_objects_detected); + _mav_put_uint8_t(buf, 6, tracker_status); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TRACKER_STATUS_LEN); +#else + mavlink_tracker_status_t packet; + packet.tracked_object_id = tracked_object_id; + packet.number_objects_detected = number_objects_detected; + packet.tracker_status = tracker_status; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TRACKER_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_TRACKER_STATUS; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_TRACKER_STATUS_MIN_LEN, MAVLINK_MSG_ID_TRACKER_STATUS_LEN, MAVLINK_MSG_ID_TRACKER_STATUS_CRC); +} + +/** + * @brief Encode a tracker_status struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param tracker_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_tracker_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_tracker_status_t* tracker_status) +{ + return mavlink_msg_tracker_status_pack(system_id, component_id, msg, tracker_status->tracker_status, tracker_status->number_objects_detected, tracker_status->tracked_object_id); +} + +/** + * @brief Encode a tracker_status struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param tracker_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_tracker_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_tracker_status_t* tracker_status) +{ + return mavlink_msg_tracker_status_pack_chan(system_id, component_id, chan, msg, tracker_status->tracker_status, tracker_status->number_objects_detected, tracker_status->tracked_object_id); +} + +/** + * @brief Encode a tracker_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param tracker_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_tracker_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_tracker_status_t* tracker_status) +{ + return mavlink_msg_tracker_status_pack_status(system_id, component_id, _status, msg, tracker_status->tracker_status, tracker_status->number_objects_detected, tracker_status->tracked_object_id); +} + +/** + * @brief Send a tracker_status message + * @param chan MAVLink channel to send the message + * + * @param tracker_status + * @param number_objects_detected Number of objects currently detected. + * @param tracked_object_id The UID of the object currently being tracked. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_tracker_status_send(mavlink_channel_t chan, uint8_t tracker_status, uint16_t number_objects_detected, uint32_t tracked_object_id) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_TRACKER_STATUS_LEN]; + _mav_put_uint32_t(buf, 0, tracked_object_id); + _mav_put_uint16_t(buf, 4, number_objects_detected); + _mav_put_uint8_t(buf, 6, tracker_status); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TRACKER_STATUS, buf, MAVLINK_MSG_ID_TRACKER_STATUS_MIN_LEN, MAVLINK_MSG_ID_TRACKER_STATUS_LEN, MAVLINK_MSG_ID_TRACKER_STATUS_CRC); +#else + mavlink_tracker_status_t packet; + packet.tracked_object_id = tracked_object_id; + packet.number_objects_detected = number_objects_detected; + packet.tracker_status = tracker_status; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TRACKER_STATUS, (const char *)&packet, MAVLINK_MSG_ID_TRACKER_STATUS_MIN_LEN, MAVLINK_MSG_ID_TRACKER_STATUS_LEN, MAVLINK_MSG_ID_TRACKER_STATUS_CRC); +#endif +} + +/** + * @brief Send a tracker_status message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_tracker_status_send_struct(mavlink_channel_t chan, const mavlink_tracker_status_t* tracker_status) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_tracker_status_send(chan, tracker_status->tracker_status, tracker_status->number_objects_detected, tracker_status->tracked_object_id); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TRACKER_STATUS, (const char *)tracker_status, MAVLINK_MSG_ID_TRACKER_STATUS_MIN_LEN, MAVLINK_MSG_ID_TRACKER_STATUS_LEN, MAVLINK_MSG_ID_TRACKER_STATUS_CRC); +#endif +} + +#if MAVLINK_MSG_ID_TRACKER_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_tracker_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t tracker_status, uint16_t number_objects_detected, uint32_t tracked_object_id) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint32_t(buf, 0, tracked_object_id); + _mav_put_uint16_t(buf, 4, number_objects_detected); + _mav_put_uint8_t(buf, 6, tracker_status); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TRACKER_STATUS, buf, MAVLINK_MSG_ID_TRACKER_STATUS_MIN_LEN, MAVLINK_MSG_ID_TRACKER_STATUS_LEN, MAVLINK_MSG_ID_TRACKER_STATUS_CRC); +#else + mavlink_tracker_status_t *packet = (mavlink_tracker_status_t *)msgbuf; + packet->tracked_object_id = tracked_object_id; + packet->number_objects_detected = number_objects_detected; + packet->tracker_status = tracker_status; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TRACKER_STATUS, (const char *)packet, MAVLINK_MSG_ID_TRACKER_STATUS_MIN_LEN, MAVLINK_MSG_ID_TRACKER_STATUS_LEN, MAVLINK_MSG_ID_TRACKER_STATUS_CRC); +#endif +} +#endif + +#endif + +// MESSAGE TRACKER_STATUS UNPACKING + + +/** + * @brief Get field tracker_status from tracker_status message + * + * @return + */ +static inline uint8_t mavlink_msg_tracker_status_get_tracker_status(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 6); +} + +/** + * @brief Get field number_objects_detected from tracker_status message + * + * @return Number of objects currently detected. + */ +static inline uint16_t mavlink_msg_tracker_status_get_number_objects_detected(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 4); +} + +/** + * @brief Get field tracked_object_id from tracker_status message + * + * @return The UID of the object currently being tracked. + */ +static inline uint32_t mavlink_msg_tracker_status_get_tracked_object_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 0); +} + +/** + * @brief Decode a tracker_status message into a struct + * + * @param msg The message to decode + * @param tracker_status C-struct to decode the message contents into + */ +static inline void mavlink_msg_tracker_status_decode(const mavlink_message_t* msg, mavlink_tracker_status_t* tracker_status) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + tracker_status->tracked_object_id = mavlink_msg_tracker_status_get_tracked_object_id(msg); + tracker_status->number_objects_detected = mavlink_msg_tracker_status_get_number_objects_detected(msg); + tracker_status->tracker_status = mavlink_msg_tracker_status_get_tracker_status(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_TRACKER_STATUS_LEN? msg->len : MAVLINK_MSG_ID_TRACKER_STATUS_LEN; + memset(tracker_status, 0, MAVLINK_MSG_ID_TRACKER_STATUS_LEN); + memcpy(tracker_status, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/auterion/mavlink_msg_unique_identifier.h b/auterion/mavlink_msg_unique_identifier.h new file mode 100644 index 000000000..f45c040e3 --- /dev/null +++ b/auterion/mavlink_msg_unique_identifier.h @@ -0,0 +1,260 @@ +#pragma once +// MESSAGE UNIQUE_IDENTIFIER PACKING + +#define MAVLINK_MSG_ID_UNIQUE_IDENTIFIER 13470 + + +typedef struct __mavlink_unique_identifier_t { + char uuid[32]; /*< uuid of the sender.*/ +} mavlink_unique_identifier_t; + +#define MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_LEN 32 +#define MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_MIN_LEN 32 +#define MAVLINK_MSG_ID_13470_LEN 32 +#define MAVLINK_MSG_ID_13470_MIN_LEN 32 + +#define MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_CRC 113 +#define MAVLINK_MSG_ID_13470_CRC 113 + +#define MAVLINK_MSG_UNIQUE_IDENTIFIER_FIELD_UUID_LEN 32 + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_UNIQUE_IDENTIFIER { \ + 13470, \ + "UNIQUE_IDENTIFIER", \ + 1, \ + { { "uuid", NULL, MAVLINK_TYPE_CHAR, 32, 0, offsetof(mavlink_unique_identifier_t, uuid) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_UNIQUE_IDENTIFIER { \ + "UNIQUE_IDENTIFIER", \ + 1, \ + { { "uuid", NULL, MAVLINK_TYPE_CHAR, 32, 0, offsetof(mavlink_unique_identifier_t, uuid) }, \ + } \ +} +#endif + +/** + * @brief Pack a unique_identifier message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param uuid uuid of the sender. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_unique_identifier_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + const char *uuid) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_LEN]; + + _mav_put_char_array(buf, 0, uuid, 32); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_LEN); +#else + mavlink_unique_identifier_t packet; + + mav_array_assign_char(packet.uuid, uuid, 32); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_UNIQUE_IDENTIFIER; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_MIN_LEN, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_LEN, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_CRC); +} + +/** + * @brief Pack a unique_identifier message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param uuid uuid of the sender. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_unique_identifier_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + const char *uuid) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_LEN]; + + _mav_put_char_array(buf, 0, uuid, 32); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_LEN); +#else + mavlink_unique_identifier_t packet; + + mav_array_memcpy(packet.uuid, uuid, sizeof(char)*32); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_UNIQUE_IDENTIFIER; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_MIN_LEN, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_LEN, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_MIN_LEN, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_LEN); +#endif +} + +/** + * @brief Pack a unique_identifier message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param uuid uuid of the sender. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_unique_identifier_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + const char *uuid) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_LEN]; + + _mav_put_char_array(buf, 0, uuid, 32); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_LEN); +#else + mavlink_unique_identifier_t packet; + + mav_array_assign_char(packet.uuid, uuid, 32); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_UNIQUE_IDENTIFIER; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_MIN_LEN, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_LEN, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_CRC); +} + +/** + * @brief Encode a unique_identifier struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param unique_identifier C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_unique_identifier_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_unique_identifier_t* unique_identifier) +{ + return mavlink_msg_unique_identifier_pack(system_id, component_id, msg, unique_identifier->uuid); +} + +/** + * @brief Encode a unique_identifier struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param unique_identifier C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_unique_identifier_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_unique_identifier_t* unique_identifier) +{ + return mavlink_msg_unique_identifier_pack_chan(system_id, component_id, chan, msg, unique_identifier->uuid); +} + +/** + * @brief Encode a unique_identifier struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param unique_identifier C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_unique_identifier_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_unique_identifier_t* unique_identifier) +{ + return mavlink_msg_unique_identifier_pack_status(system_id, component_id, _status, msg, unique_identifier->uuid); +} + +/** + * @brief Send a unique_identifier message + * @param chan MAVLink channel to send the message + * + * @param uuid uuid of the sender. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_unique_identifier_send(mavlink_channel_t chan, const char *uuid) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_LEN]; + + _mav_put_char_array(buf, 0, uuid, 32); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER, buf, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_MIN_LEN, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_LEN, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_CRC); +#else + mavlink_unique_identifier_t packet; + + mav_array_assign_char(packet.uuid, uuid, 32); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER, (const char *)&packet, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_MIN_LEN, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_LEN, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_CRC); +#endif +} + +/** + * @brief Send a unique_identifier message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_unique_identifier_send_struct(mavlink_channel_t chan, const mavlink_unique_identifier_t* unique_identifier) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_unique_identifier_send(chan, unique_identifier->uuid); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER, (const char *)unique_identifier, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_MIN_LEN, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_LEN, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_CRC); +#endif +} + +#if MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_unique_identifier_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, const char *uuid) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + + _mav_put_char_array(buf, 0, uuid, 32); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER, buf, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_MIN_LEN, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_LEN, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_CRC); +#else + mavlink_unique_identifier_t *packet = (mavlink_unique_identifier_t *)msgbuf; + + mav_array_assign_char(packet->uuid, uuid, 32); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER, (const char *)packet, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_MIN_LEN, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_LEN, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_CRC); +#endif +} +#endif + +#endif + +// MESSAGE UNIQUE_IDENTIFIER UNPACKING + + +/** + * @brief Get field uuid from unique_identifier message + * + * @return uuid of the sender. + */ +static inline uint16_t mavlink_msg_unique_identifier_get_uuid(const mavlink_message_t* msg, char *uuid) +{ + return _MAV_RETURN_char_array(msg, uuid, 32, 0); +} + +/** + * @brief Decode a unique_identifier message into a struct + * + * @param msg The message to decode + * @param unique_identifier C-struct to decode the message contents into + */ +static inline void mavlink_msg_unique_identifier_decode(const mavlink_message_t* msg, mavlink_unique_identifier_t* unique_identifier) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_unique_identifier_get_uuid(msg, unique_identifier->uuid); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_LEN? msg->len : MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_LEN; + memset(unique_identifier, 0, MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_LEN); + memcpy(unique_identifier, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/auterion/mavlink_msg_vessel_speed.h b/auterion/mavlink_msg_vessel_speed.h new file mode 100644 index 000000000..b55ae3a3e --- /dev/null +++ b/auterion/mavlink_msg_vessel_speed.h @@ -0,0 +1,372 @@ +#pragma once +// MESSAGE VESSEL_SPEED PACKING + +#define MAVLINK_MSG_ID_VESSEL_SPEED 13669 + + +typedef struct __mavlink_vessel_speed_t { + uint64_t time_usec; /*< [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.*/ + float speed_water_referenced; /*< [m/s] Speed water referenced.*/ + float speed_ground_referenced; /*< [m/s] Speed ground referenced.*/ + uint8_t speed_water_referenced_type; /*< Speed water referenced type.*/ + uint8_t speed_direction; /*< Speed direction.*/ +} mavlink_vessel_speed_t; + +#define MAVLINK_MSG_ID_VESSEL_SPEED_LEN 18 +#define MAVLINK_MSG_ID_VESSEL_SPEED_MIN_LEN 18 +#define MAVLINK_MSG_ID_13669_LEN 18 +#define MAVLINK_MSG_ID_13669_MIN_LEN 18 + +#define MAVLINK_MSG_ID_VESSEL_SPEED_CRC 228 +#define MAVLINK_MSG_ID_13669_CRC 228 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_VESSEL_SPEED { \ + 13669, \ + "VESSEL_SPEED", \ + 5, \ + { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_vessel_speed_t, time_usec) }, \ + { "speed_water_referenced", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_vessel_speed_t, speed_water_referenced) }, \ + { "speed_ground_referenced", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_vessel_speed_t, speed_ground_referenced) }, \ + { "speed_water_referenced_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_vessel_speed_t, speed_water_referenced_type) }, \ + { "speed_direction", NULL, MAVLINK_TYPE_UINT8_T, 0, 17, offsetof(mavlink_vessel_speed_t, speed_direction) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_VESSEL_SPEED { \ + "VESSEL_SPEED", \ + 5, \ + { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_vessel_speed_t, time_usec) }, \ + { "speed_water_referenced", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_vessel_speed_t, speed_water_referenced) }, \ + { "speed_ground_referenced", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_vessel_speed_t, speed_ground_referenced) }, \ + { "speed_water_referenced_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_vessel_speed_t, speed_water_referenced_type) }, \ + { "speed_direction", NULL, MAVLINK_TYPE_UINT8_T, 0, 17, offsetof(mavlink_vessel_speed_t, speed_direction) }, \ + } \ +} +#endif + +/** + * @brief Pack a vessel_speed message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param speed_water_referenced [m/s] Speed water referenced. + * @param speed_ground_referenced [m/s] Speed ground referenced. + * @param speed_water_referenced_type Speed water referenced type. + * @param speed_direction Speed direction. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_vessel_speed_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint64_t time_usec, float speed_water_referenced, float speed_ground_referenced, uint8_t speed_water_referenced_type, uint8_t speed_direction) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_VESSEL_SPEED_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, speed_water_referenced); + _mav_put_float(buf, 12, speed_ground_referenced); + _mav_put_uint8_t(buf, 16, speed_water_referenced_type); + _mav_put_uint8_t(buf, 17, speed_direction); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VESSEL_SPEED_LEN); +#else + mavlink_vessel_speed_t packet; + packet.time_usec = time_usec; + packet.speed_water_referenced = speed_water_referenced; + packet.speed_ground_referenced = speed_ground_referenced; + packet.speed_water_referenced_type = speed_water_referenced_type; + packet.speed_direction = speed_direction; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VESSEL_SPEED_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_VESSEL_SPEED; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_VESSEL_SPEED_MIN_LEN, MAVLINK_MSG_ID_VESSEL_SPEED_LEN, MAVLINK_MSG_ID_VESSEL_SPEED_CRC); +} + +/** + * @brief Pack a vessel_speed message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param speed_water_referenced [m/s] Speed water referenced. + * @param speed_ground_referenced [m/s] Speed ground referenced. + * @param speed_water_referenced_type Speed water referenced type. + * @param speed_direction Speed direction. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_vessel_speed_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, float speed_water_referenced, float speed_ground_referenced, uint8_t speed_water_referenced_type, uint8_t speed_direction) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_VESSEL_SPEED_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, speed_water_referenced); + _mav_put_float(buf, 12, speed_ground_referenced); + _mav_put_uint8_t(buf, 16, speed_water_referenced_type); + _mav_put_uint8_t(buf, 17, speed_direction); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VESSEL_SPEED_LEN); +#else + mavlink_vessel_speed_t packet; + packet.time_usec = time_usec; + packet.speed_water_referenced = speed_water_referenced; + packet.speed_ground_referenced = speed_ground_referenced; + packet.speed_water_referenced_type = speed_water_referenced_type; + packet.speed_direction = speed_direction; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VESSEL_SPEED_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_VESSEL_SPEED; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VESSEL_SPEED_MIN_LEN, MAVLINK_MSG_ID_VESSEL_SPEED_LEN, MAVLINK_MSG_ID_VESSEL_SPEED_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VESSEL_SPEED_MIN_LEN, MAVLINK_MSG_ID_VESSEL_SPEED_LEN); +#endif +} + +/** + * @brief Pack a vessel_speed message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param speed_water_referenced [m/s] Speed water referenced. + * @param speed_ground_referenced [m/s] Speed ground referenced. + * @param speed_water_referenced_type Speed water referenced type. + * @param speed_direction Speed direction. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_vessel_speed_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint64_t time_usec,float speed_water_referenced,float speed_ground_referenced,uint8_t speed_water_referenced_type,uint8_t speed_direction) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_VESSEL_SPEED_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, speed_water_referenced); + _mav_put_float(buf, 12, speed_ground_referenced); + _mav_put_uint8_t(buf, 16, speed_water_referenced_type); + _mav_put_uint8_t(buf, 17, speed_direction); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VESSEL_SPEED_LEN); +#else + mavlink_vessel_speed_t packet; + packet.time_usec = time_usec; + packet.speed_water_referenced = speed_water_referenced; + packet.speed_ground_referenced = speed_ground_referenced; + packet.speed_water_referenced_type = speed_water_referenced_type; + packet.speed_direction = speed_direction; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VESSEL_SPEED_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_VESSEL_SPEED; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_VESSEL_SPEED_MIN_LEN, MAVLINK_MSG_ID_VESSEL_SPEED_LEN, MAVLINK_MSG_ID_VESSEL_SPEED_CRC); +} + +/** + * @brief Encode a vessel_speed struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param vessel_speed C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_vessel_speed_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_vessel_speed_t* vessel_speed) +{ + return mavlink_msg_vessel_speed_pack(system_id, component_id, msg, vessel_speed->time_usec, vessel_speed->speed_water_referenced, vessel_speed->speed_ground_referenced, vessel_speed->speed_water_referenced_type, vessel_speed->speed_direction); +} + +/** + * @brief Encode a vessel_speed struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param vessel_speed C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_vessel_speed_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_vessel_speed_t* vessel_speed) +{ + return mavlink_msg_vessel_speed_pack_chan(system_id, component_id, chan, msg, vessel_speed->time_usec, vessel_speed->speed_water_referenced, vessel_speed->speed_ground_referenced, vessel_speed->speed_water_referenced_type, vessel_speed->speed_direction); +} + +/** + * @brief Encode a vessel_speed struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param vessel_speed C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_vessel_speed_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_vessel_speed_t* vessel_speed) +{ + return mavlink_msg_vessel_speed_pack_status(system_id, component_id, _status, msg, vessel_speed->time_usec, vessel_speed->speed_water_referenced, vessel_speed->speed_ground_referenced, vessel_speed->speed_water_referenced_type, vessel_speed->speed_direction); +} + +/** + * @brief Send a vessel_speed message + * @param chan MAVLink channel to send the message + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param speed_water_referenced [m/s] Speed water referenced. + * @param speed_ground_referenced [m/s] Speed ground referenced. + * @param speed_water_referenced_type Speed water referenced type. + * @param speed_direction Speed direction. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_vessel_speed_send(mavlink_channel_t chan, uint64_t time_usec, float speed_water_referenced, float speed_ground_referenced, uint8_t speed_water_referenced_type, uint8_t speed_direction) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_VESSEL_SPEED_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, speed_water_referenced); + _mav_put_float(buf, 12, speed_ground_referenced); + _mav_put_uint8_t(buf, 16, speed_water_referenced_type); + _mav_put_uint8_t(buf, 17, speed_direction); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VESSEL_SPEED, buf, MAVLINK_MSG_ID_VESSEL_SPEED_MIN_LEN, MAVLINK_MSG_ID_VESSEL_SPEED_LEN, MAVLINK_MSG_ID_VESSEL_SPEED_CRC); +#else + mavlink_vessel_speed_t packet; + packet.time_usec = time_usec; + packet.speed_water_referenced = speed_water_referenced; + packet.speed_ground_referenced = speed_ground_referenced; + packet.speed_water_referenced_type = speed_water_referenced_type; + packet.speed_direction = speed_direction; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VESSEL_SPEED, (const char *)&packet, MAVLINK_MSG_ID_VESSEL_SPEED_MIN_LEN, MAVLINK_MSG_ID_VESSEL_SPEED_LEN, MAVLINK_MSG_ID_VESSEL_SPEED_CRC); +#endif +} + +/** + * @brief Send a vessel_speed message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_vessel_speed_send_struct(mavlink_channel_t chan, const mavlink_vessel_speed_t* vessel_speed) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_vessel_speed_send(chan, vessel_speed->time_usec, vessel_speed->speed_water_referenced, vessel_speed->speed_ground_referenced, vessel_speed->speed_water_referenced_type, vessel_speed->speed_direction); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VESSEL_SPEED, (const char *)vessel_speed, MAVLINK_MSG_ID_VESSEL_SPEED_MIN_LEN, MAVLINK_MSG_ID_VESSEL_SPEED_LEN, MAVLINK_MSG_ID_VESSEL_SPEED_CRC); +#endif +} + +#if MAVLINK_MSG_ID_VESSEL_SPEED_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_vessel_speed_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, float speed_water_referenced, float speed_ground_referenced, uint8_t speed_water_referenced_type, uint8_t speed_direction) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, speed_water_referenced); + _mav_put_float(buf, 12, speed_ground_referenced); + _mav_put_uint8_t(buf, 16, speed_water_referenced_type); + _mav_put_uint8_t(buf, 17, speed_direction); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VESSEL_SPEED, buf, MAVLINK_MSG_ID_VESSEL_SPEED_MIN_LEN, MAVLINK_MSG_ID_VESSEL_SPEED_LEN, MAVLINK_MSG_ID_VESSEL_SPEED_CRC); +#else + mavlink_vessel_speed_t *packet = (mavlink_vessel_speed_t *)msgbuf; + packet->time_usec = time_usec; + packet->speed_water_referenced = speed_water_referenced; + packet->speed_ground_referenced = speed_ground_referenced; + packet->speed_water_referenced_type = speed_water_referenced_type; + packet->speed_direction = speed_direction; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VESSEL_SPEED, (const char *)packet, MAVLINK_MSG_ID_VESSEL_SPEED_MIN_LEN, MAVLINK_MSG_ID_VESSEL_SPEED_LEN, MAVLINK_MSG_ID_VESSEL_SPEED_CRC); +#endif +} +#endif + +#endif + +// MESSAGE VESSEL_SPEED UNPACKING + + +/** + * @brief Get field time_usec from vessel_speed message + * + * @return [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + */ +static inline uint64_t mavlink_msg_vessel_speed_get_time_usec(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 0); +} + +/** + * @brief Get field speed_water_referenced from vessel_speed message + * + * @return [m/s] Speed water referenced. + */ +static inline float mavlink_msg_vessel_speed_get_speed_water_referenced(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 8); +} + +/** + * @brief Get field speed_ground_referenced from vessel_speed message + * + * @return [m/s] Speed ground referenced. + */ +static inline float mavlink_msg_vessel_speed_get_speed_ground_referenced(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 12); +} + +/** + * @brief Get field speed_water_referenced_type from vessel_speed message + * + * @return Speed water referenced type. + */ +static inline uint8_t mavlink_msg_vessel_speed_get_speed_water_referenced_type(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 16); +} + +/** + * @brief Get field speed_direction from vessel_speed message + * + * @return Speed direction. + */ +static inline uint8_t mavlink_msg_vessel_speed_get_speed_direction(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 17); +} + +/** + * @brief Decode a vessel_speed message into a struct + * + * @param msg The message to decode + * @param vessel_speed C-struct to decode the message contents into + */ +static inline void mavlink_msg_vessel_speed_decode(const mavlink_message_t* msg, mavlink_vessel_speed_t* vessel_speed) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + vessel_speed->time_usec = mavlink_msg_vessel_speed_get_time_usec(msg); + vessel_speed->speed_water_referenced = mavlink_msg_vessel_speed_get_speed_water_referenced(msg); + vessel_speed->speed_ground_referenced = mavlink_msg_vessel_speed_get_speed_ground_referenced(msg); + vessel_speed->speed_water_referenced_type = mavlink_msg_vessel_speed_get_speed_water_referenced_type(msg); + vessel_speed->speed_direction = mavlink_msg_vessel_speed_get_speed_direction(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_VESSEL_SPEED_LEN? msg->len : MAVLINK_MSG_ID_VESSEL_SPEED_LEN; + memset(vessel_speed, 0, MAVLINK_MSG_ID_VESSEL_SPEED_LEN); + memcpy(vessel_speed, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/auterion/mavlink_msg_water_depth_raw.h b/auterion/mavlink_msg_water_depth_raw.h new file mode 100644 index 000000000..6cd784d3a --- /dev/null +++ b/auterion/mavlink_msg_water_depth_raw.h @@ -0,0 +1,344 @@ +#pragma once +// MESSAGE WATER_DEPTH_RAW PACKING + +#define MAVLINK_MSG_ID_WATER_DEPTH_RAW 13670 + + +typedef struct __mavlink_water_depth_raw_t { + uint64_t time_usec; /*< [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.*/ + float depth; /*< [m] Depth below transducer.*/ + float offset; /*< [m] Distance between transducer and surface (positive) or keel (negative).*/ + float range; /*< [m] Max measurement range.*/ +} mavlink_water_depth_raw_t; + +#define MAVLINK_MSG_ID_WATER_DEPTH_RAW_LEN 20 +#define MAVLINK_MSG_ID_WATER_DEPTH_RAW_MIN_LEN 20 +#define MAVLINK_MSG_ID_13670_LEN 20 +#define MAVLINK_MSG_ID_13670_MIN_LEN 20 + +#define MAVLINK_MSG_ID_WATER_DEPTH_RAW_CRC 131 +#define MAVLINK_MSG_ID_13670_CRC 131 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_WATER_DEPTH_RAW { \ + 13670, \ + "WATER_DEPTH_RAW", \ + 4, \ + { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_water_depth_raw_t, time_usec) }, \ + { "depth", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_water_depth_raw_t, depth) }, \ + { "offset", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_water_depth_raw_t, offset) }, \ + { "range", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_water_depth_raw_t, range) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_WATER_DEPTH_RAW { \ + "WATER_DEPTH_RAW", \ + 4, \ + { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_water_depth_raw_t, time_usec) }, \ + { "depth", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_water_depth_raw_t, depth) }, \ + { "offset", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_water_depth_raw_t, offset) }, \ + { "range", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_water_depth_raw_t, range) }, \ + } \ +} +#endif + +/** + * @brief Pack a water_depth_raw message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param depth [m] Depth below transducer. + * @param offset [m] Distance between transducer and surface (positive) or keel (negative). + * @param range [m] Max measurement range. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_water_depth_raw_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint64_t time_usec, float depth, float offset, float range) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_WATER_DEPTH_RAW_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, depth); + _mav_put_float(buf, 12, offset); + _mav_put_float(buf, 16, range); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_WATER_DEPTH_RAW_LEN); +#else + mavlink_water_depth_raw_t packet; + packet.time_usec = time_usec; + packet.depth = depth; + packet.offset = offset; + packet.range = range; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_WATER_DEPTH_RAW_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_WATER_DEPTH_RAW; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_WATER_DEPTH_RAW_MIN_LEN, MAVLINK_MSG_ID_WATER_DEPTH_RAW_LEN, MAVLINK_MSG_ID_WATER_DEPTH_RAW_CRC); +} + +/** + * @brief Pack a water_depth_raw message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param depth [m] Depth below transducer. + * @param offset [m] Distance between transducer and surface (positive) or keel (negative). + * @param range [m] Max measurement range. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_water_depth_raw_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, float depth, float offset, float range) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_WATER_DEPTH_RAW_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, depth); + _mav_put_float(buf, 12, offset); + _mav_put_float(buf, 16, range); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_WATER_DEPTH_RAW_LEN); +#else + mavlink_water_depth_raw_t packet; + packet.time_usec = time_usec; + packet.depth = depth; + packet.offset = offset; + packet.range = range; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_WATER_DEPTH_RAW_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_WATER_DEPTH_RAW; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_WATER_DEPTH_RAW_MIN_LEN, MAVLINK_MSG_ID_WATER_DEPTH_RAW_LEN, MAVLINK_MSG_ID_WATER_DEPTH_RAW_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_WATER_DEPTH_RAW_MIN_LEN, MAVLINK_MSG_ID_WATER_DEPTH_RAW_LEN); +#endif +} + +/** + * @brief Pack a water_depth_raw message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param depth [m] Depth below transducer. + * @param offset [m] Distance between transducer and surface (positive) or keel (negative). + * @param range [m] Max measurement range. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_water_depth_raw_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint64_t time_usec,float depth,float offset,float range) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_WATER_DEPTH_RAW_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, depth); + _mav_put_float(buf, 12, offset); + _mav_put_float(buf, 16, range); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_WATER_DEPTH_RAW_LEN); +#else + mavlink_water_depth_raw_t packet; + packet.time_usec = time_usec; + packet.depth = depth; + packet.offset = offset; + packet.range = range; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_WATER_DEPTH_RAW_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_WATER_DEPTH_RAW; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_WATER_DEPTH_RAW_MIN_LEN, MAVLINK_MSG_ID_WATER_DEPTH_RAW_LEN, MAVLINK_MSG_ID_WATER_DEPTH_RAW_CRC); +} + +/** + * @brief Encode a water_depth_raw struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param water_depth_raw C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_water_depth_raw_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_water_depth_raw_t* water_depth_raw) +{ + return mavlink_msg_water_depth_raw_pack(system_id, component_id, msg, water_depth_raw->time_usec, water_depth_raw->depth, water_depth_raw->offset, water_depth_raw->range); +} + +/** + * @brief Encode a water_depth_raw struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param water_depth_raw C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_water_depth_raw_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_water_depth_raw_t* water_depth_raw) +{ + return mavlink_msg_water_depth_raw_pack_chan(system_id, component_id, chan, msg, water_depth_raw->time_usec, water_depth_raw->depth, water_depth_raw->offset, water_depth_raw->range); +} + +/** + * @brief Encode a water_depth_raw struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param water_depth_raw C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_water_depth_raw_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_water_depth_raw_t* water_depth_raw) +{ + return mavlink_msg_water_depth_raw_pack_status(system_id, component_id, _status, msg, water_depth_raw->time_usec, water_depth_raw->depth, water_depth_raw->offset, water_depth_raw->range); +} + +/** + * @brief Send a water_depth_raw message + * @param chan MAVLink channel to send the message + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param depth [m] Depth below transducer. + * @param offset [m] Distance between transducer and surface (positive) or keel (negative). + * @param range [m] Max measurement range. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_water_depth_raw_send(mavlink_channel_t chan, uint64_t time_usec, float depth, float offset, float range) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_WATER_DEPTH_RAW_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, depth); + _mav_put_float(buf, 12, offset); + _mav_put_float(buf, 16, range); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WATER_DEPTH_RAW, buf, MAVLINK_MSG_ID_WATER_DEPTH_RAW_MIN_LEN, MAVLINK_MSG_ID_WATER_DEPTH_RAW_LEN, MAVLINK_MSG_ID_WATER_DEPTH_RAW_CRC); +#else + mavlink_water_depth_raw_t packet; + packet.time_usec = time_usec; + packet.depth = depth; + packet.offset = offset; + packet.range = range; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WATER_DEPTH_RAW, (const char *)&packet, MAVLINK_MSG_ID_WATER_DEPTH_RAW_MIN_LEN, MAVLINK_MSG_ID_WATER_DEPTH_RAW_LEN, MAVLINK_MSG_ID_WATER_DEPTH_RAW_CRC); +#endif +} + +/** + * @brief Send a water_depth_raw message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_water_depth_raw_send_struct(mavlink_channel_t chan, const mavlink_water_depth_raw_t* water_depth_raw) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_water_depth_raw_send(chan, water_depth_raw->time_usec, water_depth_raw->depth, water_depth_raw->offset, water_depth_raw->range); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WATER_DEPTH_RAW, (const char *)water_depth_raw, MAVLINK_MSG_ID_WATER_DEPTH_RAW_MIN_LEN, MAVLINK_MSG_ID_WATER_DEPTH_RAW_LEN, MAVLINK_MSG_ID_WATER_DEPTH_RAW_CRC); +#endif +} + +#if MAVLINK_MSG_ID_WATER_DEPTH_RAW_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_water_depth_raw_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, float depth, float offset, float range) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, depth); + _mav_put_float(buf, 12, offset); + _mav_put_float(buf, 16, range); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WATER_DEPTH_RAW, buf, MAVLINK_MSG_ID_WATER_DEPTH_RAW_MIN_LEN, MAVLINK_MSG_ID_WATER_DEPTH_RAW_LEN, MAVLINK_MSG_ID_WATER_DEPTH_RAW_CRC); +#else + mavlink_water_depth_raw_t *packet = (mavlink_water_depth_raw_t *)msgbuf; + packet->time_usec = time_usec; + packet->depth = depth; + packet->offset = offset; + packet->range = range; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WATER_DEPTH_RAW, (const char *)packet, MAVLINK_MSG_ID_WATER_DEPTH_RAW_MIN_LEN, MAVLINK_MSG_ID_WATER_DEPTH_RAW_LEN, MAVLINK_MSG_ID_WATER_DEPTH_RAW_CRC); +#endif +} +#endif + +#endif + +// MESSAGE WATER_DEPTH_RAW UNPACKING + + +/** + * @brief Get field time_usec from water_depth_raw message + * + * @return [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + */ +static inline uint64_t mavlink_msg_water_depth_raw_get_time_usec(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 0); +} + +/** + * @brief Get field depth from water_depth_raw message + * + * @return [m] Depth below transducer. + */ +static inline float mavlink_msg_water_depth_raw_get_depth(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 8); +} + +/** + * @brief Get field offset from water_depth_raw message + * + * @return [m] Distance between transducer and surface (positive) or keel (negative). + */ +static inline float mavlink_msg_water_depth_raw_get_offset(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 12); +} + +/** + * @brief Get field range from water_depth_raw message + * + * @return [m] Max measurement range. + */ +static inline float mavlink_msg_water_depth_raw_get_range(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 16); +} + +/** + * @brief Decode a water_depth_raw message into a struct + * + * @param msg The message to decode + * @param water_depth_raw C-struct to decode the message contents into + */ +static inline void mavlink_msg_water_depth_raw_decode(const mavlink_message_t* msg, mavlink_water_depth_raw_t* water_depth_raw) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + water_depth_raw->time_usec = mavlink_msg_water_depth_raw_get_time_usec(msg); + water_depth_raw->depth = mavlink_msg_water_depth_raw_get_depth(msg); + water_depth_raw->offset = mavlink_msg_water_depth_raw_get_offset(msg); + water_depth_raw->range = mavlink_msg_water_depth_raw_get_range(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_WATER_DEPTH_RAW_LEN? msg->len : MAVLINK_MSG_ID_WATER_DEPTH_RAW_LEN; + memset(water_depth_raw, 0, MAVLINK_MSG_ID_WATER_DEPTH_RAW_LEN); + memcpy(water_depth_raw, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/auterion/mavlink_msg_wind_data_raw.h b/auterion/mavlink_msg_wind_data_raw.h new file mode 100644 index 000000000..619ca4bc7 --- /dev/null +++ b/auterion/mavlink_msg_wind_data_raw.h @@ -0,0 +1,344 @@ +#pragma once +// MESSAGE WIND_DATA_RAW PACKING + +#define MAVLINK_MSG_ID_WIND_DATA_RAW 13671 + + +typedef struct __mavlink_wind_data_raw_t { + uint64_t time_usec; /*< [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.*/ + float wind_speed; /*< [m/s] Wind speed.*/ + float wind_angle; /*< [rad] Wind angle.*/ + uint8_t reference; /*< Wind reference.*/ +} mavlink_wind_data_raw_t; + +#define MAVLINK_MSG_ID_WIND_DATA_RAW_LEN 17 +#define MAVLINK_MSG_ID_WIND_DATA_RAW_MIN_LEN 17 +#define MAVLINK_MSG_ID_13671_LEN 17 +#define MAVLINK_MSG_ID_13671_MIN_LEN 17 + +#define MAVLINK_MSG_ID_WIND_DATA_RAW_CRC 106 +#define MAVLINK_MSG_ID_13671_CRC 106 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_WIND_DATA_RAW { \ + 13671, \ + "WIND_DATA_RAW", \ + 4, \ + { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_wind_data_raw_t, time_usec) }, \ + { "reference", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_wind_data_raw_t, reference) }, \ + { "wind_speed", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_wind_data_raw_t, wind_speed) }, \ + { "wind_angle", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_wind_data_raw_t, wind_angle) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_WIND_DATA_RAW { \ + "WIND_DATA_RAW", \ + 4, \ + { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_wind_data_raw_t, time_usec) }, \ + { "reference", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_wind_data_raw_t, reference) }, \ + { "wind_speed", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_wind_data_raw_t, wind_speed) }, \ + { "wind_angle", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_wind_data_raw_t, wind_angle) }, \ + } \ +} +#endif + +/** + * @brief Pack a wind_data_raw message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param reference Wind reference. + * @param wind_speed [m/s] Wind speed. + * @param wind_angle [rad] Wind angle. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_wind_data_raw_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint64_t time_usec, uint8_t reference, float wind_speed, float wind_angle) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_WIND_DATA_RAW_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, wind_speed); + _mav_put_float(buf, 12, wind_angle); + _mav_put_uint8_t(buf, 16, reference); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_WIND_DATA_RAW_LEN); +#else + mavlink_wind_data_raw_t packet; + packet.time_usec = time_usec; + packet.wind_speed = wind_speed; + packet.wind_angle = wind_angle; + packet.reference = reference; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_WIND_DATA_RAW_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_WIND_DATA_RAW; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_WIND_DATA_RAW_MIN_LEN, MAVLINK_MSG_ID_WIND_DATA_RAW_LEN, MAVLINK_MSG_ID_WIND_DATA_RAW_CRC); +} + +/** + * @brief Pack a wind_data_raw message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param reference Wind reference. + * @param wind_speed [m/s] Wind speed. + * @param wind_angle [rad] Wind angle. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_wind_data_raw_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, uint8_t reference, float wind_speed, float wind_angle) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_WIND_DATA_RAW_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, wind_speed); + _mav_put_float(buf, 12, wind_angle); + _mav_put_uint8_t(buf, 16, reference); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_WIND_DATA_RAW_LEN); +#else + mavlink_wind_data_raw_t packet; + packet.time_usec = time_usec; + packet.wind_speed = wind_speed; + packet.wind_angle = wind_angle; + packet.reference = reference; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_WIND_DATA_RAW_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_WIND_DATA_RAW; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_WIND_DATA_RAW_MIN_LEN, MAVLINK_MSG_ID_WIND_DATA_RAW_LEN, MAVLINK_MSG_ID_WIND_DATA_RAW_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_WIND_DATA_RAW_MIN_LEN, MAVLINK_MSG_ID_WIND_DATA_RAW_LEN); +#endif +} + +/** + * @brief Pack a wind_data_raw message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param reference Wind reference. + * @param wind_speed [m/s] Wind speed. + * @param wind_angle [rad] Wind angle. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_wind_data_raw_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint64_t time_usec,uint8_t reference,float wind_speed,float wind_angle) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_WIND_DATA_RAW_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, wind_speed); + _mav_put_float(buf, 12, wind_angle); + _mav_put_uint8_t(buf, 16, reference); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_WIND_DATA_RAW_LEN); +#else + mavlink_wind_data_raw_t packet; + packet.time_usec = time_usec; + packet.wind_speed = wind_speed; + packet.wind_angle = wind_angle; + packet.reference = reference; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_WIND_DATA_RAW_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_WIND_DATA_RAW; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_WIND_DATA_RAW_MIN_LEN, MAVLINK_MSG_ID_WIND_DATA_RAW_LEN, MAVLINK_MSG_ID_WIND_DATA_RAW_CRC); +} + +/** + * @brief Encode a wind_data_raw struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param wind_data_raw C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_wind_data_raw_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_wind_data_raw_t* wind_data_raw) +{ + return mavlink_msg_wind_data_raw_pack(system_id, component_id, msg, wind_data_raw->time_usec, wind_data_raw->reference, wind_data_raw->wind_speed, wind_data_raw->wind_angle); +} + +/** + * @brief Encode a wind_data_raw struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param wind_data_raw C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_wind_data_raw_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_wind_data_raw_t* wind_data_raw) +{ + return mavlink_msg_wind_data_raw_pack_chan(system_id, component_id, chan, msg, wind_data_raw->time_usec, wind_data_raw->reference, wind_data_raw->wind_speed, wind_data_raw->wind_angle); +} + +/** + * @brief Encode a wind_data_raw struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param wind_data_raw C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_wind_data_raw_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_wind_data_raw_t* wind_data_raw) +{ + return mavlink_msg_wind_data_raw_pack_status(system_id, component_id, _status, msg, wind_data_raw->time_usec, wind_data_raw->reference, wind_data_raw->wind_speed, wind_data_raw->wind_angle); +} + +/** + * @brief Send a wind_data_raw message + * @param chan MAVLink channel to send the message + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param reference Wind reference. + * @param wind_speed [m/s] Wind speed. + * @param wind_angle [rad] Wind angle. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_wind_data_raw_send(mavlink_channel_t chan, uint64_t time_usec, uint8_t reference, float wind_speed, float wind_angle) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_WIND_DATA_RAW_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, wind_speed); + _mav_put_float(buf, 12, wind_angle); + _mav_put_uint8_t(buf, 16, reference); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WIND_DATA_RAW, buf, MAVLINK_MSG_ID_WIND_DATA_RAW_MIN_LEN, MAVLINK_MSG_ID_WIND_DATA_RAW_LEN, MAVLINK_MSG_ID_WIND_DATA_RAW_CRC); +#else + mavlink_wind_data_raw_t packet; + packet.time_usec = time_usec; + packet.wind_speed = wind_speed; + packet.wind_angle = wind_angle; + packet.reference = reference; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WIND_DATA_RAW, (const char *)&packet, MAVLINK_MSG_ID_WIND_DATA_RAW_MIN_LEN, MAVLINK_MSG_ID_WIND_DATA_RAW_LEN, MAVLINK_MSG_ID_WIND_DATA_RAW_CRC); +#endif +} + +/** + * @brief Send a wind_data_raw message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_wind_data_raw_send_struct(mavlink_channel_t chan, const mavlink_wind_data_raw_t* wind_data_raw) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_wind_data_raw_send(chan, wind_data_raw->time_usec, wind_data_raw->reference, wind_data_raw->wind_speed, wind_data_raw->wind_angle); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WIND_DATA_RAW, (const char *)wind_data_raw, MAVLINK_MSG_ID_WIND_DATA_RAW_MIN_LEN, MAVLINK_MSG_ID_WIND_DATA_RAW_LEN, MAVLINK_MSG_ID_WIND_DATA_RAW_CRC); +#endif +} + +#if MAVLINK_MSG_ID_WIND_DATA_RAW_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_wind_data_raw_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint8_t reference, float wind_speed, float wind_angle) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, wind_speed); + _mav_put_float(buf, 12, wind_angle); + _mav_put_uint8_t(buf, 16, reference); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WIND_DATA_RAW, buf, MAVLINK_MSG_ID_WIND_DATA_RAW_MIN_LEN, MAVLINK_MSG_ID_WIND_DATA_RAW_LEN, MAVLINK_MSG_ID_WIND_DATA_RAW_CRC); +#else + mavlink_wind_data_raw_t *packet = (mavlink_wind_data_raw_t *)msgbuf; + packet->time_usec = time_usec; + packet->wind_speed = wind_speed; + packet->wind_angle = wind_angle; + packet->reference = reference; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WIND_DATA_RAW, (const char *)packet, MAVLINK_MSG_ID_WIND_DATA_RAW_MIN_LEN, MAVLINK_MSG_ID_WIND_DATA_RAW_LEN, MAVLINK_MSG_ID_WIND_DATA_RAW_CRC); +#endif +} +#endif + +#endif + +// MESSAGE WIND_DATA_RAW UNPACKING + + +/** + * @brief Get field time_usec from wind_data_raw message + * + * @return [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + */ +static inline uint64_t mavlink_msg_wind_data_raw_get_time_usec(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 0); +} + +/** + * @brief Get field reference from wind_data_raw message + * + * @return Wind reference. + */ +static inline uint8_t mavlink_msg_wind_data_raw_get_reference(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 16); +} + +/** + * @brief Get field wind_speed from wind_data_raw message + * + * @return [m/s] Wind speed. + */ +static inline float mavlink_msg_wind_data_raw_get_wind_speed(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 8); +} + +/** + * @brief Get field wind_angle from wind_data_raw message + * + * @return [rad] Wind angle. + */ +static inline float mavlink_msg_wind_data_raw_get_wind_angle(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 12); +} + +/** + * @brief Decode a wind_data_raw message into a struct + * + * @param msg The message to decode + * @param wind_data_raw C-struct to decode the message contents into + */ +static inline void mavlink_msg_wind_data_raw_decode(const mavlink_message_t* msg, mavlink_wind_data_raw_t* wind_data_raw) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + wind_data_raw->time_usec = mavlink_msg_wind_data_raw_get_time_usec(msg); + wind_data_raw->wind_speed = mavlink_msg_wind_data_raw_get_wind_speed(msg); + wind_data_raw->wind_angle = mavlink_msg_wind_data_raw_get_wind_angle(msg); + wind_data_raw->reference = mavlink_msg_wind_data_raw_get_reference(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_WIND_DATA_RAW_LEN? msg->len : MAVLINK_MSG_ID_WIND_DATA_RAW_LEN; + memset(wind_data_raw, 0, MAVLINK_MSG_ID_WIND_DATA_RAW_LEN); + memcpy(wind_data_raw, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/auterion/testsuite.h b/auterion/testsuite.h new file mode 100644 index 000000000..eb2906472 --- /dev/null +++ b/auterion/testsuite.h @@ -0,0 +1,1824 @@ +/** @file + * @brief MAVLink comm protocol testsuite generated from auterion.xml + * @see https://mavlink.io/en/ + */ +#pragma once +#ifndef AUTERION_TESTSUITE_H +#define AUTERION_TESTSUITE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef MAVLINK_TEST_ALL +#define MAVLINK_TEST_ALL +static void mavlink_test_development(uint8_t, uint8_t, mavlink_message_t *last_msg); +static void mavlink_test_auterion(uint8_t, uint8_t, mavlink_message_t *last_msg); + +static void mavlink_test_all(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) +{ + mavlink_test_development(system_id, component_id, last_msg); + mavlink_test_auterion(system_id, component_id, last_msg); +} +#endif + +#include "../development/testsuite.h" + + +static void mavlink_test_param_ack_transaction(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) +{ +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); + if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_param_ack_transaction_t packet_in = { + 17.0,17,84,"GHIJKLMNOPQRSTU",199,10 + }; + mavlink_param_ack_transaction_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.param_value = packet_in.param_value; + packet1.target_system = packet_in.target_system; + packet1.target_component = packet_in.target_component; + packet1.param_type = packet_in.param_type; + packet1.param_result = packet_in.param_result; + + mav_array_memcpy(packet1.param_id, packet_in.param_id, sizeof(char)*16); + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_param_ack_transaction_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_param_ack_transaction_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_param_ack_transaction_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_value , packet1.param_type , packet1.param_result ); + mavlink_msg_param_ack_transaction_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_param_ack_transaction_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_value , packet1.param_type , packet1.param_result ); + mavlink_msg_param_ack_transaction_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_PARACHUTE_STATUS >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_parachute_status_t packet_in = { + 963497464,963497672,29,96,163,230,"MNOPQRSTUV" + }; + mavlink_parachute_status_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.time_boot_ms = packet_in.time_boot_ms; + packet1.error_status = packet_in.error_status; + packet1.arm_status = packet_in.arm_status; + packet1.deployment_status = packet_in.deployment_status; + packet1.safety_status = packet_in.safety_status; + packet1.ats_arm_altitude = packet_in.ats_arm_altitude; + + mav_array_memcpy(packet1.parachute_packed_date, packet_in.parachute_packed_date, sizeof(char)*11); + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_PARACHUTE_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_PARACHUTE_STATUS_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_parachute_status_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_parachute_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_parachute_status_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.error_status , packet1.arm_status , packet1.deployment_status , packet1.safety_status , packet1.ats_arm_altitude , packet1.parachute_packed_date ); + mavlink_msg_parachute_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_parachute_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.error_status , packet1.arm_status , packet1.deployment_status , packet1.safety_status , packet1.ats_arm_altitude , packet1.parachute_packed_date ); + mavlink_msg_parachute_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_BEACON_POSITION >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_beacon_position_t packet_in = { + 963497464,963497672,963497880,101.0,129.0,963498504,963498712,89 + }; + mavlink_beacon_position_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.beacon_id = packet_in.beacon_id; + packet1.latitude = packet_in.latitude; + packet1.longitude = packet_in.longitude; + packet1.altitude = packet_in.altitude; + packet1.distance = packet_in.distance; + packet1.delay = packet_in.delay; + packet1.link_quality = packet_in.link_quality; + packet1.gps_status = packet_in.gps_status; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_BEACON_POSITION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_BEACON_POSITION_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_beacon_position_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_beacon_position_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_beacon_position_pack(system_id, component_id, &msg , packet1.beacon_id , packet1.latitude , packet1.longitude , packet1.altitude , packet1.distance , packet1.delay , packet1.gps_status , packet1.link_quality ); + mavlink_msg_beacon_position_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_beacon_position_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.beacon_id , packet1.latitude , packet1.longitude , packet1.altitude , packet1.distance , packet1.delay , packet1.gps_status , packet1.link_quality ); + mavlink_msg_beacon_position_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_radiation_detector_counts_t packet_in = { + 123.0,93372036854776311ULL,93372036854776815ULL,963498712,963498920 + }; + mavlink_radiation_detector_counts_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.timestamp = packet_in.timestamp; + packet1.counts = packet_in.counts; + packet1.integration_time_usec = packet_in.integration_time_usec; + packet1.serial_no = packet_in.serial_no; + packet1.rate = packet_in.rate; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_RADIATION_DETECTOR_COUNTS_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_radiation_detector_counts_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_radiation_detector_counts_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_radiation_detector_counts_pack(system_id, component_id, &msg , packet1.serial_no , packet1.timestamp , packet1.counts , packet1.rate , packet1.integration_time_usec ); + mavlink_msg_radiation_detector_counts_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_radiation_detector_counts_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.serial_no , packet1.timestamp , packet1.counts , packet1.rate , packet1.integration_time_usec ); + mavlink_msg_radiation_detector_counts_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_radiation_detector_spectrum_t packet_in = { + 963497464,17,84,{ 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143 } + }; + mavlink_radiation_detector_spectrum_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.serial_no = packet_in.serial_no; + packet1.msg_no = packet_in.msg_no; + packet1.seq_no = packet_in.seq_no; + + mav_array_memcpy(packet1.segment, packet_in.segment, sizeof(uint8_t)*249); + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_RADIATION_DETECTOR_SPECTRUM_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_radiation_detector_spectrum_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_radiation_detector_spectrum_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_radiation_detector_spectrum_pack(system_id, component_id, &msg , packet1.serial_no , packet1.msg_no , packet1.seq_no , packet1.segment ); + mavlink_msg_radiation_detector_spectrum_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_radiation_detector_spectrum_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.serial_no , packet1.msg_no , packet1.seq_no , packet1.segment ); + mavlink_msg_radiation_detector_spectrum_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_radiation_detector_cps_t packet_in = { + 123.0,963497880,963498088,129.0 + }; + mavlink_radiation_detector_cps_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.timestamp = packet_in.timestamp; + packet1.serial_no = packet_in.serial_no; + packet1.cps = packet_in.cps; + packet1.dt = packet_in.dt; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_RADIATION_DETECTOR_CPS_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_radiation_detector_cps_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_radiation_detector_cps_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_radiation_detector_cps_pack(system_id, component_id, &msg , packet1.serial_no , packet1.timestamp , packet1.cps , packet1.dt ); + mavlink_msg_radiation_detector_cps_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_radiation_detector_cps_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.serial_no , packet1.timestamp , packet1.cps , packet1.dt ); + mavlink_msg_radiation_detector_cps_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_TRACKER_STATUS >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_tracker_status_t packet_in = { + 963497464,17443,151 + }; + mavlink_tracker_status_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.tracked_object_id = packet_in.tracked_object_id; + packet1.number_objects_detected = packet_in.number_objects_detected; + packet1.tracker_status = packet_in.tracker_status; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_TRACKER_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_TRACKER_STATUS_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_tracker_status_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_tracker_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_tracker_status_pack(system_id, component_id, &msg , packet1.tracker_status , packet1.number_objects_detected , packet1.tracked_object_id ); + mavlink_msg_tracker_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_tracker_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.tracker_status , packet1.number_objects_detected , packet1.tracked_object_id ); + mavlink_msg_tracker_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_TRACKER_DETECTION_2D >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_tracker_detection_2d_t packet_in = { + 93372036854775807ULL,93372036854776311ULL,963498296,963498504,963498712,963498920,241.0,269.0,297.0,325.0,19731,19835,19939,20043,173,240 + }; + mavlink_tracker_detection_2d_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.img_ts = packet_in.img_ts; + packet1.img_id = packet_in.img_id; + packet1.object_id = packet_in.object_id; + packet1.class_id = packet_in.class_id; + packet1.lat = packet_in.lat; + packet1.lon = packet_in.lon; + packet1.alt = packet_in.alt; + packet1.vel_n = packet_in.vel_n; + packet1.vel_e = packet_in.vel_e; + packet1.vel_up = packet_in.vel_up; + packet1.bbox_top_left_x = packet_in.bbox_top_left_x; + packet1.bbox_top_left_y = packet_in.bbox_top_left_y; + packet1.bbox_bot_right_x = packet_in.bbox_bot_right_x; + packet1.bbox_bot_right_y = packet_in.bbox_bot_right_y; + packet1.tracking_status = packet_in.tracking_status; + packet1.confidence = packet_in.confidence; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_TRACKER_DETECTION_2D_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_TRACKER_DETECTION_2D_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_tracker_detection_2d_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_tracker_detection_2d_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_tracker_detection_2d_pack(system_id, component_id, &msg , packet1.img_ts , packet1.img_id , packet1.object_id , packet1.class_id , packet1.tracking_status , packet1.confidence , packet1.bbox_top_left_x , packet1.bbox_top_left_y , packet1.bbox_bot_right_x , packet1.bbox_bot_right_y , packet1.lat , packet1.lon , packet1.alt , packet1.vel_n , packet1.vel_e , packet1.vel_up ); + mavlink_msg_tracker_detection_2d_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_tracker_detection_2d_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.img_ts , packet1.img_id , packet1.object_id , packet1.class_id , packet1.tracking_status , packet1.confidence , packet1.bbox_top_left_x , packet1.bbox_top_left_y , packet1.bbox_bot_right_x , packet1.bbox_bot_right_y , packet1.lat , packet1.lon , packet1.alt , packet1.vel_n , packet1.vel_e , packet1.vel_up ); + mavlink_msg_tracker_detection_2d_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_JOYSTICK_STATE >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_joystick_state_t packet_in = { + 93372036854775807ULL,{ 17651, 17652, 17653, 17654, 17655, 17656, 17657, 17658, 17659, 17660 },89,{ 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175 } + }; + mavlink_joystick_state_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.time_usec = packet_in.time_usec; + packet1.type = packet_in.type; + + mav_array_memcpy(packet1.axis_value, packet_in.axis_value, sizeof(uint16_t)*10); + mav_array_memcpy(packet1.button_value, packet_in.button_value, sizeof(uint8_t)*20); + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_JOYSTICK_STATE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_JOYSTICK_STATE_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_joystick_state_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_joystick_state_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_joystick_state_pack(system_id, component_id, &msg , packet1.time_usec , packet1.type , packet1.axis_value , packet1.button_value ); + mavlink_msg_joystick_state_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_joystick_state_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.type , packet1.axis_value , packet1.button_value ); + mavlink_msg_joystick_state_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_pixel_to_lla_request_t packet_in = { + 93372036854775807ULL,93372036854776311ULL,129.0,157.0,77 + }; + mavlink_pixel_to_lla_request_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.uid = packet_in.uid; + packet1.img_unix_ts = packet_in.img_unix_ts; + packet1.img_rel_x = packet_in.img_rel_x; + packet1.img_rel_y = packet_in.img_rel_y; + packet1.camera_id = packet_in.camera_id; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_PIXEL_TO_LLA_REQUEST_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_pixel_to_lla_request_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_pixel_to_lla_request_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_pixel_to_lla_request_pack(system_id, component_id, &msg , packet1.camera_id , packet1.uid , packet1.img_unix_ts , packet1.img_rel_x , packet1.img_rel_y ); + mavlink_msg_pixel_to_lla_request_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_pixel_to_lla_request_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.camera_id , packet1.uid , packet1.img_unix_ts , packet1.img_rel_x , packet1.img_rel_y ); + mavlink_msg_pixel_to_lla_request_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_pixel_to_lla_ack_t packet_in = { + 93372036854775807ULL,29,"JKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCD" + }; + mavlink_pixel_to_lla_ack_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.uid = packet_in.uid; + packet1.status = packet_in.status; + + mav_array_memcpy(packet1.error_message, packet_in.error_message, sizeof(char)*100); + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_PIXEL_TO_LLA_ACK_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_pixel_to_lla_ack_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_pixel_to_lla_ack_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_pixel_to_lla_ack_pack(system_id, component_id, &msg , packet1.uid , packet1.status , packet1.error_message ); + mavlink_msg_pixel_to_lla_ack_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_pixel_to_lla_ack_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.uid , packet1.status , packet1.error_message ); + mavlink_msg_pixel_to_lla_ack_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_pixel_to_lla_result_t packet_in = { + 93372036854775807ULL,179.0,235.0,291.0,{ 241.0, 242.0, 243.0, 244.0, 245.0, 246.0, 247.0, 248.0, 249.0 },209,"RSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL" + }; + mavlink_pixel_to_lla_result_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.uid = packet_in.uid; + packet1.latitude = packet_in.latitude; + packet1.longitude = packet_in.longitude; + packet1.altitude = packet_in.altitude; + packet1.status = packet_in.status; + + mav_array_memcpy(packet1.ned_homography_matrix, packet_in.ned_homography_matrix, sizeof(float)*9); + mav_array_memcpy(packet1.error_message, packet_in.error_message, sizeof(char)*100); + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_PIXEL_TO_LLA_RESULT_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_pixel_to_lla_result_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_pixel_to_lla_result_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_pixel_to_lla_result_pack(system_id, component_id, &msg , packet1.uid , packet1.status , packet1.latitude , packet1.longitude , packet1.altitude , packet1.ned_homography_matrix , packet1.error_message ); + mavlink_msg_pixel_to_lla_result_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_pixel_to_lla_result_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.uid , packet1.status , packet1.latitude , packet1.longitude , packet1.altitude , packet1.ned_homography_matrix , packet1.error_message ); + mavlink_msg_pixel_to_lla_result_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MOTOR_INFO >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_motor_info_t packet_in = { + 93372036854775807ULL,17651,163,230 + }; + mavlink_motor_info_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.total_time = packet_in.total_time; + packet1.temperature = packet_in.temperature; + packet1.index = packet_in.index; + packet1.type = packet_in.type; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_MOTOR_INFO_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MOTOR_INFO_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_motor_info_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_motor_info_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_motor_info_pack(system_id, component_id, &msg , packet1.index , packet1.type , packet1.total_time , packet1.temperature ); + mavlink_msg_motor_info_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_motor_info_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.index , packet1.type , packet1.total_time , packet1.temperature ); + mavlink_msg_motor_info_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_CONTROL_STATUS_REPORT >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_control_status_report_t packet_in = { + 5,72 + }; + mavlink_control_status_report_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.current_flight_controller = packet_in.current_flight_controller; + packet1.current_payload_controller = packet_in.current_payload_controller; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_CONTROL_STATUS_REPORT_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_control_status_report_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_control_status_report_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_control_status_report_pack(system_id, component_id, &msg , packet1.current_flight_controller , packet1.current_payload_controller ); + mavlink_msg_control_status_report_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_control_status_report_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.current_flight_controller , packet1.current_payload_controller ); + mavlink_msg_control_status_report_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_REQUEST_CONTROL >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_request_control_t packet_in = { + 5,72,"CDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNO","QRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJK" + }; + mavlink_request_control_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.control_target = packet_in.control_target; + packet1.request_priority = packet_in.request_priority; + + mav_array_memcpy(packet1.requester_id, packet_in.requester_id, sizeof(char)*40); + mav_array_memcpy(packet1.reason, packet_in.reason, sizeof(char)*100); + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_REQUEST_CONTROL_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_REQUEST_CONTROL_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_request_control_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_request_control_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_request_control_pack(system_id, component_id, &msg , packet1.control_target , packet1.request_priority , packet1.requester_id , packet1.reason ); + mavlink_msg_request_control_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_request_control_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.control_target , packet1.request_priority , packet1.requester_id , packet1.reason ); + mavlink_msg_request_control_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_REQUEST_CONTROL_ACK >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_request_control_ack_t packet_in = { + 5,72 + }; + mavlink_request_control_ack_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.control_target = packet_in.control_target; + packet1.error_code = packet_in.error_code; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_REQUEST_CONTROL_ACK_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_request_control_ack_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_request_control_ack_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_request_control_ack_pack(system_id, component_id, &msg , packet1.control_target , packet1.error_code ); + mavlink_msg_request_control_ack_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_request_control_ack_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.control_target , packet1.error_code ); + mavlink_msg_request_control_ack_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_RELEASE_CONTROL >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_release_control_t packet_in = { + 5 + }; + mavlink_release_control_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.control_target = packet_in.control_target; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_RELEASE_CONTROL_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_RELEASE_CONTROL_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_release_control_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_release_control_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_release_control_pack(system_id, component_id, &msg , packet1.control_target ); + mavlink_msg_release_control_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_release_control_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.control_target ); + mavlink_msg_release_control_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_REQUEST_HANDOFF >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_request_handoff_t packet_in = { + 5,"BCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMN","PQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJ" + }; + mavlink_request_handoff_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.control_target = packet_in.control_target; + + mav_array_memcpy(packet1.requester_id, packet_in.requester_id, sizeof(char)*40); + mav_array_memcpy(packet1.reason, packet_in.reason, sizeof(char)*100); + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_REQUEST_HANDOFF_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_REQUEST_HANDOFF_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_request_handoff_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_request_handoff_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_request_handoff_pack(system_id, component_id, &msg , packet1.control_target , packet1.requester_id , packet1.reason ); + mavlink_msg_request_handoff_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_request_handoff_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.control_target , packet1.requester_id , packet1.reason ); + mavlink_msg_request_handoff_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_HANDOFF_RESPOND >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_handoff_respond_t packet_in = { + 5,72 + }; + mavlink_handoff_respond_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.control_target = packet_in.control_target; + packet1.handoff_decision = packet_in.handoff_decision; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_HANDOFF_RESPOND_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_HANDOFF_RESPOND_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_handoff_respond_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_handoff_respond_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_handoff_respond_pack(system_id, component_id, &msg , packet1.control_target , packet1.handoff_decision ); + mavlink_msg_handoff_respond_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_handoff_respond_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.control_target , packet1.handoff_decision ); + mavlink_msg_handoff_respond_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_UNIQUE_IDENTIFIER >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_unique_identifier_t packet_in = { + "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDE" + }; + mavlink_unique_identifier_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + + mav_array_memcpy(packet1.uuid, packet_in.uuid, sizeof(char)*32); + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_UNIQUE_IDENTIFIER_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_unique_identifier_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_unique_identifier_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_unique_identifier_pack(system_id, component_id, &msg , packet1.uuid ); + mavlink_msg_unique_identifier_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_unique_identifier_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.uuid ); + mavlink_msg_unique_identifier_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_boat_actuator_status_t packet_in = { + 93372036854775807ULL,{ 73.0, 74.0, 75.0, 76.0, 77.0, 78.0 },{ 241.0, 242.0, 243.0, 244.0, 245.0, 246.0 },{ 173, 174, 175, 176, 177, 178 },{ 63, 64, 65, 66, 67, 68 } + }; + mavlink_boat_actuator_status_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.time_usec = packet_in.time_usec; + + mav_array_memcpy(packet1.engine_leg_trim_position, packet_in.engine_leg_trim_position, sizeof(float)*6); + mav_array_memcpy(packet1.rudder_position, packet_in.rudder_position, sizeof(float)*6); + mav_array_memcpy(packet1.engine_leg_trim_state, packet_in.engine_leg_trim_state, sizeof(uint8_t)*6); + mav_array_memcpy(packet1.rudder_state, packet_in.rudder_state, sizeof(uint8_t)*6); + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_BOAT_ACTUATOR_STATUS_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_boat_actuator_status_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_boat_actuator_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_boat_actuator_status_pack(system_id, component_id, &msg , packet1.time_usec , packet1.engine_leg_trim_state , packet1.engine_leg_trim_position , packet1.rudder_state , packet1.rudder_position ); + mavlink_msg_boat_actuator_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_boat_actuator_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.engine_leg_trim_state , packet1.engine_leg_trim_position , packet1.rudder_state , packet1.rudder_position ); + mavlink_msg_boat_actuator_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_BOAT_ENGINE_STATUS >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_boat_engine_status_t packet_in = { + 93372036854775807ULL,73.0,{ 101.0, 102.0, 103.0, 104.0, 105.0, 106.0 },{ 269.0, 270.0, 271.0, 272.0, 273.0, 274.0 },{ 20355, 20356, 20357, 20358, 20359, 20360 },{ 221, 222, 223, 224, 225, 226 },{ 111, 112, 113, 114, 115, 116 },{ 1, 2, 3, 4, 5, 6 },{ 147, 148, 149, 150, 151, 152 } + }; + mavlink_boat_engine_status_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.time_usec = packet_in.time_usec; + packet1.fuel_consumption_rate = packet_in.fuel_consumption_rate; + + mav_array_memcpy(packet1.oil_pressure, packet_in.oil_pressure, sizeof(float)*6); + mav_array_memcpy(packet1.engine_coolant_temperature, packet_in.engine_coolant_temperature, sizeof(float)*6); + mav_array_memcpy(packet1.engine_rpm, packet_in.engine_rpm, sizeof(uint16_t)*6); + mav_array_memcpy(packet1.engine_state, packet_in.engine_state, sizeof(uint8_t)*6); + mav_array_memcpy(packet1.engine_load, packet_in.engine_load, sizeof(uint8_t)*6); + mav_array_memcpy(packet1.throttle_position, packet_in.throttle_position, sizeof(uint8_t)*6); + mav_array_memcpy(packet1.transmission_state, packet_in.transmission_state, sizeof(uint8_t)*6); + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_BOAT_ENGINE_STATUS_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_boat_engine_status_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_boat_engine_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_boat_engine_status_pack(system_id, component_id, &msg , packet1.time_usec , packet1.engine_state , packet1.engine_load , packet1.engine_rpm , packet1.fuel_consumption_rate , packet1.oil_pressure , packet1.throttle_position , packet1.engine_coolant_temperature , packet1.transmission_state ); + mavlink_msg_boat_engine_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_boat_engine_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.engine_state , packet1.engine_load , packet1.engine_rpm , packet1.fuel_consumption_rate , packet1.oil_pressure , packet1.throttle_position , packet1.engine_coolant_temperature , packet1.transmission_state ); + mavlink_msg_boat_engine_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_FLUID_LEVEL >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_fluid_level_t packet_in = { + 93372036854775807ULL,73.0,101.0,53,120 + }; + mavlink_fluid_level_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.time_usec = packet_in.time_usec; + packet1.level = packet_in.level; + packet1.capacity = packet_in.capacity; + packet1.instance = packet_in.instance; + packet1.type = packet_in.type; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_FLUID_LEVEL_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_FLUID_LEVEL_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_fluid_level_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_fluid_level_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_fluid_level_pack(system_id, component_id, &msg , packet1.time_usec , packet1.instance , packet1.type , packet1.level , packet1.capacity ); + mavlink_msg_fluid_level_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_fluid_level_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.instance , packet1.type , packet1.level , packet1.capacity ); + mavlink_msg_fluid_level_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_VESSEL_SPEED >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_vessel_speed_t packet_in = { + 93372036854775807ULL,73.0,101.0,53,120 + }; + mavlink_vessel_speed_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.time_usec = packet_in.time_usec; + packet1.speed_water_referenced = packet_in.speed_water_referenced; + packet1.speed_ground_referenced = packet_in.speed_ground_referenced; + packet1.speed_water_referenced_type = packet_in.speed_water_referenced_type; + packet1.speed_direction = packet_in.speed_direction; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_VESSEL_SPEED_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_VESSEL_SPEED_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_vessel_speed_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_vessel_speed_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_vessel_speed_pack(system_id, component_id, &msg , packet1.time_usec , packet1.speed_water_referenced , packet1.speed_ground_referenced , packet1.speed_water_referenced_type , packet1.speed_direction ); + mavlink_msg_vessel_speed_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_vessel_speed_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.speed_water_referenced , packet1.speed_ground_referenced , packet1.speed_water_referenced_type , packet1.speed_direction ); + mavlink_msg_vessel_speed_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_WATER_DEPTH_RAW >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_water_depth_raw_t packet_in = { + 93372036854775807ULL,73.0,101.0,129.0 + }; + mavlink_water_depth_raw_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.time_usec = packet_in.time_usec; + packet1.depth = packet_in.depth; + packet1.offset = packet_in.offset; + packet1.range = packet_in.range; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_WATER_DEPTH_RAW_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_WATER_DEPTH_RAW_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_water_depth_raw_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_water_depth_raw_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_water_depth_raw_pack(system_id, component_id, &msg , packet1.time_usec , packet1.depth , packet1.offset , packet1.range ); + mavlink_msg_water_depth_raw_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_water_depth_raw_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.depth , packet1.offset , packet1.range ); + mavlink_msg_water_depth_raw_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_WIND_DATA_RAW >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_wind_data_raw_t packet_in = { + 93372036854775807ULL,73.0,101.0,53 + }; + mavlink_wind_data_raw_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.time_usec = packet_in.time_usec; + packet1.wind_speed = packet_in.wind_speed; + packet1.wind_angle = packet_in.wind_angle; + packet1.reference = packet_in.reference; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_WIND_DATA_RAW_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_WIND_DATA_RAW_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_wind_data_raw_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_wind_data_raw_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_wind_data_raw_pack(system_id, component_id, &msg , packet1.time_usec , packet1.reference , packet1.wind_speed , packet1.wind_angle ); + mavlink_msg_wind_data_raw_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_wind_data_raw_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.reference , packet1.wind_speed , packet1.wind_angle ); + mavlink_msg_wind_data_raw_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_RADAR_TARGET_TRACK >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_radar_target_track_t packet_in = { + 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,18899,235,46,"KLMNOPQRSTUVWXYZABC",173,240 + }; + mavlink_radar_target_track_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.time_usec = packet_in.time_usec; + packet1.distance_to_target = packet_in.distance_to_target; + packet1.bearing_to_target = packet_in.bearing_to_target; + packet1.target_speed = packet_in.target_speed; + packet1.target_course = packet_in.target_course; + packet1.distance_to_closest_point_of_approach = packet_in.distance_to_closest_point_of_approach; + packet1.time_to_closest_point_of_approach = packet_in.time_to_closest_point_of_approach; + packet1.target_number = packet_in.target_number; + packet1.bearing_type = packet_in.bearing_type; + packet1.course_type = packet_in.course_type; + packet1.target_track_status = packet_in.target_track_status; + packet1.target_track_acquisition_type = packet_in.target_track_acquisition_type; + + mav_array_memcpy(packet1.target_name, packet_in.target_name, sizeof(char)*20); + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_RADAR_TARGET_TRACK_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_RADAR_TARGET_TRACK_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_radar_target_track_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_radar_target_track_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_radar_target_track_pack(system_id, component_id, &msg , packet1.time_usec , packet1.target_number , packet1.distance_to_target , packet1.bearing_to_target , packet1.bearing_type , packet1.target_speed , packet1.target_course , packet1.course_type , packet1.distance_to_closest_point_of_approach , packet1.time_to_closest_point_of_approach , packet1.target_name , packet1.target_track_status , packet1.target_track_acquisition_type ); + mavlink_msg_radar_target_track_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_radar_target_track_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.target_number , packet1.distance_to_target , packet1.bearing_to_target , packet1.bearing_type , packet1.target_speed , packet1.target_course , packet1.course_type , packet1.distance_to_closest_point_of_approach , packet1.time_to_closest_point_of_approach , packet1.target_name , packet1.target_track_status , packet1.target_track_acquisition_type ); + mavlink_msg_radar_target_track_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_ship_approach_sectors_status_t packet_in = { + 5 + }; + mavlink_ship_approach_sectors_status_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.sectors = packet_in.sectors; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SHIP_APPROACH_SECTORS_STATUS_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_ship_approach_sectors_status_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_ship_approach_sectors_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_ship_approach_sectors_status_pack(system_id, component_id, &msg , packet1.sectors ); + mavlink_msg_ship_approach_sectors_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_ship_approach_sectors_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.sectors ); + mavlink_msg_ship_approach_sectors_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; i 0 radius to pass by WP. Positive value for clockwise orbit, negative value for counter-clockwise orbit. Allows trajectory control.| Desired yaw angle at waypoint (rotary wing). NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_LOITER_UNLIM=17, /* Loiter around this waypoint an unlimited amount of time |Empty| Empty| Loiter radius around waypoint for forward-only moving vehicles (not multicopters). If positive loiter clockwise, else counter-clockwise| Desired yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_LOITER_TURNS=18, /* Loiter around this waypoint for X turns |Number of turns.| Leave loiter circle only once heading towards the next waypoint (0 = False)| Loiter radius around waypoint for forward-only moving vehicles (not multicopters). If positive loiter clockwise, else counter-clockwise| Loiter circle exit location and/or path to next waypoint ("xtrack") for forward-only moving vehicles (not multicopters). 0 for the vehicle to converge towards the center xtrack when it leaves the loiter (the line between the centers of the current and next waypoint), 1 to converge to the direct line between the location that the vehicle exits the loiter radius and the next waypoint. Otherwise the angle (in degrees) between the tangent of the loiter circle and the center xtrack at which the vehicle must leave the loiter (and converge to the center xtrack). NaN to use the current system default xtrack behaviour.| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_LOITER_TIME=19, /* Loiter at the specified latitude, longitude and altitude for a certain amount of time. Multicopter vehicles stop at the point (within a vehicle-specific acceptance radius). Forward-only moving vehicles (e.g. fixed-wing) circle the point with the specified radius/direction. If the Heading Required parameter (2) is non-zero forward moving aircraft will only leave the loiter circle once heading towards the next waypoint. |Loiter time (only starts once Lat, Lon and Alt is reached).| Leave loiter circle only once heading towards the next waypoint (0 = False)| Loiter radius around waypoint for forward-only moving vehicles (not multicopters). If positive loiter clockwise, else counter-clockwise.| Loiter circle exit location and/or path to next waypoint ("xtrack") for forward-only moving vehicles (not multicopters). 0 for the vehicle to converge towards the center xtrack when it leaves the loiter (the line between the centers of the current and next waypoint), 1 to converge to the direct line between the location that the vehicle exits the loiter radius and the next waypoint. Otherwise the angle (in degrees) between the tangent of the loiter circle and the center xtrack at which the vehicle must leave the loiter (and converge to the center xtrack). NaN to use the current system default xtrack behaviour.| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_RETURN_TO_LAUNCH=20, /* Return to launch location |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_NAV_LAND=21, /* Land at location. |Minimum target altitude if landing is aborted (0 = undefined/use system default).| Precision land mode.| Empty.| Desired yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude.| Longitude.| Landing altitude (ground level in current frame).| */ - MAV_CMD_NAV_TAKEOFF=22, /* Takeoff from ground / hand. Vehicles that support multiple takeoff modes (e.g. VTOL quadplane) should take off using the currently configured mode. |Minimum pitch (if airspeed sensor present), desired pitch without sensor| Empty| Empty| Yaw angle (if magnetometer present), ignored without magnetometer. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_LAND_LOCAL=23, /* Land at local position (local frame only) |Landing target number (if available)| Maximum accepted offset from desired landing position - computed magnitude from spherical coordinates: d = sqrt(x^2 + y^2 + z^2), which gives the maximum accepted distance between the desired landing position and the position where the vehicle is about to land| Landing descend rate| Desired yaw angle| Y-axis position| X-axis position| Z-axis / ground level position| */ - MAV_CMD_NAV_TAKEOFF_LOCAL=24, /* Takeoff from local position (local frame only) |Minimum pitch (if airspeed sensor present), desired pitch without sensor| Empty| Takeoff ascend rate| Yaw angle (if magnetometer or another yaw estimation source present), ignored without one of these| Y-axis position| X-axis position| Z-axis position| */ - MAV_CMD_NAV_FOLLOW=25, /* Vehicle following, i.e. this waypoint represents the position of a moving vehicle |Following logic to use (e.g. loitering or sinusoidal following) - depends on specific autopilot implementation| Ground speed of vehicle to be followed| Radius around waypoint. If positive loiter clockwise, else counter-clockwise| Desired yaw angle.| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_CONTINUE_AND_CHANGE_ALT=30, /* Continue on the current course and climb/descend to specified altitude. When the altitude is reached continue to the next command (i.e., don't proceed to the next command until the desired altitude is reached. |Climb or Descend (0 = Neutral, command completes when within 5m of this command's altitude, 1 = Climbing, command completes when at or above this command's altitude, 2 = Descending, command completes when at or below this command's altitude.| Empty| Empty| Empty| Empty| Empty| Desired altitude| */ - MAV_CMD_NAV_LOITER_TO_ALT=31, /* Begin loiter at the specified Latitude and Longitude. If Lat=Lon=0, then loiter at the current position. Don't consider the navigation command complete (don't leave loiter) until the altitude has been reached. Additionally, if the Heading Required parameter is non-zero the aircraft will not leave the loiter until heading toward the next waypoint. |Leave loiter circle only once heading towards the next waypoint (0 = False)| Loiter radius around waypoint for forward-only moving vehicles (not multicopters). If positive loiter clockwise, negative counter-clockwise, 0 means no change to standard loiter.| Empty| Loiter circle exit location and/or path to next waypoint ("xtrack") for forward-only moving vehicles (not multicopters). 0 for the vehicle to converge towards the center xtrack when it leaves the loiter (the line between the centers of the current and next waypoint), 1 to converge to the direct line between the location that the vehicle exits the loiter radius and the next waypoint. Otherwise the angle (in degrees) between the tangent of the loiter circle and the center xtrack at which the vehicle must leave the loiter (and converge to the center xtrack). NaN to use the current system default xtrack behaviour.| Latitude| Longitude| Altitude| */ - MAV_CMD_DO_FOLLOW=32, /* Begin following a target |System ID (of the FOLLOW_TARGET beacon). Send 0 to disable follow-me and return to the default position hold mode.| Reserved| Reserved| Altitude mode: 0: Keep current altitude, 1: keep altitude difference to target, 2: go to a fixed altitude above home.| Altitude above home. (used if mode=2)| Reserved| Time to land in which the MAV should go to the default position hold mode after a message RX timeout.| */ - MAV_CMD_DO_FOLLOW_REPOSITION=33, /* Reposition the MAV after a follow target command has been sent |Camera q1 (where 0 is on the ray from the camera to the tracking device)| Camera q2| Camera q3| Camera q4| altitude offset from target| X offset from target| Y offset from target| */ - MAV_CMD_DO_ORBIT=34, /* Start orbiting on the circumference of a circle defined by the parameters. Setting any value NaN results in using defaults. |Radius of the circle. positive: Orbit clockwise. negative: Orbit counter-clockwise.| Tangential Velocity. NaN: Vehicle configuration default.| Yaw behavior of the vehicle.| Reserved (e.g. for dynamic center beacon options)| Center point latitude (if no MAV_FRAME specified) / X coordinate according to MAV_FRAME. NaN: Use current vehicle position or current center if already orbiting.| Center point longitude (if no MAV_FRAME specified) / Y coordinate according to MAV_FRAME. NaN: Use current vehicle position or current center if already orbiting.| Center point altitude (MSL) (if no MAV_FRAME specified) / Z coordinate according to MAV_FRAME. NaN: Use current vehicle position or current center if already orbiting.| */ - MAV_CMD_NAV_ROI=80, /* Sets the region of interest (ROI) for a sensor set or the vehicle itself. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. |Region of interest mode.| Waypoint index/ target ID. (see MAV_ROI enum)| ROI index (allows a vehicle to manage multiple ROI's)| Empty| x the location of the fixed ROI (see MAV_FRAME)| y| z| */ - MAV_CMD_NAV_PATHPLANNING=81, /* Control autonomous path planning on the MAV. |0: Disable local obstacle avoidance / local path planning (without resetting map), 1: Enable local path planning, 2: Enable and reset local path planning| 0: Disable full path planning (without resetting map), 1: Enable, 2: Enable and reset map/occupancy grid, 3: Enable and reset planned route, but not occupancy grid| Empty| Yaw angle at goal| Latitude/X of goal| Longitude/Y of goal| Altitude/Z of goal| */ - MAV_CMD_NAV_SPLINE_WAYPOINT=82, /* Navigate to waypoint using a spline path. |Hold time. (ignored by fixed wing, time to stay at waypoint for rotary wing)| Empty| Empty| Empty| Latitude/X of goal| Longitude/Y of goal| Altitude/Z of goal| */ - MAV_CMD_NAV_VTOL_TAKEOFF=84, /* Takeoff from ground using VTOL mode, and transition to forward flight with specified heading. The command should be ignored by vehicles that dont support both VTOL and fixed-wing flight (multicopters, boats,etc.). |Empty| Front transition heading.| Empty| Yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_VTOL_LAND=85, /* Land using VTOL mode |Empty| Empty| Approach altitude (with the same reference as the Altitude field). NaN if unspecified.| Yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude| Longitude| Altitude (ground level)| */ - MAV_CMD_NAV_GUIDED_ENABLE=92, /* hand control over to an external controller |On / Off (> 0.5f on)| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_NAV_DELAY=93, /* Delay the next navigation command a number of seconds or until a specified time |Delay (-1 to enable time-of-day fields)| hour (24h format, UTC, -1 to ignore)| minute (24h format, UTC, -1 to ignore)| second (24h format, UTC, -1 to ignore)| Empty| Empty| Empty| */ - MAV_CMD_NAV_PAYLOAD_PLACE=94, /* Descend and place payload. Vehicle moves to specified location, descends until it detects a hanging payload has reached the ground, and then releases the payload. If ground is not detected before the reaching the maximum descent value (param1), the command will complete without releasing the payload. |Maximum distance to descend.| Empty| Empty| Empty| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_LAST=95, /* NOP - This command is only used to mark the upper limit of the NAV/ACTION commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_CONDITION_DELAY=112, /* Delay mission state machine. |Delay| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_CONDITION_CHANGE_ALT=113, /* Ascend/descend to target altitude at specified rate. Delay mission state machine until desired altitude reached. |Descent / Ascend rate.| Empty| Empty| Empty| Empty| Empty| Target Altitude| */ - MAV_CMD_CONDITION_DISTANCE=114, /* Delay mission state machine until within desired distance of next NAV point. |Distance.| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_CONDITION_YAW=115, /* Reach a certain target angle. |target angle, 0 is north| angular speed| direction: -1: counter clockwise, 1: clockwise| 0: absolute angle, 1: relative offset| Empty| Empty| Empty| */ - MAV_CMD_CONDITION_LAST=159, /* NOP - This command is only used to mark the upper limit of the CONDITION commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_MODE=176, /* Set system mode. |Mode| Custom mode - this is system specific, please refer to the individual autopilot specifications for details.| Custom sub mode - this is system specific, please refer to the individual autopilot specifications for details.| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_JUMP=177, /* Jump to the desired command in the mission list. Repeat this action only the specified number of times |Sequence number| Repeat count| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_CHANGE_SPEED=178, /* Change speed and/or throttle set points. |Speed type (0=Airspeed, 1=Ground Speed, 2=Climb Speed, 3=Descent Speed)| Speed (-1 indicates no change)| Throttle (-1 indicates no change)| 0: absolute, 1: relative| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_HOME=179, /* Changes the home location either to the current location or a specified location. |Use current (1=use current location, 0=use specified location)| Empty| Empty| Yaw angle. NaN to use default heading| Latitude| Longitude| Altitude| */ - MAV_CMD_DO_SET_PARAMETER=180, /* Set a system parameter. Caution! Use of this command requires knowledge of the numeric enumeration value of the parameter. |Parameter number| Parameter value| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_RELAY=181, /* Set a relay to a condition. |Relay instance number.| Setting. (1=on, 0=off, others possible depending on system hardware)| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_REPEAT_RELAY=182, /* Cycle a relay on and off for a desired number of cycles with a desired period. |Relay instance number.| Cycle count.| Cycle time.| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_SERVO=183, /* Set a servo to a desired PWM value. |Servo instance number.| Pulse Width Modulation.| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_REPEAT_SERVO=184, /* Cycle a between its nominal setting and a desired PWM for a desired number of cycles with a desired period. |Servo instance number.| Pulse Width Modulation.| Cycle count.| Cycle time.| Empty| Empty| Empty| */ - MAV_CMD_DO_FLIGHTTERMINATION=185, /* Terminate flight immediately |Flight termination activated if > 0.5| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_CHANGE_ALTITUDE=186, /* Change altitude set point. |Altitude.| Frame of new altitude.| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_ACTUATOR=187, /* Sets actuators (e.g. servos) to a desired value. The actuator numbers are mapped to specific outputs (e.g. on any MAIN or AUX PWM or UAVCAN) using a flight-stack specific mechanism (i.e. a parameter). |Actuator 1 value, scaled from [-1 to 1]. NaN to ignore.| Actuator 2 value, scaled from [-1 to 1]. NaN to ignore.| Actuator 3 value, scaled from [-1 to 1]. NaN to ignore.| Actuator 4 value, scaled from [-1 to 1]. NaN to ignore.| Actuator 5 value, scaled from [-1 to 1]. NaN to ignore.| Actuator 6 value, scaled from [-1 to 1]. NaN to ignore.| Index of actuator set (i.e if set to 1, Actuator 1 becomes Actuator 7)| */ - MAV_CMD_DO_LAND_START=189, /* Mission command to perform a landing. This is used as a marker in a mission to tell the autopilot where a sequence of mission items that represents a landing starts. It may also be sent via a COMMAND_LONG to trigger a landing, in which case the nearest (geographically) landing sequence in the mission will be used. The Latitude/Longitude is optional, and may be set to 0 if not needed. If specified then it will be used to help find the closest landing sequence. |Empty| Empty| Empty| Empty| Latitude| Longitude| Empty| */ - MAV_CMD_DO_RALLY_LAND=190, /* Mission command to perform a landing from a rally point. |Break altitude| Landing speed| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_GO_AROUND=191, /* Mission command to safely abort an autonomous landing. |Altitude| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_REPOSITION=192, /* Reposition the vehicle to a specific WGS84 global position. |Ground speed, less than 0 (-1) for default| Bitmask of option flags.| Reserved| Yaw heading. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.). For planes indicates loiter direction (0: clockwise, 1: counter clockwise)| Latitude| Longitude| Altitude| */ - MAV_CMD_DO_PAUSE_CONTINUE=193, /* If in a GPS controlled position mode, hold the current position or continue. |0: Pause current mission or reposition command, hold current position. 1: Continue mission. A VTOL capable vehicle should enter hover mode (multicopter and VTOL planes). A plane should loiter with the default loiter radius.| Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| */ - MAV_CMD_DO_SET_REVERSE=194, /* Set moving direction to forward or reverse. |Direction (0=Forward, 1=Reverse)| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_ROI_LOCATION=195, /* Sets the region of interest (ROI) to a location. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. This command can be sent to a gimbal manager but not to a gimbal device. A gimbal is not to react to this message. |Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| Empty| Empty| Empty| Latitude of ROI location| Longitude of ROI location| Altitude of ROI location| */ - MAV_CMD_DO_SET_ROI_WPNEXT_OFFSET=196, /* Sets the region of interest (ROI) to be toward next waypoint, with optional pitch/roll/yaw offset. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. This command can be sent to a gimbal manager but not to a gimbal device. A gimbal device is not to react to this message. |Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| Empty| Empty| Empty| Pitch offset from next waypoint, positive pitching up| Roll offset from next waypoint, positive rolling to the right| Yaw offset from next waypoint, positive yawing to the right| */ - MAV_CMD_DO_SET_ROI_NONE=197, /* Cancels any previous ROI command returning the vehicle/sensors to default flight characteristics. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. This command can be sent to a gimbal manager but not to a gimbal device. A gimbal device is not to react to this message. After this command the gimbal manager should go back to manual input if available, and otherwise assume a neutral position. |Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_ROI_SYSID=198, /* Mount tracks system with specified system ID. Determination of target vehicle position may be done with GLOBAL_POSITION_INT or any other means. This command can be sent to a gimbal manager but not to a gimbal device. A gimbal device is not to react to this message. |System ID| Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_DO_CONTROL_VIDEO=200, /* Control onboard camera system. |Camera ID (-1 for all)| Transmission: 0: disabled, 1: enabled compressed, 2: enabled raw| Transmission mode: 0: video stream, >0: single images every n seconds| Recording: 0: disabled, 1: enabled compressed, 2: enabled raw| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_ROI=201, /* Sets the region of interest (ROI) for a sensor set or the vehicle itself. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. |Region of interest mode.| Waypoint index/ target ID (depends on param 1).| Region of interest index. (allows a vehicle to manage multiple ROI's)| Empty| MAV_ROI_WPNEXT: pitch offset from next waypoint, MAV_ROI_LOCATION: latitude| MAV_ROI_WPNEXT: roll offset from next waypoint, MAV_ROI_LOCATION: longitude| MAV_ROI_WPNEXT: yaw offset from next waypoint, MAV_ROI_LOCATION: altitude| */ - MAV_CMD_DO_DIGICAM_CONFIGURE=202, /* Configure digital camera. This is a fallback message for systems that have not yet implemented PARAM_EXT_XXX messages and camera definition files (see https://mavlink.io/en/services/camera_def.html ). |Modes: P, TV, AV, M, Etc.| Shutter speed: Divisor number for one second.| Aperture: F stop number.| ISO number e.g. 80, 100, 200, Etc.| Exposure type enumerator.| Command Identity.| Main engine cut-off time before camera trigger. (0 means no cut-off)| */ - MAV_CMD_DO_DIGICAM_CONTROL=203, /* Control digital camera. This is a fallback message for systems that have not yet implemented PARAM_EXT_XXX messages and camera definition files (see https://mavlink.io/en/services/camera_def.html ). |Session control e.g. show/hide lens| Zoom's absolute position| Zooming step value to offset zoom from the current position| Focus Locking, Unlocking or Re-locking| Shooting Command| Command Identity| Test shot identifier. If set to 1, image will only be captured, but not counted towards internal frame count.| */ - MAV_CMD_DO_MOUNT_CONFIGURE=204, /* Mission command to configure a camera or antenna mount |Mount operation mode| stabilize roll? (1 = yes, 0 = no)| stabilize pitch? (1 = yes, 0 = no)| stabilize yaw? (1 = yes, 0 = no)| roll input (0 = angle body frame, 1 = angular rate, 2 = angle absolute frame)| pitch input (0 = angle body frame, 1 = angular rate, 2 = angle absolute frame)| yaw input (0 = angle body frame, 1 = angular rate, 2 = angle absolute frame)| */ - MAV_CMD_DO_MOUNT_CONTROL=205, /* Mission command to control a camera or antenna mount |pitch depending on mount mode (degrees or degrees/second depending on pitch input).| roll depending on mount mode (degrees or degrees/second depending on roll input).| yaw depending on mount mode (degrees or degrees/second depending on yaw input).| altitude depending on mount mode.| latitude, set if appropriate mount mode.| longitude, set if appropriate mount mode.| Mount mode.| */ - MAV_CMD_DO_SET_CAM_TRIGG_DIST=206, /* Mission command to set camera trigger distance for this flight. The camera is triggered each time this distance is exceeded. This command can also be used to set the shutter integration time for the camera. |Camera trigger distance. 0 to stop triggering.| Camera shutter integration time. -1 or 0 to ignore| Trigger camera once immediately. (0 = no trigger, 1 = trigger)| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_FENCE_ENABLE=207, /* Mission command to enable the geofence |enable? (0=disable, 1=enable, 2=disable_floor_only)| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_PARACHUTE=208, /* Mission item/command to release a parachute or enable/disable auto release. |Action| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_MOTOR_TEST=209, /* Mission command to perform motor test. |Motor instance number. (from 1 to max number of motors on the vehicle)| Throttle type.| Throttle.| Timeout.| Motor count. (number of motors to test to test in sequence, waiting for the timeout above between them; 0=1 motor, 1=1 motor, 2=2 motors...)| Motor test order.| Empty| */ - MAV_CMD_DO_INVERTED_FLIGHT=210, /* Change to/from inverted flight. |Inverted flight. (0=normal, 1=inverted)| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_GRIPPER=211, /* Mission command to operate a gripper. |Gripper instance number.| Gripper action to perform.| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_AUTOTUNE_ENABLE=212, /* Enable/disable autotune. |Enable (1: enable, 0:disable).| Empty.| Empty.| Empty.| Empty.| Empty.| Empty.| */ - MAV_CMD_NAV_SET_YAW_SPEED=213, /* Sets a desired vehicle turn angle and speed change. |Yaw angle to adjust steering by.| Speed.| Final angle. (0=absolute, 1=relative)| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_CAM_TRIGG_INTERVAL=214, /* Mission command to set camera trigger interval for this flight. If triggering is enabled, the camera is triggered each time this interval expires. This command can also be used to set the shutter integration time for the camera. |Camera trigger cycle time. -1 or 0 to ignore.| Camera shutter integration time. Should be less than trigger cycle time. -1 or 0 to ignore.| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_MOUNT_CONTROL_QUAT=220, /* Mission command to control a camera or antenna mount, using a quaternion as reference. |quaternion param q1, w (1 in null-rotation)| quaternion param q2, x (0 in null-rotation)| quaternion param q3, y (0 in null-rotation)| quaternion param q4, z (0 in null-rotation)| Empty| Empty| Empty| */ - MAV_CMD_DO_GUIDED_MASTER=221, /* set id of master controller |System ID| Component ID| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_GUIDED_LIMITS=222, /* Set limits for external control |Timeout - maximum time that external controller will be allowed to control vehicle. 0 means no timeout.| Altitude (MSL) min - if vehicle moves below this alt, the command will be aborted and the mission will continue. 0 means no lower altitude limit.| Altitude (MSL) max - if vehicle moves above this alt, the command will be aborted and the mission will continue. 0 means no upper altitude limit.| Horizontal move limit - if vehicle moves more than this distance from its location at the moment the command was executed, the command will be aborted and the mission will continue. 0 means no horizontal move limit.| Empty| Empty| Empty| */ - MAV_CMD_DO_ENGINE_CONTROL=223, /* Control vehicle engine. This is interpreted by the vehicles engine controller to change the target engine state. It is intended for vehicles with internal combustion engines |0: Stop engine, 1:Start Engine| 0: Warm start, 1:Cold start. Controls use of choke where applicable| Height delay. This is for commanding engine start only after the vehicle has gained the specified height. Used in VTOL vehicles during takeoff to start engine after the aircraft is off the ground. Zero for no delay.| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_MISSION_CURRENT=224, /* Set the mission item with sequence number seq as current item. This means that the MAV will continue to this mission item on the shortest path (not following the mission items in-between). |Mission sequence value to set| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_LAST=240, /* NOP - This command is only used to mark the upper limit of the DO commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_PREFLIGHT_CALIBRATION=241, /* Trigger calibration. This command will be only accepted if in pre-flight mode. Except for Temperature Calibration, only one sensor should be set in a single message and all others should be zero. |1: gyro calibration, 3: gyro temperature calibration| 1: magnetometer calibration| 1: ground pressure calibration| 1: radio RC calibration, 2: RC trim calibration| 1: accelerometer calibration, 2: board level calibration, 3: accelerometer temperature calibration, 4: simple accelerometer calibration| 1: APM: compass/motor interference calibration (PX4: airspeed calibration, deprecated), 2: airspeed calibration| 1: ESC calibration, 3: barometer temperature calibration| */ - MAV_CMD_PREFLIGHT_SET_SENSOR_OFFSETS=242, /* Set sensor offsets. This command will be only accepted if in pre-flight mode. |Sensor to adjust the offsets for: 0: gyros, 1: accelerometer, 2: magnetometer, 3: barometer, 4: optical flow, 5: second magnetometer, 6: third magnetometer| X axis offset (or generic dimension 1), in the sensor's raw units| Y axis offset (or generic dimension 2), in the sensor's raw units| Z axis offset (or generic dimension 3), in the sensor's raw units| Generic dimension 4, in the sensor's raw units| Generic dimension 5, in the sensor's raw units| Generic dimension 6, in the sensor's raw units| */ - MAV_CMD_PREFLIGHT_UAVCAN=243, /* Trigger UAVCAN configuration (actuator ID assignment and direction mapping). Note that this maps to the legacy UAVCAN v0 function UAVCAN_ENUMERATE, which is intended to be executed just once during initial vehicle configuration (it is not a normal pre-flight command and has been poorly named). |1: Trigger actuator ID assignment and direction mapping. 0: Cancel command.| Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| */ - MAV_CMD_PREFLIGHT_STORAGE=245, /* Request storage of different parameter values and logs. This command will be only accepted if in pre-flight mode. |Parameter storage: 0: READ FROM FLASH/EEPROM, 1: WRITE CURRENT TO FLASH/EEPROM, 2: Reset to defaults| Mission storage: 0: READ FROM FLASH/EEPROM, 1: WRITE CURRENT TO FLASH/EEPROM, 2: Reset to defaults| Onboard logging: 0: Ignore, 1: Start default rate logging, -1: Stop logging, > 1: logging rate (e.g. set to 1000 for 1000 Hz logging)| Reserved| Empty| Empty| Empty| */ - MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN=246, /* Request the reboot or shutdown of system components. |0: Do nothing for autopilot, 1: Reboot autopilot, 2: Shutdown autopilot, 3: Reboot autopilot and keep it in the bootloader until upgraded.| 0: Do nothing for onboard computer, 1: Reboot onboard computer, 2: Shutdown onboard computer, 3: Reboot onboard computer and keep it in the bootloader until upgraded.| WIP: 0: Do nothing for camera, 1: Reboot onboard camera, 2: Shutdown onboard camera, 3: Reboot onboard camera and keep it in the bootloader until upgraded| WIP: 0: Do nothing for mount (e.g. gimbal), 1: Reboot mount, 2: Shutdown mount, 3: Reboot mount and keep it in the bootloader until upgraded| Reserved (set to 0)| Reserved (set to 0)| WIP: ID (e.g. camera ID -1 for all IDs)| */ - MAV_CMD_DO_UPGRADE=247, /* Request a target system to start an upgrade of one (or all) of its components. For example, the command might be sent to a companion computer to cause it to upgrade a connected flight controller. The system doing the upgrade will report progress using the normal command protocol sequence for a long running operation. Command protocol information: https://mavlink.io/en/services/command.html. |Component id of the component to be upgraded. If set to 0, all components should be upgraded.| 0: Do not reboot component after the action is executed, 1: Reboot component after the action is executed.| Reserved| Reserved| Reserved| Reserved| WIP: upgrade progress report rate (can be used for more granular control).| */ - MAV_CMD_OVERRIDE_GOTO=252, /* Override current mission with command to pause mission, pause mission and move to position, continue/resume mission. When param 1 indicates that the mission is paused (MAV_GOTO_DO_HOLD), param 2 defines whether it holds in place or moves to another position. |MAV_GOTO_DO_HOLD: pause mission and either hold or move to specified position (depending on param2), MAV_GOTO_DO_CONTINUE: resume mission.| MAV_GOTO_HOLD_AT_CURRENT_POSITION: hold at current position, MAV_GOTO_HOLD_AT_SPECIFIED_POSITION: hold at specified position.| Coordinate frame of hold point.| Desired yaw angle.| Latitude/X position.| Longitude/Y position.| Altitude/Z position.| */ - MAV_CMD_OBLIQUE_SURVEY=260, /* Mission command to set a Camera Auto Mount Pivoting Oblique Survey (Replaces CAM_TRIGG_DIST for this purpose). The camera is triggered each time this distance is exceeded, then the mount moves to the next position. Params 4~6 set-up the angle limits and number of positions for oblique survey, where mount-enabled vehicles automatically roll the camera between shots to emulate an oblique camera setup (providing an increased HFOV). This command can also be used to set the shutter integration time for the camera. |Camera trigger distance. 0 to stop triggering.| Camera shutter integration time. 0 to ignore| The minimum interval in which the camera is capable of taking subsequent pictures repeatedly. 0 to ignore.| Total number of roll positions at which the camera will capture photos (images captures spread evenly across the limits defined by param5).| Angle limits that the camera can be rolled to left and right of center.| Fixed pitch angle that the camera will hold in oblique mode if the mount is actuated in the pitch axis.| Empty| */ - MAV_CMD_MISSION_START=300, /* start running a mission |first_item: the first mission item to run| last_item: the last mission item to run (after this item is run, the mission ends)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_COMPONENT_ARM_DISARM=400, /* Arms / Disarms a component |0: disarm, 1: arm| 0: arm-disarm unless prevented by safety checks (i.e. when landed), 21196: force arming/disarming (e.g. allow arming to override preflight checks and disarming in flight)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_ILLUMINATOR_ON_OFF=405, /* Turns illuminators ON/OFF. An illuminator is a light source that is used for lighting up dark areas external to the sytstem: e.g. a torch or searchlight (as opposed to a light source for illuminating the system itself, e.g. an indicator light). |0: Illuminators OFF, 1: Illuminators ON| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_GET_HOME_POSITION=410, /* Request the home position from the vehicle. |Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| */ - MAV_CMD_INJECT_FAILURE=420, /* Inject artificial failure for testing purposes. Note that autopilots should implement an additional protection before accepting this command such as a specific param setting. |The unit which is affected by the failure.| The type how the failure manifests itself.| Instance affected by failure (0 to signal all).| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_START_RX_PAIR=500, /* Starts receiver pairing. |0:Spektrum.| RC type.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_GET_MESSAGE_INTERVAL=510, /* Request the interval between messages for a particular MAVLink message ID. The receiver should ACK the command and then emit its response in a MESSAGE_INTERVAL message. |The MAVLink message ID| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_SET_MESSAGE_INTERVAL=511, /* Set the interval between messages for a particular MAVLink message ID. This interface replaces REQUEST_DATA_STREAM. |The MAVLink message ID| The interval between two messages. Set to -1 to disable and 0 to request default rate.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Target address of message stream (if message has target address fields). 0: Flight-stack default (recommended), 1: address of requestor, 2: broadcast.| */ - MAV_CMD_REQUEST_MESSAGE=512, /* Request the target system(s) emit a single instance of a specified message (i.e. a "one-shot" version of MAV_CMD_SET_MESSAGE_INTERVAL). |The MAVLink message ID of the requested message.| Use for index ID, if required. Otherwise, the use of this parameter (if any) must be defined in the requested message. By default assumed not used (0).| The use of this parameter (if any), must be defined in the requested message. By default assumed not used (0).| The use of this parameter (if any), must be defined in the requested message. By default assumed not used (0).| The use of this parameter (if any), must be defined in the requested message. By default assumed not used (0).| The use of this parameter (if any), must be defined in the requested message. By default assumed not used (0).| Target address for requested message (if message has target address fields). 0: Flight-stack default, 1: address of requestor, 2: broadcast.| */ - MAV_CMD_REQUEST_PROTOCOL_VERSION=519, /* Request MAVLink protocol version compatibility. All receivers should ACK the command and then emit their capabilities in an PROTOCOL_VERSION message |1: Request supported protocol versions by all nodes on the network| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES=520, /* Request autopilot capabilities. The receiver should ACK the command and then emit its capabilities in an AUTOPILOT_VERSION message |1: Request autopilot version| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_CAMERA_INFORMATION=521, /* Request camera information (CAMERA_INFORMATION). |0: No action 1: Request camera capabilities| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_CAMERA_SETTINGS=522, /* Request camera settings (CAMERA_SETTINGS). |0: No Action 1: Request camera settings| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_STORAGE_INFORMATION=525, /* Request storage information (STORAGE_INFORMATION). Use the command's target_component to target a specific component's storage. |Storage ID (0 for all, 1 for first, 2 for second, etc.)| 0: No Action 1: Request storage information| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_STORAGE_FORMAT=526, /* Format a storage medium. Once format is complete, a STORAGE_INFORMATION message is sent. Use the command's target_component to target a specific component's storage. |Storage ID (1 for first, 2 for second, etc.)| Format storage (and reset image log). 0: No action 1: Format storage| Reset Image Log (without formatting storage medium). This will reset CAMERA_CAPTURE_STATUS.image_count and CAMERA_IMAGE_CAPTURED.image_index. 0: No action 1: Reset Image Log| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_CAMERA_CAPTURE_STATUS=527, /* Request camera capture status (CAMERA_CAPTURE_STATUS) |0: No Action 1: Request camera capture status| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_FLIGHT_INFORMATION=528, /* Request flight information (FLIGHT_INFORMATION) |1: Request flight information| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_RESET_CAMERA_SETTINGS=529, /* Reset all camera settings to Factory Default |0: No Action 1: Reset all settings| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_SET_CAMERA_MODE=530, /* Set camera running mode. Use NaN for reserved values. GCS will send a MAV_CMD_REQUEST_VIDEO_STREAM_STATUS command after a mode change if the camera supports video streaming. |Reserved (Set to 0)| Camera mode| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ - MAV_CMD_SET_CAMERA_ZOOM=531, /* Set camera zoom. Camera must respond with a CAMERA_SETTINGS message (on success). |Zoom type| Zoom value. The range of valid values depend on the zoom type.| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ - MAV_CMD_SET_CAMERA_FOCUS=532, /* Set camera focus. Camera must respond with a CAMERA_SETTINGS message (on success). |Focus type| Focus value| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ - MAV_CMD_JUMP_TAG=600, /* Tagged jump target. Can be jumped to with MAV_CMD_DO_JUMP_TAG. |Tag.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_DO_JUMP_TAG=601, /* Jump to the matching tag in the mission list. Repeat this action for the specified number of times. A mission should contain a single matching tag for each jump. If this is not the case then a jump to a missing tag should complete the mission, and a jump where there are multiple matching tags should always select the one with the lowest mission sequence number. |Target tag to jump to.| Repeat count.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_PARAM_TRANSACTION=900, /* Request to start or end a parameter transaction. Multiple kinds of transport layers can be used to exchange parameters in the transaction (param, param_ext and mavftp). The command response can either be a success/failure or an in progress in case the receiving side takes some time to apply the parameters. |Action to be performed (start, commit, cancel, etc.)| Possible transport layers to set and get parameters via mavlink during a parameter transaction.| Identifier for a specific transaction.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_DO_GIMBAL_MANAGER_PITCHYAW=1000, /* High level setpoint to be sent to a gimbal manager to set a gimbal attitude. It is possible to set combinations of the values below. E.g. an angle as well as a desired angular rate can be used to get to this angle at a certain angular rate, or an angular rate only will result in continuous turning. NaN is to be used to signal unset. Note: a gimbal is never to react to this command but only the gimbal manager. |Pitch angle (positive to pitch up, relative to vehicle for FOLLOW mode, relative to world horizon for LOCK mode).| Yaw angle (positive to yaw to the right, relative to vehicle for FOLLOW mode, absolute to North for LOCK mode).| Pitch rate (positive to pitch up).| Yaw rate (positive to yaw to the right).| Gimbal manager flags to use.| Reserved (default:0)| Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| */ - MAV_CMD_DO_GIMBAL_MANAGER_CONFIGURE=1001, /* Gimbal configuration to set which sysid/compid is in primary and secondary control. |Sysid for primary control (0: no one in control, -1: leave unchanged, -2: set itself in control (for missions where the own sysid is still unknown), -3: remove control if currently in control).| Compid for primary control (0: no one in control, -1: leave unchanged, -2: set itself in control (for missions where the own sysid is still unknown), -3: remove control if currently in control).| Sysid for secondary control (0: no one in control, -1: leave unchanged, -2: set itself in control (for missions where the own sysid is still unknown), -3: remove control if currently in control).| Compid for secondary control (0: no one in control, -1: leave unchanged, -2: set itself in control (for missions where the own sysid is still unknown), -3: remove control if currently in control).| Reserved (default:0)| Reserved (default:0)| Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| */ - MAV_CMD_IMAGE_START_CAPTURE=2000, /* Start image capture sequence. Sends CAMERA_IMAGE_CAPTURED after each capture. Use NaN for reserved values. |Reserved (Set to 0)| Desired elapsed time between two consecutive pictures (in seconds). Minimum values depend on hardware (typically greater than 2 seconds).| Total number of images to capture. 0 to capture forever/until MAV_CMD_IMAGE_STOP_CAPTURE.| Capture sequence number starting from 1. This is only valid for single-capture (param3 == 1), otherwise set to 0. Increment the capture ID for each capture command to prevent double captures when a command is re-transmitted.| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| */ - MAV_CMD_IMAGE_STOP_CAPTURE=2001, /* Stop image capture sequence Use NaN for reserved values. |Reserved (Set to 0)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ - MAV_CMD_REQUEST_CAMERA_IMAGE_CAPTURE=2002, /* Re-request a CAMERA_IMAGE_CAPTURED message. |Sequence number for missing CAMERA_IMAGE_CAPTURED message| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ - MAV_CMD_DO_TRIGGER_CONTROL=2003, /* Enable or disable on-board camera triggering system. |Trigger enable/disable (0 for disable, 1 for start), -1 to ignore| 1 to reset the trigger sequence, -1 or 0 to ignore| 1 to pause triggering, but without switching the camera off or retracting it. -1 to ignore| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_CAMERA_TRACK_POINT=2004, /* If the camera supports point visual tracking (CAMERA_CAP_FLAGS_HAS_TRACKING_POINT is set), this command allows to initiate the tracking. |Point to track x value (normalized 0..1, 0 is left, 1 is right).| Point to track y value (normalized 0..1, 0 is top, 1 is bottom).| Point radius (normalized 0..1, 0 is image left, 1 is image right).| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_CAMERA_TRACK_RECTANGLE=2005, /* If the camera supports rectangle visual tracking (CAMERA_CAP_FLAGS_HAS_TRACKING_RECTANGLE is set), this command allows to initiate the tracking. |Top left corner of rectangle x value (normalized 0..1, 0 is left, 1 is right).| Top left corner of rectangle y value (normalized 0..1, 0 is top, 1 is bottom).| Bottom right corner of rectangle x value (normalized 0..1, 0 is left, 1 is right).| Bottom right corner of rectangle y value (normalized 0..1, 0 is top, 1 is bottom).| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_CAMERA_STOP_TRACKING=2010, /* Stops ongoing tracking. |Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_VIDEO_START_CAPTURE=2500, /* Starts video capture (recording). |Video Stream ID (0 for all streams)| Frequency CAMERA_CAPTURE_STATUS messages should be sent while recording (0 for no messages, otherwise frequency)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| */ - MAV_CMD_VIDEO_STOP_CAPTURE=2501, /* Stop the current video capture (recording). |Video Stream ID (0 for all streams)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| */ - MAV_CMD_VIDEO_START_STREAMING=2502, /* Start video streaming |Video Stream ID (0 for all streams, 1 for first, 2 for second, etc.)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_VIDEO_STOP_STREAMING=2503, /* Stop the given video stream |Video Stream ID (0 for all streams, 1 for first, 2 for second, etc.)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_VIDEO_STREAM_INFORMATION=2504, /* Request video stream information (VIDEO_STREAM_INFORMATION) |Video Stream ID (0 for all streams, 1 for first, 2 for second, etc.)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_VIDEO_STREAM_STATUS=2505, /* Request video stream status (VIDEO_STREAM_STATUS) |Video Stream ID (0 for all streams, 1 for first, 2 for second, etc.)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_LOGGING_START=2510, /* Request to start streaming logging data over MAVLink (see also LOGGING_DATA message) |Format: 0: ULog| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| */ - MAV_CMD_LOGGING_STOP=2511, /* Request to stop streaming log data over MAVLink |Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| */ - MAV_CMD_AIRFRAME_CONFIGURATION=2520, /* |Landing gear ID (default: 0, -1 for all)| Landing gear position (Down: 0, Up: 1, NaN for no change)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| */ - MAV_CMD_CONTROL_HIGH_LATENCY=2600, /* Request to start/stop transmitting over the high latency telemetry |Control transmission over high latency telemetry (0: stop, 1: start)| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_PANORAMA_CREATE=2800, /* Create a panorama at the current position |Viewing angle horizontal of the panorama (+- 0.5 the total angle)| Viewing angle vertical of panorama.| Speed of the horizontal rotation.| Speed of the vertical rotation.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_DO_VTOL_TRANSITION=3000, /* Request VTOL transition |The target VTOL state. Only MAV_VTOL_STATE_MC and MAV_VTOL_STATE_FW can be used.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_ARM_AUTHORIZATION_REQUEST=3001, /* Request authorization to arm the vehicle to a external entity, the arm authorizer is responsible to request all data that is needs from the vehicle before authorize or deny the request. If approved the progress of command_ack message should be set with period of time that this authorization is valid in seconds or in case it was denied it should be set with one of the reasons in ARM_AUTH_DENIED_REASON. - |Vehicle system id, this way ground station can request arm authorization on behalf of any vehicle| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_SET_GUIDED_SUBMODE_STANDARD=4000, /* This command sets the submode to standard guided when vehicle is in guided mode. The vehicle holds position and altitude and the user can input the desired velocities along all three axes. - |Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_SET_GUIDED_SUBMODE_CIRCLE=4001, /* This command sets submode circle when vehicle is in guided mode. Vehicle flies along a circle facing the center of the circle. The user can input the velocity along the circle and change the radius. If no input is given the vehicle will hold position. - |Radius of desired circle in CIRCLE_MODE| User defined| User defined| User defined| Target latitude of center of circle in CIRCLE_MODE| Target longitude of center of circle in CIRCLE_MODE| Reserved (default:0)| */ - MAV_CMD_CONDITION_GATE=4501, /* Delay mission state machine until gate has been reached. |Geometry: 0: orthogonal to path between previous and next waypoint.| Altitude: 0: ignore altitude| Empty| Empty| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_FENCE_RETURN_POINT=5000, /* Fence return point. There can only be one fence return point. - |Reserved| Reserved| Reserved| Reserved| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_FENCE_POLYGON_VERTEX_INCLUSION=5001, /* Fence vertex for an inclusion polygon (the polygon must not be self-intersecting). The vehicle must stay within this area. Minimum of 3 vertices required. - |Polygon vertex count| Vehicle must be inside ALL inclusion zones in a single group, vehicle must be inside at least one group, must be the same for all points in each polygon| Reserved| Reserved| Latitude| Longitude| Reserved| */ - MAV_CMD_NAV_FENCE_POLYGON_VERTEX_EXCLUSION=5002, /* Fence vertex for an exclusion polygon (the polygon must not be self-intersecting). The vehicle must stay outside this area. Minimum of 3 vertices required. - |Polygon vertex count| Reserved| Reserved| Reserved| Latitude| Longitude| Reserved| */ - MAV_CMD_NAV_FENCE_CIRCLE_INCLUSION=5003, /* Circular fence area. The vehicle must stay inside this area. - |Radius.| Vehicle must be inside ALL inclusion zones in a single group, vehicle must be inside at least one group| Reserved| Reserved| Latitude| Longitude| Reserved| */ - MAV_CMD_NAV_FENCE_CIRCLE_EXCLUSION=5004, /* Circular fence area. The vehicle must stay outside this area. - |Radius.| Reserved| Reserved| Reserved| Latitude| Longitude| Reserved| */ - MAV_CMD_NAV_RALLY_POINT=5100, /* Rally point. You can have multiple rally points defined. - |Reserved| Reserved| Reserved| Reserved| Latitude| Longitude| Altitude| */ - MAV_CMD_UAVCAN_GET_NODE_INFO=5200, /* Commands the vehicle to respond with a sequence of messages UAVCAN_NODE_INFO, one message per every UAVCAN node that is online. Note that some of the response messages can be lost, which the receiver can detect easily by checking whether every received UAVCAN_NODE_STATUS has a matching message UAVCAN_NODE_INFO received earlier; if not, this command should be sent again in order to request re-transmission of the node information messages. |Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| */ - MAV_CMD_PAYLOAD_PREPARE_DEPLOY=30001, /* Deploy payload on a Lat / Lon / Alt position. This includes the navigation to reach the required release position and velocity. |Operation mode. 0: prepare single payload deploy (overwriting previous requests), but do not execute it. 1: execute payload deploy immediately (rejecting further deploy commands during execution, but allowing abort). 2: add payload deploy to existing deployment list.| Desired approach vector in compass heading. A negative value indicates the system can define the approach vector at will.| Desired ground speed at release time. This can be overridden by the airframe in case it needs to meet minimum airspeed. A negative value indicates the system can define the ground speed at will.| Minimum altitude clearance to the release position. A negative value indicates the system can define the clearance at will.| Latitude. Note, if used in MISSION_ITEM (deprecated) the units are degrees (unscaled)| Longitude. Note, if used in MISSION_ITEM (deprecated) the units are degrees (unscaled)| Altitude (MSL)| */ - MAV_CMD_PAYLOAD_CONTROL_DEPLOY=30002, /* Control the payload deployment. |Operation mode. 0: Abort deployment, continue normal mission. 1: switch to payload deployment mode. 100: delete first payload deployment request. 101: delete all payload deployment requests.| Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| */ - MAV_CMD_WAYPOINT_USER_1=31000, /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_WAYPOINT_USER_2=31001, /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_WAYPOINT_USER_3=31002, /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_WAYPOINT_USER_4=31003, /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_WAYPOINT_USER_5=31004, /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_SPATIAL_USER_1=31005, /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_SPATIAL_USER_2=31006, /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_SPATIAL_USER_3=31007, /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_SPATIAL_USER_4=31008, /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_SPATIAL_USER_5=31009, /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_USER_1=31010, /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ - MAV_CMD_USER_2=31011, /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ - MAV_CMD_USER_3=31012, /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ - MAV_CMD_USER_4=31013, /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ - MAV_CMD_USER_5=31014, /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ - MAV_CMD_FIXED_MAG_CAL_YAW=42006, /* Magnetometer calibration based on provided known yaw. This allows for fast calibration using WMM field tables in the vehicle, given only the known yaw of the vehicle. If Latitude and longitude are both zero then use the current vehicle location. |Yaw of vehicle in earth frame.| CompassMask, 0 for all.| Latitude.| Longitude.| Empty.| Empty.| Empty.| */ - MAV_CMD_DO_WINCH=42600, /* Command to operate winch. |Winch instance number.| Action to perform.| Length of cable to release (negative to wind).| Release rate (negative to wind).| Empty.| Empty.| Empty.| */ - MAV_CMD_ENUM_END=42601, /* | */ -} MAV_CMD; -#endif - -/** @brief A data stream is not a fixed set of messages, but rather a - recommendation to the autopilot software. Individual autopilots may or may not obey - the recommended messages. */ -#ifndef HAVE_ENUM_MAV_DATA_STREAM -#define HAVE_ENUM_MAV_DATA_STREAM -typedef enum MAV_DATA_STREAM -{ - MAV_DATA_STREAM_ALL=0, /* Enable all data streams | */ - MAV_DATA_STREAM_RAW_SENSORS=1, /* Enable IMU_RAW, GPS_RAW, GPS_STATUS packets. | */ - MAV_DATA_STREAM_EXTENDED_STATUS=2, /* Enable GPS_STATUS, CONTROL_STATUS, AUX_STATUS | */ - MAV_DATA_STREAM_RC_CHANNELS=3, /* Enable RC_CHANNELS_SCALED, RC_CHANNELS_RAW, SERVO_OUTPUT_RAW | */ - MAV_DATA_STREAM_RAW_CONTROLLER=4, /* Enable ATTITUDE_CONTROLLER_OUTPUT, POSITION_CONTROLLER_OUTPUT, NAV_CONTROLLER_OUTPUT. | */ - MAV_DATA_STREAM_POSITION=6, /* Enable LOCAL_POSITION, GLOBAL_POSITION/GLOBAL_POSITION_INT messages. | */ - MAV_DATA_STREAM_EXTRA1=10, /* Dependent on the autopilot | */ - MAV_DATA_STREAM_EXTRA2=11, /* Dependent on the autopilot | */ - MAV_DATA_STREAM_EXTRA3=12, /* Dependent on the autopilot | */ - MAV_DATA_STREAM_PROPULSION=13, /* Motor/ESC telemetry data. | */ - MAV_DATA_STREAM_ENUM_END=14, /* | */ -} MAV_DATA_STREAM; -#endif - -// MAVLINK VERSION - -#ifndef MAVLINK_VERSION -#define MAVLINK_VERSION 3 -#endif - -#if (MAVLINK_VERSION == 0) -#undef MAVLINK_VERSION -#define MAVLINK_VERSION 3 -#endif - -// MESSAGE DEFINITIONS -#include "./mavlink_msg_aq_telemetry_f.h" -#include "./mavlink_msg_aq_esc_telemetry.h" - -// base include -#include "../common/common.h" - -#undef MAVLINK_THIS_XML_IDX -#define MAVLINK_THIS_XML_IDX 0 - -#if MAVLINK_THIS_XML_IDX == MAVLINK_PRIMARY_XML_IDX -# define MAVLINK_MESSAGE_INFO {MAVLINK_MESSAGE_INFO_HEARTBEAT, MAVLINK_MESSAGE_INFO_SYS_STATUS, MAVLINK_MESSAGE_INFO_SYSTEM_TIME, MAVLINK_MESSAGE_INFO_PING, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL_ACK, MAVLINK_MESSAGE_INFO_AUTH_KEY, MAVLINK_MESSAGE_INFO_LINK_NODE_STATUS, MAVLINK_MESSAGE_INFO_SET_MODE, MAVLINK_MESSAGE_INFO_PARAM_ACK_TRANSACTION, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_READ, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_LIST, MAVLINK_MESSAGE_INFO_PARAM_VALUE, MAVLINK_MESSAGE_INFO_PARAM_SET, MAVLINK_MESSAGE_INFO_GPS_RAW_INT, MAVLINK_MESSAGE_INFO_GPS_STATUS, MAVLINK_MESSAGE_INFO_SCALED_IMU, MAVLINK_MESSAGE_INFO_RAW_IMU, MAVLINK_MESSAGE_INFO_RAW_PRESSURE, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE, MAVLINK_MESSAGE_INFO_ATTITUDE, MAVLINK_MESSAGE_INFO_ATTITUDE_QUATERNION, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT, MAVLINK_MESSAGE_INFO_RC_CHANNELS_SCALED, MAVLINK_MESSAGE_INFO_RC_CHANNELS_RAW, MAVLINK_MESSAGE_INFO_SERVO_OUTPUT_RAW, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_PARTIAL_LIST, MAVLINK_MESSAGE_INFO_MISSION_WRITE_PARTIAL_LIST, MAVLINK_MESSAGE_INFO_MISSION_ITEM, MAVLINK_MESSAGE_INFO_MISSION_REQUEST, MAVLINK_MESSAGE_INFO_MISSION_SET_CURRENT, MAVLINK_MESSAGE_INFO_MISSION_CURRENT, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_LIST, MAVLINK_MESSAGE_INFO_MISSION_COUNT, MAVLINK_MESSAGE_INFO_MISSION_CLEAR_ALL, MAVLINK_MESSAGE_INFO_MISSION_ITEM_REACHED, MAVLINK_MESSAGE_INFO_MISSION_ACK, MAVLINK_MESSAGE_INFO_SET_GPS_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_GPS_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_PARAM_MAP_RC, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_INT, MAVLINK_MESSAGE_INFO_MISSION_CHANGED, MAVLINK_MESSAGE_INFO_SAFETY_SET_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_SAFETY_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_ATTITUDE_QUATERNION_COV, MAVLINK_MESSAGE_INFO_NAV_CONTROLLER_OUTPUT, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT_COV, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED_COV, MAVLINK_MESSAGE_INFO_RC_CHANNELS, MAVLINK_MESSAGE_INFO_REQUEST_DATA_STREAM, MAVLINK_MESSAGE_INFO_DATA_STREAM, MAVLINK_MESSAGE_INFO_MANUAL_CONTROL, MAVLINK_MESSAGE_INFO_RC_CHANNELS_OVERRIDE, MAVLINK_MESSAGE_INFO_MISSION_ITEM_INT, MAVLINK_MESSAGE_INFO_VFR_HUD, MAVLINK_MESSAGE_INFO_COMMAND_INT, MAVLINK_MESSAGE_INFO_COMMAND_LONG, MAVLINK_MESSAGE_INFO_COMMAND_ACK, MAVLINK_MESSAGE_INFO_COMMAND_CANCEL, MAVLINK_MESSAGE_INFO_MANUAL_SETPOINT, MAVLINK_MESSAGE_INFO_SET_ATTITUDE_TARGET, MAVLINK_MESSAGE_INFO_ATTITUDE_TARGET, MAVLINK_MESSAGE_INFO_SET_POSITION_TARGET_LOCAL_NED, MAVLINK_MESSAGE_INFO_POSITION_TARGET_LOCAL_NED, MAVLINK_MESSAGE_INFO_SET_POSITION_TARGET_GLOBAL_INT, MAVLINK_MESSAGE_INFO_POSITION_TARGET_GLOBAL_INT, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET, MAVLINK_MESSAGE_INFO_HIL_STATE, MAVLINK_MESSAGE_INFO_HIL_CONTROLS, MAVLINK_MESSAGE_INFO_HIL_RC_INPUTS_RAW, MAVLINK_MESSAGE_INFO_HIL_ACTUATOR_CONTROLS, MAVLINK_MESSAGE_INFO_OPTICAL_FLOW, MAVLINK_MESSAGE_INFO_GLOBAL_VISION_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_VISION_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_VISION_SPEED_ESTIMATE, MAVLINK_MESSAGE_INFO_VICON_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_HIGHRES_IMU, MAVLINK_MESSAGE_INFO_OPTICAL_FLOW_RAD, MAVLINK_MESSAGE_INFO_HIL_SENSOR, MAVLINK_MESSAGE_INFO_SIM_STATE, MAVLINK_MESSAGE_INFO_RADIO_STATUS, MAVLINK_MESSAGE_INFO_FILE_TRANSFER_PROTOCOL, MAVLINK_MESSAGE_INFO_TIMESYNC, MAVLINK_MESSAGE_INFO_CAMERA_TRIGGER, MAVLINK_MESSAGE_INFO_HIL_GPS, MAVLINK_MESSAGE_INFO_HIL_OPTICAL_FLOW, MAVLINK_MESSAGE_INFO_HIL_STATE_QUATERNION, MAVLINK_MESSAGE_INFO_SCALED_IMU2, MAVLINK_MESSAGE_INFO_LOG_REQUEST_LIST, MAVLINK_MESSAGE_INFO_LOG_ENTRY, MAVLINK_MESSAGE_INFO_LOG_REQUEST_DATA, MAVLINK_MESSAGE_INFO_LOG_DATA, MAVLINK_MESSAGE_INFO_LOG_ERASE, MAVLINK_MESSAGE_INFO_LOG_REQUEST_END, MAVLINK_MESSAGE_INFO_GPS_INJECT_DATA, MAVLINK_MESSAGE_INFO_GPS2_RAW, MAVLINK_MESSAGE_INFO_POWER_STATUS, MAVLINK_MESSAGE_INFO_SERIAL_CONTROL, MAVLINK_MESSAGE_INFO_GPS_RTK, MAVLINK_MESSAGE_INFO_GPS2_RTK, MAVLINK_MESSAGE_INFO_SCALED_IMU3, MAVLINK_MESSAGE_INFO_DATA_TRANSMISSION_HANDSHAKE, MAVLINK_MESSAGE_INFO_ENCAPSULATED_DATA, MAVLINK_MESSAGE_INFO_DISTANCE_SENSOR, MAVLINK_MESSAGE_INFO_TERRAIN_REQUEST, MAVLINK_MESSAGE_INFO_TERRAIN_DATA, MAVLINK_MESSAGE_INFO_TERRAIN_CHECK, MAVLINK_MESSAGE_INFO_TERRAIN_REPORT, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE2, MAVLINK_MESSAGE_INFO_ATT_POS_MOCAP, MAVLINK_MESSAGE_INFO_SET_ACTUATOR_CONTROL_TARGET, MAVLINK_MESSAGE_INFO_ACTUATOR_CONTROL_TARGET, MAVLINK_MESSAGE_INFO_ALTITUDE, MAVLINK_MESSAGE_INFO_RESOURCE_REQUEST, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE3, MAVLINK_MESSAGE_INFO_FOLLOW_TARGET, MAVLINK_MESSAGE_INFO_CONTROL_SYSTEM_STATE, MAVLINK_MESSAGE_INFO_BATTERY_STATUS, MAVLINK_MESSAGE_INFO_AUTOPILOT_VERSION, MAVLINK_MESSAGE_INFO_LANDING_TARGET, MAVLINK_MESSAGE_INFO_AQ_TELEMETRY_F, MAVLINK_MESSAGE_INFO_AQ_ESC_TELEMETRY, MAVLINK_MESSAGE_INFO_FENCE_STATUS, MAVLINK_MESSAGE_INFO_MAG_CAL_REPORT, MAVLINK_MESSAGE_INFO_EFI_STATUS, MAVLINK_MESSAGE_INFO_ESTIMATOR_STATUS, MAVLINK_MESSAGE_INFO_WIND_COV, MAVLINK_MESSAGE_INFO_GPS_INPUT, MAVLINK_MESSAGE_INFO_GPS_RTCM_DATA, MAVLINK_MESSAGE_INFO_HIGH_LATENCY, MAVLINK_MESSAGE_INFO_HIGH_LATENCY2, MAVLINK_MESSAGE_INFO_VIBRATION, MAVLINK_MESSAGE_INFO_HOME_POSITION, MAVLINK_MESSAGE_INFO_SET_HOME_POSITION, MAVLINK_MESSAGE_INFO_MESSAGE_INTERVAL, MAVLINK_MESSAGE_INFO_EXTENDED_SYS_STATE, MAVLINK_MESSAGE_INFO_ADSB_VEHICLE, MAVLINK_MESSAGE_INFO_COLLISION, MAVLINK_MESSAGE_INFO_V2_EXTENSION, MAVLINK_MESSAGE_INFO_MEMORY_VECT, MAVLINK_MESSAGE_INFO_DEBUG_VECT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_FLOAT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_INT, MAVLINK_MESSAGE_INFO_STATUSTEXT, MAVLINK_MESSAGE_INFO_DEBUG, MAVLINK_MESSAGE_INFO_SETUP_SIGNING, MAVLINK_MESSAGE_INFO_BUTTON_CHANGE, MAVLINK_MESSAGE_INFO_PLAY_TUNE, MAVLINK_MESSAGE_INFO_CAMERA_INFORMATION, MAVLINK_MESSAGE_INFO_CAMERA_SETTINGS, MAVLINK_MESSAGE_INFO_STORAGE_INFORMATION, MAVLINK_MESSAGE_INFO_CAMERA_CAPTURE_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_IMAGE_CAPTURED, MAVLINK_MESSAGE_INFO_FLIGHT_INFORMATION, MAVLINK_MESSAGE_INFO_MOUNT_ORIENTATION, MAVLINK_MESSAGE_INFO_LOGGING_DATA, MAVLINK_MESSAGE_INFO_LOGGING_DATA_ACKED, MAVLINK_MESSAGE_INFO_LOGGING_ACK, MAVLINK_MESSAGE_INFO_VIDEO_STREAM_INFORMATION, MAVLINK_MESSAGE_INFO_VIDEO_STREAM_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_FOV_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_TRACKING_IMAGE_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_TRACKING_GEO_STATUS, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_INFORMATION, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_STATUS, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_SET_ATTITUDE, MAVLINK_MESSAGE_INFO_GIMBAL_DEVICE_INFORMATION, MAVLINK_MESSAGE_INFO_GIMBAL_DEVICE_SET_ATTITUDE, MAVLINK_MESSAGE_INFO_GIMBAL_DEVICE_ATTITUDE_STATUS, MAVLINK_MESSAGE_INFO_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_SET_PITCHYAW, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_SET_MANUAL_CONTROL, MAVLINK_MESSAGE_INFO_ESC_INFO, MAVLINK_MESSAGE_INFO_ESC_STATUS, MAVLINK_MESSAGE_INFO_WIFI_CONFIG_AP, MAVLINK_MESSAGE_INFO_PROTOCOL_VERSION, MAVLINK_MESSAGE_INFO_AIS_VESSEL, MAVLINK_MESSAGE_INFO_UAVCAN_NODE_STATUS, MAVLINK_MESSAGE_INFO_UAVCAN_NODE_INFO, MAVLINK_MESSAGE_INFO_PARAM_EXT_REQUEST_READ, MAVLINK_MESSAGE_INFO_PARAM_EXT_REQUEST_LIST, MAVLINK_MESSAGE_INFO_PARAM_EXT_VALUE, MAVLINK_MESSAGE_INFO_PARAM_EXT_SET, MAVLINK_MESSAGE_INFO_PARAM_EXT_ACK, MAVLINK_MESSAGE_INFO_OBSTACLE_DISTANCE, MAVLINK_MESSAGE_INFO_ODOMETRY, MAVLINK_MESSAGE_INFO_TRAJECTORY_REPRESENTATION_WAYPOINTS, MAVLINK_MESSAGE_INFO_TRAJECTORY_REPRESENTATION_BEZIER, MAVLINK_MESSAGE_INFO_CELLULAR_STATUS, MAVLINK_MESSAGE_INFO_ISBD_LINK_STATUS, MAVLINK_MESSAGE_INFO_CELLULAR_CONFIG, MAVLINK_MESSAGE_INFO_RAW_RPM, MAVLINK_MESSAGE_INFO_UTM_GLOBAL_POSITION, MAVLINK_MESSAGE_INFO_DEBUG_FLOAT_ARRAY, MAVLINK_MESSAGE_INFO_ORBIT_EXECUTION_STATUS, MAVLINK_MESSAGE_INFO_SMART_BATTERY_INFO, MAVLINK_MESSAGE_INFO_GENERATOR_STATUS, MAVLINK_MESSAGE_INFO_ACTUATOR_OUTPUT_STATUS, MAVLINK_MESSAGE_INFO_TIME_ESTIMATE_TO_TARGET, MAVLINK_MESSAGE_INFO_TUNNEL, MAVLINK_MESSAGE_INFO_ONBOARD_COMPUTER_STATUS, MAVLINK_MESSAGE_INFO_COMPONENT_INFORMATION, MAVLINK_MESSAGE_INFO_PLAY_TUNE_V2, MAVLINK_MESSAGE_INFO_SUPPORTED_TUNES, MAVLINK_MESSAGE_INFO_WHEEL_DISTANCE, MAVLINK_MESSAGE_INFO_WINCH_STATUS, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_BASIC_ID, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_LOCATION, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_AUTHENTICATION, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_SELF_ID, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_SYSTEM, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_OPERATOR_ID, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_MESSAGE_PACK} -# define MAVLINK_MESSAGE_NAMES {{ "ACTUATOR_CONTROL_TARGET", 140 }, { "ACTUATOR_OUTPUT_STATUS", 375 }, { "ADSB_VEHICLE", 246 }, { "AIS_VESSEL", 301 }, { "ALTITUDE", 141 }, { "AQ_ESC_TELEMETRY", 152 }, { "AQ_TELEMETRY_F", 150 }, { "ATTITUDE", 30 }, { "ATTITUDE_QUATERNION", 31 }, { "ATTITUDE_QUATERNION_COV", 61 }, { "ATTITUDE_TARGET", 83 }, { "ATT_POS_MOCAP", 138 }, { "AUTH_KEY", 7 }, { "AUTOPILOT_STATE_FOR_GIMBAL_DEVICE", 286 }, { "AUTOPILOT_VERSION", 148 }, { "BATTERY_STATUS", 147 }, { "BUTTON_CHANGE", 257 }, { "CAMERA_CAPTURE_STATUS", 262 }, { "CAMERA_FOV_STATUS", 271 }, { "CAMERA_IMAGE_CAPTURED", 263 }, { "CAMERA_INFORMATION", 259 }, { "CAMERA_SETTINGS", 260 }, { "CAMERA_TRACKING_GEO_STATUS", 276 }, { "CAMERA_TRACKING_IMAGE_STATUS", 275 }, { "CAMERA_TRIGGER", 112 }, { "CELLULAR_CONFIG", 336 }, { "CELLULAR_STATUS", 334 }, { "CHANGE_OPERATOR_CONTROL", 5 }, { "CHANGE_OPERATOR_CONTROL_ACK", 6 }, { "COLLISION", 247 }, { "COMMAND_ACK", 77 }, { "COMMAND_CANCEL", 80 }, { "COMMAND_INT", 75 }, { "COMMAND_LONG", 76 }, { "COMPONENT_INFORMATION", 395 }, { "CONTROL_SYSTEM_STATE", 146 }, { "DATA_STREAM", 67 }, { "DATA_TRANSMISSION_HANDSHAKE", 130 }, { "DEBUG", 254 }, { "DEBUG_FLOAT_ARRAY", 350 }, { "DEBUG_VECT", 250 }, { "DISTANCE_SENSOR", 132 }, { "EFI_STATUS", 225 }, { "ENCAPSULATED_DATA", 131 }, { "ESC_INFO", 290 }, { "ESC_STATUS", 291 }, { "ESTIMATOR_STATUS", 230 }, { "EXTENDED_SYS_STATE", 245 }, { "FENCE_STATUS", 162 }, { "FILE_TRANSFER_PROTOCOL", 110 }, { "FLIGHT_INFORMATION", 264 }, { "FOLLOW_TARGET", 144 }, { "GENERATOR_STATUS", 373 }, { "GIMBAL_DEVICE_ATTITUDE_STATUS", 285 }, { "GIMBAL_DEVICE_INFORMATION", 283 }, { "GIMBAL_DEVICE_SET_ATTITUDE", 284 }, { "GIMBAL_MANAGER_INFORMATION", 280 }, { "GIMBAL_MANAGER_SET_ATTITUDE", 282 }, { "GIMBAL_MANAGER_SET_MANUAL_CONTROL", 288 }, { "GIMBAL_MANAGER_SET_PITCHYAW", 287 }, { "GIMBAL_MANAGER_STATUS", 281 }, { "GLOBAL_POSITION_INT", 33 }, { "GLOBAL_POSITION_INT_COV", 63 }, { "GLOBAL_VISION_POSITION_ESTIMATE", 101 }, { "GPS2_RAW", 124 }, { "GPS2_RTK", 128 }, { "GPS_GLOBAL_ORIGIN", 49 }, { "GPS_INJECT_DATA", 123 }, { "GPS_INPUT", 232 }, { "GPS_RAW_INT", 24 }, { "GPS_RTCM_DATA", 233 }, { "GPS_RTK", 127 }, { "GPS_STATUS", 25 }, { "HEARTBEAT", 0 }, { "HIGHRES_IMU", 105 }, { "HIGH_LATENCY", 234 }, { "HIGH_LATENCY2", 235 }, { "HIL_ACTUATOR_CONTROLS", 93 }, { "HIL_CONTROLS", 91 }, { "HIL_GPS", 113 }, { "HIL_OPTICAL_FLOW", 114 }, { "HIL_RC_INPUTS_RAW", 92 }, { "HIL_SENSOR", 107 }, { "HIL_STATE", 90 }, { "HIL_STATE_QUATERNION", 115 }, { "HOME_POSITION", 242 }, { "ISBD_LINK_STATUS", 335 }, { "LANDING_TARGET", 149 }, { "LINK_NODE_STATUS", 8 }, { "LOCAL_POSITION_NED", 32 }, { "LOCAL_POSITION_NED_COV", 64 }, { "LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET", 89 }, { "LOGGING_ACK", 268 }, { "LOGGING_DATA", 266 }, { "LOGGING_DATA_ACKED", 267 }, { "LOG_DATA", 120 }, { "LOG_ENTRY", 118 }, { "LOG_ERASE", 121 }, { "LOG_REQUEST_DATA", 119 }, { "LOG_REQUEST_END", 122 }, { "LOG_REQUEST_LIST", 117 }, { "MAG_CAL_REPORT", 192 }, { "MANUAL_CONTROL", 69 }, { "MANUAL_SETPOINT", 81 }, { "MEMORY_VECT", 249 }, { "MESSAGE_INTERVAL", 244 }, { "MISSION_ACK", 47 }, { "MISSION_CHANGED", 52 }, { "MISSION_CLEAR_ALL", 45 }, { "MISSION_COUNT", 44 }, { "MISSION_CURRENT", 42 }, { "MISSION_ITEM", 39 }, { "MISSION_ITEM_INT", 73 }, { "MISSION_ITEM_REACHED", 46 }, { "MISSION_REQUEST", 40 }, { "MISSION_REQUEST_INT", 51 }, { "MISSION_REQUEST_LIST", 43 }, { "MISSION_REQUEST_PARTIAL_LIST", 37 }, { "MISSION_SET_CURRENT", 41 }, { "MISSION_WRITE_PARTIAL_LIST", 38 }, { "MOUNT_ORIENTATION", 265 }, { "NAMED_VALUE_FLOAT", 251 }, { "NAMED_VALUE_INT", 252 }, { "NAV_CONTROLLER_OUTPUT", 62 }, { "OBSTACLE_DISTANCE", 330 }, { "ODOMETRY", 331 }, { "ONBOARD_COMPUTER_STATUS", 390 }, { "OPEN_DRONE_ID_AUTHENTICATION", 12902 }, { "OPEN_DRONE_ID_BASIC_ID", 12900 }, { "OPEN_DRONE_ID_LOCATION", 12901 }, { "OPEN_DRONE_ID_MESSAGE_PACK", 12915 }, { "OPEN_DRONE_ID_OPERATOR_ID", 12905 }, { "OPEN_DRONE_ID_SELF_ID", 12903 }, { "OPEN_DRONE_ID_SYSTEM", 12904 }, { "OPTICAL_FLOW", 100 }, { "OPTICAL_FLOW_RAD", 106 }, { "ORBIT_EXECUTION_STATUS", 360 }, { "PARAM_ACK_TRANSACTION", 19 }, { "PARAM_EXT_ACK", 324 }, { "PARAM_EXT_REQUEST_LIST", 321 }, { "PARAM_EXT_REQUEST_READ", 320 }, { "PARAM_EXT_SET", 323 }, { "PARAM_EXT_VALUE", 322 }, { "PARAM_MAP_RC", 50 }, { "PARAM_REQUEST_LIST", 21 }, { "PARAM_REQUEST_READ", 20 }, { "PARAM_SET", 23 }, { "PARAM_VALUE", 22 }, { "PING", 4 }, { "PLAY_TUNE", 258 }, { "PLAY_TUNE_V2", 400 }, { "POSITION_TARGET_GLOBAL_INT", 87 }, { "POSITION_TARGET_LOCAL_NED", 85 }, { "POWER_STATUS", 125 }, { "PROTOCOL_VERSION", 300 }, { "RADIO_STATUS", 109 }, { "RAW_IMU", 27 }, { "RAW_PRESSURE", 28 }, { "RAW_RPM", 339 }, { "RC_CHANNELS", 65 }, { "RC_CHANNELS_OVERRIDE", 70 }, { "RC_CHANNELS_RAW", 35 }, { "RC_CHANNELS_SCALED", 34 }, { "REQUEST_DATA_STREAM", 66 }, { "RESOURCE_REQUEST", 142 }, { "SAFETY_ALLOWED_AREA", 55 }, { "SAFETY_SET_ALLOWED_AREA", 54 }, { "SCALED_IMU", 26 }, { "SCALED_IMU2", 116 }, { "SCALED_IMU3", 129 }, { "SCALED_PRESSURE", 29 }, { "SCALED_PRESSURE2", 137 }, { "SCALED_PRESSURE3", 143 }, { "SERIAL_CONTROL", 126 }, { "SERVO_OUTPUT_RAW", 36 }, { "SETUP_SIGNING", 256 }, { "SET_ACTUATOR_CONTROL_TARGET", 139 }, { "SET_ATTITUDE_TARGET", 82 }, { "SET_GPS_GLOBAL_ORIGIN", 48 }, { "SET_HOME_POSITION", 243 }, { "SET_MODE", 11 }, { "SET_POSITION_TARGET_GLOBAL_INT", 86 }, { "SET_POSITION_TARGET_LOCAL_NED", 84 }, { "SIM_STATE", 108 }, { "SMART_BATTERY_INFO", 370 }, { "STATUSTEXT", 253 }, { "STORAGE_INFORMATION", 261 }, { "SUPPORTED_TUNES", 401 }, { "SYSTEM_TIME", 2 }, { "SYS_STATUS", 1 }, { "TERRAIN_CHECK", 135 }, { "TERRAIN_DATA", 134 }, { "TERRAIN_REPORT", 136 }, { "TERRAIN_REQUEST", 133 }, { "TIMESYNC", 111 }, { "TIME_ESTIMATE_TO_TARGET", 380 }, { "TRAJECTORY_REPRESENTATION_BEZIER", 333 }, { "TRAJECTORY_REPRESENTATION_WAYPOINTS", 332 }, { "TUNNEL", 385 }, { "UAVCAN_NODE_INFO", 311 }, { "UAVCAN_NODE_STATUS", 310 }, { "UTM_GLOBAL_POSITION", 340 }, { "V2_EXTENSION", 248 }, { "VFR_HUD", 74 }, { "VIBRATION", 241 }, { "VICON_POSITION_ESTIMATE", 104 }, { "VIDEO_STREAM_INFORMATION", 269 }, { "VIDEO_STREAM_STATUS", 270 }, { "VISION_POSITION_ESTIMATE", 102 }, { "VISION_SPEED_ESTIMATE", 103 }, { "WHEEL_DISTANCE", 9000 }, { "WIFI_CONFIG_AP", 299 }, { "WINCH_STATUS", 9005 }, { "WIND_COV", 231 }} -# if MAVLINK_COMMAND_24BIT -# include "../mavlink_get_info.h" -# endif -#endif - -#ifdef __cplusplus -} -#endif // __cplusplus -#endif // MAVLINK_AUTOQUAD_H diff --git a/autoquad/mavlink_msg_aq_esc_telemetry.h b/autoquad/mavlink_msg_aq_esc_telemetry.h deleted file mode 100644 index 2804eac98..000000000 --- a/autoquad/mavlink_msg_aq_esc_telemetry.h +++ /dev/null @@ -1,409 +0,0 @@ -#pragma once -// MESSAGE AQ_ESC_TELEMETRY PACKING - -#define MAVLINK_MSG_ID_AQ_ESC_TELEMETRY 152 - - -typedef struct __mavlink_aq_esc_telemetry_t { - uint32_t time_boot_ms; /*< Timestamp of the component clock since boot time in ms.*/ - uint32_t data0[4]; /*< Data bits 1-32 for each ESC.*/ - uint32_t data1[4]; /*< Data bits 33-64 for each ESC.*/ - uint16_t status_age[4]; /*< Age of each ESC telemetry reading in ms compared to boot time. A value of 0xFFFF means timeout/no data.*/ - uint8_t seq; /*< Sequence number of message (first set of 4 motors is #1, next 4 is #2, etc).*/ - uint8_t num_motors; /*< Total number of active ESCs/motors on the system.*/ - uint8_t num_in_seq; /*< Number of active ESCs in this sequence (1 through this many array members will be populated with data)*/ - uint8_t escid[4]; /*< ESC/Motor ID*/ - uint8_t data_version[4]; /*< Version of data structure (determines contents).*/ -} mavlink_aq_esc_telemetry_t; - -#define MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_LEN 55 -#define MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_MIN_LEN 55 -#define MAVLINK_MSG_ID_152_LEN 55 -#define MAVLINK_MSG_ID_152_MIN_LEN 55 - -#define MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_CRC 115 -#define MAVLINK_MSG_ID_152_CRC 115 - -#define MAVLINK_MSG_AQ_ESC_TELEMETRY_FIELD_DATA0_LEN 4 -#define MAVLINK_MSG_AQ_ESC_TELEMETRY_FIELD_DATA1_LEN 4 -#define MAVLINK_MSG_AQ_ESC_TELEMETRY_FIELD_STATUS_AGE_LEN 4 -#define MAVLINK_MSG_AQ_ESC_TELEMETRY_FIELD_ESCID_LEN 4 -#define MAVLINK_MSG_AQ_ESC_TELEMETRY_FIELD_DATA_VERSION_LEN 4 - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_AQ_ESC_TELEMETRY { \ - 152, \ - "AQ_ESC_TELEMETRY", \ - 9, \ - { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_aq_esc_telemetry_t, time_boot_ms) }, \ - { "seq", NULL, MAVLINK_TYPE_UINT8_T, 0, 44, offsetof(mavlink_aq_esc_telemetry_t, seq) }, \ - { "num_motors", NULL, MAVLINK_TYPE_UINT8_T, 0, 45, offsetof(mavlink_aq_esc_telemetry_t, num_motors) }, \ - { "num_in_seq", NULL, MAVLINK_TYPE_UINT8_T, 0, 46, offsetof(mavlink_aq_esc_telemetry_t, num_in_seq) }, \ - { "escid", NULL, MAVLINK_TYPE_UINT8_T, 4, 47, offsetof(mavlink_aq_esc_telemetry_t, escid) }, \ - { "status_age", NULL, MAVLINK_TYPE_UINT16_T, 4, 36, offsetof(mavlink_aq_esc_telemetry_t, status_age) }, \ - { "data_version", NULL, MAVLINK_TYPE_UINT8_T, 4, 51, offsetof(mavlink_aq_esc_telemetry_t, data_version) }, \ - { "data0", NULL, MAVLINK_TYPE_UINT32_T, 4, 4, offsetof(mavlink_aq_esc_telemetry_t, data0) }, \ - { "data1", NULL, MAVLINK_TYPE_UINT32_T, 4, 20, offsetof(mavlink_aq_esc_telemetry_t, data1) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_AQ_ESC_TELEMETRY { \ - "AQ_ESC_TELEMETRY", \ - 9, \ - { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_aq_esc_telemetry_t, time_boot_ms) }, \ - { "seq", NULL, MAVLINK_TYPE_UINT8_T, 0, 44, offsetof(mavlink_aq_esc_telemetry_t, seq) }, \ - { "num_motors", NULL, MAVLINK_TYPE_UINT8_T, 0, 45, offsetof(mavlink_aq_esc_telemetry_t, num_motors) }, \ - { "num_in_seq", NULL, MAVLINK_TYPE_UINT8_T, 0, 46, offsetof(mavlink_aq_esc_telemetry_t, num_in_seq) }, \ - { "escid", NULL, MAVLINK_TYPE_UINT8_T, 4, 47, offsetof(mavlink_aq_esc_telemetry_t, escid) }, \ - { "status_age", NULL, MAVLINK_TYPE_UINT16_T, 4, 36, offsetof(mavlink_aq_esc_telemetry_t, status_age) }, \ - { "data_version", NULL, MAVLINK_TYPE_UINT8_T, 4, 51, offsetof(mavlink_aq_esc_telemetry_t, data_version) }, \ - { "data0", NULL, MAVLINK_TYPE_UINT32_T, 4, 4, offsetof(mavlink_aq_esc_telemetry_t, data0) }, \ - { "data1", NULL, MAVLINK_TYPE_UINT32_T, 4, 20, offsetof(mavlink_aq_esc_telemetry_t, data1) }, \ - } \ -} -#endif - -/** - * @brief Pack a aq_esc_telemetry message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param time_boot_ms Timestamp of the component clock since boot time in ms. - * @param seq Sequence number of message (first set of 4 motors is #1, next 4 is #2, etc). - * @param num_motors Total number of active ESCs/motors on the system. - * @param num_in_seq Number of active ESCs in this sequence (1 through this many array members will be populated with data) - * @param escid ESC/Motor ID - * @param status_age Age of each ESC telemetry reading in ms compared to boot time. A value of 0xFFFF means timeout/no data. - * @param data_version Version of data structure (determines contents). - * @param data0 Data bits 1-32 for each ESC. - * @param data1 Data bits 33-64 for each ESC. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_aq_esc_telemetry_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint32_t time_boot_ms, uint8_t seq, uint8_t num_motors, uint8_t num_in_seq, const uint8_t *escid, const uint16_t *status_age, const uint8_t *data_version, const uint32_t *data0, const uint32_t *data1) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_LEN]; - _mav_put_uint32_t(buf, 0, time_boot_ms); - _mav_put_uint8_t(buf, 44, seq); - _mav_put_uint8_t(buf, 45, num_motors); - _mav_put_uint8_t(buf, 46, num_in_seq); - _mav_put_uint32_t_array(buf, 4, data0, 4); - _mav_put_uint32_t_array(buf, 20, data1, 4); - _mav_put_uint16_t_array(buf, 36, status_age, 4); - _mav_put_uint8_t_array(buf, 47, escid, 4); - _mav_put_uint8_t_array(buf, 51, data_version, 4); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_LEN); -#else - mavlink_aq_esc_telemetry_t packet; - packet.time_boot_ms = time_boot_ms; - packet.seq = seq; - packet.num_motors = num_motors; - packet.num_in_seq = num_in_seq; - mav_array_memcpy(packet.data0, data0, sizeof(uint32_t)*4); - mav_array_memcpy(packet.data1, data1, sizeof(uint32_t)*4); - mav_array_memcpy(packet.status_age, status_age, sizeof(uint16_t)*4); - mav_array_memcpy(packet.escid, escid, sizeof(uint8_t)*4); - mav_array_memcpy(packet.data_version, data_version, sizeof(uint8_t)*4); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_AQ_ESC_TELEMETRY; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_MIN_LEN, MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_LEN, MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_CRC); -} - -/** - * @brief Pack a aq_esc_telemetry message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param time_boot_ms Timestamp of the component clock since boot time in ms. - * @param seq Sequence number of message (first set of 4 motors is #1, next 4 is #2, etc). - * @param num_motors Total number of active ESCs/motors on the system. - * @param num_in_seq Number of active ESCs in this sequence (1 through this many array members will be populated with data) - * @param escid ESC/Motor ID - * @param status_age Age of each ESC telemetry reading in ms compared to boot time. A value of 0xFFFF means timeout/no data. - * @param data_version Version of data structure (determines contents). - * @param data0 Data bits 1-32 for each ESC. - * @param data1 Data bits 33-64 for each ESC. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_aq_esc_telemetry_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint32_t time_boot_ms,uint8_t seq,uint8_t num_motors,uint8_t num_in_seq,const uint8_t *escid,const uint16_t *status_age,const uint8_t *data_version,const uint32_t *data0,const uint32_t *data1) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_LEN]; - _mav_put_uint32_t(buf, 0, time_boot_ms); - _mav_put_uint8_t(buf, 44, seq); - _mav_put_uint8_t(buf, 45, num_motors); - _mav_put_uint8_t(buf, 46, num_in_seq); - _mav_put_uint32_t_array(buf, 4, data0, 4); - _mav_put_uint32_t_array(buf, 20, data1, 4); - _mav_put_uint16_t_array(buf, 36, status_age, 4); - _mav_put_uint8_t_array(buf, 47, escid, 4); - _mav_put_uint8_t_array(buf, 51, data_version, 4); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_LEN); -#else - mavlink_aq_esc_telemetry_t packet; - packet.time_boot_ms = time_boot_ms; - packet.seq = seq; - packet.num_motors = num_motors; - packet.num_in_seq = num_in_seq; - mav_array_memcpy(packet.data0, data0, sizeof(uint32_t)*4); - mav_array_memcpy(packet.data1, data1, sizeof(uint32_t)*4); - mav_array_memcpy(packet.status_age, status_age, sizeof(uint16_t)*4); - mav_array_memcpy(packet.escid, escid, sizeof(uint8_t)*4); - mav_array_memcpy(packet.data_version, data_version, sizeof(uint8_t)*4); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_AQ_ESC_TELEMETRY; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_MIN_LEN, MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_LEN, MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_CRC); -} - -/** - * @brief Encode a aq_esc_telemetry struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param aq_esc_telemetry C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_aq_esc_telemetry_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_aq_esc_telemetry_t* aq_esc_telemetry) -{ - return mavlink_msg_aq_esc_telemetry_pack(system_id, component_id, msg, aq_esc_telemetry->time_boot_ms, aq_esc_telemetry->seq, aq_esc_telemetry->num_motors, aq_esc_telemetry->num_in_seq, aq_esc_telemetry->escid, aq_esc_telemetry->status_age, aq_esc_telemetry->data_version, aq_esc_telemetry->data0, aq_esc_telemetry->data1); -} - -/** - * @brief Encode a aq_esc_telemetry struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param aq_esc_telemetry C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_aq_esc_telemetry_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_aq_esc_telemetry_t* aq_esc_telemetry) -{ - return mavlink_msg_aq_esc_telemetry_pack_chan(system_id, component_id, chan, msg, aq_esc_telemetry->time_boot_ms, aq_esc_telemetry->seq, aq_esc_telemetry->num_motors, aq_esc_telemetry->num_in_seq, aq_esc_telemetry->escid, aq_esc_telemetry->status_age, aq_esc_telemetry->data_version, aq_esc_telemetry->data0, aq_esc_telemetry->data1); -} - -/** - * @brief Send a aq_esc_telemetry message - * @param chan MAVLink channel to send the message - * - * @param time_boot_ms Timestamp of the component clock since boot time in ms. - * @param seq Sequence number of message (first set of 4 motors is #1, next 4 is #2, etc). - * @param num_motors Total number of active ESCs/motors on the system. - * @param num_in_seq Number of active ESCs in this sequence (1 through this many array members will be populated with data) - * @param escid ESC/Motor ID - * @param status_age Age of each ESC telemetry reading in ms compared to boot time. A value of 0xFFFF means timeout/no data. - * @param data_version Version of data structure (determines contents). - * @param data0 Data bits 1-32 for each ESC. - * @param data1 Data bits 33-64 for each ESC. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_aq_esc_telemetry_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t seq, uint8_t num_motors, uint8_t num_in_seq, const uint8_t *escid, const uint16_t *status_age, const uint8_t *data_version, const uint32_t *data0, const uint32_t *data1) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_LEN]; - _mav_put_uint32_t(buf, 0, time_boot_ms); - _mav_put_uint8_t(buf, 44, seq); - _mav_put_uint8_t(buf, 45, num_motors); - _mav_put_uint8_t(buf, 46, num_in_seq); - _mav_put_uint32_t_array(buf, 4, data0, 4); - _mav_put_uint32_t_array(buf, 20, data1, 4); - _mav_put_uint16_t_array(buf, 36, status_age, 4); - _mav_put_uint8_t_array(buf, 47, escid, 4); - _mav_put_uint8_t_array(buf, 51, data_version, 4); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AQ_ESC_TELEMETRY, buf, MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_MIN_LEN, MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_LEN, MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_CRC); -#else - mavlink_aq_esc_telemetry_t packet; - packet.time_boot_ms = time_boot_ms; - packet.seq = seq; - packet.num_motors = num_motors; - packet.num_in_seq = num_in_seq; - mav_array_memcpy(packet.data0, data0, sizeof(uint32_t)*4); - mav_array_memcpy(packet.data1, data1, sizeof(uint32_t)*4); - mav_array_memcpy(packet.status_age, status_age, sizeof(uint16_t)*4); - mav_array_memcpy(packet.escid, escid, sizeof(uint8_t)*4); - mav_array_memcpy(packet.data_version, data_version, sizeof(uint8_t)*4); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AQ_ESC_TELEMETRY, (const char *)&packet, MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_MIN_LEN, MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_LEN, MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_CRC); -#endif -} - -/** - * @brief Send a aq_esc_telemetry message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_aq_esc_telemetry_send_struct(mavlink_channel_t chan, const mavlink_aq_esc_telemetry_t* aq_esc_telemetry) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_aq_esc_telemetry_send(chan, aq_esc_telemetry->time_boot_ms, aq_esc_telemetry->seq, aq_esc_telemetry->num_motors, aq_esc_telemetry->num_in_seq, aq_esc_telemetry->escid, aq_esc_telemetry->status_age, aq_esc_telemetry->data_version, aq_esc_telemetry->data0, aq_esc_telemetry->data1); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AQ_ESC_TELEMETRY, (const char *)aq_esc_telemetry, MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_MIN_LEN, MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_LEN, MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_CRC); -#endif -} - -#if MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_aq_esc_telemetry_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t seq, uint8_t num_motors, uint8_t num_in_seq, const uint8_t *escid, const uint16_t *status_age, const uint8_t *data_version, const uint32_t *data0, const uint32_t *data1) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint32_t(buf, 0, time_boot_ms); - _mav_put_uint8_t(buf, 44, seq); - _mav_put_uint8_t(buf, 45, num_motors); - _mav_put_uint8_t(buf, 46, num_in_seq); - _mav_put_uint32_t_array(buf, 4, data0, 4); - _mav_put_uint32_t_array(buf, 20, data1, 4); - _mav_put_uint16_t_array(buf, 36, status_age, 4); - _mav_put_uint8_t_array(buf, 47, escid, 4); - _mav_put_uint8_t_array(buf, 51, data_version, 4); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AQ_ESC_TELEMETRY, buf, MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_MIN_LEN, MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_LEN, MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_CRC); -#else - mavlink_aq_esc_telemetry_t *packet = (mavlink_aq_esc_telemetry_t *)msgbuf; - packet->time_boot_ms = time_boot_ms; - packet->seq = seq; - packet->num_motors = num_motors; - packet->num_in_seq = num_in_seq; - mav_array_memcpy(packet->data0, data0, sizeof(uint32_t)*4); - mav_array_memcpy(packet->data1, data1, sizeof(uint32_t)*4); - mav_array_memcpy(packet->status_age, status_age, sizeof(uint16_t)*4); - mav_array_memcpy(packet->escid, escid, sizeof(uint8_t)*4); - mav_array_memcpy(packet->data_version, data_version, sizeof(uint8_t)*4); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AQ_ESC_TELEMETRY, (const char *)packet, MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_MIN_LEN, MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_LEN, MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_CRC); -#endif -} -#endif - -#endif - -// MESSAGE AQ_ESC_TELEMETRY UNPACKING - - -/** - * @brief Get field time_boot_ms from aq_esc_telemetry message - * - * @return Timestamp of the component clock since boot time in ms. - */ -static inline uint32_t mavlink_msg_aq_esc_telemetry_get_time_boot_ms(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 0); -} - -/** - * @brief Get field seq from aq_esc_telemetry message - * - * @return Sequence number of message (first set of 4 motors is #1, next 4 is #2, etc). - */ -static inline uint8_t mavlink_msg_aq_esc_telemetry_get_seq(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 44); -} - -/** - * @brief Get field num_motors from aq_esc_telemetry message - * - * @return Total number of active ESCs/motors on the system. - */ -static inline uint8_t mavlink_msg_aq_esc_telemetry_get_num_motors(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 45); -} - -/** - * @brief Get field num_in_seq from aq_esc_telemetry message - * - * @return Number of active ESCs in this sequence (1 through this many array members will be populated with data) - */ -static inline uint8_t mavlink_msg_aq_esc_telemetry_get_num_in_seq(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 46); -} - -/** - * @brief Get field escid from aq_esc_telemetry message - * - * @return ESC/Motor ID - */ -static inline uint16_t mavlink_msg_aq_esc_telemetry_get_escid(const mavlink_message_t* msg, uint8_t *escid) -{ - return _MAV_RETURN_uint8_t_array(msg, escid, 4, 47); -} - -/** - * @brief Get field status_age from aq_esc_telemetry message - * - * @return Age of each ESC telemetry reading in ms compared to boot time. A value of 0xFFFF means timeout/no data. - */ -static inline uint16_t mavlink_msg_aq_esc_telemetry_get_status_age(const mavlink_message_t* msg, uint16_t *status_age) -{ - return _MAV_RETURN_uint16_t_array(msg, status_age, 4, 36); -} - -/** - * @brief Get field data_version from aq_esc_telemetry message - * - * @return Version of data structure (determines contents). - */ -static inline uint16_t mavlink_msg_aq_esc_telemetry_get_data_version(const mavlink_message_t* msg, uint8_t *data_version) -{ - return _MAV_RETURN_uint8_t_array(msg, data_version, 4, 51); -} - -/** - * @brief Get field data0 from aq_esc_telemetry message - * - * @return Data bits 1-32 for each ESC. - */ -static inline uint16_t mavlink_msg_aq_esc_telemetry_get_data0(const mavlink_message_t* msg, uint32_t *data0) -{ - return _MAV_RETURN_uint32_t_array(msg, data0, 4, 4); -} - -/** - * @brief Get field data1 from aq_esc_telemetry message - * - * @return Data bits 33-64 for each ESC. - */ -static inline uint16_t mavlink_msg_aq_esc_telemetry_get_data1(const mavlink_message_t* msg, uint32_t *data1) -{ - return _MAV_RETURN_uint32_t_array(msg, data1, 4, 20); -} - -/** - * @brief Decode a aq_esc_telemetry message into a struct - * - * @param msg The message to decode - * @param aq_esc_telemetry C-struct to decode the message contents into - */ -static inline void mavlink_msg_aq_esc_telemetry_decode(const mavlink_message_t* msg, mavlink_aq_esc_telemetry_t* aq_esc_telemetry) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - aq_esc_telemetry->time_boot_ms = mavlink_msg_aq_esc_telemetry_get_time_boot_ms(msg); - mavlink_msg_aq_esc_telemetry_get_data0(msg, aq_esc_telemetry->data0); - mavlink_msg_aq_esc_telemetry_get_data1(msg, aq_esc_telemetry->data1); - mavlink_msg_aq_esc_telemetry_get_status_age(msg, aq_esc_telemetry->status_age); - aq_esc_telemetry->seq = mavlink_msg_aq_esc_telemetry_get_seq(msg); - aq_esc_telemetry->num_motors = mavlink_msg_aq_esc_telemetry_get_num_motors(msg); - aq_esc_telemetry->num_in_seq = mavlink_msg_aq_esc_telemetry_get_num_in_seq(msg); - mavlink_msg_aq_esc_telemetry_get_escid(msg, aq_esc_telemetry->escid); - mavlink_msg_aq_esc_telemetry_get_data_version(msg, aq_esc_telemetry->data_version); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_LEN? msg->len : MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_LEN; - memset(aq_esc_telemetry, 0, MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_LEN); - memcpy(aq_esc_telemetry, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/autoquad/mavlink_msg_aq_telemetry_f.h b/autoquad/mavlink_msg_aq_telemetry_f.h deleted file mode 100644 index 73ce058ec..000000000 --- a/autoquad/mavlink_msg_aq_telemetry_f.h +++ /dev/null @@ -1,713 +0,0 @@ -#pragma once -// MESSAGE AQ_TELEMETRY_F PACKING - -#define MAVLINK_MSG_ID_AQ_TELEMETRY_F 150 - - -typedef struct __mavlink_aq_telemetry_f_t { - float value1; /*< value1*/ - float value2; /*< value2*/ - float value3; /*< value3*/ - float value4; /*< value4*/ - float value5; /*< value5*/ - float value6; /*< value6*/ - float value7; /*< value7*/ - float value8; /*< value8*/ - float value9; /*< value9*/ - float value10; /*< value10*/ - float value11; /*< value11*/ - float value12; /*< value12*/ - float value13; /*< value13*/ - float value14; /*< value14*/ - float value15; /*< value15*/ - float value16; /*< value16*/ - float value17; /*< value17*/ - float value18; /*< value18*/ - float value19; /*< value19*/ - float value20; /*< value20*/ - uint16_t Index; /*< Index of message*/ -} mavlink_aq_telemetry_f_t; - -#define MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN 82 -#define MAVLINK_MSG_ID_AQ_TELEMETRY_F_MIN_LEN 82 -#define MAVLINK_MSG_ID_150_LEN 82 -#define MAVLINK_MSG_ID_150_MIN_LEN 82 - -#define MAVLINK_MSG_ID_AQ_TELEMETRY_F_CRC 241 -#define MAVLINK_MSG_ID_150_CRC 241 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_AQ_TELEMETRY_F { \ - 150, \ - "AQ_TELEMETRY_F", \ - 21, \ - { { "Index", NULL, MAVLINK_TYPE_UINT16_T, 0, 80, offsetof(mavlink_aq_telemetry_f_t, Index) }, \ - { "value1", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_aq_telemetry_f_t, value1) }, \ - { "value2", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_aq_telemetry_f_t, value2) }, \ - { "value3", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_aq_telemetry_f_t, value3) }, \ - { "value4", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_aq_telemetry_f_t, value4) }, \ - { "value5", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_aq_telemetry_f_t, value5) }, \ - { "value6", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_aq_telemetry_f_t, value6) }, \ - { "value7", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_aq_telemetry_f_t, value7) }, \ - { "value8", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_aq_telemetry_f_t, value8) }, \ - { "value9", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_aq_telemetry_f_t, value9) }, \ - { "value10", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_aq_telemetry_f_t, value10) }, \ - { "value11", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_aq_telemetry_f_t, value11) }, \ - { "value12", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_aq_telemetry_f_t, value12) }, \ - { "value13", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_aq_telemetry_f_t, value13) }, \ - { "value14", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_aq_telemetry_f_t, value14) }, \ - { "value15", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_aq_telemetry_f_t, value15) }, \ - { "value16", NULL, MAVLINK_TYPE_FLOAT, 0, 60, offsetof(mavlink_aq_telemetry_f_t, value16) }, \ - { "value17", NULL, MAVLINK_TYPE_FLOAT, 0, 64, offsetof(mavlink_aq_telemetry_f_t, value17) }, \ - { "value18", NULL, MAVLINK_TYPE_FLOAT, 0, 68, offsetof(mavlink_aq_telemetry_f_t, value18) }, \ - { "value19", NULL, MAVLINK_TYPE_FLOAT, 0, 72, offsetof(mavlink_aq_telemetry_f_t, value19) }, \ - { "value20", NULL, MAVLINK_TYPE_FLOAT, 0, 76, offsetof(mavlink_aq_telemetry_f_t, value20) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_AQ_TELEMETRY_F { \ - "AQ_TELEMETRY_F", \ - 21, \ - { { "Index", NULL, MAVLINK_TYPE_UINT16_T, 0, 80, offsetof(mavlink_aq_telemetry_f_t, Index) }, \ - { "value1", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_aq_telemetry_f_t, value1) }, \ - { "value2", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_aq_telemetry_f_t, value2) }, \ - { "value3", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_aq_telemetry_f_t, value3) }, \ - { "value4", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_aq_telemetry_f_t, value4) }, \ - { "value5", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_aq_telemetry_f_t, value5) }, \ - { "value6", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_aq_telemetry_f_t, value6) }, \ - { "value7", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_aq_telemetry_f_t, value7) }, \ - { "value8", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_aq_telemetry_f_t, value8) }, \ - { "value9", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_aq_telemetry_f_t, value9) }, \ - { "value10", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_aq_telemetry_f_t, value10) }, \ - { "value11", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_aq_telemetry_f_t, value11) }, \ - { "value12", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_aq_telemetry_f_t, value12) }, \ - { "value13", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_aq_telemetry_f_t, value13) }, \ - { "value14", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_aq_telemetry_f_t, value14) }, \ - { "value15", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_aq_telemetry_f_t, value15) }, \ - { "value16", NULL, MAVLINK_TYPE_FLOAT, 0, 60, offsetof(mavlink_aq_telemetry_f_t, value16) }, \ - { "value17", NULL, MAVLINK_TYPE_FLOAT, 0, 64, offsetof(mavlink_aq_telemetry_f_t, value17) }, \ - { "value18", NULL, MAVLINK_TYPE_FLOAT, 0, 68, offsetof(mavlink_aq_telemetry_f_t, value18) }, \ - { "value19", NULL, MAVLINK_TYPE_FLOAT, 0, 72, offsetof(mavlink_aq_telemetry_f_t, value19) }, \ - { "value20", NULL, MAVLINK_TYPE_FLOAT, 0, 76, offsetof(mavlink_aq_telemetry_f_t, value20) }, \ - } \ -} -#endif - -/** - * @brief Pack a aq_telemetry_f message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param Index Index of message - * @param value1 value1 - * @param value2 value2 - * @param value3 value3 - * @param value4 value4 - * @param value5 value5 - * @param value6 value6 - * @param value7 value7 - * @param value8 value8 - * @param value9 value9 - * @param value10 value10 - * @param value11 value11 - * @param value12 value12 - * @param value13 value13 - * @param value14 value14 - * @param value15 value15 - * @param value16 value16 - * @param value17 value17 - * @param value18 value18 - * @param value19 value19 - * @param value20 value20 - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_aq_telemetry_f_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint16_t Index, float value1, float value2, float value3, float value4, float value5, float value6, float value7, float value8, float value9, float value10, float value11, float value12, float value13, float value14, float value15, float value16, float value17, float value18, float value19, float value20) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN]; - _mav_put_float(buf, 0, value1); - _mav_put_float(buf, 4, value2); - _mav_put_float(buf, 8, value3); - _mav_put_float(buf, 12, value4); - _mav_put_float(buf, 16, value5); - _mav_put_float(buf, 20, value6); - _mav_put_float(buf, 24, value7); - _mav_put_float(buf, 28, value8); - _mav_put_float(buf, 32, value9); - _mav_put_float(buf, 36, value10); - _mav_put_float(buf, 40, value11); - _mav_put_float(buf, 44, value12); - _mav_put_float(buf, 48, value13); - _mav_put_float(buf, 52, value14); - _mav_put_float(buf, 56, value15); - _mav_put_float(buf, 60, value16); - _mav_put_float(buf, 64, value17); - _mav_put_float(buf, 68, value18); - _mav_put_float(buf, 72, value19); - _mav_put_float(buf, 76, value20); - _mav_put_uint16_t(buf, 80, Index); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN); -#else - mavlink_aq_telemetry_f_t packet; - packet.value1 = value1; - packet.value2 = value2; - packet.value3 = value3; - packet.value4 = value4; - packet.value5 = value5; - packet.value6 = value6; - packet.value7 = value7; - packet.value8 = value8; - packet.value9 = value9; - packet.value10 = value10; - packet.value11 = value11; - packet.value12 = value12; - packet.value13 = value13; - packet.value14 = value14; - packet.value15 = value15; - packet.value16 = value16; - packet.value17 = value17; - packet.value18 = value18; - packet.value19 = value19; - packet.value20 = value20; - packet.Index = Index; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_AQ_TELEMETRY_F; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AQ_TELEMETRY_F_MIN_LEN, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN, MAVLINK_MSG_ID_AQ_TELEMETRY_F_CRC); -} - -/** - * @brief Pack a aq_telemetry_f message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param Index Index of message - * @param value1 value1 - * @param value2 value2 - * @param value3 value3 - * @param value4 value4 - * @param value5 value5 - * @param value6 value6 - * @param value7 value7 - * @param value8 value8 - * @param value9 value9 - * @param value10 value10 - * @param value11 value11 - * @param value12 value12 - * @param value13 value13 - * @param value14 value14 - * @param value15 value15 - * @param value16 value16 - * @param value17 value17 - * @param value18 value18 - * @param value19 value19 - * @param value20 value20 - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_aq_telemetry_f_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint16_t Index,float value1,float value2,float value3,float value4,float value5,float value6,float value7,float value8,float value9,float value10,float value11,float value12,float value13,float value14,float value15,float value16,float value17,float value18,float value19,float value20) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN]; - _mav_put_float(buf, 0, value1); - _mav_put_float(buf, 4, value2); - _mav_put_float(buf, 8, value3); - _mav_put_float(buf, 12, value4); - _mav_put_float(buf, 16, value5); - _mav_put_float(buf, 20, value6); - _mav_put_float(buf, 24, value7); - _mav_put_float(buf, 28, value8); - _mav_put_float(buf, 32, value9); - _mav_put_float(buf, 36, value10); - _mav_put_float(buf, 40, value11); - _mav_put_float(buf, 44, value12); - _mav_put_float(buf, 48, value13); - _mav_put_float(buf, 52, value14); - _mav_put_float(buf, 56, value15); - _mav_put_float(buf, 60, value16); - _mav_put_float(buf, 64, value17); - _mav_put_float(buf, 68, value18); - _mav_put_float(buf, 72, value19); - _mav_put_float(buf, 76, value20); - _mav_put_uint16_t(buf, 80, Index); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN); -#else - mavlink_aq_telemetry_f_t packet; - packet.value1 = value1; - packet.value2 = value2; - packet.value3 = value3; - packet.value4 = value4; - packet.value5 = value5; - packet.value6 = value6; - packet.value7 = value7; - packet.value8 = value8; - packet.value9 = value9; - packet.value10 = value10; - packet.value11 = value11; - packet.value12 = value12; - packet.value13 = value13; - packet.value14 = value14; - packet.value15 = value15; - packet.value16 = value16; - packet.value17 = value17; - packet.value18 = value18; - packet.value19 = value19; - packet.value20 = value20; - packet.Index = Index; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_AQ_TELEMETRY_F; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AQ_TELEMETRY_F_MIN_LEN, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN, MAVLINK_MSG_ID_AQ_TELEMETRY_F_CRC); -} - -/** - * @brief Encode a aq_telemetry_f struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param aq_telemetry_f C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_aq_telemetry_f_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_aq_telemetry_f_t* aq_telemetry_f) -{ - return mavlink_msg_aq_telemetry_f_pack(system_id, component_id, msg, aq_telemetry_f->Index, aq_telemetry_f->value1, aq_telemetry_f->value2, aq_telemetry_f->value3, aq_telemetry_f->value4, aq_telemetry_f->value5, aq_telemetry_f->value6, aq_telemetry_f->value7, aq_telemetry_f->value8, aq_telemetry_f->value9, aq_telemetry_f->value10, aq_telemetry_f->value11, aq_telemetry_f->value12, aq_telemetry_f->value13, aq_telemetry_f->value14, aq_telemetry_f->value15, aq_telemetry_f->value16, aq_telemetry_f->value17, aq_telemetry_f->value18, aq_telemetry_f->value19, aq_telemetry_f->value20); -} - -/** - * @brief Encode a aq_telemetry_f struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param aq_telemetry_f C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_aq_telemetry_f_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_aq_telemetry_f_t* aq_telemetry_f) -{ - return mavlink_msg_aq_telemetry_f_pack_chan(system_id, component_id, chan, msg, aq_telemetry_f->Index, aq_telemetry_f->value1, aq_telemetry_f->value2, aq_telemetry_f->value3, aq_telemetry_f->value4, aq_telemetry_f->value5, aq_telemetry_f->value6, aq_telemetry_f->value7, aq_telemetry_f->value8, aq_telemetry_f->value9, aq_telemetry_f->value10, aq_telemetry_f->value11, aq_telemetry_f->value12, aq_telemetry_f->value13, aq_telemetry_f->value14, aq_telemetry_f->value15, aq_telemetry_f->value16, aq_telemetry_f->value17, aq_telemetry_f->value18, aq_telemetry_f->value19, aq_telemetry_f->value20); -} - -/** - * @brief Send a aq_telemetry_f message - * @param chan MAVLink channel to send the message - * - * @param Index Index of message - * @param value1 value1 - * @param value2 value2 - * @param value3 value3 - * @param value4 value4 - * @param value5 value5 - * @param value6 value6 - * @param value7 value7 - * @param value8 value8 - * @param value9 value9 - * @param value10 value10 - * @param value11 value11 - * @param value12 value12 - * @param value13 value13 - * @param value14 value14 - * @param value15 value15 - * @param value16 value16 - * @param value17 value17 - * @param value18 value18 - * @param value19 value19 - * @param value20 value20 - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_aq_telemetry_f_send(mavlink_channel_t chan, uint16_t Index, float value1, float value2, float value3, float value4, float value5, float value6, float value7, float value8, float value9, float value10, float value11, float value12, float value13, float value14, float value15, float value16, float value17, float value18, float value19, float value20) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN]; - _mav_put_float(buf, 0, value1); - _mav_put_float(buf, 4, value2); - _mav_put_float(buf, 8, value3); - _mav_put_float(buf, 12, value4); - _mav_put_float(buf, 16, value5); - _mav_put_float(buf, 20, value6); - _mav_put_float(buf, 24, value7); - _mav_put_float(buf, 28, value8); - _mav_put_float(buf, 32, value9); - _mav_put_float(buf, 36, value10); - _mav_put_float(buf, 40, value11); - _mav_put_float(buf, 44, value12); - _mav_put_float(buf, 48, value13); - _mav_put_float(buf, 52, value14); - _mav_put_float(buf, 56, value15); - _mav_put_float(buf, 60, value16); - _mav_put_float(buf, 64, value17); - _mav_put_float(buf, 68, value18); - _mav_put_float(buf, 72, value19); - _mav_put_float(buf, 76, value20); - _mav_put_uint16_t(buf, 80, Index); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AQ_TELEMETRY_F, buf, MAVLINK_MSG_ID_AQ_TELEMETRY_F_MIN_LEN, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN, MAVLINK_MSG_ID_AQ_TELEMETRY_F_CRC); -#else - mavlink_aq_telemetry_f_t packet; - packet.value1 = value1; - packet.value2 = value2; - packet.value3 = value3; - packet.value4 = value4; - packet.value5 = value5; - packet.value6 = value6; - packet.value7 = value7; - packet.value8 = value8; - packet.value9 = value9; - packet.value10 = value10; - packet.value11 = value11; - packet.value12 = value12; - packet.value13 = value13; - packet.value14 = value14; - packet.value15 = value15; - packet.value16 = value16; - packet.value17 = value17; - packet.value18 = value18; - packet.value19 = value19; - packet.value20 = value20; - packet.Index = Index; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AQ_TELEMETRY_F, (const char *)&packet, MAVLINK_MSG_ID_AQ_TELEMETRY_F_MIN_LEN, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN, MAVLINK_MSG_ID_AQ_TELEMETRY_F_CRC); -#endif -} - -/** - * @brief Send a aq_telemetry_f message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_aq_telemetry_f_send_struct(mavlink_channel_t chan, const mavlink_aq_telemetry_f_t* aq_telemetry_f) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_aq_telemetry_f_send(chan, aq_telemetry_f->Index, aq_telemetry_f->value1, aq_telemetry_f->value2, aq_telemetry_f->value3, aq_telemetry_f->value4, aq_telemetry_f->value5, aq_telemetry_f->value6, aq_telemetry_f->value7, aq_telemetry_f->value8, aq_telemetry_f->value9, aq_telemetry_f->value10, aq_telemetry_f->value11, aq_telemetry_f->value12, aq_telemetry_f->value13, aq_telemetry_f->value14, aq_telemetry_f->value15, aq_telemetry_f->value16, aq_telemetry_f->value17, aq_telemetry_f->value18, aq_telemetry_f->value19, aq_telemetry_f->value20); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AQ_TELEMETRY_F, (const char *)aq_telemetry_f, MAVLINK_MSG_ID_AQ_TELEMETRY_F_MIN_LEN, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN, MAVLINK_MSG_ID_AQ_TELEMETRY_F_CRC); -#endif -} - -#if MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_aq_telemetry_f_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint16_t Index, float value1, float value2, float value3, float value4, float value5, float value6, float value7, float value8, float value9, float value10, float value11, float value12, float value13, float value14, float value15, float value16, float value17, float value18, float value19, float value20) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_float(buf, 0, value1); - _mav_put_float(buf, 4, value2); - _mav_put_float(buf, 8, value3); - _mav_put_float(buf, 12, value4); - _mav_put_float(buf, 16, value5); - _mav_put_float(buf, 20, value6); - _mav_put_float(buf, 24, value7); - _mav_put_float(buf, 28, value8); - _mav_put_float(buf, 32, value9); - _mav_put_float(buf, 36, value10); - _mav_put_float(buf, 40, value11); - _mav_put_float(buf, 44, value12); - _mav_put_float(buf, 48, value13); - _mav_put_float(buf, 52, value14); - _mav_put_float(buf, 56, value15); - _mav_put_float(buf, 60, value16); - _mav_put_float(buf, 64, value17); - _mav_put_float(buf, 68, value18); - _mav_put_float(buf, 72, value19); - _mav_put_float(buf, 76, value20); - _mav_put_uint16_t(buf, 80, Index); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AQ_TELEMETRY_F, buf, MAVLINK_MSG_ID_AQ_TELEMETRY_F_MIN_LEN, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN, MAVLINK_MSG_ID_AQ_TELEMETRY_F_CRC); -#else - mavlink_aq_telemetry_f_t *packet = (mavlink_aq_telemetry_f_t *)msgbuf; - packet->value1 = value1; - packet->value2 = value2; - packet->value3 = value3; - packet->value4 = value4; - packet->value5 = value5; - packet->value6 = value6; - packet->value7 = value7; - packet->value8 = value8; - packet->value9 = value9; - packet->value10 = value10; - packet->value11 = value11; - packet->value12 = value12; - packet->value13 = value13; - packet->value14 = value14; - packet->value15 = value15; - packet->value16 = value16; - packet->value17 = value17; - packet->value18 = value18; - packet->value19 = value19; - packet->value20 = value20; - packet->Index = Index; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AQ_TELEMETRY_F, (const char *)packet, MAVLINK_MSG_ID_AQ_TELEMETRY_F_MIN_LEN, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN, MAVLINK_MSG_ID_AQ_TELEMETRY_F_CRC); -#endif -} -#endif - -#endif - -// MESSAGE AQ_TELEMETRY_F UNPACKING - - -/** - * @brief Get field Index from aq_telemetry_f message - * - * @return Index of message - */ -static inline uint16_t mavlink_msg_aq_telemetry_f_get_Index(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 80); -} - -/** - * @brief Get field value1 from aq_telemetry_f message - * - * @return value1 - */ -static inline float mavlink_msg_aq_telemetry_f_get_value1(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 0); -} - -/** - * @brief Get field value2 from aq_telemetry_f message - * - * @return value2 - */ -static inline float mavlink_msg_aq_telemetry_f_get_value2(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 4); -} - -/** - * @brief Get field value3 from aq_telemetry_f message - * - * @return value3 - */ -static inline float mavlink_msg_aq_telemetry_f_get_value3(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field value4 from aq_telemetry_f message - * - * @return value4 - */ -static inline float mavlink_msg_aq_telemetry_f_get_value4(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Get field value5 from aq_telemetry_f message - * - * @return value5 - */ -static inline float mavlink_msg_aq_telemetry_f_get_value5(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 16); -} - -/** - * @brief Get field value6 from aq_telemetry_f message - * - * @return value6 - */ -static inline float mavlink_msg_aq_telemetry_f_get_value6(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 20); -} - -/** - * @brief Get field value7 from aq_telemetry_f message - * - * @return value7 - */ -static inline float mavlink_msg_aq_telemetry_f_get_value7(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 24); -} - -/** - * @brief Get field value8 from aq_telemetry_f message - * - * @return value8 - */ -static inline float mavlink_msg_aq_telemetry_f_get_value8(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 28); -} - -/** - * @brief Get field value9 from aq_telemetry_f message - * - * @return value9 - */ -static inline float mavlink_msg_aq_telemetry_f_get_value9(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 32); -} - -/** - * @brief Get field value10 from aq_telemetry_f message - * - * @return value10 - */ -static inline float mavlink_msg_aq_telemetry_f_get_value10(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 36); -} - -/** - * @brief Get field value11 from aq_telemetry_f message - * - * @return value11 - */ -static inline float mavlink_msg_aq_telemetry_f_get_value11(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 40); -} - -/** - * @brief Get field value12 from aq_telemetry_f message - * - * @return value12 - */ -static inline float mavlink_msg_aq_telemetry_f_get_value12(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 44); -} - -/** - * @brief Get field value13 from aq_telemetry_f message - * - * @return value13 - */ -static inline float mavlink_msg_aq_telemetry_f_get_value13(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 48); -} - -/** - * @brief Get field value14 from aq_telemetry_f message - * - * @return value14 - */ -static inline float mavlink_msg_aq_telemetry_f_get_value14(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 52); -} - -/** - * @brief Get field value15 from aq_telemetry_f message - * - * @return value15 - */ -static inline float mavlink_msg_aq_telemetry_f_get_value15(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 56); -} - -/** - * @brief Get field value16 from aq_telemetry_f message - * - * @return value16 - */ -static inline float mavlink_msg_aq_telemetry_f_get_value16(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 60); -} - -/** - * @brief Get field value17 from aq_telemetry_f message - * - * @return value17 - */ -static inline float mavlink_msg_aq_telemetry_f_get_value17(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 64); -} - -/** - * @brief Get field value18 from aq_telemetry_f message - * - * @return value18 - */ -static inline float mavlink_msg_aq_telemetry_f_get_value18(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 68); -} - -/** - * @brief Get field value19 from aq_telemetry_f message - * - * @return value19 - */ -static inline float mavlink_msg_aq_telemetry_f_get_value19(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 72); -} - -/** - * @brief Get field value20 from aq_telemetry_f message - * - * @return value20 - */ -static inline float mavlink_msg_aq_telemetry_f_get_value20(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 76); -} - -/** - * @brief Decode a aq_telemetry_f message into a struct - * - * @param msg The message to decode - * @param aq_telemetry_f C-struct to decode the message contents into - */ -static inline void mavlink_msg_aq_telemetry_f_decode(const mavlink_message_t* msg, mavlink_aq_telemetry_f_t* aq_telemetry_f) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - aq_telemetry_f->value1 = mavlink_msg_aq_telemetry_f_get_value1(msg); - aq_telemetry_f->value2 = mavlink_msg_aq_telemetry_f_get_value2(msg); - aq_telemetry_f->value3 = mavlink_msg_aq_telemetry_f_get_value3(msg); - aq_telemetry_f->value4 = mavlink_msg_aq_telemetry_f_get_value4(msg); - aq_telemetry_f->value5 = mavlink_msg_aq_telemetry_f_get_value5(msg); - aq_telemetry_f->value6 = mavlink_msg_aq_telemetry_f_get_value6(msg); - aq_telemetry_f->value7 = mavlink_msg_aq_telemetry_f_get_value7(msg); - aq_telemetry_f->value8 = mavlink_msg_aq_telemetry_f_get_value8(msg); - aq_telemetry_f->value9 = mavlink_msg_aq_telemetry_f_get_value9(msg); - aq_telemetry_f->value10 = mavlink_msg_aq_telemetry_f_get_value10(msg); - aq_telemetry_f->value11 = mavlink_msg_aq_telemetry_f_get_value11(msg); - aq_telemetry_f->value12 = mavlink_msg_aq_telemetry_f_get_value12(msg); - aq_telemetry_f->value13 = mavlink_msg_aq_telemetry_f_get_value13(msg); - aq_telemetry_f->value14 = mavlink_msg_aq_telemetry_f_get_value14(msg); - aq_telemetry_f->value15 = mavlink_msg_aq_telemetry_f_get_value15(msg); - aq_telemetry_f->value16 = mavlink_msg_aq_telemetry_f_get_value16(msg); - aq_telemetry_f->value17 = mavlink_msg_aq_telemetry_f_get_value17(msg); - aq_telemetry_f->value18 = mavlink_msg_aq_telemetry_f_get_value18(msg); - aq_telemetry_f->value19 = mavlink_msg_aq_telemetry_f_get_value19(msg); - aq_telemetry_f->value20 = mavlink_msg_aq_telemetry_f_get_value20(msg); - aq_telemetry_f->Index = mavlink_msg_aq_telemetry_f_get_Index(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN? msg->len : MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN; - memset(aq_telemetry_f, 0, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN); - memcpy(aq_telemetry_f, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/autoquad/testsuite.h b/autoquad/testsuite.h deleted file mode 100644 index 7d6708864..000000000 --- a/autoquad/testsuite.h +++ /dev/null @@ -1,173 +0,0 @@ -/** @file - * @brief MAVLink comm protocol testsuite generated from autoquad.xml - * @see http://qgroundcontrol.org/mavlink/ - */ -#pragma once -#ifndef AUTOQUAD_TESTSUITE_H -#define AUTOQUAD_TESTSUITE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef MAVLINK_TEST_ALL -#define MAVLINK_TEST_ALL -static void mavlink_test_common(uint8_t, uint8_t, mavlink_message_t *last_msg); -static void mavlink_test_autoquad(uint8_t, uint8_t, mavlink_message_t *last_msg); - -static void mavlink_test_all(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) -{ - mavlink_test_common(system_id, component_id, last_msg); - mavlink_test_autoquad(system_id, component_id, last_msg); -} -#endif - -#include "../common/testsuite.h" - - -static void mavlink_test_aq_telemetry_f(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) -{ -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); - if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_AQ_TELEMETRY_F >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_aq_telemetry_f_t packet_in = { - 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,381.0,409.0,437.0,465.0,493.0,521.0,549.0,21395 - }; - mavlink_aq_telemetry_f_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.value1 = packet_in.value1; - packet1.value2 = packet_in.value2; - packet1.value3 = packet_in.value3; - packet1.value4 = packet_in.value4; - packet1.value5 = packet_in.value5; - packet1.value6 = packet_in.value6; - packet1.value7 = packet_in.value7; - packet1.value8 = packet_in.value8; - packet1.value9 = packet_in.value9; - packet1.value10 = packet_in.value10; - packet1.value11 = packet_in.value11; - packet1.value12 = packet_in.value12; - packet1.value13 = packet_in.value13; - packet1.value14 = packet_in.value14; - packet1.value15 = packet_in.value15; - packet1.value16 = packet_in.value16; - packet1.value17 = packet_in.value17; - packet1.value18 = packet_in.value18; - packet1.value19 = packet_in.value19; - packet1.value20 = packet_in.value20; - packet1.Index = packet_in.Index; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_AQ_TELEMETRY_F_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_AQ_TELEMETRY_F_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_aq_telemetry_f_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_aq_telemetry_f_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_aq_telemetry_f_pack(system_id, component_id, &msg , packet1.Index , packet1.value1 , packet1.value2 , packet1.value3 , packet1.value4 , packet1.value5 , packet1.value6 , packet1.value7 , packet1.value8 , packet1.value9 , packet1.value10 , packet1.value11 , packet1.value12 , packet1.value13 , packet1.value14 , packet1.value15 , packet1.value16 , packet1.value17 , packet1.value18 , packet1.value19 , packet1.value20 ); - mavlink_msg_aq_telemetry_f_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_aq_telemetry_f_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.Index , packet1.value1 , packet1.value2 , packet1.value3 , packet1.value4 , packet1.value5 , packet1.value6 , packet1.value7 , packet1.value8 , packet1.value9 , packet1.value10 , packet1.value11 , packet1.value12 , packet1.value13 , packet1.value14 , packet1.value15 , packet1.value16 , packet1.value17 , packet1.value18 , packet1.value19 , packet1.value20 ); - mavlink_msg_aq_telemetry_f_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_AQ_ESC_TELEMETRY >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_aq_esc_telemetry_t packet_in = { - 963497464,{ 963497672, 963497673, 963497674, 963497675 },{ 963498504, 963498505, 963498506, 963498507 },{ 19107, 19108, 19109, 19110 },137,204,15,{ 82, 83, 84, 85 },{ 94, 95, 96, 97 } - }; - mavlink_aq_esc_telemetry_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.time_boot_ms = packet_in.time_boot_ms; - packet1.seq = packet_in.seq; - packet1.num_motors = packet_in.num_motors; - packet1.num_in_seq = packet_in.num_in_seq; - - mav_array_memcpy(packet1.data0, packet_in.data0, sizeof(uint32_t)*4); - mav_array_memcpy(packet1.data1, packet_in.data1, sizeof(uint32_t)*4); - mav_array_memcpy(packet1.status_age, packet_in.status_age, sizeof(uint16_t)*4); - mav_array_memcpy(packet1.escid, packet_in.escid, sizeof(uint8_t)*4); - mav_array_memcpy(packet1.data_version, packet_in.data_version, sizeof(uint8_t)*4); - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_AQ_ESC_TELEMETRY_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_aq_esc_telemetry_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_aq_esc_telemetry_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_aq_esc_telemetry_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.seq , packet1.num_motors , packet1.num_in_seq , packet1.escid , packet1.status_age , packet1.data_version , packet1.data0 , packet1.data1 ); - mavlink_msg_aq_esc_telemetry_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_aq_esc_telemetry_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.seq , packet1.num_motors , packet1.num_in_seq , packet1.escid , packet1.status_age , packet1.data_version , packet1.data0 , packet1.data1 ); - mavlink_msg_aq_esc_telemetry_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; i 0 radius to pass by WP. Positive value for clockwise orbit, negative value for counter-clockwise orbit. Allows trajectory control.| Desired yaw angle at waypoint (rotary wing). NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_LOITER_UNLIM=17, /* Loiter around this waypoint an unlimited amount of time |Empty| Empty| Loiter radius around waypoint for forward-only moving vehicles (not multicopters). If positive loiter clockwise, else counter-clockwise| Desired yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_LOITER_TURNS=18, /* Loiter around this waypoint for X turns |Number of turns.| Leave loiter circle only once heading towards the next waypoint (0 = False)| Loiter radius around waypoint for forward-only moving vehicles (not multicopters). If positive loiter clockwise, else counter-clockwise| Loiter circle exit location and/or path to next waypoint ("xtrack") for forward-only moving vehicles (not multicopters). 0 for the vehicle to converge towards the center xtrack when it leaves the loiter (the line between the centers of the current and next waypoint), 1 to converge to the direct line between the location that the vehicle exits the loiter radius and the next waypoint. Otherwise the angle (in degrees) between the tangent of the loiter circle and the center xtrack at which the vehicle must leave the loiter (and converge to the center xtrack). NaN to use the current system default xtrack behaviour.| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_LOITER_TIME=19, /* Loiter at the specified latitude, longitude and altitude for a certain amount of time. Multicopter vehicles stop at the point (within a vehicle-specific acceptance radius). Forward-only moving vehicles (e.g. fixed-wing) circle the point with the specified radius/direction. If the Heading Required parameter (2) is non-zero forward moving aircraft will only leave the loiter circle once heading towards the next waypoint. |Loiter time (only starts once Lat, Lon and Alt is reached).| Leave loiter circle only once heading towards the next waypoint (0 = False)| Loiter radius around waypoint for forward-only moving vehicles (not multicopters). If positive loiter clockwise, else counter-clockwise.| Loiter circle exit location and/or path to next waypoint ("xtrack") for forward-only moving vehicles (not multicopters). 0 for the vehicle to converge towards the center xtrack when it leaves the loiter (the line between the centers of the current and next waypoint), 1 to converge to the direct line between the location that the vehicle exits the loiter radius and the next waypoint. Otherwise the angle (in degrees) between the tangent of the loiter circle and the center xtrack at which the vehicle must leave the loiter (and converge to the center xtrack). NaN to use the current system default xtrack behaviour.| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_RETURN_TO_LAUNCH=20, /* Return to launch location |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_NAV_LAND=21, /* Land at location. |Minimum target altitude if landing is aborted (0 = undefined/use system default).| Precision land mode.| Empty.| Desired yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude.| Longitude.| Landing altitude (ground level in current frame).| */ - MAV_CMD_NAV_TAKEOFF=22, /* Takeoff from ground / hand. Vehicles that support multiple takeoff modes (e.g. VTOL quadplane) should take off using the currently configured mode. |Minimum pitch (if airspeed sensor present), desired pitch without sensor| Empty| Empty| Yaw angle (if magnetometer present), ignored without magnetometer. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_LAND_LOCAL=23, /* Land at local position (local frame only) |Landing target number (if available)| Maximum accepted offset from desired landing position - computed magnitude from spherical coordinates: d = sqrt(x^2 + y^2 + z^2), which gives the maximum accepted distance between the desired landing position and the position where the vehicle is about to land| Landing descend rate| Desired yaw angle| Y-axis position| X-axis position| Z-axis / ground level position| */ - MAV_CMD_NAV_TAKEOFF_LOCAL=24, /* Takeoff from local position (local frame only) |Minimum pitch (if airspeed sensor present), desired pitch without sensor| Empty| Takeoff ascend rate| Yaw angle (if magnetometer or another yaw estimation source present), ignored without one of these| Y-axis position| X-axis position| Z-axis position| */ - MAV_CMD_NAV_FOLLOW=25, /* Vehicle following, i.e. this waypoint represents the position of a moving vehicle |Following logic to use (e.g. loitering or sinusoidal following) - depends on specific autopilot implementation| Ground speed of vehicle to be followed| Radius around waypoint. If positive loiter clockwise, else counter-clockwise| Desired yaw angle.| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_CONTINUE_AND_CHANGE_ALT=30, /* Continue on the current course and climb/descend to specified altitude. When the altitude is reached continue to the next command (i.e., don't proceed to the next command until the desired altitude is reached. |Climb or Descend (0 = Neutral, command completes when within 5m of this command's altitude, 1 = Climbing, command completes when at or above this command's altitude, 2 = Descending, command completes when at or below this command's altitude.| Empty| Empty| Empty| Empty| Empty| Desired altitude| */ - MAV_CMD_NAV_LOITER_TO_ALT=31, /* Begin loiter at the specified Latitude and Longitude. If Lat=Lon=0, then loiter at the current position. Don't consider the navigation command complete (don't leave loiter) until the altitude has been reached. Additionally, if the Heading Required parameter is non-zero the aircraft will not leave the loiter until heading toward the next waypoint. |Leave loiter circle only once heading towards the next waypoint (0 = False)| Loiter radius around waypoint for forward-only moving vehicles (not multicopters). If positive loiter clockwise, negative counter-clockwise, 0 means no change to standard loiter.| Empty| Loiter circle exit location and/or path to next waypoint ("xtrack") for forward-only moving vehicles (not multicopters). 0 for the vehicle to converge towards the center xtrack when it leaves the loiter (the line between the centers of the current and next waypoint), 1 to converge to the direct line between the location that the vehicle exits the loiter radius and the next waypoint. Otherwise the angle (in degrees) between the tangent of the loiter circle and the center xtrack at which the vehicle must leave the loiter (and converge to the center xtrack). NaN to use the current system default xtrack behaviour.| Latitude| Longitude| Altitude| */ - MAV_CMD_DO_FOLLOW=32, /* Begin following a target |System ID (of the FOLLOW_TARGET beacon). Send 0 to disable follow-me and return to the default position hold mode.| Reserved| Reserved| Altitude mode: 0: Keep current altitude, 1: keep altitude difference to target, 2: go to a fixed altitude above home.| Altitude above home. (used if mode=2)| Reserved| Time to land in which the MAV should go to the default position hold mode after a message RX timeout.| */ - MAV_CMD_DO_FOLLOW_REPOSITION=33, /* Reposition the MAV after a follow target command has been sent |Camera q1 (where 0 is on the ray from the camera to the tracking device)| Camera q2| Camera q3| Camera q4| altitude offset from target| X offset from target| Y offset from target| */ - MAV_CMD_DO_ORBIT=34, /* Start orbiting on the circumference of a circle defined by the parameters. Setting any value NaN results in using defaults. |Radius of the circle. positive: Orbit clockwise. negative: Orbit counter-clockwise.| Tangential Velocity. NaN: Vehicle configuration default.| Yaw behavior of the vehicle.| Reserved (e.g. for dynamic center beacon options)| Center point latitude (if no MAV_FRAME specified) / X coordinate according to MAV_FRAME. NaN: Use current vehicle position or current center if already orbiting.| Center point longitude (if no MAV_FRAME specified) / Y coordinate according to MAV_FRAME. NaN: Use current vehicle position or current center if already orbiting.| Center point altitude (MSL) (if no MAV_FRAME specified) / Z coordinate according to MAV_FRAME. NaN: Use current vehicle position or current center if already orbiting.| */ - MAV_CMD_NAV_ROI=80, /* Sets the region of interest (ROI) for a sensor set or the vehicle itself. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. |Region of interest mode.| Waypoint index/ target ID. (see MAV_ROI enum)| ROI index (allows a vehicle to manage multiple ROI's)| Empty| x the location of the fixed ROI (see MAV_FRAME)| y| z| */ - MAV_CMD_NAV_PATHPLANNING=81, /* Control autonomous path planning on the MAV. |0: Disable local obstacle avoidance / local path planning (without resetting map), 1: Enable local path planning, 2: Enable and reset local path planning| 0: Disable full path planning (without resetting map), 1: Enable, 2: Enable and reset map/occupancy grid, 3: Enable and reset planned route, but not occupancy grid| Empty| Yaw angle at goal| Latitude/X of goal| Longitude/Y of goal| Altitude/Z of goal| */ - MAV_CMD_NAV_SPLINE_WAYPOINT=82, /* Navigate to waypoint using a spline path. |Hold time. (ignored by fixed wing, time to stay at waypoint for rotary wing)| Empty| Empty| Empty| Latitude/X of goal| Longitude/Y of goal| Altitude/Z of goal| */ - MAV_CMD_NAV_VTOL_TAKEOFF=84, /* Takeoff from ground using VTOL mode, and transition to forward flight with specified heading. The command should be ignored by vehicles that dont support both VTOL and fixed-wing flight (multicopters, boats,etc.). |Empty| Front transition heading.| Empty| Yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_VTOL_LAND=85, /* Land using VTOL mode |Empty| Empty| Approach altitude (with the same reference as the Altitude field). NaN if unspecified.| Yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude| Longitude| Altitude (ground level)| */ - MAV_CMD_NAV_GUIDED_ENABLE=92, /* hand control over to an external controller |On / Off (> 0.5f on)| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_NAV_DELAY=93, /* Delay the next navigation command a number of seconds or until a specified time |Delay (-1 to enable time-of-day fields)| hour (24h format, UTC, -1 to ignore)| minute (24h format, UTC, -1 to ignore)| second (24h format, UTC, -1 to ignore)| Empty| Empty| Empty| */ - MAV_CMD_NAV_PAYLOAD_PLACE=94, /* Descend and place payload. Vehicle moves to specified location, descends until it detects a hanging payload has reached the ground, and then releases the payload. If ground is not detected before the reaching the maximum descent value (param1), the command will complete without releasing the payload. |Maximum distance to descend.| Empty| Empty| Empty| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_LAST=95, /* NOP - This command is only used to mark the upper limit of the NAV/ACTION commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_CONDITION_DELAY=112, /* Delay mission state machine. |Delay| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_CONDITION_CHANGE_ALT=113, /* Ascend/descend to target altitude at specified rate. Delay mission state machine until desired altitude reached. |Descent / Ascend rate.| Empty| Empty| Empty| Empty| Empty| Target Altitude| */ - MAV_CMD_CONDITION_DISTANCE=114, /* Delay mission state machine until within desired distance of next NAV point. |Distance.| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_CONDITION_YAW=115, /* Reach a certain target angle. |target angle, 0 is north| angular speed| direction: -1: counter clockwise, 1: clockwise| 0: absolute angle, 1: relative offset| Empty| Empty| Empty| */ - MAV_CMD_CONDITION_LAST=159, /* NOP - This command is only used to mark the upper limit of the CONDITION commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_MODE=176, /* Set system mode. |Mode| Custom mode - this is system specific, please refer to the individual autopilot specifications for details.| Custom sub mode - this is system specific, please refer to the individual autopilot specifications for details.| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_JUMP=177, /* Jump to the desired command in the mission list. Repeat this action only the specified number of times |Sequence number| Repeat count| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_CHANGE_SPEED=178, /* Change speed and/or throttle set points. |Speed type (0=Airspeed, 1=Ground Speed, 2=Climb Speed, 3=Descent Speed)| Speed (-1 indicates no change)| Throttle (-1 indicates no change)| 0: absolute, 1: relative| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_HOME=179, /* Changes the home location either to the current location or a specified location. |Use current (1=use current location, 0=use specified location)| Empty| Empty| Yaw angle. NaN to use default heading| Latitude| Longitude| Altitude| */ - MAV_CMD_DO_SET_PARAMETER=180, /* Set a system parameter. Caution! Use of this command requires knowledge of the numeric enumeration value of the parameter. |Parameter number| Parameter value| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_RELAY=181, /* Set a relay to a condition. |Relay instance number.| Setting. (1=on, 0=off, others possible depending on system hardware)| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_REPEAT_RELAY=182, /* Cycle a relay on and off for a desired number of cycles with a desired period. |Relay instance number.| Cycle count.| Cycle time.| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_SERVO=183, /* Set a servo to a desired PWM value. |Servo instance number.| Pulse Width Modulation.| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_REPEAT_SERVO=184, /* Cycle a between its nominal setting and a desired PWM for a desired number of cycles with a desired period. |Servo instance number.| Pulse Width Modulation.| Cycle count.| Cycle time.| Empty| Empty| Empty| */ - MAV_CMD_DO_FLIGHTTERMINATION=185, /* Terminate flight immediately |Flight termination activated if > 0.5| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_CHANGE_ALTITUDE=186, /* Change altitude set point. |Altitude.| Frame of new altitude.| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_ACTUATOR=187, /* Sets actuators (e.g. servos) to a desired value. The actuator numbers are mapped to specific outputs (e.g. on any MAIN or AUX PWM or UAVCAN) using a flight-stack specific mechanism (i.e. a parameter). |Actuator 1 value, scaled from [-1 to 1]. NaN to ignore.| Actuator 2 value, scaled from [-1 to 1]. NaN to ignore.| Actuator 3 value, scaled from [-1 to 1]. NaN to ignore.| Actuator 4 value, scaled from [-1 to 1]. NaN to ignore.| Actuator 5 value, scaled from [-1 to 1]. NaN to ignore.| Actuator 6 value, scaled from [-1 to 1]. NaN to ignore.| Index of actuator set (i.e if set to 1, Actuator 1 becomes Actuator 7)| */ - MAV_CMD_DO_LAND_START=189, /* Mission command to perform a landing. This is used as a marker in a mission to tell the autopilot where a sequence of mission items that represents a landing starts. It may also be sent via a COMMAND_LONG to trigger a landing, in which case the nearest (geographically) landing sequence in the mission will be used. The Latitude/Longitude is optional, and may be set to 0 if not needed. If specified then it will be used to help find the closest landing sequence. |Empty| Empty| Empty| Empty| Latitude| Longitude| Empty| */ - MAV_CMD_DO_RALLY_LAND=190, /* Mission command to perform a landing from a rally point. |Break altitude| Landing speed| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_GO_AROUND=191, /* Mission command to safely abort an autonomous landing. |Altitude| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_REPOSITION=192, /* Reposition the vehicle to a specific WGS84 global position. |Ground speed, less than 0 (-1) for default| Bitmask of option flags.| Reserved| Yaw heading. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.). For planes indicates loiter direction (0: clockwise, 1: counter clockwise)| Latitude| Longitude| Altitude| */ - MAV_CMD_DO_PAUSE_CONTINUE=193, /* If in a GPS controlled position mode, hold the current position or continue. |0: Pause current mission or reposition command, hold current position. 1: Continue mission. A VTOL capable vehicle should enter hover mode (multicopter and VTOL planes). A plane should loiter with the default loiter radius.| Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| */ - MAV_CMD_DO_SET_REVERSE=194, /* Set moving direction to forward or reverse. |Direction (0=Forward, 1=Reverse)| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_ROI_LOCATION=195, /* Sets the region of interest (ROI) to a location. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. This command can be sent to a gimbal manager but not to a gimbal device. A gimbal is not to react to this message. |Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| Empty| Empty| Empty| Latitude of ROI location| Longitude of ROI location| Altitude of ROI location| */ - MAV_CMD_DO_SET_ROI_WPNEXT_OFFSET=196, /* Sets the region of interest (ROI) to be toward next waypoint, with optional pitch/roll/yaw offset. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. This command can be sent to a gimbal manager but not to a gimbal device. A gimbal device is not to react to this message. |Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| Empty| Empty| Empty| Pitch offset from next waypoint, positive pitching up| Roll offset from next waypoint, positive rolling to the right| Yaw offset from next waypoint, positive yawing to the right| */ - MAV_CMD_DO_SET_ROI_NONE=197, /* Cancels any previous ROI command returning the vehicle/sensors to default flight characteristics. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. This command can be sent to a gimbal manager but not to a gimbal device. A gimbal device is not to react to this message. After this command the gimbal manager should go back to manual input if available, and otherwise assume a neutral position. |Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_ROI_SYSID=198, /* Mount tracks system with specified system ID. Determination of target vehicle position may be done with GLOBAL_POSITION_INT or any other means. This command can be sent to a gimbal manager but not to a gimbal device. A gimbal device is not to react to this message. |System ID| Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_DO_CONTROL_VIDEO=200, /* Control onboard camera system. |Camera ID (-1 for all)| Transmission: 0: disabled, 1: enabled compressed, 2: enabled raw| Transmission mode: 0: video stream, >0: single images every n seconds| Recording: 0: disabled, 1: enabled compressed, 2: enabled raw| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_ROI=201, /* Sets the region of interest (ROI) for a sensor set or the vehicle itself. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. |Region of interest mode.| Waypoint index/ target ID (depends on param 1).| Region of interest index. (allows a vehicle to manage multiple ROI's)| Empty| MAV_ROI_WPNEXT: pitch offset from next waypoint, MAV_ROI_LOCATION: latitude| MAV_ROI_WPNEXT: roll offset from next waypoint, MAV_ROI_LOCATION: longitude| MAV_ROI_WPNEXT: yaw offset from next waypoint, MAV_ROI_LOCATION: altitude| */ - MAV_CMD_DO_DIGICAM_CONFIGURE=202, /* Configure digital camera. This is a fallback message for systems that have not yet implemented PARAM_EXT_XXX messages and camera definition files (see https://mavlink.io/en/services/camera_def.html ). |Modes: P, TV, AV, M, Etc.| Shutter speed: Divisor number for one second.| Aperture: F stop number.| ISO number e.g. 80, 100, 200, Etc.| Exposure type enumerator.| Command Identity.| Main engine cut-off time before camera trigger. (0 means no cut-off)| */ - MAV_CMD_DO_DIGICAM_CONTROL=203, /* Control digital camera. This is a fallback message for systems that have not yet implemented PARAM_EXT_XXX messages and camera definition files (see https://mavlink.io/en/services/camera_def.html ). |Session control e.g. show/hide lens| Zoom's absolute position| Zooming step value to offset zoom from the current position| Focus Locking, Unlocking or Re-locking| Shooting Command| Command Identity| Test shot identifier. If set to 1, image will only be captured, but not counted towards internal frame count.| */ - MAV_CMD_DO_MOUNT_CONFIGURE=204, /* Mission command to configure a camera or antenna mount |Mount operation mode| stabilize roll? (1 = yes, 0 = no)| stabilize pitch? (1 = yes, 0 = no)| stabilize yaw? (1 = yes, 0 = no)| roll input (0 = angle body frame, 1 = angular rate, 2 = angle absolute frame)| pitch input (0 = angle body frame, 1 = angular rate, 2 = angle absolute frame)| yaw input (0 = angle body frame, 1 = angular rate, 2 = angle absolute frame)| */ - MAV_CMD_DO_MOUNT_CONTROL=205, /* Mission command to control a camera or antenna mount |pitch depending on mount mode (degrees or degrees/second depending on pitch input).| roll depending on mount mode (degrees or degrees/second depending on roll input).| yaw depending on mount mode (degrees or degrees/second depending on yaw input).| altitude depending on mount mode.| latitude, set if appropriate mount mode.| longitude, set if appropriate mount mode.| Mount mode.| */ - MAV_CMD_DO_SET_CAM_TRIGG_DIST=206, /* Mission command to set camera trigger distance for this flight. The camera is triggered each time this distance is exceeded. This command can also be used to set the shutter integration time for the camera. |Camera trigger distance. 0 to stop triggering.| Camera shutter integration time. -1 or 0 to ignore| Trigger camera once immediately. (0 = no trigger, 1 = trigger)| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_FENCE_ENABLE=207, /* Mission command to enable the geofence |enable? (0=disable, 1=enable, 2=disable_floor_only)| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_PARACHUTE=208, /* Mission item/command to release a parachute or enable/disable auto release. |Action| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_MOTOR_TEST=209, /* Mission command to perform motor test. |Motor instance number. (from 1 to max number of motors on the vehicle)| Throttle type.| Throttle.| Timeout.| Motor count. (number of motors to test to test in sequence, waiting for the timeout above between them; 0=1 motor, 1=1 motor, 2=2 motors...)| Motor test order.| Empty| */ - MAV_CMD_DO_INVERTED_FLIGHT=210, /* Change to/from inverted flight. |Inverted flight. (0=normal, 1=inverted)| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_GRIPPER=211, /* Mission command to operate a gripper. |Gripper instance number.| Gripper action to perform.| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_AUTOTUNE_ENABLE=212, /* Enable/disable autotune. |Enable (1: enable, 0:disable).| Empty.| Empty.| Empty.| Empty.| Empty.| Empty.| */ - MAV_CMD_NAV_SET_YAW_SPEED=213, /* Sets a desired vehicle turn angle and speed change. |Yaw angle to adjust steering by.| Speed.| Final angle. (0=absolute, 1=relative)| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_CAM_TRIGG_INTERVAL=214, /* Mission command to set camera trigger interval for this flight. If triggering is enabled, the camera is triggered each time this interval expires. This command can also be used to set the shutter integration time for the camera. |Camera trigger cycle time. -1 or 0 to ignore.| Camera shutter integration time. Should be less than trigger cycle time. -1 or 0 to ignore.| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_MOUNT_CONTROL_QUAT=220, /* Mission command to control a camera or antenna mount, using a quaternion as reference. |quaternion param q1, w (1 in null-rotation)| quaternion param q2, x (0 in null-rotation)| quaternion param q3, y (0 in null-rotation)| quaternion param q4, z (0 in null-rotation)| Empty| Empty| Empty| */ - MAV_CMD_DO_GUIDED_MASTER=221, /* set id of master controller |System ID| Component ID| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_GUIDED_LIMITS=222, /* Set limits for external control |Timeout - maximum time that external controller will be allowed to control vehicle. 0 means no timeout.| Altitude (MSL) min - if vehicle moves below this alt, the command will be aborted and the mission will continue. 0 means no lower altitude limit.| Altitude (MSL) max - if vehicle moves above this alt, the command will be aborted and the mission will continue. 0 means no upper altitude limit.| Horizontal move limit - if vehicle moves more than this distance from its location at the moment the command was executed, the command will be aborted and the mission will continue. 0 means no horizontal move limit.| Empty| Empty| Empty| */ - MAV_CMD_DO_ENGINE_CONTROL=223, /* Control vehicle engine. This is interpreted by the vehicles engine controller to change the target engine state. It is intended for vehicles with internal combustion engines |0: Stop engine, 1:Start Engine| 0: Warm start, 1:Cold start. Controls use of choke where applicable| Height delay. This is for commanding engine start only after the vehicle has gained the specified height. Used in VTOL vehicles during takeoff to start engine after the aircraft is off the ground. Zero for no delay.| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_MISSION_CURRENT=224, /* Set the mission item with sequence number seq as current item. This means that the MAV will continue to this mission item on the shortest path (not following the mission items in-between). |Mission sequence value to set| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_LAST=240, /* NOP - This command is only used to mark the upper limit of the DO commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_PREFLIGHT_CALIBRATION=241, /* Trigger calibration. This command will be only accepted if in pre-flight mode. Except for Temperature Calibration, only one sensor should be set in a single message and all others should be zero. |1: gyro calibration, 3: gyro temperature calibration| 1: magnetometer calibration| 1: ground pressure calibration| 1: radio RC calibration, 2: RC trim calibration| 1: accelerometer calibration, 2: board level calibration, 3: accelerometer temperature calibration, 4: simple accelerometer calibration| 1: APM: compass/motor interference calibration (PX4: airspeed calibration, deprecated), 2: airspeed calibration| 1: ESC calibration, 3: barometer temperature calibration| */ - MAV_CMD_PREFLIGHT_SET_SENSOR_OFFSETS=242, /* Set sensor offsets. This command will be only accepted if in pre-flight mode. |Sensor to adjust the offsets for: 0: gyros, 1: accelerometer, 2: magnetometer, 3: barometer, 4: optical flow, 5: second magnetometer, 6: third magnetometer| X axis offset (or generic dimension 1), in the sensor's raw units| Y axis offset (or generic dimension 2), in the sensor's raw units| Z axis offset (or generic dimension 3), in the sensor's raw units| Generic dimension 4, in the sensor's raw units| Generic dimension 5, in the sensor's raw units| Generic dimension 6, in the sensor's raw units| */ - MAV_CMD_PREFLIGHT_UAVCAN=243, /* Trigger UAVCAN configuration (actuator ID assignment and direction mapping). Note that this maps to the legacy UAVCAN v0 function UAVCAN_ENUMERATE, which is intended to be executed just once during initial vehicle configuration (it is not a normal pre-flight command and has been poorly named). |1: Trigger actuator ID assignment and direction mapping. 0: Cancel command.| Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| */ - MAV_CMD_PREFLIGHT_STORAGE=245, /* Request storage of different parameter values and logs. This command will be only accepted if in pre-flight mode. |Parameter storage: 0: READ FROM FLASH/EEPROM, 1: WRITE CURRENT TO FLASH/EEPROM, 2: Reset to defaults| Mission storage: 0: READ FROM FLASH/EEPROM, 1: WRITE CURRENT TO FLASH/EEPROM, 2: Reset to defaults| Onboard logging: 0: Ignore, 1: Start default rate logging, -1: Stop logging, > 1: logging rate (e.g. set to 1000 for 1000 Hz logging)| Reserved| Empty| Empty| Empty| */ - MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN=246, /* Request the reboot or shutdown of system components. |0: Do nothing for autopilot, 1: Reboot autopilot, 2: Shutdown autopilot, 3: Reboot autopilot and keep it in the bootloader until upgraded.| 0: Do nothing for onboard computer, 1: Reboot onboard computer, 2: Shutdown onboard computer, 3: Reboot onboard computer and keep it in the bootloader until upgraded.| WIP: 0: Do nothing for camera, 1: Reboot onboard camera, 2: Shutdown onboard camera, 3: Reboot onboard camera and keep it in the bootloader until upgraded| WIP: 0: Do nothing for mount (e.g. gimbal), 1: Reboot mount, 2: Shutdown mount, 3: Reboot mount and keep it in the bootloader until upgraded| Reserved (set to 0)| Reserved (set to 0)| WIP: ID (e.g. camera ID -1 for all IDs)| */ - MAV_CMD_DO_UPGRADE=247, /* Request a target system to start an upgrade of one (or all) of its components. For example, the command might be sent to a companion computer to cause it to upgrade a connected flight controller. The system doing the upgrade will report progress using the normal command protocol sequence for a long running operation. Command protocol information: https://mavlink.io/en/services/command.html. |Component id of the component to be upgraded. If set to 0, all components should be upgraded.| 0: Do not reboot component after the action is executed, 1: Reboot component after the action is executed.| Reserved| Reserved| Reserved| Reserved| WIP: upgrade progress report rate (can be used for more granular control).| */ - MAV_CMD_OVERRIDE_GOTO=252, /* Override current mission with command to pause mission, pause mission and move to position, continue/resume mission. When param 1 indicates that the mission is paused (MAV_GOTO_DO_HOLD), param 2 defines whether it holds in place or moves to another position. |MAV_GOTO_DO_HOLD: pause mission and either hold or move to specified position (depending on param2), MAV_GOTO_DO_CONTINUE: resume mission.| MAV_GOTO_HOLD_AT_CURRENT_POSITION: hold at current position, MAV_GOTO_HOLD_AT_SPECIFIED_POSITION: hold at specified position.| Coordinate frame of hold point.| Desired yaw angle.| Latitude/X position.| Longitude/Y position.| Altitude/Z position.| */ - MAV_CMD_OBLIQUE_SURVEY=260, /* Mission command to set a Camera Auto Mount Pivoting Oblique Survey (Replaces CAM_TRIGG_DIST for this purpose). The camera is triggered each time this distance is exceeded, then the mount moves to the next position. Params 4~6 set-up the angle limits and number of positions for oblique survey, where mount-enabled vehicles automatically roll the camera between shots to emulate an oblique camera setup (providing an increased HFOV). This command can also be used to set the shutter integration time for the camera. |Camera trigger distance. 0 to stop triggering.| Camera shutter integration time. 0 to ignore| The minimum interval in which the camera is capable of taking subsequent pictures repeatedly. 0 to ignore.| Total number of roll positions at which the camera will capture photos (images captures spread evenly across the limits defined by param5).| Angle limits that the camera can be rolled to left and right of center.| Fixed pitch angle that the camera will hold in oblique mode if the mount is actuated in the pitch axis.| Empty| */ - MAV_CMD_MISSION_START=300, /* start running a mission |first_item: the first mission item to run| last_item: the last mission item to run (after this item is run, the mission ends)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_COMPONENT_ARM_DISARM=400, /* Arms / Disarms a component |0: disarm, 1: arm| 0: arm-disarm unless prevented by safety checks (i.e. when landed), 21196: force arming/disarming (e.g. allow arming to override preflight checks and disarming in flight)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_ILLUMINATOR_ON_OFF=405, /* Turns illuminators ON/OFF. An illuminator is a light source that is used for lighting up dark areas external to the sytstem: e.g. a torch or searchlight (as opposed to a light source for illuminating the system itself, e.g. an indicator light). |0: Illuminators OFF, 1: Illuminators ON| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_GET_HOME_POSITION=410, /* Request the home position from the vehicle. |Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| */ - MAV_CMD_INJECT_FAILURE=420, /* Inject artificial failure for testing purposes. Note that autopilots should implement an additional protection before accepting this command such as a specific param setting. |The unit which is affected by the failure.| The type how the failure manifests itself.| Instance affected by failure (0 to signal all).| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_START_RX_PAIR=500, /* Starts receiver pairing. |0:Spektrum.| RC type.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_GET_MESSAGE_INTERVAL=510, /* Request the interval between messages for a particular MAVLink message ID. The receiver should ACK the command and then emit its response in a MESSAGE_INTERVAL message. |The MAVLink message ID| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_SET_MESSAGE_INTERVAL=511, /* Set the interval between messages for a particular MAVLink message ID. This interface replaces REQUEST_DATA_STREAM. |The MAVLink message ID| The interval between two messages. Set to -1 to disable and 0 to request default rate.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Target address of message stream (if message has target address fields). 0: Flight-stack default (recommended), 1: address of requestor, 2: broadcast.| */ - MAV_CMD_REQUEST_MESSAGE=512, /* Request the target system(s) emit a single instance of a specified message (i.e. a "one-shot" version of MAV_CMD_SET_MESSAGE_INTERVAL). |The MAVLink message ID of the requested message.| Use for index ID, if required. Otherwise, the use of this parameter (if any) must be defined in the requested message. By default assumed not used (0).| The use of this parameter (if any), must be defined in the requested message. By default assumed not used (0).| The use of this parameter (if any), must be defined in the requested message. By default assumed not used (0).| The use of this parameter (if any), must be defined in the requested message. By default assumed not used (0).| The use of this parameter (if any), must be defined in the requested message. By default assumed not used (0).| Target address for requested message (if message has target address fields). 0: Flight-stack default, 1: address of requestor, 2: broadcast.| */ - MAV_CMD_REQUEST_PROTOCOL_VERSION=519, /* Request MAVLink protocol version compatibility. All receivers should ACK the command and then emit their capabilities in an PROTOCOL_VERSION message |1: Request supported protocol versions by all nodes on the network| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES=520, /* Request autopilot capabilities. The receiver should ACK the command and then emit its capabilities in an AUTOPILOT_VERSION message |1: Request autopilot version| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_CAMERA_INFORMATION=521, /* Request camera information (CAMERA_INFORMATION). |0: No action 1: Request camera capabilities| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_CAMERA_SETTINGS=522, /* Request camera settings (CAMERA_SETTINGS). |0: No Action 1: Request camera settings| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_STORAGE_INFORMATION=525, /* Request storage information (STORAGE_INFORMATION). Use the command's target_component to target a specific component's storage. |Storage ID (0 for all, 1 for first, 2 for second, etc.)| 0: No Action 1: Request storage information| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_STORAGE_FORMAT=526, /* Format a storage medium. Once format is complete, a STORAGE_INFORMATION message is sent. Use the command's target_component to target a specific component's storage. |Storage ID (1 for first, 2 for second, etc.)| Format storage (and reset image log). 0: No action 1: Format storage| Reset Image Log (without formatting storage medium). This will reset CAMERA_CAPTURE_STATUS.image_count and CAMERA_IMAGE_CAPTURED.image_index. 0: No action 1: Reset Image Log| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_CAMERA_CAPTURE_STATUS=527, /* Request camera capture status (CAMERA_CAPTURE_STATUS) |0: No Action 1: Request camera capture status| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_FLIGHT_INFORMATION=528, /* Request flight information (FLIGHT_INFORMATION) |1: Request flight information| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_RESET_CAMERA_SETTINGS=529, /* Reset all camera settings to Factory Default |0: No Action 1: Reset all settings| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_SET_CAMERA_MODE=530, /* Set camera running mode. Use NaN for reserved values. GCS will send a MAV_CMD_REQUEST_VIDEO_STREAM_STATUS command after a mode change if the camera supports video streaming. |Reserved (Set to 0)| Camera mode| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ - MAV_CMD_SET_CAMERA_ZOOM=531, /* Set camera zoom. Camera must respond with a CAMERA_SETTINGS message (on success). |Zoom type| Zoom value. The range of valid values depend on the zoom type.| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ - MAV_CMD_SET_CAMERA_FOCUS=532, /* Set camera focus. Camera must respond with a CAMERA_SETTINGS message (on success). |Focus type| Focus value| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ - MAV_CMD_JUMP_TAG=600, /* Tagged jump target. Can be jumped to with MAV_CMD_DO_JUMP_TAG. |Tag.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_DO_JUMP_TAG=601, /* Jump to the matching tag in the mission list. Repeat this action for the specified number of times. A mission should contain a single matching tag for each jump. If this is not the case then a jump to a missing tag should complete the mission, and a jump where there are multiple matching tags should always select the one with the lowest mission sequence number. |Target tag to jump to.| Repeat count.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_PARAM_TRANSACTION=900, /* Request to start or end a parameter transaction. Multiple kinds of transport layers can be used to exchange parameters in the transaction (param, param_ext and mavftp). The command response can either be a success/failure or an in progress in case the receiving side takes some time to apply the parameters. |Action to be performed (start, commit, cancel, etc.)| Possible transport layers to set and get parameters via mavlink during a parameter transaction.| Identifier for a specific transaction.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_DO_GIMBAL_MANAGER_PITCHYAW=1000, /* High level setpoint to be sent to a gimbal manager to set a gimbal attitude. It is possible to set combinations of the values below. E.g. an angle as well as a desired angular rate can be used to get to this angle at a certain angular rate, or an angular rate only will result in continuous turning. NaN is to be used to signal unset. Note: a gimbal is never to react to this command but only the gimbal manager. |Pitch angle (positive to pitch up, relative to vehicle for FOLLOW mode, relative to world horizon for LOCK mode).| Yaw angle (positive to yaw to the right, relative to vehicle for FOLLOW mode, absolute to North for LOCK mode).| Pitch rate (positive to pitch up).| Yaw rate (positive to yaw to the right).| Gimbal manager flags to use.| Reserved (default:0)| Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| */ - MAV_CMD_DO_GIMBAL_MANAGER_CONFIGURE=1001, /* Gimbal configuration to set which sysid/compid is in primary and secondary control. |Sysid for primary control (0: no one in control, -1: leave unchanged, -2: set itself in control (for missions where the own sysid is still unknown), -3: remove control if currently in control).| Compid for primary control (0: no one in control, -1: leave unchanged, -2: set itself in control (for missions where the own sysid is still unknown), -3: remove control if currently in control).| Sysid for secondary control (0: no one in control, -1: leave unchanged, -2: set itself in control (for missions where the own sysid is still unknown), -3: remove control if currently in control).| Compid for secondary control (0: no one in control, -1: leave unchanged, -2: set itself in control (for missions where the own sysid is still unknown), -3: remove control if currently in control).| Reserved (default:0)| Reserved (default:0)| Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| */ - MAV_CMD_IMAGE_START_CAPTURE=2000, /* Start image capture sequence. Sends CAMERA_IMAGE_CAPTURED after each capture. Use NaN for reserved values. |Reserved (Set to 0)| Desired elapsed time between two consecutive pictures (in seconds). Minimum values depend on hardware (typically greater than 2 seconds).| Total number of images to capture. 0 to capture forever/until MAV_CMD_IMAGE_STOP_CAPTURE.| Capture sequence number starting from 1. This is only valid for single-capture (param3 == 1), otherwise set to 0. Increment the capture ID for each capture command to prevent double captures when a command is re-transmitted.| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| */ - MAV_CMD_IMAGE_STOP_CAPTURE=2001, /* Stop image capture sequence Use NaN for reserved values. |Reserved (Set to 0)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ - MAV_CMD_REQUEST_CAMERA_IMAGE_CAPTURE=2002, /* Re-request a CAMERA_IMAGE_CAPTURED message. |Sequence number for missing CAMERA_IMAGE_CAPTURED message| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ - MAV_CMD_DO_TRIGGER_CONTROL=2003, /* Enable or disable on-board camera triggering system. |Trigger enable/disable (0 for disable, 1 for start), -1 to ignore| 1 to reset the trigger sequence, -1 or 0 to ignore| 1 to pause triggering, but without switching the camera off or retracting it. -1 to ignore| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_CAMERA_TRACK_POINT=2004, /* If the camera supports point visual tracking (CAMERA_CAP_FLAGS_HAS_TRACKING_POINT is set), this command allows to initiate the tracking. |Point to track x value (normalized 0..1, 0 is left, 1 is right).| Point to track y value (normalized 0..1, 0 is top, 1 is bottom).| Point radius (normalized 0..1, 0 is image left, 1 is image right).| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_CAMERA_TRACK_RECTANGLE=2005, /* If the camera supports rectangle visual tracking (CAMERA_CAP_FLAGS_HAS_TRACKING_RECTANGLE is set), this command allows to initiate the tracking. |Top left corner of rectangle x value (normalized 0..1, 0 is left, 1 is right).| Top left corner of rectangle y value (normalized 0..1, 0 is top, 1 is bottom).| Bottom right corner of rectangle x value (normalized 0..1, 0 is left, 1 is right).| Bottom right corner of rectangle y value (normalized 0..1, 0 is top, 1 is bottom).| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_CAMERA_STOP_TRACKING=2010, /* Stops ongoing tracking. |Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_VIDEO_START_CAPTURE=2500, /* Starts video capture (recording). |Video Stream ID (0 for all streams)| Frequency CAMERA_CAPTURE_STATUS messages should be sent while recording (0 for no messages, otherwise frequency)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| */ - MAV_CMD_VIDEO_STOP_CAPTURE=2501, /* Stop the current video capture (recording). |Video Stream ID (0 for all streams)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| */ - MAV_CMD_VIDEO_START_STREAMING=2502, /* Start video streaming |Video Stream ID (0 for all streams, 1 for first, 2 for second, etc.)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_VIDEO_STOP_STREAMING=2503, /* Stop the given video stream |Video Stream ID (0 for all streams, 1 for first, 2 for second, etc.)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_VIDEO_STREAM_INFORMATION=2504, /* Request video stream information (VIDEO_STREAM_INFORMATION) |Video Stream ID (0 for all streams, 1 for first, 2 for second, etc.)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_VIDEO_STREAM_STATUS=2505, /* Request video stream status (VIDEO_STREAM_STATUS) |Video Stream ID (0 for all streams, 1 for first, 2 for second, etc.)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_LOGGING_START=2510, /* Request to start streaming logging data over MAVLink (see also LOGGING_DATA message) |Format: 0: ULog| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| */ - MAV_CMD_LOGGING_STOP=2511, /* Request to stop streaming log data over MAVLink |Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| */ - MAV_CMD_AIRFRAME_CONFIGURATION=2520, /* |Landing gear ID (default: 0, -1 for all)| Landing gear position (Down: 0, Up: 1, NaN for no change)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| */ - MAV_CMD_CONTROL_HIGH_LATENCY=2600, /* Request to start/stop transmitting over the high latency telemetry |Control transmission over high latency telemetry (0: stop, 1: start)| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_PANORAMA_CREATE=2800, /* Create a panorama at the current position |Viewing angle horizontal of the panorama (+- 0.5 the total angle)| Viewing angle vertical of panorama.| Speed of the horizontal rotation.| Speed of the vertical rotation.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_DO_VTOL_TRANSITION=3000, /* Request VTOL transition |The target VTOL state. Only MAV_VTOL_STATE_MC and MAV_VTOL_STATE_FW can be used.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_ARM_AUTHORIZATION_REQUEST=3001, /* Request authorization to arm the vehicle to a external entity, the arm authorizer is responsible to request all data that is needs from the vehicle before authorize or deny the request. If approved the progress of command_ack message should be set with period of time that this authorization is valid in seconds or in case it was denied it should be set with one of the reasons in ARM_AUTH_DENIED_REASON. - |Vehicle system id, this way ground station can request arm authorization on behalf of any vehicle| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_SET_GUIDED_SUBMODE_STANDARD=4000, /* This command sets the submode to standard guided when vehicle is in guided mode. The vehicle holds position and altitude and the user can input the desired velocities along all three axes. - |Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_SET_GUIDED_SUBMODE_CIRCLE=4001, /* This command sets submode circle when vehicle is in guided mode. Vehicle flies along a circle facing the center of the circle. The user can input the velocity along the circle and change the radius. If no input is given the vehicle will hold position. - |Radius of desired circle in CIRCLE_MODE| User defined| User defined| User defined| Target latitude of center of circle in CIRCLE_MODE| Target longitude of center of circle in CIRCLE_MODE| Reserved (default:0)| */ - MAV_CMD_CONDITION_GATE=4501, /* Delay mission state machine until gate has been reached. |Geometry: 0: orthogonal to path between previous and next waypoint.| Altitude: 0: ignore altitude| Empty| Empty| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_FENCE_RETURN_POINT=5000, /* Fence return point. There can only be one fence return point. - |Reserved| Reserved| Reserved| Reserved| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_FENCE_POLYGON_VERTEX_INCLUSION=5001, /* Fence vertex for an inclusion polygon (the polygon must not be self-intersecting). The vehicle must stay within this area. Minimum of 3 vertices required. - |Polygon vertex count| Vehicle must be inside ALL inclusion zones in a single group, vehicle must be inside at least one group, must be the same for all points in each polygon| Reserved| Reserved| Latitude| Longitude| Reserved| */ - MAV_CMD_NAV_FENCE_POLYGON_VERTEX_EXCLUSION=5002, /* Fence vertex for an exclusion polygon (the polygon must not be self-intersecting). The vehicle must stay outside this area. Minimum of 3 vertices required. - |Polygon vertex count| Reserved| Reserved| Reserved| Latitude| Longitude| Reserved| */ - MAV_CMD_NAV_FENCE_CIRCLE_INCLUSION=5003, /* Circular fence area. The vehicle must stay inside this area. - |Radius.| Vehicle must be inside ALL inclusion zones in a single group, vehicle must be inside at least one group| Reserved| Reserved| Latitude| Longitude| Reserved| */ - MAV_CMD_NAV_FENCE_CIRCLE_EXCLUSION=5004, /* Circular fence area. The vehicle must stay outside this area. - |Radius.| Reserved| Reserved| Reserved| Latitude| Longitude| Reserved| */ - MAV_CMD_NAV_RALLY_POINT=5100, /* Rally point. You can have multiple rally points defined. - |Reserved| Reserved| Reserved| Reserved| Latitude| Longitude| Altitude| */ - MAV_CMD_UAVCAN_GET_NODE_INFO=5200, /* Commands the vehicle to respond with a sequence of messages UAVCAN_NODE_INFO, one message per every UAVCAN node that is online. Note that some of the response messages can be lost, which the receiver can detect easily by checking whether every received UAVCAN_NODE_STATUS has a matching message UAVCAN_NODE_INFO received earlier; if not, this command should be sent again in order to request re-transmission of the node information messages. |Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| */ - MAV_CMD_PAYLOAD_PREPARE_DEPLOY=30001, /* Deploy payload on a Lat / Lon / Alt position. This includes the navigation to reach the required release position and velocity. |Operation mode. 0: prepare single payload deploy (overwriting previous requests), but do not execute it. 1: execute payload deploy immediately (rejecting further deploy commands during execution, but allowing abort). 2: add payload deploy to existing deployment list.| Desired approach vector in compass heading. A negative value indicates the system can define the approach vector at will.| Desired ground speed at release time. This can be overridden by the airframe in case it needs to meet minimum airspeed. A negative value indicates the system can define the ground speed at will.| Minimum altitude clearance to the release position. A negative value indicates the system can define the clearance at will.| Latitude. Note, if used in MISSION_ITEM (deprecated) the units are degrees (unscaled)| Longitude. Note, if used in MISSION_ITEM (deprecated) the units are degrees (unscaled)| Altitude (MSL)| */ - MAV_CMD_PAYLOAD_CONTROL_DEPLOY=30002, /* Control the payload deployment. |Operation mode. 0: Abort deployment, continue normal mission. 1: switch to payload deployment mode. 100: delete first payload deployment request. 101: delete all payload deployment requests.| Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| */ - MAV_CMD_WAYPOINT_USER_1=31000, /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_WAYPOINT_USER_2=31001, /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_WAYPOINT_USER_3=31002, /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_WAYPOINT_USER_4=31003, /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_WAYPOINT_USER_5=31004, /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_SPATIAL_USER_1=31005, /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_SPATIAL_USER_2=31006, /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_SPATIAL_USER_3=31007, /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_SPATIAL_USER_4=31008, /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_SPATIAL_USER_5=31009, /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_USER_1=31010, /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ - MAV_CMD_USER_2=31011, /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ - MAV_CMD_USER_3=31012, /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ - MAV_CMD_USER_4=31013, /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ - MAV_CMD_USER_5=31014, /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ - MAV_CMD_FIXED_MAG_CAL_YAW=42006, /* Magnetometer calibration based on provided known yaw. This allows for fast calibration using WMM field tables in the vehicle, given only the known yaw of the vehicle. If Latitude and longitude are both zero then use the current vehicle location. |Yaw of vehicle in earth frame.| CompassMask, 0 for all.| Latitude.| Longitude.| Empty.| Empty.| Empty.| */ - MAV_CMD_DO_WINCH=42600, /* Command to operate winch. |Winch instance number.| Action to perform.| Length of cable to release (negative to wind).| Release rate (negative to wind).| Empty.| Empty.| Empty.| */ - MAV_CMD_ENUM_END=42601, /* | */ -} MAV_CMD; +/** @brief Actuator configuration, used to change a setting on an actuator. Component information metadata can be used to know which outputs support which commands. */ +#ifndef HAVE_ENUM_ACTUATOR_CONFIGURATION +#define HAVE_ENUM_ACTUATOR_CONFIGURATION +typedef enum ACTUATOR_CONFIGURATION +{ + ACTUATOR_CONFIGURATION_NONE=0, /* Do nothing. | */ + ACTUATOR_CONFIGURATION_BEEP=1, /* Command the actuator to beep now. | */ + ACTUATOR_CONFIGURATION_3D_MODE_ON=2, /* Permanently set the actuator (ESC) to 3D mode (reversible thrust). | */ + ACTUATOR_CONFIGURATION_3D_MODE_OFF=3, /* Permanently set the actuator (ESC) to non 3D mode (non-reversible thrust). | */ + ACTUATOR_CONFIGURATION_SPIN_DIRECTION1=4, /* Permanently set the actuator (ESC) to spin direction 1 (which can be clockwise or counter-clockwise). | */ + ACTUATOR_CONFIGURATION_SPIN_DIRECTION2=5, /* Permanently set the actuator (ESC) to spin direction 2 (opposite of direction 1). | */ + ACTUATOR_CONFIGURATION_ENUM_END=6, /* | */ +} ACTUATOR_CONFIGURATION; +#endif + +/** @brief Actuator output function. Values greater or equal to 1000 are autopilot-specific. */ +#ifndef HAVE_ENUM_ACTUATOR_OUTPUT_FUNCTION +#define HAVE_ENUM_ACTUATOR_OUTPUT_FUNCTION +typedef enum ACTUATOR_OUTPUT_FUNCTION +{ + ACTUATOR_OUTPUT_FUNCTION_NONE=0, /* No function (disabled). | */ + ACTUATOR_OUTPUT_FUNCTION_MOTOR1=1, /* Motor 1 | */ + ACTUATOR_OUTPUT_FUNCTION_MOTOR2=2, /* Motor 2 | */ + ACTUATOR_OUTPUT_FUNCTION_MOTOR3=3, /* Motor 3 | */ + ACTUATOR_OUTPUT_FUNCTION_MOTOR4=4, /* Motor 4 | */ + ACTUATOR_OUTPUT_FUNCTION_MOTOR5=5, /* Motor 5 | */ + ACTUATOR_OUTPUT_FUNCTION_MOTOR6=6, /* Motor 6 | */ + ACTUATOR_OUTPUT_FUNCTION_MOTOR7=7, /* Motor 7 | */ + ACTUATOR_OUTPUT_FUNCTION_MOTOR8=8, /* Motor 8 | */ + ACTUATOR_OUTPUT_FUNCTION_MOTOR9=9, /* Motor 9 | */ + ACTUATOR_OUTPUT_FUNCTION_MOTOR10=10, /* Motor 10 | */ + ACTUATOR_OUTPUT_FUNCTION_MOTOR11=11, /* Motor 11 | */ + ACTUATOR_OUTPUT_FUNCTION_MOTOR12=12, /* Motor 12 | */ + ACTUATOR_OUTPUT_FUNCTION_MOTOR13=13, /* Motor 13 | */ + ACTUATOR_OUTPUT_FUNCTION_MOTOR14=14, /* Motor 14 | */ + ACTUATOR_OUTPUT_FUNCTION_MOTOR15=15, /* Motor 15 | */ + ACTUATOR_OUTPUT_FUNCTION_MOTOR16=16, /* Motor 16 | */ + ACTUATOR_OUTPUT_FUNCTION_SERVO1=33, /* Servo 1 | */ + ACTUATOR_OUTPUT_FUNCTION_SERVO2=34, /* Servo 2 | */ + ACTUATOR_OUTPUT_FUNCTION_SERVO3=35, /* Servo 3 | */ + ACTUATOR_OUTPUT_FUNCTION_SERVO4=36, /* Servo 4 | */ + ACTUATOR_OUTPUT_FUNCTION_SERVO5=37, /* Servo 5 | */ + ACTUATOR_OUTPUT_FUNCTION_SERVO6=38, /* Servo 6 | */ + ACTUATOR_OUTPUT_FUNCTION_SERVO7=39, /* Servo 7 | */ + ACTUATOR_OUTPUT_FUNCTION_SERVO8=40, /* Servo 8 | */ + ACTUATOR_OUTPUT_FUNCTION_SERVO9=41, /* Servo 9 | */ + ACTUATOR_OUTPUT_FUNCTION_SERVO10=42, /* Servo 10 | */ + ACTUATOR_OUTPUT_FUNCTION_SERVO11=43, /* Servo 11 | */ + ACTUATOR_OUTPUT_FUNCTION_SERVO12=44, /* Servo 12 | */ + ACTUATOR_OUTPUT_FUNCTION_SERVO13=45, /* Servo 13 | */ + ACTUATOR_OUTPUT_FUNCTION_SERVO14=46, /* Servo 14 | */ + ACTUATOR_OUTPUT_FUNCTION_SERVO15=47, /* Servo 15 | */ + ACTUATOR_OUTPUT_FUNCTION_SERVO16=48, /* Servo 16 | */ + ACTUATOR_OUTPUT_FUNCTION_ENUM_END=49, /* | */ +} ACTUATOR_OUTPUT_FUNCTION; +#endif + +/** @brief Axes that will be autotuned by MAV_CMD_DO_AUTOTUNE_ENABLE. + Note that at least one flag must be set in MAV_CMD_DO_AUTOTUNE_ENABLE.param2: if none are set, the flight stack will tune its default set of axes. */ +#ifndef HAVE_ENUM_AUTOTUNE_AXIS +#define HAVE_ENUM_AUTOTUNE_AXIS +typedef enum AUTOTUNE_AXIS +{ + AUTOTUNE_AXIS_ROLL=1, /* Autotune roll axis. | */ + AUTOTUNE_AXIS_PITCH=2, /* Autotune pitch axis. | */ + AUTOTUNE_AXIS_YAW=4, /* Autotune yaw axis. | */ + AUTOTUNE_AXIS_ENUM_END=5, /* | */ +} AUTOTUNE_AXIS; +#endif + +/** @brief + Actions for reading/writing parameters between persistent and volatile storage when using MAV_CMD_PREFLIGHT_STORAGE. + (Commonly parameters are loaded from persistent storage (flash/EEPROM) into volatile storage (RAM) on startup and written back when they are changed.) + */ +#ifndef HAVE_ENUM_PREFLIGHT_STORAGE_PARAMETER_ACTION +#define HAVE_ENUM_PREFLIGHT_STORAGE_PARAMETER_ACTION +typedef enum PREFLIGHT_STORAGE_PARAMETER_ACTION +{ + PARAM_READ_PERSISTENT=0, /* Read all parameters from persistent storage. Replaces values in volatile storage. | */ + PARAM_WRITE_PERSISTENT=1, /* Write all parameter values to persistent storage (flash/EEPROM) | */ + PARAM_RESET_CONFIG_DEFAULT=2, /* Reset all user configurable parameters to their default value (including airframe selection, sensor calibration data, safety settings, and so on). Does not reset values that contain operation counters and vehicle computed statistics. | */ + PARAM_RESET_SENSOR_DEFAULT=3, /* Reset only sensor calibration parameters to factory defaults (or firmware default if not available) | */ + PARAM_RESET_ALL_DEFAULT=4, /* Reset all parameters, including operation counters, to default values | */ + PREFLIGHT_STORAGE_PARAMETER_ACTION_ENUM_END=5, /* | */ +} PREFLIGHT_STORAGE_PARAMETER_ACTION; +#endif + +/** @brief + Actions for reading and writing plan information (mission, rally points, geofence) between persistent and volatile storage when using MAV_CMD_PREFLIGHT_STORAGE. + (Commonly missions are loaded from persistent storage (flash/EEPROM) into volatile storage (RAM) on startup and written back when they are changed.) + */ +#ifndef HAVE_ENUM_PREFLIGHT_STORAGE_MISSION_ACTION +#define HAVE_ENUM_PREFLIGHT_STORAGE_MISSION_ACTION +typedef enum PREFLIGHT_STORAGE_MISSION_ACTION +{ + MISSION_READ_PERSISTENT=0, /* Read current mission data from persistent storage | */ + MISSION_WRITE_PERSISTENT=1, /* Write current mission data to persistent storage | */ + MISSION_RESET_DEFAULT=2, /* Erase all mission data stored on the vehicle (both persistent and volatile storage) | */ + PREFLIGHT_STORAGE_MISSION_ACTION_ENUM_END=3, /* | */ +} PREFLIGHT_STORAGE_MISSION_ACTION; +#endif + +/** @brief Reboot/shutdown action for selected component in MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN. */ +#ifndef HAVE_ENUM_REBOOT_SHUTDOWN_ACTION +#define HAVE_ENUM_REBOOT_SHUTDOWN_ACTION +typedef enum REBOOT_SHUTDOWN_ACTION +{ + REBOOT_SHUTDOWN_ACTION_NONE=0, /* Do nothing. | */ + REBOOT_SHUTDOWN_ACTION_REBOOT=1, /* Reboot component. | */ + REBOOT_SHUTDOWN_ACTION_SHUTDOWN=2, /* Shutdown component. | */ + REBOOT_SHUTDOWN_ACTION_REBOOT_TO_BOOTLOADER=3, /* Reboot component and keep it in the bootloader until upgraded. | */ + REBOOT_SHUTDOWN_ACTION_POWER_ON=4, /* Power on component. Do nothing if component is already powered (ACK command with MAV_RESULT_ACCEPTED). | */ + REBOOT_SHUTDOWN_ACTION_ENUM_END=5, /* | */ +} REBOOT_SHUTDOWN_ACTION; +#endif + +/** @brief Specifies the conditions under which the MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN command should be accepted. */ +#ifndef HAVE_ENUM_REBOOT_SHUTDOWN_CONDITIONS +#define HAVE_ENUM_REBOOT_SHUTDOWN_CONDITIONS +typedef enum REBOOT_SHUTDOWN_CONDITIONS +{ + REBOOT_SHUTDOWN_CONDITIONS_SAFETY_INTERLOCKED=0, /* Reboot/Shutdown only if allowed by safety checks, such as being landed. | */ + REBOOT_SHUTDOWN_CONDITIONS_FORCE=20190226, /* Force reboot/shutdown of the autopilot/component regardless of system state. | */ + REBOOT_SHUTDOWN_CONDITIONS_ENUM_END=20190227, /* | */ +} REBOOT_SHUTDOWN_CONDITIONS; #endif /** @brief A data stream is not a fixed set of messages, but rather a @@ -724,7 +709,7 @@ typedef enum MAV_DATA_STREAM MAV_DATA_STREAM_EXTENDED_STATUS=2, /* Enable GPS_STATUS, CONTROL_STATUS, AUX_STATUS | */ MAV_DATA_STREAM_RC_CHANNELS=3, /* Enable RC_CHANNELS_SCALED, RC_CHANNELS_RAW, SERVO_OUTPUT_RAW | */ MAV_DATA_STREAM_RAW_CONTROLLER=4, /* Enable ATTITUDE_CONTROLLER_OUTPUT, POSITION_CONTROLLER_OUTPUT, NAV_CONTROLLER_OUTPUT. | */ - MAV_DATA_STREAM_POSITION=6, /* Enable LOCAL_POSITION, GLOBAL_POSITION/GLOBAL_POSITION_INT messages. | */ + MAV_DATA_STREAM_POSITION=6, /* Enable LOCAL_POSITION, GLOBAL_POSITION_INT messages. | */ MAV_DATA_STREAM_EXTRA1=10, /* Dependent on the autopilot | */ MAV_DATA_STREAM_EXTRA2=11, /* Dependent on the autopilot | */ MAV_DATA_STREAM_EXTRA3=12, /* Dependent on the autopilot | */ @@ -748,24 +733,6 @@ typedef enum MAV_ROI } MAV_ROI; #endif -/** @brief ACK / NACK / ERROR values as a result of MAV_CMDs and for mission item transmission. */ -#ifndef HAVE_ENUM_MAV_CMD_ACK -#define HAVE_ENUM_MAV_CMD_ACK -typedef enum MAV_CMD_ACK -{ - MAV_CMD_ACK_OK=1, /* Command / mission item is ok. |Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_ACK_ERR_FAIL=2, /* Generic error message if none of the other reasons fails or if no detailed error reporting is implemented. |Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_ACK_ERR_ACCESS_DENIED=3, /* The system is refusing to accept this command from this source / communication partner. |Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_ACK_ERR_NOT_SUPPORTED=4, /* Command or mission item is not supported, other commands would be accepted. |Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_ACK_ERR_COORDINATE_FRAME_NOT_SUPPORTED=5, /* The coordinate frame of this command / mission item is not supported. |Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_ACK_ERR_COORDINATES_OUT_OF_RANGE=6, /* The coordinate frame of this command is ok, but he coordinate values exceed the safety limits of this system. This is a generic error, please use the more specific error messages below if possible. |Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_ACK_ERR_X_LAT_OUT_OF_RANGE=7, /* The X or latitude value is out of range. |Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_ACK_ERR_Y_LON_OUT_OF_RANGE=8, /* The Y or longitude value is out of range. |Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_ACK_ERR_Z_ALT_OUT_OF_RANGE=9, /* The Z or altitude value is out of range. |Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_ACK_ENUM_END=10, /* | */ -} MAV_CMD_ACK; -#endif - /** @brief Specifies the datatype of a MAVLink parameter. */ #ifndef HAVE_ENUM_MAV_PARAM_TYPE #define HAVE_ENUM_MAV_PARAM_TYPE @@ -785,6 +752,21 @@ typedef enum MAV_PARAM_TYPE } MAV_PARAM_TYPE; #endif +/** @brief Parameter protocol error types (see PARAM_ERROR). */ +#ifndef HAVE_ENUM_MAV_PARAM_ERROR +#define HAVE_ENUM_MAV_PARAM_ERROR +typedef enum MAV_PARAM_ERROR +{ + MAV_PARAM_ERROR_NO_ERROR=0, /* No error occurred (not expected in PARAM_ERROR but may be used in future implementations. | */ + MAV_PARAM_ERROR_DOES_NOT_EXIST=1, /* Parameter does not exist | */ + MAV_PARAM_ERROR_VALUE_OUT_OF_RANGE=2, /* Parameter value does not fit within accepted range | */ + MAV_PARAM_ERROR_PERMISSION_DENIED=3, /* Caller is not permitted to set the value of this parameter | */ + MAV_PARAM_ERROR_COMPONENT_NOT_FOUND=4, /* Unknown component specified | */ + MAV_PARAM_ERROR_READ_ONLY=5, /* Parameter is read-only | */ + MAV_PARAM_ERROR_ENUM_END=6, /* | */ +} MAV_PARAM_ERROR; +#endif + /** @brief Specifies the datatype of a MAVLink extended parameter. */ #ifndef HAVE_ENUM_MAV_PARAM_EXT_TYPE #define HAVE_ENUM_MAV_PARAM_EXT_TYPE @@ -817,7 +799,11 @@ typedef enum MAV_RESULT MAV_RESULT_FAILED=4, /* Command is valid, but execution has failed. This is used to indicate any non-temporary or unexpected problem, i.e. any problem that must be fixed before the command can succeed/be retried. For example, attempting to write a file when out of memory, attempting to arm when sensors are not calibrated, etc. | */ MAV_RESULT_IN_PROGRESS=5, /* Command is valid and is being executed. This will be followed by further progress updates, i.e. the component may send further COMMAND_ACK messages with result MAV_RESULT_IN_PROGRESS (at a rate decided by the implementation), and must terminate by sending a COMMAND_ACK message with final result of the operation. The COMMAND_ACK.progress field can be used to indicate the progress of the operation. | */ MAV_RESULT_CANCELLED=6, /* Command has been cancelled (as a result of receiving a COMMAND_CANCEL message). | */ - MAV_RESULT_ENUM_END=7, /* | */ + MAV_RESULT_COMMAND_LONG_ONLY=7, /* Command is only accepted when sent as a COMMAND_LONG. | */ + MAV_RESULT_COMMAND_INT_ONLY=8, /* Command is only accepted when sent as a COMMAND_INT. | */ + MAV_RESULT_COMMAND_UNSUPPORTED_MAV_FRAME=9, /* Command is invalid because a frame is required and the specified frame is not supported. | */ + MAV_RESULT_NOT_IN_CONTROL=10, /* Command has been rejected because source system is not in control of the target system/component. | */ + MAV_RESULT_ENUM_END=11, /* | */ } MAV_RESULT; #endif @@ -981,32 +967,6 @@ typedef enum MAV_SENSOR_ORIENTATION } MAV_SENSOR_ORIENTATION; #endif -/** @brief Bitmask of (optional) autopilot capabilities (64 bit). If a bit is set, the autopilot supports this capability. */ -#ifndef HAVE_ENUM_MAV_PROTOCOL_CAPABILITY -#define HAVE_ENUM_MAV_PROTOCOL_CAPABILITY -typedef enum MAV_PROTOCOL_CAPABILITY -{ - MAV_PROTOCOL_CAPABILITY_MISSION_FLOAT=1, /* Autopilot supports MISSION float message type. | */ - MAV_PROTOCOL_CAPABILITY_PARAM_FLOAT=2, /* Autopilot supports the new param float message type. | */ - MAV_PROTOCOL_CAPABILITY_MISSION_INT=4, /* Autopilot supports MISSION_ITEM_INT scaled integer message type. | */ - MAV_PROTOCOL_CAPABILITY_COMMAND_INT=8, /* Autopilot supports COMMAND_INT scaled integer message type. | */ - MAV_PROTOCOL_CAPABILITY_PARAM_UNION=16, /* Autopilot supports the new param union message type. | */ - MAV_PROTOCOL_CAPABILITY_FTP=32, /* Autopilot supports the new FILE_TRANSFER_PROTOCOL message type. | */ - MAV_PROTOCOL_CAPABILITY_SET_ATTITUDE_TARGET=64, /* Autopilot supports commanding attitude offboard. | */ - MAV_PROTOCOL_CAPABILITY_SET_POSITION_TARGET_LOCAL_NED=128, /* Autopilot supports commanding position and velocity targets in local NED frame. | */ - MAV_PROTOCOL_CAPABILITY_SET_POSITION_TARGET_GLOBAL_INT=256, /* Autopilot supports commanding position and velocity targets in global scaled integers. | */ - MAV_PROTOCOL_CAPABILITY_TERRAIN=512, /* Autopilot supports terrain protocol / data handling. | */ - MAV_PROTOCOL_CAPABILITY_SET_ACTUATOR_TARGET=1024, /* Autopilot supports direct actuator control. | */ - MAV_PROTOCOL_CAPABILITY_FLIGHT_TERMINATION=2048, /* Autopilot supports the flight termination command. | */ - MAV_PROTOCOL_CAPABILITY_COMPASS_CALIBRATION=4096, /* Autopilot supports onboard compass calibration. | */ - MAV_PROTOCOL_CAPABILITY_MAVLINK2=8192, /* Autopilot supports MAVLink version 2. | */ - MAV_PROTOCOL_CAPABILITY_MISSION_FENCE=16384, /* Autopilot supports mission fence protocol. | */ - MAV_PROTOCOL_CAPABILITY_MISSION_RALLY=32768, /* Autopilot supports mission rally point protocol. | */ - MAV_PROTOCOL_CAPABILITY_FLIGHT_INFORMATION=65536, /* Autopilot supports the flight information protocol. | */ - MAV_PROTOCOL_CAPABILITY_ENUM_END=65537, /* | */ -} MAV_PROTOCOL_CAPABILITY; -#endif - /** @brief Type of mission items being requested/sent in mission protocol. */ #ifndef HAVE_ENUM_MAV_MISSION_TYPE #define HAVE_ENUM_MAV_MISSION_TYPE @@ -1061,7 +1021,7 @@ typedef enum MAV_BATTERY_FUNCTION MAV_BATTERY_FUNCTION_ALL=1, /* Battery supports all flight systems | */ MAV_BATTERY_FUNCTION_PROPULSION=2, /* Battery for the propulsion system | */ MAV_BATTERY_FUNCTION_AVIONICS=3, /* Avionics battery | */ - MAV_BATTERY_TYPE_PAYLOAD=4, /* Payload battery | */ + MAV_BATTERY_FUNCTION_PAYLOAD=4, /* Payload battery | */ MAV_BATTERY_FUNCTION_ENUM_END=5, /* | */ } MAV_BATTERY_FUNCTION; #endif @@ -1107,10 +1067,24 @@ typedef enum MAV_BATTERY_FAULT MAV_BATTERY_FAULT_OVER_TEMPERATURE=16, /* Over-temperature fault. | */ MAV_BATTERY_FAULT_UNDER_TEMPERATURE=32, /* Under-temperature fault. | */ MAV_BATTERY_FAULT_INCOMPATIBLE_VOLTAGE=64, /* Vehicle voltage is not compatible with this battery (batteries on same power rail should have similar voltage). | */ - MAV_BATTERY_FAULT_ENUM_END=65, /* | */ + MAV_BATTERY_FAULT_INCOMPATIBLE_FIRMWARE=128, /* Battery firmware is not compatible with current autopilot firmware. | */ + BATTERY_FAULT_INCOMPATIBLE_CELLS_CONFIGURATION=256, /* Battery is not compatible due to cell configuration (e.g. 5s1p when vehicle requires 6s). | */ + MAV_BATTERY_FAULT_ENUM_END=257, /* | */ } MAV_BATTERY_FAULT; #endif +/** @brief Fuel types for use in FUEL_TYPE. Fuel types specify the units for the maximum, available and consumed fuel, and for the flow rates. */ +#ifndef HAVE_ENUM_MAV_FUEL_TYPE +#define HAVE_ENUM_MAV_FUEL_TYPE +typedef enum MAV_FUEL_TYPE +{ + MAV_FUEL_TYPE_UNKNOWN=0, /* Not specified. Fuel levels are normalized (i.e. maximum is 1, and other levels are relative to 1). | */ + MAV_FUEL_TYPE_LIQUID=1, /* A generic liquid fuel. Fuel levels are in millilitres (ml). Fuel rates are in millilitres/second. | */ + MAV_FUEL_TYPE_GAS=2, /* A gas tank. Fuel levels are in kilo-Pascal (kPa), and flow rates are in milliliters per second (ml/s). | */ + MAV_FUEL_TYPE_ENUM_END=3, /* | */ +} MAV_FUEL_TYPE; +#endif + /** @brief Flags to report status/failure cases for a power generator (used in GENERATOR_STATUS). Note that FAULTS are conditions that cause the generator to fail. Warnings are conditions that require attention before the next use (they indicate the system is not operating properly). */ #ifndef HAVE_ENUM_MAV_GENERATOR_STATUS_FLAG #define HAVE_ENUM_MAV_GENERATOR_STATUS_FLAG @@ -1236,10 +1210,24 @@ typedef enum ADSB_FLAGS typedef enum MAV_DO_REPOSITION_FLAGS { MAV_DO_REPOSITION_FLAGS_CHANGE_MODE=1, /* The aircraft should immediately transition into guided. This should not be set for follow me applications | */ - MAV_DO_REPOSITION_FLAGS_ENUM_END=2, /* | */ + MAV_DO_REPOSITION_FLAGS_RELATIVE_YAW=2, /* Yaw relative to the vehicle current heading (if not set, relative to North). | */ + MAV_DO_REPOSITION_FLAGS_ENUM_END=3, /* | */ } MAV_DO_REPOSITION_FLAGS; #endif +/** @brief Speed setpoint types used in MAV_CMD_DO_CHANGE_SPEED */ +#ifndef HAVE_ENUM_SPEED_TYPE +#define HAVE_ENUM_SPEED_TYPE +typedef enum SPEED_TYPE +{ + SPEED_TYPE_AIRSPEED=0, /* Airspeed | */ + SPEED_TYPE_GROUNDSPEED=1, /* Groundspeed | */ + SPEED_TYPE_CLIMB_SPEED=2, /* Climb speed | */ + SPEED_TYPE_DESCENT_SPEED=3, /* Descent speed | */ + SPEED_TYPE_ENUM_END=4, /* | */ +} SPEED_TYPE; +#endif + /** @brief Flags in ESTIMATOR_STATUS message */ #ifndef HAVE_ENUM_ESTIMATOR_STATUS_FLAGS #define HAVE_ENUM_ESTIMATOR_STATUS_FLAGS @@ -1261,27 +1249,27 @@ typedef enum ESTIMATOR_STATUS_FLAGS } ESTIMATOR_STATUS_FLAGS; #endif -/** @brief */ +/** @brief Sequence that motors are tested when using MAV_CMD_DO_MOTOR_TEST. */ #ifndef HAVE_ENUM_MOTOR_TEST_ORDER #define HAVE_ENUM_MOTOR_TEST_ORDER typedef enum MOTOR_TEST_ORDER { - MOTOR_TEST_ORDER_DEFAULT=0, /* default autopilot motor test method | */ - MOTOR_TEST_ORDER_SEQUENCE=1, /* motor numbers are specified as their index in a predefined vehicle-specific sequence | */ - MOTOR_TEST_ORDER_BOARD=2, /* motor numbers are specified as the output as labeled on the board | */ + MOTOR_TEST_ORDER_DEFAULT=0, /* Default autopilot motor test method. | */ + MOTOR_TEST_ORDER_SEQUENCE=1, /* Motor numbers are specified as their index in a predefined vehicle-specific sequence. | */ + MOTOR_TEST_ORDER_BOARD=2, /* Motor numbers are specified as the output as labeled on the board. | */ MOTOR_TEST_ORDER_ENUM_END=3, /* | */ } MOTOR_TEST_ORDER; #endif -/** @brief */ +/** @brief Defines how throttle value is represented in MAV_CMD_DO_MOTOR_TEST. */ #ifndef HAVE_ENUM_MOTOR_TEST_THROTTLE_TYPE #define HAVE_ENUM_MOTOR_TEST_THROTTLE_TYPE typedef enum MOTOR_TEST_THROTTLE_TYPE { - MOTOR_TEST_THROTTLE_PERCENT=0, /* throttle as a percentage from 0 ~ 100 | */ - MOTOR_TEST_THROTTLE_PWM=1, /* throttle as an absolute PWM value (normally in range of 1000~2000) | */ - MOTOR_TEST_THROTTLE_PILOT=2, /* throttle pass-through from pilot's transmitter | */ - MOTOR_TEST_COMPASS_CAL=3, /* per-motor compass calibration test | */ + MOTOR_TEST_THROTTLE_PERCENT=0, /* Throttle as a percentage (0 ~ 100) | */ + MOTOR_TEST_THROTTLE_PWM=1, /* Throttle as an absolute PWM value (normally in range of 1000~2000). | */ + MOTOR_TEST_THROTTLE_PILOT=2, /* Throttle pass-through from pilot's transmitter. | */ + MOTOR_TEST_COMPASS_CAL=3, /* Per-motor compass calibration test. | */ MOTOR_TEST_THROTTLE_TYPE_ENUM_END=4, /* | */ } MOTOR_TEST_THROTTLE_TYPE; #endif @@ -1415,7 +1403,9 @@ typedef enum CAMERA_CAP_FLAGS CAMERA_CAP_FLAGS_HAS_TRACKING_POINT=512, /* Camera supports tracking of a point on the camera view. | */ CAMERA_CAP_FLAGS_HAS_TRACKING_RECTANGLE=1024, /* Camera supports tracking of a selection rectangle on the camera view. | */ CAMERA_CAP_FLAGS_HAS_TRACKING_GEO_STATUS=2048, /* Camera supports tracking geo status (CAMERA_TRACKING_GEO_STATUS). | */ - CAMERA_CAP_FLAGS_ENUM_END=2049, /* | */ + CAMERA_CAP_FLAGS_HAS_THERMAL_RANGE=4096, /* Camera supports absolute thermal range (request CAMERA_THERMAL_RANGE with MAV_CMD_REQUEST_MESSAGE). | */ + CAMERA_CAP_FLAGS_HAS_MTI=8192, /* Camera supports Moving Target Indicators (MTI) on the camera view (using MAV_CMD_CAMERA_START_MTI). | */ + CAMERA_CAP_FLAGS_ENUM_END=8193, /* | */ } CAMERA_CAP_FLAGS; #endif @@ -1426,7 +1416,8 @@ typedef enum VIDEO_STREAM_STATUS_FLAGS { VIDEO_STREAM_STATUS_FLAGS_RUNNING=1, /* Stream is active (running) | */ VIDEO_STREAM_STATUS_FLAGS_THERMAL=2, /* Stream is thermal imaging | */ - VIDEO_STREAM_STATUS_FLAGS_ENUM_END=3, /* | */ + VIDEO_STREAM_STATUS_FLAGS_THERMAL_RANGE_ENABLED=4, /* Stream can report absolute thermal range (see CAMERA_THERMAL_RANGE). | */ + VIDEO_STREAM_STATUS_FLAGS_ENUM_END=5, /* | */ } VIDEO_STREAM_STATUS_FLAGS; #endif @@ -1438,11 +1429,23 @@ typedef enum VIDEO_STREAM_TYPE VIDEO_STREAM_TYPE_RTSP=0, /* Stream is RTSP | */ VIDEO_STREAM_TYPE_RTPUDP=1, /* Stream is RTP UDP (URI gives the port number) | */ VIDEO_STREAM_TYPE_TCP_MPEG=2, /* Stream is MPEG on TCP | */ - VIDEO_STREAM_TYPE_MPEG_TS_H264=3, /* Stream is h.264 on MPEG TS (URI gives the port number) | */ + VIDEO_STREAM_TYPE_MPEG_TS=3, /* Stream is MPEG TS (URI gives the port number) | */ VIDEO_STREAM_TYPE_ENUM_END=4, /* | */ } VIDEO_STREAM_TYPE; #endif +/** @brief Video stream encodings */ +#ifndef HAVE_ENUM_VIDEO_STREAM_ENCODING +#define HAVE_ENUM_VIDEO_STREAM_ENCODING +typedef enum VIDEO_STREAM_ENCODING +{ + VIDEO_STREAM_ENCODING_UNKNOWN=0, /* Stream encoding is unknown | */ + VIDEO_STREAM_ENCODING_H264=1, /* Stream encoding is H.264 | */ + VIDEO_STREAM_ENCODING_H265=2, /* Stream encoding is H.265 | */ + VIDEO_STREAM_ENCODING_ENUM_END=3, /* | */ +} VIDEO_STREAM_ENCODING; +#endif + /** @brief Camera tracking status flags */ #ifndef HAVE_ENUM_CAMERA_TRACKING_STATUS_FLAGS #define HAVE_ENUM_CAMERA_TRACKING_STATUS_FLAGS @@ -1451,7 +1454,9 @@ typedef enum CAMERA_TRACKING_STATUS_FLAGS CAMERA_TRACKING_STATUS_FLAGS_IDLE=0, /* Camera is not tracking | */ CAMERA_TRACKING_STATUS_FLAGS_ACTIVE=1, /* Camera is tracking | */ CAMERA_TRACKING_STATUS_FLAGS_ERROR=2, /* Camera tracking in error state | */ - CAMERA_TRACKING_STATUS_FLAGS_ENUM_END=3, /* | */ + CAMERA_TRACKING_STATUS_FLAGS_MTI=4, /* Camera Moving Target Indicators (MTI) are active | */ + CAMERA_TRACKING_STATUS_FLAGS_COASTING=8, /* Camera tracking target is obscured and is being predicted | */ + CAMERA_TRACKING_STATUS_FLAGS_ENUM_END=9, /* | */ } CAMERA_TRACKING_STATUS_FLAGS; #endif @@ -1472,10 +1477,9 @@ typedef enum CAMERA_TRACKING_MODE #define HAVE_ENUM_CAMERA_TRACKING_TARGET_DATA typedef enum CAMERA_TRACKING_TARGET_DATA { - CAMERA_TRACKING_TARGET_NONE=0, /* No target data | */ - CAMERA_TRACKING_TARGET_EMBEDDED=1, /* Target data embedded in image data (proprietary) | */ - CAMERA_TRACKING_TARGET_RENDERED=2, /* Target data rendered in image | */ - CAMERA_TRACKING_TARGET_IN_STATUS=4, /* Target data within status message (Point or Rectangle) | */ + CAMERA_TRACKING_TARGET_DATA_EMBEDDED=1, /* Target data embedded in image data (proprietary) | */ + CAMERA_TRACKING_TARGET_DATA_RENDERED=2, /* Target data rendered in image | */ + CAMERA_TRACKING_TARGET_DATA_IN_STATUS=4, /* Target data within status message (Point or Rectangle) | */ CAMERA_TRACKING_TARGET_DATA_ENUM_END=5, /* | */ } CAMERA_TRACKING_TARGET_DATA; #endif @@ -1486,10 +1490,11 @@ typedef enum CAMERA_TRACKING_TARGET_DATA typedef enum CAMERA_ZOOM_TYPE { ZOOM_TYPE_STEP=0, /* Zoom one step increment (-1 for wide, 1 for tele) | */ - ZOOM_TYPE_CONTINUOUS=1, /* Continuous zoom up/down until stopped (-1 for wide, 1 for tele, 0 to stop zooming) | */ - ZOOM_TYPE_RANGE=2, /* Zoom value as proportion of full camera range (a value between 0.0 and 100.0) | */ - ZOOM_TYPE_FOCAL_LENGTH=3, /* Zoom value/variable focal length in milimetres. Note that there is no message to get the valid zoom range of the camera, so this can type can only be used for cameras where the zoom range is known (implying that this cannot reliably be used in a GCS for an arbitrary camera) | */ - CAMERA_ZOOM_TYPE_ENUM_END=4, /* | */ + ZOOM_TYPE_CONTINUOUS=1, /* Continuous normalized zoom in/out rate until stopped. Range -1..1, negative: wide, positive: narrow/tele, 0 to stop zooming. Other values should be clipped to the range. | */ + ZOOM_TYPE_RANGE=2, /* Zoom value as proportion of full camera range (a percentage value between 0.0 and 100.0) | */ + ZOOM_TYPE_FOCAL_LENGTH=3, /* Zoom value/variable focal length in millimetres. Note that there is no message to get the valid zoom range of the camera, so this can type can only be used for cameras where the zoom range is known (implying that this cannot reliably be used in a GCS for an arbitrary camera) | */ + ZOOM_TYPE_HORIZONTAL_FOV=4, /* Zoom value as horizontal field of view in degrees. | */ + CAMERA_ZOOM_TYPE_ENUM_END=5, /* | */ } CAMERA_ZOOM_TYPE; #endif @@ -1499,14 +1504,30 @@ typedef enum CAMERA_ZOOM_TYPE typedef enum SET_FOCUS_TYPE { FOCUS_TYPE_STEP=0, /* Focus one step increment (-1 for focusing in, 1 for focusing out towards infinity). | */ - FOCUS_TYPE_CONTINUOUS=1, /* Continuous focus up/down until stopped (-1 for focusing in, 1 for focusing out towards infinity, 0 to stop focusing) | */ + FOCUS_TYPE_CONTINUOUS=1, /* Continuous normalized focus in/out rate until stopped. Range -1..1, negative: in, positive: out towards infinity, 0 to stop focusing. Other values should be clipped to the range. | */ FOCUS_TYPE_RANGE=2, /* Focus value as proportion of full camera focus range (a value between 0.0 and 100.0) | */ FOCUS_TYPE_METERS=3, /* Focus value in metres. Note that there is no message to get the valid focus range of the camera, so this can type can only be used for cameras where the range is known (implying that this cannot reliably be used in a GCS for an arbitrary camera). | */ - SET_FOCUS_TYPE_ENUM_END=4, /* | */ + FOCUS_TYPE_AUTO=4, /* Focus automatically. | */ + FOCUS_TYPE_AUTO_SINGLE=5, /* Single auto focus. Mainly used for still pictures. Usually abbreviated as AF-S. | */ + FOCUS_TYPE_AUTO_CONTINUOUS=6, /* Continuous auto focus. Mainly used for dynamic scenes. Abbreviated as AF-C. | */ + SET_FOCUS_TYPE_ENUM_END=7, /* | */ } SET_FOCUS_TYPE; #endif -/** @brief Result from PARAM_EXT_SET message (or a PARAM_SET within a transaction). */ +/** @brief Camera sources for MAV_CMD_SET_CAMERA_SOURCE */ +#ifndef HAVE_ENUM_CAMERA_SOURCE +#define HAVE_ENUM_CAMERA_SOURCE +typedef enum CAMERA_SOURCE +{ + CAMERA_SOURCE_DEFAULT=0, /* Default camera source. | */ + CAMERA_SOURCE_RGB=1, /* RGB camera source. | */ + CAMERA_SOURCE_IR=2, /* IR camera source. | */ + CAMERA_SOURCE_NDVI=3, /* NDVI camera source. | */ + CAMERA_SOURCE_ENUM_END=4, /* | */ +} CAMERA_SOURCE; +#endif + +/** @brief Result from PARAM_EXT_SET message. */ #ifndef HAVE_ENUM_PARAM_ACK #define HAVE_ENUM_PARAM_ACK typedef enum PARAM_ACK @@ -1514,7 +1535,7 @@ typedef enum PARAM_ACK PARAM_ACK_ACCEPTED=0, /* Parameter value ACCEPTED and SET | */ PARAM_ACK_VALUE_UNSUPPORTED=1, /* Parameter value UNKNOWN/UNSUPPORTED | */ PARAM_ACK_FAILED=2, /* Parameter failed to set | */ - PARAM_ACK_IN_PROGRESS=3, /* Parameter value received but not yet set/accepted. A subsequent PARAM_ACK_TRANSACTION or PARAM_EXT_ACK with the final result will follow once operation is completed. This is returned immediately for parameters that take longer to set, indicating taht the the parameter was recieved and does not need to be resent. | */ + PARAM_ACK_IN_PROGRESS=3, /* Parameter value received but not yet set/accepted. A subsequent PARAM_EXT_ACK with the final result will follow once operation is completed. This is returned immediately for parameters that take longer to set, indicating that the the parameter was received and does not need to be resent. | */ PARAM_ACK_ENUM_END=4, /* | */ } PARAM_ACK; #endif @@ -1546,17 +1567,29 @@ typedef enum MAV_ARM_AUTH_DENIED_REASON } MAV_ARM_AUTH_DENIED_REASON; #endif -/** @brief RC type */ +/** @brief RC type. Used in MAV_CMD_START_RX_PAIR. */ #ifndef HAVE_ENUM_RC_TYPE #define HAVE_ENUM_RC_TYPE typedef enum RC_TYPE { - RC_TYPE_SPEKTRUM_DSM2=0, /* Spektrum DSM2 | */ - RC_TYPE_SPEKTRUM_DSMX=1, /* Spektrum DSMX | */ + RC_TYPE_SPEKTRUM=0, /* Spektrum | */ + RC_TYPE_CRSF=1, /* CRSF | */ RC_TYPE_ENUM_END=2, /* | */ } RC_TYPE; #endif +/** @brief RC sub-type of types defined in RC_TYPE. Used in MAV_CMD_START_RX_PAIR. Ignored if value does not correspond to the set RC_TYPE. */ +#ifndef HAVE_ENUM_RC_SUB_TYPE +#define HAVE_ENUM_RC_SUB_TYPE +typedef enum RC_SUB_TYPE +{ + RC_SUB_TYPE_SPEKTRUM_DSM2=0, /* Spektrum DSM2 | */ + RC_SUB_TYPE_SPEKTRUM_DSMX=1, /* Spektrum DSMX | */ + RC_SUB_TYPE_SPEKTRUM_DSMX8=2, /* Spektrum DSMX8 | */ + RC_SUB_TYPE_ENUM_END=3, /* | */ +} RC_SUB_TYPE; +#endif + /** @brief Bitmap to indicate which dimensions should be ignored by the vehicle: a value of 0b0000000000000000 or 0b0000001000000000 indicates that none of the setpoint dimensions should be ignored. If bit 9 is set the floats afx afy afz should be interpreted as force instead of acceleration. */ #ifndef HAVE_ENUM_POSITION_TARGET_TYPEMASK #define HAVE_ENUM_POSITION_TARGET_TYPEMASK @@ -1586,6 +1619,7 @@ typedef enum ATTITUDE_TARGET_TYPEMASK ATTITUDE_TARGET_TYPEMASK_BODY_ROLL_RATE_IGNORE=1, /* Ignore body roll rate | */ ATTITUDE_TARGET_TYPEMASK_BODY_PITCH_RATE_IGNORE=2, /* Ignore body pitch rate | */ ATTITUDE_TARGET_TYPEMASK_BODY_YAW_RATE_IGNORE=4, /* Ignore body yaw rate | */ + ATTITUDE_TARGET_TYPEMASK_THRUST_BODY_SET=32, /* Use 3D body thrust setpoint instead of throttle | */ ATTITUDE_TARGET_TYPEMASK_THROTTLE_IGNORE=64, /* Ignore throttle | */ ATTITUDE_TARGET_TYPEMASK_ATTITUDE_IGNORE=128, /* Ignore attitude | */ ATTITUDE_TARGET_TYPEMASK_ENUM_END=129, /* | */ @@ -1623,20 +1657,6 @@ typedef enum UTM_DATA_AVAIL_FLAGS } UTM_DATA_AVAIL_FLAGS; #endif -/** @brief Cellular network radio type */ -#ifndef HAVE_ENUM_CELLULAR_NETWORK_RADIO_TYPE -#define HAVE_ENUM_CELLULAR_NETWORK_RADIO_TYPE -typedef enum CELLULAR_NETWORK_RADIO_TYPE -{ - CELLULAR_NETWORK_RADIO_TYPE_NONE=0, /* | */ - CELLULAR_NETWORK_RADIO_TYPE_GSM=1, /* | */ - CELLULAR_NETWORK_RADIO_TYPE_CDMA=2, /* | */ - CELLULAR_NETWORK_RADIO_TYPE_WCDMA=3, /* | */ - CELLULAR_NETWORK_RADIO_TYPE_LTE=4, /* | */ - CELLULAR_NETWORK_RADIO_TYPE_ENUM_END=5, /* | */ -} CELLULAR_NETWORK_RADIO_TYPE; -#endif - /** @brief These flags encode the cellular network status */ #ifndef HAVE_ENUM_CELLULAR_STATUS_FLAG #define HAVE_ENUM_CELLULAR_STATUS_FLAG @@ -1667,11 +1687,25 @@ typedef enum CELLULAR_NETWORK_FAILED_REASON CELLULAR_NETWORK_FAILED_REASON_NONE=0, /* No error | */ CELLULAR_NETWORK_FAILED_REASON_UNKNOWN=1, /* Error state is unknown | */ CELLULAR_NETWORK_FAILED_REASON_SIM_MISSING=2, /* SIM is required for the modem but missing | */ - CELLULAR_NETWORK_FAILED_REASON_SIM_ERROR=3, /* SIM is available, but not usuable for connection | */ + CELLULAR_NETWORK_FAILED_REASON_SIM_ERROR=3, /* SIM is available, but not usable for connection | */ CELLULAR_NETWORK_FAILED_REASON_ENUM_END=4, /* | */ } CELLULAR_NETWORK_FAILED_REASON; #endif +/** @brief Cellular network radio type */ +#ifndef HAVE_ENUM_CELLULAR_NETWORK_RADIO_TYPE +#define HAVE_ENUM_CELLULAR_NETWORK_RADIO_TYPE +typedef enum CELLULAR_NETWORK_RADIO_TYPE +{ + CELLULAR_NETWORK_RADIO_TYPE_NONE=0, /* | */ + CELLULAR_NETWORK_RADIO_TYPE_GSM=1, /* | */ + CELLULAR_NETWORK_RADIO_TYPE_CDMA=2, /* | */ + CELLULAR_NETWORK_RADIO_TYPE_WCDMA=3, /* | */ + CELLULAR_NETWORK_RADIO_TYPE_LTE=4, /* | */ + CELLULAR_NETWORK_RADIO_TYPE_ENUM_END=5, /* | */ +} CELLULAR_NETWORK_RADIO_TYPE; +#endif + /** @brief Precision land modes (used in MAV_CMD_NAV_LAND). */ #ifndef HAVE_ENUM_PRECISION_LAND_MODE #define HAVE_ENUM_PRECISION_LAND_MODE @@ -1712,7 +1746,10 @@ typedef enum MAV_TUNNEL_PAYLOAD_TYPE MAV_TUNNEL_PAYLOAD_TYPE_STORM32_RESERVED7=207, /* Registered for STorM32 gimbal controller. | */ MAV_TUNNEL_PAYLOAD_TYPE_STORM32_RESERVED8=208, /* Registered for STorM32 gimbal controller. | */ MAV_TUNNEL_PAYLOAD_TYPE_STORM32_RESERVED9=209, /* Registered for STorM32 gimbal controller. | */ - MAV_TUNNEL_PAYLOAD_TYPE_ENUM_END=210, /* | */ + MAV_TUNNEL_PAYLOAD_TYPE_MODALAI_REMOTE_OSD=210, /* Registered for ModalAI remote OSD protocol. | */ + MAV_TUNNEL_PAYLOAD_TYPE_MODALAI_ESC_UART_PASSTHRU=211, /* Registered for ModalAI ESC UART passthru protocol. | */ + MAV_TUNNEL_PAYLOAD_TYPE_MODALAI_IO_UART_PASSTHRU=212, /* Registered for ModalAI vendor use. | */ + MAV_TUNNEL_PAYLOAD_TYPE_ENUM_END=213, /* | */ } MAV_TUNNEL_PAYLOAD_TYPE; #endif @@ -1725,7 +1762,8 @@ typedef enum MAV_ODID_ID_TYPE MAV_ODID_ID_TYPE_SERIAL_NUMBER=1, /* Manufacturer Serial Number (ANSI/CTA-2063 format). | */ MAV_ODID_ID_TYPE_CAA_REGISTRATION_ID=2, /* CAA (Civil Aviation Authority) registered ID. Format: [ICAO Country Code].[CAA Assigned ID]. | */ MAV_ODID_ID_TYPE_UTM_ASSIGNED_UUID=3, /* UTM (Unmanned Traffic Management) assigned UUID (RFC4122). | */ - MAV_ODID_ID_TYPE_ENUM_END=4, /* | */ + MAV_ODID_ID_TYPE_SPECIFIC_SESSION_ID=4, /* A 20 byte ID for a specific flight/session. The exact ID type is indicated by the first byte of uas_id and these type values are managed by ICAO. | */ + MAV_ODID_ID_TYPE_ENUM_END=5, /* | */ } MAV_ODID_ID_TYPE; #endif @@ -1763,7 +1801,8 @@ typedef enum MAV_ODID_STATUS MAV_ODID_STATUS_GROUND=1, /* The UA is on the ground. | */ MAV_ODID_STATUS_AIRBORNE=2, /* The UA is in the air. | */ MAV_ODID_STATUS_EMERGENCY=3, /* The UA is having an emergency. | */ - MAV_ODID_STATUS_ENUM_END=4, /* | */ + MAV_ODID_STATUS_REMOTE_ID_SYSTEM_FAILURE=4, /* The remote ID system is failing or unreliable in some way. | */ + MAV_ODID_STATUS_ENUM_END=5, /* | */ } MAV_ODID_STATUS; #endif @@ -1865,7 +1904,8 @@ typedef enum MAV_ODID_AUTH_TYPE MAV_ODID_AUTH_TYPE_OPERATOR_ID_SIGNATURE=2, /* Signature for the Operator ID. | */ MAV_ODID_AUTH_TYPE_MESSAGE_SET_SIGNATURE=3, /* Signature for the entire message set. | */ MAV_ODID_AUTH_TYPE_NETWORK_REMOTE_ID=4, /* Authentication is provided by Network Remote ID. | */ - MAV_ODID_AUTH_TYPE_ENUM_END=5, /* | */ + MAV_ODID_AUTH_TYPE_SPECIFIC_AUTHENTICATION=5, /* The exact authentication type is indicated by the first byte of authentication_data and these type values are managed by ICAO. | */ + MAV_ODID_AUTH_TYPE_ENUM_END=6, /* | */ } MAV_ODID_AUTH_TYPE; #endif @@ -1874,8 +1914,10 @@ typedef enum MAV_ODID_AUTH_TYPE #define HAVE_ENUM_MAV_ODID_DESC_TYPE typedef enum MAV_ODID_DESC_TYPE { - MAV_ODID_DESC_TYPE_TEXT=0, /* Free-form text description of the purpose of the flight. | */ - MAV_ODID_DESC_TYPE_ENUM_END=1, /* | */ + MAV_ODID_DESC_TYPE_TEXT=0, /* Optional free-form text description of the purpose of the flight. | */ + MAV_ODID_DESC_TYPE_EMERGENCY=1, /* Optional additional clarification when status == MAV_ODID_STATUS_EMERGENCY. | */ + MAV_ODID_DESC_TYPE_EXTENDED_STATUS=2, /* Optional additional clarification when status != MAV_ODID_STATUS_EMERGENCY. | */ + MAV_ODID_DESC_TYPE_ENUM_END=3, /* | */ } MAV_ODID_DESC_TYPE; #endif @@ -1884,9 +1926,9 @@ typedef enum MAV_ODID_DESC_TYPE #define HAVE_ENUM_MAV_ODID_OPERATOR_LOCATION_TYPE typedef enum MAV_ODID_OPERATOR_LOCATION_TYPE { - MAV_ODID_OPERATOR_LOCATION_TYPE_TAKEOFF=0, /* The location of the operator is the same as the take-off location. | */ - MAV_ODID_OPERATOR_LOCATION_TYPE_LIVE_GNSS=1, /* The location of the operator is based on live GNSS data. | */ - MAV_ODID_OPERATOR_LOCATION_TYPE_FIXED=2, /* The location of the operator is a fixed location. | */ + MAV_ODID_OPERATOR_LOCATION_TYPE_TAKEOFF=0, /* The location/altitude of the operator is the same as the take-off location. | */ + MAV_ODID_OPERATOR_LOCATION_TYPE_LIVE_GNSS=1, /* The location/altitude of the operator is dynamic. E.g. based on live GNSS data. | */ + MAV_ODID_OPERATOR_LOCATION_TYPE_FIXED=2, /* The location/altitude of the operator are fixed values. | */ MAV_ODID_OPERATOR_LOCATION_TYPE_ENUM_END=3, /* | */ } MAV_ODID_OPERATOR_LOCATION_TYPE; #endif @@ -1942,6 +1984,17 @@ typedef enum MAV_ODID_OPERATOR_ID_TYPE } MAV_ODID_OPERATOR_ID_TYPE; #endif +/** @brief */ +#ifndef HAVE_ENUM_MAV_ODID_ARM_STATUS +#define HAVE_ENUM_MAV_ODID_ARM_STATUS +typedef enum MAV_ODID_ARM_STATUS +{ + MAV_ODID_ARM_STATUS_GOOD_TO_ARM=0, /* Passing arming checks. | */ + MAV_ODID_ARM_STATUS_PRE_ARM_FAIL_GENERIC=1, /* Generic arming failure, see error string for details. | */ + MAV_ODID_ARM_STATUS_ENUM_END=2, /* | */ +} MAV_ODID_ARM_STATUS; +#endif + /** @brief Tune formats (used for vehicle buzzer/tone generation). */ #ifndef HAVE_ENUM_TUNE_FORMAT #define HAVE_ENUM_TUNE_FORMAT @@ -1953,17 +2006,6 @@ typedef enum TUNE_FORMAT } TUNE_FORMAT; #endif -/** @brief Component capability flags (Bitmap) */ -#ifndef HAVE_ENUM_COMPONENT_CAP_FLAGS -#define HAVE_ENUM_COMPONENT_CAP_FLAGS -typedef enum COMPONENT_CAP_FLAGS -{ - COMPONENT_CAP_FLAGS_PARAM=1, /* Component has parameters, and supports the parameter protocol (PARAM messages). | */ - COMPONENT_CAP_FLAGS_PARAM_EXT=2, /* Component has parameters, and supports the extended parameter protocol (PARAM_EXT messages). | */ - COMPONENT_CAP_FLAGS_ENUM_END=3, /* | */ -} COMPONENT_CAP_FLAGS; -#endif - /** @brief Type of AIS vessel, enum duplicated from AIS standard, https://gpsd.gitlab.io/gpsd/AIVDM.html */ #ifndef HAVE_ENUM_AIS_TYPE #define HAVE_ENUM_AIS_TYPE @@ -2032,12 +2074,12 @@ typedef enum AIS_TYPE AIS_TYPE_PASSENGER=60, /* | */ AIS_TYPE_PASSENGER_HAZARDOUS_A=61, /* | */ AIS_TYPE_PASSENGER_HAZARDOUS_B=62, /* | */ - AIS_TYPE_AIS_TYPE_PASSENGER_HAZARDOUS_C=63, /* | */ + AIS_TYPE_PASSENGER_HAZARDOUS_C=63, /* | */ AIS_TYPE_PASSENGER_HAZARDOUS_D=64, /* | */ AIS_TYPE_PASSENGER_RESERVED_1=65, /* | */ AIS_TYPE_PASSENGER_RESERVED_2=66, /* | */ AIS_TYPE_PASSENGER_RESERVED_3=67, /* | */ - AIS_TYPE_AIS_TYPE_PASSENGER_RESERVED_4=68, /* | */ + AIS_TYPE_PASSENGER_RESERVED_4=68, /* | */ AIS_TYPE_PASSENGER_UNKNOWN=69, /* | */ AIS_TYPE_CARGO=70, /* | */ AIS_TYPE_CARGO_HAZARDOUS_A=71, /* | */ @@ -2078,22 +2120,22 @@ typedef enum AIS_TYPE #define HAVE_ENUM_AIS_NAV_STATUS typedef enum AIS_NAV_STATUS { - UNDER_WAY=0, /* Under way using engine. | */ - AIS_NAV_ANCHORED=1, /* | */ - AIS_NAV_UN_COMMANDED=2, /* | */ - AIS_NAV_RESTRICTED_MANOEUVERABILITY=3, /* | */ - AIS_NAV_DRAUGHT_CONSTRAINED=4, /* | */ - AIS_NAV_MOORED=5, /* | */ - AIS_NAV_AGROUND=6, /* | */ - AIS_NAV_FISHING=7, /* | */ - AIS_NAV_SAILING=8, /* | */ - AIS_NAV_RESERVED_HSC=9, /* | */ - AIS_NAV_RESERVED_WIG=10, /* | */ - AIS_NAV_RESERVED_1=11, /* | */ - AIS_NAV_RESERVED_2=12, /* | */ - AIS_NAV_RESERVED_3=13, /* | */ - AIS_NAV_AIS_SART=14, /* Search And Rescue Transponder. | */ - AIS_NAV_UNKNOWN=15, /* Not available (default). | */ + AIS_NAV_STATUS_UNDER_WAY=0, /* Under way using engine. | */ + AIS_NAV_STATUS_ANCHORED=1, /* | */ + AIS_NAV_STATUS_UN_COMMANDED=2, /* | */ + AIS_NAV_STATUS_RESTRICTED_MANOEUVERABILITY=3, /* | */ + AIS_NAV_STATUS_DRAUGHT_CONSTRAINED=4, /* | */ + AIS_NAV_STATUS_MOORED=5, /* | */ + AIS_NAV_STATUS_AGROUND=6, /* | */ + AIS_NAV_STATUS_FISHING=7, /* | */ + AIS_NAV_STATUS_SAILING=8, /* | */ + AIS_NAV_STATUS_RESERVED_HSC=9, /* | */ + AIS_NAV_STATUS_RESERVED_WIG=10, /* | */ + AIS_NAV_STATUS_RESERVED_1=11, /* | */ + AIS_NAV_STATUS_RESERVED_2=12, /* | */ + AIS_NAV_STATUS_RESERVED_3=13, /* | */ + AIS_NAV_STATUS_AIS_SART=14, /* Search And Rescue Transponder. | */ + AIS_NAV_STATUS_UNKNOWN=15, /* Not available (default). | */ AIS_NAV_STATUS_ENUM_END=16, /* | */ } AIS_NAV_STATUS; #endif @@ -2161,16 +2203,40 @@ typedef enum FAILURE_TYPE } FAILURE_TYPE; #endif +/** @brief */ +#ifndef HAVE_ENUM_NAV_VTOL_LAND_OPTIONS +#define HAVE_ENUM_NAV_VTOL_LAND_OPTIONS +typedef enum NAV_VTOL_LAND_OPTIONS +{ + NAV_VTOL_LAND_OPTIONS_DEFAULT=0, /* Default autopilot landing behaviour. | */ + NAV_VTOL_LAND_OPTIONS_FW_DESCENT=1, /* Descend in fixed wing mode, transitioning to multicopter mode for vertical landing when close to the ground. + The fixed wing descent pattern is at the discretion of the vehicle (e.g. transition altitude, loiter direction, radius, and speed, etc.). + | */ + NAV_VTOL_LAND_OPTIONS_HOVER_DESCENT=2, /* Land in multicopter mode on reaching the landing coordinates (the whole landing is by "hover descent"). | */ + NAV_VTOL_LAND_OPTIONS_ENUM_END=3, /* | */ +} NAV_VTOL_LAND_OPTIONS; +#endif + /** @brief Winch status flags used in WINCH_STATUS */ #ifndef HAVE_ENUM_MAV_WINCH_STATUS_FLAG #define HAVE_ENUM_MAV_WINCH_STATUS_FLAG typedef enum MAV_WINCH_STATUS_FLAG { MAV_WINCH_STATUS_HEALTHY=1, /* Winch is healthy | */ - MAV_WINCH_STATUS_FULLY_RETRACTED=2, /* Winch thread is fully retracted | */ + MAV_WINCH_STATUS_FULLY_RETRACTED=2, /* Winch line is fully retracted | */ MAV_WINCH_STATUS_MOVING=4, /* Winch motor is moving | */ - MAV_WINCH_STATUS_CLUTCH_ENGAGED=8, /* Winch clutch is engaged allowing motor to move freely | */ - MAV_WINCH_STATUS_FLAG_ENUM_END=9, /* | */ + MAV_WINCH_STATUS_CLUTCH_ENGAGED=8, /* Winch clutch is engaged allowing motor to move freely. | */ + MAV_WINCH_STATUS_LOCKED=16, /* Winch is locked by locking mechanism. | */ + MAV_WINCH_STATUS_DROPPING=32, /* Winch is gravity dropping payload. | */ + MAV_WINCH_STATUS_ARRESTING=64, /* Winch is arresting payload descent. | */ + MAV_WINCH_STATUS_GROUND_SENSE=128, /* Winch is using torque measurements to sense the ground. | */ + MAV_WINCH_STATUS_RETRACTING=256, /* Winch is returning to the fully retracted position. | */ + MAV_WINCH_STATUS_REDELIVER=512, /* Winch is redelivering the payload. This is a failover state if the line tension goes above a threshold during RETRACTING. | */ + MAV_WINCH_STATUS_ABANDON_LINE=1024, /* Winch is abandoning the line and possibly payload. Winch unspools the entire calculated line length. This is a failover state from REDELIVER if the number of attempts exceeds a threshold. | */ + MAV_WINCH_STATUS_LOCKING=2048, /* Winch is engaging the locking mechanism. | */ + MAV_WINCH_STATUS_LOAD_LINE=4096, /* Winch is spooling on line. | */ + MAV_WINCH_STATUS_LOAD_PAYLOAD=8192, /* Winch is loading a payload. | */ + MAV_WINCH_STATUS_FLAG_ENUM_END=8193, /* | */ } MAV_WINCH_STATUS_FLAG; #endif @@ -2191,6 +2257,296 @@ typedef enum MAG_CAL_STATUS } MAG_CAL_STATUS; #endif +/** @brief Reason for an event error response. */ +#ifndef HAVE_ENUM_MAV_EVENT_ERROR_REASON +#define HAVE_ENUM_MAV_EVENT_ERROR_REASON +typedef enum MAV_EVENT_ERROR_REASON +{ + MAV_EVENT_ERROR_REASON_UNAVAILABLE=0, /* The requested event is not available (anymore). | */ + MAV_EVENT_ERROR_REASON_ENUM_END=1, /* | */ +} MAV_EVENT_ERROR_REASON; +#endif + +/** @brief Flags for CURRENT_EVENT_SEQUENCE. */ +#ifndef HAVE_ENUM_MAV_EVENT_CURRENT_SEQUENCE_FLAGS +#define HAVE_ENUM_MAV_EVENT_CURRENT_SEQUENCE_FLAGS +typedef enum MAV_EVENT_CURRENT_SEQUENCE_FLAGS +{ + MAV_EVENT_CURRENT_SEQUENCE_FLAGS_RESET=1, /* A sequence reset has happened (e.g. vehicle reboot). | */ + MAV_EVENT_CURRENT_SEQUENCE_FLAGS_ENUM_END=2, /* | */ +} MAV_EVENT_CURRENT_SEQUENCE_FLAGS; +#endif + +/** @brief Flags in the HIL_SENSOR message indicate which fields have updated since the last message */ +#ifndef HAVE_ENUM_HIL_SENSOR_UPDATED_FLAGS +#define HAVE_ENUM_HIL_SENSOR_UPDATED_FLAGS +typedef enum HIL_SENSOR_UPDATED_FLAGS +{ + HIL_SENSOR_UPDATED_XACC=1, /* The value in the xacc field has been updated | */ + HIL_SENSOR_UPDATED_YACC=2, /* The value in the yacc field has been updated | */ + HIL_SENSOR_UPDATED_ZACC=4, /* The value in the zacc field has been updated | */ + HIL_SENSOR_UPDATED_XGYRO=8, /* The value in the xgyro field has been updated | */ + HIL_SENSOR_UPDATED_YGYRO=16, /* The value in the ygyro field has been updated | */ + HIL_SENSOR_UPDATED_ZGYRO=32, /* The value in the zgyro field has been updated | */ + HIL_SENSOR_UPDATED_XMAG=64, /* The value in the xmag field has been updated | */ + HIL_SENSOR_UPDATED_YMAG=128, /* The value in the ymag field has been updated | */ + HIL_SENSOR_UPDATED_ZMAG=256, /* The value in the zmag field has been updated | */ + HIL_SENSOR_UPDATED_ABS_PRESSURE=512, /* The value in the abs_pressure field has been updated | */ + HIL_SENSOR_UPDATED_DIFF_PRESSURE=1024, /* The value in the diff_pressure field has been updated | */ + HIL_SENSOR_UPDATED_PRESSURE_ALT=2048, /* The value in the pressure_alt field has been updated | */ + HIL_SENSOR_UPDATED_TEMPERATURE=4096, /* The value in the temperature field has been updated | */ + HIL_SENSOR_UPDATED_RESET=2147483648, /* Full reset of attitude/position/velocities/etc was performed in sim (Bit 31). | */ + HIL_SENSOR_UPDATED_FLAGS_ENUM_END=2147483649, /* | */ +} HIL_SENSOR_UPDATED_FLAGS; +#endif + +/** @brief Flags in the HIGHRES_IMU message indicate which fields have updated since the last message */ +#ifndef HAVE_ENUM_HIGHRES_IMU_UPDATED_FLAGS +#define HAVE_ENUM_HIGHRES_IMU_UPDATED_FLAGS +typedef enum HIGHRES_IMU_UPDATED_FLAGS +{ + HIGHRES_IMU_UPDATED_XACC=1, /* The value in the xacc field has been updated | */ + HIGHRES_IMU_UPDATED_YACC=2, /* The value in the yacc field has been updated | */ + HIGHRES_IMU_UPDATED_ZACC=4, /* The value in the zacc field has been updated since | */ + HIGHRES_IMU_UPDATED_XGYRO=8, /* The value in the xgyro field has been updated | */ + HIGHRES_IMU_UPDATED_YGYRO=16, /* The value in the ygyro field has been updated | */ + HIGHRES_IMU_UPDATED_ZGYRO=32, /* The value in the zgyro field has been updated | */ + HIGHRES_IMU_UPDATED_XMAG=64, /* The value in the xmag field has been updated | */ + HIGHRES_IMU_UPDATED_YMAG=128, /* The value in the ymag field has been updated | */ + HIGHRES_IMU_UPDATED_ZMAG=256, /* The value in the zmag field has been updated | */ + HIGHRES_IMU_UPDATED_ABS_PRESSURE=512, /* The value in the abs_pressure field has been updated | */ + HIGHRES_IMU_UPDATED_DIFF_PRESSURE=1024, /* The value in the diff_pressure field has been updated | */ + HIGHRES_IMU_UPDATED_PRESSURE_ALT=2048, /* The value in the pressure_alt field has been updated | */ + HIGHRES_IMU_UPDATED_TEMPERATURE=4096, /* The value in the temperature field has been updated | */ + HIGHRES_IMU_UPDATED_FLAGS_ENUM_END=4097, /* | */ +} HIGHRES_IMU_UPDATED_FLAGS; +#endif + +/** @brief */ +#ifndef HAVE_ENUM_CAN_FILTER_OP +#define HAVE_ENUM_CAN_FILTER_OP +typedef enum CAN_FILTER_OP +{ + CAN_FILTER_REPLACE=0, /* | */ + CAN_FILTER_ADD=1, /* | */ + CAN_FILTER_REMOVE=2, /* | */ + CAN_FILTER_OP_ENUM_END=3, /* | */ +} CAN_FILTER_OP; +#endif + +/** @brief MAV FTP error codes (https://mavlink.io/en/services/ftp.html) */ +#ifndef HAVE_ENUM_MAV_FTP_ERR +#define HAVE_ENUM_MAV_FTP_ERR +typedef enum MAV_FTP_ERR +{ + MAV_FTP_ERR_NONE=0, /* None: No error | */ + MAV_FTP_ERR_FAIL=1, /* Fail: Unknown failure | */ + MAV_FTP_ERR_FAILERRNO=2, /* FailErrno: Command failed, Err number sent back in PayloadHeader.data[1]. + This is a file-system error number understood by the server operating system. | */ + MAV_FTP_ERR_INVALIDDATASIZE=3, /* InvalidDataSize: Payload size is invalid | */ + MAV_FTP_ERR_INVALIDSESSION=4, /* InvalidSession: Session is not currently open | */ + MAV_FTP_ERR_NOSESSIONSAVAILABLE=5, /* NoSessionsAvailable: All available sessions are already in use | */ + MAV_FTP_ERR_EOF=6, /* EOF: Offset past end of file for ListDirectory and ReadFile commands | */ + MAV_FTP_ERR_UNKNOWNCOMMAND=7, /* UnknownCommand: Unknown command / opcode | */ + MAV_FTP_ERR_FILEEXISTS=8, /* FileExists: File/directory already exists | */ + MAV_FTP_ERR_FILEPROTECTED=9, /* FileProtected: File/directory is write protected | */ + MAV_FTP_ERR_FILENOTFOUND=10, /* FileNotFound: File/directory not found | */ + MAV_FTP_ERR_ENUM_END=11, /* | */ +} MAV_FTP_ERR; +#endif + +/** @brief MAV FTP opcodes: https://mavlink.io/en/services/ftp.html */ +#ifndef HAVE_ENUM_MAV_FTP_OPCODE +#define HAVE_ENUM_MAV_FTP_OPCODE +typedef enum MAV_FTP_OPCODE +{ + MAV_FTP_OPCODE_NONE=0, /* None. Ignored, always ACKed | */ + MAV_FTP_OPCODE_TERMINATESESSION=1, /* TerminateSession: Terminates open Read session | */ + MAV_FTP_OPCODE_RESETSESSION=2, /* ResetSessions: Terminates all open read sessions | */ + MAV_FTP_OPCODE_LISTDIRECTORY=3, /* ListDirectory. List files and directories in path from offset | */ + MAV_FTP_OPCODE_OPENFILERO=4, /* OpenFileRO: Opens file at path for reading, returns session | */ + MAV_FTP_OPCODE_READFILE=5, /* ReadFile: Reads size bytes from offset in session | */ + MAV_FTP_OPCODE_CREATEFILE=6, /* CreateFile: Creates file at path for writing, returns session | */ + MAV_FTP_OPCODE_WRITEFILE=7, /* WriteFile: Writes size bytes to offset in session | */ + MAV_FTP_OPCODE_REMOVEFILE=8, /* RemoveFile: Remove file at path | */ + MAV_FTP_OPCODE_CREATEDIRECTORY=9, /* CreateDirectory: Creates directory at path | */ + MAV_FTP_OPCODE_REMOVEDIRECTORY=10, /* RemoveDirectory: Removes directory at path. The directory must be empty. | */ + MAV_FTP_OPCODE_OPENFILEWO=11, /* OpenFileWO: Opens file at path for writing, returns session | */ + MAV_FTP_OPCODE_TRUNCATEFILE=12, /* TruncateFile: Truncate file at path to offset length | */ + MAV_FTP_OPCODE_RENAME=13, /* Rename: Rename path1 to path2 | */ + MAV_FTP_OPCODE_CALCFILECRC=14, /* CalcFileCRC32: Calculate CRC32 for file at path | */ + MAV_FTP_OPCODE_BURSTREADFILE=15, /* BurstReadFile: Burst download session file | */ + MAV_FTP_OPCODE_ACK=128, /* ACK: ACK response | */ + MAV_FTP_OPCODE_NAK=129, /* NAK: NAK response | */ + MAV_FTP_OPCODE_ENUM_END=130, /* | */ +} MAV_FTP_OPCODE; +#endif + +/** @brief + States of the mission state machine. + Note that these states are independent of whether the mission is in a mode that can execute mission items or not (is suspended). + They may not all be relevant on all vehicles. + */ +#ifndef HAVE_ENUM_MISSION_STATE +#define HAVE_ENUM_MISSION_STATE +typedef enum MISSION_STATE +{ + MISSION_STATE_UNKNOWN=0, /* The mission status reporting is not supported. | */ + MISSION_STATE_NO_MISSION=1, /* No mission on the vehicle. | */ + MISSION_STATE_NOT_STARTED=2, /* Mission has not started. This is the case after a mission has uploaded but not yet started executing. | */ + MISSION_STATE_ACTIVE=3, /* Mission is active, and will execute mission items when in auto mode. | */ + MISSION_STATE_PAUSED=4, /* Mission is paused when in auto mode. | */ + MISSION_STATE_COMPLETE=5, /* Mission has executed all mission items. | */ + MISSION_STATE_ENUM_END=6, /* | */ +} MISSION_STATE; +#endif + +/** @brief + Possible safety switch states. + */ +#ifndef HAVE_ENUM_SAFETY_SWITCH_STATE +#define HAVE_ENUM_SAFETY_SWITCH_STATE +typedef enum SAFETY_SWITCH_STATE +{ + SAFETY_SWITCH_STATE_SAFE=0, /* Safety switch is engaged and vehicle should be safe to approach. | */ + SAFETY_SWITCH_STATE_DANGEROUS=1, /* Safety switch is NOT engaged and motors, propellers and other actuators should be considered active. | */ + SAFETY_SWITCH_STATE_ENUM_END=2, /* | */ +} SAFETY_SWITCH_STATE; +#endif + +/** @brief Modes of illuminator */ +#ifndef HAVE_ENUM_ILLUMINATOR_MODE +#define HAVE_ENUM_ILLUMINATOR_MODE +typedef enum ILLUMINATOR_MODE +{ + ILLUMINATOR_MODE_UNKNOWN=0, /* Illuminator mode is not specified/unknown | */ + ILLUMINATOR_MODE_INTERNAL_CONTROL=1, /* Illuminator behavior is controlled by MAV_CMD_DO_ILLUMINATOR_CONFIGURE settings | */ + ILLUMINATOR_MODE_EXTERNAL_SYNC=2, /* Illuminator behavior is controlled by external factors: e.g. an external hardware signal | */ + ILLUMINATOR_MODE_ENUM_END=3, /* | */ +} ILLUMINATOR_MODE; +#endif + +/** @brief Illuminator module error flags (bitmap, 0 means no error) */ +#ifndef HAVE_ENUM_ILLUMINATOR_ERROR_FLAGS +#define HAVE_ENUM_ILLUMINATOR_ERROR_FLAGS +typedef enum ILLUMINATOR_ERROR_FLAGS +{ + ILLUMINATOR_ERROR_FLAGS_THERMAL_THROTTLING=1, /* Illuminator thermal throttling error. | */ + ILLUMINATOR_ERROR_FLAGS_OVER_TEMPERATURE_SHUTDOWN=2, /* Illuminator over temperature shutdown error. | */ + ILLUMINATOR_ERROR_FLAGS_THERMISTOR_FAILURE=4, /* Illuminator thermistor failure. | */ + ILLUMINATOR_ERROR_FLAGS_ENUM_END=5, /* | */ +} ILLUMINATOR_ERROR_FLAGS; +#endif + +/** @brief Standard modes with a well understood meaning across flight stacks and vehicle types. + For example, most flight stack have the concept of a "return" or "RTL" mode that takes a vehicle to safety, even though the precise mechanics of this mode may differ. + The modes supported by a flight stack can be queried using AVAILABLE_MODES and set using MAV_CMD_DO_SET_STANDARD_MODE. + The current mode is streamed in CURRENT_MODE. + See https://mavlink.io/en/services/standard_modes.html + */ +#ifndef HAVE_ENUM_MAV_STANDARD_MODE +#define HAVE_ENUM_MAV_STANDARD_MODE +typedef enum MAV_STANDARD_MODE +{ + MAV_STANDARD_MODE_NON_STANDARD=0, /* Non standard mode. + This may be used when reporting the mode if the current flight mode is not a standard mode. + | */ + MAV_STANDARD_MODE_POSITION_HOLD=1, /* Position mode (manual). + Position-controlled and stabilized manual mode. + When sticks are released vehicles return to their level-flight orientation and hold both position and altitude against wind and external forces. + This mode can only be set by vehicles that can hold a fixed position. + Multicopter (MC) vehicles actively brake and hold both position and altitude against wind and external forces. + Hybrid MC/FW ("VTOL") vehicles first transition to multicopter mode (if needed) but otherwise behave in the same way as MC vehicles. + Fixed-wing (FW) vehicles must not support this mode. + Other vehicle types must not support this mode (this may be revisited through the PR process). + | */ + MAV_STANDARD_MODE_ORBIT=2, /* Orbit (manual). + Position-controlled and stabilized manual mode. + The vehicle circles around a fixed setpoint in the horizontal plane at a particular radius, altitude, and direction. + Flight stacks may further allow manual control over the setpoint position, radius, direction, speed, and/or altitude of the circle, but this is not mandated. + Flight stacks may support the [MAV_CMD_DO_ORBIT](https://mavlink.io/en/messages/common.html#MAV_CMD_DO_ORBIT) for changing the orbit parameters. + MC and FW vehicles may support this mode. + Hybrid MC/FW ("VTOL") vehicles may support this mode in MC/FW or both modes; if the mode is not supported by the current configuration the vehicle should transition to the supported configuration. + Other vehicle types must not support this mode (this may be revisited through the PR process). + | */ + MAV_STANDARD_MODE_CRUISE=3, /* Cruise mode (manual). + Position-controlled and stabilized manual mode. + When sticks are released vehicles return to their level-flight orientation and hold their original track against wind and external forces. + Fixed-wing (FW) vehicles level orientation and maintain current track and altitude against wind and external forces. + Hybrid MC/FW ("VTOL") vehicles first transition to FW mode (if needed) but otherwise behave in the same way as MC vehicles. + Multicopter (MC) vehicles must not support this mode. + Other vehicle types must not support this mode (this may be revisited through the PR process). + | */ + MAV_STANDARD_MODE_ALTITUDE_HOLD=4, /* Altitude hold (manual). + Altitude-controlled and stabilized manual mode. + When sticks are released vehicles return to their level-flight orientation and hold their altitude. + MC vehicles continue with existing momentum and may move with wind (or other external forces). + FW vehicles continue with current heading, but may be moved off-track by wind. + Hybrid MC/FW ("VTOL") vehicles behave according to their current configuration/mode (FW or MC). + Other vehicle types must not support this mode (this may be revisited through the PR process). + | */ + MAV_STANDARD_MODE_SAFE_RECOVERY=5, /* Safe recovery mode (auto). + Automatic mode that takes vehicle to a predefined safe location via a safe flight path, and may also automatically land the vehicle. + This mode is more commonly referred to as RTL and/or or Smart RTL. + The precise return location, flight path, and landing behaviour depend on vehicle configuration and type. + For example, the vehicle might return to the home/launch location, a rally point, or the start of a mission landing, it might follow a direct path, mission path, or breadcrumb path, and land using a mission landing pattern or some other kind of descent. + | */ + MAV_STANDARD_MODE_MISSION=6, /* Mission mode (automatic). + Automatic mode that executes MAVLink missions. + Missions are executed from the current waypoint as soon as the mode is enabled. + | */ + MAV_STANDARD_MODE_LAND=7, /* Land mode (auto). + Automatic mode that lands the vehicle at the current location. + The precise landing behaviour depends on vehicle configuration and type. + | */ + MAV_STANDARD_MODE_TAKEOFF=8, /* Takeoff mode (auto). + Automatic takeoff mode. + The precise takeoff behaviour depends on vehicle configuration and type. + | */ + MAV_STANDARD_MODE_ENUM_END=9, /* | */ +} MAV_STANDARD_MODE; +#endif + +/** @brief Flags used in HIL_ACTUATOR_CONTROLS message. */ +#ifndef HAVE_ENUM_HIL_ACTUATOR_CONTROLS_FLAGS +#define HAVE_ENUM_HIL_ACTUATOR_CONTROLS_FLAGS +typedef enum HIL_ACTUATOR_CONTROLS_FLAGS +{ + HIL_ACTUATOR_CONTROLS_FLAGS_LOCKSTEP=1, /* Simulation is using lockstep | */ + HIL_ACTUATOR_CONTROLS_FLAGS_ENUM_END=2, /* | */ +} HIL_ACTUATOR_CONTROLS_FLAGS; +#endif + +/** @brief Mode properties. + */ +#ifndef HAVE_ENUM_MAV_MODE_PROPERTY +#define HAVE_ENUM_MAV_MODE_PROPERTY +typedef enum MAV_MODE_PROPERTY +{ + MAV_MODE_PROPERTY_ADVANCED=1, /* If set, this mode is an advanced mode. + For example a rate-controlled manual mode might be advanced, whereas a position-controlled manual mode is not. + A GCS can optionally use this flag to configure the UI for its intended users. + | */ + MAV_MODE_PROPERTY_NOT_USER_SELECTABLE=2, /* If set, this mode should not be added to the list of selectable modes. + The mode might still be selected by the FC directly (for example as part of a failsafe). + | */ + MAV_MODE_PROPERTY_ENUM_END=3, /* | */ +} MAV_MODE_PROPERTY; +#endif + +/** @brief Flags used to report computer status. */ +#ifndef HAVE_ENUM_COMPUTER_STATUS_FLAGS +#define HAVE_ENUM_COMPUTER_STATUS_FLAGS +typedef enum COMPUTER_STATUS_FLAGS +{ + COMPUTER_STATUS_FLAGS_UNDER_VOLTAGE=1, /* Indicates if the system is experiencing voltage outside of acceptable range. | */ + COMPUTER_STATUS_FLAGS_CPU_THROTTLE=2, /* Indicates if CPU throttling is active. | */ + COMPUTER_STATUS_FLAGS_THERMAL_THROTTLE=4, /* Indicates if thermal throttling is active. | */ + COMPUTER_STATUS_FLAGS_DISK_FULL=8, /* Indicates if main disk is full. | */ + COMPUTER_STATUS_FLAGS_ENUM_END=9, /* | */ +} COMPUTER_STATUS_FLAGS; +#endif + // MAVLINK VERSION #ifndef MAVLINK_VERSION @@ -2211,7 +2567,6 @@ typedef enum MAG_CAL_STATUS #include "./mavlink_msg_auth_key.h" #include "./mavlink_msg_link_node_status.h" #include "./mavlink_msg_set_mode.h" -#include "./mavlink_msg_param_ack_transaction.h" #include "./mavlink_msg_param_request_read.h" #include "./mavlink_msg_param_request_list.h" #include "./mavlink_msg_param_value.h" @@ -2225,7 +2580,6 @@ typedef enum MAG_CAL_STATUS #include "./mavlink_msg_attitude.h" #include "./mavlink_msg_attitude_quaternion.h" #include "./mavlink_msg_local_position_ned.h" -#include "./mavlink_msg_global_position_int.h" #include "./mavlink_msg_rc_channels_scaled.h" #include "./mavlink_msg_rc_channels_raw.h" #include "./mavlink_msg_servo_output_raw.h" @@ -2244,7 +2598,6 @@ typedef enum MAG_CAL_STATUS #include "./mavlink_msg_gps_global_origin.h" #include "./mavlink_msg_param_map_rc.h" #include "./mavlink_msg_mission_request_int.h" -#include "./mavlink_msg_mission_changed.h" #include "./mavlink_msg_safety_set_allowed_area.h" #include "./mavlink_msg_safety_allowed_area.h" #include "./mavlink_msg_attitude_quaternion_cov.h" @@ -2321,7 +2674,6 @@ typedef enum MAG_CAL_STATUS #include "./mavlink_msg_follow_target.h" #include "./mavlink_msg_control_system_state.h" #include "./mavlink_msg_battery_status.h" -#include "./mavlink_msg_autopilot_version.h" #include "./mavlink_msg_landing_target.h" #include "./mavlink_msg_fence_status.h" #include "./mavlink_msg_mag_cal_report.h" @@ -2364,6 +2716,7 @@ typedef enum MAG_CAL_STATUS #include "./mavlink_msg_camera_fov_status.h" #include "./mavlink_msg_camera_tracking_image_status.h" #include "./mavlink_msg_camera_tracking_geo_status.h" +#include "./mavlink_msg_camera_thermal_range.h" #include "./mavlink_msg_gimbal_manager_information.h" #include "./mavlink_msg_gimbal_manager_status.h" #include "./mavlink_msg_gimbal_manager_set_attitude.h" @@ -2393,17 +2746,33 @@ typedef enum MAG_CAL_STATUS #include "./mavlink_msg_cellular_config.h" #include "./mavlink_msg_raw_rpm.h" #include "./mavlink_msg_utm_global_position.h" +#include "./mavlink_msg_param_error.h" #include "./mavlink_msg_debug_float_array.h" #include "./mavlink_msg_orbit_execution_status.h" #include "./mavlink_msg_smart_battery_info.h" +#include "./mavlink_msg_fuel_status.h" +#include "./mavlink_msg_battery_info.h" #include "./mavlink_msg_generator_status.h" #include "./mavlink_msg_actuator_output_status.h" #include "./mavlink_msg_time_estimate_to_target.h" #include "./mavlink_msg_tunnel.h" +#include "./mavlink_msg_can_frame.h" #include "./mavlink_msg_onboard_computer_status.h" #include "./mavlink_msg_component_information.h" +#include "./mavlink_msg_component_information_basic.h" +#include "./mavlink_msg_component_metadata.h" #include "./mavlink_msg_play_tune_v2.h" #include "./mavlink_msg_supported_tunes.h" +#include "./mavlink_msg_event.h" +#include "./mavlink_msg_current_event_sequence.h" +#include "./mavlink_msg_request_event.h" +#include "./mavlink_msg_response_event_error.h" +#include "./mavlink_msg_available_modes.h" +#include "./mavlink_msg_current_mode.h" +#include "./mavlink_msg_available_modes_monitor.h" +#include "./mavlink_msg_illuminator_status.h" +#include "./mavlink_msg_canfd_frame.h" +#include "./mavlink_msg_can_filter_modify.h" #include "./mavlink_msg_wheel_distance.h" #include "./mavlink_msg_winch_status.h" #include "./mavlink_msg_open_drone_id_basic_id.h" @@ -2413,16 +2782,17 @@ typedef enum MAG_CAL_STATUS #include "./mavlink_msg_open_drone_id_system.h" #include "./mavlink_msg_open_drone_id_operator_id.h" #include "./mavlink_msg_open_drone_id_message_pack.h" +#include "./mavlink_msg_open_drone_id_arm_status.h" +#include "./mavlink_msg_open_drone_id_system_update.h" +#include "./mavlink_msg_hygrometer_sensor.h" // base include -#include "../minimal/minimal.h" +#include "../standard/standard.h" -#undef MAVLINK_THIS_XML_IDX -#define MAVLINK_THIS_XML_IDX 1 -#if MAVLINK_THIS_XML_IDX == MAVLINK_PRIMARY_XML_IDX -# define MAVLINK_MESSAGE_INFO {MAVLINK_MESSAGE_INFO_HEARTBEAT, MAVLINK_MESSAGE_INFO_SYS_STATUS, MAVLINK_MESSAGE_INFO_SYSTEM_TIME, MAVLINK_MESSAGE_INFO_PING, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL_ACK, MAVLINK_MESSAGE_INFO_AUTH_KEY, MAVLINK_MESSAGE_INFO_LINK_NODE_STATUS, MAVLINK_MESSAGE_INFO_SET_MODE, MAVLINK_MESSAGE_INFO_PARAM_ACK_TRANSACTION, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_READ, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_LIST, MAVLINK_MESSAGE_INFO_PARAM_VALUE, MAVLINK_MESSAGE_INFO_PARAM_SET, MAVLINK_MESSAGE_INFO_GPS_RAW_INT, MAVLINK_MESSAGE_INFO_GPS_STATUS, MAVLINK_MESSAGE_INFO_SCALED_IMU, MAVLINK_MESSAGE_INFO_RAW_IMU, MAVLINK_MESSAGE_INFO_RAW_PRESSURE, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE, MAVLINK_MESSAGE_INFO_ATTITUDE, MAVLINK_MESSAGE_INFO_ATTITUDE_QUATERNION, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT, MAVLINK_MESSAGE_INFO_RC_CHANNELS_SCALED, MAVLINK_MESSAGE_INFO_RC_CHANNELS_RAW, MAVLINK_MESSAGE_INFO_SERVO_OUTPUT_RAW, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_PARTIAL_LIST, MAVLINK_MESSAGE_INFO_MISSION_WRITE_PARTIAL_LIST, MAVLINK_MESSAGE_INFO_MISSION_ITEM, MAVLINK_MESSAGE_INFO_MISSION_REQUEST, MAVLINK_MESSAGE_INFO_MISSION_SET_CURRENT, MAVLINK_MESSAGE_INFO_MISSION_CURRENT, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_LIST, MAVLINK_MESSAGE_INFO_MISSION_COUNT, MAVLINK_MESSAGE_INFO_MISSION_CLEAR_ALL, MAVLINK_MESSAGE_INFO_MISSION_ITEM_REACHED, MAVLINK_MESSAGE_INFO_MISSION_ACK, MAVLINK_MESSAGE_INFO_SET_GPS_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_GPS_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_PARAM_MAP_RC, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_INT, MAVLINK_MESSAGE_INFO_MISSION_CHANGED, MAVLINK_MESSAGE_INFO_SAFETY_SET_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_SAFETY_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_ATTITUDE_QUATERNION_COV, MAVLINK_MESSAGE_INFO_NAV_CONTROLLER_OUTPUT, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT_COV, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED_COV, MAVLINK_MESSAGE_INFO_RC_CHANNELS, MAVLINK_MESSAGE_INFO_REQUEST_DATA_STREAM, MAVLINK_MESSAGE_INFO_DATA_STREAM, MAVLINK_MESSAGE_INFO_MANUAL_CONTROL, MAVLINK_MESSAGE_INFO_RC_CHANNELS_OVERRIDE, MAVLINK_MESSAGE_INFO_MISSION_ITEM_INT, MAVLINK_MESSAGE_INFO_VFR_HUD, MAVLINK_MESSAGE_INFO_COMMAND_INT, MAVLINK_MESSAGE_INFO_COMMAND_LONG, MAVLINK_MESSAGE_INFO_COMMAND_ACK, MAVLINK_MESSAGE_INFO_COMMAND_CANCEL, MAVLINK_MESSAGE_INFO_MANUAL_SETPOINT, MAVLINK_MESSAGE_INFO_SET_ATTITUDE_TARGET, MAVLINK_MESSAGE_INFO_ATTITUDE_TARGET, MAVLINK_MESSAGE_INFO_SET_POSITION_TARGET_LOCAL_NED, MAVLINK_MESSAGE_INFO_POSITION_TARGET_LOCAL_NED, MAVLINK_MESSAGE_INFO_SET_POSITION_TARGET_GLOBAL_INT, MAVLINK_MESSAGE_INFO_POSITION_TARGET_GLOBAL_INT, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET, MAVLINK_MESSAGE_INFO_HIL_STATE, MAVLINK_MESSAGE_INFO_HIL_CONTROLS, MAVLINK_MESSAGE_INFO_HIL_RC_INPUTS_RAW, MAVLINK_MESSAGE_INFO_HIL_ACTUATOR_CONTROLS, MAVLINK_MESSAGE_INFO_OPTICAL_FLOW, MAVLINK_MESSAGE_INFO_GLOBAL_VISION_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_VISION_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_VISION_SPEED_ESTIMATE, MAVLINK_MESSAGE_INFO_VICON_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_HIGHRES_IMU, MAVLINK_MESSAGE_INFO_OPTICAL_FLOW_RAD, MAVLINK_MESSAGE_INFO_HIL_SENSOR, MAVLINK_MESSAGE_INFO_SIM_STATE, MAVLINK_MESSAGE_INFO_RADIO_STATUS, MAVLINK_MESSAGE_INFO_FILE_TRANSFER_PROTOCOL, MAVLINK_MESSAGE_INFO_TIMESYNC, MAVLINK_MESSAGE_INFO_CAMERA_TRIGGER, MAVLINK_MESSAGE_INFO_HIL_GPS, MAVLINK_MESSAGE_INFO_HIL_OPTICAL_FLOW, MAVLINK_MESSAGE_INFO_HIL_STATE_QUATERNION, MAVLINK_MESSAGE_INFO_SCALED_IMU2, MAVLINK_MESSAGE_INFO_LOG_REQUEST_LIST, MAVLINK_MESSAGE_INFO_LOG_ENTRY, MAVLINK_MESSAGE_INFO_LOG_REQUEST_DATA, MAVLINK_MESSAGE_INFO_LOG_DATA, MAVLINK_MESSAGE_INFO_LOG_ERASE, MAVLINK_MESSAGE_INFO_LOG_REQUEST_END, MAVLINK_MESSAGE_INFO_GPS_INJECT_DATA, MAVLINK_MESSAGE_INFO_GPS2_RAW, MAVLINK_MESSAGE_INFO_POWER_STATUS, MAVLINK_MESSAGE_INFO_SERIAL_CONTROL, MAVLINK_MESSAGE_INFO_GPS_RTK, MAVLINK_MESSAGE_INFO_GPS2_RTK, MAVLINK_MESSAGE_INFO_SCALED_IMU3, MAVLINK_MESSAGE_INFO_DATA_TRANSMISSION_HANDSHAKE, MAVLINK_MESSAGE_INFO_ENCAPSULATED_DATA, MAVLINK_MESSAGE_INFO_DISTANCE_SENSOR, MAVLINK_MESSAGE_INFO_TERRAIN_REQUEST, MAVLINK_MESSAGE_INFO_TERRAIN_DATA, MAVLINK_MESSAGE_INFO_TERRAIN_CHECK, MAVLINK_MESSAGE_INFO_TERRAIN_REPORT, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE2, MAVLINK_MESSAGE_INFO_ATT_POS_MOCAP, MAVLINK_MESSAGE_INFO_SET_ACTUATOR_CONTROL_TARGET, MAVLINK_MESSAGE_INFO_ACTUATOR_CONTROL_TARGET, MAVLINK_MESSAGE_INFO_ALTITUDE, MAVLINK_MESSAGE_INFO_RESOURCE_REQUEST, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE3, MAVLINK_MESSAGE_INFO_FOLLOW_TARGET, MAVLINK_MESSAGE_INFO_CONTROL_SYSTEM_STATE, MAVLINK_MESSAGE_INFO_BATTERY_STATUS, MAVLINK_MESSAGE_INFO_AUTOPILOT_VERSION, MAVLINK_MESSAGE_INFO_LANDING_TARGET, MAVLINK_MESSAGE_INFO_FENCE_STATUS, MAVLINK_MESSAGE_INFO_MAG_CAL_REPORT, MAVLINK_MESSAGE_INFO_EFI_STATUS, MAVLINK_MESSAGE_INFO_ESTIMATOR_STATUS, MAVLINK_MESSAGE_INFO_WIND_COV, MAVLINK_MESSAGE_INFO_GPS_INPUT, MAVLINK_MESSAGE_INFO_GPS_RTCM_DATA, MAVLINK_MESSAGE_INFO_HIGH_LATENCY, MAVLINK_MESSAGE_INFO_HIGH_LATENCY2, MAVLINK_MESSAGE_INFO_VIBRATION, MAVLINK_MESSAGE_INFO_HOME_POSITION, MAVLINK_MESSAGE_INFO_SET_HOME_POSITION, MAVLINK_MESSAGE_INFO_MESSAGE_INTERVAL, MAVLINK_MESSAGE_INFO_EXTENDED_SYS_STATE, MAVLINK_MESSAGE_INFO_ADSB_VEHICLE, MAVLINK_MESSAGE_INFO_COLLISION, MAVLINK_MESSAGE_INFO_V2_EXTENSION, MAVLINK_MESSAGE_INFO_MEMORY_VECT, MAVLINK_MESSAGE_INFO_DEBUG_VECT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_FLOAT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_INT, MAVLINK_MESSAGE_INFO_STATUSTEXT, MAVLINK_MESSAGE_INFO_DEBUG, MAVLINK_MESSAGE_INFO_SETUP_SIGNING, MAVLINK_MESSAGE_INFO_BUTTON_CHANGE, MAVLINK_MESSAGE_INFO_PLAY_TUNE, MAVLINK_MESSAGE_INFO_CAMERA_INFORMATION, MAVLINK_MESSAGE_INFO_CAMERA_SETTINGS, MAVLINK_MESSAGE_INFO_STORAGE_INFORMATION, MAVLINK_MESSAGE_INFO_CAMERA_CAPTURE_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_IMAGE_CAPTURED, MAVLINK_MESSAGE_INFO_FLIGHT_INFORMATION, MAVLINK_MESSAGE_INFO_MOUNT_ORIENTATION, MAVLINK_MESSAGE_INFO_LOGGING_DATA, MAVLINK_MESSAGE_INFO_LOGGING_DATA_ACKED, MAVLINK_MESSAGE_INFO_LOGGING_ACK, MAVLINK_MESSAGE_INFO_VIDEO_STREAM_INFORMATION, MAVLINK_MESSAGE_INFO_VIDEO_STREAM_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_FOV_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_TRACKING_IMAGE_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_TRACKING_GEO_STATUS, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_INFORMATION, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_STATUS, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_SET_ATTITUDE, MAVLINK_MESSAGE_INFO_GIMBAL_DEVICE_INFORMATION, MAVLINK_MESSAGE_INFO_GIMBAL_DEVICE_SET_ATTITUDE, MAVLINK_MESSAGE_INFO_GIMBAL_DEVICE_ATTITUDE_STATUS, MAVLINK_MESSAGE_INFO_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_SET_PITCHYAW, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_SET_MANUAL_CONTROL, MAVLINK_MESSAGE_INFO_ESC_INFO, MAVLINK_MESSAGE_INFO_ESC_STATUS, MAVLINK_MESSAGE_INFO_WIFI_CONFIG_AP, MAVLINK_MESSAGE_INFO_PROTOCOL_VERSION, MAVLINK_MESSAGE_INFO_AIS_VESSEL, MAVLINK_MESSAGE_INFO_UAVCAN_NODE_STATUS, MAVLINK_MESSAGE_INFO_UAVCAN_NODE_INFO, MAVLINK_MESSAGE_INFO_PARAM_EXT_REQUEST_READ, MAVLINK_MESSAGE_INFO_PARAM_EXT_REQUEST_LIST, MAVLINK_MESSAGE_INFO_PARAM_EXT_VALUE, MAVLINK_MESSAGE_INFO_PARAM_EXT_SET, MAVLINK_MESSAGE_INFO_PARAM_EXT_ACK, MAVLINK_MESSAGE_INFO_OBSTACLE_DISTANCE, MAVLINK_MESSAGE_INFO_ODOMETRY, MAVLINK_MESSAGE_INFO_TRAJECTORY_REPRESENTATION_WAYPOINTS, MAVLINK_MESSAGE_INFO_TRAJECTORY_REPRESENTATION_BEZIER, MAVLINK_MESSAGE_INFO_CELLULAR_STATUS, MAVLINK_MESSAGE_INFO_ISBD_LINK_STATUS, MAVLINK_MESSAGE_INFO_CELLULAR_CONFIG, MAVLINK_MESSAGE_INFO_RAW_RPM, MAVLINK_MESSAGE_INFO_UTM_GLOBAL_POSITION, MAVLINK_MESSAGE_INFO_DEBUG_FLOAT_ARRAY, MAVLINK_MESSAGE_INFO_ORBIT_EXECUTION_STATUS, MAVLINK_MESSAGE_INFO_SMART_BATTERY_INFO, MAVLINK_MESSAGE_INFO_GENERATOR_STATUS, MAVLINK_MESSAGE_INFO_ACTUATOR_OUTPUT_STATUS, MAVLINK_MESSAGE_INFO_TIME_ESTIMATE_TO_TARGET, MAVLINK_MESSAGE_INFO_TUNNEL, MAVLINK_MESSAGE_INFO_ONBOARD_COMPUTER_STATUS, MAVLINK_MESSAGE_INFO_COMPONENT_INFORMATION, MAVLINK_MESSAGE_INFO_PLAY_TUNE_V2, MAVLINK_MESSAGE_INFO_SUPPORTED_TUNES, MAVLINK_MESSAGE_INFO_WHEEL_DISTANCE, MAVLINK_MESSAGE_INFO_WINCH_STATUS, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_BASIC_ID, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_LOCATION, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_AUTHENTICATION, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_SELF_ID, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_SYSTEM, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_OPERATOR_ID, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_MESSAGE_PACK} -# define MAVLINK_MESSAGE_NAMES {{ "ACTUATOR_CONTROL_TARGET", 140 }, { "ACTUATOR_OUTPUT_STATUS", 375 }, { "ADSB_VEHICLE", 246 }, { "AIS_VESSEL", 301 }, { "ALTITUDE", 141 }, { "ATTITUDE", 30 }, { "ATTITUDE_QUATERNION", 31 }, { "ATTITUDE_QUATERNION_COV", 61 }, { "ATTITUDE_TARGET", 83 }, { "ATT_POS_MOCAP", 138 }, { "AUTH_KEY", 7 }, { "AUTOPILOT_STATE_FOR_GIMBAL_DEVICE", 286 }, { "AUTOPILOT_VERSION", 148 }, { "BATTERY_STATUS", 147 }, { "BUTTON_CHANGE", 257 }, { "CAMERA_CAPTURE_STATUS", 262 }, { "CAMERA_FOV_STATUS", 271 }, { "CAMERA_IMAGE_CAPTURED", 263 }, { "CAMERA_INFORMATION", 259 }, { "CAMERA_SETTINGS", 260 }, { "CAMERA_TRACKING_GEO_STATUS", 276 }, { "CAMERA_TRACKING_IMAGE_STATUS", 275 }, { "CAMERA_TRIGGER", 112 }, { "CELLULAR_CONFIG", 336 }, { "CELLULAR_STATUS", 334 }, { "CHANGE_OPERATOR_CONTROL", 5 }, { "CHANGE_OPERATOR_CONTROL_ACK", 6 }, { "COLLISION", 247 }, { "COMMAND_ACK", 77 }, { "COMMAND_CANCEL", 80 }, { "COMMAND_INT", 75 }, { "COMMAND_LONG", 76 }, { "COMPONENT_INFORMATION", 395 }, { "CONTROL_SYSTEM_STATE", 146 }, { "DATA_STREAM", 67 }, { "DATA_TRANSMISSION_HANDSHAKE", 130 }, { "DEBUG", 254 }, { "DEBUG_FLOAT_ARRAY", 350 }, { "DEBUG_VECT", 250 }, { "DISTANCE_SENSOR", 132 }, { "EFI_STATUS", 225 }, { "ENCAPSULATED_DATA", 131 }, { "ESC_INFO", 290 }, { "ESC_STATUS", 291 }, { "ESTIMATOR_STATUS", 230 }, { "EXTENDED_SYS_STATE", 245 }, { "FENCE_STATUS", 162 }, { "FILE_TRANSFER_PROTOCOL", 110 }, { "FLIGHT_INFORMATION", 264 }, { "FOLLOW_TARGET", 144 }, { "GENERATOR_STATUS", 373 }, { "GIMBAL_DEVICE_ATTITUDE_STATUS", 285 }, { "GIMBAL_DEVICE_INFORMATION", 283 }, { "GIMBAL_DEVICE_SET_ATTITUDE", 284 }, { "GIMBAL_MANAGER_INFORMATION", 280 }, { "GIMBAL_MANAGER_SET_ATTITUDE", 282 }, { "GIMBAL_MANAGER_SET_MANUAL_CONTROL", 288 }, { "GIMBAL_MANAGER_SET_PITCHYAW", 287 }, { "GIMBAL_MANAGER_STATUS", 281 }, { "GLOBAL_POSITION_INT", 33 }, { "GLOBAL_POSITION_INT_COV", 63 }, { "GLOBAL_VISION_POSITION_ESTIMATE", 101 }, { "GPS2_RAW", 124 }, { "GPS2_RTK", 128 }, { "GPS_GLOBAL_ORIGIN", 49 }, { "GPS_INJECT_DATA", 123 }, { "GPS_INPUT", 232 }, { "GPS_RAW_INT", 24 }, { "GPS_RTCM_DATA", 233 }, { "GPS_RTK", 127 }, { "GPS_STATUS", 25 }, { "HEARTBEAT", 0 }, { "HIGHRES_IMU", 105 }, { "HIGH_LATENCY", 234 }, { "HIGH_LATENCY2", 235 }, { "HIL_ACTUATOR_CONTROLS", 93 }, { "HIL_CONTROLS", 91 }, { "HIL_GPS", 113 }, { "HIL_OPTICAL_FLOW", 114 }, { "HIL_RC_INPUTS_RAW", 92 }, { "HIL_SENSOR", 107 }, { "HIL_STATE", 90 }, { "HIL_STATE_QUATERNION", 115 }, { "HOME_POSITION", 242 }, { "ISBD_LINK_STATUS", 335 }, { "LANDING_TARGET", 149 }, { "LINK_NODE_STATUS", 8 }, { "LOCAL_POSITION_NED", 32 }, { "LOCAL_POSITION_NED_COV", 64 }, { "LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET", 89 }, { "LOGGING_ACK", 268 }, { "LOGGING_DATA", 266 }, { "LOGGING_DATA_ACKED", 267 }, { "LOG_DATA", 120 }, { "LOG_ENTRY", 118 }, { "LOG_ERASE", 121 }, { "LOG_REQUEST_DATA", 119 }, { "LOG_REQUEST_END", 122 }, { "LOG_REQUEST_LIST", 117 }, { "MAG_CAL_REPORT", 192 }, { "MANUAL_CONTROL", 69 }, { "MANUAL_SETPOINT", 81 }, { "MEMORY_VECT", 249 }, { "MESSAGE_INTERVAL", 244 }, { "MISSION_ACK", 47 }, { "MISSION_CHANGED", 52 }, { "MISSION_CLEAR_ALL", 45 }, { "MISSION_COUNT", 44 }, { "MISSION_CURRENT", 42 }, { "MISSION_ITEM", 39 }, { "MISSION_ITEM_INT", 73 }, { "MISSION_ITEM_REACHED", 46 }, { "MISSION_REQUEST", 40 }, { "MISSION_REQUEST_INT", 51 }, { "MISSION_REQUEST_LIST", 43 }, { "MISSION_REQUEST_PARTIAL_LIST", 37 }, { "MISSION_SET_CURRENT", 41 }, { "MISSION_WRITE_PARTIAL_LIST", 38 }, { "MOUNT_ORIENTATION", 265 }, { "NAMED_VALUE_FLOAT", 251 }, { "NAMED_VALUE_INT", 252 }, { "NAV_CONTROLLER_OUTPUT", 62 }, { "OBSTACLE_DISTANCE", 330 }, { "ODOMETRY", 331 }, { "ONBOARD_COMPUTER_STATUS", 390 }, { "OPEN_DRONE_ID_AUTHENTICATION", 12902 }, { "OPEN_DRONE_ID_BASIC_ID", 12900 }, { "OPEN_DRONE_ID_LOCATION", 12901 }, { "OPEN_DRONE_ID_MESSAGE_PACK", 12915 }, { "OPEN_DRONE_ID_OPERATOR_ID", 12905 }, { "OPEN_DRONE_ID_SELF_ID", 12903 }, { "OPEN_DRONE_ID_SYSTEM", 12904 }, { "OPTICAL_FLOW", 100 }, { "OPTICAL_FLOW_RAD", 106 }, { "ORBIT_EXECUTION_STATUS", 360 }, { "PARAM_ACK_TRANSACTION", 19 }, { "PARAM_EXT_ACK", 324 }, { "PARAM_EXT_REQUEST_LIST", 321 }, { "PARAM_EXT_REQUEST_READ", 320 }, { "PARAM_EXT_SET", 323 }, { "PARAM_EXT_VALUE", 322 }, { "PARAM_MAP_RC", 50 }, { "PARAM_REQUEST_LIST", 21 }, { "PARAM_REQUEST_READ", 20 }, { "PARAM_SET", 23 }, { "PARAM_VALUE", 22 }, { "PING", 4 }, { "PLAY_TUNE", 258 }, { "PLAY_TUNE_V2", 400 }, { "POSITION_TARGET_GLOBAL_INT", 87 }, { "POSITION_TARGET_LOCAL_NED", 85 }, { "POWER_STATUS", 125 }, { "PROTOCOL_VERSION", 300 }, { "RADIO_STATUS", 109 }, { "RAW_IMU", 27 }, { "RAW_PRESSURE", 28 }, { "RAW_RPM", 339 }, { "RC_CHANNELS", 65 }, { "RC_CHANNELS_OVERRIDE", 70 }, { "RC_CHANNELS_RAW", 35 }, { "RC_CHANNELS_SCALED", 34 }, { "REQUEST_DATA_STREAM", 66 }, { "RESOURCE_REQUEST", 142 }, { "SAFETY_ALLOWED_AREA", 55 }, { "SAFETY_SET_ALLOWED_AREA", 54 }, { "SCALED_IMU", 26 }, { "SCALED_IMU2", 116 }, { "SCALED_IMU3", 129 }, { "SCALED_PRESSURE", 29 }, { "SCALED_PRESSURE2", 137 }, { "SCALED_PRESSURE3", 143 }, { "SERIAL_CONTROL", 126 }, { "SERVO_OUTPUT_RAW", 36 }, { "SETUP_SIGNING", 256 }, { "SET_ACTUATOR_CONTROL_TARGET", 139 }, { "SET_ATTITUDE_TARGET", 82 }, { "SET_GPS_GLOBAL_ORIGIN", 48 }, { "SET_HOME_POSITION", 243 }, { "SET_MODE", 11 }, { "SET_POSITION_TARGET_GLOBAL_INT", 86 }, { "SET_POSITION_TARGET_LOCAL_NED", 84 }, { "SIM_STATE", 108 }, { "SMART_BATTERY_INFO", 370 }, { "STATUSTEXT", 253 }, { "STORAGE_INFORMATION", 261 }, { "SUPPORTED_TUNES", 401 }, { "SYSTEM_TIME", 2 }, { "SYS_STATUS", 1 }, { "TERRAIN_CHECK", 135 }, { "TERRAIN_DATA", 134 }, { "TERRAIN_REPORT", 136 }, { "TERRAIN_REQUEST", 133 }, { "TIMESYNC", 111 }, { "TIME_ESTIMATE_TO_TARGET", 380 }, { "TRAJECTORY_REPRESENTATION_BEZIER", 333 }, { "TRAJECTORY_REPRESENTATION_WAYPOINTS", 332 }, { "TUNNEL", 385 }, { "UAVCAN_NODE_INFO", 311 }, { "UAVCAN_NODE_STATUS", 310 }, { "UTM_GLOBAL_POSITION", 340 }, { "V2_EXTENSION", 248 }, { "VFR_HUD", 74 }, { "VIBRATION", 241 }, { "VICON_POSITION_ESTIMATE", 104 }, { "VIDEO_STREAM_INFORMATION", 269 }, { "VIDEO_STREAM_STATUS", 270 }, { "VISION_POSITION_ESTIMATE", 102 }, { "VISION_SPEED_ESTIMATE", 103 }, { "WHEEL_DISTANCE", 9000 }, { "WIFI_CONFIG_AP", 299 }, { "WINCH_STATUS", 9005 }, { "WIND_COV", 231 }} +#if MAVLINK_COMMON_XML_HASH == MAVLINK_PRIMARY_XML_HASH +# define MAVLINK_MESSAGE_INFO {MAVLINK_MESSAGE_INFO_HEARTBEAT, MAVLINK_MESSAGE_INFO_SYS_STATUS, MAVLINK_MESSAGE_INFO_SYSTEM_TIME, MAVLINK_MESSAGE_INFO_PING, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL_ACK, MAVLINK_MESSAGE_INFO_AUTH_KEY, MAVLINK_MESSAGE_INFO_LINK_NODE_STATUS, MAVLINK_MESSAGE_INFO_SET_MODE, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_READ, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_LIST, MAVLINK_MESSAGE_INFO_PARAM_VALUE, MAVLINK_MESSAGE_INFO_PARAM_SET, MAVLINK_MESSAGE_INFO_GPS_RAW_INT, MAVLINK_MESSAGE_INFO_GPS_STATUS, MAVLINK_MESSAGE_INFO_SCALED_IMU, MAVLINK_MESSAGE_INFO_RAW_IMU, MAVLINK_MESSAGE_INFO_RAW_PRESSURE, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE, MAVLINK_MESSAGE_INFO_ATTITUDE, MAVLINK_MESSAGE_INFO_ATTITUDE_QUATERNION, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT, MAVLINK_MESSAGE_INFO_RC_CHANNELS_SCALED, MAVLINK_MESSAGE_INFO_RC_CHANNELS_RAW, MAVLINK_MESSAGE_INFO_SERVO_OUTPUT_RAW, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_PARTIAL_LIST, MAVLINK_MESSAGE_INFO_MISSION_WRITE_PARTIAL_LIST, MAVLINK_MESSAGE_INFO_MISSION_ITEM, MAVLINK_MESSAGE_INFO_MISSION_REQUEST, MAVLINK_MESSAGE_INFO_MISSION_SET_CURRENT, MAVLINK_MESSAGE_INFO_MISSION_CURRENT, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_LIST, MAVLINK_MESSAGE_INFO_MISSION_COUNT, MAVLINK_MESSAGE_INFO_MISSION_CLEAR_ALL, MAVLINK_MESSAGE_INFO_MISSION_ITEM_REACHED, MAVLINK_MESSAGE_INFO_MISSION_ACK, MAVLINK_MESSAGE_INFO_SET_GPS_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_GPS_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_PARAM_MAP_RC, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_INT, MAVLINK_MESSAGE_INFO_SAFETY_SET_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_SAFETY_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_ATTITUDE_QUATERNION_COV, MAVLINK_MESSAGE_INFO_NAV_CONTROLLER_OUTPUT, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT_COV, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED_COV, MAVLINK_MESSAGE_INFO_RC_CHANNELS, MAVLINK_MESSAGE_INFO_REQUEST_DATA_STREAM, MAVLINK_MESSAGE_INFO_DATA_STREAM, MAVLINK_MESSAGE_INFO_MANUAL_CONTROL, MAVLINK_MESSAGE_INFO_RC_CHANNELS_OVERRIDE, MAVLINK_MESSAGE_INFO_MISSION_ITEM_INT, MAVLINK_MESSAGE_INFO_VFR_HUD, MAVLINK_MESSAGE_INFO_COMMAND_INT, MAVLINK_MESSAGE_INFO_COMMAND_LONG, MAVLINK_MESSAGE_INFO_COMMAND_ACK, MAVLINK_MESSAGE_INFO_COMMAND_CANCEL, MAVLINK_MESSAGE_INFO_MANUAL_SETPOINT, MAVLINK_MESSAGE_INFO_SET_ATTITUDE_TARGET, MAVLINK_MESSAGE_INFO_ATTITUDE_TARGET, MAVLINK_MESSAGE_INFO_SET_POSITION_TARGET_LOCAL_NED, MAVLINK_MESSAGE_INFO_POSITION_TARGET_LOCAL_NED, MAVLINK_MESSAGE_INFO_SET_POSITION_TARGET_GLOBAL_INT, MAVLINK_MESSAGE_INFO_POSITION_TARGET_GLOBAL_INT, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET, MAVLINK_MESSAGE_INFO_HIL_STATE, MAVLINK_MESSAGE_INFO_HIL_CONTROLS, MAVLINK_MESSAGE_INFO_HIL_RC_INPUTS_RAW, MAVLINK_MESSAGE_INFO_HIL_ACTUATOR_CONTROLS, MAVLINK_MESSAGE_INFO_OPTICAL_FLOW, MAVLINK_MESSAGE_INFO_GLOBAL_VISION_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_VISION_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_VISION_SPEED_ESTIMATE, MAVLINK_MESSAGE_INFO_VICON_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_HIGHRES_IMU, MAVLINK_MESSAGE_INFO_OPTICAL_FLOW_RAD, MAVLINK_MESSAGE_INFO_HIL_SENSOR, MAVLINK_MESSAGE_INFO_SIM_STATE, MAVLINK_MESSAGE_INFO_RADIO_STATUS, MAVLINK_MESSAGE_INFO_FILE_TRANSFER_PROTOCOL, MAVLINK_MESSAGE_INFO_TIMESYNC, MAVLINK_MESSAGE_INFO_CAMERA_TRIGGER, MAVLINK_MESSAGE_INFO_HIL_GPS, MAVLINK_MESSAGE_INFO_HIL_OPTICAL_FLOW, MAVLINK_MESSAGE_INFO_HIL_STATE_QUATERNION, MAVLINK_MESSAGE_INFO_SCALED_IMU2, MAVLINK_MESSAGE_INFO_LOG_REQUEST_LIST, MAVLINK_MESSAGE_INFO_LOG_ENTRY, MAVLINK_MESSAGE_INFO_LOG_REQUEST_DATA, MAVLINK_MESSAGE_INFO_LOG_DATA, MAVLINK_MESSAGE_INFO_LOG_ERASE, MAVLINK_MESSAGE_INFO_LOG_REQUEST_END, MAVLINK_MESSAGE_INFO_GPS_INJECT_DATA, MAVLINK_MESSAGE_INFO_GPS2_RAW, MAVLINK_MESSAGE_INFO_POWER_STATUS, MAVLINK_MESSAGE_INFO_SERIAL_CONTROL, MAVLINK_MESSAGE_INFO_GPS_RTK, MAVLINK_MESSAGE_INFO_GPS2_RTK, MAVLINK_MESSAGE_INFO_SCALED_IMU3, MAVLINK_MESSAGE_INFO_DATA_TRANSMISSION_HANDSHAKE, MAVLINK_MESSAGE_INFO_ENCAPSULATED_DATA, MAVLINK_MESSAGE_INFO_DISTANCE_SENSOR, MAVLINK_MESSAGE_INFO_TERRAIN_REQUEST, MAVLINK_MESSAGE_INFO_TERRAIN_DATA, MAVLINK_MESSAGE_INFO_TERRAIN_CHECK, MAVLINK_MESSAGE_INFO_TERRAIN_REPORT, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE2, MAVLINK_MESSAGE_INFO_ATT_POS_MOCAP, MAVLINK_MESSAGE_INFO_SET_ACTUATOR_CONTROL_TARGET, MAVLINK_MESSAGE_INFO_ACTUATOR_CONTROL_TARGET, MAVLINK_MESSAGE_INFO_ALTITUDE, MAVLINK_MESSAGE_INFO_RESOURCE_REQUEST, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE3, MAVLINK_MESSAGE_INFO_FOLLOW_TARGET, MAVLINK_MESSAGE_INFO_CONTROL_SYSTEM_STATE, MAVLINK_MESSAGE_INFO_BATTERY_STATUS, MAVLINK_MESSAGE_INFO_AUTOPILOT_VERSION, MAVLINK_MESSAGE_INFO_LANDING_TARGET, MAVLINK_MESSAGE_INFO_FENCE_STATUS, MAVLINK_MESSAGE_INFO_MAG_CAL_REPORT, MAVLINK_MESSAGE_INFO_EFI_STATUS, MAVLINK_MESSAGE_INFO_ESTIMATOR_STATUS, MAVLINK_MESSAGE_INFO_WIND_COV, MAVLINK_MESSAGE_INFO_GPS_INPUT, MAVLINK_MESSAGE_INFO_GPS_RTCM_DATA, MAVLINK_MESSAGE_INFO_HIGH_LATENCY, MAVLINK_MESSAGE_INFO_HIGH_LATENCY2, MAVLINK_MESSAGE_INFO_VIBRATION, MAVLINK_MESSAGE_INFO_HOME_POSITION, MAVLINK_MESSAGE_INFO_SET_HOME_POSITION, MAVLINK_MESSAGE_INFO_MESSAGE_INTERVAL, MAVLINK_MESSAGE_INFO_EXTENDED_SYS_STATE, MAVLINK_MESSAGE_INFO_ADSB_VEHICLE, MAVLINK_MESSAGE_INFO_COLLISION, MAVLINK_MESSAGE_INFO_V2_EXTENSION, MAVLINK_MESSAGE_INFO_MEMORY_VECT, MAVLINK_MESSAGE_INFO_DEBUG_VECT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_FLOAT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_INT, MAVLINK_MESSAGE_INFO_STATUSTEXT, MAVLINK_MESSAGE_INFO_DEBUG, MAVLINK_MESSAGE_INFO_SETUP_SIGNING, MAVLINK_MESSAGE_INFO_BUTTON_CHANGE, MAVLINK_MESSAGE_INFO_PLAY_TUNE, MAVLINK_MESSAGE_INFO_CAMERA_INFORMATION, MAVLINK_MESSAGE_INFO_CAMERA_SETTINGS, MAVLINK_MESSAGE_INFO_STORAGE_INFORMATION, MAVLINK_MESSAGE_INFO_CAMERA_CAPTURE_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_IMAGE_CAPTURED, MAVLINK_MESSAGE_INFO_FLIGHT_INFORMATION, MAVLINK_MESSAGE_INFO_MOUNT_ORIENTATION, MAVLINK_MESSAGE_INFO_LOGGING_DATA, MAVLINK_MESSAGE_INFO_LOGGING_DATA_ACKED, MAVLINK_MESSAGE_INFO_LOGGING_ACK, MAVLINK_MESSAGE_INFO_VIDEO_STREAM_INFORMATION, MAVLINK_MESSAGE_INFO_VIDEO_STREAM_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_FOV_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_TRACKING_IMAGE_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_TRACKING_GEO_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_THERMAL_RANGE, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_INFORMATION, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_STATUS, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_SET_ATTITUDE, MAVLINK_MESSAGE_INFO_GIMBAL_DEVICE_INFORMATION, MAVLINK_MESSAGE_INFO_GIMBAL_DEVICE_SET_ATTITUDE, MAVLINK_MESSAGE_INFO_GIMBAL_DEVICE_ATTITUDE_STATUS, MAVLINK_MESSAGE_INFO_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_SET_PITCHYAW, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_SET_MANUAL_CONTROL, MAVLINK_MESSAGE_INFO_ESC_INFO, MAVLINK_MESSAGE_INFO_ESC_STATUS, MAVLINK_MESSAGE_INFO_WIFI_CONFIG_AP, MAVLINK_MESSAGE_INFO_PROTOCOL_VERSION, MAVLINK_MESSAGE_INFO_AIS_VESSEL, MAVLINK_MESSAGE_INFO_UAVCAN_NODE_STATUS, MAVLINK_MESSAGE_INFO_UAVCAN_NODE_INFO, MAVLINK_MESSAGE_INFO_PARAM_EXT_REQUEST_READ, MAVLINK_MESSAGE_INFO_PARAM_EXT_REQUEST_LIST, MAVLINK_MESSAGE_INFO_PARAM_EXT_VALUE, MAVLINK_MESSAGE_INFO_PARAM_EXT_SET, MAVLINK_MESSAGE_INFO_PARAM_EXT_ACK, MAVLINK_MESSAGE_INFO_OBSTACLE_DISTANCE, MAVLINK_MESSAGE_INFO_ODOMETRY, MAVLINK_MESSAGE_INFO_TRAJECTORY_REPRESENTATION_WAYPOINTS, MAVLINK_MESSAGE_INFO_TRAJECTORY_REPRESENTATION_BEZIER, MAVLINK_MESSAGE_INFO_CELLULAR_STATUS, MAVLINK_MESSAGE_INFO_ISBD_LINK_STATUS, MAVLINK_MESSAGE_INFO_CELLULAR_CONFIG, MAVLINK_MESSAGE_INFO_RAW_RPM, MAVLINK_MESSAGE_INFO_UTM_GLOBAL_POSITION, MAVLINK_MESSAGE_INFO_PARAM_ERROR, MAVLINK_MESSAGE_INFO_DEBUG_FLOAT_ARRAY, MAVLINK_MESSAGE_INFO_ORBIT_EXECUTION_STATUS, MAVLINK_MESSAGE_INFO_SMART_BATTERY_INFO, MAVLINK_MESSAGE_INFO_FUEL_STATUS, MAVLINK_MESSAGE_INFO_BATTERY_INFO, MAVLINK_MESSAGE_INFO_GENERATOR_STATUS, MAVLINK_MESSAGE_INFO_ACTUATOR_OUTPUT_STATUS, MAVLINK_MESSAGE_INFO_TIME_ESTIMATE_TO_TARGET, MAVLINK_MESSAGE_INFO_TUNNEL, MAVLINK_MESSAGE_INFO_CAN_FRAME, MAVLINK_MESSAGE_INFO_CANFD_FRAME, MAVLINK_MESSAGE_INFO_CAN_FILTER_MODIFY, MAVLINK_MESSAGE_INFO_ONBOARD_COMPUTER_STATUS, MAVLINK_MESSAGE_INFO_COMPONENT_INFORMATION, MAVLINK_MESSAGE_INFO_COMPONENT_INFORMATION_BASIC, MAVLINK_MESSAGE_INFO_COMPONENT_METADATA, MAVLINK_MESSAGE_INFO_PLAY_TUNE_V2, MAVLINK_MESSAGE_INFO_SUPPORTED_TUNES, MAVLINK_MESSAGE_INFO_EVENT, MAVLINK_MESSAGE_INFO_CURRENT_EVENT_SEQUENCE, MAVLINK_MESSAGE_INFO_REQUEST_EVENT, MAVLINK_MESSAGE_INFO_RESPONSE_EVENT_ERROR, MAVLINK_MESSAGE_INFO_AVAILABLE_MODES, MAVLINK_MESSAGE_INFO_CURRENT_MODE, MAVLINK_MESSAGE_INFO_AVAILABLE_MODES_MONITOR, MAVLINK_MESSAGE_INFO_ILLUMINATOR_STATUS, MAVLINK_MESSAGE_INFO_WHEEL_DISTANCE, MAVLINK_MESSAGE_INFO_WINCH_STATUS, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_BASIC_ID, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_LOCATION, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_AUTHENTICATION, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_SELF_ID, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_SYSTEM, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_OPERATOR_ID, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_MESSAGE_PACK, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_ARM_STATUS, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_SYSTEM_UPDATE, MAVLINK_MESSAGE_INFO_HYGROMETER_SENSOR} +# define MAVLINK_MESSAGE_NAMES {{ "ACTUATOR_CONTROL_TARGET", 140 }, { "ACTUATOR_OUTPUT_STATUS", 375 }, { "ADSB_VEHICLE", 246 }, { "AIS_VESSEL", 301 }, { "ALTITUDE", 141 }, { "ATTITUDE", 30 }, { "ATTITUDE_QUATERNION", 31 }, { "ATTITUDE_QUATERNION_COV", 61 }, { "ATTITUDE_TARGET", 83 }, { "ATT_POS_MOCAP", 138 }, { "AUTH_KEY", 7 }, { "AUTOPILOT_STATE_FOR_GIMBAL_DEVICE", 286 }, { "AUTOPILOT_VERSION", 148 }, { "AVAILABLE_MODES", 435 }, { "AVAILABLE_MODES_MONITOR", 437 }, { "BATTERY_INFO", 372 }, { "BATTERY_STATUS", 147 }, { "BUTTON_CHANGE", 257 }, { "CAMERA_CAPTURE_STATUS", 262 }, { "CAMERA_FOV_STATUS", 271 }, { "CAMERA_IMAGE_CAPTURED", 263 }, { "CAMERA_INFORMATION", 259 }, { "CAMERA_SETTINGS", 260 }, { "CAMERA_THERMAL_RANGE", 277 }, { "CAMERA_TRACKING_GEO_STATUS", 276 }, { "CAMERA_TRACKING_IMAGE_STATUS", 275 }, { "CAMERA_TRIGGER", 112 }, { "CANFD_FRAME", 387 }, { "CAN_FILTER_MODIFY", 388 }, { "CAN_FRAME", 386 }, { "CELLULAR_CONFIG", 336 }, { "CELLULAR_STATUS", 334 }, { "CHANGE_OPERATOR_CONTROL", 5 }, { "CHANGE_OPERATOR_CONTROL_ACK", 6 }, { "COLLISION", 247 }, { "COMMAND_ACK", 77 }, { "COMMAND_CANCEL", 80 }, { "COMMAND_INT", 75 }, { "COMMAND_LONG", 76 }, { "COMPONENT_INFORMATION", 395 }, { "COMPONENT_INFORMATION_BASIC", 396 }, { "COMPONENT_METADATA", 397 }, { "CONTROL_SYSTEM_STATE", 146 }, { "CURRENT_EVENT_SEQUENCE", 411 }, { "CURRENT_MODE", 436 }, { "DATA_STREAM", 67 }, { "DATA_TRANSMISSION_HANDSHAKE", 130 }, { "DEBUG", 254 }, { "DEBUG_FLOAT_ARRAY", 350 }, { "DEBUG_VECT", 250 }, { "DISTANCE_SENSOR", 132 }, { "EFI_STATUS", 225 }, { "ENCAPSULATED_DATA", 131 }, { "ESC_INFO", 290 }, { "ESC_STATUS", 291 }, { "ESTIMATOR_STATUS", 230 }, { "EVENT", 410 }, { "EXTENDED_SYS_STATE", 245 }, { "FENCE_STATUS", 162 }, { "FILE_TRANSFER_PROTOCOL", 110 }, { "FLIGHT_INFORMATION", 264 }, { "FOLLOW_TARGET", 144 }, { "FUEL_STATUS", 371 }, { "GENERATOR_STATUS", 373 }, { "GIMBAL_DEVICE_ATTITUDE_STATUS", 285 }, { "GIMBAL_DEVICE_INFORMATION", 283 }, { "GIMBAL_DEVICE_SET_ATTITUDE", 284 }, { "GIMBAL_MANAGER_INFORMATION", 280 }, { "GIMBAL_MANAGER_SET_ATTITUDE", 282 }, { "GIMBAL_MANAGER_SET_MANUAL_CONTROL", 288 }, { "GIMBAL_MANAGER_SET_PITCHYAW", 287 }, { "GIMBAL_MANAGER_STATUS", 281 }, { "GLOBAL_POSITION_INT", 33 }, { "GLOBAL_POSITION_INT_COV", 63 }, { "GLOBAL_VISION_POSITION_ESTIMATE", 101 }, { "GPS2_RAW", 124 }, { "GPS2_RTK", 128 }, { "GPS_GLOBAL_ORIGIN", 49 }, { "GPS_INJECT_DATA", 123 }, { "GPS_INPUT", 232 }, { "GPS_RAW_INT", 24 }, { "GPS_RTCM_DATA", 233 }, { "GPS_RTK", 127 }, { "GPS_STATUS", 25 }, { "HEARTBEAT", 0 }, { "HIGHRES_IMU", 105 }, { "HIGH_LATENCY", 234 }, { "HIGH_LATENCY2", 235 }, { "HIL_ACTUATOR_CONTROLS", 93 }, { "HIL_CONTROLS", 91 }, { "HIL_GPS", 113 }, { "HIL_OPTICAL_FLOW", 114 }, { "HIL_RC_INPUTS_RAW", 92 }, { "HIL_SENSOR", 107 }, { "HIL_STATE", 90 }, { "HIL_STATE_QUATERNION", 115 }, { "HOME_POSITION", 242 }, { "HYGROMETER_SENSOR", 12920 }, { "ILLUMINATOR_STATUS", 440 }, { "ISBD_LINK_STATUS", 335 }, { "LANDING_TARGET", 149 }, { "LINK_NODE_STATUS", 8 }, { "LOCAL_POSITION_NED", 32 }, { "LOCAL_POSITION_NED_COV", 64 }, { "LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET", 89 }, { "LOGGING_ACK", 268 }, { "LOGGING_DATA", 266 }, { "LOGGING_DATA_ACKED", 267 }, { "LOG_DATA", 120 }, { "LOG_ENTRY", 118 }, { "LOG_ERASE", 121 }, { "LOG_REQUEST_DATA", 119 }, { "LOG_REQUEST_END", 122 }, { "LOG_REQUEST_LIST", 117 }, { "MAG_CAL_REPORT", 192 }, { "MANUAL_CONTROL", 69 }, { "MANUAL_SETPOINT", 81 }, { "MEMORY_VECT", 249 }, { "MESSAGE_INTERVAL", 244 }, { "MISSION_ACK", 47 }, { "MISSION_CLEAR_ALL", 45 }, { "MISSION_COUNT", 44 }, { "MISSION_CURRENT", 42 }, { "MISSION_ITEM", 39 }, { "MISSION_ITEM_INT", 73 }, { "MISSION_ITEM_REACHED", 46 }, { "MISSION_REQUEST", 40 }, { "MISSION_REQUEST_INT", 51 }, { "MISSION_REQUEST_LIST", 43 }, { "MISSION_REQUEST_PARTIAL_LIST", 37 }, { "MISSION_SET_CURRENT", 41 }, { "MISSION_WRITE_PARTIAL_LIST", 38 }, { "MOUNT_ORIENTATION", 265 }, { "NAMED_VALUE_FLOAT", 251 }, { "NAMED_VALUE_INT", 252 }, { "NAV_CONTROLLER_OUTPUT", 62 }, { "OBSTACLE_DISTANCE", 330 }, { "ODOMETRY", 331 }, { "ONBOARD_COMPUTER_STATUS", 390 }, { "OPEN_DRONE_ID_ARM_STATUS", 12918 }, { "OPEN_DRONE_ID_AUTHENTICATION", 12902 }, { "OPEN_DRONE_ID_BASIC_ID", 12900 }, { "OPEN_DRONE_ID_LOCATION", 12901 }, { "OPEN_DRONE_ID_MESSAGE_PACK", 12915 }, { "OPEN_DRONE_ID_OPERATOR_ID", 12905 }, { "OPEN_DRONE_ID_SELF_ID", 12903 }, { "OPEN_DRONE_ID_SYSTEM", 12904 }, { "OPEN_DRONE_ID_SYSTEM_UPDATE", 12919 }, { "OPTICAL_FLOW", 100 }, { "OPTICAL_FLOW_RAD", 106 }, { "ORBIT_EXECUTION_STATUS", 360 }, { "PARAM_ERROR", 345 }, { "PARAM_EXT_ACK", 324 }, { "PARAM_EXT_REQUEST_LIST", 321 }, { "PARAM_EXT_REQUEST_READ", 320 }, { "PARAM_EXT_SET", 323 }, { "PARAM_EXT_VALUE", 322 }, { "PARAM_MAP_RC", 50 }, { "PARAM_REQUEST_LIST", 21 }, { "PARAM_REQUEST_READ", 20 }, { "PARAM_SET", 23 }, { "PARAM_VALUE", 22 }, { "PING", 4 }, { "PLAY_TUNE", 258 }, { "PLAY_TUNE_V2", 400 }, { "POSITION_TARGET_GLOBAL_INT", 87 }, { "POSITION_TARGET_LOCAL_NED", 85 }, { "POWER_STATUS", 125 }, { "PROTOCOL_VERSION", 300 }, { "RADIO_STATUS", 109 }, { "RAW_IMU", 27 }, { "RAW_PRESSURE", 28 }, { "RAW_RPM", 339 }, { "RC_CHANNELS", 65 }, { "RC_CHANNELS_OVERRIDE", 70 }, { "RC_CHANNELS_RAW", 35 }, { "RC_CHANNELS_SCALED", 34 }, { "REQUEST_DATA_STREAM", 66 }, { "REQUEST_EVENT", 412 }, { "RESOURCE_REQUEST", 142 }, { "RESPONSE_EVENT_ERROR", 413 }, { "SAFETY_ALLOWED_AREA", 55 }, { "SAFETY_SET_ALLOWED_AREA", 54 }, { "SCALED_IMU", 26 }, { "SCALED_IMU2", 116 }, { "SCALED_IMU3", 129 }, { "SCALED_PRESSURE", 29 }, { "SCALED_PRESSURE2", 137 }, { "SCALED_PRESSURE3", 143 }, { "SERIAL_CONTROL", 126 }, { "SERVO_OUTPUT_RAW", 36 }, { "SETUP_SIGNING", 256 }, { "SET_ACTUATOR_CONTROL_TARGET", 139 }, { "SET_ATTITUDE_TARGET", 82 }, { "SET_GPS_GLOBAL_ORIGIN", 48 }, { "SET_HOME_POSITION", 243 }, { "SET_MODE", 11 }, { "SET_POSITION_TARGET_GLOBAL_INT", 86 }, { "SET_POSITION_TARGET_LOCAL_NED", 84 }, { "SIM_STATE", 108 }, { "SMART_BATTERY_INFO", 370 }, { "STATUSTEXT", 253 }, { "STORAGE_INFORMATION", 261 }, { "SUPPORTED_TUNES", 401 }, { "SYSTEM_TIME", 2 }, { "SYS_STATUS", 1 }, { "TERRAIN_CHECK", 135 }, { "TERRAIN_DATA", 134 }, { "TERRAIN_REPORT", 136 }, { "TERRAIN_REQUEST", 133 }, { "TIMESYNC", 111 }, { "TIME_ESTIMATE_TO_TARGET", 380 }, { "TRAJECTORY_REPRESENTATION_BEZIER", 333 }, { "TRAJECTORY_REPRESENTATION_WAYPOINTS", 332 }, { "TUNNEL", 385 }, { "UAVCAN_NODE_INFO", 311 }, { "UAVCAN_NODE_STATUS", 310 }, { "UTM_GLOBAL_POSITION", 340 }, { "V2_EXTENSION", 248 }, { "VFR_HUD", 74 }, { "VIBRATION", 241 }, { "VICON_POSITION_ESTIMATE", 104 }, { "VIDEO_STREAM_INFORMATION", 269 }, { "VIDEO_STREAM_STATUS", 270 }, { "VISION_POSITION_ESTIMATE", 102 }, { "VISION_SPEED_ESTIMATE", 103 }, { "WHEEL_DISTANCE", 9000 }, { "WIFI_CONFIG_AP", 299 }, { "WINCH_STATUS", 9005 }, { "WIND_COV", 231 }} # if MAVLINK_COMMAND_24BIT # include "../mavlink_get_info.h" # endif diff --git a/common/mavlink.h b/common/mavlink.h index 5f5958244..f5196a343 100644 --- a/common/mavlink.h +++ b/common/mavlink.h @@ -6,7 +6,7 @@ #ifndef MAVLINK_H #define MAVLINK_H -#define MAVLINK_PRIMARY_XML_IDX 1 +#define MAVLINK_PRIMARY_XML_HASH 2322469066585003424 #ifndef MAVLINK_STX #define MAVLINK_STX 253 diff --git a/common/mavlink_msg_actuator_control_target.h b/common/mavlink_msg_actuator_control_target.h index 31e307cb5..c03a6a7c7 100644 --- a/common/mavlink_msg_actuator_control_target.h +++ b/common/mavlink_msg_actuator_control_target.h @@ -65,7 +65,7 @@ static inline uint16_t mavlink_msg_actuator_control_target_pack(uint8_t system_i mavlink_actuator_control_target_t packet; packet.time_usec = time_usec; packet.group_mlx = group_mlx; - mav_array_memcpy(packet.controls, controls, sizeof(float)*8); + mav_array_assign_float(packet.controls, controls, 8); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN); #endif @@ -73,6 +73,43 @@ static inline uint16_t mavlink_msg_actuator_control_target_pack(uint8_t system_i return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_MIN_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_CRC); } +/** + * @brief Pack a actuator_control_target message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param group_mlx Actuator group. The "_mlx" indicates this is a multi-instance message and a MAVLink parser should use this field to difference between instances. + * @param controls Actuator controls. Normed to -1..+1 where 0 is neutral position. Throttle for single rotation direction motors is 0..1, negative range for reverse direction. Standard mapping for attitude controls (group 0): (index 0-7): roll, pitch, yaw, throttle, flaps, spoilers, airbrakes, landing gear. Load a pass-through mixer to repurpose them as generic outputs. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_actuator_control_target_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, uint8_t group_mlx, const float *controls) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint8_t(buf, 40, group_mlx); + _mav_put_float_array(buf, 8, controls, 8); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN); +#else + mavlink_actuator_control_target_t packet; + packet.time_usec = time_usec; + packet.group_mlx = group_mlx; + mav_array_memcpy(packet.controls, controls, sizeof(float)*8); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_MIN_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_MIN_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN); +#endif +} + /** * @brief Pack a actuator_control_target message on a channel * @param system_id ID of this system @@ -98,7 +135,7 @@ static inline uint16_t mavlink_msg_actuator_control_target_pack_chan(uint8_t sys mavlink_actuator_control_target_t packet; packet.time_usec = time_usec; packet.group_mlx = group_mlx; - mav_array_memcpy(packet.controls, controls, sizeof(float)*8); + mav_array_assign_float(packet.controls, controls, 8); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN); #endif @@ -133,6 +170,20 @@ static inline uint16_t mavlink_msg_actuator_control_target_encode_chan(uint8_t s return mavlink_msg_actuator_control_target_pack_chan(system_id, component_id, chan, msg, actuator_control_target->time_usec, actuator_control_target->group_mlx, actuator_control_target->controls); } +/** + * @brief Encode a actuator_control_target struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param actuator_control_target C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_actuator_control_target_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_actuator_control_target_t* actuator_control_target) +{ + return mavlink_msg_actuator_control_target_pack_status(system_id, component_id, _status, msg, actuator_control_target->time_usec, actuator_control_target->group_mlx, actuator_control_target->controls); +} + /** * @brief Send a actuator_control_target message * @param chan MAVLink channel to send the message @@ -155,7 +206,7 @@ static inline void mavlink_msg_actuator_control_target_send(mavlink_channel_t ch mavlink_actuator_control_target_t packet; packet.time_usec = time_usec; packet.group_mlx = group_mlx; - mav_array_memcpy(packet.controls, controls, sizeof(float)*8); + mav_array_assign_float(packet.controls, controls, 8); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET, (const char *)&packet, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_MIN_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_CRC); #endif } @@ -176,7 +227,7 @@ static inline void mavlink_msg_actuator_control_target_send_struct(mavlink_chann #if MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -194,7 +245,7 @@ static inline void mavlink_msg_actuator_control_target_send_buf(mavlink_message_ mavlink_actuator_control_target_t *packet = (mavlink_actuator_control_target_t *)msgbuf; packet->time_usec = time_usec; packet->group_mlx = group_mlx; - mav_array_memcpy(packet->controls, controls, sizeof(float)*8); + mav_array_assign_float(packet->controls, controls, 8); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET, (const char *)packet, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_MIN_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_CRC); #endif } diff --git a/common/mavlink_msg_actuator_output_status.h b/common/mavlink_msg_actuator_output_status.h index 52ee04df7..413235dc5 100644 --- a/common/mavlink_msg_actuator_output_status.h +++ b/common/mavlink_msg_actuator_output_status.h @@ -65,7 +65,7 @@ static inline uint16_t mavlink_msg_actuator_output_status_pack(uint8_t system_id mavlink_actuator_output_status_t packet; packet.time_usec = time_usec; packet.active = active; - mav_array_memcpy(packet.actuator, actuator, sizeof(float)*32); + mav_array_assign_float(packet.actuator, actuator, 32); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ACTUATOR_OUTPUT_STATUS_LEN); #endif @@ -73,6 +73,43 @@ static inline uint16_t mavlink_msg_actuator_output_status_pack(uint8_t system_id return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ACTUATOR_OUTPUT_STATUS_MIN_LEN, MAVLINK_MSG_ID_ACTUATOR_OUTPUT_STATUS_LEN, MAVLINK_MSG_ID_ACTUATOR_OUTPUT_STATUS_CRC); } +/** + * @brief Pack a actuator_output_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (since system boot). + * @param active Active outputs + * @param actuator Servo / motor output array values. Zero values indicate unused channels. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_actuator_output_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, uint32_t active, const float *actuator) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_ACTUATOR_OUTPUT_STATUS_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint32_t(buf, 8, active); + _mav_put_float_array(buf, 12, actuator, 32); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ACTUATOR_OUTPUT_STATUS_LEN); +#else + mavlink_actuator_output_status_t packet; + packet.time_usec = time_usec; + packet.active = active; + mav_array_memcpy(packet.actuator, actuator, sizeof(float)*32); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ACTUATOR_OUTPUT_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_ACTUATOR_OUTPUT_STATUS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ACTUATOR_OUTPUT_STATUS_MIN_LEN, MAVLINK_MSG_ID_ACTUATOR_OUTPUT_STATUS_LEN, MAVLINK_MSG_ID_ACTUATOR_OUTPUT_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ACTUATOR_OUTPUT_STATUS_MIN_LEN, MAVLINK_MSG_ID_ACTUATOR_OUTPUT_STATUS_LEN); +#endif +} + /** * @brief Pack a actuator_output_status message on a channel * @param system_id ID of this system @@ -98,7 +135,7 @@ static inline uint16_t mavlink_msg_actuator_output_status_pack_chan(uint8_t syst mavlink_actuator_output_status_t packet; packet.time_usec = time_usec; packet.active = active; - mav_array_memcpy(packet.actuator, actuator, sizeof(float)*32); + mav_array_assign_float(packet.actuator, actuator, 32); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ACTUATOR_OUTPUT_STATUS_LEN); #endif @@ -133,6 +170,20 @@ static inline uint16_t mavlink_msg_actuator_output_status_encode_chan(uint8_t sy return mavlink_msg_actuator_output_status_pack_chan(system_id, component_id, chan, msg, actuator_output_status->time_usec, actuator_output_status->active, actuator_output_status->actuator); } +/** + * @brief Encode a actuator_output_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param actuator_output_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_actuator_output_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_actuator_output_status_t* actuator_output_status) +{ + return mavlink_msg_actuator_output_status_pack_status(system_id, component_id, _status, msg, actuator_output_status->time_usec, actuator_output_status->active, actuator_output_status->actuator); +} + /** * @brief Send a actuator_output_status message * @param chan MAVLink channel to send the message @@ -155,7 +206,7 @@ static inline void mavlink_msg_actuator_output_status_send(mavlink_channel_t cha mavlink_actuator_output_status_t packet; packet.time_usec = time_usec; packet.active = active; - mav_array_memcpy(packet.actuator, actuator, sizeof(float)*32); + mav_array_assign_float(packet.actuator, actuator, 32); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ACTUATOR_OUTPUT_STATUS, (const char *)&packet, MAVLINK_MSG_ID_ACTUATOR_OUTPUT_STATUS_MIN_LEN, MAVLINK_MSG_ID_ACTUATOR_OUTPUT_STATUS_LEN, MAVLINK_MSG_ID_ACTUATOR_OUTPUT_STATUS_CRC); #endif } @@ -176,7 +227,7 @@ static inline void mavlink_msg_actuator_output_status_send_struct(mavlink_channe #if MAVLINK_MSG_ID_ACTUATOR_OUTPUT_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -194,7 +245,7 @@ static inline void mavlink_msg_actuator_output_status_send_buf(mavlink_message_t mavlink_actuator_output_status_t *packet = (mavlink_actuator_output_status_t *)msgbuf; packet->time_usec = time_usec; packet->active = active; - mav_array_memcpy(packet->actuator, actuator, sizeof(float)*32); + mav_array_assign_float(packet->actuator, actuator, 32); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ACTUATOR_OUTPUT_STATUS, (const char *)packet, MAVLINK_MSG_ID_ACTUATOR_OUTPUT_STATUS_MIN_LEN, MAVLINK_MSG_ID_ACTUATOR_OUTPUT_STATUS_LEN, MAVLINK_MSG_ID_ACTUATOR_OUTPUT_STATUS_CRC); #endif } diff --git a/common/mavlink_msg_adsb_vehicle.h b/common/mavlink_msg_adsb_vehicle.h index 7296c22aa..fcdb9257e 100644 --- a/common/mavlink_msg_adsb_vehicle.h +++ b/common/mavlink_msg_adsb_vehicle.h @@ -13,7 +13,7 @@ typedef struct __mavlink_adsb_vehicle_t { uint16_t hor_velocity; /*< [cm/s] The horizontal velocity*/ int16_t ver_velocity; /*< [cm/s] The vertical velocity. Positive is up*/ uint16_t flags; /*< Bitmap to indicate various statuses including valid data fields*/ - uint16_t squawk; /*< Squawk code*/ + uint16_t squawk; /*< Squawk code. Note that the code is in decimal: e.g. 7700 (general emergency) is encoded as binary 0b0001_1110_0001_0100, not(!) as 0b0000_111_111_000_000*/ uint8_t altitude_type; /*< ADSB altitude type.*/ char callsign[9]; /*< The callsign, 8+null*/ uint8_t emitter_type; /*< ADSB emitter type.*/ @@ -89,7 +89,7 @@ typedef struct __mavlink_adsb_vehicle_t { * @param emitter_type ADSB emitter type. * @param tslc [s] Time since last communication in seconds * @param flags Bitmap to indicate various statuses including valid data fields - * @param squawk Squawk code + * @param squawk Squawk code. Note that the code is in decimal: e.g. 7700 (general emergency) is encoded as binary 0b0001_1110_0001_0100, not(!) as 0b0000_111_111_000_000 * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_adsb_vehicle_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, @@ -125,7 +125,7 @@ static inline uint16_t mavlink_msg_adsb_vehicle_pack(uint8_t system_id, uint8_t packet.altitude_type = altitude_type; packet.emitter_type = emitter_type; packet.tslc = tslc; - mav_array_memcpy(packet.callsign, callsign, sizeof(char)*9); + mav_array_assign_char(packet.callsign, callsign, 9); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN); #endif @@ -133,6 +133,73 @@ static inline uint16_t mavlink_msg_adsb_vehicle_pack(uint8_t system_id, uint8_t return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ADSB_VEHICLE_MIN_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_CRC); } +/** + * @brief Pack a adsb_vehicle message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param ICAO_address ICAO address + * @param lat [degE7] Latitude + * @param lon [degE7] Longitude + * @param altitude_type ADSB altitude type. + * @param altitude [mm] Altitude(ASL) + * @param heading [cdeg] Course over ground + * @param hor_velocity [cm/s] The horizontal velocity + * @param ver_velocity [cm/s] The vertical velocity. Positive is up + * @param callsign The callsign, 8+null + * @param emitter_type ADSB emitter type. + * @param tslc [s] Time since last communication in seconds + * @param flags Bitmap to indicate various statuses including valid data fields + * @param squawk Squawk code. Note that the code is in decimal: e.g. 7700 (general emergency) is encoded as binary 0b0001_1110_0001_0100, not(!) as 0b0000_111_111_000_000 + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_adsb_vehicle_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t ICAO_address, int32_t lat, int32_t lon, uint8_t altitude_type, int32_t altitude, uint16_t heading, uint16_t hor_velocity, int16_t ver_velocity, const char *callsign, uint8_t emitter_type, uint8_t tslc, uint16_t flags, uint16_t squawk) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_ADSB_VEHICLE_LEN]; + _mav_put_uint32_t(buf, 0, ICAO_address); + _mav_put_int32_t(buf, 4, lat); + _mav_put_int32_t(buf, 8, lon); + _mav_put_int32_t(buf, 12, altitude); + _mav_put_uint16_t(buf, 16, heading); + _mav_put_uint16_t(buf, 18, hor_velocity); + _mav_put_int16_t(buf, 20, ver_velocity); + _mav_put_uint16_t(buf, 22, flags); + _mav_put_uint16_t(buf, 24, squawk); + _mav_put_uint8_t(buf, 26, altitude_type); + _mav_put_uint8_t(buf, 36, emitter_type); + _mav_put_uint8_t(buf, 37, tslc); + _mav_put_char_array(buf, 27, callsign, 9); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN); +#else + mavlink_adsb_vehicle_t packet; + packet.ICAO_address = ICAO_address; + packet.lat = lat; + packet.lon = lon; + packet.altitude = altitude; + packet.heading = heading; + packet.hor_velocity = hor_velocity; + packet.ver_velocity = ver_velocity; + packet.flags = flags; + packet.squawk = squawk; + packet.altitude_type = altitude_type; + packet.emitter_type = emitter_type; + packet.tslc = tslc; + mav_array_memcpy(packet.callsign, callsign, sizeof(char)*9); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_ADSB_VEHICLE; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ADSB_VEHICLE_MIN_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ADSB_VEHICLE_MIN_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN); +#endif +} + /** * @brief Pack a adsb_vehicle message on a channel * @param system_id ID of this system @@ -151,7 +218,7 @@ static inline uint16_t mavlink_msg_adsb_vehicle_pack(uint8_t system_id, uint8_t * @param emitter_type ADSB emitter type. * @param tslc [s] Time since last communication in seconds * @param flags Bitmap to indicate various statuses including valid data fields - * @param squawk Squawk code + * @param squawk Squawk code. Note that the code is in decimal: e.g. 7700 (general emergency) is encoded as binary 0b0001_1110_0001_0100, not(!) as 0b0000_111_111_000_000 * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_adsb_vehicle_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, @@ -188,7 +255,7 @@ static inline uint16_t mavlink_msg_adsb_vehicle_pack_chan(uint8_t system_id, uin packet.altitude_type = altitude_type; packet.emitter_type = emitter_type; packet.tslc = tslc; - mav_array_memcpy(packet.callsign, callsign, sizeof(char)*9); + mav_array_assign_char(packet.callsign, callsign, 9); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN); #endif @@ -223,6 +290,20 @@ static inline uint16_t mavlink_msg_adsb_vehicle_encode_chan(uint8_t system_id, u return mavlink_msg_adsb_vehicle_pack_chan(system_id, component_id, chan, msg, adsb_vehicle->ICAO_address, adsb_vehicle->lat, adsb_vehicle->lon, adsb_vehicle->altitude_type, adsb_vehicle->altitude, adsb_vehicle->heading, adsb_vehicle->hor_velocity, adsb_vehicle->ver_velocity, adsb_vehicle->callsign, adsb_vehicle->emitter_type, adsb_vehicle->tslc, adsb_vehicle->flags, adsb_vehicle->squawk); } +/** + * @brief Encode a adsb_vehicle struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param adsb_vehicle C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_adsb_vehicle_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_adsb_vehicle_t* adsb_vehicle) +{ + return mavlink_msg_adsb_vehicle_pack_status(system_id, component_id, _status, msg, adsb_vehicle->ICAO_address, adsb_vehicle->lat, adsb_vehicle->lon, adsb_vehicle->altitude_type, adsb_vehicle->altitude, adsb_vehicle->heading, adsb_vehicle->hor_velocity, adsb_vehicle->ver_velocity, adsb_vehicle->callsign, adsb_vehicle->emitter_type, adsb_vehicle->tslc, adsb_vehicle->flags, adsb_vehicle->squawk); +} + /** * @brief Send a adsb_vehicle message * @param chan MAVLink channel to send the message @@ -239,7 +320,7 @@ static inline uint16_t mavlink_msg_adsb_vehicle_encode_chan(uint8_t system_id, u * @param emitter_type ADSB emitter type. * @param tslc [s] Time since last communication in seconds * @param flags Bitmap to indicate various statuses including valid data fields - * @param squawk Squawk code + * @param squawk Squawk code. Note that the code is in decimal: e.g. 7700 (general emergency) is encoded as binary 0b0001_1110_0001_0100, not(!) as 0b0000_111_111_000_000 */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS @@ -275,7 +356,7 @@ static inline void mavlink_msg_adsb_vehicle_send(mavlink_channel_t chan, uint32_ packet.altitude_type = altitude_type; packet.emitter_type = emitter_type; packet.tslc = tslc; - mav_array_memcpy(packet.callsign, callsign, sizeof(char)*9); + mav_array_assign_char(packet.callsign, callsign, 9); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ADSB_VEHICLE, (const char *)&packet, MAVLINK_MSG_ID_ADSB_VEHICLE_MIN_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_CRC); #endif } @@ -296,7 +377,7 @@ static inline void mavlink_msg_adsb_vehicle_send_struct(mavlink_channel_t chan, #if MAVLINK_MSG_ID_ADSB_VEHICLE_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -334,7 +415,7 @@ static inline void mavlink_msg_adsb_vehicle_send_buf(mavlink_message_t *msgbuf, packet->altitude_type = altitude_type; packet->emitter_type = emitter_type; packet->tslc = tslc; - mav_array_memcpy(packet->callsign, callsign, sizeof(char)*9); + mav_array_assign_char(packet->callsign, callsign, 9); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ADSB_VEHICLE, (const char *)packet, MAVLINK_MSG_ID_ADSB_VEHICLE_MIN_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_CRC); #endif } @@ -468,7 +549,7 @@ static inline uint16_t mavlink_msg_adsb_vehicle_get_flags(const mavlink_message_ /** * @brief Get field squawk from adsb_vehicle message * - * @return Squawk code + * @return Squawk code. Note that the code is in decimal: e.g. 7700 (general emergency) is encoded as binary 0b0001_1110_0001_0100, not(!) as 0b0000_111_111_000_000 */ static inline uint16_t mavlink_msg_adsb_vehicle_get_squawk(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_ais_vessel.h b/common/mavlink_msg_ais_vessel.h index e97fe42bc..1fd7e6091 100644 --- a/common/mavlink_msg_ais_vessel.h +++ b/common/mavlink_msg_ais_vessel.h @@ -15,7 +15,7 @@ typedef struct __mavlink_ais_vessel_t { uint16_t dimension_stern; /*< [m] Distance from lat/lon location to stern*/ uint16_t tslc; /*< [s] Time since last communication in seconds*/ uint16_t flags; /*< Bitmask to indicate various statuses including valid data fields*/ - int8_t turn_rate; /*< [cdeg/s] Turn rate*/ + int8_t turn_rate; /*< [ddeg/s] Turn rate, 0.1 degrees per second*/ uint8_t navigational_status; /*< Navigational status*/ uint8_t type; /*< Type of vessels*/ uint8_t dimension_port; /*< [m] Distance from lat/lon location to port side*/ @@ -96,7 +96,7 @@ typedef struct __mavlink_ais_vessel_t { * @param COG [cdeg] Course over ground * @param heading [cdeg] True heading * @param velocity [cm/s] Speed over ground - * @param turn_rate [cdeg/s] Turn rate + * @param turn_rate [ddeg/s] Turn rate, 0.1 degrees per second * @param navigational_status Navigational status * @param type Type of vessels * @param dimension_bow [m] Distance from lat/lon location to bow @@ -112,6 +112,81 @@ typedef struct __mavlink_ais_vessel_t { static inline uint16_t mavlink_msg_ais_vessel_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint32_t MMSI, int32_t lat, int32_t lon, uint16_t COG, uint16_t heading, uint16_t velocity, int8_t turn_rate, uint8_t navigational_status, uint8_t type, uint16_t dimension_bow, uint16_t dimension_stern, uint8_t dimension_port, uint8_t dimension_starboard, const char *callsign, const char *name, uint16_t tslc, uint16_t flags) { +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_AIS_VESSEL_LEN]; + _mav_put_uint32_t(buf, 0, MMSI); + _mav_put_int32_t(buf, 4, lat); + _mav_put_int32_t(buf, 8, lon); + _mav_put_uint16_t(buf, 12, COG); + _mav_put_uint16_t(buf, 14, heading); + _mav_put_uint16_t(buf, 16, velocity); + _mav_put_uint16_t(buf, 18, dimension_bow); + _mav_put_uint16_t(buf, 20, dimension_stern); + _mav_put_uint16_t(buf, 22, tslc); + _mav_put_uint16_t(buf, 24, flags); + _mav_put_int8_t(buf, 26, turn_rate); + _mav_put_uint8_t(buf, 27, navigational_status); + _mav_put_uint8_t(buf, 28, type); + _mav_put_uint8_t(buf, 29, dimension_port); + _mav_put_uint8_t(buf, 30, dimension_starboard); + _mav_put_char_array(buf, 31, callsign, 7); + _mav_put_char_array(buf, 38, name, 20); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AIS_VESSEL_LEN); +#else + mavlink_ais_vessel_t packet; + packet.MMSI = MMSI; + packet.lat = lat; + packet.lon = lon; + packet.COG = COG; + packet.heading = heading; + packet.velocity = velocity; + packet.dimension_bow = dimension_bow; + packet.dimension_stern = dimension_stern; + packet.tslc = tslc; + packet.flags = flags; + packet.turn_rate = turn_rate; + packet.navigational_status = navigational_status; + packet.type = type; + packet.dimension_port = dimension_port; + packet.dimension_starboard = dimension_starboard; + mav_array_assign_char(packet.callsign, callsign, 7); + mav_array_assign_char(packet.name, name, 20); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AIS_VESSEL_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_AIS_VESSEL; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AIS_VESSEL_MIN_LEN, MAVLINK_MSG_ID_AIS_VESSEL_LEN, MAVLINK_MSG_ID_AIS_VESSEL_CRC); +} + +/** + * @brief Pack a ais_vessel message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param MMSI Mobile Marine Service Identifier, 9 decimal digits + * @param lat [degE7] Latitude + * @param lon [degE7] Longitude + * @param COG [cdeg] Course over ground + * @param heading [cdeg] True heading + * @param velocity [cm/s] Speed over ground + * @param turn_rate [ddeg/s] Turn rate, 0.1 degrees per second + * @param navigational_status Navigational status + * @param type Type of vessels + * @param dimension_bow [m] Distance from lat/lon location to bow + * @param dimension_stern [m] Distance from lat/lon location to stern + * @param dimension_port [m] Distance from lat/lon location to port side + * @param dimension_starboard [m] Distance from lat/lon location to starboard side + * @param callsign The vessel callsign + * @param name The vessel name + * @param tslc [s] Time since last communication in seconds + * @param flags Bitmask to indicate various statuses including valid data fields + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_ais_vessel_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t MMSI, int32_t lat, int32_t lon, uint16_t COG, uint16_t heading, uint16_t velocity, int8_t turn_rate, uint8_t navigational_status, uint8_t type, uint16_t dimension_bow, uint16_t dimension_stern, uint8_t dimension_port, uint8_t dimension_starboard, const char *callsign, const char *name, uint16_t tslc, uint16_t flags) +{ #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_AIS_VESSEL_LEN]; _mav_put_uint32_t(buf, 0, MMSI); @@ -155,7 +230,11 @@ static inline uint16_t mavlink_msg_ais_vessel_pack(uint8_t system_id, uint8_t co #endif msg->msgid = MAVLINK_MSG_ID_AIS_VESSEL; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AIS_VESSEL_MIN_LEN, MAVLINK_MSG_ID_AIS_VESSEL_LEN, MAVLINK_MSG_ID_AIS_VESSEL_CRC); +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_AIS_VESSEL_MIN_LEN, MAVLINK_MSG_ID_AIS_VESSEL_LEN, MAVLINK_MSG_ID_AIS_VESSEL_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_AIS_VESSEL_MIN_LEN, MAVLINK_MSG_ID_AIS_VESSEL_LEN); +#endif } /** @@ -170,7 +249,7 @@ static inline uint16_t mavlink_msg_ais_vessel_pack(uint8_t system_id, uint8_t co * @param COG [cdeg] Course over ground * @param heading [cdeg] True heading * @param velocity [cm/s] Speed over ground - * @param turn_rate [cdeg/s] Turn rate + * @param turn_rate [ddeg/s] Turn rate, 0.1 degrees per second * @param navigational_status Navigational status * @param type Type of vessels * @param dimension_bow [m] Distance from lat/lon location to bow @@ -224,8 +303,8 @@ static inline uint16_t mavlink_msg_ais_vessel_pack_chan(uint8_t system_id, uint8 packet.type = type; packet.dimension_port = dimension_port; packet.dimension_starboard = dimension_starboard; - mav_array_memcpy(packet.callsign, callsign, sizeof(char)*7); - mav_array_memcpy(packet.name, name, sizeof(char)*20); + mav_array_assign_char(packet.callsign, callsign, 7); + mav_array_assign_char(packet.name, name, 20); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AIS_VESSEL_LEN); #endif @@ -260,6 +339,20 @@ static inline uint16_t mavlink_msg_ais_vessel_encode_chan(uint8_t system_id, uin return mavlink_msg_ais_vessel_pack_chan(system_id, component_id, chan, msg, ais_vessel->MMSI, ais_vessel->lat, ais_vessel->lon, ais_vessel->COG, ais_vessel->heading, ais_vessel->velocity, ais_vessel->turn_rate, ais_vessel->navigational_status, ais_vessel->type, ais_vessel->dimension_bow, ais_vessel->dimension_stern, ais_vessel->dimension_port, ais_vessel->dimension_starboard, ais_vessel->callsign, ais_vessel->name, ais_vessel->tslc, ais_vessel->flags); } +/** + * @brief Encode a ais_vessel struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param ais_vessel C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_ais_vessel_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_ais_vessel_t* ais_vessel) +{ + return mavlink_msg_ais_vessel_pack_status(system_id, component_id, _status, msg, ais_vessel->MMSI, ais_vessel->lat, ais_vessel->lon, ais_vessel->COG, ais_vessel->heading, ais_vessel->velocity, ais_vessel->turn_rate, ais_vessel->navigational_status, ais_vessel->type, ais_vessel->dimension_bow, ais_vessel->dimension_stern, ais_vessel->dimension_port, ais_vessel->dimension_starboard, ais_vessel->callsign, ais_vessel->name, ais_vessel->tslc, ais_vessel->flags); +} + /** * @brief Send a ais_vessel message * @param chan MAVLink channel to send the message @@ -270,7 +363,7 @@ static inline uint16_t mavlink_msg_ais_vessel_encode_chan(uint8_t system_id, uin * @param COG [cdeg] Course over ground * @param heading [cdeg] True heading * @param velocity [cm/s] Speed over ground - * @param turn_rate [cdeg/s] Turn rate + * @param turn_rate [ddeg/s] Turn rate, 0.1 degrees per second * @param navigational_status Navigational status * @param type Type of vessels * @param dimension_bow [m] Distance from lat/lon location to bow @@ -323,8 +416,8 @@ static inline void mavlink_msg_ais_vessel_send(mavlink_channel_t chan, uint32_t packet.type = type; packet.dimension_port = dimension_port; packet.dimension_starboard = dimension_starboard; - mav_array_memcpy(packet.callsign, callsign, sizeof(char)*7); - mav_array_memcpy(packet.name, name, sizeof(char)*20); + mav_array_assign_char(packet.callsign, callsign, 7); + mav_array_assign_char(packet.name, name, 20); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIS_VESSEL, (const char *)&packet, MAVLINK_MSG_ID_AIS_VESSEL_MIN_LEN, MAVLINK_MSG_ID_AIS_VESSEL_LEN, MAVLINK_MSG_ID_AIS_VESSEL_CRC); #endif } @@ -345,7 +438,7 @@ static inline void mavlink_msg_ais_vessel_send_struct(mavlink_channel_t chan, co #if MAVLINK_MSG_ID_AIS_VESSEL_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -390,8 +483,8 @@ static inline void mavlink_msg_ais_vessel_send_buf(mavlink_message_t *msgbuf, ma packet->type = type; packet->dimension_port = dimension_port; packet->dimension_starboard = dimension_starboard; - mav_array_memcpy(packet->callsign, callsign, sizeof(char)*7); - mav_array_memcpy(packet->name, name, sizeof(char)*20); + mav_array_assign_char(packet->callsign, callsign, 7); + mav_array_assign_char(packet->name, name, 20); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIS_VESSEL, (const char *)packet, MAVLINK_MSG_ID_AIS_VESSEL_MIN_LEN, MAVLINK_MSG_ID_AIS_VESSEL_LEN, MAVLINK_MSG_ID_AIS_VESSEL_CRC); #endif } @@ -465,7 +558,7 @@ static inline uint16_t mavlink_msg_ais_vessel_get_velocity(const mavlink_message /** * @brief Get field turn_rate from ais_vessel message * - * @return [cdeg/s] Turn rate + * @return [ddeg/s] Turn rate, 0.1 degrees per second */ static inline int8_t mavlink_msg_ais_vessel_get_turn_rate(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_altitude.h b/common/mavlink_msg_altitude.h index 1424f0ab9..8e44e6c7a 100644 --- a/common/mavlink_msg_altitude.h +++ b/common/mavlink_msg_altitude.h @@ -99,6 +99,57 @@ static inline uint16_t mavlink_msg_altitude_pack(uint8_t system_id, uint8_t comp return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ALTITUDE_MIN_LEN, MAVLINK_MSG_ID_ALTITUDE_LEN, MAVLINK_MSG_ID_ALTITUDE_CRC); } +/** + * @brief Pack a altitude message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param altitude_monotonic [m] This altitude measure is initialized on system boot and monotonic (it is never reset, but represents the local altitude change). The only guarantee on this field is that it will never be reset and is consistent within a flight. The recommended value for this field is the uncorrected barometric altitude at boot time. This altitude will also drift and vary between flights. + * @param altitude_amsl [m] This altitude measure is strictly above mean sea level and might be non-monotonic (it might reset on events like GPS lock or when a new QNH value is set). It should be the altitude to which global altitude waypoints are compared to. Note that it is *not* the GPS altitude, however, most GPS modules already output MSL by default and not the WGS84 altitude. + * @param altitude_local [m] This is the local altitude in the local coordinate frame. It is not the altitude above home, but in reference to the coordinate origin (0, 0, 0). It is up-positive. + * @param altitude_relative [m] This is the altitude above the home position. It resets on each change of the current home position. + * @param altitude_terrain [m] This is the altitude above terrain. It might be fed by a terrain database or an altimeter. Values smaller than -1000 should be interpreted as unknown. + * @param bottom_clearance [m] This is not the altitude, but the clear space below the system according to the fused clearance estimate. It generally should max out at the maximum range of e.g. the laser altimeter. It is generally a moving target. A negative value indicates no measurement available. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_altitude_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, float altitude_monotonic, float altitude_amsl, float altitude_local, float altitude_relative, float altitude_terrain, float bottom_clearance) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_ALTITUDE_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, altitude_monotonic); + _mav_put_float(buf, 12, altitude_amsl); + _mav_put_float(buf, 16, altitude_local); + _mav_put_float(buf, 20, altitude_relative); + _mav_put_float(buf, 24, altitude_terrain); + _mav_put_float(buf, 28, bottom_clearance); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ALTITUDE_LEN); +#else + mavlink_altitude_t packet; + packet.time_usec = time_usec; + packet.altitude_monotonic = altitude_monotonic; + packet.altitude_amsl = altitude_amsl; + packet.altitude_local = altitude_local; + packet.altitude_relative = altitude_relative; + packet.altitude_terrain = altitude_terrain; + packet.bottom_clearance = bottom_clearance; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ALTITUDE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_ALTITUDE; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ALTITUDE_MIN_LEN, MAVLINK_MSG_ID_ALTITUDE_LEN, MAVLINK_MSG_ID_ALTITUDE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ALTITUDE_MIN_LEN, MAVLINK_MSG_ID_ALTITUDE_LEN); +#endif +} + /** * @brief Pack a altitude message on a channel * @param system_id ID of this system @@ -173,6 +224,20 @@ static inline uint16_t mavlink_msg_altitude_encode_chan(uint8_t system_id, uint8 return mavlink_msg_altitude_pack_chan(system_id, component_id, chan, msg, altitude->time_usec, altitude->altitude_monotonic, altitude->altitude_amsl, altitude->altitude_local, altitude->altitude_relative, altitude->altitude_terrain, altitude->bottom_clearance); } +/** + * @brief Encode a altitude struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param altitude C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_altitude_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_altitude_t* altitude) +{ + return mavlink_msg_altitude_pack_status(system_id, component_id, _status, msg, altitude->time_usec, altitude->altitude_monotonic, altitude->altitude_amsl, altitude->altitude_local, altitude->altitude_relative, altitude->altitude_terrain, altitude->bottom_clearance); +} + /** * @brief Send a altitude message * @param chan MAVLink channel to send the message @@ -230,7 +295,7 @@ static inline void mavlink_msg_altitude_send_struct(mavlink_channel_t chan, cons #if MAVLINK_MSG_ID_ALTITUDE_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_att_pos_mocap.h b/common/mavlink_msg_att_pos_mocap.h index 2bf0bfd11..3d0ea12bf 100644 --- a/common/mavlink_msg_att_pos_mocap.h +++ b/common/mavlink_msg_att_pos_mocap.h @@ -68,6 +68,48 @@ typedef struct __mavlink_att_pos_mocap_t { static inline uint16_t mavlink_msg_att_pos_mocap_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint64_t time_usec, const float *q, float x, float y, float z, const float *covariance) { +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 24, x); + _mav_put_float(buf, 28, y); + _mav_put_float(buf, 32, z); + _mav_put_float_array(buf, 8, q, 4); + _mav_put_float_array(buf, 36, covariance, 21); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN); +#else + mavlink_att_pos_mocap_t packet; + packet.time_usec = time_usec; + packet.x = x; + packet.y = y; + packet.z = z; + mav_array_assign_float(packet.q, q, 4); + mav_array_assign_float(packet.covariance, covariance, 21); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_ATT_POS_MOCAP; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ATT_POS_MOCAP_MIN_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_CRC); +} + +/** + * @brief Pack a att_pos_mocap message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param q Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) + * @param x [m] X position (NED) + * @param y [m] Y position (NED) + * @param z [m] Z position (NED) + * @param covariance Row-major representation of a pose 6x6 cross-covariance matrix upper right triangle (states: x, y, z, roll, pitch, yaw; first six entries are the first ROW, next five entries are the second ROW, etc.). If unknown, assign NaN value to first element in the array. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_att_pos_mocap_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, const float *q, float x, float y, float z, const float *covariance) +{ #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN]; _mav_put_uint64_t(buf, 0, time_usec); @@ -89,7 +131,11 @@ static inline uint16_t mavlink_msg_att_pos_mocap_pack(uint8_t system_id, uint8_t #endif msg->msgid = MAVLINK_MSG_ID_ATT_POS_MOCAP; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ATT_POS_MOCAP_MIN_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_CRC); +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ATT_POS_MOCAP_MIN_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ATT_POS_MOCAP_MIN_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN); +#endif } /** @@ -125,8 +171,8 @@ static inline uint16_t mavlink_msg_att_pos_mocap_pack_chan(uint8_t system_id, ui packet.x = x; packet.y = y; packet.z = z; - mav_array_memcpy(packet.q, q, sizeof(float)*4); - mav_array_memcpy(packet.covariance, covariance, sizeof(float)*21); + mav_array_assign_float(packet.q, q, 4); + mav_array_assign_float(packet.covariance, covariance, 21); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN); #endif @@ -161,6 +207,20 @@ static inline uint16_t mavlink_msg_att_pos_mocap_encode_chan(uint8_t system_id, return mavlink_msg_att_pos_mocap_pack_chan(system_id, component_id, chan, msg, att_pos_mocap->time_usec, att_pos_mocap->q, att_pos_mocap->x, att_pos_mocap->y, att_pos_mocap->z, att_pos_mocap->covariance); } +/** + * @brief Encode a att_pos_mocap struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param att_pos_mocap C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_att_pos_mocap_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_att_pos_mocap_t* att_pos_mocap) +{ + return mavlink_msg_att_pos_mocap_pack_status(system_id, component_id, _status, msg, att_pos_mocap->time_usec, att_pos_mocap->q, att_pos_mocap->x, att_pos_mocap->y, att_pos_mocap->z, att_pos_mocap->covariance); +} + /** * @brief Send a att_pos_mocap message * @param chan MAVLink channel to send the message @@ -191,8 +251,8 @@ static inline void mavlink_msg_att_pos_mocap_send(mavlink_channel_t chan, uint64 packet.x = x; packet.y = y; packet.z = z; - mav_array_memcpy(packet.q, q, sizeof(float)*4); - mav_array_memcpy(packet.covariance, covariance, sizeof(float)*21); + mav_array_assign_float(packet.q, q, 4); + mav_array_assign_float(packet.covariance, covariance, 21); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATT_POS_MOCAP, (const char *)&packet, MAVLINK_MSG_ID_ATT_POS_MOCAP_MIN_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_CRC); #endif } @@ -213,7 +273,7 @@ static inline void mavlink_msg_att_pos_mocap_send_struct(mavlink_channel_t chan, #if MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -236,8 +296,8 @@ static inline void mavlink_msg_att_pos_mocap_send_buf(mavlink_message_t *msgbuf, packet->x = x; packet->y = y; packet->z = z; - mav_array_memcpy(packet->q, q, sizeof(float)*4); - mav_array_memcpy(packet->covariance, covariance, sizeof(float)*21); + mav_array_assign_float(packet->q, q, 4); + mav_array_assign_float(packet->covariance, covariance, 21); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATT_POS_MOCAP, (const char *)packet, MAVLINK_MSG_ID_ATT_POS_MOCAP_MIN_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_CRC); #endif } diff --git a/common/mavlink_msg_attitude.h b/common/mavlink_msg_attitude.h index 6a8237c92..c260822bf 100644 --- a/common/mavlink_msg_attitude.h +++ b/common/mavlink_msg_attitude.h @@ -99,6 +99,57 @@ static inline uint16_t mavlink_msg_attitude_pack(uint8_t system_id, uint8_t comp return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ATTITUDE_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_LEN, MAVLINK_MSG_ID_ATTITUDE_CRC); } +/** + * @brief Pack a attitude message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param roll [rad] Roll angle (-pi..+pi) + * @param pitch [rad] Pitch angle (-pi..+pi) + * @param yaw [rad] Yaw angle (-pi..+pi) + * @param rollspeed [rad/s] Roll angular speed + * @param pitchspeed [rad/s] Pitch angular speed + * @param yawspeed [rad/s] Yaw angular speed + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_attitude_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, float roll, float pitch, float yaw, float rollspeed, float pitchspeed, float yawspeed) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_ATTITUDE_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_float(buf, 4, roll); + _mav_put_float(buf, 8, pitch); + _mav_put_float(buf, 12, yaw); + _mav_put_float(buf, 16, rollspeed); + _mav_put_float(buf, 20, pitchspeed); + _mav_put_float(buf, 24, yawspeed); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ATTITUDE_LEN); +#else + mavlink_attitude_t packet; + packet.time_boot_ms = time_boot_ms; + packet.roll = roll; + packet.pitch = pitch; + packet.yaw = yaw; + packet.rollspeed = rollspeed; + packet.pitchspeed = pitchspeed; + packet.yawspeed = yawspeed; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATTITUDE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_ATTITUDE; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ATTITUDE_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_LEN, MAVLINK_MSG_ID_ATTITUDE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ATTITUDE_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_LEN); +#endif +} + /** * @brief Pack a attitude message on a channel * @param system_id ID of this system @@ -173,6 +224,20 @@ static inline uint16_t mavlink_msg_attitude_encode_chan(uint8_t system_id, uint8 return mavlink_msg_attitude_pack_chan(system_id, component_id, chan, msg, attitude->time_boot_ms, attitude->roll, attitude->pitch, attitude->yaw, attitude->rollspeed, attitude->pitchspeed, attitude->yawspeed); } +/** + * @brief Encode a attitude struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param attitude C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_attitude_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_attitude_t* attitude) +{ + return mavlink_msg_attitude_pack_status(system_id, component_id, _status, msg, attitude->time_boot_ms, attitude->roll, attitude->pitch, attitude->yaw, attitude->rollspeed, attitude->pitchspeed, attitude->yawspeed); +} + /** * @brief Send a attitude message * @param chan MAVLink channel to send the message @@ -230,7 +295,7 @@ static inline void mavlink_msg_attitude_send_struct(mavlink_channel_t chan, cons #if MAVLINK_MSG_ID_ATTITUDE_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_attitude_quaternion.h b/common/mavlink_msg_attitude_quaternion.h index a61381622..a2f65fcbd 100644 --- a/common/mavlink_msg_attitude_quaternion.h +++ b/common/mavlink_msg_attitude_quaternion.h @@ -101,7 +101,7 @@ static inline uint16_t mavlink_msg_attitude_quaternion_pack(uint8_t system_id, u packet.rollspeed = rollspeed; packet.pitchspeed = pitchspeed; packet.yawspeed = yawspeed; - mav_array_memcpy(packet.repr_offset_q, repr_offset_q, sizeof(float)*4); + mav_array_assign_float(packet.repr_offset_q, repr_offset_q, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN); #endif @@ -109,6 +109,61 @@ static inline uint16_t mavlink_msg_attitude_quaternion_pack(uint8_t system_id, u return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_CRC); } +/** + * @brief Pack a attitude_quaternion message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param q1 Quaternion component 1, w (1 in null-rotation) + * @param q2 Quaternion component 2, x (0 in null-rotation) + * @param q3 Quaternion component 3, y (0 in null-rotation) + * @param q4 Quaternion component 4, z (0 in null-rotation) + * @param rollspeed [rad/s] Roll angular speed + * @param pitchspeed [rad/s] Pitch angular speed + * @param yawspeed [rad/s] Yaw angular speed + * @param repr_offset_q Rotation offset by which the attitude quaternion and angular speed vector should be rotated for user display (quaternion with [w, x, y, z] order, zero-rotation is [1, 0, 0, 0], send [0, 0, 0, 0] if field not supported). This field is intended for systems in which the reference attitude may change during flight. For example, tailsitters VTOLs rotate their reference attitude by 90 degrees between hover mode and fixed wing mode, thus repr_offset_q is equal to [1, 0, 0, 0] in hover mode and equal to [0.7071, 0, 0.7071, 0] in fixed wing mode. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_attitude_quaternion_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, float q1, float q2, float q3, float q4, float rollspeed, float pitchspeed, float yawspeed, const float *repr_offset_q) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_float(buf, 4, q1); + _mav_put_float(buf, 8, q2); + _mav_put_float(buf, 12, q3); + _mav_put_float(buf, 16, q4); + _mav_put_float(buf, 20, rollspeed); + _mav_put_float(buf, 24, pitchspeed); + _mav_put_float(buf, 28, yawspeed); + _mav_put_float_array(buf, 32, repr_offset_q, 4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN); +#else + mavlink_attitude_quaternion_t packet; + packet.time_boot_ms = time_boot_ms; + packet.q1 = q1; + packet.q2 = q2; + packet.q3 = q3; + packet.q4 = q4; + packet.rollspeed = rollspeed; + packet.pitchspeed = pitchspeed; + packet.yawspeed = yawspeed; + mav_array_memcpy(packet.repr_offset_q, repr_offset_q, sizeof(float)*4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_ATTITUDE_QUATERNION; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN); +#endif +} + /** * @brief Pack a attitude_quaternion message on a channel * @param system_id ID of this system @@ -152,7 +207,7 @@ static inline uint16_t mavlink_msg_attitude_quaternion_pack_chan(uint8_t system_ packet.rollspeed = rollspeed; packet.pitchspeed = pitchspeed; packet.yawspeed = yawspeed; - mav_array_memcpy(packet.repr_offset_q, repr_offset_q, sizeof(float)*4); + mav_array_assign_float(packet.repr_offset_q, repr_offset_q, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN); #endif @@ -187,6 +242,20 @@ static inline uint16_t mavlink_msg_attitude_quaternion_encode_chan(uint8_t syste return mavlink_msg_attitude_quaternion_pack_chan(system_id, component_id, chan, msg, attitude_quaternion->time_boot_ms, attitude_quaternion->q1, attitude_quaternion->q2, attitude_quaternion->q3, attitude_quaternion->q4, attitude_quaternion->rollspeed, attitude_quaternion->pitchspeed, attitude_quaternion->yawspeed, attitude_quaternion->repr_offset_q); } +/** + * @brief Encode a attitude_quaternion struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param attitude_quaternion C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_attitude_quaternion_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_attitude_quaternion_t* attitude_quaternion) +{ + return mavlink_msg_attitude_quaternion_pack_status(system_id, component_id, _status, msg, attitude_quaternion->time_boot_ms, attitude_quaternion->q1, attitude_quaternion->q2, attitude_quaternion->q3, attitude_quaternion->q4, attitude_quaternion->rollspeed, attitude_quaternion->pitchspeed, attitude_quaternion->yawspeed, attitude_quaternion->repr_offset_q); +} + /** * @brief Send a attitude_quaternion message * @param chan MAVLink channel to send the message @@ -227,7 +296,7 @@ static inline void mavlink_msg_attitude_quaternion_send(mavlink_channel_t chan, packet.rollspeed = rollspeed; packet.pitchspeed = pitchspeed; packet.yawspeed = yawspeed; - mav_array_memcpy(packet.repr_offset_q, repr_offset_q, sizeof(float)*4); + mav_array_assign_float(packet.repr_offset_q, repr_offset_q, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION, (const char *)&packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_CRC); #endif } @@ -248,7 +317,7 @@ static inline void mavlink_msg_attitude_quaternion_send_struct(mavlink_channel_t #if MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -278,7 +347,7 @@ static inline void mavlink_msg_attitude_quaternion_send_buf(mavlink_message_t *m packet->rollspeed = rollspeed; packet->pitchspeed = pitchspeed; packet->yawspeed = yawspeed; - mav_array_memcpy(packet->repr_offset_q, repr_offset_q, sizeof(float)*4); + mav_array_assign_float(packet->repr_offset_q, repr_offset_q, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION, (const char *)packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_CRC); #endif } diff --git a/common/mavlink_msg_attitude_quaternion_cov.h b/common/mavlink_msg_attitude_quaternion_cov.h index bc2351aa3..86457f398 100644 --- a/common/mavlink_msg_attitude_quaternion_cov.h +++ b/common/mavlink_msg_attitude_quaternion_cov.h @@ -68,6 +68,48 @@ typedef struct __mavlink_attitude_quaternion_cov_t { static inline uint16_t mavlink_msg_attitude_quaternion_cov_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint64_t time_usec, const float *q, float rollspeed, float pitchspeed, float yawspeed, const float *covariance) { +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 24, rollspeed); + _mav_put_float(buf, 28, pitchspeed); + _mav_put_float(buf, 32, yawspeed); + _mav_put_float_array(buf, 8, q, 4); + _mav_put_float_array(buf, 36, covariance, 9); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN); +#else + mavlink_attitude_quaternion_cov_t packet; + packet.time_usec = time_usec; + packet.rollspeed = rollspeed; + packet.pitchspeed = pitchspeed; + packet.yawspeed = yawspeed; + mav_array_assign_float(packet.q, q, 4); + mav_array_assign_float(packet.covariance, covariance, 9); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC); +} + +/** + * @brief Pack a attitude_quaternion_cov message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation) + * @param rollspeed [rad/s] Roll angular speed + * @param pitchspeed [rad/s] Pitch angular speed + * @param yawspeed [rad/s] Yaw angular speed + * @param covariance Row-major representation of a 3x3 attitude covariance matrix (states: roll, pitch, yaw; first three entries are the first ROW, next three entries are the second row, etc.). If unknown, assign NaN value to first element in the array. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_attitude_quaternion_cov_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, const float *q, float rollspeed, float pitchspeed, float yawspeed, const float *covariance) +{ #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN]; _mav_put_uint64_t(buf, 0, time_usec); @@ -89,7 +131,11 @@ static inline uint16_t mavlink_msg_attitude_quaternion_cov_pack(uint8_t system_i #endif msg->msgid = MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC); +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN); +#endif } /** @@ -125,8 +171,8 @@ static inline uint16_t mavlink_msg_attitude_quaternion_cov_pack_chan(uint8_t sys packet.rollspeed = rollspeed; packet.pitchspeed = pitchspeed; packet.yawspeed = yawspeed; - mav_array_memcpy(packet.q, q, sizeof(float)*4); - mav_array_memcpy(packet.covariance, covariance, sizeof(float)*9); + mav_array_assign_float(packet.q, q, 4); + mav_array_assign_float(packet.covariance, covariance, 9); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN); #endif @@ -161,6 +207,20 @@ static inline uint16_t mavlink_msg_attitude_quaternion_cov_encode_chan(uint8_t s return mavlink_msg_attitude_quaternion_cov_pack_chan(system_id, component_id, chan, msg, attitude_quaternion_cov->time_usec, attitude_quaternion_cov->q, attitude_quaternion_cov->rollspeed, attitude_quaternion_cov->pitchspeed, attitude_quaternion_cov->yawspeed, attitude_quaternion_cov->covariance); } +/** + * @brief Encode a attitude_quaternion_cov struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param attitude_quaternion_cov C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_attitude_quaternion_cov_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_attitude_quaternion_cov_t* attitude_quaternion_cov) +{ + return mavlink_msg_attitude_quaternion_cov_pack_status(system_id, component_id, _status, msg, attitude_quaternion_cov->time_usec, attitude_quaternion_cov->q, attitude_quaternion_cov->rollspeed, attitude_quaternion_cov->pitchspeed, attitude_quaternion_cov->yawspeed, attitude_quaternion_cov->covariance); +} + /** * @brief Send a attitude_quaternion_cov message * @param chan MAVLink channel to send the message @@ -191,8 +251,8 @@ static inline void mavlink_msg_attitude_quaternion_cov_send(mavlink_channel_t ch packet.rollspeed = rollspeed; packet.pitchspeed = pitchspeed; packet.yawspeed = yawspeed; - mav_array_memcpy(packet.q, q, sizeof(float)*4); - mav_array_memcpy(packet.covariance, covariance, sizeof(float)*9); + mav_array_assign_float(packet.q, q, 4); + mav_array_assign_float(packet.covariance, covariance, 9); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV, (const char *)&packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC); #endif } @@ -213,7 +273,7 @@ static inline void mavlink_msg_attitude_quaternion_cov_send_struct(mavlink_chann #if MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -236,8 +296,8 @@ static inline void mavlink_msg_attitude_quaternion_cov_send_buf(mavlink_message_ packet->rollspeed = rollspeed; packet->pitchspeed = pitchspeed; packet->yawspeed = yawspeed; - mav_array_memcpy(packet->q, q, sizeof(float)*4); - mav_array_memcpy(packet->covariance, covariance, sizeof(float)*9); + mav_array_assign_float(packet->q, q, 4); + mav_array_assign_float(packet->covariance, covariance, 9); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV, (const char *)packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC); #endif } diff --git a/common/mavlink_msg_attitude_target.h b/common/mavlink_msg_attitude_target.h index bedbb93e9..89de26e1f 100644 --- a/common/mavlink_msg_attitude_target.h +++ b/common/mavlink_msg_attitude_target.h @@ -89,7 +89,7 @@ static inline uint16_t mavlink_msg_attitude_target_pack(uint8_t system_id, uint8 packet.body_yaw_rate = body_yaw_rate; packet.thrust = thrust; packet.type_mask = type_mask; - mav_array_memcpy(packet.q, q, sizeof(float)*4); + mav_array_assign_float(packet.q, q, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN); #endif @@ -97,6 +97,55 @@ static inline uint16_t mavlink_msg_attitude_target_pack(uint8_t system_id, uint8 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ATTITUDE_TARGET_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN, MAVLINK_MSG_ID_ATTITUDE_TARGET_CRC); } +/** + * @brief Pack a attitude_target message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param type_mask Bitmap to indicate which dimensions should be ignored by the vehicle. + * @param q Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) + * @param body_roll_rate [rad/s] Body roll rate + * @param body_pitch_rate [rad/s] Body pitch rate + * @param body_yaw_rate [rad/s] Body yaw rate + * @param thrust Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse trust) + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_attitude_target_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, uint8_t type_mask, const float *q, float body_roll_rate, float body_pitch_rate, float body_yaw_rate, float thrust) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_float(buf, 20, body_roll_rate); + _mav_put_float(buf, 24, body_pitch_rate); + _mav_put_float(buf, 28, body_yaw_rate); + _mav_put_float(buf, 32, thrust); + _mav_put_uint8_t(buf, 36, type_mask); + _mav_put_float_array(buf, 4, q, 4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN); +#else + mavlink_attitude_target_t packet; + packet.time_boot_ms = time_boot_ms; + packet.body_roll_rate = body_roll_rate; + packet.body_pitch_rate = body_pitch_rate; + packet.body_yaw_rate = body_yaw_rate; + packet.thrust = thrust; + packet.type_mask = type_mask; + mav_array_memcpy(packet.q, q, sizeof(float)*4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_ATTITUDE_TARGET; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ATTITUDE_TARGET_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN, MAVLINK_MSG_ID_ATTITUDE_TARGET_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ATTITUDE_TARGET_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN); +#endif +} + /** * @brief Pack a attitude_target message on a channel * @param system_id ID of this system @@ -134,7 +183,7 @@ static inline uint16_t mavlink_msg_attitude_target_pack_chan(uint8_t system_id, packet.body_yaw_rate = body_yaw_rate; packet.thrust = thrust; packet.type_mask = type_mask; - mav_array_memcpy(packet.q, q, sizeof(float)*4); + mav_array_assign_float(packet.q, q, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN); #endif @@ -169,6 +218,20 @@ static inline uint16_t mavlink_msg_attitude_target_encode_chan(uint8_t system_id return mavlink_msg_attitude_target_pack_chan(system_id, component_id, chan, msg, attitude_target->time_boot_ms, attitude_target->type_mask, attitude_target->q, attitude_target->body_roll_rate, attitude_target->body_pitch_rate, attitude_target->body_yaw_rate, attitude_target->thrust); } +/** + * @brief Encode a attitude_target struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param attitude_target C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_attitude_target_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_attitude_target_t* attitude_target) +{ + return mavlink_msg_attitude_target_pack_status(system_id, component_id, _status, msg, attitude_target->time_boot_ms, attitude_target->type_mask, attitude_target->q, attitude_target->body_roll_rate, attitude_target->body_pitch_rate, attitude_target->body_yaw_rate, attitude_target->thrust); +} + /** * @brief Send a attitude_target message * @param chan MAVLink channel to send the message @@ -203,7 +266,7 @@ static inline void mavlink_msg_attitude_target_send(mavlink_channel_t chan, uint packet.body_yaw_rate = body_yaw_rate; packet.thrust = thrust; packet.type_mask = type_mask; - mav_array_memcpy(packet.q, q, sizeof(float)*4); + mav_array_assign_float(packet.q, q, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_TARGET, (const char *)&packet, MAVLINK_MSG_ID_ATTITUDE_TARGET_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN, MAVLINK_MSG_ID_ATTITUDE_TARGET_CRC); #endif } @@ -224,7 +287,7 @@ static inline void mavlink_msg_attitude_target_send_struct(mavlink_channel_t cha #if MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -250,7 +313,7 @@ static inline void mavlink_msg_attitude_target_send_buf(mavlink_message_t *msgbu packet->body_yaw_rate = body_yaw_rate; packet->thrust = thrust; packet->type_mask = type_mask; - mav_array_memcpy(packet->q, q, sizeof(float)*4); + mav_array_assign_float(packet->q, q, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_TARGET, (const char *)packet, MAVLINK_MSG_ID_ATTITUDE_TARGET_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN, MAVLINK_MSG_ID_ATTITUDE_TARGET_CRC); #endif } diff --git a/common/mavlink_msg_auth_key.h b/common/mavlink_msg_auth_key.h index 57cd6916a..827544a69 100644 --- a/common/mavlink_msg_auth_key.h +++ b/common/mavlink_msg_auth_key.h @@ -55,7 +55,7 @@ static inline uint16_t mavlink_msg_auth_key_pack(uint8_t system_id, uint8_t comp #else mavlink_auth_key_t packet; - mav_array_memcpy(packet.key, key, sizeof(char)*32); + mav_array_assign_char(packet.key, key, 32); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AUTH_KEY_LEN); #endif @@ -63,6 +63,39 @@ static inline uint16_t mavlink_msg_auth_key_pack(uint8_t system_id, uint8_t comp return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AUTH_KEY_MIN_LEN, MAVLINK_MSG_ID_AUTH_KEY_LEN, MAVLINK_MSG_ID_AUTH_KEY_CRC); } +/** + * @brief Pack a auth_key message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param key key + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_auth_key_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + const char *key) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_AUTH_KEY_LEN]; + + _mav_put_char_array(buf, 0, key, 32); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AUTH_KEY_LEN); +#else + mavlink_auth_key_t packet; + + mav_array_memcpy(packet.key, key, sizeof(char)*32); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AUTH_KEY_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_AUTH_KEY; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_AUTH_KEY_MIN_LEN, MAVLINK_MSG_ID_AUTH_KEY_LEN, MAVLINK_MSG_ID_AUTH_KEY_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_AUTH_KEY_MIN_LEN, MAVLINK_MSG_ID_AUTH_KEY_LEN); +#endif +} + /** * @brief Pack a auth_key message on a channel * @param system_id ID of this system @@ -84,7 +117,7 @@ static inline uint16_t mavlink_msg_auth_key_pack_chan(uint8_t system_id, uint8_t #else mavlink_auth_key_t packet; - mav_array_memcpy(packet.key, key, sizeof(char)*32); + mav_array_assign_char(packet.key, key, 32); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AUTH_KEY_LEN); #endif @@ -119,6 +152,20 @@ static inline uint16_t mavlink_msg_auth_key_encode_chan(uint8_t system_id, uint8 return mavlink_msg_auth_key_pack_chan(system_id, component_id, chan, msg, auth_key->key); } +/** + * @brief Encode a auth_key struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param auth_key C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_auth_key_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_auth_key_t* auth_key) +{ + return mavlink_msg_auth_key_pack_status(system_id, component_id, _status, msg, auth_key->key); +} + /** * @brief Send a auth_key message * @param chan MAVLink channel to send the message @@ -137,7 +184,7 @@ static inline void mavlink_msg_auth_key_send(mavlink_channel_t chan, const char #else mavlink_auth_key_t packet; - mav_array_memcpy(packet.key, key, sizeof(char)*32); + mav_array_assign_char(packet.key, key, 32); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTH_KEY, (const char *)&packet, MAVLINK_MSG_ID_AUTH_KEY_MIN_LEN, MAVLINK_MSG_ID_AUTH_KEY_LEN, MAVLINK_MSG_ID_AUTH_KEY_CRC); #endif } @@ -158,7 +205,7 @@ static inline void mavlink_msg_auth_key_send_struct(mavlink_channel_t chan, cons #if MAVLINK_MSG_ID_AUTH_KEY_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -174,7 +221,7 @@ static inline void mavlink_msg_auth_key_send_buf(mavlink_message_t *msgbuf, mavl #else mavlink_auth_key_t *packet = (mavlink_auth_key_t *)msgbuf; - mav_array_memcpy(packet->key, key, sizeof(char)*32); + mav_array_assign_char(packet->key, key, 32); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTH_KEY, (const char *)packet, MAVLINK_MSG_ID_AUTH_KEY_MIN_LEN, MAVLINK_MSG_ID_AUTH_KEY_LEN, MAVLINK_MSG_ID_AUTH_KEY_CRC); #endif } diff --git a/common/mavlink_msg_autopilot_state_for_gimbal_device.h b/common/mavlink_msg_autopilot_state_for_gimbal_device.h index c9cdce8d5..e15fa6d45 100644 --- a/common/mavlink_msg_autopilot_state_for_gimbal_device.h +++ b/common/mavlink_msg_autopilot_state_for_gimbal_device.h @@ -3,25 +3,26 @@ #define MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE 286 - +MAVPACKED( typedef struct __mavlink_autopilot_state_for_gimbal_device_t { uint64_t time_boot_us; /*< [us] Timestamp (time since system boot).*/ float q[4]; /*< Quaternion components of autopilot attitude: w, x, y, z (1 0 0 0 is the null-rotation, Hamilton convention).*/ - uint32_t q_estimated_delay_us; /*< [us] Estimated delay of the attitude data.*/ - float vx; /*< [m/s] X Speed in NED (North, East, Down).*/ - float vy; /*< [m/s] Y Speed in NED (North, East, Down).*/ - float vz; /*< [m/s] Z Speed in NED (North, East, Down).*/ - uint32_t v_estimated_delay_us; /*< [us] Estimated delay of the speed data.*/ - float feed_forward_angular_velocity_z; /*< [rad/s] Feed forward Z component of angular velocity, positive is yawing to the right, NaN to be ignored. This is to indicate if the autopilot is actively yawing.*/ + uint32_t q_estimated_delay_us; /*< [us] Estimated delay of the attitude data. 0 if unknown.*/ + float vx; /*< [m/s] X Speed in NED (North, East, Down). NAN if unknown.*/ + float vy; /*< [m/s] Y Speed in NED (North, East, Down). NAN if unknown.*/ + float vz; /*< [m/s] Z Speed in NED (North, East, Down). NAN if unknown.*/ + uint32_t v_estimated_delay_us; /*< [us] Estimated delay of the speed data. 0 if unknown.*/ + float feed_forward_angular_velocity_z; /*< [rad/s] Feed forward Z component of angular velocity (positive: yawing to the right). NaN to be ignored. This is to indicate if the autopilot is actively yawing.*/ uint16_t estimator_status; /*< Bitmap indicating which estimator outputs are valid.*/ uint8_t target_system; /*< System ID*/ uint8_t target_component; /*< Component ID*/ uint8_t landed_state; /*< The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown.*/ -} mavlink_autopilot_state_for_gimbal_device_t; + float angular_velocity_z; /*< [rad/s] Z component of angular velocity in NED (North, East, Down). NaN if unknown.*/ +}) mavlink_autopilot_state_for_gimbal_device_t; -#define MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_LEN 53 +#define MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_LEN 57 #define MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_MIN_LEN 53 -#define MAVLINK_MSG_ID_286_LEN 53 +#define MAVLINK_MSG_ID_286_LEN 57 #define MAVLINK_MSG_ID_286_MIN_LEN 53 #define MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_CRC 210 @@ -33,7 +34,7 @@ typedef struct __mavlink_autopilot_state_for_gimbal_device_t { #define MAVLINK_MESSAGE_INFO_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE { \ 286, \ "AUTOPILOT_STATE_FOR_GIMBAL_DEVICE", \ - 12, \ + 13, \ { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 50, offsetof(mavlink_autopilot_state_for_gimbal_device_t, target_system) }, \ { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 51, offsetof(mavlink_autopilot_state_for_gimbal_device_t, target_component) }, \ { "time_boot_us", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_autopilot_state_for_gimbal_device_t, time_boot_us) }, \ @@ -46,12 +47,13 @@ typedef struct __mavlink_autopilot_state_for_gimbal_device_t { { "feed_forward_angular_velocity_z", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_autopilot_state_for_gimbal_device_t, feed_forward_angular_velocity_z) }, \ { "estimator_status", NULL, MAVLINK_TYPE_UINT16_T, 0, 48, offsetof(mavlink_autopilot_state_for_gimbal_device_t, estimator_status) }, \ { "landed_state", NULL, MAVLINK_TYPE_UINT8_T, 0, 52, offsetof(mavlink_autopilot_state_for_gimbal_device_t, landed_state) }, \ + { "angular_velocity_z", NULL, MAVLINK_TYPE_FLOAT, 0, 53, offsetof(mavlink_autopilot_state_for_gimbal_device_t, angular_velocity_z) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE { \ "AUTOPILOT_STATE_FOR_GIMBAL_DEVICE", \ - 12, \ + 13, \ { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 50, offsetof(mavlink_autopilot_state_for_gimbal_device_t, target_system) }, \ { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 51, offsetof(mavlink_autopilot_state_for_gimbal_device_t, target_component) }, \ { "time_boot_us", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_autopilot_state_for_gimbal_device_t, time_boot_us) }, \ @@ -64,6 +66,7 @@ typedef struct __mavlink_autopilot_state_for_gimbal_device_t { { "feed_forward_angular_velocity_z", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_autopilot_state_for_gimbal_device_t, feed_forward_angular_velocity_z) }, \ { "estimator_status", NULL, MAVLINK_TYPE_UINT16_T, 0, 48, offsetof(mavlink_autopilot_state_for_gimbal_device_t, estimator_status) }, \ { "landed_state", NULL, MAVLINK_TYPE_UINT8_T, 0, 52, offsetof(mavlink_autopilot_state_for_gimbal_device_t, landed_state) }, \ + { "angular_velocity_z", NULL, MAVLINK_TYPE_FLOAT, 0, 53, offsetof(mavlink_autopilot_state_for_gimbal_device_t, angular_velocity_z) }, \ } \ } #endif @@ -78,18 +81,19 @@ typedef struct __mavlink_autopilot_state_for_gimbal_device_t { * @param target_component Component ID * @param time_boot_us [us] Timestamp (time since system boot). * @param q Quaternion components of autopilot attitude: w, x, y, z (1 0 0 0 is the null-rotation, Hamilton convention). - * @param q_estimated_delay_us [us] Estimated delay of the attitude data. - * @param vx [m/s] X Speed in NED (North, East, Down). - * @param vy [m/s] Y Speed in NED (North, East, Down). - * @param vz [m/s] Z Speed in NED (North, East, Down). - * @param v_estimated_delay_us [us] Estimated delay of the speed data. - * @param feed_forward_angular_velocity_z [rad/s] Feed forward Z component of angular velocity, positive is yawing to the right, NaN to be ignored. This is to indicate if the autopilot is actively yawing. + * @param q_estimated_delay_us [us] Estimated delay of the attitude data. 0 if unknown. + * @param vx [m/s] X Speed in NED (North, East, Down). NAN if unknown. + * @param vy [m/s] Y Speed in NED (North, East, Down). NAN if unknown. + * @param vz [m/s] Z Speed in NED (North, East, Down). NAN if unknown. + * @param v_estimated_delay_us [us] Estimated delay of the speed data. 0 if unknown. + * @param feed_forward_angular_velocity_z [rad/s] Feed forward Z component of angular velocity (positive: yawing to the right). NaN to be ignored. This is to indicate if the autopilot is actively yawing. * @param estimator_status Bitmap indicating which estimator outputs are valid. * @param landed_state The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown. + * @param angular_velocity_z [rad/s] Z component of angular velocity in NED (North, East, Down). NaN if unknown. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_autopilot_state_for_gimbal_device_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, uint64_t time_boot_us, const float *q, uint32_t q_estimated_delay_us, float vx, float vy, float vz, uint32_t v_estimated_delay_us, float feed_forward_angular_velocity_z, uint16_t estimator_status, uint8_t landed_state) + uint8_t target_system, uint8_t target_component, uint64_t time_boot_us, const float *q, uint32_t q_estimated_delay_us, float vx, float vy, float vz, uint32_t v_estimated_delay_us, float feed_forward_angular_velocity_z, uint16_t estimator_status, uint8_t landed_state, float angular_velocity_z) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_LEN]; @@ -104,6 +108,7 @@ static inline uint16_t mavlink_msg_autopilot_state_for_gimbal_device_pack(uint8_ _mav_put_uint8_t(buf, 50, target_system); _mav_put_uint8_t(buf, 51, target_component); _mav_put_uint8_t(buf, 52, landed_state); + _mav_put_float(buf, 53, angular_velocity_z); _mav_put_float_array(buf, 8, q, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_LEN); #else @@ -119,7 +124,8 @@ static inline uint16_t mavlink_msg_autopilot_state_for_gimbal_device_pack(uint8_ packet.target_system = target_system; packet.target_component = target_component; packet.landed_state = landed_state; - mav_array_memcpy(packet.q, q, sizeof(float)*4); + packet.angular_velocity_z = angular_velocity_z; + mav_array_assign_float(packet.q, q, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_LEN); #endif @@ -127,6 +133,73 @@ static inline uint16_t mavlink_msg_autopilot_state_for_gimbal_device_pack(uint8_ return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_LEN, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_CRC); } +/** + * @brief Pack a autopilot_state_for_gimbal_device message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param time_boot_us [us] Timestamp (time since system boot). + * @param q Quaternion components of autopilot attitude: w, x, y, z (1 0 0 0 is the null-rotation, Hamilton convention). + * @param q_estimated_delay_us [us] Estimated delay of the attitude data. 0 if unknown. + * @param vx [m/s] X Speed in NED (North, East, Down). NAN if unknown. + * @param vy [m/s] Y Speed in NED (North, East, Down). NAN if unknown. + * @param vz [m/s] Z Speed in NED (North, East, Down). NAN if unknown. + * @param v_estimated_delay_us [us] Estimated delay of the speed data. 0 if unknown. + * @param feed_forward_angular_velocity_z [rad/s] Feed forward Z component of angular velocity (positive: yawing to the right). NaN to be ignored. This is to indicate if the autopilot is actively yawing. + * @param estimator_status Bitmap indicating which estimator outputs are valid. + * @param landed_state The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown. + * @param angular_velocity_z [rad/s] Z component of angular velocity in NED (North, East, Down). NaN if unknown. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_autopilot_state_for_gimbal_device_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint64_t time_boot_us, const float *q, uint32_t q_estimated_delay_us, float vx, float vy, float vz, uint32_t v_estimated_delay_us, float feed_forward_angular_velocity_z, uint16_t estimator_status, uint8_t landed_state, float angular_velocity_z) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_LEN]; + _mav_put_uint64_t(buf, 0, time_boot_us); + _mav_put_uint32_t(buf, 24, q_estimated_delay_us); + _mav_put_float(buf, 28, vx); + _mav_put_float(buf, 32, vy); + _mav_put_float(buf, 36, vz); + _mav_put_uint32_t(buf, 40, v_estimated_delay_us); + _mav_put_float(buf, 44, feed_forward_angular_velocity_z); + _mav_put_uint16_t(buf, 48, estimator_status); + _mav_put_uint8_t(buf, 50, target_system); + _mav_put_uint8_t(buf, 51, target_component); + _mav_put_uint8_t(buf, 52, landed_state); + _mav_put_float(buf, 53, angular_velocity_z); + _mav_put_float_array(buf, 8, q, 4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_LEN); +#else + mavlink_autopilot_state_for_gimbal_device_t packet; + packet.time_boot_us = time_boot_us; + packet.q_estimated_delay_us = q_estimated_delay_us; + packet.vx = vx; + packet.vy = vy; + packet.vz = vz; + packet.v_estimated_delay_us = v_estimated_delay_us; + packet.feed_forward_angular_velocity_z = feed_forward_angular_velocity_z; + packet.estimator_status = estimator_status; + packet.target_system = target_system; + packet.target_component = target_component; + packet.landed_state = landed_state; + packet.angular_velocity_z = angular_velocity_z; + mav_array_memcpy(packet.q, q, sizeof(float)*4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_LEN, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_LEN); +#endif +} + /** * @brief Pack a autopilot_state_for_gimbal_device message on a channel * @param system_id ID of this system @@ -137,19 +210,20 @@ static inline uint16_t mavlink_msg_autopilot_state_for_gimbal_device_pack(uint8_ * @param target_component Component ID * @param time_boot_us [us] Timestamp (time since system boot). * @param q Quaternion components of autopilot attitude: w, x, y, z (1 0 0 0 is the null-rotation, Hamilton convention). - * @param q_estimated_delay_us [us] Estimated delay of the attitude data. - * @param vx [m/s] X Speed in NED (North, East, Down). - * @param vy [m/s] Y Speed in NED (North, East, Down). - * @param vz [m/s] Z Speed in NED (North, East, Down). - * @param v_estimated_delay_us [us] Estimated delay of the speed data. - * @param feed_forward_angular_velocity_z [rad/s] Feed forward Z component of angular velocity, positive is yawing to the right, NaN to be ignored. This is to indicate if the autopilot is actively yawing. + * @param q_estimated_delay_us [us] Estimated delay of the attitude data. 0 if unknown. + * @param vx [m/s] X Speed in NED (North, East, Down). NAN if unknown. + * @param vy [m/s] Y Speed in NED (North, East, Down). NAN if unknown. + * @param vz [m/s] Z Speed in NED (North, East, Down). NAN if unknown. + * @param v_estimated_delay_us [us] Estimated delay of the speed data. 0 if unknown. + * @param feed_forward_angular_velocity_z [rad/s] Feed forward Z component of angular velocity (positive: yawing to the right). NaN to be ignored. This is to indicate if the autopilot is actively yawing. * @param estimator_status Bitmap indicating which estimator outputs are valid. * @param landed_state The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown. + * @param angular_velocity_z [rad/s] Z component of angular velocity in NED (North, East, Down). NaN if unknown. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_autopilot_state_for_gimbal_device_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,uint64_t time_boot_us,const float *q,uint32_t q_estimated_delay_us,float vx,float vy,float vz,uint32_t v_estimated_delay_us,float feed_forward_angular_velocity_z,uint16_t estimator_status,uint8_t landed_state) + uint8_t target_system,uint8_t target_component,uint64_t time_boot_us,const float *q,uint32_t q_estimated_delay_us,float vx,float vy,float vz,uint32_t v_estimated_delay_us,float feed_forward_angular_velocity_z,uint16_t estimator_status,uint8_t landed_state,float angular_velocity_z) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_LEN]; @@ -164,6 +238,7 @@ static inline uint16_t mavlink_msg_autopilot_state_for_gimbal_device_pack_chan(u _mav_put_uint8_t(buf, 50, target_system); _mav_put_uint8_t(buf, 51, target_component); _mav_put_uint8_t(buf, 52, landed_state); + _mav_put_float(buf, 53, angular_velocity_z); _mav_put_float_array(buf, 8, q, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_LEN); #else @@ -179,7 +254,8 @@ static inline uint16_t mavlink_msg_autopilot_state_for_gimbal_device_pack_chan(u packet.target_system = target_system; packet.target_component = target_component; packet.landed_state = landed_state; - mav_array_memcpy(packet.q, q, sizeof(float)*4); + packet.angular_velocity_z = angular_velocity_z; + mav_array_assign_float(packet.q, q, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_LEN); #endif @@ -197,7 +273,7 @@ static inline uint16_t mavlink_msg_autopilot_state_for_gimbal_device_pack_chan(u */ static inline uint16_t mavlink_msg_autopilot_state_for_gimbal_device_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_autopilot_state_for_gimbal_device_t* autopilot_state_for_gimbal_device) { - return mavlink_msg_autopilot_state_for_gimbal_device_pack(system_id, component_id, msg, autopilot_state_for_gimbal_device->target_system, autopilot_state_for_gimbal_device->target_component, autopilot_state_for_gimbal_device->time_boot_us, autopilot_state_for_gimbal_device->q, autopilot_state_for_gimbal_device->q_estimated_delay_us, autopilot_state_for_gimbal_device->vx, autopilot_state_for_gimbal_device->vy, autopilot_state_for_gimbal_device->vz, autopilot_state_for_gimbal_device->v_estimated_delay_us, autopilot_state_for_gimbal_device->feed_forward_angular_velocity_z, autopilot_state_for_gimbal_device->estimator_status, autopilot_state_for_gimbal_device->landed_state); + return mavlink_msg_autopilot_state_for_gimbal_device_pack(system_id, component_id, msg, autopilot_state_for_gimbal_device->target_system, autopilot_state_for_gimbal_device->target_component, autopilot_state_for_gimbal_device->time_boot_us, autopilot_state_for_gimbal_device->q, autopilot_state_for_gimbal_device->q_estimated_delay_us, autopilot_state_for_gimbal_device->vx, autopilot_state_for_gimbal_device->vy, autopilot_state_for_gimbal_device->vz, autopilot_state_for_gimbal_device->v_estimated_delay_us, autopilot_state_for_gimbal_device->feed_forward_angular_velocity_z, autopilot_state_for_gimbal_device->estimator_status, autopilot_state_for_gimbal_device->landed_state, autopilot_state_for_gimbal_device->angular_velocity_z); } /** @@ -211,7 +287,21 @@ static inline uint16_t mavlink_msg_autopilot_state_for_gimbal_device_encode(uint */ static inline uint16_t mavlink_msg_autopilot_state_for_gimbal_device_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_autopilot_state_for_gimbal_device_t* autopilot_state_for_gimbal_device) { - return mavlink_msg_autopilot_state_for_gimbal_device_pack_chan(system_id, component_id, chan, msg, autopilot_state_for_gimbal_device->target_system, autopilot_state_for_gimbal_device->target_component, autopilot_state_for_gimbal_device->time_boot_us, autopilot_state_for_gimbal_device->q, autopilot_state_for_gimbal_device->q_estimated_delay_us, autopilot_state_for_gimbal_device->vx, autopilot_state_for_gimbal_device->vy, autopilot_state_for_gimbal_device->vz, autopilot_state_for_gimbal_device->v_estimated_delay_us, autopilot_state_for_gimbal_device->feed_forward_angular_velocity_z, autopilot_state_for_gimbal_device->estimator_status, autopilot_state_for_gimbal_device->landed_state); + return mavlink_msg_autopilot_state_for_gimbal_device_pack_chan(system_id, component_id, chan, msg, autopilot_state_for_gimbal_device->target_system, autopilot_state_for_gimbal_device->target_component, autopilot_state_for_gimbal_device->time_boot_us, autopilot_state_for_gimbal_device->q, autopilot_state_for_gimbal_device->q_estimated_delay_us, autopilot_state_for_gimbal_device->vx, autopilot_state_for_gimbal_device->vy, autopilot_state_for_gimbal_device->vz, autopilot_state_for_gimbal_device->v_estimated_delay_us, autopilot_state_for_gimbal_device->feed_forward_angular_velocity_z, autopilot_state_for_gimbal_device->estimator_status, autopilot_state_for_gimbal_device->landed_state, autopilot_state_for_gimbal_device->angular_velocity_z); +} + +/** + * @brief Encode a autopilot_state_for_gimbal_device struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param autopilot_state_for_gimbal_device C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_autopilot_state_for_gimbal_device_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_autopilot_state_for_gimbal_device_t* autopilot_state_for_gimbal_device) +{ + return mavlink_msg_autopilot_state_for_gimbal_device_pack_status(system_id, component_id, _status, msg, autopilot_state_for_gimbal_device->target_system, autopilot_state_for_gimbal_device->target_component, autopilot_state_for_gimbal_device->time_boot_us, autopilot_state_for_gimbal_device->q, autopilot_state_for_gimbal_device->q_estimated_delay_us, autopilot_state_for_gimbal_device->vx, autopilot_state_for_gimbal_device->vy, autopilot_state_for_gimbal_device->vz, autopilot_state_for_gimbal_device->v_estimated_delay_us, autopilot_state_for_gimbal_device->feed_forward_angular_velocity_z, autopilot_state_for_gimbal_device->estimator_status, autopilot_state_for_gimbal_device->landed_state, autopilot_state_for_gimbal_device->angular_velocity_z); } /** @@ -222,18 +312,19 @@ static inline uint16_t mavlink_msg_autopilot_state_for_gimbal_device_encode_chan * @param target_component Component ID * @param time_boot_us [us] Timestamp (time since system boot). * @param q Quaternion components of autopilot attitude: w, x, y, z (1 0 0 0 is the null-rotation, Hamilton convention). - * @param q_estimated_delay_us [us] Estimated delay of the attitude data. - * @param vx [m/s] X Speed in NED (North, East, Down). - * @param vy [m/s] Y Speed in NED (North, East, Down). - * @param vz [m/s] Z Speed in NED (North, East, Down). - * @param v_estimated_delay_us [us] Estimated delay of the speed data. - * @param feed_forward_angular_velocity_z [rad/s] Feed forward Z component of angular velocity, positive is yawing to the right, NaN to be ignored. This is to indicate if the autopilot is actively yawing. + * @param q_estimated_delay_us [us] Estimated delay of the attitude data. 0 if unknown. + * @param vx [m/s] X Speed in NED (North, East, Down). NAN if unknown. + * @param vy [m/s] Y Speed in NED (North, East, Down). NAN if unknown. + * @param vz [m/s] Z Speed in NED (North, East, Down). NAN if unknown. + * @param v_estimated_delay_us [us] Estimated delay of the speed data. 0 if unknown. + * @param feed_forward_angular_velocity_z [rad/s] Feed forward Z component of angular velocity (positive: yawing to the right). NaN to be ignored. This is to indicate if the autopilot is actively yawing. * @param estimator_status Bitmap indicating which estimator outputs are valid. * @param landed_state The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown. + * @param angular_velocity_z [rad/s] Z component of angular velocity in NED (North, East, Down). NaN if unknown. */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_autopilot_state_for_gimbal_device_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint64_t time_boot_us, const float *q, uint32_t q_estimated_delay_us, float vx, float vy, float vz, uint32_t v_estimated_delay_us, float feed_forward_angular_velocity_z, uint16_t estimator_status, uint8_t landed_state) +static inline void mavlink_msg_autopilot_state_for_gimbal_device_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint64_t time_boot_us, const float *q, uint32_t q_estimated_delay_us, float vx, float vy, float vz, uint32_t v_estimated_delay_us, float feed_forward_angular_velocity_z, uint16_t estimator_status, uint8_t landed_state, float angular_velocity_z) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_LEN]; @@ -248,6 +339,7 @@ static inline void mavlink_msg_autopilot_state_for_gimbal_device_send(mavlink_ch _mav_put_uint8_t(buf, 50, target_system); _mav_put_uint8_t(buf, 51, target_component); _mav_put_uint8_t(buf, 52, landed_state); + _mav_put_float(buf, 53, angular_velocity_z); _mav_put_float_array(buf, 8, q, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE, buf, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_LEN, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_CRC); #else @@ -263,7 +355,8 @@ static inline void mavlink_msg_autopilot_state_for_gimbal_device_send(mavlink_ch packet.target_system = target_system; packet.target_component = target_component; packet.landed_state = landed_state; - mav_array_memcpy(packet.q, q, sizeof(float)*4); + packet.angular_velocity_z = angular_velocity_z; + mav_array_assign_float(packet.q, q, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE, (const char *)&packet, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_LEN, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_CRC); #endif } @@ -276,7 +369,7 @@ static inline void mavlink_msg_autopilot_state_for_gimbal_device_send(mavlink_ch static inline void mavlink_msg_autopilot_state_for_gimbal_device_send_struct(mavlink_channel_t chan, const mavlink_autopilot_state_for_gimbal_device_t* autopilot_state_for_gimbal_device) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_autopilot_state_for_gimbal_device_send(chan, autopilot_state_for_gimbal_device->target_system, autopilot_state_for_gimbal_device->target_component, autopilot_state_for_gimbal_device->time_boot_us, autopilot_state_for_gimbal_device->q, autopilot_state_for_gimbal_device->q_estimated_delay_us, autopilot_state_for_gimbal_device->vx, autopilot_state_for_gimbal_device->vy, autopilot_state_for_gimbal_device->vz, autopilot_state_for_gimbal_device->v_estimated_delay_us, autopilot_state_for_gimbal_device->feed_forward_angular_velocity_z, autopilot_state_for_gimbal_device->estimator_status, autopilot_state_for_gimbal_device->landed_state); + mavlink_msg_autopilot_state_for_gimbal_device_send(chan, autopilot_state_for_gimbal_device->target_system, autopilot_state_for_gimbal_device->target_component, autopilot_state_for_gimbal_device->time_boot_us, autopilot_state_for_gimbal_device->q, autopilot_state_for_gimbal_device->q_estimated_delay_us, autopilot_state_for_gimbal_device->vx, autopilot_state_for_gimbal_device->vy, autopilot_state_for_gimbal_device->vz, autopilot_state_for_gimbal_device->v_estimated_delay_us, autopilot_state_for_gimbal_device->feed_forward_angular_velocity_z, autopilot_state_for_gimbal_device->estimator_status, autopilot_state_for_gimbal_device->landed_state, autopilot_state_for_gimbal_device->angular_velocity_z); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE, (const char *)autopilot_state_for_gimbal_device, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_LEN, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_CRC); #endif @@ -284,13 +377,13 @@ static inline void mavlink_msg_autopilot_state_for_gimbal_device_send_struct(mav #if MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_autopilot_state_for_gimbal_device_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint64_t time_boot_us, const float *q, uint32_t q_estimated_delay_us, float vx, float vy, float vz, uint32_t v_estimated_delay_us, float feed_forward_angular_velocity_z, uint16_t estimator_status, uint8_t landed_state) +static inline void mavlink_msg_autopilot_state_for_gimbal_device_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint64_t time_boot_us, const float *q, uint32_t q_estimated_delay_us, float vx, float vy, float vz, uint32_t v_estimated_delay_us, float feed_forward_angular_velocity_z, uint16_t estimator_status, uint8_t landed_state, float angular_velocity_z) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; @@ -305,6 +398,7 @@ static inline void mavlink_msg_autopilot_state_for_gimbal_device_send_buf(mavlin _mav_put_uint8_t(buf, 50, target_system); _mav_put_uint8_t(buf, 51, target_component); _mav_put_uint8_t(buf, 52, landed_state); + _mav_put_float(buf, 53, angular_velocity_z); _mav_put_float_array(buf, 8, q, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE, buf, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_LEN, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_CRC); #else @@ -320,7 +414,8 @@ static inline void mavlink_msg_autopilot_state_for_gimbal_device_send_buf(mavlin packet->target_system = target_system; packet->target_component = target_component; packet->landed_state = landed_state; - mav_array_memcpy(packet->q, q, sizeof(float)*4); + packet->angular_velocity_z = angular_velocity_z; + mav_array_assign_float(packet->q, q, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE, (const char *)packet, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_LEN, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_CRC); #endif } @@ -374,7 +469,7 @@ static inline uint16_t mavlink_msg_autopilot_state_for_gimbal_device_get_q(const /** * @brief Get field q_estimated_delay_us from autopilot_state_for_gimbal_device message * - * @return [us] Estimated delay of the attitude data. + * @return [us] Estimated delay of the attitude data. 0 if unknown. */ static inline uint32_t mavlink_msg_autopilot_state_for_gimbal_device_get_q_estimated_delay_us(const mavlink_message_t* msg) { @@ -384,7 +479,7 @@ static inline uint32_t mavlink_msg_autopilot_state_for_gimbal_device_get_q_estim /** * @brief Get field vx from autopilot_state_for_gimbal_device message * - * @return [m/s] X Speed in NED (North, East, Down). + * @return [m/s] X Speed in NED (North, East, Down). NAN if unknown. */ static inline float mavlink_msg_autopilot_state_for_gimbal_device_get_vx(const mavlink_message_t* msg) { @@ -394,7 +489,7 @@ static inline float mavlink_msg_autopilot_state_for_gimbal_device_get_vx(const m /** * @brief Get field vy from autopilot_state_for_gimbal_device message * - * @return [m/s] Y Speed in NED (North, East, Down). + * @return [m/s] Y Speed in NED (North, East, Down). NAN if unknown. */ static inline float mavlink_msg_autopilot_state_for_gimbal_device_get_vy(const mavlink_message_t* msg) { @@ -404,7 +499,7 @@ static inline float mavlink_msg_autopilot_state_for_gimbal_device_get_vy(const m /** * @brief Get field vz from autopilot_state_for_gimbal_device message * - * @return [m/s] Z Speed in NED (North, East, Down). + * @return [m/s] Z Speed in NED (North, East, Down). NAN if unknown. */ static inline float mavlink_msg_autopilot_state_for_gimbal_device_get_vz(const mavlink_message_t* msg) { @@ -414,7 +509,7 @@ static inline float mavlink_msg_autopilot_state_for_gimbal_device_get_vz(const m /** * @brief Get field v_estimated_delay_us from autopilot_state_for_gimbal_device message * - * @return [us] Estimated delay of the speed data. + * @return [us] Estimated delay of the speed data. 0 if unknown. */ static inline uint32_t mavlink_msg_autopilot_state_for_gimbal_device_get_v_estimated_delay_us(const mavlink_message_t* msg) { @@ -424,7 +519,7 @@ static inline uint32_t mavlink_msg_autopilot_state_for_gimbal_device_get_v_estim /** * @brief Get field feed_forward_angular_velocity_z from autopilot_state_for_gimbal_device message * - * @return [rad/s] Feed forward Z component of angular velocity, positive is yawing to the right, NaN to be ignored. This is to indicate if the autopilot is actively yawing. + * @return [rad/s] Feed forward Z component of angular velocity (positive: yawing to the right). NaN to be ignored. This is to indicate if the autopilot is actively yawing. */ static inline float mavlink_msg_autopilot_state_for_gimbal_device_get_feed_forward_angular_velocity_z(const mavlink_message_t* msg) { @@ -451,6 +546,16 @@ static inline uint8_t mavlink_msg_autopilot_state_for_gimbal_device_get_landed_s return _MAV_RETURN_uint8_t(msg, 52); } +/** + * @brief Get field angular_velocity_z from autopilot_state_for_gimbal_device message + * + * @return [rad/s] Z component of angular velocity in NED (North, East, Down). NaN if unknown. + */ +static inline float mavlink_msg_autopilot_state_for_gimbal_device_get_angular_velocity_z(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 53); +} + /** * @brief Decode a autopilot_state_for_gimbal_device message into a struct * @@ -472,6 +577,7 @@ static inline void mavlink_msg_autopilot_state_for_gimbal_device_decode(const ma autopilot_state_for_gimbal_device->target_system = mavlink_msg_autopilot_state_for_gimbal_device_get_target_system(msg); autopilot_state_for_gimbal_device->target_component = mavlink_msg_autopilot_state_for_gimbal_device_get_target_component(msg); autopilot_state_for_gimbal_device->landed_state = mavlink_msg_autopilot_state_for_gimbal_device_get_landed_state(msg); + autopilot_state_for_gimbal_device->angular_velocity_z = mavlink_msg_autopilot_state_for_gimbal_device_get_angular_velocity_z(msg); #else uint8_t len = msg->len < MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_LEN? msg->len : MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_LEN; memset(autopilot_state_for_gimbal_device, 0, MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE_LEN); diff --git a/common/mavlink_msg_autopilot_version.h b/common/mavlink_msg_autopilot_version.h index 37b87be38..b406ff277 100644 --- a/common/mavlink_msg_autopilot_version.h +++ b/common/mavlink_msg_autopilot_version.h @@ -10,7 +10,7 @@ typedef struct __mavlink_autopilot_version_t { uint32_t flight_sw_version; /*< Firmware version number*/ uint32_t middleware_sw_version; /*< Middleware version number*/ uint32_t os_sw_version; /*< Operating system version number*/ - uint32_t board_version; /*< HW / board version (last 8 bytes should be silicon ID, if any)*/ + uint32_t board_version; /*< HW / board version (last 8 bits should be silicon ID, if any). The first 16 bits of this field specify https://github.com/PX4/PX4-Bootloader/blob/master/board_types.txt*/ uint16_t vendor_id; /*< ID of the board vendor*/ uint16_t product_id; /*< ID of the product*/ uint8_t flight_custom_version[8]; /*< Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases.*/ @@ -81,7 +81,7 @@ typedef struct __mavlink_autopilot_version_t { * @param flight_sw_version Firmware version number * @param middleware_sw_version Middleware version number * @param os_sw_version Operating system version number - * @param board_version HW / board version (last 8 bytes should be silicon ID, if any) + * @param board_version HW / board version (last 8 bits should be silicon ID, if any). The first 16 bits of this field specify https://github.com/PX4/PX4-Bootloader/blob/master/board_types.txt * @param flight_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. * @param middleware_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. * @param os_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. @@ -130,6 +130,70 @@ static inline uint16_t mavlink_msg_autopilot_version_pack(uint8_t system_id, uin return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AUTOPILOT_VERSION_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_CRC); } +/** + * @brief Pack a autopilot_version message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param capabilities Bitmap of capabilities + * @param flight_sw_version Firmware version number + * @param middleware_sw_version Middleware version number + * @param os_sw_version Operating system version number + * @param board_version HW / board version (last 8 bits should be silicon ID, if any). The first 16 bits of this field specify https://github.com/PX4/PX4-Bootloader/blob/master/board_types.txt + * @param flight_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. + * @param middleware_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. + * @param os_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. + * @param vendor_id ID of the board vendor + * @param product_id ID of the product + * @param uid UID if provided by hardware (see uid2) + * @param uid2 UID if provided by hardware (supersedes the uid field. If this is non-zero, use this field, otherwise use uid) + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_autopilot_version_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t capabilities, uint32_t flight_sw_version, uint32_t middleware_sw_version, uint32_t os_sw_version, uint32_t board_version, const uint8_t *flight_custom_version, const uint8_t *middleware_custom_version, const uint8_t *os_custom_version, uint16_t vendor_id, uint16_t product_id, uint64_t uid, const uint8_t *uid2) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN]; + _mav_put_uint64_t(buf, 0, capabilities); + _mav_put_uint64_t(buf, 8, uid); + _mav_put_uint32_t(buf, 16, flight_sw_version); + _mav_put_uint32_t(buf, 20, middleware_sw_version); + _mav_put_uint32_t(buf, 24, os_sw_version); + _mav_put_uint32_t(buf, 28, board_version); + _mav_put_uint16_t(buf, 32, vendor_id); + _mav_put_uint16_t(buf, 34, product_id); + _mav_put_uint8_t_array(buf, 36, flight_custom_version, 8); + _mav_put_uint8_t_array(buf, 44, middleware_custom_version, 8); + _mav_put_uint8_t_array(buf, 52, os_custom_version, 8); + _mav_put_uint8_t_array(buf, 60, uid2, 18); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN); +#else + mavlink_autopilot_version_t packet; + packet.capabilities = capabilities; + packet.uid = uid; + packet.flight_sw_version = flight_sw_version; + packet.middleware_sw_version = middleware_sw_version; + packet.os_sw_version = os_sw_version; + packet.board_version = board_version; + packet.vendor_id = vendor_id; + packet.product_id = product_id; + mav_array_memcpy(packet.flight_custom_version, flight_custom_version, sizeof(uint8_t)*8); + mav_array_memcpy(packet.middleware_custom_version, middleware_custom_version, sizeof(uint8_t)*8); + mav_array_memcpy(packet.os_custom_version, os_custom_version, sizeof(uint8_t)*8); + mav_array_memcpy(packet.uid2, uid2, sizeof(uint8_t)*18); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_AUTOPILOT_VERSION; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_AUTOPILOT_VERSION_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_AUTOPILOT_VERSION_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN); +#endif +} + /** * @brief Pack a autopilot_version message on a channel * @param system_id ID of this system @@ -140,7 +204,7 @@ static inline uint16_t mavlink_msg_autopilot_version_pack(uint8_t system_id, uin * @param flight_sw_version Firmware version number * @param middleware_sw_version Middleware version number * @param os_sw_version Operating system version number - * @param board_version HW / board version (last 8 bytes should be silicon ID, if any) + * @param board_version HW / board version (last 8 bits should be silicon ID, if any). The first 16 bits of this field specify https://github.com/PX4/PX4-Bootloader/blob/master/board_types.txt * @param flight_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. * @param middleware_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. * @param os_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. @@ -217,6 +281,20 @@ static inline uint16_t mavlink_msg_autopilot_version_encode_chan(uint8_t system_ return mavlink_msg_autopilot_version_pack_chan(system_id, component_id, chan, msg, autopilot_version->capabilities, autopilot_version->flight_sw_version, autopilot_version->middleware_sw_version, autopilot_version->os_sw_version, autopilot_version->board_version, autopilot_version->flight_custom_version, autopilot_version->middleware_custom_version, autopilot_version->os_custom_version, autopilot_version->vendor_id, autopilot_version->product_id, autopilot_version->uid, autopilot_version->uid2); } +/** + * @brief Encode a autopilot_version struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param autopilot_version C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_autopilot_version_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_autopilot_version_t* autopilot_version) +{ + return mavlink_msg_autopilot_version_pack_status(system_id, component_id, _status, msg, autopilot_version->capabilities, autopilot_version->flight_sw_version, autopilot_version->middleware_sw_version, autopilot_version->os_sw_version, autopilot_version->board_version, autopilot_version->flight_custom_version, autopilot_version->middleware_custom_version, autopilot_version->os_custom_version, autopilot_version->vendor_id, autopilot_version->product_id, autopilot_version->uid, autopilot_version->uid2); +} + /** * @brief Send a autopilot_version message * @param chan MAVLink channel to send the message @@ -225,7 +303,7 @@ static inline uint16_t mavlink_msg_autopilot_version_encode_chan(uint8_t system_ * @param flight_sw_version Firmware version number * @param middleware_sw_version Middleware version number * @param os_sw_version Operating system version number - * @param board_version HW / board version (last 8 bytes should be silicon ID, if any) + * @param board_version HW / board version (last 8 bits should be silicon ID, if any). The first 16 bits of this field specify https://github.com/PX4/PX4-Bootloader/blob/master/board_types.txt * @param flight_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. * @param middleware_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. * @param os_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. @@ -287,7 +365,7 @@ static inline void mavlink_msg_autopilot_version_send_struct(mavlink_channel_t c #if MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by re-using memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -377,7 +455,7 @@ static inline uint32_t mavlink_msg_autopilot_version_get_os_sw_version(const mav /** * @brief Get field board_version from autopilot_version message * - * @return HW / board version (last 8 bytes should be silicon ID, if any) + * @return HW / board version (last 8 bits should be silicon ID, if any). The first 16 bits of this field specify https://github.com/PX4/PX4-Bootloader/blob/master/board_types.txt */ static inline uint32_t mavlink_msg_autopilot_version_get_board_version(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_available_modes.h b/common/mavlink_msg_available_modes.h new file mode 100644 index 000000000..a316e271f --- /dev/null +++ b/common/mavlink_msg_available_modes.h @@ -0,0 +1,390 @@ +#pragma once +// MESSAGE AVAILABLE_MODES PACKING + +#define MAVLINK_MSG_ID_AVAILABLE_MODES 435 + + +typedef struct __mavlink_available_modes_t { + uint32_t custom_mode; /*< A bitfield for use for autopilot-specific flags*/ + uint32_t properties; /*< Mode properties.*/ + uint8_t number_modes; /*< The total number of available modes for the current vehicle type.*/ + uint8_t mode_index; /*< The current mode index within number_modes, indexed from 1. The index is not guaranteed to be persistent, and may change between reboots or if the set of modes change.*/ + uint8_t standard_mode; /*< Standard mode.*/ + char mode_name[35]; /*< Name of custom mode, with null termination character. Should be omitted for standard modes.*/ +} mavlink_available_modes_t; + +#define MAVLINK_MSG_ID_AVAILABLE_MODES_LEN 46 +#define MAVLINK_MSG_ID_AVAILABLE_MODES_MIN_LEN 46 +#define MAVLINK_MSG_ID_435_LEN 46 +#define MAVLINK_MSG_ID_435_MIN_LEN 46 + +#define MAVLINK_MSG_ID_AVAILABLE_MODES_CRC 134 +#define MAVLINK_MSG_ID_435_CRC 134 + +#define MAVLINK_MSG_AVAILABLE_MODES_FIELD_MODE_NAME_LEN 35 + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_AVAILABLE_MODES { \ + 435, \ + "AVAILABLE_MODES", \ + 6, \ + { { "number_modes", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_available_modes_t, number_modes) }, \ + { "mode_index", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_available_modes_t, mode_index) }, \ + { "standard_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_available_modes_t, standard_mode) }, \ + { "custom_mode", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_available_modes_t, custom_mode) }, \ + { "properties", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_available_modes_t, properties) }, \ + { "mode_name", NULL, MAVLINK_TYPE_CHAR, 35, 11, offsetof(mavlink_available_modes_t, mode_name) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_AVAILABLE_MODES { \ + "AVAILABLE_MODES", \ + 6, \ + { { "number_modes", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_available_modes_t, number_modes) }, \ + { "mode_index", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_available_modes_t, mode_index) }, \ + { "standard_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_available_modes_t, standard_mode) }, \ + { "custom_mode", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_available_modes_t, custom_mode) }, \ + { "properties", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_available_modes_t, properties) }, \ + { "mode_name", NULL, MAVLINK_TYPE_CHAR, 35, 11, offsetof(mavlink_available_modes_t, mode_name) }, \ + } \ +} +#endif + +/** + * @brief Pack a available_modes message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param number_modes The total number of available modes for the current vehicle type. + * @param mode_index The current mode index within number_modes, indexed from 1. The index is not guaranteed to be persistent, and may change between reboots or if the set of modes change. + * @param standard_mode Standard mode. + * @param custom_mode A bitfield for use for autopilot-specific flags + * @param properties Mode properties. + * @param mode_name Name of custom mode, with null termination character. Should be omitted for standard modes. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_available_modes_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t number_modes, uint8_t mode_index, uint8_t standard_mode, uint32_t custom_mode, uint32_t properties, const char *mode_name) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_AVAILABLE_MODES_LEN]; + _mav_put_uint32_t(buf, 0, custom_mode); + _mav_put_uint32_t(buf, 4, properties); + _mav_put_uint8_t(buf, 8, number_modes); + _mav_put_uint8_t(buf, 9, mode_index); + _mav_put_uint8_t(buf, 10, standard_mode); + _mav_put_char_array(buf, 11, mode_name, 35); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AVAILABLE_MODES_LEN); +#else + mavlink_available_modes_t packet; + packet.custom_mode = custom_mode; + packet.properties = properties; + packet.number_modes = number_modes; + packet.mode_index = mode_index; + packet.standard_mode = standard_mode; + mav_array_assign_char(packet.mode_name, mode_name, 35); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AVAILABLE_MODES_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_AVAILABLE_MODES; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AVAILABLE_MODES_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_CRC); +} + +/** + * @brief Pack a available_modes message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param number_modes The total number of available modes for the current vehicle type. + * @param mode_index The current mode index within number_modes, indexed from 1. The index is not guaranteed to be persistent, and may change between reboots or if the set of modes change. + * @param standard_mode Standard mode. + * @param custom_mode A bitfield for use for autopilot-specific flags + * @param properties Mode properties. + * @param mode_name Name of custom mode, with null termination character. Should be omitted for standard modes. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_available_modes_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t number_modes, uint8_t mode_index, uint8_t standard_mode, uint32_t custom_mode, uint32_t properties, const char *mode_name) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_AVAILABLE_MODES_LEN]; + _mav_put_uint32_t(buf, 0, custom_mode); + _mav_put_uint32_t(buf, 4, properties); + _mav_put_uint8_t(buf, 8, number_modes); + _mav_put_uint8_t(buf, 9, mode_index); + _mav_put_uint8_t(buf, 10, standard_mode); + _mav_put_char_array(buf, 11, mode_name, 35); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AVAILABLE_MODES_LEN); +#else + mavlink_available_modes_t packet; + packet.custom_mode = custom_mode; + packet.properties = properties; + packet.number_modes = number_modes; + packet.mode_index = mode_index; + packet.standard_mode = standard_mode; + mav_array_memcpy(packet.mode_name, mode_name, sizeof(char)*35); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AVAILABLE_MODES_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_AVAILABLE_MODES; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_AVAILABLE_MODES_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_AVAILABLE_MODES_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_LEN); +#endif +} + +/** + * @brief Pack a available_modes message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param number_modes The total number of available modes for the current vehicle type. + * @param mode_index The current mode index within number_modes, indexed from 1. The index is not guaranteed to be persistent, and may change between reboots or if the set of modes change. + * @param standard_mode Standard mode. + * @param custom_mode A bitfield for use for autopilot-specific flags + * @param properties Mode properties. + * @param mode_name Name of custom mode, with null termination character. Should be omitted for standard modes. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_available_modes_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t number_modes,uint8_t mode_index,uint8_t standard_mode,uint32_t custom_mode,uint32_t properties,const char *mode_name) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_AVAILABLE_MODES_LEN]; + _mav_put_uint32_t(buf, 0, custom_mode); + _mav_put_uint32_t(buf, 4, properties); + _mav_put_uint8_t(buf, 8, number_modes); + _mav_put_uint8_t(buf, 9, mode_index); + _mav_put_uint8_t(buf, 10, standard_mode); + _mav_put_char_array(buf, 11, mode_name, 35); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AVAILABLE_MODES_LEN); +#else + mavlink_available_modes_t packet; + packet.custom_mode = custom_mode; + packet.properties = properties; + packet.number_modes = number_modes; + packet.mode_index = mode_index; + packet.standard_mode = standard_mode; + mav_array_assign_char(packet.mode_name, mode_name, 35); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AVAILABLE_MODES_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_AVAILABLE_MODES; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AVAILABLE_MODES_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_CRC); +} + +/** + * @brief Encode a available_modes struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param available_modes C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_available_modes_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_available_modes_t* available_modes) +{ + return mavlink_msg_available_modes_pack(system_id, component_id, msg, available_modes->number_modes, available_modes->mode_index, available_modes->standard_mode, available_modes->custom_mode, available_modes->properties, available_modes->mode_name); +} + +/** + * @brief Encode a available_modes struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param available_modes C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_available_modes_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_available_modes_t* available_modes) +{ + return mavlink_msg_available_modes_pack_chan(system_id, component_id, chan, msg, available_modes->number_modes, available_modes->mode_index, available_modes->standard_mode, available_modes->custom_mode, available_modes->properties, available_modes->mode_name); +} + +/** + * @brief Encode a available_modes struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param available_modes C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_available_modes_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_available_modes_t* available_modes) +{ + return mavlink_msg_available_modes_pack_status(system_id, component_id, _status, msg, available_modes->number_modes, available_modes->mode_index, available_modes->standard_mode, available_modes->custom_mode, available_modes->properties, available_modes->mode_name); +} + +/** + * @brief Send a available_modes message + * @param chan MAVLink channel to send the message + * + * @param number_modes The total number of available modes for the current vehicle type. + * @param mode_index The current mode index within number_modes, indexed from 1. The index is not guaranteed to be persistent, and may change between reboots or if the set of modes change. + * @param standard_mode Standard mode. + * @param custom_mode A bitfield for use for autopilot-specific flags + * @param properties Mode properties. + * @param mode_name Name of custom mode, with null termination character. Should be omitted for standard modes. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_available_modes_send(mavlink_channel_t chan, uint8_t number_modes, uint8_t mode_index, uint8_t standard_mode, uint32_t custom_mode, uint32_t properties, const char *mode_name) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_AVAILABLE_MODES_LEN]; + _mav_put_uint32_t(buf, 0, custom_mode); + _mav_put_uint32_t(buf, 4, properties); + _mav_put_uint8_t(buf, 8, number_modes); + _mav_put_uint8_t(buf, 9, mode_index); + _mav_put_uint8_t(buf, 10, standard_mode); + _mav_put_char_array(buf, 11, mode_name, 35); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AVAILABLE_MODES, buf, MAVLINK_MSG_ID_AVAILABLE_MODES_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_CRC); +#else + mavlink_available_modes_t packet; + packet.custom_mode = custom_mode; + packet.properties = properties; + packet.number_modes = number_modes; + packet.mode_index = mode_index; + packet.standard_mode = standard_mode; + mav_array_assign_char(packet.mode_name, mode_name, 35); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AVAILABLE_MODES, (const char *)&packet, MAVLINK_MSG_ID_AVAILABLE_MODES_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_CRC); +#endif +} + +/** + * @brief Send a available_modes message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_available_modes_send_struct(mavlink_channel_t chan, const mavlink_available_modes_t* available_modes) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_available_modes_send(chan, available_modes->number_modes, available_modes->mode_index, available_modes->standard_mode, available_modes->custom_mode, available_modes->properties, available_modes->mode_name); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AVAILABLE_MODES, (const char *)available_modes, MAVLINK_MSG_ID_AVAILABLE_MODES_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_CRC); +#endif +} + +#if MAVLINK_MSG_ID_AVAILABLE_MODES_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_available_modes_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t number_modes, uint8_t mode_index, uint8_t standard_mode, uint32_t custom_mode, uint32_t properties, const char *mode_name) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint32_t(buf, 0, custom_mode); + _mav_put_uint32_t(buf, 4, properties); + _mav_put_uint8_t(buf, 8, number_modes); + _mav_put_uint8_t(buf, 9, mode_index); + _mav_put_uint8_t(buf, 10, standard_mode); + _mav_put_char_array(buf, 11, mode_name, 35); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AVAILABLE_MODES, buf, MAVLINK_MSG_ID_AVAILABLE_MODES_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_CRC); +#else + mavlink_available_modes_t *packet = (mavlink_available_modes_t *)msgbuf; + packet->custom_mode = custom_mode; + packet->properties = properties; + packet->number_modes = number_modes; + packet->mode_index = mode_index; + packet->standard_mode = standard_mode; + mav_array_assign_char(packet->mode_name, mode_name, 35); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AVAILABLE_MODES, (const char *)packet, MAVLINK_MSG_ID_AVAILABLE_MODES_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_CRC); +#endif +} +#endif + +#endif + +// MESSAGE AVAILABLE_MODES UNPACKING + + +/** + * @brief Get field number_modes from available_modes message + * + * @return The total number of available modes for the current vehicle type. + */ +static inline uint8_t mavlink_msg_available_modes_get_number_modes(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 8); +} + +/** + * @brief Get field mode_index from available_modes message + * + * @return The current mode index within number_modes, indexed from 1. The index is not guaranteed to be persistent, and may change between reboots or if the set of modes change. + */ +static inline uint8_t mavlink_msg_available_modes_get_mode_index(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 9); +} + +/** + * @brief Get field standard_mode from available_modes message + * + * @return Standard mode. + */ +static inline uint8_t mavlink_msg_available_modes_get_standard_mode(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 10); +} + +/** + * @brief Get field custom_mode from available_modes message + * + * @return A bitfield for use for autopilot-specific flags + */ +static inline uint32_t mavlink_msg_available_modes_get_custom_mode(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 0); +} + +/** + * @brief Get field properties from available_modes message + * + * @return Mode properties. + */ +static inline uint32_t mavlink_msg_available_modes_get_properties(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 4); +} + +/** + * @brief Get field mode_name from available_modes message + * + * @return Name of custom mode, with null termination character. Should be omitted for standard modes. + */ +static inline uint16_t mavlink_msg_available_modes_get_mode_name(const mavlink_message_t* msg, char *mode_name) +{ + return _MAV_RETURN_char_array(msg, mode_name, 35, 11); +} + +/** + * @brief Decode a available_modes message into a struct + * + * @param msg The message to decode + * @param available_modes C-struct to decode the message contents into + */ +static inline void mavlink_msg_available_modes_decode(const mavlink_message_t* msg, mavlink_available_modes_t* available_modes) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + available_modes->custom_mode = mavlink_msg_available_modes_get_custom_mode(msg); + available_modes->properties = mavlink_msg_available_modes_get_properties(msg); + available_modes->number_modes = mavlink_msg_available_modes_get_number_modes(msg); + available_modes->mode_index = mavlink_msg_available_modes_get_mode_index(msg); + available_modes->standard_mode = mavlink_msg_available_modes_get_standard_mode(msg); + mavlink_msg_available_modes_get_mode_name(msg, available_modes->mode_name); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_AVAILABLE_MODES_LEN? msg->len : MAVLINK_MSG_ID_AVAILABLE_MODES_LEN; + memset(available_modes, 0, MAVLINK_MSG_ID_AVAILABLE_MODES_LEN); + memcpy(available_modes, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/common/mavlink_msg_available_modes_monitor.h b/common/mavlink_msg_available_modes_monitor.h new file mode 100644 index 000000000..e3c902f4a --- /dev/null +++ b/common/mavlink_msg_available_modes_monitor.h @@ -0,0 +1,260 @@ +#pragma once +// MESSAGE AVAILABLE_MODES_MONITOR PACKING + +#define MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR 437 + + +typedef struct __mavlink_available_modes_monitor_t { + uint8_t seq; /*< Sequence number. The value iterates sequentially whenever AVAILABLE_MODES changes (e.g. support for a new mode is added/removed dynamically).*/ +} mavlink_available_modes_monitor_t; + +#define MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN 1 +#define MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_MIN_LEN 1 +#define MAVLINK_MSG_ID_437_LEN 1 +#define MAVLINK_MSG_ID_437_MIN_LEN 1 + +#define MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_CRC 30 +#define MAVLINK_MSG_ID_437_CRC 30 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_AVAILABLE_MODES_MONITOR { \ + 437, \ + "AVAILABLE_MODES_MONITOR", \ + 1, \ + { { "seq", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_available_modes_monitor_t, seq) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_AVAILABLE_MODES_MONITOR { \ + "AVAILABLE_MODES_MONITOR", \ + 1, \ + { { "seq", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_available_modes_monitor_t, seq) }, \ + } \ +} +#endif + +/** + * @brief Pack a available_modes_monitor message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param seq Sequence number. The value iterates sequentially whenever AVAILABLE_MODES changes (e.g. support for a new mode is added/removed dynamically). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_available_modes_monitor_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t seq) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN]; + _mav_put_uint8_t(buf, 0, seq); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN); +#else + mavlink_available_modes_monitor_t packet; + packet.seq = seq; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_CRC); +} + +/** + * @brief Pack a available_modes_monitor message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param seq Sequence number. The value iterates sequentially whenever AVAILABLE_MODES changes (e.g. support for a new mode is added/removed dynamically). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_available_modes_monitor_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t seq) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN]; + _mav_put_uint8_t(buf, 0, seq); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN); +#else + mavlink_available_modes_monitor_t packet; + packet.seq = seq; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN); +#endif +} + +/** + * @brief Pack a available_modes_monitor message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param seq Sequence number. The value iterates sequentially whenever AVAILABLE_MODES changes (e.g. support for a new mode is added/removed dynamically). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_available_modes_monitor_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t seq) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN]; + _mav_put_uint8_t(buf, 0, seq); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN); +#else + mavlink_available_modes_monitor_t packet; + packet.seq = seq; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_CRC); +} + +/** + * @brief Encode a available_modes_monitor struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param available_modes_monitor C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_available_modes_monitor_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_available_modes_monitor_t* available_modes_monitor) +{ + return mavlink_msg_available_modes_monitor_pack(system_id, component_id, msg, available_modes_monitor->seq); +} + +/** + * @brief Encode a available_modes_monitor struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param available_modes_monitor C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_available_modes_monitor_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_available_modes_monitor_t* available_modes_monitor) +{ + return mavlink_msg_available_modes_monitor_pack_chan(system_id, component_id, chan, msg, available_modes_monitor->seq); +} + +/** + * @brief Encode a available_modes_monitor struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param available_modes_monitor C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_available_modes_monitor_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_available_modes_monitor_t* available_modes_monitor) +{ + return mavlink_msg_available_modes_monitor_pack_status(system_id, component_id, _status, msg, available_modes_monitor->seq); +} + +/** + * @brief Send a available_modes_monitor message + * @param chan MAVLink channel to send the message + * + * @param seq Sequence number. The value iterates sequentially whenever AVAILABLE_MODES changes (e.g. support for a new mode is added/removed dynamically). + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_available_modes_monitor_send(mavlink_channel_t chan, uint8_t seq) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN]; + _mav_put_uint8_t(buf, 0, seq); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR, buf, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_CRC); +#else + mavlink_available_modes_monitor_t packet; + packet.seq = seq; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR, (const char *)&packet, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_CRC); +#endif +} + +/** + * @brief Send a available_modes_monitor message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_available_modes_monitor_send_struct(mavlink_channel_t chan, const mavlink_available_modes_monitor_t* available_modes_monitor) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_available_modes_monitor_send(chan, available_modes_monitor->seq); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR, (const char *)available_modes_monitor, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_CRC); +#endif +} + +#if MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_available_modes_monitor_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t seq) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint8_t(buf, 0, seq); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR, buf, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_CRC); +#else + mavlink_available_modes_monitor_t *packet = (mavlink_available_modes_monitor_t *)msgbuf; + packet->seq = seq; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR, (const char *)packet, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_CRC); +#endif +} +#endif + +#endif + +// MESSAGE AVAILABLE_MODES_MONITOR UNPACKING + + +/** + * @brief Get field seq from available_modes_monitor message + * + * @return Sequence number. The value iterates sequentially whenever AVAILABLE_MODES changes (e.g. support for a new mode is added/removed dynamically). + */ +static inline uint8_t mavlink_msg_available_modes_monitor_get_seq(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 0); +} + +/** + * @brief Decode a available_modes_monitor message into a struct + * + * @param msg The message to decode + * @param available_modes_monitor C-struct to decode the message contents into + */ +static inline void mavlink_msg_available_modes_monitor_decode(const mavlink_message_t* msg, mavlink_available_modes_monitor_t* available_modes_monitor) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + available_modes_monitor->seq = mavlink_msg_available_modes_monitor_get_seq(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN? msg->len : MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN; + memset(available_modes_monitor, 0, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN); + memcpy(available_modes_monitor, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/common/mavlink_msg_battery_info.h b/common/mavlink_msg_battery_info.h new file mode 100644 index 000000000..19e29f36c --- /dev/null +++ b/common/mavlink_msg_battery_info.h @@ -0,0 +1,784 @@ +#pragma once +// MESSAGE BATTERY_INFO PACKING + +#define MAVLINK_MSG_ID_BATTERY_INFO 372 + + +typedef struct __mavlink_battery_info_t { + float discharge_minimum_voltage; /*< [V] Minimum per-cell voltage when discharging. 0: field not provided.*/ + float charging_minimum_voltage; /*< [V] Minimum per-cell voltage when charging. 0: field not provided.*/ + float resting_minimum_voltage; /*< [V] Minimum per-cell voltage when resting. 0: field not provided.*/ + float charging_maximum_voltage; /*< [V] Maximum per-cell voltage when charged. 0: field not provided.*/ + float charging_maximum_current; /*< [A] Maximum pack continuous charge current. 0: field not provided.*/ + float nominal_voltage; /*< [V] Battery nominal voltage. Used for conversion between Wh and Ah. 0: field not provided.*/ + float discharge_maximum_current; /*< [A] Maximum pack discharge current. 0: field not provided.*/ + float discharge_maximum_burst_current; /*< [A] Maximum pack discharge burst current. 0: field not provided.*/ + float design_capacity; /*< [Ah] Fully charged design capacity. 0: field not provided.*/ + float full_charge_capacity; /*< [Ah] Predicted battery capacity when fully charged (accounting for battery degradation). NAN: field not provided.*/ + uint16_t cycle_count; /*< Lifetime count of the number of charge/discharge cycles (https://en.wikipedia.org/wiki/Charge_cycle). UINT16_MAX: field not provided.*/ + uint16_t weight; /*< [g] Battery weight. 0: field not provided.*/ + uint8_t id; /*< Battery ID*/ + uint8_t battery_function; /*< Function of the battery.*/ + uint8_t type; /*< Type (chemistry) of the battery.*/ + uint8_t state_of_health; /*< [%] State of Health (SOH) estimate. Typically 100% at the time of manufacture and will decrease over time and use. -1: field not provided.*/ + uint8_t cells_in_series; /*< Number of battery cells in series. 0: field not provided.*/ + char manufacture_date[9]; /*< Manufacture date (DDMMYYYY) in ASCII characters, 0 terminated. All 0: field not provided.*/ + char serial_number[32]; /*< Serial number in ASCII characters, 0 terminated. All 0: field not provided.*/ + char name[50]; /*< Battery device name. Formatted as manufacturer name then product name, separated with an underscore (in ASCII characters), 0 terminated. All 0: field not provided.*/ +} mavlink_battery_info_t; + +#define MAVLINK_MSG_ID_BATTERY_INFO_LEN 140 +#define MAVLINK_MSG_ID_BATTERY_INFO_MIN_LEN 140 +#define MAVLINK_MSG_ID_372_LEN 140 +#define MAVLINK_MSG_ID_372_MIN_LEN 140 + +#define MAVLINK_MSG_ID_BATTERY_INFO_CRC 26 +#define MAVLINK_MSG_ID_372_CRC 26 + +#define MAVLINK_MSG_BATTERY_INFO_FIELD_MANUFACTURE_DATE_LEN 9 +#define MAVLINK_MSG_BATTERY_INFO_FIELD_SERIAL_NUMBER_LEN 32 +#define MAVLINK_MSG_BATTERY_INFO_FIELD_NAME_LEN 50 + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_BATTERY_INFO { \ + 372, \ + "BATTERY_INFO", \ + 20, \ + { { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 44, offsetof(mavlink_battery_info_t, id) }, \ + { "battery_function", NULL, MAVLINK_TYPE_UINT8_T, 0, 45, offsetof(mavlink_battery_info_t, battery_function) }, \ + { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 46, offsetof(mavlink_battery_info_t, type) }, \ + { "state_of_health", NULL, MAVLINK_TYPE_UINT8_T, 0, 47, offsetof(mavlink_battery_info_t, state_of_health) }, \ + { "cells_in_series", NULL, MAVLINK_TYPE_UINT8_T, 0, 48, offsetof(mavlink_battery_info_t, cells_in_series) }, \ + { "cycle_count", NULL, MAVLINK_TYPE_UINT16_T, 0, 40, offsetof(mavlink_battery_info_t, cycle_count) }, \ + { "weight", NULL, MAVLINK_TYPE_UINT16_T, 0, 42, offsetof(mavlink_battery_info_t, weight) }, \ + { "discharge_minimum_voltage", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_battery_info_t, discharge_minimum_voltage) }, \ + { "charging_minimum_voltage", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_battery_info_t, charging_minimum_voltage) }, \ + { "resting_minimum_voltage", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_battery_info_t, resting_minimum_voltage) }, \ + { "charging_maximum_voltage", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_battery_info_t, charging_maximum_voltage) }, \ + { "charging_maximum_current", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_battery_info_t, charging_maximum_current) }, \ + { "nominal_voltage", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_battery_info_t, nominal_voltage) }, \ + { "discharge_maximum_current", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_battery_info_t, discharge_maximum_current) }, \ + { "discharge_maximum_burst_current", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_battery_info_t, discharge_maximum_burst_current) }, \ + { "design_capacity", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_battery_info_t, design_capacity) }, \ + { "full_charge_capacity", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_battery_info_t, full_charge_capacity) }, \ + { "manufacture_date", NULL, MAVLINK_TYPE_CHAR, 9, 49, offsetof(mavlink_battery_info_t, manufacture_date) }, \ + { "serial_number", NULL, MAVLINK_TYPE_CHAR, 32, 58, offsetof(mavlink_battery_info_t, serial_number) }, \ + { "name", NULL, MAVLINK_TYPE_CHAR, 50, 90, offsetof(mavlink_battery_info_t, name) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_BATTERY_INFO { \ + "BATTERY_INFO", \ + 20, \ + { { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 44, offsetof(mavlink_battery_info_t, id) }, \ + { "battery_function", NULL, MAVLINK_TYPE_UINT8_T, 0, 45, offsetof(mavlink_battery_info_t, battery_function) }, \ + { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 46, offsetof(mavlink_battery_info_t, type) }, \ + { "state_of_health", NULL, MAVLINK_TYPE_UINT8_T, 0, 47, offsetof(mavlink_battery_info_t, state_of_health) }, \ + { "cells_in_series", NULL, MAVLINK_TYPE_UINT8_T, 0, 48, offsetof(mavlink_battery_info_t, cells_in_series) }, \ + { "cycle_count", NULL, MAVLINK_TYPE_UINT16_T, 0, 40, offsetof(mavlink_battery_info_t, cycle_count) }, \ + { "weight", NULL, MAVLINK_TYPE_UINT16_T, 0, 42, offsetof(mavlink_battery_info_t, weight) }, \ + { "discharge_minimum_voltage", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_battery_info_t, discharge_minimum_voltage) }, \ + { "charging_minimum_voltage", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_battery_info_t, charging_minimum_voltage) }, \ + { "resting_minimum_voltage", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_battery_info_t, resting_minimum_voltage) }, \ + { "charging_maximum_voltage", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_battery_info_t, charging_maximum_voltage) }, \ + { "charging_maximum_current", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_battery_info_t, charging_maximum_current) }, \ + { "nominal_voltage", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_battery_info_t, nominal_voltage) }, \ + { "discharge_maximum_current", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_battery_info_t, discharge_maximum_current) }, \ + { "discharge_maximum_burst_current", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_battery_info_t, discharge_maximum_burst_current) }, \ + { "design_capacity", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_battery_info_t, design_capacity) }, \ + { "full_charge_capacity", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_battery_info_t, full_charge_capacity) }, \ + { "manufacture_date", NULL, MAVLINK_TYPE_CHAR, 9, 49, offsetof(mavlink_battery_info_t, manufacture_date) }, \ + { "serial_number", NULL, MAVLINK_TYPE_CHAR, 32, 58, offsetof(mavlink_battery_info_t, serial_number) }, \ + { "name", NULL, MAVLINK_TYPE_CHAR, 50, 90, offsetof(mavlink_battery_info_t, name) }, \ + } \ +} +#endif + +/** + * @brief Pack a battery_info message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param id Battery ID + * @param battery_function Function of the battery. + * @param type Type (chemistry) of the battery. + * @param state_of_health [%] State of Health (SOH) estimate. Typically 100% at the time of manufacture and will decrease over time and use. -1: field not provided. + * @param cells_in_series Number of battery cells in series. 0: field not provided. + * @param cycle_count Lifetime count of the number of charge/discharge cycles (https://en.wikipedia.org/wiki/Charge_cycle). UINT16_MAX: field not provided. + * @param weight [g] Battery weight. 0: field not provided. + * @param discharge_minimum_voltage [V] Minimum per-cell voltage when discharging. 0: field not provided. + * @param charging_minimum_voltage [V] Minimum per-cell voltage when charging. 0: field not provided. + * @param resting_minimum_voltage [V] Minimum per-cell voltage when resting. 0: field not provided. + * @param charging_maximum_voltage [V] Maximum per-cell voltage when charged. 0: field not provided. + * @param charging_maximum_current [A] Maximum pack continuous charge current. 0: field not provided. + * @param nominal_voltage [V] Battery nominal voltage. Used for conversion between Wh and Ah. 0: field not provided. + * @param discharge_maximum_current [A] Maximum pack discharge current. 0: field not provided. + * @param discharge_maximum_burst_current [A] Maximum pack discharge burst current. 0: field not provided. + * @param design_capacity [Ah] Fully charged design capacity. 0: field not provided. + * @param full_charge_capacity [Ah] Predicted battery capacity when fully charged (accounting for battery degradation). NAN: field not provided. + * @param manufacture_date Manufacture date (DDMMYYYY) in ASCII characters, 0 terminated. All 0: field not provided. + * @param serial_number Serial number in ASCII characters, 0 terminated. All 0: field not provided. + * @param name Battery device name. Formatted as manufacturer name then product name, separated with an underscore (in ASCII characters), 0 terminated. All 0: field not provided. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_battery_info_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t id, uint8_t battery_function, uint8_t type, uint8_t state_of_health, uint8_t cells_in_series, uint16_t cycle_count, uint16_t weight, float discharge_minimum_voltage, float charging_minimum_voltage, float resting_minimum_voltage, float charging_maximum_voltage, float charging_maximum_current, float nominal_voltage, float discharge_maximum_current, float discharge_maximum_burst_current, float design_capacity, float full_charge_capacity, const char *manufacture_date, const char *serial_number, const char *name) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_BATTERY_INFO_LEN]; + _mav_put_float(buf, 0, discharge_minimum_voltage); + _mav_put_float(buf, 4, charging_minimum_voltage); + _mav_put_float(buf, 8, resting_minimum_voltage); + _mav_put_float(buf, 12, charging_maximum_voltage); + _mav_put_float(buf, 16, charging_maximum_current); + _mav_put_float(buf, 20, nominal_voltage); + _mav_put_float(buf, 24, discharge_maximum_current); + _mav_put_float(buf, 28, discharge_maximum_burst_current); + _mav_put_float(buf, 32, design_capacity); + _mav_put_float(buf, 36, full_charge_capacity); + _mav_put_uint16_t(buf, 40, cycle_count); + _mav_put_uint16_t(buf, 42, weight); + _mav_put_uint8_t(buf, 44, id); + _mav_put_uint8_t(buf, 45, battery_function); + _mav_put_uint8_t(buf, 46, type); + _mav_put_uint8_t(buf, 47, state_of_health); + _mav_put_uint8_t(buf, 48, cells_in_series); + _mav_put_char_array(buf, 49, manufacture_date, 9); + _mav_put_char_array(buf, 58, serial_number, 32); + _mav_put_char_array(buf, 90, name, 50); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_BATTERY_INFO_LEN); +#else + mavlink_battery_info_t packet; + packet.discharge_minimum_voltage = discharge_minimum_voltage; + packet.charging_minimum_voltage = charging_minimum_voltage; + packet.resting_minimum_voltage = resting_minimum_voltage; + packet.charging_maximum_voltage = charging_maximum_voltage; + packet.charging_maximum_current = charging_maximum_current; + packet.nominal_voltage = nominal_voltage; + packet.discharge_maximum_current = discharge_maximum_current; + packet.discharge_maximum_burst_current = discharge_maximum_burst_current; + packet.design_capacity = design_capacity; + packet.full_charge_capacity = full_charge_capacity; + packet.cycle_count = cycle_count; + packet.weight = weight; + packet.id = id; + packet.battery_function = battery_function; + packet.type = type; + packet.state_of_health = state_of_health; + packet.cells_in_series = cells_in_series; + mav_array_assign_char(packet.manufacture_date, manufacture_date, 9); + mav_array_assign_char(packet.serial_number, serial_number, 32); + mav_array_assign_char(packet.name, name, 50); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_BATTERY_INFO_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_BATTERY_INFO; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_BATTERY_INFO_MIN_LEN, MAVLINK_MSG_ID_BATTERY_INFO_LEN, MAVLINK_MSG_ID_BATTERY_INFO_CRC); +} + +/** + * @brief Pack a battery_info message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param id Battery ID + * @param battery_function Function of the battery. + * @param type Type (chemistry) of the battery. + * @param state_of_health [%] State of Health (SOH) estimate. Typically 100% at the time of manufacture and will decrease over time and use. -1: field not provided. + * @param cells_in_series Number of battery cells in series. 0: field not provided. + * @param cycle_count Lifetime count of the number of charge/discharge cycles (https://en.wikipedia.org/wiki/Charge_cycle). UINT16_MAX: field not provided. + * @param weight [g] Battery weight. 0: field not provided. + * @param discharge_minimum_voltage [V] Minimum per-cell voltage when discharging. 0: field not provided. + * @param charging_minimum_voltage [V] Minimum per-cell voltage when charging. 0: field not provided. + * @param resting_minimum_voltage [V] Minimum per-cell voltage when resting. 0: field not provided. + * @param charging_maximum_voltage [V] Maximum per-cell voltage when charged. 0: field not provided. + * @param charging_maximum_current [A] Maximum pack continuous charge current. 0: field not provided. + * @param nominal_voltage [V] Battery nominal voltage. Used for conversion between Wh and Ah. 0: field not provided. + * @param discharge_maximum_current [A] Maximum pack discharge current. 0: field not provided. + * @param discharge_maximum_burst_current [A] Maximum pack discharge burst current. 0: field not provided. + * @param design_capacity [Ah] Fully charged design capacity. 0: field not provided. + * @param full_charge_capacity [Ah] Predicted battery capacity when fully charged (accounting for battery degradation). NAN: field not provided. + * @param manufacture_date Manufacture date (DDMMYYYY) in ASCII characters, 0 terminated. All 0: field not provided. + * @param serial_number Serial number in ASCII characters, 0 terminated. All 0: field not provided. + * @param name Battery device name. Formatted as manufacturer name then product name, separated with an underscore (in ASCII characters), 0 terminated. All 0: field not provided. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_battery_info_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t id, uint8_t battery_function, uint8_t type, uint8_t state_of_health, uint8_t cells_in_series, uint16_t cycle_count, uint16_t weight, float discharge_minimum_voltage, float charging_minimum_voltage, float resting_minimum_voltage, float charging_maximum_voltage, float charging_maximum_current, float nominal_voltage, float discharge_maximum_current, float discharge_maximum_burst_current, float design_capacity, float full_charge_capacity, const char *manufacture_date, const char *serial_number, const char *name) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_BATTERY_INFO_LEN]; + _mav_put_float(buf, 0, discharge_minimum_voltage); + _mav_put_float(buf, 4, charging_minimum_voltage); + _mav_put_float(buf, 8, resting_minimum_voltage); + _mav_put_float(buf, 12, charging_maximum_voltage); + _mav_put_float(buf, 16, charging_maximum_current); + _mav_put_float(buf, 20, nominal_voltage); + _mav_put_float(buf, 24, discharge_maximum_current); + _mav_put_float(buf, 28, discharge_maximum_burst_current); + _mav_put_float(buf, 32, design_capacity); + _mav_put_float(buf, 36, full_charge_capacity); + _mav_put_uint16_t(buf, 40, cycle_count); + _mav_put_uint16_t(buf, 42, weight); + _mav_put_uint8_t(buf, 44, id); + _mav_put_uint8_t(buf, 45, battery_function); + _mav_put_uint8_t(buf, 46, type); + _mav_put_uint8_t(buf, 47, state_of_health); + _mav_put_uint8_t(buf, 48, cells_in_series); + _mav_put_char_array(buf, 49, manufacture_date, 9); + _mav_put_char_array(buf, 58, serial_number, 32); + _mav_put_char_array(buf, 90, name, 50); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_BATTERY_INFO_LEN); +#else + mavlink_battery_info_t packet; + packet.discharge_minimum_voltage = discharge_minimum_voltage; + packet.charging_minimum_voltage = charging_minimum_voltage; + packet.resting_minimum_voltage = resting_minimum_voltage; + packet.charging_maximum_voltage = charging_maximum_voltage; + packet.charging_maximum_current = charging_maximum_current; + packet.nominal_voltage = nominal_voltage; + packet.discharge_maximum_current = discharge_maximum_current; + packet.discharge_maximum_burst_current = discharge_maximum_burst_current; + packet.design_capacity = design_capacity; + packet.full_charge_capacity = full_charge_capacity; + packet.cycle_count = cycle_count; + packet.weight = weight; + packet.id = id; + packet.battery_function = battery_function; + packet.type = type; + packet.state_of_health = state_of_health; + packet.cells_in_series = cells_in_series; + mav_array_memcpy(packet.manufacture_date, manufacture_date, sizeof(char)*9); + mav_array_memcpy(packet.serial_number, serial_number, sizeof(char)*32); + mav_array_memcpy(packet.name, name, sizeof(char)*50); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_BATTERY_INFO_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_BATTERY_INFO; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_BATTERY_INFO_MIN_LEN, MAVLINK_MSG_ID_BATTERY_INFO_LEN, MAVLINK_MSG_ID_BATTERY_INFO_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_BATTERY_INFO_MIN_LEN, MAVLINK_MSG_ID_BATTERY_INFO_LEN); +#endif +} + +/** + * @brief Pack a battery_info message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param id Battery ID + * @param battery_function Function of the battery. + * @param type Type (chemistry) of the battery. + * @param state_of_health [%] State of Health (SOH) estimate. Typically 100% at the time of manufacture and will decrease over time and use. -1: field not provided. + * @param cells_in_series Number of battery cells in series. 0: field not provided. + * @param cycle_count Lifetime count of the number of charge/discharge cycles (https://en.wikipedia.org/wiki/Charge_cycle). UINT16_MAX: field not provided. + * @param weight [g] Battery weight. 0: field not provided. + * @param discharge_minimum_voltage [V] Minimum per-cell voltage when discharging. 0: field not provided. + * @param charging_minimum_voltage [V] Minimum per-cell voltage when charging. 0: field not provided. + * @param resting_minimum_voltage [V] Minimum per-cell voltage when resting. 0: field not provided. + * @param charging_maximum_voltage [V] Maximum per-cell voltage when charged. 0: field not provided. + * @param charging_maximum_current [A] Maximum pack continuous charge current. 0: field not provided. + * @param nominal_voltage [V] Battery nominal voltage. Used for conversion between Wh and Ah. 0: field not provided. + * @param discharge_maximum_current [A] Maximum pack discharge current. 0: field not provided. + * @param discharge_maximum_burst_current [A] Maximum pack discharge burst current. 0: field not provided. + * @param design_capacity [Ah] Fully charged design capacity. 0: field not provided. + * @param full_charge_capacity [Ah] Predicted battery capacity when fully charged (accounting for battery degradation). NAN: field not provided. + * @param manufacture_date Manufacture date (DDMMYYYY) in ASCII characters, 0 terminated. All 0: field not provided. + * @param serial_number Serial number in ASCII characters, 0 terminated. All 0: field not provided. + * @param name Battery device name. Formatted as manufacturer name then product name, separated with an underscore (in ASCII characters), 0 terminated. All 0: field not provided. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_battery_info_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t id,uint8_t battery_function,uint8_t type,uint8_t state_of_health,uint8_t cells_in_series,uint16_t cycle_count,uint16_t weight,float discharge_minimum_voltage,float charging_minimum_voltage,float resting_minimum_voltage,float charging_maximum_voltage,float charging_maximum_current,float nominal_voltage,float discharge_maximum_current,float discharge_maximum_burst_current,float design_capacity,float full_charge_capacity,const char *manufacture_date,const char *serial_number,const char *name) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_BATTERY_INFO_LEN]; + _mav_put_float(buf, 0, discharge_minimum_voltage); + _mav_put_float(buf, 4, charging_minimum_voltage); + _mav_put_float(buf, 8, resting_minimum_voltage); + _mav_put_float(buf, 12, charging_maximum_voltage); + _mav_put_float(buf, 16, charging_maximum_current); + _mav_put_float(buf, 20, nominal_voltage); + _mav_put_float(buf, 24, discharge_maximum_current); + _mav_put_float(buf, 28, discharge_maximum_burst_current); + _mav_put_float(buf, 32, design_capacity); + _mav_put_float(buf, 36, full_charge_capacity); + _mav_put_uint16_t(buf, 40, cycle_count); + _mav_put_uint16_t(buf, 42, weight); + _mav_put_uint8_t(buf, 44, id); + _mav_put_uint8_t(buf, 45, battery_function); + _mav_put_uint8_t(buf, 46, type); + _mav_put_uint8_t(buf, 47, state_of_health); + _mav_put_uint8_t(buf, 48, cells_in_series); + _mav_put_char_array(buf, 49, manufacture_date, 9); + _mav_put_char_array(buf, 58, serial_number, 32); + _mav_put_char_array(buf, 90, name, 50); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_BATTERY_INFO_LEN); +#else + mavlink_battery_info_t packet; + packet.discharge_minimum_voltage = discharge_minimum_voltage; + packet.charging_minimum_voltage = charging_minimum_voltage; + packet.resting_minimum_voltage = resting_minimum_voltage; + packet.charging_maximum_voltage = charging_maximum_voltage; + packet.charging_maximum_current = charging_maximum_current; + packet.nominal_voltage = nominal_voltage; + packet.discharge_maximum_current = discharge_maximum_current; + packet.discharge_maximum_burst_current = discharge_maximum_burst_current; + packet.design_capacity = design_capacity; + packet.full_charge_capacity = full_charge_capacity; + packet.cycle_count = cycle_count; + packet.weight = weight; + packet.id = id; + packet.battery_function = battery_function; + packet.type = type; + packet.state_of_health = state_of_health; + packet.cells_in_series = cells_in_series; + mav_array_assign_char(packet.manufacture_date, manufacture_date, 9); + mav_array_assign_char(packet.serial_number, serial_number, 32); + mav_array_assign_char(packet.name, name, 50); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_BATTERY_INFO_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_BATTERY_INFO; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_BATTERY_INFO_MIN_LEN, MAVLINK_MSG_ID_BATTERY_INFO_LEN, MAVLINK_MSG_ID_BATTERY_INFO_CRC); +} + +/** + * @brief Encode a battery_info struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param battery_info C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_battery_info_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_battery_info_t* battery_info) +{ + return mavlink_msg_battery_info_pack(system_id, component_id, msg, battery_info->id, battery_info->battery_function, battery_info->type, battery_info->state_of_health, battery_info->cells_in_series, battery_info->cycle_count, battery_info->weight, battery_info->discharge_minimum_voltage, battery_info->charging_minimum_voltage, battery_info->resting_minimum_voltage, battery_info->charging_maximum_voltage, battery_info->charging_maximum_current, battery_info->nominal_voltage, battery_info->discharge_maximum_current, battery_info->discharge_maximum_burst_current, battery_info->design_capacity, battery_info->full_charge_capacity, battery_info->manufacture_date, battery_info->serial_number, battery_info->name); +} + +/** + * @brief Encode a battery_info struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param battery_info C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_battery_info_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_battery_info_t* battery_info) +{ + return mavlink_msg_battery_info_pack_chan(system_id, component_id, chan, msg, battery_info->id, battery_info->battery_function, battery_info->type, battery_info->state_of_health, battery_info->cells_in_series, battery_info->cycle_count, battery_info->weight, battery_info->discharge_minimum_voltage, battery_info->charging_minimum_voltage, battery_info->resting_minimum_voltage, battery_info->charging_maximum_voltage, battery_info->charging_maximum_current, battery_info->nominal_voltage, battery_info->discharge_maximum_current, battery_info->discharge_maximum_burst_current, battery_info->design_capacity, battery_info->full_charge_capacity, battery_info->manufacture_date, battery_info->serial_number, battery_info->name); +} + +/** + * @brief Encode a battery_info struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param battery_info C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_battery_info_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_battery_info_t* battery_info) +{ + return mavlink_msg_battery_info_pack_status(system_id, component_id, _status, msg, battery_info->id, battery_info->battery_function, battery_info->type, battery_info->state_of_health, battery_info->cells_in_series, battery_info->cycle_count, battery_info->weight, battery_info->discharge_minimum_voltage, battery_info->charging_minimum_voltage, battery_info->resting_minimum_voltage, battery_info->charging_maximum_voltage, battery_info->charging_maximum_current, battery_info->nominal_voltage, battery_info->discharge_maximum_current, battery_info->discharge_maximum_burst_current, battery_info->design_capacity, battery_info->full_charge_capacity, battery_info->manufacture_date, battery_info->serial_number, battery_info->name); +} + +/** + * @brief Send a battery_info message + * @param chan MAVLink channel to send the message + * + * @param id Battery ID + * @param battery_function Function of the battery. + * @param type Type (chemistry) of the battery. + * @param state_of_health [%] State of Health (SOH) estimate. Typically 100% at the time of manufacture and will decrease over time and use. -1: field not provided. + * @param cells_in_series Number of battery cells in series. 0: field not provided. + * @param cycle_count Lifetime count of the number of charge/discharge cycles (https://en.wikipedia.org/wiki/Charge_cycle). UINT16_MAX: field not provided. + * @param weight [g] Battery weight. 0: field not provided. + * @param discharge_minimum_voltage [V] Minimum per-cell voltage when discharging. 0: field not provided. + * @param charging_minimum_voltage [V] Minimum per-cell voltage when charging. 0: field not provided. + * @param resting_minimum_voltage [V] Minimum per-cell voltage when resting. 0: field not provided. + * @param charging_maximum_voltage [V] Maximum per-cell voltage when charged. 0: field not provided. + * @param charging_maximum_current [A] Maximum pack continuous charge current. 0: field not provided. + * @param nominal_voltage [V] Battery nominal voltage. Used for conversion between Wh and Ah. 0: field not provided. + * @param discharge_maximum_current [A] Maximum pack discharge current. 0: field not provided. + * @param discharge_maximum_burst_current [A] Maximum pack discharge burst current. 0: field not provided. + * @param design_capacity [Ah] Fully charged design capacity. 0: field not provided. + * @param full_charge_capacity [Ah] Predicted battery capacity when fully charged (accounting for battery degradation). NAN: field not provided. + * @param manufacture_date Manufacture date (DDMMYYYY) in ASCII characters, 0 terminated. All 0: field not provided. + * @param serial_number Serial number in ASCII characters, 0 terminated. All 0: field not provided. + * @param name Battery device name. Formatted as manufacturer name then product name, separated with an underscore (in ASCII characters), 0 terminated. All 0: field not provided. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_battery_info_send(mavlink_channel_t chan, uint8_t id, uint8_t battery_function, uint8_t type, uint8_t state_of_health, uint8_t cells_in_series, uint16_t cycle_count, uint16_t weight, float discharge_minimum_voltage, float charging_minimum_voltage, float resting_minimum_voltage, float charging_maximum_voltage, float charging_maximum_current, float nominal_voltage, float discharge_maximum_current, float discharge_maximum_burst_current, float design_capacity, float full_charge_capacity, const char *manufacture_date, const char *serial_number, const char *name) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_BATTERY_INFO_LEN]; + _mav_put_float(buf, 0, discharge_minimum_voltage); + _mav_put_float(buf, 4, charging_minimum_voltage); + _mav_put_float(buf, 8, resting_minimum_voltage); + _mav_put_float(buf, 12, charging_maximum_voltage); + _mav_put_float(buf, 16, charging_maximum_current); + _mav_put_float(buf, 20, nominal_voltage); + _mav_put_float(buf, 24, discharge_maximum_current); + _mav_put_float(buf, 28, discharge_maximum_burst_current); + _mav_put_float(buf, 32, design_capacity); + _mav_put_float(buf, 36, full_charge_capacity); + _mav_put_uint16_t(buf, 40, cycle_count); + _mav_put_uint16_t(buf, 42, weight); + _mav_put_uint8_t(buf, 44, id); + _mav_put_uint8_t(buf, 45, battery_function); + _mav_put_uint8_t(buf, 46, type); + _mav_put_uint8_t(buf, 47, state_of_health); + _mav_put_uint8_t(buf, 48, cells_in_series); + _mav_put_char_array(buf, 49, manufacture_date, 9); + _mav_put_char_array(buf, 58, serial_number, 32); + _mav_put_char_array(buf, 90, name, 50); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BATTERY_INFO, buf, MAVLINK_MSG_ID_BATTERY_INFO_MIN_LEN, MAVLINK_MSG_ID_BATTERY_INFO_LEN, MAVLINK_MSG_ID_BATTERY_INFO_CRC); +#else + mavlink_battery_info_t packet; + packet.discharge_minimum_voltage = discharge_minimum_voltage; + packet.charging_minimum_voltage = charging_minimum_voltage; + packet.resting_minimum_voltage = resting_minimum_voltage; + packet.charging_maximum_voltage = charging_maximum_voltage; + packet.charging_maximum_current = charging_maximum_current; + packet.nominal_voltage = nominal_voltage; + packet.discharge_maximum_current = discharge_maximum_current; + packet.discharge_maximum_burst_current = discharge_maximum_burst_current; + packet.design_capacity = design_capacity; + packet.full_charge_capacity = full_charge_capacity; + packet.cycle_count = cycle_count; + packet.weight = weight; + packet.id = id; + packet.battery_function = battery_function; + packet.type = type; + packet.state_of_health = state_of_health; + packet.cells_in_series = cells_in_series; + mav_array_assign_char(packet.manufacture_date, manufacture_date, 9); + mav_array_assign_char(packet.serial_number, serial_number, 32); + mav_array_assign_char(packet.name, name, 50); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BATTERY_INFO, (const char *)&packet, MAVLINK_MSG_ID_BATTERY_INFO_MIN_LEN, MAVLINK_MSG_ID_BATTERY_INFO_LEN, MAVLINK_MSG_ID_BATTERY_INFO_CRC); +#endif +} + +/** + * @brief Send a battery_info message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_battery_info_send_struct(mavlink_channel_t chan, const mavlink_battery_info_t* battery_info) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_battery_info_send(chan, battery_info->id, battery_info->battery_function, battery_info->type, battery_info->state_of_health, battery_info->cells_in_series, battery_info->cycle_count, battery_info->weight, battery_info->discharge_minimum_voltage, battery_info->charging_minimum_voltage, battery_info->resting_minimum_voltage, battery_info->charging_maximum_voltage, battery_info->charging_maximum_current, battery_info->nominal_voltage, battery_info->discharge_maximum_current, battery_info->discharge_maximum_burst_current, battery_info->design_capacity, battery_info->full_charge_capacity, battery_info->manufacture_date, battery_info->serial_number, battery_info->name); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BATTERY_INFO, (const char *)battery_info, MAVLINK_MSG_ID_BATTERY_INFO_MIN_LEN, MAVLINK_MSG_ID_BATTERY_INFO_LEN, MAVLINK_MSG_ID_BATTERY_INFO_CRC); +#endif +} + +#if MAVLINK_MSG_ID_BATTERY_INFO_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_battery_info_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t id, uint8_t battery_function, uint8_t type, uint8_t state_of_health, uint8_t cells_in_series, uint16_t cycle_count, uint16_t weight, float discharge_minimum_voltage, float charging_minimum_voltage, float resting_minimum_voltage, float charging_maximum_voltage, float charging_maximum_current, float nominal_voltage, float discharge_maximum_current, float discharge_maximum_burst_current, float design_capacity, float full_charge_capacity, const char *manufacture_date, const char *serial_number, const char *name) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_float(buf, 0, discharge_minimum_voltage); + _mav_put_float(buf, 4, charging_minimum_voltage); + _mav_put_float(buf, 8, resting_minimum_voltage); + _mav_put_float(buf, 12, charging_maximum_voltage); + _mav_put_float(buf, 16, charging_maximum_current); + _mav_put_float(buf, 20, nominal_voltage); + _mav_put_float(buf, 24, discharge_maximum_current); + _mav_put_float(buf, 28, discharge_maximum_burst_current); + _mav_put_float(buf, 32, design_capacity); + _mav_put_float(buf, 36, full_charge_capacity); + _mav_put_uint16_t(buf, 40, cycle_count); + _mav_put_uint16_t(buf, 42, weight); + _mav_put_uint8_t(buf, 44, id); + _mav_put_uint8_t(buf, 45, battery_function); + _mav_put_uint8_t(buf, 46, type); + _mav_put_uint8_t(buf, 47, state_of_health); + _mav_put_uint8_t(buf, 48, cells_in_series); + _mav_put_char_array(buf, 49, manufacture_date, 9); + _mav_put_char_array(buf, 58, serial_number, 32); + _mav_put_char_array(buf, 90, name, 50); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BATTERY_INFO, buf, MAVLINK_MSG_ID_BATTERY_INFO_MIN_LEN, MAVLINK_MSG_ID_BATTERY_INFO_LEN, MAVLINK_MSG_ID_BATTERY_INFO_CRC); +#else + mavlink_battery_info_t *packet = (mavlink_battery_info_t *)msgbuf; + packet->discharge_minimum_voltage = discharge_minimum_voltage; + packet->charging_minimum_voltage = charging_minimum_voltage; + packet->resting_minimum_voltage = resting_minimum_voltage; + packet->charging_maximum_voltage = charging_maximum_voltage; + packet->charging_maximum_current = charging_maximum_current; + packet->nominal_voltage = nominal_voltage; + packet->discharge_maximum_current = discharge_maximum_current; + packet->discharge_maximum_burst_current = discharge_maximum_burst_current; + packet->design_capacity = design_capacity; + packet->full_charge_capacity = full_charge_capacity; + packet->cycle_count = cycle_count; + packet->weight = weight; + packet->id = id; + packet->battery_function = battery_function; + packet->type = type; + packet->state_of_health = state_of_health; + packet->cells_in_series = cells_in_series; + mav_array_assign_char(packet->manufacture_date, manufacture_date, 9); + mav_array_assign_char(packet->serial_number, serial_number, 32); + mav_array_assign_char(packet->name, name, 50); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BATTERY_INFO, (const char *)packet, MAVLINK_MSG_ID_BATTERY_INFO_MIN_LEN, MAVLINK_MSG_ID_BATTERY_INFO_LEN, MAVLINK_MSG_ID_BATTERY_INFO_CRC); +#endif +} +#endif + +#endif + +// MESSAGE BATTERY_INFO UNPACKING + + +/** + * @brief Get field id from battery_info message + * + * @return Battery ID + */ +static inline uint8_t mavlink_msg_battery_info_get_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 44); +} + +/** + * @brief Get field battery_function from battery_info message + * + * @return Function of the battery. + */ +static inline uint8_t mavlink_msg_battery_info_get_battery_function(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 45); +} + +/** + * @brief Get field type from battery_info message + * + * @return Type (chemistry) of the battery. + */ +static inline uint8_t mavlink_msg_battery_info_get_type(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 46); +} + +/** + * @brief Get field state_of_health from battery_info message + * + * @return [%] State of Health (SOH) estimate. Typically 100% at the time of manufacture and will decrease over time and use. -1: field not provided. + */ +static inline uint8_t mavlink_msg_battery_info_get_state_of_health(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 47); +} + +/** + * @brief Get field cells_in_series from battery_info message + * + * @return Number of battery cells in series. 0: field not provided. + */ +static inline uint8_t mavlink_msg_battery_info_get_cells_in_series(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 48); +} + +/** + * @brief Get field cycle_count from battery_info message + * + * @return Lifetime count of the number of charge/discharge cycles (https://en.wikipedia.org/wiki/Charge_cycle). UINT16_MAX: field not provided. + */ +static inline uint16_t mavlink_msg_battery_info_get_cycle_count(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 40); +} + +/** + * @brief Get field weight from battery_info message + * + * @return [g] Battery weight. 0: field not provided. + */ +static inline uint16_t mavlink_msg_battery_info_get_weight(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 42); +} + +/** + * @brief Get field discharge_minimum_voltage from battery_info message + * + * @return [V] Minimum per-cell voltage when discharging. 0: field not provided. + */ +static inline float mavlink_msg_battery_info_get_discharge_minimum_voltage(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 0); +} + +/** + * @brief Get field charging_minimum_voltage from battery_info message + * + * @return [V] Minimum per-cell voltage when charging. 0: field not provided. + */ +static inline float mavlink_msg_battery_info_get_charging_minimum_voltage(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 4); +} + +/** + * @brief Get field resting_minimum_voltage from battery_info message + * + * @return [V] Minimum per-cell voltage when resting. 0: field not provided. + */ +static inline float mavlink_msg_battery_info_get_resting_minimum_voltage(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 8); +} + +/** + * @brief Get field charging_maximum_voltage from battery_info message + * + * @return [V] Maximum per-cell voltage when charged. 0: field not provided. + */ +static inline float mavlink_msg_battery_info_get_charging_maximum_voltage(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 12); +} + +/** + * @brief Get field charging_maximum_current from battery_info message + * + * @return [A] Maximum pack continuous charge current. 0: field not provided. + */ +static inline float mavlink_msg_battery_info_get_charging_maximum_current(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 16); +} + +/** + * @brief Get field nominal_voltage from battery_info message + * + * @return [V] Battery nominal voltage. Used for conversion between Wh and Ah. 0: field not provided. + */ +static inline float mavlink_msg_battery_info_get_nominal_voltage(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 20); +} + +/** + * @brief Get field discharge_maximum_current from battery_info message + * + * @return [A] Maximum pack discharge current. 0: field not provided. + */ +static inline float mavlink_msg_battery_info_get_discharge_maximum_current(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 24); +} + +/** + * @brief Get field discharge_maximum_burst_current from battery_info message + * + * @return [A] Maximum pack discharge burst current. 0: field not provided. + */ +static inline float mavlink_msg_battery_info_get_discharge_maximum_burst_current(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 28); +} + +/** + * @brief Get field design_capacity from battery_info message + * + * @return [Ah] Fully charged design capacity. 0: field not provided. + */ +static inline float mavlink_msg_battery_info_get_design_capacity(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 32); +} + +/** + * @brief Get field full_charge_capacity from battery_info message + * + * @return [Ah] Predicted battery capacity when fully charged (accounting for battery degradation). NAN: field not provided. + */ +static inline float mavlink_msg_battery_info_get_full_charge_capacity(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 36); +} + +/** + * @brief Get field manufacture_date from battery_info message + * + * @return Manufacture date (DDMMYYYY) in ASCII characters, 0 terminated. All 0: field not provided. + */ +static inline uint16_t mavlink_msg_battery_info_get_manufacture_date(const mavlink_message_t* msg, char *manufacture_date) +{ + return _MAV_RETURN_char_array(msg, manufacture_date, 9, 49); +} + +/** + * @brief Get field serial_number from battery_info message + * + * @return Serial number in ASCII characters, 0 terminated. All 0: field not provided. + */ +static inline uint16_t mavlink_msg_battery_info_get_serial_number(const mavlink_message_t* msg, char *serial_number) +{ + return _MAV_RETURN_char_array(msg, serial_number, 32, 58); +} + +/** + * @brief Get field name from battery_info message + * + * @return Battery device name. Formatted as manufacturer name then product name, separated with an underscore (in ASCII characters), 0 terminated. All 0: field not provided. + */ +static inline uint16_t mavlink_msg_battery_info_get_name(const mavlink_message_t* msg, char *name) +{ + return _MAV_RETURN_char_array(msg, name, 50, 90); +} + +/** + * @brief Decode a battery_info message into a struct + * + * @param msg The message to decode + * @param battery_info C-struct to decode the message contents into + */ +static inline void mavlink_msg_battery_info_decode(const mavlink_message_t* msg, mavlink_battery_info_t* battery_info) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + battery_info->discharge_minimum_voltage = mavlink_msg_battery_info_get_discharge_minimum_voltage(msg); + battery_info->charging_minimum_voltage = mavlink_msg_battery_info_get_charging_minimum_voltage(msg); + battery_info->resting_minimum_voltage = mavlink_msg_battery_info_get_resting_minimum_voltage(msg); + battery_info->charging_maximum_voltage = mavlink_msg_battery_info_get_charging_maximum_voltage(msg); + battery_info->charging_maximum_current = mavlink_msg_battery_info_get_charging_maximum_current(msg); + battery_info->nominal_voltage = mavlink_msg_battery_info_get_nominal_voltage(msg); + battery_info->discharge_maximum_current = mavlink_msg_battery_info_get_discharge_maximum_current(msg); + battery_info->discharge_maximum_burst_current = mavlink_msg_battery_info_get_discharge_maximum_burst_current(msg); + battery_info->design_capacity = mavlink_msg_battery_info_get_design_capacity(msg); + battery_info->full_charge_capacity = mavlink_msg_battery_info_get_full_charge_capacity(msg); + battery_info->cycle_count = mavlink_msg_battery_info_get_cycle_count(msg); + battery_info->weight = mavlink_msg_battery_info_get_weight(msg); + battery_info->id = mavlink_msg_battery_info_get_id(msg); + battery_info->battery_function = mavlink_msg_battery_info_get_battery_function(msg); + battery_info->type = mavlink_msg_battery_info_get_type(msg); + battery_info->state_of_health = mavlink_msg_battery_info_get_state_of_health(msg); + battery_info->cells_in_series = mavlink_msg_battery_info_get_cells_in_series(msg); + mavlink_msg_battery_info_get_manufacture_date(msg, battery_info->manufacture_date); + mavlink_msg_battery_info_get_serial_number(msg, battery_info->serial_number); + mavlink_msg_battery_info_get_name(msg, battery_info->name); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_BATTERY_INFO_LEN? msg->len : MAVLINK_MSG_ID_BATTERY_INFO_LEN; + memset(battery_info, 0, MAVLINK_MSG_ID_BATTERY_INFO_LEN); + memcpy(battery_info, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/common/mavlink_msg_battery_status.h b/common/mavlink_msg_battery_status.h index 084b2a388..aa7512064 100644 --- a/common/mavlink_msg_battery_status.h +++ b/common/mavlink_msg_battery_status.h @@ -100,6 +100,72 @@ typedef struct __mavlink_battery_status_t { static inline uint16_t mavlink_msg_battery_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t id, uint8_t battery_function, uint8_t type, int16_t temperature, const uint16_t *voltages, int16_t current_battery, int32_t current_consumed, int32_t energy_consumed, int8_t battery_remaining, int32_t time_remaining, uint8_t charge_state, const uint16_t *voltages_ext, uint8_t mode, uint32_t fault_bitmask) { +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_BATTERY_STATUS_LEN]; + _mav_put_int32_t(buf, 0, current_consumed); + _mav_put_int32_t(buf, 4, energy_consumed); + _mav_put_int16_t(buf, 8, temperature); + _mav_put_int16_t(buf, 30, current_battery); + _mav_put_uint8_t(buf, 32, id); + _mav_put_uint8_t(buf, 33, battery_function); + _mav_put_uint8_t(buf, 34, type); + _mav_put_int8_t(buf, 35, battery_remaining); + _mav_put_int32_t(buf, 36, time_remaining); + _mav_put_uint8_t(buf, 40, charge_state); + _mav_put_uint8_t(buf, 49, mode); + _mav_put_uint32_t(buf, 50, fault_bitmask); + _mav_put_uint16_t_array(buf, 10, voltages, 10); + _mav_put_uint16_t_array(buf, 41, voltages_ext, 4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_BATTERY_STATUS_LEN); +#else + mavlink_battery_status_t packet; + packet.current_consumed = current_consumed; + packet.energy_consumed = energy_consumed; + packet.temperature = temperature; + packet.current_battery = current_battery; + packet.id = id; + packet.battery_function = battery_function; + packet.type = type; + packet.battery_remaining = battery_remaining; + packet.time_remaining = time_remaining; + packet.charge_state = charge_state; + packet.mode = mode; + packet.fault_bitmask = fault_bitmask; + mav_array_assign_uint16_t(packet.voltages, voltages, 10); + mav_array_assign_uint16_t(packet.voltages_ext, voltages_ext, 4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_BATTERY_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_BATTERY_STATUS; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_BATTERY_STATUS_MIN_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_CRC); +} + +/** + * @brief Pack a battery_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param id Battery ID + * @param battery_function Function of the battery + * @param type Type (chemistry) of the battery + * @param temperature [cdegC] Temperature of the battery. INT16_MAX for unknown temperature. + * @param voltages [mV] Battery voltage of cells 1 to 10 (see voltages_ext for cells 11-14). Cells in this field above the valid cell count for this battery should have the UINT16_MAX value. If individual cell voltages are unknown or not measured for this battery, then the overall battery voltage should be filled in cell 0, with all others set to UINT16_MAX. If the voltage of the battery is greater than (UINT16_MAX - 1), then cell 0 should be set to (UINT16_MAX - 1), and cell 1 to the remaining voltage. This can be extended to multiple cells if the total voltage is greater than 2 * (UINT16_MAX - 1). + * @param current_battery [cA] Battery current, -1: autopilot does not measure the current + * @param current_consumed [mAh] Consumed charge, -1: autopilot does not provide consumption estimate + * @param energy_consumed [hJ] Consumed energy, -1: autopilot does not provide energy consumption estimate + * @param battery_remaining [%] Remaining battery energy. Values: [0-100], -1: autopilot does not estimate the remaining battery. + * @param time_remaining [s] Remaining battery time, 0: autopilot does not provide remaining battery time estimate + * @param charge_state State for extent of discharge, provided by autopilot for warning or external reactions + * @param voltages_ext [mV] Battery voltages for cells 11 to 14. Cells above the valid cell count for this battery should have a value of 0, where zero indicates not supported (note, this is different than for the voltages field and allows empty byte truncation). If the measured value is 0 then 1 should be sent instead. + * @param mode Battery mode. Default (0) is that battery mode reporting is not supported or battery is in normal-use mode. + * @param fault_bitmask Fault/health indications. These should be set when charge_state is MAV_BATTERY_CHARGE_STATE_FAILED or MAV_BATTERY_CHARGE_STATE_UNHEALTHY (if not, fault reporting is not supported). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_battery_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t id, uint8_t battery_function, uint8_t type, int16_t temperature, const uint16_t *voltages, int16_t current_battery, int32_t current_consumed, int32_t energy_consumed, int8_t battery_remaining, int32_t time_remaining, uint8_t charge_state, const uint16_t *voltages_ext, uint8_t mode, uint32_t fault_bitmask) +{ #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_BATTERY_STATUS_LEN]; _mav_put_int32_t(buf, 0, current_consumed); @@ -137,7 +203,11 @@ static inline uint16_t mavlink_msg_battery_status_pack(uint8_t system_id, uint8_ #endif msg->msgid = MAVLINK_MSG_ID_BATTERY_STATUS; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_BATTERY_STATUS_MIN_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_CRC); +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_BATTERY_STATUS_MIN_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_BATTERY_STATUS_MIN_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_LEN); +#endif } /** @@ -197,8 +267,8 @@ static inline uint16_t mavlink_msg_battery_status_pack_chan(uint8_t system_id, u packet.charge_state = charge_state; packet.mode = mode; packet.fault_bitmask = fault_bitmask; - mav_array_memcpy(packet.voltages, voltages, sizeof(uint16_t)*10); - mav_array_memcpy(packet.voltages_ext, voltages_ext, sizeof(uint16_t)*4); + mav_array_assign_uint16_t(packet.voltages, voltages, 10); + mav_array_assign_uint16_t(packet.voltages_ext, voltages_ext, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_BATTERY_STATUS_LEN); #endif @@ -233,6 +303,20 @@ static inline uint16_t mavlink_msg_battery_status_encode_chan(uint8_t system_id, return mavlink_msg_battery_status_pack_chan(system_id, component_id, chan, msg, battery_status->id, battery_status->battery_function, battery_status->type, battery_status->temperature, battery_status->voltages, battery_status->current_battery, battery_status->current_consumed, battery_status->energy_consumed, battery_status->battery_remaining, battery_status->time_remaining, battery_status->charge_state, battery_status->voltages_ext, battery_status->mode, battery_status->fault_bitmask); } +/** + * @brief Encode a battery_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param battery_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_battery_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_battery_status_t* battery_status) +{ + return mavlink_msg_battery_status_pack_status(system_id, component_id, _status, msg, battery_status->id, battery_status->battery_function, battery_status->type, battery_status->temperature, battery_status->voltages, battery_status->current_battery, battery_status->current_consumed, battery_status->energy_consumed, battery_status->battery_remaining, battery_status->time_remaining, battery_status->charge_state, battery_status->voltages_ext, battery_status->mode, battery_status->fault_bitmask); +} + /** * @brief Send a battery_status message * @param chan MAVLink channel to send the message @@ -287,8 +371,8 @@ static inline void mavlink_msg_battery_status_send(mavlink_channel_t chan, uint8 packet.charge_state = charge_state; packet.mode = mode; packet.fault_bitmask = fault_bitmask; - mav_array_memcpy(packet.voltages, voltages, sizeof(uint16_t)*10); - mav_array_memcpy(packet.voltages_ext, voltages_ext, sizeof(uint16_t)*4); + mav_array_assign_uint16_t(packet.voltages, voltages, 10); + mav_array_assign_uint16_t(packet.voltages_ext, voltages_ext, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BATTERY_STATUS, (const char *)&packet, MAVLINK_MSG_ID_BATTERY_STATUS_MIN_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_CRC); #endif } @@ -309,7 +393,7 @@ static inline void mavlink_msg_battery_status_send_struct(mavlink_channel_t chan #if MAVLINK_MSG_ID_BATTERY_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -348,8 +432,8 @@ static inline void mavlink_msg_battery_status_send_buf(mavlink_message_t *msgbuf packet->charge_state = charge_state; packet->mode = mode; packet->fault_bitmask = fault_bitmask; - mav_array_memcpy(packet->voltages, voltages, sizeof(uint16_t)*10); - mav_array_memcpy(packet->voltages_ext, voltages_ext, sizeof(uint16_t)*4); + mav_array_assign_uint16_t(packet->voltages, voltages, 10); + mav_array_assign_uint16_t(packet->voltages_ext, voltages_ext, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BATTERY_STATUS, (const char *)packet, MAVLINK_MSG_ID_BATTERY_STATUS_MIN_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_CRC); #endif } diff --git a/common/mavlink_msg_button_change.h b/common/mavlink_msg_button_change.h index 831bc60fc..d29988bc6 100644 --- a/common/mavlink_msg_button_change.h +++ b/common/mavlink_msg_button_change.h @@ -75,6 +75,45 @@ static inline uint16_t mavlink_msg_button_change_pack(uint8_t system_id, uint8_t return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_BUTTON_CHANGE_MIN_LEN, MAVLINK_MSG_ID_BUTTON_CHANGE_LEN, MAVLINK_MSG_ID_BUTTON_CHANGE_CRC); } +/** + * @brief Pack a button_change message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param last_change_ms [ms] Time of last change of button state. + * @param state Bitmap for state of buttons. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_button_change_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, uint32_t last_change_ms, uint8_t state) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_BUTTON_CHANGE_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_uint32_t(buf, 4, last_change_ms); + _mav_put_uint8_t(buf, 8, state); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_BUTTON_CHANGE_LEN); +#else + mavlink_button_change_t packet; + packet.time_boot_ms = time_boot_ms; + packet.last_change_ms = last_change_ms; + packet.state = state; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_BUTTON_CHANGE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_BUTTON_CHANGE; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_BUTTON_CHANGE_MIN_LEN, MAVLINK_MSG_ID_BUTTON_CHANGE_LEN, MAVLINK_MSG_ID_BUTTON_CHANGE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_BUTTON_CHANGE_MIN_LEN, MAVLINK_MSG_ID_BUTTON_CHANGE_LEN); +#endif +} + /** * @brief Pack a button_change message on a channel * @param system_id ID of this system @@ -137,6 +176,20 @@ static inline uint16_t mavlink_msg_button_change_encode_chan(uint8_t system_id, return mavlink_msg_button_change_pack_chan(system_id, component_id, chan, msg, button_change->time_boot_ms, button_change->last_change_ms, button_change->state); } +/** + * @brief Encode a button_change struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param button_change C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_button_change_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_button_change_t* button_change) +{ + return mavlink_msg_button_change_pack_status(system_id, component_id, _status, msg, button_change->time_boot_ms, button_change->last_change_ms, button_change->state); +} + /** * @brief Send a button_change message * @param chan MAVLink channel to send the message @@ -182,7 +235,7 @@ static inline void mavlink_msg_button_change_send_struct(mavlink_channel_t chan, #if MAVLINK_MSG_ID_BUTTON_CHANGE_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_camera_capture_status.h b/common/mavlink_msg_camera_capture_status.h index 8951db6a7..35024f92b 100644 --- a/common/mavlink_msg_camera_capture_status.h +++ b/common/mavlink_msg_camera_capture_status.h @@ -7,16 +7,17 @@ MAVPACKED( typedef struct __mavlink_camera_capture_status_t { uint32_t time_boot_ms; /*< [ms] Timestamp (time since system boot).*/ float image_interval; /*< [s] Image capture interval*/ - uint32_t recording_time_ms; /*< [ms] Time since recording started*/ + uint32_t recording_time_ms; /*< [ms] Elapsed time since recording started (0: Not supported/available). A GCS should compute recording time and use non-zero values of this field to correct any discrepancy.*/ float available_capacity; /*< [MiB] Available storage capacity.*/ uint8_t image_status; /*< Current status of image capturing (0: idle, 1: capture in progress, 2: interval set but idle, 3: interval set and capture in progress)*/ uint8_t video_status; /*< Current status of video capturing (0: idle, 1: capture in progress)*/ int32_t image_count; /*< Total number of images captured ('forever', or until reset using MAV_CMD_STORAGE_FORMAT).*/ + uint8_t camera_device_id; /*< Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id).*/ }) mavlink_camera_capture_status_t; -#define MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN 22 +#define MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN 23 #define MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_MIN_LEN 18 -#define MAVLINK_MSG_ID_262_LEN 22 +#define MAVLINK_MSG_ID_262_LEN 23 #define MAVLINK_MSG_ID_262_MIN_LEN 18 #define MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_CRC 12 @@ -28,7 +29,7 @@ typedef struct __mavlink_camera_capture_status_t { #define MAVLINK_MESSAGE_INFO_CAMERA_CAPTURE_STATUS { \ 262, \ "CAMERA_CAPTURE_STATUS", \ - 7, \ + 8, \ { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_camera_capture_status_t, time_boot_ms) }, \ { "image_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_camera_capture_status_t, image_status) }, \ { "video_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 17, offsetof(mavlink_camera_capture_status_t, video_status) }, \ @@ -36,12 +37,13 @@ typedef struct __mavlink_camera_capture_status_t { { "recording_time_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_camera_capture_status_t, recording_time_ms) }, \ { "available_capacity", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_camera_capture_status_t, available_capacity) }, \ { "image_count", NULL, MAVLINK_TYPE_INT32_T, 0, 18, offsetof(mavlink_camera_capture_status_t, image_count) }, \ + { "camera_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 22, offsetof(mavlink_camera_capture_status_t, camera_device_id) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_CAMERA_CAPTURE_STATUS { \ "CAMERA_CAPTURE_STATUS", \ - 7, \ + 8, \ { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_camera_capture_status_t, time_boot_ms) }, \ { "image_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_camera_capture_status_t, image_status) }, \ { "video_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 17, offsetof(mavlink_camera_capture_status_t, video_status) }, \ @@ -49,6 +51,7 @@ typedef struct __mavlink_camera_capture_status_t { { "recording_time_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_camera_capture_status_t, recording_time_ms) }, \ { "available_capacity", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_camera_capture_status_t, available_capacity) }, \ { "image_count", NULL, MAVLINK_TYPE_INT32_T, 0, 18, offsetof(mavlink_camera_capture_status_t, image_count) }, \ + { "camera_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 22, offsetof(mavlink_camera_capture_status_t, camera_device_id) }, \ } \ } #endif @@ -63,13 +66,14 @@ typedef struct __mavlink_camera_capture_status_t { * @param image_status Current status of image capturing (0: idle, 1: capture in progress, 2: interval set but idle, 3: interval set and capture in progress) * @param video_status Current status of video capturing (0: idle, 1: capture in progress) * @param image_interval [s] Image capture interval - * @param recording_time_ms [ms] Time since recording started + * @param recording_time_ms [ms] Elapsed time since recording started (0: Not supported/available). A GCS should compute recording time and use non-zero values of this field to correct any discrepancy. * @param available_capacity [MiB] Available storage capacity. * @param image_count Total number of images captured ('forever', or until reset using MAV_CMD_STORAGE_FORMAT). + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_camera_capture_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint32_t time_boot_ms, uint8_t image_status, uint8_t video_status, float image_interval, uint32_t recording_time_ms, float available_capacity, int32_t image_count) + uint32_t time_boot_ms, uint8_t image_status, uint8_t video_status, float image_interval, uint32_t recording_time_ms, float available_capacity, int32_t image_count, uint8_t camera_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN]; @@ -80,6 +84,7 @@ static inline uint16_t mavlink_msg_camera_capture_status_pack(uint8_t system_id, _mav_put_uint8_t(buf, 16, image_status); _mav_put_uint8_t(buf, 17, video_status); _mav_put_int32_t(buf, 18, image_count); + _mav_put_uint8_t(buf, 22, camera_device_id); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN); #else @@ -91,6 +96,7 @@ static inline uint16_t mavlink_msg_camera_capture_status_pack(uint8_t system_id, packet.image_status = image_status; packet.video_status = video_status; packet.image_count = image_count; + packet.camera_device_id = camera_device_id; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN); #endif @@ -99,6 +105,60 @@ static inline uint16_t mavlink_msg_camera_capture_status_pack(uint8_t system_id, return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_CRC); } +/** + * @brief Pack a camera_capture_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param image_status Current status of image capturing (0: idle, 1: capture in progress, 2: interval set but idle, 3: interval set and capture in progress) + * @param video_status Current status of video capturing (0: idle, 1: capture in progress) + * @param image_interval [s] Image capture interval + * @param recording_time_ms [ms] Elapsed time since recording started (0: Not supported/available). A GCS should compute recording time and use non-zero values of this field to correct any discrepancy. + * @param available_capacity [MiB] Available storage capacity. + * @param image_count Total number of images captured ('forever', or until reset using MAV_CMD_STORAGE_FORMAT). + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_camera_capture_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, uint8_t image_status, uint8_t video_status, float image_interval, uint32_t recording_time_ms, float available_capacity, int32_t image_count, uint8_t camera_device_id) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_float(buf, 4, image_interval); + _mav_put_uint32_t(buf, 8, recording_time_ms); + _mav_put_float(buf, 12, available_capacity); + _mav_put_uint8_t(buf, 16, image_status); + _mav_put_uint8_t(buf, 17, video_status); + _mav_put_int32_t(buf, 18, image_count); + _mav_put_uint8_t(buf, 22, camera_device_id); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN); +#else + mavlink_camera_capture_status_t packet; + packet.time_boot_ms = time_boot_ms; + packet.image_interval = image_interval; + packet.recording_time_ms = recording_time_ms; + packet.available_capacity = available_capacity; + packet.image_status = image_status; + packet.video_status = video_status; + packet.image_count = image_count; + packet.camera_device_id = camera_device_id; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN); +#endif +} + /** * @brief Pack a camera_capture_status message on a channel * @param system_id ID of this system @@ -109,14 +169,15 @@ static inline uint16_t mavlink_msg_camera_capture_status_pack(uint8_t system_id, * @param image_status Current status of image capturing (0: idle, 1: capture in progress, 2: interval set but idle, 3: interval set and capture in progress) * @param video_status Current status of video capturing (0: idle, 1: capture in progress) * @param image_interval [s] Image capture interval - * @param recording_time_ms [ms] Time since recording started + * @param recording_time_ms [ms] Elapsed time since recording started (0: Not supported/available). A GCS should compute recording time and use non-zero values of this field to correct any discrepancy. * @param available_capacity [MiB] Available storage capacity. * @param image_count Total number of images captured ('forever', or until reset using MAV_CMD_STORAGE_FORMAT). + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_camera_capture_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - uint32_t time_boot_ms,uint8_t image_status,uint8_t video_status,float image_interval,uint32_t recording_time_ms,float available_capacity,int32_t image_count) + uint32_t time_boot_ms,uint8_t image_status,uint8_t video_status,float image_interval,uint32_t recording_time_ms,float available_capacity,int32_t image_count,uint8_t camera_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN]; @@ -127,6 +188,7 @@ static inline uint16_t mavlink_msg_camera_capture_status_pack_chan(uint8_t syste _mav_put_uint8_t(buf, 16, image_status); _mav_put_uint8_t(buf, 17, video_status); _mav_put_int32_t(buf, 18, image_count); + _mav_put_uint8_t(buf, 22, camera_device_id); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN); #else @@ -138,6 +200,7 @@ static inline uint16_t mavlink_msg_camera_capture_status_pack_chan(uint8_t syste packet.image_status = image_status; packet.video_status = video_status; packet.image_count = image_count; + packet.camera_device_id = camera_device_id; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN); #endif @@ -156,7 +219,7 @@ static inline uint16_t mavlink_msg_camera_capture_status_pack_chan(uint8_t syste */ static inline uint16_t mavlink_msg_camera_capture_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_camera_capture_status_t* camera_capture_status) { - return mavlink_msg_camera_capture_status_pack(system_id, component_id, msg, camera_capture_status->time_boot_ms, camera_capture_status->image_status, camera_capture_status->video_status, camera_capture_status->image_interval, camera_capture_status->recording_time_ms, camera_capture_status->available_capacity, camera_capture_status->image_count); + return mavlink_msg_camera_capture_status_pack(system_id, component_id, msg, camera_capture_status->time_boot_ms, camera_capture_status->image_status, camera_capture_status->video_status, camera_capture_status->image_interval, camera_capture_status->recording_time_ms, camera_capture_status->available_capacity, camera_capture_status->image_count, camera_capture_status->camera_device_id); } /** @@ -170,7 +233,21 @@ static inline uint16_t mavlink_msg_camera_capture_status_encode(uint8_t system_i */ static inline uint16_t mavlink_msg_camera_capture_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_camera_capture_status_t* camera_capture_status) { - return mavlink_msg_camera_capture_status_pack_chan(system_id, component_id, chan, msg, camera_capture_status->time_boot_ms, camera_capture_status->image_status, camera_capture_status->video_status, camera_capture_status->image_interval, camera_capture_status->recording_time_ms, camera_capture_status->available_capacity, camera_capture_status->image_count); + return mavlink_msg_camera_capture_status_pack_chan(system_id, component_id, chan, msg, camera_capture_status->time_boot_ms, camera_capture_status->image_status, camera_capture_status->video_status, camera_capture_status->image_interval, camera_capture_status->recording_time_ms, camera_capture_status->available_capacity, camera_capture_status->image_count, camera_capture_status->camera_device_id); +} + +/** + * @brief Encode a camera_capture_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param camera_capture_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_camera_capture_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_camera_capture_status_t* camera_capture_status) +{ + return mavlink_msg_camera_capture_status_pack_status(system_id, component_id, _status, msg, camera_capture_status->time_boot_ms, camera_capture_status->image_status, camera_capture_status->video_status, camera_capture_status->image_interval, camera_capture_status->recording_time_ms, camera_capture_status->available_capacity, camera_capture_status->image_count, camera_capture_status->camera_device_id); } /** @@ -181,13 +258,14 @@ static inline uint16_t mavlink_msg_camera_capture_status_encode_chan(uint8_t sys * @param image_status Current status of image capturing (0: idle, 1: capture in progress, 2: interval set but idle, 3: interval set and capture in progress) * @param video_status Current status of video capturing (0: idle, 1: capture in progress) * @param image_interval [s] Image capture interval - * @param recording_time_ms [ms] Time since recording started + * @param recording_time_ms [ms] Elapsed time since recording started (0: Not supported/available). A GCS should compute recording time and use non-zero values of this field to correct any discrepancy. * @param available_capacity [MiB] Available storage capacity. * @param image_count Total number of images captured ('forever', or until reset using MAV_CMD_STORAGE_FORMAT). + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_camera_capture_status_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t image_status, uint8_t video_status, float image_interval, uint32_t recording_time_ms, float available_capacity, int32_t image_count) +static inline void mavlink_msg_camera_capture_status_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t image_status, uint8_t video_status, float image_interval, uint32_t recording_time_ms, float available_capacity, int32_t image_count, uint8_t camera_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN]; @@ -198,6 +276,7 @@ static inline void mavlink_msg_camera_capture_status_send(mavlink_channel_t chan _mav_put_uint8_t(buf, 16, image_status); _mav_put_uint8_t(buf, 17, video_status); _mav_put_int32_t(buf, 18, image_count); + _mav_put_uint8_t(buf, 22, camera_device_id); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS, buf, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_CRC); #else @@ -209,6 +288,7 @@ static inline void mavlink_msg_camera_capture_status_send(mavlink_channel_t chan packet.image_status = image_status; packet.video_status = video_status; packet.image_count = image_count; + packet.camera_device_id = camera_device_id; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS, (const char *)&packet, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_CRC); #endif @@ -222,7 +302,7 @@ static inline void mavlink_msg_camera_capture_status_send(mavlink_channel_t chan static inline void mavlink_msg_camera_capture_status_send_struct(mavlink_channel_t chan, const mavlink_camera_capture_status_t* camera_capture_status) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_camera_capture_status_send(chan, camera_capture_status->time_boot_ms, camera_capture_status->image_status, camera_capture_status->video_status, camera_capture_status->image_interval, camera_capture_status->recording_time_ms, camera_capture_status->available_capacity, camera_capture_status->image_count); + mavlink_msg_camera_capture_status_send(chan, camera_capture_status->time_boot_ms, camera_capture_status->image_status, camera_capture_status->video_status, camera_capture_status->image_interval, camera_capture_status->recording_time_ms, camera_capture_status->available_capacity, camera_capture_status->image_count, camera_capture_status->camera_device_id); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS, (const char *)camera_capture_status, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_CRC); #endif @@ -230,13 +310,13 @@ static inline void mavlink_msg_camera_capture_status_send_struct(mavlink_channel #if MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_camera_capture_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t image_status, uint8_t video_status, float image_interval, uint32_t recording_time_ms, float available_capacity, int32_t image_count) +static inline void mavlink_msg_camera_capture_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t image_status, uint8_t video_status, float image_interval, uint32_t recording_time_ms, float available_capacity, int32_t image_count, uint8_t camera_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; @@ -247,6 +327,7 @@ static inline void mavlink_msg_camera_capture_status_send_buf(mavlink_message_t _mav_put_uint8_t(buf, 16, image_status); _mav_put_uint8_t(buf, 17, video_status); _mav_put_int32_t(buf, 18, image_count); + _mav_put_uint8_t(buf, 22, camera_device_id); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS, buf, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_CRC); #else @@ -258,6 +339,7 @@ static inline void mavlink_msg_camera_capture_status_send_buf(mavlink_message_t packet->image_status = image_status; packet->video_status = video_status; packet->image_count = image_count; + packet->camera_device_id = camera_device_id; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS, (const char *)packet, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_CRC); #endif @@ -312,7 +394,7 @@ static inline float mavlink_msg_camera_capture_status_get_image_interval(const m /** * @brief Get field recording_time_ms from camera_capture_status message * - * @return [ms] Time since recording started + * @return [ms] Elapsed time since recording started (0: Not supported/available). A GCS should compute recording time and use non-zero values of this field to correct any discrepancy. */ static inline uint32_t mavlink_msg_camera_capture_status_get_recording_time_ms(const mavlink_message_t* msg) { @@ -339,6 +421,16 @@ static inline int32_t mavlink_msg_camera_capture_status_get_image_count(const ma return _MAV_RETURN_int32_t(msg, 18); } +/** + * @brief Get field camera_device_id from camera_capture_status message + * + * @return Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). + */ +static inline uint8_t mavlink_msg_camera_capture_status_get_camera_device_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 22); +} + /** * @brief Decode a camera_capture_status message into a struct * @@ -355,6 +447,7 @@ static inline void mavlink_msg_camera_capture_status_decode(const mavlink_messag camera_capture_status->image_status = mavlink_msg_camera_capture_status_get_image_status(msg); camera_capture_status->video_status = mavlink_msg_camera_capture_status_get_video_status(msg); camera_capture_status->image_count = mavlink_msg_camera_capture_status_get_image_count(msg); + camera_capture_status->camera_device_id = mavlink_msg_camera_capture_status_get_camera_device_id(msg); #else uint8_t len = msg->len < MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN? msg->len : MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN; memset(camera_capture_status, 0, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN); diff --git a/common/mavlink_msg_camera_fov_status.h b/common/mavlink_msg_camera_fov_status.h index 6378e56aa..ee8a06dc1 100644 --- a/common/mavlink_msg_camera_fov_status.h +++ b/common/mavlink_msg_camera_fov_status.h @@ -15,11 +15,12 @@ typedef struct __mavlink_camera_fov_status_t { float q[4]; /*< Quaternion of camera orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0)*/ float hfov; /*< [deg] Horizontal field of view (NaN if unknown).*/ float vfov; /*< [deg] Vertical field of view (NaN if unknown).*/ + uint8_t camera_device_id; /*< Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id).*/ } mavlink_camera_fov_status_t; -#define MAVLINK_MSG_ID_CAMERA_FOV_STATUS_LEN 52 +#define MAVLINK_MSG_ID_CAMERA_FOV_STATUS_LEN 53 #define MAVLINK_MSG_ID_CAMERA_FOV_STATUS_MIN_LEN 52 -#define MAVLINK_MSG_ID_271_LEN 52 +#define MAVLINK_MSG_ID_271_LEN 53 #define MAVLINK_MSG_ID_271_MIN_LEN 52 #define MAVLINK_MSG_ID_CAMERA_FOV_STATUS_CRC 22 @@ -31,7 +32,7 @@ typedef struct __mavlink_camera_fov_status_t { #define MAVLINK_MESSAGE_INFO_CAMERA_FOV_STATUS { \ 271, \ "CAMERA_FOV_STATUS", \ - 10, \ + 11, \ { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_camera_fov_status_t, time_boot_ms) }, \ { "lat_camera", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_camera_fov_status_t, lat_camera) }, \ { "lon_camera", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_camera_fov_status_t, lon_camera) }, \ @@ -42,12 +43,13 @@ typedef struct __mavlink_camera_fov_status_t { { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 28, offsetof(mavlink_camera_fov_status_t, q) }, \ { "hfov", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_camera_fov_status_t, hfov) }, \ { "vfov", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_camera_fov_status_t, vfov) }, \ + { "camera_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 52, offsetof(mavlink_camera_fov_status_t, camera_device_id) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_CAMERA_FOV_STATUS { \ "CAMERA_FOV_STATUS", \ - 10, \ + 11, \ { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_camera_fov_status_t, time_boot_ms) }, \ { "lat_camera", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_camera_fov_status_t, lat_camera) }, \ { "lon_camera", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_camera_fov_status_t, lon_camera) }, \ @@ -58,6 +60,7 @@ typedef struct __mavlink_camera_fov_status_t { { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 28, offsetof(mavlink_camera_fov_status_t, q) }, \ { "hfov", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_camera_fov_status_t, hfov) }, \ { "vfov", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_camera_fov_status_t, vfov) }, \ + { "camera_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 52, offsetof(mavlink_camera_fov_status_t, camera_device_id) }, \ } \ } #endif @@ -78,10 +81,11 @@ typedef struct __mavlink_camera_fov_status_t { * @param q Quaternion of camera orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0) * @param hfov [deg] Horizontal field of view (NaN if unknown). * @param vfov [deg] Vertical field of view (NaN if unknown). + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_camera_fov_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint32_t time_boot_ms, int32_t lat_camera, int32_t lon_camera, int32_t alt_camera, int32_t lat_image, int32_t lon_image, int32_t alt_image, const float *q, float hfov, float vfov) + uint32_t time_boot_ms, int32_t lat_camera, int32_t lon_camera, int32_t alt_camera, int32_t lat_image, int32_t lon_image, int32_t alt_image, const float *q, float hfov, float vfov, uint8_t camera_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_CAMERA_FOV_STATUS_LEN]; @@ -94,6 +98,7 @@ static inline uint16_t mavlink_msg_camera_fov_status_pack(uint8_t system_id, uin _mav_put_int32_t(buf, 24, alt_image); _mav_put_float(buf, 44, hfov); _mav_put_float(buf, 48, vfov); + _mav_put_uint8_t(buf, 52, camera_device_id); _mav_put_float_array(buf, 28, q, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_FOV_STATUS_LEN); #else @@ -107,7 +112,8 @@ static inline uint16_t mavlink_msg_camera_fov_status_pack(uint8_t system_id, uin packet.alt_image = alt_image; packet.hfov = hfov; packet.vfov = vfov; - mav_array_memcpy(packet.q, q, sizeof(float)*4); + packet.camera_device_id = camera_device_id; + mav_array_assign_float(packet.q, q, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_FOV_STATUS_LEN); #endif @@ -115,6 +121,67 @@ static inline uint16_t mavlink_msg_camera_fov_status_pack(uint8_t system_id, uin return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CAMERA_FOV_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_FOV_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_FOV_STATUS_CRC); } +/** + * @brief Pack a camera_fov_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param lat_camera [degE7] Latitude of camera (INT32_MAX if unknown). + * @param lon_camera [degE7] Longitude of camera (INT32_MAX if unknown). + * @param alt_camera [mm] Altitude (MSL) of camera (INT32_MAX if unknown). + * @param lat_image [degE7] Latitude of center of image (INT32_MAX if unknown, INT32_MIN if at infinity, not intersecting with horizon). + * @param lon_image [degE7] Longitude of center of image (INT32_MAX if unknown, INT32_MIN if at infinity, not intersecting with horizon). + * @param alt_image [mm] Altitude (MSL) of center of image (INT32_MAX if unknown, INT32_MIN if at infinity, not intersecting with horizon). + * @param q Quaternion of camera orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0) + * @param hfov [deg] Horizontal field of view (NaN if unknown). + * @param vfov [deg] Vertical field of view (NaN if unknown). + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_camera_fov_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, int32_t lat_camera, int32_t lon_camera, int32_t alt_camera, int32_t lat_image, int32_t lon_image, int32_t alt_image, const float *q, float hfov, float vfov, uint8_t camera_device_id) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CAMERA_FOV_STATUS_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_int32_t(buf, 4, lat_camera); + _mav_put_int32_t(buf, 8, lon_camera); + _mav_put_int32_t(buf, 12, alt_camera); + _mav_put_int32_t(buf, 16, lat_image); + _mav_put_int32_t(buf, 20, lon_image); + _mav_put_int32_t(buf, 24, alt_image); + _mav_put_float(buf, 44, hfov); + _mav_put_float(buf, 48, vfov); + _mav_put_uint8_t(buf, 52, camera_device_id); + _mav_put_float_array(buf, 28, q, 4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_FOV_STATUS_LEN); +#else + mavlink_camera_fov_status_t packet; + packet.time_boot_ms = time_boot_ms; + packet.lat_camera = lat_camera; + packet.lon_camera = lon_camera; + packet.alt_camera = alt_camera; + packet.lat_image = lat_image; + packet.lon_image = lon_image; + packet.alt_image = alt_image; + packet.hfov = hfov; + packet.vfov = vfov; + packet.camera_device_id = camera_device_id; + mav_array_memcpy(packet.q, q, sizeof(float)*4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_FOV_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CAMERA_FOV_STATUS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CAMERA_FOV_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_FOV_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_FOV_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CAMERA_FOV_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_FOV_STATUS_LEN); +#endif +} + /** * @brief Pack a camera_fov_status message on a channel * @param system_id ID of this system @@ -131,11 +198,12 @@ static inline uint16_t mavlink_msg_camera_fov_status_pack(uint8_t system_id, uin * @param q Quaternion of camera orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0) * @param hfov [deg] Horizontal field of view (NaN if unknown). * @param vfov [deg] Vertical field of view (NaN if unknown). + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_camera_fov_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - uint32_t time_boot_ms,int32_t lat_camera,int32_t lon_camera,int32_t alt_camera,int32_t lat_image,int32_t lon_image,int32_t alt_image,const float *q,float hfov,float vfov) + uint32_t time_boot_ms,int32_t lat_camera,int32_t lon_camera,int32_t alt_camera,int32_t lat_image,int32_t lon_image,int32_t alt_image,const float *q,float hfov,float vfov,uint8_t camera_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_CAMERA_FOV_STATUS_LEN]; @@ -148,6 +216,7 @@ static inline uint16_t mavlink_msg_camera_fov_status_pack_chan(uint8_t system_id _mav_put_int32_t(buf, 24, alt_image); _mav_put_float(buf, 44, hfov); _mav_put_float(buf, 48, vfov); + _mav_put_uint8_t(buf, 52, camera_device_id); _mav_put_float_array(buf, 28, q, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_FOV_STATUS_LEN); #else @@ -161,7 +230,8 @@ static inline uint16_t mavlink_msg_camera_fov_status_pack_chan(uint8_t system_id packet.alt_image = alt_image; packet.hfov = hfov; packet.vfov = vfov; - mav_array_memcpy(packet.q, q, sizeof(float)*4); + packet.camera_device_id = camera_device_id; + mav_array_assign_float(packet.q, q, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_FOV_STATUS_LEN); #endif @@ -179,7 +249,7 @@ static inline uint16_t mavlink_msg_camera_fov_status_pack_chan(uint8_t system_id */ static inline uint16_t mavlink_msg_camera_fov_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_camera_fov_status_t* camera_fov_status) { - return mavlink_msg_camera_fov_status_pack(system_id, component_id, msg, camera_fov_status->time_boot_ms, camera_fov_status->lat_camera, camera_fov_status->lon_camera, camera_fov_status->alt_camera, camera_fov_status->lat_image, camera_fov_status->lon_image, camera_fov_status->alt_image, camera_fov_status->q, camera_fov_status->hfov, camera_fov_status->vfov); + return mavlink_msg_camera_fov_status_pack(system_id, component_id, msg, camera_fov_status->time_boot_ms, camera_fov_status->lat_camera, camera_fov_status->lon_camera, camera_fov_status->alt_camera, camera_fov_status->lat_image, camera_fov_status->lon_image, camera_fov_status->alt_image, camera_fov_status->q, camera_fov_status->hfov, camera_fov_status->vfov, camera_fov_status->camera_device_id); } /** @@ -193,7 +263,21 @@ static inline uint16_t mavlink_msg_camera_fov_status_encode(uint8_t system_id, u */ static inline uint16_t mavlink_msg_camera_fov_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_camera_fov_status_t* camera_fov_status) { - return mavlink_msg_camera_fov_status_pack_chan(system_id, component_id, chan, msg, camera_fov_status->time_boot_ms, camera_fov_status->lat_camera, camera_fov_status->lon_camera, camera_fov_status->alt_camera, camera_fov_status->lat_image, camera_fov_status->lon_image, camera_fov_status->alt_image, camera_fov_status->q, camera_fov_status->hfov, camera_fov_status->vfov); + return mavlink_msg_camera_fov_status_pack_chan(system_id, component_id, chan, msg, camera_fov_status->time_boot_ms, camera_fov_status->lat_camera, camera_fov_status->lon_camera, camera_fov_status->alt_camera, camera_fov_status->lat_image, camera_fov_status->lon_image, camera_fov_status->alt_image, camera_fov_status->q, camera_fov_status->hfov, camera_fov_status->vfov, camera_fov_status->camera_device_id); +} + +/** + * @brief Encode a camera_fov_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param camera_fov_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_camera_fov_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_camera_fov_status_t* camera_fov_status) +{ + return mavlink_msg_camera_fov_status_pack_status(system_id, component_id, _status, msg, camera_fov_status->time_boot_ms, camera_fov_status->lat_camera, camera_fov_status->lon_camera, camera_fov_status->alt_camera, camera_fov_status->lat_image, camera_fov_status->lon_image, camera_fov_status->alt_image, camera_fov_status->q, camera_fov_status->hfov, camera_fov_status->vfov, camera_fov_status->camera_device_id); } /** @@ -210,10 +294,11 @@ static inline uint16_t mavlink_msg_camera_fov_status_encode_chan(uint8_t system_ * @param q Quaternion of camera orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0) * @param hfov [deg] Horizontal field of view (NaN if unknown). * @param vfov [deg] Vertical field of view (NaN if unknown). + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_camera_fov_status_send(mavlink_channel_t chan, uint32_t time_boot_ms, int32_t lat_camera, int32_t lon_camera, int32_t alt_camera, int32_t lat_image, int32_t lon_image, int32_t alt_image, const float *q, float hfov, float vfov) +static inline void mavlink_msg_camera_fov_status_send(mavlink_channel_t chan, uint32_t time_boot_ms, int32_t lat_camera, int32_t lon_camera, int32_t alt_camera, int32_t lat_image, int32_t lon_image, int32_t alt_image, const float *q, float hfov, float vfov, uint8_t camera_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_CAMERA_FOV_STATUS_LEN]; @@ -226,6 +311,7 @@ static inline void mavlink_msg_camera_fov_status_send(mavlink_channel_t chan, ui _mav_put_int32_t(buf, 24, alt_image); _mav_put_float(buf, 44, hfov); _mav_put_float(buf, 48, vfov); + _mav_put_uint8_t(buf, 52, camera_device_id); _mav_put_float_array(buf, 28, q, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_FOV_STATUS, buf, MAVLINK_MSG_ID_CAMERA_FOV_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_FOV_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_FOV_STATUS_CRC); #else @@ -239,7 +325,8 @@ static inline void mavlink_msg_camera_fov_status_send(mavlink_channel_t chan, ui packet.alt_image = alt_image; packet.hfov = hfov; packet.vfov = vfov; - mav_array_memcpy(packet.q, q, sizeof(float)*4); + packet.camera_device_id = camera_device_id; + mav_array_assign_float(packet.q, q, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_FOV_STATUS, (const char *)&packet, MAVLINK_MSG_ID_CAMERA_FOV_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_FOV_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_FOV_STATUS_CRC); #endif } @@ -252,7 +339,7 @@ static inline void mavlink_msg_camera_fov_status_send(mavlink_channel_t chan, ui static inline void mavlink_msg_camera_fov_status_send_struct(mavlink_channel_t chan, const mavlink_camera_fov_status_t* camera_fov_status) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_camera_fov_status_send(chan, camera_fov_status->time_boot_ms, camera_fov_status->lat_camera, camera_fov_status->lon_camera, camera_fov_status->alt_camera, camera_fov_status->lat_image, camera_fov_status->lon_image, camera_fov_status->alt_image, camera_fov_status->q, camera_fov_status->hfov, camera_fov_status->vfov); + mavlink_msg_camera_fov_status_send(chan, camera_fov_status->time_boot_ms, camera_fov_status->lat_camera, camera_fov_status->lon_camera, camera_fov_status->alt_camera, camera_fov_status->lat_image, camera_fov_status->lon_image, camera_fov_status->alt_image, camera_fov_status->q, camera_fov_status->hfov, camera_fov_status->vfov, camera_fov_status->camera_device_id); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_FOV_STATUS, (const char *)camera_fov_status, MAVLINK_MSG_ID_CAMERA_FOV_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_FOV_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_FOV_STATUS_CRC); #endif @@ -260,13 +347,13 @@ static inline void mavlink_msg_camera_fov_status_send_struct(mavlink_channel_t c #if MAVLINK_MSG_ID_CAMERA_FOV_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_camera_fov_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, int32_t lat_camera, int32_t lon_camera, int32_t alt_camera, int32_t lat_image, int32_t lon_image, int32_t alt_image, const float *q, float hfov, float vfov) +static inline void mavlink_msg_camera_fov_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, int32_t lat_camera, int32_t lon_camera, int32_t alt_camera, int32_t lat_image, int32_t lon_image, int32_t alt_image, const float *q, float hfov, float vfov, uint8_t camera_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; @@ -279,6 +366,7 @@ static inline void mavlink_msg_camera_fov_status_send_buf(mavlink_message_t *msg _mav_put_int32_t(buf, 24, alt_image); _mav_put_float(buf, 44, hfov); _mav_put_float(buf, 48, vfov); + _mav_put_uint8_t(buf, 52, camera_device_id); _mav_put_float_array(buf, 28, q, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_FOV_STATUS, buf, MAVLINK_MSG_ID_CAMERA_FOV_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_FOV_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_FOV_STATUS_CRC); #else @@ -292,7 +380,8 @@ static inline void mavlink_msg_camera_fov_status_send_buf(mavlink_message_t *msg packet->alt_image = alt_image; packet->hfov = hfov; packet->vfov = vfov; - mav_array_memcpy(packet->q, q, sizeof(float)*4); + packet->camera_device_id = camera_device_id; + mav_array_assign_float(packet->q, q, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_FOV_STATUS, (const char *)packet, MAVLINK_MSG_ID_CAMERA_FOV_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_FOV_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_FOV_STATUS_CRC); #endif } @@ -403,6 +492,16 @@ static inline float mavlink_msg_camera_fov_status_get_vfov(const mavlink_message return _MAV_RETURN_float(msg, 48); } +/** + * @brief Get field camera_device_id from camera_fov_status message + * + * @return Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). + */ +static inline uint8_t mavlink_msg_camera_fov_status_get_camera_device_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 52); +} + /** * @brief Decode a camera_fov_status message into a struct * @@ -422,6 +521,7 @@ static inline void mavlink_msg_camera_fov_status_decode(const mavlink_message_t* mavlink_msg_camera_fov_status_get_q(msg, camera_fov_status->q); camera_fov_status->hfov = mavlink_msg_camera_fov_status_get_hfov(msg); camera_fov_status->vfov = mavlink_msg_camera_fov_status_get_vfov(msg); + camera_fov_status->camera_device_id = mavlink_msg_camera_fov_status_get_camera_device_id(msg); #else uint8_t len = msg->len < MAVLINK_MSG_ID_CAMERA_FOV_STATUS_LEN? msg->len : MAVLINK_MSG_ID_CAMERA_FOV_STATUS_LEN; memset(camera_fov_status, 0, MAVLINK_MSG_ID_CAMERA_FOV_STATUS_LEN); diff --git a/common/mavlink_msg_camera_image_captured.h b/common/mavlink_msg_camera_image_captured.h index 01d772b62..0689fabdf 100644 --- a/common/mavlink_msg_camera_image_captured.h +++ b/common/mavlink_msg_camera_image_captured.h @@ -13,8 +13,8 @@ typedef struct __mavlink_camera_image_captured_t { int32_t relative_alt; /*< [mm] Altitude above ground*/ float q[4]; /*< Quaternion of camera orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0)*/ int32_t image_index; /*< Zero based index of this image (i.e. a new image will have index CAMERA_CAPTURE_STATUS.image count -1)*/ - uint8_t camera_id; /*< Deprecated/unused. Component IDs are used to differentiate multiple cameras.*/ - int8_t capture_result; /*< Boolean indicating success (1) or failure (0) while capturing this image.*/ + uint8_t camera_id; /*< Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). Field name is usually camera_device_id.*/ + int8_t capture_result; /*< Image was captured successfully (MAV_BOOL_TRUE). Values not equal to 0 or 1 are invalid.*/ char file_url[205]; /*< URL of image taken. Either local storage or http://foo.jpg if camera provides an HTTP interface.*/ } mavlink_camera_image_captured_t; @@ -74,20 +74,77 @@ typedef struct __mavlink_camera_image_captured_t { * * @param time_boot_ms [ms] Timestamp (time since system boot). * @param time_utc [us] Timestamp (time since UNIX epoch) in UTC. 0 for unknown. - * @param camera_id Deprecated/unused. Component IDs are used to differentiate multiple cameras. + * @param camera_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). Field name is usually camera_device_id. * @param lat [degE7] Latitude where image was taken * @param lon [degE7] Longitude where capture was taken * @param alt [mm] Altitude (MSL) where image was taken * @param relative_alt [mm] Altitude above ground * @param q Quaternion of camera orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0) * @param image_index Zero based index of this image (i.e. a new image will have index CAMERA_CAPTURE_STATUS.image count -1) - * @param capture_result Boolean indicating success (1) or failure (0) while capturing this image. + * @param capture_result Image was captured successfully (MAV_BOOL_TRUE). Values not equal to 0 or 1 are invalid. * @param file_url URL of image taken. Either local storage or http://foo.jpg if camera provides an HTTP interface. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_camera_image_captured_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint32_t time_boot_ms, uint64_t time_utc, uint8_t camera_id, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, const float *q, int32_t image_index, int8_t capture_result, const char *file_url) { +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_LEN]; + _mav_put_uint64_t(buf, 0, time_utc); + _mav_put_uint32_t(buf, 8, time_boot_ms); + _mav_put_int32_t(buf, 12, lat); + _mav_put_int32_t(buf, 16, lon); + _mav_put_int32_t(buf, 20, alt); + _mav_put_int32_t(buf, 24, relative_alt); + _mav_put_int32_t(buf, 44, image_index); + _mav_put_uint8_t(buf, 48, camera_id); + _mav_put_int8_t(buf, 49, capture_result); + _mav_put_float_array(buf, 28, q, 4); + _mav_put_char_array(buf, 50, file_url, 205); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_LEN); +#else + mavlink_camera_image_captured_t packet; + packet.time_utc = time_utc; + packet.time_boot_ms = time_boot_ms; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.relative_alt = relative_alt; + packet.image_index = image_index; + packet.camera_id = camera_id; + packet.capture_result = capture_result; + mav_array_assign_float(packet.q, q, 4); + mav_array_assign_char(packet.file_url, file_url, 205); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_MIN_LEN, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_LEN, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_CRC); +} + +/** + * @brief Pack a camera_image_captured message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param time_utc [us] Timestamp (time since UNIX epoch) in UTC. 0 for unknown. + * @param camera_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). Field name is usually camera_device_id. + * @param lat [degE7] Latitude where image was taken + * @param lon [degE7] Longitude where capture was taken + * @param alt [mm] Altitude (MSL) where image was taken + * @param relative_alt [mm] Altitude above ground + * @param q Quaternion of camera orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0) + * @param image_index Zero based index of this image (i.e. a new image will have index CAMERA_CAPTURE_STATUS.image count -1) + * @param capture_result Image was captured successfully (MAV_BOOL_TRUE). Values not equal to 0 or 1 are invalid. + * @param file_url URL of image taken. Either local storage or http://foo.jpg if camera provides an HTTP interface. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_camera_image_captured_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, uint64_t time_utc, uint8_t camera_id, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, const float *q, int32_t image_index, int8_t capture_result, const char *file_url) +{ #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_LEN]; _mav_put_uint64_t(buf, 0, time_utc); @@ -119,7 +176,11 @@ static inline uint16_t mavlink_msg_camera_image_captured_pack(uint8_t system_id, #endif msg->msgid = MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_MIN_LEN, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_LEN, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_CRC); +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_MIN_LEN, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_LEN, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_MIN_LEN, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_LEN); +#endif } /** @@ -130,14 +191,14 @@ static inline uint16_t mavlink_msg_camera_image_captured_pack(uint8_t system_id, * @param msg The MAVLink message to compress the data into * @param time_boot_ms [ms] Timestamp (time since system boot). * @param time_utc [us] Timestamp (time since UNIX epoch) in UTC. 0 for unknown. - * @param camera_id Deprecated/unused. Component IDs are used to differentiate multiple cameras. + * @param camera_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). Field name is usually camera_device_id. * @param lat [degE7] Latitude where image was taken * @param lon [degE7] Longitude where capture was taken * @param alt [mm] Altitude (MSL) where image was taken * @param relative_alt [mm] Altitude above ground * @param q Quaternion of camera orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0) * @param image_index Zero based index of this image (i.e. a new image will have index CAMERA_CAPTURE_STATUS.image count -1) - * @param capture_result Boolean indicating success (1) or failure (0) while capturing this image. + * @param capture_result Image was captured successfully (MAV_BOOL_TRUE). Values not equal to 0 or 1 are invalid. * @param file_url URL of image taken. Either local storage or http://foo.jpg if camera provides an HTTP interface. * @return length of the message in bytes (excluding serial stream start sign) */ @@ -170,8 +231,8 @@ static inline uint16_t mavlink_msg_camera_image_captured_pack_chan(uint8_t syste packet.image_index = image_index; packet.camera_id = camera_id; packet.capture_result = capture_result; - mav_array_memcpy(packet.q, q, sizeof(float)*4); - mav_array_memcpy(packet.file_url, file_url, sizeof(char)*205); + mav_array_assign_float(packet.q, q, 4); + mav_array_assign_char(packet.file_url, file_url, 205); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_LEN); #endif @@ -206,20 +267,34 @@ static inline uint16_t mavlink_msg_camera_image_captured_encode_chan(uint8_t sys return mavlink_msg_camera_image_captured_pack_chan(system_id, component_id, chan, msg, camera_image_captured->time_boot_ms, camera_image_captured->time_utc, camera_image_captured->camera_id, camera_image_captured->lat, camera_image_captured->lon, camera_image_captured->alt, camera_image_captured->relative_alt, camera_image_captured->q, camera_image_captured->image_index, camera_image_captured->capture_result, camera_image_captured->file_url); } +/** + * @brief Encode a camera_image_captured struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param camera_image_captured C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_camera_image_captured_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_camera_image_captured_t* camera_image_captured) +{ + return mavlink_msg_camera_image_captured_pack_status(system_id, component_id, _status, msg, camera_image_captured->time_boot_ms, camera_image_captured->time_utc, camera_image_captured->camera_id, camera_image_captured->lat, camera_image_captured->lon, camera_image_captured->alt, camera_image_captured->relative_alt, camera_image_captured->q, camera_image_captured->image_index, camera_image_captured->capture_result, camera_image_captured->file_url); +} + /** * @brief Send a camera_image_captured message * @param chan MAVLink channel to send the message * * @param time_boot_ms [ms] Timestamp (time since system boot). * @param time_utc [us] Timestamp (time since UNIX epoch) in UTC. 0 for unknown. - * @param camera_id Deprecated/unused. Component IDs are used to differentiate multiple cameras. + * @param camera_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). Field name is usually camera_device_id. * @param lat [degE7] Latitude where image was taken * @param lon [degE7] Longitude where capture was taken * @param alt [mm] Altitude (MSL) where image was taken * @param relative_alt [mm] Altitude above ground * @param q Quaternion of camera orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0) * @param image_index Zero based index of this image (i.e. a new image will have index CAMERA_CAPTURE_STATUS.image count -1) - * @param capture_result Boolean indicating success (1) or failure (0) while capturing this image. + * @param capture_result Image was captured successfully (MAV_BOOL_TRUE). Values not equal to 0 or 1 are invalid. * @param file_url URL of image taken. Either local storage or http://foo.jpg if camera provides an HTTP interface. */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS @@ -251,8 +326,8 @@ static inline void mavlink_msg_camera_image_captured_send(mavlink_channel_t chan packet.image_index = image_index; packet.camera_id = camera_id; packet.capture_result = capture_result; - mav_array_memcpy(packet.q, q, sizeof(float)*4); - mav_array_memcpy(packet.file_url, file_url, sizeof(char)*205); + mav_array_assign_float(packet.q, q, 4); + mav_array_assign_char(packet.file_url, file_url, 205); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED, (const char *)&packet, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_MIN_LEN, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_LEN, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_CRC); #endif } @@ -273,7 +348,7 @@ static inline void mavlink_msg_camera_image_captured_send_struct(mavlink_channel #if MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -306,8 +381,8 @@ static inline void mavlink_msg_camera_image_captured_send_buf(mavlink_message_t packet->image_index = image_index; packet->camera_id = camera_id; packet->capture_result = capture_result; - mav_array_memcpy(packet->q, q, sizeof(float)*4); - mav_array_memcpy(packet->file_url, file_url, sizeof(char)*205); + mav_array_assign_float(packet->q, q, 4); + mav_array_assign_char(packet->file_url, file_url, 205); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED, (const char *)packet, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_MIN_LEN, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_LEN, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_CRC); #endif } @@ -341,7 +416,7 @@ static inline uint64_t mavlink_msg_camera_image_captured_get_time_utc(const mavl /** * @brief Get field camera_id from camera_image_captured message * - * @return Deprecated/unused. Component IDs are used to differentiate multiple cameras. + * @return Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). Field name is usually camera_device_id. */ static inline uint8_t mavlink_msg_camera_image_captured_get_camera_id(const mavlink_message_t* msg) { @@ -411,7 +486,7 @@ static inline int32_t mavlink_msg_camera_image_captured_get_image_index(const ma /** * @brief Get field capture_result from camera_image_captured message * - * @return Boolean indicating success (1) or failure (0) while capturing this image. + * @return Image was captured successfully (MAV_BOOL_TRUE). Values not equal to 0 or 1 are invalid. */ static inline int8_t mavlink_msg_camera_image_captured_get_capture_result(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_camera_information.h b/common/mavlink_msg_camera_information.h index 0ae20c4b3..30bebcfce 100644 --- a/common/mavlink_msg_camera_information.h +++ b/common/mavlink_msg_camera_information.h @@ -6,23 +6,25 @@ typedef struct __mavlink_camera_information_t { uint32_t time_boot_ms; /*< [ms] Timestamp (time since system boot).*/ - uint32_t firmware_version; /*< Version of the camera firmware, encoded as: (Dev & 0xff) << 24 | (Patch & 0xff) << 16 | (Minor & 0xff) << 8 | (Major & 0xff)*/ - float focal_length; /*< [mm] Focal length*/ - float sensor_size_h; /*< [mm] Image sensor size horizontal*/ - float sensor_size_v; /*< [mm] Image sensor size vertical*/ + uint32_t firmware_version; /*< Version of the camera firmware, encoded as: `(Dev & 0xff) << 24 + (Patch & 0xff) << 16 + (Minor & 0xff) << 8 + (Major & 0xff)`. Use 0 if not known.*/ + float focal_length; /*< [mm] Focal length. Use NaN if not known.*/ + float sensor_size_h; /*< [mm] Image sensor size horizontal. Use NaN if not known.*/ + float sensor_size_v; /*< [mm] Image sensor size vertical. Use NaN if not known.*/ uint32_t flags; /*< Bitmap of camera capability flags.*/ - uint16_t resolution_h; /*< [pix] Horizontal image resolution*/ - uint16_t resolution_v; /*< [pix] Vertical image resolution*/ - uint16_t cam_definition_version; /*< Camera definition version (iteration)*/ + uint16_t resolution_h; /*< [pix] Horizontal image resolution. Use 0 if not known.*/ + uint16_t resolution_v; /*< [pix] Vertical image resolution. Use 0 if not known.*/ + uint16_t cam_definition_version; /*< Camera definition version (iteration). Use 0 if not known.*/ uint8_t vendor_name[32]; /*< Name of the camera vendor*/ uint8_t model_name[32]; /*< Name of the camera model*/ - uint8_t lens_id; /*< Reserved for a lens ID*/ - char cam_definition_uri[140]; /*< Camera definition URI (if any, otherwise only basic functions will be available). HTTP- (http://) and MAVLink FTP- (mavlinkftp://) formatted URIs are allowed (and both must be supported by any GCS that implements the Camera Protocol).*/ + uint8_t lens_id; /*< Reserved for a lens ID. Use 0 if not known.*/ + char cam_definition_uri[140]; /*< Camera definition URI (if any, otherwise only basic functions will be available). HTTP- (http://) and MAVLink FTP- (mavlinkftp://) formatted URIs are allowed (and both must be supported by any GCS that implements the Camera Protocol). The definition file may be xz compressed, which will be indicated by the file extension .xml.xz (a GCS that implements the protocol must support decompressing the file). The string needs to be zero terminated. Use a zero-length string if not known.*/ + uint8_t gimbal_device_id; /*< Gimbal id of a gimbal associated with this camera. This is the component id of the gimbal device, or 1-6 for non mavlink gimbals. Use 0 if no gimbal is associated with the camera.*/ + uint8_t camera_device_id; /*< Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id).*/ } mavlink_camera_information_t; -#define MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN 235 +#define MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN 237 #define MAVLINK_MSG_ID_CAMERA_INFORMATION_MIN_LEN 235 -#define MAVLINK_MSG_ID_259_LEN 235 +#define MAVLINK_MSG_ID_259_LEN 237 #define MAVLINK_MSG_ID_259_MIN_LEN 235 #define MAVLINK_MSG_ID_CAMERA_INFORMATION_CRC 92 @@ -36,7 +38,7 @@ typedef struct __mavlink_camera_information_t { #define MAVLINK_MESSAGE_INFO_CAMERA_INFORMATION { \ 259, \ "CAMERA_INFORMATION", \ - 13, \ + 15, \ { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_camera_information_t, time_boot_ms) }, \ { "vendor_name", NULL, MAVLINK_TYPE_UINT8_T, 32, 30, offsetof(mavlink_camera_information_t, vendor_name) }, \ { "model_name", NULL, MAVLINK_TYPE_UINT8_T, 32, 62, offsetof(mavlink_camera_information_t, model_name) }, \ @@ -50,12 +52,14 @@ typedef struct __mavlink_camera_information_t { { "flags", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_camera_information_t, flags) }, \ { "cam_definition_version", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_camera_information_t, cam_definition_version) }, \ { "cam_definition_uri", NULL, MAVLINK_TYPE_CHAR, 140, 95, offsetof(mavlink_camera_information_t, cam_definition_uri) }, \ + { "gimbal_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 235, offsetof(mavlink_camera_information_t, gimbal_device_id) }, \ + { "camera_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 236, offsetof(mavlink_camera_information_t, camera_device_id) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_CAMERA_INFORMATION { \ "CAMERA_INFORMATION", \ - 13, \ + 15, \ { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_camera_information_t, time_boot_ms) }, \ { "vendor_name", NULL, MAVLINK_TYPE_UINT8_T, 32, 30, offsetof(mavlink_camera_information_t, vendor_name) }, \ { "model_name", NULL, MAVLINK_TYPE_UINT8_T, 32, 62, offsetof(mavlink_camera_information_t, model_name) }, \ @@ -69,6 +73,8 @@ typedef struct __mavlink_camera_information_t { { "flags", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_camera_information_t, flags) }, \ { "cam_definition_version", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_camera_information_t, cam_definition_version) }, \ { "cam_definition_uri", NULL, MAVLINK_TYPE_CHAR, 140, 95, offsetof(mavlink_camera_information_t, cam_definition_uri) }, \ + { "gimbal_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 235, offsetof(mavlink_camera_information_t, gimbal_device_id) }, \ + { "camera_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 236, offsetof(mavlink_camera_information_t, camera_device_id) }, \ } \ } #endif @@ -82,20 +88,22 @@ typedef struct __mavlink_camera_information_t { * @param time_boot_ms [ms] Timestamp (time since system boot). * @param vendor_name Name of the camera vendor * @param model_name Name of the camera model - * @param firmware_version Version of the camera firmware, encoded as: (Dev & 0xff) << 24 | (Patch & 0xff) << 16 | (Minor & 0xff) << 8 | (Major & 0xff) - * @param focal_length [mm] Focal length - * @param sensor_size_h [mm] Image sensor size horizontal - * @param sensor_size_v [mm] Image sensor size vertical - * @param resolution_h [pix] Horizontal image resolution - * @param resolution_v [pix] Vertical image resolution - * @param lens_id Reserved for a lens ID + * @param firmware_version Version of the camera firmware, encoded as: `(Dev & 0xff) << 24 + (Patch & 0xff) << 16 + (Minor & 0xff) << 8 + (Major & 0xff)`. Use 0 if not known. + * @param focal_length [mm] Focal length. Use NaN if not known. + * @param sensor_size_h [mm] Image sensor size horizontal. Use NaN if not known. + * @param sensor_size_v [mm] Image sensor size vertical. Use NaN if not known. + * @param resolution_h [pix] Horizontal image resolution. Use 0 if not known. + * @param resolution_v [pix] Vertical image resolution. Use 0 if not known. + * @param lens_id Reserved for a lens ID. Use 0 if not known. * @param flags Bitmap of camera capability flags. - * @param cam_definition_version Camera definition version (iteration) - * @param cam_definition_uri Camera definition URI (if any, otherwise only basic functions will be available). HTTP- (http://) and MAVLink FTP- (mavlinkftp://) formatted URIs are allowed (and both must be supported by any GCS that implements the Camera Protocol). + * @param cam_definition_version Camera definition version (iteration). Use 0 if not known. + * @param cam_definition_uri Camera definition URI (if any, otherwise only basic functions will be available). HTTP- (http://) and MAVLink FTP- (mavlinkftp://) formatted URIs are allowed (and both must be supported by any GCS that implements the Camera Protocol). The definition file may be xz compressed, which will be indicated by the file extension .xml.xz (a GCS that implements the protocol must support decompressing the file). The string needs to be zero terminated. Use a zero-length string if not known. + * @param gimbal_device_id Gimbal id of a gimbal associated with this camera. This is the component id of the gimbal device, or 1-6 for non mavlink gimbals. Use 0 if no gimbal is associated with the camera. + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_camera_information_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint32_t time_boot_ms, const uint8_t *vendor_name, const uint8_t *model_name, uint32_t firmware_version, float focal_length, float sensor_size_h, float sensor_size_v, uint16_t resolution_h, uint16_t resolution_v, uint8_t lens_id, uint32_t flags, uint16_t cam_definition_version, const char *cam_definition_uri) + uint32_t time_boot_ms, const uint8_t *vendor_name, const uint8_t *model_name, uint32_t firmware_version, float focal_length, float sensor_size_h, float sensor_size_v, uint16_t resolution_h, uint16_t resolution_v, uint8_t lens_id, uint32_t flags, uint16_t cam_definition_version, const char *cam_definition_uri, uint8_t gimbal_device_id, uint8_t camera_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN]; @@ -109,6 +117,8 @@ static inline uint16_t mavlink_msg_camera_information_pack(uint8_t system_id, ui _mav_put_uint16_t(buf, 26, resolution_v); _mav_put_uint16_t(buf, 28, cam_definition_version); _mav_put_uint8_t(buf, 94, lens_id); + _mav_put_uint8_t(buf, 235, gimbal_device_id); + _mav_put_uint8_t(buf, 236, camera_device_id); _mav_put_uint8_t_array(buf, 30, vendor_name, 32); _mav_put_uint8_t_array(buf, 62, model_name, 32); _mav_put_char_array(buf, 95, cam_definition_uri, 140); @@ -125,6 +135,77 @@ static inline uint16_t mavlink_msg_camera_information_pack(uint8_t system_id, ui packet.resolution_v = resolution_v; packet.cam_definition_version = cam_definition_version; packet.lens_id = lens_id; + packet.gimbal_device_id = gimbal_device_id; + packet.camera_device_id = camera_device_id; + mav_array_assign_uint8_t(packet.vendor_name, vendor_name, 32); + mav_array_assign_uint8_t(packet.model_name, model_name, 32); + mav_array_assign_char(packet.cam_definition_uri, cam_definition_uri, 140); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CAMERA_INFORMATION; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CAMERA_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN, MAVLINK_MSG_ID_CAMERA_INFORMATION_CRC); +} + +/** + * @brief Pack a camera_information message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param vendor_name Name of the camera vendor + * @param model_name Name of the camera model + * @param firmware_version Version of the camera firmware, encoded as: `(Dev & 0xff) << 24 + (Patch & 0xff) << 16 + (Minor & 0xff) << 8 + (Major & 0xff)`. Use 0 if not known. + * @param focal_length [mm] Focal length. Use NaN if not known. + * @param sensor_size_h [mm] Image sensor size horizontal. Use NaN if not known. + * @param sensor_size_v [mm] Image sensor size vertical. Use NaN if not known. + * @param resolution_h [pix] Horizontal image resolution. Use 0 if not known. + * @param resolution_v [pix] Vertical image resolution. Use 0 if not known. + * @param lens_id Reserved for a lens ID. Use 0 if not known. + * @param flags Bitmap of camera capability flags. + * @param cam_definition_version Camera definition version (iteration). Use 0 if not known. + * @param cam_definition_uri Camera definition URI (if any, otherwise only basic functions will be available). HTTP- (http://) and MAVLink FTP- (mavlinkftp://) formatted URIs are allowed (and both must be supported by any GCS that implements the Camera Protocol). The definition file may be xz compressed, which will be indicated by the file extension .xml.xz (a GCS that implements the protocol must support decompressing the file). The string needs to be zero terminated. Use a zero-length string if not known. + * @param gimbal_device_id Gimbal id of a gimbal associated with this camera. This is the component id of the gimbal device, or 1-6 for non mavlink gimbals. Use 0 if no gimbal is associated with the camera. + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_camera_information_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, const uint8_t *vendor_name, const uint8_t *model_name, uint32_t firmware_version, float focal_length, float sensor_size_h, float sensor_size_v, uint16_t resolution_h, uint16_t resolution_v, uint8_t lens_id, uint32_t flags, uint16_t cam_definition_version, const char *cam_definition_uri, uint8_t gimbal_device_id, uint8_t camera_device_id) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_uint32_t(buf, 4, firmware_version); + _mav_put_float(buf, 8, focal_length); + _mav_put_float(buf, 12, sensor_size_h); + _mav_put_float(buf, 16, sensor_size_v); + _mav_put_uint32_t(buf, 20, flags); + _mav_put_uint16_t(buf, 24, resolution_h); + _mav_put_uint16_t(buf, 26, resolution_v); + _mav_put_uint16_t(buf, 28, cam_definition_version); + _mav_put_uint8_t(buf, 94, lens_id); + _mav_put_uint8_t(buf, 235, gimbal_device_id); + _mav_put_uint8_t(buf, 236, camera_device_id); + _mav_put_uint8_t_array(buf, 30, vendor_name, 32); + _mav_put_uint8_t_array(buf, 62, model_name, 32); + _mav_put_char_array(buf, 95, cam_definition_uri, 140); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN); +#else + mavlink_camera_information_t packet; + packet.time_boot_ms = time_boot_ms; + packet.firmware_version = firmware_version; + packet.focal_length = focal_length; + packet.sensor_size_h = sensor_size_h; + packet.sensor_size_v = sensor_size_v; + packet.flags = flags; + packet.resolution_h = resolution_h; + packet.resolution_v = resolution_v; + packet.cam_definition_version = cam_definition_version; + packet.lens_id = lens_id; + packet.gimbal_device_id = gimbal_device_id; + packet.camera_device_id = camera_device_id; mav_array_memcpy(packet.vendor_name, vendor_name, sizeof(uint8_t)*32); mav_array_memcpy(packet.model_name, model_name, sizeof(uint8_t)*32); mav_array_memcpy(packet.cam_definition_uri, cam_definition_uri, sizeof(char)*140); @@ -132,7 +213,11 @@ static inline uint16_t mavlink_msg_camera_information_pack(uint8_t system_id, ui #endif msg->msgid = MAVLINK_MSG_ID_CAMERA_INFORMATION; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CAMERA_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN, MAVLINK_MSG_ID_CAMERA_INFORMATION_CRC); +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CAMERA_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN, MAVLINK_MSG_ID_CAMERA_INFORMATION_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CAMERA_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN); +#endif } /** @@ -144,21 +229,23 @@ static inline uint16_t mavlink_msg_camera_information_pack(uint8_t system_id, ui * @param time_boot_ms [ms] Timestamp (time since system boot). * @param vendor_name Name of the camera vendor * @param model_name Name of the camera model - * @param firmware_version Version of the camera firmware, encoded as: (Dev & 0xff) << 24 | (Patch & 0xff) << 16 | (Minor & 0xff) << 8 | (Major & 0xff) - * @param focal_length [mm] Focal length - * @param sensor_size_h [mm] Image sensor size horizontal - * @param sensor_size_v [mm] Image sensor size vertical - * @param resolution_h [pix] Horizontal image resolution - * @param resolution_v [pix] Vertical image resolution - * @param lens_id Reserved for a lens ID + * @param firmware_version Version of the camera firmware, encoded as: `(Dev & 0xff) << 24 + (Patch & 0xff) << 16 + (Minor & 0xff) << 8 + (Major & 0xff)`. Use 0 if not known. + * @param focal_length [mm] Focal length. Use NaN if not known. + * @param sensor_size_h [mm] Image sensor size horizontal. Use NaN if not known. + * @param sensor_size_v [mm] Image sensor size vertical. Use NaN if not known. + * @param resolution_h [pix] Horizontal image resolution. Use 0 if not known. + * @param resolution_v [pix] Vertical image resolution. Use 0 if not known. + * @param lens_id Reserved for a lens ID. Use 0 if not known. * @param flags Bitmap of camera capability flags. - * @param cam_definition_version Camera definition version (iteration) - * @param cam_definition_uri Camera definition URI (if any, otherwise only basic functions will be available). HTTP- (http://) and MAVLink FTP- (mavlinkftp://) formatted URIs are allowed (and both must be supported by any GCS that implements the Camera Protocol). + * @param cam_definition_version Camera definition version (iteration). Use 0 if not known. + * @param cam_definition_uri Camera definition URI (if any, otherwise only basic functions will be available). HTTP- (http://) and MAVLink FTP- (mavlinkftp://) formatted URIs are allowed (and both must be supported by any GCS that implements the Camera Protocol). The definition file may be xz compressed, which will be indicated by the file extension .xml.xz (a GCS that implements the protocol must support decompressing the file). The string needs to be zero terminated. Use a zero-length string if not known. + * @param gimbal_device_id Gimbal id of a gimbal associated with this camera. This is the component id of the gimbal device, or 1-6 for non mavlink gimbals. Use 0 if no gimbal is associated with the camera. + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_camera_information_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - uint32_t time_boot_ms,const uint8_t *vendor_name,const uint8_t *model_name,uint32_t firmware_version,float focal_length,float sensor_size_h,float sensor_size_v,uint16_t resolution_h,uint16_t resolution_v,uint8_t lens_id,uint32_t flags,uint16_t cam_definition_version,const char *cam_definition_uri) + uint32_t time_boot_ms,const uint8_t *vendor_name,const uint8_t *model_name,uint32_t firmware_version,float focal_length,float sensor_size_h,float sensor_size_v,uint16_t resolution_h,uint16_t resolution_v,uint8_t lens_id,uint32_t flags,uint16_t cam_definition_version,const char *cam_definition_uri,uint8_t gimbal_device_id,uint8_t camera_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN]; @@ -172,6 +259,8 @@ static inline uint16_t mavlink_msg_camera_information_pack_chan(uint8_t system_i _mav_put_uint16_t(buf, 26, resolution_v); _mav_put_uint16_t(buf, 28, cam_definition_version); _mav_put_uint8_t(buf, 94, lens_id); + _mav_put_uint8_t(buf, 235, gimbal_device_id); + _mav_put_uint8_t(buf, 236, camera_device_id); _mav_put_uint8_t_array(buf, 30, vendor_name, 32); _mav_put_uint8_t_array(buf, 62, model_name, 32); _mav_put_char_array(buf, 95, cam_definition_uri, 140); @@ -188,9 +277,11 @@ static inline uint16_t mavlink_msg_camera_information_pack_chan(uint8_t system_i packet.resolution_v = resolution_v; packet.cam_definition_version = cam_definition_version; packet.lens_id = lens_id; - mav_array_memcpy(packet.vendor_name, vendor_name, sizeof(uint8_t)*32); - mav_array_memcpy(packet.model_name, model_name, sizeof(uint8_t)*32); - mav_array_memcpy(packet.cam_definition_uri, cam_definition_uri, sizeof(char)*140); + packet.gimbal_device_id = gimbal_device_id; + packet.camera_device_id = camera_device_id; + mav_array_assign_uint8_t(packet.vendor_name, vendor_name, 32); + mav_array_assign_uint8_t(packet.model_name, model_name, 32); + mav_array_assign_char(packet.cam_definition_uri, cam_definition_uri, 140); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN); #endif @@ -208,7 +299,7 @@ static inline uint16_t mavlink_msg_camera_information_pack_chan(uint8_t system_i */ static inline uint16_t mavlink_msg_camera_information_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_camera_information_t* camera_information) { - return mavlink_msg_camera_information_pack(system_id, component_id, msg, camera_information->time_boot_ms, camera_information->vendor_name, camera_information->model_name, camera_information->firmware_version, camera_information->focal_length, camera_information->sensor_size_h, camera_information->sensor_size_v, camera_information->resolution_h, camera_information->resolution_v, camera_information->lens_id, camera_information->flags, camera_information->cam_definition_version, camera_information->cam_definition_uri); + return mavlink_msg_camera_information_pack(system_id, component_id, msg, camera_information->time_boot_ms, camera_information->vendor_name, camera_information->model_name, camera_information->firmware_version, camera_information->focal_length, camera_information->sensor_size_h, camera_information->sensor_size_v, camera_information->resolution_h, camera_information->resolution_v, camera_information->lens_id, camera_information->flags, camera_information->cam_definition_version, camera_information->cam_definition_uri, camera_information->gimbal_device_id, camera_information->camera_device_id); } /** @@ -222,7 +313,21 @@ static inline uint16_t mavlink_msg_camera_information_encode(uint8_t system_id, */ static inline uint16_t mavlink_msg_camera_information_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_camera_information_t* camera_information) { - return mavlink_msg_camera_information_pack_chan(system_id, component_id, chan, msg, camera_information->time_boot_ms, camera_information->vendor_name, camera_information->model_name, camera_information->firmware_version, camera_information->focal_length, camera_information->sensor_size_h, camera_information->sensor_size_v, camera_information->resolution_h, camera_information->resolution_v, camera_information->lens_id, camera_information->flags, camera_information->cam_definition_version, camera_information->cam_definition_uri); + return mavlink_msg_camera_information_pack_chan(system_id, component_id, chan, msg, camera_information->time_boot_ms, camera_information->vendor_name, camera_information->model_name, camera_information->firmware_version, camera_information->focal_length, camera_information->sensor_size_h, camera_information->sensor_size_v, camera_information->resolution_h, camera_information->resolution_v, camera_information->lens_id, camera_information->flags, camera_information->cam_definition_version, camera_information->cam_definition_uri, camera_information->gimbal_device_id, camera_information->camera_device_id); +} + +/** + * @brief Encode a camera_information struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param camera_information C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_camera_information_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_camera_information_t* camera_information) +{ + return mavlink_msg_camera_information_pack_status(system_id, component_id, _status, msg, camera_information->time_boot_ms, camera_information->vendor_name, camera_information->model_name, camera_information->firmware_version, camera_information->focal_length, camera_information->sensor_size_h, camera_information->sensor_size_v, camera_information->resolution_h, camera_information->resolution_v, camera_information->lens_id, camera_information->flags, camera_information->cam_definition_version, camera_information->cam_definition_uri, camera_information->gimbal_device_id, camera_information->camera_device_id); } /** @@ -232,20 +337,22 @@ static inline uint16_t mavlink_msg_camera_information_encode_chan(uint8_t system * @param time_boot_ms [ms] Timestamp (time since system boot). * @param vendor_name Name of the camera vendor * @param model_name Name of the camera model - * @param firmware_version Version of the camera firmware, encoded as: (Dev & 0xff) << 24 | (Patch & 0xff) << 16 | (Minor & 0xff) << 8 | (Major & 0xff) - * @param focal_length [mm] Focal length - * @param sensor_size_h [mm] Image sensor size horizontal - * @param sensor_size_v [mm] Image sensor size vertical - * @param resolution_h [pix] Horizontal image resolution - * @param resolution_v [pix] Vertical image resolution - * @param lens_id Reserved for a lens ID + * @param firmware_version Version of the camera firmware, encoded as: `(Dev & 0xff) << 24 + (Patch & 0xff) << 16 + (Minor & 0xff) << 8 + (Major & 0xff)`. Use 0 if not known. + * @param focal_length [mm] Focal length. Use NaN if not known. + * @param sensor_size_h [mm] Image sensor size horizontal. Use NaN if not known. + * @param sensor_size_v [mm] Image sensor size vertical. Use NaN if not known. + * @param resolution_h [pix] Horizontal image resolution. Use 0 if not known. + * @param resolution_v [pix] Vertical image resolution. Use 0 if not known. + * @param lens_id Reserved for a lens ID. Use 0 if not known. * @param flags Bitmap of camera capability flags. - * @param cam_definition_version Camera definition version (iteration) - * @param cam_definition_uri Camera definition URI (if any, otherwise only basic functions will be available). HTTP- (http://) and MAVLink FTP- (mavlinkftp://) formatted URIs are allowed (and both must be supported by any GCS that implements the Camera Protocol). + * @param cam_definition_version Camera definition version (iteration). Use 0 if not known. + * @param cam_definition_uri Camera definition URI (if any, otherwise only basic functions will be available). HTTP- (http://) and MAVLink FTP- (mavlinkftp://) formatted URIs are allowed (and both must be supported by any GCS that implements the Camera Protocol). The definition file may be xz compressed, which will be indicated by the file extension .xml.xz (a GCS that implements the protocol must support decompressing the file). The string needs to be zero terminated. Use a zero-length string if not known. + * @param gimbal_device_id Gimbal id of a gimbal associated with this camera. This is the component id of the gimbal device, or 1-6 for non mavlink gimbals. Use 0 if no gimbal is associated with the camera. + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_camera_information_send(mavlink_channel_t chan, uint32_t time_boot_ms, const uint8_t *vendor_name, const uint8_t *model_name, uint32_t firmware_version, float focal_length, float sensor_size_h, float sensor_size_v, uint16_t resolution_h, uint16_t resolution_v, uint8_t lens_id, uint32_t flags, uint16_t cam_definition_version, const char *cam_definition_uri) +static inline void mavlink_msg_camera_information_send(mavlink_channel_t chan, uint32_t time_boot_ms, const uint8_t *vendor_name, const uint8_t *model_name, uint32_t firmware_version, float focal_length, float sensor_size_h, float sensor_size_v, uint16_t resolution_h, uint16_t resolution_v, uint8_t lens_id, uint32_t flags, uint16_t cam_definition_version, const char *cam_definition_uri, uint8_t gimbal_device_id, uint8_t camera_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN]; @@ -259,6 +366,8 @@ static inline void mavlink_msg_camera_information_send(mavlink_channel_t chan, u _mav_put_uint16_t(buf, 26, resolution_v); _mav_put_uint16_t(buf, 28, cam_definition_version); _mav_put_uint8_t(buf, 94, lens_id); + _mav_put_uint8_t(buf, 235, gimbal_device_id); + _mav_put_uint8_t(buf, 236, camera_device_id); _mav_put_uint8_t_array(buf, 30, vendor_name, 32); _mav_put_uint8_t_array(buf, 62, model_name, 32); _mav_put_char_array(buf, 95, cam_definition_uri, 140); @@ -275,9 +384,11 @@ static inline void mavlink_msg_camera_information_send(mavlink_channel_t chan, u packet.resolution_v = resolution_v; packet.cam_definition_version = cam_definition_version; packet.lens_id = lens_id; - mav_array_memcpy(packet.vendor_name, vendor_name, sizeof(uint8_t)*32); - mav_array_memcpy(packet.model_name, model_name, sizeof(uint8_t)*32); - mav_array_memcpy(packet.cam_definition_uri, cam_definition_uri, sizeof(char)*140); + packet.gimbal_device_id = gimbal_device_id; + packet.camera_device_id = camera_device_id; + mav_array_assign_uint8_t(packet.vendor_name, vendor_name, 32); + mav_array_assign_uint8_t(packet.model_name, model_name, 32); + mav_array_assign_char(packet.cam_definition_uri, cam_definition_uri, 140); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_INFORMATION, (const char *)&packet, MAVLINK_MSG_ID_CAMERA_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN, MAVLINK_MSG_ID_CAMERA_INFORMATION_CRC); #endif } @@ -290,7 +401,7 @@ static inline void mavlink_msg_camera_information_send(mavlink_channel_t chan, u static inline void mavlink_msg_camera_information_send_struct(mavlink_channel_t chan, const mavlink_camera_information_t* camera_information) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_camera_information_send(chan, camera_information->time_boot_ms, camera_information->vendor_name, camera_information->model_name, camera_information->firmware_version, camera_information->focal_length, camera_information->sensor_size_h, camera_information->sensor_size_v, camera_information->resolution_h, camera_information->resolution_v, camera_information->lens_id, camera_information->flags, camera_information->cam_definition_version, camera_information->cam_definition_uri); + mavlink_msg_camera_information_send(chan, camera_information->time_boot_ms, camera_information->vendor_name, camera_information->model_name, camera_information->firmware_version, camera_information->focal_length, camera_information->sensor_size_h, camera_information->sensor_size_v, camera_information->resolution_h, camera_information->resolution_v, camera_information->lens_id, camera_information->flags, camera_information->cam_definition_version, camera_information->cam_definition_uri, camera_information->gimbal_device_id, camera_information->camera_device_id); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_INFORMATION, (const char *)camera_information, MAVLINK_MSG_ID_CAMERA_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN, MAVLINK_MSG_ID_CAMERA_INFORMATION_CRC); #endif @@ -298,13 +409,13 @@ static inline void mavlink_msg_camera_information_send_struct(mavlink_channel_t #if MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_camera_information_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, const uint8_t *vendor_name, const uint8_t *model_name, uint32_t firmware_version, float focal_length, float sensor_size_h, float sensor_size_v, uint16_t resolution_h, uint16_t resolution_v, uint8_t lens_id, uint32_t flags, uint16_t cam_definition_version, const char *cam_definition_uri) +static inline void mavlink_msg_camera_information_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, const uint8_t *vendor_name, const uint8_t *model_name, uint32_t firmware_version, float focal_length, float sensor_size_h, float sensor_size_v, uint16_t resolution_h, uint16_t resolution_v, uint8_t lens_id, uint32_t flags, uint16_t cam_definition_version, const char *cam_definition_uri, uint8_t gimbal_device_id, uint8_t camera_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; @@ -318,6 +429,8 @@ static inline void mavlink_msg_camera_information_send_buf(mavlink_message_t *ms _mav_put_uint16_t(buf, 26, resolution_v); _mav_put_uint16_t(buf, 28, cam_definition_version); _mav_put_uint8_t(buf, 94, lens_id); + _mav_put_uint8_t(buf, 235, gimbal_device_id); + _mav_put_uint8_t(buf, 236, camera_device_id); _mav_put_uint8_t_array(buf, 30, vendor_name, 32); _mav_put_uint8_t_array(buf, 62, model_name, 32); _mav_put_char_array(buf, 95, cam_definition_uri, 140); @@ -334,9 +447,11 @@ static inline void mavlink_msg_camera_information_send_buf(mavlink_message_t *ms packet->resolution_v = resolution_v; packet->cam_definition_version = cam_definition_version; packet->lens_id = lens_id; - mav_array_memcpy(packet->vendor_name, vendor_name, sizeof(uint8_t)*32); - mav_array_memcpy(packet->model_name, model_name, sizeof(uint8_t)*32); - mav_array_memcpy(packet->cam_definition_uri, cam_definition_uri, sizeof(char)*140); + packet->gimbal_device_id = gimbal_device_id; + packet->camera_device_id = camera_device_id; + mav_array_assign_uint8_t(packet->vendor_name, vendor_name, 32); + mav_array_assign_uint8_t(packet->model_name, model_name, 32); + mav_array_assign_char(packet->cam_definition_uri, cam_definition_uri, 140); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_INFORMATION, (const char *)packet, MAVLINK_MSG_ID_CAMERA_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN, MAVLINK_MSG_ID_CAMERA_INFORMATION_CRC); #endif } @@ -380,7 +495,7 @@ static inline uint16_t mavlink_msg_camera_information_get_model_name(const mavli /** * @brief Get field firmware_version from camera_information message * - * @return Version of the camera firmware, encoded as: (Dev & 0xff) << 24 | (Patch & 0xff) << 16 | (Minor & 0xff) << 8 | (Major & 0xff) + * @return Version of the camera firmware, encoded as: `(Dev & 0xff) << 24 + (Patch & 0xff) << 16 + (Minor & 0xff) << 8 + (Major & 0xff)`. Use 0 if not known. */ static inline uint32_t mavlink_msg_camera_information_get_firmware_version(const mavlink_message_t* msg) { @@ -390,7 +505,7 @@ static inline uint32_t mavlink_msg_camera_information_get_firmware_version(const /** * @brief Get field focal_length from camera_information message * - * @return [mm] Focal length + * @return [mm] Focal length. Use NaN if not known. */ static inline float mavlink_msg_camera_information_get_focal_length(const mavlink_message_t* msg) { @@ -400,7 +515,7 @@ static inline float mavlink_msg_camera_information_get_focal_length(const mavlin /** * @brief Get field sensor_size_h from camera_information message * - * @return [mm] Image sensor size horizontal + * @return [mm] Image sensor size horizontal. Use NaN if not known. */ static inline float mavlink_msg_camera_information_get_sensor_size_h(const mavlink_message_t* msg) { @@ -410,7 +525,7 @@ static inline float mavlink_msg_camera_information_get_sensor_size_h(const mavli /** * @brief Get field sensor_size_v from camera_information message * - * @return [mm] Image sensor size vertical + * @return [mm] Image sensor size vertical. Use NaN if not known. */ static inline float mavlink_msg_camera_information_get_sensor_size_v(const mavlink_message_t* msg) { @@ -420,7 +535,7 @@ static inline float mavlink_msg_camera_information_get_sensor_size_v(const mavli /** * @brief Get field resolution_h from camera_information message * - * @return [pix] Horizontal image resolution + * @return [pix] Horizontal image resolution. Use 0 if not known. */ static inline uint16_t mavlink_msg_camera_information_get_resolution_h(const mavlink_message_t* msg) { @@ -430,7 +545,7 @@ static inline uint16_t mavlink_msg_camera_information_get_resolution_h(const mav /** * @brief Get field resolution_v from camera_information message * - * @return [pix] Vertical image resolution + * @return [pix] Vertical image resolution. Use 0 if not known. */ static inline uint16_t mavlink_msg_camera_information_get_resolution_v(const mavlink_message_t* msg) { @@ -440,7 +555,7 @@ static inline uint16_t mavlink_msg_camera_information_get_resolution_v(const mav /** * @brief Get field lens_id from camera_information message * - * @return Reserved for a lens ID + * @return Reserved for a lens ID. Use 0 if not known. */ static inline uint8_t mavlink_msg_camera_information_get_lens_id(const mavlink_message_t* msg) { @@ -460,7 +575,7 @@ static inline uint32_t mavlink_msg_camera_information_get_flags(const mavlink_me /** * @brief Get field cam_definition_version from camera_information message * - * @return Camera definition version (iteration) + * @return Camera definition version (iteration). Use 0 if not known. */ static inline uint16_t mavlink_msg_camera_information_get_cam_definition_version(const mavlink_message_t* msg) { @@ -470,13 +585,33 @@ static inline uint16_t mavlink_msg_camera_information_get_cam_definition_version /** * @brief Get field cam_definition_uri from camera_information message * - * @return Camera definition URI (if any, otherwise only basic functions will be available). HTTP- (http://) and MAVLink FTP- (mavlinkftp://) formatted URIs are allowed (and both must be supported by any GCS that implements the Camera Protocol). + * @return Camera definition URI (if any, otherwise only basic functions will be available). HTTP- (http://) and MAVLink FTP- (mavlinkftp://) formatted URIs are allowed (and both must be supported by any GCS that implements the Camera Protocol). The definition file may be xz compressed, which will be indicated by the file extension .xml.xz (a GCS that implements the protocol must support decompressing the file). The string needs to be zero terminated. Use a zero-length string if not known. */ static inline uint16_t mavlink_msg_camera_information_get_cam_definition_uri(const mavlink_message_t* msg, char *cam_definition_uri) { return _MAV_RETURN_char_array(msg, cam_definition_uri, 140, 95); } +/** + * @brief Get field gimbal_device_id from camera_information message + * + * @return Gimbal id of a gimbal associated with this camera. This is the component id of the gimbal device, or 1-6 for non mavlink gimbals. Use 0 if no gimbal is associated with the camera. + */ +static inline uint8_t mavlink_msg_camera_information_get_gimbal_device_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 235); +} + +/** + * @brief Get field camera_device_id from camera_information message + * + * @return Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). + */ +static inline uint8_t mavlink_msg_camera_information_get_camera_device_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 236); +} + /** * @brief Decode a camera_information message into a struct * @@ -499,6 +634,8 @@ static inline void mavlink_msg_camera_information_decode(const mavlink_message_t mavlink_msg_camera_information_get_model_name(msg, camera_information->model_name); camera_information->lens_id = mavlink_msg_camera_information_get_lens_id(msg); mavlink_msg_camera_information_get_cam_definition_uri(msg, camera_information->cam_definition_uri); + camera_information->gimbal_device_id = mavlink_msg_camera_information_get_gimbal_device_id(msg); + camera_information->camera_device_id = mavlink_msg_camera_information_get_camera_device_id(msg); #else uint8_t len = msg->len < MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN? msg->len : MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN; memset(camera_information, 0, MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN); diff --git a/common/mavlink_msg_camera_settings.h b/common/mavlink_msg_camera_settings.h index 8f49780fa..0083d1556 100644 --- a/common/mavlink_msg_camera_settings.h +++ b/common/mavlink_msg_camera_settings.h @@ -7,13 +7,14 @@ MAVPACKED( typedef struct __mavlink_camera_settings_t { uint32_t time_boot_ms; /*< [ms] Timestamp (time since system boot).*/ uint8_t mode_id; /*< Camera mode*/ - float zoomLevel; /*< Current zoom level (0.0 to 100.0, NaN if not known)*/ - float focusLevel; /*< Current focus level (0.0 to 100.0, NaN if not known)*/ + float zoomLevel; /*< Current zoom level as a percentage of the full range (0.0 to 100.0, NaN if not known)*/ + float focusLevel; /*< Current focus level as a percentage of the full range (0.0 to 100.0, NaN if not known)*/ + uint8_t camera_device_id; /*< Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id).*/ }) mavlink_camera_settings_t; -#define MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN 13 +#define MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN 14 #define MAVLINK_MSG_ID_CAMERA_SETTINGS_MIN_LEN 5 -#define MAVLINK_MSG_ID_260_LEN 13 +#define MAVLINK_MSG_ID_260_LEN 14 #define MAVLINK_MSG_ID_260_MIN_LEN 5 #define MAVLINK_MSG_ID_CAMERA_SETTINGS_CRC 146 @@ -25,21 +26,23 @@ typedef struct __mavlink_camera_settings_t { #define MAVLINK_MESSAGE_INFO_CAMERA_SETTINGS { \ 260, \ "CAMERA_SETTINGS", \ - 4, \ + 5, \ { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_camera_settings_t, time_boot_ms) }, \ { "mode_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_camera_settings_t, mode_id) }, \ { "zoomLevel", NULL, MAVLINK_TYPE_FLOAT, 0, 5, offsetof(mavlink_camera_settings_t, zoomLevel) }, \ { "focusLevel", NULL, MAVLINK_TYPE_FLOAT, 0, 9, offsetof(mavlink_camera_settings_t, focusLevel) }, \ + { "camera_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_camera_settings_t, camera_device_id) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_CAMERA_SETTINGS { \ "CAMERA_SETTINGS", \ - 4, \ + 5, \ { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_camera_settings_t, time_boot_ms) }, \ { "mode_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_camera_settings_t, mode_id) }, \ { "zoomLevel", NULL, MAVLINK_TYPE_FLOAT, 0, 5, offsetof(mavlink_camera_settings_t, zoomLevel) }, \ { "focusLevel", NULL, MAVLINK_TYPE_FLOAT, 0, 9, offsetof(mavlink_camera_settings_t, focusLevel) }, \ + { "camera_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_camera_settings_t, camera_device_id) }, \ } \ } #endif @@ -52,12 +55,13 @@ typedef struct __mavlink_camera_settings_t { * * @param time_boot_ms [ms] Timestamp (time since system boot). * @param mode_id Camera mode - * @param zoomLevel Current zoom level (0.0 to 100.0, NaN if not known) - * @param focusLevel Current focus level (0.0 to 100.0, NaN if not known) + * @param zoomLevel Current zoom level as a percentage of the full range (0.0 to 100.0, NaN if not known) + * @param focusLevel Current focus level as a percentage of the full range (0.0 to 100.0, NaN if not known) + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_camera_settings_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint32_t time_boot_ms, uint8_t mode_id, float zoomLevel, float focusLevel) + uint32_t time_boot_ms, uint8_t mode_id, float zoomLevel, float focusLevel, uint8_t camera_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN]; @@ -65,6 +69,7 @@ static inline uint16_t mavlink_msg_camera_settings_pack(uint8_t system_id, uint8 _mav_put_uint8_t(buf, 4, mode_id); _mav_put_float(buf, 5, zoomLevel); _mav_put_float(buf, 9, focusLevel); + _mav_put_uint8_t(buf, 13, camera_device_id); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN); #else @@ -73,6 +78,7 @@ static inline uint16_t mavlink_msg_camera_settings_pack(uint8_t system_id, uint8 packet.mode_id = mode_id; packet.zoomLevel = zoomLevel; packet.focusLevel = focusLevel; + packet.camera_device_id = camera_device_id; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN); #endif @@ -81,6 +87,51 @@ static inline uint16_t mavlink_msg_camera_settings_pack(uint8_t system_id, uint8 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CAMERA_SETTINGS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN, MAVLINK_MSG_ID_CAMERA_SETTINGS_CRC); } +/** + * @brief Pack a camera_settings message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param mode_id Camera mode + * @param zoomLevel Current zoom level as a percentage of the full range (0.0 to 100.0, NaN if not known) + * @param focusLevel Current focus level as a percentage of the full range (0.0 to 100.0, NaN if not known) + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_camera_settings_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, uint8_t mode_id, float zoomLevel, float focusLevel, uint8_t camera_device_id) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_uint8_t(buf, 4, mode_id); + _mav_put_float(buf, 5, zoomLevel); + _mav_put_float(buf, 9, focusLevel); + _mav_put_uint8_t(buf, 13, camera_device_id); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN); +#else + mavlink_camera_settings_t packet; + packet.time_boot_ms = time_boot_ms; + packet.mode_id = mode_id; + packet.zoomLevel = zoomLevel; + packet.focusLevel = focusLevel; + packet.camera_device_id = camera_device_id; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CAMERA_SETTINGS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CAMERA_SETTINGS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN, MAVLINK_MSG_ID_CAMERA_SETTINGS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CAMERA_SETTINGS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN); +#endif +} + /** * @brief Pack a camera_settings message on a channel * @param system_id ID of this system @@ -89,13 +140,14 @@ static inline uint16_t mavlink_msg_camera_settings_pack(uint8_t system_id, uint8 * @param msg The MAVLink message to compress the data into * @param time_boot_ms [ms] Timestamp (time since system boot). * @param mode_id Camera mode - * @param zoomLevel Current zoom level (0.0 to 100.0, NaN if not known) - * @param focusLevel Current focus level (0.0 to 100.0, NaN if not known) + * @param zoomLevel Current zoom level as a percentage of the full range (0.0 to 100.0, NaN if not known) + * @param focusLevel Current focus level as a percentage of the full range (0.0 to 100.0, NaN if not known) + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_camera_settings_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - uint32_t time_boot_ms,uint8_t mode_id,float zoomLevel,float focusLevel) + uint32_t time_boot_ms,uint8_t mode_id,float zoomLevel,float focusLevel,uint8_t camera_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN]; @@ -103,6 +155,7 @@ static inline uint16_t mavlink_msg_camera_settings_pack_chan(uint8_t system_id, _mav_put_uint8_t(buf, 4, mode_id); _mav_put_float(buf, 5, zoomLevel); _mav_put_float(buf, 9, focusLevel); + _mav_put_uint8_t(buf, 13, camera_device_id); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN); #else @@ -111,6 +164,7 @@ static inline uint16_t mavlink_msg_camera_settings_pack_chan(uint8_t system_id, packet.mode_id = mode_id; packet.zoomLevel = zoomLevel; packet.focusLevel = focusLevel; + packet.camera_device_id = camera_device_id; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN); #endif @@ -129,7 +183,7 @@ static inline uint16_t mavlink_msg_camera_settings_pack_chan(uint8_t system_id, */ static inline uint16_t mavlink_msg_camera_settings_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_camera_settings_t* camera_settings) { - return mavlink_msg_camera_settings_pack(system_id, component_id, msg, camera_settings->time_boot_ms, camera_settings->mode_id, camera_settings->zoomLevel, camera_settings->focusLevel); + return mavlink_msg_camera_settings_pack(system_id, component_id, msg, camera_settings->time_boot_ms, camera_settings->mode_id, camera_settings->zoomLevel, camera_settings->focusLevel, camera_settings->camera_device_id); } /** @@ -143,7 +197,21 @@ static inline uint16_t mavlink_msg_camera_settings_encode(uint8_t system_id, uin */ static inline uint16_t mavlink_msg_camera_settings_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_camera_settings_t* camera_settings) { - return mavlink_msg_camera_settings_pack_chan(system_id, component_id, chan, msg, camera_settings->time_boot_ms, camera_settings->mode_id, camera_settings->zoomLevel, camera_settings->focusLevel); + return mavlink_msg_camera_settings_pack_chan(system_id, component_id, chan, msg, camera_settings->time_boot_ms, camera_settings->mode_id, camera_settings->zoomLevel, camera_settings->focusLevel, camera_settings->camera_device_id); +} + +/** + * @brief Encode a camera_settings struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param camera_settings C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_camera_settings_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_camera_settings_t* camera_settings) +{ + return mavlink_msg_camera_settings_pack_status(system_id, component_id, _status, msg, camera_settings->time_boot_ms, camera_settings->mode_id, camera_settings->zoomLevel, camera_settings->focusLevel, camera_settings->camera_device_id); } /** @@ -152,12 +220,13 @@ static inline uint16_t mavlink_msg_camera_settings_encode_chan(uint8_t system_id * * @param time_boot_ms [ms] Timestamp (time since system boot). * @param mode_id Camera mode - * @param zoomLevel Current zoom level (0.0 to 100.0, NaN if not known) - * @param focusLevel Current focus level (0.0 to 100.0, NaN if not known) + * @param zoomLevel Current zoom level as a percentage of the full range (0.0 to 100.0, NaN if not known) + * @param focusLevel Current focus level as a percentage of the full range (0.0 to 100.0, NaN if not known) + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_camera_settings_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t mode_id, float zoomLevel, float focusLevel) +static inline void mavlink_msg_camera_settings_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t mode_id, float zoomLevel, float focusLevel, uint8_t camera_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN]; @@ -165,6 +234,7 @@ static inline void mavlink_msg_camera_settings_send(mavlink_channel_t chan, uint _mav_put_uint8_t(buf, 4, mode_id); _mav_put_float(buf, 5, zoomLevel); _mav_put_float(buf, 9, focusLevel); + _mav_put_uint8_t(buf, 13, camera_device_id); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_SETTINGS, buf, MAVLINK_MSG_ID_CAMERA_SETTINGS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN, MAVLINK_MSG_ID_CAMERA_SETTINGS_CRC); #else @@ -173,6 +243,7 @@ static inline void mavlink_msg_camera_settings_send(mavlink_channel_t chan, uint packet.mode_id = mode_id; packet.zoomLevel = zoomLevel; packet.focusLevel = focusLevel; + packet.camera_device_id = camera_device_id; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_SETTINGS, (const char *)&packet, MAVLINK_MSG_ID_CAMERA_SETTINGS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN, MAVLINK_MSG_ID_CAMERA_SETTINGS_CRC); #endif @@ -186,7 +257,7 @@ static inline void mavlink_msg_camera_settings_send(mavlink_channel_t chan, uint static inline void mavlink_msg_camera_settings_send_struct(mavlink_channel_t chan, const mavlink_camera_settings_t* camera_settings) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_camera_settings_send(chan, camera_settings->time_boot_ms, camera_settings->mode_id, camera_settings->zoomLevel, camera_settings->focusLevel); + mavlink_msg_camera_settings_send(chan, camera_settings->time_boot_ms, camera_settings->mode_id, camera_settings->zoomLevel, camera_settings->focusLevel, camera_settings->camera_device_id); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_SETTINGS, (const char *)camera_settings, MAVLINK_MSG_ID_CAMERA_SETTINGS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN, MAVLINK_MSG_ID_CAMERA_SETTINGS_CRC); #endif @@ -194,13 +265,13 @@ static inline void mavlink_msg_camera_settings_send_struct(mavlink_channel_t cha #if MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_camera_settings_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t mode_id, float zoomLevel, float focusLevel) +static inline void mavlink_msg_camera_settings_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t mode_id, float zoomLevel, float focusLevel, uint8_t camera_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; @@ -208,6 +279,7 @@ static inline void mavlink_msg_camera_settings_send_buf(mavlink_message_t *msgbu _mav_put_uint8_t(buf, 4, mode_id); _mav_put_float(buf, 5, zoomLevel); _mav_put_float(buf, 9, focusLevel); + _mav_put_uint8_t(buf, 13, camera_device_id); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_SETTINGS, buf, MAVLINK_MSG_ID_CAMERA_SETTINGS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN, MAVLINK_MSG_ID_CAMERA_SETTINGS_CRC); #else @@ -216,6 +288,7 @@ static inline void mavlink_msg_camera_settings_send_buf(mavlink_message_t *msgbu packet->mode_id = mode_id; packet->zoomLevel = zoomLevel; packet->focusLevel = focusLevel; + packet->camera_device_id = camera_device_id; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_SETTINGS, (const char *)packet, MAVLINK_MSG_ID_CAMERA_SETTINGS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN, MAVLINK_MSG_ID_CAMERA_SETTINGS_CRC); #endif @@ -250,7 +323,7 @@ static inline uint8_t mavlink_msg_camera_settings_get_mode_id(const mavlink_mess /** * @brief Get field zoomLevel from camera_settings message * - * @return Current zoom level (0.0 to 100.0, NaN if not known) + * @return Current zoom level as a percentage of the full range (0.0 to 100.0, NaN if not known) */ static inline float mavlink_msg_camera_settings_get_zoomLevel(const mavlink_message_t* msg) { @@ -260,13 +333,23 @@ static inline float mavlink_msg_camera_settings_get_zoomLevel(const mavlink_mess /** * @brief Get field focusLevel from camera_settings message * - * @return Current focus level (0.0 to 100.0, NaN if not known) + * @return Current focus level as a percentage of the full range (0.0 to 100.0, NaN if not known) */ static inline float mavlink_msg_camera_settings_get_focusLevel(const mavlink_message_t* msg) { return _MAV_RETURN_float(msg, 9); } +/** + * @brief Get field camera_device_id from camera_settings message + * + * @return Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). + */ +static inline uint8_t mavlink_msg_camera_settings_get_camera_device_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 13); +} + /** * @brief Decode a camera_settings message into a struct * @@ -280,6 +363,7 @@ static inline void mavlink_msg_camera_settings_decode(const mavlink_message_t* m camera_settings->mode_id = mavlink_msg_camera_settings_get_mode_id(msg); camera_settings->zoomLevel = mavlink_msg_camera_settings_get_zoomLevel(msg); camera_settings->focusLevel = mavlink_msg_camera_settings_get_focusLevel(msg); + camera_settings->camera_device_id = mavlink_msg_camera_settings_get_camera_device_id(msg); #else uint8_t len = msg->len < MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN? msg->len : MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN; memset(camera_settings, 0, MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN); diff --git a/common/mavlink_msg_camera_thermal_range.h b/common/mavlink_msg_camera_thermal_range.h new file mode 100644 index 000000000..92ee507ff --- /dev/null +++ b/common/mavlink_msg_camera_thermal_range.h @@ -0,0 +1,484 @@ +#pragma once +// MESSAGE CAMERA_THERMAL_RANGE PACKING + +#define MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE 277 + + +typedef struct __mavlink_camera_thermal_range_t { + uint32_t time_boot_ms; /*< [ms] Timestamp (time since system boot).*/ + float max; /*< [degC] Temperature max.*/ + float max_point_x; /*< Temperature max point x value (normalized 0..1, 0 is left, 1 is right), NAN if unknown.*/ + float max_point_y; /*< Temperature max point y value (normalized 0..1, 0 is top, 1 is bottom), NAN if unknown.*/ + float min; /*< [degC] Temperature min.*/ + float min_point_x; /*< Temperature min point x value (normalized 0..1, 0 is left, 1 is right), NAN if unknown.*/ + float min_point_y; /*< Temperature min point y value (normalized 0..1, 0 is top, 1 is bottom), NAN if unknown.*/ + uint8_t stream_id; /*< Video Stream ID (1 for first, 2 for second, etc.)*/ + uint8_t camera_device_id; /*< Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id).*/ +} mavlink_camera_thermal_range_t; + +#define MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_LEN 30 +#define MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_MIN_LEN 30 +#define MAVLINK_MSG_ID_277_LEN 30 +#define MAVLINK_MSG_ID_277_MIN_LEN 30 + +#define MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_CRC 62 +#define MAVLINK_MSG_ID_277_CRC 62 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_CAMERA_THERMAL_RANGE { \ + 277, \ + "CAMERA_THERMAL_RANGE", \ + 9, \ + { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_camera_thermal_range_t, time_boot_ms) }, \ + { "stream_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_camera_thermal_range_t, stream_id) }, \ + { "camera_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_camera_thermal_range_t, camera_device_id) }, \ + { "max", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_camera_thermal_range_t, max) }, \ + { "max_point_x", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_camera_thermal_range_t, max_point_x) }, \ + { "max_point_y", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_camera_thermal_range_t, max_point_y) }, \ + { "min", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_camera_thermal_range_t, min) }, \ + { "min_point_x", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_camera_thermal_range_t, min_point_x) }, \ + { "min_point_y", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_camera_thermal_range_t, min_point_y) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_CAMERA_THERMAL_RANGE { \ + "CAMERA_THERMAL_RANGE", \ + 9, \ + { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_camera_thermal_range_t, time_boot_ms) }, \ + { "stream_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_camera_thermal_range_t, stream_id) }, \ + { "camera_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_camera_thermal_range_t, camera_device_id) }, \ + { "max", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_camera_thermal_range_t, max) }, \ + { "max_point_x", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_camera_thermal_range_t, max_point_x) }, \ + { "max_point_y", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_camera_thermal_range_t, max_point_y) }, \ + { "min", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_camera_thermal_range_t, min) }, \ + { "min_point_x", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_camera_thermal_range_t, min_point_x) }, \ + { "min_point_y", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_camera_thermal_range_t, min_point_y) }, \ + } \ +} +#endif + +/** + * @brief Pack a camera_thermal_range message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param stream_id Video Stream ID (1 for first, 2 for second, etc.) + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). + * @param max [degC] Temperature max. + * @param max_point_x Temperature max point x value (normalized 0..1, 0 is left, 1 is right), NAN if unknown. + * @param max_point_y Temperature max point y value (normalized 0..1, 0 is top, 1 is bottom), NAN if unknown. + * @param min [degC] Temperature min. + * @param min_point_x Temperature min point x value (normalized 0..1, 0 is left, 1 is right), NAN if unknown. + * @param min_point_y Temperature min point y value (normalized 0..1, 0 is top, 1 is bottom), NAN if unknown. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_camera_thermal_range_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint32_t time_boot_ms, uint8_t stream_id, uint8_t camera_device_id, float max, float max_point_x, float max_point_y, float min, float min_point_x, float min_point_y) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_float(buf, 4, max); + _mav_put_float(buf, 8, max_point_x); + _mav_put_float(buf, 12, max_point_y); + _mav_put_float(buf, 16, min); + _mav_put_float(buf, 20, min_point_x); + _mav_put_float(buf, 24, min_point_y); + _mav_put_uint8_t(buf, 28, stream_id); + _mav_put_uint8_t(buf, 29, camera_device_id); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_LEN); +#else + mavlink_camera_thermal_range_t packet; + packet.time_boot_ms = time_boot_ms; + packet.max = max; + packet.max_point_x = max_point_x; + packet.max_point_y = max_point_y; + packet.min = min; + packet.min_point_x = min_point_x; + packet.min_point_y = min_point_y; + packet.stream_id = stream_id; + packet.camera_device_id = camera_device_id; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_MIN_LEN, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_LEN, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_CRC); +} + +/** + * @brief Pack a camera_thermal_range message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param stream_id Video Stream ID (1 for first, 2 for second, etc.) + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). + * @param max [degC] Temperature max. + * @param max_point_x Temperature max point x value (normalized 0..1, 0 is left, 1 is right), NAN if unknown. + * @param max_point_y Temperature max point y value (normalized 0..1, 0 is top, 1 is bottom), NAN if unknown. + * @param min [degC] Temperature min. + * @param min_point_x Temperature min point x value (normalized 0..1, 0 is left, 1 is right), NAN if unknown. + * @param min_point_y Temperature min point y value (normalized 0..1, 0 is top, 1 is bottom), NAN if unknown. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_camera_thermal_range_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, uint8_t stream_id, uint8_t camera_device_id, float max, float max_point_x, float max_point_y, float min, float min_point_x, float min_point_y) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_float(buf, 4, max); + _mav_put_float(buf, 8, max_point_x); + _mav_put_float(buf, 12, max_point_y); + _mav_put_float(buf, 16, min); + _mav_put_float(buf, 20, min_point_x); + _mav_put_float(buf, 24, min_point_y); + _mav_put_uint8_t(buf, 28, stream_id); + _mav_put_uint8_t(buf, 29, camera_device_id); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_LEN); +#else + mavlink_camera_thermal_range_t packet; + packet.time_boot_ms = time_boot_ms; + packet.max = max; + packet.max_point_x = max_point_x; + packet.max_point_y = max_point_y; + packet.min = min; + packet.min_point_x = min_point_x; + packet.min_point_y = min_point_y; + packet.stream_id = stream_id; + packet.camera_device_id = camera_device_id; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_MIN_LEN, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_LEN, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_MIN_LEN, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_LEN); +#endif +} + +/** + * @brief Pack a camera_thermal_range message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param stream_id Video Stream ID (1 for first, 2 for second, etc.) + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). + * @param max [degC] Temperature max. + * @param max_point_x Temperature max point x value (normalized 0..1, 0 is left, 1 is right), NAN if unknown. + * @param max_point_y Temperature max point y value (normalized 0..1, 0 is top, 1 is bottom), NAN if unknown. + * @param min [degC] Temperature min. + * @param min_point_x Temperature min point x value (normalized 0..1, 0 is left, 1 is right), NAN if unknown. + * @param min_point_y Temperature min point y value (normalized 0..1, 0 is top, 1 is bottom), NAN if unknown. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_camera_thermal_range_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint32_t time_boot_ms,uint8_t stream_id,uint8_t camera_device_id,float max,float max_point_x,float max_point_y,float min,float min_point_x,float min_point_y) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_float(buf, 4, max); + _mav_put_float(buf, 8, max_point_x); + _mav_put_float(buf, 12, max_point_y); + _mav_put_float(buf, 16, min); + _mav_put_float(buf, 20, min_point_x); + _mav_put_float(buf, 24, min_point_y); + _mav_put_uint8_t(buf, 28, stream_id); + _mav_put_uint8_t(buf, 29, camera_device_id); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_LEN); +#else + mavlink_camera_thermal_range_t packet; + packet.time_boot_ms = time_boot_ms; + packet.max = max; + packet.max_point_x = max_point_x; + packet.max_point_y = max_point_y; + packet.min = min; + packet.min_point_x = min_point_x; + packet.min_point_y = min_point_y; + packet.stream_id = stream_id; + packet.camera_device_id = camera_device_id; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_MIN_LEN, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_LEN, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_CRC); +} + +/** + * @brief Encode a camera_thermal_range struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param camera_thermal_range C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_camera_thermal_range_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_camera_thermal_range_t* camera_thermal_range) +{ + return mavlink_msg_camera_thermal_range_pack(system_id, component_id, msg, camera_thermal_range->time_boot_ms, camera_thermal_range->stream_id, camera_thermal_range->camera_device_id, camera_thermal_range->max, camera_thermal_range->max_point_x, camera_thermal_range->max_point_y, camera_thermal_range->min, camera_thermal_range->min_point_x, camera_thermal_range->min_point_y); +} + +/** + * @brief Encode a camera_thermal_range struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param camera_thermal_range C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_camera_thermal_range_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_camera_thermal_range_t* camera_thermal_range) +{ + return mavlink_msg_camera_thermal_range_pack_chan(system_id, component_id, chan, msg, camera_thermal_range->time_boot_ms, camera_thermal_range->stream_id, camera_thermal_range->camera_device_id, camera_thermal_range->max, camera_thermal_range->max_point_x, camera_thermal_range->max_point_y, camera_thermal_range->min, camera_thermal_range->min_point_x, camera_thermal_range->min_point_y); +} + +/** + * @brief Encode a camera_thermal_range struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param camera_thermal_range C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_camera_thermal_range_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_camera_thermal_range_t* camera_thermal_range) +{ + return mavlink_msg_camera_thermal_range_pack_status(system_id, component_id, _status, msg, camera_thermal_range->time_boot_ms, camera_thermal_range->stream_id, camera_thermal_range->camera_device_id, camera_thermal_range->max, camera_thermal_range->max_point_x, camera_thermal_range->max_point_y, camera_thermal_range->min, camera_thermal_range->min_point_x, camera_thermal_range->min_point_y); +} + +/** + * @brief Send a camera_thermal_range message + * @param chan MAVLink channel to send the message + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param stream_id Video Stream ID (1 for first, 2 for second, etc.) + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). + * @param max [degC] Temperature max. + * @param max_point_x Temperature max point x value (normalized 0..1, 0 is left, 1 is right), NAN if unknown. + * @param max_point_y Temperature max point y value (normalized 0..1, 0 is top, 1 is bottom), NAN if unknown. + * @param min [degC] Temperature min. + * @param min_point_x Temperature min point x value (normalized 0..1, 0 is left, 1 is right), NAN if unknown. + * @param min_point_y Temperature min point y value (normalized 0..1, 0 is top, 1 is bottom), NAN if unknown. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_camera_thermal_range_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t stream_id, uint8_t camera_device_id, float max, float max_point_x, float max_point_y, float min, float min_point_x, float min_point_y) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_float(buf, 4, max); + _mav_put_float(buf, 8, max_point_x); + _mav_put_float(buf, 12, max_point_y); + _mav_put_float(buf, 16, min); + _mav_put_float(buf, 20, min_point_x); + _mav_put_float(buf, 24, min_point_y); + _mav_put_uint8_t(buf, 28, stream_id); + _mav_put_uint8_t(buf, 29, camera_device_id); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE, buf, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_MIN_LEN, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_LEN, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_CRC); +#else + mavlink_camera_thermal_range_t packet; + packet.time_boot_ms = time_boot_ms; + packet.max = max; + packet.max_point_x = max_point_x; + packet.max_point_y = max_point_y; + packet.min = min; + packet.min_point_x = min_point_x; + packet.min_point_y = min_point_y; + packet.stream_id = stream_id; + packet.camera_device_id = camera_device_id; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE, (const char *)&packet, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_MIN_LEN, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_LEN, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_CRC); +#endif +} + +/** + * @brief Send a camera_thermal_range message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_camera_thermal_range_send_struct(mavlink_channel_t chan, const mavlink_camera_thermal_range_t* camera_thermal_range) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_camera_thermal_range_send(chan, camera_thermal_range->time_boot_ms, camera_thermal_range->stream_id, camera_thermal_range->camera_device_id, camera_thermal_range->max, camera_thermal_range->max_point_x, camera_thermal_range->max_point_y, camera_thermal_range->min, camera_thermal_range->min_point_x, camera_thermal_range->min_point_y); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE, (const char *)camera_thermal_range, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_MIN_LEN, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_LEN, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_CRC); +#endif +} + +#if MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_camera_thermal_range_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t stream_id, uint8_t camera_device_id, float max, float max_point_x, float max_point_y, float min, float min_point_x, float min_point_y) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_float(buf, 4, max); + _mav_put_float(buf, 8, max_point_x); + _mav_put_float(buf, 12, max_point_y); + _mav_put_float(buf, 16, min); + _mav_put_float(buf, 20, min_point_x); + _mav_put_float(buf, 24, min_point_y); + _mav_put_uint8_t(buf, 28, stream_id); + _mav_put_uint8_t(buf, 29, camera_device_id); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE, buf, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_MIN_LEN, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_LEN, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_CRC); +#else + mavlink_camera_thermal_range_t *packet = (mavlink_camera_thermal_range_t *)msgbuf; + packet->time_boot_ms = time_boot_ms; + packet->max = max; + packet->max_point_x = max_point_x; + packet->max_point_y = max_point_y; + packet->min = min; + packet->min_point_x = min_point_x; + packet->min_point_y = min_point_y; + packet->stream_id = stream_id; + packet->camera_device_id = camera_device_id; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE, (const char *)packet, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_MIN_LEN, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_LEN, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_CRC); +#endif +} +#endif + +#endif + +// MESSAGE CAMERA_THERMAL_RANGE UNPACKING + + +/** + * @brief Get field time_boot_ms from camera_thermal_range message + * + * @return [ms] Timestamp (time since system boot). + */ +static inline uint32_t mavlink_msg_camera_thermal_range_get_time_boot_ms(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 0); +} + +/** + * @brief Get field stream_id from camera_thermal_range message + * + * @return Video Stream ID (1 for first, 2 for second, etc.) + */ +static inline uint8_t mavlink_msg_camera_thermal_range_get_stream_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 28); +} + +/** + * @brief Get field camera_device_id from camera_thermal_range message + * + * @return Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). + */ +static inline uint8_t mavlink_msg_camera_thermal_range_get_camera_device_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 29); +} + +/** + * @brief Get field max from camera_thermal_range message + * + * @return [degC] Temperature max. + */ +static inline float mavlink_msg_camera_thermal_range_get_max(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 4); +} + +/** + * @brief Get field max_point_x from camera_thermal_range message + * + * @return Temperature max point x value (normalized 0..1, 0 is left, 1 is right), NAN if unknown. + */ +static inline float mavlink_msg_camera_thermal_range_get_max_point_x(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 8); +} + +/** + * @brief Get field max_point_y from camera_thermal_range message + * + * @return Temperature max point y value (normalized 0..1, 0 is top, 1 is bottom), NAN if unknown. + */ +static inline float mavlink_msg_camera_thermal_range_get_max_point_y(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 12); +} + +/** + * @brief Get field min from camera_thermal_range message + * + * @return [degC] Temperature min. + */ +static inline float mavlink_msg_camera_thermal_range_get_min(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 16); +} + +/** + * @brief Get field min_point_x from camera_thermal_range message + * + * @return Temperature min point x value (normalized 0..1, 0 is left, 1 is right), NAN if unknown. + */ +static inline float mavlink_msg_camera_thermal_range_get_min_point_x(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 20); +} + +/** + * @brief Get field min_point_y from camera_thermal_range message + * + * @return Temperature min point y value (normalized 0..1, 0 is top, 1 is bottom), NAN if unknown. + */ +static inline float mavlink_msg_camera_thermal_range_get_min_point_y(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 24); +} + +/** + * @brief Decode a camera_thermal_range message into a struct + * + * @param msg The message to decode + * @param camera_thermal_range C-struct to decode the message contents into + */ +static inline void mavlink_msg_camera_thermal_range_decode(const mavlink_message_t* msg, mavlink_camera_thermal_range_t* camera_thermal_range) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + camera_thermal_range->time_boot_ms = mavlink_msg_camera_thermal_range_get_time_boot_ms(msg); + camera_thermal_range->max = mavlink_msg_camera_thermal_range_get_max(msg); + camera_thermal_range->max_point_x = mavlink_msg_camera_thermal_range_get_max_point_x(msg); + camera_thermal_range->max_point_y = mavlink_msg_camera_thermal_range_get_max_point_y(msg); + camera_thermal_range->min = mavlink_msg_camera_thermal_range_get_min(msg); + camera_thermal_range->min_point_x = mavlink_msg_camera_thermal_range_get_min_point_x(msg); + camera_thermal_range->min_point_y = mavlink_msg_camera_thermal_range_get_min_point_y(msg); + camera_thermal_range->stream_id = mavlink_msg_camera_thermal_range_get_stream_id(msg); + camera_thermal_range->camera_device_id = mavlink_msg_camera_thermal_range_get_camera_device_id(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_LEN? msg->len : MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_LEN; + memset(camera_thermal_range, 0, MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_LEN); + memcpy(camera_thermal_range, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/common/mavlink_msg_camera_tracking_geo_status.h b/common/mavlink_msg_camera_tracking_geo_status.h index f4e22b98f..4876870a5 100644 --- a/common/mavlink_msg_camera_tracking_geo_status.h +++ b/common/mavlink_msg_camera_tracking_geo_status.h @@ -18,11 +18,12 @@ typedef struct __mavlink_camera_tracking_geo_status_t { float hdg; /*< [rad] Heading in radians, in NED. NAN if unknown*/ float hdg_acc; /*< [rad] Accuracy of heading, in NED. NAN if unknown*/ uint8_t tracking_status; /*< Current tracking status*/ + uint8_t camera_device_id; /*< Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id).*/ } mavlink_camera_tracking_geo_status_t; -#define MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_LEN 49 +#define MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_LEN 50 #define MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_MIN_LEN 49 -#define MAVLINK_MSG_ID_276_LEN 49 +#define MAVLINK_MSG_ID_276_LEN 50 #define MAVLINK_MSG_ID_276_MIN_LEN 49 #define MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_CRC 18 @@ -34,7 +35,7 @@ typedef struct __mavlink_camera_tracking_geo_status_t { #define MAVLINK_MESSAGE_INFO_CAMERA_TRACKING_GEO_STATUS { \ 276, \ "CAMERA_TRACKING_GEO_STATUS", \ - 13, \ + 14, \ { { "tracking_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 48, offsetof(mavlink_camera_tracking_geo_status_t, tracking_status) }, \ { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_camera_tracking_geo_status_t, lat) }, \ { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_camera_tracking_geo_status_t, lon) }, \ @@ -48,12 +49,13 @@ typedef struct __mavlink_camera_tracking_geo_status_t { { "dist", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_camera_tracking_geo_status_t, dist) }, \ { "hdg", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_camera_tracking_geo_status_t, hdg) }, \ { "hdg_acc", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_camera_tracking_geo_status_t, hdg_acc) }, \ + { "camera_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 49, offsetof(mavlink_camera_tracking_geo_status_t, camera_device_id) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_CAMERA_TRACKING_GEO_STATUS { \ "CAMERA_TRACKING_GEO_STATUS", \ - 13, \ + 14, \ { { "tracking_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 48, offsetof(mavlink_camera_tracking_geo_status_t, tracking_status) }, \ { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_camera_tracking_geo_status_t, lat) }, \ { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_camera_tracking_geo_status_t, lon) }, \ @@ -67,6 +69,7 @@ typedef struct __mavlink_camera_tracking_geo_status_t { { "dist", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_camera_tracking_geo_status_t, dist) }, \ { "hdg", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_camera_tracking_geo_status_t, hdg) }, \ { "hdg_acc", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_camera_tracking_geo_status_t, hdg_acc) }, \ + { "camera_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 49, offsetof(mavlink_camera_tracking_geo_status_t, camera_device_id) }, \ } \ } #endif @@ -90,10 +93,11 @@ typedef struct __mavlink_camera_tracking_geo_status_t { * @param dist [m] Distance between camera and tracked object. NAN if unknown * @param hdg [rad] Heading in radians, in NED. NAN if unknown * @param hdg_acc [rad] Accuracy of heading, in NED. NAN if unknown + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_camera_tracking_geo_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t tracking_status, int32_t lat, int32_t lon, float alt, float h_acc, float v_acc, float vel_n, float vel_e, float vel_d, float vel_acc, float dist, float hdg, float hdg_acc) + uint8_t tracking_status, int32_t lat, int32_t lon, float alt, float h_acc, float v_acc, float vel_n, float vel_e, float vel_d, float vel_acc, float dist, float hdg, float hdg_acc, uint8_t camera_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_LEN]; @@ -110,6 +114,7 @@ static inline uint16_t mavlink_msg_camera_tracking_geo_status_pack(uint8_t syste _mav_put_float(buf, 40, hdg); _mav_put_float(buf, 44, hdg_acc); _mav_put_uint8_t(buf, 48, tracking_status); + _mav_put_uint8_t(buf, 49, camera_device_id); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_LEN); #else @@ -127,6 +132,7 @@ static inline uint16_t mavlink_msg_camera_tracking_geo_status_pack(uint8_t syste packet.hdg = hdg; packet.hdg_acc = hdg_acc; packet.tracking_status = tracking_status; + packet.camera_device_id = camera_device_id; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_LEN); #endif @@ -135,6 +141,78 @@ static inline uint16_t mavlink_msg_camera_tracking_geo_status_pack(uint8_t syste return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_CRC); } +/** + * @brief Pack a camera_tracking_geo_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param tracking_status Current tracking status + * @param lat [degE7] Latitude of tracked object + * @param lon [degE7] Longitude of tracked object + * @param alt [m] Altitude of tracked object(AMSL, WGS84) + * @param h_acc [m] Horizontal accuracy. NAN if unknown + * @param v_acc [m] Vertical accuracy. NAN if unknown + * @param vel_n [m/s] North velocity of tracked object. NAN if unknown + * @param vel_e [m/s] East velocity of tracked object. NAN if unknown + * @param vel_d [m/s] Down velocity of tracked object. NAN if unknown + * @param vel_acc [m/s] Velocity accuracy. NAN if unknown + * @param dist [m] Distance between camera and tracked object. NAN if unknown + * @param hdg [rad] Heading in radians, in NED. NAN if unknown + * @param hdg_acc [rad] Accuracy of heading, in NED. NAN if unknown + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_camera_tracking_geo_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t tracking_status, int32_t lat, int32_t lon, float alt, float h_acc, float v_acc, float vel_n, float vel_e, float vel_d, float vel_acc, float dist, float hdg, float hdg_acc, uint8_t camera_device_id) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_LEN]; + _mav_put_int32_t(buf, 0, lat); + _mav_put_int32_t(buf, 4, lon); + _mav_put_float(buf, 8, alt); + _mav_put_float(buf, 12, h_acc); + _mav_put_float(buf, 16, v_acc); + _mav_put_float(buf, 20, vel_n); + _mav_put_float(buf, 24, vel_e); + _mav_put_float(buf, 28, vel_d); + _mav_put_float(buf, 32, vel_acc); + _mav_put_float(buf, 36, dist); + _mav_put_float(buf, 40, hdg); + _mav_put_float(buf, 44, hdg_acc); + _mav_put_uint8_t(buf, 48, tracking_status); + _mav_put_uint8_t(buf, 49, camera_device_id); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_LEN); +#else + mavlink_camera_tracking_geo_status_t packet; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.h_acc = h_acc; + packet.v_acc = v_acc; + packet.vel_n = vel_n; + packet.vel_e = vel_e; + packet.vel_d = vel_d; + packet.vel_acc = vel_acc; + packet.dist = dist; + packet.hdg = hdg; + packet.hdg_acc = hdg_acc; + packet.tracking_status = tracking_status; + packet.camera_device_id = camera_device_id; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_LEN); +#endif +} + /** * @brief Pack a camera_tracking_geo_status message on a channel * @param system_id ID of this system @@ -154,11 +232,12 @@ static inline uint16_t mavlink_msg_camera_tracking_geo_status_pack(uint8_t syste * @param dist [m] Distance between camera and tracked object. NAN if unknown * @param hdg [rad] Heading in radians, in NED. NAN if unknown * @param hdg_acc [rad] Accuracy of heading, in NED. NAN if unknown + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_camera_tracking_geo_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - uint8_t tracking_status,int32_t lat,int32_t lon,float alt,float h_acc,float v_acc,float vel_n,float vel_e,float vel_d,float vel_acc,float dist,float hdg,float hdg_acc) + uint8_t tracking_status,int32_t lat,int32_t lon,float alt,float h_acc,float v_acc,float vel_n,float vel_e,float vel_d,float vel_acc,float dist,float hdg,float hdg_acc,uint8_t camera_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_LEN]; @@ -175,6 +254,7 @@ static inline uint16_t mavlink_msg_camera_tracking_geo_status_pack_chan(uint8_t _mav_put_float(buf, 40, hdg); _mav_put_float(buf, 44, hdg_acc); _mav_put_uint8_t(buf, 48, tracking_status); + _mav_put_uint8_t(buf, 49, camera_device_id); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_LEN); #else @@ -192,6 +272,7 @@ static inline uint16_t mavlink_msg_camera_tracking_geo_status_pack_chan(uint8_t packet.hdg = hdg; packet.hdg_acc = hdg_acc; packet.tracking_status = tracking_status; + packet.camera_device_id = camera_device_id; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_LEN); #endif @@ -210,7 +291,7 @@ static inline uint16_t mavlink_msg_camera_tracking_geo_status_pack_chan(uint8_t */ static inline uint16_t mavlink_msg_camera_tracking_geo_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_camera_tracking_geo_status_t* camera_tracking_geo_status) { - return mavlink_msg_camera_tracking_geo_status_pack(system_id, component_id, msg, camera_tracking_geo_status->tracking_status, camera_tracking_geo_status->lat, camera_tracking_geo_status->lon, camera_tracking_geo_status->alt, camera_tracking_geo_status->h_acc, camera_tracking_geo_status->v_acc, camera_tracking_geo_status->vel_n, camera_tracking_geo_status->vel_e, camera_tracking_geo_status->vel_d, camera_tracking_geo_status->vel_acc, camera_tracking_geo_status->dist, camera_tracking_geo_status->hdg, camera_tracking_geo_status->hdg_acc); + return mavlink_msg_camera_tracking_geo_status_pack(system_id, component_id, msg, camera_tracking_geo_status->tracking_status, camera_tracking_geo_status->lat, camera_tracking_geo_status->lon, camera_tracking_geo_status->alt, camera_tracking_geo_status->h_acc, camera_tracking_geo_status->v_acc, camera_tracking_geo_status->vel_n, camera_tracking_geo_status->vel_e, camera_tracking_geo_status->vel_d, camera_tracking_geo_status->vel_acc, camera_tracking_geo_status->dist, camera_tracking_geo_status->hdg, camera_tracking_geo_status->hdg_acc, camera_tracking_geo_status->camera_device_id); } /** @@ -224,7 +305,21 @@ static inline uint16_t mavlink_msg_camera_tracking_geo_status_encode(uint8_t sys */ static inline uint16_t mavlink_msg_camera_tracking_geo_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_camera_tracking_geo_status_t* camera_tracking_geo_status) { - return mavlink_msg_camera_tracking_geo_status_pack_chan(system_id, component_id, chan, msg, camera_tracking_geo_status->tracking_status, camera_tracking_geo_status->lat, camera_tracking_geo_status->lon, camera_tracking_geo_status->alt, camera_tracking_geo_status->h_acc, camera_tracking_geo_status->v_acc, camera_tracking_geo_status->vel_n, camera_tracking_geo_status->vel_e, camera_tracking_geo_status->vel_d, camera_tracking_geo_status->vel_acc, camera_tracking_geo_status->dist, camera_tracking_geo_status->hdg, camera_tracking_geo_status->hdg_acc); + return mavlink_msg_camera_tracking_geo_status_pack_chan(system_id, component_id, chan, msg, camera_tracking_geo_status->tracking_status, camera_tracking_geo_status->lat, camera_tracking_geo_status->lon, camera_tracking_geo_status->alt, camera_tracking_geo_status->h_acc, camera_tracking_geo_status->v_acc, camera_tracking_geo_status->vel_n, camera_tracking_geo_status->vel_e, camera_tracking_geo_status->vel_d, camera_tracking_geo_status->vel_acc, camera_tracking_geo_status->dist, camera_tracking_geo_status->hdg, camera_tracking_geo_status->hdg_acc, camera_tracking_geo_status->camera_device_id); +} + +/** + * @brief Encode a camera_tracking_geo_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param camera_tracking_geo_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_camera_tracking_geo_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_camera_tracking_geo_status_t* camera_tracking_geo_status) +{ + return mavlink_msg_camera_tracking_geo_status_pack_status(system_id, component_id, _status, msg, camera_tracking_geo_status->tracking_status, camera_tracking_geo_status->lat, camera_tracking_geo_status->lon, camera_tracking_geo_status->alt, camera_tracking_geo_status->h_acc, camera_tracking_geo_status->v_acc, camera_tracking_geo_status->vel_n, camera_tracking_geo_status->vel_e, camera_tracking_geo_status->vel_d, camera_tracking_geo_status->vel_acc, camera_tracking_geo_status->dist, camera_tracking_geo_status->hdg, camera_tracking_geo_status->hdg_acc, camera_tracking_geo_status->camera_device_id); } /** @@ -244,10 +339,11 @@ static inline uint16_t mavlink_msg_camera_tracking_geo_status_encode_chan(uint8_ * @param dist [m] Distance between camera and tracked object. NAN if unknown * @param hdg [rad] Heading in radians, in NED. NAN if unknown * @param hdg_acc [rad] Accuracy of heading, in NED. NAN if unknown + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_camera_tracking_geo_status_send(mavlink_channel_t chan, uint8_t tracking_status, int32_t lat, int32_t lon, float alt, float h_acc, float v_acc, float vel_n, float vel_e, float vel_d, float vel_acc, float dist, float hdg, float hdg_acc) +static inline void mavlink_msg_camera_tracking_geo_status_send(mavlink_channel_t chan, uint8_t tracking_status, int32_t lat, int32_t lon, float alt, float h_acc, float v_acc, float vel_n, float vel_e, float vel_d, float vel_acc, float dist, float hdg, float hdg_acc, uint8_t camera_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_LEN]; @@ -264,6 +360,7 @@ static inline void mavlink_msg_camera_tracking_geo_status_send(mavlink_channel_t _mav_put_float(buf, 40, hdg); _mav_put_float(buf, 44, hdg_acc); _mav_put_uint8_t(buf, 48, tracking_status); + _mav_put_uint8_t(buf, 49, camera_device_id); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS, buf, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_CRC); #else @@ -281,6 +378,7 @@ static inline void mavlink_msg_camera_tracking_geo_status_send(mavlink_channel_t packet.hdg = hdg; packet.hdg_acc = hdg_acc; packet.tracking_status = tracking_status; + packet.camera_device_id = camera_device_id; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS, (const char *)&packet, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_CRC); #endif @@ -294,7 +392,7 @@ static inline void mavlink_msg_camera_tracking_geo_status_send(mavlink_channel_t static inline void mavlink_msg_camera_tracking_geo_status_send_struct(mavlink_channel_t chan, const mavlink_camera_tracking_geo_status_t* camera_tracking_geo_status) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_camera_tracking_geo_status_send(chan, camera_tracking_geo_status->tracking_status, camera_tracking_geo_status->lat, camera_tracking_geo_status->lon, camera_tracking_geo_status->alt, camera_tracking_geo_status->h_acc, camera_tracking_geo_status->v_acc, camera_tracking_geo_status->vel_n, camera_tracking_geo_status->vel_e, camera_tracking_geo_status->vel_d, camera_tracking_geo_status->vel_acc, camera_tracking_geo_status->dist, camera_tracking_geo_status->hdg, camera_tracking_geo_status->hdg_acc); + mavlink_msg_camera_tracking_geo_status_send(chan, camera_tracking_geo_status->tracking_status, camera_tracking_geo_status->lat, camera_tracking_geo_status->lon, camera_tracking_geo_status->alt, camera_tracking_geo_status->h_acc, camera_tracking_geo_status->v_acc, camera_tracking_geo_status->vel_n, camera_tracking_geo_status->vel_e, camera_tracking_geo_status->vel_d, camera_tracking_geo_status->vel_acc, camera_tracking_geo_status->dist, camera_tracking_geo_status->hdg, camera_tracking_geo_status->hdg_acc, camera_tracking_geo_status->camera_device_id); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS, (const char *)camera_tracking_geo_status, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_CRC); #endif @@ -302,13 +400,13 @@ static inline void mavlink_msg_camera_tracking_geo_status_send_struct(mavlink_ch #if MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_camera_tracking_geo_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t tracking_status, int32_t lat, int32_t lon, float alt, float h_acc, float v_acc, float vel_n, float vel_e, float vel_d, float vel_acc, float dist, float hdg, float hdg_acc) +static inline void mavlink_msg_camera_tracking_geo_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t tracking_status, int32_t lat, int32_t lon, float alt, float h_acc, float v_acc, float vel_n, float vel_e, float vel_d, float vel_acc, float dist, float hdg, float hdg_acc, uint8_t camera_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; @@ -325,6 +423,7 @@ static inline void mavlink_msg_camera_tracking_geo_status_send_buf(mavlink_messa _mav_put_float(buf, 40, hdg); _mav_put_float(buf, 44, hdg_acc); _mav_put_uint8_t(buf, 48, tracking_status); + _mav_put_uint8_t(buf, 49, camera_device_id); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS, buf, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_CRC); #else @@ -342,6 +441,7 @@ static inline void mavlink_msg_camera_tracking_geo_status_send_buf(mavlink_messa packet->hdg = hdg; packet->hdg_acc = hdg_acc; packet->tracking_status = tracking_status; + packet->camera_device_id = camera_device_id; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS, (const char *)packet, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_CRC); #endif @@ -483,6 +583,16 @@ static inline float mavlink_msg_camera_tracking_geo_status_get_hdg_acc(const mav return _MAV_RETURN_float(msg, 44); } +/** + * @brief Get field camera_device_id from camera_tracking_geo_status message + * + * @return Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). + */ +static inline uint8_t mavlink_msg_camera_tracking_geo_status_get_camera_device_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 49); +} + /** * @brief Decode a camera_tracking_geo_status message into a struct * @@ -505,6 +615,7 @@ static inline void mavlink_msg_camera_tracking_geo_status_decode(const mavlink_m camera_tracking_geo_status->hdg = mavlink_msg_camera_tracking_geo_status_get_hdg(msg); camera_tracking_geo_status->hdg_acc = mavlink_msg_camera_tracking_geo_status_get_hdg_acc(msg); camera_tracking_geo_status->tracking_status = mavlink_msg_camera_tracking_geo_status_get_tracking_status(msg); + camera_tracking_geo_status->camera_device_id = mavlink_msg_camera_tracking_geo_status_get_camera_device_id(msg); #else uint8_t len = msg->len < MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_LEN? msg->len : MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_LEN; memset(camera_tracking_geo_status, 0, MAVLINK_MSG_ID_CAMERA_TRACKING_GEO_STATUS_LEN); diff --git a/common/mavlink_msg_camera_tracking_image_status.h b/common/mavlink_msg_camera_tracking_image_status.h index 5f703fce5..48dcd6ef9 100644 --- a/common/mavlink_msg_camera_tracking_image_status.h +++ b/common/mavlink_msg_camera_tracking_image_status.h @@ -15,11 +15,12 @@ typedef struct __mavlink_camera_tracking_image_status_t { uint8_t tracking_status; /*< Current tracking status*/ uint8_t tracking_mode; /*< Current tracking mode*/ uint8_t target_data; /*< Defines location of target data*/ + uint8_t camera_device_id; /*< Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id).*/ } mavlink_camera_tracking_image_status_t; -#define MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_LEN 31 +#define MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_LEN 32 #define MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_MIN_LEN 31 -#define MAVLINK_MSG_ID_275_LEN 31 +#define MAVLINK_MSG_ID_275_LEN 32 #define MAVLINK_MSG_ID_275_MIN_LEN 31 #define MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_CRC 126 @@ -31,7 +32,7 @@ typedef struct __mavlink_camera_tracking_image_status_t { #define MAVLINK_MESSAGE_INFO_CAMERA_TRACKING_IMAGE_STATUS { \ 275, \ "CAMERA_TRACKING_IMAGE_STATUS", \ - 10, \ + 11, \ { { "tracking_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_camera_tracking_image_status_t, tracking_status) }, \ { "tracking_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_camera_tracking_image_status_t, tracking_mode) }, \ { "target_data", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_camera_tracking_image_status_t, target_data) }, \ @@ -42,12 +43,13 @@ typedef struct __mavlink_camera_tracking_image_status_t { { "rec_top_y", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_camera_tracking_image_status_t, rec_top_y) }, \ { "rec_bottom_x", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_camera_tracking_image_status_t, rec_bottom_x) }, \ { "rec_bottom_y", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_camera_tracking_image_status_t, rec_bottom_y) }, \ + { "camera_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_camera_tracking_image_status_t, camera_device_id) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_CAMERA_TRACKING_IMAGE_STATUS { \ "CAMERA_TRACKING_IMAGE_STATUS", \ - 10, \ + 11, \ { { "tracking_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_camera_tracking_image_status_t, tracking_status) }, \ { "tracking_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_camera_tracking_image_status_t, tracking_mode) }, \ { "target_data", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_camera_tracking_image_status_t, target_data) }, \ @@ -58,6 +60,7 @@ typedef struct __mavlink_camera_tracking_image_status_t { { "rec_top_y", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_camera_tracking_image_status_t, rec_top_y) }, \ { "rec_bottom_x", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_camera_tracking_image_status_t, rec_bottom_x) }, \ { "rec_bottom_y", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_camera_tracking_image_status_t, rec_bottom_y) }, \ + { "camera_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_camera_tracking_image_status_t, camera_device_id) }, \ } \ } #endif @@ -78,10 +81,11 @@ typedef struct __mavlink_camera_tracking_image_status_t { * @param rec_top_y Current tracked rectangle top y value if CAMERA_TRACKING_MODE_RECTANGLE (normalized 0..1, 0 is top, 1 is bottom), NAN if unknown * @param rec_bottom_x Current tracked rectangle bottom x value if CAMERA_TRACKING_MODE_RECTANGLE (normalized 0..1, 0 is left, 1 is right), NAN if unknown * @param rec_bottom_y Current tracked rectangle bottom y value if CAMERA_TRACKING_MODE_RECTANGLE (normalized 0..1, 0 is top, 1 is bottom), NAN if unknown + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_camera_tracking_image_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t tracking_status, uint8_t tracking_mode, uint8_t target_data, float point_x, float point_y, float radius, float rec_top_x, float rec_top_y, float rec_bottom_x, float rec_bottom_y) + uint8_t tracking_status, uint8_t tracking_mode, uint8_t target_data, float point_x, float point_y, float radius, float rec_top_x, float rec_top_y, float rec_bottom_x, float rec_bottom_y, uint8_t camera_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_LEN]; @@ -95,6 +99,7 @@ static inline uint16_t mavlink_msg_camera_tracking_image_status_pack(uint8_t sys _mav_put_uint8_t(buf, 28, tracking_status); _mav_put_uint8_t(buf, 29, tracking_mode); _mav_put_uint8_t(buf, 30, target_data); + _mav_put_uint8_t(buf, 31, camera_device_id); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_LEN); #else @@ -109,6 +114,7 @@ static inline uint16_t mavlink_msg_camera_tracking_image_status_pack(uint8_t sys packet.tracking_status = tracking_status; packet.tracking_mode = tracking_mode; packet.target_data = target_data; + packet.camera_device_id = camera_device_id; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_LEN); #endif @@ -117,6 +123,69 @@ static inline uint16_t mavlink_msg_camera_tracking_image_status_pack(uint8_t sys return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_CRC); } +/** + * @brief Pack a camera_tracking_image_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param tracking_status Current tracking status + * @param tracking_mode Current tracking mode + * @param target_data Defines location of target data + * @param point_x Current tracked point x value if CAMERA_TRACKING_MODE_POINT (normalized 0..1, 0 is left, 1 is right), NAN if unknown + * @param point_y Current tracked point y value if CAMERA_TRACKING_MODE_POINT (normalized 0..1, 0 is top, 1 is bottom), NAN if unknown + * @param radius Current tracked radius if CAMERA_TRACKING_MODE_POINT (normalized 0..1, 0 is image left, 1 is image right), NAN if unknown + * @param rec_top_x Current tracked rectangle top x value if CAMERA_TRACKING_MODE_RECTANGLE (normalized 0..1, 0 is left, 1 is right), NAN if unknown + * @param rec_top_y Current tracked rectangle top y value if CAMERA_TRACKING_MODE_RECTANGLE (normalized 0..1, 0 is top, 1 is bottom), NAN if unknown + * @param rec_bottom_x Current tracked rectangle bottom x value if CAMERA_TRACKING_MODE_RECTANGLE (normalized 0..1, 0 is left, 1 is right), NAN if unknown + * @param rec_bottom_y Current tracked rectangle bottom y value if CAMERA_TRACKING_MODE_RECTANGLE (normalized 0..1, 0 is top, 1 is bottom), NAN if unknown + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_camera_tracking_image_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t tracking_status, uint8_t tracking_mode, uint8_t target_data, float point_x, float point_y, float radius, float rec_top_x, float rec_top_y, float rec_bottom_x, float rec_bottom_y, uint8_t camera_device_id) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_LEN]; + _mav_put_float(buf, 0, point_x); + _mav_put_float(buf, 4, point_y); + _mav_put_float(buf, 8, radius); + _mav_put_float(buf, 12, rec_top_x); + _mav_put_float(buf, 16, rec_top_y); + _mav_put_float(buf, 20, rec_bottom_x); + _mav_put_float(buf, 24, rec_bottom_y); + _mav_put_uint8_t(buf, 28, tracking_status); + _mav_put_uint8_t(buf, 29, tracking_mode); + _mav_put_uint8_t(buf, 30, target_data); + _mav_put_uint8_t(buf, 31, camera_device_id); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_LEN); +#else + mavlink_camera_tracking_image_status_t packet; + packet.point_x = point_x; + packet.point_y = point_y; + packet.radius = radius; + packet.rec_top_x = rec_top_x; + packet.rec_top_y = rec_top_y; + packet.rec_bottom_x = rec_bottom_x; + packet.rec_bottom_y = rec_bottom_y; + packet.tracking_status = tracking_status; + packet.tracking_mode = tracking_mode; + packet.target_data = target_data; + packet.camera_device_id = camera_device_id; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_LEN); +#endif +} + /** * @brief Pack a camera_tracking_image_status message on a channel * @param system_id ID of this system @@ -133,11 +202,12 @@ static inline uint16_t mavlink_msg_camera_tracking_image_status_pack(uint8_t sys * @param rec_top_y Current tracked rectangle top y value if CAMERA_TRACKING_MODE_RECTANGLE (normalized 0..1, 0 is top, 1 is bottom), NAN if unknown * @param rec_bottom_x Current tracked rectangle bottom x value if CAMERA_TRACKING_MODE_RECTANGLE (normalized 0..1, 0 is left, 1 is right), NAN if unknown * @param rec_bottom_y Current tracked rectangle bottom y value if CAMERA_TRACKING_MODE_RECTANGLE (normalized 0..1, 0 is top, 1 is bottom), NAN if unknown + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_camera_tracking_image_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - uint8_t tracking_status,uint8_t tracking_mode,uint8_t target_data,float point_x,float point_y,float radius,float rec_top_x,float rec_top_y,float rec_bottom_x,float rec_bottom_y) + uint8_t tracking_status,uint8_t tracking_mode,uint8_t target_data,float point_x,float point_y,float radius,float rec_top_x,float rec_top_y,float rec_bottom_x,float rec_bottom_y,uint8_t camera_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_LEN]; @@ -151,6 +221,7 @@ static inline uint16_t mavlink_msg_camera_tracking_image_status_pack_chan(uint8_ _mav_put_uint8_t(buf, 28, tracking_status); _mav_put_uint8_t(buf, 29, tracking_mode); _mav_put_uint8_t(buf, 30, target_data); + _mav_put_uint8_t(buf, 31, camera_device_id); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_LEN); #else @@ -165,6 +236,7 @@ static inline uint16_t mavlink_msg_camera_tracking_image_status_pack_chan(uint8_ packet.tracking_status = tracking_status; packet.tracking_mode = tracking_mode; packet.target_data = target_data; + packet.camera_device_id = camera_device_id; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_LEN); #endif @@ -183,7 +255,7 @@ static inline uint16_t mavlink_msg_camera_tracking_image_status_pack_chan(uint8_ */ static inline uint16_t mavlink_msg_camera_tracking_image_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_camera_tracking_image_status_t* camera_tracking_image_status) { - return mavlink_msg_camera_tracking_image_status_pack(system_id, component_id, msg, camera_tracking_image_status->tracking_status, camera_tracking_image_status->tracking_mode, camera_tracking_image_status->target_data, camera_tracking_image_status->point_x, camera_tracking_image_status->point_y, camera_tracking_image_status->radius, camera_tracking_image_status->rec_top_x, camera_tracking_image_status->rec_top_y, camera_tracking_image_status->rec_bottom_x, camera_tracking_image_status->rec_bottom_y); + return mavlink_msg_camera_tracking_image_status_pack(system_id, component_id, msg, camera_tracking_image_status->tracking_status, camera_tracking_image_status->tracking_mode, camera_tracking_image_status->target_data, camera_tracking_image_status->point_x, camera_tracking_image_status->point_y, camera_tracking_image_status->radius, camera_tracking_image_status->rec_top_x, camera_tracking_image_status->rec_top_y, camera_tracking_image_status->rec_bottom_x, camera_tracking_image_status->rec_bottom_y, camera_tracking_image_status->camera_device_id); } /** @@ -197,7 +269,21 @@ static inline uint16_t mavlink_msg_camera_tracking_image_status_encode(uint8_t s */ static inline uint16_t mavlink_msg_camera_tracking_image_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_camera_tracking_image_status_t* camera_tracking_image_status) { - return mavlink_msg_camera_tracking_image_status_pack_chan(system_id, component_id, chan, msg, camera_tracking_image_status->tracking_status, camera_tracking_image_status->tracking_mode, camera_tracking_image_status->target_data, camera_tracking_image_status->point_x, camera_tracking_image_status->point_y, camera_tracking_image_status->radius, camera_tracking_image_status->rec_top_x, camera_tracking_image_status->rec_top_y, camera_tracking_image_status->rec_bottom_x, camera_tracking_image_status->rec_bottom_y); + return mavlink_msg_camera_tracking_image_status_pack_chan(system_id, component_id, chan, msg, camera_tracking_image_status->tracking_status, camera_tracking_image_status->tracking_mode, camera_tracking_image_status->target_data, camera_tracking_image_status->point_x, camera_tracking_image_status->point_y, camera_tracking_image_status->radius, camera_tracking_image_status->rec_top_x, camera_tracking_image_status->rec_top_y, camera_tracking_image_status->rec_bottom_x, camera_tracking_image_status->rec_bottom_y, camera_tracking_image_status->camera_device_id); +} + +/** + * @brief Encode a camera_tracking_image_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param camera_tracking_image_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_camera_tracking_image_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_camera_tracking_image_status_t* camera_tracking_image_status) +{ + return mavlink_msg_camera_tracking_image_status_pack_status(system_id, component_id, _status, msg, camera_tracking_image_status->tracking_status, camera_tracking_image_status->tracking_mode, camera_tracking_image_status->target_data, camera_tracking_image_status->point_x, camera_tracking_image_status->point_y, camera_tracking_image_status->radius, camera_tracking_image_status->rec_top_x, camera_tracking_image_status->rec_top_y, camera_tracking_image_status->rec_bottom_x, camera_tracking_image_status->rec_bottom_y, camera_tracking_image_status->camera_device_id); } /** @@ -214,10 +300,11 @@ static inline uint16_t mavlink_msg_camera_tracking_image_status_encode_chan(uint * @param rec_top_y Current tracked rectangle top y value if CAMERA_TRACKING_MODE_RECTANGLE (normalized 0..1, 0 is top, 1 is bottom), NAN if unknown * @param rec_bottom_x Current tracked rectangle bottom x value if CAMERA_TRACKING_MODE_RECTANGLE (normalized 0..1, 0 is left, 1 is right), NAN if unknown * @param rec_bottom_y Current tracked rectangle bottom y value if CAMERA_TRACKING_MODE_RECTANGLE (normalized 0..1, 0 is top, 1 is bottom), NAN if unknown + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_camera_tracking_image_status_send(mavlink_channel_t chan, uint8_t tracking_status, uint8_t tracking_mode, uint8_t target_data, float point_x, float point_y, float radius, float rec_top_x, float rec_top_y, float rec_bottom_x, float rec_bottom_y) +static inline void mavlink_msg_camera_tracking_image_status_send(mavlink_channel_t chan, uint8_t tracking_status, uint8_t tracking_mode, uint8_t target_data, float point_x, float point_y, float radius, float rec_top_x, float rec_top_y, float rec_bottom_x, float rec_bottom_y, uint8_t camera_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_LEN]; @@ -231,6 +318,7 @@ static inline void mavlink_msg_camera_tracking_image_status_send(mavlink_channel _mav_put_uint8_t(buf, 28, tracking_status); _mav_put_uint8_t(buf, 29, tracking_mode); _mav_put_uint8_t(buf, 30, target_data); + _mav_put_uint8_t(buf, 31, camera_device_id); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS, buf, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_CRC); #else @@ -245,6 +333,7 @@ static inline void mavlink_msg_camera_tracking_image_status_send(mavlink_channel packet.tracking_status = tracking_status; packet.tracking_mode = tracking_mode; packet.target_data = target_data; + packet.camera_device_id = camera_device_id; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS, (const char *)&packet, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_CRC); #endif @@ -258,7 +347,7 @@ static inline void mavlink_msg_camera_tracking_image_status_send(mavlink_channel static inline void mavlink_msg_camera_tracking_image_status_send_struct(mavlink_channel_t chan, const mavlink_camera_tracking_image_status_t* camera_tracking_image_status) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_camera_tracking_image_status_send(chan, camera_tracking_image_status->tracking_status, camera_tracking_image_status->tracking_mode, camera_tracking_image_status->target_data, camera_tracking_image_status->point_x, camera_tracking_image_status->point_y, camera_tracking_image_status->radius, camera_tracking_image_status->rec_top_x, camera_tracking_image_status->rec_top_y, camera_tracking_image_status->rec_bottom_x, camera_tracking_image_status->rec_bottom_y); + mavlink_msg_camera_tracking_image_status_send(chan, camera_tracking_image_status->tracking_status, camera_tracking_image_status->tracking_mode, camera_tracking_image_status->target_data, camera_tracking_image_status->point_x, camera_tracking_image_status->point_y, camera_tracking_image_status->radius, camera_tracking_image_status->rec_top_x, camera_tracking_image_status->rec_top_y, camera_tracking_image_status->rec_bottom_x, camera_tracking_image_status->rec_bottom_y, camera_tracking_image_status->camera_device_id); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS, (const char *)camera_tracking_image_status, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_CRC); #endif @@ -266,13 +355,13 @@ static inline void mavlink_msg_camera_tracking_image_status_send_struct(mavlink_ #if MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_camera_tracking_image_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t tracking_status, uint8_t tracking_mode, uint8_t target_data, float point_x, float point_y, float radius, float rec_top_x, float rec_top_y, float rec_bottom_x, float rec_bottom_y) +static inline void mavlink_msg_camera_tracking_image_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t tracking_status, uint8_t tracking_mode, uint8_t target_data, float point_x, float point_y, float radius, float rec_top_x, float rec_top_y, float rec_bottom_x, float rec_bottom_y, uint8_t camera_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; @@ -286,6 +375,7 @@ static inline void mavlink_msg_camera_tracking_image_status_send_buf(mavlink_mes _mav_put_uint8_t(buf, 28, tracking_status); _mav_put_uint8_t(buf, 29, tracking_mode); _mav_put_uint8_t(buf, 30, target_data); + _mav_put_uint8_t(buf, 31, camera_device_id); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS, buf, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_CRC); #else @@ -300,6 +390,7 @@ static inline void mavlink_msg_camera_tracking_image_status_send_buf(mavlink_mes packet->tracking_status = tracking_status; packet->tracking_mode = tracking_mode; packet->target_data = target_data; + packet->camera_device_id = camera_device_id; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS, (const char *)packet, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_CRC); #endif @@ -411,6 +502,16 @@ static inline float mavlink_msg_camera_tracking_image_status_get_rec_bottom_y(co return _MAV_RETURN_float(msg, 24); } +/** + * @brief Get field camera_device_id from camera_tracking_image_status message + * + * @return Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). + */ +static inline uint8_t mavlink_msg_camera_tracking_image_status_get_camera_device_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 31); +} + /** * @brief Decode a camera_tracking_image_status message into a struct * @@ -430,6 +531,7 @@ static inline void mavlink_msg_camera_tracking_image_status_decode(const mavlink camera_tracking_image_status->tracking_status = mavlink_msg_camera_tracking_image_status_get_tracking_status(msg); camera_tracking_image_status->tracking_mode = mavlink_msg_camera_tracking_image_status_get_tracking_mode(msg); camera_tracking_image_status->target_data = mavlink_msg_camera_tracking_image_status_get_target_data(msg); + camera_tracking_image_status->camera_device_id = mavlink_msg_camera_tracking_image_status_get_camera_device_id(msg); #else uint8_t len = msg->len < MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_LEN? msg->len : MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_LEN; memset(camera_tracking_image_status, 0, MAVLINK_MSG_ID_CAMERA_TRACKING_IMAGE_STATUS_LEN); diff --git a/common/mavlink_msg_camera_trigger.h b/common/mavlink_msg_camera_trigger.h index ee2ad8e9b..687a9a06c 100644 --- a/common/mavlink_msg_camera_trigger.h +++ b/common/mavlink_msg_camera_trigger.h @@ -69,6 +69,42 @@ static inline uint16_t mavlink_msg_camera_trigger_pack(uint8_t system_id, uint8_ return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CAMERA_TRIGGER_MIN_LEN, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN, MAVLINK_MSG_ID_CAMERA_TRIGGER_CRC); } +/** + * @brief Pack a camera_trigger message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp for image frame (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param seq Image frame sequence + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_camera_trigger_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, uint32_t seq) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint32_t(buf, 8, seq); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN); +#else + mavlink_camera_trigger_t packet; + packet.time_usec = time_usec; + packet.seq = seq; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CAMERA_TRIGGER; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CAMERA_TRIGGER_MIN_LEN, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN, MAVLINK_MSG_ID_CAMERA_TRIGGER_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CAMERA_TRIGGER_MIN_LEN, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN); +#endif +} + /** * @brief Pack a camera_trigger message on a channel * @param system_id ID of this system @@ -128,6 +164,20 @@ static inline uint16_t mavlink_msg_camera_trigger_encode_chan(uint8_t system_id, return mavlink_msg_camera_trigger_pack_chan(system_id, component_id, chan, msg, camera_trigger->time_usec, camera_trigger->seq); } +/** + * @brief Encode a camera_trigger struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param camera_trigger C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_camera_trigger_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_camera_trigger_t* camera_trigger) +{ + return mavlink_msg_camera_trigger_pack_status(system_id, component_id, _status, msg, camera_trigger->time_usec, camera_trigger->seq); +} + /** * @brief Send a camera_trigger message * @param chan MAVLink channel to send the message @@ -170,7 +220,7 @@ static inline void mavlink_msg_camera_trigger_send_struct(mavlink_channel_t chan #if MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_can_filter_modify.h b/common/mavlink_msg_can_filter_modify.h new file mode 100644 index 000000000..45d73011f --- /dev/null +++ b/common/mavlink_msg_can_filter_modify.h @@ -0,0 +1,390 @@ +#pragma once +// MESSAGE CAN_FILTER_MODIFY PACKING + +#define MAVLINK_MSG_ID_CAN_FILTER_MODIFY 388 + + +typedef struct __mavlink_can_filter_modify_t { + uint16_t ids[16]; /*< filter IDs, length num_ids*/ + uint8_t target_system; /*< System ID.*/ + uint8_t target_component; /*< Component ID.*/ + uint8_t bus; /*< bus number*/ + uint8_t operation; /*< what operation to perform on the filter list. See CAN_FILTER_OP enum.*/ + uint8_t num_ids; /*< number of IDs in filter list*/ +} mavlink_can_filter_modify_t; + +#define MAVLINK_MSG_ID_CAN_FILTER_MODIFY_LEN 37 +#define MAVLINK_MSG_ID_CAN_FILTER_MODIFY_MIN_LEN 37 +#define MAVLINK_MSG_ID_388_LEN 37 +#define MAVLINK_MSG_ID_388_MIN_LEN 37 + +#define MAVLINK_MSG_ID_CAN_FILTER_MODIFY_CRC 8 +#define MAVLINK_MSG_ID_388_CRC 8 + +#define MAVLINK_MSG_CAN_FILTER_MODIFY_FIELD_IDS_LEN 16 + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_CAN_FILTER_MODIFY { \ + 388, \ + "CAN_FILTER_MODIFY", \ + 6, \ + { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_can_filter_modify_t, target_system) }, \ + { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_can_filter_modify_t, target_component) }, \ + { "bus", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_can_filter_modify_t, bus) }, \ + { "operation", NULL, MAVLINK_TYPE_UINT8_T, 0, 35, offsetof(mavlink_can_filter_modify_t, operation) }, \ + { "num_ids", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_can_filter_modify_t, num_ids) }, \ + { "ids", NULL, MAVLINK_TYPE_UINT16_T, 16, 0, offsetof(mavlink_can_filter_modify_t, ids) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_CAN_FILTER_MODIFY { \ + "CAN_FILTER_MODIFY", \ + 6, \ + { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_can_filter_modify_t, target_system) }, \ + { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_can_filter_modify_t, target_component) }, \ + { "bus", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_can_filter_modify_t, bus) }, \ + { "operation", NULL, MAVLINK_TYPE_UINT8_T, 0, 35, offsetof(mavlink_can_filter_modify_t, operation) }, \ + { "num_ids", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_can_filter_modify_t, num_ids) }, \ + { "ids", NULL, MAVLINK_TYPE_UINT16_T, 16, 0, offsetof(mavlink_can_filter_modify_t, ids) }, \ + } \ +} +#endif + +/** + * @brief Pack a can_filter_modify message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID. + * @param target_component Component ID. + * @param bus bus number + * @param operation what operation to perform on the filter list. See CAN_FILTER_OP enum. + * @param num_ids number of IDs in filter list + * @param ids filter IDs, length num_ids + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_can_filter_modify_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint8_t bus, uint8_t operation, uint8_t num_ids, const uint16_t *ids) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CAN_FILTER_MODIFY_LEN]; + _mav_put_uint8_t(buf, 32, target_system); + _mav_put_uint8_t(buf, 33, target_component); + _mav_put_uint8_t(buf, 34, bus); + _mav_put_uint8_t(buf, 35, operation); + _mav_put_uint8_t(buf, 36, num_ids); + _mav_put_uint16_t_array(buf, 0, ids, 16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_LEN); +#else + mavlink_can_filter_modify_t packet; + packet.target_system = target_system; + packet.target_component = target_component; + packet.bus = bus; + packet.operation = operation; + packet.num_ids = num_ids; + mav_array_assign_uint16_t(packet.ids, ids, 16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CAN_FILTER_MODIFY; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_MIN_LEN, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_LEN, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_CRC); +} + +/** + * @brief Pack a can_filter_modify message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID. + * @param target_component Component ID. + * @param bus bus number + * @param operation what operation to perform on the filter list. See CAN_FILTER_OP enum. + * @param num_ids number of IDs in filter list + * @param ids filter IDs, length num_ids + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_can_filter_modify_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint8_t bus, uint8_t operation, uint8_t num_ids, const uint16_t *ids) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CAN_FILTER_MODIFY_LEN]; + _mav_put_uint8_t(buf, 32, target_system); + _mav_put_uint8_t(buf, 33, target_component); + _mav_put_uint8_t(buf, 34, bus); + _mav_put_uint8_t(buf, 35, operation); + _mav_put_uint8_t(buf, 36, num_ids); + _mav_put_uint16_t_array(buf, 0, ids, 16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_LEN); +#else + mavlink_can_filter_modify_t packet; + packet.target_system = target_system; + packet.target_component = target_component; + packet.bus = bus; + packet.operation = operation; + packet.num_ids = num_ids; + mav_array_memcpy(packet.ids, ids, sizeof(uint16_t)*16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CAN_FILTER_MODIFY; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_MIN_LEN, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_LEN, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_MIN_LEN, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_LEN); +#endif +} + +/** + * @brief Pack a can_filter_modify message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param target_system System ID. + * @param target_component Component ID. + * @param bus bus number + * @param operation what operation to perform on the filter list. See CAN_FILTER_OP enum. + * @param num_ids number of IDs in filter list + * @param ids filter IDs, length num_ids + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_can_filter_modify_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t target_system,uint8_t target_component,uint8_t bus,uint8_t operation,uint8_t num_ids,const uint16_t *ids) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CAN_FILTER_MODIFY_LEN]; + _mav_put_uint8_t(buf, 32, target_system); + _mav_put_uint8_t(buf, 33, target_component); + _mav_put_uint8_t(buf, 34, bus); + _mav_put_uint8_t(buf, 35, operation); + _mav_put_uint8_t(buf, 36, num_ids); + _mav_put_uint16_t_array(buf, 0, ids, 16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_LEN); +#else + mavlink_can_filter_modify_t packet; + packet.target_system = target_system; + packet.target_component = target_component; + packet.bus = bus; + packet.operation = operation; + packet.num_ids = num_ids; + mav_array_assign_uint16_t(packet.ids, ids, 16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CAN_FILTER_MODIFY; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_MIN_LEN, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_LEN, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_CRC); +} + +/** + * @brief Encode a can_filter_modify struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param can_filter_modify C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_can_filter_modify_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_can_filter_modify_t* can_filter_modify) +{ + return mavlink_msg_can_filter_modify_pack(system_id, component_id, msg, can_filter_modify->target_system, can_filter_modify->target_component, can_filter_modify->bus, can_filter_modify->operation, can_filter_modify->num_ids, can_filter_modify->ids); +} + +/** + * @brief Encode a can_filter_modify struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param can_filter_modify C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_can_filter_modify_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_can_filter_modify_t* can_filter_modify) +{ + return mavlink_msg_can_filter_modify_pack_chan(system_id, component_id, chan, msg, can_filter_modify->target_system, can_filter_modify->target_component, can_filter_modify->bus, can_filter_modify->operation, can_filter_modify->num_ids, can_filter_modify->ids); +} + +/** + * @brief Encode a can_filter_modify struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param can_filter_modify C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_can_filter_modify_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_can_filter_modify_t* can_filter_modify) +{ + return mavlink_msg_can_filter_modify_pack_status(system_id, component_id, _status, msg, can_filter_modify->target_system, can_filter_modify->target_component, can_filter_modify->bus, can_filter_modify->operation, can_filter_modify->num_ids, can_filter_modify->ids); +} + +/** + * @brief Send a can_filter_modify message + * @param chan MAVLink channel to send the message + * + * @param target_system System ID. + * @param target_component Component ID. + * @param bus bus number + * @param operation what operation to perform on the filter list. See CAN_FILTER_OP enum. + * @param num_ids number of IDs in filter list + * @param ids filter IDs, length num_ids + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_can_filter_modify_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t bus, uint8_t operation, uint8_t num_ids, const uint16_t *ids) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CAN_FILTER_MODIFY_LEN]; + _mav_put_uint8_t(buf, 32, target_system); + _mav_put_uint8_t(buf, 33, target_component); + _mav_put_uint8_t(buf, 34, bus); + _mav_put_uint8_t(buf, 35, operation); + _mav_put_uint8_t(buf, 36, num_ids); + _mav_put_uint16_t_array(buf, 0, ids, 16); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAN_FILTER_MODIFY, buf, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_MIN_LEN, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_LEN, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_CRC); +#else + mavlink_can_filter_modify_t packet; + packet.target_system = target_system; + packet.target_component = target_component; + packet.bus = bus; + packet.operation = operation; + packet.num_ids = num_ids; + mav_array_assign_uint16_t(packet.ids, ids, 16); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAN_FILTER_MODIFY, (const char *)&packet, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_MIN_LEN, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_LEN, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_CRC); +#endif +} + +/** + * @brief Send a can_filter_modify message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_can_filter_modify_send_struct(mavlink_channel_t chan, const mavlink_can_filter_modify_t* can_filter_modify) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_can_filter_modify_send(chan, can_filter_modify->target_system, can_filter_modify->target_component, can_filter_modify->bus, can_filter_modify->operation, can_filter_modify->num_ids, can_filter_modify->ids); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAN_FILTER_MODIFY, (const char *)can_filter_modify, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_MIN_LEN, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_LEN, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_CRC); +#endif +} + +#if MAVLINK_MSG_ID_CAN_FILTER_MODIFY_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_can_filter_modify_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t bus, uint8_t operation, uint8_t num_ids, const uint16_t *ids) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint8_t(buf, 32, target_system); + _mav_put_uint8_t(buf, 33, target_component); + _mav_put_uint8_t(buf, 34, bus); + _mav_put_uint8_t(buf, 35, operation); + _mav_put_uint8_t(buf, 36, num_ids); + _mav_put_uint16_t_array(buf, 0, ids, 16); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAN_FILTER_MODIFY, buf, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_MIN_LEN, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_LEN, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_CRC); +#else + mavlink_can_filter_modify_t *packet = (mavlink_can_filter_modify_t *)msgbuf; + packet->target_system = target_system; + packet->target_component = target_component; + packet->bus = bus; + packet->operation = operation; + packet->num_ids = num_ids; + mav_array_assign_uint16_t(packet->ids, ids, 16); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAN_FILTER_MODIFY, (const char *)packet, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_MIN_LEN, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_LEN, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_CRC); +#endif +} +#endif + +#endif + +// MESSAGE CAN_FILTER_MODIFY UNPACKING + + +/** + * @brief Get field target_system from can_filter_modify message + * + * @return System ID. + */ +static inline uint8_t mavlink_msg_can_filter_modify_get_target_system(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 32); +} + +/** + * @brief Get field target_component from can_filter_modify message + * + * @return Component ID. + */ +static inline uint8_t mavlink_msg_can_filter_modify_get_target_component(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 33); +} + +/** + * @brief Get field bus from can_filter_modify message + * + * @return bus number + */ +static inline uint8_t mavlink_msg_can_filter_modify_get_bus(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 34); +} + +/** + * @brief Get field operation from can_filter_modify message + * + * @return what operation to perform on the filter list. See CAN_FILTER_OP enum. + */ +static inline uint8_t mavlink_msg_can_filter_modify_get_operation(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 35); +} + +/** + * @brief Get field num_ids from can_filter_modify message + * + * @return number of IDs in filter list + */ +static inline uint8_t mavlink_msg_can_filter_modify_get_num_ids(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 36); +} + +/** + * @brief Get field ids from can_filter_modify message + * + * @return filter IDs, length num_ids + */ +static inline uint16_t mavlink_msg_can_filter_modify_get_ids(const mavlink_message_t* msg, uint16_t *ids) +{ + return _MAV_RETURN_uint16_t_array(msg, ids, 16, 0); +} + +/** + * @brief Decode a can_filter_modify message into a struct + * + * @param msg The message to decode + * @param can_filter_modify C-struct to decode the message contents into + */ +static inline void mavlink_msg_can_filter_modify_decode(const mavlink_message_t* msg, mavlink_can_filter_modify_t* can_filter_modify) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_can_filter_modify_get_ids(msg, can_filter_modify->ids); + can_filter_modify->target_system = mavlink_msg_can_filter_modify_get_target_system(msg); + can_filter_modify->target_component = mavlink_msg_can_filter_modify_get_target_component(msg); + can_filter_modify->bus = mavlink_msg_can_filter_modify_get_bus(msg); + can_filter_modify->operation = mavlink_msg_can_filter_modify_get_operation(msg); + can_filter_modify->num_ids = mavlink_msg_can_filter_modify_get_num_ids(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_CAN_FILTER_MODIFY_LEN? msg->len : MAVLINK_MSG_ID_CAN_FILTER_MODIFY_LEN; + memset(can_filter_modify, 0, MAVLINK_MSG_ID_CAN_FILTER_MODIFY_LEN); + memcpy(can_filter_modify, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/common/mavlink_msg_can_frame.h b/common/mavlink_msg_can_frame.h new file mode 100644 index 000000000..a97caa783 --- /dev/null +++ b/common/mavlink_msg_can_frame.h @@ -0,0 +1,390 @@ +#pragma once +// MESSAGE CAN_FRAME PACKING + +#define MAVLINK_MSG_ID_CAN_FRAME 386 + + +typedef struct __mavlink_can_frame_t { + uint32_t id; /*< Frame ID*/ + uint8_t target_system; /*< System ID.*/ + uint8_t target_component; /*< Component ID.*/ + uint8_t bus; /*< Bus number*/ + uint8_t len; /*< Frame length*/ + uint8_t data[8]; /*< Frame data*/ +} mavlink_can_frame_t; + +#define MAVLINK_MSG_ID_CAN_FRAME_LEN 16 +#define MAVLINK_MSG_ID_CAN_FRAME_MIN_LEN 16 +#define MAVLINK_MSG_ID_386_LEN 16 +#define MAVLINK_MSG_ID_386_MIN_LEN 16 + +#define MAVLINK_MSG_ID_CAN_FRAME_CRC 132 +#define MAVLINK_MSG_ID_386_CRC 132 + +#define MAVLINK_MSG_CAN_FRAME_FIELD_DATA_LEN 8 + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_CAN_FRAME { \ + 386, \ + "CAN_FRAME", \ + 6, \ + { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_can_frame_t, target_system) }, \ + { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_can_frame_t, target_component) }, \ + { "bus", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_can_frame_t, bus) }, \ + { "len", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_can_frame_t, len) }, \ + { "id", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_can_frame_t, id) }, \ + { "data", NULL, MAVLINK_TYPE_UINT8_T, 8, 8, offsetof(mavlink_can_frame_t, data) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_CAN_FRAME { \ + "CAN_FRAME", \ + 6, \ + { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_can_frame_t, target_system) }, \ + { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_can_frame_t, target_component) }, \ + { "bus", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_can_frame_t, bus) }, \ + { "len", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_can_frame_t, len) }, \ + { "id", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_can_frame_t, id) }, \ + { "data", NULL, MAVLINK_TYPE_UINT8_T, 8, 8, offsetof(mavlink_can_frame_t, data) }, \ + } \ +} +#endif + +/** + * @brief Pack a can_frame message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID. + * @param target_component Component ID. + * @param bus Bus number + * @param len Frame length + * @param id Frame ID + * @param data Frame data + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_can_frame_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint8_t bus, uint8_t len, uint32_t id, const uint8_t *data) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CAN_FRAME_LEN]; + _mav_put_uint32_t(buf, 0, id); + _mav_put_uint8_t(buf, 4, target_system); + _mav_put_uint8_t(buf, 5, target_component); + _mav_put_uint8_t(buf, 6, bus); + _mav_put_uint8_t(buf, 7, len); + _mav_put_uint8_t_array(buf, 8, data, 8); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAN_FRAME_LEN); +#else + mavlink_can_frame_t packet; + packet.id = id; + packet.target_system = target_system; + packet.target_component = target_component; + packet.bus = bus; + packet.len = len; + mav_array_assign_uint8_t(packet.data, data, 8); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAN_FRAME_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CAN_FRAME; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CAN_FRAME_MIN_LEN, MAVLINK_MSG_ID_CAN_FRAME_LEN, MAVLINK_MSG_ID_CAN_FRAME_CRC); +} + +/** + * @brief Pack a can_frame message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID. + * @param target_component Component ID. + * @param bus Bus number + * @param len Frame length + * @param id Frame ID + * @param data Frame data + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_can_frame_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint8_t bus, uint8_t len, uint32_t id, const uint8_t *data) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CAN_FRAME_LEN]; + _mav_put_uint32_t(buf, 0, id); + _mav_put_uint8_t(buf, 4, target_system); + _mav_put_uint8_t(buf, 5, target_component); + _mav_put_uint8_t(buf, 6, bus); + _mav_put_uint8_t(buf, 7, len); + _mav_put_uint8_t_array(buf, 8, data, 8); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAN_FRAME_LEN); +#else + mavlink_can_frame_t packet; + packet.id = id; + packet.target_system = target_system; + packet.target_component = target_component; + packet.bus = bus; + packet.len = len; + mav_array_memcpy(packet.data, data, sizeof(uint8_t)*8); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAN_FRAME_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CAN_FRAME; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CAN_FRAME_MIN_LEN, MAVLINK_MSG_ID_CAN_FRAME_LEN, MAVLINK_MSG_ID_CAN_FRAME_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CAN_FRAME_MIN_LEN, MAVLINK_MSG_ID_CAN_FRAME_LEN); +#endif +} + +/** + * @brief Pack a can_frame message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param target_system System ID. + * @param target_component Component ID. + * @param bus Bus number + * @param len Frame length + * @param id Frame ID + * @param data Frame data + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_can_frame_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t target_system,uint8_t target_component,uint8_t bus,uint8_t len,uint32_t id,const uint8_t *data) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CAN_FRAME_LEN]; + _mav_put_uint32_t(buf, 0, id); + _mav_put_uint8_t(buf, 4, target_system); + _mav_put_uint8_t(buf, 5, target_component); + _mav_put_uint8_t(buf, 6, bus); + _mav_put_uint8_t(buf, 7, len); + _mav_put_uint8_t_array(buf, 8, data, 8); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAN_FRAME_LEN); +#else + mavlink_can_frame_t packet; + packet.id = id; + packet.target_system = target_system; + packet.target_component = target_component; + packet.bus = bus; + packet.len = len; + mav_array_assign_uint8_t(packet.data, data, 8); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAN_FRAME_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CAN_FRAME; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CAN_FRAME_MIN_LEN, MAVLINK_MSG_ID_CAN_FRAME_LEN, MAVLINK_MSG_ID_CAN_FRAME_CRC); +} + +/** + * @brief Encode a can_frame struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param can_frame C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_can_frame_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_can_frame_t* can_frame) +{ + return mavlink_msg_can_frame_pack(system_id, component_id, msg, can_frame->target_system, can_frame->target_component, can_frame->bus, can_frame->len, can_frame->id, can_frame->data); +} + +/** + * @brief Encode a can_frame struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param can_frame C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_can_frame_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_can_frame_t* can_frame) +{ + return mavlink_msg_can_frame_pack_chan(system_id, component_id, chan, msg, can_frame->target_system, can_frame->target_component, can_frame->bus, can_frame->len, can_frame->id, can_frame->data); +} + +/** + * @brief Encode a can_frame struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param can_frame C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_can_frame_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_can_frame_t* can_frame) +{ + return mavlink_msg_can_frame_pack_status(system_id, component_id, _status, msg, can_frame->target_system, can_frame->target_component, can_frame->bus, can_frame->len, can_frame->id, can_frame->data); +} + +/** + * @brief Send a can_frame message + * @param chan MAVLink channel to send the message + * + * @param target_system System ID. + * @param target_component Component ID. + * @param bus Bus number + * @param len Frame length + * @param id Frame ID + * @param data Frame data + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_can_frame_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t bus, uint8_t len, uint32_t id, const uint8_t *data) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CAN_FRAME_LEN]; + _mav_put_uint32_t(buf, 0, id); + _mav_put_uint8_t(buf, 4, target_system); + _mav_put_uint8_t(buf, 5, target_component); + _mav_put_uint8_t(buf, 6, bus); + _mav_put_uint8_t(buf, 7, len); + _mav_put_uint8_t_array(buf, 8, data, 8); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAN_FRAME, buf, MAVLINK_MSG_ID_CAN_FRAME_MIN_LEN, MAVLINK_MSG_ID_CAN_FRAME_LEN, MAVLINK_MSG_ID_CAN_FRAME_CRC); +#else + mavlink_can_frame_t packet; + packet.id = id; + packet.target_system = target_system; + packet.target_component = target_component; + packet.bus = bus; + packet.len = len; + mav_array_assign_uint8_t(packet.data, data, 8); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAN_FRAME, (const char *)&packet, MAVLINK_MSG_ID_CAN_FRAME_MIN_LEN, MAVLINK_MSG_ID_CAN_FRAME_LEN, MAVLINK_MSG_ID_CAN_FRAME_CRC); +#endif +} + +/** + * @brief Send a can_frame message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_can_frame_send_struct(mavlink_channel_t chan, const mavlink_can_frame_t* can_frame) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_can_frame_send(chan, can_frame->target_system, can_frame->target_component, can_frame->bus, can_frame->len, can_frame->id, can_frame->data); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAN_FRAME, (const char *)can_frame, MAVLINK_MSG_ID_CAN_FRAME_MIN_LEN, MAVLINK_MSG_ID_CAN_FRAME_LEN, MAVLINK_MSG_ID_CAN_FRAME_CRC); +#endif +} + +#if MAVLINK_MSG_ID_CAN_FRAME_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_can_frame_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t bus, uint8_t len, uint32_t id, const uint8_t *data) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint32_t(buf, 0, id); + _mav_put_uint8_t(buf, 4, target_system); + _mav_put_uint8_t(buf, 5, target_component); + _mav_put_uint8_t(buf, 6, bus); + _mav_put_uint8_t(buf, 7, len); + _mav_put_uint8_t_array(buf, 8, data, 8); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAN_FRAME, buf, MAVLINK_MSG_ID_CAN_FRAME_MIN_LEN, MAVLINK_MSG_ID_CAN_FRAME_LEN, MAVLINK_MSG_ID_CAN_FRAME_CRC); +#else + mavlink_can_frame_t *packet = (mavlink_can_frame_t *)msgbuf; + packet->id = id; + packet->target_system = target_system; + packet->target_component = target_component; + packet->bus = bus; + packet->len = len; + mav_array_assign_uint8_t(packet->data, data, 8); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAN_FRAME, (const char *)packet, MAVLINK_MSG_ID_CAN_FRAME_MIN_LEN, MAVLINK_MSG_ID_CAN_FRAME_LEN, MAVLINK_MSG_ID_CAN_FRAME_CRC); +#endif +} +#endif + +#endif + +// MESSAGE CAN_FRAME UNPACKING + + +/** + * @brief Get field target_system from can_frame message + * + * @return System ID. + */ +static inline uint8_t mavlink_msg_can_frame_get_target_system(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 4); +} + +/** + * @brief Get field target_component from can_frame message + * + * @return Component ID. + */ +static inline uint8_t mavlink_msg_can_frame_get_target_component(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 5); +} + +/** + * @brief Get field bus from can_frame message + * + * @return Bus number + */ +static inline uint8_t mavlink_msg_can_frame_get_bus(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 6); +} + +/** + * @brief Get field len from can_frame message + * + * @return Frame length + */ +static inline uint8_t mavlink_msg_can_frame_get_len(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 7); +} + +/** + * @brief Get field id from can_frame message + * + * @return Frame ID + */ +static inline uint32_t mavlink_msg_can_frame_get_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 0); +} + +/** + * @brief Get field data from can_frame message + * + * @return Frame data + */ +static inline uint16_t mavlink_msg_can_frame_get_data(const mavlink_message_t* msg, uint8_t *data) +{ + return _MAV_RETURN_uint8_t_array(msg, data, 8, 8); +} + +/** + * @brief Decode a can_frame message into a struct + * + * @param msg The message to decode + * @param can_frame C-struct to decode the message contents into + */ +static inline void mavlink_msg_can_frame_decode(const mavlink_message_t* msg, mavlink_can_frame_t* can_frame) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + can_frame->id = mavlink_msg_can_frame_get_id(msg); + can_frame->target_system = mavlink_msg_can_frame_get_target_system(msg); + can_frame->target_component = mavlink_msg_can_frame_get_target_component(msg); + can_frame->bus = mavlink_msg_can_frame_get_bus(msg); + can_frame->len = mavlink_msg_can_frame_get_len(msg); + mavlink_msg_can_frame_get_data(msg, can_frame->data); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_CAN_FRAME_LEN? msg->len : MAVLINK_MSG_ID_CAN_FRAME_LEN; + memset(can_frame, 0, MAVLINK_MSG_ID_CAN_FRAME_LEN); + memcpy(can_frame, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/common/mavlink_msg_canfd_frame.h b/common/mavlink_msg_canfd_frame.h new file mode 100644 index 000000000..b64b249f1 --- /dev/null +++ b/common/mavlink_msg_canfd_frame.h @@ -0,0 +1,390 @@ +#pragma once +// MESSAGE CANFD_FRAME PACKING + +#define MAVLINK_MSG_ID_CANFD_FRAME 387 + + +typedef struct __mavlink_canfd_frame_t { + uint32_t id; /*< Frame ID*/ + uint8_t target_system; /*< System ID.*/ + uint8_t target_component; /*< Component ID.*/ + uint8_t bus; /*< bus number*/ + uint8_t len; /*< Frame length*/ + uint8_t data[64]; /*< Frame data*/ +} mavlink_canfd_frame_t; + +#define MAVLINK_MSG_ID_CANFD_FRAME_LEN 72 +#define MAVLINK_MSG_ID_CANFD_FRAME_MIN_LEN 72 +#define MAVLINK_MSG_ID_387_LEN 72 +#define MAVLINK_MSG_ID_387_MIN_LEN 72 + +#define MAVLINK_MSG_ID_CANFD_FRAME_CRC 4 +#define MAVLINK_MSG_ID_387_CRC 4 + +#define MAVLINK_MSG_CANFD_FRAME_FIELD_DATA_LEN 64 + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_CANFD_FRAME { \ + 387, \ + "CANFD_FRAME", \ + 6, \ + { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_canfd_frame_t, target_system) }, \ + { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_canfd_frame_t, target_component) }, \ + { "bus", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_canfd_frame_t, bus) }, \ + { "len", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_canfd_frame_t, len) }, \ + { "id", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_canfd_frame_t, id) }, \ + { "data", NULL, MAVLINK_TYPE_UINT8_T, 64, 8, offsetof(mavlink_canfd_frame_t, data) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_CANFD_FRAME { \ + "CANFD_FRAME", \ + 6, \ + { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_canfd_frame_t, target_system) }, \ + { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_canfd_frame_t, target_component) }, \ + { "bus", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_canfd_frame_t, bus) }, \ + { "len", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_canfd_frame_t, len) }, \ + { "id", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_canfd_frame_t, id) }, \ + { "data", NULL, MAVLINK_TYPE_UINT8_T, 64, 8, offsetof(mavlink_canfd_frame_t, data) }, \ + } \ +} +#endif + +/** + * @brief Pack a canfd_frame message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID. + * @param target_component Component ID. + * @param bus bus number + * @param len Frame length + * @param id Frame ID + * @param data Frame data + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_canfd_frame_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint8_t bus, uint8_t len, uint32_t id, const uint8_t *data) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CANFD_FRAME_LEN]; + _mav_put_uint32_t(buf, 0, id); + _mav_put_uint8_t(buf, 4, target_system); + _mav_put_uint8_t(buf, 5, target_component); + _mav_put_uint8_t(buf, 6, bus); + _mav_put_uint8_t(buf, 7, len); + _mav_put_uint8_t_array(buf, 8, data, 64); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CANFD_FRAME_LEN); +#else + mavlink_canfd_frame_t packet; + packet.id = id; + packet.target_system = target_system; + packet.target_component = target_component; + packet.bus = bus; + packet.len = len; + mav_array_assign_uint8_t(packet.data, data, 64); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CANFD_FRAME_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CANFD_FRAME; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CANFD_FRAME_MIN_LEN, MAVLINK_MSG_ID_CANFD_FRAME_LEN, MAVLINK_MSG_ID_CANFD_FRAME_CRC); +} + +/** + * @brief Pack a canfd_frame message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID. + * @param target_component Component ID. + * @param bus bus number + * @param len Frame length + * @param id Frame ID + * @param data Frame data + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_canfd_frame_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint8_t bus, uint8_t len, uint32_t id, const uint8_t *data) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CANFD_FRAME_LEN]; + _mav_put_uint32_t(buf, 0, id); + _mav_put_uint8_t(buf, 4, target_system); + _mav_put_uint8_t(buf, 5, target_component); + _mav_put_uint8_t(buf, 6, bus); + _mav_put_uint8_t(buf, 7, len); + _mav_put_uint8_t_array(buf, 8, data, 64); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CANFD_FRAME_LEN); +#else + mavlink_canfd_frame_t packet; + packet.id = id; + packet.target_system = target_system; + packet.target_component = target_component; + packet.bus = bus; + packet.len = len; + mav_array_memcpy(packet.data, data, sizeof(uint8_t)*64); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CANFD_FRAME_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CANFD_FRAME; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CANFD_FRAME_MIN_LEN, MAVLINK_MSG_ID_CANFD_FRAME_LEN, MAVLINK_MSG_ID_CANFD_FRAME_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CANFD_FRAME_MIN_LEN, MAVLINK_MSG_ID_CANFD_FRAME_LEN); +#endif +} + +/** + * @brief Pack a canfd_frame message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param target_system System ID. + * @param target_component Component ID. + * @param bus bus number + * @param len Frame length + * @param id Frame ID + * @param data Frame data + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_canfd_frame_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t target_system,uint8_t target_component,uint8_t bus,uint8_t len,uint32_t id,const uint8_t *data) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CANFD_FRAME_LEN]; + _mav_put_uint32_t(buf, 0, id); + _mav_put_uint8_t(buf, 4, target_system); + _mav_put_uint8_t(buf, 5, target_component); + _mav_put_uint8_t(buf, 6, bus); + _mav_put_uint8_t(buf, 7, len); + _mav_put_uint8_t_array(buf, 8, data, 64); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CANFD_FRAME_LEN); +#else + mavlink_canfd_frame_t packet; + packet.id = id; + packet.target_system = target_system; + packet.target_component = target_component; + packet.bus = bus; + packet.len = len; + mav_array_assign_uint8_t(packet.data, data, 64); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CANFD_FRAME_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CANFD_FRAME; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CANFD_FRAME_MIN_LEN, MAVLINK_MSG_ID_CANFD_FRAME_LEN, MAVLINK_MSG_ID_CANFD_FRAME_CRC); +} + +/** + * @brief Encode a canfd_frame struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param canfd_frame C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_canfd_frame_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_canfd_frame_t* canfd_frame) +{ + return mavlink_msg_canfd_frame_pack(system_id, component_id, msg, canfd_frame->target_system, canfd_frame->target_component, canfd_frame->bus, canfd_frame->len, canfd_frame->id, canfd_frame->data); +} + +/** + * @brief Encode a canfd_frame struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param canfd_frame C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_canfd_frame_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_canfd_frame_t* canfd_frame) +{ + return mavlink_msg_canfd_frame_pack_chan(system_id, component_id, chan, msg, canfd_frame->target_system, canfd_frame->target_component, canfd_frame->bus, canfd_frame->len, canfd_frame->id, canfd_frame->data); +} + +/** + * @brief Encode a canfd_frame struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param canfd_frame C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_canfd_frame_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_canfd_frame_t* canfd_frame) +{ + return mavlink_msg_canfd_frame_pack_status(system_id, component_id, _status, msg, canfd_frame->target_system, canfd_frame->target_component, canfd_frame->bus, canfd_frame->len, canfd_frame->id, canfd_frame->data); +} + +/** + * @brief Send a canfd_frame message + * @param chan MAVLink channel to send the message + * + * @param target_system System ID. + * @param target_component Component ID. + * @param bus bus number + * @param len Frame length + * @param id Frame ID + * @param data Frame data + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_canfd_frame_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t bus, uint8_t len, uint32_t id, const uint8_t *data) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CANFD_FRAME_LEN]; + _mav_put_uint32_t(buf, 0, id); + _mav_put_uint8_t(buf, 4, target_system); + _mav_put_uint8_t(buf, 5, target_component); + _mav_put_uint8_t(buf, 6, bus); + _mav_put_uint8_t(buf, 7, len); + _mav_put_uint8_t_array(buf, 8, data, 64); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CANFD_FRAME, buf, MAVLINK_MSG_ID_CANFD_FRAME_MIN_LEN, MAVLINK_MSG_ID_CANFD_FRAME_LEN, MAVLINK_MSG_ID_CANFD_FRAME_CRC); +#else + mavlink_canfd_frame_t packet; + packet.id = id; + packet.target_system = target_system; + packet.target_component = target_component; + packet.bus = bus; + packet.len = len; + mav_array_assign_uint8_t(packet.data, data, 64); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CANFD_FRAME, (const char *)&packet, MAVLINK_MSG_ID_CANFD_FRAME_MIN_LEN, MAVLINK_MSG_ID_CANFD_FRAME_LEN, MAVLINK_MSG_ID_CANFD_FRAME_CRC); +#endif +} + +/** + * @brief Send a canfd_frame message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_canfd_frame_send_struct(mavlink_channel_t chan, const mavlink_canfd_frame_t* canfd_frame) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_canfd_frame_send(chan, canfd_frame->target_system, canfd_frame->target_component, canfd_frame->bus, canfd_frame->len, canfd_frame->id, canfd_frame->data); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CANFD_FRAME, (const char *)canfd_frame, MAVLINK_MSG_ID_CANFD_FRAME_MIN_LEN, MAVLINK_MSG_ID_CANFD_FRAME_LEN, MAVLINK_MSG_ID_CANFD_FRAME_CRC); +#endif +} + +#if MAVLINK_MSG_ID_CANFD_FRAME_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_canfd_frame_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t bus, uint8_t len, uint32_t id, const uint8_t *data) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint32_t(buf, 0, id); + _mav_put_uint8_t(buf, 4, target_system); + _mav_put_uint8_t(buf, 5, target_component); + _mav_put_uint8_t(buf, 6, bus); + _mav_put_uint8_t(buf, 7, len); + _mav_put_uint8_t_array(buf, 8, data, 64); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CANFD_FRAME, buf, MAVLINK_MSG_ID_CANFD_FRAME_MIN_LEN, MAVLINK_MSG_ID_CANFD_FRAME_LEN, MAVLINK_MSG_ID_CANFD_FRAME_CRC); +#else + mavlink_canfd_frame_t *packet = (mavlink_canfd_frame_t *)msgbuf; + packet->id = id; + packet->target_system = target_system; + packet->target_component = target_component; + packet->bus = bus; + packet->len = len; + mav_array_assign_uint8_t(packet->data, data, 64); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CANFD_FRAME, (const char *)packet, MAVLINK_MSG_ID_CANFD_FRAME_MIN_LEN, MAVLINK_MSG_ID_CANFD_FRAME_LEN, MAVLINK_MSG_ID_CANFD_FRAME_CRC); +#endif +} +#endif + +#endif + +// MESSAGE CANFD_FRAME UNPACKING + + +/** + * @brief Get field target_system from canfd_frame message + * + * @return System ID. + */ +static inline uint8_t mavlink_msg_canfd_frame_get_target_system(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 4); +} + +/** + * @brief Get field target_component from canfd_frame message + * + * @return Component ID. + */ +static inline uint8_t mavlink_msg_canfd_frame_get_target_component(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 5); +} + +/** + * @brief Get field bus from canfd_frame message + * + * @return bus number + */ +static inline uint8_t mavlink_msg_canfd_frame_get_bus(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 6); +} + +/** + * @brief Get field len from canfd_frame message + * + * @return Frame length + */ +static inline uint8_t mavlink_msg_canfd_frame_get_len(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 7); +} + +/** + * @brief Get field id from canfd_frame message + * + * @return Frame ID + */ +static inline uint32_t mavlink_msg_canfd_frame_get_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 0); +} + +/** + * @brief Get field data from canfd_frame message + * + * @return Frame data + */ +static inline uint16_t mavlink_msg_canfd_frame_get_data(const mavlink_message_t* msg, uint8_t *data) +{ + return _MAV_RETURN_uint8_t_array(msg, data, 64, 8); +} + +/** + * @brief Decode a canfd_frame message into a struct + * + * @param msg The message to decode + * @param canfd_frame C-struct to decode the message contents into + */ +static inline void mavlink_msg_canfd_frame_decode(const mavlink_message_t* msg, mavlink_canfd_frame_t* canfd_frame) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + canfd_frame->id = mavlink_msg_canfd_frame_get_id(msg); + canfd_frame->target_system = mavlink_msg_canfd_frame_get_target_system(msg); + canfd_frame->target_component = mavlink_msg_canfd_frame_get_target_component(msg); + canfd_frame->bus = mavlink_msg_canfd_frame_get_bus(msg); + canfd_frame->len = mavlink_msg_canfd_frame_get_len(msg); + mavlink_msg_canfd_frame_get_data(msg, canfd_frame->data); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_CANFD_FRAME_LEN? msg->len : MAVLINK_MSG_ID_CANFD_FRAME_LEN; + memset(canfd_frame, 0, MAVLINK_MSG_ID_CANFD_FRAME_LEN); + memcpy(canfd_frame, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/common/mavlink_msg_cellular_config.h b/common/mavlink_msg_cellular_config.h index 5b8a1fb76..5772ac9e9 100644 --- a/common/mavlink_msg_cellular_config.h +++ b/common/mavlink_msg_cellular_config.h @@ -78,6 +78,54 @@ typedef struct __mavlink_cellular_config_t { static inline uint16_t mavlink_msg_cellular_config_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t enable_lte, uint8_t enable_pin, const char *pin, const char *new_pin, const char *apn, const char *puk, uint8_t roaming, uint8_t response) { +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN]; + _mav_put_uint8_t(buf, 0, enable_lte); + _mav_put_uint8_t(buf, 1, enable_pin); + _mav_put_uint8_t(buf, 82, roaming); + _mav_put_uint8_t(buf, 83, response); + _mav_put_char_array(buf, 2, pin, 16); + _mav_put_char_array(buf, 18, new_pin, 16); + _mav_put_char_array(buf, 34, apn, 32); + _mav_put_char_array(buf, 66, puk, 16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN); +#else + mavlink_cellular_config_t packet; + packet.enable_lte = enable_lte; + packet.enable_pin = enable_pin; + packet.roaming = roaming; + packet.response = response; + mav_array_assign_char(packet.pin, pin, 16); + mav_array_assign_char(packet.new_pin, new_pin, 16); + mav_array_assign_char(packet.apn, apn, 32); + mav_array_assign_char(packet.puk, puk, 16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CELLULAR_CONFIG; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CELLULAR_CONFIG_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN, MAVLINK_MSG_ID_CELLULAR_CONFIG_CRC); +} + +/** + * @brief Pack a cellular_config message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param enable_lte Enable/disable LTE. 0: setting unchanged, 1: disabled, 2: enabled. Current setting when sent back as a response. + * @param enable_pin Enable/disable PIN on the SIM card. 0: setting unchanged, 1: disabled, 2: enabled. Current setting when sent back as a response. + * @param pin PIN sent to the SIM card. Blank when PIN is disabled. Empty when message is sent back as a response. + * @param new_pin New PIN when changing the PIN. Blank to leave it unchanged. Empty when message is sent back as a response. + * @param apn Name of the cellular APN. Blank to leave it unchanged. Current APN when sent back as a response. + * @param puk Required PUK code in case the user failed to authenticate 3 times with the PIN. Empty when message is sent back as a response. + * @param roaming Enable/disable roaming. 0: setting unchanged, 1: disabled, 2: enabled. Current setting when sent back as a response. + * @param response Message acceptance response (sent back to GS). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_cellular_config_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t enable_lte, uint8_t enable_pin, const char *pin, const char *new_pin, const char *apn, const char *puk, uint8_t roaming, uint8_t response) +{ #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN]; _mav_put_uint8_t(buf, 0, enable_lte); @@ -103,7 +151,11 @@ static inline uint16_t mavlink_msg_cellular_config_pack(uint8_t system_id, uint8 #endif msg->msgid = MAVLINK_MSG_ID_CELLULAR_CONFIG; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CELLULAR_CONFIG_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN, MAVLINK_MSG_ID_CELLULAR_CONFIG_CRC); +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CELLULAR_CONFIG_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN, MAVLINK_MSG_ID_CELLULAR_CONFIG_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CELLULAR_CONFIG_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN); +#endif } /** @@ -143,10 +195,10 @@ static inline uint16_t mavlink_msg_cellular_config_pack_chan(uint8_t system_id, packet.enable_pin = enable_pin; packet.roaming = roaming; packet.response = response; - mav_array_memcpy(packet.pin, pin, sizeof(char)*16); - mav_array_memcpy(packet.new_pin, new_pin, sizeof(char)*16); - mav_array_memcpy(packet.apn, apn, sizeof(char)*32); - mav_array_memcpy(packet.puk, puk, sizeof(char)*16); + mav_array_assign_char(packet.pin, pin, 16); + mav_array_assign_char(packet.new_pin, new_pin, 16); + mav_array_assign_char(packet.apn, apn, 32); + mav_array_assign_char(packet.puk, puk, 16); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN); #endif @@ -181,6 +233,20 @@ static inline uint16_t mavlink_msg_cellular_config_encode_chan(uint8_t system_id return mavlink_msg_cellular_config_pack_chan(system_id, component_id, chan, msg, cellular_config->enable_lte, cellular_config->enable_pin, cellular_config->pin, cellular_config->new_pin, cellular_config->apn, cellular_config->puk, cellular_config->roaming, cellular_config->response); } +/** + * @brief Encode a cellular_config struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param cellular_config C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_cellular_config_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_cellular_config_t* cellular_config) +{ + return mavlink_msg_cellular_config_pack_status(system_id, component_id, _status, msg, cellular_config->enable_lte, cellular_config->enable_pin, cellular_config->pin, cellular_config->new_pin, cellular_config->apn, cellular_config->puk, cellular_config->roaming, cellular_config->response); +} + /** * @brief Send a cellular_config message * @param chan MAVLink channel to send the message @@ -215,10 +281,10 @@ static inline void mavlink_msg_cellular_config_send(mavlink_channel_t chan, uint packet.enable_pin = enable_pin; packet.roaming = roaming; packet.response = response; - mav_array_memcpy(packet.pin, pin, sizeof(char)*16); - mav_array_memcpy(packet.new_pin, new_pin, sizeof(char)*16); - mav_array_memcpy(packet.apn, apn, sizeof(char)*32); - mav_array_memcpy(packet.puk, puk, sizeof(char)*16); + mav_array_assign_char(packet.pin, pin, 16); + mav_array_assign_char(packet.new_pin, new_pin, 16); + mav_array_assign_char(packet.apn, apn, 32); + mav_array_assign_char(packet.puk, puk, 16); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CELLULAR_CONFIG, (const char *)&packet, MAVLINK_MSG_ID_CELLULAR_CONFIG_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN, MAVLINK_MSG_ID_CELLULAR_CONFIG_CRC); #endif } @@ -239,7 +305,7 @@ static inline void mavlink_msg_cellular_config_send_struct(mavlink_channel_t cha #if MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -264,10 +330,10 @@ static inline void mavlink_msg_cellular_config_send_buf(mavlink_message_t *msgbu packet->enable_pin = enable_pin; packet->roaming = roaming; packet->response = response; - mav_array_memcpy(packet->pin, pin, sizeof(char)*16); - mav_array_memcpy(packet->new_pin, new_pin, sizeof(char)*16); - mav_array_memcpy(packet->apn, apn, sizeof(char)*32); - mav_array_memcpy(packet->puk, puk, sizeof(char)*16); + mav_array_assign_char(packet->pin, pin, 16); + mav_array_assign_char(packet->new_pin, new_pin, 16); + mav_array_assign_char(packet->apn, apn, 32); + mav_array_assign_char(packet->puk, puk, 16); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CELLULAR_CONFIG, (const char *)packet, MAVLINK_MSG_ID_CELLULAR_CONFIG_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN, MAVLINK_MSG_ID_CELLULAR_CONFIG_CRC); #endif } diff --git a/common/mavlink_msg_cellular_status.h b/common/mavlink_msg_cellular_status.h index 5b1c19580..44c4f3bd7 100644 --- a/common/mavlink_msg_cellular_status.h +++ b/common/mavlink_msg_cellular_status.h @@ -3,32 +3,43 @@ #define MAVLINK_MSG_ID_CELLULAR_STATUS 334 - +MAVPACKED( typedef struct __mavlink_cellular_status_t { uint16_t mcc; /*< Mobile country code. If unknown, set to UINT16_MAX*/ uint16_t mnc; /*< Mobile network code. If unknown, set to UINT16_MAX*/ uint16_t lac; /*< Location area code. If unknown, set to 0*/ uint8_t status; /*< Cellular modem status*/ - uint8_t failure_reason; /*< Failure reason when status in in CELLUAR_STATUS_FAILED*/ + uint8_t failure_reason; /*< Failure reason when status in in CELLULAR_STATUS_FLAG_FAILED*/ uint8_t type; /*< Cellular network radio type: gsm, cdma, lte...*/ - uint8_t quality; /*< Signal quality in percent. If unknown, set to UINT8_MAX*/ -} mavlink_cellular_status_t; - -#define MAVLINK_MSG_ID_CELLULAR_STATUS_LEN 10 + uint8_t quality; /*< Signal quality in percent. May be used for Received Signal Strength Indicator (RSSI). If unknown, set to UINT8_MAX*/ + uint8_t band_number; /*< (WIP) LTE frequency band number.*/ + float band_frequency; /*< [MHz] (WIP) LTE radio frequency.*/ + uint16_t channel_number; /*< (WIP) The channel number (CN). Absolute radio-frequency (ARFCN) / E-UTRA (EARFCN) / UTRA (UARFCN) / New radio (NR_CH).*/ + float rx_level; /*< [dBm] (WIP) On 3G is Received Signal Code Power (RSCP). On LTE Reference Signal Received Power (RSRP). On 5G is New Radio Reference Signal Received Power (NR_RSRQ).*/ + float tx_level; /*< [dBm] (WIP) Transmitter (modem) signal absolute power level.*/ + float rx_quality; /*< [dBm] (WIP) On 3G is Receiver Quality (RxQual). On LTE is Reference Signal Received Quality (RSRQ). On 5G is New radio Reference Signal Received Quality (NR_RSRQ).*/ + uint32_t link_tx_rate; /*< [KiB/s] (WIP) Download rate.*/ + uint32_t link_rx_rate; /*< [KiB/s] (WIP) Upload rate.*/ + uint16_t ber; /*< (WIP) The bit error rate (BER) is determined by comparing the erroneous bits received with the total number of bits received. It is a ratio.*/ + uint8_t id; /*< (WIP) Cellular instance number. Indexed from 1. Matches index in corresponding CELLULAR_MODEM_INFORMATION message.*/ + char cell_tower_id[9]; /*< (WIP) ID of the currently connected cell tower. This must be NULL terminated if the length is less than 9 human-readable chars, and without the null termination (NULL) byte if the length is exactly 9 chars.*/ +}) mavlink_cellular_status_t; + +#define MAVLINK_MSG_ID_CELLULAR_STATUS_LEN 49 #define MAVLINK_MSG_ID_CELLULAR_STATUS_MIN_LEN 10 -#define MAVLINK_MSG_ID_334_LEN 10 +#define MAVLINK_MSG_ID_334_LEN 49 #define MAVLINK_MSG_ID_334_MIN_LEN 10 #define MAVLINK_MSG_ID_CELLULAR_STATUS_CRC 72 #define MAVLINK_MSG_ID_334_CRC 72 - +#define MAVLINK_MSG_CELLULAR_STATUS_FIELD_CELL_TOWER_ID_LEN 9 #if MAVLINK_COMMAND_24BIT #define MAVLINK_MESSAGE_INFO_CELLULAR_STATUS { \ 334, \ "CELLULAR_STATUS", \ - 7, \ + 18, \ { { "status", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_cellular_status_t, status) }, \ { "failure_reason", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_cellular_status_t, failure_reason) }, \ { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_cellular_status_t, type) }, \ @@ -36,12 +47,23 @@ typedef struct __mavlink_cellular_status_t { { "mcc", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_cellular_status_t, mcc) }, \ { "mnc", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_cellular_status_t, mnc) }, \ { "lac", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_cellular_status_t, lac) }, \ + { "band_number", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_cellular_status_t, band_number) }, \ + { "band_frequency", NULL, MAVLINK_TYPE_FLOAT, 0, 11, offsetof(mavlink_cellular_status_t, band_frequency) }, \ + { "channel_number", NULL, MAVLINK_TYPE_UINT16_T, 0, 15, offsetof(mavlink_cellular_status_t, channel_number) }, \ + { "rx_level", NULL, MAVLINK_TYPE_FLOAT, 0, 17, offsetof(mavlink_cellular_status_t, rx_level) }, \ + { "tx_level", NULL, MAVLINK_TYPE_FLOAT, 0, 21, offsetof(mavlink_cellular_status_t, tx_level) }, \ + { "rx_quality", NULL, MAVLINK_TYPE_FLOAT, 0, 25, offsetof(mavlink_cellular_status_t, rx_quality) }, \ + { "link_tx_rate", NULL, MAVLINK_TYPE_UINT32_T, 0, 29, offsetof(mavlink_cellular_status_t, link_tx_rate) }, \ + { "link_rx_rate", NULL, MAVLINK_TYPE_UINT32_T, 0, 33, offsetof(mavlink_cellular_status_t, link_rx_rate) }, \ + { "ber", NULL, MAVLINK_TYPE_UINT16_T, 0, 37, offsetof(mavlink_cellular_status_t, ber) }, \ + { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 39, offsetof(mavlink_cellular_status_t, id) }, \ + { "cell_tower_id", NULL, MAVLINK_TYPE_CHAR, 9, 40, offsetof(mavlink_cellular_status_t, cell_tower_id) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_CELLULAR_STATUS { \ "CELLULAR_STATUS", \ - 7, \ + 18, \ { { "status", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_cellular_status_t, status) }, \ { "failure_reason", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_cellular_status_t, failure_reason) }, \ { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_cellular_status_t, type) }, \ @@ -49,6 +71,17 @@ typedef struct __mavlink_cellular_status_t { { "mcc", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_cellular_status_t, mcc) }, \ { "mnc", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_cellular_status_t, mnc) }, \ { "lac", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_cellular_status_t, lac) }, \ + { "band_number", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_cellular_status_t, band_number) }, \ + { "band_frequency", NULL, MAVLINK_TYPE_FLOAT, 0, 11, offsetof(mavlink_cellular_status_t, band_frequency) }, \ + { "channel_number", NULL, MAVLINK_TYPE_UINT16_T, 0, 15, offsetof(mavlink_cellular_status_t, channel_number) }, \ + { "rx_level", NULL, MAVLINK_TYPE_FLOAT, 0, 17, offsetof(mavlink_cellular_status_t, rx_level) }, \ + { "tx_level", NULL, MAVLINK_TYPE_FLOAT, 0, 21, offsetof(mavlink_cellular_status_t, tx_level) }, \ + { "rx_quality", NULL, MAVLINK_TYPE_FLOAT, 0, 25, offsetof(mavlink_cellular_status_t, rx_quality) }, \ + { "link_tx_rate", NULL, MAVLINK_TYPE_UINT32_T, 0, 29, offsetof(mavlink_cellular_status_t, link_tx_rate) }, \ + { "link_rx_rate", NULL, MAVLINK_TYPE_UINT32_T, 0, 33, offsetof(mavlink_cellular_status_t, link_rx_rate) }, \ + { "ber", NULL, MAVLINK_TYPE_UINT16_T, 0, 37, offsetof(mavlink_cellular_status_t, ber) }, \ + { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 39, offsetof(mavlink_cellular_status_t, id) }, \ + { "cell_tower_id", NULL, MAVLINK_TYPE_CHAR, 9, 40, offsetof(mavlink_cellular_status_t, cell_tower_id) }, \ } \ } #endif @@ -60,16 +93,27 @@ typedef struct __mavlink_cellular_status_t { * @param msg The MAVLink message to compress the data into * * @param status Cellular modem status - * @param failure_reason Failure reason when status in in CELLUAR_STATUS_FAILED + * @param failure_reason Failure reason when status in in CELLULAR_STATUS_FLAG_FAILED * @param type Cellular network radio type: gsm, cdma, lte... - * @param quality Signal quality in percent. If unknown, set to UINT8_MAX + * @param quality Signal quality in percent. May be used for Received Signal Strength Indicator (RSSI). If unknown, set to UINT8_MAX * @param mcc Mobile country code. If unknown, set to UINT16_MAX * @param mnc Mobile network code. If unknown, set to UINT16_MAX * @param lac Location area code. If unknown, set to 0 + * @param band_number (WIP) LTE frequency band number. + * @param band_frequency [MHz] (WIP) LTE radio frequency. + * @param channel_number (WIP) The channel number (CN). Absolute radio-frequency (ARFCN) / E-UTRA (EARFCN) / UTRA (UARFCN) / New radio (NR_CH). + * @param rx_level [dBm] (WIP) On 3G is Received Signal Code Power (RSCP). On LTE Reference Signal Received Power (RSRP). On 5G is New Radio Reference Signal Received Power (NR_RSRQ). + * @param tx_level [dBm] (WIP) Transmitter (modem) signal absolute power level. + * @param rx_quality [dBm] (WIP) On 3G is Receiver Quality (RxQual). On LTE is Reference Signal Received Quality (RSRQ). On 5G is New radio Reference Signal Received Quality (NR_RSRQ). + * @param link_tx_rate [KiB/s] (WIP) Download rate. + * @param link_rx_rate [KiB/s] (WIP) Upload rate. + * @param ber (WIP) The bit error rate (BER) is determined by comparing the erroneous bits received with the total number of bits received. It is a ratio. + * @param id (WIP) Cellular instance number. Indexed from 1. Matches index in corresponding CELLULAR_MODEM_INFORMATION message. + * @param cell_tower_id (WIP) ID of the currently connected cell tower. This must be NULL terminated if the length is less than 9 human-readable chars, and without the null termination (NULL) byte if the length is exactly 9 chars. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_cellular_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t status, uint8_t failure_reason, uint8_t type, uint8_t quality, uint16_t mcc, uint16_t mnc, uint16_t lac) + uint8_t status, uint8_t failure_reason, uint8_t type, uint8_t quality, uint16_t mcc, uint16_t mnc, uint16_t lac, uint8_t band_number, float band_frequency, uint16_t channel_number, float rx_level, float tx_level, float rx_quality, uint32_t link_tx_rate, uint32_t link_rx_rate, uint16_t ber, uint8_t id, const char *cell_tower_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_CELLULAR_STATUS_LEN]; @@ -80,7 +124,17 @@ static inline uint16_t mavlink_msg_cellular_status_pack(uint8_t system_id, uint8 _mav_put_uint8_t(buf, 7, failure_reason); _mav_put_uint8_t(buf, 8, type); _mav_put_uint8_t(buf, 9, quality); - + _mav_put_uint8_t(buf, 10, band_number); + _mav_put_float(buf, 11, band_frequency); + _mav_put_uint16_t(buf, 15, channel_number); + _mav_put_float(buf, 17, rx_level); + _mav_put_float(buf, 21, tx_level); + _mav_put_float(buf, 25, rx_quality); + _mav_put_uint32_t(buf, 29, link_tx_rate); + _mav_put_uint32_t(buf, 33, link_rx_rate); + _mav_put_uint16_t(buf, 37, ber); + _mav_put_uint8_t(buf, 39, id); + _mav_put_char_array(buf, 40, cell_tower_id, 9); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CELLULAR_STATUS_LEN); #else mavlink_cellular_status_t packet; @@ -91,7 +145,17 @@ static inline uint16_t mavlink_msg_cellular_status_pack(uint8_t system_id, uint8 packet.failure_reason = failure_reason; packet.type = type; packet.quality = quality; - + packet.band_number = band_number; + packet.band_frequency = band_frequency; + packet.channel_number = channel_number; + packet.rx_level = rx_level; + packet.tx_level = tx_level; + packet.rx_quality = rx_quality; + packet.link_tx_rate = link_tx_rate; + packet.link_rx_rate = link_rx_rate; + packet.ber = ber; + packet.id = id; + mav_array_assign_char(packet.cell_tower_id, cell_tower_id, 9); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CELLULAR_STATUS_LEN); #endif @@ -99,6 +163,88 @@ static inline uint16_t mavlink_msg_cellular_status_pack(uint8_t system_id, uint8 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CELLULAR_STATUS_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_STATUS_LEN, MAVLINK_MSG_ID_CELLULAR_STATUS_CRC); } +/** + * @brief Pack a cellular_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param status Cellular modem status + * @param failure_reason Failure reason when status in in CELLULAR_STATUS_FLAG_FAILED + * @param type Cellular network radio type: gsm, cdma, lte... + * @param quality Signal quality in percent. May be used for Received Signal Strength Indicator (RSSI). If unknown, set to UINT8_MAX + * @param mcc Mobile country code. If unknown, set to UINT16_MAX + * @param mnc Mobile network code. If unknown, set to UINT16_MAX + * @param lac Location area code. If unknown, set to 0 + * @param band_number (WIP) LTE frequency band number. + * @param band_frequency [MHz] (WIP) LTE radio frequency. + * @param channel_number (WIP) The channel number (CN). Absolute radio-frequency (ARFCN) / E-UTRA (EARFCN) / UTRA (UARFCN) / New radio (NR_CH). + * @param rx_level [dBm] (WIP) On 3G is Received Signal Code Power (RSCP). On LTE Reference Signal Received Power (RSRP). On 5G is New Radio Reference Signal Received Power (NR_RSRQ). + * @param tx_level [dBm] (WIP) Transmitter (modem) signal absolute power level. + * @param rx_quality [dBm] (WIP) On 3G is Receiver Quality (RxQual). On LTE is Reference Signal Received Quality (RSRQ). On 5G is New radio Reference Signal Received Quality (NR_RSRQ). + * @param link_tx_rate [KiB/s] (WIP) Download rate. + * @param link_rx_rate [KiB/s] (WIP) Upload rate. + * @param ber (WIP) The bit error rate (BER) is determined by comparing the erroneous bits received with the total number of bits received. It is a ratio. + * @param id (WIP) Cellular instance number. Indexed from 1. Matches index in corresponding CELLULAR_MODEM_INFORMATION message. + * @param cell_tower_id (WIP) ID of the currently connected cell tower. This must be NULL terminated if the length is less than 9 human-readable chars, and without the null termination (NULL) byte if the length is exactly 9 chars. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_cellular_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t status, uint8_t failure_reason, uint8_t type, uint8_t quality, uint16_t mcc, uint16_t mnc, uint16_t lac, uint8_t band_number, float band_frequency, uint16_t channel_number, float rx_level, float tx_level, float rx_quality, uint32_t link_tx_rate, uint32_t link_rx_rate, uint16_t ber, uint8_t id, const char *cell_tower_id) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CELLULAR_STATUS_LEN]; + _mav_put_uint16_t(buf, 0, mcc); + _mav_put_uint16_t(buf, 2, mnc); + _mav_put_uint16_t(buf, 4, lac); + _mav_put_uint8_t(buf, 6, status); + _mav_put_uint8_t(buf, 7, failure_reason); + _mav_put_uint8_t(buf, 8, type); + _mav_put_uint8_t(buf, 9, quality); + _mav_put_uint8_t(buf, 10, band_number); + _mav_put_float(buf, 11, band_frequency); + _mav_put_uint16_t(buf, 15, channel_number); + _mav_put_float(buf, 17, rx_level); + _mav_put_float(buf, 21, tx_level); + _mav_put_float(buf, 25, rx_quality); + _mav_put_uint32_t(buf, 29, link_tx_rate); + _mav_put_uint32_t(buf, 33, link_rx_rate); + _mav_put_uint16_t(buf, 37, ber); + _mav_put_uint8_t(buf, 39, id); + _mav_put_char_array(buf, 40, cell_tower_id, 9); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CELLULAR_STATUS_LEN); +#else + mavlink_cellular_status_t packet; + packet.mcc = mcc; + packet.mnc = mnc; + packet.lac = lac; + packet.status = status; + packet.failure_reason = failure_reason; + packet.type = type; + packet.quality = quality; + packet.band_number = band_number; + packet.band_frequency = band_frequency; + packet.channel_number = channel_number; + packet.rx_level = rx_level; + packet.tx_level = tx_level; + packet.rx_quality = rx_quality; + packet.link_tx_rate = link_tx_rate; + packet.link_rx_rate = link_rx_rate; + packet.ber = ber; + packet.id = id; + mav_array_memcpy(packet.cell_tower_id, cell_tower_id, sizeof(char)*9); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CELLULAR_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CELLULAR_STATUS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CELLULAR_STATUS_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_STATUS_LEN, MAVLINK_MSG_ID_CELLULAR_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CELLULAR_STATUS_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_STATUS_LEN); +#endif +} + /** * @brief Pack a cellular_status message on a channel * @param system_id ID of this system @@ -106,17 +252,28 @@ static inline uint16_t mavlink_msg_cellular_status_pack(uint8_t system_id, uint8 * @param chan The MAVLink channel this message will be sent over * @param msg The MAVLink message to compress the data into * @param status Cellular modem status - * @param failure_reason Failure reason when status in in CELLUAR_STATUS_FAILED + * @param failure_reason Failure reason when status in in CELLULAR_STATUS_FLAG_FAILED * @param type Cellular network radio type: gsm, cdma, lte... - * @param quality Signal quality in percent. If unknown, set to UINT8_MAX + * @param quality Signal quality in percent. May be used for Received Signal Strength Indicator (RSSI). If unknown, set to UINT8_MAX * @param mcc Mobile country code. If unknown, set to UINT16_MAX * @param mnc Mobile network code. If unknown, set to UINT16_MAX * @param lac Location area code. If unknown, set to 0 + * @param band_number (WIP) LTE frequency band number. + * @param band_frequency [MHz] (WIP) LTE radio frequency. + * @param channel_number (WIP) The channel number (CN). Absolute radio-frequency (ARFCN) / E-UTRA (EARFCN) / UTRA (UARFCN) / New radio (NR_CH). + * @param rx_level [dBm] (WIP) On 3G is Received Signal Code Power (RSCP). On LTE Reference Signal Received Power (RSRP). On 5G is New Radio Reference Signal Received Power (NR_RSRQ). + * @param tx_level [dBm] (WIP) Transmitter (modem) signal absolute power level. + * @param rx_quality [dBm] (WIP) On 3G is Receiver Quality (RxQual). On LTE is Reference Signal Received Quality (RSRQ). On 5G is New radio Reference Signal Received Quality (NR_RSRQ). + * @param link_tx_rate [KiB/s] (WIP) Download rate. + * @param link_rx_rate [KiB/s] (WIP) Upload rate. + * @param ber (WIP) The bit error rate (BER) is determined by comparing the erroneous bits received with the total number of bits received. It is a ratio. + * @param id (WIP) Cellular instance number. Indexed from 1. Matches index in corresponding CELLULAR_MODEM_INFORMATION message. + * @param cell_tower_id (WIP) ID of the currently connected cell tower. This must be NULL terminated if the length is less than 9 human-readable chars, and without the null termination (NULL) byte if the length is exactly 9 chars. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_cellular_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - uint8_t status,uint8_t failure_reason,uint8_t type,uint8_t quality,uint16_t mcc,uint16_t mnc,uint16_t lac) + uint8_t status,uint8_t failure_reason,uint8_t type,uint8_t quality,uint16_t mcc,uint16_t mnc,uint16_t lac,uint8_t band_number,float band_frequency,uint16_t channel_number,float rx_level,float tx_level,float rx_quality,uint32_t link_tx_rate,uint32_t link_rx_rate,uint16_t ber,uint8_t id,const char *cell_tower_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_CELLULAR_STATUS_LEN]; @@ -127,7 +284,17 @@ static inline uint16_t mavlink_msg_cellular_status_pack_chan(uint8_t system_id, _mav_put_uint8_t(buf, 7, failure_reason); _mav_put_uint8_t(buf, 8, type); _mav_put_uint8_t(buf, 9, quality); - + _mav_put_uint8_t(buf, 10, band_number); + _mav_put_float(buf, 11, band_frequency); + _mav_put_uint16_t(buf, 15, channel_number); + _mav_put_float(buf, 17, rx_level); + _mav_put_float(buf, 21, tx_level); + _mav_put_float(buf, 25, rx_quality); + _mav_put_uint32_t(buf, 29, link_tx_rate); + _mav_put_uint32_t(buf, 33, link_rx_rate); + _mav_put_uint16_t(buf, 37, ber); + _mav_put_uint8_t(buf, 39, id); + _mav_put_char_array(buf, 40, cell_tower_id, 9); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CELLULAR_STATUS_LEN); #else mavlink_cellular_status_t packet; @@ -138,7 +305,17 @@ static inline uint16_t mavlink_msg_cellular_status_pack_chan(uint8_t system_id, packet.failure_reason = failure_reason; packet.type = type; packet.quality = quality; - + packet.band_number = band_number; + packet.band_frequency = band_frequency; + packet.channel_number = channel_number; + packet.rx_level = rx_level; + packet.tx_level = tx_level; + packet.rx_quality = rx_quality; + packet.link_tx_rate = link_tx_rate; + packet.link_rx_rate = link_rx_rate; + packet.ber = ber; + packet.id = id; + mav_array_assign_char(packet.cell_tower_id, cell_tower_id, 9); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CELLULAR_STATUS_LEN); #endif @@ -156,7 +333,7 @@ static inline uint16_t mavlink_msg_cellular_status_pack_chan(uint8_t system_id, */ static inline uint16_t mavlink_msg_cellular_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_cellular_status_t* cellular_status) { - return mavlink_msg_cellular_status_pack(system_id, component_id, msg, cellular_status->status, cellular_status->failure_reason, cellular_status->type, cellular_status->quality, cellular_status->mcc, cellular_status->mnc, cellular_status->lac); + return mavlink_msg_cellular_status_pack(system_id, component_id, msg, cellular_status->status, cellular_status->failure_reason, cellular_status->type, cellular_status->quality, cellular_status->mcc, cellular_status->mnc, cellular_status->lac, cellular_status->band_number, cellular_status->band_frequency, cellular_status->channel_number, cellular_status->rx_level, cellular_status->tx_level, cellular_status->rx_quality, cellular_status->link_tx_rate, cellular_status->link_rx_rate, cellular_status->ber, cellular_status->id, cellular_status->cell_tower_id); } /** @@ -170,7 +347,21 @@ static inline uint16_t mavlink_msg_cellular_status_encode(uint8_t system_id, uin */ static inline uint16_t mavlink_msg_cellular_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_cellular_status_t* cellular_status) { - return mavlink_msg_cellular_status_pack_chan(system_id, component_id, chan, msg, cellular_status->status, cellular_status->failure_reason, cellular_status->type, cellular_status->quality, cellular_status->mcc, cellular_status->mnc, cellular_status->lac); + return mavlink_msg_cellular_status_pack_chan(system_id, component_id, chan, msg, cellular_status->status, cellular_status->failure_reason, cellular_status->type, cellular_status->quality, cellular_status->mcc, cellular_status->mnc, cellular_status->lac, cellular_status->band_number, cellular_status->band_frequency, cellular_status->channel_number, cellular_status->rx_level, cellular_status->tx_level, cellular_status->rx_quality, cellular_status->link_tx_rate, cellular_status->link_rx_rate, cellular_status->ber, cellular_status->id, cellular_status->cell_tower_id); +} + +/** + * @brief Encode a cellular_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param cellular_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_cellular_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_cellular_status_t* cellular_status) +{ + return mavlink_msg_cellular_status_pack_status(system_id, component_id, _status, msg, cellular_status->status, cellular_status->failure_reason, cellular_status->type, cellular_status->quality, cellular_status->mcc, cellular_status->mnc, cellular_status->lac, cellular_status->band_number, cellular_status->band_frequency, cellular_status->channel_number, cellular_status->rx_level, cellular_status->tx_level, cellular_status->rx_quality, cellular_status->link_tx_rate, cellular_status->link_rx_rate, cellular_status->ber, cellular_status->id, cellular_status->cell_tower_id); } /** @@ -178,16 +369,27 @@ static inline uint16_t mavlink_msg_cellular_status_encode_chan(uint8_t system_id * @param chan MAVLink channel to send the message * * @param status Cellular modem status - * @param failure_reason Failure reason when status in in CELLUAR_STATUS_FAILED + * @param failure_reason Failure reason when status in in CELLULAR_STATUS_FLAG_FAILED * @param type Cellular network radio type: gsm, cdma, lte... - * @param quality Signal quality in percent. If unknown, set to UINT8_MAX + * @param quality Signal quality in percent. May be used for Received Signal Strength Indicator (RSSI). If unknown, set to UINT8_MAX * @param mcc Mobile country code. If unknown, set to UINT16_MAX * @param mnc Mobile network code. If unknown, set to UINT16_MAX * @param lac Location area code. If unknown, set to 0 + * @param band_number (WIP) LTE frequency band number. + * @param band_frequency [MHz] (WIP) LTE radio frequency. + * @param channel_number (WIP) The channel number (CN). Absolute radio-frequency (ARFCN) / E-UTRA (EARFCN) / UTRA (UARFCN) / New radio (NR_CH). + * @param rx_level [dBm] (WIP) On 3G is Received Signal Code Power (RSCP). On LTE Reference Signal Received Power (RSRP). On 5G is New Radio Reference Signal Received Power (NR_RSRQ). + * @param tx_level [dBm] (WIP) Transmitter (modem) signal absolute power level. + * @param rx_quality [dBm] (WIP) On 3G is Receiver Quality (RxQual). On LTE is Reference Signal Received Quality (RSRQ). On 5G is New radio Reference Signal Received Quality (NR_RSRQ). + * @param link_tx_rate [KiB/s] (WIP) Download rate. + * @param link_rx_rate [KiB/s] (WIP) Upload rate. + * @param ber (WIP) The bit error rate (BER) is determined by comparing the erroneous bits received with the total number of bits received. It is a ratio. + * @param id (WIP) Cellular instance number. Indexed from 1. Matches index in corresponding CELLULAR_MODEM_INFORMATION message. + * @param cell_tower_id (WIP) ID of the currently connected cell tower. This must be NULL terminated if the length is less than 9 human-readable chars, and without the null termination (NULL) byte if the length is exactly 9 chars. */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_cellular_status_send(mavlink_channel_t chan, uint8_t status, uint8_t failure_reason, uint8_t type, uint8_t quality, uint16_t mcc, uint16_t mnc, uint16_t lac) +static inline void mavlink_msg_cellular_status_send(mavlink_channel_t chan, uint8_t status, uint8_t failure_reason, uint8_t type, uint8_t quality, uint16_t mcc, uint16_t mnc, uint16_t lac, uint8_t band_number, float band_frequency, uint16_t channel_number, float rx_level, float tx_level, float rx_quality, uint32_t link_tx_rate, uint32_t link_rx_rate, uint16_t ber, uint8_t id, const char *cell_tower_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_CELLULAR_STATUS_LEN]; @@ -198,7 +400,17 @@ static inline void mavlink_msg_cellular_status_send(mavlink_channel_t chan, uint _mav_put_uint8_t(buf, 7, failure_reason); _mav_put_uint8_t(buf, 8, type); _mav_put_uint8_t(buf, 9, quality); - + _mav_put_uint8_t(buf, 10, band_number); + _mav_put_float(buf, 11, band_frequency); + _mav_put_uint16_t(buf, 15, channel_number); + _mav_put_float(buf, 17, rx_level); + _mav_put_float(buf, 21, tx_level); + _mav_put_float(buf, 25, rx_quality); + _mav_put_uint32_t(buf, 29, link_tx_rate); + _mav_put_uint32_t(buf, 33, link_rx_rate); + _mav_put_uint16_t(buf, 37, ber); + _mav_put_uint8_t(buf, 39, id); + _mav_put_char_array(buf, 40, cell_tower_id, 9); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CELLULAR_STATUS, buf, MAVLINK_MSG_ID_CELLULAR_STATUS_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_STATUS_LEN, MAVLINK_MSG_ID_CELLULAR_STATUS_CRC); #else mavlink_cellular_status_t packet; @@ -209,7 +421,17 @@ static inline void mavlink_msg_cellular_status_send(mavlink_channel_t chan, uint packet.failure_reason = failure_reason; packet.type = type; packet.quality = quality; - + packet.band_number = band_number; + packet.band_frequency = band_frequency; + packet.channel_number = channel_number; + packet.rx_level = rx_level; + packet.tx_level = tx_level; + packet.rx_quality = rx_quality; + packet.link_tx_rate = link_tx_rate; + packet.link_rx_rate = link_rx_rate; + packet.ber = ber; + packet.id = id; + mav_array_assign_char(packet.cell_tower_id, cell_tower_id, 9); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CELLULAR_STATUS, (const char *)&packet, MAVLINK_MSG_ID_CELLULAR_STATUS_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_STATUS_LEN, MAVLINK_MSG_ID_CELLULAR_STATUS_CRC); #endif } @@ -222,7 +444,7 @@ static inline void mavlink_msg_cellular_status_send(mavlink_channel_t chan, uint static inline void mavlink_msg_cellular_status_send_struct(mavlink_channel_t chan, const mavlink_cellular_status_t* cellular_status) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_cellular_status_send(chan, cellular_status->status, cellular_status->failure_reason, cellular_status->type, cellular_status->quality, cellular_status->mcc, cellular_status->mnc, cellular_status->lac); + mavlink_msg_cellular_status_send(chan, cellular_status->status, cellular_status->failure_reason, cellular_status->type, cellular_status->quality, cellular_status->mcc, cellular_status->mnc, cellular_status->lac, cellular_status->band_number, cellular_status->band_frequency, cellular_status->channel_number, cellular_status->rx_level, cellular_status->tx_level, cellular_status->rx_quality, cellular_status->link_tx_rate, cellular_status->link_rx_rate, cellular_status->ber, cellular_status->id, cellular_status->cell_tower_id); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CELLULAR_STATUS, (const char *)cellular_status, MAVLINK_MSG_ID_CELLULAR_STATUS_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_STATUS_LEN, MAVLINK_MSG_ID_CELLULAR_STATUS_CRC); #endif @@ -230,13 +452,13 @@ static inline void mavlink_msg_cellular_status_send_struct(mavlink_channel_t cha #if MAVLINK_MSG_ID_CELLULAR_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_cellular_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t status, uint8_t failure_reason, uint8_t type, uint8_t quality, uint16_t mcc, uint16_t mnc, uint16_t lac) +static inline void mavlink_msg_cellular_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t status, uint8_t failure_reason, uint8_t type, uint8_t quality, uint16_t mcc, uint16_t mnc, uint16_t lac, uint8_t band_number, float band_frequency, uint16_t channel_number, float rx_level, float tx_level, float rx_quality, uint32_t link_tx_rate, uint32_t link_rx_rate, uint16_t ber, uint8_t id, const char *cell_tower_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; @@ -247,7 +469,17 @@ static inline void mavlink_msg_cellular_status_send_buf(mavlink_message_t *msgbu _mav_put_uint8_t(buf, 7, failure_reason); _mav_put_uint8_t(buf, 8, type); _mav_put_uint8_t(buf, 9, quality); - + _mav_put_uint8_t(buf, 10, band_number); + _mav_put_float(buf, 11, band_frequency); + _mav_put_uint16_t(buf, 15, channel_number); + _mav_put_float(buf, 17, rx_level); + _mav_put_float(buf, 21, tx_level); + _mav_put_float(buf, 25, rx_quality); + _mav_put_uint32_t(buf, 29, link_tx_rate); + _mav_put_uint32_t(buf, 33, link_rx_rate); + _mav_put_uint16_t(buf, 37, ber); + _mav_put_uint8_t(buf, 39, id); + _mav_put_char_array(buf, 40, cell_tower_id, 9); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CELLULAR_STATUS, buf, MAVLINK_MSG_ID_CELLULAR_STATUS_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_STATUS_LEN, MAVLINK_MSG_ID_CELLULAR_STATUS_CRC); #else mavlink_cellular_status_t *packet = (mavlink_cellular_status_t *)msgbuf; @@ -258,7 +490,17 @@ static inline void mavlink_msg_cellular_status_send_buf(mavlink_message_t *msgbu packet->failure_reason = failure_reason; packet->type = type; packet->quality = quality; - + packet->band_number = band_number; + packet->band_frequency = band_frequency; + packet->channel_number = channel_number; + packet->rx_level = rx_level; + packet->tx_level = tx_level; + packet->rx_quality = rx_quality; + packet->link_tx_rate = link_tx_rate; + packet->link_rx_rate = link_rx_rate; + packet->ber = ber; + packet->id = id; + mav_array_assign_char(packet->cell_tower_id, cell_tower_id, 9); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CELLULAR_STATUS, (const char *)packet, MAVLINK_MSG_ID_CELLULAR_STATUS_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_STATUS_LEN, MAVLINK_MSG_ID_CELLULAR_STATUS_CRC); #endif } @@ -282,7 +524,7 @@ static inline uint8_t mavlink_msg_cellular_status_get_status(const mavlink_messa /** * @brief Get field failure_reason from cellular_status message * - * @return Failure reason when status in in CELLUAR_STATUS_FAILED + * @return Failure reason when status in in CELLULAR_STATUS_FLAG_FAILED */ static inline uint8_t mavlink_msg_cellular_status_get_failure_reason(const mavlink_message_t* msg) { @@ -302,7 +544,7 @@ static inline uint8_t mavlink_msg_cellular_status_get_type(const mavlink_message /** * @brief Get field quality from cellular_status message * - * @return Signal quality in percent. If unknown, set to UINT8_MAX + * @return Signal quality in percent. May be used for Received Signal Strength Indicator (RSSI). If unknown, set to UINT8_MAX */ static inline uint8_t mavlink_msg_cellular_status_get_quality(const mavlink_message_t* msg) { @@ -339,6 +581,116 @@ static inline uint16_t mavlink_msg_cellular_status_get_lac(const mavlink_message return _MAV_RETURN_uint16_t(msg, 4); } +/** + * @brief Get field band_number from cellular_status message + * + * @return (WIP) LTE frequency band number. + */ +static inline uint8_t mavlink_msg_cellular_status_get_band_number(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 10); +} + +/** + * @brief Get field band_frequency from cellular_status message + * + * @return [MHz] (WIP) LTE radio frequency. + */ +static inline float mavlink_msg_cellular_status_get_band_frequency(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 11); +} + +/** + * @brief Get field channel_number from cellular_status message + * + * @return (WIP) The channel number (CN). Absolute radio-frequency (ARFCN) / E-UTRA (EARFCN) / UTRA (UARFCN) / New radio (NR_CH). + */ +static inline uint16_t mavlink_msg_cellular_status_get_channel_number(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 15); +} + +/** + * @brief Get field rx_level from cellular_status message + * + * @return [dBm] (WIP) On 3G is Received Signal Code Power (RSCP). On LTE Reference Signal Received Power (RSRP). On 5G is New Radio Reference Signal Received Power (NR_RSRQ). + */ +static inline float mavlink_msg_cellular_status_get_rx_level(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 17); +} + +/** + * @brief Get field tx_level from cellular_status message + * + * @return [dBm] (WIP) Transmitter (modem) signal absolute power level. + */ +static inline float mavlink_msg_cellular_status_get_tx_level(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 21); +} + +/** + * @brief Get field rx_quality from cellular_status message + * + * @return [dBm] (WIP) On 3G is Receiver Quality (RxQual). On LTE is Reference Signal Received Quality (RSRQ). On 5G is New radio Reference Signal Received Quality (NR_RSRQ). + */ +static inline float mavlink_msg_cellular_status_get_rx_quality(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 25); +} + +/** + * @brief Get field link_tx_rate from cellular_status message + * + * @return [KiB/s] (WIP) Download rate. + */ +static inline uint32_t mavlink_msg_cellular_status_get_link_tx_rate(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 29); +} + +/** + * @brief Get field link_rx_rate from cellular_status message + * + * @return [KiB/s] (WIP) Upload rate. + */ +static inline uint32_t mavlink_msg_cellular_status_get_link_rx_rate(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 33); +} + +/** + * @brief Get field ber from cellular_status message + * + * @return (WIP) The bit error rate (BER) is determined by comparing the erroneous bits received with the total number of bits received. It is a ratio. + */ +static inline uint16_t mavlink_msg_cellular_status_get_ber(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 37); +} + +/** + * @brief Get field id from cellular_status message + * + * @return (WIP) Cellular instance number. Indexed from 1. Matches index in corresponding CELLULAR_MODEM_INFORMATION message. + */ +static inline uint8_t mavlink_msg_cellular_status_get_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 39); +} + +/** + * @brief Get field cell_tower_id from cellular_status message + * + * @return (WIP) ID of the currently connected cell tower. This must be NULL terminated if the length is less than 9 human-readable chars, and without the null termination (NULL) byte if the length is exactly 9 chars. + */ +static inline uint16_t mavlink_msg_cellular_status_get_cell_tower_id(const mavlink_message_t* msg, char *cell_tower_id) +{ + return _MAV_RETURN_char_array(msg, cell_tower_id, 9, 40); +} + /** * @brief Decode a cellular_status message into a struct * @@ -355,6 +707,17 @@ static inline void mavlink_msg_cellular_status_decode(const mavlink_message_t* m cellular_status->failure_reason = mavlink_msg_cellular_status_get_failure_reason(msg); cellular_status->type = mavlink_msg_cellular_status_get_type(msg); cellular_status->quality = mavlink_msg_cellular_status_get_quality(msg); + cellular_status->band_number = mavlink_msg_cellular_status_get_band_number(msg); + cellular_status->band_frequency = mavlink_msg_cellular_status_get_band_frequency(msg); + cellular_status->channel_number = mavlink_msg_cellular_status_get_channel_number(msg); + cellular_status->rx_level = mavlink_msg_cellular_status_get_rx_level(msg); + cellular_status->tx_level = mavlink_msg_cellular_status_get_tx_level(msg); + cellular_status->rx_quality = mavlink_msg_cellular_status_get_rx_quality(msg); + cellular_status->link_tx_rate = mavlink_msg_cellular_status_get_link_tx_rate(msg); + cellular_status->link_rx_rate = mavlink_msg_cellular_status_get_link_rx_rate(msg); + cellular_status->ber = mavlink_msg_cellular_status_get_ber(msg); + cellular_status->id = mavlink_msg_cellular_status_get_id(msg); + mavlink_msg_cellular_status_get_cell_tower_id(msg, cellular_status->cell_tower_id); #else uint8_t len = msg->len < MAVLINK_MSG_ID_CELLULAR_STATUS_LEN? msg->len : MAVLINK_MSG_ID_CELLULAR_STATUS_LEN; memset(cellular_status, 0, MAVLINK_MSG_ID_CELLULAR_STATUS_LEN); diff --git a/common/mavlink_msg_change_operator_control.h b/common/mavlink_msg_change_operator_control.h index 8fea8d783..1391cde04 100644 --- a/common/mavlink_msg_change_operator_control.h +++ b/common/mavlink_msg_change_operator_control.h @@ -71,7 +71,7 @@ static inline uint16_t mavlink_msg_change_operator_control_pack(uint8_t system_i packet.target_system = target_system; packet.control_request = control_request; packet.version = version; - mav_array_memcpy(packet.passkey, passkey, sizeof(char)*25); + mav_array_assign_char(packet.passkey, passkey, 25); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN); #endif @@ -79,6 +79,46 @@ static inline uint16_t mavlink_msg_change_operator_control_pack(uint8_t system_i return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_MIN_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_CRC); } +/** + * @brief Pack a change_operator_control message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System the GCS requests control for + * @param control_request 0: request control of this MAV, 1: Release control of this MAV + * @param version [rad] 0: key as plaintext, 1-255: future, different hashing/encryption variants. The GCS should in general use the safest mode possible initially and then gradually move down the encryption level if it gets a NACK message indicating an encryption mismatch. + * @param passkey Password / Key, depending on version plaintext or encrypted. 25 or less characters, NULL terminated. The characters may involve A-Z, a-z, 0-9, and "!?,.-" + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_change_operator_control_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t control_request, uint8_t version, const char *passkey) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN]; + _mav_put_uint8_t(buf, 0, target_system); + _mav_put_uint8_t(buf, 1, control_request); + _mav_put_uint8_t(buf, 2, version); + _mav_put_char_array(buf, 3, passkey, 25); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN); +#else + mavlink_change_operator_control_t packet; + packet.target_system = target_system; + packet.control_request = control_request; + packet.version = version; + mav_array_memcpy(packet.passkey, passkey, sizeof(char)*25); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_MIN_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_MIN_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN); +#endif +} + /** * @brief Pack a change_operator_control message on a channel * @param system_id ID of this system @@ -107,7 +147,7 @@ static inline uint16_t mavlink_msg_change_operator_control_pack_chan(uint8_t sys packet.target_system = target_system; packet.control_request = control_request; packet.version = version; - mav_array_memcpy(packet.passkey, passkey, sizeof(char)*25); + mav_array_assign_char(packet.passkey, passkey, 25); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN); #endif @@ -142,6 +182,20 @@ static inline uint16_t mavlink_msg_change_operator_control_encode_chan(uint8_t s return mavlink_msg_change_operator_control_pack_chan(system_id, component_id, chan, msg, change_operator_control->target_system, change_operator_control->control_request, change_operator_control->version, change_operator_control->passkey); } +/** + * @brief Encode a change_operator_control struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param change_operator_control C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_change_operator_control_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_change_operator_control_t* change_operator_control) +{ + return mavlink_msg_change_operator_control_pack_status(system_id, component_id, _status, msg, change_operator_control->target_system, change_operator_control->control_request, change_operator_control->version, change_operator_control->passkey); +} + /** * @brief Send a change_operator_control message * @param chan MAVLink channel to send the message @@ -167,7 +221,7 @@ static inline void mavlink_msg_change_operator_control_send(mavlink_channel_t ch packet.target_system = target_system; packet.control_request = control_request; packet.version = version; - mav_array_memcpy(packet.passkey, passkey, sizeof(char)*25); + mav_array_assign_char(packet.passkey, passkey, 25); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL, (const char *)&packet, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_MIN_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_CRC); #endif } @@ -188,7 +242,7 @@ static inline void mavlink_msg_change_operator_control_send_struct(mavlink_chann #if MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -208,7 +262,7 @@ static inline void mavlink_msg_change_operator_control_send_buf(mavlink_message_ packet->target_system = target_system; packet->control_request = control_request; packet->version = version; - mav_array_memcpy(packet->passkey, passkey, sizeof(char)*25); + mav_array_assign_char(packet->passkey, passkey, 25); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL, (const char *)packet, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_MIN_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_CRC); #endif } diff --git a/common/mavlink_msg_change_operator_control_ack.h b/common/mavlink_msg_change_operator_control_ack.h index d35d444ba..612c26953 100644 --- a/common/mavlink_msg_change_operator_control_ack.h +++ b/common/mavlink_msg_change_operator_control_ack.h @@ -75,6 +75,45 @@ static inline uint16_t mavlink_msg_change_operator_control_ack_pack(uint8_t syst return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_MIN_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_CRC); } +/** + * @brief Pack a change_operator_control_ack message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param gcs_system_id ID of the GCS this message + * @param control_request 0: request control of this MAV, 1: Release control of this MAV + * @param ack 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_change_operator_control_ack_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t gcs_system_id, uint8_t control_request, uint8_t ack) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN]; + _mav_put_uint8_t(buf, 0, gcs_system_id); + _mav_put_uint8_t(buf, 1, control_request); + _mav_put_uint8_t(buf, 2, ack); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN); +#else + mavlink_change_operator_control_ack_t packet; + packet.gcs_system_id = gcs_system_id; + packet.control_request = control_request; + packet.ack = ack; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_MIN_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_MIN_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN); +#endif +} + /** * @brief Pack a change_operator_control_ack message on a channel * @param system_id ID of this system @@ -137,6 +176,20 @@ static inline uint16_t mavlink_msg_change_operator_control_ack_encode_chan(uint8 return mavlink_msg_change_operator_control_ack_pack_chan(system_id, component_id, chan, msg, change_operator_control_ack->gcs_system_id, change_operator_control_ack->control_request, change_operator_control_ack->ack); } +/** + * @brief Encode a change_operator_control_ack struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param change_operator_control_ack C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_change_operator_control_ack_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_change_operator_control_ack_t* change_operator_control_ack) +{ + return mavlink_msg_change_operator_control_ack_pack_status(system_id, component_id, _status, msg, change_operator_control_ack->gcs_system_id, change_operator_control_ack->control_request, change_operator_control_ack->ack); +} + /** * @brief Send a change_operator_control_ack message * @param chan MAVLink channel to send the message @@ -182,7 +235,7 @@ static inline void mavlink_msg_change_operator_control_ack_send_struct(mavlink_c #if MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_collision.h b/common/mavlink_msg_collision.h index b7d8a07f2..cb64679e8 100644 --- a/common/mavlink_msg_collision.h +++ b/common/mavlink_msg_collision.h @@ -99,6 +99,57 @@ static inline uint16_t mavlink_msg_collision_pack(uint8_t system_id, uint8_t com return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_COLLISION_MIN_LEN, MAVLINK_MSG_ID_COLLISION_LEN, MAVLINK_MSG_ID_COLLISION_CRC); } +/** + * @brief Pack a collision message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param src Collision data source + * @param id Unique identifier, domain based on src field + * @param action Action that is being taken to avoid this collision + * @param threat_level How concerned the aircraft is about this collision + * @param time_to_minimum_delta [s] Estimated time until collision occurs + * @param altitude_minimum_delta [m] Closest vertical distance between vehicle and object + * @param horizontal_minimum_delta [m] Closest horizontal distance between vehicle and object + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_collision_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t src, uint32_t id, uint8_t action, uint8_t threat_level, float time_to_minimum_delta, float altitude_minimum_delta, float horizontal_minimum_delta) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_COLLISION_LEN]; + _mav_put_uint32_t(buf, 0, id); + _mav_put_float(buf, 4, time_to_minimum_delta); + _mav_put_float(buf, 8, altitude_minimum_delta); + _mav_put_float(buf, 12, horizontal_minimum_delta); + _mav_put_uint8_t(buf, 16, src); + _mav_put_uint8_t(buf, 17, action); + _mav_put_uint8_t(buf, 18, threat_level); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COLLISION_LEN); +#else + mavlink_collision_t packet; + packet.id = id; + packet.time_to_minimum_delta = time_to_minimum_delta; + packet.altitude_minimum_delta = altitude_minimum_delta; + packet.horizontal_minimum_delta = horizontal_minimum_delta; + packet.src = src; + packet.action = action; + packet.threat_level = threat_level; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COLLISION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_COLLISION; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_COLLISION_MIN_LEN, MAVLINK_MSG_ID_COLLISION_LEN, MAVLINK_MSG_ID_COLLISION_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_COLLISION_MIN_LEN, MAVLINK_MSG_ID_COLLISION_LEN); +#endif +} + /** * @brief Pack a collision message on a channel * @param system_id ID of this system @@ -173,6 +224,20 @@ static inline uint16_t mavlink_msg_collision_encode_chan(uint8_t system_id, uint return mavlink_msg_collision_pack_chan(system_id, component_id, chan, msg, collision->src, collision->id, collision->action, collision->threat_level, collision->time_to_minimum_delta, collision->altitude_minimum_delta, collision->horizontal_minimum_delta); } +/** + * @brief Encode a collision struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param collision C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_collision_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_collision_t* collision) +{ + return mavlink_msg_collision_pack_status(system_id, component_id, _status, msg, collision->src, collision->id, collision->action, collision->threat_level, collision->time_to_minimum_delta, collision->altitude_minimum_delta, collision->horizontal_minimum_delta); +} + /** * @brief Send a collision message * @param chan MAVLink channel to send the message @@ -230,7 +295,7 @@ static inline void mavlink_msg_collision_send_struct(mavlink_channel_t chan, con #if MAVLINK_MSG_ID_COLLISION_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_command_ack.h b/common/mavlink_msg_command_ack.h index 58dd1fc6d..74ec97892 100644 --- a/common/mavlink_msg_command_ack.h +++ b/common/mavlink_msg_command_ack.h @@ -7,10 +7,10 @@ typedef struct __mavlink_command_ack_t { uint16_t command; /*< Command ID (of acknowledged command).*/ uint8_t result; /*< Result of command.*/ - uint8_t progress; /*< WIP: Also used as result_param1, it can be set with an enum containing the errors reasons of why the command was denied, or the progress percentage when result is MAV_RESULT_IN_PROGRESS (255 if the progress is unknown).*/ - int32_t result_param2; /*< WIP: Additional parameter of the result, example: which parameter of MAV_CMD_NAV_WAYPOINT caused it to be denied.*/ - uint8_t target_system; /*< WIP: System ID of the target recipient. This is the ID of the system that sent the command for which this COMMAND_ACK is an acknowledgement.*/ - uint8_t target_component; /*< WIP: Component ID of the target recipient. This is the ID of the system that sent the command for which this COMMAND_ACK is an acknowledgement.*/ + uint8_t progress; /*< [%] The progress percentage when result is MAV_RESULT_IN_PROGRESS. Values: [0-100], or UINT8_MAX if the progress is unknown.*/ + int32_t result_param2; /*< Additional result information. Can be set with a command-specific enum containing command-specific error reasons for why the command might be denied. If used, the associated enum must be documented in the corresponding MAV_CMD (this enum should have a 0 value to indicate "unused" or "unknown").*/ + uint8_t target_system; /*< System ID of the target recipient. This is the ID of the system that sent the command for which this COMMAND_ACK is an acknowledgement.*/ + uint8_t target_component; /*< Component ID of the target recipient. This is the ID of the system that sent the command for which this COMMAND_ACK is an acknowledgement.*/ } mavlink_command_ack_t; #define MAVLINK_MSG_ID_COMMAND_ACK_LEN 10 @@ -58,10 +58,10 @@ typedef struct __mavlink_command_ack_t { * * @param command Command ID (of acknowledged command). * @param result Result of command. - * @param progress WIP: Also used as result_param1, it can be set with an enum containing the errors reasons of why the command was denied, or the progress percentage when result is MAV_RESULT_IN_PROGRESS (255 if the progress is unknown). - * @param result_param2 WIP: Additional parameter of the result, example: which parameter of MAV_CMD_NAV_WAYPOINT caused it to be denied. - * @param target_system WIP: System ID of the target recipient. This is the ID of the system that sent the command for which this COMMAND_ACK is an acknowledgement. - * @param target_component WIP: Component ID of the target recipient. This is the ID of the system that sent the command for which this COMMAND_ACK is an acknowledgement. + * @param progress [%] The progress percentage when result is MAV_RESULT_IN_PROGRESS. Values: [0-100], or UINT8_MAX if the progress is unknown. + * @param result_param2 Additional result information. Can be set with a command-specific enum containing command-specific error reasons for why the command might be denied. If used, the associated enum must be documented in the corresponding MAV_CMD (this enum should have a 0 value to indicate "unused" or "unknown"). + * @param target_system System ID of the target recipient. This is the ID of the system that sent the command for which this COMMAND_ACK is an acknowledgement. + * @param target_component Component ID of the target recipient. This is the ID of the system that sent the command for which this COMMAND_ACK is an acknowledgement. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_command_ack_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, @@ -93,6 +93,54 @@ static inline uint16_t mavlink_msg_command_ack_pack(uint8_t system_id, uint8_t c return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_COMMAND_ACK_MIN_LEN, MAVLINK_MSG_ID_COMMAND_ACK_LEN, MAVLINK_MSG_ID_COMMAND_ACK_CRC); } +/** + * @brief Pack a command_ack message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param command Command ID (of acknowledged command). + * @param result Result of command. + * @param progress [%] The progress percentage when result is MAV_RESULT_IN_PROGRESS. Values: [0-100], or UINT8_MAX if the progress is unknown. + * @param result_param2 Additional result information. Can be set with a command-specific enum containing command-specific error reasons for why the command might be denied. If used, the associated enum must be documented in the corresponding MAV_CMD (this enum should have a 0 value to indicate "unused" or "unknown"). + * @param target_system System ID of the target recipient. This is the ID of the system that sent the command for which this COMMAND_ACK is an acknowledgement. + * @param target_component Component ID of the target recipient. This is the ID of the system that sent the command for which this COMMAND_ACK is an acknowledgement. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_command_ack_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint16_t command, uint8_t result, uint8_t progress, int32_t result_param2, uint8_t target_system, uint8_t target_component) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_COMMAND_ACK_LEN]; + _mav_put_uint16_t(buf, 0, command); + _mav_put_uint8_t(buf, 2, result); + _mav_put_uint8_t(buf, 3, progress); + _mav_put_int32_t(buf, 4, result_param2); + _mav_put_uint8_t(buf, 8, target_system); + _mav_put_uint8_t(buf, 9, target_component); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMMAND_ACK_LEN); +#else + mavlink_command_ack_t packet; + packet.command = command; + packet.result = result; + packet.progress = progress; + packet.result_param2 = result_param2; + packet.target_system = target_system; + packet.target_component = target_component; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMMAND_ACK_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_COMMAND_ACK; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_COMMAND_ACK_MIN_LEN, MAVLINK_MSG_ID_COMMAND_ACK_LEN, MAVLINK_MSG_ID_COMMAND_ACK_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_COMMAND_ACK_MIN_LEN, MAVLINK_MSG_ID_COMMAND_ACK_LEN); +#endif +} + /** * @brief Pack a command_ack message on a channel * @param system_id ID of this system @@ -101,10 +149,10 @@ static inline uint16_t mavlink_msg_command_ack_pack(uint8_t system_id, uint8_t c * @param msg The MAVLink message to compress the data into * @param command Command ID (of acknowledged command). * @param result Result of command. - * @param progress WIP: Also used as result_param1, it can be set with an enum containing the errors reasons of why the command was denied, or the progress percentage when result is MAV_RESULT_IN_PROGRESS (255 if the progress is unknown). - * @param result_param2 WIP: Additional parameter of the result, example: which parameter of MAV_CMD_NAV_WAYPOINT caused it to be denied. - * @param target_system WIP: System ID of the target recipient. This is the ID of the system that sent the command for which this COMMAND_ACK is an acknowledgement. - * @param target_component WIP: Component ID of the target recipient. This is the ID of the system that sent the command for which this COMMAND_ACK is an acknowledgement. + * @param progress [%] The progress percentage when result is MAV_RESULT_IN_PROGRESS. Values: [0-100], or UINT8_MAX if the progress is unknown. + * @param result_param2 Additional result information. Can be set with a command-specific enum containing command-specific error reasons for why the command might be denied. If used, the associated enum must be documented in the corresponding MAV_CMD (this enum should have a 0 value to indicate "unused" or "unknown"). + * @param target_system System ID of the target recipient. This is the ID of the system that sent the command for which this COMMAND_ACK is an acknowledgement. + * @param target_component Component ID of the target recipient. This is the ID of the system that sent the command for which this COMMAND_ACK is an acknowledgement. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_command_ack_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, @@ -164,16 +212,30 @@ static inline uint16_t mavlink_msg_command_ack_encode_chan(uint8_t system_id, ui return mavlink_msg_command_ack_pack_chan(system_id, component_id, chan, msg, command_ack->command, command_ack->result, command_ack->progress, command_ack->result_param2, command_ack->target_system, command_ack->target_component); } +/** + * @brief Encode a command_ack struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param command_ack C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_command_ack_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_command_ack_t* command_ack) +{ + return mavlink_msg_command_ack_pack_status(system_id, component_id, _status, msg, command_ack->command, command_ack->result, command_ack->progress, command_ack->result_param2, command_ack->target_system, command_ack->target_component); +} + /** * @brief Send a command_ack message * @param chan MAVLink channel to send the message * * @param command Command ID (of acknowledged command). * @param result Result of command. - * @param progress WIP: Also used as result_param1, it can be set with an enum containing the errors reasons of why the command was denied, or the progress percentage when result is MAV_RESULT_IN_PROGRESS (255 if the progress is unknown). - * @param result_param2 WIP: Additional parameter of the result, example: which parameter of MAV_CMD_NAV_WAYPOINT caused it to be denied. - * @param target_system WIP: System ID of the target recipient. This is the ID of the system that sent the command for which this COMMAND_ACK is an acknowledgement. - * @param target_component WIP: Component ID of the target recipient. This is the ID of the system that sent the command for which this COMMAND_ACK is an acknowledgement. + * @param progress [%] The progress percentage when result is MAV_RESULT_IN_PROGRESS. Values: [0-100], or UINT8_MAX if the progress is unknown. + * @param result_param2 Additional result information. Can be set with a command-specific enum containing command-specific error reasons for why the command might be denied. If used, the associated enum must be documented in the corresponding MAV_CMD (this enum should have a 0 value to indicate "unused" or "unknown"). + * @param target_system System ID of the target recipient. This is the ID of the system that sent the command for which this COMMAND_ACK is an acknowledgement. + * @param target_component Component ID of the target recipient. This is the ID of the system that sent the command for which this COMMAND_ACK is an acknowledgement. */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS @@ -218,7 +280,7 @@ static inline void mavlink_msg_command_ack_send_struct(mavlink_channel_t chan, c #if MAVLINK_MSG_ID_COMMAND_ACK_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -278,7 +340,7 @@ static inline uint8_t mavlink_msg_command_ack_get_result(const mavlink_message_t /** * @brief Get field progress from command_ack message * - * @return WIP: Also used as result_param1, it can be set with an enum containing the errors reasons of why the command was denied, or the progress percentage when result is MAV_RESULT_IN_PROGRESS (255 if the progress is unknown). + * @return [%] The progress percentage when result is MAV_RESULT_IN_PROGRESS. Values: [0-100], or UINT8_MAX if the progress is unknown. */ static inline uint8_t mavlink_msg_command_ack_get_progress(const mavlink_message_t* msg) { @@ -288,7 +350,7 @@ static inline uint8_t mavlink_msg_command_ack_get_progress(const mavlink_message /** * @brief Get field result_param2 from command_ack message * - * @return WIP: Additional parameter of the result, example: which parameter of MAV_CMD_NAV_WAYPOINT caused it to be denied. + * @return Additional result information. Can be set with a command-specific enum containing command-specific error reasons for why the command might be denied. If used, the associated enum must be documented in the corresponding MAV_CMD (this enum should have a 0 value to indicate "unused" or "unknown"). */ static inline int32_t mavlink_msg_command_ack_get_result_param2(const mavlink_message_t* msg) { @@ -298,7 +360,7 @@ static inline int32_t mavlink_msg_command_ack_get_result_param2(const mavlink_me /** * @brief Get field target_system from command_ack message * - * @return WIP: System ID of the target recipient. This is the ID of the system that sent the command for which this COMMAND_ACK is an acknowledgement. + * @return System ID of the target recipient. This is the ID of the system that sent the command for which this COMMAND_ACK is an acknowledgement. */ static inline uint8_t mavlink_msg_command_ack_get_target_system(const mavlink_message_t* msg) { @@ -308,7 +370,7 @@ static inline uint8_t mavlink_msg_command_ack_get_target_system(const mavlink_me /** * @brief Get field target_component from command_ack message * - * @return WIP: Component ID of the target recipient. This is the ID of the system that sent the command for which this COMMAND_ACK is an acknowledgement. + * @return Component ID of the target recipient. This is the ID of the system that sent the command for which this COMMAND_ACK is an acknowledgement. */ static inline uint8_t mavlink_msg_command_ack_get_target_component(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_command_cancel.h b/common/mavlink_msg_command_cancel.h index 0ad7dac58..6b437b159 100644 --- a/common/mavlink_msg_command_cancel.h +++ b/common/mavlink_msg_command_cancel.h @@ -75,6 +75,45 @@ static inline uint16_t mavlink_msg_command_cancel_pack(uint8_t system_id, uint8_ return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_COMMAND_CANCEL_MIN_LEN, MAVLINK_MSG_ID_COMMAND_CANCEL_LEN, MAVLINK_MSG_ID_COMMAND_CANCEL_CRC); } +/** + * @brief Pack a command_cancel message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System executing long running command. Should not be broadcast (0). + * @param target_component Component executing long running command. + * @param command Command ID (of command to cancel). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_command_cancel_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint16_t command) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_COMMAND_CANCEL_LEN]; + _mav_put_uint16_t(buf, 0, command); + _mav_put_uint8_t(buf, 2, target_system); + _mav_put_uint8_t(buf, 3, target_component); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMMAND_CANCEL_LEN); +#else + mavlink_command_cancel_t packet; + packet.command = command; + packet.target_system = target_system; + packet.target_component = target_component; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMMAND_CANCEL_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_COMMAND_CANCEL; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_COMMAND_CANCEL_MIN_LEN, MAVLINK_MSG_ID_COMMAND_CANCEL_LEN, MAVLINK_MSG_ID_COMMAND_CANCEL_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_COMMAND_CANCEL_MIN_LEN, MAVLINK_MSG_ID_COMMAND_CANCEL_LEN); +#endif +} + /** * @brief Pack a command_cancel message on a channel * @param system_id ID of this system @@ -137,6 +176,20 @@ static inline uint16_t mavlink_msg_command_cancel_encode_chan(uint8_t system_id, return mavlink_msg_command_cancel_pack_chan(system_id, component_id, chan, msg, command_cancel->target_system, command_cancel->target_component, command_cancel->command); } +/** + * @brief Encode a command_cancel struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param command_cancel C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_command_cancel_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_command_cancel_t* command_cancel) +{ + return mavlink_msg_command_cancel_pack_status(system_id, component_id, _status, msg, command_cancel->target_system, command_cancel->target_component, command_cancel->command); +} + /** * @brief Send a command_cancel message * @param chan MAVLink channel to send the message @@ -182,7 +235,7 @@ static inline void mavlink_msg_command_cancel_send_struct(mavlink_channel_t chan #if MAVLINK_MSG_ID_COMMAND_CANCEL_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_command_int.h b/common/mavlink_msg_command_int.h index a23f50895..8d84b44c6 100644 --- a/common/mavlink_msg_command_int.h +++ b/common/mavlink_msg_command_int.h @@ -135,6 +135,75 @@ static inline uint16_t mavlink_msg_command_int_pack(uint8_t system_id, uint8_t c return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_COMMAND_INT_MIN_LEN, MAVLINK_MSG_ID_COMMAND_INT_LEN, MAVLINK_MSG_ID_COMMAND_INT_CRC); } +/** + * @brief Pack a command_int message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param frame The coordinate system of the COMMAND. + * @param command The scheduled action for the mission item. + * @param current Not used. + * @param autocontinue Not used (set 0). + * @param param1 PARAM1, see MAV_CMD enum + * @param param2 PARAM2, see MAV_CMD enum + * @param param3 PARAM3, see MAV_CMD enum + * @param param4 PARAM4, see MAV_CMD enum + * @param x PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7 + * @param y PARAM6 / local: y position in meters * 1e4, global: longitude in degrees * 10^7 + * @param z PARAM7 / z position: global: altitude in meters (relative or absolute, depending on frame). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_command_int_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint8_t frame, uint16_t command, uint8_t current, uint8_t autocontinue, float param1, float param2, float param3, float param4, int32_t x, int32_t y, float z) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_COMMAND_INT_LEN]; + _mav_put_float(buf, 0, param1); + _mav_put_float(buf, 4, param2); + _mav_put_float(buf, 8, param3); + _mav_put_float(buf, 12, param4); + _mav_put_int32_t(buf, 16, x); + _mav_put_int32_t(buf, 20, y); + _mav_put_float(buf, 24, z); + _mav_put_uint16_t(buf, 28, command); + _mav_put_uint8_t(buf, 30, target_system); + _mav_put_uint8_t(buf, 31, target_component); + _mav_put_uint8_t(buf, 32, frame); + _mav_put_uint8_t(buf, 33, current); + _mav_put_uint8_t(buf, 34, autocontinue); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMMAND_INT_LEN); +#else + mavlink_command_int_t packet; + packet.param1 = param1; + packet.param2 = param2; + packet.param3 = param3; + packet.param4 = param4; + packet.x = x; + packet.y = y; + packet.z = z; + packet.command = command; + packet.target_system = target_system; + packet.target_component = target_component; + packet.frame = frame; + packet.current = current; + packet.autocontinue = autocontinue; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMMAND_INT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_COMMAND_INT; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_COMMAND_INT_MIN_LEN, MAVLINK_MSG_ID_COMMAND_INT_LEN, MAVLINK_MSG_ID_COMMAND_INT_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_COMMAND_INT_MIN_LEN, MAVLINK_MSG_ID_COMMAND_INT_LEN); +#endif +} + /** * @brief Pack a command_int message on a channel * @param system_id ID of this system @@ -227,6 +296,20 @@ static inline uint16_t mavlink_msg_command_int_encode_chan(uint8_t system_id, ui return mavlink_msg_command_int_pack_chan(system_id, component_id, chan, msg, command_int->target_system, command_int->target_component, command_int->frame, command_int->command, command_int->current, command_int->autocontinue, command_int->param1, command_int->param2, command_int->param3, command_int->param4, command_int->x, command_int->y, command_int->z); } +/** + * @brief Encode a command_int struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param command_int C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_command_int_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_command_int_t* command_int) +{ + return mavlink_msg_command_int_pack_status(system_id, component_id, _status, msg, command_int->target_system, command_int->target_component, command_int->frame, command_int->command, command_int->current, command_int->autocontinue, command_int->param1, command_int->param2, command_int->param3, command_int->param4, command_int->x, command_int->y, command_int->z); +} + /** * @brief Send a command_int message * @param chan MAVLink channel to send the message @@ -302,7 +385,7 @@ static inline void mavlink_msg_command_int_send_struct(mavlink_channel_t chan, c #if MAVLINK_MSG_ID_COMMAND_INT_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_command_long.h b/common/mavlink_msg_command_long.h index 6a9a16987..68894e4b9 100644 --- a/common/mavlink_msg_command_long.h +++ b/common/mavlink_msg_command_long.h @@ -123,6 +123,69 @@ static inline uint16_t mavlink_msg_command_long_pack(uint8_t system_id, uint8_t return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_COMMAND_LONG_MIN_LEN, MAVLINK_MSG_ID_COMMAND_LONG_LEN, MAVLINK_MSG_ID_COMMAND_LONG_CRC); } +/** + * @brief Pack a command_long message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System which should execute the command + * @param target_component Component which should execute the command, 0 for all components + * @param command Command ID (of command to send). + * @param confirmation 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command) + * @param param1 Parameter 1 (for the specific command). + * @param param2 Parameter 2 (for the specific command). + * @param param3 Parameter 3 (for the specific command). + * @param param4 Parameter 4 (for the specific command). + * @param param5 Parameter 5 (for the specific command). + * @param param6 Parameter 6 (for the specific command). + * @param param7 Parameter 7 (for the specific command). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_command_long_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint16_t command, uint8_t confirmation, float param1, float param2, float param3, float param4, float param5, float param6, float param7) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_COMMAND_LONG_LEN]; + _mav_put_float(buf, 0, param1); + _mav_put_float(buf, 4, param2); + _mav_put_float(buf, 8, param3); + _mav_put_float(buf, 12, param4); + _mav_put_float(buf, 16, param5); + _mav_put_float(buf, 20, param6); + _mav_put_float(buf, 24, param7); + _mav_put_uint16_t(buf, 28, command); + _mav_put_uint8_t(buf, 30, target_system); + _mav_put_uint8_t(buf, 31, target_component); + _mav_put_uint8_t(buf, 32, confirmation); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMMAND_LONG_LEN); +#else + mavlink_command_long_t packet; + packet.param1 = param1; + packet.param2 = param2; + packet.param3 = param3; + packet.param4 = param4; + packet.param5 = param5; + packet.param6 = param6; + packet.param7 = param7; + packet.command = command; + packet.target_system = target_system; + packet.target_component = target_component; + packet.confirmation = confirmation; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMMAND_LONG_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_COMMAND_LONG; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_COMMAND_LONG_MIN_LEN, MAVLINK_MSG_ID_COMMAND_LONG_LEN, MAVLINK_MSG_ID_COMMAND_LONG_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_COMMAND_LONG_MIN_LEN, MAVLINK_MSG_ID_COMMAND_LONG_LEN); +#endif +} + /** * @brief Pack a command_long message on a channel * @param system_id ID of this system @@ -209,6 +272,20 @@ static inline uint16_t mavlink_msg_command_long_encode_chan(uint8_t system_id, u return mavlink_msg_command_long_pack_chan(system_id, component_id, chan, msg, command_long->target_system, command_long->target_component, command_long->command, command_long->confirmation, command_long->param1, command_long->param2, command_long->param3, command_long->param4, command_long->param5, command_long->param6, command_long->param7); } +/** + * @brief Encode a command_long struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param command_long C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_command_long_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_command_long_t* command_long) +{ + return mavlink_msg_command_long_pack_status(system_id, component_id, _status, msg, command_long->target_system, command_long->target_component, command_long->command, command_long->confirmation, command_long->param1, command_long->param2, command_long->param3, command_long->param4, command_long->param5, command_long->param6, command_long->param7); +} + /** * @brief Send a command_long message * @param chan MAVLink channel to send the message @@ -278,7 +355,7 @@ static inline void mavlink_msg_command_long_send_struct(mavlink_channel_t chan, #if MAVLINK_MSG_ID_COMMAND_LONG_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_component_information.h b/common/mavlink_msg_component_information.h index a916e6bee..602dc93f2 100644 --- a/common/mavlink_msg_component_information.h +++ b/common/mavlink_msg_component_information.h @@ -6,47 +6,44 @@ typedef struct __mavlink_component_information_t { uint32_t time_boot_ms; /*< [ms] Timestamp (time since system boot).*/ - uint32_t metadata_type; /*< The type of metadata being requested.*/ - uint32_t metadata_uid; /*< Unique uid for this metadata which a gcs can use for created cached metadata and understanding whether it's cache it up to date or whether it needs to download new data.*/ - uint32_t translation_uid; /*< Unique uid for the translation file associated with the metadata.*/ - char metadata_uri[70]; /*< Component definition URI. If prefix mavlinkftp:// file is downloaded from vehicle over mavlink ftp protocol. If prefix http[s]:// file is downloaded over internet. Files are json format. They can end in .gz to indicate file is in gzip format.*/ - char translation_uri[70]; /*< The translations for strings within the metadata file. If null the either do not exist or may be included in the metadata file itself. The translations specified here supercede any which may be in the metadata file itself. The uri format is the same as component_metadata_uri . Files are in Json Translation spec format. Empty string indicates no tranlsation file.*/ + uint32_t general_metadata_file_crc; /*< CRC32 of the general metadata file (general_metadata_uri).*/ + uint32_t peripherals_metadata_file_crc; /*< CRC32 of peripherals metadata file (peripherals_metadata_uri).*/ + char general_metadata_uri[100]; /*< MAVLink FTP URI for the general metadata file (COMP_METADATA_TYPE_GENERAL), which may be compressed with xz. The file contains general component metadata, and may contain URI links for additional metadata (see COMP_METADATA_TYPE). The information is static from boot, and may be generated at compile time. The string needs to be zero terminated.*/ + char peripherals_metadata_uri[100]; /*< (Optional) MAVLink FTP URI for the peripherals metadata file (COMP_METADATA_TYPE_PERIPHERALS), which may be compressed with xz. This contains data about "attached components" such as UAVCAN nodes. The peripherals are in a separate file because the information must be generated dynamically at runtime. The string needs to be zero terminated.*/ } mavlink_component_information_t; -#define MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN 156 -#define MAVLINK_MSG_ID_COMPONENT_INFORMATION_MIN_LEN 156 -#define MAVLINK_MSG_ID_395_LEN 156 -#define MAVLINK_MSG_ID_395_MIN_LEN 156 +#define MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN 212 +#define MAVLINK_MSG_ID_COMPONENT_INFORMATION_MIN_LEN 212 +#define MAVLINK_MSG_ID_395_LEN 212 +#define MAVLINK_MSG_ID_395_MIN_LEN 212 -#define MAVLINK_MSG_ID_COMPONENT_INFORMATION_CRC 163 -#define MAVLINK_MSG_ID_395_CRC 163 +#define MAVLINK_MSG_ID_COMPONENT_INFORMATION_CRC 0 +#define MAVLINK_MSG_ID_395_CRC 0 -#define MAVLINK_MSG_COMPONENT_INFORMATION_FIELD_METADATA_URI_LEN 70 -#define MAVLINK_MSG_COMPONENT_INFORMATION_FIELD_TRANSLATION_URI_LEN 70 +#define MAVLINK_MSG_COMPONENT_INFORMATION_FIELD_GENERAL_METADATA_URI_LEN 100 +#define MAVLINK_MSG_COMPONENT_INFORMATION_FIELD_PERIPHERALS_METADATA_URI_LEN 100 #if MAVLINK_COMMAND_24BIT #define MAVLINK_MESSAGE_INFO_COMPONENT_INFORMATION { \ 395, \ "COMPONENT_INFORMATION", \ - 6, \ + 5, \ { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_component_information_t, time_boot_ms) }, \ - { "metadata_type", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_component_information_t, metadata_type) }, \ - { "metadata_uid", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_component_information_t, metadata_uid) }, \ - { "metadata_uri", NULL, MAVLINK_TYPE_CHAR, 70, 16, offsetof(mavlink_component_information_t, metadata_uri) }, \ - { "translation_uid", NULL, MAVLINK_TYPE_UINT32_T, 0, 12, offsetof(mavlink_component_information_t, translation_uid) }, \ - { "translation_uri", NULL, MAVLINK_TYPE_CHAR, 70, 86, offsetof(mavlink_component_information_t, translation_uri) }, \ + { "general_metadata_file_crc", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_component_information_t, general_metadata_file_crc) }, \ + { "general_metadata_uri", NULL, MAVLINK_TYPE_CHAR, 100, 12, offsetof(mavlink_component_information_t, general_metadata_uri) }, \ + { "peripherals_metadata_file_crc", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_component_information_t, peripherals_metadata_file_crc) }, \ + { "peripherals_metadata_uri", NULL, MAVLINK_TYPE_CHAR, 100, 112, offsetof(mavlink_component_information_t, peripherals_metadata_uri) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_COMPONENT_INFORMATION { \ "COMPONENT_INFORMATION", \ - 6, \ + 5, \ { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_component_information_t, time_boot_ms) }, \ - { "metadata_type", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_component_information_t, metadata_type) }, \ - { "metadata_uid", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_component_information_t, metadata_uid) }, \ - { "metadata_uri", NULL, MAVLINK_TYPE_CHAR, 70, 16, offsetof(mavlink_component_information_t, metadata_uri) }, \ - { "translation_uid", NULL, MAVLINK_TYPE_UINT32_T, 0, 12, offsetof(mavlink_component_information_t, translation_uid) }, \ - { "translation_uri", NULL, MAVLINK_TYPE_CHAR, 70, 86, offsetof(mavlink_component_information_t, translation_uri) }, \ + { "general_metadata_file_crc", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_component_information_t, general_metadata_file_crc) }, \ + { "general_metadata_uri", NULL, MAVLINK_TYPE_CHAR, 100, 12, offsetof(mavlink_component_information_t, general_metadata_uri) }, \ + { "peripherals_metadata_file_crc", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_component_information_t, peripherals_metadata_file_crc) }, \ + { "peripherals_metadata_uri", NULL, MAVLINK_TYPE_CHAR, 100, 112, offsetof(mavlink_component_information_t, peripherals_metadata_uri) }, \ } \ } #endif @@ -58,33 +55,30 @@ typedef struct __mavlink_component_information_t { * @param msg The MAVLink message to compress the data into * * @param time_boot_ms [ms] Timestamp (time since system boot). - * @param metadata_type The type of metadata being requested. - * @param metadata_uid Unique uid for this metadata which a gcs can use for created cached metadata and understanding whether it's cache it up to date or whether it needs to download new data. - * @param metadata_uri Component definition URI. If prefix mavlinkftp:// file is downloaded from vehicle over mavlink ftp protocol. If prefix http[s]:// file is downloaded over internet. Files are json format. They can end in .gz to indicate file is in gzip format. - * @param translation_uid Unique uid for the translation file associated with the metadata. - * @param translation_uri The translations for strings within the metadata file. If null the either do not exist or may be included in the metadata file itself. The translations specified here supercede any which may be in the metadata file itself. The uri format is the same as component_metadata_uri . Files are in Json Translation spec format. Empty string indicates no tranlsation file. + * @param general_metadata_file_crc CRC32 of the general metadata file (general_metadata_uri). + * @param general_metadata_uri MAVLink FTP URI for the general metadata file (COMP_METADATA_TYPE_GENERAL), which may be compressed with xz. The file contains general component metadata, and may contain URI links for additional metadata (see COMP_METADATA_TYPE). The information is static from boot, and may be generated at compile time. The string needs to be zero terminated. + * @param peripherals_metadata_file_crc CRC32 of peripherals metadata file (peripherals_metadata_uri). + * @param peripherals_metadata_uri (Optional) MAVLink FTP URI for the peripherals metadata file (COMP_METADATA_TYPE_PERIPHERALS), which may be compressed with xz. This contains data about "attached components" such as UAVCAN nodes. The peripherals are in a separate file because the information must be generated dynamically at runtime. The string needs to be zero terminated. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_component_information_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint32_t time_boot_ms, uint32_t metadata_type, uint32_t metadata_uid, const char *metadata_uri, uint32_t translation_uid, const char *translation_uri) + uint32_t time_boot_ms, uint32_t general_metadata_file_crc, const char *general_metadata_uri, uint32_t peripherals_metadata_file_crc, const char *peripherals_metadata_uri) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN]; _mav_put_uint32_t(buf, 0, time_boot_ms); - _mav_put_uint32_t(buf, 4, metadata_type); - _mav_put_uint32_t(buf, 8, metadata_uid); - _mav_put_uint32_t(buf, 12, translation_uid); - _mav_put_char_array(buf, 16, metadata_uri, 70); - _mav_put_char_array(buf, 86, translation_uri, 70); + _mav_put_uint32_t(buf, 4, general_metadata_file_crc); + _mav_put_uint32_t(buf, 8, peripherals_metadata_file_crc); + _mav_put_char_array(buf, 12, general_metadata_uri, 100); + _mav_put_char_array(buf, 112, peripherals_metadata_uri, 100); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN); #else mavlink_component_information_t packet; packet.time_boot_ms = time_boot_ms; - packet.metadata_type = metadata_type; - packet.metadata_uid = metadata_uid; - packet.translation_uid = translation_uid; - mav_array_memcpy(packet.metadata_uri, metadata_uri, sizeof(char)*70); - mav_array_memcpy(packet.translation_uri, translation_uri, sizeof(char)*70); + packet.general_metadata_file_crc = general_metadata_file_crc; + packet.peripherals_metadata_file_crc = peripherals_metadata_file_crc; + mav_array_assign_char(packet.general_metadata_uri, general_metadata_uri, 100); + mav_array_assign_char(packet.peripherals_metadata_uri, peripherals_metadata_uri, 100); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN); #endif @@ -92,6 +86,49 @@ static inline uint16_t mavlink_msg_component_information_pack(uint8_t system_id, return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_COMPONENT_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_CRC); } +/** + * @brief Pack a component_information message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param general_metadata_file_crc CRC32 of the general metadata file (general_metadata_uri). + * @param general_metadata_uri MAVLink FTP URI for the general metadata file (COMP_METADATA_TYPE_GENERAL), which may be compressed with xz. The file contains general component metadata, and may contain URI links for additional metadata (see COMP_METADATA_TYPE). The information is static from boot, and may be generated at compile time. The string needs to be zero terminated. + * @param peripherals_metadata_file_crc CRC32 of peripherals metadata file (peripherals_metadata_uri). + * @param peripherals_metadata_uri (Optional) MAVLink FTP URI for the peripherals metadata file (COMP_METADATA_TYPE_PERIPHERALS), which may be compressed with xz. This contains data about "attached components" such as UAVCAN nodes. The peripherals are in a separate file because the information must be generated dynamically at runtime. The string needs to be zero terminated. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_component_information_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, uint32_t general_metadata_file_crc, const char *general_metadata_uri, uint32_t peripherals_metadata_file_crc, const char *peripherals_metadata_uri) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_uint32_t(buf, 4, general_metadata_file_crc); + _mav_put_uint32_t(buf, 8, peripherals_metadata_file_crc); + _mav_put_char_array(buf, 12, general_metadata_uri, 100); + _mav_put_char_array(buf, 112, peripherals_metadata_uri, 100); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN); +#else + mavlink_component_information_t packet; + packet.time_boot_ms = time_boot_ms; + packet.general_metadata_file_crc = general_metadata_file_crc; + packet.peripherals_metadata_file_crc = peripherals_metadata_file_crc; + mav_array_memcpy(packet.general_metadata_uri, general_metadata_uri, sizeof(char)*100); + mav_array_memcpy(packet.peripherals_metadata_uri, peripherals_metadata_uri, sizeof(char)*100); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_COMPONENT_INFORMATION; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_COMPONENT_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_COMPONENT_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN); +#endif +} + /** * @brief Pack a component_information message on a channel * @param system_id ID of this system @@ -99,34 +136,31 @@ static inline uint16_t mavlink_msg_component_information_pack(uint8_t system_id, * @param chan The MAVLink channel this message will be sent over * @param msg The MAVLink message to compress the data into * @param time_boot_ms [ms] Timestamp (time since system boot). - * @param metadata_type The type of metadata being requested. - * @param metadata_uid Unique uid for this metadata which a gcs can use for created cached metadata and understanding whether it's cache it up to date or whether it needs to download new data. - * @param metadata_uri Component definition URI. If prefix mavlinkftp:// file is downloaded from vehicle over mavlink ftp protocol. If prefix http[s]:// file is downloaded over internet. Files are json format. They can end in .gz to indicate file is in gzip format. - * @param translation_uid Unique uid for the translation file associated with the metadata. - * @param translation_uri The translations for strings within the metadata file. If null the either do not exist or may be included in the metadata file itself. The translations specified here supercede any which may be in the metadata file itself. The uri format is the same as component_metadata_uri . Files are in Json Translation spec format. Empty string indicates no tranlsation file. + * @param general_metadata_file_crc CRC32 of the general metadata file (general_metadata_uri). + * @param general_metadata_uri MAVLink FTP URI for the general metadata file (COMP_METADATA_TYPE_GENERAL), which may be compressed with xz. The file contains general component metadata, and may contain URI links for additional metadata (see COMP_METADATA_TYPE). The information is static from boot, and may be generated at compile time. The string needs to be zero terminated. + * @param peripherals_metadata_file_crc CRC32 of peripherals metadata file (peripherals_metadata_uri). + * @param peripherals_metadata_uri (Optional) MAVLink FTP URI for the peripherals metadata file (COMP_METADATA_TYPE_PERIPHERALS), which may be compressed with xz. This contains data about "attached components" such as UAVCAN nodes. The peripherals are in a separate file because the information must be generated dynamically at runtime. The string needs to be zero terminated. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_component_information_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - uint32_t time_boot_ms,uint32_t metadata_type,uint32_t metadata_uid,const char *metadata_uri,uint32_t translation_uid,const char *translation_uri) + uint32_t time_boot_ms,uint32_t general_metadata_file_crc,const char *general_metadata_uri,uint32_t peripherals_metadata_file_crc,const char *peripherals_metadata_uri) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN]; _mav_put_uint32_t(buf, 0, time_boot_ms); - _mav_put_uint32_t(buf, 4, metadata_type); - _mav_put_uint32_t(buf, 8, metadata_uid); - _mav_put_uint32_t(buf, 12, translation_uid); - _mav_put_char_array(buf, 16, metadata_uri, 70); - _mav_put_char_array(buf, 86, translation_uri, 70); + _mav_put_uint32_t(buf, 4, general_metadata_file_crc); + _mav_put_uint32_t(buf, 8, peripherals_metadata_file_crc); + _mav_put_char_array(buf, 12, general_metadata_uri, 100); + _mav_put_char_array(buf, 112, peripherals_metadata_uri, 100); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN); #else mavlink_component_information_t packet; packet.time_boot_ms = time_boot_ms; - packet.metadata_type = metadata_type; - packet.metadata_uid = metadata_uid; - packet.translation_uid = translation_uid; - mav_array_memcpy(packet.metadata_uri, metadata_uri, sizeof(char)*70); - mav_array_memcpy(packet.translation_uri, translation_uri, sizeof(char)*70); + packet.general_metadata_file_crc = general_metadata_file_crc; + packet.peripherals_metadata_file_crc = peripherals_metadata_file_crc; + mav_array_assign_char(packet.general_metadata_uri, general_metadata_uri, 100); + mav_array_assign_char(packet.peripherals_metadata_uri, peripherals_metadata_uri, 100); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN); #endif @@ -144,7 +178,7 @@ static inline uint16_t mavlink_msg_component_information_pack_chan(uint8_t syste */ static inline uint16_t mavlink_msg_component_information_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_component_information_t* component_information) { - return mavlink_msg_component_information_pack(system_id, component_id, msg, component_information->time_boot_ms, component_information->metadata_type, component_information->metadata_uid, component_information->metadata_uri, component_information->translation_uid, component_information->translation_uri); + return mavlink_msg_component_information_pack(system_id, component_id, msg, component_information->time_boot_ms, component_information->general_metadata_file_crc, component_information->general_metadata_uri, component_information->peripherals_metadata_file_crc, component_information->peripherals_metadata_uri); } /** @@ -158,7 +192,21 @@ static inline uint16_t mavlink_msg_component_information_encode(uint8_t system_i */ static inline uint16_t mavlink_msg_component_information_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_component_information_t* component_information) { - return mavlink_msg_component_information_pack_chan(system_id, component_id, chan, msg, component_information->time_boot_ms, component_information->metadata_type, component_information->metadata_uid, component_information->metadata_uri, component_information->translation_uid, component_information->translation_uri); + return mavlink_msg_component_information_pack_chan(system_id, component_id, chan, msg, component_information->time_boot_ms, component_information->general_metadata_file_crc, component_information->general_metadata_uri, component_information->peripherals_metadata_file_crc, component_information->peripherals_metadata_uri); +} + +/** + * @brief Encode a component_information struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param component_information C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_component_information_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_component_information_t* component_information) +{ + return mavlink_msg_component_information_pack_status(system_id, component_id, _status, msg, component_information->time_boot_ms, component_information->general_metadata_file_crc, component_information->general_metadata_uri, component_information->peripherals_metadata_file_crc, component_information->peripherals_metadata_uri); } /** @@ -166,33 +214,30 @@ static inline uint16_t mavlink_msg_component_information_encode_chan(uint8_t sys * @param chan MAVLink channel to send the message * * @param time_boot_ms [ms] Timestamp (time since system boot). - * @param metadata_type The type of metadata being requested. - * @param metadata_uid Unique uid for this metadata which a gcs can use for created cached metadata and understanding whether it's cache it up to date or whether it needs to download new data. - * @param metadata_uri Component definition URI. If prefix mavlinkftp:// file is downloaded from vehicle over mavlink ftp protocol. If prefix http[s]:// file is downloaded over internet. Files are json format. They can end in .gz to indicate file is in gzip format. - * @param translation_uid Unique uid for the translation file associated with the metadata. - * @param translation_uri The translations for strings within the metadata file. If null the either do not exist or may be included in the metadata file itself. The translations specified here supercede any which may be in the metadata file itself. The uri format is the same as component_metadata_uri . Files are in Json Translation spec format. Empty string indicates no tranlsation file. + * @param general_metadata_file_crc CRC32 of the general metadata file (general_metadata_uri). + * @param general_metadata_uri MAVLink FTP URI for the general metadata file (COMP_METADATA_TYPE_GENERAL), which may be compressed with xz. The file contains general component metadata, and may contain URI links for additional metadata (see COMP_METADATA_TYPE). The information is static from boot, and may be generated at compile time. The string needs to be zero terminated. + * @param peripherals_metadata_file_crc CRC32 of peripherals metadata file (peripherals_metadata_uri). + * @param peripherals_metadata_uri (Optional) MAVLink FTP URI for the peripherals metadata file (COMP_METADATA_TYPE_PERIPHERALS), which may be compressed with xz. This contains data about "attached components" such as UAVCAN nodes. The peripherals are in a separate file because the information must be generated dynamically at runtime. The string needs to be zero terminated. */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_component_information_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint32_t metadata_type, uint32_t metadata_uid, const char *metadata_uri, uint32_t translation_uid, const char *translation_uri) +static inline void mavlink_msg_component_information_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint32_t general_metadata_file_crc, const char *general_metadata_uri, uint32_t peripherals_metadata_file_crc, const char *peripherals_metadata_uri) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN]; _mav_put_uint32_t(buf, 0, time_boot_ms); - _mav_put_uint32_t(buf, 4, metadata_type); - _mav_put_uint32_t(buf, 8, metadata_uid); - _mav_put_uint32_t(buf, 12, translation_uid); - _mav_put_char_array(buf, 16, metadata_uri, 70); - _mav_put_char_array(buf, 86, translation_uri, 70); + _mav_put_uint32_t(buf, 4, general_metadata_file_crc); + _mav_put_uint32_t(buf, 8, peripherals_metadata_file_crc); + _mav_put_char_array(buf, 12, general_metadata_uri, 100); + _mav_put_char_array(buf, 112, peripherals_metadata_uri, 100); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPONENT_INFORMATION, buf, MAVLINK_MSG_ID_COMPONENT_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_CRC); #else mavlink_component_information_t packet; packet.time_boot_ms = time_boot_ms; - packet.metadata_type = metadata_type; - packet.metadata_uid = metadata_uid; - packet.translation_uid = translation_uid; - mav_array_memcpy(packet.metadata_uri, metadata_uri, sizeof(char)*70); - mav_array_memcpy(packet.translation_uri, translation_uri, sizeof(char)*70); + packet.general_metadata_file_crc = general_metadata_file_crc; + packet.peripherals_metadata_file_crc = peripherals_metadata_file_crc; + mav_array_assign_char(packet.general_metadata_uri, general_metadata_uri, 100); + mav_array_assign_char(packet.peripherals_metadata_uri, peripherals_metadata_uri, 100); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPONENT_INFORMATION, (const char *)&packet, MAVLINK_MSG_ID_COMPONENT_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_CRC); #endif } @@ -205,7 +250,7 @@ static inline void mavlink_msg_component_information_send(mavlink_channel_t chan static inline void mavlink_msg_component_information_send_struct(mavlink_channel_t chan, const mavlink_component_information_t* component_information) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_component_information_send(chan, component_information->time_boot_ms, component_information->metadata_type, component_information->metadata_uid, component_information->metadata_uri, component_information->translation_uid, component_information->translation_uri); + mavlink_msg_component_information_send(chan, component_information->time_boot_ms, component_information->general_metadata_file_crc, component_information->general_metadata_uri, component_information->peripherals_metadata_file_crc, component_information->peripherals_metadata_uri); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPONENT_INFORMATION, (const char *)component_information, MAVLINK_MSG_ID_COMPONENT_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_CRC); #endif @@ -213,31 +258,29 @@ static inline void mavlink_msg_component_information_send_struct(mavlink_channel #if MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_component_information_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint32_t metadata_type, uint32_t metadata_uid, const char *metadata_uri, uint32_t translation_uid, const char *translation_uri) +static inline void mavlink_msg_component_information_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint32_t general_metadata_file_crc, const char *general_metadata_uri, uint32_t peripherals_metadata_file_crc, const char *peripherals_metadata_uri) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; _mav_put_uint32_t(buf, 0, time_boot_ms); - _mav_put_uint32_t(buf, 4, metadata_type); - _mav_put_uint32_t(buf, 8, metadata_uid); - _mav_put_uint32_t(buf, 12, translation_uid); - _mav_put_char_array(buf, 16, metadata_uri, 70); - _mav_put_char_array(buf, 86, translation_uri, 70); + _mav_put_uint32_t(buf, 4, general_metadata_file_crc); + _mav_put_uint32_t(buf, 8, peripherals_metadata_file_crc); + _mav_put_char_array(buf, 12, general_metadata_uri, 100); + _mav_put_char_array(buf, 112, peripherals_metadata_uri, 100); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPONENT_INFORMATION, buf, MAVLINK_MSG_ID_COMPONENT_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_CRC); #else mavlink_component_information_t *packet = (mavlink_component_information_t *)msgbuf; packet->time_boot_ms = time_boot_ms; - packet->metadata_type = metadata_type; - packet->metadata_uid = metadata_uid; - packet->translation_uid = translation_uid; - mav_array_memcpy(packet->metadata_uri, metadata_uri, sizeof(char)*70); - mav_array_memcpy(packet->translation_uri, translation_uri, sizeof(char)*70); + packet->general_metadata_file_crc = general_metadata_file_crc; + packet->peripherals_metadata_file_crc = peripherals_metadata_file_crc; + mav_array_assign_char(packet->general_metadata_uri, general_metadata_uri, 100); + mav_array_assign_char(packet->peripherals_metadata_uri, peripherals_metadata_uri, 100); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPONENT_INFORMATION, (const char *)packet, MAVLINK_MSG_ID_COMPONENT_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_CRC); #endif } @@ -259,53 +302,43 @@ static inline uint32_t mavlink_msg_component_information_get_time_boot_ms(const } /** - * @brief Get field metadata_type from component_information message + * @brief Get field general_metadata_file_crc from component_information message * - * @return The type of metadata being requested. + * @return CRC32 of the general metadata file (general_metadata_uri). */ -static inline uint32_t mavlink_msg_component_information_get_metadata_type(const mavlink_message_t* msg) +static inline uint32_t mavlink_msg_component_information_get_general_metadata_file_crc(const mavlink_message_t* msg) { return _MAV_RETURN_uint32_t(msg, 4); } /** - * @brief Get field metadata_uid from component_information message - * - * @return Unique uid for this metadata which a gcs can use for created cached metadata and understanding whether it's cache it up to date or whether it needs to download new data. - */ -static inline uint32_t mavlink_msg_component_information_get_metadata_uid(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 8); -} - -/** - * @brief Get field metadata_uri from component_information message + * @brief Get field general_metadata_uri from component_information message * - * @return Component definition URI. If prefix mavlinkftp:// file is downloaded from vehicle over mavlink ftp protocol. If prefix http[s]:// file is downloaded over internet. Files are json format. They can end in .gz to indicate file is in gzip format. + * @return MAVLink FTP URI for the general metadata file (COMP_METADATA_TYPE_GENERAL), which may be compressed with xz. The file contains general component metadata, and may contain URI links for additional metadata (see COMP_METADATA_TYPE). The information is static from boot, and may be generated at compile time. The string needs to be zero terminated. */ -static inline uint16_t mavlink_msg_component_information_get_metadata_uri(const mavlink_message_t* msg, char *metadata_uri) +static inline uint16_t mavlink_msg_component_information_get_general_metadata_uri(const mavlink_message_t* msg, char *general_metadata_uri) { - return _MAV_RETURN_char_array(msg, metadata_uri, 70, 16); + return _MAV_RETURN_char_array(msg, general_metadata_uri, 100, 12); } /** - * @brief Get field translation_uid from component_information message + * @brief Get field peripherals_metadata_file_crc from component_information message * - * @return Unique uid for the translation file associated with the metadata. + * @return CRC32 of peripherals metadata file (peripherals_metadata_uri). */ -static inline uint32_t mavlink_msg_component_information_get_translation_uid(const mavlink_message_t* msg) +static inline uint32_t mavlink_msg_component_information_get_peripherals_metadata_file_crc(const mavlink_message_t* msg) { - return _MAV_RETURN_uint32_t(msg, 12); + return _MAV_RETURN_uint32_t(msg, 8); } /** - * @brief Get field translation_uri from component_information message + * @brief Get field peripherals_metadata_uri from component_information message * - * @return The translations for strings within the metadata file. If null the either do not exist or may be included in the metadata file itself. The translations specified here supercede any which may be in the metadata file itself. The uri format is the same as component_metadata_uri . Files are in Json Translation spec format. Empty string indicates no tranlsation file. + * @return (Optional) MAVLink FTP URI for the peripherals metadata file (COMP_METADATA_TYPE_PERIPHERALS), which may be compressed with xz. This contains data about "attached components" such as UAVCAN nodes. The peripherals are in a separate file because the information must be generated dynamically at runtime. The string needs to be zero terminated. */ -static inline uint16_t mavlink_msg_component_information_get_translation_uri(const mavlink_message_t* msg, char *translation_uri) +static inline uint16_t mavlink_msg_component_information_get_peripherals_metadata_uri(const mavlink_message_t* msg, char *peripherals_metadata_uri) { - return _MAV_RETURN_char_array(msg, translation_uri, 70, 86); + return _MAV_RETURN_char_array(msg, peripherals_metadata_uri, 100, 112); } /** @@ -318,11 +351,10 @@ static inline void mavlink_msg_component_information_decode(const mavlink_messag { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS component_information->time_boot_ms = mavlink_msg_component_information_get_time_boot_ms(msg); - component_information->metadata_type = mavlink_msg_component_information_get_metadata_type(msg); - component_information->metadata_uid = mavlink_msg_component_information_get_metadata_uid(msg); - component_information->translation_uid = mavlink_msg_component_information_get_translation_uid(msg); - mavlink_msg_component_information_get_metadata_uri(msg, component_information->metadata_uri); - mavlink_msg_component_information_get_translation_uri(msg, component_information->translation_uri); + component_information->general_metadata_file_crc = mavlink_msg_component_information_get_general_metadata_file_crc(msg); + component_information->peripherals_metadata_file_crc = mavlink_msg_component_information_get_peripherals_metadata_file_crc(msg); + mavlink_msg_component_information_get_general_metadata_uri(msg, component_information->general_metadata_uri); + mavlink_msg_component_information_get_peripherals_metadata_uri(msg, component_information->peripherals_metadata_uri); #else uint8_t len = msg->len < MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN? msg->len : MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN; memset(component_information, 0, MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN); diff --git a/common/mavlink_msg_component_information_basic.h b/common/mavlink_msg_component_information_basic.h new file mode 100644 index 000000000..bbe75c1a7 --- /dev/null +++ b/common/mavlink_msg_component_information_basic.h @@ -0,0 +1,450 @@ +#pragma once +// MESSAGE COMPONENT_INFORMATION_BASIC PACKING + +#define MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC 396 + + +typedef struct __mavlink_component_information_basic_t { + uint64_t capabilities; /*< Component capability flags*/ + uint32_t time_boot_ms; /*< [ms] Timestamp (time since system boot).*/ + uint32_t time_manufacture_s; /*< [s] Date of manufacture as a UNIX Epoch time (since 1.1.1970) in seconds.*/ + char vendor_name[32]; /*< Name of the component vendor. Needs to be zero terminated. The field is optional and can be empty/all zeros.*/ + char model_name[32]; /*< Name of the component model. Needs to be zero terminated. The field is optional and can be empty/all zeros.*/ + char software_version[24]; /*< Software version. The recommended format is SEMVER: 'major.minor.patch' (any format may be used). The field must be zero terminated if it has a value. The field is optional and can be empty/all zeros.*/ + char hardware_version[24]; /*< Hardware version. The recommended format is SEMVER: 'major.minor.patch' (any format may be used). The field must be zero terminated if it has a value. The field is optional and can be empty/all zeros.*/ + char serial_number[32]; /*< Hardware serial number. The field must be zero terminated if it has a value. The field is optional and can be empty/all zeros.*/ +} mavlink_component_information_basic_t; + +#define MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_LEN 160 +#define MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_MIN_LEN 160 +#define MAVLINK_MSG_ID_396_LEN 160 +#define MAVLINK_MSG_ID_396_MIN_LEN 160 + +#define MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_CRC 50 +#define MAVLINK_MSG_ID_396_CRC 50 + +#define MAVLINK_MSG_COMPONENT_INFORMATION_BASIC_FIELD_VENDOR_NAME_LEN 32 +#define MAVLINK_MSG_COMPONENT_INFORMATION_BASIC_FIELD_MODEL_NAME_LEN 32 +#define MAVLINK_MSG_COMPONENT_INFORMATION_BASIC_FIELD_SOFTWARE_VERSION_LEN 24 +#define MAVLINK_MSG_COMPONENT_INFORMATION_BASIC_FIELD_HARDWARE_VERSION_LEN 24 +#define MAVLINK_MSG_COMPONENT_INFORMATION_BASIC_FIELD_SERIAL_NUMBER_LEN 32 + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_COMPONENT_INFORMATION_BASIC { \ + 396, \ + "COMPONENT_INFORMATION_BASIC", \ + 8, \ + { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_component_information_basic_t, time_boot_ms) }, \ + { "capabilities", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_component_information_basic_t, capabilities) }, \ + { "time_manufacture_s", NULL, MAVLINK_TYPE_UINT32_T, 0, 12, offsetof(mavlink_component_information_basic_t, time_manufacture_s) }, \ + { "vendor_name", NULL, MAVLINK_TYPE_CHAR, 32, 16, offsetof(mavlink_component_information_basic_t, vendor_name) }, \ + { "model_name", NULL, MAVLINK_TYPE_CHAR, 32, 48, offsetof(mavlink_component_information_basic_t, model_name) }, \ + { "software_version", NULL, MAVLINK_TYPE_CHAR, 24, 80, offsetof(mavlink_component_information_basic_t, software_version) }, \ + { "hardware_version", NULL, MAVLINK_TYPE_CHAR, 24, 104, offsetof(mavlink_component_information_basic_t, hardware_version) }, \ + { "serial_number", NULL, MAVLINK_TYPE_CHAR, 32, 128, offsetof(mavlink_component_information_basic_t, serial_number) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_COMPONENT_INFORMATION_BASIC { \ + "COMPONENT_INFORMATION_BASIC", \ + 8, \ + { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_component_information_basic_t, time_boot_ms) }, \ + { "capabilities", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_component_information_basic_t, capabilities) }, \ + { "time_manufacture_s", NULL, MAVLINK_TYPE_UINT32_T, 0, 12, offsetof(mavlink_component_information_basic_t, time_manufacture_s) }, \ + { "vendor_name", NULL, MAVLINK_TYPE_CHAR, 32, 16, offsetof(mavlink_component_information_basic_t, vendor_name) }, \ + { "model_name", NULL, MAVLINK_TYPE_CHAR, 32, 48, offsetof(mavlink_component_information_basic_t, model_name) }, \ + { "software_version", NULL, MAVLINK_TYPE_CHAR, 24, 80, offsetof(mavlink_component_information_basic_t, software_version) }, \ + { "hardware_version", NULL, MAVLINK_TYPE_CHAR, 24, 104, offsetof(mavlink_component_information_basic_t, hardware_version) }, \ + { "serial_number", NULL, MAVLINK_TYPE_CHAR, 32, 128, offsetof(mavlink_component_information_basic_t, serial_number) }, \ + } \ +} +#endif + +/** + * @brief Pack a component_information_basic message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param capabilities Component capability flags + * @param time_manufacture_s [s] Date of manufacture as a UNIX Epoch time (since 1.1.1970) in seconds. + * @param vendor_name Name of the component vendor. Needs to be zero terminated. The field is optional and can be empty/all zeros. + * @param model_name Name of the component model. Needs to be zero terminated. The field is optional and can be empty/all zeros. + * @param software_version Software version. The recommended format is SEMVER: 'major.minor.patch' (any format may be used). The field must be zero terminated if it has a value. The field is optional and can be empty/all zeros. + * @param hardware_version Hardware version. The recommended format is SEMVER: 'major.minor.patch' (any format may be used). The field must be zero terminated if it has a value. The field is optional and can be empty/all zeros. + * @param serial_number Hardware serial number. The field must be zero terminated if it has a value. The field is optional and can be empty/all zeros. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_component_information_basic_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint32_t time_boot_ms, uint64_t capabilities, uint32_t time_manufacture_s, const char *vendor_name, const char *model_name, const char *software_version, const char *hardware_version, const char *serial_number) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_LEN]; + _mav_put_uint64_t(buf, 0, capabilities); + _mav_put_uint32_t(buf, 8, time_boot_ms); + _mav_put_uint32_t(buf, 12, time_manufacture_s); + _mav_put_char_array(buf, 16, vendor_name, 32); + _mav_put_char_array(buf, 48, model_name, 32); + _mav_put_char_array(buf, 80, software_version, 24); + _mav_put_char_array(buf, 104, hardware_version, 24); + _mav_put_char_array(buf, 128, serial_number, 32); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_LEN); +#else + mavlink_component_information_basic_t packet; + packet.capabilities = capabilities; + packet.time_boot_ms = time_boot_ms; + packet.time_manufacture_s = time_manufacture_s; + mav_array_assign_char(packet.vendor_name, vendor_name, 32); + mav_array_assign_char(packet.model_name, model_name, 32); + mav_array_assign_char(packet.software_version, software_version, 24); + mav_array_assign_char(packet.hardware_version, hardware_version, 24); + mav_array_assign_char(packet.serial_number, serial_number, 32); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_CRC); +} + +/** + * @brief Pack a component_information_basic message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param capabilities Component capability flags + * @param time_manufacture_s [s] Date of manufacture as a UNIX Epoch time (since 1.1.1970) in seconds. + * @param vendor_name Name of the component vendor. Needs to be zero terminated. The field is optional and can be empty/all zeros. + * @param model_name Name of the component model. Needs to be zero terminated. The field is optional and can be empty/all zeros. + * @param software_version Software version. The recommended format is SEMVER: 'major.minor.patch' (any format may be used). The field must be zero terminated if it has a value. The field is optional and can be empty/all zeros. + * @param hardware_version Hardware version. The recommended format is SEMVER: 'major.minor.patch' (any format may be used). The field must be zero terminated if it has a value. The field is optional and can be empty/all zeros. + * @param serial_number Hardware serial number. The field must be zero terminated if it has a value. The field is optional and can be empty/all zeros. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_component_information_basic_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, uint64_t capabilities, uint32_t time_manufacture_s, const char *vendor_name, const char *model_name, const char *software_version, const char *hardware_version, const char *serial_number) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_LEN]; + _mav_put_uint64_t(buf, 0, capabilities); + _mav_put_uint32_t(buf, 8, time_boot_ms); + _mav_put_uint32_t(buf, 12, time_manufacture_s); + _mav_put_char_array(buf, 16, vendor_name, 32); + _mav_put_char_array(buf, 48, model_name, 32); + _mav_put_char_array(buf, 80, software_version, 24); + _mav_put_char_array(buf, 104, hardware_version, 24); + _mav_put_char_array(buf, 128, serial_number, 32); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_LEN); +#else + mavlink_component_information_basic_t packet; + packet.capabilities = capabilities; + packet.time_boot_ms = time_boot_ms; + packet.time_manufacture_s = time_manufacture_s; + mav_array_memcpy(packet.vendor_name, vendor_name, sizeof(char)*32); + mav_array_memcpy(packet.model_name, model_name, sizeof(char)*32); + mav_array_memcpy(packet.software_version, software_version, sizeof(char)*24); + mav_array_memcpy(packet.hardware_version, hardware_version, sizeof(char)*24); + mav_array_memcpy(packet.serial_number, serial_number, sizeof(char)*32); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_LEN); +#endif +} + +/** + * @brief Pack a component_information_basic message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param capabilities Component capability flags + * @param time_manufacture_s [s] Date of manufacture as a UNIX Epoch time (since 1.1.1970) in seconds. + * @param vendor_name Name of the component vendor. Needs to be zero terminated. The field is optional and can be empty/all zeros. + * @param model_name Name of the component model. Needs to be zero terminated. The field is optional and can be empty/all zeros. + * @param software_version Software version. The recommended format is SEMVER: 'major.minor.patch' (any format may be used). The field must be zero terminated if it has a value. The field is optional and can be empty/all zeros. + * @param hardware_version Hardware version. The recommended format is SEMVER: 'major.minor.patch' (any format may be used). The field must be zero terminated if it has a value. The field is optional and can be empty/all zeros. + * @param serial_number Hardware serial number. The field must be zero terminated if it has a value. The field is optional and can be empty/all zeros. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_component_information_basic_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint32_t time_boot_ms,uint64_t capabilities,uint32_t time_manufacture_s,const char *vendor_name,const char *model_name,const char *software_version,const char *hardware_version,const char *serial_number) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_LEN]; + _mav_put_uint64_t(buf, 0, capabilities); + _mav_put_uint32_t(buf, 8, time_boot_ms); + _mav_put_uint32_t(buf, 12, time_manufacture_s); + _mav_put_char_array(buf, 16, vendor_name, 32); + _mav_put_char_array(buf, 48, model_name, 32); + _mav_put_char_array(buf, 80, software_version, 24); + _mav_put_char_array(buf, 104, hardware_version, 24); + _mav_put_char_array(buf, 128, serial_number, 32); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_LEN); +#else + mavlink_component_information_basic_t packet; + packet.capabilities = capabilities; + packet.time_boot_ms = time_boot_ms; + packet.time_manufacture_s = time_manufacture_s; + mav_array_assign_char(packet.vendor_name, vendor_name, 32); + mav_array_assign_char(packet.model_name, model_name, 32); + mav_array_assign_char(packet.software_version, software_version, 24); + mav_array_assign_char(packet.hardware_version, hardware_version, 24); + mav_array_assign_char(packet.serial_number, serial_number, 32); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_CRC); +} + +/** + * @brief Encode a component_information_basic struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param component_information_basic C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_component_information_basic_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_component_information_basic_t* component_information_basic) +{ + return mavlink_msg_component_information_basic_pack(system_id, component_id, msg, component_information_basic->time_boot_ms, component_information_basic->capabilities, component_information_basic->time_manufacture_s, component_information_basic->vendor_name, component_information_basic->model_name, component_information_basic->software_version, component_information_basic->hardware_version, component_information_basic->serial_number); +} + +/** + * @brief Encode a component_information_basic struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param component_information_basic C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_component_information_basic_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_component_information_basic_t* component_information_basic) +{ + return mavlink_msg_component_information_basic_pack_chan(system_id, component_id, chan, msg, component_information_basic->time_boot_ms, component_information_basic->capabilities, component_information_basic->time_manufacture_s, component_information_basic->vendor_name, component_information_basic->model_name, component_information_basic->software_version, component_information_basic->hardware_version, component_information_basic->serial_number); +} + +/** + * @brief Encode a component_information_basic struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param component_information_basic C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_component_information_basic_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_component_information_basic_t* component_information_basic) +{ + return mavlink_msg_component_information_basic_pack_status(system_id, component_id, _status, msg, component_information_basic->time_boot_ms, component_information_basic->capabilities, component_information_basic->time_manufacture_s, component_information_basic->vendor_name, component_information_basic->model_name, component_information_basic->software_version, component_information_basic->hardware_version, component_information_basic->serial_number); +} + +/** + * @brief Send a component_information_basic message + * @param chan MAVLink channel to send the message + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param capabilities Component capability flags + * @param time_manufacture_s [s] Date of manufacture as a UNIX Epoch time (since 1.1.1970) in seconds. + * @param vendor_name Name of the component vendor. Needs to be zero terminated. The field is optional and can be empty/all zeros. + * @param model_name Name of the component model. Needs to be zero terminated. The field is optional and can be empty/all zeros. + * @param software_version Software version. The recommended format is SEMVER: 'major.minor.patch' (any format may be used). The field must be zero terminated if it has a value. The field is optional and can be empty/all zeros. + * @param hardware_version Hardware version. The recommended format is SEMVER: 'major.minor.patch' (any format may be used). The field must be zero terminated if it has a value. The field is optional and can be empty/all zeros. + * @param serial_number Hardware serial number. The field must be zero terminated if it has a value. The field is optional and can be empty/all zeros. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_component_information_basic_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint64_t capabilities, uint32_t time_manufacture_s, const char *vendor_name, const char *model_name, const char *software_version, const char *hardware_version, const char *serial_number) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_LEN]; + _mav_put_uint64_t(buf, 0, capabilities); + _mav_put_uint32_t(buf, 8, time_boot_ms); + _mav_put_uint32_t(buf, 12, time_manufacture_s); + _mav_put_char_array(buf, 16, vendor_name, 32); + _mav_put_char_array(buf, 48, model_name, 32); + _mav_put_char_array(buf, 80, software_version, 24); + _mav_put_char_array(buf, 104, hardware_version, 24); + _mav_put_char_array(buf, 128, serial_number, 32); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC, buf, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_CRC); +#else + mavlink_component_information_basic_t packet; + packet.capabilities = capabilities; + packet.time_boot_ms = time_boot_ms; + packet.time_manufacture_s = time_manufacture_s; + mav_array_assign_char(packet.vendor_name, vendor_name, 32); + mav_array_assign_char(packet.model_name, model_name, 32); + mav_array_assign_char(packet.software_version, software_version, 24); + mav_array_assign_char(packet.hardware_version, hardware_version, 24); + mav_array_assign_char(packet.serial_number, serial_number, 32); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC, (const char *)&packet, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_CRC); +#endif +} + +/** + * @brief Send a component_information_basic message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_component_information_basic_send_struct(mavlink_channel_t chan, const mavlink_component_information_basic_t* component_information_basic) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_component_information_basic_send(chan, component_information_basic->time_boot_ms, component_information_basic->capabilities, component_information_basic->time_manufacture_s, component_information_basic->vendor_name, component_information_basic->model_name, component_information_basic->software_version, component_information_basic->hardware_version, component_information_basic->serial_number); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC, (const char *)component_information_basic, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_CRC); +#endif +} + +#if MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_component_information_basic_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint64_t capabilities, uint32_t time_manufacture_s, const char *vendor_name, const char *model_name, const char *software_version, const char *hardware_version, const char *serial_number) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint64_t(buf, 0, capabilities); + _mav_put_uint32_t(buf, 8, time_boot_ms); + _mav_put_uint32_t(buf, 12, time_manufacture_s); + _mav_put_char_array(buf, 16, vendor_name, 32); + _mav_put_char_array(buf, 48, model_name, 32); + _mav_put_char_array(buf, 80, software_version, 24); + _mav_put_char_array(buf, 104, hardware_version, 24); + _mav_put_char_array(buf, 128, serial_number, 32); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC, buf, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_CRC); +#else + mavlink_component_information_basic_t *packet = (mavlink_component_information_basic_t *)msgbuf; + packet->capabilities = capabilities; + packet->time_boot_ms = time_boot_ms; + packet->time_manufacture_s = time_manufacture_s; + mav_array_assign_char(packet->vendor_name, vendor_name, 32); + mav_array_assign_char(packet->model_name, model_name, 32); + mav_array_assign_char(packet->software_version, software_version, 24); + mav_array_assign_char(packet->hardware_version, hardware_version, 24); + mav_array_assign_char(packet->serial_number, serial_number, 32); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC, (const char *)packet, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_CRC); +#endif +} +#endif + +#endif + +// MESSAGE COMPONENT_INFORMATION_BASIC UNPACKING + + +/** + * @brief Get field time_boot_ms from component_information_basic message + * + * @return [ms] Timestamp (time since system boot). + */ +static inline uint32_t mavlink_msg_component_information_basic_get_time_boot_ms(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 8); +} + +/** + * @brief Get field capabilities from component_information_basic message + * + * @return Component capability flags + */ +static inline uint64_t mavlink_msg_component_information_basic_get_capabilities(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 0); +} + +/** + * @brief Get field time_manufacture_s from component_information_basic message + * + * @return [s] Date of manufacture as a UNIX Epoch time (since 1.1.1970) in seconds. + */ +static inline uint32_t mavlink_msg_component_information_basic_get_time_manufacture_s(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 12); +} + +/** + * @brief Get field vendor_name from component_information_basic message + * + * @return Name of the component vendor. Needs to be zero terminated. The field is optional and can be empty/all zeros. + */ +static inline uint16_t mavlink_msg_component_information_basic_get_vendor_name(const mavlink_message_t* msg, char *vendor_name) +{ + return _MAV_RETURN_char_array(msg, vendor_name, 32, 16); +} + +/** + * @brief Get field model_name from component_information_basic message + * + * @return Name of the component model. Needs to be zero terminated. The field is optional and can be empty/all zeros. + */ +static inline uint16_t mavlink_msg_component_information_basic_get_model_name(const mavlink_message_t* msg, char *model_name) +{ + return _MAV_RETURN_char_array(msg, model_name, 32, 48); +} + +/** + * @brief Get field software_version from component_information_basic message + * + * @return Software version. The recommended format is SEMVER: 'major.minor.patch' (any format may be used). The field must be zero terminated if it has a value. The field is optional and can be empty/all zeros. + */ +static inline uint16_t mavlink_msg_component_information_basic_get_software_version(const mavlink_message_t* msg, char *software_version) +{ + return _MAV_RETURN_char_array(msg, software_version, 24, 80); +} + +/** + * @brief Get field hardware_version from component_information_basic message + * + * @return Hardware version. The recommended format is SEMVER: 'major.minor.patch' (any format may be used). The field must be zero terminated if it has a value. The field is optional and can be empty/all zeros. + */ +static inline uint16_t mavlink_msg_component_information_basic_get_hardware_version(const mavlink_message_t* msg, char *hardware_version) +{ + return _MAV_RETURN_char_array(msg, hardware_version, 24, 104); +} + +/** + * @brief Get field serial_number from component_information_basic message + * + * @return Hardware serial number. The field must be zero terminated if it has a value. The field is optional and can be empty/all zeros. + */ +static inline uint16_t mavlink_msg_component_information_basic_get_serial_number(const mavlink_message_t* msg, char *serial_number) +{ + return _MAV_RETURN_char_array(msg, serial_number, 32, 128); +} + +/** + * @brief Decode a component_information_basic message into a struct + * + * @param msg The message to decode + * @param component_information_basic C-struct to decode the message contents into + */ +static inline void mavlink_msg_component_information_basic_decode(const mavlink_message_t* msg, mavlink_component_information_basic_t* component_information_basic) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + component_information_basic->capabilities = mavlink_msg_component_information_basic_get_capabilities(msg); + component_information_basic->time_boot_ms = mavlink_msg_component_information_basic_get_time_boot_ms(msg); + component_information_basic->time_manufacture_s = mavlink_msg_component_information_basic_get_time_manufacture_s(msg); + mavlink_msg_component_information_basic_get_vendor_name(msg, component_information_basic->vendor_name); + mavlink_msg_component_information_basic_get_model_name(msg, component_information_basic->model_name); + mavlink_msg_component_information_basic_get_software_version(msg, component_information_basic->software_version); + mavlink_msg_component_information_basic_get_hardware_version(msg, component_information_basic->hardware_version); + mavlink_msg_component_information_basic_get_serial_number(msg, component_information_basic->serial_number); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_LEN? msg->len : MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_LEN; + memset(component_information_basic, 0, MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_LEN); + memcpy(component_information_basic, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/common/mavlink_msg_component_metadata.h b/common/mavlink_msg_component_metadata.h new file mode 100644 index 000000000..d51c2f847 --- /dev/null +++ b/common/mavlink_msg_component_metadata.h @@ -0,0 +1,306 @@ +#pragma once +// MESSAGE COMPONENT_METADATA PACKING + +#define MAVLINK_MSG_ID_COMPONENT_METADATA 397 + + +typedef struct __mavlink_component_metadata_t { + uint32_t time_boot_ms; /*< [ms] Timestamp (time since system boot).*/ + uint32_t file_crc; /*< CRC32 of the general metadata file.*/ + char uri[100]; /*< MAVLink FTP URI for the general metadata file (COMP_METADATA_TYPE_GENERAL), which may be compressed with xz. The file contains general component metadata, and may contain URI links for additional metadata (see COMP_METADATA_TYPE). The information is static from boot, and may be generated at compile time. The string needs to be zero terminated.*/ +} mavlink_component_metadata_t; + +#define MAVLINK_MSG_ID_COMPONENT_METADATA_LEN 108 +#define MAVLINK_MSG_ID_COMPONENT_METADATA_MIN_LEN 108 +#define MAVLINK_MSG_ID_397_LEN 108 +#define MAVLINK_MSG_ID_397_MIN_LEN 108 + +#define MAVLINK_MSG_ID_COMPONENT_METADATA_CRC 182 +#define MAVLINK_MSG_ID_397_CRC 182 + +#define MAVLINK_MSG_COMPONENT_METADATA_FIELD_URI_LEN 100 + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_COMPONENT_METADATA { \ + 397, \ + "COMPONENT_METADATA", \ + 3, \ + { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_component_metadata_t, time_boot_ms) }, \ + { "file_crc", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_component_metadata_t, file_crc) }, \ + { "uri", NULL, MAVLINK_TYPE_CHAR, 100, 8, offsetof(mavlink_component_metadata_t, uri) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_COMPONENT_METADATA { \ + "COMPONENT_METADATA", \ + 3, \ + { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_component_metadata_t, time_boot_ms) }, \ + { "file_crc", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_component_metadata_t, file_crc) }, \ + { "uri", NULL, MAVLINK_TYPE_CHAR, 100, 8, offsetof(mavlink_component_metadata_t, uri) }, \ + } \ +} +#endif + +/** + * @brief Pack a component_metadata message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param file_crc CRC32 of the general metadata file. + * @param uri MAVLink FTP URI for the general metadata file (COMP_METADATA_TYPE_GENERAL), which may be compressed with xz. The file contains general component metadata, and may contain URI links for additional metadata (see COMP_METADATA_TYPE). The information is static from boot, and may be generated at compile time. The string needs to be zero terminated. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_component_metadata_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint32_t time_boot_ms, uint32_t file_crc, const char *uri) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_COMPONENT_METADATA_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_uint32_t(buf, 4, file_crc); + _mav_put_char_array(buf, 8, uri, 100); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMPONENT_METADATA_LEN); +#else + mavlink_component_metadata_t packet; + packet.time_boot_ms = time_boot_ms; + packet.file_crc = file_crc; + mav_array_assign_char(packet.uri, uri, 100); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMPONENT_METADATA_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_COMPONENT_METADATA; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_COMPONENT_METADATA_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_METADATA_LEN, MAVLINK_MSG_ID_COMPONENT_METADATA_CRC); +} + +/** + * @brief Pack a component_metadata message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param file_crc CRC32 of the general metadata file. + * @param uri MAVLink FTP URI for the general metadata file (COMP_METADATA_TYPE_GENERAL), which may be compressed with xz. The file contains general component metadata, and may contain URI links for additional metadata (see COMP_METADATA_TYPE). The information is static from boot, and may be generated at compile time. The string needs to be zero terminated. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_component_metadata_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, uint32_t file_crc, const char *uri) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_COMPONENT_METADATA_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_uint32_t(buf, 4, file_crc); + _mav_put_char_array(buf, 8, uri, 100); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMPONENT_METADATA_LEN); +#else + mavlink_component_metadata_t packet; + packet.time_boot_ms = time_boot_ms; + packet.file_crc = file_crc; + mav_array_memcpy(packet.uri, uri, sizeof(char)*100); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMPONENT_METADATA_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_COMPONENT_METADATA; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_COMPONENT_METADATA_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_METADATA_LEN, MAVLINK_MSG_ID_COMPONENT_METADATA_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_COMPONENT_METADATA_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_METADATA_LEN); +#endif +} + +/** + * @brief Pack a component_metadata message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param file_crc CRC32 of the general metadata file. + * @param uri MAVLink FTP URI for the general metadata file (COMP_METADATA_TYPE_GENERAL), which may be compressed with xz. The file contains general component metadata, and may contain URI links for additional metadata (see COMP_METADATA_TYPE). The information is static from boot, and may be generated at compile time. The string needs to be zero terminated. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_component_metadata_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint32_t time_boot_ms,uint32_t file_crc,const char *uri) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_COMPONENT_METADATA_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_uint32_t(buf, 4, file_crc); + _mav_put_char_array(buf, 8, uri, 100); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMPONENT_METADATA_LEN); +#else + mavlink_component_metadata_t packet; + packet.time_boot_ms = time_boot_ms; + packet.file_crc = file_crc; + mav_array_assign_char(packet.uri, uri, 100); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMPONENT_METADATA_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_COMPONENT_METADATA; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_COMPONENT_METADATA_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_METADATA_LEN, MAVLINK_MSG_ID_COMPONENT_METADATA_CRC); +} + +/** + * @brief Encode a component_metadata struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param component_metadata C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_component_metadata_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_component_metadata_t* component_metadata) +{ + return mavlink_msg_component_metadata_pack(system_id, component_id, msg, component_metadata->time_boot_ms, component_metadata->file_crc, component_metadata->uri); +} + +/** + * @brief Encode a component_metadata struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param component_metadata C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_component_metadata_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_component_metadata_t* component_metadata) +{ + return mavlink_msg_component_metadata_pack_chan(system_id, component_id, chan, msg, component_metadata->time_boot_ms, component_metadata->file_crc, component_metadata->uri); +} + +/** + * @brief Encode a component_metadata struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param component_metadata C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_component_metadata_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_component_metadata_t* component_metadata) +{ + return mavlink_msg_component_metadata_pack_status(system_id, component_id, _status, msg, component_metadata->time_boot_ms, component_metadata->file_crc, component_metadata->uri); +} + +/** + * @brief Send a component_metadata message + * @param chan MAVLink channel to send the message + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param file_crc CRC32 of the general metadata file. + * @param uri MAVLink FTP URI for the general metadata file (COMP_METADATA_TYPE_GENERAL), which may be compressed with xz. The file contains general component metadata, and may contain URI links for additional metadata (see COMP_METADATA_TYPE). The information is static from boot, and may be generated at compile time. The string needs to be zero terminated. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_component_metadata_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint32_t file_crc, const char *uri) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_COMPONENT_METADATA_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_uint32_t(buf, 4, file_crc); + _mav_put_char_array(buf, 8, uri, 100); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPONENT_METADATA, buf, MAVLINK_MSG_ID_COMPONENT_METADATA_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_METADATA_LEN, MAVLINK_MSG_ID_COMPONENT_METADATA_CRC); +#else + mavlink_component_metadata_t packet; + packet.time_boot_ms = time_boot_ms; + packet.file_crc = file_crc; + mav_array_assign_char(packet.uri, uri, 100); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPONENT_METADATA, (const char *)&packet, MAVLINK_MSG_ID_COMPONENT_METADATA_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_METADATA_LEN, MAVLINK_MSG_ID_COMPONENT_METADATA_CRC); +#endif +} + +/** + * @brief Send a component_metadata message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_component_metadata_send_struct(mavlink_channel_t chan, const mavlink_component_metadata_t* component_metadata) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_component_metadata_send(chan, component_metadata->time_boot_ms, component_metadata->file_crc, component_metadata->uri); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPONENT_METADATA, (const char *)component_metadata, MAVLINK_MSG_ID_COMPONENT_METADATA_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_METADATA_LEN, MAVLINK_MSG_ID_COMPONENT_METADATA_CRC); +#endif +} + +#if MAVLINK_MSG_ID_COMPONENT_METADATA_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_component_metadata_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint32_t file_crc, const char *uri) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_uint32_t(buf, 4, file_crc); + _mav_put_char_array(buf, 8, uri, 100); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPONENT_METADATA, buf, MAVLINK_MSG_ID_COMPONENT_METADATA_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_METADATA_LEN, MAVLINK_MSG_ID_COMPONENT_METADATA_CRC); +#else + mavlink_component_metadata_t *packet = (mavlink_component_metadata_t *)msgbuf; + packet->time_boot_ms = time_boot_ms; + packet->file_crc = file_crc; + mav_array_assign_char(packet->uri, uri, 100); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPONENT_METADATA, (const char *)packet, MAVLINK_MSG_ID_COMPONENT_METADATA_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_METADATA_LEN, MAVLINK_MSG_ID_COMPONENT_METADATA_CRC); +#endif +} +#endif + +#endif + +// MESSAGE COMPONENT_METADATA UNPACKING + + +/** + * @brief Get field time_boot_ms from component_metadata message + * + * @return [ms] Timestamp (time since system boot). + */ +static inline uint32_t mavlink_msg_component_metadata_get_time_boot_ms(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 0); +} + +/** + * @brief Get field file_crc from component_metadata message + * + * @return CRC32 of the general metadata file. + */ +static inline uint32_t mavlink_msg_component_metadata_get_file_crc(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 4); +} + +/** + * @brief Get field uri from component_metadata message + * + * @return MAVLink FTP URI for the general metadata file (COMP_METADATA_TYPE_GENERAL), which may be compressed with xz. The file contains general component metadata, and may contain URI links for additional metadata (see COMP_METADATA_TYPE). The information is static from boot, and may be generated at compile time. The string needs to be zero terminated. + */ +static inline uint16_t mavlink_msg_component_metadata_get_uri(const mavlink_message_t* msg, char *uri) +{ + return _MAV_RETURN_char_array(msg, uri, 100, 8); +} + +/** + * @brief Decode a component_metadata message into a struct + * + * @param msg The message to decode + * @param component_metadata C-struct to decode the message contents into + */ +static inline void mavlink_msg_component_metadata_decode(const mavlink_message_t* msg, mavlink_component_metadata_t* component_metadata) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + component_metadata->time_boot_ms = mavlink_msg_component_metadata_get_time_boot_ms(msg); + component_metadata->file_crc = mavlink_msg_component_metadata_get_file_crc(msg); + mavlink_msg_component_metadata_get_uri(msg, component_metadata->uri); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_COMPONENT_METADATA_LEN? msg->len : MAVLINK_MSG_ID_COMPONENT_METADATA_LEN; + memset(component_metadata, 0, MAVLINK_MSG_ID_COMPONENT_METADATA_LEN); + memcpy(component_metadata, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/common/mavlink_msg_control_system_state.h b/common/mavlink_msg_control_system_state.h index b4381cff4..118161a24 100644 --- a/common/mavlink_msg_control_system_state.h +++ b/common/mavlink_msg_control_system_state.h @@ -113,6 +113,81 @@ typedef struct __mavlink_control_system_state_t { static inline uint16_t mavlink_msg_control_system_state_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint64_t time_usec, float x_acc, float y_acc, float z_acc, float x_vel, float y_vel, float z_vel, float x_pos, float y_pos, float z_pos, float airspeed, const float *vel_variance, const float *pos_variance, const float *q, float roll_rate, float pitch_rate, float yaw_rate) { +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, x_acc); + _mav_put_float(buf, 12, y_acc); + _mav_put_float(buf, 16, z_acc); + _mav_put_float(buf, 20, x_vel); + _mav_put_float(buf, 24, y_vel); + _mav_put_float(buf, 28, z_vel); + _mav_put_float(buf, 32, x_pos); + _mav_put_float(buf, 36, y_pos); + _mav_put_float(buf, 40, z_pos); + _mav_put_float(buf, 44, airspeed); + _mav_put_float(buf, 88, roll_rate); + _mav_put_float(buf, 92, pitch_rate); + _mav_put_float(buf, 96, yaw_rate); + _mav_put_float_array(buf, 48, vel_variance, 3); + _mav_put_float_array(buf, 60, pos_variance, 3); + _mav_put_float_array(buf, 72, q, 4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN); +#else + mavlink_control_system_state_t packet; + packet.time_usec = time_usec; + packet.x_acc = x_acc; + packet.y_acc = y_acc; + packet.z_acc = z_acc; + packet.x_vel = x_vel; + packet.y_vel = y_vel; + packet.z_vel = z_vel; + packet.x_pos = x_pos; + packet.y_pos = y_pos; + packet.z_pos = z_pos; + packet.airspeed = airspeed; + packet.roll_rate = roll_rate; + packet.pitch_rate = pitch_rate; + packet.yaw_rate = yaw_rate; + mav_array_assign_float(packet.vel_variance, vel_variance, 3); + mav_array_assign_float(packet.pos_variance, pos_variance, 3); + mav_array_assign_float(packet.q, q, 4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_MIN_LEN, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_CRC); +} + +/** + * @brief Pack a control_system_state message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param x_acc [m/s/s] X acceleration in body frame + * @param y_acc [m/s/s] Y acceleration in body frame + * @param z_acc [m/s/s] Z acceleration in body frame + * @param x_vel [m/s] X velocity in body frame + * @param y_vel [m/s] Y velocity in body frame + * @param z_vel [m/s] Z velocity in body frame + * @param x_pos [m] X position in local frame + * @param y_pos [m] Y position in local frame + * @param z_pos [m] Z position in local frame + * @param airspeed [m/s] Airspeed, set to -1 if unknown + * @param vel_variance Variance of body velocity estimate + * @param pos_variance Variance in local position + * @param q The attitude, represented as Quaternion + * @param roll_rate [rad/s] Angular rate in roll axis + * @param pitch_rate [rad/s] Angular rate in pitch axis + * @param yaw_rate [rad/s] Angular rate in yaw axis + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_control_system_state_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, float x_acc, float y_acc, float z_acc, float x_vel, float y_vel, float z_vel, float x_pos, float y_pos, float z_pos, float airspeed, const float *vel_variance, const float *pos_variance, const float *q, float roll_rate, float pitch_rate, float yaw_rate) +{ #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN]; _mav_put_uint64_t(buf, 0, time_usec); @@ -156,7 +231,11 @@ static inline uint16_t mavlink_msg_control_system_state_pack(uint8_t system_id, #endif msg->msgid = MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_MIN_LEN, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_CRC); +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_MIN_LEN, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_MIN_LEN, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN); +#endif } /** @@ -224,9 +303,9 @@ static inline uint16_t mavlink_msg_control_system_state_pack_chan(uint8_t system packet.roll_rate = roll_rate; packet.pitch_rate = pitch_rate; packet.yaw_rate = yaw_rate; - mav_array_memcpy(packet.vel_variance, vel_variance, sizeof(float)*3); - mav_array_memcpy(packet.pos_variance, pos_variance, sizeof(float)*3); - mav_array_memcpy(packet.q, q, sizeof(float)*4); + mav_array_assign_float(packet.vel_variance, vel_variance, 3); + mav_array_assign_float(packet.pos_variance, pos_variance, 3); + mav_array_assign_float(packet.q, q, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN); #endif @@ -261,6 +340,20 @@ static inline uint16_t mavlink_msg_control_system_state_encode_chan(uint8_t syst return mavlink_msg_control_system_state_pack_chan(system_id, component_id, chan, msg, control_system_state->time_usec, control_system_state->x_acc, control_system_state->y_acc, control_system_state->z_acc, control_system_state->x_vel, control_system_state->y_vel, control_system_state->z_vel, control_system_state->x_pos, control_system_state->y_pos, control_system_state->z_pos, control_system_state->airspeed, control_system_state->vel_variance, control_system_state->pos_variance, control_system_state->q, control_system_state->roll_rate, control_system_state->pitch_rate, control_system_state->yaw_rate); } +/** + * @brief Encode a control_system_state struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param control_system_state C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_control_system_state_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_control_system_state_t* control_system_state) +{ + return mavlink_msg_control_system_state_pack_status(system_id, component_id, _status, msg, control_system_state->time_usec, control_system_state->x_acc, control_system_state->y_acc, control_system_state->z_acc, control_system_state->x_vel, control_system_state->y_vel, control_system_state->z_vel, control_system_state->x_pos, control_system_state->y_pos, control_system_state->z_pos, control_system_state->airspeed, control_system_state->vel_variance, control_system_state->pos_variance, control_system_state->q, control_system_state->roll_rate, control_system_state->pitch_rate, control_system_state->yaw_rate); +} + /** * @brief Send a control_system_state message * @param chan MAVLink channel to send the message @@ -323,9 +416,9 @@ static inline void mavlink_msg_control_system_state_send(mavlink_channel_t chan, packet.roll_rate = roll_rate; packet.pitch_rate = pitch_rate; packet.yaw_rate = yaw_rate; - mav_array_memcpy(packet.vel_variance, vel_variance, sizeof(float)*3); - mav_array_memcpy(packet.pos_variance, pos_variance, sizeof(float)*3); - mav_array_memcpy(packet.q, q, sizeof(float)*4); + mav_array_assign_float(packet.vel_variance, vel_variance, 3); + mav_array_assign_float(packet.pos_variance, pos_variance, 3); + mav_array_assign_float(packet.q, q, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE, (const char *)&packet, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_MIN_LEN, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_CRC); #endif } @@ -346,7 +439,7 @@ static inline void mavlink_msg_control_system_state_send_struct(mavlink_channel_ #if MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -390,9 +483,9 @@ static inline void mavlink_msg_control_system_state_send_buf(mavlink_message_t * packet->roll_rate = roll_rate; packet->pitch_rate = pitch_rate; packet->yaw_rate = yaw_rate; - mav_array_memcpy(packet->vel_variance, vel_variance, sizeof(float)*3); - mav_array_memcpy(packet->pos_variance, pos_variance, sizeof(float)*3); - mav_array_memcpy(packet->q, q, sizeof(float)*4); + mav_array_assign_float(packet->vel_variance, vel_variance, 3); + mav_array_assign_float(packet->pos_variance, pos_variance, 3); + mav_array_assign_float(packet->q, q, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE, (const char *)packet, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_MIN_LEN, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_CRC); #endif } diff --git a/common/mavlink_msg_current_event_sequence.h b/common/mavlink_msg_current_event_sequence.h new file mode 100644 index 000000000..bc3a61571 --- /dev/null +++ b/common/mavlink_msg_current_event_sequence.h @@ -0,0 +1,288 @@ +#pragma once +// MESSAGE CURRENT_EVENT_SEQUENCE PACKING + +#define MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE 411 + + +typedef struct __mavlink_current_event_sequence_t { + uint16_t sequence; /*< Sequence number.*/ + uint8_t flags; /*< Flag bitset.*/ +} mavlink_current_event_sequence_t; + +#define MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN 3 +#define MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_MIN_LEN 3 +#define MAVLINK_MSG_ID_411_LEN 3 +#define MAVLINK_MSG_ID_411_MIN_LEN 3 + +#define MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_CRC 106 +#define MAVLINK_MSG_ID_411_CRC 106 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_CURRENT_EVENT_SEQUENCE { \ + 411, \ + "CURRENT_EVENT_SEQUENCE", \ + 2, \ + { { "sequence", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_current_event_sequence_t, sequence) }, \ + { "flags", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_current_event_sequence_t, flags) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_CURRENT_EVENT_SEQUENCE { \ + "CURRENT_EVENT_SEQUENCE", \ + 2, \ + { { "sequence", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_current_event_sequence_t, sequence) }, \ + { "flags", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_current_event_sequence_t, flags) }, \ + } \ +} +#endif + +/** + * @brief Pack a current_event_sequence message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param sequence Sequence number. + * @param flags Flag bitset. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_current_event_sequence_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint16_t sequence, uint8_t flags) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN]; + _mav_put_uint16_t(buf, 0, sequence); + _mav_put_uint8_t(buf, 2, flags); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN); +#else + mavlink_current_event_sequence_t packet; + packet.sequence = sequence; + packet.flags = flags; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_CRC); +} + +/** + * @brief Pack a current_event_sequence message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param sequence Sequence number. + * @param flags Flag bitset. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_current_event_sequence_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint16_t sequence, uint8_t flags) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN]; + _mav_put_uint16_t(buf, 0, sequence); + _mav_put_uint8_t(buf, 2, flags); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN); +#else + mavlink_current_event_sequence_t packet; + packet.sequence = sequence; + packet.flags = flags; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN); +#endif +} + +/** + * @brief Pack a current_event_sequence message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param sequence Sequence number. + * @param flags Flag bitset. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_current_event_sequence_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint16_t sequence,uint8_t flags) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN]; + _mav_put_uint16_t(buf, 0, sequence); + _mav_put_uint8_t(buf, 2, flags); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN); +#else + mavlink_current_event_sequence_t packet; + packet.sequence = sequence; + packet.flags = flags; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_CRC); +} + +/** + * @brief Encode a current_event_sequence struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param current_event_sequence C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_current_event_sequence_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_current_event_sequence_t* current_event_sequence) +{ + return mavlink_msg_current_event_sequence_pack(system_id, component_id, msg, current_event_sequence->sequence, current_event_sequence->flags); +} + +/** + * @brief Encode a current_event_sequence struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param current_event_sequence C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_current_event_sequence_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_current_event_sequence_t* current_event_sequence) +{ + return mavlink_msg_current_event_sequence_pack_chan(system_id, component_id, chan, msg, current_event_sequence->sequence, current_event_sequence->flags); +} + +/** + * @brief Encode a current_event_sequence struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param current_event_sequence C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_current_event_sequence_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_current_event_sequence_t* current_event_sequence) +{ + return mavlink_msg_current_event_sequence_pack_status(system_id, component_id, _status, msg, current_event_sequence->sequence, current_event_sequence->flags); +} + +/** + * @brief Send a current_event_sequence message + * @param chan MAVLink channel to send the message + * + * @param sequence Sequence number. + * @param flags Flag bitset. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_current_event_sequence_send(mavlink_channel_t chan, uint16_t sequence, uint8_t flags) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN]; + _mav_put_uint16_t(buf, 0, sequence); + _mav_put_uint8_t(buf, 2, flags); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE, buf, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_CRC); +#else + mavlink_current_event_sequence_t packet; + packet.sequence = sequence; + packet.flags = flags; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE, (const char *)&packet, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_CRC); +#endif +} + +/** + * @brief Send a current_event_sequence message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_current_event_sequence_send_struct(mavlink_channel_t chan, const mavlink_current_event_sequence_t* current_event_sequence) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_current_event_sequence_send(chan, current_event_sequence->sequence, current_event_sequence->flags); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE, (const char *)current_event_sequence, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_CRC); +#endif +} + +#if MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_current_event_sequence_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint16_t sequence, uint8_t flags) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint16_t(buf, 0, sequence); + _mav_put_uint8_t(buf, 2, flags); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE, buf, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_CRC); +#else + mavlink_current_event_sequence_t *packet = (mavlink_current_event_sequence_t *)msgbuf; + packet->sequence = sequence; + packet->flags = flags; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE, (const char *)packet, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_CRC); +#endif +} +#endif + +#endif + +// MESSAGE CURRENT_EVENT_SEQUENCE UNPACKING + + +/** + * @brief Get field sequence from current_event_sequence message + * + * @return Sequence number. + */ +static inline uint16_t mavlink_msg_current_event_sequence_get_sequence(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 0); +} + +/** + * @brief Get field flags from current_event_sequence message + * + * @return Flag bitset. + */ +static inline uint8_t mavlink_msg_current_event_sequence_get_flags(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 2); +} + +/** + * @brief Decode a current_event_sequence message into a struct + * + * @param msg The message to decode + * @param current_event_sequence C-struct to decode the message contents into + */ +static inline void mavlink_msg_current_event_sequence_decode(const mavlink_message_t* msg, mavlink_current_event_sequence_t* current_event_sequence) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + current_event_sequence->sequence = mavlink_msg_current_event_sequence_get_sequence(msg); + current_event_sequence->flags = mavlink_msg_current_event_sequence_get_flags(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN? msg->len : MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN; + memset(current_event_sequence, 0, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN); + memcpy(current_event_sequence, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/common/mavlink_msg_current_mode.h b/common/mavlink_msg_current_mode.h new file mode 100644 index 000000000..a3dc44e56 --- /dev/null +++ b/common/mavlink_msg_current_mode.h @@ -0,0 +1,316 @@ +#pragma once +// MESSAGE CURRENT_MODE PACKING + +#define MAVLINK_MSG_ID_CURRENT_MODE 436 + + +typedef struct __mavlink_current_mode_t { + uint32_t custom_mode; /*< A bitfield for use for autopilot-specific flags*/ + uint32_t intended_custom_mode; /*< The custom_mode of the mode that was last commanded by the user (for example, with MAV_CMD_DO_SET_STANDARD_MODE, MAV_CMD_DO_SET_MODE or via RC). This should usually be the same as custom_mode. It will be different if the vehicle is unable to enter the intended mode, or has left that mode due to a failsafe condition. 0 indicates the intended custom mode is unknown/not supplied*/ + uint8_t standard_mode; /*< Standard mode.*/ +} mavlink_current_mode_t; + +#define MAVLINK_MSG_ID_CURRENT_MODE_LEN 9 +#define MAVLINK_MSG_ID_CURRENT_MODE_MIN_LEN 9 +#define MAVLINK_MSG_ID_436_LEN 9 +#define MAVLINK_MSG_ID_436_MIN_LEN 9 + +#define MAVLINK_MSG_ID_CURRENT_MODE_CRC 193 +#define MAVLINK_MSG_ID_436_CRC 193 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_CURRENT_MODE { \ + 436, \ + "CURRENT_MODE", \ + 3, \ + { { "standard_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_current_mode_t, standard_mode) }, \ + { "custom_mode", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_current_mode_t, custom_mode) }, \ + { "intended_custom_mode", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_current_mode_t, intended_custom_mode) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_CURRENT_MODE { \ + "CURRENT_MODE", \ + 3, \ + { { "standard_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_current_mode_t, standard_mode) }, \ + { "custom_mode", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_current_mode_t, custom_mode) }, \ + { "intended_custom_mode", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_current_mode_t, intended_custom_mode) }, \ + } \ +} +#endif + +/** + * @brief Pack a current_mode message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param standard_mode Standard mode. + * @param custom_mode A bitfield for use for autopilot-specific flags + * @param intended_custom_mode The custom_mode of the mode that was last commanded by the user (for example, with MAV_CMD_DO_SET_STANDARD_MODE, MAV_CMD_DO_SET_MODE or via RC). This should usually be the same as custom_mode. It will be different if the vehicle is unable to enter the intended mode, or has left that mode due to a failsafe condition. 0 indicates the intended custom mode is unknown/not supplied + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_current_mode_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t standard_mode, uint32_t custom_mode, uint32_t intended_custom_mode) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CURRENT_MODE_LEN]; + _mav_put_uint32_t(buf, 0, custom_mode); + _mav_put_uint32_t(buf, 4, intended_custom_mode); + _mav_put_uint8_t(buf, 8, standard_mode); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CURRENT_MODE_LEN); +#else + mavlink_current_mode_t packet; + packet.custom_mode = custom_mode; + packet.intended_custom_mode = intended_custom_mode; + packet.standard_mode = standard_mode; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CURRENT_MODE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CURRENT_MODE; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CURRENT_MODE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_MODE_LEN, MAVLINK_MSG_ID_CURRENT_MODE_CRC); +} + +/** + * @brief Pack a current_mode message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param standard_mode Standard mode. + * @param custom_mode A bitfield for use for autopilot-specific flags + * @param intended_custom_mode The custom_mode of the mode that was last commanded by the user (for example, with MAV_CMD_DO_SET_STANDARD_MODE, MAV_CMD_DO_SET_MODE or via RC). This should usually be the same as custom_mode. It will be different if the vehicle is unable to enter the intended mode, or has left that mode due to a failsafe condition. 0 indicates the intended custom mode is unknown/not supplied + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_current_mode_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t standard_mode, uint32_t custom_mode, uint32_t intended_custom_mode) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CURRENT_MODE_LEN]; + _mav_put_uint32_t(buf, 0, custom_mode); + _mav_put_uint32_t(buf, 4, intended_custom_mode); + _mav_put_uint8_t(buf, 8, standard_mode); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CURRENT_MODE_LEN); +#else + mavlink_current_mode_t packet; + packet.custom_mode = custom_mode; + packet.intended_custom_mode = intended_custom_mode; + packet.standard_mode = standard_mode; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CURRENT_MODE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CURRENT_MODE; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CURRENT_MODE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_MODE_LEN, MAVLINK_MSG_ID_CURRENT_MODE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CURRENT_MODE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_MODE_LEN); +#endif +} + +/** + * @brief Pack a current_mode message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param standard_mode Standard mode. + * @param custom_mode A bitfield for use for autopilot-specific flags + * @param intended_custom_mode The custom_mode of the mode that was last commanded by the user (for example, with MAV_CMD_DO_SET_STANDARD_MODE, MAV_CMD_DO_SET_MODE or via RC). This should usually be the same as custom_mode. It will be different if the vehicle is unable to enter the intended mode, or has left that mode due to a failsafe condition. 0 indicates the intended custom mode is unknown/not supplied + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_current_mode_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t standard_mode,uint32_t custom_mode,uint32_t intended_custom_mode) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CURRENT_MODE_LEN]; + _mav_put_uint32_t(buf, 0, custom_mode); + _mav_put_uint32_t(buf, 4, intended_custom_mode); + _mav_put_uint8_t(buf, 8, standard_mode); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CURRENT_MODE_LEN); +#else + mavlink_current_mode_t packet; + packet.custom_mode = custom_mode; + packet.intended_custom_mode = intended_custom_mode; + packet.standard_mode = standard_mode; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CURRENT_MODE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CURRENT_MODE; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CURRENT_MODE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_MODE_LEN, MAVLINK_MSG_ID_CURRENT_MODE_CRC); +} + +/** + * @brief Encode a current_mode struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param current_mode C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_current_mode_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_current_mode_t* current_mode) +{ + return mavlink_msg_current_mode_pack(system_id, component_id, msg, current_mode->standard_mode, current_mode->custom_mode, current_mode->intended_custom_mode); +} + +/** + * @brief Encode a current_mode struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param current_mode C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_current_mode_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_current_mode_t* current_mode) +{ + return mavlink_msg_current_mode_pack_chan(system_id, component_id, chan, msg, current_mode->standard_mode, current_mode->custom_mode, current_mode->intended_custom_mode); +} + +/** + * @brief Encode a current_mode struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param current_mode C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_current_mode_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_current_mode_t* current_mode) +{ + return mavlink_msg_current_mode_pack_status(system_id, component_id, _status, msg, current_mode->standard_mode, current_mode->custom_mode, current_mode->intended_custom_mode); +} + +/** + * @brief Send a current_mode message + * @param chan MAVLink channel to send the message + * + * @param standard_mode Standard mode. + * @param custom_mode A bitfield for use for autopilot-specific flags + * @param intended_custom_mode The custom_mode of the mode that was last commanded by the user (for example, with MAV_CMD_DO_SET_STANDARD_MODE, MAV_CMD_DO_SET_MODE or via RC). This should usually be the same as custom_mode. It will be different if the vehicle is unable to enter the intended mode, or has left that mode due to a failsafe condition. 0 indicates the intended custom mode is unknown/not supplied + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_current_mode_send(mavlink_channel_t chan, uint8_t standard_mode, uint32_t custom_mode, uint32_t intended_custom_mode) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CURRENT_MODE_LEN]; + _mav_put_uint32_t(buf, 0, custom_mode); + _mav_put_uint32_t(buf, 4, intended_custom_mode); + _mav_put_uint8_t(buf, 8, standard_mode); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CURRENT_MODE, buf, MAVLINK_MSG_ID_CURRENT_MODE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_MODE_LEN, MAVLINK_MSG_ID_CURRENT_MODE_CRC); +#else + mavlink_current_mode_t packet; + packet.custom_mode = custom_mode; + packet.intended_custom_mode = intended_custom_mode; + packet.standard_mode = standard_mode; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CURRENT_MODE, (const char *)&packet, MAVLINK_MSG_ID_CURRENT_MODE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_MODE_LEN, MAVLINK_MSG_ID_CURRENT_MODE_CRC); +#endif +} + +/** + * @brief Send a current_mode message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_current_mode_send_struct(mavlink_channel_t chan, const mavlink_current_mode_t* current_mode) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_current_mode_send(chan, current_mode->standard_mode, current_mode->custom_mode, current_mode->intended_custom_mode); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CURRENT_MODE, (const char *)current_mode, MAVLINK_MSG_ID_CURRENT_MODE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_MODE_LEN, MAVLINK_MSG_ID_CURRENT_MODE_CRC); +#endif +} + +#if MAVLINK_MSG_ID_CURRENT_MODE_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_current_mode_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t standard_mode, uint32_t custom_mode, uint32_t intended_custom_mode) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint32_t(buf, 0, custom_mode); + _mav_put_uint32_t(buf, 4, intended_custom_mode); + _mav_put_uint8_t(buf, 8, standard_mode); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CURRENT_MODE, buf, MAVLINK_MSG_ID_CURRENT_MODE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_MODE_LEN, MAVLINK_MSG_ID_CURRENT_MODE_CRC); +#else + mavlink_current_mode_t *packet = (mavlink_current_mode_t *)msgbuf; + packet->custom_mode = custom_mode; + packet->intended_custom_mode = intended_custom_mode; + packet->standard_mode = standard_mode; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CURRENT_MODE, (const char *)packet, MAVLINK_MSG_ID_CURRENT_MODE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_MODE_LEN, MAVLINK_MSG_ID_CURRENT_MODE_CRC); +#endif +} +#endif + +#endif + +// MESSAGE CURRENT_MODE UNPACKING + + +/** + * @brief Get field standard_mode from current_mode message + * + * @return Standard mode. + */ +static inline uint8_t mavlink_msg_current_mode_get_standard_mode(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 8); +} + +/** + * @brief Get field custom_mode from current_mode message + * + * @return A bitfield for use for autopilot-specific flags + */ +static inline uint32_t mavlink_msg_current_mode_get_custom_mode(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 0); +} + +/** + * @brief Get field intended_custom_mode from current_mode message + * + * @return The custom_mode of the mode that was last commanded by the user (for example, with MAV_CMD_DO_SET_STANDARD_MODE, MAV_CMD_DO_SET_MODE or via RC). This should usually be the same as custom_mode. It will be different if the vehicle is unable to enter the intended mode, or has left that mode due to a failsafe condition. 0 indicates the intended custom mode is unknown/not supplied + */ +static inline uint32_t mavlink_msg_current_mode_get_intended_custom_mode(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 4); +} + +/** + * @brief Decode a current_mode message into a struct + * + * @param msg The message to decode + * @param current_mode C-struct to decode the message contents into + */ +static inline void mavlink_msg_current_mode_decode(const mavlink_message_t* msg, mavlink_current_mode_t* current_mode) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + current_mode->custom_mode = mavlink_msg_current_mode_get_custom_mode(msg); + current_mode->intended_custom_mode = mavlink_msg_current_mode_get_intended_custom_mode(msg); + current_mode->standard_mode = mavlink_msg_current_mode_get_standard_mode(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_CURRENT_MODE_LEN? msg->len : MAVLINK_MSG_ID_CURRENT_MODE_LEN; + memset(current_mode, 0, MAVLINK_MSG_ID_CURRENT_MODE_LEN); + memcpy(current_mode, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/common/mavlink_msg_data_stream.h b/common/mavlink_msg_data_stream.h index 36b688cbe..9436e645c 100644 --- a/common/mavlink_msg_data_stream.h +++ b/common/mavlink_msg_data_stream.h @@ -75,6 +75,45 @@ static inline uint16_t mavlink_msg_data_stream_pack(uint8_t system_id, uint8_t c return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DATA_STREAM_MIN_LEN, MAVLINK_MSG_ID_DATA_STREAM_LEN, MAVLINK_MSG_ID_DATA_STREAM_CRC); } +/** + * @brief Pack a data_stream message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param stream_id The ID of the requested data stream + * @param message_rate [Hz] The message rate + * @param on_off 1 stream is enabled, 0 stream is stopped. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_data_stream_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t stream_id, uint16_t message_rate, uint8_t on_off) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_DATA_STREAM_LEN]; + _mav_put_uint16_t(buf, 0, message_rate); + _mav_put_uint8_t(buf, 2, stream_id); + _mav_put_uint8_t(buf, 3, on_off); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DATA_STREAM_LEN); +#else + mavlink_data_stream_t packet; + packet.message_rate = message_rate; + packet.stream_id = stream_id; + packet.on_off = on_off; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DATA_STREAM_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_DATA_STREAM; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_DATA_STREAM_MIN_LEN, MAVLINK_MSG_ID_DATA_STREAM_LEN, MAVLINK_MSG_ID_DATA_STREAM_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_DATA_STREAM_MIN_LEN, MAVLINK_MSG_ID_DATA_STREAM_LEN); +#endif +} + /** * @brief Pack a data_stream message on a channel * @param system_id ID of this system @@ -137,6 +176,20 @@ static inline uint16_t mavlink_msg_data_stream_encode_chan(uint8_t system_id, ui return mavlink_msg_data_stream_pack_chan(system_id, component_id, chan, msg, data_stream->stream_id, data_stream->message_rate, data_stream->on_off); } +/** + * @brief Encode a data_stream struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param data_stream C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_data_stream_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_data_stream_t* data_stream) +{ + return mavlink_msg_data_stream_pack_status(system_id, component_id, _status, msg, data_stream->stream_id, data_stream->message_rate, data_stream->on_off); +} + /** * @brief Send a data_stream message * @param chan MAVLink channel to send the message @@ -182,7 +235,7 @@ static inline void mavlink_msg_data_stream_send_struct(mavlink_channel_t chan, c #if MAVLINK_MSG_ID_DATA_STREAM_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_data_transmission_handshake.h b/common/mavlink_msg_data_transmission_handshake.h index 45fe60680..aa6d551ee 100644 --- a/common/mavlink_msg_data_transmission_handshake.h +++ b/common/mavlink_msg_data_transmission_handshake.h @@ -99,6 +99,57 @@ static inline uint16_t mavlink_msg_data_transmission_handshake_pack(uint8_t syst return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_MIN_LEN, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_CRC); } +/** + * @brief Pack a data_transmission_handshake message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param type Type of requested/acknowledged data. + * @param size [bytes] total data size (set on ACK only). + * @param width Width of a matrix or image. + * @param height Height of a matrix or image. + * @param packets Number of packets being sent (set on ACK only). + * @param payload [bytes] Payload size per packet (normally 253 byte, see DATA field size in message ENCAPSULATED_DATA) (set on ACK only). + * @param jpg_quality [%] JPEG quality. Values: [1-100]. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_data_transmission_handshake_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t type, uint32_t size, uint16_t width, uint16_t height, uint16_t packets, uint8_t payload, uint8_t jpg_quality) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN]; + _mav_put_uint32_t(buf, 0, size); + _mav_put_uint16_t(buf, 4, width); + _mav_put_uint16_t(buf, 6, height); + _mav_put_uint16_t(buf, 8, packets); + _mav_put_uint8_t(buf, 10, type); + _mav_put_uint8_t(buf, 11, payload); + _mav_put_uint8_t(buf, 12, jpg_quality); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN); +#else + mavlink_data_transmission_handshake_t packet; + packet.size = size; + packet.width = width; + packet.height = height; + packet.packets = packets; + packet.type = type; + packet.payload = payload; + packet.jpg_quality = jpg_quality; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_MIN_LEN, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_MIN_LEN, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN); +#endif +} + /** * @brief Pack a data_transmission_handshake message on a channel * @param system_id ID of this system @@ -173,6 +224,20 @@ static inline uint16_t mavlink_msg_data_transmission_handshake_encode_chan(uint8 return mavlink_msg_data_transmission_handshake_pack_chan(system_id, component_id, chan, msg, data_transmission_handshake->type, data_transmission_handshake->size, data_transmission_handshake->width, data_transmission_handshake->height, data_transmission_handshake->packets, data_transmission_handshake->payload, data_transmission_handshake->jpg_quality); } +/** + * @brief Encode a data_transmission_handshake struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param data_transmission_handshake C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_data_transmission_handshake_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_data_transmission_handshake_t* data_transmission_handshake) +{ + return mavlink_msg_data_transmission_handshake_pack_status(system_id, component_id, _status, msg, data_transmission_handshake->type, data_transmission_handshake->size, data_transmission_handshake->width, data_transmission_handshake->height, data_transmission_handshake->packets, data_transmission_handshake->payload, data_transmission_handshake->jpg_quality); +} + /** * @brief Send a data_transmission_handshake message * @param chan MAVLink channel to send the message @@ -230,7 +295,7 @@ static inline void mavlink_msg_data_transmission_handshake_send_struct(mavlink_c #if MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_debug.h b/common/mavlink_msg_debug.h index 85814e366..ffb11509a 100644 --- a/common/mavlink_msg_debug.h +++ b/common/mavlink_msg_debug.h @@ -75,6 +75,45 @@ static inline uint16_t mavlink_msg_debug_pack(uint8_t system_id, uint8_t compone return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DEBUG_MIN_LEN, MAVLINK_MSG_ID_DEBUG_LEN, MAVLINK_MSG_ID_DEBUG_CRC); } +/** + * @brief Pack a debug message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param ind index of debug variable + * @param value DEBUG value + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_debug_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, uint8_t ind, float value) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_DEBUG_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_float(buf, 4, value); + _mav_put_uint8_t(buf, 8, ind); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DEBUG_LEN); +#else + mavlink_debug_t packet; + packet.time_boot_ms = time_boot_ms; + packet.value = value; + packet.ind = ind; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DEBUG_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_DEBUG; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_DEBUG_MIN_LEN, MAVLINK_MSG_ID_DEBUG_LEN, MAVLINK_MSG_ID_DEBUG_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_DEBUG_MIN_LEN, MAVLINK_MSG_ID_DEBUG_LEN); +#endif +} + /** * @brief Pack a debug message on a channel * @param system_id ID of this system @@ -137,6 +176,20 @@ static inline uint16_t mavlink_msg_debug_encode_chan(uint8_t system_id, uint8_t return mavlink_msg_debug_pack_chan(system_id, component_id, chan, msg, debug->time_boot_ms, debug->ind, debug->value); } +/** + * @brief Encode a debug struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param debug C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_debug_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_debug_t* debug) +{ + return mavlink_msg_debug_pack_status(system_id, component_id, _status, msg, debug->time_boot_ms, debug->ind, debug->value); +} + /** * @brief Send a debug message * @param chan MAVLink channel to send the message @@ -182,7 +235,7 @@ static inline void mavlink_msg_debug_send_struct(mavlink_channel_t chan, const m #if MAVLINK_MSG_ID_DEBUG_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_debug_float_array.h b/common/mavlink_msg_debug_float_array.h index c3a8b31fb..c17a0de62 100644 --- a/common/mavlink_msg_debug_float_array.h +++ b/common/mavlink_msg_debug_float_array.h @@ -60,6 +60,42 @@ typedef struct __mavlink_debug_float_array_t { static inline uint16_t mavlink_msg_debug_float_array_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint64_t time_usec, const char *name, uint16_t array_id, const float *data) { +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint16_t(buf, 8, array_id); + _mav_put_char_array(buf, 10, name, 10); + _mav_put_float_array(buf, 20, data, 58); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_LEN); +#else + mavlink_debug_float_array_t packet; + packet.time_usec = time_usec; + packet.array_id = array_id; + mav_array_assign_char(packet.name, name, 10); + mav_array_assign_float(packet.data, data, 58); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_MIN_LEN, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_LEN, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_CRC); +} + +/** + * @brief Pack a debug_float_array message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param name Name, for human-friendly display in a Ground Control Station + * @param array_id Unique ID used to discriminate between arrays + * @param data data + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_debug_float_array_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, const char *name, uint16_t array_id, const float *data) +{ #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_LEN]; _mav_put_uint64_t(buf, 0, time_usec); @@ -77,7 +113,11 @@ static inline uint16_t mavlink_msg_debug_float_array_pack(uint8_t system_id, uin #endif msg->msgid = MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_MIN_LEN, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_LEN, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_CRC); +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_MIN_LEN, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_LEN, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_MIN_LEN, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_LEN); +#endif } /** @@ -107,8 +147,8 @@ static inline uint16_t mavlink_msg_debug_float_array_pack_chan(uint8_t system_id mavlink_debug_float_array_t packet; packet.time_usec = time_usec; packet.array_id = array_id; - mav_array_memcpy(packet.name, name, sizeof(char)*10); - mav_array_memcpy(packet.data, data, sizeof(float)*58); + mav_array_assign_char(packet.name, name, 10); + mav_array_assign_float(packet.data, data, 58); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_LEN); #endif @@ -143,6 +183,20 @@ static inline uint16_t mavlink_msg_debug_float_array_encode_chan(uint8_t system_ return mavlink_msg_debug_float_array_pack_chan(system_id, component_id, chan, msg, debug_float_array->time_usec, debug_float_array->name, debug_float_array->array_id, debug_float_array->data); } +/** + * @brief Encode a debug_float_array struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param debug_float_array C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_debug_float_array_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_debug_float_array_t* debug_float_array) +{ + return mavlink_msg_debug_float_array_pack_status(system_id, component_id, _status, msg, debug_float_array->time_usec, debug_float_array->name, debug_float_array->array_id, debug_float_array->data); +} + /** * @brief Send a debug_float_array message * @param chan MAVLink channel to send the message @@ -167,8 +221,8 @@ static inline void mavlink_msg_debug_float_array_send(mavlink_channel_t chan, ui mavlink_debug_float_array_t packet; packet.time_usec = time_usec; packet.array_id = array_id; - mav_array_memcpy(packet.name, name, sizeof(char)*10); - mav_array_memcpy(packet.data, data, sizeof(float)*58); + mav_array_assign_char(packet.name, name, 10); + mav_array_assign_float(packet.data, data, 58); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY, (const char *)&packet, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_MIN_LEN, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_LEN, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_CRC); #endif } @@ -189,7 +243,7 @@ static inline void mavlink_msg_debug_float_array_send_struct(mavlink_channel_t c #if MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -208,8 +262,8 @@ static inline void mavlink_msg_debug_float_array_send_buf(mavlink_message_t *msg mavlink_debug_float_array_t *packet = (mavlink_debug_float_array_t *)msgbuf; packet->time_usec = time_usec; packet->array_id = array_id; - mav_array_memcpy(packet->name, name, sizeof(char)*10); - mav_array_memcpy(packet->data, data, sizeof(float)*58); + mav_array_assign_char(packet->name, name, 10); + mav_array_assign_float(packet->data, data, 58); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY, (const char *)packet, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_MIN_LEN, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_LEN, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_CRC); #endif } diff --git a/common/mavlink_msg_debug_vect.h b/common/mavlink_msg_debug_vect.h index 1cb8d77ab..3bd4a5102 100644 --- a/common/mavlink_msg_debug_vect.h +++ b/common/mavlink_msg_debug_vect.h @@ -77,7 +77,7 @@ static inline uint16_t mavlink_msg_debug_vect_pack(uint8_t system_id, uint8_t co packet.x = x; packet.y = y; packet.z = z; - mav_array_memcpy(packet.name, name, sizeof(char)*10); + mav_array_assign_char(packet.name, name, 10); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DEBUG_VECT_LEN); #endif @@ -85,6 +85,49 @@ static inline uint16_t mavlink_msg_debug_vect_pack(uint8_t system_id, uint8_t co return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DEBUG_VECT_MIN_LEN, MAVLINK_MSG_ID_DEBUG_VECT_LEN, MAVLINK_MSG_ID_DEBUG_VECT_CRC); } +/** + * @brief Pack a debug_vect message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param name Name + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param x x + * @param y y + * @param z z + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_debug_vect_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + const char *name, uint64_t time_usec, float x, float y, float z) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_DEBUG_VECT_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, x); + _mav_put_float(buf, 12, y); + _mav_put_float(buf, 16, z); + _mav_put_char_array(buf, 20, name, 10); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DEBUG_VECT_LEN); +#else + mavlink_debug_vect_t packet; + packet.time_usec = time_usec; + packet.x = x; + packet.y = y; + packet.z = z; + mav_array_memcpy(packet.name, name, sizeof(char)*10); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DEBUG_VECT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_DEBUG_VECT; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_DEBUG_VECT_MIN_LEN, MAVLINK_MSG_ID_DEBUG_VECT_LEN, MAVLINK_MSG_ID_DEBUG_VECT_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_DEBUG_VECT_MIN_LEN, MAVLINK_MSG_ID_DEBUG_VECT_LEN); +#endif +} + /** * @brief Pack a debug_vect message on a channel * @param system_id ID of this system @@ -116,7 +159,7 @@ static inline uint16_t mavlink_msg_debug_vect_pack_chan(uint8_t system_id, uint8 packet.x = x; packet.y = y; packet.z = z; - mav_array_memcpy(packet.name, name, sizeof(char)*10); + mav_array_assign_char(packet.name, name, 10); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DEBUG_VECT_LEN); #endif @@ -151,6 +194,20 @@ static inline uint16_t mavlink_msg_debug_vect_encode_chan(uint8_t system_id, uin return mavlink_msg_debug_vect_pack_chan(system_id, component_id, chan, msg, debug_vect->name, debug_vect->time_usec, debug_vect->x, debug_vect->y, debug_vect->z); } +/** + * @brief Encode a debug_vect struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param debug_vect C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_debug_vect_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_debug_vect_t* debug_vect) +{ + return mavlink_msg_debug_vect_pack_status(system_id, component_id, _status, msg, debug_vect->name, debug_vect->time_usec, debug_vect->x, debug_vect->y, debug_vect->z); +} + /** * @brief Send a debug_vect message * @param chan MAVLink channel to send the message @@ -179,7 +236,7 @@ static inline void mavlink_msg_debug_vect_send(mavlink_channel_t chan, const cha packet.x = x; packet.y = y; packet.z = z; - mav_array_memcpy(packet.name, name, sizeof(char)*10); + mav_array_assign_char(packet.name, name, 10); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG_VECT, (const char *)&packet, MAVLINK_MSG_ID_DEBUG_VECT_MIN_LEN, MAVLINK_MSG_ID_DEBUG_VECT_LEN, MAVLINK_MSG_ID_DEBUG_VECT_CRC); #endif } @@ -200,7 +257,7 @@ static inline void mavlink_msg_debug_vect_send_struct(mavlink_channel_t chan, co #if MAVLINK_MSG_ID_DEBUG_VECT_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -222,7 +279,7 @@ static inline void mavlink_msg_debug_vect_send_buf(mavlink_message_t *msgbuf, ma packet->x = x; packet->y = y; packet->z = z; - mav_array_memcpy(packet->name, name, sizeof(char)*10); + mav_array_assign_char(packet->name, name, 10); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG_VECT, (const char *)packet, MAVLINK_MSG_ID_DEBUG_VECT_MIN_LEN, MAVLINK_MSG_ID_DEBUG_VECT_LEN, MAVLINK_MSG_ID_DEBUG_VECT_CRC); #endif } diff --git a/common/mavlink_msg_distance_sensor.h b/common/mavlink_msg_distance_sensor.h index 7e4e85040..adf30f78a 100644 --- a/common/mavlink_msg_distance_sensor.h +++ b/common/mavlink_msg_distance_sensor.h @@ -12,7 +12,7 @@ typedef struct __mavlink_distance_sensor_t { uint8_t type; /*< Type of distance sensor.*/ uint8_t id; /*< Onboard ID of the sensor*/ uint8_t orientation; /*< Direction the sensor faces. downward-facing: ROTATION_PITCH_270, upward-facing: ROTATION_PITCH_90, backward-facing: ROTATION_PITCH_180, forward-facing: ROTATION_NONE, left-facing: ROTATION_YAW_90, right-facing: ROTATION_YAW_270*/ - uint8_t covariance; /*< [cm^2] Measurement variance. Max standard deviation is 6cm. 255 if unknown.*/ + uint8_t covariance; /*< [cm^2] Measurement variance. Max standard deviation is 6cm. UINT8_MAX if unknown.*/ float horizontal_fov; /*< [rad] Horizontal Field of View (angle) where the distance measurement is valid and the field of view is known. Otherwise this is set to 0.*/ float vertical_fov; /*< [rad] Vertical Field of View (angle) where the distance measurement is valid and the field of view is known. Otherwise this is set to 0.*/ float quaternion[4]; /*< Quaternion of the sensor orientation in vehicle body frame (w, x, y, z order, zero-rotation is 1, 0, 0, 0). Zero-rotation is along the vehicle body x-axis. This field is required if the orientation is set to MAV_SENSOR_ROTATION_CUSTOM. Set it to 0 if invalid."*/ @@ -81,7 +81,7 @@ typedef struct __mavlink_distance_sensor_t { * @param type Type of distance sensor. * @param id Onboard ID of the sensor * @param orientation Direction the sensor faces. downward-facing: ROTATION_PITCH_270, upward-facing: ROTATION_PITCH_90, backward-facing: ROTATION_PITCH_180, forward-facing: ROTATION_NONE, left-facing: ROTATION_YAW_90, right-facing: ROTATION_YAW_270 - * @param covariance [cm^2] Measurement variance. Max standard deviation is 6cm. 255 if unknown. + * @param covariance [cm^2] Measurement variance. Max standard deviation is 6cm. UINT8_MAX if unknown. * @param horizontal_fov [rad] Horizontal Field of View (angle) where the distance measurement is valid and the field of view is known. Otherwise this is set to 0. * @param vertical_fov [rad] Vertical Field of View (angle) where the distance measurement is valid and the field of view is known. Otherwise this is set to 0. * @param quaternion Quaternion of the sensor orientation in vehicle body frame (w, x, y, z order, zero-rotation is 1, 0, 0, 0). Zero-rotation is along the vehicle body x-axis. This field is required if the orientation is set to MAV_SENSOR_ROTATION_CUSTOM. Set it to 0 if invalid." @@ -119,7 +119,7 @@ static inline uint16_t mavlink_msg_distance_sensor_pack(uint8_t system_id, uint8 packet.horizontal_fov = horizontal_fov; packet.vertical_fov = vertical_fov; packet.signal_quality = signal_quality; - mav_array_memcpy(packet.quaternion, quaternion, sizeof(float)*4); + mav_array_assign_float(packet.quaternion, quaternion, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN); #endif @@ -127,6 +127,70 @@ static inline uint16_t mavlink_msg_distance_sensor_pack(uint8_t system_id, uint8 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DISTANCE_SENSOR_MIN_LEN, MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN, MAVLINK_MSG_ID_DISTANCE_SENSOR_CRC); } +/** + * @brief Pack a distance_sensor message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param min_distance [cm] Minimum distance the sensor can measure + * @param max_distance [cm] Maximum distance the sensor can measure + * @param current_distance [cm] Current distance reading + * @param type Type of distance sensor. + * @param id Onboard ID of the sensor + * @param orientation Direction the sensor faces. downward-facing: ROTATION_PITCH_270, upward-facing: ROTATION_PITCH_90, backward-facing: ROTATION_PITCH_180, forward-facing: ROTATION_NONE, left-facing: ROTATION_YAW_90, right-facing: ROTATION_YAW_270 + * @param covariance [cm^2] Measurement variance. Max standard deviation is 6cm. UINT8_MAX if unknown. + * @param horizontal_fov [rad] Horizontal Field of View (angle) where the distance measurement is valid and the field of view is known. Otherwise this is set to 0. + * @param vertical_fov [rad] Vertical Field of View (angle) where the distance measurement is valid and the field of view is known. Otherwise this is set to 0. + * @param quaternion Quaternion of the sensor orientation in vehicle body frame (w, x, y, z order, zero-rotation is 1, 0, 0, 0). Zero-rotation is along the vehicle body x-axis. This field is required if the orientation is set to MAV_SENSOR_ROTATION_CUSTOM. Set it to 0 if invalid." + * @param signal_quality [%] Signal quality of the sensor. Specific to each sensor type, representing the relation of the signal strength with the target reflectivity, distance, size or aspect, but normalised as a percentage. 0 = unknown/unset signal quality, 1 = invalid signal, 100 = perfect signal. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_distance_sensor_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, uint16_t min_distance, uint16_t max_distance, uint16_t current_distance, uint8_t type, uint8_t id, uint8_t orientation, uint8_t covariance, float horizontal_fov, float vertical_fov, const float *quaternion, uint8_t signal_quality) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_uint16_t(buf, 4, min_distance); + _mav_put_uint16_t(buf, 6, max_distance); + _mav_put_uint16_t(buf, 8, current_distance); + _mav_put_uint8_t(buf, 10, type); + _mav_put_uint8_t(buf, 11, id); + _mav_put_uint8_t(buf, 12, orientation); + _mav_put_uint8_t(buf, 13, covariance); + _mav_put_float(buf, 14, horizontal_fov); + _mav_put_float(buf, 18, vertical_fov); + _mav_put_uint8_t(buf, 38, signal_quality); + _mav_put_float_array(buf, 22, quaternion, 4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN); +#else + mavlink_distance_sensor_t packet; + packet.time_boot_ms = time_boot_ms; + packet.min_distance = min_distance; + packet.max_distance = max_distance; + packet.current_distance = current_distance; + packet.type = type; + packet.id = id; + packet.orientation = orientation; + packet.covariance = covariance; + packet.horizontal_fov = horizontal_fov; + packet.vertical_fov = vertical_fov; + packet.signal_quality = signal_quality; + mav_array_memcpy(packet.quaternion, quaternion, sizeof(float)*4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_DISTANCE_SENSOR; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_DISTANCE_SENSOR_MIN_LEN, MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN, MAVLINK_MSG_ID_DISTANCE_SENSOR_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_DISTANCE_SENSOR_MIN_LEN, MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN); +#endif +} + /** * @brief Pack a distance_sensor message on a channel * @param system_id ID of this system @@ -140,7 +204,7 @@ static inline uint16_t mavlink_msg_distance_sensor_pack(uint8_t system_id, uint8 * @param type Type of distance sensor. * @param id Onboard ID of the sensor * @param orientation Direction the sensor faces. downward-facing: ROTATION_PITCH_270, upward-facing: ROTATION_PITCH_90, backward-facing: ROTATION_PITCH_180, forward-facing: ROTATION_NONE, left-facing: ROTATION_YAW_90, right-facing: ROTATION_YAW_270 - * @param covariance [cm^2] Measurement variance. Max standard deviation is 6cm. 255 if unknown. + * @param covariance [cm^2] Measurement variance. Max standard deviation is 6cm. UINT8_MAX if unknown. * @param horizontal_fov [rad] Horizontal Field of View (angle) where the distance measurement is valid and the field of view is known. Otherwise this is set to 0. * @param vertical_fov [rad] Vertical Field of View (angle) where the distance measurement is valid and the field of view is known. Otherwise this is set to 0. * @param quaternion Quaternion of the sensor orientation in vehicle body frame (w, x, y, z order, zero-rotation is 1, 0, 0, 0). Zero-rotation is along the vehicle body x-axis. This field is required if the orientation is set to MAV_SENSOR_ROTATION_CUSTOM. Set it to 0 if invalid." @@ -179,7 +243,7 @@ static inline uint16_t mavlink_msg_distance_sensor_pack_chan(uint8_t system_id, packet.horizontal_fov = horizontal_fov; packet.vertical_fov = vertical_fov; packet.signal_quality = signal_quality; - mav_array_memcpy(packet.quaternion, quaternion, sizeof(float)*4); + mav_array_assign_float(packet.quaternion, quaternion, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN); #endif @@ -214,6 +278,20 @@ static inline uint16_t mavlink_msg_distance_sensor_encode_chan(uint8_t system_id return mavlink_msg_distance_sensor_pack_chan(system_id, component_id, chan, msg, distance_sensor->time_boot_ms, distance_sensor->min_distance, distance_sensor->max_distance, distance_sensor->current_distance, distance_sensor->type, distance_sensor->id, distance_sensor->orientation, distance_sensor->covariance, distance_sensor->horizontal_fov, distance_sensor->vertical_fov, distance_sensor->quaternion, distance_sensor->signal_quality); } +/** + * @brief Encode a distance_sensor struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param distance_sensor C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_distance_sensor_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_distance_sensor_t* distance_sensor) +{ + return mavlink_msg_distance_sensor_pack_status(system_id, component_id, _status, msg, distance_sensor->time_boot_ms, distance_sensor->min_distance, distance_sensor->max_distance, distance_sensor->current_distance, distance_sensor->type, distance_sensor->id, distance_sensor->orientation, distance_sensor->covariance, distance_sensor->horizontal_fov, distance_sensor->vertical_fov, distance_sensor->quaternion, distance_sensor->signal_quality); +} + /** * @brief Send a distance_sensor message * @param chan MAVLink channel to send the message @@ -225,7 +303,7 @@ static inline uint16_t mavlink_msg_distance_sensor_encode_chan(uint8_t system_id * @param type Type of distance sensor. * @param id Onboard ID of the sensor * @param orientation Direction the sensor faces. downward-facing: ROTATION_PITCH_270, upward-facing: ROTATION_PITCH_90, backward-facing: ROTATION_PITCH_180, forward-facing: ROTATION_NONE, left-facing: ROTATION_YAW_90, right-facing: ROTATION_YAW_270 - * @param covariance [cm^2] Measurement variance. Max standard deviation is 6cm. 255 if unknown. + * @param covariance [cm^2] Measurement variance. Max standard deviation is 6cm. UINT8_MAX if unknown. * @param horizontal_fov [rad] Horizontal Field of View (angle) where the distance measurement is valid and the field of view is known. Otherwise this is set to 0. * @param vertical_fov [rad] Vertical Field of View (angle) where the distance measurement is valid and the field of view is known. Otherwise this is set to 0. * @param quaternion Quaternion of the sensor orientation in vehicle body frame (w, x, y, z order, zero-rotation is 1, 0, 0, 0). Zero-rotation is along the vehicle body x-axis. This field is required if the orientation is set to MAV_SENSOR_ROTATION_CUSTOM. Set it to 0 if invalid." @@ -263,7 +341,7 @@ static inline void mavlink_msg_distance_sensor_send(mavlink_channel_t chan, uint packet.horizontal_fov = horizontal_fov; packet.vertical_fov = vertical_fov; packet.signal_quality = signal_quality; - mav_array_memcpy(packet.quaternion, quaternion, sizeof(float)*4); + mav_array_assign_float(packet.quaternion, quaternion, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DISTANCE_SENSOR, (const char *)&packet, MAVLINK_MSG_ID_DISTANCE_SENSOR_MIN_LEN, MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN, MAVLINK_MSG_ID_DISTANCE_SENSOR_CRC); #endif } @@ -284,7 +362,7 @@ static inline void mavlink_msg_distance_sensor_send_struct(mavlink_channel_t cha #if MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -320,7 +398,7 @@ static inline void mavlink_msg_distance_sensor_send_buf(mavlink_message_t *msgbu packet->horizontal_fov = horizontal_fov; packet->vertical_fov = vertical_fov; packet->signal_quality = signal_quality; - mav_array_memcpy(packet->quaternion, quaternion, sizeof(float)*4); + mav_array_assign_float(packet->quaternion, quaternion, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DISTANCE_SENSOR, (const char *)packet, MAVLINK_MSG_ID_DISTANCE_SENSOR_MIN_LEN, MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN, MAVLINK_MSG_ID_DISTANCE_SENSOR_CRC); #endif } @@ -404,7 +482,7 @@ static inline uint8_t mavlink_msg_distance_sensor_get_orientation(const mavlink_ /** * @brief Get field covariance from distance_sensor message * - * @return [cm^2] Measurement variance. Max standard deviation is 6cm. 255 if unknown. + * @return [cm^2] Measurement variance. Max standard deviation is 6cm. UINT8_MAX if unknown. */ static inline uint8_t mavlink_msg_distance_sensor_get_covariance(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_efi_status.h b/common/mavlink_msg_efi_status.h index d63102404..70d3f5ce2 100644 --- a/common/mavlink_msg_efi_status.h +++ b/common/mavlink_msg_efi_status.h @@ -3,7 +3,7 @@ #define MAVLINK_MSG_ID_EFI_STATUS 225 - +MAVPACKED( typedef struct __mavlink_efi_status_t { float ecu_index; /*< ECU index*/ float rpm; /*< RPM*/ @@ -22,11 +22,13 @@ typedef struct __mavlink_efi_status_t { float throttle_out; /*< [%] Output throttle*/ float pt_compensation; /*< Pressure/temperature compensation*/ uint8_t health; /*< EFI health status*/ -} mavlink_efi_status_t; + float ignition_voltage; /*< [V] Supply voltage to EFI sparking system. Zero in this value means "unknown", so if the supply voltage really is zero volts use 0.0001 instead.*/ + float fuel_pressure; /*< [kPa] Fuel pressure. Zero in this value means "unknown", so if the fuel pressure really is zero kPa use 0.0001 instead.*/ +}) mavlink_efi_status_t; -#define MAVLINK_MSG_ID_EFI_STATUS_LEN 65 +#define MAVLINK_MSG_ID_EFI_STATUS_LEN 73 #define MAVLINK_MSG_ID_EFI_STATUS_MIN_LEN 65 -#define MAVLINK_MSG_ID_225_LEN 65 +#define MAVLINK_MSG_ID_225_LEN 73 #define MAVLINK_MSG_ID_225_MIN_LEN 65 #define MAVLINK_MSG_ID_EFI_STATUS_CRC 208 @@ -38,7 +40,7 @@ typedef struct __mavlink_efi_status_t { #define MAVLINK_MESSAGE_INFO_EFI_STATUS { \ 225, \ "EFI_STATUS", \ - 17, \ + 19, \ { { "health", NULL, MAVLINK_TYPE_UINT8_T, 0, 64, offsetof(mavlink_efi_status_t, health) }, \ { "ecu_index", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_efi_status_t, ecu_index) }, \ { "rpm", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_efi_status_t, rpm) }, \ @@ -56,12 +58,14 @@ typedef struct __mavlink_efi_status_t { { "exhaust_gas_temperature", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_efi_status_t, exhaust_gas_temperature) }, \ { "throttle_out", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_efi_status_t, throttle_out) }, \ { "pt_compensation", NULL, MAVLINK_TYPE_FLOAT, 0, 60, offsetof(mavlink_efi_status_t, pt_compensation) }, \ + { "ignition_voltage", NULL, MAVLINK_TYPE_FLOAT, 0, 65, offsetof(mavlink_efi_status_t, ignition_voltage) }, \ + { "fuel_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 69, offsetof(mavlink_efi_status_t, fuel_pressure) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_EFI_STATUS { \ "EFI_STATUS", \ - 17, \ + 19, \ { { "health", NULL, MAVLINK_TYPE_UINT8_T, 0, 64, offsetof(mavlink_efi_status_t, health) }, \ { "ecu_index", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_efi_status_t, ecu_index) }, \ { "rpm", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_efi_status_t, rpm) }, \ @@ -79,6 +83,8 @@ typedef struct __mavlink_efi_status_t { { "exhaust_gas_temperature", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_efi_status_t, exhaust_gas_temperature) }, \ { "throttle_out", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_efi_status_t, throttle_out) }, \ { "pt_compensation", NULL, MAVLINK_TYPE_FLOAT, 0, 60, offsetof(mavlink_efi_status_t, pt_compensation) }, \ + { "ignition_voltage", NULL, MAVLINK_TYPE_FLOAT, 0, 65, offsetof(mavlink_efi_status_t, ignition_voltage) }, \ + { "fuel_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 69, offsetof(mavlink_efi_status_t, fuel_pressure) }, \ } \ } #endif @@ -106,10 +112,12 @@ typedef struct __mavlink_efi_status_t { * @param exhaust_gas_temperature [degC] Exhaust gas temperature * @param throttle_out [%] Output throttle * @param pt_compensation Pressure/temperature compensation + * @param ignition_voltage [V] Supply voltage to EFI sparking system. Zero in this value means "unknown", so if the supply voltage really is zero volts use 0.0001 instead. + * @param fuel_pressure [kPa] Fuel pressure. Zero in this value means "unknown", so if the fuel pressure really is zero kPa use 0.0001 instead. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_efi_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t health, float ecu_index, float rpm, float fuel_consumed, float fuel_flow, float engine_load, float throttle_position, float spark_dwell_time, float barometric_pressure, float intake_manifold_pressure, float intake_manifold_temperature, float cylinder_head_temperature, float ignition_timing, float injection_time, float exhaust_gas_temperature, float throttle_out, float pt_compensation) + uint8_t health, float ecu_index, float rpm, float fuel_consumed, float fuel_flow, float engine_load, float throttle_position, float spark_dwell_time, float barometric_pressure, float intake_manifold_pressure, float intake_manifold_temperature, float cylinder_head_temperature, float ignition_timing, float injection_time, float exhaust_gas_temperature, float throttle_out, float pt_compensation, float ignition_voltage, float fuel_pressure) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_EFI_STATUS_LEN]; @@ -130,6 +138,8 @@ static inline uint16_t mavlink_msg_efi_status_pack(uint8_t system_id, uint8_t co _mav_put_float(buf, 56, throttle_out); _mav_put_float(buf, 60, pt_compensation); _mav_put_uint8_t(buf, 64, health); + _mav_put_float(buf, 65, ignition_voltage); + _mav_put_float(buf, 69, fuel_pressure); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_EFI_STATUS_LEN); #else @@ -151,6 +161,8 @@ static inline uint16_t mavlink_msg_efi_status_pack(uint8_t system_id, uint8_t co packet.throttle_out = throttle_out; packet.pt_compensation = pt_compensation; packet.health = health; + packet.ignition_voltage = ignition_voltage; + packet.fuel_pressure = fuel_pressure; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_EFI_STATUS_LEN); #endif @@ -159,6 +171,93 @@ static inline uint16_t mavlink_msg_efi_status_pack(uint8_t system_id, uint8_t co return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_EFI_STATUS_MIN_LEN, MAVLINK_MSG_ID_EFI_STATUS_LEN, MAVLINK_MSG_ID_EFI_STATUS_CRC); } +/** + * @brief Pack a efi_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param health EFI health status + * @param ecu_index ECU index + * @param rpm RPM + * @param fuel_consumed [cm^3] Fuel consumed + * @param fuel_flow [cm^3/min] Fuel flow rate + * @param engine_load [%] Engine load + * @param throttle_position [%] Throttle position + * @param spark_dwell_time [ms] Spark dwell time + * @param barometric_pressure [kPa] Barometric pressure + * @param intake_manifold_pressure [kPa] Intake manifold pressure( + * @param intake_manifold_temperature [degC] Intake manifold temperature + * @param cylinder_head_temperature [degC] Cylinder head temperature + * @param ignition_timing [deg] Ignition timing (Crank angle degrees) + * @param injection_time [ms] Injection time + * @param exhaust_gas_temperature [degC] Exhaust gas temperature + * @param throttle_out [%] Output throttle + * @param pt_compensation Pressure/temperature compensation + * @param ignition_voltage [V] Supply voltage to EFI sparking system. Zero in this value means "unknown", so if the supply voltage really is zero volts use 0.0001 instead. + * @param fuel_pressure [kPa] Fuel pressure. Zero in this value means "unknown", so if the fuel pressure really is zero kPa use 0.0001 instead. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_efi_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t health, float ecu_index, float rpm, float fuel_consumed, float fuel_flow, float engine_load, float throttle_position, float spark_dwell_time, float barometric_pressure, float intake_manifold_pressure, float intake_manifold_temperature, float cylinder_head_temperature, float ignition_timing, float injection_time, float exhaust_gas_temperature, float throttle_out, float pt_compensation, float ignition_voltage, float fuel_pressure) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_EFI_STATUS_LEN]; + _mav_put_float(buf, 0, ecu_index); + _mav_put_float(buf, 4, rpm); + _mav_put_float(buf, 8, fuel_consumed); + _mav_put_float(buf, 12, fuel_flow); + _mav_put_float(buf, 16, engine_load); + _mav_put_float(buf, 20, throttle_position); + _mav_put_float(buf, 24, spark_dwell_time); + _mav_put_float(buf, 28, barometric_pressure); + _mav_put_float(buf, 32, intake_manifold_pressure); + _mav_put_float(buf, 36, intake_manifold_temperature); + _mav_put_float(buf, 40, cylinder_head_temperature); + _mav_put_float(buf, 44, ignition_timing); + _mav_put_float(buf, 48, injection_time); + _mav_put_float(buf, 52, exhaust_gas_temperature); + _mav_put_float(buf, 56, throttle_out); + _mav_put_float(buf, 60, pt_compensation); + _mav_put_uint8_t(buf, 64, health); + _mav_put_float(buf, 65, ignition_voltage); + _mav_put_float(buf, 69, fuel_pressure); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_EFI_STATUS_LEN); +#else + mavlink_efi_status_t packet; + packet.ecu_index = ecu_index; + packet.rpm = rpm; + packet.fuel_consumed = fuel_consumed; + packet.fuel_flow = fuel_flow; + packet.engine_load = engine_load; + packet.throttle_position = throttle_position; + packet.spark_dwell_time = spark_dwell_time; + packet.barometric_pressure = barometric_pressure; + packet.intake_manifold_pressure = intake_manifold_pressure; + packet.intake_manifold_temperature = intake_manifold_temperature; + packet.cylinder_head_temperature = cylinder_head_temperature; + packet.ignition_timing = ignition_timing; + packet.injection_time = injection_time; + packet.exhaust_gas_temperature = exhaust_gas_temperature; + packet.throttle_out = throttle_out; + packet.pt_compensation = pt_compensation; + packet.health = health; + packet.ignition_voltage = ignition_voltage; + packet.fuel_pressure = fuel_pressure; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_EFI_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_EFI_STATUS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_EFI_STATUS_MIN_LEN, MAVLINK_MSG_ID_EFI_STATUS_LEN, MAVLINK_MSG_ID_EFI_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_EFI_STATUS_MIN_LEN, MAVLINK_MSG_ID_EFI_STATUS_LEN); +#endif +} + /** * @brief Pack a efi_status message on a channel * @param system_id ID of this system @@ -182,11 +281,13 @@ static inline uint16_t mavlink_msg_efi_status_pack(uint8_t system_id, uint8_t co * @param exhaust_gas_temperature [degC] Exhaust gas temperature * @param throttle_out [%] Output throttle * @param pt_compensation Pressure/temperature compensation + * @param ignition_voltage [V] Supply voltage to EFI sparking system. Zero in this value means "unknown", so if the supply voltage really is zero volts use 0.0001 instead. + * @param fuel_pressure [kPa] Fuel pressure. Zero in this value means "unknown", so if the fuel pressure really is zero kPa use 0.0001 instead. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_efi_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - uint8_t health,float ecu_index,float rpm,float fuel_consumed,float fuel_flow,float engine_load,float throttle_position,float spark_dwell_time,float barometric_pressure,float intake_manifold_pressure,float intake_manifold_temperature,float cylinder_head_temperature,float ignition_timing,float injection_time,float exhaust_gas_temperature,float throttle_out,float pt_compensation) + uint8_t health,float ecu_index,float rpm,float fuel_consumed,float fuel_flow,float engine_load,float throttle_position,float spark_dwell_time,float barometric_pressure,float intake_manifold_pressure,float intake_manifold_temperature,float cylinder_head_temperature,float ignition_timing,float injection_time,float exhaust_gas_temperature,float throttle_out,float pt_compensation,float ignition_voltage,float fuel_pressure) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_EFI_STATUS_LEN]; @@ -207,6 +308,8 @@ static inline uint16_t mavlink_msg_efi_status_pack_chan(uint8_t system_id, uint8 _mav_put_float(buf, 56, throttle_out); _mav_put_float(buf, 60, pt_compensation); _mav_put_uint8_t(buf, 64, health); + _mav_put_float(buf, 65, ignition_voltage); + _mav_put_float(buf, 69, fuel_pressure); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_EFI_STATUS_LEN); #else @@ -228,6 +331,8 @@ static inline uint16_t mavlink_msg_efi_status_pack_chan(uint8_t system_id, uint8 packet.throttle_out = throttle_out; packet.pt_compensation = pt_compensation; packet.health = health; + packet.ignition_voltage = ignition_voltage; + packet.fuel_pressure = fuel_pressure; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_EFI_STATUS_LEN); #endif @@ -246,7 +351,7 @@ static inline uint16_t mavlink_msg_efi_status_pack_chan(uint8_t system_id, uint8 */ static inline uint16_t mavlink_msg_efi_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_efi_status_t* efi_status) { - return mavlink_msg_efi_status_pack(system_id, component_id, msg, efi_status->health, efi_status->ecu_index, efi_status->rpm, efi_status->fuel_consumed, efi_status->fuel_flow, efi_status->engine_load, efi_status->throttle_position, efi_status->spark_dwell_time, efi_status->barometric_pressure, efi_status->intake_manifold_pressure, efi_status->intake_manifold_temperature, efi_status->cylinder_head_temperature, efi_status->ignition_timing, efi_status->injection_time, efi_status->exhaust_gas_temperature, efi_status->throttle_out, efi_status->pt_compensation); + return mavlink_msg_efi_status_pack(system_id, component_id, msg, efi_status->health, efi_status->ecu_index, efi_status->rpm, efi_status->fuel_consumed, efi_status->fuel_flow, efi_status->engine_load, efi_status->throttle_position, efi_status->spark_dwell_time, efi_status->barometric_pressure, efi_status->intake_manifold_pressure, efi_status->intake_manifold_temperature, efi_status->cylinder_head_temperature, efi_status->ignition_timing, efi_status->injection_time, efi_status->exhaust_gas_temperature, efi_status->throttle_out, efi_status->pt_compensation, efi_status->ignition_voltage, efi_status->fuel_pressure); } /** @@ -260,7 +365,21 @@ static inline uint16_t mavlink_msg_efi_status_encode(uint8_t system_id, uint8_t */ static inline uint16_t mavlink_msg_efi_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_efi_status_t* efi_status) { - return mavlink_msg_efi_status_pack_chan(system_id, component_id, chan, msg, efi_status->health, efi_status->ecu_index, efi_status->rpm, efi_status->fuel_consumed, efi_status->fuel_flow, efi_status->engine_load, efi_status->throttle_position, efi_status->spark_dwell_time, efi_status->barometric_pressure, efi_status->intake_manifold_pressure, efi_status->intake_manifold_temperature, efi_status->cylinder_head_temperature, efi_status->ignition_timing, efi_status->injection_time, efi_status->exhaust_gas_temperature, efi_status->throttle_out, efi_status->pt_compensation); + return mavlink_msg_efi_status_pack_chan(system_id, component_id, chan, msg, efi_status->health, efi_status->ecu_index, efi_status->rpm, efi_status->fuel_consumed, efi_status->fuel_flow, efi_status->engine_load, efi_status->throttle_position, efi_status->spark_dwell_time, efi_status->barometric_pressure, efi_status->intake_manifold_pressure, efi_status->intake_manifold_temperature, efi_status->cylinder_head_temperature, efi_status->ignition_timing, efi_status->injection_time, efi_status->exhaust_gas_temperature, efi_status->throttle_out, efi_status->pt_compensation, efi_status->ignition_voltage, efi_status->fuel_pressure); +} + +/** + * @brief Encode a efi_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param efi_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_efi_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_efi_status_t* efi_status) +{ + return mavlink_msg_efi_status_pack_status(system_id, component_id, _status, msg, efi_status->health, efi_status->ecu_index, efi_status->rpm, efi_status->fuel_consumed, efi_status->fuel_flow, efi_status->engine_load, efi_status->throttle_position, efi_status->spark_dwell_time, efi_status->barometric_pressure, efi_status->intake_manifold_pressure, efi_status->intake_manifold_temperature, efi_status->cylinder_head_temperature, efi_status->ignition_timing, efi_status->injection_time, efi_status->exhaust_gas_temperature, efi_status->throttle_out, efi_status->pt_compensation, efi_status->ignition_voltage, efi_status->fuel_pressure); } /** @@ -284,10 +403,12 @@ static inline uint16_t mavlink_msg_efi_status_encode_chan(uint8_t system_id, uin * @param exhaust_gas_temperature [degC] Exhaust gas temperature * @param throttle_out [%] Output throttle * @param pt_compensation Pressure/temperature compensation + * @param ignition_voltage [V] Supply voltage to EFI sparking system. Zero in this value means "unknown", so if the supply voltage really is zero volts use 0.0001 instead. + * @param fuel_pressure [kPa] Fuel pressure. Zero in this value means "unknown", so if the fuel pressure really is zero kPa use 0.0001 instead. */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_efi_status_send(mavlink_channel_t chan, uint8_t health, float ecu_index, float rpm, float fuel_consumed, float fuel_flow, float engine_load, float throttle_position, float spark_dwell_time, float barometric_pressure, float intake_manifold_pressure, float intake_manifold_temperature, float cylinder_head_temperature, float ignition_timing, float injection_time, float exhaust_gas_temperature, float throttle_out, float pt_compensation) +static inline void mavlink_msg_efi_status_send(mavlink_channel_t chan, uint8_t health, float ecu_index, float rpm, float fuel_consumed, float fuel_flow, float engine_load, float throttle_position, float spark_dwell_time, float barometric_pressure, float intake_manifold_pressure, float intake_manifold_temperature, float cylinder_head_temperature, float ignition_timing, float injection_time, float exhaust_gas_temperature, float throttle_out, float pt_compensation, float ignition_voltage, float fuel_pressure) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_EFI_STATUS_LEN]; @@ -308,6 +429,8 @@ static inline void mavlink_msg_efi_status_send(mavlink_channel_t chan, uint8_t h _mav_put_float(buf, 56, throttle_out); _mav_put_float(buf, 60, pt_compensation); _mav_put_uint8_t(buf, 64, health); + _mav_put_float(buf, 65, ignition_voltage); + _mav_put_float(buf, 69, fuel_pressure); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EFI_STATUS, buf, MAVLINK_MSG_ID_EFI_STATUS_MIN_LEN, MAVLINK_MSG_ID_EFI_STATUS_LEN, MAVLINK_MSG_ID_EFI_STATUS_CRC); #else @@ -329,6 +452,8 @@ static inline void mavlink_msg_efi_status_send(mavlink_channel_t chan, uint8_t h packet.throttle_out = throttle_out; packet.pt_compensation = pt_compensation; packet.health = health; + packet.ignition_voltage = ignition_voltage; + packet.fuel_pressure = fuel_pressure; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EFI_STATUS, (const char *)&packet, MAVLINK_MSG_ID_EFI_STATUS_MIN_LEN, MAVLINK_MSG_ID_EFI_STATUS_LEN, MAVLINK_MSG_ID_EFI_STATUS_CRC); #endif @@ -342,7 +467,7 @@ static inline void mavlink_msg_efi_status_send(mavlink_channel_t chan, uint8_t h static inline void mavlink_msg_efi_status_send_struct(mavlink_channel_t chan, const mavlink_efi_status_t* efi_status) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_efi_status_send(chan, efi_status->health, efi_status->ecu_index, efi_status->rpm, efi_status->fuel_consumed, efi_status->fuel_flow, efi_status->engine_load, efi_status->throttle_position, efi_status->spark_dwell_time, efi_status->barometric_pressure, efi_status->intake_manifold_pressure, efi_status->intake_manifold_temperature, efi_status->cylinder_head_temperature, efi_status->ignition_timing, efi_status->injection_time, efi_status->exhaust_gas_temperature, efi_status->throttle_out, efi_status->pt_compensation); + mavlink_msg_efi_status_send(chan, efi_status->health, efi_status->ecu_index, efi_status->rpm, efi_status->fuel_consumed, efi_status->fuel_flow, efi_status->engine_load, efi_status->throttle_position, efi_status->spark_dwell_time, efi_status->barometric_pressure, efi_status->intake_manifold_pressure, efi_status->intake_manifold_temperature, efi_status->cylinder_head_temperature, efi_status->ignition_timing, efi_status->injection_time, efi_status->exhaust_gas_temperature, efi_status->throttle_out, efi_status->pt_compensation, efi_status->ignition_voltage, efi_status->fuel_pressure); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EFI_STATUS, (const char *)efi_status, MAVLINK_MSG_ID_EFI_STATUS_MIN_LEN, MAVLINK_MSG_ID_EFI_STATUS_LEN, MAVLINK_MSG_ID_EFI_STATUS_CRC); #endif @@ -350,13 +475,13 @@ static inline void mavlink_msg_efi_status_send_struct(mavlink_channel_t chan, co #if MAVLINK_MSG_ID_EFI_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_efi_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t health, float ecu_index, float rpm, float fuel_consumed, float fuel_flow, float engine_load, float throttle_position, float spark_dwell_time, float barometric_pressure, float intake_manifold_pressure, float intake_manifold_temperature, float cylinder_head_temperature, float ignition_timing, float injection_time, float exhaust_gas_temperature, float throttle_out, float pt_compensation) +static inline void mavlink_msg_efi_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t health, float ecu_index, float rpm, float fuel_consumed, float fuel_flow, float engine_load, float throttle_position, float spark_dwell_time, float barometric_pressure, float intake_manifold_pressure, float intake_manifold_temperature, float cylinder_head_temperature, float ignition_timing, float injection_time, float exhaust_gas_temperature, float throttle_out, float pt_compensation, float ignition_voltage, float fuel_pressure) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; @@ -377,6 +502,8 @@ static inline void mavlink_msg_efi_status_send_buf(mavlink_message_t *msgbuf, ma _mav_put_float(buf, 56, throttle_out); _mav_put_float(buf, 60, pt_compensation); _mav_put_uint8_t(buf, 64, health); + _mav_put_float(buf, 65, ignition_voltage); + _mav_put_float(buf, 69, fuel_pressure); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EFI_STATUS, buf, MAVLINK_MSG_ID_EFI_STATUS_MIN_LEN, MAVLINK_MSG_ID_EFI_STATUS_LEN, MAVLINK_MSG_ID_EFI_STATUS_CRC); #else @@ -398,6 +525,8 @@ static inline void mavlink_msg_efi_status_send_buf(mavlink_message_t *msgbuf, ma packet->throttle_out = throttle_out; packet->pt_compensation = pt_compensation; packet->health = health; + packet->ignition_voltage = ignition_voltage; + packet->fuel_pressure = fuel_pressure; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EFI_STATUS, (const char *)packet, MAVLINK_MSG_ID_EFI_STATUS_MIN_LEN, MAVLINK_MSG_ID_EFI_STATUS_LEN, MAVLINK_MSG_ID_EFI_STATUS_CRC); #endif @@ -579,6 +708,26 @@ static inline float mavlink_msg_efi_status_get_pt_compensation(const mavlink_mes return _MAV_RETURN_float(msg, 60); } +/** + * @brief Get field ignition_voltage from efi_status message + * + * @return [V] Supply voltage to EFI sparking system. Zero in this value means "unknown", so if the supply voltage really is zero volts use 0.0001 instead. + */ +static inline float mavlink_msg_efi_status_get_ignition_voltage(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 65); +} + +/** + * @brief Get field fuel_pressure from efi_status message + * + * @return [kPa] Fuel pressure. Zero in this value means "unknown", so if the fuel pressure really is zero kPa use 0.0001 instead. + */ +static inline float mavlink_msg_efi_status_get_fuel_pressure(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 69); +} + /** * @brief Decode a efi_status message into a struct * @@ -605,6 +754,8 @@ static inline void mavlink_msg_efi_status_decode(const mavlink_message_t* msg, m efi_status->throttle_out = mavlink_msg_efi_status_get_throttle_out(msg); efi_status->pt_compensation = mavlink_msg_efi_status_get_pt_compensation(msg); efi_status->health = mavlink_msg_efi_status_get_health(msg); + efi_status->ignition_voltage = mavlink_msg_efi_status_get_ignition_voltage(msg); + efi_status->fuel_pressure = mavlink_msg_efi_status_get_fuel_pressure(msg); #else uint8_t len = msg->len < MAVLINK_MSG_ID_EFI_STATUS_LEN? msg->len : MAVLINK_MSG_ID_EFI_STATUS_LEN; memset(efi_status, 0, MAVLINK_MSG_ID_EFI_STATUS_LEN); diff --git a/common/mavlink_msg_encapsulated_data.h b/common/mavlink_msg_encapsulated_data.h index bfcf511b9..eef3c3da1 100644 --- a/common/mavlink_msg_encapsulated_data.h +++ b/common/mavlink_msg_encapsulated_data.h @@ -59,7 +59,7 @@ static inline uint16_t mavlink_msg_encapsulated_data_pack(uint8_t system_id, uin #else mavlink_encapsulated_data_t packet; packet.seqnr = seqnr; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*253); + mav_array_assign_uint8_t(packet.data, data, 253); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN); #endif @@ -67,6 +67,40 @@ static inline uint16_t mavlink_msg_encapsulated_data_pack(uint8_t system_id, uin return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ENCAPSULATED_DATA_MIN_LEN, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN, MAVLINK_MSG_ID_ENCAPSULATED_DATA_CRC); } +/** + * @brief Pack a encapsulated_data message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param seqnr sequence number (starting with 0 on every transmission) + * @param data image data bytes + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_encapsulated_data_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint16_t seqnr, const uint8_t *data) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN]; + _mav_put_uint16_t(buf, 0, seqnr); + _mav_put_uint8_t_array(buf, 2, data, 253); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN); +#else + mavlink_encapsulated_data_t packet; + packet.seqnr = seqnr; + mav_array_memcpy(packet.data, data, sizeof(uint8_t)*253); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_ENCAPSULATED_DATA; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ENCAPSULATED_DATA_MIN_LEN, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN, MAVLINK_MSG_ID_ENCAPSULATED_DATA_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ENCAPSULATED_DATA_MIN_LEN, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN); +#endif +} + /** * @brief Pack a encapsulated_data message on a channel * @param system_id ID of this system @@ -89,7 +123,7 @@ static inline uint16_t mavlink_msg_encapsulated_data_pack_chan(uint8_t system_id #else mavlink_encapsulated_data_t packet; packet.seqnr = seqnr; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*253); + mav_array_assign_uint8_t(packet.data, data, 253); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN); #endif @@ -124,6 +158,20 @@ static inline uint16_t mavlink_msg_encapsulated_data_encode_chan(uint8_t system_ return mavlink_msg_encapsulated_data_pack_chan(system_id, component_id, chan, msg, encapsulated_data->seqnr, encapsulated_data->data); } +/** + * @brief Encode a encapsulated_data struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param encapsulated_data C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_encapsulated_data_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_encapsulated_data_t* encapsulated_data) +{ + return mavlink_msg_encapsulated_data_pack_status(system_id, component_id, _status, msg, encapsulated_data->seqnr, encapsulated_data->data); +} + /** * @brief Send a encapsulated_data message * @param chan MAVLink channel to send the message @@ -143,7 +191,7 @@ static inline void mavlink_msg_encapsulated_data_send(mavlink_channel_t chan, ui #else mavlink_encapsulated_data_t packet; packet.seqnr = seqnr; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*253); + mav_array_assign_uint8_t(packet.data, data, 253); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ENCAPSULATED_DATA, (const char *)&packet, MAVLINK_MSG_ID_ENCAPSULATED_DATA_MIN_LEN, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN, MAVLINK_MSG_ID_ENCAPSULATED_DATA_CRC); #endif } @@ -164,7 +212,7 @@ static inline void mavlink_msg_encapsulated_data_send_struct(mavlink_channel_t c #if MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -180,7 +228,7 @@ static inline void mavlink_msg_encapsulated_data_send_buf(mavlink_message_t *msg #else mavlink_encapsulated_data_t *packet = (mavlink_encapsulated_data_t *)msgbuf; packet->seqnr = seqnr; - mav_array_memcpy(packet->data, data, sizeof(uint8_t)*253); + mav_array_assign_uint8_t(packet->data, data, 253); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ENCAPSULATED_DATA, (const char *)packet, MAVLINK_MSG_ID_ENCAPSULATED_DATA_MIN_LEN, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN, MAVLINK_MSG_ID_ENCAPSULATED_DATA_CRC); #endif } diff --git a/common/mavlink_msg_esc_info.h b/common/mavlink_msg_esc_info.h index d8a8bbcfe..463e46abb 100644 --- a/common/mavlink_msg_esc_info.h +++ b/common/mavlink_msg_esc_info.h @@ -9,20 +9,20 @@ typedef struct __mavlink_esc_info_t { uint32_t error_count[4]; /*< Number of reported errors by each ESC since boot.*/ uint16_t counter; /*< Counter of data packets received.*/ uint16_t failure_flags[4]; /*< Bitmap of ESC failure flags.*/ + int16_t temperature[4]; /*< [cdegC] Temperature of each ESC. INT16_MAX: if data not supplied by ESC.*/ uint8_t index; /*< Index of the first ESC in this message. minValue = 0, maxValue = 60, increment = 4.*/ uint8_t count; /*< Total number of ESCs in all messages of this type. Message fields with an index higher than this should be ignored because they contain invalid data.*/ uint8_t connection_type; /*< Connection type protocol for all ESC.*/ uint8_t info; /*< Information regarding online/offline status of each ESC.*/ - uint8_t temperature[4]; /*< [degC] Temperature measured by each ESC. UINT8_MAX if data not supplied by ESC.*/ } mavlink_esc_info_t; -#define MAVLINK_MSG_ID_ESC_INFO_LEN 42 -#define MAVLINK_MSG_ID_ESC_INFO_MIN_LEN 42 -#define MAVLINK_MSG_ID_290_LEN 42 -#define MAVLINK_MSG_ID_290_MIN_LEN 42 +#define MAVLINK_MSG_ID_ESC_INFO_LEN 46 +#define MAVLINK_MSG_ID_ESC_INFO_MIN_LEN 46 +#define MAVLINK_MSG_ID_290_LEN 46 +#define MAVLINK_MSG_ID_290_MIN_LEN 46 -#define MAVLINK_MSG_ID_ESC_INFO_CRC 221 -#define MAVLINK_MSG_ID_290_CRC 221 +#define MAVLINK_MSG_ID_ESC_INFO_CRC 251 +#define MAVLINK_MSG_ID_290_CRC 251 #define MAVLINK_MSG_ESC_INFO_FIELD_ERROR_COUNT_LEN 4 #define MAVLINK_MSG_ESC_INFO_FIELD_FAILURE_FLAGS_LEN 4 @@ -33,30 +33,30 @@ typedef struct __mavlink_esc_info_t { 290, \ "ESC_INFO", \ 9, \ - { { "index", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_esc_info_t, index) }, \ + { { "index", NULL, MAVLINK_TYPE_UINT8_T, 0, 42, offsetof(mavlink_esc_info_t, index) }, \ { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_esc_info_t, time_usec) }, \ { "counter", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_esc_info_t, counter) }, \ - { "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 35, offsetof(mavlink_esc_info_t, count) }, \ - { "connection_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_esc_info_t, connection_type) }, \ - { "info", NULL, MAVLINK_TYPE_UINT8_T, 0, 37, offsetof(mavlink_esc_info_t, info) }, \ + { "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 43, offsetof(mavlink_esc_info_t, count) }, \ + { "connection_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 44, offsetof(mavlink_esc_info_t, connection_type) }, \ + { "info", NULL, MAVLINK_TYPE_UINT8_T, 0, 45, offsetof(mavlink_esc_info_t, info) }, \ { "failure_flags", NULL, MAVLINK_TYPE_UINT16_T, 4, 26, offsetof(mavlink_esc_info_t, failure_flags) }, \ { "error_count", NULL, MAVLINK_TYPE_UINT32_T, 4, 8, offsetof(mavlink_esc_info_t, error_count) }, \ - { "temperature", NULL, MAVLINK_TYPE_UINT8_T, 4, 38, offsetof(mavlink_esc_info_t, temperature) }, \ + { "temperature", NULL, MAVLINK_TYPE_INT16_T, 4, 34, offsetof(mavlink_esc_info_t, temperature) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_ESC_INFO { \ "ESC_INFO", \ 9, \ - { { "index", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_esc_info_t, index) }, \ + { { "index", NULL, MAVLINK_TYPE_UINT8_T, 0, 42, offsetof(mavlink_esc_info_t, index) }, \ { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_esc_info_t, time_usec) }, \ { "counter", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_esc_info_t, counter) }, \ - { "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 35, offsetof(mavlink_esc_info_t, count) }, \ - { "connection_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_esc_info_t, connection_type) }, \ - { "info", NULL, MAVLINK_TYPE_UINT8_T, 0, 37, offsetof(mavlink_esc_info_t, info) }, \ + { "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 43, offsetof(mavlink_esc_info_t, count) }, \ + { "connection_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 44, offsetof(mavlink_esc_info_t, connection_type) }, \ + { "info", NULL, MAVLINK_TYPE_UINT8_T, 0, 45, offsetof(mavlink_esc_info_t, info) }, \ { "failure_flags", NULL, MAVLINK_TYPE_UINT16_T, 4, 26, offsetof(mavlink_esc_info_t, failure_flags) }, \ { "error_count", NULL, MAVLINK_TYPE_UINT32_T, 4, 8, offsetof(mavlink_esc_info_t, error_count) }, \ - { "temperature", NULL, MAVLINK_TYPE_UINT8_T, 4, 38, offsetof(mavlink_esc_info_t, temperature) }, \ + { "temperature", NULL, MAVLINK_TYPE_INT16_T, 4, 34, offsetof(mavlink_esc_info_t, temperature) }, \ } \ } #endif @@ -75,23 +75,74 @@ typedef struct __mavlink_esc_info_t { * @param info Information regarding online/offline status of each ESC. * @param failure_flags Bitmap of ESC failure flags. * @param error_count Number of reported errors by each ESC since boot. - * @param temperature [degC] Temperature measured by each ESC. UINT8_MAX if data not supplied by ESC. + * @param temperature [cdegC] Temperature of each ESC. INT16_MAX: if data not supplied by ESC. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_esc_info_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t index, uint64_t time_usec, uint16_t counter, uint8_t count, uint8_t connection_type, uint8_t info, const uint16_t *failure_flags, const uint32_t *error_count, const uint8_t *temperature) + uint8_t index, uint64_t time_usec, uint16_t counter, uint8_t count, uint8_t connection_type, uint8_t info, const uint16_t *failure_flags, const uint32_t *error_count, const int16_t *temperature) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_ESC_INFO_LEN]; _mav_put_uint64_t(buf, 0, time_usec); _mav_put_uint16_t(buf, 24, counter); - _mav_put_uint8_t(buf, 34, index); - _mav_put_uint8_t(buf, 35, count); - _mav_put_uint8_t(buf, 36, connection_type); - _mav_put_uint8_t(buf, 37, info); + _mav_put_uint8_t(buf, 42, index); + _mav_put_uint8_t(buf, 43, count); + _mav_put_uint8_t(buf, 44, connection_type); + _mav_put_uint8_t(buf, 45, info); _mav_put_uint32_t_array(buf, 8, error_count, 4); _mav_put_uint16_t_array(buf, 26, failure_flags, 4); - _mav_put_uint8_t_array(buf, 38, temperature, 4); + _mav_put_int16_t_array(buf, 34, temperature, 4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ESC_INFO_LEN); +#else + mavlink_esc_info_t packet; + packet.time_usec = time_usec; + packet.counter = counter; + packet.index = index; + packet.count = count; + packet.connection_type = connection_type; + packet.info = info; + mav_array_assign_uint32_t(packet.error_count, error_count, 4); + mav_array_assign_uint16_t(packet.failure_flags, failure_flags, 4); + mav_array_assign_int16_t(packet.temperature, temperature, 4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ESC_INFO_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_ESC_INFO; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ESC_INFO_MIN_LEN, MAVLINK_MSG_ID_ESC_INFO_LEN, MAVLINK_MSG_ID_ESC_INFO_CRC); +} + +/** + * @brief Pack a esc_info message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param index Index of the first ESC in this message. minValue = 0, maxValue = 60, increment = 4. + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude the number. + * @param counter Counter of data packets received. + * @param count Total number of ESCs in all messages of this type. Message fields with an index higher than this should be ignored because they contain invalid data. + * @param connection_type Connection type protocol for all ESC. + * @param info Information regarding online/offline status of each ESC. + * @param failure_flags Bitmap of ESC failure flags. + * @param error_count Number of reported errors by each ESC since boot. + * @param temperature [cdegC] Temperature of each ESC. INT16_MAX: if data not supplied by ESC. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_esc_info_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t index, uint64_t time_usec, uint16_t counter, uint8_t count, uint8_t connection_type, uint8_t info, const uint16_t *failure_flags, const uint32_t *error_count, const int16_t *temperature) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_ESC_INFO_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint16_t(buf, 24, counter); + _mav_put_uint8_t(buf, 42, index); + _mav_put_uint8_t(buf, 43, count); + _mav_put_uint8_t(buf, 44, connection_type); + _mav_put_uint8_t(buf, 45, info); + _mav_put_uint32_t_array(buf, 8, error_count, 4); + _mav_put_uint16_t_array(buf, 26, failure_flags, 4); + _mav_put_int16_t_array(buf, 34, temperature, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ESC_INFO_LEN); #else mavlink_esc_info_t packet; @@ -103,12 +154,16 @@ static inline uint16_t mavlink_msg_esc_info_pack(uint8_t system_id, uint8_t comp packet.info = info; mav_array_memcpy(packet.error_count, error_count, sizeof(uint32_t)*4); mav_array_memcpy(packet.failure_flags, failure_flags, sizeof(uint16_t)*4); - mav_array_memcpy(packet.temperature, temperature, sizeof(uint8_t)*4); + mav_array_memcpy(packet.temperature, temperature, sizeof(int16_t)*4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ESC_INFO_LEN); #endif msg->msgid = MAVLINK_MSG_ID_ESC_INFO; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ESC_INFO_MIN_LEN, MAVLINK_MSG_ID_ESC_INFO_LEN, MAVLINK_MSG_ID_ESC_INFO_CRC); +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ESC_INFO_MIN_LEN, MAVLINK_MSG_ID_ESC_INFO_LEN, MAVLINK_MSG_ID_ESC_INFO_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ESC_INFO_MIN_LEN, MAVLINK_MSG_ID_ESC_INFO_LEN); +#endif } /** @@ -125,24 +180,24 @@ static inline uint16_t mavlink_msg_esc_info_pack(uint8_t system_id, uint8_t comp * @param info Information regarding online/offline status of each ESC. * @param failure_flags Bitmap of ESC failure flags. * @param error_count Number of reported errors by each ESC since boot. - * @param temperature [degC] Temperature measured by each ESC. UINT8_MAX if data not supplied by ESC. + * @param temperature [cdegC] Temperature of each ESC. INT16_MAX: if data not supplied by ESC. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_esc_info_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - uint8_t index,uint64_t time_usec,uint16_t counter,uint8_t count,uint8_t connection_type,uint8_t info,const uint16_t *failure_flags,const uint32_t *error_count,const uint8_t *temperature) + uint8_t index,uint64_t time_usec,uint16_t counter,uint8_t count,uint8_t connection_type,uint8_t info,const uint16_t *failure_flags,const uint32_t *error_count,const int16_t *temperature) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_ESC_INFO_LEN]; _mav_put_uint64_t(buf, 0, time_usec); _mav_put_uint16_t(buf, 24, counter); - _mav_put_uint8_t(buf, 34, index); - _mav_put_uint8_t(buf, 35, count); - _mav_put_uint8_t(buf, 36, connection_type); - _mav_put_uint8_t(buf, 37, info); + _mav_put_uint8_t(buf, 42, index); + _mav_put_uint8_t(buf, 43, count); + _mav_put_uint8_t(buf, 44, connection_type); + _mav_put_uint8_t(buf, 45, info); _mav_put_uint32_t_array(buf, 8, error_count, 4); _mav_put_uint16_t_array(buf, 26, failure_flags, 4); - _mav_put_uint8_t_array(buf, 38, temperature, 4); + _mav_put_int16_t_array(buf, 34, temperature, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ESC_INFO_LEN); #else mavlink_esc_info_t packet; @@ -152,9 +207,9 @@ static inline uint16_t mavlink_msg_esc_info_pack_chan(uint8_t system_id, uint8_t packet.count = count; packet.connection_type = connection_type; packet.info = info; - mav_array_memcpy(packet.error_count, error_count, sizeof(uint32_t)*4); - mav_array_memcpy(packet.failure_flags, failure_flags, sizeof(uint16_t)*4); - mav_array_memcpy(packet.temperature, temperature, sizeof(uint8_t)*4); + mav_array_assign_uint32_t(packet.error_count, error_count, 4); + mav_array_assign_uint16_t(packet.failure_flags, failure_flags, 4); + mav_array_assign_int16_t(packet.temperature, temperature, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ESC_INFO_LEN); #endif @@ -189,6 +244,20 @@ static inline uint16_t mavlink_msg_esc_info_encode_chan(uint8_t system_id, uint8 return mavlink_msg_esc_info_pack_chan(system_id, component_id, chan, msg, esc_info->index, esc_info->time_usec, esc_info->counter, esc_info->count, esc_info->connection_type, esc_info->info, esc_info->failure_flags, esc_info->error_count, esc_info->temperature); } +/** + * @brief Encode a esc_info struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param esc_info C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_esc_info_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_esc_info_t* esc_info) +{ + return mavlink_msg_esc_info_pack_status(system_id, component_id, _status, msg, esc_info->index, esc_info->time_usec, esc_info->counter, esc_info->count, esc_info->connection_type, esc_info->info, esc_info->failure_flags, esc_info->error_count, esc_info->temperature); +} + /** * @brief Send a esc_info message * @param chan MAVLink channel to send the message @@ -201,23 +270,23 @@ static inline uint16_t mavlink_msg_esc_info_encode_chan(uint8_t system_id, uint8 * @param info Information regarding online/offline status of each ESC. * @param failure_flags Bitmap of ESC failure flags. * @param error_count Number of reported errors by each ESC since boot. - * @param temperature [degC] Temperature measured by each ESC. UINT8_MAX if data not supplied by ESC. + * @param temperature [cdegC] Temperature of each ESC. INT16_MAX: if data not supplied by ESC. */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_esc_info_send(mavlink_channel_t chan, uint8_t index, uint64_t time_usec, uint16_t counter, uint8_t count, uint8_t connection_type, uint8_t info, const uint16_t *failure_flags, const uint32_t *error_count, const uint8_t *temperature) +static inline void mavlink_msg_esc_info_send(mavlink_channel_t chan, uint8_t index, uint64_t time_usec, uint16_t counter, uint8_t count, uint8_t connection_type, uint8_t info, const uint16_t *failure_flags, const uint32_t *error_count, const int16_t *temperature) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_ESC_INFO_LEN]; _mav_put_uint64_t(buf, 0, time_usec); _mav_put_uint16_t(buf, 24, counter); - _mav_put_uint8_t(buf, 34, index); - _mav_put_uint8_t(buf, 35, count); - _mav_put_uint8_t(buf, 36, connection_type); - _mav_put_uint8_t(buf, 37, info); + _mav_put_uint8_t(buf, 42, index); + _mav_put_uint8_t(buf, 43, count); + _mav_put_uint8_t(buf, 44, connection_type); + _mav_put_uint8_t(buf, 45, info); _mav_put_uint32_t_array(buf, 8, error_count, 4); _mav_put_uint16_t_array(buf, 26, failure_flags, 4); - _mav_put_uint8_t_array(buf, 38, temperature, 4); + _mav_put_int16_t_array(buf, 34, temperature, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESC_INFO, buf, MAVLINK_MSG_ID_ESC_INFO_MIN_LEN, MAVLINK_MSG_ID_ESC_INFO_LEN, MAVLINK_MSG_ID_ESC_INFO_CRC); #else mavlink_esc_info_t packet; @@ -227,9 +296,9 @@ static inline void mavlink_msg_esc_info_send(mavlink_channel_t chan, uint8_t ind packet.count = count; packet.connection_type = connection_type; packet.info = info; - mav_array_memcpy(packet.error_count, error_count, sizeof(uint32_t)*4); - mav_array_memcpy(packet.failure_flags, failure_flags, sizeof(uint16_t)*4); - mav_array_memcpy(packet.temperature, temperature, sizeof(uint8_t)*4); + mav_array_assign_uint32_t(packet.error_count, error_count, 4); + mav_array_assign_uint16_t(packet.failure_flags, failure_flags, 4); + mav_array_assign_int16_t(packet.temperature, temperature, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESC_INFO, (const char *)&packet, MAVLINK_MSG_ID_ESC_INFO_MIN_LEN, MAVLINK_MSG_ID_ESC_INFO_LEN, MAVLINK_MSG_ID_ESC_INFO_CRC); #endif } @@ -250,25 +319,25 @@ static inline void mavlink_msg_esc_info_send_struct(mavlink_channel_t chan, cons #if MAVLINK_MSG_ID_ESC_INFO_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_esc_info_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t index, uint64_t time_usec, uint16_t counter, uint8_t count, uint8_t connection_type, uint8_t info, const uint16_t *failure_flags, const uint32_t *error_count, const uint8_t *temperature) +static inline void mavlink_msg_esc_info_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t index, uint64_t time_usec, uint16_t counter, uint8_t count, uint8_t connection_type, uint8_t info, const uint16_t *failure_flags, const uint32_t *error_count, const int16_t *temperature) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; _mav_put_uint64_t(buf, 0, time_usec); _mav_put_uint16_t(buf, 24, counter); - _mav_put_uint8_t(buf, 34, index); - _mav_put_uint8_t(buf, 35, count); - _mav_put_uint8_t(buf, 36, connection_type); - _mav_put_uint8_t(buf, 37, info); + _mav_put_uint8_t(buf, 42, index); + _mav_put_uint8_t(buf, 43, count); + _mav_put_uint8_t(buf, 44, connection_type); + _mav_put_uint8_t(buf, 45, info); _mav_put_uint32_t_array(buf, 8, error_count, 4); _mav_put_uint16_t_array(buf, 26, failure_flags, 4); - _mav_put_uint8_t_array(buf, 38, temperature, 4); + _mav_put_int16_t_array(buf, 34, temperature, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESC_INFO, buf, MAVLINK_MSG_ID_ESC_INFO_MIN_LEN, MAVLINK_MSG_ID_ESC_INFO_LEN, MAVLINK_MSG_ID_ESC_INFO_CRC); #else mavlink_esc_info_t *packet = (mavlink_esc_info_t *)msgbuf; @@ -278,9 +347,9 @@ static inline void mavlink_msg_esc_info_send_buf(mavlink_message_t *msgbuf, mavl packet->count = count; packet->connection_type = connection_type; packet->info = info; - mav_array_memcpy(packet->error_count, error_count, sizeof(uint32_t)*4); - mav_array_memcpy(packet->failure_flags, failure_flags, sizeof(uint16_t)*4); - mav_array_memcpy(packet->temperature, temperature, sizeof(uint8_t)*4); + mav_array_assign_uint32_t(packet->error_count, error_count, 4); + mav_array_assign_uint16_t(packet->failure_flags, failure_flags, 4); + mav_array_assign_int16_t(packet->temperature, temperature, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESC_INFO, (const char *)packet, MAVLINK_MSG_ID_ESC_INFO_MIN_LEN, MAVLINK_MSG_ID_ESC_INFO_LEN, MAVLINK_MSG_ID_ESC_INFO_CRC); #endif } @@ -298,7 +367,7 @@ static inline void mavlink_msg_esc_info_send_buf(mavlink_message_t *msgbuf, mavl */ static inline uint8_t mavlink_msg_esc_info_get_index(const mavlink_message_t* msg) { - return _MAV_RETURN_uint8_t(msg, 34); + return _MAV_RETURN_uint8_t(msg, 42); } /** @@ -328,7 +397,7 @@ static inline uint16_t mavlink_msg_esc_info_get_counter(const mavlink_message_t* */ static inline uint8_t mavlink_msg_esc_info_get_count(const mavlink_message_t* msg) { - return _MAV_RETURN_uint8_t(msg, 35); + return _MAV_RETURN_uint8_t(msg, 43); } /** @@ -338,7 +407,7 @@ static inline uint8_t mavlink_msg_esc_info_get_count(const mavlink_message_t* ms */ static inline uint8_t mavlink_msg_esc_info_get_connection_type(const mavlink_message_t* msg) { - return _MAV_RETURN_uint8_t(msg, 36); + return _MAV_RETURN_uint8_t(msg, 44); } /** @@ -348,7 +417,7 @@ static inline uint8_t mavlink_msg_esc_info_get_connection_type(const mavlink_mes */ static inline uint8_t mavlink_msg_esc_info_get_info(const mavlink_message_t* msg) { - return _MAV_RETURN_uint8_t(msg, 37); + return _MAV_RETURN_uint8_t(msg, 45); } /** @@ -374,11 +443,11 @@ static inline uint16_t mavlink_msg_esc_info_get_error_count(const mavlink_messag /** * @brief Get field temperature from esc_info message * - * @return [degC] Temperature measured by each ESC. UINT8_MAX if data not supplied by ESC. + * @return [cdegC] Temperature of each ESC. INT16_MAX: if data not supplied by ESC. */ -static inline uint16_t mavlink_msg_esc_info_get_temperature(const mavlink_message_t* msg, uint8_t *temperature) +static inline uint16_t mavlink_msg_esc_info_get_temperature(const mavlink_message_t* msg, int16_t *temperature) { - return _MAV_RETURN_uint8_t_array(msg, temperature, 4, 38); + return _MAV_RETURN_int16_t_array(msg, temperature, 4, 34); } /** @@ -394,11 +463,11 @@ static inline void mavlink_msg_esc_info_decode(const mavlink_message_t* msg, mav mavlink_msg_esc_info_get_error_count(msg, esc_info->error_count); esc_info->counter = mavlink_msg_esc_info_get_counter(msg); mavlink_msg_esc_info_get_failure_flags(msg, esc_info->failure_flags); + mavlink_msg_esc_info_get_temperature(msg, esc_info->temperature); esc_info->index = mavlink_msg_esc_info_get_index(msg); esc_info->count = mavlink_msg_esc_info_get_count(msg); esc_info->connection_type = mavlink_msg_esc_info_get_connection_type(msg); esc_info->info = mavlink_msg_esc_info_get_info(msg); - mavlink_msg_esc_info_get_temperature(msg, esc_info->temperature); #else uint8_t len = msg->len < MAVLINK_MSG_ID_ESC_INFO_LEN? msg->len : MAVLINK_MSG_ID_ESC_INFO_LEN; memset(esc_info, 0, MAVLINK_MSG_ID_ESC_INFO_LEN); diff --git a/common/mavlink_msg_esc_status.h b/common/mavlink_msg_esc_status.h index 3a5fefe20..1fc33dda0 100644 --- a/common/mavlink_msg_esc_status.h +++ b/common/mavlink_msg_esc_status.h @@ -65,6 +65,45 @@ typedef struct __mavlink_esc_status_t { static inline uint16_t mavlink_msg_esc_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t index, uint64_t time_usec, const int32_t *rpm, const float *voltage, const float *current) { +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_ESC_STATUS_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint8_t(buf, 56, index); + _mav_put_int32_t_array(buf, 8, rpm, 4); + _mav_put_float_array(buf, 24, voltage, 4); + _mav_put_float_array(buf, 40, current, 4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ESC_STATUS_LEN); +#else + mavlink_esc_status_t packet; + packet.time_usec = time_usec; + packet.index = index; + mav_array_assign_int32_t(packet.rpm, rpm, 4); + mav_array_assign_float(packet.voltage, voltage, 4); + mav_array_assign_float(packet.current, current, 4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ESC_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_ESC_STATUS; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ESC_STATUS_MIN_LEN, MAVLINK_MSG_ID_ESC_STATUS_LEN, MAVLINK_MSG_ID_ESC_STATUS_CRC); +} + +/** + * @brief Pack a esc_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param index Index of the first ESC in this message. minValue = 0, maxValue = 60, increment = 4. + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude the number. + * @param rpm [rpm] Reported motor RPM from each ESC (negative for reverse rotation). + * @param voltage [V] Voltage measured from each ESC. + * @param current [A] Current measured from each ESC. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_esc_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t index, uint64_t time_usec, const int32_t *rpm, const float *voltage, const float *current) +{ #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_ESC_STATUS_LEN]; _mav_put_uint64_t(buf, 0, time_usec); @@ -84,7 +123,11 @@ static inline uint16_t mavlink_msg_esc_status_pack(uint8_t system_id, uint8_t co #endif msg->msgid = MAVLINK_MSG_ID_ESC_STATUS; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ESC_STATUS_MIN_LEN, MAVLINK_MSG_ID_ESC_STATUS_LEN, MAVLINK_MSG_ID_ESC_STATUS_CRC); +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ESC_STATUS_MIN_LEN, MAVLINK_MSG_ID_ESC_STATUS_LEN, MAVLINK_MSG_ID_ESC_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ESC_STATUS_MIN_LEN, MAVLINK_MSG_ID_ESC_STATUS_LEN); +#endif } /** @@ -116,9 +159,9 @@ static inline uint16_t mavlink_msg_esc_status_pack_chan(uint8_t system_id, uint8 mavlink_esc_status_t packet; packet.time_usec = time_usec; packet.index = index; - mav_array_memcpy(packet.rpm, rpm, sizeof(int32_t)*4); - mav_array_memcpy(packet.voltage, voltage, sizeof(float)*4); - mav_array_memcpy(packet.current, current, sizeof(float)*4); + mav_array_assign_int32_t(packet.rpm, rpm, 4); + mav_array_assign_float(packet.voltage, voltage, 4); + mav_array_assign_float(packet.current, current, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ESC_STATUS_LEN); #endif @@ -153,6 +196,20 @@ static inline uint16_t mavlink_msg_esc_status_encode_chan(uint8_t system_id, uin return mavlink_msg_esc_status_pack_chan(system_id, component_id, chan, msg, esc_status->index, esc_status->time_usec, esc_status->rpm, esc_status->voltage, esc_status->current); } +/** + * @brief Encode a esc_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param esc_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_esc_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_esc_status_t* esc_status) +{ + return mavlink_msg_esc_status_pack_status(system_id, component_id, _status, msg, esc_status->index, esc_status->time_usec, esc_status->rpm, esc_status->voltage, esc_status->current); +} + /** * @brief Send a esc_status message * @param chan MAVLink channel to send the message @@ -179,9 +236,9 @@ static inline void mavlink_msg_esc_status_send(mavlink_channel_t chan, uint8_t i mavlink_esc_status_t packet; packet.time_usec = time_usec; packet.index = index; - mav_array_memcpy(packet.rpm, rpm, sizeof(int32_t)*4); - mav_array_memcpy(packet.voltage, voltage, sizeof(float)*4); - mav_array_memcpy(packet.current, current, sizeof(float)*4); + mav_array_assign_int32_t(packet.rpm, rpm, 4); + mav_array_assign_float(packet.voltage, voltage, 4); + mav_array_assign_float(packet.current, current, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESC_STATUS, (const char *)&packet, MAVLINK_MSG_ID_ESC_STATUS_MIN_LEN, MAVLINK_MSG_ID_ESC_STATUS_LEN, MAVLINK_MSG_ID_ESC_STATUS_CRC); #endif } @@ -202,7 +259,7 @@ static inline void mavlink_msg_esc_status_send_struct(mavlink_channel_t chan, co #if MAVLINK_MSG_ID_ESC_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -222,9 +279,9 @@ static inline void mavlink_msg_esc_status_send_buf(mavlink_message_t *msgbuf, ma mavlink_esc_status_t *packet = (mavlink_esc_status_t *)msgbuf; packet->time_usec = time_usec; packet->index = index; - mav_array_memcpy(packet->rpm, rpm, sizeof(int32_t)*4); - mav_array_memcpy(packet->voltage, voltage, sizeof(float)*4); - mav_array_memcpy(packet->current, current, sizeof(float)*4); + mav_array_assign_int32_t(packet->rpm, rpm, 4); + mav_array_assign_float(packet->voltage, voltage, 4); + mav_array_assign_float(packet->current, current, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESC_STATUS, (const char *)packet, MAVLINK_MSG_ID_ESC_STATUS_MIN_LEN, MAVLINK_MSG_ID_ESC_STATUS_LEN, MAVLINK_MSG_ID_ESC_STATUS_CRC); #endif } diff --git a/common/mavlink_msg_estimator_status.h b/common/mavlink_msg_estimator_status.h index bc5499b92..4a53e0697 100644 --- a/common/mavlink_msg_estimator_status.h +++ b/common/mavlink_msg_estimator_status.h @@ -117,6 +117,66 @@ static inline uint16_t mavlink_msg_estimator_status_pack(uint8_t system_id, uint return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ESTIMATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_ESTIMATOR_STATUS_LEN, MAVLINK_MSG_ID_ESTIMATOR_STATUS_CRC); } +/** + * @brief Pack a estimator_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param flags Bitmap indicating which EKF outputs are valid. + * @param vel_ratio Velocity innovation test ratio + * @param pos_horiz_ratio Horizontal position innovation test ratio + * @param pos_vert_ratio Vertical position innovation test ratio + * @param mag_ratio Magnetometer innovation test ratio + * @param hagl_ratio Height above terrain innovation test ratio + * @param tas_ratio True airspeed innovation test ratio + * @param pos_horiz_accuracy [m] Horizontal position 1-STD accuracy relative to the EKF local origin + * @param pos_vert_accuracy [m] Vertical position 1-STD accuracy relative to the EKF local origin + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_estimator_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, uint16_t flags, float vel_ratio, float pos_horiz_ratio, float pos_vert_ratio, float mag_ratio, float hagl_ratio, float tas_ratio, float pos_horiz_accuracy, float pos_vert_accuracy) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_ESTIMATOR_STATUS_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, vel_ratio); + _mav_put_float(buf, 12, pos_horiz_ratio); + _mav_put_float(buf, 16, pos_vert_ratio); + _mav_put_float(buf, 20, mag_ratio); + _mav_put_float(buf, 24, hagl_ratio); + _mav_put_float(buf, 28, tas_ratio); + _mav_put_float(buf, 32, pos_horiz_accuracy); + _mav_put_float(buf, 36, pos_vert_accuracy); + _mav_put_uint16_t(buf, 40, flags); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ESTIMATOR_STATUS_LEN); +#else + mavlink_estimator_status_t packet; + packet.time_usec = time_usec; + packet.vel_ratio = vel_ratio; + packet.pos_horiz_ratio = pos_horiz_ratio; + packet.pos_vert_ratio = pos_vert_ratio; + packet.mag_ratio = mag_ratio; + packet.hagl_ratio = hagl_ratio; + packet.tas_ratio = tas_ratio; + packet.pos_horiz_accuracy = pos_horiz_accuracy; + packet.pos_vert_accuracy = pos_vert_accuracy; + packet.flags = flags; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ESTIMATOR_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_ESTIMATOR_STATUS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ESTIMATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_ESTIMATOR_STATUS_LEN, MAVLINK_MSG_ID_ESTIMATOR_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ESTIMATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_ESTIMATOR_STATUS_LEN); +#endif +} + /** * @brief Pack a estimator_status message on a channel * @param system_id ID of this system @@ -200,6 +260,20 @@ static inline uint16_t mavlink_msg_estimator_status_encode_chan(uint8_t system_i return mavlink_msg_estimator_status_pack_chan(system_id, component_id, chan, msg, estimator_status->time_usec, estimator_status->flags, estimator_status->vel_ratio, estimator_status->pos_horiz_ratio, estimator_status->pos_vert_ratio, estimator_status->mag_ratio, estimator_status->hagl_ratio, estimator_status->tas_ratio, estimator_status->pos_horiz_accuracy, estimator_status->pos_vert_accuracy); } +/** + * @brief Encode a estimator_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param estimator_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_estimator_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_estimator_status_t* estimator_status) +{ + return mavlink_msg_estimator_status_pack_status(system_id, component_id, _status, msg, estimator_status->time_usec, estimator_status->flags, estimator_status->vel_ratio, estimator_status->pos_horiz_ratio, estimator_status->pos_vert_ratio, estimator_status->mag_ratio, estimator_status->hagl_ratio, estimator_status->tas_ratio, estimator_status->pos_horiz_accuracy, estimator_status->pos_vert_accuracy); +} + /** * @brief Send a estimator_status message * @param chan MAVLink channel to send the message @@ -266,7 +340,7 @@ static inline void mavlink_msg_estimator_status_send_struct(mavlink_channel_t ch #if MAVLINK_MSG_ID_ESTIMATOR_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_event.h b/common/mavlink_msg_event.h new file mode 100644 index 000000000..056743314 --- /dev/null +++ b/common/mavlink_msg_event.h @@ -0,0 +1,418 @@ +#pragma once +// MESSAGE EVENT PACKING + +#define MAVLINK_MSG_ID_EVENT 410 + + +typedef struct __mavlink_event_t { + uint32_t id; /*< Event ID (as defined in the component metadata)*/ + uint32_t event_time_boot_ms; /*< [ms] Timestamp (time since system boot when the event happened).*/ + uint16_t sequence; /*< Sequence number.*/ + uint8_t destination_component; /*< Component ID*/ + uint8_t destination_system; /*< System ID*/ + uint8_t log_levels; /*< Log levels: 4 bits MSB: internal (for logging purposes), 4 bits LSB: external. Levels: Emergency = 0, Alert = 1, Critical = 2, Error = 3, Warning = 4, Notice = 5, Info = 6, Debug = 7, Protocol = 8, Disabled = 9*/ + uint8_t arguments[40]; /*< Arguments (depend on event ID).*/ +} mavlink_event_t; + +#define MAVLINK_MSG_ID_EVENT_LEN 53 +#define MAVLINK_MSG_ID_EVENT_MIN_LEN 53 +#define MAVLINK_MSG_ID_410_LEN 53 +#define MAVLINK_MSG_ID_410_MIN_LEN 53 + +#define MAVLINK_MSG_ID_EVENT_CRC 160 +#define MAVLINK_MSG_ID_410_CRC 160 + +#define MAVLINK_MSG_EVENT_FIELD_ARGUMENTS_LEN 40 + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_EVENT { \ + 410, \ + "EVENT", \ + 7, \ + { { "destination_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_event_t, destination_component) }, \ + { "destination_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_event_t, destination_system) }, \ + { "id", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_event_t, id) }, \ + { "event_time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_event_t, event_time_boot_ms) }, \ + { "sequence", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_event_t, sequence) }, \ + { "log_levels", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_event_t, log_levels) }, \ + { "arguments", NULL, MAVLINK_TYPE_UINT8_T, 40, 13, offsetof(mavlink_event_t, arguments) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_EVENT { \ + "EVENT", \ + 7, \ + { { "destination_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_event_t, destination_component) }, \ + { "destination_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_event_t, destination_system) }, \ + { "id", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_event_t, id) }, \ + { "event_time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_event_t, event_time_boot_ms) }, \ + { "sequence", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_event_t, sequence) }, \ + { "log_levels", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_event_t, log_levels) }, \ + { "arguments", NULL, MAVLINK_TYPE_UINT8_T, 40, 13, offsetof(mavlink_event_t, arguments) }, \ + } \ +} +#endif + +/** + * @brief Pack a event message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param destination_component Component ID + * @param destination_system System ID + * @param id Event ID (as defined in the component metadata) + * @param event_time_boot_ms [ms] Timestamp (time since system boot when the event happened). + * @param sequence Sequence number. + * @param log_levels Log levels: 4 bits MSB: internal (for logging purposes), 4 bits LSB: external. Levels: Emergency = 0, Alert = 1, Critical = 2, Error = 3, Warning = 4, Notice = 5, Info = 6, Debug = 7, Protocol = 8, Disabled = 9 + * @param arguments Arguments (depend on event ID). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_event_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t destination_component, uint8_t destination_system, uint32_t id, uint32_t event_time_boot_ms, uint16_t sequence, uint8_t log_levels, const uint8_t *arguments) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_EVENT_LEN]; + _mav_put_uint32_t(buf, 0, id); + _mav_put_uint32_t(buf, 4, event_time_boot_ms); + _mav_put_uint16_t(buf, 8, sequence); + _mav_put_uint8_t(buf, 10, destination_component); + _mav_put_uint8_t(buf, 11, destination_system); + _mav_put_uint8_t(buf, 12, log_levels); + _mav_put_uint8_t_array(buf, 13, arguments, 40); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_EVENT_LEN); +#else + mavlink_event_t packet; + packet.id = id; + packet.event_time_boot_ms = event_time_boot_ms; + packet.sequence = sequence; + packet.destination_component = destination_component; + packet.destination_system = destination_system; + packet.log_levels = log_levels; + mav_array_assign_uint8_t(packet.arguments, arguments, 40); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_EVENT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_EVENT; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_EVENT_MIN_LEN, MAVLINK_MSG_ID_EVENT_LEN, MAVLINK_MSG_ID_EVENT_CRC); +} + +/** + * @brief Pack a event message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param destination_component Component ID + * @param destination_system System ID + * @param id Event ID (as defined in the component metadata) + * @param event_time_boot_ms [ms] Timestamp (time since system boot when the event happened). + * @param sequence Sequence number. + * @param log_levels Log levels: 4 bits MSB: internal (for logging purposes), 4 bits LSB: external. Levels: Emergency = 0, Alert = 1, Critical = 2, Error = 3, Warning = 4, Notice = 5, Info = 6, Debug = 7, Protocol = 8, Disabled = 9 + * @param arguments Arguments (depend on event ID). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_event_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t destination_component, uint8_t destination_system, uint32_t id, uint32_t event_time_boot_ms, uint16_t sequence, uint8_t log_levels, const uint8_t *arguments) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_EVENT_LEN]; + _mav_put_uint32_t(buf, 0, id); + _mav_put_uint32_t(buf, 4, event_time_boot_ms); + _mav_put_uint16_t(buf, 8, sequence); + _mav_put_uint8_t(buf, 10, destination_component); + _mav_put_uint8_t(buf, 11, destination_system); + _mav_put_uint8_t(buf, 12, log_levels); + _mav_put_uint8_t_array(buf, 13, arguments, 40); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_EVENT_LEN); +#else + mavlink_event_t packet; + packet.id = id; + packet.event_time_boot_ms = event_time_boot_ms; + packet.sequence = sequence; + packet.destination_component = destination_component; + packet.destination_system = destination_system; + packet.log_levels = log_levels; + mav_array_memcpy(packet.arguments, arguments, sizeof(uint8_t)*40); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_EVENT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_EVENT; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_EVENT_MIN_LEN, MAVLINK_MSG_ID_EVENT_LEN, MAVLINK_MSG_ID_EVENT_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_EVENT_MIN_LEN, MAVLINK_MSG_ID_EVENT_LEN); +#endif +} + +/** + * @brief Pack a event message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param destination_component Component ID + * @param destination_system System ID + * @param id Event ID (as defined in the component metadata) + * @param event_time_boot_ms [ms] Timestamp (time since system boot when the event happened). + * @param sequence Sequence number. + * @param log_levels Log levels: 4 bits MSB: internal (for logging purposes), 4 bits LSB: external. Levels: Emergency = 0, Alert = 1, Critical = 2, Error = 3, Warning = 4, Notice = 5, Info = 6, Debug = 7, Protocol = 8, Disabled = 9 + * @param arguments Arguments (depend on event ID). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_event_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t destination_component,uint8_t destination_system,uint32_t id,uint32_t event_time_boot_ms,uint16_t sequence,uint8_t log_levels,const uint8_t *arguments) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_EVENT_LEN]; + _mav_put_uint32_t(buf, 0, id); + _mav_put_uint32_t(buf, 4, event_time_boot_ms); + _mav_put_uint16_t(buf, 8, sequence); + _mav_put_uint8_t(buf, 10, destination_component); + _mav_put_uint8_t(buf, 11, destination_system); + _mav_put_uint8_t(buf, 12, log_levels); + _mav_put_uint8_t_array(buf, 13, arguments, 40); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_EVENT_LEN); +#else + mavlink_event_t packet; + packet.id = id; + packet.event_time_boot_ms = event_time_boot_ms; + packet.sequence = sequence; + packet.destination_component = destination_component; + packet.destination_system = destination_system; + packet.log_levels = log_levels; + mav_array_assign_uint8_t(packet.arguments, arguments, 40); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_EVENT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_EVENT; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_EVENT_MIN_LEN, MAVLINK_MSG_ID_EVENT_LEN, MAVLINK_MSG_ID_EVENT_CRC); +} + +/** + * @brief Encode a event struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param event C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_event_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_event_t* event) +{ + return mavlink_msg_event_pack(system_id, component_id, msg, event->destination_component, event->destination_system, event->id, event->event_time_boot_ms, event->sequence, event->log_levels, event->arguments); +} + +/** + * @brief Encode a event struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param event C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_event_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_event_t* event) +{ + return mavlink_msg_event_pack_chan(system_id, component_id, chan, msg, event->destination_component, event->destination_system, event->id, event->event_time_boot_ms, event->sequence, event->log_levels, event->arguments); +} + +/** + * @brief Encode a event struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param event C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_event_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_event_t* event) +{ + return mavlink_msg_event_pack_status(system_id, component_id, _status, msg, event->destination_component, event->destination_system, event->id, event->event_time_boot_ms, event->sequence, event->log_levels, event->arguments); +} + +/** + * @brief Send a event message + * @param chan MAVLink channel to send the message + * + * @param destination_component Component ID + * @param destination_system System ID + * @param id Event ID (as defined in the component metadata) + * @param event_time_boot_ms [ms] Timestamp (time since system boot when the event happened). + * @param sequence Sequence number. + * @param log_levels Log levels: 4 bits MSB: internal (for logging purposes), 4 bits LSB: external. Levels: Emergency = 0, Alert = 1, Critical = 2, Error = 3, Warning = 4, Notice = 5, Info = 6, Debug = 7, Protocol = 8, Disabled = 9 + * @param arguments Arguments (depend on event ID). + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_event_send(mavlink_channel_t chan, uint8_t destination_component, uint8_t destination_system, uint32_t id, uint32_t event_time_boot_ms, uint16_t sequence, uint8_t log_levels, const uint8_t *arguments) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_EVENT_LEN]; + _mav_put_uint32_t(buf, 0, id); + _mav_put_uint32_t(buf, 4, event_time_boot_ms); + _mav_put_uint16_t(buf, 8, sequence); + _mav_put_uint8_t(buf, 10, destination_component); + _mav_put_uint8_t(buf, 11, destination_system); + _mav_put_uint8_t(buf, 12, log_levels); + _mav_put_uint8_t_array(buf, 13, arguments, 40); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EVENT, buf, MAVLINK_MSG_ID_EVENT_MIN_LEN, MAVLINK_MSG_ID_EVENT_LEN, MAVLINK_MSG_ID_EVENT_CRC); +#else + mavlink_event_t packet; + packet.id = id; + packet.event_time_boot_ms = event_time_boot_ms; + packet.sequence = sequence; + packet.destination_component = destination_component; + packet.destination_system = destination_system; + packet.log_levels = log_levels; + mav_array_assign_uint8_t(packet.arguments, arguments, 40); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EVENT, (const char *)&packet, MAVLINK_MSG_ID_EVENT_MIN_LEN, MAVLINK_MSG_ID_EVENT_LEN, MAVLINK_MSG_ID_EVENT_CRC); +#endif +} + +/** + * @brief Send a event message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_event_send_struct(mavlink_channel_t chan, const mavlink_event_t* event) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_event_send(chan, event->destination_component, event->destination_system, event->id, event->event_time_boot_ms, event->sequence, event->log_levels, event->arguments); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EVENT, (const char *)event, MAVLINK_MSG_ID_EVENT_MIN_LEN, MAVLINK_MSG_ID_EVENT_LEN, MAVLINK_MSG_ID_EVENT_CRC); +#endif +} + +#if MAVLINK_MSG_ID_EVENT_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_event_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t destination_component, uint8_t destination_system, uint32_t id, uint32_t event_time_boot_ms, uint16_t sequence, uint8_t log_levels, const uint8_t *arguments) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint32_t(buf, 0, id); + _mav_put_uint32_t(buf, 4, event_time_boot_ms); + _mav_put_uint16_t(buf, 8, sequence); + _mav_put_uint8_t(buf, 10, destination_component); + _mav_put_uint8_t(buf, 11, destination_system); + _mav_put_uint8_t(buf, 12, log_levels); + _mav_put_uint8_t_array(buf, 13, arguments, 40); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EVENT, buf, MAVLINK_MSG_ID_EVENT_MIN_LEN, MAVLINK_MSG_ID_EVENT_LEN, MAVLINK_MSG_ID_EVENT_CRC); +#else + mavlink_event_t *packet = (mavlink_event_t *)msgbuf; + packet->id = id; + packet->event_time_boot_ms = event_time_boot_ms; + packet->sequence = sequence; + packet->destination_component = destination_component; + packet->destination_system = destination_system; + packet->log_levels = log_levels; + mav_array_assign_uint8_t(packet->arguments, arguments, 40); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EVENT, (const char *)packet, MAVLINK_MSG_ID_EVENT_MIN_LEN, MAVLINK_MSG_ID_EVENT_LEN, MAVLINK_MSG_ID_EVENT_CRC); +#endif +} +#endif + +#endif + +// MESSAGE EVENT UNPACKING + + +/** + * @brief Get field destination_component from event message + * + * @return Component ID + */ +static inline uint8_t mavlink_msg_event_get_destination_component(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 10); +} + +/** + * @brief Get field destination_system from event message + * + * @return System ID + */ +static inline uint8_t mavlink_msg_event_get_destination_system(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 11); +} + +/** + * @brief Get field id from event message + * + * @return Event ID (as defined in the component metadata) + */ +static inline uint32_t mavlink_msg_event_get_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 0); +} + +/** + * @brief Get field event_time_boot_ms from event message + * + * @return [ms] Timestamp (time since system boot when the event happened). + */ +static inline uint32_t mavlink_msg_event_get_event_time_boot_ms(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 4); +} + +/** + * @brief Get field sequence from event message + * + * @return Sequence number. + */ +static inline uint16_t mavlink_msg_event_get_sequence(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 8); +} + +/** + * @brief Get field log_levels from event message + * + * @return Log levels: 4 bits MSB: internal (for logging purposes), 4 bits LSB: external. Levels: Emergency = 0, Alert = 1, Critical = 2, Error = 3, Warning = 4, Notice = 5, Info = 6, Debug = 7, Protocol = 8, Disabled = 9 + */ +static inline uint8_t mavlink_msg_event_get_log_levels(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 12); +} + +/** + * @brief Get field arguments from event message + * + * @return Arguments (depend on event ID). + */ +static inline uint16_t mavlink_msg_event_get_arguments(const mavlink_message_t* msg, uint8_t *arguments) +{ + return _MAV_RETURN_uint8_t_array(msg, arguments, 40, 13); +} + +/** + * @brief Decode a event message into a struct + * + * @param msg The message to decode + * @param event C-struct to decode the message contents into + */ +static inline void mavlink_msg_event_decode(const mavlink_message_t* msg, mavlink_event_t* event) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + event->id = mavlink_msg_event_get_id(msg); + event->event_time_boot_ms = mavlink_msg_event_get_event_time_boot_ms(msg); + event->sequence = mavlink_msg_event_get_sequence(msg); + event->destination_component = mavlink_msg_event_get_destination_component(msg); + event->destination_system = mavlink_msg_event_get_destination_system(msg); + event->log_levels = mavlink_msg_event_get_log_levels(msg); + mavlink_msg_event_get_arguments(msg, event->arguments); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_EVENT_LEN? msg->len : MAVLINK_MSG_ID_EVENT_LEN; + memset(event, 0, MAVLINK_MSG_ID_EVENT_LEN); + memcpy(event, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/common/mavlink_msg_extended_sys_state.h b/common/mavlink_msg_extended_sys_state.h index 2eeeed0c0..a56ba8f78 100644 --- a/common/mavlink_msg_extended_sys_state.h +++ b/common/mavlink_msg_extended_sys_state.h @@ -69,6 +69,42 @@ static inline uint16_t mavlink_msg_extended_sys_state_pack(uint8_t system_id, ui return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_MIN_LEN, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_CRC); } +/** + * @brief Pack a extended_sys_state message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param vtol_state The VTOL state if applicable. Is set to MAV_VTOL_STATE_UNDEFINED if UAV is not in VTOL configuration. + * @param landed_state The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_extended_sys_state_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t vtol_state, uint8_t landed_state) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN]; + _mav_put_uint8_t(buf, 0, vtol_state); + _mav_put_uint8_t(buf, 1, landed_state); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN); +#else + mavlink_extended_sys_state_t packet; + packet.vtol_state = vtol_state; + packet.landed_state = landed_state; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_EXTENDED_SYS_STATE; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_MIN_LEN, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_MIN_LEN, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN); +#endif +} + /** * @brief Pack a extended_sys_state message on a channel * @param system_id ID of this system @@ -128,6 +164,20 @@ static inline uint16_t mavlink_msg_extended_sys_state_encode_chan(uint8_t system return mavlink_msg_extended_sys_state_pack_chan(system_id, component_id, chan, msg, extended_sys_state->vtol_state, extended_sys_state->landed_state); } +/** + * @brief Encode a extended_sys_state struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param extended_sys_state C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_extended_sys_state_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_extended_sys_state_t* extended_sys_state) +{ + return mavlink_msg_extended_sys_state_pack_status(system_id, component_id, _status, msg, extended_sys_state->vtol_state, extended_sys_state->landed_state); +} + /** * @brief Send a extended_sys_state message * @param chan MAVLink channel to send the message @@ -170,7 +220,7 @@ static inline void mavlink_msg_extended_sys_state_send_struct(mavlink_channel_t #if MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_external_global_position.h b/common/mavlink_msg_external_global_position.h new file mode 100644 index 000000000..5bac7e922 --- /dev/null +++ b/common/mavlink_msg_external_global_position.h @@ -0,0 +1,568 @@ +#pragma once +// MESSAGE EXTERNAL_GLOBAL_POSITION PACKING + +#define MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION 296 + + +typedef struct __mavlink_external_global_position_t { + uint64_t time_usec; /*< [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.*/ + int32_t lat; /*< [degE7] Latitude (WGS84)*/ + int32_t lon; /*< [degE7] Longitude (WGS84)*/ + float alt; /*< [m] Altitude (MSL)*/ + float vn; /*< [m/s] GPS velocity in north direction in earth-fixed NED frame. NaN is unused*/ + float ve; /*< [m/s] GPS velocity in east direction in earth-fixed NED frame*/ + float vd; /*< [m/s] GPS velocity in down direction in earth-fixed NED frame*/ + float eph; /*< [m] Standard deviation of horizontal position error*/ + float epv; /*< [m] Standard deviation of vertical position error*/ + float evh; /*< [m] Standard deviation of horizontal velocity error*/ + float evv; /*< [m] Standard deviation of vertical velocity error*/ + uint8_t id; /*< Sensor ID*/ +} mavlink_external_global_position_t; + +#define MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN 49 +#define MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_MIN_LEN 49 +#define MAVLINK_MSG_ID_296_LEN 49 +#define MAVLINK_MSG_ID_296_MIN_LEN 49 + +#define MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_CRC 110 +#define MAVLINK_MSG_ID_296_CRC 110 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_EXTERNAL_GLOBAL_POSITION { \ + 296, \ + "EXTERNAL_GLOBAL_POSITION", \ + 12, \ + { { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 48, offsetof(mavlink_external_global_position_t, id) }, \ + { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_external_global_position_t, time_usec) }, \ + { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_external_global_position_t, lat) }, \ + { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_external_global_position_t, lon) }, \ + { "alt", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_external_global_position_t, alt) }, \ + { "vn", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_external_global_position_t, vn) }, \ + { "ve", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_external_global_position_t, ve) }, \ + { "vd", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_external_global_position_t, vd) }, \ + { "eph", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_external_global_position_t, eph) }, \ + { "epv", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_external_global_position_t, epv) }, \ + { "evh", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_external_global_position_t, evh) }, \ + { "evv", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_external_global_position_t, evv) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_EXTERNAL_GLOBAL_POSITION { \ + "EXTERNAL_GLOBAL_POSITION", \ + 12, \ + { { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 48, offsetof(mavlink_external_global_position_t, id) }, \ + { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_external_global_position_t, time_usec) }, \ + { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_external_global_position_t, lat) }, \ + { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_external_global_position_t, lon) }, \ + { "alt", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_external_global_position_t, alt) }, \ + { "vn", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_external_global_position_t, vn) }, \ + { "ve", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_external_global_position_t, ve) }, \ + { "vd", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_external_global_position_t, vd) }, \ + { "eph", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_external_global_position_t, eph) }, \ + { "epv", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_external_global_position_t, epv) }, \ + { "evh", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_external_global_position_t, evh) }, \ + { "evv", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_external_global_position_t, evv) }, \ + } \ +} +#endif + +/** + * @brief Pack a external_global_position message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param id Sensor ID + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param lat [degE7] Latitude (WGS84) + * @param lon [degE7] Longitude (WGS84) + * @param alt [m] Altitude (MSL) + * @param vn [m/s] GPS velocity in north direction in earth-fixed NED frame. NaN is unused + * @param ve [m/s] GPS velocity in east direction in earth-fixed NED frame + * @param vd [m/s] GPS velocity in down direction in earth-fixed NED frame + * @param eph [m] Standard deviation of horizontal position error + * @param epv [m] Standard deviation of vertical position error + * @param evh [m] Standard deviation of horizontal velocity error + * @param evv [m] Standard deviation of vertical velocity error + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_external_global_position_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t id, uint64_t time_usec, int32_t lat, int32_t lon, float alt, float vn, float ve, float vd, float eph, float epv, float evh, float evv) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_float(buf, 16, alt); + _mav_put_float(buf, 20, vn); + _mav_put_float(buf, 24, ve); + _mav_put_float(buf, 28, vd); + _mav_put_float(buf, 32, eph); + _mav_put_float(buf, 36, epv); + _mav_put_float(buf, 40, evh); + _mav_put_float(buf, 44, evv); + _mav_put_uint8_t(buf, 48, id); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN); +#else + mavlink_external_global_position_t packet; + packet.time_usec = time_usec; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.vn = vn; + packet.ve = ve; + packet.vd = vd; + packet.eph = eph; + packet.epv = epv; + packet.evh = evh; + packet.evv = evv; + packet.id = id; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_CRC); +} + +/** + * @brief Pack a external_global_position message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param id Sensor ID + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param lat [degE7] Latitude (WGS84) + * @param lon [degE7] Longitude (WGS84) + * @param alt [m] Altitude (MSL) + * @param vn [m/s] GPS velocity in north direction in earth-fixed NED frame. NaN is unused + * @param ve [m/s] GPS velocity in east direction in earth-fixed NED frame + * @param vd [m/s] GPS velocity in down direction in earth-fixed NED frame + * @param eph [m] Standard deviation of horizontal position error + * @param epv [m] Standard deviation of vertical position error + * @param evh [m] Standard deviation of horizontal velocity error + * @param evv [m] Standard deviation of vertical velocity error + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_external_global_position_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t id, uint64_t time_usec, int32_t lat, int32_t lon, float alt, float vn, float ve, float vd, float eph, float epv, float evh, float evv) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_float(buf, 16, alt); + _mav_put_float(buf, 20, vn); + _mav_put_float(buf, 24, ve); + _mav_put_float(buf, 28, vd); + _mav_put_float(buf, 32, eph); + _mav_put_float(buf, 36, epv); + _mav_put_float(buf, 40, evh); + _mav_put_float(buf, 44, evv); + _mav_put_uint8_t(buf, 48, id); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN); +#else + mavlink_external_global_position_t packet; + packet.time_usec = time_usec; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.vn = vn; + packet.ve = ve; + packet.vd = vd; + packet.eph = eph; + packet.epv = epv; + packet.evh = evh; + packet.evv = evv; + packet.id = id; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN); +#endif +} + +/** + * @brief Pack a external_global_position message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param id Sensor ID + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param lat [degE7] Latitude (WGS84) + * @param lon [degE7] Longitude (WGS84) + * @param alt [m] Altitude (MSL) + * @param vn [m/s] GPS velocity in north direction in earth-fixed NED frame. NaN is unused + * @param ve [m/s] GPS velocity in east direction in earth-fixed NED frame + * @param vd [m/s] GPS velocity in down direction in earth-fixed NED frame + * @param eph [m] Standard deviation of horizontal position error + * @param epv [m] Standard deviation of vertical position error + * @param evh [m] Standard deviation of horizontal velocity error + * @param evv [m] Standard deviation of vertical velocity error + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_external_global_position_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t id,uint64_t time_usec,int32_t lat,int32_t lon,float alt,float vn,float ve,float vd,float eph,float epv,float evh,float evv) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_float(buf, 16, alt); + _mav_put_float(buf, 20, vn); + _mav_put_float(buf, 24, ve); + _mav_put_float(buf, 28, vd); + _mav_put_float(buf, 32, eph); + _mav_put_float(buf, 36, epv); + _mav_put_float(buf, 40, evh); + _mav_put_float(buf, 44, evv); + _mav_put_uint8_t(buf, 48, id); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN); +#else + mavlink_external_global_position_t packet; + packet.time_usec = time_usec; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.vn = vn; + packet.ve = ve; + packet.vd = vd; + packet.eph = eph; + packet.epv = epv; + packet.evh = evh; + packet.evv = evv; + packet.id = id; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_CRC); +} + +/** + * @brief Encode a external_global_position struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param external_global_position C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_external_global_position_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_external_global_position_t* external_global_position) +{ + return mavlink_msg_external_global_position_pack(system_id, component_id, msg, external_global_position->id, external_global_position->time_usec, external_global_position->lat, external_global_position->lon, external_global_position->alt, external_global_position->vn, external_global_position->ve, external_global_position->vd, external_global_position->eph, external_global_position->epv, external_global_position->evh, external_global_position->evv); +} + +/** + * @brief Encode a external_global_position struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param external_global_position C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_external_global_position_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_external_global_position_t* external_global_position) +{ + return mavlink_msg_external_global_position_pack_chan(system_id, component_id, chan, msg, external_global_position->id, external_global_position->time_usec, external_global_position->lat, external_global_position->lon, external_global_position->alt, external_global_position->vn, external_global_position->ve, external_global_position->vd, external_global_position->eph, external_global_position->epv, external_global_position->evh, external_global_position->evv); +} + +/** + * @brief Encode a external_global_position struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param external_global_position C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_external_global_position_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_external_global_position_t* external_global_position) +{ + return mavlink_msg_external_global_position_pack_status(system_id, component_id, _status, msg, external_global_position->id, external_global_position->time_usec, external_global_position->lat, external_global_position->lon, external_global_position->alt, external_global_position->vn, external_global_position->ve, external_global_position->vd, external_global_position->eph, external_global_position->epv, external_global_position->evh, external_global_position->evv); +} + +/** + * @brief Send a external_global_position message + * @param chan MAVLink channel to send the message + * + * @param id Sensor ID + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param lat [degE7] Latitude (WGS84) + * @param lon [degE7] Longitude (WGS84) + * @param alt [m] Altitude (MSL) + * @param vn [m/s] GPS velocity in north direction in earth-fixed NED frame. NaN is unused + * @param ve [m/s] GPS velocity in east direction in earth-fixed NED frame + * @param vd [m/s] GPS velocity in down direction in earth-fixed NED frame + * @param eph [m] Standard deviation of horizontal position error + * @param epv [m] Standard deviation of vertical position error + * @param evh [m] Standard deviation of horizontal velocity error + * @param evv [m] Standard deviation of vertical velocity error + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_external_global_position_send(mavlink_channel_t chan, uint8_t id, uint64_t time_usec, int32_t lat, int32_t lon, float alt, float vn, float ve, float vd, float eph, float epv, float evh, float evv) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_float(buf, 16, alt); + _mav_put_float(buf, 20, vn); + _mav_put_float(buf, 24, ve); + _mav_put_float(buf, 28, vd); + _mav_put_float(buf, 32, eph); + _mav_put_float(buf, 36, epv); + _mav_put_float(buf, 40, evh); + _mav_put_float(buf, 44, evv); + _mav_put_uint8_t(buf, 48, id); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION, buf, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_CRC); +#else + mavlink_external_global_position_t packet; + packet.time_usec = time_usec; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.vn = vn; + packet.ve = ve; + packet.vd = vd; + packet.eph = eph; + packet.epv = epv; + packet.evh = evh; + packet.evv = evv; + packet.id = id; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION, (const char *)&packet, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_CRC); +#endif +} + +/** + * @brief Send a external_global_position message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_external_global_position_send_struct(mavlink_channel_t chan, const mavlink_external_global_position_t* external_global_position) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_external_global_position_send(chan, external_global_position->id, external_global_position->time_usec, external_global_position->lat, external_global_position->lon, external_global_position->alt, external_global_position->vn, external_global_position->ve, external_global_position->vd, external_global_position->eph, external_global_position->epv, external_global_position->evh, external_global_position->evv); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION, (const char *)external_global_position, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_CRC); +#endif +} + +#if MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by re-using + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_external_global_position_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t id, uint64_t time_usec, int32_t lat, int32_t lon, float alt, float vn, float ve, float vd, float eph, float epv, float evh, float evv) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_float(buf, 16, alt); + _mav_put_float(buf, 20, vn); + _mav_put_float(buf, 24, ve); + _mav_put_float(buf, 28, vd); + _mav_put_float(buf, 32, eph); + _mav_put_float(buf, 36, epv); + _mav_put_float(buf, 40, evh); + _mav_put_float(buf, 44, evv); + _mav_put_uint8_t(buf, 48, id); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION, buf, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_CRC); +#else + mavlink_external_global_position_t *packet = (mavlink_external_global_position_t *)msgbuf; + packet->time_usec = time_usec; + packet->lat = lat; + packet->lon = lon; + packet->alt = alt; + packet->vn = vn; + packet->ve = ve; + packet->vd = vd; + packet->eph = eph; + packet->epv = epv; + packet->evh = evh; + packet->evv = evv; + packet->id = id; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION, (const char *)packet, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_CRC); +#endif +} +#endif + +#endif + +// MESSAGE EXTERNAL_GLOBAL_POSITION UNPACKING + + +/** + * @brief Get field id from external_global_position message + * + * @return Sensor ID + */ +static inline uint8_t mavlink_msg_external_global_position_get_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 48); +} + +/** + * @brief Get field time_usec from external_global_position message + * + * @return [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + */ +static inline uint64_t mavlink_msg_external_global_position_get_time_usec(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 0); +} + +/** + * @brief Get field lat from external_global_position message + * + * @return [degE7] Latitude (WGS84) + */ +static inline int32_t mavlink_msg_external_global_position_get_lat(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 8); +} + +/** + * @brief Get field lon from external_global_position message + * + * @return [degE7] Longitude (WGS84) + */ +static inline int32_t mavlink_msg_external_global_position_get_lon(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 12); +} + +/** + * @brief Get field alt from external_global_position message + * + * @return [m] Altitude (MSL) + */ +static inline float mavlink_msg_external_global_position_get_alt(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 16); +} + +/** + * @brief Get field vn from external_global_position message + * + * @return [m/s] GPS velocity in north direction in earth-fixed NED frame. NaN is unused + */ +static inline float mavlink_msg_external_global_position_get_vn(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 20); +} + +/** + * @brief Get field ve from external_global_position message + * + * @return [m/s] GPS velocity in east direction in earth-fixed NED frame + */ +static inline float mavlink_msg_external_global_position_get_ve(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 24); +} + +/** + * @brief Get field vd from external_global_position message + * + * @return [m/s] GPS velocity in down direction in earth-fixed NED frame + */ +static inline float mavlink_msg_external_global_position_get_vd(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 28); +} + +/** + * @brief Get field eph from external_global_position message + * + * @return [m] Standard deviation of horizontal position error + */ +static inline float mavlink_msg_external_global_position_get_eph(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 32); +} + +/** + * @brief Get field epv from external_global_position message + * + * @return [m] Standard deviation of vertical position error + */ +static inline float mavlink_msg_external_global_position_get_epv(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 36); +} + +/** + * @brief Get field evh from external_global_position message + * + * @return [m] Standard deviation of horizontal velocity error + */ +static inline float mavlink_msg_external_global_position_get_evh(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 40); +} + +/** + * @brief Get field evv from external_global_position message + * + * @return [m] Standard deviation of vertical velocity error + */ +static inline float mavlink_msg_external_global_position_get_evv(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 44); +} + +/** + * @brief Decode a external_global_position message into a struct + * + * @param msg The message to decode + * @param external_global_position C-struct to decode the message contents into + */ +static inline void mavlink_msg_external_global_position_decode(const mavlink_message_t* msg, mavlink_external_global_position_t* external_global_position) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + external_global_position->time_usec = mavlink_msg_external_global_position_get_time_usec(msg); + external_global_position->lat = mavlink_msg_external_global_position_get_lat(msg); + external_global_position->lon = mavlink_msg_external_global_position_get_lon(msg); + external_global_position->alt = mavlink_msg_external_global_position_get_alt(msg); + external_global_position->vn = mavlink_msg_external_global_position_get_vn(msg); + external_global_position->ve = mavlink_msg_external_global_position_get_ve(msg); + external_global_position->vd = mavlink_msg_external_global_position_get_vd(msg); + external_global_position->eph = mavlink_msg_external_global_position_get_eph(msg); + external_global_position->epv = mavlink_msg_external_global_position_get_epv(msg); + external_global_position->evh = mavlink_msg_external_global_position_get_evh(msg); + external_global_position->evv = mavlink_msg_external_global_position_get_evv(msg); + external_global_position->id = mavlink_msg_external_global_position_get_id(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN? msg->len : MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN; + memset(external_global_position, 0, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN); + memcpy(external_global_position, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/common/mavlink_msg_fence_status.h b/common/mavlink_msg_fence_status.h index 08ba1555f..61745bb0c 100644 --- a/common/mavlink_msg_fence_status.h +++ b/common/mavlink_msg_fence_status.h @@ -87,6 +87,51 @@ static inline uint16_t mavlink_msg_fence_status_pack(uint8_t system_id, uint8_t return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FENCE_STATUS_MIN_LEN, MAVLINK_MSG_ID_FENCE_STATUS_LEN, MAVLINK_MSG_ID_FENCE_STATUS_CRC); } +/** + * @brief Pack a fence_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param breach_status Breach status (0 if currently inside fence, 1 if outside). + * @param breach_count Number of fence breaches. + * @param breach_type Last breach type. + * @param breach_time [ms] Time (since boot) of last breach. + * @param breach_mitigation Active action to prevent fence breach + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_fence_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t breach_status, uint16_t breach_count, uint8_t breach_type, uint32_t breach_time, uint8_t breach_mitigation) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_FENCE_STATUS_LEN]; + _mav_put_uint32_t(buf, 0, breach_time); + _mav_put_uint16_t(buf, 4, breach_count); + _mav_put_uint8_t(buf, 6, breach_status); + _mav_put_uint8_t(buf, 7, breach_type); + _mav_put_uint8_t(buf, 8, breach_mitigation); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FENCE_STATUS_LEN); +#else + mavlink_fence_status_t packet; + packet.breach_time = breach_time; + packet.breach_count = breach_count; + packet.breach_status = breach_status; + packet.breach_type = breach_type; + packet.breach_mitigation = breach_mitigation; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FENCE_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_FENCE_STATUS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_FENCE_STATUS_MIN_LEN, MAVLINK_MSG_ID_FENCE_STATUS_LEN, MAVLINK_MSG_ID_FENCE_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_FENCE_STATUS_MIN_LEN, MAVLINK_MSG_ID_FENCE_STATUS_LEN); +#endif +} + /** * @brief Pack a fence_status message on a channel * @param system_id ID of this system @@ -155,6 +200,20 @@ static inline uint16_t mavlink_msg_fence_status_encode_chan(uint8_t system_id, u return mavlink_msg_fence_status_pack_chan(system_id, component_id, chan, msg, fence_status->breach_status, fence_status->breach_count, fence_status->breach_type, fence_status->breach_time, fence_status->breach_mitigation); } +/** + * @brief Encode a fence_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param fence_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_fence_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_fence_status_t* fence_status) +{ + return mavlink_msg_fence_status_pack_status(system_id, component_id, _status, msg, fence_status->breach_status, fence_status->breach_count, fence_status->breach_type, fence_status->breach_time, fence_status->breach_mitigation); +} + /** * @brief Send a fence_status message * @param chan MAVLink channel to send the message @@ -206,7 +265,7 @@ static inline void mavlink_msg_fence_status_send_struct(mavlink_channel_t chan, #if MAVLINK_MSG_ID_FENCE_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_file_transfer_protocol.h b/common/mavlink_msg_file_transfer_protocol.h index 0dd4d0530..091aec65e 100644 --- a/common/mavlink_msg_file_transfer_protocol.h +++ b/common/mavlink_msg_file_transfer_protocol.h @@ -8,7 +8,7 @@ typedef struct __mavlink_file_transfer_protocol_t { uint8_t target_network; /*< Network ID (0 for broadcast)*/ uint8_t target_system; /*< System ID (0 for broadcast)*/ uint8_t target_component; /*< Component ID (0 for broadcast)*/ - uint8_t payload[251]; /*< Variable length payload. The length is defined by the remaining message length when subtracting the header and other fields. The entire content of this block is opaque unless you understand any the encoding message_type. The particular encoding used can be extension specific and might not always be documented as part of the mavlink specification.*/ + uint8_t payload[251]; /*< Variable length payload. The length is defined by the remaining message length when subtracting the header and other fields. The content/format of this block is defined in https://mavlink.io/en/services/ftp.html.*/ } mavlink_file_transfer_protocol_t; #define MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN 254 @@ -53,7 +53,7 @@ typedef struct __mavlink_file_transfer_protocol_t { * @param target_network Network ID (0 for broadcast) * @param target_system System ID (0 for broadcast) * @param target_component Component ID (0 for broadcast) - * @param payload Variable length payload. The length is defined by the remaining message length when subtracting the header and other fields. The entire content of this block is opaque unless you understand any the encoding message_type. The particular encoding used can be extension specific and might not always be documented as part of the mavlink specification. + * @param payload Variable length payload. The length is defined by the remaining message length when subtracting the header and other fields. The content/format of this block is defined in https://mavlink.io/en/services/ftp.html. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_file_transfer_protocol_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, @@ -71,7 +71,7 @@ static inline uint16_t mavlink_msg_file_transfer_protocol_pack(uint8_t system_id packet.target_network = target_network; packet.target_system = target_system; packet.target_component = target_component; - mav_array_memcpy(packet.payload, payload, sizeof(uint8_t)*251); + mav_array_assign_uint8_t(packet.payload, payload, 251); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN); #endif @@ -79,6 +79,46 @@ static inline uint16_t mavlink_msg_file_transfer_protocol_pack(uint8_t system_id return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_MIN_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_CRC); } +/** + * @brief Pack a file_transfer_protocol message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_network Network ID (0 for broadcast) + * @param target_system System ID (0 for broadcast) + * @param target_component Component ID (0 for broadcast) + * @param payload Variable length payload. The length is defined by the remaining message length when subtracting the header and other fields. The content/format of this block is defined in https://mavlink.io/en/services/ftp.html. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_file_transfer_protocol_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_network, uint8_t target_system, uint8_t target_component, const uint8_t *payload) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN]; + _mav_put_uint8_t(buf, 0, target_network); + _mav_put_uint8_t(buf, 1, target_system); + _mav_put_uint8_t(buf, 2, target_component); + _mav_put_uint8_t_array(buf, 3, payload, 251); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN); +#else + mavlink_file_transfer_protocol_t packet; + packet.target_network = target_network; + packet.target_system = target_system; + packet.target_component = target_component; + mav_array_memcpy(packet.payload, payload, sizeof(uint8_t)*251); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_MIN_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_MIN_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN); +#endif +} + /** * @brief Pack a file_transfer_protocol message on a channel * @param system_id ID of this system @@ -88,7 +128,7 @@ static inline uint16_t mavlink_msg_file_transfer_protocol_pack(uint8_t system_id * @param target_network Network ID (0 for broadcast) * @param target_system System ID (0 for broadcast) * @param target_component Component ID (0 for broadcast) - * @param payload Variable length payload. The length is defined by the remaining message length when subtracting the header and other fields. The entire content of this block is opaque unless you understand any the encoding message_type. The particular encoding used can be extension specific and might not always be documented as part of the mavlink specification. + * @param payload Variable length payload. The length is defined by the remaining message length when subtracting the header and other fields. The content/format of this block is defined in https://mavlink.io/en/services/ftp.html. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_file_transfer_protocol_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, @@ -107,7 +147,7 @@ static inline uint16_t mavlink_msg_file_transfer_protocol_pack_chan(uint8_t syst packet.target_network = target_network; packet.target_system = target_system; packet.target_component = target_component; - mav_array_memcpy(packet.payload, payload, sizeof(uint8_t)*251); + mav_array_assign_uint8_t(packet.payload, payload, 251); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN); #endif @@ -142,6 +182,20 @@ static inline uint16_t mavlink_msg_file_transfer_protocol_encode_chan(uint8_t sy return mavlink_msg_file_transfer_protocol_pack_chan(system_id, component_id, chan, msg, file_transfer_protocol->target_network, file_transfer_protocol->target_system, file_transfer_protocol->target_component, file_transfer_protocol->payload); } +/** + * @brief Encode a file_transfer_protocol struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param file_transfer_protocol C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_file_transfer_protocol_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_file_transfer_protocol_t* file_transfer_protocol) +{ + return mavlink_msg_file_transfer_protocol_pack_status(system_id, component_id, _status, msg, file_transfer_protocol->target_network, file_transfer_protocol->target_system, file_transfer_protocol->target_component, file_transfer_protocol->payload); +} + /** * @brief Send a file_transfer_protocol message * @param chan MAVLink channel to send the message @@ -149,7 +203,7 @@ static inline uint16_t mavlink_msg_file_transfer_protocol_encode_chan(uint8_t sy * @param target_network Network ID (0 for broadcast) * @param target_system System ID (0 for broadcast) * @param target_component Component ID (0 for broadcast) - * @param payload Variable length payload. The length is defined by the remaining message length when subtracting the header and other fields. The entire content of this block is opaque unless you understand any the encoding message_type. The particular encoding used can be extension specific and might not always be documented as part of the mavlink specification. + * @param payload Variable length payload. The length is defined by the remaining message length when subtracting the header and other fields. The content/format of this block is defined in https://mavlink.io/en/services/ftp.html. */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS @@ -167,7 +221,7 @@ static inline void mavlink_msg_file_transfer_protocol_send(mavlink_channel_t cha packet.target_network = target_network; packet.target_system = target_system; packet.target_component = target_component; - mav_array_memcpy(packet.payload, payload, sizeof(uint8_t)*251); + mav_array_assign_uint8_t(packet.payload, payload, 251); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL, (const char *)&packet, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_MIN_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_CRC); #endif } @@ -188,7 +242,7 @@ static inline void mavlink_msg_file_transfer_protocol_send_struct(mavlink_channe #if MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -208,7 +262,7 @@ static inline void mavlink_msg_file_transfer_protocol_send_buf(mavlink_message_t packet->target_network = target_network; packet->target_system = target_system; packet->target_component = target_component; - mav_array_memcpy(packet->payload, payload, sizeof(uint8_t)*251); + mav_array_assign_uint8_t(packet->payload, payload, 251); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL, (const char *)packet, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_MIN_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_CRC); #endif } @@ -252,7 +306,7 @@ static inline uint8_t mavlink_msg_file_transfer_protocol_get_target_component(co /** * @brief Get field payload from file_transfer_protocol message * - * @return Variable length payload. The length is defined by the remaining message length when subtracting the header and other fields. The entire content of this block is opaque unless you understand any the encoding message_type. The particular encoding used can be extension specific and might not always be documented as part of the mavlink specification. + * @return Variable length payload. The length is defined by the remaining message length when subtracting the header and other fields. The content/format of this block is defined in https://mavlink.io/en/services/ftp.html. */ static inline uint16_t mavlink_msg_file_transfer_protocol_get_payload(const mavlink_message_t* msg, uint8_t *payload) { diff --git a/common/mavlink_msg_flight_information.h b/common/mavlink_msg_flight_information.h index 78513ff59..57e5d385a 100644 --- a/common/mavlink_msg_flight_information.h +++ b/common/mavlink_msg_flight_information.h @@ -5,15 +5,16 @@ typedef struct __mavlink_flight_information_t { - uint64_t arming_time_utc; /*< [us] Timestamp at arming (time since UNIX epoch) in UTC, 0 for unknown*/ - uint64_t takeoff_time_utc; /*< [us] Timestamp at takeoff (time since UNIX epoch) in UTC, 0 for unknown*/ - uint64_t flight_uuid; /*< Universally unique identifier (UUID) of flight, should correspond to name of log files*/ + uint64_t arming_time_utc; /*< [us] Timestamp at arming (since system boot). Set to 0 on boot. Set value on arming. Note, field is misnamed UTC.*/ + uint64_t takeoff_time_utc; /*< [us] Timestamp at takeoff (since system boot). Set to 0 at boot and on arming. Note, field is misnamed UTC.*/ + uint64_t flight_uuid; /*< Flight number. Note, field is misnamed UUID.*/ uint32_t time_boot_ms; /*< [ms] Timestamp (time since system boot).*/ + uint32_t landing_time; /*< [ms] Timestamp at landing (in ms since system boot). Set to 0 at boot and on arming.*/ } mavlink_flight_information_t; -#define MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN 28 +#define MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN 32 #define MAVLINK_MSG_ID_FLIGHT_INFORMATION_MIN_LEN 28 -#define MAVLINK_MSG_ID_264_LEN 28 +#define MAVLINK_MSG_ID_264_LEN 32 #define MAVLINK_MSG_ID_264_MIN_LEN 28 #define MAVLINK_MSG_ID_FLIGHT_INFORMATION_CRC 49 @@ -25,21 +26,23 @@ typedef struct __mavlink_flight_information_t { #define MAVLINK_MESSAGE_INFO_FLIGHT_INFORMATION { \ 264, \ "FLIGHT_INFORMATION", \ - 4, \ + 5, \ { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 24, offsetof(mavlink_flight_information_t, time_boot_ms) }, \ { "arming_time_utc", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_flight_information_t, arming_time_utc) }, \ { "takeoff_time_utc", NULL, MAVLINK_TYPE_UINT64_T, 0, 8, offsetof(mavlink_flight_information_t, takeoff_time_utc) }, \ { "flight_uuid", NULL, MAVLINK_TYPE_UINT64_T, 0, 16, offsetof(mavlink_flight_information_t, flight_uuid) }, \ + { "landing_time", NULL, MAVLINK_TYPE_UINT32_T, 0, 28, offsetof(mavlink_flight_information_t, landing_time) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_FLIGHT_INFORMATION { \ "FLIGHT_INFORMATION", \ - 4, \ + 5, \ { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 24, offsetof(mavlink_flight_information_t, time_boot_ms) }, \ { "arming_time_utc", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_flight_information_t, arming_time_utc) }, \ { "takeoff_time_utc", NULL, MAVLINK_TYPE_UINT64_T, 0, 8, offsetof(mavlink_flight_information_t, takeoff_time_utc) }, \ { "flight_uuid", NULL, MAVLINK_TYPE_UINT64_T, 0, 16, offsetof(mavlink_flight_information_t, flight_uuid) }, \ + { "landing_time", NULL, MAVLINK_TYPE_UINT32_T, 0, 28, offsetof(mavlink_flight_information_t, landing_time) }, \ } \ } #endif @@ -51,13 +54,14 @@ typedef struct __mavlink_flight_information_t { * @param msg The MAVLink message to compress the data into * * @param time_boot_ms [ms] Timestamp (time since system boot). - * @param arming_time_utc [us] Timestamp at arming (time since UNIX epoch) in UTC, 0 for unknown - * @param takeoff_time_utc [us] Timestamp at takeoff (time since UNIX epoch) in UTC, 0 for unknown - * @param flight_uuid Universally unique identifier (UUID) of flight, should correspond to name of log files + * @param arming_time_utc [us] Timestamp at arming (since system boot). Set to 0 on boot. Set value on arming. Note, field is misnamed UTC. + * @param takeoff_time_utc [us] Timestamp at takeoff (since system boot). Set to 0 at boot and on arming. Note, field is misnamed UTC. + * @param flight_uuid Flight number. Note, field is misnamed UUID. + * @param landing_time [ms] Timestamp at landing (in ms since system boot). Set to 0 at boot and on arming. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_flight_information_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint32_t time_boot_ms, uint64_t arming_time_utc, uint64_t takeoff_time_utc, uint64_t flight_uuid) + uint32_t time_boot_ms, uint64_t arming_time_utc, uint64_t takeoff_time_utc, uint64_t flight_uuid, uint32_t landing_time) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN]; @@ -65,6 +69,7 @@ static inline uint16_t mavlink_msg_flight_information_pack(uint8_t system_id, ui _mav_put_uint64_t(buf, 8, takeoff_time_utc); _mav_put_uint64_t(buf, 16, flight_uuid); _mav_put_uint32_t(buf, 24, time_boot_ms); + _mav_put_uint32_t(buf, 28, landing_time); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN); #else @@ -73,6 +78,7 @@ static inline uint16_t mavlink_msg_flight_information_pack(uint8_t system_id, ui packet.takeoff_time_utc = takeoff_time_utc; packet.flight_uuid = flight_uuid; packet.time_boot_ms = time_boot_ms; + packet.landing_time = landing_time; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN); #endif @@ -81,6 +87,51 @@ static inline uint16_t mavlink_msg_flight_information_pack(uint8_t system_id, ui return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FLIGHT_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN, MAVLINK_MSG_ID_FLIGHT_INFORMATION_CRC); } +/** + * @brief Pack a flight_information message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param arming_time_utc [us] Timestamp at arming (since system boot). Set to 0 on boot. Set value on arming. Note, field is misnamed UTC. + * @param takeoff_time_utc [us] Timestamp at takeoff (since system boot). Set to 0 at boot and on arming. Note, field is misnamed UTC. + * @param flight_uuid Flight number. Note, field is misnamed UUID. + * @param landing_time [ms] Timestamp at landing (in ms since system boot). Set to 0 at boot and on arming. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_flight_information_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, uint64_t arming_time_utc, uint64_t takeoff_time_utc, uint64_t flight_uuid, uint32_t landing_time) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN]; + _mav_put_uint64_t(buf, 0, arming_time_utc); + _mav_put_uint64_t(buf, 8, takeoff_time_utc); + _mav_put_uint64_t(buf, 16, flight_uuid); + _mav_put_uint32_t(buf, 24, time_boot_ms); + _mav_put_uint32_t(buf, 28, landing_time); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN); +#else + mavlink_flight_information_t packet; + packet.arming_time_utc = arming_time_utc; + packet.takeoff_time_utc = takeoff_time_utc; + packet.flight_uuid = flight_uuid; + packet.time_boot_ms = time_boot_ms; + packet.landing_time = landing_time; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_FLIGHT_INFORMATION; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_FLIGHT_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN, MAVLINK_MSG_ID_FLIGHT_INFORMATION_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_FLIGHT_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN); +#endif +} + /** * @brief Pack a flight_information message on a channel * @param system_id ID of this system @@ -88,14 +139,15 @@ static inline uint16_t mavlink_msg_flight_information_pack(uint8_t system_id, ui * @param chan The MAVLink channel this message will be sent over * @param msg The MAVLink message to compress the data into * @param time_boot_ms [ms] Timestamp (time since system boot). - * @param arming_time_utc [us] Timestamp at arming (time since UNIX epoch) in UTC, 0 for unknown - * @param takeoff_time_utc [us] Timestamp at takeoff (time since UNIX epoch) in UTC, 0 for unknown - * @param flight_uuid Universally unique identifier (UUID) of flight, should correspond to name of log files + * @param arming_time_utc [us] Timestamp at arming (since system boot). Set to 0 on boot. Set value on arming. Note, field is misnamed UTC. + * @param takeoff_time_utc [us] Timestamp at takeoff (since system boot). Set to 0 at boot and on arming. Note, field is misnamed UTC. + * @param flight_uuid Flight number. Note, field is misnamed UUID. + * @param landing_time [ms] Timestamp at landing (in ms since system boot). Set to 0 at boot and on arming. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_flight_information_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - uint32_t time_boot_ms,uint64_t arming_time_utc,uint64_t takeoff_time_utc,uint64_t flight_uuid) + uint32_t time_boot_ms,uint64_t arming_time_utc,uint64_t takeoff_time_utc,uint64_t flight_uuid,uint32_t landing_time) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN]; @@ -103,6 +155,7 @@ static inline uint16_t mavlink_msg_flight_information_pack_chan(uint8_t system_i _mav_put_uint64_t(buf, 8, takeoff_time_utc); _mav_put_uint64_t(buf, 16, flight_uuid); _mav_put_uint32_t(buf, 24, time_boot_ms); + _mav_put_uint32_t(buf, 28, landing_time); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN); #else @@ -111,6 +164,7 @@ static inline uint16_t mavlink_msg_flight_information_pack_chan(uint8_t system_i packet.takeoff_time_utc = takeoff_time_utc; packet.flight_uuid = flight_uuid; packet.time_boot_ms = time_boot_ms; + packet.landing_time = landing_time; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN); #endif @@ -129,7 +183,7 @@ static inline uint16_t mavlink_msg_flight_information_pack_chan(uint8_t system_i */ static inline uint16_t mavlink_msg_flight_information_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_flight_information_t* flight_information) { - return mavlink_msg_flight_information_pack(system_id, component_id, msg, flight_information->time_boot_ms, flight_information->arming_time_utc, flight_information->takeoff_time_utc, flight_information->flight_uuid); + return mavlink_msg_flight_information_pack(system_id, component_id, msg, flight_information->time_boot_ms, flight_information->arming_time_utc, flight_information->takeoff_time_utc, flight_information->flight_uuid, flight_information->landing_time); } /** @@ -143,7 +197,21 @@ static inline uint16_t mavlink_msg_flight_information_encode(uint8_t system_id, */ static inline uint16_t mavlink_msg_flight_information_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_flight_information_t* flight_information) { - return mavlink_msg_flight_information_pack_chan(system_id, component_id, chan, msg, flight_information->time_boot_ms, flight_information->arming_time_utc, flight_information->takeoff_time_utc, flight_information->flight_uuid); + return mavlink_msg_flight_information_pack_chan(system_id, component_id, chan, msg, flight_information->time_boot_ms, flight_information->arming_time_utc, flight_information->takeoff_time_utc, flight_information->flight_uuid, flight_information->landing_time); +} + +/** + * @brief Encode a flight_information struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param flight_information C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_flight_information_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_flight_information_t* flight_information) +{ + return mavlink_msg_flight_information_pack_status(system_id, component_id, _status, msg, flight_information->time_boot_ms, flight_information->arming_time_utc, flight_information->takeoff_time_utc, flight_information->flight_uuid, flight_information->landing_time); } /** @@ -151,13 +219,14 @@ static inline uint16_t mavlink_msg_flight_information_encode_chan(uint8_t system * @param chan MAVLink channel to send the message * * @param time_boot_ms [ms] Timestamp (time since system boot). - * @param arming_time_utc [us] Timestamp at arming (time since UNIX epoch) in UTC, 0 for unknown - * @param takeoff_time_utc [us] Timestamp at takeoff (time since UNIX epoch) in UTC, 0 for unknown - * @param flight_uuid Universally unique identifier (UUID) of flight, should correspond to name of log files + * @param arming_time_utc [us] Timestamp at arming (since system boot). Set to 0 on boot. Set value on arming. Note, field is misnamed UTC. + * @param takeoff_time_utc [us] Timestamp at takeoff (since system boot). Set to 0 at boot and on arming. Note, field is misnamed UTC. + * @param flight_uuid Flight number. Note, field is misnamed UUID. + * @param landing_time [ms] Timestamp at landing (in ms since system boot). Set to 0 at boot and on arming. */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_flight_information_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint64_t arming_time_utc, uint64_t takeoff_time_utc, uint64_t flight_uuid) +static inline void mavlink_msg_flight_information_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint64_t arming_time_utc, uint64_t takeoff_time_utc, uint64_t flight_uuid, uint32_t landing_time) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN]; @@ -165,6 +234,7 @@ static inline void mavlink_msg_flight_information_send(mavlink_channel_t chan, u _mav_put_uint64_t(buf, 8, takeoff_time_utc); _mav_put_uint64_t(buf, 16, flight_uuid); _mav_put_uint32_t(buf, 24, time_boot_ms); + _mav_put_uint32_t(buf, 28, landing_time); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLIGHT_INFORMATION, buf, MAVLINK_MSG_ID_FLIGHT_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN, MAVLINK_MSG_ID_FLIGHT_INFORMATION_CRC); #else @@ -173,6 +243,7 @@ static inline void mavlink_msg_flight_information_send(mavlink_channel_t chan, u packet.takeoff_time_utc = takeoff_time_utc; packet.flight_uuid = flight_uuid; packet.time_boot_ms = time_boot_ms; + packet.landing_time = landing_time; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLIGHT_INFORMATION, (const char *)&packet, MAVLINK_MSG_ID_FLIGHT_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN, MAVLINK_MSG_ID_FLIGHT_INFORMATION_CRC); #endif @@ -186,7 +257,7 @@ static inline void mavlink_msg_flight_information_send(mavlink_channel_t chan, u static inline void mavlink_msg_flight_information_send_struct(mavlink_channel_t chan, const mavlink_flight_information_t* flight_information) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_flight_information_send(chan, flight_information->time_boot_ms, flight_information->arming_time_utc, flight_information->takeoff_time_utc, flight_information->flight_uuid); + mavlink_msg_flight_information_send(chan, flight_information->time_boot_ms, flight_information->arming_time_utc, flight_information->takeoff_time_utc, flight_information->flight_uuid, flight_information->landing_time); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLIGHT_INFORMATION, (const char *)flight_information, MAVLINK_MSG_ID_FLIGHT_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN, MAVLINK_MSG_ID_FLIGHT_INFORMATION_CRC); #endif @@ -194,13 +265,13 @@ static inline void mavlink_msg_flight_information_send_struct(mavlink_channel_t #if MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_flight_information_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint64_t arming_time_utc, uint64_t takeoff_time_utc, uint64_t flight_uuid) +static inline void mavlink_msg_flight_information_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint64_t arming_time_utc, uint64_t takeoff_time_utc, uint64_t flight_uuid, uint32_t landing_time) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; @@ -208,6 +279,7 @@ static inline void mavlink_msg_flight_information_send_buf(mavlink_message_t *ms _mav_put_uint64_t(buf, 8, takeoff_time_utc); _mav_put_uint64_t(buf, 16, flight_uuid); _mav_put_uint32_t(buf, 24, time_boot_ms); + _mav_put_uint32_t(buf, 28, landing_time); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLIGHT_INFORMATION, buf, MAVLINK_MSG_ID_FLIGHT_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN, MAVLINK_MSG_ID_FLIGHT_INFORMATION_CRC); #else @@ -216,6 +288,7 @@ static inline void mavlink_msg_flight_information_send_buf(mavlink_message_t *ms packet->takeoff_time_utc = takeoff_time_utc; packet->flight_uuid = flight_uuid; packet->time_boot_ms = time_boot_ms; + packet->landing_time = landing_time; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLIGHT_INFORMATION, (const char *)packet, MAVLINK_MSG_ID_FLIGHT_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN, MAVLINK_MSG_ID_FLIGHT_INFORMATION_CRC); #endif @@ -240,7 +313,7 @@ static inline uint32_t mavlink_msg_flight_information_get_time_boot_ms(const mav /** * @brief Get field arming_time_utc from flight_information message * - * @return [us] Timestamp at arming (time since UNIX epoch) in UTC, 0 for unknown + * @return [us] Timestamp at arming (since system boot). Set to 0 on boot. Set value on arming. Note, field is misnamed UTC. */ static inline uint64_t mavlink_msg_flight_information_get_arming_time_utc(const mavlink_message_t* msg) { @@ -250,7 +323,7 @@ static inline uint64_t mavlink_msg_flight_information_get_arming_time_utc(const /** * @brief Get field takeoff_time_utc from flight_information message * - * @return [us] Timestamp at takeoff (time since UNIX epoch) in UTC, 0 for unknown + * @return [us] Timestamp at takeoff (since system boot). Set to 0 at boot and on arming. Note, field is misnamed UTC. */ static inline uint64_t mavlink_msg_flight_information_get_takeoff_time_utc(const mavlink_message_t* msg) { @@ -260,13 +333,23 @@ static inline uint64_t mavlink_msg_flight_information_get_takeoff_time_utc(const /** * @brief Get field flight_uuid from flight_information message * - * @return Universally unique identifier (UUID) of flight, should correspond to name of log files + * @return Flight number. Note, field is misnamed UUID. */ static inline uint64_t mavlink_msg_flight_information_get_flight_uuid(const mavlink_message_t* msg) { return _MAV_RETURN_uint64_t(msg, 16); } +/** + * @brief Get field landing_time from flight_information message + * + * @return [ms] Timestamp at landing (in ms since system boot). Set to 0 at boot and on arming. + */ +static inline uint32_t mavlink_msg_flight_information_get_landing_time(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 28); +} + /** * @brief Decode a flight_information message into a struct * @@ -280,6 +363,7 @@ static inline void mavlink_msg_flight_information_decode(const mavlink_message_t flight_information->takeoff_time_utc = mavlink_msg_flight_information_get_takeoff_time_utc(msg); flight_information->flight_uuid = mavlink_msg_flight_information_get_flight_uuid(msg); flight_information->time_boot_ms = mavlink_msg_flight_information_get_time_boot_ms(msg); + flight_information->landing_time = mavlink_msg_flight_information_get_landing_time(msg); #else uint8_t len = msg->len < MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN? msg->len : MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN; memset(flight_information, 0, MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN); diff --git a/common/mavlink_msg_follow_target.h b/common/mavlink_msg_follow_target.h index 01d03ab51..c8a9dbb86 100644 --- a/common/mavlink_msg_follow_target.h +++ b/common/mavlink_msg_follow_target.h @@ -12,7 +12,7 @@ typedef struct __mavlink_follow_target_t { float alt; /*< [m] Altitude (MSL)*/ float vel[3]; /*< [m/s] target velocity (0,0,0) for unknown*/ float acc[3]; /*< [m/s/s] linear target acceleration (0,0,0) for unknown*/ - float attitude_q[4]; /*< (1 0 0 0 for unknown)*/ + float attitude_q[4]; /*< (0 0 0 0 for unknown)*/ float rates[3]; /*< (0 0 0 for unknown)*/ float position_cov[3]; /*< eph epv*/ uint8_t est_capabilities; /*< bit positions for tracker reporting capabilities (POS = 0, VEL = 1, ACCEL = 2, ATT + RATES = 3)*/ @@ -82,7 +82,7 @@ typedef struct __mavlink_follow_target_t { * @param alt [m] Altitude (MSL) * @param vel [m/s] target velocity (0,0,0) for unknown * @param acc [m/s/s] linear target acceleration (0,0,0) for unknown - * @param attitude_q (1 0 0 0 for unknown) + * @param attitude_q (0 0 0 0 for unknown) * @param rates (0 0 0 for unknown) * @param position_cov eph epv * @param custom_state button states or switches of a tracker device @@ -91,6 +91,63 @@ typedef struct __mavlink_follow_target_t { static inline uint16_t mavlink_msg_follow_target_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint64_t timestamp, uint8_t est_capabilities, int32_t lat, int32_t lon, float alt, const float *vel, const float *acc, const float *attitude_q, const float *rates, const float *position_cov, uint64_t custom_state) { +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_FOLLOW_TARGET_LEN]; + _mav_put_uint64_t(buf, 0, timestamp); + _mav_put_uint64_t(buf, 8, custom_state); + _mav_put_int32_t(buf, 16, lat); + _mav_put_int32_t(buf, 20, lon); + _mav_put_float(buf, 24, alt); + _mav_put_uint8_t(buf, 92, est_capabilities); + _mav_put_float_array(buf, 28, vel, 3); + _mav_put_float_array(buf, 40, acc, 3); + _mav_put_float_array(buf, 52, attitude_q, 4); + _mav_put_float_array(buf, 68, rates, 3); + _mav_put_float_array(buf, 80, position_cov, 3); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN); +#else + mavlink_follow_target_t packet; + packet.timestamp = timestamp; + packet.custom_state = custom_state; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.est_capabilities = est_capabilities; + mav_array_assign_float(packet.vel, vel, 3); + mav_array_assign_float(packet.acc, acc, 3); + mav_array_assign_float(packet.attitude_q, attitude_q, 4); + mav_array_assign_float(packet.rates, rates, 3); + mav_array_assign_float(packet.position_cov, position_cov, 3); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_FOLLOW_TARGET; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FOLLOW_TARGET_MIN_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_CRC); +} + +/** + * @brief Pack a follow_target message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param timestamp [ms] Timestamp (time since system boot). + * @param est_capabilities bit positions for tracker reporting capabilities (POS = 0, VEL = 1, ACCEL = 2, ATT + RATES = 3) + * @param lat [degE7] Latitude (WGS84) + * @param lon [degE7] Longitude (WGS84) + * @param alt [m] Altitude (MSL) + * @param vel [m/s] target velocity (0,0,0) for unknown + * @param acc [m/s/s] linear target acceleration (0,0,0) for unknown + * @param attitude_q (0 0 0 0 for unknown) + * @param rates (0 0 0 for unknown) + * @param position_cov eph epv + * @param custom_state button states or switches of a tracker device + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_follow_target_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t timestamp, uint8_t est_capabilities, int32_t lat, int32_t lon, float alt, const float *vel, const float *acc, const float *attitude_q, const float *rates, const float *position_cov, uint64_t custom_state) +{ #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_FOLLOW_TARGET_LEN]; _mav_put_uint64_t(buf, 0, timestamp); @@ -122,7 +179,11 @@ static inline uint16_t mavlink_msg_follow_target_pack(uint8_t system_id, uint8_t #endif msg->msgid = MAVLINK_MSG_ID_FOLLOW_TARGET; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FOLLOW_TARGET_MIN_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_CRC); +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_FOLLOW_TARGET_MIN_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_FOLLOW_TARGET_MIN_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN); +#endif } /** @@ -138,7 +199,7 @@ static inline uint16_t mavlink_msg_follow_target_pack(uint8_t system_id, uint8_t * @param alt [m] Altitude (MSL) * @param vel [m/s] target velocity (0,0,0) for unknown * @param acc [m/s/s] linear target acceleration (0,0,0) for unknown - * @param attitude_q (1 0 0 0 for unknown) + * @param attitude_q (0 0 0 0 for unknown) * @param rates (0 0 0 for unknown) * @param position_cov eph epv * @param custom_state button states or switches of a tracker device @@ -170,11 +231,11 @@ static inline uint16_t mavlink_msg_follow_target_pack_chan(uint8_t system_id, ui packet.lon = lon; packet.alt = alt; packet.est_capabilities = est_capabilities; - mav_array_memcpy(packet.vel, vel, sizeof(float)*3); - mav_array_memcpy(packet.acc, acc, sizeof(float)*3); - mav_array_memcpy(packet.attitude_q, attitude_q, sizeof(float)*4); - mav_array_memcpy(packet.rates, rates, sizeof(float)*3); - mav_array_memcpy(packet.position_cov, position_cov, sizeof(float)*3); + mav_array_assign_float(packet.vel, vel, 3); + mav_array_assign_float(packet.acc, acc, 3); + mav_array_assign_float(packet.attitude_q, attitude_q, 4); + mav_array_assign_float(packet.rates, rates, 3); + mav_array_assign_float(packet.position_cov, position_cov, 3); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN); #endif @@ -209,6 +270,20 @@ static inline uint16_t mavlink_msg_follow_target_encode_chan(uint8_t system_id, return mavlink_msg_follow_target_pack_chan(system_id, component_id, chan, msg, follow_target->timestamp, follow_target->est_capabilities, follow_target->lat, follow_target->lon, follow_target->alt, follow_target->vel, follow_target->acc, follow_target->attitude_q, follow_target->rates, follow_target->position_cov, follow_target->custom_state); } +/** + * @brief Encode a follow_target struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param follow_target C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_follow_target_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_follow_target_t* follow_target) +{ + return mavlink_msg_follow_target_pack_status(system_id, component_id, _status, msg, follow_target->timestamp, follow_target->est_capabilities, follow_target->lat, follow_target->lon, follow_target->alt, follow_target->vel, follow_target->acc, follow_target->attitude_q, follow_target->rates, follow_target->position_cov, follow_target->custom_state); +} + /** * @brief Send a follow_target message * @param chan MAVLink channel to send the message @@ -220,7 +295,7 @@ static inline uint16_t mavlink_msg_follow_target_encode_chan(uint8_t system_id, * @param alt [m] Altitude (MSL) * @param vel [m/s] target velocity (0,0,0) for unknown * @param acc [m/s/s] linear target acceleration (0,0,0) for unknown - * @param attitude_q (1 0 0 0 for unknown) + * @param attitude_q (0 0 0 0 for unknown) * @param rates (0 0 0 for unknown) * @param position_cov eph epv * @param custom_state button states or switches of a tracker device @@ -251,11 +326,11 @@ static inline void mavlink_msg_follow_target_send(mavlink_channel_t chan, uint64 packet.lon = lon; packet.alt = alt; packet.est_capabilities = est_capabilities; - mav_array_memcpy(packet.vel, vel, sizeof(float)*3); - mav_array_memcpy(packet.acc, acc, sizeof(float)*3); - mav_array_memcpy(packet.attitude_q, attitude_q, sizeof(float)*4); - mav_array_memcpy(packet.rates, rates, sizeof(float)*3); - mav_array_memcpy(packet.position_cov, position_cov, sizeof(float)*3); + mav_array_assign_float(packet.vel, vel, 3); + mav_array_assign_float(packet.acc, acc, 3); + mav_array_assign_float(packet.attitude_q, attitude_q, 4); + mav_array_assign_float(packet.rates, rates, 3); + mav_array_assign_float(packet.position_cov, position_cov, 3); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FOLLOW_TARGET, (const char *)&packet, MAVLINK_MSG_ID_FOLLOW_TARGET_MIN_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_CRC); #endif } @@ -276,7 +351,7 @@ static inline void mavlink_msg_follow_target_send_struct(mavlink_channel_t chan, #if MAVLINK_MSG_ID_FOLLOW_TARGET_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -306,11 +381,11 @@ static inline void mavlink_msg_follow_target_send_buf(mavlink_message_t *msgbuf, packet->lon = lon; packet->alt = alt; packet->est_capabilities = est_capabilities; - mav_array_memcpy(packet->vel, vel, sizeof(float)*3); - mav_array_memcpy(packet->acc, acc, sizeof(float)*3); - mav_array_memcpy(packet->attitude_q, attitude_q, sizeof(float)*4); - mav_array_memcpy(packet->rates, rates, sizeof(float)*3); - mav_array_memcpy(packet->position_cov, position_cov, sizeof(float)*3); + mav_array_assign_float(packet->vel, vel, 3); + mav_array_assign_float(packet->acc, acc, 3); + mav_array_assign_float(packet->attitude_q, attitude_q, 4); + mav_array_assign_float(packet->rates, rates, 3); + mav_array_assign_float(packet->position_cov, position_cov, 3); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FOLLOW_TARGET, (const char *)packet, MAVLINK_MSG_ID_FOLLOW_TARGET_MIN_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_CRC); #endif } @@ -394,7 +469,7 @@ static inline uint16_t mavlink_msg_follow_target_get_acc(const mavlink_message_t /** * @brief Get field attitude_q from follow_target message * - * @return (1 0 0 0 for unknown) + * @return (0 0 0 0 for unknown) */ static inline uint16_t mavlink_msg_follow_target_get_attitude_q(const mavlink_message_t* msg, float *attitude_q) { diff --git a/common/mavlink_msg_fuel_status.h b/common/mavlink_msg_fuel_status.h new file mode 100644 index 000000000..3ee8b9d79 --- /dev/null +++ b/common/mavlink_msg_fuel_status.h @@ -0,0 +1,456 @@ +#pragma once +// MESSAGE FUEL_STATUS PACKING + +#define MAVLINK_MSG_ID_FUEL_STATUS 371 + + +typedef struct __mavlink_fuel_status_t { + float maximum_fuel; /*< Capacity when full. Must be provided.*/ + float consumed_fuel; /*< Consumed fuel (measured). This value should not be inferred: if not measured set to NaN. NaN: field not provided.*/ + float remaining_fuel; /*< Remaining fuel until empty (measured). The value should not be inferred: if not measured set to NaN. NaN: field not provided.*/ + float flow_rate; /*< Positive value when emptying/using, and negative if filling/replacing. NaN: field not provided.*/ + float temperature; /*< [K] Fuel temperature. NaN: field not provided.*/ + uint32_t fuel_type; /*< Fuel type. Defines units for fuel capacity and consumption fields above.*/ + uint8_t id; /*< Fuel ID. Must match ID of other messages for same fuel system, such as BATTERY_STATUS_V2.*/ + uint8_t percent_remaining; /*< [%] Percentage of remaining fuel, relative to full. Values: [0-100], UINT8_MAX: field not provided.*/ +} mavlink_fuel_status_t; + +#define MAVLINK_MSG_ID_FUEL_STATUS_LEN 26 +#define MAVLINK_MSG_ID_FUEL_STATUS_MIN_LEN 26 +#define MAVLINK_MSG_ID_371_LEN 26 +#define MAVLINK_MSG_ID_371_MIN_LEN 26 + +#define MAVLINK_MSG_ID_FUEL_STATUS_CRC 10 +#define MAVLINK_MSG_ID_371_CRC 10 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_FUEL_STATUS { \ + 371, \ + "FUEL_STATUS", \ + 8, \ + { { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_fuel_status_t, id) }, \ + { "maximum_fuel", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_fuel_status_t, maximum_fuel) }, \ + { "consumed_fuel", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_fuel_status_t, consumed_fuel) }, \ + { "remaining_fuel", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_fuel_status_t, remaining_fuel) }, \ + { "percent_remaining", NULL, MAVLINK_TYPE_UINT8_T, 0, 25, offsetof(mavlink_fuel_status_t, percent_remaining) }, \ + { "flow_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_fuel_status_t, flow_rate) }, \ + { "temperature", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_fuel_status_t, temperature) }, \ + { "fuel_type", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_fuel_status_t, fuel_type) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_FUEL_STATUS { \ + "FUEL_STATUS", \ + 8, \ + { { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_fuel_status_t, id) }, \ + { "maximum_fuel", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_fuel_status_t, maximum_fuel) }, \ + { "consumed_fuel", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_fuel_status_t, consumed_fuel) }, \ + { "remaining_fuel", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_fuel_status_t, remaining_fuel) }, \ + { "percent_remaining", NULL, MAVLINK_TYPE_UINT8_T, 0, 25, offsetof(mavlink_fuel_status_t, percent_remaining) }, \ + { "flow_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_fuel_status_t, flow_rate) }, \ + { "temperature", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_fuel_status_t, temperature) }, \ + { "fuel_type", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_fuel_status_t, fuel_type) }, \ + } \ +} +#endif + +/** + * @brief Pack a fuel_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param id Fuel ID. Must match ID of other messages for same fuel system, such as BATTERY_STATUS_V2. + * @param maximum_fuel Capacity when full. Must be provided. + * @param consumed_fuel Consumed fuel (measured). This value should not be inferred: if not measured set to NaN. NaN: field not provided. + * @param remaining_fuel Remaining fuel until empty (measured). The value should not be inferred: if not measured set to NaN. NaN: field not provided. + * @param percent_remaining [%] Percentage of remaining fuel, relative to full. Values: [0-100], UINT8_MAX: field not provided. + * @param flow_rate Positive value when emptying/using, and negative if filling/replacing. NaN: field not provided. + * @param temperature [K] Fuel temperature. NaN: field not provided. + * @param fuel_type Fuel type. Defines units for fuel capacity and consumption fields above. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_fuel_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t id, float maximum_fuel, float consumed_fuel, float remaining_fuel, uint8_t percent_remaining, float flow_rate, float temperature, uint32_t fuel_type) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_FUEL_STATUS_LEN]; + _mav_put_float(buf, 0, maximum_fuel); + _mav_put_float(buf, 4, consumed_fuel); + _mav_put_float(buf, 8, remaining_fuel); + _mav_put_float(buf, 12, flow_rate); + _mav_put_float(buf, 16, temperature); + _mav_put_uint32_t(buf, 20, fuel_type); + _mav_put_uint8_t(buf, 24, id); + _mav_put_uint8_t(buf, 25, percent_remaining); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FUEL_STATUS_LEN); +#else + mavlink_fuel_status_t packet; + packet.maximum_fuel = maximum_fuel; + packet.consumed_fuel = consumed_fuel; + packet.remaining_fuel = remaining_fuel; + packet.flow_rate = flow_rate; + packet.temperature = temperature; + packet.fuel_type = fuel_type; + packet.id = id; + packet.percent_remaining = percent_remaining; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FUEL_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_FUEL_STATUS; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FUEL_STATUS_MIN_LEN, MAVLINK_MSG_ID_FUEL_STATUS_LEN, MAVLINK_MSG_ID_FUEL_STATUS_CRC); +} + +/** + * @brief Pack a fuel_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param id Fuel ID. Must match ID of other messages for same fuel system, such as BATTERY_STATUS_V2. + * @param maximum_fuel Capacity when full. Must be provided. + * @param consumed_fuel Consumed fuel (measured). This value should not be inferred: if not measured set to NaN. NaN: field not provided. + * @param remaining_fuel Remaining fuel until empty (measured). The value should not be inferred: if not measured set to NaN. NaN: field not provided. + * @param percent_remaining [%] Percentage of remaining fuel, relative to full. Values: [0-100], UINT8_MAX: field not provided. + * @param flow_rate Positive value when emptying/using, and negative if filling/replacing. NaN: field not provided. + * @param temperature [K] Fuel temperature. NaN: field not provided. + * @param fuel_type Fuel type. Defines units for fuel capacity and consumption fields above. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_fuel_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t id, float maximum_fuel, float consumed_fuel, float remaining_fuel, uint8_t percent_remaining, float flow_rate, float temperature, uint32_t fuel_type) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_FUEL_STATUS_LEN]; + _mav_put_float(buf, 0, maximum_fuel); + _mav_put_float(buf, 4, consumed_fuel); + _mav_put_float(buf, 8, remaining_fuel); + _mav_put_float(buf, 12, flow_rate); + _mav_put_float(buf, 16, temperature); + _mav_put_uint32_t(buf, 20, fuel_type); + _mav_put_uint8_t(buf, 24, id); + _mav_put_uint8_t(buf, 25, percent_remaining); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FUEL_STATUS_LEN); +#else + mavlink_fuel_status_t packet; + packet.maximum_fuel = maximum_fuel; + packet.consumed_fuel = consumed_fuel; + packet.remaining_fuel = remaining_fuel; + packet.flow_rate = flow_rate; + packet.temperature = temperature; + packet.fuel_type = fuel_type; + packet.id = id; + packet.percent_remaining = percent_remaining; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FUEL_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_FUEL_STATUS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_FUEL_STATUS_MIN_LEN, MAVLINK_MSG_ID_FUEL_STATUS_LEN, MAVLINK_MSG_ID_FUEL_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_FUEL_STATUS_MIN_LEN, MAVLINK_MSG_ID_FUEL_STATUS_LEN); +#endif +} + +/** + * @brief Pack a fuel_status message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param id Fuel ID. Must match ID of other messages for same fuel system, such as BATTERY_STATUS_V2. + * @param maximum_fuel Capacity when full. Must be provided. + * @param consumed_fuel Consumed fuel (measured). This value should not be inferred: if not measured set to NaN. NaN: field not provided. + * @param remaining_fuel Remaining fuel until empty (measured). The value should not be inferred: if not measured set to NaN. NaN: field not provided. + * @param percent_remaining [%] Percentage of remaining fuel, relative to full. Values: [0-100], UINT8_MAX: field not provided. + * @param flow_rate Positive value when emptying/using, and negative if filling/replacing. NaN: field not provided. + * @param temperature [K] Fuel temperature. NaN: field not provided. + * @param fuel_type Fuel type. Defines units for fuel capacity and consumption fields above. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_fuel_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t id,float maximum_fuel,float consumed_fuel,float remaining_fuel,uint8_t percent_remaining,float flow_rate,float temperature,uint32_t fuel_type) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_FUEL_STATUS_LEN]; + _mav_put_float(buf, 0, maximum_fuel); + _mav_put_float(buf, 4, consumed_fuel); + _mav_put_float(buf, 8, remaining_fuel); + _mav_put_float(buf, 12, flow_rate); + _mav_put_float(buf, 16, temperature); + _mav_put_uint32_t(buf, 20, fuel_type); + _mav_put_uint8_t(buf, 24, id); + _mav_put_uint8_t(buf, 25, percent_remaining); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FUEL_STATUS_LEN); +#else + mavlink_fuel_status_t packet; + packet.maximum_fuel = maximum_fuel; + packet.consumed_fuel = consumed_fuel; + packet.remaining_fuel = remaining_fuel; + packet.flow_rate = flow_rate; + packet.temperature = temperature; + packet.fuel_type = fuel_type; + packet.id = id; + packet.percent_remaining = percent_remaining; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FUEL_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_FUEL_STATUS; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FUEL_STATUS_MIN_LEN, MAVLINK_MSG_ID_FUEL_STATUS_LEN, MAVLINK_MSG_ID_FUEL_STATUS_CRC); +} + +/** + * @brief Encode a fuel_status struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param fuel_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_fuel_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_fuel_status_t* fuel_status) +{ + return mavlink_msg_fuel_status_pack(system_id, component_id, msg, fuel_status->id, fuel_status->maximum_fuel, fuel_status->consumed_fuel, fuel_status->remaining_fuel, fuel_status->percent_remaining, fuel_status->flow_rate, fuel_status->temperature, fuel_status->fuel_type); +} + +/** + * @brief Encode a fuel_status struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param fuel_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_fuel_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_fuel_status_t* fuel_status) +{ + return mavlink_msg_fuel_status_pack_chan(system_id, component_id, chan, msg, fuel_status->id, fuel_status->maximum_fuel, fuel_status->consumed_fuel, fuel_status->remaining_fuel, fuel_status->percent_remaining, fuel_status->flow_rate, fuel_status->temperature, fuel_status->fuel_type); +} + +/** + * @brief Encode a fuel_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param fuel_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_fuel_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_fuel_status_t* fuel_status) +{ + return mavlink_msg_fuel_status_pack_status(system_id, component_id, _status, msg, fuel_status->id, fuel_status->maximum_fuel, fuel_status->consumed_fuel, fuel_status->remaining_fuel, fuel_status->percent_remaining, fuel_status->flow_rate, fuel_status->temperature, fuel_status->fuel_type); +} + +/** + * @brief Send a fuel_status message + * @param chan MAVLink channel to send the message + * + * @param id Fuel ID. Must match ID of other messages for same fuel system, such as BATTERY_STATUS_V2. + * @param maximum_fuel Capacity when full. Must be provided. + * @param consumed_fuel Consumed fuel (measured). This value should not be inferred: if not measured set to NaN. NaN: field not provided. + * @param remaining_fuel Remaining fuel until empty (measured). The value should not be inferred: if not measured set to NaN. NaN: field not provided. + * @param percent_remaining [%] Percentage of remaining fuel, relative to full. Values: [0-100], UINT8_MAX: field not provided. + * @param flow_rate Positive value when emptying/using, and negative if filling/replacing. NaN: field not provided. + * @param temperature [K] Fuel temperature. NaN: field not provided. + * @param fuel_type Fuel type. Defines units for fuel capacity and consumption fields above. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_fuel_status_send(mavlink_channel_t chan, uint8_t id, float maximum_fuel, float consumed_fuel, float remaining_fuel, uint8_t percent_remaining, float flow_rate, float temperature, uint32_t fuel_type) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_FUEL_STATUS_LEN]; + _mav_put_float(buf, 0, maximum_fuel); + _mav_put_float(buf, 4, consumed_fuel); + _mav_put_float(buf, 8, remaining_fuel); + _mav_put_float(buf, 12, flow_rate); + _mav_put_float(buf, 16, temperature); + _mav_put_uint32_t(buf, 20, fuel_type); + _mav_put_uint8_t(buf, 24, id); + _mav_put_uint8_t(buf, 25, percent_remaining); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FUEL_STATUS, buf, MAVLINK_MSG_ID_FUEL_STATUS_MIN_LEN, MAVLINK_MSG_ID_FUEL_STATUS_LEN, MAVLINK_MSG_ID_FUEL_STATUS_CRC); +#else + mavlink_fuel_status_t packet; + packet.maximum_fuel = maximum_fuel; + packet.consumed_fuel = consumed_fuel; + packet.remaining_fuel = remaining_fuel; + packet.flow_rate = flow_rate; + packet.temperature = temperature; + packet.fuel_type = fuel_type; + packet.id = id; + packet.percent_remaining = percent_remaining; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FUEL_STATUS, (const char *)&packet, MAVLINK_MSG_ID_FUEL_STATUS_MIN_LEN, MAVLINK_MSG_ID_FUEL_STATUS_LEN, MAVLINK_MSG_ID_FUEL_STATUS_CRC); +#endif +} + +/** + * @brief Send a fuel_status message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_fuel_status_send_struct(mavlink_channel_t chan, const mavlink_fuel_status_t* fuel_status) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_fuel_status_send(chan, fuel_status->id, fuel_status->maximum_fuel, fuel_status->consumed_fuel, fuel_status->remaining_fuel, fuel_status->percent_remaining, fuel_status->flow_rate, fuel_status->temperature, fuel_status->fuel_type); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FUEL_STATUS, (const char *)fuel_status, MAVLINK_MSG_ID_FUEL_STATUS_MIN_LEN, MAVLINK_MSG_ID_FUEL_STATUS_LEN, MAVLINK_MSG_ID_FUEL_STATUS_CRC); +#endif +} + +#if MAVLINK_MSG_ID_FUEL_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_fuel_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t id, float maximum_fuel, float consumed_fuel, float remaining_fuel, uint8_t percent_remaining, float flow_rate, float temperature, uint32_t fuel_type) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_float(buf, 0, maximum_fuel); + _mav_put_float(buf, 4, consumed_fuel); + _mav_put_float(buf, 8, remaining_fuel); + _mav_put_float(buf, 12, flow_rate); + _mav_put_float(buf, 16, temperature); + _mav_put_uint32_t(buf, 20, fuel_type); + _mav_put_uint8_t(buf, 24, id); + _mav_put_uint8_t(buf, 25, percent_remaining); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FUEL_STATUS, buf, MAVLINK_MSG_ID_FUEL_STATUS_MIN_LEN, MAVLINK_MSG_ID_FUEL_STATUS_LEN, MAVLINK_MSG_ID_FUEL_STATUS_CRC); +#else + mavlink_fuel_status_t *packet = (mavlink_fuel_status_t *)msgbuf; + packet->maximum_fuel = maximum_fuel; + packet->consumed_fuel = consumed_fuel; + packet->remaining_fuel = remaining_fuel; + packet->flow_rate = flow_rate; + packet->temperature = temperature; + packet->fuel_type = fuel_type; + packet->id = id; + packet->percent_remaining = percent_remaining; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FUEL_STATUS, (const char *)packet, MAVLINK_MSG_ID_FUEL_STATUS_MIN_LEN, MAVLINK_MSG_ID_FUEL_STATUS_LEN, MAVLINK_MSG_ID_FUEL_STATUS_CRC); +#endif +} +#endif + +#endif + +// MESSAGE FUEL_STATUS UNPACKING + + +/** + * @brief Get field id from fuel_status message + * + * @return Fuel ID. Must match ID of other messages for same fuel system, such as BATTERY_STATUS_V2. + */ +static inline uint8_t mavlink_msg_fuel_status_get_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 24); +} + +/** + * @brief Get field maximum_fuel from fuel_status message + * + * @return Capacity when full. Must be provided. + */ +static inline float mavlink_msg_fuel_status_get_maximum_fuel(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 0); +} + +/** + * @brief Get field consumed_fuel from fuel_status message + * + * @return Consumed fuel (measured). This value should not be inferred: if not measured set to NaN. NaN: field not provided. + */ +static inline float mavlink_msg_fuel_status_get_consumed_fuel(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 4); +} + +/** + * @brief Get field remaining_fuel from fuel_status message + * + * @return Remaining fuel until empty (measured). The value should not be inferred: if not measured set to NaN. NaN: field not provided. + */ +static inline float mavlink_msg_fuel_status_get_remaining_fuel(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 8); +} + +/** + * @brief Get field percent_remaining from fuel_status message + * + * @return [%] Percentage of remaining fuel, relative to full. Values: [0-100], UINT8_MAX: field not provided. + */ +static inline uint8_t mavlink_msg_fuel_status_get_percent_remaining(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 25); +} + +/** + * @brief Get field flow_rate from fuel_status message + * + * @return Positive value when emptying/using, and negative if filling/replacing. NaN: field not provided. + */ +static inline float mavlink_msg_fuel_status_get_flow_rate(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 12); +} + +/** + * @brief Get field temperature from fuel_status message + * + * @return [K] Fuel temperature. NaN: field not provided. + */ +static inline float mavlink_msg_fuel_status_get_temperature(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 16); +} + +/** + * @brief Get field fuel_type from fuel_status message + * + * @return Fuel type. Defines units for fuel capacity and consumption fields above. + */ +static inline uint32_t mavlink_msg_fuel_status_get_fuel_type(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 20); +} + +/** + * @brief Decode a fuel_status message into a struct + * + * @param msg The message to decode + * @param fuel_status C-struct to decode the message contents into + */ +static inline void mavlink_msg_fuel_status_decode(const mavlink_message_t* msg, mavlink_fuel_status_t* fuel_status) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + fuel_status->maximum_fuel = mavlink_msg_fuel_status_get_maximum_fuel(msg); + fuel_status->consumed_fuel = mavlink_msg_fuel_status_get_consumed_fuel(msg); + fuel_status->remaining_fuel = mavlink_msg_fuel_status_get_remaining_fuel(msg); + fuel_status->flow_rate = mavlink_msg_fuel_status_get_flow_rate(msg); + fuel_status->temperature = mavlink_msg_fuel_status_get_temperature(msg); + fuel_status->fuel_type = mavlink_msg_fuel_status_get_fuel_type(msg); + fuel_status->id = mavlink_msg_fuel_status_get_id(msg); + fuel_status->percent_remaining = mavlink_msg_fuel_status_get_percent_remaining(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_FUEL_STATUS_LEN? msg->len : MAVLINK_MSG_ID_FUEL_STATUS_LEN; + memset(fuel_status, 0, MAVLINK_MSG_ID_FUEL_STATUS_LEN); + memcpy(fuel_status, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/common/mavlink_msg_generator_status.h b/common/mavlink_msg_generator_status.h index ef960e13c..050f431b2 100644 --- a/common/mavlink_msg_generator_status.h +++ b/common/mavlink_msg_generator_status.h @@ -123,6 +123,69 @@ static inline uint16_t mavlink_msg_generator_status_pack(uint8_t system_id, uint return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GENERATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_GENERATOR_STATUS_LEN, MAVLINK_MSG_ID_GENERATOR_STATUS_CRC); } +/** + * @brief Pack a generator_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param status Status flags. + * @param generator_speed [rpm] Speed of electrical generator or alternator. UINT16_MAX: field not provided. + * @param battery_current [A] Current into/out of battery. Positive for out. Negative for in. NaN: field not provided. + * @param load_current [A] Current going to the UAV. If battery current not available this is the DC current from the generator. Positive for out. Negative for in. NaN: field not provided + * @param power_generated [W] The power being generated. NaN: field not provided + * @param bus_voltage [V] Voltage of the bus seen at the generator, or battery bus if battery bus is controlled by generator and at a different voltage to main bus. + * @param rectifier_temperature [degC] The temperature of the rectifier or power converter. INT16_MAX: field not provided. + * @param bat_current_setpoint [A] The target battery current. Positive for out. Negative for in. NaN: field not provided + * @param generator_temperature [degC] The temperature of the mechanical motor, fuel cell core or generator. INT16_MAX: field not provided. + * @param runtime [s] Seconds this generator has run since it was rebooted. UINT32_MAX: field not provided. + * @param time_until_maintenance [s] Seconds until this generator requires maintenance. A negative value indicates maintenance is past-due. INT32_MAX: field not provided. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_generator_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t status, uint16_t generator_speed, float battery_current, float load_current, float power_generated, float bus_voltage, int16_t rectifier_temperature, float bat_current_setpoint, int16_t generator_temperature, uint32_t runtime, int32_t time_until_maintenance) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GENERATOR_STATUS_LEN]; + _mav_put_uint64_t(buf, 0, status); + _mav_put_float(buf, 8, battery_current); + _mav_put_float(buf, 12, load_current); + _mav_put_float(buf, 16, power_generated); + _mav_put_float(buf, 20, bus_voltage); + _mav_put_float(buf, 24, bat_current_setpoint); + _mav_put_uint32_t(buf, 28, runtime); + _mav_put_int32_t(buf, 32, time_until_maintenance); + _mav_put_uint16_t(buf, 36, generator_speed); + _mav_put_int16_t(buf, 38, rectifier_temperature); + _mav_put_int16_t(buf, 40, generator_temperature); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GENERATOR_STATUS_LEN); +#else + mavlink_generator_status_t packet; + packet.status = status; + packet.battery_current = battery_current; + packet.load_current = load_current; + packet.power_generated = power_generated; + packet.bus_voltage = bus_voltage; + packet.bat_current_setpoint = bat_current_setpoint; + packet.runtime = runtime; + packet.time_until_maintenance = time_until_maintenance; + packet.generator_speed = generator_speed; + packet.rectifier_temperature = rectifier_temperature; + packet.generator_temperature = generator_temperature; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GENERATOR_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GENERATOR_STATUS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GENERATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_GENERATOR_STATUS_LEN, MAVLINK_MSG_ID_GENERATOR_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GENERATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_GENERATOR_STATUS_LEN); +#endif +} + /** * @brief Pack a generator_status message on a channel * @param system_id ID of this system @@ -209,6 +272,20 @@ static inline uint16_t mavlink_msg_generator_status_encode_chan(uint8_t system_i return mavlink_msg_generator_status_pack_chan(system_id, component_id, chan, msg, generator_status->status, generator_status->generator_speed, generator_status->battery_current, generator_status->load_current, generator_status->power_generated, generator_status->bus_voltage, generator_status->rectifier_temperature, generator_status->bat_current_setpoint, generator_status->generator_temperature, generator_status->runtime, generator_status->time_until_maintenance); } +/** + * @brief Encode a generator_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param generator_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_generator_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_generator_status_t* generator_status) +{ + return mavlink_msg_generator_status_pack_status(system_id, component_id, _status, msg, generator_status->status, generator_status->generator_speed, generator_status->battery_current, generator_status->load_current, generator_status->power_generated, generator_status->bus_voltage, generator_status->rectifier_temperature, generator_status->bat_current_setpoint, generator_status->generator_temperature, generator_status->runtime, generator_status->time_until_maintenance); +} + /** * @brief Send a generator_status message * @param chan MAVLink channel to send the message @@ -278,7 +355,7 @@ static inline void mavlink_msg_generator_status_send_struct(mavlink_channel_t ch #if MAVLINK_MSG_ID_GENERATOR_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_gimbal_device_attitude_status.h b/common/mavlink_msg_gimbal_device_attitude_status.h index 63275480b..85aa87f30 100644 --- a/common/mavlink_msg_gimbal_device_attitude_status.h +++ b/common/mavlink_msg_gimbal_device_attitude_status.h @@ -6,19 +6,22 @@ typedef struct __mavlink_gimbal_device_attitude_status_t { uint32_t time_boot_ms; /*< [ms] Timestamp (time since system boot).*/ - float q[4]; /*< Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation, the frame is depends on whether the flag GIMBAL_DEVICE_FLAGS_YAW_LOCK is set)*/ - float angular_velocity_x; /*< [rad/s] X component of angular velocity (NaN if unknown)*/ - float angular_velocity_y; /*< [rad/s] Y component of angular velocity (NaN if unknown)*/ - float angular_velocity_z; /*< [rad/s] Z component of angular velocity (NaN if unknown)*/ + float q[4]; /*< Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation). The frame is described in the message description.*/ + float angular_velocity_x; /*< [rad/s] X component of angular velocity (positive: rolling to the right). The frame is described in the message description. NaN if unknown.*/ + float angular_velocity_y; /*< [rad/s] Y component of angular velocity (positive: pitching up). The frame is described in the message description. NaN if unknown.*/ + float angular_velocity_z; /*< [rad/s] Z component of angular velocity (positive: yawing to the right). The frame is described in the message description. NaN if unknown.*/ uint32_t failure_flags; /*< Failure flags (0 for no failure)*/ uint16_t flags; /*< Current gimbal flags set.*/ uint8_t target_system; /*< System ID*/ uint8_t target_component; /*< Component ID*/ + float delta_yaw; /*< [rad] Yaw angle relating the quaternions in earth and body frames (see message description). NaN if unknown.*/ + float delta_yaw_velocity; /*< [rad/s] Yaw angular velocity relating the angular velocities in earth and body frames (see message description). NaN if unknown.*/ + uint8_t gimbal_device_id; /*< This field is to be used if the gimbal manager and the gimbal device are the same component and hence have the same component ID. This field is then set a number between 1-6. If the component ID is separate, this field is not required and must be set to 0.*/ } mavlink_gimbal_device_attitude_status_t; -#define MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN 40 +#define MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN 49 #define MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_MIN_LEN 40 -#define MAVLINK_MSG_ID_285_LEN 40 +#define MAVLINK_MSG_ID_285_LEN 49 #define MAVLINK_MSG_ID_285_MIN_LEN 40 #define MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_CRC 137 @@ -30,7 +33,7 @@ typedef struct __mavlink_gimbal_device_attitude_status_t { #define MAVLINK_MESSAGE_INFO_GIMBAL_DEVICE_ATTITUDE_STATUS { \ 285, \ "GIMBAL_DEVICE_ATTITUDE_STATUS", \ - 9, \ + 12, \ { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 38, offsetof(mavlink_gimbal_device_attitude_status_t, target_system) }, \ { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 39, offsetof(mavlink_gimbal_device_attitude_status_t, target_component) }, \ { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_gimbal_device_attitude_status_t, time_boot_ms) }, \ @@ -40,12 +43,15 @@ typedef struct __mavlink_gimbal_device_attitude_status_t { { "angular_velocity_y", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_gimbal_device_attitude_status_t, angular_velocity_y) }, \ { "angular_velocity_z", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_gimbal_device_attitude_status_t, angular_velocity_z) }, \ { "failure_flags", NULL, MAVLINK_TYPE_UINT32_T, 0, 32, offsetof(mavlink_gimbal_device_attitude_status_t, failure_flags) }, \ + { "delta_yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_gimbal_device_attitude_status_t, delta_yaw) }, \ + { "delta_yaw_velocity", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_gimbal_device_attitude_status_t, delta_yaw_velocity) }, \ + { "gimbal_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 48, offsetof(mavlink_gimbal_device_attitude_status_t, gimbal_device_id) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_GIMBAL_DEVICE_ATTITUDE_STATUS { \ "GIMBAL_DEVICE_ATTITUDE_STATUS", \ - 9, \ + 12, \ { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 38, offsetof(mavlink_gimbal_device_attitude_status_t, target_system) }, \ { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 39, offsetof(mavlink_gimbal_device_attitude_status_t, target_component) }, \ { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_gimbal_device_attitude_status_t, time_boot_ms) }, \ @@ -55,6 +61,9 @@ typedef struct __mavlink_gimbal_device_attitude_status_t { { "angular_velocity_y", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_gimbal_device_attitude_status_t, angular_velocity_y) }, \ { "angular_velocity_z", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_gimbal_device_attitude_status_t, angular_velocity_z) }, \ { "failure_flags", NULL, MAVLINK_TYPE_UINT32_T, 0, 32, offsetof(mavlink_gimbal_device_attitude_status_t, failure_flags) }, \ + { "delta_yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_gimbal_device_attitude_status_t, delta_yaw) }, \ + { "delta_yaw_velocity", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_gimbal_device_attitude_status_t, delta_yaw_velocity) }, \ + { "gimbal_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 48, offsetof(mavlink_gimbal_device_attitude_status_t, gimbal_device_id) }, \ } \ } #endif @@ -69,15 +78,18 @@ typedef struct __mavlink_gimbal_device_attitude_status_t { * @param target_component Component ID * @param time_boot_ms [ms] Timestamp (time since system boot). * @param flags Current gimbal flags set. - * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation, the frame is depends on whether the flag GIMBAL_DEVICE_FLAGS_YAW_LOCK is set) - * @param angular_velocity_x [rad/s] X component of angular velocity (NaN if unknown) - * @param angular_velocity_y [rad/s] Y component of angular velocity (NaN if unknown) - * @param angular_velocity_z [rad/s] Z component of angular velocity (NaN if unknown) + * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation). The frame is described in the message description. + * @param angular_velocity_x [rad/s] X component of angular velocity (positive: rolling to the right). The frame is described in the message description. NaN if unknown. + * @param angular_velocity_y [rad/s] Y component of angular velocity (positive: pitching up). The frame is described in the message description. NaN if unknown. + * @param angular_velocity_z [rad/s] Z component of angular velocity (positive: yawing to the right). The frame is described in the message description. NaN if unknown. * @param failure_flags Failure flags (0 for no failure) + * @param delta_yaw [rad] Yaw angle relating the quaternions in earth and body frames (see message description). NaN if unknown. + * @param delta_yaw_velocity [rad/s] Yaw angular velocity relating the angular velocities in earth and body frames (see message description). NaN if unknown. + * @param gimbal_device_id This field is to be used if the gimbal manager and the gimbal device are the same component and hence have the same component ID. This field is then set a number between 1-6. If the component ID is separate, this field is not required and must be set to 0. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_gimbal_device_attitude_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, uint32_t time_boot_ms, uint16_t flags, const float *q, float angular_velocity_x, float angular_velocity_y, float angular_velocity_z, uint32_t failure_flags) + uint8_t target_system, uint8_t target_component, uint32_t time_boot_ms, uint16_t flags, const float *q, float angular_velocity_x, float angular_velocity_y, float angular_velocity_z, uint32_t failure_flags, float delta_yaw, float delta_yaw_velocity, uint8_t gimbal_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN]; @@ -89,6 +101,9 @@ static inline uint16_t mavlink_msg_gimbal_device_attitude_status_pack(uint8_t sy _mav_put_uint16_t(buf, 36, flags); _mav_put_uint8_t(buf, 38, target_system); _mav_put_uint8_t(buf, 39, target_component); + _mav_put_float(buf, 40, delta_yaw); + _mav_put_float(buf, 44, delta_yaw_velocity); + _mav_put_uint8_t(buf, 48, gimbal_device_id); _mav_put_float_array(buf, 4, q, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN); #else @@ -101,7 +116,10 @@ static inline uint16_t mavlink_msg_gimbal_device_attitude_status_pack(uint8_t sy packet.flags = flags; packet.target_system = target_system; packet.target_component = target_component; - mav_array_memcpy(packet.q, q, sizeof(float)*4); + packet.delta_yaw = delta_yaw; + packet.delta_yaw_velocity = delta_yaw_velocity; + packet.gimbal_device_id = gimbal_device_id; + mav_array_assign_float(packet.q, q, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN); #endif @@ -109,6 +127,70 @@ static inline uint16_t mavlink_msg_gimbal_device_attitude_status_pack(uint8_t sy return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_CRC); } +/** + * @brief Pack a gimbal_device_attitude_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param flags Current gimbal flags set. + * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation). The frame is described in the message description. + * @param angular_velocity_x [rad/s] X component of angular velocity (positive: rolling to the right). The frame is described in the message description. NaN if unknown. + * @param angular_velocity_y [rad/s] Y component of angular velocity (positive: pitching up). The frame is described in the message description. NaN if unknown. + * @param angular_velocity_z [rad/s] Z component of angular velocity (positive: yawing to the right). The frame is described in the message description. NaN if unknown. + * @param failure_flags Failure flags (0 for no failure) + * @param delta_yaw [rad] Yaw angle relating the quaternions in earth and body frames (see message description). NaN if unknown. + * @param delta_yaw_velocity [rad/s] Yaw angular velocity relating the angular velocities in earth and body frames (see message description). NaN if unknown. + * @param gimbal_device_id This field is to be used if the gimbal manager and the gimbal device are the same component and hence have the same component ID. This field is then set a number between 1-6. If the component ID is separate, this field is not required and must be set to 0. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_gimbal_device_attitude_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint32_t time_boot_ms, uint16_t flags, const float *q, float angular_velocity_x, float angular_velocity_y, float angular_velocity_z, uint32_t failure_flags, float delta_yaw, float delta_yaw_velocity, uint8_t gimbal_device_id) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_float(buf, 20, angular_velocity_x); + _mav_put_float(buf, 24, angular_velocity_y); + _mav_put_float(buf, 28, angular_velocity_z); + _mav_put_uint32_t(buf, 32, failure_flags); + _mav_put_uint16_t(buf, 36, flags); + _mav_put_uint8_t(buf, 38, target_system); + _mav_put_uint8_t(buf, 39, target_component); + _mav_put_float(buf, 40, delta_yaw); + _mav_put_float(buf, 44, delta_yaw_velocity); + _mav_put_uint8_t(buf, 48, gimbal_device_id); + _mav_put_float_array(buf, 4, q, 4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN); +#else + mavlink_gimbal_device_attitude_status_t packet; + packet.time_boot_ms = time_boot_ms; + packet.angular_velocity_x = angular_velocity_x; + packet.angular_velocity_y = angular_velocity_y; + packet.angular_velocity_z = angular_velocity_z; + packet.failure_flags = failure_flags; + packet.flags = flags; + packet.target_system = target_system; + packet.target_component = target_component; + packet.delta_yaw = delta_yaw; + packet.delta_yaw_velocity = delta_yaw_velocity; + packet.gimbal_device_id = gimbal_device_id; + mav_array_memcpy(packet.q, q, sizeof(float)*4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN); +#endif +} + /** * @brief Pack a gimbal_device_attitude_status message on a channel * @param system_id ID of this system @@ -119,16 +201,19 @@ static inline uint16_t mavlink_msg_gimbal_device_attitude_status_pack(uint8_t sy * @param target_component Component ID * @param time_boot_ms [ms] Timestamp (time since system boot). * @param flags Current gimbal flags set. - * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation, the frame is depends on whether the flag GIMBAL_DEVICE_FLAGS_YAW_LOCK is set) - * @param angular_velocity_x [rad/s] X component of angular velocity (NaN if unknown) - * @param angular_velocity_y [rad/s] Y component of angular velocity (NaN if unknown) - * @param angular_velocity_z [rad/s] Z component of angular velocity (NaN if unknown) + * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation). The frame is described in the message description. + * @param angular_velocity_x [rad/s] X component of angular velocity (positive: rolling to the right). The frame is described in the message description. NaN if unknown. + * @param angular_velocity_y [rad/s] Y component of angular velocity (positive: pitching up). The frame is described in the message description. NaN if unknown. + * @param angular_velocity_z [rad/s] Z component of angular velocity (positive: yawing to the right). The frame is described in the message description. NaN if unknown. * @param failure_flags Failure flags (0 for no failure) + * @param delta_yaw [rad] Yaw angle relating the quaternions in earth and body frames (see message description). NaN if unknown. + * @param delta_yaw_velocity [rad/s] Yaw angular velocity relating the angular velocities in earth and body frames (see message description). NaN if unknown. + * @param gimbal_device_id This field is to be used if the gimbal manager and the gimbal device are the same component and hence have the same component ID. This field is then set a number between 1-6. If the component ID is separate, this field is not required and must be set to 0. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_gimbal_device_attitude_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,uint32_t time_boot_ms,uint16_t flags,const float *q,float angular_velocity_x,float angular_velocity_y,float angular_velocity_z,uint32_t failure_flags) + uint8_t target_system,uint8_t target_component,uint32_t time_boot_ms,uint16_t flags,const float *q,float angular_velocity_x,float angular_velocity_y,float angular_velocity_z,uint32_t failure_flags,float delta_yaw,float delta_yaw_velocity,uint8_t gimbal_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN]; @@ -140,6 +225,9 @@ static inline uint16_t mavlink_msg_gimbal_device_attitude_status_pack_chan(uint8 _mav_put_uint16_t(buf, 36, flags); _mav_put_uint8_t(buf, 38, target_system); _mav_put_uint8_t(buf, 39, target_component); + _mav_put_float(buf, 40, delta_yaw); + _mav_put_float(buf, 44, delta_yaw_velocity); + _mav_put_uint8_t(buf, 48, gimbal_device_id); _mav_put_float_array(buf, 4, q, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN); #else @@ -152,7 +240,10 @@ static inline uint16_t mavlink_msg_gimbal_device_attitude_status_pack_chan(uint8 packet.flags = flags; packet.target_system = target_system; packet.target_component = target_component; - mav_array_memcpy(packet.q, q, sizeof(float)*4); + packet.delta_yaw = delta_yaw; + packet.delta_yaw_velocity = delta_yaw_velocity; + packet.gimbal_device_id = gimbal_device_id; + mav_array_assign_float(packet.q, q, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN); #endif @@ -170,7 +261,7 @@ static inline uint16_t mavlink_msg_gimbal_device_attitude_status_pack_chan(uint8 */ static inline uint16_t mavlink_msg_gimbal_device_attitude_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gimbal_device_attitude_status_t* gimbal_device_attitude_status) { - return mavlink_msg_gimbal_device_attitude_status_pack(system_id, component_id, msg, gimbal_device_attitude_status->target_system, gimbal_device_attitude_status->target_component, gimbal_device_attitude_status->time_boot_ms, gimbal_device_attitude_status->flags, gimbal_device_attitude_status->q, gimbal_device_attitude_status->angular_velocity_x, gimbal_device_attitude_status->angular_velocity_y, gimbal_device_attitude_status->angular_velocity_z, gimbal_device_attitude_status->failure_flags); + return mavlink_msg_gimbal_device_attitude_status_pack(system_id, component_id, msg, gimbal_device_attitude_status->target_system, gimbal_device_attitude_status->target_component, gimbal_device_attitude_status->time_boot_ms, gimbal_device_attitude_status->flags, gimbal_device_attitude_status->q, gimbal_device_attitude_status->angular_velocity_x, gimbal_device_attitude_status->angular_velocity_y, gimbal_device_attitude_status->angular_velocity_z, gimbal_device_attitude_status->failure_flags, gimbal_device_attitude_status->delta_yaw, gimbal_device_attitude_status->delta_yaw_velocity, gimbal_device_attitude_status->gimbal_device_id); } /** @@ -184,7 +275,21 @@ static inline uint16_t mavlink_msg_gimbal_device_attitude_status_encode(uint8_t */ static inline uint16_t mavlink_msg_gimbal_device_attitude_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gimbal_device_attitude_status_t* gimbal_device_attitude_status) { - return mavlink_msg_gimbal_device_attitude_status_pack_chan(system_id, component_id, chan, msg, gimbal_device_attitude_status->target_system, gimbal_device_attitude_status->target_component, gimbal_device_attitude_status->time_boot_ms, gimbal_device_attitude_status->flags, gimbal_device_attitude_status->q, gimbal_device_attitude_status->angular_velocity_x, gimbal_device_attitude_status->angular_velocity_y, gimbal_device_attitude_status->angular_velocity_z, gimbal_device_attitude_status->failure_flags); + return mavlink_msg_gimbal_device_attitude_status_pack_chan(system_id, component_id, chan, msg, gimbal_device_attitude_status->target_system, gimbal_device_attitude_status->target_component, gimbal_device_attitude_status->time_boot_ms, gimbal_device_attitude_status->flags, gimbal_device_attitude_status->q, gimbal_device_attitude_status->angular_velocity_x, gimbal_device_attitude_status->angular_velocity_y, gimbal_device_attitude_status->angular_velocity_z, gimbal_device_attitude_status->failure_flags, gimbal_device_attitude_status->delta_yaw, gimbal_device_attitude_status->delta_yaw_velocity, gimbal_device_attitude_status->gimbal_device_id); +} + +/** + * @brief Encode a gimbal_device_attitude_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param gimbal_device_attitude_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_gimbal_device_attitude_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_gimbal_device_attitude_status_t* gimbal_device_attitude_status) +{ + return mavlink_msg_gimbal_device_attitude_status_pack_status(system_id, component_id, _status, msg, gimbal_device_attitude_status->target_system, gimbal_device_attitude_status->target_component, gimbal_device_attitude_status->time_boot_ms, gimbal_device_attitude_status->flags, gimbal_device_attitude_status->q, gimbal_device_attitude_status->angular_velocity_x, gimbal_device_attitude_status->angular_velocity_y, gimbal_device_attitude_status->angular_velocity_z, gimbal_device_attitude_status->failure_flags, gimbal_device_attitude_status->delta_yaw, gimbal_device_attitude_status->delta_yaw_velocity, gimbal_device_attitude_status->gimbal_device_id); } /** @@ -195,15 +300,18 @@ static inline uint16_t mavlink_msg_gimbal_device_attitude_status_encode_chan(uin * @param target_component Component ID * @param time_boot_ms [ms] Timestamp (time since system boot). * @param flags Current gimbal flags set. - * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation, the frame is depends on whether the flag GIMBAL_DEVICE_FLAGS_YAW_LOCK is set) - * @param angular_velocity_x [rad/s] X component of angular velocity (NaN if unknown) - * @param angular_velocity_y [rad/s] Y component of angular velocity (NaN if unknown) - * @param angular_velocity_z [rad/s] Z component of angular velocity (NaN if unknown) + * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation). The frame is described in the message description. + * @param angular_velocity_x [rad/s] X component of angular velocity (positive: rolling to the right). The frame is described in the message description. NaN if unknown. + * @param angular_velocity_y [rad/s] Y component of angular velocity (positive: pitching up). The frame is described in the message description. NaN if unknown. + * @param angular_velocity_z [rad/s] Z component of angular velocity (positive: yawing to the right). The frame is described in the message description. NaN if unknown. * @param failure_flags Failure flags (0 for no failure) + * @param delta_yaw [rad] Yaw angle relating the quaternions in earth and body frames (see message description). NaN if unknown. + * @param delta_yaw_velocity [rad/s] Yaw angular velocity relating the angular velocities in earth and body frames (see message description). NaN if unknown. + * @param gimbal_device_id This field is to be used if the gimbal manager and the gimbal device are the same component and hence have the same component ID. This field is then set a number between 1-6. If the component ID is separate, this field is not required and must be set to 0. */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_gimbal_device_attitude_status_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint32_t time_boot_ms, uint16_t flags, const float *q, float angular_velocity_x, float angular_velocity_y, float angular_velocity_z, uint32_t failure_flags) +static inline void mavlink_msg_gimbal_device_attitude_status_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint32_t time_boot_ms, uint16_t flags, const float *q, float angular_velocity_x, float angular_velocity_y, float angular_velocity_z, uint32_t failure_flags, float delta_yaw, float delta_yaw_velocity, uint8_t gimbal_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN]; @@ -215,6 +323,9 @@ static inline void mavlink_msg_gimbal_device_attitude_status_send(mavlink_channe _mav_put_uint16_t(buf, 36, flags); _mav_put_uint8_t(buf, 38, target_system); _mav_put_uint8_t(buf, 39, target_component); + _mav_put_float(buf, 40, delta_yaw); + _mav_put_float(buf, 44, delta_yaw_velocity); + _mav_put_uint8_t(buf, 48, gimbal_device_id); _mav_put_float_array(buf, 4, q, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS, buf, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_CRC); #else @@ -227,7 +338,10 @@ static inline void mavlink_msg_gimbal_device_attitude_status_send(mavlink_channe packet.flags = flags; packet.target_system = target_system; packet.target_component = target_component; - mav_array_memcpy(packet.q, q, sizeof(float)*4); + packet.delta_yaw = delta_yaw; + packet.delta_yaw_velocity = delta_yaw_velocity; + packet.gimbal_device_id = gimbal_device_id; + mav_array_assign_float(packet.q, q, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS, (const char *)&packet, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_CRC); #endif } @@ -240,7 +354,7 @@ static inline void mavlink_msg_gimbal_device_attitude_status_send(mavlink_channe static inline void mavlink_msg_gimbal_device_attitude_status_send_struct(mavlink_channel_t chan, const mavlink_gimbal_device_attitude_status_t* gimbal_device_attitude_status) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_gimbal_device_attitude_status_send(chan, gimbal_device_attitude_status->target_system, gimbal_device_attitude_status->target_component, gimbal_device_attitude_status->time_boot_ms, gimbal_device_attitude_status->flags, gimbal_device_attitude_status->q, gimbal_device_attitude_status->angular_velocity_x, gimbal_device_attitude_status->angular_velocity_y, gimbal_device_attitude_status->angular_velocity_z, gimbal_device_attitude_status->failure_flags); + mavlink_msg_gimbal_device_attitude_status_send(chan, gimbal_device_attitude_status->target_system, gimbal_device_attitude_status->target_component, gimbal_device_attitude_status->time_boot_ms, gimbal_device_attitude_status->flags, gimbal_device_attitude_status->q, gimbal_device_attitude_status->angular_velocity_x, gimbal_device_attitude_status->angular_velocity_y, gimbal_device_attitude_status->angular_velocity_z, gimbal_device_attitude_status->failure_flags, gimbal_device_attitude_status->delta_yaw, gimbal_device_attitude_status->delta_yaw_velocity, gimbal_device_attitude_status->gimbal_device_id); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS, (const char *)gimbal_device_attitude_status, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_CRC); #endif @@ -248,13 +362,13 @@ static inline void mavlink_msg_gimbal_device_attitude_status_send_struct(mavlink #if MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_gimbal_device_attitude_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint32_t time_boot_ms, uint16_t flags, const float *q, float angular_velocity_x, float angular_velocity_y, float angular_velocity_z, uint32_t failure_flags) +static inline void mavlink_msg_gimbal_device_attitude_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint32_t time_boot_ms, uint16_t flags, const float *q, float angular_velocity_x, float angular_velocity_y, float angular_velocity_z, uint32_t failure_flags, float delta_yaw, float delta_yaw_velocity, uint8_t gimbal_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; @@ -266,6 +380,9 @@ static inline void mavlink_msg_gimbal_device_attitude_status_send_buf(mavlink_me _mav_put_uint16_t(buf, 36, flags); _mav_put_uint8_t(buf, 38, target_system); _mav_put_uint8_t(buf, 39, target_component); + _mav_put_float(buf, 40, delta_yaw); + _mav_put_float(buf, 44, delta_yaw_velocity); + _mav_put_uint8_t(buf, 48, gimbal_device_id); _mav_put_float_array(buf, 4, q, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS, buf, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_CRC); #else @@ -278,7 +395,10 @@ static inline void mavlink_msg_gimbal_device_attitude_status_send_buf(mavlink_me packet->flags = flags; packet->target_system = target_system; packet->target_component = target_component; - mav_array_memcpy(packet->q, q, sizeof(float)*4); + packet->delta_yaw = delta_yaw; + packet->delta_yaw_velocity = delta_yaw_velocity; + packet->gimbal_device_id = gimbal_device_id; + mav_array_assign_float(packet->q, q, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS, (const char *)packet, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_CRC); #endif } @@ -332,7 +452,7 @@ static inline uint16_t mavlink_msg_gimbal_device_attitude_status_get_flags(const /** * @brief Get field q from gimbal_device_attitude_status message * - * @return Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation, the frame is depends on whether the flag GIMBAL_DEVICE_FLAGS_YAW_LOCK is set) + * @return Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation). The frame is described in the message description. */ static inline uint16_t mavlink_msg_gimbal_device_attitude_status_get_q(const mavlink_message_t* msg, float *q) { @@ -342,7 +462,7 @@ static inline uint16_t mavlink_msg_gimbal_device_attitude_status_get_q(const mav /** * @brief Get field angular_velocity_x from gimbal_device_attitude_status message * - * @return [rad/s] X component of angular velocity (NaN if unknown) + * @return [rad/s] X component of angular velocity (positive: rolling to the right). The frame is described in the message description. NaN if unknown. */ static inline float mavlink_msg_gimbal_device_attitude_status_get_angular_velocity_x(const mavlink_message_t* msg) { @@ -352,7 +472,7 @@ static inline float mavlink_msg_gimbal_device_attitude_status_get_angular_veloci /** * @brief Get field angular_velocity_y from gimbal_device_attitude_status message * - * @return [rad/s] Y component of angular velocity (NaN if unknown) + * @return [rad/s] Y component of angular velocity (positive: pitching up). The frame is described in the message description. NaN if unknown. */ static inline float mavlink_msg_gimbal_device_attitude_status_get_angular_velocity_y(const mavlink_message_t* msg) { @@ -362,7 +482,7 @@ static inline float mavlink_msg_gimbal_device_attitude_status_get_angular_veloci /** * @brief Get field angular_velocity_z from gimbal_device_attitude_status message * - * @return [rad/s] Z component of angular velocity (NaN if unknown) + * @return [rad/s] Z component of angular velocity (positive: yawing to the right). The frame is described in the message description. NaN if unknown. */ static inline float mavlink_msg_gimbal_device_attitude_status_get_angular_velocity_z(const mavlink_message_t* msg) { @@ -379,6 +499,36 @@ static inline uint32_t mavlink_msg_gimbal_device_attitude_status_get_failure_fla return _MAV_RETURN_uint32_t(msg, 32); } +/** + * @brief Get field delta_yaw from gimbal_device_attitude_status message + * + * @return [rad] Yaw angle relating the quaternions in earth and body frames (see message description). NaN if unknown. + */ +static inline float mavlink_msg_gimbal_device_attitude_status_get_delta_yaw(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 40); +} + +/** + * @brief Get field delta_yaw_velocity from gimbal_device_attitude_status message + * + * @return [rad/s] Yaw angular velocity relating the angular velocities in earth and body frames (see message description). NaN if unknown. + */ +static inline float mavlink_msg_gimbal_device_attitude_status_get_delta_yaw_velocity(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 44); +} + +/** + * @brief Get field gimbal_device_id from gimbal_device_attitude_status message + * + * @return This field is to be used if the gimbal manager and the gimbal device are the same component and hence have the same component ID. This field is then set a number between 1-6. If the component ID is separate, this field is not required and must be set to 0. + */ +static inline uint8_t mavlink_msg_gimbal_device_attitude_status_get_gimbal_device_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 48); +} + /** * @brief Decode a gimbal_device_attitude_status message into a struct * @@ -397,6 +547,9 @@ static inline void mavlink_msg_gimbal_device_attitude_status_decode(const mavlin gimbal_device_attitude_status->flags = mavlink_msg_gimbal_device_attitude_status_get_flags(msg); gimbal_device_attitude_status->target_system = mavlink_msg_gimbal_device_attitude_status_get_target_system(msg); gimbal_device_attitude_status->target_component = mavlink_msg_gimbal_device_attitude_status_get_target_component(msg); + gimbal_device_attitude_status->delta_yaw = mavlink_msg_gimbal_device_attitude_status_get_delta_yaw(msg); + gimbal_device_attitude_status->delta_yaw_velocity = mavlink_msg_gimbal_device_attitude_status_get_delta_yaw_velocity(msg); + gimbal_device_attitude_status->gimbal_device_id = mavlink_msg_gimbal_device_attitude_status_get_gimbal_device_id(msg); #else uint8_t len = msg->len < MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN? msg->len : MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN; memset(gimbal_device_attitude_status, 0, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN); diff --git a/common/mavlink_msg_gimbal_device_information.h b/common/mavlink_msg_gimbal_device_information.h index 2f0c86bdc..975d9c17c 100644 --- a/common/mavlink_msg_gimbal_device_information.h +++ b/common/mavlink_msg_gimbal_device_information.h @@ -7,24 +7,25 @@ typedef struct __mavlink_gimbal_device_information_t { uint64_t uid; /*< UID of gimbal hardware (0 if unknown).*/ uint32_t time_boot_ms; /*< [ms] Timestamp (time since system boot).*/ - uint32_t firmware_version; /*< Version of the gimbal firmware, encoded as: (Dev & 0xff) << 24 | (Patch & 0xff) << 16 | (Minor & 0xff) << 8 | (Major & 0xff).*/ - uint32_t hardware_version; /*< Version of the gimbal hardware, encoded as: (Dev & 0xff) << 24 | (Patch & 0xff) << 16 | (Minor & 0xff) << 8 | (Major & 0xff).*/ - float roll_min; /*< [rad] Minimum hardware roll angle (positive: rolling to the right, negative: rolling to the left)*/ - float roll_max; /*< [rad] Maximum hardware roll angle (positive: rolling to the right, negative: rolling to the left)*/ - float pitch_min; /*< [rad] Minimum hardware pitch angle (positive: up, negative: down)*/ - float pitch_max; /*< [rad] Maximum hardware pitch angle (positive: up, negative: down)*/ - float yaw_min; /*< [rad] Minimum hardware yaw angle (positive: to the right, negative: to the left)*/ - float yaw_max; /*< [rad] Maximum hardware yaw angle (positive: to the right, negative: to the left)*/ + uint32_t firmware_version; /*< Version of the gimbal firmware, encoded as: `(Dev & 0xff) << 24 + (Patch & 0xff) << 16 + (Minor & 0xff) << 8 + (Major & 0xff)`.*/ + uint32_t hardware_version; /*< Version of the gimbal hardware, encoded as: `(Dev & 0xff) << 24 + (Patch & 0xff) << 16 + (Minor & 0xff) << 8 + (Major & 0xff)`.*/ + float roll_min; /*< [rad] Minimum hardware roll angle (positive: rolling to the right, negative: rolling to the left). NAN if unknown.*/ + float roll_max; /*< [rad] Maximum hardware roll angle (positive: rolling to the right, negative: rolling to the left). NAN if unknown.*/ + float pitch_min; /*< [rad] Minimum hardware pitch angle (positive: up, negative: down). NAN if unknown.*/ + float pitch_max; /*< [rad] Maximum hardware pitch angle (positive: up, negative: down). NAN if unknown.*/ + float yaw_min; /*< [rad] Minimum hardware yaw angle (positive: to the right, negative: to the left). NAN if unknown.*/ + float yaw_max; /*< [rad] Maximum hardware yaw angle (positive: to the right, negative: to the left). NAN if unknown.*/ uint16_t cap_flags; /*< Bitmap of gimbal capability flags.*/ uint16_t custom_cap_flags; /*< Bitmap for use for gimbal-specific capability flags.*/ char vendor_name[32]; /*< Name of the gimbal vendor.*/ char model_name[32]; /*< Name of the gimbal model.*/ char custom_name[32]; /*< Custom name of the gimbal given to it by the user.*/ + uint8_t gimbal_device_id; /*< This field is to be used if the gimbal manager and the gimbal device are the same component and hence have the same component ID. This field is then set to a number between 1-6. If the component ID is separate, this field is not required and must be set to 0.*/ } mavlink_gimbal_device_information_t; -#define MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_LEN 144 +#define MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_LEN 145 #define MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_MIN_LEN 144 -#define MAVLINK_MSG_ID_283_LEN 144 +#define MAVLINK_MSG_ID_283_LEN 145 #define MAVLINK_MSG_ID_283_MIN_LEN 144 #define MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_CRC 74 @@ -38,7 +39,7 @@ typedef struct __mavlink_gimbal_device_information_t { #define MAVLINK_MESSAGE_INFO_GIMBAL_DEVICE_INFORMATION { \ 283, \ "GIMBAL_DEVICE_INFORMATION", \ - 15, \ + 16, \ { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_gimbal_device_information_t, time_boot_ms) }, \ { "vendor_name", NULL, MAVLINK_TYPE_CHAR, 32, 48, offsetof(mavlink_gimbal_device_information_t, vendor_name) }, \ { "model_name", NULL, MAVLINK_TYPE_CHAR, 32, 80, offsetof(mavlink_gimbal_device_information_t, model_name) }, \ @@ -54,12 +55,13 @@ typedef struct __mavlink_gimbal_device_information_t { { "pitch_max", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_gimbal_device_information_t, pitch_max) }, \ { "yaw_min", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_gimbal_device_information_t, yaw_min) }, \ { "yaw_max", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_gimbal_device_information_t, yaw_max) }, \ + { "gimbal_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 144, offsetof(mavlink_gimbal_device_information_t, gimbal_device_id) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_GIMBAL_DEVICE_INFORMATION { \ "GIMBAL_DEVICE_INFORMATION", \ - 15, \ + 16, \ { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_gimbal_device_information_t, time_boot_ms) }, \ { "vendor_name", NULL, MAVLINK_TYPE_CHAR, 32, 48, offsetof(mavlink_gimbal_device_information_t, vendor_name) }, \ { "model_name", NULL, MAVLINK_TYPE_CHAR, 32, 80, offsetof(mavlink_gimbal_device_information_t, model_name) }, \ @@ -75,6 +77,7 @@ typedef struct __mavlink_gimbal_device_information_t { { "pitch_max", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_gimbal_device_information_t, pitch_max) }, \ { "yaw_min", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_gimbal_device_information_t, yaw_min) }, \ { "yaw_max", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_gimbal_device_information_t, yaw_max) }, \ + { "gimbal_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 144, offsetof(mavlink_gimbal_device_information_t, gimbal_device_id) }, \ } \ } #endif @@ -89,21 +92,22 @@ typedef struct __mavlink_gimbal_device_information_t { * @param vendor_name Name of the gimbal vendor. * @param model_name Name of the gimbal model. * @param custom_name Custom name of the gimbal given to it by the user. - * @param firmware_version Version of the gimbal firmware, encoded as: (Dev & 0xff) << 24 | (Patch & 0xff) << 16 | (Minor & 0xff) << 8 | (Major & 0xff). - * @param hardware_version Version of the gimbal hardware, encoded as: (Dev & 0xff) << 24 | (Patch & 0xff) << 16 | (Minor & 0xff) << 8 | (Major & 0xff). + * @param firmware_version Version of the gimbal firmware, encoded as: `(Dev & 0xff) << 24 + (Patch & 0xff) << 16 + (Minor & 0xff) << 8 + (Major & 0xff)`. + * @param hardware_version Version of the gimbal hardware, encoded as: `(Dev & 0xff) << 24 + (Patch & 0xff) << 16 + (Minor & 0xff) << 8 + (Major & 0xff)`. * @param uid UID of gimbal hardware (0 if unknown). * @param cap_flags Bitmap of gimbal capability flags. * @param custom_cap_flags Bitmap for use for gimbal-specific capability flags. - * @param roll_min [rad] Minimum hardware roll angle (positive: rolling to the right, negative: rolling to the left) - * @param roll_max [rad] Maximum hardware roll angle (positive: rolling to the right, negative: rolling to the left) - * @param pitch_min [rad] Minimum hardware pitch angle (positive: up, negative: down) - * @param pitch_max [rad] Maximum hardware pitch angle (positive: up, negative: down) - * @param yaw_min [rad] Minimum hardware yaw angle (positive: to the right, negative: to the left) - * @param yaw_max [rad] Maximum hardware yaw angle (positive: to the right, negative: to the left) + * @param roll_min [rad] Minimum hardware roll angle (positive: rolling to the right, negative: rolling to the left). NAN if unknown. + * @param roll_max [rad] Maximum hardware roll angle (positive: rolling to the right, negative: rolling to the left). NAN if unknown. + * @param pitch_min [rad] Minimum hardware pitch angle (positive: up, negative: down). NAN if unknown. + * @param pitch_max [rad] Maximum hardware pitch angle (positive: up, negative: down). NAN if unknown. + * @param yaw_min [rad] Minimum hardware yaw angle (positive: to the right, negative: to the left). NAN if unknown. + * @param yaw_max [rad] Maximum hardware yaw angle (positive: to the right, negative: to the left). NAN if unknown. + * @param gimbal_device_id This field is to be used if the gimbal manager and the gimbal device are the same component and hence have the same component ID. This field is then set to a number between 1-6. If the component ID is separate, this field is not required and must be set to 0. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_gimbal_device_information_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint32_t time_boot_ms, const char *vendor_name, const char *model_name, const char *custom_name, uint32_t firmware_version, uint32_t hardware_version, uint64_t uid, uint16_t cap_flags, uint16_t custom_cap_flags, float roll_min, float roll_max, float pitch_min, float pitch_max, float yaw_min, float yaw_max) + uint32_t time_boot_ms, const char *vendor_name, const char *model_name, const char *custom_name, uint32_t firmware_version, uint32_t hardware_version, uint64_t uid, uint16_t cap_flags, uint16_t custom_cap_flags, float roll_min, float roll_max, float pitch_min, float pitch_max, float yaw_min, float yaw_max, uint8_t gimbal_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_LEN]; @@ -119,6 +123,7 @@ static inline uint16_t mavlink_msg_gimbal_device_information_pack(uint8_t system _mav_put_float(buf, 40, yaw_max); _mav_put_uint16_t(buf, 44, cap_flags); _mav_put_uint16_t(buf, 46, custom_cap_flags); + _mav_put_uint8_t(buf, 144, gimbal_device_id); _mav_put_char_array(buf, 48, vendor_name, 32); _mav_put_char_array(buf, 80, model_name, 32); _mav_put_char_array(buf, 112, custom_name, 32); @@ -137,6 +142,79 @@ static inline uint16_t mavlink_msg_gimbal_device_information_pack(uint8_t system packet.yaw_max = yaw_max; packet.cap_flags = cap_flags; packet.custom_cap_flags = custom_cap_flags; + packet.gimbal_device_id = gimbal_device_id; + mav_array_assign_char(packet.vendor_name, vendor_name, 32); + mav_array_assign_char(packet.model_name, model_name, 32); + mav_array_assign_char(packet.custom_name, custom_name, 32); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_CRC); +} + +/** + * @brief Pack a gimbal_device_information message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param vendor_name Name of the gimbal vendor. + * @param model_name Name of the gimbal model. + * @param custom_name Custom name of the gimbal given to it by the user. + * @param firmware_version Version of the gimbal firmware, encoded as: `(Dev & 0xff) << 24 + (Patch & 0xff) << 16 + (Minor & 0xff) << 8 + (Major & 0xff)`. + * @param hardware_version Version of the gimbal hardware, encoded as: `(Dev & 0xff) << 24 + (Patch & 0xff) << 16 + (Minor & 0xff) << 8 + (Major & 0xff)`. + * @param uid UID of gimbal hardware (0 if unknown). + * @param cap_flags Bitmap of gimbal capability flags. + * @param custom_cap_flags Bitmap for use for gimbal-specific capability flags. + * @param roll_min [rad] Minimum hardware roll angle (positive: rolling to the right, negative: rolling to the left). NAN if unknown. + * @param roll_max [rad] Maximum hardware roll angle (positive: rolling to the right, negative: rolling to the left). NAN if unknown. + * @param pitch_min [rad] Minimum hardware pitch angle (positive: up, negative: down). NAN if unknown. + * @param pitch_max [rad] Maximum hardware pitch angle (positive: up, negative: down). NAN if unknown. + * @param yaw_min [rad] Minimum hardware yaw angle (positive: to the right, negative: to the left). NAN if unknown. + * @param yaw_max [rad] Maximum hardware yaw angle (positive: to the right, negative: to the left). NAN if unknown. + * @param gimbal_device_id This field is to be used if the gimbal manager and the gimbal device are the same component and hence have the same component ID. This field is then set to a number between 1-6. If the component ID is separate, this field is not required and must be set to 0. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_gimbal_device_information_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, const char *vendor_name, const char *model_name, const char *custom_name, uint32_t firmware_version, uint32_t hardware_version, uint64_t uid, uint16_t cap_flags, uint16_t custom_cap_flags, float roll_min, float roll_max, float pitch_min, float pitch_max, float yaw_min, float yaw_max, uint8_t gimbal_device_id) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_LEN]; + _mav_put_uint64_t(buf, 0, uid); + _mav_put_uint32_t(buf, 8, time_boot_ms); + _mav_put_uint32_t(buf, 12, firmware_version); + _mav_put_uint32_t(buf, 16, hardware_version); + _mav_put_float(buf, 20, roll_min); + _mav_put_float(buf, 24, roll_max); + _mav_put_float(buf, 28, pitch_min); + _mav_put_float(buf, 32, pitch_max); + _mav_put_float(buf, 36, yaw_min); + _mav_put_float(buf, 40, yaw_max); + _mav_put_uint16_t(buf, 44, cap_flags); + _mav_put_uint16_t(buf, 46, custom_cap_flags); + _mav_put_uint8_t(buf, 144, gimbal_device_id); + _mav_put_char_array(buf, 48, vendor_name, 32); + _mav_put_char_array(buf, 80, model_name, 32); + _mav_put_char_array(buf, 112, custom_name, 32); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_LEN); +#else + mavlink_gimbal_device_information_t packet; + packet.uid = uid; + packet.time_boot_ms = time_boot_ms; + packet.firmware_version = firmware_version; + packet.hardware_version = hardware_version; + packet.roll_min = roll_min; + packet.roll_max = roll_max; + packet.pitch_min = pitch_min; + packet.pitch_max = pitch_max; + packet.yaw_min = yaw_min; + packet.yaw_max = yaw_max; + packet.cap_flags = cap_flags; + packet.custom_cap_flags = custom_cap_flags; + packet.gimbal_device_id = gimbal_device_id; mav_array_memcpy(packet.vendor_name, vendor_name, sizeof(char)*32); mav_array_memcpy(packet.model_name, model_name, sizeof(char)*32); mav_array_memcpy(packet.custom_name, custom_name, sizeof(char)*32); @@ -144,7 +222,11 @@ static inline uint16_t mavlink_msg_gimbal_device_information_pack(uint8_t system #endif msg->msgid = MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_CRC); +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_LEN); +#endif } /** @@ -157,22 +239,23 @@ static inline uint16_t mavlink_msg_gimbal_device_information_pack(uint8_t system * @param vendor_name Name of the gimbal vendor. * @param model_name Name of the gimbal model. * @param custom_name Custom name of the gimbal given to it by the user. - * @param firmware_version Version of the gimbal firmware, encoded as: (Dev & 0xff) << 24 | (Patch & 0xff) << 16 | (Minor & 0xff) << 8 | (Major & 0xff). - * @param hardware_version Version of the gimbal hardware, encoded as: (Dev & 0xff) << 24 | (Patch & 0xff) << 16 | (Minor & 0xff) << 8 | (Major & 0xff). + * @param firmware_version Version of the gimbal firmware, encoded as: `(Dev & 0xff) << 24 + (Patch & 0xff) << 16 + (Minor & 0xff) << 8 + (Major & 0xff)`. + * @param hardware_version Version of the gimbal hardware, encoded as: `(Dev & 0xff) << 24 + (Patch & 0xff) << 16 + (Minor & 0xff) << 8 + (Major & 0xff)`. * @param uid UID of gimbal hardware (0 if unknown). * @param cap_flags Bitmap of gimbal capability flags. * @param custom_cap_flags Bitmap for use for gimbal-specific capability flags. - * @param roll_min [rad] Minimum hardware roll angle (positive: rolling to the right, negative: rolling to the left) - * @param roll_max [rad] Maximum hardware roll angle (positive: rolling to the right, negative: rolling to the left) - * @param pitch_min [rad] Minimum hardware pitch angle (positive: up, negative: down) - * @param pitch_max [rad] Maximum hardware pitch angle (positive: up, negative: down) - * @param yaw_min [rad] Minimum hardware yaw angle (positive: to the right, negative: to the left) - * @param yaw_max [rad] Maximum hardware yaw angle (positive: to the right, negative: to the left) + * @param roll_min [rad] Minimum hardware roll angle (positive: rolling to the right, negative: rolling to the left). NAN if unknown. + * @param roll_max [rad] Maximum hardware roll angle (positive: rolling to the right, negative: rolling to the left). NAN if unknown. + * @param pitch_min [rad] Minimum hardware pitch angle (positive: up, negative: down). NAN if unknown. + * @param pitch_max [rad] Maximum hardware pitch angle (positive: up, negative: down). NAN if unknown. + * @param yaw_min [rad] Minimum hardware yaw angle (positive: to the right, negative: to the left). NAN if unknown. + * @param yaw_max [rad] Maximum hardware yaw angle (positive: to the right, negative: to the left). NAN if unknown. + * @param gimbal_device_id This field is to be used if the gimbal manager and the gimbal device are the same component and hence have the same component ID. This field is then set to a number between 1-6. If the component ID is separate, this field is not required and must be set to 0. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_gimbal_device_information_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - uint32_t time_boot_ms,const char *vendor_name,const char *model_name,const char *custom_name,uint32_t firmware_version,uint32_t hardware_version,uint64_t uid,uint16_t cap_flags,uint16_t custom_cap_flags,float roll_min,float roll_max,float pitch_min,float pitch_max,float yaw_min,float yaw_max) + uint32_t time_boot_ms,const char *vendor_name,const char *model_name,const char *custom_name,uint32_t firmware_version,uint32_t hardware_version,uint64_t uid,uint16_t cap_flags,uint16_t custom_cap_flags,float roll_min,float roll_max,float pitch_min,float pitch_max,float yaw_min,float yaw_max,uint8_t gimbal_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_LEN]; @@ -188,6 +271,7 @@ static inline uint16_t mavlink_msg_gimbal_device_information_pack_chan(uint8_t s _mav_put_float(buf, 40, yaw_max); _mav_put_uint16_t(buf, 44, cap_flags); _mav_put_uint16_t(buf, 46, custom_cap_flags); + _mav_put_uint8_t(buf, 144, gimbal_device_id); _mav_put_char_array(buf, 48, vendor_name, 32); _mav_put_char_array(buf, 80, model_name, 32); _mav_put_char_array(buf, 112, custom_name, 32); @@ -206,9 +290,10 @@ static inline uint16_t mavlink_msg_gimbal_device_information_pack_chan(uint8_t s packet.yaw_max = yaw_max; packet.cap_flags = cap_flags; packet.custom_cap_flags = custom_cap_flags; - mav_array_memcpy(packet.vendor_name, vendor_name, sizeof(char)*32); - mav_array_memcpy(packet.model_name, model_name, sizeof(char)*32); - mav_array_memcpy(packet.custom_name, custom_name, sizeof(char)*32); + packet.gimbal_device_id = gimbal_device_id; + mav_array_assign_char(packet.vendor_name, vendor_name, 32); + mav_array_assign_char(packet.model_name, model_name, 32); + mav_array_assign_char(packet.custom_name, custom_name, 32); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_LEN); #endif @@ -226,7 +311,7 @@ static inline uint16_t mavlink_msg_gimbal_device_information_pack_chan(uint8_t s */ static inline uint16_t mavlink_msg_gimbal_device_information_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gimbal_device_information_t* gimbal_device_information) { - return mavlink_msg_gimbal_device_information_pack(system_id, component_id, msg, gimbal_device_information->time_boot_ms, gimbal_device_information->vendor_name, gimbal_device_information->model_name, gimbal_device_information->custom_name, gimbal_device_information->firmware_version, gimbal_device_information->hardware_version, gimbal_device_information->uid, gimbal_device_information->cap_flags, gimbal_device_information->custom_cap_flags, gimbal_device_information->roll_min, gimbal_device_information->roll_max, gimbal_device_information->pitch_min, gimbal_device_information->pitch_max, gimbal_device_information->yaw_min, gimbal_device_information->yaw_max); + return mavlink_msg_gimbal_device_information_pack(system_id, component_id, msg, gimbal_device_information->time_boot_ms, gimbal_device_information->vendor_name, gimbal_device_information->model_name, gimbal_device_information->custom_name, gimbal_device_information->firmware_version, gimbal_device_information->hardware_version, gimbal_device_information->uid, gimbal_device_information->cap_flags, gimbal_device_information->custom_cap_flags, gimbal_device_information->roll_min, gimbal_device_information->roll_max, gimbal_device_information->pitch_min, gimbal_device_information->pitch_max, gimbal_device_information->yaw_min, gimbal_device_information->yaw_max, gimbal_device_information->gimbal_device_id); } /** @@ -240,7 +325,21 @@ static inline uint16_t mavlink_msg_gimbal_device_information_encode(uint8_t syst */ static inline uint16_t mavlink_msg_gimbal_device_information_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gimbal_device_information_t* gimbal_device_information) { - return mavlink_msg_gimbal_device_information_pack_chan(system_id, component_id, chan, msg, gimbal_device_information->time_boot_ms, gimbal_device_information->vendor_name, gimbal_device_information->model_name, gimbal_device_information->custom_name, gimbal_device_information->firmware_version, gimbal_device_information->hardware_version, gimbal_device_information->uid, gimbal_device_information->cap_flags, gimbal_device_information->custom_cap_flags, gimbal_device_information->roll_min, gimbal_device_information->roll_max, gimbal_device_information->pitch_min, gimbal_device_information->pitch_max, gimbal_device_information->yaw_min, gimbal_device_information->yaw_max); + return mavlink_msg_gimbal_device_information_pack_chan(system_id, component_id, chan, msg, gimbal_device_information->time_boot_ms, gimbal_device_information->vendor_name, gimbal_device_information->model_name, gimbal_device_information->custom_name, gimbal_device_information->firmware_version, gimbal_device_information->hardware_version, gimbal_device_information->uid, gimbal_device_information->cap_flags, gimbal_device_information->custom_cap_flags, gimbal_device_information->roll_min, gimbal_device_information->roll_max, gimbal_device_information->pitch_min, gimbal_device_information->pitch_max, gimbal_device_information->yaw_min, gimbal_device_information->yaw_max, gimbal_device_information->gimbal_device_id); +} + +/** + * @brief Encode a gimbal_device_information struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param gimbal_device_information C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_gimbal_device_information_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_gimbal_device_information_t* gimbal_device_information) +{ + return mavlink_msg_gimbal_device_information_pack_status(system_id, component_id, _status, msg, gimbal_device_information->time_boot_ms, gimbal_device_information->vendor_name, gimbal_device_information->model_name, gimbal_device_information->custom_name, gimbal_device_information->firmware_version, gimbal_device_information->hardware_version, gimbal_device_information->uid, gimbal_device_information->cap_flags, gimbal_device_information->custom_cap_flags, gimbal_device_information->roll_min, gimbal_device_information->roll_max, gimbal_device_information->pitch_min, gimbal_device_information->pitch_max, gimbal_device_information->yaw_min, gimbal_device_information->yaw_max, gimbal_device_information->gimbal_device_id); } /** @@ -251,21 +350,22 @@ static inline uint16_t mavlink_msg_gimbal_device_information_encode_chan(uint8_t * @param vendor_name Name of the gimbal vendor. * @param model_name Name of the gimbal model. * @param custom_name Custom name of the gimbal given to it by the user. - * @param firmware_version Version of the gimbal firmware, encoded as: (Dev & 0xff) << 24 | (Patch & 0xff) << 16 | (Minor & 0xff) << 8 | (Major & 0xff). - * @param hardware_version Version of the gimbal hardware, encoded as: (Dev & 0xff) << 24 | (Patch & 0xff) << 16 | (Minor & 0xff) << 8 | (Major & 0xff). + * @param firmware_version Version of the gimbal firmware, encoded as: `(Dev & 0xff) << 24 + (Patch & 0xff) << 16 + (Minor & 0xff) << 8 + (Major & 0xff)`. + * @param hardware_version Version of the gimbal hardware, encoded as: `(Dev & 0xff) << 24 + (Patch & 0xff) << 16 + (Minor & 0xff) << 8 + (Major & 0xff)`. * @param uid UID of gimbal hardware (0 if unknown). * @param cap_flags Bitmap of gimbal capability flags. * @param custom_cap_flags Bitmap for use for gimbal-specific capability flags. - * @param roll_min [rad] Minimum hardware roll angle (positive: rolling to the right, negative: rolling to the left) - * @param roll_max [rad] Maximum hardware roll angle (positive: rolling to the right, negative: rolling to the left) - * @param pitch_min [rad] Minimum hardware pitch angle (positive: up, negative: down) - * @param pitch_max [rad] Maximum hardware pitch angle (positive: up, negative: down) - * @param yaw_min [rad] Minimum hardware yaw angle (positive: to the right, negative: to the left) - * @param yaw_max [rad] Maximum hardware yaw angle (positive: to the right, negative: to the left) + * @param roll_min [rad] Minimum hardware roll angle (positive: rolling to the right, negative: rolling to the left). NAN if unknown. + * @param roll_max [rad] Maximum hardware roll angle (positive: rolling to the right, negative: rolling to the left). NAN if unknown. + * @param pitch_min [rad] Minimum hardware pitch angle (positive: up, negative: down). NAN if unknown. + * @param pitch_max [rad] Maximum hardware pitch angle (positive: up, negative: down). NAN if unknown. + * @param yaw_min [rad] Minimum hardware yaw angle (positive: to the right, negative: to the left). NAN if unknown. + * @param yaw_max [rad] Maximum hardware yaw angle (positive: to the right, negative: to the left). NAN if unknown. + * @param gimbal_device_id This field is to be used if the gimbal manager and the gimbal device are the same component and hence have the same component ID. This field is then set to a number between 1-6. If the component ID is separate, this field is not required and must be set to 0. */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_gimbal_device_information_send(mavlink_channel_t chan, uint32_t time_boot_ms, const char *vendor_name, const char *model_name, const char *custom_name, uint32_t firmware_version, uint32_t hardware_version, uint64_t uid, uint16_t cap_flags, uint16_t custom_cap_flags, float roll_min, float roll_max, float pitch_min, float pitch_max, float yaw_min, float yaw_max) +static inline void mavlink_msg_gimbal_device_information_send(mavlink_channel_t chan, uint32_t time_boot_ms, const char *vendor_name, const char *model_name, const char *custom_name, uint32_t firmware_version, uint32_t hardware_version, uint64_t uid, uint16_t cap_flags, uint16_t custom_cap_flags, float roll_min, float roll_max, float pitch_min, float pitch_max, float yaw_min, float yaw_max, uint8_t gimbal_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_LEN]; @@ -281,6 +381,7 @@ static inline void mavlink_msg_gimbal_device_information_send(mavlink_channel_t _mav_put_float(buf, 40, yaw_max); _mav_put_uint16_t(buf, 44, cap_flags); _mav_put_uint16_t(buf, 46, custom_cap_flags); + _mav_put_uint8_t(buf, 144, gimbal_device_id); _mav_put_char_array(buf, 48, vendor_name, 32); _mav_put_char_array(buf, 80, model_name, 32); _mav_put_char_array(buf, 112, custom_name, 32); @@ -299,9 +400,10 @@ static inline void mavlink_msg_gimbal_device_information_send(mavlink_channel_t packet.yaw_max = yaw_max; packet.cap_flags = cap_flags; packet.custom_cap_flags = custom_cap_flags; - mav_array_memcpy(packet.vendor_name, vendor_name, sizeof(char)*32); - mav_array_memcpy(packet.model_name, model_name, sizeof(char)*32); - mav_array_memcpy(packet.custom_name, custom_name, sizeof(char)*32); + packet.gimbal_device_id = gimbal_device_id; + mav_array_assign_char(packet.vendor_name, vendor_name, 32); + mav_array_assign_char(packet.model_name, model_name, 32); + mav_array_assign_char(packet.custom_name, custom_name, 32); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION, (const char *)&packet, MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_CRC); #endif } @@ -314,7 +416,7 @@ static inline void mavlink_msg_gimbal_device_information_send(mavlink_channel_t static inline void mavlink_msg_gimbal_device_information_send_struct(mavlink_channel_t chan, const mavlink_gimbal_device_information_t* gimbal_device_information) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_gimbal_device_information_send(chan, gimbal_device_information->time_boot_ms, gimbal_device_information->vendor_name, gimbal_device_information->model_name, gimbal_device_information->custom_name, gimbal_device_information->firmware_version, gimbal_device_information->hardware_version, gimbal_device_information->uid, gimbal_device_information->cap_flags, gimbal_device_information->custom_cap_flags, gimbal_device_information->roll_min, gimbal_device_information->roll_max, gimbal_device_information->pitch_min, gimbal_device_information->pitch_max, gimbal_device_information->yaw_min, gimbal_device_information->yaw_max); + mavlink_msg_gimbal_device_information_send(chan, gimbal_device_information->time_boot_ms, gimbal_device_information->vendor_name, gimbal_device_information->model_name, gimbal_device_information->custom_name, gimbal_device_information->firmware_version, gimbal_device_information->hardware_version, gimbal_device_information->uid, gimbal_device_information->cap_flags, gimbal_device_information->custom_cap_flags, gimbal_device_information->roll_min, gimbal_device_information->roll_max, gimbal_device_information->pitch_min, gimbal_device_information->pitch_max, gimbal_device_information->yaw_min, gimbal_device_information->yaw_max, gimbal_device_information->gimbal_device_id); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION, (const char *)gimbal_device_information, MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_CRC); #endif @@ -322,13 +424,13 @@ static inline void mavlink_msg_gimbal_device_information_send_struct(mavlink_cha #if MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_gimbal_device_information_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, const char *vendor_name, const char *model_name, const char *custom_name, uint32_t firmware_version, uint32_t hardware_version, uint64_t uid, uint16_t cap_flags, uint16_t custom_cap_flags, float roll_min, float roll_max, float pitch_min, float pitch_max, float yaw_min, float yaw_max) +static inline void mavlink_msg_gimbal_device_information_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, const char *vendor_name, const char *model_name, const char *custom_name, uint32_t firmware_version, uint32_t hardware_version, uint64_t uid, uint16_t cap_flags, uint16_t custom_cap_flags, float roll_min, float roll_max, float pitch_min, float pitch_max, float yaw_min, float yaw_max, uint8_t gimbal_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; @@ -344,6 +446,7 @@ static inline void mavlink_msg_gimbal_device_information_send_buf(mavlink_messag _mav_put_float(buf, 40, yaw_max); _mav_put_uint16_t(buf, 44, cap_flags); _mav_put_uint16_t(buf, 46, custom_cap_flags); + _mav_put_uint8_t(buf, 144, gimbal_device_id); _mav_put_char_array(buf, 48, vendor_name, 32); _mav_put_char_array(buf, 80, model_name, 32); _mav_put_char_array(buf, 112, custom_name, 32); @@ -362,9 +465,10 @@ static inline void mavlink_msg_gimbal_device_information_send_buf(mavlink_messag packet->yaw_max = yaw_max; packet->cap_flags = cap_flags; packet->custom_cap_flags = custom_cap_flags; - mav_array_memcpy(packet->vendor_name, vendor_name, sizeof(char)*32); - mav_array_memcpy(packet->model_name, model_name, sizeof(char)*32); - mav_array_memcpy(packet->custom_name, custom_name, sizeof(char)*32); + packet->gimbal_device_id = gimbal_device_id; + mav_array_assign_char(packet->vendor_name, vendor_name, 32); + mav_array_assign_char(packet->model_name, model_name, 32); + mav_array_assign_char(packet->custom_name, custom_name, 32); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION, (const char *)packet, MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_CRC); #endif } @@ -418,7 +522,7 @@ static inline uint16_t mavlink_msg_gimbal_device_information_get_custom_name(con /** * @brief Get field firmware_version from gimbal_device_information message * - * @return Version of the gimbal firmware, encoded as: (Dev & 0xff) << 24 | (Patch & 0xff) << 16 | (Minor & 0xff) << 8 | (Major & 0xff). + * @return Version of the gimbal firmware, encoded as: `(Dev & 0xff) << 24 + (Patch & 0xff) << 16 + (Minor & 0xff) << 8 + (Major & 0xff)`. */ static inline uint32_t mavlink_msg_gimbal_device_information_get_firmware_version(const mavlink_message_t* msg) { @@ -428,7 +532,7 @@ static inline uint32_t mavlink_msg_gimbal_device_information_get_firmware_versio /** * @brief Get field hardware_version from gimbal_device_information message * - * @return Version of the gimbal hardware, encoded as: (Dev & 0xff) << 24 | (Patch & 0xff) << 16 | (Minor & 0xff) << 8 | (Major & 0xff). + * @return Version of the gimbal hardware, encoded as: `(Dev & 0xff) << 24 + (Patch & 0xff) << 16 + (Minor & 0xff) << 8 + (Major & 0xff)`. */ static inline uint32_t mavlink_msg_gimbal_device_information_get_hardware_version(const mavlink_message_t* msg) { @@ -468,7 +572,7 @@ static inline uint16_t mavlink_msg_gimbal_device_information_get_custom_cap_flag /** * @brief Get field roll_min from gimbal_device_information message * - * @return [rad] Minimum hardware roll angle (positive: rolling to the right, negative: rolling to the left) + * @return [rad] Minimum hardware roll angle (positive: rolling to the right, negative: rolling to the left). NAN if unknown. */ static inline float mavlink_msg_gimbal_device_information_get_roll_min(const mavlink_message_t* msg) { @@ -478,7 +582,7 @@ static inline float mavlink_msg_gimbal_device_information_get_roll_min(const mav /** * @brief Get field roll_max from gimbal_device_information message * - * @return [rad] Maximum hardware roll angle (positive: rolling to the right, negative: rolling to the left) + * @return [rad] Maximum hardware roll angle (positive: rolling to the right, negative: rolling to the left). NAN if unknown. */ static inline float mavlink_msg_gimbal_device_information_get_roll_max(const mavlink_message_t* msg) { @@ -488,7 +592,7 @@ static inline float mavlink_msg_gimbal_device_information_get_roll_max(const mav /** * @brief Get field pitch_min from gimbal_device_information message * - * @return [rad] Minimum hardware pitch angle (positive: up, negative: down) + * @return [rad] Minimum hardware pitch angle (positive: up, negative: down). NAN if unknown. */ static inline float mavlink_msg_gimbal_device_information_get_pitch_min(const mavlink_message_t* msg) { @@ -498,7 +602,7 @@ static inline float mavlink_msg_gimbal_device_information_get_pitch_min(const ma /** * @brief Get field pitch_max from gimbal_device_information message * - * @return [rad] Maximum hardware pitch angle (positive: up, negative: down) + * @return [rad] Maximum hardware pitch angle (positive: up, negative: down). NAN if unknown. */ static inline float mavlink_msg_gimbal_device_information_get_pitch_max(const mavlink_message_t* msg) { @@ -508,7 +612,7 @@ static inline float mavlink_msg_gimbal_device_information_get_pitch_max(const ma /** * @brief Get field yaw_min from gimbal_device_information message * - * @return [rad] Minimum hardware yaw angle (positive: to the right, negative: to the left) + * @return [rad] Minimum hardware yaw angle (positive: to the right, negative: to the left). NAN if unknown. */ static inline float mavlink_msg_gimbal_device_information_get_yaw_min(const mavlink_message_t* msg) { @@ -518,13 +622,23 @@ static inline float mavlink_msg_gimbal_device_information_get_yaw_min(const mavl /** * @brief Get field yaw_max from gimbal_device_information message * - * @return [rad] Maximum hardware yaw angle (positive: to the right, negative: to the left) + * @return [rad] Maximum hardware yaw angle (positive: to the right, negative: to the left). NAN if unknown. */ static inline float mavlink_msg_gimbal_device_information_get_yaw_max(const mavlink_message_t* msg) { return _MAV_RETURN_float(msg, 40); } +/** + * @brief Get field gimbal_device_id from gimbal_device_information message + * + * @return This field is to be used if the gimbal manager and the gimbal device are the same component and hence have the same component ID. This field is then set to a number between 1-6. If the component ID is separate, this field is not required and must be set to 0. + */ +static inline uint8_t mavlink_msg_gimbal_device_information_get_gimbal_device_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 144); +} + /** * @brief Decode a gimbal_device_information message into a struct * @@ -549,6 +663,7 @@ static inline void mavlink_msg_gimbal_device_information_decode(const mavlink_me mavlink_msg_gimbal_device_information_get_vendor_name(msg, gimbal_device_information->vendor_name); mavlink_msg_gimbal_device_information_get_model_name(msg, gimbal_device_information->model_name); mavlink_msg_gimbal_device_information_get_custom_name(msg, gimbal_device_information->custom_name); + gimbal_device_information->gimbal_device_id = mavlink_msg_gimbal_device_information_get_gimbal_device_id(msg); #else uint8_t len = msg->len < MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_LEN? msg->len : MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_LEN; memset(gimbal_device_information, 0, MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION_LEN); diff --git a/common/mavlink_msg_gimbal_device_set_attitude.h b/common/mavlink_msg_gimbal_device_set_attitude.h index 1cfda3266..f8cf2076b 100644 --- a/common/mavlink_msg_gimbal_device_set_attitude.h +++ b/common/mavlink_msg_gimbal_device_set_attitude.h @@ -5,10 +5,10 @@ typedef struct __mavlink_gimbal_device_set_attitude_t { - float q[4]; /*< Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation, the frame is depends on whether the flag GIMBAL_DEVICE_FLAGS_YAW_LOCK is set, set all fields to NaN if only angular velocity should be used)*/ - float angular_velocity_x; /*< [rad/s] X component of angular velocity, positive is rolling to the right, NaN to be ignored.*/ - float angular_velocity_y; /*< [rad/s] Y component of angular velocity, positive is pitching up, NaN to be ignored.*/ - float angular_velocity_z; /*< [rad/s] Z component of angular velocity, positive is yawing to the right, NaN to be ignored.*/ + float q[4]; /*< Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation). The frame is described in the message description. Set fields to NaN to be ignored.*/ + float angular_velocity_x; /*< [rad/s] X component of angular velocity (positive: rolling to the right). The frame is described in the message description. NaN to be ignored.*/ + float angular_velocity_y; /*< [rad/s] Y component of angular velocity (positive: pitching up). The frame is described in the message description. NaN to be ignored.*/ + float angular_velocity_z; /*< [rad/s] Z component of angular velocity (positive: yawing to the right). The frame is described in the message description. NaN to be ignored.*/ uint16_t flags; /*< Low level gimbal flags.*/ uint8_t target_system; /*< System ID*/ uint8_t target_component; /*< Component ID*/ @@ -62,10 +62,10 @@ typedef struct __mavlink_gimbal_device_set_attitude_t { * @param target_system System ID * @param target_component Component ID * @param flags Low level gimbal flags. - * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation, the frame is depends on whether the flag GIMBAL_DEVICE_FLAGS_YAW_LOCK is set, set all fields to NaN if only angular velocity should be used) - * @param angular_velocity_x [rad/s] X component of angular velocity, positive is rolling to the right, NaN to be ignored. - * @param angular_velocity_y [rad/s] Y component of angular velocity, positive is pitching up, NaN to be ignored. - * @param angular_velocity_z [rad/s] Z component of angular velocity, positive is yawing to the right, NaN to be ignored. + * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation). The frame is described in the message description. Set fields to NaN to be ignored. + * @param angular_velocity_x [rad/s] X component of angular velocity (positive: rolling to the right). The frame is described in the message description. NaN to be ignored. + * @param angular_velocity_y [rad/s] Y component of angular velocity (positive: pitching up). The frame is described in the message description. NaN to be ignored. + * @param angular_velocity_z [rad/s] Z component of angular velocity (positive: yawing to the right). The frame is described in the message description. NaN to be ignored. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_gimbal_device_set_attitude_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, @@ -89,7 +89,7 @@ static inline uint16_t mavlink_msg_gimbal_device_set_attitude_pack(uint8_t syste packet.flags = flags; packet.target_system = target_system; packet.target_component = target_component; - mav_array_memcpy(packet.q, q, sizeof(float)*4); + mav_array_assign_float(packet.q, q, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_DEVICE_SET_ATTITUDE_LEN); #endif @@ -97,6 +97,55 @@ static inline uint16_t mavlink_msg_gimbal_device_set_attitude_pack(uint8_t syste return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GIMBAL_DEVICE_SET_ATTITUDE_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_SET_ATTITUDE_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_SET_ATTITUDE_CRC); } +/** + * @brief Pack a gimbal_device_set_attitude message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param flags Low level gimbal flags. + * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation). The frame is described in the message description. Set fields to NaN to be ignored. + * @param angular_velocity_x [rad/s] X component of angular velocity (positive: rolling to the right). The frame is described in the message description. NaN to be ignored. + * @param angular_velocity_y [rad/s] Y component of angular velocity (positive: pitching up). The frame is described in the message description. NaN to be ignored. + * @param angular_velocity_z [rad/s] Z component of angular velocity (positive: yawing to the right). The frame is described in the message description. NaN to be ignored. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_gimbal_device_set_attitude_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint16_t flags, const float *q, float angular_velocity_x, float angular_velocity_y, float angular_velocity_z) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GIMBAL_DEVICE_SET_ATTITUDE_LEN]; + _mav_put_float(buf, 16, angular_velocity_x); + _mav_put_float(buf, 20, angular_velocity_y); + _mav_put_float(buf, 24, angular_velocity_z); + _mav_put_uint16_t(buf, 28, flags); + _mav_put_uint8_t(buf, 30, target_system); + _mav_put_uint8_t(buf, 31, target_component); + _mav_put_float_array(buf, 0, q, 4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GIMBAL_DEVICE_SET_ATTITUDE_LEN); +#else + mavlink_gimbal_device_set_attitude_t packet; + packet.angular_velocity_x = angular_velocity_x; + packet.angular_velocity_y = angular_velocity_y; + packet.angular_velocity_z = angular_velocity_z; + packet.flags = flags; + packet.target_system = target_system; + packet.target_component = target_component; + mav_array_memcpy(packet.q, q, sizeof(float)*4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_DEVICE_SET_ATTITUDE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GIMBAL_DEVICE_SET_ATTITUDE; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GIMBAL_DEVICE_SET_ATTITUDE_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_SET_ATTITUDE_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_SET_ATTITUDE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GIMBAL_DEVICE_SET_ATTITUDE_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_SET_ATTITUDE_LEN); +#endif +} + /** * @brief Pack a gimbal_device_set_attitude message on a channel * @param system_id ID of this system @@ -106,10 +155,10 @@ static inline uint16_t mavlink_msg_gimbal_device_set_attitude_pack(uint8_t syste * @param target_system System ID * @param target_component Component ID * @param flags Low level gimbal flags. - * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation, the frame is depends on whether the flag GIMBAL_DEVICE_FLAGS_YAW_LOCK is set, set all fields to NaN if only angular velocity should be used) - * @param angular_velocity_x [rad/s] X component of angular velocity, positive is rolling to the right, NaN to be ignored. - * @param angular_velocity_y [rad/s] Y component of angular velocity, positive is pitching up, NaN to be ignored. - * @param angular_velocity_z [rad/s] Z component of angular velocity, positive is yawing to the right, NaN to be ignored. + * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation). The frame is described in the message description. Set fields to NaN to be ignored. + * @param angular_velocity_x [rad/s] X component of angular velocity (positive: rolling to the right). The frame is described in the message description. NaN to be ignored. + * @param angular_velocity_y [rad/s] Y component of angular velocity (positive: pitching up). The frame is described in the message description. NaN to be ignored. + * @param angular_velocity_z [rad/s] Z component of angular velocity (positive: yawing to the right). The frame is described in the message description. NaN to be ignored. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_gimbal_device_set_attitude_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, @@ -134,7 +183,7 @@ static inline uint16_t mavlink_msg_gimbal_device_set_attitude_pack_chan(uint8_t packet.flags = flags; packet.target_system = target_system; packet.target_component = target_component; - mav_array_memcpy(packet.q, q, sizeof(float)*4); + mav_array_assign_float(packet.q, q, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_DEVICE_SET_ATTITUDE_LEN); #endif @@ -169,6 +218,20 @@ static inline uint16_t mavlink_msg_gimbal_device_set_attitude_encode_chan(uint8_ return mavlink_msg_gimbal_device_set_attitude_pack_chan(system_id, component_id, chan, msg, gimbal_device_set_attitude->target_system, gimbal_device_set_attitude->target_component, gimbal_device_set_attitude->flags, gimbal_device_set_attitude->q, gimbal_device_set_attitude->angular_velocity_x, gimbal_device_set_attitude->angular_velocity_y, gimbal_device_set_attitude->angular_velocity_z); } +/** + * @brief Encode a gimbal_device_set_attitude struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param gimbal_device_set_attitude C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_gimbal_device_set_attitude_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_gimbal_device_set_attitude_t* gimbal_device_set_attitude) +{ + return mavlink_msg_gimbal_device_set_attitude_pack_status(system_id, component_id, _status, msg, gimbal_device_set_attitude->target_system, gimbal_device_set_attitude->target_component, gimbal_device_set_attitude->flags, gimbal_device_set_attitude->q, gimbal_device_set_attitude->angular_velocity_x, gimbal_device_set_attitude->angular_velocity_y, gimbal_device_set_attitude->angular_velocity_z); +} + /** * @brief Send a gimbal_device_set_attitude message * @param chan MAVLink channel to send the message @@ -176,10 +239,10 @@ static inline uint16_t mavlink_msg_gimbal_device_set_attitude_encode_chan(uint8_ * @param target_system System ID * @param target_component Component ID * @param flags Low level gimbal flags. - * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation, the frame is depends on whether the flag GIMBAL_DEVICE_FLAGS_YAW_LOCK is set, set all fields to NaN if only angular velocity should be used) - * @param angular_velocity_x [rad/s] X component of angular velocity, positive is rolling to the right, NaN to be ignored. - * @param angular_velocity_y [rad/s] Y component of angular velocity, positive is pitching up, NaN to be ignored. - * @param angular_velocity_z [rad/s] Z component of angular velocity, positive is yawing to the right, NaN to be ignored. + * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation). The frame is described in the message description. Set fields to NaN to be ignored. + * @param angular_velocity_x [rad/s] X component of angular velocity (positive: rolling to the right). The frame is described in the message description. NaN to be ignored. + * @param angular_velocity_y [rad/s] Y component of angular velocity (positive: pitching up). The frame is described in the message description. NaN to be ignored. + * @param angular_velocity_z [rad/s] Z component of angular velocity (positive: yawing to the right). The frame is described in the message description. NaN to be ignored. */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS @@ -203,7 +266,7 @@ static inline void mavlink_msg_gimbal_device_set_attitude_send(mavlink_channel_t packet.flags = flags; packet.target_system = target_system; packet.target_component = target_component; - mav_array_memcpy(packet.q, q, sizeof(float)*4); + mav_array_assign_float(packet.q, q, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_DEVICE_SET_ATTITUDE, (const char *)&packet, MAVLINK_MSG_ID_GIMBAL_DEVICE_SET_ATTITUDE_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_SET_ATTITUDE_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_SET_ATTITUDE_CRC); #endif } @@ -224,7 +287,7 @@ static inline void mavlink_msg_gimbal_device_set_attitude_send_struct(mavlink_ch #if MAVLINK_MSG_ID_GIMBAL_DEVICE_SET_ATTITUDE_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -250,7 +313,7 @@ static inline void mavlink_msg_gimbal_device_set_attitude_send_buf(mavlink_messa packet->flags = flags; packet->target_system = target_system; packet->target_component = target_component; - mav_array_memcpy(packet->q, q, sizeof(float)*4); + mav_array_assign_float(packet->q, q, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_DEVICE_SET_ATTITUDE, (const char *)packet, MAVLINK_MSG_ID_GIMBAL_DEVICE_SET_ATTITUDE_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_SET_ATTITUDE_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_SET_ATTITUDE_CRC); #endif } @@ -294,7 +357,7 @@ static inline uint16_t mavlink_msg_gimbal_device_set_attitude_get_flags(const ma /** * @brief Get field q from gimbal_device_set_attitude message * - * @return Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation, the frame is depends on whether the flag GIMBAL_DEVICE_FLAGS_YAW_LOCK is set, set all fields to NaN if only angular velocity should be used) + * @return Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation). The frame is described in the message description. Set fields to NaN to be ignored. */ static inline uint16_t mavlink_msg_gimbal_device_set_attitude_get_q(const mavlink_message_t* msg, float *q) { @@ -304,7 +367,7 @@ static inline uint16_t mavlink_msg_gimbal_device_set_attitude_get_q(const mavlin /** * @brief Get field angular_velocity_x from gimbal_device_set_attitude message * - * @return [rad/s] X component of angular velocity, positive is rolling to the right, NaN to be ignored. + * @return [rad/s] X component of angular velocity (positive: rolling to the right). The frame is described in the message description. NaN to be ignored. */ static inline float mavlink_msg_gimbal_device_set_attitude_get_angular_velocity_x(const mavlink_message_t* msg) { @@ -314,7 +377,7 @@ static inline float mavlink_msg_gimbal_device_set_attitude_get_angular_velocity_ /** * @brief Get field angular_velocity_y from gimbal_device_set_attitude message * - * @return [rad/s] Y component of angular velocity, positive is pitching up, NaN to be ignored. + * @return [rad/s] Y component of angular velocity (positive: pitching up). The frame is described in the message description. NaN to be ignored. */ static inline float mavlink_msg_gimbal_device_set_attitude_get_angular_velocity_y(const mavlink_message_t* msg) { @@ -324,7 +387,7 @@ static inline float mavlink_msg_gimbal_device_set_attitude_get_angular_velocity_ /** * @brief Get field angular_velocity_z from gimbal_device_set_attitude message * - * @return [rad/s] Z component of angular velocity, positive is yawing to the right, NaN to be ignored. + * @return [rad/s] Z component of angular velocity (positive: yawing to the right). The frame is described in the message description. NaN to be ignored. */ static inline float mavlink_msg_gimbal_device_set_attitude_get_angular_velocity_z(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_gimbal_manager_information.h b/common/mavlink_msg_gimbal_manager_information.h index 58c8c59d9..f3415a1c2 100644 --- a/common/mavlink_msg_gimbal_manager_information.h +++ b/common/mavlink_msg_gimbal_manager_information.h @@ -13,7 +13,7 @@ typedef struct __mavlink_gimbal_manager_information_t { float pitch_max; /*< [rad] Maximum pitch angle (positive: up, negative: down)*/ float yaw_min; /*< [rad] Minimum yaw angle (positive: to the right, negative: to the left)*/ float yaw_max; /*< [rad] Maximum yaw angle (positive: to the right, negative: to the left)*/ - uint8_t gimbal_device_id; /*< Gimbal device ID that this gimbal manager is responsible for.*/ + uint8_t gimbal_device_id; /*< Gimbal device ID that this gimbal manager is responsible for. Component ID of gimbal device (or 1-6 for non-MAVLink gimbal).*/ } mavlink_gimbal_manager_information_t; #define MAVLINK_MSG_ID_GIMBAL_MANAGER_INFORMATION_LEN 33 @@ -67,7 +67,7 @@ typedef struct __mavlink_gimbal_manager_information_t { * * @param time_boot_ms [ms] Timestamp (time since system boot). * @param cap_flags Bitmap of gimbal capability flags. - * @param gimbal_device_id Gimbal device ID that this gimbal manager is responsible for. + * @param gimbal_device_id Gimbal device ID that this gimbal manager is responsible for. Component ID of gimbal device (or 1-6 for non-MAVLink gimbal). * @param roll_min [rad] Minimum hardware roll angle (positive: rolling to the right, negative: rolling to the left) * @param roll_max [rad] Maximum hardware roll angle (positive: rolling to the right, negative: rolling to the left) * @param pitch_min [rad] Minimum pitch angle (positive: up, negative: down) @@ -111,6 +111,63 @@ static inline uint16_t mavlink_msg_gimbal_manager_information_pack(uint8_t syste return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GIMBAL_MANAGER_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_INFORMATION_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_INFORMATION_CRC); } +/** + * @brief Pack a gimbal_manager_information message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param cap_flags Bitmap of gimbal capability flags. + * @param gimbal_device_id Gimbal device ID that this gimbal manager is responsible for. Component ID of gimbal device (or 1-6 for non-MAVLink gimbal). + * @param roll_min [rad] Minimum hardware roll angle (positive: rolling to the right, negative: rolling to the left) + * @param roll_max [rad] Maximum hardware roll angle (positive: rolling to the right, negative: rolling to the left) + * @param pitch_min [rad] Minimum pitch angle (positive: up, negative: down) + * @param pitch_max [rad] Maximum pitch angle (positive: up, negative: down) + * @param yaw_min [rad] Minimum yaw angle (positive: to the right, negative: to the left) + * @param yaw_max [rad] Maximum yaw angle (positive: to the right, negative: to the left) + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_gimbal_manager_information_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, uint32_t cap_flags, uint8_t gimbal_device_id, float roll_min, float roll_max, float pitch_min, float pitch_max, float yaw_min, float yaw_max) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GIMBAL_MANAGER_INFORMATION_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_uint32_t(buf, 4, cap_flags); + _mav_put_float(buf, 8, roll_min); + _mav_put_float(buf, 12, roll_max); + _mav_put_float(buf, 16, pitch_min); + _mav_put_float(buf, 20, pitch_max); + _mav_put_float(buf, 24, yaw_min); + _mav_put_float(buf, 28, yaw_max); + _mav_put_uint8_t(buf, 32, gimbal_device_id); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GIMBAL_MANAGER_INFORMATION_LEN); +#else + mavlink_gimbal_manager_information_t packet; + packet.time_boot_ms = time_boot_ms; + packet.cap_flags = cap_flags; + packet.roll_min = roll_min; + packet.roll_max = roll_max; + packet.pitch_min = pitch_min; + packet.pitch_max = pitch_max; + packet.yaw_min = yaw_min; + packet.yaw_max = yaw_max; + packet.gimbal_device_id = gimbal_device_id; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_MANAGER_INFORMATION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GIMBAL_MANAGER_INFORMATION; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GIMBAL_MANAGER_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_INFORMATION_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_INFORMATION_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GIMBAL_MANAGER_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_INFORMATION_LEN); +#endif +} + /** * @brief Pack a gimbal_manager_information message on a channel * @param system_id ID of this system @@ -119,7 +176,7 @@ static inline uint16_t mavlink_msg_gimbal_manager_information_pack(uint8_t syste * @param msg The MAVLink message to compress the data into * @param time_boot_ms [ms] Timestamp (time since system boot). * @param cap_flags Bitmap of gimbal capability flags. - * @param gimbal_device_id Gimbal device ID that this gimbal manager is responsible for. + * @param gimbal_device_id Gimbal device ID that this gimbal manager is responsible for. Component ID of gimbal device (or 1-6 for non-MAVLink gimbal). * @param roll_min [rad] Minimum hardware roll angle (positive: rolling to the right, negative: rolling to the left) * @param roll_max [rad] Maximum hardware roll angle (positive: rolling to the right, negative: rolling to the left) * @param pitch_min [rad] Minimum pitch angle (positive: up, negative: down) @@ -191,13 +248,27 @@ static inline uint16_t mavlink_msg_gimbal_manager_information_encode_chan(uint8_ return mavlink_msg_gimbal_manager_information_pack_chan(system_id, component_id, chan, msg, gimbal_manager_information->time_boot_ms, gimbal_manager_information->cap_flags, gimbal_manager_information->gimbal_device_id, gimbal_manager_information->roll_min, gimbal_manager_information->roll_max, gimbal_manager_information->pitch_min, gimbal_manager_information->pitch_max, gimbal_manager_information->yaw_min, gimbal_manager_information->yaw_max); } +/** + * @brief Encode a gimbal_manager_information struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param gimbal_manager_information C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_gimbal_manager_information_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_gimbal_manager_information_t* gimbal_manager_information) +{ + return mavlink_msg_gimbal_manager_information_pack_status(system_id, component_id, _status, msg, gimbal_manager_information->time_boot_ms, gimbal_manager_information->cap_flags, gimbal_manager_information->gimbal_device_id, gimbal_manager_information->roll_min, gimbal_manager_information->roll_max, gimbal_manager_information->pitch_min, gimbal_manager_information->pitch_max, gimbal_manager_information->yaw_min, gimbal_manager_information->yaw_max); +} + /** * @brief Send a gimbal_manager_information message * @param chan MAVLink channel to send the message * * @param time_boot_ms [ms] Timestamp (time since system boot). * @param cap_flags Bitmap of gimbal capability flags. - * @param gimbal_device_id Gimbal device ID that this gimbal manager is responsible for. + * @param gimbal_device_id Gimbal device ID that this gimbal manager is responsible for. Component ID of gimbal device (or 1-6 for non-MAVLink gimbal). * @param roll_min [rad] Minimum hardware roll angle (positive: rolling to the right, negative: rolling to the left) * @param roll_max [rad] Maximum hardware roll angle (positive: rolling to the right, negative: rolling to the left) * @param pitch_min [rad] Minimum pitch angle (positive: up, negative: down) @@ -254,7 +325,7 @@ static inline void mavlink_msg_gimbal_manager_information_send_struct(mavlink_ch #if MAVLINK_MSG_ID_GIMBAL_MANAGER_INFORMATION_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -320,7 +391,7 @@ static inline uint32_t mavlink_msg_gimbal_manager_information_get_cap_flags(cons /** * @brief Get field gimbal_device_id from gimbal_manager_information message * - * @return Gimbal device ID that this gimbal manager is responsible for. + * @return Gimbal device ID that this gimbal manager is responsible for. Component ID of gimbal device (or 1-6 for non-MAVLink gimbal). */ static inline uint8_t mavlink_msg_gimbal_manager_information_get_gimbal_device_id(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_gimbal_manager_set_attitude.h b/common/mavlink_msg_gimbal_manager_set_attitude.h index 828f1e6a3..6388ebada 100644 --- a/common/mavlink_msg_gimbal_manager_set_attitude.h +++ b/common/mavlink_msg_gimbal_manager_set_attitude.h @@ -95,7 +95,7 @@ static inline uint16_t mavlink_msg_gimbal_manager_set_attitude_pack(uint8_t syst packet.target_system = target_system; packet.target_component = target_component; packet.gimbal_device_id = gimbal_device_id; - mav_array_memcpy(packet.q, q, sizeof(float)*4); + mav_array_assign_float(packet.q, q, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_ATTITUDE_LEN); #endif @@ -103,6 +103,58 @@ static inline uint16_t mavlink_msg_gimbal_manager_set_attitude_pack(uint8_t syst return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_ATTITUDE_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_ATTITUDE_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_ATTITUDE_CRC); } +/** + * @brief Pack a gimbal_manager_set_attitude message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param flags High level gimbal manager flags to use. + * @param gimbal_device_id Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals). + * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation, the frame is depends on whether the flag GIMBAL_MANAGER_FLAGS_YAW_LOCK is set) + * @param angular_velocity_x [rad/s] X component of angular velocity, positive is rolling to the right, NaN to be ignored. + * @param angular_velocity_y [rad/s] Y component of angular velocity, positive is pitching up, NaN to be ignored. + * @param angular_velocity_z [rad/s] Z component of angular velocity, positive is yawing to the right, NaN to be ignored. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_gimbal_manager_set_attitude_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint32_t flags, uint8_t gimbal_device_id, const float *q, float angular_velocity_x, float angular_velocity_y, float angular_velocity_z) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_ATTITUDE_LEN]; + _mav_put_uint32_t(buf, 0, flags); + _mav_put_float(buf, 20, angular_velocity_x); + _mav_put_float(buf, 24, angular_velocity_y); + _mav_put_float(buf, 28, angular_velocity_z); + _mav_put_uint8_t(buf, 32, target_system); + _mav_put_uint8_t(buf, 33, target_component); + _mav_put_uint8_t(buf, 34, gimbal_device_id); + _mav_put_float_array(buf, 4, q, 4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_ATTITUDE_LEN); +#else + mavlink_gimbal_manager_set_attitude_t packet; + packet.flags = flags; + packet.angular_velocity_x = angular_velocity_x; + packet.angular_velocity_y = angular_velocity_y; + packet.angular_velocity_z = angular_velocity_z; + packet.target_system = target_system; + packet.target_component = target_component; + packet.gimbal_device_id = gimbal_device_id; + mav_array_memcpy(packet.q, q, sizeof(float)*4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_ATTITUDE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_ATTITUDE; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_ATTITUDE_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_ATTITUDE_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_ATTITUDE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_ATTITUDE_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_ATTITUDE_LEN); +#endif +} + /** * @brief Pack a gimbal_manager_set_attitude message on a channel * @param system_id ID of this system @@ -143,7 +195,7 @@ static inline uint16_t mavlink_msg_gimbal_manager_set_attitude_pack_chan(uint8_t packet.target_system = target_system; packet.target_component = target_component; packet.gimbal_device_id = gimbal_device_id; - mav_array_memcpy(packet.q, q, sizeof(float)*4); + mav_array_assign_float(packet.q, q, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_ATTITUDE_LEN); #endif @@ -178,6 +230,20 @@ static inline uint16_t mavlink_msg_gimbal_manager_set_attitude_encode_chan(uint8 return mavlink_msg_gimbal_manager_set_attitude_pack_chan(system_id, component_id, chan, msg, gimbal_manager_set_attitude->target_system, gimbal_manager_set_attitude->target_component, gimbal_manager_set_attitude->flags, gimbal_manager_set_attitude->gimbal_device_id, gimbal_manager_set_attitude->q, gimbal_manager_set_attitude->angular_velocity_x, gimbal_manager_set_attitude->angular_velocity_y, gimbal_manager_set_attitude->angular_velocity_z); } +/** + * @brief Encode a gimbal_manager_set_attitude struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param gimbal_manager_set_attitude C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_gimbal_manager_set_attitude_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_gimbal_manager_set_attitude_t* gimbal_manager_set_attitude) +{ + return mavlink_msg_gimbal_manager_set_attitude_pack_status(system_id, component_id, _status, msg, gimbal_manager_set_attitude->target_system, gimbal_manager_set_attitude->target_component, gimbal_manager_set_attitude->flags, gimbal_manager_set_attitude->gimbal_device_id, gimbal_manager_set_attitude->q, gimbal_manager_set_attitude->angular_velocity_x, gimbal_manager_set_attitude->angular_velocity_y, gimbal_manager_set_attitude->angular_velocity_z); +} + /** * @brief Send a gimbal_manager_set_attitude message * @param chan MAVLink channel to send the message @@ -215,7 +281,7 @@ static inline void mavlink_msg_gimbal_manager_set_attitude_send(mavlink_channel_ packet.target_system = target_system; packet.target_component = target_component; packet.gimbal_device_id = gimbal_device_id; - mav_array_memcpy(packet.q, q, sizeof(float)*4); + mav_array_assign_float(packet.q, q, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_ATTITUDE, (const char *)&packet, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_ATTITUDE_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_ATTITUDE_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_ATTITUDE_CRC); #endif } @@ -236,7 +302,7 @@ static inline void mavlink_msg_gimbal_manager_set_attitude_send_struct(mavlink_c #if MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_ATTITUDE_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -264,7 +330,7 @@ static inline void mavlink_msg_gimbal_manager_set_attitude_send_buf(mavlink_mess packet->target_system = target_system; packet->target_component = target_component; packet->gimbal_device_id = gimbal_device_id; - mav_array_memcpy(packet->q, q, sizeof(float)*4); + mav_array_assign_float(packet->q, q, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_ATTITUDE, (const char *)packet, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_ATTITUDE_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_ATTITUDE_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_ATTITUDE_CRC); #endif } diff --git a/common/mavlink_msg_gimbal_manager_set_manual_control.h b/common/mavlink_msg_gimbal_manager_set_manual_control.h index d3096c49b..2705ce924 100644 --- a/common/mavlink_msg_gimbal_manager_set_manual_control.h +++ b/common/mavlink_msg_gimbal_manager_set_manual_control.h @@ -105,6 +105,60 @@ static inline uint16_t mavlink_msg_gimbal_manager_set_manual_control_pack(uint8_ return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_MANUAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_MANUAL_CONTROL_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_MANUAL_CONTROL_CRC); } +/** + * @brief Pack a gimbal_manager_set_manual_control message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param flags High level gimbal manager flags. + * @param gimbal_device_id Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals). + * @param pitch Pitch angle unitless (-1..1, positive: up, negative: down, NaN to be ignored). + * @param yaw Yaw angle unitless (-1..1, positive: to the right, negative: to the left, NaN to be ignored). + * @param pitch_rate Pitch angular rate unitless (-1..1, positive: up, negative: down, NaN to be ignored). + * @param yaw_rate Yaw angular rate unitless (-1..1, positive: to the right, negative: to the left, NaN to be ignored). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_gimbal_manager_set_manual_control_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint32_t flags, uint8_t gimbal_device_id, float pitch, float yaw, float pitch_rate, float yaw_rate) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_MANUAL_CONTROL_LEN]; + _mav_put_uint32_t(buf, 0, flags); + _mav_put_float(buf, 4, pitch); + _mav_put_float(buf, 8, yaw); + _mav_put_float(buf, 12, pitch_rate); + _mav_put_float(buf, 16, yaw_rate); + _mav_put_uint8_t(buf, 20, target_system); + _mav_put_uint8_t(buf, 21, target_component); + _mav_put_uint8_t(buf, 22, gimbal_device_id); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_MANUAL_CONTROL_LEN); +#else + mavlink_gimbal_manager_set_manual_control_t packet; + packet.flags = flags; + packet.pitch = pitch; + packet.yaw = yaw; + packet.pitch_rate = pitch_rate; + packet.yaw_rate = yaw_rate; + packet.target_system = target_system; + packet.target_component = target_component; + packet.gimbal_device_id = gimbal_device_id; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_MANUAL_CONTROL_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_MANUAL_CONTROL; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_MANUAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_MANUAL_CONTROL_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_MANUAL_CONTROL_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_MANUAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_MANUAL_CONTROL_LEN); +#endif +} + /** * @brief Pack a gimbal_manager_set_manual_control message on a channel * @param system_id ID of this system @@ -182,6 +236,20 @@ static inline uint16_t mavlink_msg_gimbal_manager_set_manual_control_encode_chan return mavlink_msg_gimbal_manager_set_manual_control_pack_chan(system_id, component_id, chan, msg, gimbal_manager_set_manual_control->target_system, gimbal_manager_set_manual_control->target_component, gimbal_manager_set_manual_control->flags, gimbal_manager_set_manual_control->gimbal_device_id, gimbal_manager_set_manual_control->pitch, gimbal_manager_set_manual_control->yaw, gimbal_manager_set_manual_control->pitch_rate, gimbal_manager_set_manual_control->yaw_rate); } +/** + * @brief Encode a gimbal_manager_set_manual_control struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param gimbal_manager_set_manual_control C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_gimbal_manager_set_manual_control_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_gimbal_manager_set_manual_control_t* gimbal_manager_set_manual_control) +{ + return mavlink_msg_gimbal_manager_set_manual_control_pack_status(system_id, component_id, _status, msg, gimbal_manager_set_manual_control->target_system, gimbal_manager_set_manual_control->target_component, gimbal_manager_set_manual_control->flags, gimbal_manager_set_manual_control->gimbal_device_id, gimbal_manager_set_manual_control->pitch, gimbal_manager_set_manual_control->yaw, gimbal_manager_set_manual_control->pitch_rate, gimbal_manager_set_manual_control->yaw_rate); +} + /** * @brief Send a gimbal_manager_set_manual_control message * @param chan MAVLink channel to send the message @@ -242,7 +310,7 @@ static inline void mavlink_msg_gimbal_manager_set_manual_control_send_struct(mav #if MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_MANUAL_CONTROL_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_gimbal_manager_set_pitchyaw.h b/common/mavlink_msg_gimbal_manager_set_pitchyaw.h index de6a43b1d..01ef99fbe 100644 --- a/common/mavlink_msg_gimbal_manager_set_pitchyaw.h +++ b/common/mavlink_msg_gimbal_manager_set_pitchyaw.h @@ -105,6 +105,60 @@ static inline uint16_t mavlink_msg_gimbal_manager_set_pitchyaw_pack(uint8_t syst return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_PITCHYAW_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_PITCHYAW_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_PITCHYAW_CRC); } +/** + * @brief Pack a gimbal_manager_set_pitchyaw message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param flags High level gimbal manager flags to use. + * @param gimbal_device_id Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals). + * @param pitch [rad] Pitch angle (positive: up, negative: down, NaN to be ignored). + * @param yaw [rad] Yaw angle (positive: to the right, negative: to the left, NaN to be ignored). + * @param pitch_rate [rad/s] Pitch angular rate (positive: up, negative: down, NaN to be ignored). + * @param yaw_rate [rad/s] Yaw angular rate (positive: to the right, negative: to the left, NaN to be ignored). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_gimbal_manager_set_pitchyaw_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint32_t flags, uint8_t gimbal_device_id, float pitch, float yaw, float pitch_rate, float yaw_rate) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_PITCHYAW_LEN]; + _mav_put_uint32_t(buf, 0, flags); + _mav_put_float(buf, 4, pitch); + _mav_put_float(buf, 8, yaw); + _mav_put_float(buf, 12, pitch_rate); + _mav_put_float(buf, 16, yaw_rate); + _mav_put_uint8_t(buf, 20, target_system); + _mav_put_uint8_t(buf, 21, target_component); + _mav_put_uint8_t(buf, 22, gimbal_device_id); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_PITCHYAW_LEN); +#else + mavlink_gimbal_manager_set_pitchyaw_t packet; + packet.flags = flags; + packet.pitch = pitch; + packet.yaw = yaw; + packet.pitch_rate = pitch_rate; + packet.yaw_rate = yaw_rate; + packet.target_system = target_system; + packet.target_component = target_component; + packet.gimbal_device_id = gimbal_device_id; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_PITCHYAW_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_PITCHYAW; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_PITCHYAW_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_PITCHYAW_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_PITCHYAW_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_PITCHYAW_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_PITCHYAW_LEN); +#endif +} + /** * @brief Pack a gimbal_manager_set_pitchyaw message on a channel * @param system_id ID of this system @@ -182,6 +236,20 @@ static inline uint16_t mavlink_msg_gimbal_manager_set_pitchyaw_encode_chan(uint8 return mavlink_msg_gimbal_manager_set_pitchyaw_pack_chan(system_id, component_id, chan, msg, gimbal_manager_set_pitchyaw->target_system, gimbal_manager_set_pitchyaw->target_component, gimbal_manager_set_pitchyaw->flags, gimbal_manager_set_pitchyaw->gimbal_device_id, gimbal_manager_set_pitchyaw->pitch, gimbal_manager_set_pitchyaw->yaw, gimbal_manager_set_pitchyaw->pitch_rate, gimbal_manager_set_pitchyaw->yaw_rate); } +/** + * @brief Encode a gimbal_manager_set_pitchyaw struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param gimbal_manager_set_pitchyaw C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_gimbal_manager_set_pitchyaw_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_gimbal_manager_set_pitchyaw_t* gimbal_manager_set_pitchyaw) +{ + return mavlink_msg_gimbal_manager_set_pitchyaw_pack_status(system_id, component_id, _status, msg, gimbal_manager_set_pitchyaw->target_system, gimbal_manager_set_pitchyaw->target_component, gimbal_manager_set_pitchyaw->flags, gimbal_manager_set_pitchyaw->gimbal_device_id, gimbal_manager_set_pitchyaw->pitch, gimbal_manager_set_pitchyaw->yaw, gimbal_manager_set_pitchyaw->pitch_rate, gimbal_manager_set_pitchyaw->yaw_rate); +} + /** * @brief Send a gimbal_manager_set_pitchyaw message * @param chan MAVLink channel to send the message @@ -242,7 +310,7 @@ static inline void mavlink_msg_gimbal_manager_set_pitchyaw_send_struct(mavlink_c #if MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_PITCHYAW_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_gimbal_manager_status.h b/common/mavlink_msg_gimbal_manager_status.h index 4eace068b..e659c49b8 100644 --- a/common/mavlink_msg_gimbal_manager_status.h +++ b/common/mavlink_msg_gimbal_manager_status.h @@ -7,7 +7,7 @@ typedef struct __mavlink_gimbal_manager_status_t { uint32_t time_boot_ms; /*< [ms] Timestamp (time since system boot).*/ uint32_t flags; /*< High level gimbal manager flags currently applied.*/ - uint8_t gimbal_device_id; /*< Gimbal device ID that this gimbal manager is responsible for.*/ + uint8_t gimbal_device_id; /*< Gimbal device ID that this gimbal manager is responsible for. Component ID of gimbal device (or 1-6 for non-MAVLink gimbal).*/ uint8_t primary_control_sysid; /*< System ID of MAVLink component with primary control, 0 for none.*/ uint8_t primary_control_compid; /*< Component ID of MAVLink component with primary control, 0 for none.*/ uint8_t secondary_control_sysid; /*< System ID of MAVLink component with secondary control, 0 for none.*/ @@ -61,7 +61,7 @@ typedef struct __mavlink_gimbal_manager_status_t { * * @param time_boot_ms [ms] Timestamp (time since system boot). * @param flags High level gimbal manager flags currently applied. - * @param gimbal_device_id Gimbal device ID that this gimbal manager is responsible for. + * @param gimbal_device_id Gimbal device ID that this gimbal manager is responsible for. Component ID of gimbal device (or 1-6 for non-MAVLink gimbal). * @param primary_control_sysid System ID of MAVLink component with primary control, 0 for none. * @param primary_control_compid Component ID of MAVLink component with primary control, 0 for none. * @param secondary_control_sysid System ID of MAVLink component with secondary control, 0 for none. @@ -99,6 +99,57 @@ static inline uint16_t mavlink_msg_gimbal_manager_status_pack(uint8_t system_id, return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_CRC); } +/** + * @brief Pack a gimbal_manager_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param flags High level gimbal manager flags currently applied. + * @param gimbal_device_id Gimbal device ID that this gimbal manager is responsible for. Component ID of gimbal device (or 1-6 for non-MAVLink gimbal). + * @param primary_control_sysid System ID of MAVLink component with primary control, 0 for none. + * @param primary_control_compid Component ID of MAVLink component with primary control, 0 for none. + * @param secondary_control_sysid System ID of MAVLink component with secondary control, 0 for none. + * @param secondary_control_compid Component ID of MAVLink component with secondary control, 0 for none. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_gimbal_manager_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, uint32_t flags, uint8_t gimbal_device_id, uint8_t primary_control_sysid, uint8_t primary_control_compid, uint8_t secondary_control_sysid, uint8_t secondary_control_compid) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_uint32_t(buf, 4, flags); + _mav_put_uint8_t(buf, 8, gimbal_device_id); + _mav_put_uint8_t(buf, 9, primary_control_sysid); + _mav_put_uint8_t(buf, 10, primary_control_compid); + _mav_put_uint8_t(buf, 11, secondary_control_sysid); + _mav_put_uint8_t(buf, 12, secondary_control_compid); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_LEN); +#else + mavlink_gimbal_manager_status_t packet; + packet.time_boot_ms = time_boot_ms; + packet.flags = flags; + packet.gimbal_device_id = gimbal_device_id; + packet.primary_control_sysid = primary_control_sysid; + packet.primary_control_compid = primary_control_compid; + packet.secondary_control_sysid = secondary_control_sysid; + packet.secondary_control_compid = secondary_control_compid; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_LEN); +#endif +} + /** * @brief Pack a gimbal_manager_status message on a channel * @param system_id ID of this system @@ -107,7 +158,7 @@ static inline uint16_t mavlink_msg_gimbal_manager_status_pack(uint8_t system_id, * @param msg The MAVLink message to compress the data into * @param time_boot_ms [ms] Timestamp (time since system boot). * @param flags High level gimbal manager flags currently applied. - * @param gimbal_device_id Gimbal device ID that this gimbal manager is responsible for. + * @param gimbal_device_id Gimbal device ID that this gimbal manager is responsible for. Component ID of gimbal device (or 1-6 for non-MAVLink gimbal). * @param primary_control_sysid System ID of MAVLink component with primary control, 0 for none. * @param primary_control_compid Component ID of MAVLink component with primary control, 0 for none. * @param secondary_control_sysid System ID of MAVLink component with secondary control, 0 for none. @@ -173,13 +224,27 @@ static inline uint16_t mavlink_msg_gimbal_manager_status_encode_chan(uint8_t sys return mavlink_msg_gimbal_manager_status_pack_chan(system_id, component_id, chan, msg, gimbal_manager_status->time_boot_ms, gimbal_manager_status->flags, gimbal_manager_status->gimbal_device_id, gimbal_manager_status->primary_control_sysid, gimbal_manager_status->primary_control_compid, gimbal_manager_status->secondary_control_sysid, gimbal_manager_status->secondary_control_compid); } +/** + * @brief Encode a gimbal_manager_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param gimbal_manager_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_gimbal_manager_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_gimbal_manager_status_t* gimbal_manager_status) +{ + return mavlink_msg_gimbal_manager_status_pack_status(system_id, component_id, _status, msg, gimbal_manager_status->time_boot_ms, gimbal_manager_status->flags, gimbal_manager_status->gimbal_device_id, gimbal_manager_status->primary_control_sysid, gimbal_manager_status->primary_control_compid, gimbal_manager_status->secondary_control_sysid, gimbal_manager_status->secondary_control_compid); +} + /** * @brief Send a gimbal_manager_status message * @param chan MAVLink channel to send the message * * @param time_boot_ms [ms] Timestamp (time since system boot). * @param flags High level gimbal manager flags currently applied. - * @param gimbal_device_id Gimbal device ID that this gimbal manager is responsible for. + * @param gimbal_device_id Gimbal device ID that this gimbal manager is responsible for. Component ID of gimbal device (or 1-6 for non-MAVLink gimbal). * @param primary_control_sysid System ID of MAVLink component with primary control, 0 for none. * @param primary_control_compid Component ID of MAVLink component with primary control, 0 for none. * @param secondary_control_sysid System ID of MAVLink component with secondary control, 0 for none. @@ -230,7 +295,7 @@ static inline void mavlink_msg_gimbal_manager_status_send_struct(mavlink_channel #if MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -292,7 +357,7 @@ static inline uint32_t mavlink_msg_gimbal_manager_status_get_flags(const mavlink /** * @brief Get field gimbal_device_id from gimbal_manager_status message * - * @return Gimbal device ID that this gimbal manager is responsible for. + * @return Gimbal device ID that this gimbal manager is responsible for. Component ID of gimbal device (or 1-6 for non-MAVLink gimbal). */ static inline uint8_t mavlink_msg_gimbal_manager_status_get_gimbal_device_id(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_global_position_int.h b/common/mavlink_msg_global_position_int.h index 8b601f234..484c5182c 100644 --- a/common/mavlink_msg_global_position_int.h +++ b/common/mavlink_msg_global_position_int.h @@ -9,7 +9,7 @@ typedef struct __mavlink_global_position_int_t { int32_t lat; /*< [degE7] Latitude, expressed*/ int32_t lon; /*< [degE7] Longitude, expressed*/ int32_t alt; /*< [mm] Altitude (MSL). Note that virtually all GPS modules provide both WGS84 and MSL.*/ - int32_t relative_alt; /*< [mm] Altitude above ground*/ + int32_t relative_alt; /*< [mm] Altitude above home*/ int16_t vx; /*< [cm/s] Ground X Speed (Latitude, positive north)*/ int16_t vy; /*< [cm/s] Ground Y Speed (Longitude, positive east)*/ int16_t vz; /*< [cm/s] Ground Z Speed (Altitude, positive down)*/ @@ -69,7 +69,7 @@ typedef struct __mavlink_global_position_int_t { * @param lat [degE7] Latitude, expressed * @param lon [degE7] Longitude, expressed * @param alt [mm] Altitude (MSL). Note that virtually all GPS modules provide both WGS84 and MSL. - * @param relative_alt [mm] Altitude above ground + * @param relative_alt [mm] Altitude above home * @param vx [cm/s] Ground X Speed (Latitude, positive north) * @param vy [cm/s] Ground Y Speed (Longitude, positive east) * @param vz [cm/s] Ground Z Speed (Altitude, positive down) @@ -111,6 +111,63 @@ static inline uint16_t mavlink_msg_global_position_int_pack(uint8_t system_id, u return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_CRC); } +/** + * @brief Pack a global_position_int message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param lat [degE7] Latitude, expressed + * @param lon [degE7] Longitude, expressed + * @param alt [mm] Altitude (MSL). Note that virtually all GPS modules provide both WGS84 and MSL. + * @param relative_alt [mm] Altitude above home + * @param vx [cm/s] Ground X Speed (Latitude, positive north) + * @param vy [cm/s] Ground Y Speed (Longitude, positive east) + * @param vz [cm/s] Ground Z Speed (Altitude, positive down) + * @param hdg [cdeg] Vehicle heading (yaw angle), 0.0..359.99 degrees. If unknown, set to: UINT16_MAX + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_global_position_int_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, int16_t vx, int16_t vy, int16_t vz, uint16_t hdg) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_int32_t(buf, 4, lat); + _mav_put_int32_t(buf, 8, lon); + _mav_put_int32_t(buf, 12, alt); + _mav_put_int32_t(buf, 16, relative_alt); + _mav_put_int16_t(buf, 20, vx); + _mav_put_int16_t(buf, 22, vy); + _mav_put_int16_t(buf, 24, vz); + _mav_put_uint16_t(buf, 26, hdg); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN); +#else + mavlink_global_position_int_t packet; + packet.time_boot_ms = time_boot_ms; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.relative_alt = relative_alt; + packet.vx = vx; + packet.vy = vy; + packet.vz = vz; + packet.hdg = hdg; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GLOBAL_POSITION_INT; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN); +#endif +} + /** * @brief Pack a global_position_int message on a channel * @param system_id ID of this system @@ -121,7 +178,7 @@ static inline uint16_t mavlink_msg_global_position_int_pack(uint8_t system_id, u * @param lat [degE7] Latitude, expressed * @param lon [degE7] Longitude, expressed * @param alt [mm] Altitude (MSL). Note that virtually all GPS modules provide both WGS84 and MSL. - * @param relative_alt [mm] Altitude above ground + * @param relative_alt [mm] Altitude above home * @param vx [cm/s] Ground X Speed (Latitude, positive north) * @param vy [cm/s] Ground Y Speed (Longitude, positive east) * @param vz [cm/s] Ground Z Speed (Altitude, positive down) @@ -191,6 +248,20 @@ static inline uint16_t mavlink_msg_global_position_int_encode_chan(uint8_t syste return mavlink_msg_global_position_int_pack_chan(system_id, component_id, chan, msg, global_position_int->time_boot_ms, global_position_int->lat, global_position_int->lon, global_position_int->alt, global_position_int->relative_alt, global_position_int->vx, global_position_int->vy, global_position_int->vz, global_position_int->hdg); } +/** + * @brief Encode a global_position_int struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param global_position_int C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_global_position_int_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_global_position_int_t* global_position_int) +{ + return mavlink_msg_global_position_int_pack_status(system_id, component_id, _status, msg, global_position_int->time_boot_ms, global_position_int->lat, global_position_int->lon, global_position_int->alt, global_position_int->relative_alt, global_position_int->vx, global_position_int->vy, global_position_int->vz, global_position_int->hdg); +} + /** * @brief Send a global_position_int message * @param chan MAVLink channel to send the message @@ -199,7 +270,7 @@ static inline uint16_t mavlink_msg_global_position_int_encode_chan(uint8_t syste * @param lat [degE7] Latitude, expressed * @param lon [degE7] Longitude, expressed * @param alt [mm] Altitude (MSL). Note that virtually all GPS modules provide both WGS84 and MSL. - * @param relative_alt [mm] Altitude above ground + * @param relative_alt [mm] Altitude above home * @param vx [cm/s] Ground X Speed (Latitude, positive north) * @param vy [cm/s] Ground Y Speed (Longitude, positive east) * @param vz [cm/s] Ground Z Speed (Altitude, positive down) @@ -254,7 +325,7 @@ static inline void mavlink_msg_global_position_int_send_struct(mavlink_channel_t #if MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by re-using memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -340,7 +411,7 @@ static inline int32_t mavlink_msg_global_position_int_get_alt(const mavlink_mess /** * @brief Get field relative_alt from global_position_int message * - * @return [mm] Altitude above ground + * @return [mm] Altitude above home */ static inline int32_t mavlink_msg_global_position_int_get_relative_alt(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_global_position_int_cov.h b/common/mavlink_msg_global_position_int_cov.h index 3cb44be78..4e1ab8a98 100644 --- a/common/mavlink_msg_global_position_int_cov.h +++ b/common/mavlink_msg_global_position_int_cov.h @@ -107,7 +107,7 @@ static inline uint16_t mavlink_msg_global_position_int_cov_pack(uint8_t system_i packet.vy = vy; packet.vz = vz; packet.estimator_type = estimator_type; - mav_array_memcpy(packet.covariance, covariance, sizeof(float)*36); + mav_array_assign_float(packet.covariance, covariance, 36); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN); #endif @@ -115,6 +115,64 @@ static inline uint16_t mavlink_msg_global_position_int_cov_pack(uint8_t system_i return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_CRC); } +/** + * @brief Pack a global_position_int_cov message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param estimator_type Class id of the estimator this estimate originated from. + * @param lat [degE7] Latitude + * @param lon [degE7] Longitude + * @param alt [mm] Altitude in meters above MSL + * @param relative_alt [mm] Altitude above ground + * @param vx [m/s] Ground X Speed (Latitude) + * @param vy [m/s] Ground Y Speed (Longitude) + * @param vz [m/s] Ground Z Speed (Altitude) + * @param covariance Row-major representation of a 6x6 position and velocity 6x6 cross-covariance matrix (states: lat, lon, alt, vx, vy, vz; first six entries are the first ROW, next six entries are the second row, etc.). If unknown, assign NaN value to first element in the array. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_global_position_int_cov_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, uint8_t estimator_type, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, float vx, float vy, float vz, const float *covariance) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_int32_t(buf, 16, alt); + _mav_put_int32_t(buf, 20, relative_alt); + _mav_put_float(buf, 24, vx); + _mav_put_float(buf, 28, vy); + _mav_put_float(buf, 32, vz); + _mav_put_uint8_t(buf, 180, estimator_type); + _mav_put_float_array(buf, 36, covariance, 36); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN); +#else + mavlink_global_position_int_cov_t packet; + packet.time_usec = time_usec; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.relative_alt = relative_alt; + packet.vx = vx; + packet.vy = vy; + packet.vz = vz; + packet.estimator_type = estimator_type; + mav_array_memcpy(packet.covariance, covariance, sizeof(float)*36); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN); +#endif +} + /** * @brief Pack a global_position_int_cov message on a channel * @param system_id ID of this system @@ -161,7 +219,7 @@ static inline uint16_t mavlink_msg_global_position_int_cov_pack_chan(uint8_t sys packet.vy = vy; packet.vz = vz; packet.estimator_type = estimator_type; - mav_array_memcpy(packet.covariance, covariance, sizeof(float)*36); + mav_array_assign_float(packet.covariance, covariance, 36); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN); #endif @@ -196,6 +254,20 @@ static inline uint16_t mavlink_msg_global_position_int_cov_encode_chan(uint8_t s return mavlink_msg_global_position_int_cov_pack_chan(system_id, component_id, chan, msg, global_position_int_cov->time_usec, global_position_int_cov->estimator_type, global_position_int_cov->lat, global_position_int_cov->lon, global_position_int_cov->alt, global_position_int_cov->relative_alt, global_position_int_cov->vx, global_position_int_cov->vy, global_position_int_cov->vz, global_position_int_cov->covariance); } +/** + * @brief Encode a global_position_int_cov struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param global_position_int_cov C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_global_position_int_cov_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_global_position_int_cov_t* global_position_int_cov) +{ + return mavlink_msg_global_position_int_cov_pack_status(system_id, component_id, _status, msg, global_position_int_cov->time_usec, global_position_int_cov->estimator_type, global_position_int_cov->lat, global_position_int_cov->lon, global_position_int_cov->alt, global_position_int_cov->relative_alt, global_position_int_cov->vx, global_position_int_cov->vy, global_position_int_cov->vz, global_position_int_cov->covariance); +} + /** * @brief Send a global_position_int_cov message * @param chan MAVLink channel to send the message @@ -239,7 +311,7 @@ static inline void mavlink_msg_global_position_int_cov_send(mavlink_channel_t ch packet.vy = vy; packet.vz = vz; packet.estimator_type = estimator_type; - mav_array_memcpy(packet.covariance, covariance, sizeof(float)*36); + mav_array_assign_float(packet.covariance, covariance, 36); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV, (const char *)&packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_CRC); #endif } @@ -260,7 +332,7 @@ static inline void mavlink_msg_global_position_int_cov_send_struct(mavlink_chann #if MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -292,7 +364,7 @@ static inline void mavlink_msg_global_position_int_cov_send_buf(mavlink_message_ packet->vy = vy; packet->vz = vz; packet->estimator_type = estimator_type; - mav_array_memcpy(packet->covariance, covariance, sizeof(float)*36); + mav_array_assign_float(packet->covariance, covariance, 36); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV, (const char *)packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_CRC); #endif } diff --git a/common/mavlink_msg_global_vision_position_estimate.h b/common/mavlink_msg_global_vision_position_estimate.h index 94a3d05dd..30ab385a6 100644 --- a/common/mavlink_msg_global_vision_position_estimate.h +++ b/common/mavlink_msg_global_vision_position_estimate.h @@ -101,7 +101,7 @@ static inline uint16_t mavlink_msg_global_vision_position_estimate_pack(uint8_t packet.pitch = pitch; packet.yaw = yaw; packet.reset_counter = reset_counter; - mav_array_memcpy(packet.covariance, covariance, sizeof(float)*21); + mav_array_assign_float(packet.covariance, covariance, 21); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN); #endif @@ -109,6 +109,61 @@ static inline uint16_t mavlink_msg_global_vision_position_estimate_pack(uint8_t return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_CRC); } +/** + * @brief Pack a global_vision_position_estimate message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param usec [us] Timestamp (UNIX time or since system boot) + * @param x [m] Global X position + * @param y [m] Global Y position + * @param z [m] Global Z position + * @param roll [rad] Roll angle + * @param pitch [rad] Pitch angle + * @param yaw [rad] Yaw angle + * @param covariance Row-major representation of pose 6x6 cross-covariance matrix upper right triangle (states: x_global, y_global, z_global, roll, pitch, yaw; first six entries are the first ROW, next five entries are the second ROW, etc.). If unknown, assign NaN value to first element in the array. + * @param reset_counter Estimate reset counter. This should be incremented when the estimate resets in any of the dimensions (position, velocity, attitude, angular speed). This is designed to be used when e.g an external SLAM system detects a loop-closure and the estimate jumps. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_global_vision_position_estimate_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t usec, float x, float y, float z, float roll, float pitch, float yaw, const float *covariance, uint8_t reset_counter) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN]; + _mav_put_uint64_t(buf, 0, usec); + _mav_put_float(buf, 8, x); + _mav_put_float(buf, 12, y); + _mav_put_float(buf, 16, z); + _mav_put_float(buf, 20, roll); + _mav_put_float(buf, 24, pitch); + _mav_put_float(buf, 28, yaw); + _mav_put_uint8_t(buf, 116, reset_counter); + _mav_put_float_array(buf, 32, covariance, 21); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN); +#else + mavlink_global_vision_position_estimate_t packet; + packet.usec = usec; + packet.x = x; + packet.y = y; + packet.z = z; + packet.roll = roll; + packet.pitch = pitch; + packet.yaw = yaw; + packet.reset_counter = reset_counter; + mav_array_memcpy(packet.covariance, covariance, sizeof(float)*21); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN); +#endif +} + /** * @brief Pack a global_vision_position_estimate message on a channel * @param system_id ID of this system @@ -152,7 +207,7 @@ static inline uint16_t mavlink_msg_global_vision_position_estimate_pack_chan(uin packet.pitch = pitch; packet.yaw = yaw; packet.reset_counter = reset_counter; - mav_array_memcpy(packet.covariance, covariance, sizeof(float)*21); + mav_array_assign_float(packet.covariance, covariance, 21); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN); #endif @@ -187,6 +242,20 @@ static inline uint16_t mavlink_msg_global_vision_position_estimate_encode_chan(u return mavlink_msg_global_vision_position_estimate_pack_chan(system_id, component_id, chan, msg, global_vision_position_estimate->usec, global_vision_position_estimate->x, global_vision_position_estimate->y, global_vision_position_estimate->z, global_vision_position_estimate->roll, global_vision_position_estimate->pitch, global_vision_position_estimate->yaw, global_vision_position_estimate->covariance, global_vision_position_estimate->reset_counter); } +/** + * @brief Encode a global_vision_position_estimate struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param global_vision_position_estimate C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_global_vision_position_estimate_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_global_vision_position_estimate_t* global_vision_position_estimate) +{ + return mavlink_msg_global_vision_position_estimate_pack_status(system_id, component_id, _status, msg, global_vision_position_estimate->usec, global_vision_position_estimate->x, global_vision_position_estimate->y, global_vision_position_estimate->z, global_vision_position_estimate->roll, global_vision_position_estimate->pitch, global_vision_position_estimate->yaw, global_vision_position_estimate->covariance, global_vision_position_estimate->reset_counter); +} + /** * @brief Send a global_vision_position_estimate message * @param chan MAVLink channel to send the message @@ -227,7 +296,7 @@ static inline void mavlink_msg_global_vision_position_estimate_send(mavlink_chan packet.pitch = pitch; packet.yaw = yaw; packet.reset_counter = reset_counter; - mav_array_memcpy(packet.covariance, covariance, sizeof(float)*21); + mav_array_assign_float(packet.covariance, covariance, 21); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE, (const char *)&packet, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_CRC); #endif } @@ -248,7 +317,7 @@ static inline void mavlink_msg_global_vision_position_estimate_send_struct(mavli #if MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -278,7 +347,7 @@ static inline void mavlink_msg_global_vision_position_estimate_send_buf(mavlink_ packet->pitch = pitch; packet->yaw = yaw; packet->reset_counter = reset_counter; - mav_array_memcpy(packet->covariance, covariance, sizeof(float)*21); + mav_array_assign_float(packet->covariance, covariance, 21); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE, (const char *)packet, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_CRC); #endif } diff --git a/common/mavlink_msg_gps2_raw.h b/common/mavlink_msg_gps2_raw.h index 5e741ef49..7c74b9804 100644 --- a/common/mavlink_msg_gps2_raw.h +++ b/common/mavlink_msg_gps2_raw.h @@ -10,19 +10,24 @@ typedef struct __mavlink_gps2_raw_t { int32_t lon; /*< [degE7] Longitude (WGS84)*/ int32_t alt; /*< [mm] Altitude (MSL). Positive for up.*/ uint32_t dgps_age; /*< [ms] Age of DGPS info*/ - uint16_t eph; /*< GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX*/ - uint16_t epv; /*< GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX*/ + uint16_t eph; /*< GPS HDOP horizontal dilution of position (unitless * 100). If unknown, set to: UINT16_MAX*/ + uint16_t epv; /*< GPS VDOP vertical dilution of position (unitless * 100). If unknown, set to: UINT16_MAX*/ uint16_t vel; /*< [cm/s] GPS ground speed. If unknown, set to: UINT16_MAX*/ uint16_t cog; /*< [cdeg] Course over ground (NOT heading, but direction of movement): 0.0..359.99 degrees. If unknown, set to: UINT16_MAX*/ uint8_t fix_type; /*< GPS fix type.*/ - uint8_t satellites_visible; /*< Number of satellites visible. If unknown, set to 255*/ + uint8_t satellites_visible; /*< Number of satellites visible. If unknown, set to UINT8_MAX*/ uint8_t dgps_numch; /*< Number of DGPS satellites*/ - uint16_t yaw; /*< [cdeg] Yaw in earth frame from north. Use 0 if this GPS does not provide yaw. Use 65535 if this GPS is configured to provide yaw and is currently unable to provide it. Use 36000 for north.*/ + uint16_t yaw; /*< [cdeg] Yaw in earth frame from north. Use 0 if this GPS does not provide yaw. Use UINT16_MAX if this GPS is configured to provide yaw and is currently unable to provide it. Use 36000 for north.*/ + int32_t alt_ellipsoid; /*< [mm] Altitude (above WGS84, EGM96 ellipsoid). Positive for up.*/ + uint32_t h_acc; /*< [mm] Position uncertainty.*/ + uint32_t v_acc; /*< [mm] Altitude uncertainty.*/ + uint32_t vel_acc; /*< [mm/s] Speed uncertainty.*/ + uint32_t hdg_acc; /*< [degE5] Heading / track uncertainty*/ }) mavlink_gps2_raw_t; -#define MAVLINK_MSG_ID_GPS2_RAW_LEN 37 +#define MAVLINK_MSG_ID_GPS2_RAW_LEN 57 #define MAVLINK_MSG_ID_GPS2_RAW_MIN_LEN 35 -#define MAVLINK_MSG_ID_124_LEN 37 +#define MAVLINK_MSG_ID_124_LEN 57 #define MAVLINK_MSG_ID_124_MIN_LEN 35 #define MAVLINK_MSG_ID_GPS2_RAW_CRC 87 @@ -34,7 +39,7 @@ typedef struct __mavlink_gps2_raw_t { #define MAVLINK_MESSAGE_INFO_GPS2_RAW { \ 124, \ "GPS2_RAW", \ - 13, \ + 18, \ { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_gps2_raw_t, time_usec) }, \ { "fix_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_gps2_raw_t, fix_type) }, \ { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_gps2_raw_t, lat) }, \ @@ -48,12 +53,17 @@ typedef struct __mavlink_gps2_raw_t { { "dgps_numch", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_gps2_raw_t, dgps_numch) }, \ { "dgps_age", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_gps2_raw_t, dgps_age) }, \ { "yaw", NULL, MAVLINK_TYPE_UINT16_T, 0, 35, offsetof(mavlink_gps2_raw_t, yaw) }, \ + { "alt_ellipsoid", NULL, MAVLINK_TYPE_INT32_T, 0, 37, offsetof(mavlink_gps2_raw_t, alt_ellipsoid) }, \ + { "h_acc", NULL, MAVLINK_TYPE_UINT32_T, 0, 41, offsetof(mavlink_gps2_raw_t, h_acc) }, \ + { "v_acc", NULL, MAVLINK_TYPE_UINT32_T, 0, 45, offsetof(mavlink_gps2_raw_t, v_acc) }, \ + { "vel_acc", NULL, MAVLINK_TYPE_UINT32_T, 0, 49, offsetof(mavlink_gps2_raw_t, vel_acc) }, \ + { "hdg_acc", NULL, MAVLINK_TYPE_UINT32_T, 0, 53, offsetof(mavlink_gps2_raw_t, hdg_acc) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_GPS2_RAW { \ "GPS2_RAW", \ - 13, \ + 18, \ { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_gps2_raw_t, time_usec) }, \ { "fix_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_gps2_raw_t, fix_type) }, \ { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_gps2_raw_t, lat) }, \ @@ -67,6 +77,11 @@ typedef struct __mavlink_gps2_raw_t { { "dgps_numch", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_gps2_raw_t, dgps_numch) }, \ { "dgps_age", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_gps2_raw_t, dgps_age) }, \ { "yaw", NULL, MAVLINK_TYPE_UINT16_T, 0, 35, offsetof(mavlink_gps2_raw_t, yaw) }, \ + { "alt_ellipsoid", NULL, MAVLINK_TYPE_INT32_T, 0, 37, offsetof(mavlink_gps2_raw_t, alt_ellipsoid) }, \ + { "h_acc", NULL, MAVLINK_TYPE_UINT32_T, 0, 41, offsetof(mavlink_gps2_raw_t, h_acc) }, \ + { "v_acc", NULL, MAVLINK_TYPE_UINT32_T, 0, 45, offsetof(mavlink_gps2_raw_t, v_acc) }, \ + { "vel_acc", NULL, MAVLINK_TYPE_UINT32_T, 0, 49, offsetof(mavlink_gps2_raw_t, vel_acc) }, \ + { "hdg_acc", NULL, MAVLINK_TYPE_UINT32_T, 0, 53, offsetof(mavlink_gps2_raw_t, hdg_acc) }, \ } \ } #endif @@ -82,18 +97,23 @@ typedef struct __mavlink_gps2_raw_t { * @param lat [degE7] Latitude (WGS84) * @param lon [degE7] Longitude (WGS84) * @param alt [mm] Altitude (MSL). Positive for up. - * @param eph GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX - * @param epv GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX + * @param eph GPS HDOP horizontal dilution of position (unitless * 100). If unknown, set to: UINT16_MAX + * @param epv GPS VDOP vertical dilution of position (unitless * 100). If unknown, set to: UINT16_MAX * @param vel [cm/s] GPS ground speed. If unknown, set to: UINT16_MAX * @param cog [cdeg] Course over ground (NOT heading, but direction of movement): 0.0..359.99 degrees. If unknown, set to: UINT16_MAX - * @param satellites_visible Number of satellites visible. If unknown, set to 255 + * @param satellites_visible Number of satellites visible. If unknown, set to UINT8_MAX * @param dgps_numch Number of DGPS satellites * @param dgps_age [ms] Age of DGPS info - * @param yaw [cdeg] Yaw in earth frame from north. Use 0 if this GPS does not provide yaw. Use 65535 if this GPS is configured to provide yaw and is currently unable to provide it. Use 36000 for north. + * @param yaw [cdeg] Yaw in earth frame from north. Use 0 if this GPS does not provide yaw. Use UINT16_MAX if this GPS is configured to provide yaw and is currently unable to provide it. Use 36000 for north. + * @param alt_ellipsoid [mm] Altitude (above WGS84, EGM96 ellipsoid). Positive for up. + * @param h_acc [mm] Position uncertainty. + * @param v_acc [mm] Altitude uncertainty. + * @param vel_acc [mm/s] Speed uncertainty. + * @param hdg_acc [degE5] Heading / track uncertainty * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_gps2_raw_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint64_t time_usec, uint8_t fix_type, int32_t lat, int32_t lon, int32_t alt, uint16_t eph, uint16_t epv, uint16_t vel, uint16_t cog, uint8_t satellites_visible, uint8_t dgps_numch, uint32_t dgps_age, uint16_t yaw) + uint64_t time_usec, uint8_t fix_type, int32_t lat, int32_t lon, int32_t alt, uint16_t eph, uint16_t epv, uint16_t vel, uint16_t cog, uint8_t satellites_visible, uint8_t dgps_numch, uint32_t dgps_age, uint16_t yaw, int32_t alt_ellipsoid, uint32_t h_acc, uint32_t v_acc, uint32_t vel_acc, uint32_t hdg_acc) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_GPS2_RAW_LEN]; @@ -110,6 +130,11 @@ static inline uint16_t mavlink_msg_gps2_raw_pack(uint8_t system_id, uint8_t comp _mav_put_uint8_t(buf, 33, satellites_visible); _mav_put_uint8_t(buf, 34, dgps_numch); _mav_put_uint16_t(buf, 35, yaw); + _mav_put_int32_t(buf, 37, alt_ellipsoid); + _mav_put_uint32_t(buf, 41, h_acc); + _mav_put_uint32_t(buf, 45, v_acc); + _mav_put_uint32_t(buf, 49, vel_acc); + _mav_put_uint32_t(buf, 53, hdg_acc); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS2_RAW_LEN); #else @@ -127,6 +152,11 @@ static inline uint16_t mavlink_msg_gps2_raw_pack(uint8_t system_id, uint8_t comp packet.satellites_visible = satellites_visible; packet.dgps_numch = dgps_numch; packet.yaw = yaw; + packet.alt_ellipsoid = alt_ellipsoid; + packet.h_acc = h_acc; + packet.v_acc = v_acc; + packet.vel_acc = vel_acc; + packet.hdg_acc = hdg_acc; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS2_RAW_LEN); #endif @@ -135,6 +165,90 @@ static inline uint16_t mavlink_msg_gps2_raw_pack(uint8_t system_id, uint8_t comp return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS2_RAW_MIN_LEN, MAVLINK_MSG_ID_GPS2_RAW_LEN, MAVLINK_MSG_ID_GPS2_RAW_CRC); } +/** + * @brief Pack a gps2_raw message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param fix_type GPS fix type. + * @param lat [degE7] Latitude (WGS84) + * @param lon [degE7] Longitude (WGS84) + * @param alt [mm] Altitude (MSL). Positive for up. + * @param eph GPS HDOP horizontal dilution of position (unitless * 100). If unknown, set to: UINT16_MAX + * @param epv GPS VDOP vertical dilution of position (unitless * 100). If unknown, set to: UINT16_MAX + * @param vel [cm/s] GPS ground speed. If unknown, set to: UINT16_MAX + * @param cog [cdeg] Course over ground (NOT heading, but direction of movement): 0.0..359.99 degrees. If unknown, set to: UINT16_MAX + * @param satellites_visible Number of satellites visible. If unknown, set to UINT8_MAX + * @param dgps_numch Number of DGPS satellites + * @param dgps_age [ms] Age of DGPS info + * @param yaw [cdeg] Yaw in earth frame from north. Use 0 if this GPS does not provide yaw. Use UINT16_MAX if this GPS is configured to provide yaw and is currently unable to provide it. Use 36000 for north. + * @param alt_ellipsoid [mm] Altitude (above WGS84, EGM96 ellipsoid). Positive for up. + * @param h_acc [mm] Position uncertainty. + * @param v_acc [mm] Altitude uncertainty. + * @param vel_acc [mm/s] Speed uncertainty. + * @param hdg_acc [degE5] Heading / track uncertainty + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_gps2_raw_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, uint8_t fix_type, int32_t lat, int32_t lon, int32_t alt, uint16_t eph, uint16_t epv, uint16_t vel, uint16_t cog, uint8_t satellites_visible, uint8_t dgps_numch, uint32_t dgps_age, uint16_t yaw, int32_t alt_ellipsoid, uint32_t h_acc, uint32_t v_acc, uint32_t vel_acc, uint32_t hdg_acc) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GPS2_RAW_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_int32_t(buf, 16, alt); + _mav_put_uint32_t(buf, 20, dgps_age); + _mav_put_uint16_t(buf, 24, eph); + _mav_put_uint16_t(buf, 26, epv); + _mav_put_uint16_t(buf, 28, vel); + _mav_put_uint16_t(buf, 30, cog); + _mav_put_uint8_t(buf, 32, fix_type); + _mav_put_uint8_t(buf, 33, satellites_visible); + _mav_put_uint8_t(buf, 34, dgps_numch); + _mav_put_uint16_t(buf, 35, yaw); + _mav_put_int32_t(buf, 37, alt_ellipsoid); + _mav_put_uint32_t(buf, 41, h_acc); + _mav_put_uint32_t(buf, 45, v_acc); + _mav_put_uint32_t(buf, 49, vel_acc); + _mav_put_uint32_t(buf, 53, hdg_acc); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS2_RAW_LEN); +#else + mavlink_gps2_raw_t packet; + packet.time_usec = time_usec; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.dgps_age = dgps_age; + packet.eph = eph; + packet.epv = epv; + packet.vel = vel; + packet.cog = cog; + packet.fix_type = fix_type; + packet.satellites_visible = satellites_visible; + packet.dgps_numch = dgps_numch; + packet.yaw = yaw; + packet.alt_ellipsoid = alt_ellipsoid; + packet.h_acc = h_acc; + packet.v_acc = v_acc; + packet.vel_acc = vel_acc; + packet.hdg_acc = hdg_acc; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS2_RAW_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GPS2_RAW; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GPS2_RAW_MIN_LEN, MAVLINK_MSG_ID_GPS2_RAW_LEN, MAVLINK_MSG_ID_GPS2_RAW_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GPS2_RAW_MIN_LEN, MAVLINK_MSG_ID_GPS2_RAW_LEN); +#endif +} + /** * @brief Pack a gps2_raw message on a channel * @param system_id ID of this system @@ -146,19 +260,24 @@ static inline uint16_t mavlink_msg_gps2_raw_pack(uint8_t system_id, uint8_t comp * @param lat [degE7] Latitude (WGS84) * @param lon [degE7] Longitude (WGS84) * @param alt [mm] Altitude (MSL). Positive for up. - * @param eph GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX - * @param epv GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX + * @param eph GPS HDOP horizontal dilution of position (unitless * 100). If unknown, set to: UINT16_MAX + * @param epv GPS VDOP vertical dilution of position (unitless * 100). If unknown, set to: UINT16_MAX * @param vel [cm/s] GPS ground speed. If unknown, set to: UINT16_MAX * @param cog [cdeg] Course over ground (NOT heading, but direction of movement): 0.0..359.99 degrees. If unknown, set to: UINT16_MAX - * @param satellites_visible Number of satellites visible. If unknown, set to 255 + * @param satellites_visible Number of satellites visible. If unknown, set to UINT8_MAX * @param dgps_numch Number of DGPS satellites * @param dgps_age [ms] Age of DGPS info - * @param yaw [cdeg] Yaw in earth frame from north. Use 0 if this GPS does not provide yaw. Use 65535 if this GPS is configured to provide yaw and is currently unable to provide it. Use 36000 for north. + * @param yaw [cdeg] Yaw in earth frame from north. Use 0 if this GPS does not provide yaw. Use UINT16_MAX if this GPS is configured to provide yaw and is currently unable to provide it. Use 36000 for north. + * @param alt_ellipsoid [mm] Altitude (above WGS84, EGM96 ellipsoid). Positive for up. + * @param h_acc [mm] Position uncertainty. + * @param v_acc [mm] Altitude uncertainty. + * @param vel_acc [mm/s] Speed uncertainty. + * @param hdg_acc [degE5] Heading / track uncertainty * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_gps2_raw_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - uint64_t time_usec,uint8_t fix_type,int32_t lat,int32_t lon,int32_t alt,uint16_t eph,uint16_t epv,uint16_t vel,uint16_t cog,uint8_t satellites_visible,uint8_t dgps_numch,uint32_t dgps_age,uint16_t yaw) + uint64_t time_usec,uint8_t fix_type,int32_t lat,int32_t lon,int32_t alt,uint16_t eph,uint16_t epv,uint16_t vel,uint16_t cog,uint8_t satellites_visible,uint8_t dgps_numch,uint32_t dgps_age,uint16_t yaw,int32_t alt_ellipsoid,uint32_t h_acc,uint32_t v_acc,uint32_t vel_acc,uint32_t hdg_acc) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_GPS2_RAW_LEN]; @@ -175,6 +294,11 @@ static inline uint16_t mavlink_msg_gps2_raw_pack_chan(uint8_t system_id, uint8_t _mav_put_uint8_t(buf, 33, satellites_visible); _mav_put_uint8_t(buf, 34, dgps_numch); _mav_put_uint16_t(buf, 35, yaw); + _mav_put_int32_t(buf, 37, alt_ellipsoid); + _mav_put_uint32_t(buf, 41, h_acc); + _mav_put_uint32_t(buf, 45, v_acc); + _mav_put_uint32_t(buf, 49, vel_acc); + _mav_put_uint32_t(buf, 53, hdg_acc); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS2_RAW_LEN); #else @@ -192,6 +316,11 @@ static inline uint16_t mavlink_msg_gps2_raw_pack_chan(uint8_t system_id, uint8_t packet.satellites_visible = satellites_visible; packet.dgps_numch = dgps_numch; packet.yaw = yaw; + packet.alt_ellipsoid = alt_ellipsoid; + packet.h_acc = h_acc; + packet.v_acc = v_acc; + packet.vel_acc = vel_acc; + packet.hdg_acc = hdg_acc; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS2_RAW_LEN); #endif @@ -210,7 +339,7 @@ static inline uint16_t mavlink_msg_gps2_raw_pack_chan(uint8_t system_id, uint8_t */ static inline uint16_t mavlink_msg_gps2_raw_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gps2_raw_t* gps2_raw) { - return mavlink_msg_gps2_raw_pack(system_id, component_id, msg, gps2_raw->time_usec, gps2_raw->fix_type, gps2_raw->lat, gps2_raw->lon, gps2_raw->alt, gps2_raw->eph, gps2_raw->epv, gps2_raw->vel, gps2_raw->cog, gps2_raw->satellites_visible, gps2_raw->dgps_numch, gps2_raw->dgps_age, gps2_raw->yaw); + return mavlink_msg_gps2_raw_pack(system_id, component_id, msg, gps2_raw->time_usec, gps2_raw->fix_type, gps2_raw->lat, gps2_raw->lon, gps2_raw->alt, gps2_raw->eph, gps2_raw->epv, gps2_raw->vel, gps2_raw->cog, gps2_raw->satellites_visible, gps2_raw->dgps_numch, gps2_raw->dgps_age, gps2_raw->yaw, gps2_raw->alt_ellipsoid, gps2_raw->h_acc, gps2_raw->v_acc, gps2_raw->vel_acc, gps2_raw->hdg_acc); } /** @@ -224,7 +353,21 @@ static inline uint16_t mavlink_msg_gps2_raw_encode(uint8_t system_id, uint8_t co */ static inline uint16_t mavlink_msg_gps2_raw_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gps2_raw_t* gps2_raw) { - return mavlink_msg_gps2_raw_pack_chan(system_id, component_id, chan, msg, gps2_raw->time_usec, gps2_raw->fix_type, gps2_raw->lat, gps2_raw->lon, gps2_raw->alt, gps2_raw->eph, gps2_raw->epv, gps2_raw->vel, gps2_raw->cog, gps2_raw->satellites_visible, gps2_raw->dgps_numch, gps2_raw->dgps_age, gps2_raw->yaw); + return mavlink_msg_gps2_raw_pack_chan(system_id, component_id, chan, msg, gps2_raw->time_usec, gps2_raw->fix_type, gps2_raw->lat, gps2_raw->lon, gps2_raw->alt, gps2_raw->eph, gps2_raw->epv, gps2_raw->vel, gps2_raw->cog, gps2_raw->satellites_visible, gps2_raw->dgps_numch, gps2_raw->dgps_age, gps2_raw->yaw, gps2_raw->alt_ellipsoid, gps2_raw->h_acc, gps2_raw->v_acc, gps2_raw->vel_acc, gps2_raw->hdg_acc); +} + +/** + * @brief Encode a gps2_raw struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param gps2_raw C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_gps2_raw_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_gps2_raw_t* gps2_raw) +{ + return mavlink_msg_gps2_raw_pack_status(system_id, component_id, _status, msg, gps2_raw->time_usec, gps2_raw->fix_type, gps2_raw->lat, gps2_raw->lon, gps2_raw->alt, gps2_raw->eph, gps2_raw->epv, gps2_raw->vel, gps2_raw->cog, gps2_raw->satellites_visible, gps2_raw->dgps_numch, gps2_raw->dgps_age, gps2_raw->yaw, gps2_raw->alt_ellipsoid, gps2_raw->h_acc, gps2_raw->v_acc, gps2_raw->vel_acc, gps2_raw->hdg_acc); } /** @@ -236,18 +379,23 @@ static inline uint16_t mavlink_msg_gps2_raw_encode_chan(uint8_t system_id, uint8 * @param lat [degE7] Latitude (WGS84) * @param lon [degE7] Longitude (WGS84) * @param alt [mm] Altitude (MSL). Positive for up. - * @param eph GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX - * @param epv GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX + * @param eph GPS HDOP horizontal dilution of position (unitless * 100). If unknown, set to: UINT16_MAX + * @param epv GPS VDOP vertical dilution of position (unitless * 100). If unknown, set to: UINT16_MAX * @param vel [cm/s] GPS ground speed. If unknown, set to: UINT16_MAX * @param cog [cdeg] Course over ground (NOT heading, but direction of movement): 0.0..359.99 degrees. If unknown, set to: UINT16_MAX - * @param satellites_visible Number of satellites visible. If unknown, set to 255 + * @param satellites_visible Number of satellites visible. If unknown, set to UINT8_MAX * @param dgps_numch Number of DGPS satellites * @param dgps_age [ms] Age of DGPS info - * @param yaw [cdeg] Yaw in earth frame from north. Use 0 if this GPS does not provide yaw. Use 65535 if this GPS is configured to provide yaw and is currently unable to provide it. Use 36000 for north. + * @param yaw [cdeg] Yaw in earth frame from north. Use 0 if this GPS does not provide yaw. Use UINT16_MAX if this GPS is configured to provide yaw and is currently unable to provide it. Use 36000 for north. + * @param alt_ellipsoid [mm] Altitude (above WGS84, EGM96 ellipsoid). Positive for up. + * @param h_acc [mm] Position uncertainty. + * @param v_acc [mm] Altitude uncertainty. + * @param vel_acc [mm/s] Speed uncertainty. + * @param hdg_acc [degE5] Heading / track uncertainty */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_gps2_raw_send(mavlink_channel_t chan, uint64_t time_usec, uint8_t fix_type, int32_t lat, int32_t lon, int32_t alt, uint16_t eph, uint16_t epv, uint16_t vel, uint16_t cog, uint8_t satellites_visible, uint8_t dgps_numch, uint32_t dgps_age, uint16_t yaw) +static inline void mavlink_msg_gps2_raw_send(mavlink_channel_t chan, uint64_t time_usec, uint8_t fix_type, int32_t lat, int32_t lon, int32_t alt, uint16_t eph, uint16_t epv, uint16_t vel, uint16_t cog, uint8_t satellites_visible, uint8_t dgps_numch, uint32_t dgps_age, uint16_t yaw, int32_t alt_ellipsoid, uint32_t h_acc, uint32_t v_acc, uint32_t vel_acc, uint32_t hdg_acc) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_GPS2_RAW_LEN]; @@ -264,6 +412,11 @@ static inline void mavlink_msg_gps2_raw_send(mavlink_channel_t chan, uint64_t ti _mav_put_uint8_t(buf, 33, satellites_visible); _mav_put_uint8_t(buf, 34, dgps_numch); _mav_put_uint16_t(buf, 35, yaw); + _mav_put_int32_t(buf, 37, alt_ellipsoid); + _mav_put_uint32_t(buf, 41, h_acc); + _mav_put_uint32_t(buf, 45, v_acc); + _mav_put_uint32_t(buf, 49, vel_acc); + _mav_put_uint32_t(buf, 53, hdg_acc); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RAW, buf, MAVLINK_MSG_ID_GPS2_RAW_MIN_LEN, MAVLINK_MSG_ID_GPS2_RAW_LEN, MAVLINK_MSG_ID_GPS2_RAW_CRC); #else @@ -281,6 +434,11 @@ static inline void mavlink_msg_gps2_raw_send(mavlink_channel_t chan, uint64_t ti packet.satellites_visible = satellites_visible; packet.dgps_numch = dgps_numch; packet.yaw = yaw; + packet.alt_ellipsoid = alt_ellipsoid; + packet.h_acc = h_acc; + packet.v_acc = v_acc; + packet.vel_acc = vel_acc; + packet.hdg_acc = hdg_acc; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RAW, (const char *)&packet, MAVLINK_MSG_ID_GPS2_RAW_MIN_LEN, MAVLINK_MSG_ID_GPS2_RAW_LEN, MAVLINK_MSG_ID_GPS2_RAW_CRC); #endif @@ -294,7 +452,7 @@ static inline void mavlink_msg_gps2_raw_send(mavlink_channel_t chan, uint64_t ti static inline void mavlink_msg_gps2_raw_send_struct(mavlink_channel_t chan, const mavlink_gps2_raw_t* gps2_raw) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_gps2_raw_send(chan, gps2_raw->time_usec, gps2_raw->fix_type, gps2_raw->lat, gps2_raw->lon, gps2_raw->alt, gps2_raw->eph, gps2_raw->epv, gps2_raw->vel, gps2_raw->cog, gps2_raw->satellites_visible, gps2_raw->dgps_numch, gps2_raw->dgps_age, gps2_raw->yaw); + mavlink_msg_gps2_raw_send(chan, gps2_raw->time_usec, gps2_raw->fix_type, gps2_raw->lat, gps2_raw->lon, gps2_raw->alt, gps2_raw->eph, gps2_raw->epv, gps2_raw->vel, gps2_raw->cog, gps2_raw->satellites_visible, gps2_raw->dgps_numch, gps2_raw->dgps_age, gps2_raw->yaw, gps2_raw->alt_ellipsoid, gps2_raw->h_acc, gps2_raw->v_acc, gps2_raw->vel_acc, gps2_raw->hdg_acc); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RAW, (const char *)gps2_raw, MAVLINK_MSG_ID_GPS2_RAW_MIN_LEN, MAVLINK_MSG_ID_GPS2_RAW_LEN, MAVLINK_MSG_ID_GPS2_RAW_CRC); #endif @@ -302,13 +460,13 @@ static inline void mavlink_msg_gps2_raw_send_struct(mavlink_channel_t chan, cons #if MAVLINK_MSG_ID_GPS2_RAW_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_gps2_raw_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint8_t fix_type, int32_t lat, int32_t lon, int32_t alt, uint16_t eph, uint16_t epv, uint16_t vel, uint16_t cog, uint8_t satellites_visible, uint8_t dgps_numch, uint32_t dgps_age, uint16_t yaw) +static inline void mavlink_msg_gps2_raw_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint8_t fix_type, int32_t lat, int32_t lon, int32_t alt, uint16_t eph, uint16_t epv, uint16_t vel, uint16_t cog, uint8_t satellites_visible, uint8_t dgps_numch, uint32_t dgps_age, uint16_t yaw, int32_t alt_ellipsoid, uint32_t h_acc, uint32_t v_acc, uint32_t vel_acc, uint32_t hdg_acc) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; @@ -325,6 +483,11 @@ static inline void mavlink_msg_gps2_raw_send_buf(mavlink_message_t *msgbuf, mavl _mav_put_uint8_t(buf, 33, satellites_visible); _mav_put_uint8_t(buf, 34, dgps_numch); _mav_put_uint16_t(buf, 35, yaw); + _mav_put_int32_t(buf, 37, alt_ellipsoid); + _mav_put_uint32_t(buf, 41, h_acc); + _mav_put_uint32_t(buf, 45, v_acc); + _mav_put_uint32_t(buf, 49, vel_acc); + _mav_put_uint32_t(buf, 53, hdg_acc); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RAW, buf, MAVLINK_MSG_ID_GPS2_RAW_MIN_LEN, MAVLINK_MSG_ID_GPS2_RAW_LEN, MAVLINK_MSG_ID_GPS2_RAW_CRC); #else @@ -342,6 +505,11 @@ static inline void mavlink_msg_gps2_raw_send_buf(mavlink_message_t *msgbuf, mavl packet->satellites_visible = satellites_visible; packet->dgps_numch = dgps_numch; packet->yaw = yaw; + packet->alt_ellipsoid = alt_ellipsoid; + packet->h_acc = h_acc; + packet->v_acc = v_acc; + packet->vel_acc = vel_acc; + packet->hdg_acc = hdg_acc; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RAW, (const char *)packet, MAVLINK_MSG_ID_GPS2_RAW_MIN_LEN, MAVLINK_MSG_ID_GPS2_RAW_LEN, MAVLINK_MSG_ID_GPS2_RAW_CRC); #endif @@ -406,7 +574,7 @@ static inline int32_t mavlink_msg_gps2_raw_get_alt(const mavlink_message_t* msg) /** * @brief Get field eph from gps2_raw message * - * @return GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX + * @return GPS HDOP horizontal dilution of position (unitless * 100). If unknown, set to: UINT16_MAX */ static inline uint16_t mavlink_msg_gps2_raw_get_eph(const mavlink_message_t* msg) { @@ -416,7 +584,7 @@ static inline uint16_t mavlink_msg_gps2_raw_get_eph(const mavlink_message_t* msg /** * @brief Get field epv from gps2_raw message * - * @return GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX + * @return GPS VDOP vertical dilution of position (unitless * 100). If unknown, set to: UINT16_MAX */ static inline uint16_t mavlink_msg_gps2_raw_get_epv(const mavlink_message_t* msg) { @@ -446,7 +614,7 @@ static inline uint16_t mavlink_msg_gps2_raw_get_cog(const mavlink_message_t* msg /** * @brief Get field satellites_visible from gps2_raw message * - * @return Number of satellites visible. If unknown, set to 255 + * @return Number of satellites visible. If unknown, set to UINT8_MAX */ static inline uint8_t mavlink_msg_gps2_raw_get_satellites_visible(const mavlink_message_t* msg) { @@ -476,13 +644,63 @@ static inline uint32_t mavlink_msg_gps2_raw_get_dgps_age(const mavlink_message_t /** * @brief Get field yaw from gps2_raw message * - * @return [cdeg] Yaw in earth frame from north. Use 0 if this GPS does not provide yaw. Use 65535 if this GPS is configured to provide yaw and is currently unable to provide it. Use 36000 for north. + * @return [cdeg] Yaw in earth frame from north. Use 0 if this GPS does not provide yaw. Use UINT16_MAX if this GPS is configured to provide yaw and is currently unable to provide it. Use 36000 for north. */ static inline uint16_t mavlink_msg_gps2_raw_get_yaw(const mavlink_message_t* msg) { return _MAV_RETURN_uint16_t(msg, 35); } +/** + * @brief Get field alt_ellipsoid from gps2_raw message + * + * @return [mm] Altitude (above WGS84, EGM96 ellipsoid). Positive for up. + */ +static inline int32_t mavlink_msg_gps2_raw_get_alt_ellipsoid(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 37); +} + +/** + * @brief Get field h_acc from gps2_raw message + * + * @return [mm] Position uncertainty. + */ +static inline uint32_t mavlink_msg_gps2_raw_get_h_acc(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 41); +} + +/** + * @brief Get field v_acc from gps2_raw message + * + * @return [mm] Altitude uncertainty. + */ +static inline uint32_t mavlink_msg_gps2_raw_get_v_acc(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 45); +} + +/** + * @brief Get field vel_acc from gps2_raw message + * + * @return [mm/s] Speed uncertainty. + */ +static inline uint32_t mavlink_msg_gps2_raw_get_vel_acc(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 49); +} + +/** + * @brief Get field hdg_acc from gps2_raw message + * + * @return [degE5] Heading / track uncertainty + */ +static inline uint32_t mavlink_msg_gps2_raw_get_hdg_acc(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 53); +} + /** * @brief Decode a gps2_raw message into a struct * @@ -505,6 +723,11 @@ static inline void mavlink_msg_gps2_raw_decode(const mavlink_message_t* msg, mav gps2_raw->satellites_visible = mavlink_msg_gps2_raw_get_satellites_visible(msg); gps2_raw->dgps_numch = mavlink_msg_gps2_raw_get_dgps_numch(msg); gps2_raw->yaw = mavlink_msg_gps2_raw_get_yaw(msg); + gps2_raw->alt_ellipsoid = mavlink_msg_gps2_raw_get_alt_ellipsoid(msg); + gps2_raw->h_acc = mavlink_msg_gps2_raw_get_h_acc(msg); + gps2_raw->v_acc = mavlink_msg_gps2_raw_get_v_acc(msg); + gps2_raw->vel_acc = mavlink_msg_gps2_raw_get_vel_acc(msg); + gps2_raw->hdg_acc = mavlink_msg_gps2_raw_get_hdg_acc(msg); #else uint8_t len = msg->len < MAVLINK_MSG_ID_GPS2_RAW_LEN? msg->len : MAVLINK_MSG_ID_GPS2_RAW_LEN; memset(gps2_raw, 0, MAVLINK_MSG_ID_GPS2_RAW_LEN); diff --git a/common/mavlink_msg_gps2_rtk.h b/common/mavlink_msg_gps2_rtk.h index 2af9b53ca..a26f3c469 100644 --- a/common/mavlink_msg_gps2_rtk.h +++ b/common/mavlink_msg_gps2_rtk.h @@ -135,6 +135,75 @@ static inline uint16_t mavlink_msg_gps2_rtk_pack(uint8_t system_id, uint8_t comp return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS2_RTK_MIN_LEN, MAVLINK_MSG_ID_GPS2_RTK_LEN, MAVLINK_MSG_ID_GPS2_RTK_CRC); } +/** + * @brief Pack a gps2_rtk message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_last_baseline_ms [ms] Time since boot of last baseline message received. + * @param rtk_receiver_id Identification of connected RTK receiver. + * @param wn GPS Week Number of last baseline + * @param tow [ms] GPS Time of Week of last baseline + * @param rtk_health GPS-specific health report for RTK data. + * @param rtk_rate [Hz] Rate of baseline messages being received by GPS + * @param nsats Current number of sats used for RTK calculation. + * @param baseline_coords_type Coordinate system of baseline + * @param baseline_a_mm [mm] Current baseline in ECEF x or NED north component. + * @param baseline_b_mm [mm] Current baseline in ECEF y or NED east component. + * @param baseline_c_mm [mm] Current baseline in ECEF z or NED down component. + * @param accuracy Current estimate of baseline accuracy. + * @param iar_num_hypotheses Current number of integer ambiguity hypotheses. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_gps2_rtk_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_last_baseline_ms, uint8_t rtk_receiver_id, uint16_t wn, uint32_t tow, uint8_t rtk_health, uint8_t rtk_rate, uint8_t nsats, uint8_t baseline_coords_type, int32_t baseline_a_mm, int32_t baseline_b_mm, int32_t baseline_c_mm, uint32_t accuracy, int32_t iar_num_hypotheses) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GPS2_RTK_LEN]; + _mav_put_uint32_t(buf, 0, time_last_baseline_ms); + _mav_put_uint32_t(buf, 4, tow); + _mav_put_int32_t(buf, 8, baseline_a_mm); + _mav_put_int32_t(buf, 12, baseline_b_mm); + _mav_put_int32_t(buf, 16, baseline_c_mm); + _mav_put_uint32_t(buf, 20, accuracy); + _mav_put_int32_t(buf, 24, iar_num_hypotheses); + _mav_put_uint16_t(buf, 28, wn); + _mav_put_uint8_t(buf, 30, rtk_receiver_id); + _mav_put_uint8_t(buf, 31, rtk_health); + _mav_put_uint8_t(buf, 32, rtk_rate); + _mav_put_uint8_t(buf, 33, nsats); + _mav_put_uint8_t(buf, 34, baseline_coords_type); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS2_RTK_LEN); +#else + mavlink_gps2_rtk_t packet; + packet.time_last_baseline_ms = time_last_baseline_ms; + packet.tow = tow; + packet.baseline_a_mm = baseline_a_mm; + packet.baseline_b_mm = baseline_b_mm; + packet.baseline_c_mm = baseline_c_mm; + packet.accuracy = accuracy; + packet.iar_num_hypotheses = iar_num_hypotheses; + packet.wn = wn; + packet.rtk_receiver_id = rtk_receiver_id; + packet.rtk_health = rtk_health; + packet.rtk_rate = rtk_rate; + packet.nsats = nsats; + packet.baseline_coords_type = baseline_coords_type; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS2_RTK_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GPS2_RTK; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GPS2_RTK_MIN_LEN, MAVLINK_MSG_ID_GPS2_RTK_LEN, MAVLINK_MSG_ID_GPS2_RTK_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GPS2_RTK_MIN_LEN, MAVLINK_MSG_ID_GPS2_RTK_LEN); +#endif +} + /** * @brief Pack a gps2_rtk message on a channel * @param system_id ID of this system @@ -227,6 +296,20 @@ static inline uint16_t mavlink_msg_gps2_rtk_encode_chan(uint8_t system_id, uint8 return mavlink_msg_gps2_rtk_pack_chan(system_id, component_id, chan, msg, gps2_rtk->time_last_baseline_ms, gps2_rtk->rtk_receiver_id, gps2_rtk->wn, gps2_rtk->tow, gps2_rtk->rtk_health, gps2_rtk->rtk_rate, gps2_rtk->nsats, gps2_rtk->baseline_coords_type, gps2_rtk->baseline_a_mm, gps2_rtk->baseline_b_mm, gps2_rtk->baseline_c_mm, gps2_rtk->accuracy, gps2_rtk->iar_num_hypotheses); } +/** + * @brief Encode a gps2_rtk struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param gps2_rtk C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_gps2_rtk_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_gps2_rtk_t* gps2_rtk) +{ + return mavlink_msg_gps2_rtk_pack_status(system_id, component_id, _status, msg, gps2_rtk->time_last_baseline_ms, gps2_rtk->rtk_receiver_id, gps2_rtk->wn, gps2_rtk->tow, gps2_rtk->rtk_health, gps2_rtk->rtk_rate, gps2_rtk->nsats, gps2_rtk->baseline_coords_type, gps2_rtk->baseline_a_mm, gps2_rtk->baseline_b_mm, gps2_rtk->baseline_c_mm, gps2_rtk->accuracy, gps2_rtk->iar_num_hypotheses); +} + /** * @brief Send a gps2_rtk message * @param chan MAVLink channel to send the message @@ -302,7 +385,7 @@ static inline void mavlink_msg_gps2_rtk_send_struct(mavlink_channel_t chan, cons #if MAVLINK_MSG_ID_GPS2_RTK_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_gps_global_origin.h b/common/mavlink_msg_gps_global_origin.h index ccbde8fd1..4a1be69e6 100644 --- a/common/mavlink_msg_gps_global_origin.h +++ b/common/mavlink_msg_gps_global_origin.h @@ -81,6 +81,48 @@ static inline uint16_t mavlink_msg_gps_global_origin_pack(uint8_t system_id, uin return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_MIN_LEN, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_CRC); } +/** + * @brief Pack a gps_global_origin message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param latitude [degE7] Latitude (WGS84) + * @param longitude [degE7] Longitude (WGS84) + * @param altitude [mm] Altitude (MSL). Positive for up. + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_gps_global_origin_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + int32_t latitude, int32_t longitude, int32_t altitude, uint64_t time_usec) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN]; + _mav_put_int32_t(buf, 0, latitude); + _mav_put_int32_t(buf, 4, longitude); + _mav_put_int32_t(buf, 8, altitude); + _mav_put_uint64_t(buf, 12, time_usec); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN); +#else + mavlink_gps_global_origin_t packet; + packet.latitude = latitude; + packet.longitude = longitude; + packet.altitude = altitude; + packet.time_usec = time_usec; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_MIN_LEN, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_MIN_LEN, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN); +#endif +} + /** * @brief Pack a gps_global_origin message on a channel * @param system_id ID of this system @@ -146,6 +188,20 @@ static inline uint16_t mavlink_msg_gps_global_origin_encode_chan(uint8_t system_ return mavlink_msg_gps_global_origin_pack_chan(system_id, component_id, chan, msg, gps_global_origin->latitude, gps_global_origin->longitude, gps_global_origin->altitude, gps_global_origin->time_usec); } +/** + * @brief Encode a gps_global_origin struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param gps_global_origin C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_gps_global_origin_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_gps_global_origin_t* gps_global_origin) +{ + return mavlink_msg_gps_global_origin_pack_status(system_id, component_id, _status, msg, gps_global_origin->latitude, gps_global_origin->longitude, gps_global_origin->altitude, gps_global_origin->time_usec); +} + /** * @brief Send a gps_global_origin message * @param chan MAVLink channel to send the message @@ -194,7 +250,7 @@ static inline void mavlink_msg_gps_global_origin_send_struct(mavlink_channel_t c #if MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_gps_inject_data.h b/common/mavlink_msg_gps_inject_data.h index ff6dc0ee9..53d5fd6de 100644 --- a/common/mavlink_msg_gps_inject_data.h +++ b/common/mavlink_msg_gps_inject_data.h @@ -71,7 +71,7 @@ static inline uint16_t mavlink_msg_gps_inject_data_pack(uint8_t system_id, uint8 packet.target_system = target_system; packet.target_component = target_component; packet.len = len; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*110); + mav_array_assign_uint8_t(packet.data, data, 110); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN); #endif @@ -79,6 +79,46 @@ static inline uint16_t mavlink_msg_gps_inject_data_pack(uint8_t system_id, uint8 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS_INJECT_DATA_MIN_LEN, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN, MAVLINK_MSG_ID_GPS_INJECT_DATA_CRC); } +/** + * @brief Pack a gps_inject_data message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param len [bytes] Data length + * @param data Raw data (110 is enough for 12 satellites of RTCMv2) + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_gps_inject_data_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint8_t len, const uint8_t *data) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN]; + _mav_put_uint8_t(buf, 0, target_system); + _mav_put_uint8_t(buf, 1, target_component); + _mav_put_uint8_t(buf, 2, len); + _mav_put_uint8_t_array(buf, 3, data, 110); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN); +#else + mavlink_gps_inject_data_t packet; + packet.target_system = target_system; + packet.target_component = target_component; + packet.len = len; + mav_array_memcpy(packet.data, data, sizeof(uint8_t)*110); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GPS_INJECT_DATA; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GPS_INJECT_DATA_MIN_LEN, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN, MAVLINK_MSG_ID_GPS_INJECT_DATA_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GPS_INJECT_DATA_MIN_LEN, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN); +#endif +} + /** * @brief Pack a gps_inject_data message on a channel * @param system_id ID of this system @@ -107,7 +147,7 @@ static inline uint16_t mavlink_msg_gps_inject_data_pack_chan(uint8_t system_id, packet.target_system = target_system; packet.target_component = target_component; packet.len = len; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*110); + mav_array_assign_uint8_t(packet.data, data, 110); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN); #endif @@ -142,6 +182,20 @@ static inline uint16_t mavlink_msg_gps_inject_data_encode_chan(uint8_t system_id return mavlink_msg_gps_inject_data_pack_chan(system_id, component_id, chan, msg, gps_inject_data->target_system, gps_inject_data->target_component, gps_inject_data->len, gps_inject_data->data); } +/** + * @brief Encode a gps_inject_data struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param gps_inject_data C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_gps_inject_data_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_gps_inject_data_t* gps_inject_data) +{ + return mavlink_msg_gps_inject_data_pack_status(system_id, component_id, _status, msg, gps_inject_data->target_system, gps_inject_data->target_component, gps_inject_data->len, gps_inject_data->data); +} + /** * @brief Send a gps_inject_data message * @param chan MAVLink channel to send the message @@ -167,7 +221,7 @@ static inline void mavlink_msg_gps_inject_data_send(mavlink_channel_t chan, uint packet.target_system = target_system; packet.target_component = target_component; packet.len = len; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*110); + mav_array_assign_uint8_t(packet.data, data, 110); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_INJECT_DATA, (const char *)&packet, MAVLINK_MSG_ID_GPS_INJECT_DATA_MIN_LEN, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN, MAVLINK_MSG_ID_GPS_INJECT_DATA_CRC); #endif } @@ -188,7 +242,7 @@ static inline void mavlink_msg_gps_inject_data_send_struct(mavlink_channel_t cha #if MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -208,7 +262,7 @@ static inline void mavlink_msg_gps_inject_data_send_buf(mavlink_message_t *msgbu packet->target_system = target_system; packet->target_component = target_component; packet->len = len; - mav_array_memcpy(packet->data, data, sizeof(uint8_t)*110); + mav_array_assign_uint8_t(packet->data, data, 110); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_INJECT_DATA, (const char *)packet, MAVLINK_MSG_ID_GPS_INJECT_DATA_MIN_LEN, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN, MAVLINK_MSG_ID_GPS_INJECT_DATA_CRC); #endif } diff --git a/common/mavlink_msg_gps_input.h b/common/mavlink_msg_gps_input.h index de76ddbf1..2c5098343 100644 --- a/common/mavlink_msg_gps_input.h +++ b/common/mavlink_msg_gps_input.h @@ -171,6 +171,93 @@ static inline uint16_t mavlink_msg_gps_input_pack(uint8_t system_id, uint8_t com return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS_INPUT_MIN_LEN, MAVLINK_MSG_ID_GPS_INPUT_LEN, MAVLINK_MSG_ID_GPS_INPUT_CRC); } +/** + * @brief Pack a gps_input message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param gps_id ID of the GPS for multiple GPS inputs + * @param ignore_flags Bitmap indicating which GPS input flags fields to ignore. All other fields must be provided. + * @param time_week_ms [ms] GPS time (from start of GPS week) + * @param time_week GPS week number + * @param fix_type 0-1: no fix, 2: 2D fix, 3: 3D fix. 4: 3D with DGPS. 5: 3D with RTK + * @param lat [degE7] Latitude (WGS84) + * @param lon [degE7] Longitude (WGS84) + * @param alt [m] Altitude (MSL). Positive for up. + * @param hdop GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX + * @param vdop GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX + * @param vn [m/s] GPS velocity in north direction in earth-fixed NED frame + * @param ve [m/s] GPS velocity in east direction in earth-fixed NED frame + * @param vd [m/s] GPS velocity in down direction in earth-fixed NED frame + * @param speed_accuracy [m/s] GPS speed accuracy + * @param horiz_accuracy [m] GPS horizontal accuracy + * @param vert_accuracy [m] GPS vertical accuracy + * @param satellites_visible Number of satellites visible. + * @param yaw [cdeg] Yaw of vehicle relative to Earth's North, zero means not available, use 36000 for north + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_gps_input_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, uint8_t gps_id, uint16_t ignore_flags, uint32_t time_week_ms, uint16_t time_week, uint8_t fix_type, int32_t lat, int32_t lon, float alt, float hdop, float vdop, float vn, float ve, float vd, float speed_accuracy, float horiz_accuracy, float vert_accuracy, uint8_t satellites_visible, uint16_t yaw) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GPS_INPUT_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint32_t(buf, 8, time_week_ms); + _mav_put_int32_t(buf, 12, lat); + _mav_put_int32_t(buf, 16, lon); + _mav_put_float(buf, 20, alt); + _mav_put_float(buf, 24, hdop); + _mav_put_float(buf, 28, vdop); + _mav_put_float(buf, 32, vn); + _mav_put_float(buf, 36, ve); + _mav_put_float(buf, 40, vd); + _mav_put_float(buf, 44, speed_accuracy); + _mav_put_float(buf, 48, horiz_accuracy); + _mav_put_float(buf, 52, vert_accuracy); + _mav_put_uint16_t(buf, 56, ignore_flags); + _mav_put_uint16_t(buf, 58, time_week); + _mav_put_uint8_t(buf, 60, gps_id); + _mav_put_uint8_t(buf, 61, fix_type); + _mav_put_uint8_t(buf, 62, satellites_visible); + _mav_put_uint16_t(buf, 63, yaw); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS_INPUT_LEN); +#else + mavlink_gps_input_t packet; + packet.time_usec = time_usec; + packet.time_week_ms = time_week_ms; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.hdop = hdop; + packet.vdop = vdop; + packet.vn = vn; + packet.ve = ve; + packet.vd = vd; + packet.speed_accuracy = speed_accuracy; + packet.horiz_accuracy = horiz_accuracy; + packet.vert_accuracy = vert_accuracy; + packet.ignore_flags = ignore_flags; + packet.time_week = time_week; + packet.gps_id = gps_id; + packet.fix_type = fix_type; + packet.satellites_visible = satellites_visible; + packet.yaw = yaw; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS_INPUT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GPS_INPUT; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GPS_INPUT_MIN_LEN, MAVLINK_MSG_ID_GPS_INPUT_LEN, MAVLINK_MSG_ID_GPS_INPUT_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GPS_INPUT_MIN_LEN, MAVLINK_MSG_ID_GPS_INPUT_LEN); +#endif +} + /** * @brief Pack a gps_input message on a channel * @param system_id ID of this system @@ -281,6 +368,20 @@ static inline uint16_t mavlink_msg_gps_input_encode_chan(uint8_t system_id, uint return mavlink_msg_gps_input_pack_chan(system_id, component_id, chan, msg, gps_input->time_usec, gps_input->gps_id, gps_input->ignore_flags, gps_input->time_week_ms, gps_input->time_week, gps_input->fix_type, gps_input->lat, gps_input->lon, gps_input->alt, gps_input->hdop, gps_input->vdop, gps_input->vn, gps_input->ve, gps_input->vd, gps_input->speed_accuracy, gps_input->horiz_accuracy, gps_input->vert_accuracy, gps_input->satellites_visible, gps_input->yaw); } +/** + * @brief Encode a gps_input struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param gps_input C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_gps_input_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_gps_input_t* gps_input) +{ + return mavlink_msg_gps_input_pack_status(system_id, component_id, _status, msg, gps_input->time_usec, gps_input->gps_id, gps_input->ignore_flags, gps_input->time_week_ms, gps_input->time_week, gps_input->fix_type, gps_input->lat, gps_input->lon, gps_input->alt, gps_input->hdop, gps_input->vdop, gps_input->vn, gps_input->ve, gps_input->vd, gps_input->speed_accuracy, gps_input->horiz_accuracy, gps_input->vert_accuracy, gps_input->satellites_visible, gps_input->yaw); +} + /** * @brief Send a gps_input message * @param chan MAVLink channel to send the message @@ -374,7 +475,7 @@ static inline void mavlink_msg_gps_input_send_struct(mavlink_channel_t chan, con #if MAVLINK_MSG_ID_GPS_INPUT_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_gps_raw_int.h b/common/mavlink_msg_gps_raw_int.h index b87d82e48..473900882 100644 --- a/common/mavlink_msg_gps_raw_int.h +++ b/common/mavlink_msg_gps_raw_int.h @@ -9,18 +9,18 @@ typedef struct __mavlink_gps_raw_int_t { int32_t lat; /*< [degE7] Latitude (WGS84, EGM96 ellipsoid)*/ int32_t lon; /*< [degE7] Longitude (WGS84, EGM96 ellipsoid)*/ int32_t alt; /*< [mm] Altitude (MSL). Positive for up. Note that virtually all GPS modules provide the MSL altitude in addition to the WGS84 altitude.*/ - uint16_t eph; /*< GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX*/ - uint16_t epv; /*< GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX*/ + uint16_t eph; /*< GPS HDOP horizontal dilution of position (unitless * 100). If unknown, set to: UINT16_MAX*/ + uint16_t epv; /*< GPS VDOP vertical dilution of position (unitless * 100). If unknown, set to: UINT16_MAX*/ uint16_t vel; /*< [cm/s] GPS ground speed. If unknown, set to: UINT16_MAX*/ uint16_t cog; /*< [cdeg] Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX*/ uint8_t fix_type; /*< GPS fix type.*/ - uint8_t satellites_visible; /*< Number of satellites visible. If unknown, set to 255*/ + uint8_t satellites_visible; /*< Number of satellites visible. If unknown, set to UINT8_MAX*/ int32_t alt_ellipsoid; /*< [mm] Altitude (above WGS84, EGM96 ellipsoid). Positive for up.*/ uint32_t h_acc; /*< [mm] Position uncertainty.*/ uint32_t v_acc; /*< [mm] Altitude uncertainty.*/ - uint32_t vel_acc; /*< [mm] Speed uncertainty.*/ + uint32_t vel_acc; /*< [mm/s] Speed uncertainty.*/ uint32_t hdg_acc; /*< [degE5] Heading / track uncertainty*/ - uint16_t yaw; /*< [cdeg] Yaw in earth frame from north. Use 0 if this GPS does not provide yaw. Use 65535 if this GPS is configured to provide yaw and is currently unable to provide it. Use 36000 for north.*/ + uint16_t yaw; /*< [cdeg] Yaw in earth frame from north. Use 0 if this GPS does not provide yaw. Use UINT16_MAX if this GPS is configured to provide yaw and is currently unable to provide it. Use 36000 for north.*/ }) mavlink_gps_raw_int_t; #define MAVLINK_MSG_ID_GPS_RAW_INT_LEN 52 @@ -91,17 +91,17 @@ typedef struct __mavlink_gps_raw_int_t { * @param lat [degE7] Latitude (WGS84, EGM96 ellipsoid) * @param lon [degE7] Longitude (WGS84, EGM96 ellipsoid) * @param alt [mm] Altitude (MSL). Positive for up. Note that virtually all GPS modules provide the MSL altitude in addition to the WGS84 altitude. - * @param eph GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX - * @param epv GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX + * @param eph GPS HDOP horizontal dilution of position (unitless * 100). If unknown, set to: UINT16_MAX + * @param epv GPS VDOP vertical dilution of position (unitless * 100). If unknown, set to: UINT16_MAX * @param vel [cm/s] GPS ground speed. If unknown, set to: UINT16_MAX * @param cog [cdeg] Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX - * @param satellites_visible Number of satellites visible. If unknown, set to 255 + * @param satellites_visible Number of satellites visible. If unknown, set to UINT8_MAX * @param alt_ellipsoid [mm] Altitude (above WGS84, EGM96 ellipsoid). Positive for up. * @param h_acc [mm] Position uncertainty. * @param v_acc [mm] Altitude uncertainty. - * @param vel_acc [mm] Speed uncertainty. + * @param vel_acc [mm/s] Speed uncertainty. * @param hdg_acc [degE5] Heading / track uncertainty - * @param yaw [cdeg] Yaw in earth frame from north. Use 0 if this GPS does not provide yaw. Use 65535 if this GPS is configured to provide yaw and is currently unable to provide it. Use 36000 for north. + * @param yaw [cdeg] Yaw in earth frame from north. Use 0 if this GPS does not provide yaw. Use UINT16_MAX if this GPS is configured to provide yaw and is currently unable to provide it. Use 36000 for north. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_gps_raw_int_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, @@ -153,6 +153,84 @@ static inline uint16_t mavlink_msg_gps_raw_int_pack(uint8_t system_id, uint8_t c return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS_RAW_INT_MIN_LEN, MAVLINK_MSG_ID_GPS_RAW_INT_LEN, MAVLINK_MSG_ID_GPS_RAW_INT_CRC); } +/** + * @brief Pack a gps_raw_int message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param fix_type GPS fix type. + * @param lat [degE7] Latitude (WGS84, EGM96 ellipsoid) + * @param lon [degE7] Longitude (WGS84, EGM96 ellipsoid) + * @param alt [mm] Altitude (MSL). Positive for up. Note that virtually all GPS modules provide the MSL altitude in addition to the WGS84 altitude. + * @param eph GPS HDOP horizontal dilution of position (unitless * 100). If unknown, set to: UINT16_MAX + * @param epv GPS VDOP vertical dilution of position (unitless * 100). If unknown, set to: UINT16_MAX + * @param vel [cm/s] GPS ground speed. If unknown, set to: UINT16_MAX + * @param cog [cdeg] Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX + * @param satellites_visible Number of satellites visible. If unknown, set to UINT8_MAX + * @param alt_ellipsoid [mm] Altitude (above WGS84, EGM96 ellipsoid). Positive for up. + * @param h_acc [mm] Position uncertainty. + * @param v_acc [mm] Altitude uncertainty. + * @param vel_acc [mm/s] Speed uncertainty. + * @param hdg_acc [degE5] Heading / track uncertainty + * @param yaw [cdeg] Yaw in earth frame from north. Use 0 if this GPS does not provide yaw. Use UINT16_MAX if this GPS is configured to provide yaw and is currently unable to provide it. Use 36000 for north. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_gps_raw_int_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, uint8_t fix_type, int32_t lat, int32_t lon, int32_t alt, uint16_t eph, uint16_t epv, uint16_t vel, uint16_t cog, uint8_t satellites_visible, int32_t alt_ellipsoid, uint32_t h_acc, uint32_t v_acc, uint32_t vel_acc, uint32_t hdg_acc, uint16_t yaw) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GPS_RAW_INT_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_int32_t(buf, 16, alt); + _mav_put_uint16_t(buf, 20, eph); + _mav_put_uint16_t(buf, 22, epv); + _mav_put_uint16_t(buf, 24, vel); + _mav_put_uint16_t(buf, 26, cog); + _mav_put_uint8_t(buf, 28, fix_type); + _mav_put_uint8_t(buf, 29, satellites_visible); + _mav_put_int32_t(buf, 30, alt_ellipsoid); + _mav_put_uint32_t(buf, 34, h_acc); + _mav_put_uint32_t(buf, 38, v_acc); + _mav_put_uint32_t(buf, 42, vel_acc); + _mav_put_uint32_t(buf, 46, hdg_acc); + _mav_put_uint16_t(buf, 50, yaw); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS_RAW_INT_LEN); +#else + mavlink_gps_raw_int_t packet; + packet.time_usec = time_usec; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.eph = eph; + packet.epv = epv; + packet.vel = vel; + packet.cog = cog; + packet.fix_type = fix_type; + packet.satellites_visible = satellites_visible; + packet.alt_ellipsoid = alt_ellipsoid; + packet.h_acc = h_acc; + packet.v_acc = v_acc; + packet.vel_acc = vel_acc; + packet.hdg_acc = hdg_acc; + packet.yaw = yaw; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS_RAW_INT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GPS_RAW_INT; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GPS_RAW_INT_MIN_LEN, MAVLINK_MSG_ID_GPS_RAW_INT_LEN, MAVLINK_MSG_ID_GPS_RAW_INT_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GPS_RAW_INT_MIN_LEN, MAVLINK_MSG_ID_GPS_RAW_INT_LEN); +#endif +} + /** * @brief Pack a gps_raw_int message on a channel * @param system_id ID of this system @@ -164,17 +242,17 @@ static inline uint16_t mavlink_msg_gps_raw_int_pack(uint8_t system_id, uint8_t c * @param lat [degE7] Latitude (WGS84, EGM96 ellipsoid) * @param lon [degE7] Longitude (WGS84, EGM96 ellipsoid) * @param alt [mm] Altitude (MSL). Positive for up. Note that virtually all GPS modules provide the MSL altitude in addition to the WGS84 altitude. - * @param eph GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX - * @param epv GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX + * @param eph GPS HDOP horizontal dilution of position (unitless * 100). If unknown, set to: UINT16_MAX + * @param epv GPS VDOP vertical dilution of position (unitless * 100). If unknown, set to: UINT16_MAX * @param vel [cm/s] GPS ground speed. If unknown, set to: UINT16_MAX * @param cog [cdeg] Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX - * @param satellites_visible Number of satellites visible. If unknown, set to 255 + * @param satellites_visible Number of satellites visible. If unknown, set to UINT8_MAX * @param alt_ellipsoid [mm] Altitude (above WGS84, EGM96 ellipsoid). Positive for up. * @param h_acc [mm] Position uncertainty. * @param v_acc [mm] Altitude uncertainty. - * @param vel_acc [mm] Speed uncertainty. + * @param vel_acc [mm/s] Speed uncertainty. * @param hdg_acc [degE5] Heading / track uncertainty - * @param yaw [cdeg] Yaw in earth frame from north. Use 0 if this GPS does not provide yaw. Use 65535 if this GPS is configured to provide yaw and is currently unable to provide it. Use 36000 for north. + * @param yaw [cdeg] Yaw in earth frame from north. Use 0 if this GPS does not provide yaw. Use UINT16_MAX if this GPS is configured to provide yaw and is currently unable to provide it. Use 36000 for north. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_gps_raw_int_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, @@ -254,6 +332,20 @@ static inline uint16_t mavlink_msg_gps_raw_int_encode_chan(uint8_t system_id, ui return mavlink_msg_gps_raw_int_pack_chan(system_id, component_id, chan, msg, gps_raw_int->time_usec, gps_raw_int->fix_type, gps_raw_int->lat, gps_raw_int->lon, gps_raw_int->alt, gps_raw_int->eph, gps_raw_int->epv, gps_raw_int->vel, gps_raw_int->cog, gps_raw_int->satellites_visible, gps_raw_int->alt_ellipsoid, gps_raw_int->h_acc, gps_raw_int->v_acc, gps_raw_int->vel_acc, gps_raw_int->hdg_acc, gps_raw_int->yaw); } +/** + * @brief Encode a gps_raw_int struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param gps_raw_int C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_gps_raw_int_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_gps_raw_int_t* gps_raw_int) +{ + return mavlink_msg_gps_raw_int_pack_status(system_id, component_id, _status, msg, gps_raw_int->time_usec, gps_raw_int->fix_type, gps_raw_int->lat, gps_raw_int->lon, gps_raw_int->alt, gps_raw_int->eph, gps_raw_int->epv, gps_raw_int->vel, gps_raw_int->cog, gps_raw_int->satellites_visible, gps_raw_int->alt_ellipsoid, gps_raw_int->h_acc, gps_raw_int->v_acc, gps_raw_int->vel_acc, gps_raw_int->hdg_acc, gps_raw_int->yaw); +} + /** * @brief Send a gps_raw_int message * @param chan MAVLink channel to send the message @@ -263,17 +355,17 @@ static inline uint16_t mavlink_msg_gps_raw_int_encode_chan(uint8_t system_id, ui * @param lat [degE7] Latitude (WGS84, EGM96 ellipsoid) * @param lon [degE7] Longitude (WGS84, EGM96 ellipsoid) * @param alt [mm] Altitude (MSL). Positive for up. Note that virtually all GPS modules provide the MSL altitude in addition to the WGS84 altitude. - * @param eph GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX - * @param epv GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX + * @param eph GPS HDOP horizontal dilution of position (unitless * 100). If unknown, set to: UINT16_MAX + * @param epv GPS VDOP vertical dilution of position (unitless * 100). If unknown, set to: UINT16_MAX * @param vel [cm/s] GPS ground speed. If unknown, set to: UINT16_MAX * @param cog [cdeg] Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX - * @param satellites_visible Number of satellites visible. If unknown, set to 255 + * @param satellites_visible Number of satellites visible. If unknown, set to UINT8_MAX * @param alt_ellipsoid [mm] Altitude (above WGS84, EGM96 ellipsoid). Positive for up. * @param h_acc [mm] Position uncertainty. * @param v_acc [mm] Altitude uncertainty. - * @param vel_acc [mm] Speed uncertainty. + * @param vel_acc [mm/s] Speed uncertainty. * @param hdg_acc [degE5] Heading / track uncertainty - * @param yaw [cdeg] Yaw in earth frame from north. Use 0 if this GPS does not provide yaw. Use 65535 if this GPS is configured to provide yaw and is currently unable to provide it. Use 36000 for north. + * @param yaw [cdeg] Yaw in earth frame from north. Use 0 if this GPS does not provide yaw. Use UINT16_MAX if this GPS is configured to provide yaw and is currently unable to provide it. Use 36000 for north. */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS @@ -338,7 +430,7 @@ static inline void mavlink_msg_gps_raw_int_send_struct(mavlink_channel_t chan, c #if MAVLINK_MSG_ID_GPS_RAW_INT_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -448,7 +540,7 @@ static inline int32_t mavlink_msg_gps_raw_int_get_alt(const mavlink_message_t* m /** * @brief Get field eph from gps_raw_int message * - * @return GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX + * @return GPS HDOP horizontal dilution of position (unitless * 100). If unknown, set to: UINT16_MAX */ static inline uint16_t mavlink_msg_gps_raw_int_get_eph(const mavlink_message_t* msg) { @@ -458,7 +550,7 @@ static inline uint16_t mavlink_msg_gps_raw_int_get_eph(const mavlink_message_t* /** * @brief Get field epv from gps_raw_int message * - * @return GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX + * @return GPS VDOP vertical dilution of position (unitless * 100). If unknown, set to: UINT16_MAX */ static inline uint16_t mavlink_msg_gps_raw_int_get_epv(const mavlink_message_t* msg) { @@ -488,7 +580,7 @@ static inline uint16_t mavlink_msg_gps_raw_int_get_cog(const mavlink_message_t* /** * @brief Get field satellites_visible from gps_raw_int message * - * @return Number of satellites visible. If unknown, set to 255 + * @return Number of satellites visible. If unknown, set to UINT8_MAX */ static inline uint8_t mavlink_msg_gps_raw_int_get_satellites_visible(const mavlink_message_t* msg) { @@ -528,7 +620,7 @@ static inline uint32_t mavlink_msg_gps_raw_int_get_v_acc(const mavlink_message_t /** * @brief Get field vel_acc from gps_raw_int message * - * @return [mm] Speed uncertainty. + * @return [mm/s] Speed uncertainty. */ static inline uint32_t mavlink_msg_gps_raw_int_get_vel_acc(const mavlink_message_t* msg) { @@ -548,7 +640,7 @@ static inline uint32_t mavlink_msg_gps_raw_int_get_hdg_acc(const mavlink_message /** * @brief Get field yaw from gps_raw_int message * - * @return [cdeg] Yaw in earth frame from north. Use 0 if this GPS does not provide yaw. Use 65535 if this GPS is configured to provide yaw and is currently unable to provide it. Use 36000 for north. + * @return [cdeg] Yaw in earth frame from north. Use 0 if this GPS does not provide yaw. Use UINT16_MAX if this GPS is configured to provide yaw and is currently unable to provide it. Use 36000 for north. */ static inline uint16_t mavlink_msg_gps_raw_int_get_yaw(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_gps_rtcm_data.h b/common/mavlink_msg_gps_rtcm_data.h index 393d6adb3..72791b24f 100644 --- a/common/mavlink_msg_gps_rtcm_data.h +++ b/common/mavlink_msg_gps_rtcm_data.h @@ -65,7 +65,7 @@ static inline uint16_t mavlink_msg_gps_rtcm_data_pack(uint8_t system_id, uint8_t mavlink_gps_rtcm_data_t packet; packet.flags = flags; packet.len = len; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*180); + mav_array_assign_uint8_t(packet.data, data, 180); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS_RTCM_DATA_LEN); #endif @@ -73,6 +73,43 @@ static inline uint16_t mavlink_msg_gps_rtcm_data_pack(uint8_t system_id, uint8_t return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS_RTCM_DATA_MIN_LEN, MAVLINK_MSG_ID_GPS_RTCM_DATA_LEN, MAVLINK_MSG_ID_GPS_RTCM_DATA_CRC); } +/** + * @brief Pack a gps_rtcm_data message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param flags LSB: 1 means message is fragmented, next 2 bits are the fragment ID, the remaining 5 bits are used for the sequence ID. Messages are only to be flushed to the GPS when the entire message has been reconstructed on the autopilot. The fragment ID specifies which order the fragments should be assembled into a buffer, while the sequence ID is used to detect a mismatch between different buffers. The buffer is considered fully reconstructed when either all 4 fragments are present, or all the fragments before the first fragment with a non full payload is received. This management is used to ensure that normal GPS operation doesn't corrupt RTCM data, and to recover from a unreliable transport delivery order. + * @param len [bytes] data length + * @param data RTCM message (may be fragmented) + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_gps_rtcm_data_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t flags, uint8_t len, const uint8_t *data) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GPS_RTCM_DATA_LEN]; + _mav_put_uint8_t(buf, 0, flags); + _mav_put_uint8_t(buf, 1, len); + _mav_put_uint8_t_array(buf, 2, data, 180); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS_RTCM_DATA_LEN); +#else + mavlink_gps_rtcm_data_t packet; + packet.flags = flags; + packet.len = len; + mav_array_memcpy(packet.data, data, sizeof(uint8_t)*180); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS_RTCM_DATA_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GPS_RTCM_DATA; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GPS_RTCM_DATA_MIN_LEN, MAVLINK_MSG_ID_GPS_RTCM_DATA_LEN, MAVLINK_MSG_ID_GPS_RTCM_DATA_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GPS_RTCM_DATA_MIN_LEN, MAVLINK_MSG_ID_GPS_RTCM_DATA_LEN); +#endif +} + /** * @brief Pack a gps_rtcm_data message on a channel * @param system_id ID of this system @@ -98,7 +135,7 @@ static inline uint16_t mavlink_msg_gps_rtcm_data_pack_chan(uint8_t system_id, ui mavlink_gps_rtcm_data_t packet; packet.flags = flags; packet.len = len; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*180); + mav_array_assign_uint8_t(packet.data, data, 180); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS_RTCM_DATA_LEN); #endif @@ -133,6 +170,20 @@ static inline uint16_t mavlink_msg_gps_rtcm_data_encode_chan(uint8_t system_id, return mavlink_msg_gps_rtcm_data_pack_chan(system_id, component_id, chan, msg, gps_rtcm_data->flags, gps_rtcm_data->len, gps_rtcm_data->data); } +/** + * @brief Encode a gps_rtcm_data struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param gps_rtcm_data C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_gps_rtcm_data_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_gps_rtcm_data_t* gps_rtcm_data) +{ + return mavlink_msg_gps_rtcm_data_pack_status(system_id, component_id, _status, msg, gps_rtcm_data->flags, gps_rtcm_data->len, gps_rtcm_data->data); +} + /** * @brief Send a gps_rtcm_data message * @param chan MAVLink channel to send the message @@ -155,7 +206,7 @@ static inline void mavlink_msg_gps_rtcm_data_send(mavlink_channel_t chan, uint8_ mavlink_gps_rtcm_data_t packet; packet.flags = flags; packet.len = len; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*180); + mav_array_assign_uint8_t(packet.data, data, 180); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RTCM_DATA, (const char *)&packet, MAVLINK_MSG_ID_GPS_RTCM_DATA_MIN_LEN, MAVLINK_MSG_ID_GPS_RTCM_DATA_LEN, MAVLINK_MSG_ID_GPS_RTCM_DATA_CRC); #endif } @@ -176,7 +227,7 @@ static inline void mavlink_msg_gps_rtcm_data_send_struct(mavlink_channel_t chan, #if MAVLINK_MSG_ID_GPS_RTCM_DATA_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -194,7 +245,7 @@ static inline void mavlink_msg_gps_rtcm_data_send_buf(mavlink_message_t *msgbuf, mavlink_gps_rtcm_data_t *packet = (mavlink_gps_rtcm_data_t *)msgbuf; packet->flags = flags; packet->len = len; - mav_array_memcpy(packet->data, data, sizeof(uint8_t)*180); + mav_array_assign_uint8_t(packet->data, data, 180); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RTCM_DATA, (const char *)packet, MAVLINK_MSG_ID_GPS_RTCM_DATA_MIN_LEN, MAVLINK_MSG_ID_GPS_RTCM_DATA_LEN, MAVLINK_MSG_ID_GPS_RTCM_DATA_CRC); #endif } diff --git a/common/mavlink_msg_gps_rtk.h b/common/mavlink_msg_gps_rtk.h index abf898f2d..478a4d88e 100644 --- a/common/mavlink_msg_gps_rtk.h +++ b/common/mavlink_msg_gps_rtk.h @@ -135,6 +135,75 @@ static inline uint16_t mavlink_msg_gps_rtk_pack(uint8_t system_id, uint8_t compo return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS_RTK_MIN_LEN, MAVLINK_MSG_ID_GPS_RTK_LEN, MAVLINK_MSG_ID_GPS_RTK_CRC); } +/** + * @brief Pack a gps_rtk message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_last_baseline_ms [ms] Time since boot of last baseline message received. + * @param rtk_receiver_id Identification of connected RTK receiver. + * @param wn GPS Week Number of last baseline + * @param tow [ms] GPS Time of Week of last baseline + * @param rtk_health GPS-specific health report for RTK data. + * @param rtk_rate [Hz] Rate of baseline messages being received by GPS + * @param nsats Current number of sats used for RTK calculation. + * @param baseline_coords_type Coordinate system of baseline + * @param baseline_a_mm [mm] Current baseline in ECEF x or NED north component. + * @param baseline_b_mm [mm] Current baseline in ECEF y or NED east component. + * @param baseline_c_mm [mm] Current baseline in ECEF z or NED down component. + * @param accuracy Current estimate of baseline accuracy. + * @param iar_num_hypotheses Current number of integer ambiguity hypotheses. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_gps_rtk_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_last_baseline_ms, uint8_t rtk_receiver_id, uint16_t wn, uint32_t tow, uint8_t rtk_health, uint8_t rtk_rate, uint8_t nsats, uint8_t baseline_coords_type, int32_t baseline_a_mm, int32_t baseline_b_mm, int32_t baseline_c_mm, uint32_t accuracy, int32_t iar_num_hypotheses) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GPS_RTK_LEN]; + _mav_put_uint32_t(buf, 0, time_last_baseline_ms); + _mav_put_uint32_t(buf, 4, tow); + _mav_put_int32_t(buf, 8, baseline_a_mm); + _mav_put_int32_t(buf, 12, baseline_b_mm); + _mav_put_int32_t(buf, 16, baseline_c_mm); + _mav_put_uint32_t(buf, 20, accuracy); + _mav_put_int32_t(buf, 24, iar_num_hypotheses); + _mav_put_uint16_t(buf, 28, wn); + _mav_put_uint8_t(buf, 30, rtk_receiver_id); + _mav_put_uint8_t(buf, 31, rtk_health); + _mav_put_uint8_t(buf, 32, rtk_rate); + _mav_put_uint8_t(buf, 33, nsats); + _mav_put_uint8_t(buf, 34, baseline_coords_type); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS_RTK_LEN); +#else + mavlink_gps_rtk_t packet; + packet.time_last_baseline_ms = time_last_baseline_ms; + packet.tow = tow; + packet.baseline_a_mm = baseline_a_mm; + packet.baseline_b_mm = baseline_b_mm; + packet.baseline_c_mm = baseline_c_mm; + packet.accuracy = accuracy; + packet.iar_num_hypotheses = iar_num_hypotheses; + packet.wn = wn; + packet.rtk_receiver_id = rtk_receiver_id; + packet.rtk_health = rtk_health; + packet.rtk_rate = rtk_rate; + packet.nsats = nsats; + packet.baseline_coords_type = baseline_coords_type; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS_RTK_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GPS_RTK; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GPS_RTK_MIN_LEN, MAVLINK_MSG_ID_GPS_RTK_LEN, MAVLINK_MSG_ID_GPS_RTK_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GPS_RTK_MIN_LEN, MAVLINK_MSG_ID_GPS_RTK_LEN); +#endif +} + /** * @brief Pack a gps_rtk message on a channel * @param system_id ID of this system @@ -227,6 +296,20 @@ static inline uint16_t mavlink_msg_gps_rtk_encode_chan(uint8_t system_id, uint8_ return mavlink_msg_gps_rtk_pack_chan(system_id, component_id, chan, msg, gps_rtk->time_last_baseline_ms, gps_rtk->rtk_receiver_id, gps_rtk->wn, gps_rtk->tow, gps_rtk->rtk_health, gps_rtk->rtk_rate, gps_rtk->nsats, gps_rtk->baseline_coords_type, gps_rtk->baseline_a_mm, gps_rtk->baseline_b_mm, gps_rtk->baseline_c_mm, gps_rtk->accuracy, gps_rtk->iar_num_hypotheses); } +/** + * @brief Encode a gps_rtk struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param gps_rtk C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_gps_rtk_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_gps_rtk_t* gps_rtk) +{ + return mavlink_msg_gps_rtk_pack_status(system_id, component_id, _status, msg, gps_rtk->time_last_baseline_ms, gps_rtk->rtk_receiver_id, gps_rtk->wn, gps_rtk->tow, gps_rtk->rtk_health, gps_rtk->rtk_rate, gps_rtk->nsats, gps_rtk->baseline_coords_type, gps_rtk->baseline_a_mm, gps_rtk->baseline_b_mm, gps_rtk->baseline_c_mm, gps_rtk->accuracy, gps_rtk->iar_num_hypotheses); +} + /** * @brief Send a gps_rtk message * @param chan MAVLink channel to send the message @@ -302,7 +385,7 @@ static inline void mavlink_msg_gps_rtk_send_struct(mavlink_channel_t chan, const #if MAVLINK_MSG_ID_GPS_RTK_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_gps_status.h b/common/mavlink_msg_gps_status.h index cedd54584..8d541980d 100644 --- a/common/mavlink_msg_gps_status.h +++ b/common/mavlink_msg_gps_status.h @@ -71,6 +71,48 @@ typedef struct __mavlink_gps_status_t { static inline uint16_t mavlink_msg_gps_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t satellites_visible, const uint8_t *satellite_prn, const uint8_t *satellite_used, const uint8_t *satellite_elevation, const uint8_t *satellite_azimuth, const uint8_t *satellite_snr) { +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GPS_STATUS_LEN]; + _mav_put_uint8_t(buf, 0, satellites_visible); + _mav_put_uint8_t_array(buf, 1, satellite_prn, 20); + _mav_put_uint8_t_array(buf, 21, satellite_used, 20); + _mav_put_uint8_t_array(buf, 41, satellite_elevation, 20); + _mav_put_uint8_t_array(buf, 61, satellite_azimuth, 20); + _mav_put_uint8_t_array(buf, 81, satellite_snr, 20); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS_STATUS_LEN); +#else + mavlink_gps_status_t packet; + packet.satellites_visible = satellites_visible; + mav_array_assign_uint8_t(packet.satellite_prn, satellite_prn, 20); + mav_array_assign_uint8_t(packet.satellite_used, satellite_used, 20); + mav_array_assign_uint8_t(packet.satellite_elevation, satellite_elevation, 20); + mav_array_assign_uint8_t(packet.satellite_azimuth, satellite_azimuth, 20); + mav_array_assign_uint8_t(packet.satellite_snr, satellite_snr, 20); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GPS_STATUS; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS_STATUS_MIN_LEN, MAVLINK_MSG_ID_GPS_STATUS_LEN, MAVLINK_MSG_ID_GPS_STATUS_CRC); +} + +/** + * @brief Pack a gps_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param satellites_visible Number of satellites visible + * @param satellite_prn Global satellite ID + * @param satellite_used 0: Satellite not used, 1: used for localization + * @param satellite_elevation [deg] Elevation (0: right on top of receiver, 90: on the horizon) of satellite + * @param satellite_azimuth [deg] Direction of satellite, 0: 0 deg, 255: 360 deg. + * @param satellite_snr [dB] Signal to noise ratio of satellite + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_gps_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t satellites_visible, const uint8_t *satellite_prn, const uint8_t *satellite_used, const uint8_t *satellite_elevation, const uint8_t *satellite_azimuth, const uint8_t *satellite_snr) +{ #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_GPS_STATUS_LEN]; _mav_put_uint8_t(buf, 0, satellites_visible); @@ -92,7 +134,11 @@ static inline uint16_t mavlink_msg_gps_status_pack(uint8_t system_id, uint8_t co #endif msg->msgid = MAVLINK_MSG_ID_GPS_STATUS; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS_STATUS_MIN_LEN, MAVLINK_MSG_ID_GPS_STATUS_LEN, MAVLINK_MSG_ID_GPS_STATUS_CRC); +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GPS_STATUS_MIN_LEN, MAVLINK_MSG_ID_GPS_STATUS_LEN, MAVLINK_MSG_ID_GPS_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GPS_STATUS_MIN_LEN, MAVLINK_MSG_ID_GPS_STATUS_LEN); +#endif } /** @@ -125,11 +171,11 @@ static inline uint16_t mavlink_msg_gps_status_pack_chan(uint8_t system_id, uint8 #else mavlink_gps_status_t packet; packet.satellites_visible = satellites_visible; - mav_array_memcpy(packet.satellite_prn, satellite_prn, sizeof(uint8_t)*20); - mav_array_memcpy(packet.satellite_used, satellite_used, sizeof(uint8_t)*20); - mav_array_memcpy(packet.satellite_elevation, satellite_elevation, sizeof(uint8_t)*20); - mav_array_memcpy(packet.satellite_azimuth, satellite_azimuth, sizeof(uint8_t)*20); - mav_array_memcpy(packet.satellite_snr, satellite_snr, sizeof(uint8_t)*20); + mav_array_assign_uint8_t(packet.satellite_prn, satellite_prn, 20); + mav_array_assign_uint8_t(packet.satellite_used, satellite_used, 20); + mav_array_assign_uint8_t(packet.satellite_elevation, satellite_elevation, 20); + mav_array_assign_uint8_t(packet.satellite_azimuth, satellite_azimuth, 20); + mav_array_assign_uint8_t(packet.satellite_snr, satellite_snr, 20); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS_STATUS_LEN); #endif @@ -164,6 +210,20 @@ static inline uint16_t mavlink_msg_gps_status_encode_chan(uint8_t system_id, uin return mavlink_msg_gps_status_pack_chan(system_id, component_id, chan, msg, gps_status->satellites_visible, gps_status->satellite_prn, gps_status->satellite_used, gps_status->satellite_elevation, gps_status->satellite_azimuth, gps_status->satellite_snr); } +/** + * @brief Encode a gps_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param gps_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_gps_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_gps_status_t* gps_status) +{ + return mavlink_msg_gps_status_pack_status(system_id, component_id, _status, msg, gps_status->satellites_visible, gps_status->satellite_prn, gps_status->satellite_used, gps_status->satellite_elevation, gps_status->satellite_azimuth, gps_status->satellite_snr); +} + /** * @brief Send a gps_status message * @param chan MAVLink channel to send the message @@ -191,11 +251,11 @@ static inline void mavlink_msg_gps_status_send(mavlink_channel_t chan, uint8_t s #else mavlink_gps_status_t packet; packet.satellites_visible = satellites_visible; - mav_array_memcpy(packet.satellite_prn, satellite_prn, sizeof(uint8_t)*20); - mav_array_memcpy(packet.satellite_used, satellite_used, sizeof(uint8_t)*20); - mav_array_memcpy(packet.satellite_elevation, satellite_elevation, sizeof(uint8_t)*20); - mav_array_memcpy(packet.satellite_azimuth, satellite_azimuth, sizeof(uint8_t)*20); - mav_array_memcpy(packet.satellite_snr, satellite_snr, sizeof(uint8_t)*20); + mav_array_assign_uint8_t(packet.satellite_prn, satellite_prn, 20); + mav_array_assign_uint8_t(packet.satellite_used, satellite_used, 20); + mav_array_assign_uint8_t(packet.satellite_elevation, satellite_elevation, 20); + mav_array_assign_uint8_t(packet.satellite_azimuth, satellite_azimuth, 20); + mav_array_assign_uint8_t(packet.satellite_snr, satellite_snr, 20); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_STATUS, (const char *)&packet, MAVLINK_MSG_ID_GPS_STATUS_MIN_LEN, MAVLINK_MSG_ID_GPS_STATUS_LEN, MAVLINK_MSG_ID_GPS_STATUS_CRC); #endif } @@ -216,7 +276,7 @@ static inline void mavlink_msg_gps_status_send_struct(mavlink_channel_t chan, co #if MAVLINK_MSG_ID_GPS_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -236,11 +296,11 @@ static inline void mavlink_msg_gps_status_send_buf(mavlink_message_t *msgbuf, ma #else mavlink_gps_status_t *packet = (mavlink_gps_status_t *)msgbuf; packet->satellites_visible = satellites_visible; - mav_array_memcpy(packet->satellite_prn, satellite_prn, sizeof(uint8_t)*20); - mav_array_memcpy(packet->satellite_used, satellite_used, sizeof(uint8_t)*20); - mav_array_memcpy(packet->satellite_elevation, satellite_elevation, sizeof(uint8_t)*20); - mav_array_memcpy(packet->satellite_azimuth, satellite_azimuth, sizeof(uint8_t)*20); - mav_array_memcpy(packet->satellite_snr, satellite_snr, sizeof(uint8_t)*20); + mav_array_assign_uint8_t(packet->satellite_prn, satellite_prn, 20); + mav_array_assign_uint8_t(packet->satellite_used, satellite_used, 20); + mav_array_assign_uint8_t(packet->satellite_elevation, satellite_elevation, 20); + mav_array_assign_uint8_t(packet->satellite_azimuth, satellite_azimuth, 20); + mav_array_assign_uint8_t(packet->satellite_snr, satellite_snr, 20); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_STATUS, (const char *)packet, MAVLINK_MSG_ID_GPS_STATUS_MIN_LEN, MAVLINK_MSG_ID_GPS_STATUS_LEN, MAVLINK_MSG_ID_GPS_STATUS_CRC); #endif } diff --git a/common/mavlink_msg_high_latency.h b/common/mavlink_msg_high_latency.h index a0f4e8496..49d6a520c 100644 --- a/common/mavlink_msg_high_latency.h +++ b/common/mavlink_msg_high_latency.h @@ -22,7 +22,7 @@ typedef struct __mavlink_high_latency_t { uint8_t airspeed_sp; /*< [m/s] airspeed setpoint*/ uint8_t groundspeed; /*< [m/s] groundspeed*/ int8_t climb_rate; /*< [m/s] climb rate*/ - uint8_t gps_nsat; /*< Number of satellites visible. If unknown, set to 255*/ + uint8_t gps_nsat; /*< Number of satellites visible. If unknown, set to UINT8_MAX*/ uint8_t gps_fix_type; /*< GPS Fix type.*/ uint8_t battery_remaining; /*< [%] Remaining battery (percentage)*/ int8_t temperature; /*< [degC] Autopilot temperature (degrees C)*/ @@ -126,7 +126,7 @@ typedef struct __mavlink_high_latency_t { * @param airspeed_sp [m/s] airspeed setpoint * @param groundspeed [m/s] groundspeed * @param climb_rate [m/s] climb rate - * @param gps_nsat Number of satellites visible. If unknown, set to 255 + * @param gps_nsat Number of satellites visible. If unknown, set to UINT8_MAX * @param gps_fix_type GPS Fix type. * @param battery_remaining [%] Remaining battery (percentage) * @param temperature [degC] Autopilot temperature (degrees C) @@ -201,6 +201,108 @@ static inline uint16_t mavlink_msg_high_latency_pack(uint8_t system_id, uint8_t return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIGH_LATENCY_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_CRC); } +/** + * @brief Pack a high_latency message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param base_mode Bitmap of enabled system modes. + * @param custom_mode A bitfield for use for autopilot-specific flags. + * @param landed_state The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown. + * @param roll [cdeg] roll + * @param pitch [cdeg] pitch + * @param heading [cdeg] heading + * @param throttle [%] throttle (percentage) + * @param heading_sp [cdeg] heading setpoint + * @param latitude [degE7] Latitude + * @param longitude [degE7] Longitude + * @param altitude_amsl [m] Altitude above mean sea level + * @param altitude_sp [m] Altitude setpoint relative to the home position + * @param airspeed [m/s] airspeed + * @param airspeed_sp [m/s] airspeed setpoint + * @param groundspeed [m/s] groundspeed + * @param climb_rate [m/s] climb rate + * @param gps_nsat Number of satellites visible. If unknown, set to UINT8_MAX + * @param gps_fix_type GPS Fix type. + * @param battery_remaining [%] Remaining battery (percentage) + * @param temperature [degC] Autopilot temperature (degrees C) + * @param temperature_air [degC] Air temperature (degrees C) from airspeed sensor + * @param failsafe failsafe (each bit represents a failsafe where 0=ok, 1=failsafe active (bit0:RC, bit1:batt, bit2:GPS, bit3:GCS, bit4:fence) + * @param wp_num current waypoint number + * @param wp_distance [m] distance to target + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_high_latency_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t base_mode, uint32_t custom_mode, uint8_t landed_state, int16_t roll, int16_t pitch, uint16_t heading, int8_t throttle, int16_t heading_sp, int32_t latitude, int32_t longitude, int16_t altitude_amsl, int16_t altitude_sp, uint8_t airspeed, uint8_t airspeed_sp, uint8_t groundspeed, int8_t climb_rate, uint8_t gps_nsat, uint8_t gps_fix_type, uint8_t battery_remaining, int8_t temperature, int8_t temperature_air, uint8_t failsafe, uint8_t wp_num, uint16_t wp_distance) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_HIGH_LATENCY_LEN]; + _mav_put_uint32_t(buf, 0, custom_mode); + _mav_put_int32_t(buf, 4, latitude); + _mav_put_int32_t(buf, 8, longitude); + _mav_put_int16_t(buf, 12, roll); + _mav_put_int16_t(buf, 14, pitch); + _mav_put_uint16_t(buf, 16, heading); + _mav_put_int16_t(buf, 18, heading_sp); + _mav_put_int16_t(buf, 20, altitude_amsl); + _mav_put_int16_t(buf, 22, altitude_sp); + _mav_put_uint16_t(buf, 24, wp_distance); + _mav_put_uint8_t(buf, 26, base_mode); + _mav_put_uint8_t(buf, 27, landed_state); + _mav_put_int8_t(buf, 28, throttle); + _mav_put_uint8_t(buf, 29, airspeed); + _mav_put_uint8_t(buf, 30, airspeed_sp); + _mav_put_uint8_t(buf, 31, groundspeed); + _mav_put_int8_t(buf, 32, climb_rate); + _mav_put_uint8_t(buf, 33, gps_nsat); + _mav_put_uint8_t(buf, 34, gps_fix_type); + _mav_put_uint8_t(buf, 35, battery_remaining); + _mav_put_int8_t(buf, 36, temperature); + _mav_put_int8_t(buf, 37, temperature_air); + _mav_put_uint8_t(buf, 38, failsafe); + _mav_put_uint8_t(buf, 39, wp_num); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIGH_LATENCY_LEN); +#else + mavlink_high_latency_t packet; + packet.custom_mode = custom_mode; + packet.latitude = latitude; + packet.longitude = longitude; + packet.roll = roll; + packet.pitch = pitch; + packet.heading = heading; + packet.heading_sp = heading_sp; + packet.altitude_amsl = altitude_amsl; + packet.altitude_sp = altitude_sp; + packet.wp_distance = wp_distance; + packet.base_mode = base_mode; + packet.landed_state = landed_state; + packet.throttle = throttle; + packet.airspeed = airspeed; + packet.airspeed_sp = airspeed_sp; + packet.groundspeed = groundspeed; + packet.climb_rate = climb_rate; + packet.gps_nsat = gps_nsat; + packet.gps_fix_type = gps_fix_type; + packet.battery_remaining = battery_remaining; + packet.temperature = temperature; + packet.temperature_air = temperature_air; + packet.failsafe = failsafe; + packet.wp_num = wp_num; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIGH_LATENCY_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_HIGH_LATENCY; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HIGH_LATENCY_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HIGH_LATENCY_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_LEN); +#endif +} + /** * @brief Pack a high_latency message on a channel * @param system_id ID of this system @@ -223,7 +325,7 @@ static inline uint16_t mavlink_msg_high_latency_pack(uint8_t system_id, uint8_t * @param airspeed_sp [m/s] airspeed setpoint * @param groundspeed [m/s] groundspeed * @param climb_rate [m/s] climb rate - * @param gps_nsat Number of satellites visible. If unknown, set to 255 + * @param gps_nsat Number of satellites visible. If unknown, set to UINT8_MAX * @param gps_fix_type GPS Fix type. * @param battery_remaining [%] Remaining battery (percentage) * @param temperature [degC] Autopilot temperature (degrees C) @@ -326,6 +428,20 @@ static inline uint16_t mavlink_msg_high_latency_encode_chan(uint8_t system_id, u return mavlink_msg_high_latency_pack_chan(system_id, component_id, chan, msg, high_latency->base_mode, high_latency->custom_mode, high_latency->landed_state, high_latency->roll, high_latency->pitch, high_latency->heading, high_latency->throttle, high_latency->heading_sp, high_latency->latitude, high_latency->longitude, high_latency->altitude_amsl, high_latency->altitude_sp, high_latency->airspeed, high_latency->airspeed_sp, high_latency->groundspeed, high_latency->climb_rate, high_latency->gps_nsat, high_latency->gps_fix_type, high_latency->battery_remaining, high_latency->temperature, high_latency->temperature_air, high_latency->failsafe, high_latency->wp_num, high_latency->wp_distance); } +/** + * @brief Encode a high_latency struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param high_latency C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_high_latency_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_high_latency_t* high_latency) +{ + return mavlink_msg_high_latency_pack_status(system_id, component_id, _status, msg, high_latency->base_mode, high_latency->custom_mode, high_latency->landed_state, high_latency->roll, high_latency->pitch, high_latency->heading, high_latency->throttle, high_latency->heading_sp, high_latency->latitude, high_latency->longitude, high_latency->altitude_amsl, high_latency->altitude_sp, high_latency->airspeed, high_latency->airspeed_sp, high_latency->groundspeed, high_latency->climb_rate, high_latency->gps_nsat, high_latency->gps_fix_type, high_latency->battery_remaining, high_latency->temperature, high_latency->temperature_air, high_latency->failsafe, high_latency->wp_num, high_latency->wp_distance); +} + /** * @brief Send a high_latency message * @param chan MAVLink channel to send the message @@ -346,7 +462,7 @@ static inline uint16_t mavlink_msg_high_latency_encode_chan(uint8_t system_id, u * @param airspeed_sp [m/s] airspeed setpoint * @param groundspeed [m/s] groundspeed * @param climb_rate [m/s] climb rate - * @param gps_nsat Number of satellites visible. If unknown, set to 255 + * @param gps_nsat Number of satellites visible. If unknown, set to UINT8_MAX * @param gps_fix_type GPS Fix type. * @param battery_remaining [%] Remaining battery (percentage) * @param temperature [degC] Autopilot temperature (degrees C) @@ -434,7 +550,7 @@ static inline void mavlink_msg_high_latency_send_struct(mavlink_channel_t chan, #if MAVLINK_MSG_ID_HIGH_LATENCY_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -670,7 +786,7 @@ static inline int8_t mavlink_msg_high_latency_get_climb_rate(const mavlink_messa /** * @brief Get field gps_nsat from high_latency message * - * @return Number of satellites visible. If unknown, set to 255 + * @return Number of satellites visible. If unknown, set to UINT8_MAX */ static inline uint8_t mavlink_msg_high_latency_get_gps_nsat(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_high_latency2.h b/common/mavlink_msg_high_latency2.h index 3de15a710..1a812b78d 100644 --- a/common/mavlink_msg_high_latency2.h +++ b/common/mavlink_msg_high_latency2.h @@ -26,7 +26,7 @@ typedef struct __mavlink_high_latency2_t { uint8_t wind_heading; /*< [deg/2] Wind heading*/ uint8_t eph; /*< [dm] Maximum error horizontal position since last message*/ uint8_t epv; /*< [dm] Maximum error vertical position since last message*/ - int8_t temperature_air; /*< [degC] Air temperature from airspeed sensor*/ + int8_t temperature_air; /*< [degC] Air temperature*/ int8_t climb_rate; /*< [dm/s] Maximum climb rate magnitude since last message*/ int8_t battery; /*< [%] Battery level (-1 if field not provided).*/ int8_t custom0; /*< Field for custom payload.*/ @@ -138,7 +138,7 @@ typedef struct __mavlink_high_latency2_t { * @param wind_heading [deg/2] Wind heading * @param eph [dm] Maximum error horizontal position since last message * @param epv [dm] Maximum error vertical position since last message - * @param temperature_air [degC] Air temperature from airspeed sensor + * @param temperature_air [degC] Air temperature * @param climb_rate [dm/s] Maximum climb rate magnitude since last message * @param battery [%] Battery level (-1 if field not provided). * @param wp_num Current waypoint number @@ -219,6 +219,117 @@ static inline uint16_t mavlink_msg_high_latency2_pack(uint8_t system_id, uint8_t return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIGH_LATENCY2_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_CRC); } +/** + * @brief Pack a high_latency2 message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param timestamp [ms] Timestamp (milliseconds since boot or Unix epoch) + * @param type Type of the MAV (quadrotor, helicopter, etc.) + * @param autopilot Autopilot type / class. Use MAV_AUTOPILOT_INVALID for components that are not flight controllers. + * @param custom_mode A bitfield for use for autopilot-specific flags (2 byte version). + * @param latitude [degE7] Latitude + * @param longitude [degE7] Longitude + * @param altitude [m] Altitude above mean sea level + * @param target_altitude [m] Altitude setpoint + * @param heading [deg/2] Heading + * @param target_heading [deg/2] Heading setpoint + * @param target_distance [dam] Distance to target waypoint or position + * @param throttle [%] Throttle + * @param airspeed [m/s*5] Airspeed + * @param airspeed_sp [m/s*5] Airspeed setpoint + * @param groundspeed [m/s*5] Groundspeed + * @param windspeed [m/s*5] Windspeed + * @param wind_heading [deg/2] Wind heading + * @param eph [dm] Maximum error horizontal position since last message + * @param epv [dm] Maximum error vertical position since last message + * @param temperature_air [degC] Air temperature + * @param climb_rate [dm/s] Maximum climb rate magnitude since last message + * @param battery [%] Battery level (-1 if field not provided). + * @param wp_num Current waypoint number + * @param failure_flags Bitmap of failure flags. + * @param custom0 Field for custom payload. + * @param custom1 Field for custom payload. + * @param custom2 Field for custom payload. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_high_latency2_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t timestamp, uint8_t type, uint8_t autopilot, uint16_t custom_mode, int32_t latitude, int32_t longitude, int16_t altitude, int16_t target_altitude, uint8_t heading, uint8_t target_heading, uint16_t target_distance, uint8_t throttle, uint8_t airspeed, uint8_t airspeed_sp, uint8_t groundspeed, uint8_t windspeed, uint8_t wind_heading, uint8_t eph, uint8_t epv, int8_t temperature_air, int8_t climb_rate, int8_t battery, uint16_t wp_num, uint16_t failure_flags, int8_t custom0, int8_t custom1, int8_t custom2) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_HIGH_LATENCY2_LEN]; + _mav_put_uint32_t(buf, 0, timestamp); + _mav_put_int32_t(buf, 4, latitude); + _mav_put_int32_t(buf, 8, longitude); + _mav_put_uint16_t(buf, 12, custom_mode); + _mav_put_int16_t(buf, 14, altitude); + _mav_put_int16_t(buf, 16, target_altitude); + _mav_put_uint16_t(buf, 18, target_distance); + _mav_put_uint16_t(buf, 20, wp_num); + _mav_put_uint16_t(buf, 22, failure_flags); + _mav_put_uint8_t(buf, 24, type); + _mav_put_uint8_t(buf, 25, autopilot); + _mav_put_uint8_t(buf, 26, heading); + _mav_put_uint8_t(buf, 27, target_heading); + _mav_put_uint8_t(buf, 28, throttle); + _mav_put_uint8_t(buf, 29, airspeed); + _mav_put_uint8_t(buf, 30, airspeed_sp); + _mav_put_uint8_t(buf, 31, groundspeed); + _mav_put_uint8_t(buf, 32, windspeed); + _mav_put_uint8_t(buf, 33, wind_heading); + _mav_put_uint8_t(buf, 34, eph); + _mav_put_uint8_t(buf, 35, epv); + _mav_put_int8_t(buf, 36, temperature_air); + _mav_put_int8_t(buf, 37, climb_rate); + _mav_put_int8_t(buf, 38, battery); + _mav_put_int8_t(buf, 39, custom0); + _mav_put_int8_t(buf, 40, custom1); + _mav_put_int8_t(buf, 41, custom2); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN); +#else + mavlink_high_latency2_t packet; + packet.timestamp = timestamp; + packet.latitude = latitude; + packet.longitude = longitude; + packet.custom_mode = custom_mode; + packet.altitude = altitude; + packet.target_altitude = target_altitude; + packet.target_distance = target_distance; + packet.wp_num = wp_num; + packet.failure_flags = failure_flags; + packet.type = type; + packet.autopilot = autopilot; + packet.heading = heading; + packet.target_heading = target_heading; + packet.throttle = throttle; + packet.airspeed = airspeed; + packet.airspeed_sp = airspeed_sp; + packet.groundspeed = groundspeed; + packet.windspeed = windspeed; + packet.wind_heading = wind_heading; + packet.eph = eph; + packet.epv = epv; + packet.temperature_air = temperature_air; + packet.climb_rate = climb_rate; + packet.battery = battery; + packet.custom0 = custom0; + packet.custom1 = custom1; + packet.custom2 = custom2; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_HIGH_LATENCY2; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HIGH_LATENCY2_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HIGH_LATENCY2_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN); +#endif +} + /** * @brief Pack a high_latency2 message on a channel * @param system_id ID of this system @@ -244,7 +355,7 @@ static inline uint16_t mavlink_msg_high_latency2_pack(uint8_t system_id, uint8_t * @param wind_heading [deg/2] Wind heading * @param eph [dm] Maximum error horizontal position since last message * @param epv [dm] Maximum error vertical position since last message - * @param temperature_air [degC] Air temperature from airspeed sensor + * @param temperature_air [degC] Air temperature * @param climb_rate [dm/s] Maximum climb rate magnitude since last message * @param battery [%] Battery level (-1 if field not provided). * @param wp_num Current waypoint number @@ -353,6 +464,20 @@ static inline uint16_t mavlink_msg_high_latency2_encode_chan(uint8_t system_id, return mavlink_msg_high_latency2_pack_chan(system_id, component_id, chan, msg, high_latency2->timestamp, high_latency2->type, high_latency2->autopilot, high_latency2->custom_mode, high_latency2->latitude, high_latency2->longitude, high_latency2->altitude, high_latency2->target_altitude, high_latency2->heading, high_latency2->target_heading, high_latency2->target_distance, high_latency2->throttle, high_latency2->airspeed, high_latency2->airspeed_sp, high_latency2->groundspeed, high_latency2->windspeed, high_latency2->wind_heading, high_latency2->eph, high_latency2->epv, high_latency2->temperature_air, high_latency2->climb_rate, high_latency2->battery, high_latency2->wp_num, high_latency2->failure_flags, high_latency2->custom0, high_latency2->custom1, high_latency2->custom2); } +/** + * @brief Encode a high_latency2 struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param high_latency2 C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_high_latency2_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_high_latency2_t* high_latency2) +{ + return mavlink_msg_high_latency2_pack_status(system_id, component_id, _status, msg, high_latency2->timestamp, high_latency2->type, high_latency2->autopilot, high_latency2->custom_mode, high_latency2->latitude, high_latency2->longitude, high_latency2->altitude, high_latency2->target_altitude, high_latency2->heading, high_latency2->target_heading, high_latency2->target_distance, high_latency2->throttle, high_latency2->airspeed, high_latency2->airspeed_sp, high_latency2->groundspeed, high_latency2->windspeed, high_latency2->wind_heading, high_latency2->eph, high_latency2->epv, high_latency2->temperature_air, high_latency2->climb_rate, high_latency2->battery, high_latency2->wp_num, high_latency2->failure_flags, high_latency2->custom0, high_latency2->custom1, high_latency2->custom2); +} + /** * @brief Send a high_latency2 message * @param chan MAVLink channel to send the message @@ -376,7 +501,7 @@ static inline uint16_t mavlink_msg_high_latency2_encode_chan(uint8_t system_id, * @param wind_heading [deg/2] Wind heading * @param eph [dm] Maximum error horizontal position since last message * @param epv [dm] Maximum error vertical position since last message - * @param temperature_air [degC] Air temperature from airspeed sensor + * @param temperature_air [degC] Air temperature * @param climb_rate [dm/s] Maximum climb rate magnitude since last message * @param battery [%] Battery level (-1 if field not provided). * @param wp_num Current waypoint number @@ -470,7 +595,7 @@ static inline void mavlink_msg_high_latency2_send_struct(mavlink_channel_t chan, #if MAVLINK_MSG_ID_HIGH_LATENCY2_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -742,7 +867,7 @@ static inline uint8_t mavlink_msg_high_latency2_get_epv(const mavlink_message_t* /** * @brief Get field temperature_air from high_latency2 message * - * @return [degC] Air temperature from airspeed sensor + * @return [degC] Air temperature */ static inline int8_t mavlink_msg_high_latency2_get_temperature_air(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_highres_imu.h b/common/mavlink_msg_highres_imu.h index a8e089992..ea8b9246a 100644 --- a/common/mavlink_msg_highres_imu.h +++ b/common/mavlink_msg_highres_imu.h @@ -19,7 +19,7 @@ typedef struct __mavlink_highres_imu_t { float diff_pressure; /*< [hPa] Differential pressure*/ float pressure_alt; /*< Altitude calculated from pressure*/ float temperature; /*< [degC] Temperature*/ - uint16_t fields_updated; /*< Bitmap for fields that have updated since last message, bit 0 = xacc, bit 12: temperature*/ + uint16_t fields_updated; /*< Bitmap for fields that have updated since last message*/ uint8_t id; /*< Id. Ids are numbered from 0 and map to IMUs numbered from 1 (e.g. IMU1 will have a message with id=0)*/ } mavlink_highres_imu_t; @@ -100,7 +100,7 @@ typedef struct __mavlink_highres_imu_t { * @param diff_pressure [hPa] Differential pressure * @param pressure_alt Altitude calculated from pressure * @param temperature [degC] Temperature - * @param fields_updated Bitmap for fields that have updated since last message, bit 0 = xacc, bit 12: temperature + * @param fields_updated Bitmap for fields that have updated since last message * @param id Id. Ids are numbered from 0 and map to IMUs numbered from 1 (e.g. IMU1 will have a message with id=0) * @return length of the message in bytes (excluding serial stream start sign) */ @@ -153,6 +153,84 @@ static inline uint16_t mavlink_msg_highres_imu_pack(uint8_t system_id, uint8_t c return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC); } +/** + * @brief Pack a highres_imu message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param xacc [m/s/s] X acceleration + * @param yacc [m/s/s] Y acceleration + * @param zacc [m/s/s] Z acceleration + * @param xgyro [rad/s] Angular speed around X axis + * @param ygyro [rad/s] Angular speed around Y axis + * @param zgyro [rad/s] Angular speed around Z axis + * @param xmag [gauss] X Magnetic field + * @param ymag [gauss] Y Magnetic field + * @param zmag [gauss] Z Magnetic field + * @param abs_pressure [hPa] Absolute pressure + * @param diff_pressure [hPa] Differential pressure + * @param pressure_alt Altitude calculated from pressure + * @param temperature [degC] Temperature + * @param fields_updated Bitmap for fields that have updated since last message + * @param id Id. Ids are numbered from 0 and map to IMUs numbered from 1 (e.g. IMU1 will have a message with id=0) + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_highres_imu_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, uint16_t fields_updated, uint8_t id) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_HIGHRES_IMU_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, xacc); + _mav_put_float(buf, 12, yacc); + _mav_put_float(buf, 16, zacc); + _mav_put_float(buf, 20, xgyro); + _mav_put_float(buf, 24, ygyro); + _mav_put_float(buf, 28, zgyro); + _mav_put_float(buf, 32, xmag); + _mav_put_float(buf, 36, ymag); + _mav_put_float(buf, 40, zmag); + _mav_put_float(buf, 44, abs_pressure); + _mav_put_float(buf, 48, diff_pressure); + _mav_put_float(buf, 52, pressure_alt); + _mav_put_float(buf, 56, temperature); + _mav_put_uint16_t(buf, 60, fields_updated); + _mav_put_uint8_t(buf, 62, id); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIGHRES_IMU_LEN); +#else + mavlink_highres_imu_t packet; + packet.time_usec = time_usec; + packet.xacc = xacc; + packet.yacc = yacc; + packet.zacc = zacc; + packet.xgyro = xgyro; + packet.ygyro = ygyro; + packet.zgyro = zgyro; + packet.xmag = xmag; + packet.ymag = ymag; + packet.zmag = zmag; + packet.abs_pressure = abs_pressure; + packet.diff_pressure = diff_pressure; + packet.pressure_alt = pressure_alt; + packet.temperature = temperature; + packet.fields_updated = fields_updated; + packet.id = id; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIGHRES_IMU_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_HIGHRES_IMU; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN); +#endif +} + /** * @brief Pack a highres_imu message on a channel * @param system_id ID of this system @@ -173,7 +251,7 @@ static inline uint16_t mavlink_msg_highres_imu_pack(uint8_t system_id, uint8_t c * @param diff_pressure [hPa] Differential pressure * @param pressure_alt Altitude calculated from pressure * @param temperature [degC] Temperature - * @param fields_updated Bitmap for fields that have updated since last message, bit 0 = xacc, bit 12: temperature + * @param fields_updated Bitmap for fields that have updated since last message * @param id Id. Ids are numbered from 0 and map to IMUs numbered from 1 (e.g. IMU1 will have a message with id=0) * @return length of the message in bytes (excluding serial stream start sign) */ @@ -254,6 +332,20 @@ static inline uint16_t mavlink_msg_highres_imu_encode_chan(uint8_t system_id, ui return mavlink_msg_highres_imu_pack_chan(system_id, component_id, chan, msg, highres_imu->time_usec, highres_imu->xacc, highres_imu->yacc, highres_imu->zacc, highres_imu->xgyro, highres_imu->ygyro, highres_imu->zgyro, highres_imu->xmag, highres_imu->ymag, highres_imu->zmag, highres_imu->abs_pressure, highres_imu->diff_pressure, highres_imu->pressure_alt, highres_imu->temperature, highres_imu->fields_updated, highres_imu->id); } +/** + * @brief Encode a highres_imu struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param highres_imu C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_highres_imu_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_highres_imu_t* highres_imu) +{ + return mavlink_msg_highres_imu_pack_status(system_id, component_id, _status, msg, highres_imu->time_usec, highres_imu->xacc, highres_imu->yacc, highres_imu->zacc, highres_imu->xgyro, highres_imu->ygyro, highres_imu->zgyro, highres_imu->xmag, highres_imu->ymag, highres_imu->zmag, highres_imu->abs_pressure, highres_imu->diff_pressure, highres_imu->pressure_alt, highres_imu->temperature, highres_imu->fields_updated, highres_imu->id); +} + /** * @brief Send a highres_imu message * @param chan MAVLink channel to send the message @@ -272,7 +364,7 @@ static inline uint16_t mavlink_msg_highres_imu_encode_chan(uint8_t system_id, ui * @param diff_pressure [hPa] Differential pressure * @param pressure_alt Altitude calculated from pressure * @param temperature [degC] Temperature - * @param fields_updated Bitmap for fields that have updated since last message, bit 0 = xacc, bit 12: temperature + * @param fields_updated Bitmap for fields that have updated since last message * @param id Id. Ids are numbered from 0 and map to IMUs numbered from 1 (e.g. IMU1 will have a message with id=0) */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS @@ -338,7 +430,7 @@ static inline void mavlink_msg_highres_imu_send_struct(mavlink_channel_t chan, c #if MAVLINK_MSG_ID_HIGHRES_IMU_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -538,7 +630,7 @@ static inline float mavlink_msg_highres_imu_get_temperature(const mavlink_messag /** * @brief Get field fields_updated from highres_imu message * - * @return Bitmap for fields that have updated since last message, bit 0 = xacc, bit 12: temperature + * @return Bitmap for fields that have updated since last message */ static inline uint16_t mavlink_msg_highres_imu_get_fields_updated(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_hil_actuator_controls.h b/common/mavlink_msg_hil_actuator_controls.h index 31c28db42..5c4c275d4 100644 --- a/common/mavlink_msg_hil_actuator_controls.h +++ b/common/mavlink_msg_hil_actuator_controls.h @@ -6,7 +6,7 @@ typedef struct __mavlink_hil_actuator_controls_t { uint64_t time_usec; /*< [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.*/ - uint64_t flags; /*< Flags as bitfield, 1: indicate simulation using lockstep.*/ + uint64_t flags; /*< Flags bitmask.*/ float controls[16]; /*< Control outputs -1 .. 1. Channel assignment depends on the simulated hardware.*/ uint8_t mode; /*< System mode. Includes arming state.*/ } mavlink_hil_actuator_controls_t; @@ -53,7 +53,7 @@ typedef struct __mavlink_hil_actuator_controls_t { * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. * @param controls Control outputs -1 .. 1. Channel assignment depends on the simulated hardware. * @param mode System mode. Includes arming state. - * @param flags Flags as bitfield, 1: indicate simulation using lockstep. + * @param flags Flags bitmask. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_hil_actuator_controls_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, @@ -71,7 +71,7 @@ static inline uint16_t mavlink_msg_hil_actuator_controls_pack(uint8_t system_id, packet.time_usec = time_usec; packet.flags = flags; packet.mode = mode; - mav_array_memcpy(packet.controls, controls, sizeof(float)*16); + mav_array_assign_float(packet.controls, controls, 16); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS_LEN); #endif @@ -79,6 +79,46 @@ static inline uint16_t mavlink_msg_hil_actuator_controls_pack(uint8_t system_id, return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS_MIN_LEN, MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS_LEN, MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS_CRC); } +/** + * @brief Pack a hil_actuator_controls message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param controls Control outputs -1 .. 1. Channel assignment depends on the simulated hardware. + * @param mode System mode. Includes arming state. + * @param flags Flags bitmask. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_hil_actuator_controls_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, const float *controls, uint8_t mode, uint64_t flags) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint64_t(buf, 8, flags); + _mav_put_uint8_t(buf, 80, mode); + _mav_put_float_array(buf, 16, controls, 16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS_LEN); +#else + mavlink_hil_actuator_controls_t packet; + packet.time_usec = time_usec; + packet.flags = flags; + packet.mode = mode; + mav_array_memcpy(packet.controls, controls, sizeof(float)*16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS_MIN_LEN, MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS_LEN, MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS_MIN_LEN, MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS_LEN); +#endif +} + /** * @brief Pack a hil_actuator_controls message on a channel * @param system_id ID of this system @@ -88,7 +128,7 @@ static inline uint16_t mavlink_msg_hil_actuator_controls_pack(uint8_t system_id, * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. * @param controls Control outputs -1 .. 1. Channel assignment depends on the simulated hardware. * @param mode System mode. Includes arming state. - * @param flags Flags as bitfield, 1: indicate simulation using lockstep. + * @param flags Flags bitmask. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_hil_actuator_controls_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, @@ -107,7 +147,7 @@ static inline uint16_t mavlink_msg_hil_actuator_controls_pack_chan(uint8_t syste packet.time_usec = time_usec; packet.flags = flags; packet.mode = mode; - mav_array_memcpy(packet.controls, controls, sizeof(float)*16); + mav_array_assign_float(packet.controls, controls, 16); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS_LEN); #endif @@ -142,6 +182,20 @@ static inline uint16_t mavlink_msg_hil_actuator_controls_encode_chan(uint8_t sys return mavlink_msg_hil_actuator_controls_pack_chan(system_id, component_id, chan, msg, hil_actuator_controls->time_usec, hil_actuator_controls->controls, hil_actuator_controls->mode, hil_actuator_controls->flags); } +/** + * @brief Encode a hil_actuator_controls struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param hil_actuator_controls C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_hil_actuator_controls_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_hil_actuator_controls_t* hil_actuator_controls) +{ + return mavlink_msg_hil_actuator_controls_pack_status(system_id, component_id, _status, msg, hil_actuator_controls->time_usec, hil_actuator_controls->controls, hil_actuator_controls->mode, hil_actuator_controls->flags); +} + /** * @brief Send a hil_actuator_controls message * @param chan MAVLink channel to send the message @@ -149,7 +203,7 @@ static inline uint16_t mavlink_msg_hil_actuator_controls_encode_chan(uint8_t sys * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. * @param controls Control outputs -1 .. 1. Channel assignment depends on the simulated hardware. * @param mode System mode. Includes arming state. - * @param flags Flags as bitfield, 1: indicate simulation using lockstep. + * @param flags Flags bitmask. */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS @@ -167,7 +221,7 @@ static inline void mavlink_msg_hil_actuator_controls_send(mavlink_channel_t chan packet.time_usec = time_usec; packet.flags = flags; packet.mode = mode; - mav_array_memcpy(packet.controls, controls, sizeof(float)*16); + mav_array_assign_float(packet.controls, controls, 16); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS, (const char *)&packet, MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS_MIN_LEN, MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS_LEN, MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS_CRC); #endif } @@ -188,7 +242,7 @@ static inline void mavlink_msg_hil_actuator_controls_send_struct(mavlink_channel #if MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -208,7 +262,7 @@ static inline void mavlink_msg_hil_actuator_controls_send_buf(mavlink_message_t packet->time_usec = time_usec; packet->flags = flags; packet->mode = mode; - mav_array_memcpy(packet->controls, controls, sizeof(float)*16); + mav_array_assign_float(packet->controls, controls, 16); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS, (const char *)packet, MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS_MIN_LEN, MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS_LEN, MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS_CRC); #endif } @@ -252,7 +306,7 @@ static inline uint8_t mavlink_msg_hil_actuator_controls_get_mode(const mavlink_m /** * @brief Get field flags from hil_actuator_controls message * - * @return Flags as bitfield, 1: indicate simulation using lockstep. + * @return Flags bitmask. */ static inline uint64_t mavlink_msg_hil_actuator_controls_get_flags(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_hil_controls.h b/common/mavlink_msg_hil_controls.h index a3bd993bf..20482821c 100644 --- a/common/mavlink_msg_hil_controls.h +++ b/common/mavlink_msg_hil_controls.h @@ -123,6 +123,69 @@ static inline uint16_t mavlink_msg_hil_controls_pack(uint8_t system_id, uint8_t return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_CONTROLS_MIN_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_CRC); } +/** + * @brief Pack a hil_controls message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param roll_ailerons Control output -1 .. 1 + * @param pitch_elevator Control output -1 .. 1 + * @param yaw_rudder Control output -1 .. 1 + * @param throttle Throttle 0 .. 1 + * @param aux1 Aux 1, -1 .. 1 + * @param aux2 Aux 2, -1 .. 1 + * @param aux3 Aux 3, -1 .. 1 + * @param aux4 Aux 4, -1 .. 1 + * @param mode System mode. + * @param nav_mode Navigation mode (MAV_NAV_MODE) + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_hil_controls_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, float roll_ailerons, float pitch_elevator, float yaw_rudder, float throttle, float aux1, float aux2, float aux3, float aux4, uint8_t mode, uint8_t nav_mode) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_HIL_CONTROLS_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, roll_ailerons); + _mav_put_float(buf, 12, pitch_elevator); + _mav_put_float(buf, 16, yaw_rudder); + _mav_put_float(buf, 20, throttle); + _mav_put_float(buf, 24, aux1); + _mav_put_float(buf, 28, aux2); + _mav_put_float(buf, 32, aux3); + _mav_put_float(buf, 36, aux4); + _mav_put_uint8_t(buf, 40, mode); + _mav_put_uint8_t(buf, 41, nav_mode); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_CONTROLS_LEN); +#else + mavlink_hil_controls_t packet; + packet.time_usec = time_usec; + packet.roll_ailerons = roll_ailerons; + packet.pitch_elevator = pitch_elevator; + packet.yaw_rudder = yaw_rudder; + packet.throttle = throttle; + packet.aux1 = aux1; + packet.aux2 = aux2; + packet.aux3 = aux3; + packet.aux4 = aux4; + packet.mode = mode; + packet.nav_mode = nav_mode; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_CONTROLS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_HIL_CONTROLS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HIL_CONTROLS_MIN_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HIL_CONTROLS_MIN_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_LEN); +#endif +} + /** * @brief Pack a hil_controls message on a channel * @param system_id ID of this system @@ -209,6 +272,20 @@ static inline uint16_t mavlink_msg_hil_controls_encode_chan(uint8_t system_id, u return mavlink_msg_hil_controls_pack_chan(system_id, component_id, chan, msg, hil_controls->time_usec, hil_controls->roll_ailerons, hil_controls->pitch_elevator, hil_controls->yaw_rudder, hil_controls->throttle, hil_controls->aux1, hil_controls->aux2, hil_controls->aux3, hil_controls->aux4, hil_controls->mode, hil_controls->nav_mode); } +/** + * @brief Encode a hil_controls struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param hil_controls C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_hil_controls_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_hil_controls_t* hil_controls) +{ + return mavlink_msg_hil_controls_pack_status(system_id, component_id, _status, msg, hil_controls->time_usec, hil_controls->roll_ailerons, hil_controls->pitch_elevator, hil_controls->yaw_rudder, hil_controls->throttle, hil_controls->aux1, hil_controls->aux2, hil_controls->aux3, hil_controls->aux4, hil_controls->mode, hil_controls->nav_mode); +} + /** * @brief Send a hil_controls message * @param chan MAVLink channel to send the message @@ -278,7 +355,7 @@ static inline void mavlink_msg_hil_controls_send_struct(mavlink_channel_t chan, #if MAVLINK_MSG_ID_HIL_CONTROLS_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_hil_gps.h b/common/mavlink_msg_hil_gps.h index 4b8ff2b85..b8690f4c8 100644 --- a/common/mavlink_msg_hil_gps.h +++ b/common/mavlink_msg_hil_gps.h @@ -9,15 +9,15 @@ typedef struct __mavlink_hil_gps_t { int32_t lat; /*< [degE7] Latitude (WGS84)*/ int32_t lon; /*< [degE7] Longitude (WGS84)*/ int32_t alt; /*< [mm] Altitude (MSL). Positive for up.*/ - uint16_t eph; /*< GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX*/ - uint16_t epv; /*< GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX*/ - uint16_t vel; /*< [cm/s] GPS ground speed. If unknown, set to: 65535*/ + uint16_t eph; /*< GPS HDOP horizontal dilution of position (unitless * 100). If unknown, set to: UINT16_MAX*/ + uint16_t epv; /*< GPS VDOP vertical dilution of position (unitless * 100). If unknown, set to: UINT16_MAX*/ + uint16_t vel; /*< [cm/s] GPS ground speed. If unknown, set to: UINT16_MAX*/ int16_t vn; /*< [cm/s] GPS velocity in north direction in earth-fixed NED frame*/ int16_t ve; /*< [cm/s] GPS velocity in east direction in earth-fixed NED frame*/ int16_t vd; /*< [cm/s] GPS velocity in down direction in earth-fixed NED frame*/ - uint16_t cog; /*< [cdeg] Course over ground (NOT heading, but direction of movement), 0.0..359.99 degrees. If unknown, set to: 65535*/ + uint16_t cog; /*< [cdeg] Course over ground (NOT heading, but direction of movement), 0.0..359.99 degrees. If unknown, set to: UINT16_MAX*/ uint8_t fix_type; /*< 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix.*/ - uint8_t satellites_visible; /*< Number of satellites visible. If unknown, set to 255*/ + uint8_t satellites_visible; /*< Number of satellites visible. If unknown, set to UINT8_MAX*/ uint8_t id; /*< GPS ID (zero indexed). Used for multiple GPS inputs*/ uint16_t yaw; /*< [cdeg] Yaw of vehicle relative to Earth's North, zero means not available, use 36000 for north*/ }) mavlink_hil_gps_t; @@ -88,14 +88,14 @@ typedef struct __mavlink_hil_gps_t { * @param lat [degE7] Latitude (WGS84) * @param lon [degE7] Longitude (WGS84) * @param alt [mm] Altitude (MSL). Positive for up. - * @param eph GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX - * @param epv GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX - * @param vel [cm/s] GPS ground speed. If unknown, set to: 65535 + * @param eph GPS HDOP horizontal dilution of position (unitless * 100). If unknown, set to: UINT16_MAX + * @param epv GPS VDOP vertical dilution of position (unitless * 100). If unknown, set to: UINT16_MAX + * @param vel [cm/s] GPS ground speed. If unknown, set to: UINT16_MAX * @param vn [cm/s] GPS velocity in north direction in earth-fixed NED frame * @param ve [cm/s] GPS velocity in east direction in earth-fixed NED frame * @param vd [cm/s] GPS velocity in down direction in earth-fixed NED frame - * @param cog [cdeg] Course over ground (NOT heading, but direction of movement), 0.0..359.99 degrees. If unknown, set to: 65535 - * @param satellites_visible Number of satellites visible. If unknown, set to 255 + * @param cog [cdeg] Course over ground (NOT heading, but direction of movement), 0.0..359.99 degrees. If unknown, set to: UINT16_MAX + * @param satellites_visible Number of satellites visible. If unknown, set to UINT8_MAX * @param id GPS ID (zero indexed). Used for multiple GPS inputs * @param yaw [cdeg] Yaw of vehicle relative to Earth's North, zero means not available, use 36000 for north * @return length of the message in bytes (excluding serial stream start sign) @@ -147,6 +147,81 @@ static inline uint16_t mavlink_msg_hil_gps_pack(uint8_t system_id, uint8_t compo return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_GPS_MIN_LEN, MAVLINK_MSG_ID_HIL_GPS_LEN, MAVLINK_MSG_ID_HIL_GPS_CRC); } +/** + * @brief Pack a hil_gps message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param fix_type 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix. + * @param lat [degE7] Latitude (WGS84) + * @param lon [degE7] Longitude (WGS84) + * @param alt [mm] Altitude (MSL). Positive for up. + * @param eph GPS HDOP horizontal dilution of position (unitless * 100). If unknown, set to: UINT16_MAX + * @param epv GPS VDOP vertical dilution of position (unitless * 100). If unknown, set to: UINT16_MAX + * @param vel [cm/s] GPS ground speed. If unknown, set to: UINT16_MAX + * @param vn [cm/s] GPS velocity in north direction in earth-fixed NED frame + * @param ve [cm/s] GPS velocity in east direction in earth-fixed NED frame + * @param vd [cm/s] GPS velocity in down direction in earth-fixed NED frame + * @param cog [cdeg] Course over ground (NOT heading, but direction of movement), 0.0..359.99 degrees. If unknown, set to: UINT16_MAX + * @param satellites_visible Number of satellites visible. If unknown, set to UINT8_MAX + * @param id GPS ID (zero indexed). Used for multiple GPS inputs + * @param yaw [cdeg] Yaw of vehicle relative to Earth's North, zero means not available, use 36000 for north + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_hil_gps_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, uint8_t fix_type, int32_t lat, int32_t lon, int32_t alt, uint16_t eph, uint16_t epv, uint16_t vel, int16_t vn, int16_t ve, int16_t vd, uint16_t cog, uint8_t satellites_visible, uint8_t id, uint16_t yaw) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_HIL_GPS_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_int32_t(buf, 16, alt); + _mav_put_uint16_t(buf, 20, eph); + _mav_put_uint16_t(buf, 22, epv); + _mav_put_uint16_t(buf, 24, vel); + _mav_put_int16_t(buf, 26, vn); + _mav_put_int16_t(buf, 28, ve); + _mav_put_int16_t(buf, 30, vd); + _mav_put_uint16_t(buf, 32, cog); + _mav_put_uint8_t(buf, 34, fix_type); + _mav_put_uint8_t(buf, 35, satellites_visible); + _mav_put_uint8_t(buf, 36, id); + _mav_put_uint16_t(buf, 37, yaw); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_GPS_LEN); +#else + mavlink_hil_gps_t packet; + packet.time_usec = time_usec; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.eph = eph; + packet.epv = epv; + packet.vel = vel; + packet.vn = vn; + packet.ve = ve; + packet.vd = vd; + packet.cog = cog; + packet.fix_type = fix_type; + packet.satellites_visible = satellites_visible; + packet.id = id; + packet.yaw = yaw; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_GPS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_HIL_GPS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HIL_GPS_MIN_LEN, MAVLINK_MSG_ID_HIL_GPS_LEN, MAVLINK_MSG_ID_HIL_GPS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HIL_GPS_MIN_LEN, MAVLINK_MSG_ID_HIL_GPS_LEN); +#endif +} + /** * @brief Pack a hil_gps message on a channel * @param system_id ID of this system @@ -158,14 +233,14 @@ static inline uint16_t mavlink_msg_hil_gps_pack(uint8_t system_id, uint8_t compo * @param lat [degE7] Latitude (WGS84) * @param lon [degE7] Longitude (WGS84) * @param alt [mm] Altitude (MSL). Positive for up. - * @param eph GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX - * @param epv GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX - * @param vel [cm/s] GPS ground speed. If unknown, set to: 65535 + * @param eph GPS HDOP horizontal dilution of position (unitless * 100). If unknown, set to: UINT16_MAX + * @param epv GPS VDOP vertical dilution of position (unitless * 100). If unknown, set to: UINT16_MAX + * @param vel [cm/s] GPS ground speed. If unknown, set to: UINT16_MAX * @param vn [cm/s] GPS velocity in north direction in earth-fixed NED frame * @param ve [cm/s] GPS velocity in east direction in earth-fixed NED frame * @param vd [cm/s] GPS velocity in down direction in earth-fixed NED frame - * @param cog [cdeg] Course over ground (NOT heading, but direction of movement), 0.0..359.99 degrees. If unknown, set to: 65535 - * @param satellites_visible Number of satellites visible. If unknown, set to 255 + * @param cog [cdeg] Course over ground (NOT heading, but direction of movement), 0.0..359.99 degrees. If unknown, set to: UINT16_MAX + * @param satellites_visible Number of satellites visible. If unknown, set to UINT8_MAX * @param id GPS ID (zero indexed). Used for multiple GPS inputs * @param yaw [cdeg] Yaw of vehicle relative to Earth's North, zero means not available, use 36000 for north * @return length of the message in bytes (excluding serial stream start sign) @@ -245,6 +320,20 @@ static inline uint16_t mavlink_msg_hil_gps_encode_chan(uint8_t system_id, uint8_ return mavlink_msg_hil_gps_pack_chan(system_id, component_id, chan, msg, hil_gps->time_usec, hil_gps->fix_type, hil_gps->lat, hil_gps->lon, hil_gps->alt, hil_gps->eph, hil_gps->epv, hil_gps->vel, hil_gps->vn, hil_gps->ve, hil_gps->vd, hil_gps->cog, hil_gps->satellites_visible, hil_gps->id, hil_gps->yaw); } +/** + * @brief Encode a hil_gps struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param hil_gps C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_hil_gps_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_hil_gps_t* hil_gps) +{ + return mavlink_msg_hil_gps_pack_status(system_id, component_id, _status, msg, hil_gps->time_usec, hil_gps->fix_type, hil_gps->lat, hil_gps->lon, hil_gps->alt, hil_gps->eph, hil_gps->epv, hil_gps->vel, hil_gps->vn, hil_gps->ve, hil_gps->vd, hil_gps->cog, hil_gps->satellites_visible, hil_gps->id, hil_gps->yaw); +} + /** * @brief Send a hil_gps message * @param chan MAVLink channel to send the message @@ -254,14 +343,14 @@ static inline uint16_t mavlink_msg_hil_gps_encode_chan(uint8_t system_id, uint8_ * @param lat [degE7] Latitude (WGS84) * @param lon [degE7] Longitude (WGS84) * @param alt [mm] Altitude (MSL). Positive for up. - * @param eph GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX - * @param epv GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX - * @param vel [cm/s] GPS ground speed. If unknown, set to: 65535 + * @param eph GPS HDOP horizontal dilution of position (unitless * 100). If unknown, set to: UINT16_MAX + * @param epv GPS VDOP vertical dilution of position (unitless * 100). If unknown, set to: UINT16_MAX + * @param vel [cm/s] GPS ground speed. If unknown, set to: UINT16_MAX * @param vn [cm/s] GPS velocity in north direction in earth-fixed NED frame * @param ve [cm/s] GPS velocity in east direction in earth-fixed NED frame * @param vd [cm/s] GPS velocity in down direction in earth-fixed NED frame - * @param cog [cdeg] Course over ground (NOT heading, but direction of movement), 0.0..359.99 degrees. If unknown, set to: 65535 - * @param satellites_visible Number of satellites visible. If unknown, set to 255 + * @param cog [cdeg] Course over ground (NOT heading, but direction of movement), 0.0..359.99 degrees. If unknown, set to: UINT16_MAX + * @param satellites_visible Number of satellites visible. If unknown, set to UINT8_MAX * @param id GPS ID (zero indexed). Used for multiple GPS inputs * @param yaw [cdeg] Yaw of vehicle relative to Earth's North, zero means not available, use 36000 for north */ @@ -326,7 +415,7 @@ static inline void mavlink_msg_hil_gps_send_struct(mavlink_channel_t chan, const #if MAVLINK_MSG_ID_HIL_GPS_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -434,7 +523,7 @@ static inline int32_t mavlink_msg_hil_gps_get_alt(const mavlink_message_t* msg) /** * @brief Get field eph from hil_gps message * - * @return GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX + * @return GPS HDOP horizontal dilution of position (unitless * 100). If unknown, set to: UINT16_MAX */ static inline uint16_t mavlink_msg_hil_gps_get_eph(const mavlink_message_t* msg) { @@ -444,7 +533,7 @@ static inline uint16_t mavlink_msg_hil_gps_get_eph(const mavlink_message_t* msg) /** * @brief Get field epv from hil_gps message * - * @return GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX + * @return GPS VDOP vertical dilution of position (unitless * 100). If unknown, set to: UINT16_MAX */ static inline uint16_t mavlink_msg_hil_gps_get_epv(const mavlink_message_t* msg) { @@ -454,7 +543,7 @@ static inline uint16_t mavlink_msg_hil_gps_get_epv(const mavlink_message_t* msg) /** * @brief Get field vel from hil_gps message * - * @return [cm/s] GPS ground speed. If unknown, set to: 65535 + * @return [cm/s] GPS ground speed. If unknown, set to: UINT16_MAX */ static inline uint16_t mavlink_msg_hil_gps_get_vel(const mavlink_message_t* msg) { @@ -494,7 +583,7 @@ static inline int16_t mavlink_msg_hil_gps_get_vd(const mavlink_message_t* msg) /** * @brief Get field cog from hil_gps message * - * @return [cdeg] Course over ground (NOT heading, but direction of movement), 0.0..359.99 degrees. If unknown, set to: 65535 + * @return [cdeg] Course over ground (NOT heading, but direction of movement), 0.0..359.99 degrees. If unknown, set to: UINT16_MAX */ static inline uint16_t mavlink_msg_hil_gps_get_cog(const mavlink_message_t* msg) { @@ -504,7 +593,7 @@ static inline uint16_t mavlink_msg_hil_gps_get_cog(const mavlink_message_t* msg) /** * @brief Get field satellites_visible from hil_gps message * - * @return Number of satellites visible. If unknown, set to 255 + * @return Number of satellites visible. If unknown, set to UINT8_MAX */ static inline uint8_t mavlink_msg_hil_gps_get_satellites_visible(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_hil_optical_flow.h b/common/mavlink_msg_hil_optical_flow.h index 98c61fd5e..f592b1b79 100644 --- a/common/mavlink_msg_hil_optical_flow.h +++ b/common/mavlink_msg_hil_optical_flow.h @@ -129,6 +129,72 @@ static inline uint16_t mavlink_msg_hil_optical_flow_pack(uint8_t system_id, uint return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_MIN_LEN, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_CRC); } +/** + * @brief Pack a hil_optical_flow message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param sensor_id Sensor ID + * @param integration_time_us [us] Integration time. Divide integrated_x and integrated_y by the integration time to obtain average flow. The integration time also indicates the. + * @param integrated_x [rad] Flow in radians around X axis (Sensor RH rotation about the X axis induces a positive flow. Sensor linear motion along the positive Y axis induces a negative flow.) + * @param integrated_y [rad] Flow in radians around Y axis (Sensor RH rotation about the Y axis induces a positive flow. Sensor linear motion along the positive X axis induces a positive flow.) + * @param integrated_xgyro [rad] RH rotation around X axis + * @param integrated_ygyro [rad] RH rotation around Y axis + * @param integrated_zgyro [rad] RH rotation around Z axis + * @param temperature [cdegC] Temperature + * @param quality Optical flow quality / confidence. 0: no valid flow, 255: maximum quality + * @param time_delta_distance_us [us] Time since the distance was sampled. + * @param distance [m] Distance to the center of the flow field. Positive value (including zero): distance known. Negative value: Unknown distance. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_hil_optical_flow_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, uint8_t sensor_id, uint32_t integration_time_us, float integrated_x, float integrated_y, float integrated_xgyro, float integrated_ygyro, float integrated_zgyro, int16_t temperature, uint8_t quality, uint32_t time_delta_distance_us, float distance) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint32_t(buf, 8, integration_time_us); + _mav_put_float(buf, 12, integrated_x); + _mav_put_float(buf, 16, integrated_y); + _mav_put_float(buf, 20, integrated_xgyro); + _mav_put_float(buf, 24, integrated_ygyro); + _mav_put_float(buf, 28, integrated_zgyro); + _mav_put_uint32_t(buf, 32, time_delta_distance_us); + _mav_put_float(buf, 36, distance); + _mav_put_int16_t(buf, 40, temperature); + _mav_put_uint8_t(buf, 42, sensor_id); + _mav_put_uint8_t(buf, 43, quality); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN); +#else + mavlink_hil_optical_flow_t packet; + packet.time_usec = time_usec; + packet.integration_time_us = integration_time_us; + packet.integrated_x = integrated_x; + packet.integrated_y = integrated_y; + packet.integrated_xgyro = integrated_xgyro; + packet.integrated_ygyro = integrated_ygyro; + packet.integrated_zgyro = integrated_zgyro; + packet.time_delta_distance_us = time_delta_distance_us; + packet.distance = distance; + packet.temperature = temperature; + packet.sensor_id = sensor_id; + packet.quality = quality; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_HIL_OPTICAL_FLOW; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_MIN_LEN, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_MIN_LEN, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN); +#endif +} + /** * @brief Pack a hil_optical_flow message on a channel * @param system_id ID of this system @@ -218,6 +284,20 @@ static inline uint16_t mavlink_msg_hil_optical_flow_encode_chan(uint8_t system_i return mavlink_msg_hil_optical_flow_pack_chan(system_id, component_id, chan, msg, hil_optical_flow->time_usec, hil_optical_flow->sensor_id, hil_optical_flow->integration_time_us, hil_optical_flow->integrated_x, hil_optical_flow->integrated_y, hil_optical_flow->integrated_xgyro, hil_optical_flow->integrated_ygyro, hil_optical_flow->integrated_zgyro, hil_optical_flow->temperature, hil_optical_flow->quality, hil_optical_flow->time_delta_distance_us, hil_optical_flow->distance); } +/** + * @brief Encode a hil_optical_flow struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param hil_optical_flow C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_hil_optical_flow_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_hil_optical_flow_t* hil_optical_flow) +{ + return mavlink_msg_hil_optical_flow_pack_status(system_id, component_id, _status, msg, hil_optical_flow->time_usec, hil_optical_flow->sensor_id, hil_optical_flow->integration_time_us, hil_optical_flow->integrated_x, hil_optical_flow->integrated_y, hil_optical_flow->integrated_xgyro, hil_optical_flow->integrated_ygyro, hil_optical_flow->integrated_zgyro, hil_optical_flow->temperature, hil_optical_flow->quality, hil_optical_flow->time_delta_distance_us, hil_optical_flow->distance); +} + /** * @brief Send a hil_optical_flow message * @param chan MAVLink channel to send the message @@ -290,7 +370,7 @@ static inline void mavlink_msg_hil_optical_flow_send_struct(mavlink_channel_t ch #if MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_hil_rc_inputs_raw.h b/common/mavlink_msg_hil_rc_inputs_raw.h index 28ce091ab..da581132d 100644 --- a/common/mavlink_msg_hil_rc_inputs_raw.h +++ b/common/mavlink_msg_hil_rc_inputs_raw.h @@ -18,7 +18,7 @@ typedef struct __mavlink_hil_rc_inputs_raw_t { uint16_t chan10_raw; /*< [us] RC channel 10 value*/ uint16_t chan11_raw; /*< [us] RC channel 11 value*/ uint16_t chan12_raw; /*< [us] RC channel 12 value*/ - uint8_t rssi; /*< Receive signal strength indicator in device-dependent units/scale. Values: [0-254], 255: invalid/unknown.*/ + uint8_t rssi; /*< Receive signal strength indicator in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown.*/ } mavlink_hil_rc_inputs_raw_t; #define MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW_LEN 33 @@ -93,7 +93,7 @@ typedef struct __mavlink_hil_rc_inputs_raw_t { * @param chan10_raw [us] RC channel 10 value * @param chan11_raw [us] RC channel 11 value * @param chan12_raw [us] RC channel 12 value - * @param rssi Receive signal strength indicator in device-dependent units/scale. Values: [0-254], 255: invalid/unknown. + * @param rssi Receive signal strength indicator in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_hil_rc_inputs_raw_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, @@ -141,6 +141,78 @@ static inline uint16_t mavlink_msg_hil_rc_inputs_raw_pack(uint8_t system_id, uin return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW_MIN_LEN, MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW_LEN, MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW_CRC); } +/** + * @brief Pack a hil_rc_inputs_raw message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param chan1_raw [us] RC channel 1 value + * @param chan2_raw [us] RC channel 2 value + * @param chan3_raw [us] RC channel 3 value + * @param chan4_raw [us] RC channel 4 value + * @param chan5_raw [us] RC channel 5 value + * @param chan6_raw [us] RC channel 6 value + * @param chan7_raw [us] RC channel 7 value + * @param chan8_raw [us] RC channel 8 value + * @param chan9_raw [us] RC channel 9 value + * @param chan10_raw [us] RC channel 10 value + * @param chan11_raw [us] RC channel 11 value + * @param chan12_raw [us] RC channel 12 value + * @param rssi Receive signal strength indicator in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_hil_rc_inputs_raw_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, uint16_t chan1_raw, uint16_t chan2_raw, uint16_t chan3_raw, uint16_t chan4_raw, uint16_t chan5_raw, uint16_t chan6_raw, uint16_t chan7_raw, uint16_t chan8_raw, uint16_t chan9_raw, uint16_t chan10_raw, uint16_t chan11_raw, uint16_t chan12_raw, uint8_t rssi) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint16_t(buf, 8, chan1_raw); + _mav_put_uint16_t(buf, 10, chan2_raw); + _mav_put_uint16_t(buf, 12, chan3_raw); + _mav_put_uint16_t(buf, 14, chan4_raw); + _mav_put_uint16_t(buf, 16, chan5_raw); + _mav_put_uint16_t(buf, 18, chan6_raw); + _mav_put_uint16_t(buf, 20, chan7_raw); + _mav_put_uint16_t(buf, 22, chan8_raw); + _mav_put_uint16_t(buf, 24, chan9_raw); + _mav_put_uint16_t(buf, 26, chan10_raw); + _mav_put_uint16_t(buf, 28, chan11_raw); + _mav_put_uint16_t(buf, 30, chan12_raw); + _mav_put_uint8_t(buf, 32, rssi); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW_LEN); +#else + mavlink_hil_rc_inputs_raw_t packet; + packet.time_usec = time_usec; + packet.chan1_raw = chan1_raw; + packet.chan2_raw = chan2_raw; + packet.chan3_raw = chan3_raw; + packet.chan4_raw = chan4_raw; + packet.chan5_raw = chan5_raw; + packet.chan6_raw = chan6_raw; + packet.chan7_raw = chan7_raw; + packet.chan8_raw = chan8_raw; + packet.chan9_raw = chan9_raw; + packet.chan10_raw = chan10_raw; + packet.chan11_raw = chan11_raw; + packet.chan12_raw = chan12_raw; + packet.rssi = rssi; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW_MIN_LEN, MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW_LEN, MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW_MIN_LEN, MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW_LEN); +#endif +} + /** * @brief Pack a hil_rc_inputs_raw message on a channel * @param system_id ID of this system @@ -160,7 +232,7 @@ static inline uint16_t mavlink_msg_hil_rc_inputs_raw_pack(uint8_t system_id, uin * @param chan10_raw [us] RC channel 10 value * @param chan11_raw [us] RC channel 11 value * @param chan12_raw [us] RC channel 12 value - * @param rssi Receive signal strength indicator in device-dependent units/scale. Values: [0-254], 255: invalid/unknown. + * @param rssi Receive signal strength indicator in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_hil_rc_inputs_raw_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, @@ -236,6 +308,20 @@ static inline uint16_t mavlink_msg_hil_rc_inputs_raw_encode_chan(uint8_t system_ return mavlink_msg_hil_rc_inputs_raw_pack_chan(system_id, component_id, chan, msg, hil_rc_inputs_raw->time_usec, hil_rc_inputs_raw->chan1_raw, hil_rc_inputs_raw->chan2_raw, hil_rc_inputs_raw->chan3_raw, hil_rc_inputs_raw->chan4_raw, hil_rc_inputs_raw->chan5_raw, hil_rc_inputs_raw->chan6_raw, hil_rc_inputs_raw->chan7_raw, hil_rc_inputs_raw->chan8_raw, hil_rc_inputs_raw->chan9_raw, hil_rc_inputs_raw->chan10_raw, hil_rc_inputs_raw->chan11_raw, hil_rc_inputs_raw->chan12_raw, hil_rc_inputs_raw->rssi); } +/** + * @brief Encode a hil_rc_inputs_raw struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param hil_rc_inputs_raw C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_hil_rc_inputs_raw_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_hil_rc_inputs_raw_t* hil_rc_inputs_raw) +{ + return mavlink_msg_hil_rc_inputs_raw_pack_status(system_id, component_id, _status, msg, hil_rc_inputs_raw->time_usec, hil_rc_inputs_raw->chan1_raw, hil_rc_inputs_raw->chan2_raw, hil_rc_inputs_raw->chan3_raw, hil_rc_inputs_raw->chan4_raw, hil_rc_inputs_raw->chan5_raw, hil_rc_inputs_raw->chan6_raw, hil_rc_inputs_raw->chan7_raw, hil_rc_inputs_raw->chan8_raw, hil_rc_inputs_raw->chan9_raw, hil_rc_inputs_raw->chan10_raw, hil_rc_inputs_raw->chan11_raw, hil_rc_inputs_raw->chan12_raw, hil_rc_inputs_raw->rssi); +} + /** * @brief Send a hil_rc_inputs_raw message * @param chan MAVLink channel to send the message @@ -253,7 +339,7 @@ static inline uint16_t mavlink_msg_hil_rc_inputs_raw_encode_chan(uint8_t system_ * @param chan10_raw [us] RC channel 10 value * @param chan11_raw [us] RC channel 11 value * @param chan12_raw [us] RC channel 12 value - * @param rssi Receive signal strength indicator in device-dependent units/scale. Values: [0-254], 255: invalid/unknown. + * @param rssi Receive signal strength indicator in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown. */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS @@ -314,7 +400,7 @@ static inline void mavlink_msg_hil_rc_inputs_raw_send_struct(mavlink_channel_t c #if MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -500,7 +586,7 @@ static inline uint16_t mavlink_msg_hil_rc_inputs_raw_get_chan12_raw(const mavlin /** * @brief Get field rssi from hil_rc_inputs_raw message * - * @return Receive signal strength indicator in device-dependent units/scale. Values: [0-254], 255: invalid/unknown. + * @return Receive signal strength indicator in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown. */ static inline uint8_t mavlink_msg_hil_rc_inputs_raw_get_rssi(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_hil_sensor.h b/common/mavlink_msg_hil_sensor.h index 007c5a698..290465d83 100644 --- a/common/mavlink_msg_hil_sensor.h +++ b/common/mavlink_msg_hil_sensor.h @@ -19,7 +19,7 @@ typedef struct __mavlink_hil_sensor_t { float diff_pressure; /*< [hPa] Differential pressure (airspeed)*/ float pressure_alt; /*< Altitude calculated from pressure*/ float temperature; /*< [degC] Temperature*/ - uint32_t fields_updated; /*< Bitmap for fields that have updated since last message, bit 0 = xacc, bit 12: temperature, bit 31: full reset of attitude/position/velocities/etc was performed in sim.*/ + uint32_t fields_updated; /*< Bitmap for fields that have updated since last message*/ uint8_t id; /*< Sensor ID (zero indexed). Used for multiple sensor inputs*/ } mavlink_hil_sensor_t; @@ -100,7 +100,7 @@ typedef struct __mavlink_hil_sensor_t { * @param diff_pressure [hPa] Differential pressure (airspeed) * @param pressure_alt Altitude calculated from pressure * @param temperature [degC] Temperature - * @param fields_updated Bitmap for fields that have updated since last message, bit 0 = xacc, bit 12: temperature, bit 31: full reset of attitude/position/velocities/etc was performed in sim. + * @param fields_updated Bitmap for fields that have updated since last message * @param id Sensor ID (zero indexed). Used for multiple sensor inputs * @return length of the message in bytes (excluding serial stream start sign) */ @@ -153,6 +153,84 @@ static inline uint16_t mavlink_msg_hil_sensor_pack(uint8_t system_id, uint8_t co return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_SENSOR_MIN_LEN, MAVLINK_MSG_ID_HIL_SENSOR_LEN, MAVLINK_MSG_ID_HIL_SENSOR_CRC); } +/** + * @brief Pack a hil_sensor message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param xacc [m/s/s] X acceleration + * @param yacc [m/s/s] Y acceleration + * @param zacc [m/s/s] Z acceleration + * @param xgyro [rad/s] Angular speed around X axis in body frame + * @param ygyro [rad/s] Angular speed around Y axis in body frame + * @param zgyro [rad/s] Angular speed around Z axis in body frame + * @param xmag [gauss] X Magnetic field + * @param ymag [gauss] Y Magnetic field + * @param zmag [gauss] Z Magnetic field + * @param abs_pressure [hPa] Absolute pressure + * @param diff_pressure [hPa] Differential pressure (airspeed) + * @param pressure_alt Altitude calculated from pressure + * @param temperature [degC] Temperature + * @param fields_updated Bitmap for fields that have updated since last message + * @param id Sensor ID (zero indexed). Used for multiple sensor inputs + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_hil_sensor_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, uint32_t fields_updated, uint8_t id) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_HIL_SENSOR_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, xacc); + _mav_put_float(buf, 12, yacc); + _mav_put_float(buf, 16, zacc); + _mav_put_float(buf, 20, xgyro); + _mav_put_float(buf, 24, ygyro); + _mav_put_float(buf, 28, zgyro); + _mav_put_float(buf, 32, xmag); + _mav_put_float(buf, 36, ymag); + _mav_put_float(buf, 40, zmag); + _mav_put_float(buf, 44, abs_pressure); + _mav_put_float(buf, 48, diff_pressure); + _mav_put_float(buf, 52, pressure_alt); + _mav_put_float(buf, 56, temperature); + _mav_put_uint32_t(buf, 60, fields_updated); + _mav_put_uint8_t(buf, 64, id); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_SENSOR_LEN); +#else + mavlink_hil_sensor_t packet; + packet.time_usec = time_usec; + packet.xacc = xacc; + packet.yacc = yacc; + packet.zacc = zacc; + packet.xgyro = xgyro; + packet.ygyro = ygyro; + packet.zgyro = zgyro; + packet.xmag = xmag; + packet.ymag = ymag; + packet.zmag = zmag; + packet.abs_pressure = abs_pressure; + packet.diff_pressure = diff_pressure; + packet.pressure_alt = pressure_alt; + packet.temperature = temperature; + packet.fields_updated = fields_updated; + packet.id = id; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_SENSOR_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_HIL_SENSOR; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HIL_SENSOR_MIN_LEN, MAVLINK_MSG_ID_HIL_SENSOR_LEN, MAVLINK_MSG_ID_HIL_SENSOR_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HIL_SENSOR_MIN_LEN, MAVLINK_MSG_ID_HIL_SENSOR_LEN); +#endif +} + /** * @brief Pack a hil_sensor message on a channel * @param system_id ID of this system @@ -173,7 +251,7 @@ static inline uint16_t mavlink_msg_hil_sensor_pack(uint8_t system_id, uint8_t co * @param diff_pressure [hPa] Differential pressure (airspeed) * @param pressure_alt Altitude calculated from pressure * @param temperature [degC] Temperature - * @param fields_updated Bitmap for fields that have updated since last message, bit 0 = xacc, bit 12: temperature, bit 31: full reset of attitude/position/velocities/etc was performed in sim. + * @param fields_updated Bitmap for fields that have updated since last message * @param id Sensor ID (zero indexed). Used for multiple sensor inputs * @return length of the message in bytes (excluding serial stream start sign) */ @@ -254,6 +332,20 @@ static inline uint16_t mavlink_msg_hil_sensor_encode_chan(uint8_t system_id, uin return mavlink_msg_hil_sensor_pack_chan(system_id, component_id, chan, msg, hil_sensor->time_usec, hil_sensor->xacc, hil_sensor->yacc, hil_sensor->zacc, hil_sensor->xgyro, hil_sensor->ygyro, hil_sensor->zgyro, hil_sensor->xmag, hil_sensor->ymag, hil_sensor->zmag, hil_sensor->abs_pressure, hil_sensor->diff_pressure, hil_sensor->pressure_alt, hil_sensor->temperature, hil_sensor->fields_updated, hil_sensor->id); } +/** + * @brief Encode a hil_sensor struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param hil_sensor C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_hil_sensor_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_hil_sensor_t* hil_sensor) +{ + return mavlink_msg_hil_sensor_pack_status(system_id, component_id, _status, msg, hil_sensor->time_usec, hil_sensor->xacc, hil_sensor->yacc, hil_sensor->zacc, hil_sensor->xgyro, hil_sensor->ygyro, hil_sensor->zgyro, hil_sensor->xmag, hil_sensor->ymag, hil_sensor->zmag, hil_sensor->abs_pressure, hil_sensor->diff_pressure, hil_sensor->pressure_alt, hil_sensor->temperature, hil_sensor->fields_updated, hil_sensor->id); +} + /** * @brief Send a hil_sensor message * @param chan MAVLink channel to send the message @@ -272,7 +364,7 @@ static inline uint16_t mavlink_msg_hil_sensor_encode_chan(uint8_t system_id, uin * @param diff_pressure [hPa] Differential pressure (airspeed) * @param pressure_alt Altitude calculated from pressure * @param temperature [degC] Temperature - * @param fields_updated Bitmap for fields that have updated since last message, bit 0 = xacc, bit 12: temperature, bit 31: full reset of attitude/position/velocities/etc was performed in sim. + * @param fields_updated Bitmap for fields that have updated since last message * @param id Sensor ID (zero indexed). Used for multiple sensor inputs */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS @@ -338,7 +430,7 @@ static inline void mavlink_msg_hil_sensor_send_struct(mavlink_channel_t chan, co #if MAVLINK_MSG_ID_HIL_SENSOR_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -538,7 +630,7 @@ static inline float mavlink_msg_hil_sensor_get_temperature(const mavlink_message /** * @brief Get field fields_updated from hil_sensor message * - * @return Bitmap for fields that have updated since last message, bit 0 = xacc, bit 12: temperature, bit 31: full reset of attitude/position/velocities/etc was performed in sim. + * @return Bitmap for fields that have updated since last message */ static inline uint32_t mavlink_msg_hil_sensor_get_fields_updated(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_hil_state.h b/common/mavlink_msg_hil_state.h index e5c4ed809..3bbeb309d 100644 --- a/common/mavlink_msg_hil_state.h +++ b/common/mavlink_msg_hil_state.h @@ -153,6 +153,84 @@ static inline uint16_t mavlink_msg_hil_state_pack(uint8_t system_id, uint8_t com return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_STATE_MIN_LEN, MAVLINK_MSG_ID_HIL_STATE_LEN, MAVLINK_MSG_ID_HIL_STATE_CRC); } +/** + * @brief Pack a hil_state message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param roll [rad] Roll angle + * @param pitch [rad] Pitch angle + * @param yaw [rad] Yaw angle + * @param rollspeed [rad/s] Body frame roll / phi angular speed + * @param pitchspeed [rad/s] Body frame pitch / theta angular speed + * @param yawspeed [rad/s] Body frame yaw / psi angular speed + * @param lat [degE7] Latitude + * @param lon [degE7] Longitude + * @param alt [mm] Altitude + * @param vx [cm/s] Ground X Speed (Latitude) + * @param vy [cm/s] Ground Y Speed (Longitude) + * @param vz [cm/s] Ground Z Speed (Altitude) + * @param xacc [mG] X acceleration + * @param yacc [mG] Y acceleration + * @param zacc [mG] Z acceleration + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_hil_state_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, float roll, float pitch, float yaw, float rollspeed, float pitchspeed, float yawspeed, int32_t lat, int32_t lon, int32_t alt, int16_t vx, int16_t vy, int16_t vz, int16_t xacc, int16_t yacc, int16_t zacc) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_HIL_STATE_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, roll); + _mav_put_float(buf, 12, pitch); + _mav_put_float(buf, 16, yaw); + _mav_put_float(buf, 20, rollspeed); + _mav_put_float(buf, 24, pitchspeed); + _mav_put_float(buf, 28, yawspeed); + _mav_put_int32_t(buf, 32, lat); + _mav_put_int32_t(buf, 36, lon); + _mav_put_int32_t(buf, 40, alt); + _mav_put_int16_t(buf, 44, vx); + _mav_put_int16_t(buf, 46, vy); + _mav_put_int16_t(buf, 48, vz); + _mav_put_int16_t(buf, 50, xacc); + _mav_put_int16_t(buf, 52, yacc); + _mav_put_int16_t(buf, 54, zacc); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_STATE_LEN); +#else + mavlink_hil_state_t packet; + packet.time_usec = time_usec; + packet.roll = roll; + packet.pitch = pitch; + packet.yaw = yaw; + packet.rollspeed = rollspeed; + packet.pitchspeed = pitchspeed; + packet.yawspeed = yawspeed; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.vx = vx; + packet.vy = vy; + packet.vz = vz; + packet.xacc = xacc; + packet.yacc = yacc; + packet.zacc = zacc; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_STATE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_HIL_STATE; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HIL_STATE_MIN_LEN, MAVLINK_MSG_ID_HIL_STATE_LEN, MAVLINK_MSG_ID_HIL_STATE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HIL_STATE_MIN_LEN, MAVLINK_MSG_ID_HIL_STATE_LEN); +#endif +} + /** * @brief Pack a hil_state message on a channel * @param system_id ID of this system @@ -254,6 +332,20 @@ static inline uint16_t mavlink_msg_hil_state_encode_chan(uint8_t system_id, uint return mavlink_msg_hil_state_pack_chan(system_id, component_id, chan, msg, hil_state->time_usec, hil_state->roll, hil_state->pitch, hil_state->yaw, hil_state->rollspeed, hil_state->pitchspeed, hil_state->yawspeed, hil_state->lat, hil_state->lon, hil_state->alt, hil_state->vx, hil_state->vy, hil_state->vz, hil_state->xacc, hil_state->yacc, hil_state->zacc); } +/** + * @brief Encode a hil_state struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param hil_state C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_hil_state_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_hil_state_t* hil_state) +{ + return mavlink_msg_hil_state_pack_status(system_id, component_id, _status, msg, hil_state->time_usec, hil_state->roll, hil_state->pitch, hil_state->yaw, hil_state->rollspeed, hil_state->pitchspeed, hil_state->yawspeed, hil_state->lat, hil_state->lon, hil_state->alt, hil_state->vx, hil_state->vy, hil_state->vz, hil_state->xacc, hil_state->yacc, hil_state->zacc); +} + /** * @brief Send a hil_state message * @param chan MAVLink channel to send the message @@ -338,7 +430,7 @@ static inline void mavlink_msg_hil_state_send_struct(mavlink_channel_t chan, con #if MAVLINK_MSG_ID_HIL_STATE_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_hil_state_quaternion.h b/common/mavlink_msg_hil_state_quaternion.h index a605f39fe..747a73e30 100644 --- a/common/mavlink_msg_hil_state_quaternion.h +++ b/common/mavlink_msg_hil_state_quaternion.h @@ -143,7 +143,7 @@ static inline uint16_t mavlink_msg_hil_state_quaternion_pack(uint8_t system_id, packet.xacc = xacc; packet.yacc = yacc; packet.zacc = zacc; - mav_array_memcpy(packet.attitude_quaternion, attitude_quaternion, sizeof(float)*4); + mav_array_assign_float(packet.attitude_quaternion, attitude_quaternion, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN); #endif @@ -151,6 +151,82 @@ static inline uint16_t mavlink_msg_hil_state_quaternion_pack(uint8_t system_id, return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_MIN_LEN, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_CRC); } +/** + * @brief Pack a hil_state_quaternion message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param attitude_quaternion Vehicle attitude expressed as normalized quaternion in w, x, y, z order (with 1 0 0 0 being the null-rotation) + * @param rollspeed [rad/s] Body frame roll / phi angular speed + * @param pitchspeed [rad/s] Body frame pitch / theta angular speed + * @param yawspeed [rad/s] Body frame yaw / psi angular speed + * @param lat [degE7] Latitude + * @param lon [degE7] Longitude + * @param alt [mm] Altitude + * @param vx [cm/s] Ground X Speed (Latitude) + * @param vy [cm/s] Ground Y Speed (Longitude) + * @param vz [cm/s] Ground Z Speed (Altitude) + * @param ind_airspeed [cm/s] Indicated airspeed + * @param true_airspeed [cm/s] True airspeed + * @param xacc [mG] X acceleration + * @param yacc [mG] Y acceleration + * @param zacc [mG] Z acceleration + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_hil_state_quaternion_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, const float *attitude_quaternion, float rollspeed, float pitchspeed, float yawspeed, int32_t lat, int32_t lon, int32_t alt, int16_t vx, int16_t vy, int16_t vz, uint16_t ind_airspeed, uint16_t true_airspeed, int16_t xacc, int16_t yacc, int16_t zacc) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 24, rollspeed); + _mav_put_float(buf, 28, pitchspeed); + _mav_put_float(buf, 32, yawspeed); + _mav_put_int32_t(buf, 36, lat); + _mav_put_int32_t(buf, 40, lon); + _mav_put_int32_t(buf, 44, alt); + _mav_put_int16_t(buf, 48, vx); + _mav_put_int16_t(buf, 50, vy); + _mav_put_int16_t(buf, 52, vz); + _mav_put_uint16_t(buf, 54, ind_airspeed); + _mav_put_uint16_t(buf, 56, true_airspeed); + _mav_put_int16_t(buf, 58, xacc); + _mav_put_int16_t(buf, 60, yacc); + _mav_put_int16_t(buf, 62, zacc); + _mav_put_float_array(buf, 8, attitude_quaternion, 4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN); +#else + mavlink_hil_state_quaternion_t packet; + packet.time_usec = time_usec; + packet.rollspeed = rollspeed; + packet.pitchspeed = pitchspeed; + packet.yawspeed = yawspeed; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.vx = vx; + packet.vy = vy; + packet.vz = vz; + packet.ind_airspeed = ind_airspeed; + packet.true_airspeed = true_airspeed; + packet.xacc = xacc; + packet.yacc = yacc; + packet.zacc = zacc; + mav_array_memcpy(packet.attitude_quaternion, attitude_quaternion, sizeof(float)*4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_HIL_STATE_QUATERNION; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_MIN_LEN, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_MIN_LEN, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN); +#endif +} + /** * @brief Pack a hil_state_quaternion message on a channel * @param system_id ID of this system @@ -215,7 +291,7 @@ static inline uint16_t mavlink_msg_hil_state_quaternion_pack_chan(uint8_t system packet.xacc = xacc; packet.yacc = yacc; packet.zacc = zacc; - mav_array_memcpy(packet.attitude_quaternion, attitude_quaternion, sizeof(float)*4); + mav_array_assign_float(packet.attitude_quaternion, attitude_quaternion, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN); #endif @@ -250,6 +326,20 @@ static inline uint16_t mavlink_msg_hil_state_quaternion_encode_chan(uint8_t syst return mavlink_msg_hil_state_quaternion_pack_chan(system_id, component_id, chan, msg, hil_state_quaternion->time_usec, hil_state_quaternion->attitude_quaternion, hil_state_quaternion->rollspeed, hil_state_quaternion->pitchspeed, hil_state_quaternion->yawspeed, hil_state_quaternion->lat, hil_state_quaternion->lon, hil_state_quaternion->alt, hil_state_quaternion->vx, hil_state_quaternion->vy, hil_state_quaternion->vz, hil_state_quaternion->ind_airspeed, hil_state_quaternion->true_airspeed, hil_state_quaternion->xacc, hil_state_quaternion->yacc, hil_state_quaternion->zacc); } +/** + * @brief Encode a hil_state_quaternion struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param hil_state_quaternion C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_hil_state_quaternion_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_hil_state_quaternion_t* hil_state_quaternion) +{ + return mavlink_msg_hil_state_quaternion_pack_status(system_id, component_id, _status, msg, hil_state_quaternion->time_usec, hil_state_quaternion->attitude_quaternion, hil_state_quaternion->rollspeed, hil_state_quaternion->pitchspeed, hil_state_quaternion->yawspeed, hil_state_quaternion->lat, hil_state_quaternion->lon, hil_state_quaternion->alt, hil_state_quaternion->vx, hil_state_quaternion->vy, hil_state_quaternion->vz, hil_state_quaternion->ind_airspeed, hil_state_quaternion->true_airspeed, hil_state_quaternion->xacc, hil_state_quaternion->yacc, hil_state_quaternion->zacc); +} + /** * @brief Send a hil_state_quaternion message * @param chan MAVLink channel to send the message @@ -311,7 +401,7 @@ static inline void mavlink_msg_hil_state_quaternion_send(mavlink_channel_t chan, packet.xacc = xacc; packet.yacc = yacc; packet.zacc = zacc; - mav_array_memcpy(packet.attitude_quaternion, attitude_quaternion, sizeof(float)*4); + mav_array_assign_float(packet.attitude_quaternion, attitude_quaternion, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_STATE_QUATERNION, (const char *)&packet, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_MIN_LEN, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_CRC); #endif } @@ -332,7 +422,7 @@ static inline void mavlink_msg_hil_state_quaternion_send_struct(mavlink_channel_ #if MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -376,7 +466,7 @@ static inline void mavlink_msg_hil_state_quaternion_send_buf(mavlink_message_t * packet->xacc = xacc; packet->yacc = yacc; packet->zacc = zacc; - mav_array_memcpy(packet->attitude_quaternion, attitude_quaternion, sizeof(float)*4); + mav_array_assign_float(packet->attitude_quaternion, attitude_quaternion, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_STATE_QUATERNION, (const char *)packet, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_MIN_LEN, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_CRC); #endif } diff --git a/common/mavlink_msg_home_position.h b/common/mavlink_msg_home_position.h index ab5130b81..61dbebdfc 100644 --- a/common/mavlink_msg_home_position.h +++ b/common/mavlink_msg_home_position.h @@ -8,10 +8,14 @@ typedef struct __mavlink_home_position_t { int32_t latitude; /*< [degE7] Latitude (WGS84)*/ int32_t longitude; /*< [degE7] Longitude (WGS84)*/ int32_t altitude; /*< [mm] Altitude (MSL). Positive for up.*/ - float x; /*< [m] Local X position of this position in the local coordinate frame*/ - float y; /*< [m] Local Y position of this position in the local coordinate frame*/ - float z; /*< [m] Local Z position of this position in the local coordinate frame*/ - float q[4]; /*< World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground*/ + float x; /*< [m] Local X position of this position in the local coordinate frame (NED)*/ + float y; /*< [m] Local Y position of this position in the local coordinate frame (NED)*/ + float z; /*< [m] Local Z position of this position in the local coordinate frame (NED: positive "down")*/ + float q[4]; /*< + Quaternion indicating world-to-surface-normal and heading transformation of the takeoff position. + Used to indicate the heading and slope of the ground. + All fields should be set to NaN if an accurate quaternion for both heading and surface slope cannot be supplied. + */ float approach_x; /*< [m] Local X position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone.*/ float approach_y; /*< [m] Local Y position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone.*/ float approach_z; /*< [m] Local Z position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone.*/ @@ -74,10 +78,14 @@ typedef struct __mavlink_home_position_t { * @param latitude [degE7] Latitude (WGS84) * @param longitude [degE7] Longitude (WGS84) * @param altitude [mm] Altitude (MSL). Positive for up. - * @param x [m] Local X position of this position in the local coordinate frame - * @param y [m] Local Y position of this position in the local coordinate frame - * @param z [m] Local Z position of this position in the local coordinate frame - * @param q World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground + * @param x [m] Local X position of this position in the local coordinate frame (NED) + * @param y [m] Local Y position of this position in the local coordinate frame (NED) + * @param z [m] Local Z position of this position in the local coordinate frame (NED: positive "down") + * @param q + Quaternion indicating world-to-surface-normal and heading transformation of the takeoff position. + Used to indicate the heading and slope of the ground. + All fields should be set to NaN if an accurate quaternion for both heading and surface slope cannot be supplied. + * @param approach_x [m] Local X position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. * @param approach_y [m] Local Y position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. * @param approach_z [m] Local Z position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. @@ -113,7 +121,7 @@ static inline uint16_t mavlink_msg_home_position_pack(uint8_t system_id, uint8_t packet.approach_y = approach_y; packet.approach_z = approach_z; packet.time_usec = time_usec; - mav_array_memcpy(packet.q, q, sizeof(float)*4); + mav_array_assign_float(packet.q, q, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HOME_POSITION_LEN); #endif @@ -121,6 +129,71 @@ static inline uint16_t mavlink_msg_home_position_pack(uint8_t system_id, uint8_t return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HOME_POSITION_MIN_LEN, MAVLINK_MSG_ID_HOME_POSITION_LEN, MAVLINK_MSG_ID_HOME_POSITION_CRC); } +/** + * @brief Pack a home_position message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param latitude [degE7] Latitude (WGS84) + * @param longitude [degE7] Longitude (WGS84) + * @param altitude [mm] Altitude (MSL). Positive for up. + * @param x [m] Local X position of this position in the local coordinate frame (NED) + * @param y [m] Local Y position of this position in the local coordinate frame (NED) + * @param z [m] Local Z position of this position in the local coordinate frame (NED: positive "down") + * @param q + Quaternion indicating world-to-surface-normal and heading transformation of the takeoff position. + Used to indicate the heading and slope of the ground. + All fields should be set to NaN if an accurate quaternion for both heading and surface slope cannot be supplied. + + * @param approach_x [m] Local X position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. + * @param approach_y [m] Local Y position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. + * @param approach_z [m] Local Z position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_home_position_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + int32_t latitude, int32_t longitude, int32_t altitude, float x, float y, float z, const float *q, float approach_x, float approach_y, float approach_z, uint64_t time_usec) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_HOME_POSITION_LEN]; + _mav_put_int32_t(buf, 0, latitude); + _mav_put_int32_t(buf, 4, longitude); + _mav_put_int32_t(buf, 8, altitude); + _mav_put_float(buf, 12, x); + _mav_put_float(buf, 16, y); + _mav_put_float(buf, 20, z); + _mav_put_float(buf, 40, approach_x); + _mav_put_float(buf, 44, approach_y); + _mav_put_float(buf, 48, approach_z); + _mav_put_uint64_t(buf, 52, time_usec); + _mav_put_float_array(buf, 24, q, 4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HOME_POSITION_LEN); +#else + mavlink_home_position_t packet; + packet.latitude = latitude; + packet.longitude = longitude; + packet.altitude = altitude; + packet.x = x; + packet.y = y; + packet.z = z; + packet.approach_x = approach_x; + packet.approach_y = approach_y; + packet.approach_z = approach_z; + packet.time_usec = time_usec; + mav_array_memcpy(packet.q, q, sizeof(float)*4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HOME_POSITION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_HOME_POSITION; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HOME_POSITION_MIN_LEN, MAVLINK_MSG_ID_HOME_POSITION_LEN, MAVLINK_MSG_ID_HOME_POSITION_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HOME_POSITION_MIN_LEN, MAVLINK_MSG_ID_HOME_POSITION_LEN); +#endif +} + /** * @brief Pack a home_position message on a channel * @param system_id ID of this system @@ -130,10 +203,14 @@ static inline uint16_t mavlink_msg_home_position_pack(uint8_t system_id, uint8_t * @param latitude [degE7] Latitude (WGS84) * @param longitude [degE7] Longitude (WGS84) * @param altitude [mm] Altitude (MSL). Positive for up. - * @param x [m] Local X position of this position in the local coordinate frame - * @param y [m] Local Y position of this position in the local coordinate frame - * @param z [m] Local Z position of this position in the local coordinate frame - * @param q World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground + * @param x [m] Local X position of this position in the local coordinate frame (NED) + * @param y [m] Local Y position of this position in the local coordinate frame (NED) + * @param z [m] Local Z position of this position in the local coordinate frame (NED: positive "down") + * @param q + Quaternion indicating world-to-surface-normal and heading transformation of the takeoff position. + Used to indicate the heading and slope of the ground. + All fields should be set to NaN if an accurate quaternion for both heading and surface slope cannot be supplied. + * @param approach_x [m] Local X position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. * @param approach_y [m] Local Y position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. * @param approach_z [m] Local Z position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. @@ -170,7 +247,7 @@ static inline uint16_t mavlink_msg_home_position_pack_chan(uint8_t system_id, ui packet.approach_y = approach_y; packet.approach_z = approach_z; packet.time_usec = time_usec; - mav_array_memcpy(packet.q, q, sizeof(float)*4); + mav_array_assign_float(packet.q, q, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HOME_POSITION_LEN); #endif @@ -205,6 +282,20 @@ static inline uint16_t mavlink_msg_home_position_encode_chan(uint8_t system_id, return mavlink_msg_home_position_pack_chan(system_id, component_id, chan, msg, home_position->latitude, home_position->longitude, home_position->altitude, home_position->x, home_position->y, home_position->z, home_position->q, home_position->approach_x, home_position->approach_y, home_position->approach_z, home_position->time_usec); } +/** + * @brief Encode a home_position struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param home_position C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_home_position_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_home_position_t* home_position) +{ + return mavlink_msg_home_position_pack_status(system_id, component_id, _status, msg, home_position->latitude, home_position->longitude, home_position->altitude, home_position->x, home_position->y, home_position->z, home_position->q, home_position->approach_x, home_position->approach_y, home_position->approach_z, home_position->time_usec); +} + /** * @brief Send a home_position message * @param chan MAVLink channel to send the message @@ -212,10 +303,14 @@ static inline uint16_t mavlink_msg_home_position_encode_chan(uint8_t system_id, * @param latitude [degE7] Latitude (WGS84) * @param longitude [degE7] Longitude (WGS84) * @param altitude [mm] Altitude (MSL). Positive for up. - * @param x [m] Local X position of this position in the local coordinate frame - * @param y [m] Local Y position of this position in the local coordinate frame - * @param z [m] Local Z position of this position in the local coordinate frame - * @param q World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground + * @param x [m] Local X position of this position in the local coordinate frame (NED) + * @param y [m] Local Y position of this position in the local coordinate frame (NED) + * @param z [m] Local Z position of this position in the local coordinate frame (NED: positive "down") + * @param q + Quaternion indicating world-to-surface-normal and heading transformation of the takeoff position. + Used to indicate the heading and slope of the ground. + All fields should be set to NaN if an accurate quaternion for both heading and surface slope cannot be supplied. + * @param approach_x [m] Local X position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. * @param approach_y [m] Local Y position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. * @param approach_z [m] Local Z position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. @@ -251,7 +346,7 @@ static inline void mavlink_msg_home_position_send(mavlink_channel_t chan, int32_ packet.approach_y = approach_y; packet.approach_z = approach_z; packet.time_usec = time_usec; - mav_array_memcpy(packet.q, q, sizeof(float)*4); + mav_array_assign_float(packet.q, q, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HOME_POSITION, (const char *)&packet, MAVLINK_MSG_ID_HOME_POSITION_MIN_LEN, MAVLINK_MSG_ID_HOME_POSITION_LEN, MAVLINK_MSG_ID_HOME_POSITION_CRC); #endif } @@ -272,7 +367,7 @@ static inline void mavlink_msg_home_position_send_struct(mavlink_channel_t chan, #if MAVLINK_MSG_ID_HOME_POSITION_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -306,7 +401,7 @@ static inline void mavlink_msg_home_position_send_buf(mavlink_message_t *msgbuf, packet->approach_y = approach_y; packet->approach_z = approach_z; packet->time_usec = time_usec; - mav_array_memcpy(packet->q, q, sizeof(float)*4); + mav_array_assign_float(packet->q, q, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HOME_POSITION, (const char *)packet, MAVLINK_MSG_ID_HOME_POSITION_MIN_LEN, MAVLINK_MSG_ID_HOME_POSITION_LEN, MAVLINK_MSG_ID_HOME_POSITION_CRC); #endif } @@ -350,7 +445,7 @@ static inline int32_t mavlink_msg_home_position_get_altitude(const mavlink_messa /** * @brief Get field x from home_position message * - * @return [m] Local X position of this position in the local coordinate frame + * @return [m] Local X position of this position in the local coordinate frame (NED) */ static inline float mavlink_msg_home_position_get_x(const mavlink_message_t* msg) { @@ -360,7 +455,7 @@ static inline float mavlink_msg_home_position_get_x(const mavlink_message_t* msg /** * @brief Get field y from home_position message * - * @return [m] Local Y position of this position in the local coordinate frame + * @return [m] Local Y position of this position in the local coordinate frame (NED) */ static inline float mavlink_msg_home_position_get_y(const mavlink_message_t* msg) { @@ -370,7 +465,7 @@ static inline float mavlink_msg_home_position_get_y(const mavlink_message_t* msg /** * @brief Get field z from home_position message * - * @return [m] Local Z position of this position in the local coordinate frame + * @return [m] Local Z position of this position in the local coordinate frame (NED: positive "down") */ static inline float mavlink_msg_home_position_get_z(const mavlink_message_t* msg) { @@ -380,7 +475,11 @@ static inline float mavlink_msg_home_position_get_z(const mavlink_message_t* msg /** * @brief Get field q from home_position message * - * @return World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground + * @return + Quaternion indicating world-to-surface-normal and heading transformation of the takeoff position. + Used to indicate the heading and slope of the ground. + All fields should be set to NaN if an accurate quaternion for both heading and surface slope cannot be supplied. + */ static inline uint16_t mavlink_msg_home_position_get_q(const mavlink_message_t* msg, float *q) { diff --git a/common/mavlink_msg_hygrometer_sensor.h b/common/mavlink_msg_hygrometer_sensor.h new file mode 100644 index 000000000..b98713e98 --- /dev/null +++ b/common/mavlink_msg_hygrometer_sensor.h @@ -0,0 +1,316 @@ +#pragma once +// MESSAGE HYGROMETER_SENSOR PACKING + +#define MAVLINK_MSG_ID_HYGROMETER_SENSOR 12920 + + +typedef struct __mavlink_hygrometer_sensor_t { + int16_t temperature; /*< [cdegC] Temperature*/ + uint16_t humidity; /*< [c%] Humidity*/ + uint8_t id; /*< Hygrometer ID*/ +} mavlink_hygrometer_sensor_t; + +#define MAVLINK_MSG_ID_HYGROMETER_SENSOR_LEN 5 +#define MAVLINK_MSG_ID_HYGROMETER_SENSOR_MIN_LEN 5 +#define MAVLINK_MSG_ID_12920_LEN 5 +#define MAVLINK_MSG_ID_12920_MIN_LEN 5 + +#define MAVLINK_MSG_ID_HYGROMETER_SENSOR_CRC 20 +#define MAVLINK_MSG_ID_12920_CRC 20 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_HYGROMETER_SENSOR { \ + 12920, \ + "HYGROMETER_SENSOR", \ + 3, \ + { { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_hygrometer_sensor_t, id) }, \ + { "temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_hygrometer_sensor_t, temperature) }, \ + { "humidity", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_hygrometer_sensor_t, humidity) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_HYGROMETER_SENSOR { \ + "HYGROMETER_SENSOR", \ + 3, \ + { { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_hygrometer_sensor_t, id) }, \ + { "temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_hygrometer_sensor_t, temperature) }, \ + { "humidity", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_hygrometer_sensor_t, humidity) }, \ + } \ +} +#endif + +/** + * @brief Pack a hygrometer_sensor message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param id Hygrometer ID + * @param temperature [cdegC] Temperature + * @param humidity [c%] Humidity + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_hygrometer_sensor_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t id, int16_t temperature, uint16_t humidity) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_HYGROMETER_SENSOR_LEN]; + _mav_put_int16_t(buf, 0, temperature); + _mav_put_uint16_t(buf, 2, humidity); + _mav_put_uint8_t(buf, 4, id); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HYGROMETER_SENSOR_LEN); +#else + mavlink_hygrometer_sensor_t packet; + packet.temperature = temperature; + packet.humidity = humidity; + packet.id = id; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HYGROMETER_SENSOR_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_HYGROMETER_SENSOR; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HYGROMETER_SENSOR_MIN_LEN, MAVLINK_MSG_ID_HYGROMETER_SENSOR_LEN, MAVLINK_MSG_ID_HYGROMETER_SENSOR_CRC); +} + +/** + * @brief Pack a hygrometer_sensor message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param id Hygrometer ID + * @param temperature [cdegC] Temperature + * @param humidity [c%] Humidity + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_hygrometer_sensor_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t id, int16_t temperature, uint16_t humidity) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_HYGROMETER_SENSOR_LEN]; + _mav_put_int16_t(buf, 0, temperature); + _mav_put_uint16_t(buf, 2, humidity); + _mav_put_uint8_t(buf, 4, id); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HYGROMETER_SENSOR_LEN); +#else + mavlink_hygrometer_sensor_t packet; + packet.temperature = temperature; + packet.humidity = humidity; + packet.id = id; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HYGROMETER_SENSOR_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_HYGROMETER_SENSOR; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HYGROMETER_SENSOR_MIN_LEN, MAVLINK_MSG_ID_HYGROMETER_SENSOR_LEN, MAVLINK_MSG_ID_HYGROMETER_SENSOR_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HYGROMETER_SENSOR_MIN_LEN, MAVLINK_MSG_ID_HYGROMETER_SENSOR_LEN); +#endif +} + +/** + * @brief Pack a hygrometer_sensor message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param id Hygrometer ID + * @param temperature [cdegC] Temperature + * @param humidity [c%] Humidity + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_hygrometer_sensor_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t id,int16_t temperature,uint16_t humidity) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_HYGROMETER_SENSOR_LEN]; + _mav_put_int16_t(buf, 0, temperature); + _mav_put_uint16_t(buf, 2, humidity); + _mav_put_uint8_t(buf, 4, id); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HYGROMETER_SENSOR_LEN); +#else + mavlink_hygrometer_sensor_t packet; + packet.temperature = temperature; + packet.humidity = humidity; + packet.id = id; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HYGROMETER_SENSOR_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_HYGROMETER_SENSOR; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HYGROMETER_SENSOR_MIN_LEN, MAVLINK_MSG_ID_HYGROMETER_SENSOR_LEN, MAVLINK_MSG_ID_HYGROMETER_SENSOR_CRC); +} + +/** + * @brief Encode a hygrometer_sensor struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param hygrometer_sensor C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_hygrometer_sensor_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_hygrometer_sensor_t* hygrometer_sensor) +{ + return mavlink_msg_hygrometer_sensor_pack(system_id, component_id, msg, hygrometer_sensor->id, hygrometer_sensor->temperature, hygrometer_sensor->humidity); +} + +/** + * @brief Encode a hygrometer_sensor struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param hygrometer_sensor C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_hygrometer_sensor_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_hygrometer_sensor_t* hygrometer_sensor) +{ + return mavlink_msg_hygrometer_sensor_pack_chan(system_id, component_id, chan, msg, hygrometer_sensor->id, hygrometer_sensor->temperature, hygrometer_sensor->humidity); +} + +/** + * @brief Encode a hygrometer_sensor struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param hygrometer_sensor C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_hygrometer_sensor_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_hygrometer_sensor_t* hygrometer_sensor) +{ + return mavlink_msg_hygrometer_sensor_pack_status(system_id, component_id, _status, msg, hygrometer_sensor->id, hygrometer_sensor->temperature, hygrometer_sensor->humidity); +} + +/** + * @brief Send a hygrometer_sensor message + * @param chan MAVLink channel to send the message + * + * @param id Hygrometer ID + * @param temperature [cdegC] Temperature + * @param humidity [c%] Humidity + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_hygrometer_sensor_send(mavlink_channel_t chan, uint8_t id, int16_t temperature, uint16_t humidity) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_HYGROMETER_SENSOR_LEN]; + _mav_put_int16_t(buf, 0, temperature); + _mav_put_uint16_t(buf, 2, humidity); + _mav_put_uint8_t(buf, 4, id); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HYGROMETER_SENSOR, buf, MAVLINK_MSG_ID_HYGROMETER_SENSOR_MIN_LEN, MAVLINK_MSG_ID_HYGROMETER_SENSOR_LEN, MAVLINK_MSG_ID_HYGROMETER_SENSOR_CRC); +#else + mavlink_hygrometer_sensor_t packet; + packet.temperature = temperature; + packet.humidity = humidity; + packet.id = id; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HYGROMETER_SENSOR, (const char *)&packet, MAVLINK_MSG_ID_HYGROMETER_SENSOR_MIN_LEN, MAVLINK_MSG_ID_HYGROMETER_SENSOR_LEN, MAVLINK_MSG_ID_HYGROMETER_SENSOR_CRC); +#endif +} + +/** + * @brief Send a hygrometer_sensor message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_hygrometer_sensor_send_struct(mavlink_channel_t chan, const mavlink_hygrometer_sensor_t* hygrometer_sensor) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_hygrometer_sensor_send(chan, hygrometer_sensor->id, hygrometer_sensor->temperature, hygrometer_sensor->humidity); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HYGROMETER_SENSOR, (const char *)hygrometer_sensor, MAVLINK_MSG_ID_HYGROMETER_SENSOR_MIN_LEN, MAVLINK_MSG_ID_HYGROMETER_SENSOR_LEN, MAVLINK_MSG_ID_HYGROMETER_SENSOR_CRC); +#endif +} + +#if MAVLINK_MSG_ID_HYGROMETER_SENSOR_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_hygrometer_sensor_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t id, int16_t temperature, uint16_t humidity) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_int16_t(buf, 0, temperature); + _mav_put_uint16_t(buf, 2, humidity); + _mav_put_uint8_t(buf, 4, id); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HYGROMETER_SENSOR, buf, MAVLINK_MSG_ID_HYGROMETER_SENSOR_MIN_LEN, MAVLINK_MSG_ID_HYGROMETER_SENSOR_LEN, MAVLINK_MSG_ID_HYGROMETER_SENSOR_CRC); +#else + mavlink_hygrometer_sensor_t *packet = (mavlink_hygrometer_sensor_t *)msgbuf; + packet->temperature = temperature; + packet->humidity = humidity; + packet->id = id; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HYGROMETER_SENSOR, (const char *)packet, MAVLINK_MSG_ID_HYGROMETER_SENSOR_MIN_LEN, MAVLINK_MSG_ID_HYGROMETER_SENSOR_LEN, MAVLINK_MSG_ID_HYGROMETER_SENSOR_CRC); +#endif +} +#endif + +#endif + +// MESSAGE HYGROMETER_SENSOR UNPACKING + + +/** + * @brief Get field id from hygrometer_sensor message + * + * @return Hygrometer ID + */ +static inline uint8_t mavlink_msg_hygrometer_sensor_get_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 4); +} + +/** + * @brief Get field temperature from hygrometer_sensor message + * + * @return [cdegC] Temperature + */ +static inline int16_t mavlink_msg_hygrometer_sensor_get_temperature(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int16_t(msg, 0); +} + +/** + * @brief Get field humidity from hygrometer_sensor message + * + * @return [c%] Humidity + */ +static inline uint16_t mavlink_msg_hygrometer_sensor_get_humidity(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 2); +} + +/** + * @brief Decode a hygrometer_sensor message into a struct + * + * @param msg The message to decode + * @param hygrometer_sensor C-struct to decode the message contents into + */ +static inline void mavlink_msg_hygrometer_sensor_decode(const mavlink_message_t* msg, mavlink_hygrometer_sensor_t* hygrometer_sensor) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + hygrometer_sensor->temperature = mavlink_msg_hygrometer_sensor_get_temperature(msg); + hygrometer_sensor->humidity = mavlink_msg_hygrometer_sensor_get_humidity(msg); + hygrometer_sensor->id = mavlink_msg_hygrometer_sensor_get_id(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_HYGROMETER_SENSOR_LEN? msg->len : MAVLINK_MSG_ID_HYGROMETER_SENSOR_LEN; + memset(hygrometer_sensor, 0, MAVLINK_MSG_ID_HYGROMETER_SENSOR_LEN); + memcpy(hygrometer_sensor, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/common/mavlink_msg_illuminator_status.h b/common/mavlink_msg_illuminator_status.h new file mode 100644 index 000000000..1dec13914 --- /dev/null +++ b/common/mavlink_msg_illuminator_status.h @@ -0,0 +1,540 @@ +#pragma once +// MESSAGE ILLUMINATOR_STATUS PACKING + +#define MAVLINK_MSG_ID_ILLUMINATOR_STATUS 440 + + +typedef struct __mavlink_illuminator_status_t { + uint32_t uptime_ms; /*< [ms] Time since the start-up of the illuminator in ms*/ + uint32_t error_status; /*< Errors*/ + float brightness; /*< [%] Illuminator brightness*/ + float strobe_period; /*< [s] Illuminator strobing period in seconds*/ + float strobe_duty_cycle; /*< [%] Illuminator strobing duty cycle*/ + float temp_c; /*< Temperature in Celsius*/ + float min_strobe_period; /*< [s] Minimum strobing period in seconds*/ + float max_strobe_period; /*< [s] Maximum strobing period in seconds*/ + uint8_t enable; /*< 0: Illuminators OFF, 1: Illuminators ON*/ + uint8_t mode_bitmask; /*< Supported illuminator modes*/ + uint8_t mode; /*< Illuminator mode*/ +} mavlink_illuminator_status_t; + +#define MAVLINK_MSG_ID_ILLUMINATOR_STATUS_LEN 35 +#define MAVLINK_MSG_ID_ILLUMINATOR_STATUS_MIN_LEN 35 +#define MAVLINK_MSG_ID_440_LEN 35 +#define MAVLINK_MSG_ID_440_MIN_LEN 35 + +#define MAVLINK_MSG_ID_ILLUMINATOR_STATUS_CRC 66 +#define MAVLINK_MSG_ID_440_CRC 66 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_ILLUMINATOR_STATUS { \ + 440, \ + "ILLUMINATOR_STATUS", \ + 11, \ + { { "uptime_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_illuminator_status_t, uptime_ms) }, \ + { "enable", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_illuminator_status_t, enable) }, \ + { "mode_bitmask", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_illuminator_status_t, mode_bitmask) }, \ + { "error_status", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_illuminator_status_t, error_status) }, \ + { "mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_illuminator_status_t, mode) }, \ + { "brightness", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_illuminator_status_t, brightness) }, \ + { "strobe_period", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_illuminator_status_t, strobe_period) }, \ + { "strobe_duty_cycle", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_illuminator_status_t, strobe_duty_cycle) }, \ + { "temp_c", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_illuminator_status_t, temp_c) }, \ + { "min_strobe_period", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_illuminator_status_t, min_strobe_period) }, \ + { "max_strobe_period", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_illuminator_status_t, max_strobe_period) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_ILLUMINATOR_STATUS { \ + "ILLUMINATOR_STATUS", \ + 11, \ + { { "uptime_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_illuminator_status_t, uptime_ms) }, \ + { "enable", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_illuminator_status_t, enable) }, \ + { "mode_bitmask", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_illuminator_status_t, mode_bitmask) }, \ + { "error_status", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_illuminator_status_t, error_status) }, \ + { "mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_illuminator_status_t, mode) }, \ + { "brightness", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_illuminator_status_t, brightness) }, \ + { "strobe_period", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_illuminator_status_t, strobe_period) }, \ + { "strobe_duty_cycle", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_illuminator_status_t, strobe_duty_cycle) }, \ + { "temp_c", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_illuminator_status_t, temp_c) }, \ + { "min_strobe_period", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_illuminator_status_t, min_strobe_period) }, \ + { "max_strobe_period", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_illuminator_status_t, max_strobe_period) }, \ + } \ +} +#endif + +/** + * @brief Pack a illuminator_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param uptime_ms [ms] Time since the start-up of the illuminator in ms + * @param enable 0: Illuminators OFF, 1: Illuminators ON + * @param mode_bitmask Supported illuminator modes + * @param error_status Errors + * @param mode Illuminator mode + * @param brightness [%] Illuminator brightness + * @param strobe_period [s] Illuminator strobing period in seconds + * @param strobe_duty_cycle [%] Illuminator strobing duty cycle + * @param temp_c Temperature in Celsius + * @param min_strobe_period [s] Minimum strobing period in seconds + * @param max_strobe_period [s] Maximum strobing period in seconds + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_illuminator_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint32_t uptime_ms, uint8_t enable, uint8_t mode_bitmask, uint32_t error_status, uint8_t mode, float brightness, float strobe_period, float strobe_duty_cycle, float temp_c, float min_strobe_period, float max_strobe_period) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_ILLUMINATOR_STATUS_LEN]; + _mav_put_uint32_t(buf, 0, uptime_ms); + _mav_put_uint32_t(buf, 4, error_status); + _mav_put_float(buf, 8, brightness); + _mav_put_float(buf, 12, strobe_period); + _mav_put_float(buf, 16, strobe_duty_cycle); + _mav_put_float(buf, 20, temp_c); + _mav_put_float(buf, 24, min_strobe_period); + _mav_put_float(buf, 28, max_strobe_period); + _mav_put_uint8_t(buf, 32, enable); + _mav_put_uint8_t(buf, 33, mode_bitmask); + _mav_put_uint8_t(buf, 34, mode); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_LEN); +#else + mavlink_illuminator_status_t packet; + packet.uptime_ms = uptime_ms; + packet.error_status = error_status; + packet.brightness = brightness; + packet.strobe_period = strobe_period; + packet.strobe_duty_cycle = strobe_duty_cycle; + packet.temp_c = temp_c; + packet.min_strobe_period = min_strobe_period; + packet.max_strobe_period = max_strobe_period; + packet.enable = enable; + packet.mode_bitmask = mode_bitmask; + packet.mode = mode; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_ILLUMINATOR_STATUS; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_LEN, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_CRC); +} + +/** + * @brief Pack a illuminator_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param uptime_ms [ms] Time since the start-up of the illuminator in ms + * @param enable 0: Illuminators OFF, 1: Illuminators ON + * @param mode_bitmask Supported illuminator modes + * @param error_status Errors + * @param mode Illuminator mode + * @param brightness [%] Illuminator brightness + * @param strobe_period [s] Illuminator strobing period in seconds + * @param strobe_duty_cycle [%] Illuminator strobing duty cycle + * @param temp_c Temperature in Celsius + * @param min_strobe_period [s] Minimum strobing period in seconds + * @param max_strobe_period [s] Maximum strobing period in seconds + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_illuminator_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t uptime_ms, uint8_t enable, uint8_t mode_bitmask, uint32_t error_status, uint8_t mode, float brightness, float strobe_period, float strobe_duty_cycle, float temp_c, float min_strobe_period, float max_strobe_period) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_ILLUMINATOR_STATUS_LEN]; + _mav_put_uint32_t(buf, 0, uptime_ms); + _mav_put_uint32_t(buf, 4, error_status); + _mav_put_float(buf, 8, brightness); + _mav_put_float(buf, 12, strobe_period); + _mav_put_float(buf, 16, strobe_duty_cycle); + _mav_put_float(buf, 20, temp_c); + _mav_put_float(buf, 24, min_strobe_period); + _mav_put_float(buf, 28, max_strobe_period); + _mav_put_uint8_t(buf, 32, enable); + _mav_put_uint8_t(buf, 33, mode_bitmask); + _mav_put_uint8_t(buf, 34, mode); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_LEN); +#else + mavlink_illuminator_status_t packet; + packet.uptime_ms = uptime_ms; + packet.error_status = error_status; + packet.brightness = brightness; + packet.strobe_period = strobe_period; + packet.strobe_duty_cycle = strobe_duty_cycle; + packet.temp_c = temp_c; + packet.min_strobe_period = min_strobe_period; + packet.max_strobe_period = max_strobe_period; + packet.enable = enable; + packet.mode_bitmask = mode_bitmask; + packet.mode = mode; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_ILLUMINATOR_STATUS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_LEN, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_LEN); +#endif +} + +/** + * @brief Pack a illuminator_status message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param uptime_ms [ms] Time since the start-up of the illuminator in ms + * @param enable 0: Illuminators OFF, 1: Illuminators ON + * @param mode_bitmask Supported illuminator modes + * @param error_status Errors + * @param mode Illuminator mode + * @param brightness [%] Illuminator brightness + * @param strobe_period [s] Illuminator strobing period in seconds + * @param strobe_duty_cycle [%] Illuminator strobing duty cycle + * @param temp_c Temperature in Celsius + * @param min_strobe_period [s] Minimum strobing period in seconds + * @param max_strobe_period [s] Maximum strobing period in seconds + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_illuminator_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint32_t uptime_ms,uint8_t enable,uint8_t mode_bitmask,uint32_t error_status,uint8_t mode,float brightness,float strobe_period,float strobe_duty_cycle,float temp_c,float min_strobe_period,float max_strobe_period) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_ILLUMINATOR_STATUS_LEN]; + _mav_put_uint32_t(buf, 0, uptime_ms); + _mav_put_uint32_t(buf, 4, error_status); + _mav_put_float(buf, 8, brightness); + _mav_put_float(buf, 12, strobe_period); + _mav_put_float(buf, 16, strobe_duty_cycle); + _mav_put_float(buf, 20, temp_c); + _mav_put_float(buf, 24, min_strobe_period); + _mav_put_float(buf, 28, max_strobe_period); + _mav_put_uint8_t(buf, 32, enable); + _mav_put_uint8_t(buf, 33, mode_bitmask); + _mav_put_uint8_t(buf, 34, mode); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_LEN); +#else + mavlink_illuminator_status_t packet; + packet.uptime_ms = uptime_ms; + packet.error_status = error_status; + packet.brightness = brightness; + packet.strobe_period = strobe_period; + packet.strobe_duty_cycle = strobe_duty_cycle; + packet.temp_c = temp_c; + packet.min_strobe_period = min_strobe_period; + packet.max_strobe_period = max_strobe_period; + packet.enable = enable; + packet.mode_bitmask = mode_bitmask; + packet.mode = mode; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_ILLUMINATOR_STATUS; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_LEN, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_CRC); +} + +/** + * @brief Encode a illuminator_status struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param illuminator_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_illuminator_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_illuminator_status_t* illuminator_status) +{ + return mavlink_msg_illuminator_status_pack(system_id, component_id, msg, illuminator_status->uptime_ms, illuminator_status->enable, illuminator_status->mode_bitmask, illuminator_status->error_status, illuminator_status->mode, illuminator_status->brightness, illuminator_status->strobe_period, illuminator_status->strobe_duty_cycle, illuminator_status->temp_c, illuminator_status->min_strobe_period, illuminator_status->max_strobe_period); +} + +/** + * @brief Encode a illuminator_status struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param illuminator_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_illuminator_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_illuminator_status_t* illuminator_status) +{ + return mavlink_msg_illuminator_status_pack_chan(system_id, component_id, chan, msg, illuminator_status->uptime_ms, illuminator_status->enable, illuminator_status->mode_bitmask, illuminator_status->error_status, illuminator_status->mode, illuminator_status->brightness, illuminator_status->strobe_period, illuminator_status->strobe_duty_cycle, illuminator_status->temp_c, illuminator_status->min_strobe_period, illuminator_status->max_strobe_period); +} + +/** + * @brief Encode a illuminator_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param illuminator_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_illuminator_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_illuminator_status_t* illuminator_status) +{ + return mavlink_msg_illuminator_status_pack_status(system_id, component_id, _status, msg, illuminator_status->uptime_ms, illuminator_status->enable, illuminator_status->mode_bitmask, illuminator_status->error_status, illuminator_status->mode, illuminator_status->brightness, illuminator_status->strobe_period, illuminator_status->strobe_duty_cycle, illuminator_status->temp_c, illuminator_status->min_strobe_period, illuminator_status->max_strobe_period); +} + +/** + * @brief Send a illuminator_status message + * @param chan MAVLink channel to send the message + * + * @param uptime_ms [ms] Time since the start-up of the illuminator in ms + * @param enable 0: Illuminators OFF, 1: Illuminators ON + * @param mode_bitmask Supported illuminator modes + * @param error_status Errors + * @param mode Illuminator mode + * @param brightness [%] Illuminator brightness + * @param strobe_period [s] Illuminator strobing period in seconds + * @param strobe_duty_cycle [%] Illuminator strobing duty cycle + * @param temp_c Temperature in Celsius + * @param min_strobe_period [s] Minimum strobing period in seconds + * @param max_strobe_period [s] Maximum strobing period in seconds + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_illuminator_status_send(mavlink_channel_t chan, uint32_t uptime_ms, uint8_t enable, uint8_t mode_bitmask, uint32_t error_status, uint8_t mode, float brightness, float strobe_period, float strobe_duty_cycle, float temp_c, float min_strobe_period, float max_strobe_period) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_ILLUMINATOR_STATUS_LEN]; + _mav_put_uint32_t(buf, 0, uptime_ms); + _mav_put_uint32_t(buf, 4, error_status); + _mav_put_float(buf, 8, brightness); + _mav_put_float(buf, 12, strobe_period); + _mav_put_float(buf, 16, strobe_duty_cycle); + _mav_put_float(buf, 20, temp_c); + _mav_put_float(buf, 24, min_strobe_period); + _mav_put_float(buf, 28, max_strobe_period); + _mav_put_uint8_t(buf, 32, enable); + _mav_put_uint8_t(buf, 33, mode_bitmask); + _mav_put_uint8_t(buf, 34, mode); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ILLUMINATOR_STATUS, buf, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_LEN, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_CRC); +#else + mavlink_illuminator_status_t packet; + packet.uptime_ms = uptime_ms; + packet.error_status = error_status; + packet.brightness = brightness; + packet.strobe_period = strobe_period; + packet.strobe_duty_cycle = strobe_duty_cycle; + packet.temp_c = temp_c; + packet.min_strobe_period = min_strobe_period; + packet.max_strobe_period = max_strobe_period; + packet.enable = enable; + packet.mode_bitmask = mode_bitmask; + packet.mode = mode; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ILLUMINATOR_STATUS, (const char *)&packet, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_LEN, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_CRC); +#endif +} + +/** + * @brief Send a illuminator_status message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_illuminator_status_send_struct(mavlink_channel_t chan, const mavlink_illuminator_status_t* illuminator_status) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_illuminator_status_send(chan, illuminator_status->uptime_ms, illuminator_status->enable, illuminator_status->mode_bitmask, illuminator_status->error_status, illuminator_status->mode, illuminator_status->brightness, illuminator_status->strobe_period, illuminator_status->strobe_duty_cycle, illuminator_status->temp_c, illuminator_status->min_strobe_period, illuminator_status->max_strobe_period); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ILLUMINATOR_STATUS, (const char *)illuminator_status, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_LEN, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_CRC); +#endif +} + +#if MAVLINK_MSG_ID_ILLUMINATOR_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_illuminator_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t uptime_ms, uint8_t enable, uint8_t mode_bitmask, uint32_t error_status, uint8_t mode, float brightness, float strobe_period, float strobe_duty_cycle, float temp_c, float min_strobe_period, float max_strobe_period) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint32_t(buf, 0, uptime_ms); + _mav_put_uint32_t(buf, 4, error_status); + _mav_put_float(buf, 8, brightness); + _mav_put_float(buf, 12, strobe_period); + _mav_put_float(buf, 16, strobe_duty_cycle); + _mav_put_float(buf, 20, temp_c); + _mav_put_float(buf, 24, min_strobe_period); + _mav_put_float(buf, 28, max_strobe_period); + _mav_put_uint8_t(buf, 32, enable); + _mav_put_uint8_t(buf, 33, mode_bitmask); + _mav_put_uint8_t(buf, 34, mode); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ILLUMINATOR_STATUS, buf, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_LEN, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_CRC); +#else + mavlink_illuminator_status_t *packet = (mavlink_illuminator_status_t *)msgbuf; + packet->uptime_ms = uptime_ms; + packet->error_status = error_status; + packet->brightness = brightness; + packet->strobe_period = strobe_period; + packet->strobe_duty_cycle = strobe_duty_cycle; + packet->temp_c = temp_c; + packet->min_strobe_period = min_strobe_period; + packet->max_strobe_period = max_strobe_period; + packet->enable = enable; + packet->mode_bitmask = mode_bitmask; + packet->mode = mode; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ILLUMINATOR_STATUS, (const char *)packet, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_MIN_LEN, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_LEN, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_CRC); +#endif +} +#endif + +#endif + +// MESSAGE ILLUMINATOR_STATUS UNPACKING + + +/** + * @brief Get field uptime_ms from illuminator_status message + * + * @return [ms] Time since the start-up of the illuminator in ms + */ +static inline uint32_t mavlink_msg_illuminator_status_get_uptime_ms(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 0); +} + +/** + * @brief Get field enable from illuminator_status message + * + * @return 0: Illuminators OFF, 1: Illuminators ON + */ +static inline uint8_t mavlink_msg_illuminator_status_get_enable(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 32); +} + +/** + * @brief Get field mode_bitmask from illuminator_status message + * + * @return Supported illuminator modes + */ +static inline uint8_t mavlink_msg_illuminator_status_get_mode_bitmask(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 33); +} + +/** + * @brief Get field error_status from illuminator_status message + * + * @return Errors + */ +static inline uint32_t mavlink_msg_illuminator_status_get_error_status(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 4); +} + +/** + * @brief Get field mode from illuminator_status message + * + * @return Illuminator mode + */ +static inline uint8_t mavlink_msg_illuminator_status_get_mode(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 34); +} + +/** + * @brief Get field brightness from illuminator_status message + * + * @return [%] Illuminator brightness + */ +static inline float mavlink_msg_illuminator_status_get_brightness(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 8); +} + +/** + * @brief Get field strobe_period from illuminator_status message + * + * @return [s] Illuminator strobing period in seconds + */ +static inline float mavlink_msg_illuminator_status_get_strobe_period(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 12); +} + +/** + * @brief Get field strobe_duty_cycle from illuminator_status message + * + * @return [%] Illuminator strobing duty cycle + */ +static inline float mavlink_msg_illuminator_status_get_strobe_duty_cycle(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 16); +} + +/** + * @brief Get field temp_c from illuminator_status message + * + * @return Temperature in Celsius + */ +static inline float mavlink_msg_illuminator_status_get_temp_c(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 20); +} + +/** + * @brief Get field min_strobe_period from illuminator_status message + * + * @return [s] Minimum strobing period in seconds + */ +static inline float mavlink_msg_illuminator_status_get_min_strobe_period(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 24); +} + +/** + * @brief Get field max_strobe_period from illuminator_status message + * + * @return [s] Maximum strobing period in seconds + */ +static inline float mavlink_msg_illuminator_status_get_max_strobe_period(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 28); +} + +/** + * @brief Decode a illuminator_status message into a struct + * + * @param msg The message to decode + * @param illuminator_status C-struct to decode the message contents into + */ +static inline void mavlink_msg_illuminator_status_decode(const mavlink_message_t* msg, mavlink_illuminator_status_t* illuminator_status) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + illuminator_status->uptime_ms = mavlink_msg_illuminator_status_get_uptime_ms(msg); + illuminator_status->error_status = mavlink_msg_illuminator_status_get_error_status(msg); + illuminator_status->brightness = mavlink_msg_illuminator_status_get_brightness(msg); + illuminator_status->strobe_period = mavlink_msg_illuminator_status_get_strobe_period(msg); + illuminator_status->strobe_duty_cycle = mavlink_msg_illuminator_status_get_strobe_duty_cycle(msg); + illuminator_status->temp_c = mavlink_msg_illuminator_status_get_temp_c(msg); + illuminator_status->min_strobe_period = mavlink_msg_illuminator_status_get_min_strobe_period(msg); + illuminator_status->max_strobe_period = mavlink_msg_illuminator_status_get_max_strobe_period(msg); + illuminator_status->enable = mavlink_msg_illuminator_status_get_enable(msg); + illuminator_status->mode_bitmask = mavlink_msg_illuminator_status_get_mode_bitmask(msg); + illuminator_status->mode = mavlink_msg_illuminator_status_get_mode(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_ILLUMINATOR_STATUS_LEN? msg->len : MAVLINK_MSG_ID_ILLUMINATOR_STATUS_LEN; + memset(illuminator_status, 0, MAVLINK_MSG_ID_ILLUMINATOR_STATUS_LEN); + memcpy(illuminator_status, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/common/mavlink_msg_isbd_link_status.h b/common/mavlink_msg_isbd_link_status.h index a0c53745f..7f3060a63 100644 --- a/common/mavlink_msg_isbd_link_status.h +++ b/common/mavlink_msg_isbd_link_status.h @@ -105,6 +105,60 @@ static inline uint16_t mavlink_msg_isbd_link_status_pack(uint8_t system_id, uint return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ISBD_LINK_STATUS_MIN_LEN, MAVLINK_MSG_ID_ISBD_LINK_STATUS_LEN, MAVLINK_MSG_ID_ISBD_LINK_STATUS_CRC); } +/** + * @brief Pack a isbd_link_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param timestamp [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param last_heartbeat [us] Timestamp of the last successful sbd session. The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param failed_sessions Number of failed SBD sessions. + * @param successful_sessions Number of successful SBD sessions. + * @param signal_quality Signal quality equal to the number of bars displayed on the ISU signal strength indicator. Range is 0 to 5, where 0 indicates no signal and 5 indicates maximum signal strength. + * @param ring_pending 1: Ring call pending, 0: No call pending. + * @param tx_session_pending 1: Transmission session pending, 0: No transmission session pending. + * @param rx_session_pending 1: Receiving session pending, 0: No receiving session pending. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_isbd_link_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t timestamp, uint64_t last_heartbeat, uint16_t failed_sessions, uint16_t successful_sessions, uint8_t signal_quality, uint8_t ring_pending, uint8_t tx_session_pending, uint8_t rx_session_pending) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_ISBD_LINK_STATUS_LEN]; + _mav_put_uint64_t(buf, 0, timestamp); + _mav_put_uint64_t(buf, 8, last_heartbeat); + _mav_put_uint16_t(buf, 16, failed_sessions); + _mav_put_uint16_t(buf, 18, successful_sessions); + _mav_put_uint8_t(buf, 20, signal_quality); + _mav_put_uint8_t(buf, 21, ring_pending); + _mav_put_uint8_t(buf, 22, tx_session_pending); + _mav_put_uint8_t(buf, 23, rx_session_pending); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ISBD_LINK_STATUS_LEN); +#else + mavlink_isbd_link_status_t packet; + packet.timestamp = timestamp; + packet.last_heartbeat = last_heartbeat; + packet.failed_sessions = failed_sessions; + packet.successful_sessions = successful_sessions; + packet.signal_quality = signal_quality; + packet.ring_pending = ring_pending; + packet.tx_session_pending = tx_session_pending; + packet.rx_session_pending = rx_session_pending; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ISBD_LINK_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_ISBD_LINK_STATUS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ISBD_LINK_STATUS_MIN_LEN, MAVLINK_MSG_ID_ISBD_LINK_STATUS_LEN, MAVLINK_MSG_ID_ISBD_LINK_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ISBD_LINK_STATUS_MIN_LEN, MAVLINK_MSG_ID_ISBD_LINK_STATUS_LEN); +#endif +} + /** * @brief Pack a isbd_link_status message on a channel * @param system_id ID of this system @@ -182,6 +236,20 @@ static inline uint16_t mavlink_msg_isbd_link_status_encode_chan(uint8_t system_i return mavlink_msg_isbd_link_status_pack_chan(system_id, component_id, chan, msg, isbd_link_status->timestamp, isbd_link_status->last_heartbeat, isbd_link_status->failed_sessions, isbd_link_status->successful_sessions, isbd_link_status->signal_quality, isbd_link_status->ring_pending, isbd_link_status->tx_session_pending, isbd_link_status->rx_session_pending); } +/** + * @brief Encode a isbd_link_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param isbd_link_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_isbd_link_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_isbd_link_status_t* isbd_link_status) +{ + return mavlink_msg_isbd_link_status_pack_status(system_id, component_id, _status, msg, isbd_link_status->timestamp, isbd_link_status->last_heartbeat, isbd_link_status->failed_sessions, isbd_link_status->successful_sessions, isbd_link_status->signal_quality, isbd_link_status->ring_pending, isbd_link_status->tx_session_pending, isbd_link_status->rx_session_pending); +} + /** * @brief Send a isbd_link_status message * @param chan MAVLink channel to send the message @@ -242,7 +310,7 @@ static inline void mavlink_msg_isbd_link_status_send_struct(mavlink_channel_t ch #if MAVLINK_MSG_ID_ISBD_LINK_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_landing_target.h b/common/mavlink_msg_landing_target.h index 1d1b41ed8..bb863dde2 100644 --- a/common/mavlink_msg_landing_target.h +++ b/common/mavlink_msg_landing_target.h @@ -18,7 +18,7 @@ typedef struct __mavlink_landing_target_t { float z; /*< [m] Z Position of the landing target in MAV_FRAME*/ float q[4]; /*< Quaternion of landing target orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0)*/ uint8_t type; /*< Type of landing target*/ - uint8_t position_valid; /*< Boolean indicating whether the position fields (x, y, z, q, type) contain valid target position information (valid: 1, invalid: 0). Default is 0 (invalid).*/ + uint8_t position_valid; /*< Position fields (x, y, z, q, type) contain valid target position information (MAV_BOOL_FALSE: invalid values). Values not equal to 0 or 1 are invalid.*/ }) mavlink_landing_target_t; #define MAVLINK_MSG_ID_LANDING_TARGET_LEN 60 @@ -93,7 +93,7 @@ typedef struct __mavlink_landing_target_t { * @param z [m] Z Position of the landing target in MAV_FRAME * @param q Quaternion of landing target orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0) * @param type Type of landing target - * @param position_valid Boolean indicating whether the position fields (x, y, z, q, type) contain valid target position information (valid: 1, invalid: 0). Default is 0 (invalid). + * @param position_valid Position fields (x, y, z, q, type) contain valid target position information (MAV_BOOL_FALSE: invalid values). Values not equal to 0 or 1 are invalid. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_landing_target_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, @@ -131,7 +131,7 @@ static inline uint16_t mavlink_msg_landing_target_pack(uint8_t system_id, uint8_ packet.z = z; packet.type = type; packet.position_valid = position_valid; - mav_array_memcpy(packet.q, q, sizeof(float)*4); + mav_array_assign_float(packet.q, q, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LANDING_TARGET_LEN); #endif @@ -139,6 +139,76 @@ static inline uint16_t mavlink_msg_landing_target_pack(uint8_t system_id, uint8_ return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LANDING_TARGET_MIN_LEN, MAVLINK_MSG_ID_LANDING_TARGET_LEN, MAVLINK_MSG_ID_LANDING_TARGET_CRC); } +/** + * @brief Pack a landing_target message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param target_num The ID of the target if multiple targets are present + * @param frame Coordinate frame used for following fields. + * @param angle_x [rad] X-axis angular offset of the target from the center of the image + * @param angle_y [rad] Y-axis angular offset of the target from the center of the image + * @param distance [m] Distance to the target from the vehicle + * @param size_x [rad] Size of target along x-axis + * @param size_y [rad] Size of target along y-axis + * @param x [m] X Position of the landing target in MAV_FRAME + * @param y [m] Y Position of the landing target in MAV_FRAME + * @param z [m] Z Position of the landing target in MAV_FRAME + * @param q Quaternion of landing target orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0) + * @param type Type of landing target + * @param position_valid Position fields (x, y, z, q, type) contain valid target position information (MAV_BOOL_FALSE: invalid values). Values not equal to 0 or 1 are invalid. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_landing_target_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, uint8_t target_num, uint8_t frame, float angle_x, float angle_y, float distance, float size_x, float size_y, float x, float y, float z, const float *q, uint8_t type, uint8_t position_valid) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_LANDING_TARGET_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, angle_x); + _mav_put_float(buf, 12, angle_y); + _mav_put_float(buf, 16, distance); + _mav_put_float(buf, 20, size_x); + _mav_put_float(buf, 24, size_y); + _mav_put_uint8_t(buf, 28, target_num); + _mav_put_uint8_t(buf, 29, frame); + _mav_put_float(buf, 30, x); + _mav_put_float(buf, 34, y); + _mav_put_float(buf, 38, z); + _mav_put_uint8_t(buf, 58, type); + _mav_put_uint8_t(buf, 59, position_valid); + _mav_put_float_array(buf, 42, q, 4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LANDING_TARGET_LEN); +#else + mavlink_landing_target_t packet; + packet.time_usec = time_usec; + packet.angle_x = angle_x; + packet.angle_y = angle_y; + packet.distance = distance; + packet.size_x = size_x; + packet.size_y = size_y; + packet.target_num = target_num; + packet.frame = frame; + packet.x = x; + packet.y = y; + packet.z = z; + packet.type = type; + packet.position_valid = position_valid; + mav_array_memcpy(packet.q, q, sizeof(float)*4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LANDING_TARGET_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_LANDING_TARGET; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LANDING_TARGET_MIN_LEN, MAVLINK_MSG_ID_LANDING_TARGET_LEN, MAVLINK_MSG_ID_LANDING_TARGET_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LANDING_TARGET_MIN_LEN, MAVLINK_MSG_ID_LANDING_TARGET_LEN); +#endif +} + /** * @brief Pack a landing_target message on a channel * @param system_id ID of this system @@ -158,7 +228,7 @@ static inline uint16_t mavlink_msg_landing_target_pack(uint8_t system_id, uint8_ * @param z [m] Z Position of the landing target in MAV_FRAME * @param q Quaternion of landing target orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0) * @param type Type of landing target - * @param position_valid Boolean indicating whether the position fields (x, y, z, q, type) contain valid target position information (valid: 1, invalid: 0). Default is 0 (invalid). + * @param position_valid Position fields (x, y, z, q, type) contain valid target position information (MAV_BOOL_FALSE: invalid values). Values not equal to 0 or 1 are invalid. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_landing_target_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, @@ -197,7 +267,7 @@ static inline uint16_t mavlink_msg_landing_target_pack_chan(uint8_t system_id, u packet.z = z; packet.type = type; packet.position_valid = position_valid; - mav_array_memcpy(packet.q, q, sizeof(float)*4); + mav_array_assign_float(packet.q, q, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LANDING_TARGET_LEN); #endif @@ -232,6 +302,20 @@ static inline uint16_t mavlink_msg_landing_target_encode_chan(uint8_t system_id, return mavlink_msg_landing_target_pack_chan(system_id, component_id, chan, msg, landing_target->time_usec, landing_target->target_num, landing_target->frame, landing_target->angle_x, landing_target->angle_y, landing_target->distance, landing_target->size_x, landing_target->size_y, landing_target->x, landing_target->y, landing_target->z, landing_target->q, landing_target->type, landing_target->position_valid); } +/** + * @brief Encode a landing_target struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param landing_target C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_landing_target_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_landing_target_t* landing_target) +{ + return mavlink_msg_landing_target_pack_status(system_id, component_id, _status, msg, landing_target->time_usec, landing_target->target_num, landing_target->frame, landing_target->angle_x, landing_target->angle_y, landing_target->distance, landing_target->size_x, landing_target->size_y, landing_target->x, landing_target->y, landing_target->z, landing_target->q, landing_target->type, landing_target->position_valid); +} + /** * @brief Send a landing_target message * @param chan MAVLink channel to send the message @@ -249,7 +333,7 @@ static inline uint16_t mavlink_msg_landing_target_encode_chan(uint8_t system_id, * @param z [m] Z Position of the landing target in MAV_FRAME * @param q Quaternion of landing target orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0) * @param type Type of landing target - * @param position_valid Boolean indicating whether the position fields (x, y, z, q, type) contain valid target position information (valid: 1, invalid: 0). Default is 0 (invalid). + * @param position_valid Position fields (x, y, z, q, type) contain valid target position information (MAV_BOOL_FALSE: invalid values). Values not equal to 0 or 1 are invalid. */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS @@ -287,7 +371,7 @@ static inline void mavlink_msg_landing_target_send(mavlink_channel_t chan, uint6 packet.z = z; packet.type = type; packet.position_valid = position_valid; - mav_array_memcpy(packet.q, q, sizeof(float)*4); + mav_array_assign_float(packet.q, q, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LANDING_TARGET, (const char *)&packet, MAVLINK_MSG_ID_LANDING_TARGET_MIN_LEN, MAVLINK_MSG_ID_LANDING_TARGET_LEN, MAVLINK_MSG_ID_LANDING_TARGET_CRC); #endif } @@ -308,7 +392,7 @@ static inline void mavlink_msg_landing_target_send_struct(mavlink_channel_t chan #if MAVLINK_MSG_ID_LANDING_TARGET_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -348,7 +432,7 @@ static inline void mavlink_msg_landing_target_send_buf(mavlink_message_t *msgbuf packet->z = z; packet->type = type; packet->position_valid = position_valid; - mav_array_memcpy(packet->q, q, sizeof(float)*4); + mav_array_assign_float(packet->q, q, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LANDING_TARGET, (const char *)packet, MAVLINK_MSG_ID_LANDING_TARGET_MIN_LEN, MAVLINK_MSG_ID_LANDING_TARGET_LEN, MAVLINK_MSG_ID_LANDING_TARGET_CRC); #endif } @@ -492,7 +576,7 @@ static inline uint8_t mavlink_msg_landing_target_get_type(const mavlink_message_ /** * @brief Get field position_valid from landing_target message * - * @return Boolean indicating whether the position fields (x, y, z, q, type) contain valid target position information (valid: 1, invalid: 0). Default is 0 (invalid). + * @return Position fields (x, y, z, q, type) contain valid target position information (MAV_BOOL_FALSE: invalid values). Values not equal to 0 or 1 are invalid. */ static inline uint8_t mavlink_msg_landing_target_get_position_valid(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_link_node_status.h b/common/mavlink_msg_link_node_status.h index 8da7b71d9..d3bb36b8a 100644 --- a/common/mavlink_msg_link_node_status.h +++ b/common/mavlink_msg_link_node_status.h @@ -123,6 +123,69 @@ static inline uint16_t mavlink_msg_link_node_status_pack(uint8_t system_id, uint return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LINK_NODE_STATUS_MIN_LEN, MAVLINK_MSG_ID_LINK_NODE_STATUS_LEN, MAVLINK_MSG_ID_LINK_NODE_STATUS_CRC); } +/** + * @brief Pack a link_node_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param timestamp [ms] Timestamp (time since system boot). + * @param tx_buf [%] Remaining free transmit buffer space + * @param rx_buf [%] Remaining free receive buffer space + * @param tx_rate [bytes/s] Transmit rate + * @param rx_rate [bytes/s] Receive rate + * @param rx_parse_err [bytes] Number of bytes that could not be parsed correctly. + * @param tx_overflows [bytes] Transmit buffer overflows. This number wraps around as it reaches UINT16_MAX + * @param rx_overflows [bytes] Receive buffer overflows. This number wraps around as it reaches UINT16_MAX + * @param messages_sent Messages sent + * @param messages_received Messages received (estimated from counting seq) + * @param messages_lost Messages lost (estimated from counting seq) + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_link_node_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t timestamp, uint8_t tx_buf, uint8_t rx_buf, uint32_t tx_rate, uint32_t rx_rate, uint16_t rx_parse_err, uint16_t tx_overflows, uint16_t rx_overflows, uint32_t messages_sent, uint32_t messages_received, uint32_t messages_lost) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_LINK_NODE_STATUS_LEN]; + _mav_put_uint64_t(buf, 0, timestamp); + _mav_put_uint32_t(buf, 8, tx_rate); + _mav_put_uint32_t(buf, 12, rx_rate); + _mav_put_uint32_t(buf, 16, messages_sent); + _mav_put_uint32_t(buf, 20, messages_received); + _mav_put_uint32_t(buf, 24, messages_lost); + _mav_put_uint16_t(buf, 28, rx_parse_err); + _mav_put_uint16_t(buf, 30, tx_overflows); + _mav_put_uint16_t(buf, 32, rx_overflows); + _mav_put_uint8_t(buf, 34, tx_buf); + _mav_put_uint8_t(buf, 35, rx_buf); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LINK_NODE_STATUS_LEN); +#else + mavlink_link_node_status_t packet; + packet.timestamp = timestamp; + packet.tx_rate = tx_rate; + packet.rx_rate = rx_rate; + packet.messages_sent = messages_sent; + packet.messages_received = messages_received; + packet.messages_lost = messages_lost; + packet.rx_parse_err = rx_parse_err; + packet.tx_overflows = tx_overflows; + packet.rx_overflows = rx_overflows; + packet.tx_buf = tx_buf; + packet.rx_buf = rx_buf; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LINK_NODE_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_LINK_NODE_STATUS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LINK_NODE_STATUS_MIN_LEN, MAVLINK_MSG_ID_LINK_NODE_STATUS_LEN, MAVLINK_MSG_ID_LINK_NODE_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LINK_NODE_STATUS_MIN_LEN, MAVLINK_MSG_ID_LINK_NODE_STATUS_LEN); +#endif +} + /** * @brief Pack a link_node_status message on a channel * @param system_id ID of this system @@ -209,6 +272,20 @@ static inline uint16_t mavlink_msg_link_node_status_encode_chan(uint8_t system_i return mavlink_msg_link_node_status_pack_chan(system_id, component_id, chan, msg, link_node_status->timestamp, link_node_status->tx_buf, link_node_status->rx_buf, link_node_status->tx_rate, link_node_status->rx_rate, link_node_status->rx_parse_err, link_node_status->tx_overflows, link_node_status->rx_overflows, link_node_status->messages_sent, link_node_status->messages_received, link_node_status->messages_lost); } +/** + * @brief Encode a link_node_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param link_node_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_link_node_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_link_node_status_t* link_node_status) +{ + return mavlink_msg_link_node_status_pack_status(system_id, component_id, _status, msg, link_node_status->timestamp, link_node_status->tx_buf, link_node_status->rx_buf, link_node_status->tx_rate, link_node_status->rx_rate, link_node_status->rx_parse_err, link_node_status->tx_overflows, link_node_status->rx_overflows, link_node_status->messages_sent, link_node_status->messages_received, link_node_status->messages_lost); +} + /** * @brief Send a link_node_status message * @param chan MAVLink channel to send the message @@ -278,7 +355,7 @@ static inline void mavlink_msg_link_node_status_send_struct(mavlink_channel_t ch #if MAVLINK_MSG_ID_LINK_NODE_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_local_position_ned.h b/common/mavlink_msg_local_position_ned.h index 48c71d90d..a78743586 100644 --- a/common/mavlink_msg_local_position_ned.h +++ b/common/mavlink_msg_local_position_ned.h @@ -99,6 +99,57 @@ static inline uint16_t mavlink_msg_local_position_ned_pack(uint8_t system_id, ui return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LOCAL_POSITION_NED_MIN_LEN, MAVLINK_MSG_ID_LOCAL_POSITION_NED_LEN, MAVLINK_MSG_ID_LOCAL_POSITION_NED_CRC); } +/** + * @brief Pack a local_position_ned message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param x [m] X Position + * @param y [m] Y Position + * @param z [m] Z Position + * @param vx [m/s] X Speed + * @param vy [m/s] Y Speed + * @param vz [m/s] Z Speed + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_local_position_ned_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, float x, float y, float z, float vx, float vy, float vz) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_LOCAL_POSITION_NED_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_float(buf, 4, x); + _mav_put_float(buf, 8, y); + _mav_put_float(buf, 12, z); + _mav_put_float(buf, 16, vx); + _mav_put_float(buf, 20, vy); + _mav_put_float(buf, 24, vz); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LOCAL_POSITION_NED_LEN); +#else + mavlink_local_position_ned_t packet; + packet.time_boot_ms = time_boot_ms; + packet.x = x; + packet.y = y; + packet.z = z; + packet.vx = vx; + packet.vy = vy; + packet.vz = vz; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOCAL_POSITION_NED_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_LOCAL_POSITION_NED; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LOCAL_POSITION_NED_MIN_LEN, MAVLINK_MSG_ID_LOCAL_POSITION_NED_LEN, MAVLINK_MSG_ID_LOCAL_POSITION_NED_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LOCAL_POSITION_NED_MIN_LEN, MAVLINK_MSG_ID_LOCAL_POSITION_NED_LEN); +#endif +} + /** * @brief Pack a local_position_ned message on a channel * @param system_id ID of this system @@ -173,6 +224,20 @@ static inline uint16_t mavlink_msg_local_position_ned_encode_chan(uint8_t system return mavlink_msg_local_position_ned_pack_chan(system_id, component_id, chan, msg, local_position_ned->time_boot_ms, local_position_ned->x, local_position_ned->y, local_position_ned->z, local_position_ned->vx, local_position_ned->vy, local_position_ned->vz); } +/** + * @brief Encode a local_position_ned struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param local_position_ned C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_local_position_ned_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_local_position_ned_t* local_position_ned) +{ + return mavlink_msg_local_position_ned_pack_status(system_id, component_id, _status, msg, local_position_ned->time_boot_ms, local_position_ned->x, local_position_ned->y, local_position_ned->z, local_position_ned->vx, local_position_ned->vy, local_position_ned->vz); +} + /** * @brief Send a local_position_ned message * @param chan MAVLink channel to send the message @@ -230,7 +295,7 @@ static inline void mavlink_msg_local_position_ned_send_struct(mavlink_channel_t #if MAVLINK_MSG_ID_LOCAL_POSITION_NED_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_local_position_ned_cov.h b/common/mavlink_msg_local_position_ned_cov.h index 8497c7d0a..9af9f1694 100644 --- a/common/mavlink_msg_local_position_ned_cov.h +++ b/common/mavlink_msg_local_position_ned_cov.h @@ -119,7 +119,7 @@ static inline uint16_t mavlink_msg_local_position_ned_cov_pack(uint8_t system_id packet.ay = ay; packet.az = az; packet.estimator_type = estimator_type; - mav_array_memcpy(packet.covariance, covariance, sizeof(float)*45); + mav_array_assign_float(packet.covariance, covariance, 45); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN); #endif @@ -127,6 +127,70 @@ static inline uint16_t mavlink_msg_local_position_ned_cov_pack(uint8_t system_id return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_MIN_LEN, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_CRC); } +/** + * @brief Pack a local_position_ned_cov message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param estimator_type Class id of the estimator this estimate originated from. + * @param x [m] X Position + * @param y [m] Y Position + * @param z [m] Z Position + * @param vx [m/s] X Speed + * @param vy [m/s] Y Speed + * @param vz [m/s] Z Speed + * @param ax [m/s/s] X Acceleration + * @param ay [m/s/s] Y Acceleration + * @param az [m/s/s] Z Acceleration + * @param covariance Row-major representation of position, velocity and acceleration 9x9 cross-covariance matrix upper right triangle (states: x, y, z, vx, vy, vz, ax, ay, az; first nine entries are the first ROW, next eight entries are the second row, etc.). If unknown, assign NaN value to first element in the array. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_local_position_ned_cov_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, uint8_t estimator_type, float x, float y, float z, float vx, float vy, float vz, float ax, float ay, float az, const float *covariance) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, x); + _mav_put_float(buf, 12, y); + _mav_put_float(buf, 16, z); + _mav_put_float(buf, 20, vx); + _mav_put_float(buf, 24, vy); + _mav_put_float(buf, 28, vz); + _mav_put_float(buf, 32, ax); + _mav_put_float(buf, 36, ay); + _mav_put_float(buf, 40, az); + _mav_put_uint8_t(buf, 224, estimator_type); + _mav_put_float_array(buf, 44, covariance, 45); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN); +#else + mavlink_local_position_ned_cov_t packet; + packet.time_usec = time_usec; + packet.x = x; + packet.y = y; + packet.z = z; + packet.vx = vx; + packet.vy = vy; + packet.vz = vz; + packet.ax = ax; + packet.ay = ay; + packet.az = az; + packet.estimator_type = estimator_type; + mav_array_memcpy(packet.covariance, covariance, sizeof(float)*45); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_MIN_LEN, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_MIN_LEN, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN); +#endif +} + /** * @brief Pack a local_position_ned_cov message on a channel * @param system_id ID of this system @@ -179,7 +243,7 @@ static inline uint16_t mavlink_msg_local_position_ned_cov_pack_chan(uint8_t syst packet.ay = ay; packet.az = az; packet.estimator_type = estimator_type; - mav_array_memcpy(packet.covariance, covariance, sizeof(float)*45); + mav_array_assign_float(packet.covariance, covariance, 45); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN); #endif @@ -214,6 +278,20 @@ static inline uint16_t mavlink_msg_local_position_ned_cov_encode_chan(uint8_t sy return mavlink_msg_local_position_ned_cov_pack_chan(system_id, component_id, chan, msg, local_position_ned_cov->time_usec, local_position_ned_cov->estimator_type, local_position_ned_cov->x, local_position_ned_cov->y, local_position_ned_cov->z, local_position_ned_cov->vx, local_position_ned_cov->vy, local_position_ned_cov->vz, local_position_ned_cov->ax, local_position_ned_cov->ay, local_position_ned_cov->az, local_position_ned_cov->covariance); } +/** + * @brief Encode a local_position_ned_cov struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param local_position_ned_cov C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_local_position_ned_cov_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_local_position_ned_cov_t* local_position_ned_cov) +{ + return mavlink_msg_local_position_ned_cov_pack_status(system_id, component_id, _status, msg, local_position_ned_cov->time_usec, local_position_ned_cov->estimator_type, local_position_ned_cov->x, local_position_ned_cov->y, local_position_ned_cov->z, local_position_ned_cov->vx, local_position_ned_cov->vy, local_position_ned_cov->vz, local_position_ned_cov->ax, local_position_ned_cov->ay, local_position_ned_cov->az, local_position_ned_cov->covariance); +} + /** * @brief Send a local_position_ned_cov message * @param chan MAVLink channel to send the message @@ -263,7 +341,7 @@ static inline void mavlink_msg_local_position_ned_cov_send(mavlink_channel_t cha packet.ay = ay; packet.az = az; packet.estimator_type = estimator_type; - mav_array_memcpy(packet.covariance, covariance, sizeof(float)*45); + mav_array_assign_float(packet.covariance, covariance, 45); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV, (const char *)&packet, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_MIN_LEN, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_CRC); #endif } @@ -284,7 +362,7 @@ static inline void mavlink_msg_local_position_ned_cov_send_struct(mavlink_channe #if MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -320,7 +398,7 @@ static inline void mavlink_msg_local_position_ned_cov_send_buf(mavlink_message_t packet->ay = ay; packet->az = az; packet->estimator_type = estimator_type; - mav_array_memcpy(packet->covariance, covariance, sizeof(float)*45); + mav_array_assign_float(packet->covariance, covariance, 45); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV, (const char *)packet, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_MIN_LEN, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_CRC); #endif } diff --git a/common/mavlink_msg_local_position_ned_system_global_offset.h b/common/mavlink_msg_local_position_ned_system_global_offset.h index 8ff2ba652..2b8b696b7 100644 --- a/common/mavlink_msg_local_position_ned_system_global_offset.h +++ b/common/mavlink_msg_local_position_ned_system_global_offset.h @@ -99,6 +99,57 @@ static inline uint16_t mavlink_msg_local_position_ned_system_global_offset_pack( return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET_MIN_LEN, MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET_LEN, MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET_CRC); } +/** + * @brief Pack a local_position_ned_system_global_offset message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param x [m] X Position + * @param y [m] Y Position + * @param z [m] Z Position + * @param roll [rad] Roll + * @param pitch [rad] Pitch + * @param yaw [rad] Yaw + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_local_position_ned_system_global_offset_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, float x, float y, float z, float roll, float pitch, float yaw) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_float(buf, 4, x); + _mav_put_float(buf, 8, y); + _mav_put_float(buf, 12, z); + _mav_put_float(buf, 16, roll); + _mav_put_float(buf, 20, pitch); + _mav_put_float(buf, 24, yaw); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET_LEN); +#else + mavlink_local_position_ned_system_global_offset_t packet; + packet.time_boot_ms = time_boot_ms; + packet.x = x; + packet.y = y; + packet.z = z; + packet.roll = roll; + packet.pitch = pitch; + packet.yaw = yaw; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET_MIN_LEN, MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET_LEN, MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET_MIN_LEN, MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET_LEN); +#endif +} + /** * @brief Pack a local_position_ned_system_global_offset message on a channel * @param system_id ID of this system @@ -173,6 +224,20 @@ static inline uint16_t mavlink_msg_local_position_ned_system_global_offset_encod return mavlink_msg_local_position_ned_system_global_offset_pack_chan(system_id, component_id, chan, msg, local_position_ned_system_global_offset->time_boot_ms, local_position_ned_system_global_offset->x, local_position_ned_system_global_offset->y, local_position_ned_system_global_offset->z, local_position_ned_system_global_offset->roll, local_position_ned_system_global_offset->pitch, local_position_ned_system_global_offset->yaw); } +/** + * @brief Encode a local_position_ned_system_global_offset struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param local_position_ned_system_global_offset C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_local_position_ned_system_global_offset_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_local_position_ned_system_global_offset_t* local_position_ned_system_global_offset) +{ + return mavlink_msg_local_position_ned_system_global_offset_pack_status(system_id, component_id, _status, msg, local_position_ned_system_global_offset->time_boot_ms, local_position_ned_system_global_offset->x, local_position_ned_system_global_offset->y, local_position_ned_system_global_offset->z, local_position_ned_system_global_offset->roll, local_position_ned_system_global_offset->pitch, local_position_ned_system_global_offset->yaw); +} + /** * @brief Send a local_position_ned_system_global_offset message * @param chan MAVLink channel to send the message @@ -230,7 +295,7 @@ static inline void mavlink_msg_local_position_ned_system_global_offset_send_stru #if MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_log_data.h b/common/mavlink_msg_log_data.h index 37cd77777..413d54826 100644 --- a/common/mavlink_msg_log_data.h +++ b/common/mavlink_msg_log_data.h @@ -71,7 +71,7 @@ static inline uint16_t mavlink_msg_log_data_pack(uint8_t system_id, uint8_t comp packet.ofs = ofs; packet.id = id; packet.count = count; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*90); + mav_array_assign_uint8_t(packet.data, data, 90); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOG_DATA_LEN); #endif @@ -79,6 +79,46 @@ static inline uint16_t mavlink_msg_log_data_pack(uint8_t system_id, uint8_t comp return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LOG_DATA_MIN_LEN, MAVLINK_MSG_ID_LOG_DATA_LEN, MAVLINK_MSG_ID_LOG_DATA_CRC); } +/** + * @brief Pack a log_data message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param id Log id (from LOG_ENTRY reply) + * @param ofs Offset into the log + * @param count [bytes] Number of bytes (zero for end of log) + * @param data log data + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_log_data_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint16_t id, uint32_t ofs, uint8_t count, const uint8_t *data) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_LOG_DATA_LEN]; + _mav_put_uint32_t(buf, 0, ofs); + _mav_put_uint16_t(buf, 4, id); + _mav_put_uint8_t(buf, 6, count); + _mav_put_uint8_t_array(buf, 7, data, 90); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LOG_DATA_LEN); +#else + mavlink_log_data_t packet; + packet.ofs = ofs; + packet.id = id; + packet.count = count; + mav_array_memcpy(packet.data, data, sizeof(uint8_t)*90); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOG_DATA_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_LOG_DATA; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LOG_DATA_MIN_LEN, MAVLINK_MSG_ID_LOG_DATA_LEN, MAVLINK_MSG_ID_LOG_DATA_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LOG_DATA_MIN_LEN, MAVLINK_MSG_ID_LOG_DATA_LEN); +#endif +} + /** * @brief Pack a log_data message on a channel * @param system_id ID of this system @@ -107,7 +147,7 @@ static inline uint16_t mavlink_msg_log_data_pack_chan(uint8_t system_id, uint8_t packet.ofs = ofs; packet.id = id; packet.count = count; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*90); + mav_array_assign_uint8_t(packet.data, data, 90); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOG_DATA_LEN); #endif @@ -142,6 +182,20 @@ static inline uint16_t mavlink_msg_log_data_encode_chan(uint8_t system_id, uint8 return mavlink_msg_log_data_pack_chan(system_id, component_id, chan, msg, log_data->id, log_data->ofs, log_data->count, log_data->data); } +/** + * @brief Encode a log_data struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param log_data C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_log_data_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_log_data_t* log_data) +{ + return mavlink_msg_log_data_pack_status(system_id, component_id, _status, msg, log_data->id, log_data->ofs, log_data->count, log_data->data); +} + /** * @brief Send a log_data message * @param chan MAVLink channel to send the message @@ -167,7 +221,7 @@ static inline void mavlink_msg_log_data_send(mavlink_channel_t chan, uint16_t id packet.ofs = ofs; packet.id = id; packet.count = count; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*90); + mav_array_assign_uint8_t(packet.data, data, 90); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOG_DATA, (const char *)&packet, MAVLINK_MSG_ID_LOG_DATA_MIN_LEN, MAVLINK_MSG_ID_LOG_DATA_LEN, MAVLINK_MSG_ID_LOG_DATA_CRC); #endif } @@ -188,7 +242,7 @@ static inline void mavlink_msg_log_data_send_struct(mavlink_channel_t chan, cons #if MAVLINK_MSG_ID_LOG_DATA_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -208,7 +262,7 @@ static inline void mavlink_msg_log_data_send_buf(mavlink_message_t *msgbuf, mavl packet->ofs = ofs; packet->id = id; packet->count = count; - mav_array_memcpy(packet->data, data, sizeof(uint8_t)*90); + mav_array_assign_uint8_t(packet->data, data, 90); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOG_DATA, (const char *)packet, MAVLINK_MSG_ID_LOG_DATA_MIN_LEN, MAVLINK_MSG_ID_LOG_DATA_LEN, MAVLINK_MSG_ID_LOG_DATA_CRC); #endif } diff --git a/common/mavlink_msg_log_entry.h b/common/mavlink_msg_log_entry.h index 3020dc74e..c2d4502bc 100644 --- a/common/mavlink_msg_log_entry.h +++ b/common/mavlink_msg_log_entry.h @@ -87,6 +87,51 @@ static inline uint16_t mavlink_msg_log_entry_pack(uint8_t system_id, uint8_t com return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LOG_ENTRY_MIN_LEN, MAVLINK_MSG_ID_LOG_ENTRY_LEN, MAVLINK_MSG_ID_LOG_ENTRY_CRC); } +/** + * @brief Pack a log_entry message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param id Log id + * @param num_logs Total number of logs + * @param last_log_num High log number + * @param time_utc [s] UTC timestamp of log since 1970, or 0 if not available + * @param size [bytes] Size of the log (may be approximate) + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_log_entry_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint16_t id, uint16_t num_logs, uint16_t last_log_num, uint32_t time_utc, uint32_t size) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_LOG_ENTRY_LEN]; + _mav_put_uint32_t(buf, 0, time_utc); + _mav_put_uint32_t(buf, 4, size); + _mav_put_uint16_t(buf, 8, id); + _mav_put_uint16_t(buf, 10, num_logs); + _mav_put_uint16_t(buf, 12, last_log_num); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LOG_ENTRY_LEN); +#else + mavlink_log_entry_t packet; + packet.time_utc = time_utc; + packet.size = size; + packet.id = id; + packet.num_logs = num_logs; + packet.last_log_num = last_log_num; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOG_ENTRY_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_LOG_ENTRY; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LOG_ENTRY_MIN_LEN, MAVLINK_MSG_ID_LOG_ENTRY_LEN, MAVLINK_MSG_ID_LOG_ENTRY_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LOG_ENTRY_MIN_LEN, MAVLINK_MSG_ID_LOG_ENTRY_LEN); +#endif +} + /** * @brief Pack a log_entry message on a channel * @param system_id ID of this system @@ -155,6 +200,20 @@ static inline uint16_t mavlink_msg_log_entry_encode_chan(uint8_t system_id, uint return mavlink_msg_log_entry_pack_chan(system_id, component_id, chan, msg, log_entry->id, log_entry->num_logs, log_entry->last_log_num, log_entry->time_utc, log_entry->size); } +/** + * @brief Encode a log_entry struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param log_entry C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_log_entry_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_log_entry_t* log_entry) +{ + return mavlink_msg_log_entry_pack_status(system_id, component_id, _status, msg, log_entry->id, log_entry->num_logs, log_entry->last_log_num, log_entry->time_utc, log_entry->size); +} + /** * @brief Send a log_entry message * @param chan MAVLink channel to send the message @@ -206,7 +265,7 @@ static inline void mavlink_msg_log_entry_send_struct(mavlink_channel_t chan, con #if MAVLINK_MSG_ID_LOG_ENTRY_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_log_erase.h b/common/mavlink_msg_log_erase.h index c3e4263e0..960709c5f 100644 --- a/common/mavlink_msg_log_erase.h +++ b/common/mavlink_msg_log_erase.h @@ -69,6 +69,42 @@ static inline uint16_t mavlink_msg_log_erase_pack(uint8_t system_id, uint8_t com return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LOG_ERASE_MIN_LEN, MAVLINK_MSG_ID_LOG_ERASE_LEN, MAVLINK_MSG_ID_LOG_ERASE_CRC); } +/** + * @brief Pack a log_erase message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_log_erase_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_LOG_ERASE_LEN]; + _mav_put_uint8_t(buf, 0, target_system); + _mav_put_uint8_t(buf, 1, target_component); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LOG_ERASE_LEN); +#else + mavlink_log_erase_t packet; + packet.target_system = target_system; + packet.target_component = target_component; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOG_ERASE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_LOG_ERASE; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LOG_ERASE_MIN_LEN, MAVLINK_MSG_ID_LOG_ERASE_LEN, MAVLINK_MSG_ID_LOG_ERASE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LOG_ERASE_MIN_LEN, MAVLINK_MSG_ID_LOG_ERASE_LEN); +#endif +} + /** * @brief Pack a log_erase message on a channel * @param system_id ID of this system @@ -128,6 +164,20 @@ static inline uint16_t mavlink_msg_log_erase_encode_chan(uint8_t system_id, uint return mavlink_msg_log_erase_pack_chan(system_id, component_id, chan, msg, log_erase->target_system, log_erase->target_component); } +/** + * @brief Encode a log_erase struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param log_erase C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_log_erase_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_log_erase_t* log_erase) +{ + return mavlink_msg_log_erase_pack_status(system_id, component_id, _status, msg, log_erase->target_system, log_erase->target_component); +} + /** * @brief Send a log_erase message * @param chan MAVLink channel to send the message @@ -170,7 +220,7 @@ static inline void mavlink_msg_log_erase_send_struct(mavlink_channel_t chan, con #if MAVLINK_MSG_ID_LOG_ERASE_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_log_request_data.h b/common/mavlink_msg_log_request_data.h index 521b8522c..31044e422 100644 --- a/common/mavlink_msg_log_request_data.h +++ b/common/mavlink_msg_log_request_data.h @@ -87,6 +87,51 @@ static inline uint16_t mavlink_msg_log_request_data_pack(uint8_t system_id, uint return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LOG_REQUEST_DATA_MIN_LEN, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN, MAVLINK_MSG_ID_LOG_REQUEST_DATA_CRC); } +/** + * @brief Pack a log_request_data message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param id Log id (from LOG_ENTRY reply) + * @param ofs Offset into the log + * @param count [bytes] Number of bytes + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_log_request_data_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint16_t id, uint32_t ofs, uint32_t count) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN]; + _mav_put_uint32_t(buf, 0, ofs); + _mav_put_uint32_t(buf, 4, count); + _mav_put_uint16_t(buf, 8, id); + _mav_put_uint8_t(buf, 10, target_system); + _mav_put_uint8_t(buf, 11, target_component); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN); +#else + mavlink_log_request_data_t packet; + packet.ofs = ofs; + packet.count = count; + packet.id = id; + packet.target_system = target_system; + packet.target_component = target_component; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_LOG_REQUEST_DATA; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LOG_REQUEST_DATA_MIN_LEN, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN, MAVLINK_MSG_ID_LOG_REQUEST_DATA_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LOG_REQUEST_DATA_MIN_LEN, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN); +#endif +} + /** * @brief Pack a log_request_data message on a channel * @param system_id ID of this system @@ -155,6 +200,20 @@ static inline uint16_t mavlink_msg_log_request_data_encode_chan(uint8_t system_i return mavlink_msg_log_request_data_pack_chan(system_id, component_id, chan, msg, log_request_data->target_system, log_request_data->target_component, log_request_data->id, log_request_data->ofs, log_request_data->count); } +/** + * @brief Encode a log_request_data struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param log_request_data C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_log_request_data_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_log_request_data_t* log_request_data) +{ + return mavlink_msg_log_request_data_pack_status(system_id, component_id, _status, msg, log_request_data->target_system, log_request_data->target_component, log_request_data->id, log_request_data->ofs, log_request_data->count); +} + /** * @brief Send a log_request_data message * @param chan MAVLink channel to send the message @@ -206,7 +265,7 @@ static inline void mavlink_msg_log_request_data_send_struct(mavlink_channel_t ch #if MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_log_request_end.h b/common/mavlink_msg_log_request_end.h index a2a7fe361..b34c412ab 100644 --- a/common/mavlink_msg_log_request_end.h +++ b/common/mavlink_msg_log_request_end.h @@ -69,6 +69,42 @@ static inline uint16_t mavlink_msg_log_request_end_pack(uint8_t system_id, uint8 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LOG_REQUEST_END_MIN_LEN, MAVLINK_MSG_ID_LOG_REQUEST_END_LEN, MAVLINK_MSG_ID_LOG_REQUEST_END_CRC); } +/** + * @brief Pack a log_request_end message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_log_request_end_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_LOG_REQUEST_END_LEN]; + _mav_put_uint8_t(buf, 0, target_system); + _mav_put_uint8_t(buf, 1, target_component); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LOG_REQUEST_END_LEN); +#else + mavlink_log_request_end_t packet; + packet.target_system = target_system; + packet.target_component = target_component; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOG_REQUEST_END_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_LOG_REQUEST_END; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LOG_REQUEST_END_MIN_LEN, MAVLINK_MSG_ID_LOG_REQUEST_END_LEN, MAVLINK_MSG_ID_LOG_REQUEST_END_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LOG_REQUEST_END_MIN_LEN, MAVLINK_MSG_ID_LOG_REQUEST_END_LEN); +#endif +} + /** * @brief Pack a log_request_end message on a channel * @param system_id ID of this system @@ -128,6 +164,20 @@ static inline uint16_t mavlink_msg_log_request_end_encode_chan(uint8_t system_id return mavlink_msg_log_request_end_pack_chan(system_id, component_id, chan, msg, log_request_end->target_system, log_request_end->target_component); } +/** + * @brief Encode a log_request_end struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param log_request_end C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_log_request_end_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_log_request_end_t* log_request_end) +{ + return mavlink_msg_log_request_end_pack_status(system_id, component_id, _status, msg, log_request_end->target_system, log_request_end->target_component); +} + /** * @brief Send a log_request_end message * @param chan MAVLink channel to send the message @@ -170,7 +220,7 @@ static inline void mavlink_msg_log_request_end_send_struct(mavlink_channel_t cha #if MAVLINK_MSG_ID_LOG_REQUEST_END_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_log_request_list.h b/common/mavlink_msg_log_request_list.h index 4a6dfaa4e..0d9017d29 100644 --- a/common/mavlink_msg_log_request_list.h +++ b/common/mavlink_msg_log_request_list.h @@ -81,6 +81,48 @@ static inline uint16_t mavlink_msg_log_request_list_pack(uint8_t system_id, uint return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LOG_REQUEST_LIST_MIN_LEN, MAVLINK_MSG_ID_LOG_REQUEST_LIST_LEN, MAVLINK_MSG_ID_LOG_REQUEST_LIST_CRC); } +/** + * @brief Pack a log_request_list message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param start First log id (0 for first available) + * @param end Last log id (0xffff for last available) + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_log_request_list_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint16_t start, uint16_t end) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_LOG_REQUEST_LIST_LEN]; + _mav_put_uint16_t(buf, 0, start); + _mav_put_uint16_t(buf, 2, end); + _mav_put_uint8_t(buf, 4, target_system); + _mav_put_uint8_t(buf, 5, target_component); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LOG_REQUEST_LIST_LEN); +#else + mavlink_log_request_list_t packet; + packet.start = start; + packet.end = end; + packet.target_system = target_system; + packet.target_component = target_component; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOG_REQUEST_LIST_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_LOG_REQUEST_LIST; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LOG_REQUEST_LIST_MIN_LEN, MAVLINK_MSG_ID_LOG_REQUEST_LIST_LEN, MAVLINK_MSG_ID_LOG_REQUEST_LIST_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LOG_REQUEST_LIST_MIN_LEN, MAVLINK_MSG_ID_LOG_REQUEST_LIST_LEN); +#endif +} + /** * @brief Pack a log_request_list message on a channel * @param system_id ID of this system @@ -146,6 +188,20 @@ static inline uint16_t mavlink_msg_log_request_list_encode_chan(uint8_t system_i return mavlink_msg_log_request_list_pack_chan(system_id, component_id, chan, msg, log_request_list->target_system, log_request_list->target_component, log_request_list->start, log_request_list->end); } +/** + * @brief Encode a log_request_list struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param log_request_list C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_log_request_list_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_log_request_list_t* log_request_list) +{ + return mavlink_msg_log_request_list_pack_status(system_id, component_id, _status, msg, log_request_list->target_system, log_request_list->target_component, log_request_list->start, log_request_list->end); +} + /** * @brief Send a log_request_list message * @param chan MAVLink channel to send the message @@ -194,7 +250,7 @@ static inline void mavlink_msg_log_request_list_send_struct(mavlink_channel_t ch #if MAVLINK_MSG_ID_LOG_REQUEST_LIST_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_logging_ack.h b/common/mavlink_msg_logging_ack.h index 56dab387d..53d8ec2a7 100644 --- a/common/mavlink_msg_logging_ack.h +++ b/common/mavlink_msg_logging_ack.h @@ -75,6 +75,45 @@ static inline uint16_t mavlink_msg_logging_ack_pack(uint8_t system_id, uint8_t c return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LOGGING_ACK_MIN_LEN, MAVLINK_MSG_ID_LOGGING_ACK_LEN, MAVLINK_MSG_ID_LOGGING_ACK_CRC); } +/** + * @brief Pack a logging_ack message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system system ID of the target + * @param target_component component ID of the target + * @param sequence sequence number (must match the one in LOGGING_DATA_ACKED) + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_logging_ack_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint16_t sequence) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_LOGGING_ACK_LEN]; + _mav_put_uint16_t(buf, 0, sequence); + _mav_put_uint8_t(buf, 2, target_system); + _mav_put_uint8_t(buf, 3, target_component); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LOGGING_ACK_LEN); +#else + mavlink_logging_ack_t packet; + packet.sequence = sequence; + packet.target_system = target_system; + packet.target_component = target_component; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOGGING_ACK_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_LOGGING_ACK; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LOGGING_ACK_MIN_LEN, MAVLINK_MSG_ID_LOGGING_ACK_LEN, MAVLINK_MSG_ID_LOGGING_ACK_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LOGGING_ACK_MIN_LEN, MAVLINK_MSG_ID_LOGGING_ACK_LEN); +#endif +} + /** * @brief Pack a logging_ack message on a channel * @param system_id ID of this system @@ -137,6 +176,20 @@ static inline uint16_t mavlink_msg_logging_ack_encode_chan(uint8_t system_id, ui return mavlink_msg_logging_ack_pack_chan(system_id, component_id, chan, msg, logging_ack->target_system, logging_ack->target_component, logging_ack->sequence); } +/** + * @brief Encode a logging_ack struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param logging_ack C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_logging_ack_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_logging_ack_t* logging_ack) +{ + return mavlink_msg_logging_ack_pack_status(system_id, component_id, _status, msg, logging_ack->target_system, logging_ack->target_component, logging_ack->sequence); +} + /** * @brief Send a logging_ack message * @param chan MAVLink channel to send the message @@ -182,7 +235,7 @@ static inline void mavlink_msg_logging_ack_send_struct(mavlink_channel_t chan, c #if MAVLINK_MSG_ID_LOGGING_ACK_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_logging_data.h b/common/mavlink_msg_logging_data.h index c9bf0559d..208df7697 100644 --- a/common/mavlink_msg_logging_data.h +++ b/common/mavlink_msg_logging_data.h @@ -9,7 +9,7 @@ typedef struct __mavlink_logging_data_t { uint8_t target_system; /*< system ID of the target*/ uint8_t target_component; /*< component ID of the target*/ uint8_t length; /*< [bytes] data length*/ - uint8_t first_message_offset; /*< [bytes] offset into data where first message starts. This can be used for recovery, when a previous message got lost (set to 255 if no start exists).*/ + uint8_t first_message_offset; /*< [bytes] offset into data where first message starts. This can be used for recovery, when a previous message got lost (set to UINT8_MAX if no start exists).*/ uint8_t data[249]; /*< logged data*/ } mavlink_logging_data_t; @@ -60,7 +60,7 @@ typedef struct __mavlink_logging_data_t { * @param target_component component ID of the target * @param sequence sequence number (can wrap) * @param length [bytes] data length - * @param first_message_offset [bytes] offset into data where first message starts. This can be used for recovery, when a previous message got lost (set to 255 if no start exists). + * @param first_message_offset [bytes] offset into data where first message starts. This can be used for recovery, when a previous message got lost (set to UINT8_MAX if no start exists). * @param data logged data * @return length of the message in bytes (excluding serial stream start sign) */ @@ -83,7 +83,7 @@ static inline uint16_t mavlink_msg_logging_data_pack(uint8_t system_id, uint8_t packet.target_component = target_component; packet.length = length; packet.first_message_offset = first_message_offset; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*249); + mav_array_assign_uint8_t(packet.data, data, 249); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOGGING_DATA_LEN); #endif @@ -91,6 +91,52 @@ static inline uint16_t mavlink_msg_logging_data_pack(uint8_t system_id, uint8_t return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LOGGING_DATA_MIN_LEN, MAVLINK_MSG_ID_LOGGING_DATA_LEN, MAVLINK_MSG_ID_LOGGING_DATA_CRC); } +/** + * @brief Pack a logging_data message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system system ID of the target + * @param target_component component ID of the target + * @param sequence sequence number (can wrap) + * @param length [bytes] data length + * @param first_message_offset [bytes] offset into data where first message starts. This can be used for recovery, when a previous message got lost (set to UINT8_MAX if no start exists). + * @param data logged data + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_logging_data_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint16_t sequence, uint8_t length, uint8_t first_message_offset, const uint8_t *data) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_LOGGING_DATA_LEN]; + _mav_put_uint16_t(buf, 0, sequence); + _mav_put_uint8_t(buf, 2, target_system); + _mav_put_uint8_t(buf, 3, target_component); + _mav_put_uint8_t(buf, 4, length); + _mav_put_uint8_t(buf, 5, first_message_offset); + _mav_put_uint8_t_array(buf, 6, data, 249); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LOGGING_DATA_LEN); +#else + mavlink_logging_data_t packet; + packet.sequence = sequence; + packet.target_system = target_system; + packet.target_component = target_component; + packet.length = length; + packet.first_message_offset = first_message_offset; + mav_array_memcpy(packet.data, data, sizeof(uint8_t)*249); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOGGING_DATA_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_LOGGING_DATA; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LOGGING_DATA_MIN_LEN, MAVLINK_MSG_ID_LOGGING_DATA_LEN, MAVLINK_MSG_ID_LOGGING_DATA_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LOGGING_DATA_MIN_LEN, MAVLINK_MSG_ID_LOGGING_DATA_LEN); +#endif +} + /** * @brief Pack a logging_data message on a channel * @param system_id ID of this system @@ -101,7 +147,7 @@ static inline uint16_t mavlink_msg_logging_data_pack(uint8_t system_id, uint8_t * @param target_component component ID of the target * @param sequence sequence number (can wrap) * @param length [bytes] data length - * @param first_message_offset [bytes] offset into data where first message starts. This can be used for recovery, when a previous message got lost (set to 255 if no start exists). + * @param first_message_offset [bytes] offset into data where first message starts. This can be used for recovery, when a previous message got lost (set to UINT8_MAX if no start exists). * @param data logged data * @return length of the message in bytes (excluding serial stream start sign) */ @@ -125,7 +171,7 @@ static inline uint16_t mavlink_msg_logging_data_pack_chan(uint8_t system_id, uin packet.target_component = target_component; packet.length = length; packet.first_message_offset = first_message_offset; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*249); + mav_array_assign_uint8_t(packet.data, data, 249); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOGGING_DATA_LEN); #endif @@ -160,6 +206,20 @@ static inline uint16_t mavlink_msg_logging_data_encode_chan(uint8_t system_id, u return mavlink_msg_logging_data_pack_chan(system_id, component_id, chan, msg, logging_data->target_system, logging_data->target_component, logging_data->sequence, logging_data->length, logging_data->first_message_offset, logging_data->data); } +/** + * @brief Encode a logging_data struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param logging_data C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_logging_data_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_logging_data_t* logging_data) +{ + return mavlink_msg_logging_data_pack_status(system_id, component_id, _status, msg, logging_data->target_system, logging_data->target_component, logging_data->sequence, logging_data->length, logging_data->first_message_offset, logging_data->data); +} + /** * @brief Send a logging_data message * @param chan MAVLink channel to send the message @@ -168,7 +228,7 @@ static inline uint16_t mavlink_msg_logging_data_encode_chan(uint8_t system_id, u * @param target_component component ID of the target * @param sequence sequence number (can wrap) * @param length [bytes] data length - * @param first_message_offset [bytes] offset into data where first message starts. This can be used for recovery, when a previous message got lost (set to 255 if no start exists). + * @param first_message_offset [bytes] offset into data where first message starts. This can be used for recovery, when a previous message got lost (set to UINT8_MAX if no start exists). * @param data logged data */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS @@ -191,7 +251,7 @@ static inline void mavlink_msg_logging_data_send(mavlink_channel_t chan, uint8_t packet.target_component = target_component; packet.length = length; packet.first_message_offset = first_message_offset; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*249); + mav_array_assign_uint8_t(packet.data, data, 249); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOGGING_DATA, (const char *)&packet, MAVLINK_MSG_ID_LOGGING_DATA_MIN_LEN, MAVLINK_MSG_ID_LOGGING_DATA_LEN, MAVLINK_MSG_ID_LOGGING_DATA_CRC); #endif } @@ -212,7 +272,7 @@ static inline void mavlink_msg_logging_data_send_struct(mavlink_channel_t chan, #if MAVLINK_MSG_ID_LOGGING_DATA_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -236,7 +296,7 @@ static inline void mavlink_msg_logging_data_send_buf(mavlink_message_t *msgbuf, packet->target_component = target_component; packet->length = length; packet->first_message_offset = first_message_offset; - mav_array_memcpy(packet->data, data, sizeof(uint8_t)*249); + mav_array_assign_uint8_t(packet->data, data, 249); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOGGING_DATA, (const char *)packet, MAVLINK_MSG_ID_LOGGING_DATA_MIN_LEN, MAVLINK_MSG_ID_LOGGING_DATA_LEN, MAVLINK_MSG_ID_LOGGING_DATA_CRC); #endif } @@ -290,7 +350,7 @@ static inline uint8_t mavlink_msg_logging_data_get_length(const mavlink_message_ /** * @brief Get field first_message_offset from logging_data message * - * @return [bytes] offset into data where first message starts. This can be used for recovery, when a previous message got lost (set to 255 if no start exists). + * @return [bytes] offset into data where first message starts. This can be used for recovery, when a previous message got lost (set to UINT8_MAX if no start exists). */ static inline uint8_t mavlink_msg_logging_data_get_first_message_offset(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_logging_data_acked.h b/common/mavlink_msg_logging_data_acked.h index a179387c7..d560b570b 100644 --- a/common/mavlink_msg_logging_data_acked.h +++ b/common/mavlink_msg_logging_data_acked.h @@ -9,7 +9,7 @@ typedef struct __mavlink_logging_data_acked_t { uint8_t target_system; /*< system ID of the target*/ uint8_t target_component; /*< component ID of the target*/ uint8_t length; /*< [bytes] data length*/ - uint8_t first_message_offset; /*< [bytes] offset into data where first message starts. This can be used for recovery, when a previous message got lost (set to 255 if no start exists).*/ + uint8_t first_message_offset; /*< [bytes] offset into data where first message starts. This can be used for recovery, when a previous message got lost (set to UINT8_MAX if no start exists).*/ uint8_t data[249]; /*< logged data*/ } mavlink_logging_data_acked_t; @@ -60,7 +60,7 @@ typedef struct __mavlink_logging_data_acked_t { * @param target_component component ID of the target * @param sequence sequence number (can wrap) * @param length [bytes] data length - * @param first_message_offset [bytes] offset into data where first message starts. This can be used for recovery, when a previous message got lost (set to 255 if no start exists). + * @param first_message_offset [bytes] offset into data where first message starts. This can be used for recovery, when a previous message got lost (set to UINT8_MAX if no start exists). * @param data logged data * @return length of the message in bytes (excluding serial stream start sign) */ @@ -83,7 +83,7 @@ static inline uint16_t mavlink_msg_logging_data_acked_pack(uint8_t system_id, ui packet.target_component = target_component; packet.length = length; packet.first_message_offset = first_message_offset; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*249); + mav_array_assign_uint8_t(packet.data, data, 249); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOGGING_DATA_ACKED_LEN); #endif @@ -91,6 +91,52 @@ static inline uint16_t mavlink_msg_logging_data_acked_pack(uint8_t system_id, ui return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LOGGING_DATA_ACKED_MIN_LEN, MAVLINK_MSG_ID_LOGGING_DATA_ACKED_LEN, MAVLINK_MSG_ID_LOGGING_DATA_ACKED_CRC); } +/** + * @brief Pack a logging_data_acked message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system system ID of the target + * @param target_component component ID of the target + * @param sequence sequence number (can wrap) + * @param length [bytes] data length + * @param first_message_offset [bytes] offset into data where first message starts. This can be used for recovery, when a previous message got lost (set to UINT8_MAX if no start exists). + * @param data logged data + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_logging_data_acked_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint16_t sequence, uint8_t length, uint8_t first_message_offset, const uint8_t *data) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_LOGGING_DATA_ACKED_LEN]; + _mav_put_uint16_t(buf, 0, sequence); + _mav_put_uint8_t(buf, 2, target_system); + _mav_put_uint8_t(buf, 3, target_component); + _mav_put_uint8_t(buf, 4, length); + _mav_put_uint8_t(buf, 5, first_message_offset); + _mav_put_uint8_t_array(buf, 6, data, 249); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LOGGING_DATA_ACKED_LEN); +#else + mavlink_logging_data_acked_t packet; + packet.sequence = sequence; + packet.target_system = target_system; + packet.target_component = target_component; + packet.length = length; + packet.first_message_offset = first_message_offset; + mav_array_memcpy(packet.data, data, sizeof(uint8_t)*249); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOGGING_DATA_ACKED_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_LOGGING_DATA_ACKED; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LOGGING_DATA_ACKED_MIN_LEN, MAVLINK_MSG_ID_LOGGING_DATA_ACKED_LEN, MAVLINK_MSG_ID_LOGGING_DATA_ACKED_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LOGGING_DATA_ACKED_MIN_LEN, MAVLINK_MSG_ID_LOGGING_DATA_ACKED_LEN); +#endif +} + /** * @brief Pack a logging_data_acked message on a channel * @param system_id ID of this system @@ -101,7 +147,7 @@ static inline uint16_t mavlink_msg_logging_data_acked_pack(uint8_t system_id, ui * @param target_component component ID of the target * @param sequence sequence number (can wrap) * @param length [bytes] data length - * @param first_message_offset [bytes] offset into data where first message starts. This can be used for recovery, when a previous message got lost (set to 255 if no start exists). + * @param first_message_offset [bytes] offset into data where first message starts. This can be used for recovery, when a previous message got lost (set to UINT8_MAX if no start exists). * @param data logged data * @return length of the message in bytes (excluding serial stream start sign) */ @@ -125,7 +171,7 @@ static inline uint16_t mavlink_msg_logging_data_acked_pack_chan(uint8_t system_i packet.target_component = target_component; packet.length = length; packet.first_message_offset = first_message_offset; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*249); + mav_array_assign_uint8_t(packet.data, data, 249); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOGGING_DATA_ACKED_LEN); #endif @@ -160,6 +206,20 @@ static inline uint16_t mavlink_msg_logging_data_acked_encode_chan(uint8_t system return mavlink_msg_logging_data_acked_pack_chan(system_id, component_id, chan, msg, logging_data_acked->target_system, logging_data_acked->target_component, logging_data_acked->sequence, logging_data_acked->length, logging_data_acked->first_message_offset, logging_data_acked->data); } +/** + * @brief Encode a logging_data_acked struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param logging_data_acked C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_logging_data_acked_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_logging_data_acked_t* logging_data_acked) +{ + return mavlink_msg_logging_data_acked_pack_status(system_id, component_id, _status, msg, logging_data_acked->target_system, logging_data_acked->target_component, logging_data_acked->sequence, logging_data_acked->length, logging_data_acked->first_message_offset, logging_data_acked->data); +} + /** * @brief Send a logging_data_acked message * @param chan MAVLink channel to send the message @@ -168,7 +228,7 @@ static inline uint16_t mavlink_msg_logging_data_acked_encode_chan(uint8_t system * @param target_component component ID of the target * @param sequence sequence number (can wrap) * @param length [bytes] data length - * @param first_message_offset [bytes] offset into data where first message starts. This can be used for recovery, when a previous message got lost (set to 255 if no start exists). + * @param first_message_offset [bytes] offset into data where first message starts. This can be used for recovery, when a previous message got lost (set to UINT8_MAX if no start exists). * @param data logged data */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS @@ -191,7 +251,7 @@ static inline void mavlink_msg_logging_data_acked_send(mavlink_channel_t chan, u packet.target_component = target_component; packet.length = length; packet.first_message_offset = first_message_offset; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*249); + mav_array_assign_uint8_t(packet.data, data, 249); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOGGING_DATA_ACKED, (const char *)&packet, MAVLINK_MSG_ID_LOGGING_DATA_ACKED_MIN_LEN, MAVLINK_MSG_ID_LOGGING_DATA_ACKED_LEN, MAVLINK_MSG_ID_LOGGING_DATA_ACKED_CRC); #endif } @@ -212,7 +272,7 @@ static inline void mavlink_msg_logging_data_acked_send_struct(mavlink_channel_t #if MAVLINK_MSG_ID_LOGGING_DATA_ACKED_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -236,7 +296,7 @@ static inline void mavlink_msg_logging_data_acked_send_buf(mavlink_message_t *ms packet->target_component = target_component; packet->length = length; packet->first_message_offset = first_message_offset; - mav_array_memcpy(packet->data, data, sizeof(uint8_t)*249); + mav_array_assign_uint8_t(packet->data, data, 249); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOGGING_DATA_ACKED, (const char *)packet, MAVLINK_MSG_ID_LOGGING_DATA_ACKED_MIN_LEN, MAVLINK_MSG_ID_LOGGING_DATA_ACKED_LEN, MAVLINK_MSG_ID_LOGGING_DATA_ACKED_CRC); #endif } @@ -290,7 +350,7 @@ static inline uint8_t mavlink_msg_logging_data_acked_get_length(const mavlink_me /** * @brief Get field first_message_offset from logging_data_acked message * - * @return [bytes] offset into data where first message starts. This can be used for recovery, when a previous message got lost (set to 255 if no start exists). + * @return [bytes] offset into data where first message starts. This can be used for recovery, when a previous message got lost (set to UINT8_MAX if no start exists). */ static inline uint8_t mavlink_msg_logging_data_acked_get_first_message_offset(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_mag_cal_report.h b/common/mavlink_msg_mag_cal_report.h index 6694501e1..4a2b1982c 100644 --- a/common/mavlink_msg_mag_cal_report.h +++ b/common/mavlink_msg_mag_cal_report.h @@ -165,6 +165,90 @@ static inline uint16_t mavlink_msg_mag_cal_report_pack(uint8_t system_id, uint8_ return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MAG_CAL_REPORT_MIN_LEN, MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN, MAVLINK_MSG_ID_MAG_CAL_REPORT_CRC); } +/** + * @brief Pack a mag_cal_report message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param compass_id Compass being calibrated. + * @param cal_mask Bitmask of compasses being calibrated. + * @param cal_status Calibration Status. + * @param autosaved 0=requires a MAV_CMD_DO_ACCEPT_MAG_CAL, 1=saved to parameters. + * @param fitness [mgauss] RMS milligauss residuals. + * @param ofs_x X offset. + * @param ofs_y Y offset. + * @param ofs_z Z offset. + * @param diag_x X diagonal (matrix 11). + * @param diag_y Y diagonal (matrix 22). + * @param diag_z Z diagonal (matrix 33). + * @param offdiag_x X off-diagonal (matrix 12 and 21). + * @param offdiag_y Y off-diagonal (matrix 13 and 31). + * @param offdiag_z Z off-diagonal (matrix 32 and 23). + * @param orientation_confidence Confidence in orientation (higher is better). + * @param old_orientation orientation before calibration. + * @param new_orientation orientation after calibration. + * @param scale_factor field radius correction factor + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_mag_cal_report_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t compass_id, uint8_t cal_mask, uint8_t cal_status, uint8_t autosaved, float fitness, float ofs_x, float ofs_y, float ofs_z, float diag_x, float diag_y, float diag_z, float offdiag_x, float offdiag_y, float offdiag_z, float orientation_confidence, uint8_t old_orientation, uint8_t new_orientation, float scale_factor) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN]; + _mav_put_float(buf, 0, fitness); + _mav_put_float(buf, 4, ofs_x); + _mav_put_float(buf, 8, ofs_y); + _mav_put_float(buf, 12, ofs_z); + _mav_put_float(buf, 16, diag_x); + _mav_put_float(buf, 20, diag_y); + _mav_put_float(buf, 24, diag_z); + _mav_put_float(buf, 28, offdiag_x); + _mav_put_float(buf, 32, offdiag_y); + _mav_put_float(buf, 36, offdiag_z); + _mav_put_uint8_t(buf, 40, compass_id); + _mav_put_uint8_t(buf, 41, cal_mask); + _mav_put_uint8_t(buf, 42, cal_status); + _mav_put_uint8_t(buf, 43, autosaved); + _mav_put_float(buf, 44, orientation_confidence); + _mav_put_uint8_t(buf, 48, old_orientation); + _mav_put_uint8_t(buf, 49, new_orientation); + _mav_put_float(buf, 50, scale_factor); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN); +#else + mavlink_mag_cal_report_t packet; + packet.fitness = fitness; + packet.ofs_x = ofs_x; + packet.ofs_y = ofs_y; + packet.ofs_z = ofs_z; + packet.diag_x = diag_x; + packet.diag_y = diag_y; + packet.diag_z = diag_z; + packet.offdiag_x = offdiag_x; + packet.offdiag_y = offdiag_y; + packet.offdiag_z = offdiag_z; + packet.compass_id = compass_id; + packet.cal_mask = cal_mask; + packet.cal_status = cal_status; + packet.autosaved = autosaved; + packet.orientation_confidence = orientation_confidence; + packet.old_orientation = old_orientation; + packet.new_orientation = new_orientation; + packet.scale_factor = scale_factor; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_MAG_CAL_REPORT; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MAG_CAL_REPORT_MIN_LEN, MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN, MAVLINK_MSG_ID_MAG_CAL_REPORT_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MAG_CAL_REPORT_MIN_LEN, MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN); +#endif +} + /** * @brief Pack a mag_cal_report message on a channel * @param system_id ID of this system @@ -272,6 +356,20 @@ static inline uint16_t mavlink_msg_mag_cal_report_encode_chan(uint8_t system_id, return mavlink_msg_mag_cal_report_pack_chan(system_id, component_id, chan, msg, mag_cal_report->compass_id, mag_cal_report->cal_mask, mag_cal_report->cal_status, mag_cal_report->autosaved, mag_cal_report->fitness, mag_cal_report->ofs_x, mag_cal_report->ofs_y, mag_cal_report->ofs_z, mag_cal_report->diag_x, mag_cal_report->diag_y, mag_cal_report->diag_z, mag_cal_report->offdiag_x, mag_cal_report->offdiag_y, mag_cal_report->offdiag_z, mag_cal_report->orientation_confidence, mag_cal_report->old_orientation, mag_cal_report->new_orientation, mag_cal_report->scale_factor); } +/** + * @brief Encode a mag_cal_report struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param mag_cal_report C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_mag_cal_report_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_mag_cal_report_t* mag_cal_report) +{ + return mavlink_msg_mag_cal_report_pack_status(system_id, component_id, _status, msg, mag_cal_report->compass_id, mag_cal_report->cal_mask, mag_cal_report->cal_status, mag_cal_report->autosaved, mag_cal_report->fitness, mag_cal_report->ofs_x, mag_cal_report->ofs_y, mag_cal_report->ofs_z, mag_cal_report->diag_x, mag_cal_report->diag_y, mag_cal_report->diag_z, mag_cal_report->offdiag_x, mag_cal_report->offdiag_y, mag_cal_report->offdiag_z, mag_cal_report->orientation_confidence, mag_cal_report->old_orientation, mag_cal_report->new_orientation, mag_cal_report->scale_factor); +} + /** * @brief Send a mag_cal_report message * @param chan MAVLink channel to send the message @@ -362,7 +460,7 @@ static inline void mavlink_msg_mag_cal_report_send_struct(mavlink_channel_t chan #if MAVLINK_MSG_ID_MAG_CAL_REPORT_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_manual_control.h b/common/mavlink_msg_manual_control.h index 14e7603a4..69c1139d0 100644 --- a/common/mavlink_msg_manual_control.h +++ b/common/mavlink_msg_manual_control.h @@ -3,19 +3,29 @@ #define MAVLINK_MSG_ID_MANUAL_CONTROL 69 - +MAVPACKED( typedef struct __mavlink_manual_control_t { int16_t x; /*< X-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to forward(1000)-backward(-1000) movement on a joystick and the pitch of a vehicle.*/ int16_t y; /*< Y-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to left(-1000)-right(1000) movement on a joystick and the roll of a vehicle.*/ int16_t z; /*< Z-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to a separate slider movement with maximum being 1000 and minimum being -1000 on a joystick and the thrust of a vehicle. Positive values are positive thrust, negative values are negative thrust.*/ int16_t r; /*< R-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to a twisting of the joystick, with counter-clockwise being 1000 and clockwise being -1000, and the yaw of a vehicle.*/ - uint16_t buttons; /*< A bitfield corresponding to the joystick buttons' current state, 1 for pressed, 0 for released. The lowest bit corresponds to Button 1.*/ + uint16_t buttons; /*< A bitfield corresponding to the joystick buttons' 0-15 current state, 1 for pressed, 0 for released. The lowest bit corresponds to Button 1.*/ uint8_t target; /*< The system to be controlled.*/ -} mavlink_manual_control_t; - -#define MAVLINK_MSG_ID_MANUAL_CONTROL_LEN 11 + uint16_t buttons2; /*< A bitfield corresponding to the joystick buttons' 16-31 current state, 1 for pressed, 0 for released. The lowest bit corresponds to Button 16.*/ + uint8_t enabled_extensions; /*< Set bits to 1 to indicate which of the following extension fields contain valid data: bit 0: pitch, bit 1: roll, bit 2: aux1, bit 3: aux2, bit 4: aux3, bit 5: aux4, bit 6: aux5, bit 7: aux6*/ + int16_t s; /*< Pitch-only-axis, normalized to the range [-1000,1000]. Generally corresponds to pitch on vehicles with additional degrees of freedom. Valid if bit 0 of enabled_extensions field is set. Set to 0 if invalid.*/ + int16_t t; /*< Roll-only-axis, normalized to the range [-1000,1000]. Generally corresponds to roll on vehicles with additional degrees of freedom. Valid if bit 1 of enabled_extensions field is set. Set to 0 if invalid.*/ + int16_t aux1; /*< Aux continuous input field 1. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 2 of enabled_extensions field is set. 0 if bit 2 is unset.*/ + int16_t aux2; /*< Aux continuous input field 2. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 3 of enabled_extensions field is set. 0 if bit 3 is unset.*/ + int16_t aux3; /*< Aux continuous input field 3. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 4 of enabled_extensions field is set. 0 if bit 4 is unset.*/ + int16_t aux4; /*< Aux continuous input field 4. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 5 of enabled_extensions field is set. 0 if bit 5 is unset.*/ + int16_t aux5; /*< Aux continuous input field 5. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 6 of enabled_extensions field is set. 0 if bit 6 is unset.*/ + int16_t aux6; /*< Aux continuous input field 6. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 7 of enabled_extensions field is set. 0 if bit 7 is unset.*/ +}) mavlink_manual_control_t; + +#define MAVLINK_MSG_ID_MANUAL_CONTROL_LEN 30 #define MAVLINK_MSG_ID_MANUAL_CONTROL_MIN_LEN 11 -#define MAVLINK_MSG_ID_69_LEN 11 +#define MAVLINK_MSG_ID_69_LEN 30 #define MAVLINK_MSG_ID_69_MIN_LEN 11 #define MAVLINK_MSG_ID_MANUAL_CONTROL_CRC 243 @@ -27,25 +37,45 @@ typedef struct __mavlink_manual_control_t { #define MAVLINK_MESSAGE_INFO_MANUAL_CONTROL { \ 69, \ "MANUAL_CONTROL", \ - 6, \ + 16, \ { { "target", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_manual_control_t, target) }, \ { "x", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_manual_control_t, x) }, \ { "y", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_manual_control_t, y) }, \ { "z", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_manual_control_t, z) }, \ { "r", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_manual_control_t, r) }, \ { "buttons", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_manual_control_t, buttons) }, \ + { "buttons2", NULL, MAVLINK_TYPE_UINT16_T, 0, 11, offsetof(mavlink_manual_control_t, buttons2) }, \ + { "enabled_extensions", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_manual_control_t, enabled_extensions) }, \ + { "s", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_manual_control_t, s) }, \ + { "t", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_manual_control_t, t) }, \ + { "aux1", NULL, MAVLINK_TYPE_INT16_T, 0, 18, offsetof(mavlink_manual_control_t, aux1) }, \ + { "aux2", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_manual_control_t, aux2) }, \ + { "aux3", NULL, MAVLINK_TYPE_INT16_T, 0, 22, offsetof(mavlink_manual_control_t, aux3) }, \ + { "aux4", NULL, MAVLINK_TYPE_INT16_T, 0, 24, offsetof(mavlink_manual_control_t, aux4) }, \ + { "aux5", NULL, MAVLINK_TYPE_INT16_T, 0, 26, offsetof(mavlink_manual_control_t, aux5) }, \ + { "aux6", NULL, MAVLINK_TYPE_INT16_T, 0, 28, offsetof(mavlink_manual_control_t, aux6) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_MANUAL_CONTROL { \ "MANUAL_CONTROL", \ - 6, \ + 16, \ { { "target", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_manual_control_t, target) }, \ { "x", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_manual_control_t, x) }, \ { "y", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_manual_control_t, y) }, \ { "z", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_manual_control_t, z) }, \ { "r", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_manual_control_t, r) }, \ { "buttons", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_manual_control_t, buttons) }, \ + { "buttons2", NULL, MAVLINK_TYPE_UINT16_T, 0, 11, offsetof(mavlink_manual_control_t, buttons2) }, \ + { "enabled_extensions", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_manual_control_t, enabled_extensions) }, \ + { "s", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_manual_control_t, s) }, \ + { "t", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_manual_control_t, t) }, \ + { "aux1", NULL, MAVLINK_TYPE_INT16_T, 0, 18, offsetof(mavlink_manual_control_t, aux1) }, \ + { "aux2", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_manual_control_t, aux2) }, \ + { "aux3", NULL, MAVLINK_TYPE_INT16_T, 0, 22, offsetof(mavlink_manual_control_t, aux3) }, \ + { "aux4", NULL, MAVLINK_TYPE_INT16_T, 0, 24, offsetof(mavlink_manual_control_t, aux4) }, \ + { "aux5", NULL, MAVLINK_TYPE_INT16_T, 0, 26, offsetof(mavlink_manual_control_t, aux5) }, \ + { "aux6", NULL, MAVLINK_TYPE_INT16_T, 0, 28, offsetof(mavlink_manual_control_t, aux6) }, \ } \ } #endif @@ -61,11 +91,21 @@ typedef struct __mavlink_manual_control_t { * @param y Y-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to left(-1000)-right(1000) movement on a joystick and the roll of a vehicle. * @param z Z-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to a separate slider movement with maximum being 1000 and minimum being -1000 on a joystick and the thrust of a vehicle. Positive values are positive thrust, negative values are negative thrust. * @param r R-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to a twisting of the joystick, with counter-clockwise being 1000 and clockwise being -1000, and the yaw of a vehicle. - * @param buttons A bitfield corresponding to the joystick buttons' current state, 1 for pressed, 0 for released. The lowest bit corresponds to Button 1. + * @param buttons A bitfield corresponding to the joystick buttons' 0-15 current state, 1 for pressed, 0 for released. The lowest bit corresponds to Button 1. + * @param buttons2 A bitfield corresponding to the joystick buttons' 16-31 current state, 1 for pressed, 0 for released. The lowest bit corresponds to Button 16. + * @param enabled_extensions Set bits to 1 to indicate which of the following extension fields contain valid data: bit 0: pitch, bit 1: roll, bit 2: aux1, bit 3: aux2, bit 4: aux3, bit 5: aux4, bit 6: aux5, bit 7: aux6 + * @param s Pitch-only-axis, normalized to the range [-1000,1000]. Generally corresponds to pitch on vehicles with additional degrees of freedom. Valid if bit 0 of enabled_extensions field is set. Set to 0 if invalid. + * @param t Roll-only-axis, normalized to the range [-1000,1000]. Generally corresponds to roll on vehicles with additional degrees of freedom. Valid if bit 1 of enabled_extensions field is set. Set to 0 if invalid. + * @param aux1 Aux continuous input field 1. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 2 of enabled_extensions field is set. 0 if bit 2 is unset. + * @param aux2 Aux continuous input field 2. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 3 of enabled_extensions field is set. 0 if bit 3 is unset. + * @param aux3 Aux continuous input field 3. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 4 of enabled_extensions field is set. 0 if bit 4 is unset. + * @param aux4 Aux continuous input field 4. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 5 of enabled_extensions field is set. 0 if bit 5 is unset. + * @param aux5 Aux continuous input field 5. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 6 of enabled_extensions field is set. 0 if bit 6 is unset. + * @param aux6 Aux continuous input field 6. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 7 of enabled_extensions field is set. 0 if bit 7 is unset. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_manual_control_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target, int16_t x, int16_t y, int16_t z, int16_t r, uint16_t buttons) + uint8_t target, int16_t x, int16_t y, int16_t z, int16_t r, uint16_t buttons, uint16_t buttons2, uint8_t enabled_extensions, int16_t s, int16_t t, int16_t aux1, int16_t aux2, int16_t aux3, int16_t aux4, int16_t aux5, int16_t aux6) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_MANUAL_CONTROL_LEN]; @@ -75,6 +115,16 @@ static inline uint16_t mavlink_msg_manual_control_pack(uint8_t system_id, uint8_ _mav_put_int16_t(buf, 6, r); _mav_put_uint16_t(buf, 8, buttons); _mav_put_uint8_t(buf, 10, target); + _mav_put_uint16_t(buf, 11, buttons2); + _mav_put_uint8_t(buf, 13, enabled_extensions); + _mav_put_int16_t(buf, 14, s); + _mav_put_int16_t(buf, 16, t); + _mav_put_int16_t(buf, 18, aux1); + _mav_put_int16_t(buf, 20, aux2); + _mav_put_int16_t(buf, 22, aux3); + _mav_put_int16_t(buf, 24, aux4); + _mav_put_int16_t(buf, 26, aux5); + _mav_put_int16_t(buf, 28, aux6); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MANUAL_CONTROL_LEN); #else @@ -85,6 +135,16 @@ static inline uint16_t mavlink_msg_manual_control_pack(uint8_t system_id, uint8_ packet.r = r; packet.buttons = buttons; packet.target = target; + packet.buttons2 = buttons2; + packet.enabled_extensions = enabled_extensions; + packet.s = s; + packet.t = t; + packet.aux1 = aux1; + packet.aux2 = aux2; + packet.aux3 = aux3; + packet.aux4 = aux4; + packet.aux5 = aux5; + packet.aux6 = aux6; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MANUAL_CONTROL_LEN); #endif @@ -93,6 +153,84 @@ static inline uint16_t mavlink_msg_manual_control_pack(uint8_t system_id, uint8_ return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MANUAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MANUAL_CONTROL_LEN, MAVLINK_MSG_ID_MANUAL_CONTROL_CRC); } +/** + * @brief Pack a manual_control message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target The system to be controlled. + * @param x X-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to forward(1000)-backward(-1000) movement on a joystick and the pitch of a vehicle. + * @param y Y-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to left(-1000)-right(1000) movement on a joystick and the roll of a vehicle. + * @param z Z-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to a separate slider movement with maximum being 1000 and minimum being -1000 on a joystick and the thrust of a vehicle. Positive values are positive thrust, negative values are negative thrust. + * @param r R-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to a twisting of the joystick, with counter-clockwise being 1000 and clockwise being -1000, and the yaw of a vehicle. + * @param buttons A bitfield corresponding to the joystick buttons' 0-15 current state, 1 for pressed, 0 for released. The lowest bit corresponds to Button 1. + * @param buttons2 A bitfield corresponding to the joystick buttons' 16-31 current state, 1 for pressed, 0 for released. The lowest bit corresponds to Button 16. + * @param enabled_extensions Set bits to 1 to indicate which of the following extension fields contain valid data: bit 0: pitch, bit 1: roll, bit 2: aux1, bit 3: aux2, bit 4: aux3, bit 5: aux4, bit 6: aux5, bit 7: aux6 + * @param s Pitch-only-axis, normalized to the range [-1000,1000]. Generally corresponds to pitch on vehicles with additional degrees of freedom. Valid if bit 0 of enabled_extensions field is set. Set to 0 if invalid. + * @param t Roll-only-axis, normalized to the range [-1000,1000]. Generally corresponds to roll on vehicles with additional degrees of freedom. Valid if bit 1 of enabled_extensions field is set. Set to 0 if invalid. + * @param aux1 Aux continuous input field 1. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 2 of enabled_extensions field is set. 0 if bit 2 is unset. + * @param aux2 Aux continuous input field 2. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 3 of enabled_extensions field is set. 0 if bit 3 is unset. + * @param aux3 Aux continuous input field 3. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 4 of enabled_extensions field is set. 0 if bit 4 is unset. + * @param aux4 Aux continuous input field 4. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 5 of enabled_extensions field is set. 0 if bit 5 is unset. + * @param aux5 Aux continuous input field 5. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 6 of enabled_extensions field is set. 0 if bit 6 is unset. + * @param aux6 Aux continuous input field 6. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 7 of enabled_extensions field is set. 0 if bit 7 is unset. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_manual_control_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target, int16_t x, int16_t y, int16_t z, int16_t r, uint16_t buttons, uint16_t buttons2, uint8_t enabled_extensions, int16_t s, int16_t t, int16_t aux1, int16_t aux2, int16_t aux3, int16_t aux4, int16_t aux5, int16_t aux6) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_MANUAL_CONTROL_LEN]; + _mav_put_int16_t(buf, 0, x); + _mav_put_int16_t(buf, 2, y); + _mav_put_int16_t(buf, 4, z); + _mav_put_int16_t(buf, 6, r); + _mav_put_uint16_t(buf, 8, buttons); + _mav_put_uint8_t(buf, 10, target); + _mav_put_uint16_t(buf, 11, buttons2); + _mav_put_uint8_t(buf, 13, enabled_extensions); + _mav_put_int16_t(buf, 14, s); + _mav_put_int16_t(buf, 16, t); + _mav_put_int16_t(buf, 18, aux1); + _mav_put_int16_t(buf, 20, aux2); + _mav_put_int16_t(buf, 22, aux3); + _mav_put_int16_t(buf, 24, aux4); + _mav_put_int16_t(buf, 26, aux5); + _mav_put_int16_t(buf, 28, aux6); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MANUAL_CONTROL_LEN); +#else + mavlink_manual_control_t packet; + packet.x = x; + packet.y = y; + packet.z = z; + packet.r = r; + packet.buttons = buttons; + packet.target = target; + packet.buttons2 = buttons2; + packet.enabled_extensions = enabled_extensions; + packet.s = s; + packet.t = t; + packet.aux1 = aux1; + packet.aux2 = aux2; + packet.aux3 = aux3; + packet.aux4 = aux4; + packet.aux5 = aux5; + packet.aux6 = aux6; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MANUAL_CONTROL_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_MANUAL_CONTROL; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MANUAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MANUAL_CONTROL_LEN, MAVLINK_MSG_ID_MANUAL_CONTROL_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MANUAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MANUAL_CONTROL_LEN); +#endif +} + /** * @brief Pack a manual_control message on a channel * @param system_id ID of this system @@ -104,12 +242,22 @@ static inline uint16_t mavlink_msg_manual_control_pack(uint8_t system_id, uint8_ * @param y Y-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to left(-1000)-right(1000) movement on a joystick and the roll of a vehicle. * @param z Z-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to a separate slider movement with maximum being 1000 and minimum being -1000 on a joystick and the thrust of a vehicle. Positive values are positive thrust, negative values are negative thrust. * @param r R-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to a twisting of the joystick, with counter-clockwise being 1000 and clockwise being -1000, and the yaw of a vehicle. - * @param buttons A bitfield corresponding to the joystick buttons' current state, 1 for pressed, 0 for released. The lowest bit corresponds to Button 1. + * @param buttons A bitfield corresponding to the joystick buttons' 0-15 current state, 1 for pressed, 0 for released. The lowest bit corresponds to Button 1. + * @param buttons2 A bitfield corresponding to the joystick buttons' 16-31 current state, 1 for pressed, 0 for released. The lowest bit corresponds to Button 16. + * @param enabled_extensions Set bits to 1 to indicate which of the following extension fields contain valid data: bit 0: pitch, bit 1: roll, bit 2: aux1, bit 3: aux2, bit 4: aux3, bit 5: aux4, bit 6: aux5, bit 7: aux6 + * @param s Pitch-only-axis, normalized to the range [-1000,1000]. Generally corresponds to pitch on vehicles with additional degrees of freedom. Valid if bit 0 of enabled_extensions field is set. Set to 0 if invalid. + * @param t Roll-only-axis, normalized to the range [-1000,1000]. Generally corresponds to roll on vehicles with additional degrees of freedom. Valid if bit 1 of enabled_extensions field is set. Set to 0 if invalid. + * @param aux1 Aux continuous input field 1. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 2 of enabled_extensions field is set. 0 if bit 2 is unset. + * @param aux2 Aux continuous input field 2. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 3 of enabled_extensions field is set. 0 if bit 3 is unset. + * @param aux3 Aux continuous input field 3. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 4 of enabled_extensions field is set. 0 if bit 4 is unset. + * @param aux4 Aux continuous input field 4. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 5 of enabled_extensions field is set. 0 if bit 5 is unset. + * @param aux5 Aux continuous input field 5. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 6 of enabled_extensions field is set. 0 if bit 6 is unset. + * @param aux6 Aux continuous input field 6. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 7 of enabled_extensions field is set. 0 if bit 7 is unset. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_manual_control_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - uint8_t target,int16_t x,int16_t y,int16_t z,int16_t r,uint16_t buttons) + uint8_t target,int16_t x,int16_t y,int16_t z,int16_t r,uint16_t buttons,uint16_t buttons2,uint8_t enabled_extensions,int16_t s,int16_t t,int16_t aux1,int16_t aux2,int16_t aux3,int16_t aux4,int16_t aux5,int16_t aux6) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_MANUAL_CONTROL_LEN]; @@ -119,6 +267,16 @@ static inline uint16_t mavlink_msg_manual_control_pack_chan(uint8_t system_id, u _mav_put_int16_t(buf, 6, r); _mav_put_uint16_t(buf, 8, buttons); _mav_put_uint8_t(buf, 10, target); + _mav_put_uint16_t(buf, 11, buttons2); + _mav_put_uint8_t(buf, 13, enabled_extensions); + _mav_put_int16_t(buf, 14, s); + _mav_put_int16_t(buf, 16, t); + _mav_put_int16_t(buf, 18, aux1); + _mav_put_int16_t(buf, 20, aux2); + _mav_put_int16_t(buf, 22, aux3); + _mav_put_int16_t(buf, 24, aux4); + _mav_put_int16_t(buf, 26, aux5); + _mav_put_int16_t(buf, 28, aux6); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MANUAL_CONTROL_LEN); #else @@ -129,6 +287,16 @@ static inline uint16_t mavlink_msg_manual_control_pack_chan(uint8_t system_id, u packet.r = r; packet.buttons = buttons; packet.target = target; + packet.buttons2 = buttons2; + packet.enabled_extensions = enabled_extensions; + packet.s = s; + packet.t = t; + packet.aux1 = aux1; + packet.aux2 = aux2; + packet.aux3 = aux3; + packet.aux4 = aux4; + packet.aux5 = aux5; + packet.aux6 = aux6; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MANUAL_CONTROL_LEN); #endif @@ -147,7 +315,7 @@ static inline uint16_t mavlink_msg_manual_control_pack_chan(uint8_t system_id, u */ static inline uint16_t mavlink_msg_manual_control_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_manual_control_t* manual_control) { - return mavlink_msg_manual_control_pack(system_id, component_id, msg, manual_control->target, manual_control->x, manual_control->y, manual_control->z, manual_control->r, manual_control->buttons); + return mavlink_msg_manual_control_pack(system_id, component_id, msg, manual_control->target, manual_control->x, manual_control->y, manual_control->z, manual_control->r, manual_control->buttons, manual_control->buttons2, manual_control->enabled_extensions, manual_control->s, manual_control->t, manual_control->aux1, manual_control->aux2, manual_control->aux3, manual_control->aux4, manual_control->aux5, manual_control->aux6); } /** @@ -161,7 +329,21 @@ static inline uint16_t mavlink_msg_manual_control_encode(uint8_t system_id, uint */ static inline uint16_t mavlink_msg_manual_control_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_manual_control_t* manual_control) { - return mavlink_msg_manual_control_pack_chan(system_id, component_id, chan, msg, manual_control->target, manual_control->x, manual_control->y, manual_control->z, manual_control->r, manual_control->buttons); + return mavlink_msg_manual_control_pack_chan(system_id, component_id, chan, msg, manual_control->target, manual_control->x, manual_control->y, manual_control->z, manual_control->r, manual_control->buttons, manual_control->buttons2, manual_control->enabled_extensions, manual_control->s, manual_control->t, manual_control->aux1, manual_control->aux2, manual_control->aux3, manual_control->aux4, manual_control->aux5, manual_control->aux6); +} + +/** + * @brief Encode a manual_control struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param manual_control C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_manual_control_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_manual_control_t* manual_control) +{ + return mavlink_msg_manual_control_pack_status(system_id, component_id, _status, msg, manual_control->target, manual_control->x, manual_control->y, manual_control->z, manual_control->r, manual_control->buttons, manual_control->buttons2, manual_control->enabled_extensions, manual_control->s, manual_control->t, manual_control->aux1, manual_control->aux2, manual_control->aux3, manual_control->aux4, manual_control->aux5, manual_control->aux6); } /** @@ -173,11 +355,21 @@ static inline uint16_t mavlink_msg_manual_control_encode_chan(uint8_t system_id, * @param y Y-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to left(-1000)-right(1000) movement on a joystick and the roll of a vehicle. * @param z Z-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to a separate slider movement with maximum being 1000 and minimum being -1000 on a joystick and the thrust of a vehicle. Positive values are positive thrust, negative values are negative thrust. * @param r R-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to a twisting of the joystick, with counter-clockwise being 1000 and clockwise being -1000, and the yaw of a vehicle. - * @param buttons A bitfield corresponding to the joystick buttons' current state, 1 for pressed, 0 for released. The lowest bit corresponds to Button 1. + * @param buttons A bitfield corresponding to the joystick buttons' 0-15 current state, 1 for pressed, 0 for released. The lowest bit corresponds to Button 1. + * @param buttons2 A bitfield corresponding to the joystick buttons' 16-31 current state, 1 for pressed, 0 for released. The lowest bit corresponds to Button 16. + * @param enabled_extensions Set bits to 1 to indicate which of the following extension fields contain valid data: bit 0: pitch, bit 1: roll, bit 2: aux1, bit 3: aux2, bit 4: aux3, bit 5: aux4, bit 6: aux5, bit 7: aux6 + * @param s Pitch-only-axis, normalized to the range [-1000,1000]. Generally corresponds to pitch on vehicles with additional degrees of freedom. Valid if bit 0 of enabled_extensions field is set. Set to 0 if invalid. + * @param t Roll-only-axis, normalized to the range [-1000,1000]. Generally corresponds to roll on vehicles with additional degrees of freedom. Valid if bit 1 of enabled_extensions field is set. Set to 0 if invalid. + * @param aux1 Aux continuous input field 1. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 2 of enabled_extensions field is set. 0 if bit 2 is unset. + * @param aux2 Aux continuous input field 2. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 3 of enabled_extensions field is set. 0 if bit 3 is unset. + * @param aux3 Aux continuous input field 3. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 4 of enabled_extensions field is set. 0 if bit 4 is unset. + * @param aux4 Aux continuous input field 4. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 5 of enabled_extensions field is set. 0 if bit 5 is unset. + * @param aux5 Aux continuous input field 5. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 6 of enabled_extensions field is set. 0 if bit 6 is unset. + * @param aux6 Aux continuous input field 6. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 7 of enabled_extensions field is set. 0 if bit 7 is unset. */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_manual_control_send(mavlink_channel_t chan, uint8_t target, int16_t x, int16_t y, int16_t z, int16_t r, uint16_t buttons) +static inline void mavlink_msg_manual_control_send(mavlink_channel_t chan, uint8_t target, int16_t x, int16_t y, int16_t z, int16_t r, uint16_t buttons, uint16_t buttons2, uint8_t enabled_extensions, int16_t s, int16_t t, int16_t aux1, int16_t aux2, int16_t aux3, int16_t aux4, int16_t aux5, int16_t aux6) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_MANUAL_CONTROL_LEN]; @@ -187,6 +379,16 @@ static inline void mavlink_msg_manual_control_send(mavlink_channel_t chan, uint8 _mav_put_int16_t(buf, 6, r); _mav_put_uint16_t(buf, 8, buttons); _mav_put_uint8_t(buf, 10, target); + _mav_put_uint16_t(buf, 11, buttons2); + _mav_put_uint8_t(buf, 13, enabled_extensions); + _mav_put_int16_t(buf, 14, s); + _mav_put_int16_t(buf, 16, t); + _mav_put_int16_t(buf, 18, aux1); + _mav_put_int16_t(buf, 20, aux2); + _mav_put_int16_t(buf, 22, aux3); + _mav_put_int16_t(buf, 24, aux4); + _mav_put_int16_t(buf, 26, aux5); + _mav_put_int16_t(buf, 28, aux6); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MANUAL_CONTROL, buf, MAVLINK_MSG_ID_MANUAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MANUAL_CONTROL_LEN, MAVLINK_MSG_ID_MANUAL_CONTROL_CRC); #else @@ -197,6 +399,16 @@ static inline void mavlink_msg_manual_control_send(mavlink_channel_t chan, uint8 packet.r = r; packet.buttons = buttons; packet.target = target; + packet.buttons2 = buttons2; + packet.enabled_extensions = enabled_extensions; + packet.s = s; + packet.t = t; + packet.aux1 = aux1; + packet.aux2 = aux2; + packet.aux3 = aux3; + packet.aux4 = aux4; + packet.aux5 = aux5; + packet.aux6 = aux6; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MANUAL_CONTROL, (const char *)&packet, MAVLINK_MSG_ID_MANUAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MANUAL_CONTROL_LEN, MAVLINK_MSG_ID_MANUAL_CONTROL_CRC); #endif @@ -210,7 +422,7 @@ static inline void mavlink_msg_manual_control_send(mavlink_channel_t chan, uint8 static inline void mavlink_msg_manual_control_send_struct(mavlink_channel_t chan, const mavlink_manual_control_t* manual_control) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_manual_control_send(chan, manual_control->target, manual_control->x, manual_control->y, manual_control->z, manual_control->r, manual_control->buttons); + mavlink_msg_manual_control_send(chan, manual_control->target, manual_control->x, manual_control->y, manual_control->z, manual_control->r, manual_control->buttons, manual_control->buttons2, manual_control->enabled_extensions, manual_control->s, manual_control->t, manual_control->aux1, manual_control->aux2, manual_control->aux3, manual_control->aux4, manual_control->aux5, manual_control->aux6); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MANUAL_CONTROL, (const char *)manual_control, MAVLINK_MSG_ID_MANUAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MANUAL_CONTROL_LEN, MAVLINK_MSG_ID_MANUAL_CONTROL_CRC); #endif @@ -218,13 +430,13 @@ static inline void mavlink_msg_manual_control_send_struct(mavlink_channel_t chan #if MAVLINK_MSG_ID_MANUAL_CONTROL_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_manual_control_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target, int16_t x, int16_t y, int16_t z, int16_t r, uint16_t buttons) +static inline void mavlink_msg_manual_control_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target, int16_t x, int16_t y, int16_t z, int16_t r, uint16_t buttons, uint16_t buttons2, uint8_t enabled_extensions, int16_t s, int16_t t, int16_t aux1, int16_t aux2, int16_t aux3, int16_t aux4, int16_t aux5, int16_t aux6) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; @@ -234,6 +446,16 @@ static inline void mavlink_msg_manual_control_send_buf(mavlink_message_t *msgbuf _mav_put_int16_t(buf, 6, r); _mav_put_uint16_t(buf, 8, buttons); _mav_put_uint8_t(buf, 10, target); + _mav_put_uint16_t(buf, 11, buttons2); + _mav_put_uint8_t(buf, 13, enabled_extensions); + _mav_put_int16_t(buf, 14, s); + _mav_put_int16_t(buf, 16, t); + _mav_put_int16_t(buf, 18, aux1); + _mav_put_int16_t(buf, 20, aux2); + _mav_put_int16_t(buf, 22, aux3); + _mav_put_int16_t(buf, 24, aux4); + _mav_put_int16_t(buf, 26, aux5); + _mav_put_int16_t(buf, 28, aux6); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MANUAL_CONTROL, buf, MAVLINK_MSG_ID_MANUAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MANUAL_CONTROL_LEN, MAVLINK_MSG_ID_MANUAL_CONTROL_CRC); #else @@ -244,6 +466,16 @@ static inline void mavlink_msg_manual_control_send_buf(mavlink_message_t *msgbuf packet->r = r; packet->buttons = buttons; packet->target = target; + packet->buttons2 = buttons2; + packet->enabled_extensions = enabled_extensions; + packet->s = s; + packet->t = t; + packet->aux1 = aux1; + packet->aux2 = aux2; + packet->aux3 = aux3; + packet->aux4 = aux4; + packet->aux5 = aux5; + packet->aux6 = aux6; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MANUAL_CONTROL, (const char *)packet, MAVLINK_MSG_ID_MANUAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MANUAL_CONTROL_LEN, MAVLINK_MSG_ID_MANUAL_CONTROL_CRC); #endif @@ -308,13 +540,113 @@ static inline int16_t mavlink_msg_manual_control_get_r(const mavlink_message_t* /** * @brief Get field buttons from manual_control message * - * @return A bitfield corresponding to the joystick buttons' current state, 1 for pressed, 0 for released. The lowest bit corresponds to Button 1. + * @return A bitfield corresponding to the joystick buttons' 0-15 current state, 1 for pressed, 0 for released. The lowest bit corresponds to Button 1. */ static inline uint16_t mavlink_msg_manual_control_get_buttons(const mavlink_message_t* msg) { return _MAV_RETURN_uint16_t(msg, 8); } +/** + * @brief Get field buttons2 from manual_control message + * + * @return A bitfield corresponding to the joystick buttons' 16-31 current state, 1 for pressed, 0 for released. The lowest bit corresponds to Button 16. + */ +static inline uint16_t mavlink_msg_manual_control_get_buttons2(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 11); +} + +/** + * @brief Get field enabled_extensions from manual_control message + * + * @return Set bits to 1 to indicate which of the following extension fields contain valid data: bit 0: pitch, bit 1: roll, bit 2: aux1, bit 3: aux2, bit 4: aux3, bit 5: aux4, bit 6: aux5, bit 7: aux6 + */ +static inline uint8_t mavlink_msg_manual_control_get_enabled_extensions(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 13); +} + +/** + * @brief Get field s from manual_control message + * + * @return Pitch-only-axis, normalized to the range [-1000,1000]. Generally corresponds to pitch on vehicles with additional degrees of freedom. Valid if bit 0 of enabled_extensions field is set. Set to 0 if invalid. + */ +static inline int16_t mavlink_msg_manual_control_get_s(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int16_t(msg, 14); +} + +/** + * @brief Get field t from manual_control message + * + * @return Roll-only-axis, normalized to the range [-1000,1000]. Generally corresponds to roll on vehicles with additional degrees of freedom. Valid if bit 1 of enabled_extensions field is set. Set to 0 if invalid. + */ +static inline int16_t mavlink_msg_manual_control_get_t(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int16_t(msg, 16); +} + +/** + * @brief Get field aux1 from manual_control message + * + * @return Aux continuous input field 1. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 2 of enabled_extensions field is set. 0 if bit 2 is unset. + */ +static inline int16_t mavlink_msg_manual_control_get_aux1(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int16_t(msg, 18); +} + +/** + * @brief Get field aux2 from manual_control message + * + * @return Aux continuous input field 2. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 3 of enabled_extensions field is set. 0 if bit 3 is unset. + */ +static inline int16_t mavlink_msg_manual_control_get_aux2(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int16_t(msg, 20); +} + +/** + * @brief Get field aux3 from manual_control message + * + * @return Aux continuous input field 3. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 4 of enabled_extensions field is set. 0 if bit 4 is unset. + */ +static inline int16_t mavlink_msg_manual_control_get_aux3(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int16_t(msg, 22); +} + +/** + * @brief Get field aux4 from manual_control message + * + * @return Aux continuous input field 4. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 5 of enabled_extensions field is set. 0 if bit 5 is unset. + */ +static inline int16_t mavlink_msg_manual_control_get_aux4(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int16_t(msg, 24); +} + +/** + * @brief Get field aux5 from manual_control message + * + * @return Aux continuous input field 5. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 6 of enabled_extensions field is set. 0 if bit 6 is unset. + */ +static inline int16_t mavlink_msg_manual_control_get_aux5(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int16_t(msg, 26); +} + +/** + * @brief Get field aux6 from manual_control message + * + * @return Aux continuous input field 6. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 7 of enabled_extensions field is set. 0 if bit 7 is unset. + */ +static inline int16_t mavlink_msg_manual_control_get_aux6(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int16_t(msg, 28); +} + /** * @brief Decode a manual_control message into a struct * @@ -330,6 +662,16 @@ static inline void mavlink_msg_manual_control_decode(const mavlink_message_t* ms manual_control->r = mavlink_msg_manual_control_get_r(msg); manual_control->buttons = mavlink_msg_manual_control_get_buttons(msg); manual_control->target = mavlink_msg_manual_control_get_target(msg); + manual_control->buttons2 = mavlink_msg_manual_control_get_buttons2(msg); + manual_control->enabled_extensions = mavlink_msg_manual_control_get_enabled_extensions(msg); + manual_control->s = mavlink_msg_manual_control_get_s(msg); + manual_control->t = mavlink_msg_manual_control_get_t(msg); + manual_control->aux1 = mavlink_msg_manual_control_get_aux1(msg); + manual_control->aux2 = mavlink_msg_manual_control_get_aux2(msg); + manual_control->aux3 = mavlink_msg_manual_control_get_aux3(msg); + manual_control->aux4 = mavlink_msg_manual_control_get_aux4(msg); + manual_control->aux5 = mavlink_msg_manual_control_get_aux5(msg); + manual_control->aux6 = mavlink_msg_manual_control_get_aux6(msg); #else uint8_t len = msg->len < MAVLINK_MSG_ID_MANUAL_CONTROL_LEN? msg->len : MAVLINK_MSG_ID_MANUAL_CONTROL_LEN; memset(manual_control, 0, MAVLINK_MSG_ID_MANUAL_CONTROL_LEN); diff --git a/common/mavlink_msg_manual_setpoint.h b/common/mavlink_msg_manual_setpoint.h index 4bc42b140..935666f91 100644 --- a/common/mavlink_msg_manual_setpoint.h +++ b/common/mavlink_msg_manual_setpoint.h @@ -99,6 +99,57 @@ static inline uint16_t mavlink_msg_manual_setpoint_pack(uint8_t system_id, uint8 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MANUAL_SETPOINT_MIN_LEN, MAVLINK_MSG_ID_MANUAL_SETPOINT_LEN, MAVLINK_MSG_ID_MANUAL_SETPOINT_CRC); } +/** + * @brief Pack a manual_setpoint message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param roll [rad/s] Desired roll rate + * @param pitch [rad/s] Desired pitch rate + * @param yaw [rad/s] Desired yaw rate + * @param thrust Collective thrust, normalized to 0 .. 1 + * @param mode_switch Flight mode switch position, 0.. 255 + * @param manual_override_switch Override mode switch position, 0.. 255 + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_manual_setpoint_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, float roll, float pitch, float yaw, float thrust, uint8_t mode_switch, uint8_t manual_override_switch) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_MANUAL_SETPOINT_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_float(buf, 4, roll); + _mav_put_float(buf, 8, pitch); + _mav_put_float(buf, 12, yaw); + _mav_put_float(buf, 16, thrust); + _mav_put_uint8_t(buf, 20, mode_switch); + _mav_put_uint8_t(buf, 21, manual_override_switch); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MANUAL_SETPOINT_LEN); +#else + mavlink_manual_setpoint_t packet; + packet.time_boot_ms = time_boot_ms; + packet.roll = roll; + packet.pitch = pitch; + packet.yaw = yaw; + packet.thrust = thrust; + packet.mode_switch = mode_switch; + packet.manual_override_switch = manual_override_switch; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MANUAL_SETPOINT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_MANUAL_SETPOINT; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MANUAL_SETPOINT_MIN_LEN, MAVLINK_MSG_ID_MANUAL_SETPOINT_LEN, MAVLINK_MSG_ID_MANUAL_SETPOINT_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MANUAL_SETPOINT_MIN_LEN, MAVLINK_MSG_ID_MANUAL_SETPOINT_LEN); +#endif +} + /** * @brief Pack a manual_setpoint message on a channel * @param system_id ID of this system @@ -173,6 +224,20 @@ static inline uint16_t mavlink_msg_manual_setpoint_encode_chan(uint8_t system_id return mavlink_msg_manual_setpoint_pack_chan(system_id, component_id, chan, msg, manual_setpoint->time_boot_ms, manual_setpoint->roll, manual_setpoint->pitch, manual_setpoint->yaw, manual_setpoint->thrust, manual_setpoint->mode_switch, manual_setpoint->manual_override_switch); } +/** + * @brief Encode a manual_setpoint struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param manual_setpoint C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_manual_setpoint_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_manual_setpoint_t* manual_setpoint) +{ + return mavlink_msg_manual_setpoint_pack_status(system_id, component_id, _status, msg, manual_setpoint->time_boot_ms, manual_setpoint->roll, manual_setpoint->pitch, manual_setpoint->yaw, manual_setpoint->thrust, manual_setpoint->mode_switch, manual_setpoint->manual_override_switch); +} + /** * @brief Send a manual_setpoint message * @param chan MAVLink channel to send the message @@ -230,7 +295,7 @@ static inline void mavlink_msg_manual_setpoint_send_struct(mavlink_channel_t cha #if MAVLINK_MSG_ID_MANUAL_SETPOINT_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_memory_vect.h b/common/mavlink_msg_memory_vect.h index c33154747..e1459ad6e 100644 --- a/common/mavlink_msg_memory_vect.h +++ b/common/mavlink_msg_memory_vect.h @@ -71,7 +71,7 @@ static inline uint16_t mavlink_msg_memory_vect_pack(uint8_t system_id, uint8_t c packet.address = address; packet.ver = ver; packet.type = type; - mav_array_memcpy(packet.value, value, sizeof(int8_t)*32); + mav_array_assign_int8_t(packet.value, value, 32); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MEMORY_VECT_LEN); #endif @@ -79,6 +79,46 @@ static inline uint16_t mavlink_msg_memory_vect_pack(uint8_t system_id, uint8_t c return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MEMORY_VECT_MIN_LEN, MAVLINK_MSG_ID_MEMORY_VECT_LEN, MAVLINK_MSG_ID_MEMORY_VECT_CRC); } +/** + * @brief Pack a memory_vect message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param address Starting address of the debug variables + * @param ver Version code of the type variable. 0=unknown, type ignored and assumed int16_t. 1=as below + * @param type Type code of the memory variables. for ver = 1: 0=16 x int16_t, 1=16 x uint16_t, 2=16 x Q15, 3=16 x 1Q14 + * @param value Memory contents at specified address + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_memory_vect_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint16_t address, uint8_t ver, uint8_t type, const int8_t *value) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_MEMORY_VECT_LEN]; + _mav_put_uint16_t(buf, 0, address); + _mav_put_uint8_t(buf, 2, ver); + _mav_put_uint8_t(buf, 3, type); + _mav_put_int8_t_array(buf, 4, value, 32); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MEMORY_VECT_LEN); +#else + mavlink_memory_vect_t packet; + packet.address = address; + packet.ver = ver; + packet.type = type; + mav_array_memcpy(packet.value, value, sizeof(int8_t)*32); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MEMORY_VECT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_MEMORY_VECT; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MEMORY_VECT_MIN_LEN, MAVLINK_MSG_ID_MEMORY_VECT_LEN, MAVLINK_MSG_ID_MEMORY_VECT_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MEMORY_VECT_MIN_LEN, MAVLINK_MSG_ID_MEMORY_VECT_LEN); +#endif +} + /** * @brief Pack a memory_vect message on a channel * @param system_id ID of this system @@ -107,7 +147,7 @@ static inline uint16_t mavlink_msg_memory_vect_pack_chan(uint8_t system_id, uint packet.address = address; packet.ver = ver; packet.type = type; - mav_array_memcpy(packet.value, value, sizeof(int8_t)*32); + mav_array_assign_int8_t(packet.value, value, 32); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MEMORY_VECT_LEN); #endif @@ -142,6 +182,20 @@ static inline uint16_t mavlink_msg_memory_vect_encode_chan(uint8_t system_id, ui return mavlink_msg_memory_vect_pack_chan(system_id, component_id, chan, msg, memory_vect->address, memory_vect->ver, memory_vect->type, memory_vect->value); } +/** + * @brief Encode a memory_vect struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param memory_vect C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_memory_vect_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_memory_vect_t* memory_vect) +{ + return mavlink_msg_memory_vect_pack_status(system_id, component_id, _status, msg, memory_vect->address, memory_vect->ver, memory_vect->type, memory_vect->value); +} + /** * @brief Send a memory_vect message * @param chan MAVLink channel to send the message @@ -167,7 +221,7 @@ static inline void mavlink_msg_memory_vect_send(mavlink_channel_t chan, uint16_t packet.address = address; packet.ver = ver; packet.type = type; - mav_array_memcpy(packet.value, value, sizeof(int8_t)*32); + mav_array_assign_int8_t(packet.value, value, 32); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MEMORY_VECT, (const char *)&packet, MAVLINK_MSG_ID_MEMORY_VECT_MIN_LEN, MAVLINK_MSG_ID_MEMORY_VECT_LEN, MAVLINK_MSG_ID_MEMORY_VECT_CRC); #endif } @@ -188,7 +242,7 @@ static inline void mavlink_msg_memory_vect_send_struct(mavlink_channel_t chan, c #if MAVLINK_MSG_ID_MEMORY_VECT_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -208,7 +262,7 @@ static inline void mavlink_msg_memory_vect_send_buf(mavlink_message_t *msgbuf, m packet->address = address; packet->ver = ver; packet->type = type; - mav_array_memcpy(packet->value, value, sizeof(int8_t)*32); + mav_array_assign_int8_t(packet->value, value, 32); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MEMORY_VECT, (const char *)packet, MAVLINK_MSG_ID_MEMORY_VECT_MIN_LEN, MAVLINK_MSG_ID_MEMORY_VECT_LEN, MAVLINK_MSG_ID_MEMORY_VECT_CRC); #endif } diff --git a/common/mavlink_msg_message_interval.h b/common/mavlink_msg_message_interval.h index a6a52b1fd..9816d33d5 100644 --- a/common/mavlink_msg_message_interval.h +++ b/common/mavlink_msg_message_interval.h @@ -69,6 +69,42 @@ static inline uint16_t mavlink_msg_message_interval_pack(uint8_t system_id, uint return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MESSAGE_INTERVAL_MIN_LEN, MAVLINK_MSG_ID_MESSAGE_INTERVAL_LEN, MAVLINK_MSG_ID_MESSAGE_INTERVAL_CRC); } +/** + * @brief Pack a message_interval message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param message_id The ID of the requested MAVLink message. v1.0 is limited to 254 messages. + * @param interval_us [us] The interval between two messages. A value of -1 indicates this stream is disabled, 0 indicates it is not available, > 0 indicates the interval at which it is sent. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_message_interval_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint16_t message_id, int32_t interval_us) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_MESSAGE_INTERVAL_LEN]; + _mav_put_int32_t(buf, 0, interval_us); + _mav_put_uint16_t(buf, 4, message_id); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MESSAGE_INTERVAL_LEN); +#else + mavlink_message_interval_t packet; + packet.interval_us = interval_us; + packet.message_id = message_id; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MESSAGE_INTERVAL_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_MESSAGE_INTERVAL; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MESSAGE_INTERVAL_MIN_LEN, MAVLINK_MSG_ID_MESSAGE_INTERVAL_LEN, MAVLINK_MSG_ID_MESSAGE_INTERVAL_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MESSAGE_INTERVAL_MIN_LEN, MAVLINK_MSG_ID_MESSAGE_INTERVAL_LEN); +#endif +} + /** * @brief Pack a message_interval message on a channel * @param system_id ID of this system @@ -128,6 +164,20 @@ static inline uint16_t mavlink_msg_message_interval_encode_chan(uint8_t system_i return mavlink_msg_message_interval_pack_chan(system_id, component_id, chan, msg, message_interval->message_id, message_interval->interval_us); } +/** + * @brief Encode a message_interval struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param message_interval C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_message_interval_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_message_interval_t* message_interval) +{ + return mavlink_msg_message_interval_pack_status(system_id, component_id, _status, msg, message_interval->message_id, message_interval->interval_us); +} + /** * @brief Send a message_interval message * @param chan MAVLink channel to send the message @@ -170,7 +220,7 @@ static inline void mavlink_msg_message_interval_send_struct(mavlink_channel_t ch #if MAVLINK_MSG_ID_MESSAGE_INTERVAL_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_mission_ack.h b/common/mavlink_msg_mission_ack.h index 916b94d38..a69f22a08 100644 --- a/common/mavlink_msg_mission_ack.h +++ b/common/mavlink_msg_mission_ack.h @@ -9,11 +9,18 @@ typedef struct __mavlink_mission_ack_t { uint8_t target_component; /*< Component ID*/ uint8_t type; /*< Mission result.*/ uint8_t mission_type; /*< Mission type.*/ + uint32_t opaque_id; /*< Id of new on-vehicle mission, fence, or rally point plan (on upload to vehicle). + The id is calculated and returned by a vehicle when a new plan is uploaded by a GCS. + The only requirement on the id is that it must change when there is any change to the on-vehicle plan type (there is no requirement that the id be globally unique). + 0 on download from the vehicle to the GCS (on download the ID is set in MISSION_COUNT). + 0 if plan ids are not supported. + The current on-vehicle plan ids are streamed in `MISSION_CURRENT`, allowing a GCS to determine if any part of the plan has changed and needs to be re-uploaded. + */ } mavlink_mission_ack_t; -#define MAVLINK_MSG_ID_MISSION_ACK_LEN 4 +#define MAVLINK_MSG_ID_MISSION_ACK_LEN 8 #define MAVLINK_MSG_ID_MISSION_ACK_MIN_LEN 3 -#define MAVLINK_MSG_ID_47_LEN 4 +#define MAVLINK_MSG_ID_47_LEN 8 #define MAVLINK_MSG_ID_47_MIN_LEN 3 #define MAVLINK_MSG_ID_MISSION_ACK_CRC 153 @@ -25,21 +32,23 @@ typedef struct __mavlink_mission_ack_t { #define MAVLINK_MESSAGE_INFO_MISSION_ACK { \ 47, \ "MISSION_ACK", \ - 4, \ + 5, \ { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_mission_ack_t, target_system) }, \ { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_mission_ack_t, target_component) }, \ { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_mission_ack_t, type) }, \ { "mission_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_mission_ack_t, mission_type) }, \ + { "opaque_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_mission_ack_t, opaque_id) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_MISSION_ACK { \ "MISSION_ACK", \ - 4, \ + 5, \ { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_mission_ack_t, target_system) }, \ { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_mission_ack_t, target_component) }, \ { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_mission_ack_t, type) }, \ { "mission_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_mission_ack_t, mission_type) }, \ + { "opaque_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_mission_ack_t, opaque_id) }, \ } \ } #endif @@ -54,10 +63,17 @@ typedef struct __mavlink_mission_ack_t { * @param target_component Component ID * @param type Mission result. * @param mission_type Mission type. + * @param opaque_id Id of new on-vehicle mission, fence, or rally point plan (on upload to vehicle). + The id is calculated and returned by a vehicle when a new plan is uploaded by a GCS. + The only requirement on the id is that it must change when there is any change to the on-vehicle plan type (there is no requirement that the id be globally unique). + 0 on download from the vehicle to the GCS (on download the ID is set in MISSION_COUNT). + 0 if plan ids are not supported. + The current on-vehicle plan ids are streamed in `MISSION_CURRENT`, allowing a GCS to determine if any part of the plan has changed and needs to be re-uploaded. + * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_mission_ack_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, uint8_t type, uint8_t mission_type) + uint8_t target_system, uint8_t target_component, uint8_t type, uint8_t mission_type, uint32_t opaque_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_MISSION_ACK_LEN]; @@ -65,6 +81,7 @@ static inline uint16_t mavlink_msg_mission_ack_pack(uint8_t system_id, uint8_t c _mav_put_uint8_t(buf, 1, target_component); _mav_put_uint8_t(buf, 2, type); _mav_put_uint8_t(buf, 3, mission_type); + _mav_put_uint32_t(buf, 4, opaque_id); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_ACK_LEN); #else @@ -73,6 +90,7 @@ static inline uint16_t mavlink_msg_mission_ack_pack(uint8_t system_id, uint8_t c packet.target_component = target_component; packet.type = type; packet.mission_type = mission_type; + packet.opaque_id = opaque_id; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_ACK_LEN); #endif @@ -81,6 +99,57 @@ static inline uint16_t mavlink_msg_mission_ack_pack(uint8_t system_id, uint8_t c return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MISSION_ACK_MIN_LEN, MAVLINK_MSG_ID_MISSION_ACK_LEN, MAVLINK_MSG_ID_MISSION_ACK_CRC); } +/** + * @brief Pack a mission_ack message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param type Mission result. + * @param mission_type Mission type. + * @param opaque_id Id of new on-vehicle mission, fence, or rally point plan (on upload to vehicle). + The id is calculated and returned by a vehicle when a new plan is uploaded by a GCS. + The only requirement on the id is that it must change when there is any change to the on-vehicle plan type (there is no requirement that the id be globally unique). + 0 on download from the vehicle to the GCS (on download the ID is set in MISSION_COUNT). + 0 if plan ids are not supported. + The current on-vehicle plan ids are streamed in `MISSION_CURRENT`, allowing a GCS to determine if any part of the plan has changed and needs to be re-uploaded. + + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_mission_ack_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint8_t type, uint8_t mission_type, uint32_t opaque_id) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_MISSION_ACK_LEN]; + _mav_put_uint8_t(buf, 0, target_system); + _mav_put_uint8_t(buf, 1, target_component); + _mav_put_uint8_t(buf, 2, type); + _mav_put_uint8_t(buf, 3, mission_type); + _mav_put_uint32_t(buf, 4, opaque_id); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_ACK_LEN); +#else + mavlink_mission_ack_t packet; + packet.target_system = target_system; + packet.target_component = target_component; + packet.type = type; + packet.mission_type = mission_type; + packet.opaque_id = opaque_id; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_ACK_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_MISSION_ACK; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MISSION_ACK_MIN_LEN, MAVLINK_MSG_ID_MISSION_ACK_LEN, MAVLINK_MSG_ID_MISSION_ACK_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MISSION_ACK_MIN_LEN, MAVLINK_MSG_ID_MISSION_ACK_LEN); +#endif +} + /** * @brief Pack a mission_ack message on a channel * @param system_id ID of this system @@ -91,11 +160,18 @@ static inline uint16_t mavlink_msg_mission_ack_pack(uint8_t system_id, uint8_t c * @param target_component Component ID * @param type Mission result. * @param mission_type Mission type. + * @param opaque_id Id of new on-vehicle mission, fence, or rally point plan (on upload to vehicle). + The id is calculated and returned by a vehicle when a new plan is uploaded by a GCS. + The only requirement on the id is that it must change when there is any change to the on-vehicle plan type (there is no requirement that the id be globally unique). + 0 on download from the vehicle to the GCS (on download the ID is set in MISSION_COUNT). + 0 if plan ids are not supported. + The current on-vehicle plan ids are streamed in `MISSION_CURRENT`, allowing a GCS to determine if any part of the plan has changed and needs to be re-uploaded. + * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_mission_ack_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,uint8_t type,uint8_t mission_type) + uint8_t target_system,uint8_t target_component,uint8_t type,uint8_t mission_type,uint32_t opaque_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_MISSION_ACK_LEN]; @@ -103,6 +179,7 @@ static inline uint16_t mavlink_msg_mission_ack_pack_chan(uint8_t system_id, uint _mav_put_uint8_t(buf, 1, target_component); _mav_put_uint8_t(buf, 2, type); _mav_put_uint8_t(buf, 3, mission_type); + _mav_put_uint32_t(buf, 4, opaque_id); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_ACK_LEN); #else @@ -111,6 +188,7 @@ static inline uint16_t mavlink_msg_mission_ack_pack_chan(uint8_t system_id, uint packet.target_component = target_component; packet.type = type; packet.mission_type = mission_type; + packet.opaque_id = opaque_id; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_ACK_LEN); #endif @@ -129,7 +207,7 @@ static inline uint16_t mavlink_msg_mission_ack_pack_chan(uint8_t system_id, uint */ static inline uint16_t mavlink_msg_mission_ack_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_mission_ack_t* mission_ack) { - return mavlink_msg_mission_ack_pack(system_id, component_id, msg, mission_ack->target_system, mission_ack->target_component, mission_ack->type, mission_ack->mission_type); + return mavlink_msg_mission_ack_pack(system_id, component_id, msg, mission_ack->target_system, mission_ack->target_component, mission_ack->type, mission_ack->mission_type, mission_ack->opaque_id); } /** @@ -143,7 +221,21 @@ static inline uint16_t mavlink_msg_mission_ack_encode(uint8_t system_id, uint8_t */ static inline uint16_t mavlink_msg_mission_ack_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_mission_ack_t* mission_ack) { - return mavlink_msg_mission_ack_pack_chan(system_id, component_id, chan, msg, mission_ack->target_system, mission_ack->target_component, mission_ack->type, mission_ack->mission_type); + return mavlink_msg_mission_ack_pack_chan(system_id, component_id, chan, msg, mission_ack->target_system, mission_ack->target_component, mission_ack->type, mission_ack->mission_type, mission_ack->opaque_id); +} + +/** + * @brief Encode a mission_ack struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param mission_ack C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_mission_ack_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_mission_ack_t* mission_ack) +{ + return mavlink_msg_mission_ack_pack_status(system_id, component_id, _status, msg, mission_ack->target_system, mission_ack->target_component, mission_ack->type, mission_ack->mission_type, mission_ack->opaque_id); } /** @@ -154,10 +246,17 @@ static inline uint16_t mavlink_msg_mission_ack_encode_chan(uint8_t system_id, ui * @param target_component Component ID * @param type Mission result. * @param mission_type Mission type. + * @param opaque_id Id of new on-vehicle mission, fence, or rally point plan (on upload to vehicle). + The id is calculated and returned by a vehicle when a new plan is uploaded by a GCS. + The only requirement on the id is that it must change when there is any change to the on-vehicle plan type (there is no requirement that the id be globally unique). + 0 on download from the vehicle to the GCS (on download the ID is set in MISSION_COUNT). + 0 if plan ids are not supported. + The current on-vehicle plan ids are streamed in `MISSION_CURRENT`, allowing a GCS to determine if any part of the plan has changed and needs to be re-uploaded. + */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_mission_ack_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t type, uint8_t mission_type) +static inline void mavlink_msg_mission_ack_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t type, uint8_t mission_type, uint32_t opaque_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_MISSION_ACK_LEN]; @@ -165,6 +264,7 @@ static inline void mavlink_msg_mission_ack_send(mavlink_channel_t chan, uint8_t _mav_put_uint8_t(buf, 1, target_component); _mav_put_uint8_t(buf, 2, type); _mav_put_uint8_t(buf, 3, mission_type); + _mav_put_uint32_t(buf, 4, opaque_id); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_ACK, buf, MAVLINK_MSG_ID_MISSION_ACK_MIN_LEN, MAVLINK_MSG_ID_MISSION_ACK_LEN, MAVLINK_MSG_ID_MISSION_ACK_CRC); #else @@ -173,6 +273,7 @@ static inline void mavlink_msg_mission_ack_send(mavlink_channel_t chan, uint8_t packet.target_component = target_component; packet.type = type; packet.mission_type = mission_type; + packet.opaque_id = opaque_id; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_ACK, (const char *)&packet, MAVLINK_MSG_ID_MISSION_ACK_MIN_LEN, MAVLINK_MSG_ID_MISSION_ACK_LEN, MAVLINK_MSG_ID_MISSION_ACK_CRC); #endif @@ -186,7 +287,7 @@ static inline void mavlink_msg_mission_ack_send(mavlink_channel_t chan, uint8_t static inline void mavlink_msg_mission_ack_send_struct(mavlink_channel_t chan, const mavlink_mission_ack_t* mission_ack) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_mission_ack_send(chan, mission_ack->target_system, mission_ack->target_component, mission_ack->type, mission_ack->mission_type); + mavlink_msg_mission_ack_send(chan, mission_ack->target_system, mission_ack->target_component, mission_ack->type, mission_ack->mission_type, mission_ack->opaque_id); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_ACK, (const char *)mission_ack, MAVLINK_MSG_ID_MISSION_ACK_MIN_LEN, MAVLINK_MSG_ID_MISSION_ACK_LEN, MAVLINK_MSG_ID_MISSION_ACK_CRC); #endif @@ -194,13 +295,13 @@ static inline void mavlink_msg_mission_ack_send_struct(mavlink_channel_t chan, c #if MAVLINK_MSG_ID_MISSION_ACK_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_mission_ack_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t type, uint8_t mission_type) +static inline void mavlink_msg_mission_ack_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t type, uint8_t mission_type, uint32_t opaque_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; @@ -208,6 +309,7 @@ static inline void mavlink_msg_mission_ack_send_buf(mavlink_message_t *msgbuf, m _mav_put_uint8_t(buf, 1, target_component); _mav_put_uint8_t(buf, 2, type); _mav_put_uint8_t(buf, 3, mission_type); + _mav_put_uint32_t(buf, 4, opaque_id); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_ACK, buf, MAVLINK_MSG_ID_MISSION_ACK_MIN_LEN, MAVLINK_MSG_ID_MISSION_ACK_LEN, MAVLINK_MSG_ID_MISSION_ACK_CRC); #else @@ -216,6 +318,7 @@ static inline void mavlink_msg_mission_ack_send_buf(mavlink_message_t *msgbuf, m packet->target_component = target_component; packet->type = type; packet->mission_type = mission_type; + packet->opaque_id = opaque_id; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_ACK, (const char *)packet, MAVLINK_MSG_ID_MISSION_ACK_MIN_LEN, MAVLINK_MSG_ID_MISSION_ACK_LEN, MAVLINK_MSG_ID_MISSION_ACK_CRC); #endif @@ -267,6 +370,22 @@ static inline uint8_t mavlink_msg_mission_ack_get_mission_type(const mavlink_mes return _MAV_RETURN_uint8_t(msg, 3); } +/** + * @brief Get field opaque_id from mission_ack message + * + * @return Id of new on-vehicle mission, fence, or rally point plan (on upload to vehicle). + The id is calculated and returned by a vehicle when a new plan is uploaded by a GCS. + The only requirement on the id is that it must change when there is any change to the on-vehicle plan type (there is no requirement that the id be globally unique). + 0 on download from the vehicle to the GCS (on download the ID is set in MISSION_COUNT). + 0 if plan ids are not supported. + The current on-vehicle plan ids are streamed in `MISSION_CURRENT`, allowing a GCS to determine if any part of the plan has changed and needs to be re-uploaded. + + */ +static inline uint32_t mavlink_msg_mission_ack_get_opaque_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 4); +} + /** * @brief Decode a mission_ack message into a struct * @@ -280,6 +399,7 @@ static inline void mavlink_msg_mission_ack_decode(const mavlink_message_t* msg, mission_ack->target_component = mavlink_msg_mission_ack_get_target_component(msg); mission_ack->type = mavlink_msg_mission_ack_get_type(msg); mission_ack->mission_type = mavlink_msg_mission_ack_get_mission_type(msg); + mission_ack->opaque_id = mavlink_msg_mission_ack_get_opaque_id(msg); #else uint8_t len = msg->len < MAVLINK_MSG_ID_MISSION_ACK_LEN? msg->len : MAVLINK_MSG_ID_MISSION_ACK_LEN; memset(mission_ack, 0, MAVLINK_MSG_ID_MISSION_ACK_LEN); diff --git a/common/mavlink_msg_mission_changed.h b/common/mavlink_msg_mission_changed.h deleted file mode 100644 index 28f75098e..000000000 --- a/common/mavlink_msg_mission_changed.h +++ /dev/null @@ -1,313 +0,0 @@ -#pragma once -// MESSAGE MISSION_CHANGED PACKING - -#define MAVLINK_MSG_ID_MISSION_CHANGED 52 - - -typedef struct __mavlink_mission_changed_t { - int16_t start_index; /*< Start index for partial mission change (-1 for all items).*/ - int16_t end_index; /*< End index of a partial mission change. -1 is a synonym for the last mission item (i.e. selects all items from start_index). Ignore field if start_index=-1.*/ - uint8_t origin_sysid; /*< System ID of the author of the new mission.*/ - uint8_t origin_compid; /*< Compnent ID of the author of the new mission.*/ - uint8_t mission_type; /*< Mission type.*/ -} mavlink_mission_changed_t; - -#define MAVLINK_MSG_ID_MISSION_CHANGED_LEN 7 -#define MAVLINK_MSG_ID_MISSION_CHANGED_MIN_LEN 7 -#define MAVLINK_MSG_ID_52_LEN 7 -#define MAVLINK_MSG_ID_52_MIN_LEN 7 - -#define MAVLINK_MSG_ID_MISSION_CHANGED_CRC 132 -#define MAVLINK_MSG_ID_52_CRC 132 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_MISSION_CHANGED { \ - 52, \ - "MISSION_CHANGED", \ - 5, \ - { { "start_index", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_mission_changed_t, start_index) }, \ - { "end_index", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_mission_changed_t, end_index) }, \ - { "origin_sysid", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_mission_changed_t, origin_sysid) }, \ - { "origin_compid", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_mission_changed_t, origin_compid) }, \ - { "mission_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_mission_changed_t, mission_type) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_MISSION_CHANGED { \ - "MISSION_CHANGED", \ - 5, \ - { { "start_index", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_mission_changed_t, start_index) }, \ - { "end_index", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_mission_changed_t, end_index) }, \ - { "origin_sysid", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_mission_changed_t, origin_sysid) }, \ - { "origin_compid", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_mission_changed_t, origin_compid) }, \ - { "mission_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_mission_changed_t, mission_type) }, \ - } \ -} -#endif - -/** - * @brief Pack a mission_changed message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param start_index Start index for partial mission change (-1 for all items). - * @param end_index End index of a partial mission change. -1 is a synonym for the last mission item (i.e. selects all items from start_index). Ignore field if start_index=-1. - * @param origin_sysid System ID of the author of the new mission. - * @param origin_compid Compnent ID of the author of the new mission. - * @param mission_type Mission type. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_mission_changed_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - int16_t start_index, int16_t end_index, uint8_t origin_sysid, uint8_t origin_compid, uint8_t mission_type) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_MISSION_CHANGED_LEN]; - _mav_put_int16_t(buf, 0, start_index); - _mav_put_int16_t(buf, 2, end_index); - _mav_put_uint8_t(buf, 4, origin_sysid); - _mav_put_uint8_t(buf, 5, origin_compid); - _mav_put_uint8_t(buf, 6, mission_type); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_CHANGED_LEN); -#else - mavlink_mission_changed_t packet; - packet.start_index = start_index; - packet.end_index = end_index; - packet.origin_sysid = origin_sysid; - packet.origin_compid = origin_compid; - packet.mission_type = mission_type; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_CHANGED_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_MISSION_CHANGED; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MISSION_CHANGED_MIN_LEN, MAVLINK_MSG_ID_MISSION_CHANGED_LEN, MAVLINK_MSG_ID_MISSION_CHANGED_CRC); -} - -/** - * @brief Pack a mission_changed message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param start_index Start index for partial mission change (-1 for all items). - * @param end_index End index of a partial mission change. -1 is a synonym for the last mission item (i.e. selects all items from start_index). Ignore field if start_index=-1. - * @param origin_sysid System ID of the author of the new mission. - * @param origin_compid Compnent ID of the author of the new mission. - * @param mission_type Mission type. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_mission_changed_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - int16_t start_index,int16_t end_index,uint8_t origin_sysid,uint8_t origin_compid,uint8_t mission_type) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_MISSION_CHANGED_LEN]; - _mav_put_int16_t(buf, 0, start_index); - _mav_put_int16_t(buf, 2, end_index); - _mav_put_uint8_t(buf, 4, origin_sysid); - _mav_put_uint8_t(buf, 5, origin_compid); - _mav_put_uint8_t(buf, 6, mission_type); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_CHANGED_LEN); -#else - mavlink_mission_changed_t packet; - packet.start_index = start_index; - packet.end_index = end_index; - packet.origin_sysid = origin_sysid; - packet.origin_compid = origin_compid; - packet.mission_type = mission_type; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_CHANGED_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_MISSION_CHANGED; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_MISSION_CHANGED_MIN_LEN, MAVLINK_MSG_ID_MISSION_CHANGED_LEN, MAVLINK_MSG_ID_MISSION_CHANGED_CRC); -} - -/** - * @brief Encode a mission_changed struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param mission_changed C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_mission_changed_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_mission_changed_t* mission_changed) -{ - return mavlink_msg_mission_changed_pack(system_id, component_id, msg, mission_changed->start_index, mission_changed->end_index, mission_changed->origin_sysid, mission_changed->origin_compid, mission_changed->mission_type); -} - -/** - * @brief Encode a mission_changed struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param mission_changed C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_mission_changed_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_mission_changed_t* mission_changed) -{ - return mavlink_msg_mission_changed_pack_chan(system_id, component_id, chan, msg, mission_changed->start_index, mission_changed->end_index, mission_changed->origin_sysid, mission_changed->origin_compid, mission_changed->mission_type); -} - -/** - * @brief Send a mission_changed message - * @param chan MAVLink channel to send the message - * - * @param start_index Start index for partial mission change (-1 for all items). - * @param end_index End index of a partial mission change. -1 is a synonym for the last mission item (i.e. selects all items from start_index). Ignore field if start_index=-1. - * @param origin_sysid System ID of the author of the new mission. - * @param origin_compid Compnent ID of the author of the new mission. - * @param mission_type Mission type. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_mission_changed_send(mavlink_channel_t chan, int16_t start_index, int16_t end_index, uint8_t origin_sysid, uint8_t origin_compid, uint8_t mission_type) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_MISSION_CHANGED_LEN]; - _mav_put_int16_t(buf, 0, start_index); - _mav_put_int16_t(buf, 2, end_index); - _mav_put_uint8_t(buf, 4, origin_sysid); - _mav_put_uint8_t(buf, 5, origin_compid); - _mav_put_uint8_t(buf, 6, mission_type); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CHANGED, buf, MAVLINK_MSG_ID_MISSION_CHANGED_MIN_LEN, MAVLINK_MSG_ID_MISSION_CHANGED_LEN, MAVLINK_MSG_ID_MISSION_CHANGED_CRC); -#else - mavlink_mission_changed_t packet; - packet.start_index = start_index; - packet.end_index = end_index; - packet.origin_sysid = origin_sysid; - packet.origin_compid = origin_compid; - packet.mission_type = mission_type; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CHANGED, (const char *)&packet, MAVLINK_MSG_ID_MISSION_CHANGED_MIN_LEN, MAVLINK_MSG_ID_MISSION_CHANGED_LEN, MAVLINK_MSG_ID_MISSION_CHANGED_CRC); -#endif -} - -/** - * @brief Send a mission_changed message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_mission_changed_send_struct(mavlink_channel_t chan, const mavlink_mission_changed_t* mission_changed) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_mission_changed_send(chan, mission_changed->start_index, mission_changed->end_index, mission_changed->origin_sysid, mission_changed->origin_compid, mission_changed->mission_type); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CHANGED, (const char *)mission_changed, MAVLINK_MSG_ID_MISSION_CHANGED_MIN_LEN, MAVLINK_MSG_ID_MISSION_CHANGED_LEN, MAVLINK_MSG_ID_MISSION_CHANGED_CRC); -#endif -} - -#if MAVLINK_MSG_ID_MISSION_CHANGED_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_mission_changed_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, int16_t start_index, int16_t end_index, uint8_t origin_sysid, uint8_t origin_compid, uint8_t mission_type) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_int16_t(buf, 0, start_index); - _mav_put_int16_t(buf, 2, end_index); - _mav_put_uint8_t(buf, 4, origin_sysid); - _mav_put_uint8_t(buf, 5, origin_compid); - _mav_put_uint8_t(buf, 6, mission_type); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CHANGED, buf, MAVLINK_MSG_ID_MISSION_CHANGED_MIN_LEN, MAVLINK_MSG_ID_MISSION_CHANGED_LEN, MAVLINK_MSG_ID_MISSION_CHANGED_CRC); -#else - mavlink_mission_changed_t *packet = (mavlink_mission_changed_t *)msgbuf; - packet->start_index = start_index; - packet->end_index = end_index; - packet->origin_sysid = origin_sysid; - packet->origin_compid = origin_compid; - packet->mission_type = mission_type; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CHANGED, (const char *)packet, MAVLINK_MSG_ID_MISSION_CHANGED_MIN_LEN, MAVLINK_MSG_ID_MISSION_CHANGED_LEN, MAVLINK_MSG_ID_MISSION_CHANGED_CRC); -#endif -} -#endif - -#endif - -// MESSAGE MISSION_CHANGED UNPACKING - - -/** - * @brief Get field start_index from mission_changed message - * - * @return Start index for partial mission change (-1 for all items). - */ -static inline int16_t mavlink_msg_mission_changed_get_start_index(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 0); -} - -/** - * @brief Get field end_index from mission_changed message - * - * @return End index of a partial mission change. -1 is a synonym for the last mission item (i.e. selects all items from start_index). Ignore field if start_index=-1. - */ -static inline int16_t mavlink_msg_mission_changed_get_end_index(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 2); -} - -/** - * @brief Get field origin_sysid from mission_changed message - * - * @return System ID of the author of the new mission. - */ -static inline uint8_t mavlink_msg_mission_changed_get_origin_sysid(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 4); -} - -/** - * @brief Get field origin_compid from mission_changed message - * - * @return Compnent ID of the author of the new mission. - */ -static inline uint8_t mavlink_msg_mission_changed_get_origin_compid(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 5); -} - -/** - * @brief Get field mission_type from mission_changed message - * - * @return Mission type. - */ -static inline uint8_t mavlink_msg_mission_changed_get_mission_type(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 6); -} - -/** - * @brief Decode a mission_changed message into a struct - * - * @param msg The message to decode - * @param mission_changed C-struct to decode the message contents into - */ -static inline void mavlink_msg_mission_changed_decode(const mavlink_message_t* msg, mavlink_mission_changed_t* mission_changed) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mission_changed->start_index = mavlink_msg_mission_changed_get_start_index(msg); - mission_changed->end_index = mavlink_msg_mission_changed_get_end_index(msg); - mission_changed->origin_sysid = mavlink_msg_mission_changed_get_origin_sysid(msg); - mission_changed->origin_compid = mavlink_msg_mission_changed_get_origin_compid(msg); - mission_changed->mission_type = mavlink_msg_mission_changed_get_mission_type(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_MISSION_CHANGED_LEN? msg->len : MAVLINK_MSG_ID_MISSION_CHANGED_LEN; - memset(mission_changed, 0, MAVLINK_MSG_ID_MISSION_CHANGED_LEN); - memcpy(mission_changed, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/common/mavlink_msg_mission_clear_all.h b/common/mavlink_msg_mission_clear_all.h index 1e585f9fc..524785d9c 100644 --- a/common/mavlink_msg_mission_clear_all.h +++ b/common/mavlink_msg_mission_clear_all.h @@ -75,6 +75,45 @@ static inline uint16_t mavlink_msg_mission_clear_all_pack(uint8_t system_id, uin return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MISSION_CLEAR_ALL_MIN_LEN, MAVLINK_MSG_ID_MISSION_CLEAR_ALL_LEN, MAVLINK_MSG_ID_MISSION_CLEAR_ALL_CRC); } +/** + * @brief Pack a mission_clear_all message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param mission_type Mission type. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_mission_clear_all_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint8_t mission_type) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_MISSION_CLEAR_ALL_LEN]; + _mav_put_uint8_t(buf, 0, target_system); + _mav_put_uint8_t(buf, 1, target_component); + _mav_put_uint8_t(buf, 2, mission_type); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_CLEAR_ALL_LEN); +#else + mavlink_mission_clear_all_t packet; + packet.target_system = target_system; + packet.target_component = target_component; + packet.mission_type = mission_type; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_CLEAR_ALL_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_MISSION_CLEAR_ALL; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MISSION_CLEAR_ALL_MIN_LEN, MAVLINK_MSG_ID_MISSION_CLEAR_ALL_LEN, MAVLINK_MSG_ID_MISSION_CLEAR_ALL_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MISSION_CLEAR_ALL_MIN_LEN, MAVLINK_MSG_ID_MISSION_CLEAR_ALL_LEN); +#endif +} + /** * @brief Pack a mission_clear_all message on a channel * @param system_id ID of this system @@ -137,6 +176,20 @@ static inline uint16_t mavlink_msg_mission_clear_all_encode_chan(uint8_t system_ return mavlink_msg_mission_clear_all_pack_chan(system_id, component_id, chan, msg, mission_clear_all->target_system, mission_clear_all->target_component, mission_clear_all->mission_type); } +/** + * @brief Encode a mission_clear_all struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param mission_clear_all C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_mission_clear_all_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_mission_clear_all_t* mission_clear_all) +{ + return mavlink_msg_mission_clear_all_pack_status(system_id, component_id, _status, msg, mission_clear_all->target_system, mission_clear_all->target_component, mission_clear_all->mission_type); +} + /** * @brief Send a mission_clear_all message * @param chan MAVLink channel to send the message @@ -182,7 +235,7 @@ static inline void mavlink_msg_mission_clear_all_send_struct(mavlink_channel_t c #if MAVLINK_MSG_ID_MISSION_CLEAR_ALL_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_mission_count.h b/common/mavlink_msg_mission_count.h index 53afd4900..0e46831cc 100644 --- a/common/mavlink_msg_mission_count.h +++ b/common/mavlink_msg_mission_count.h @@ -3,17 +3,24 @@ #define MAVLINK_MSG_ID_MISSION_COUNT 44 - +MAVPACKED( typedef struct __mavlink_mission_count_t { uint16_t count; /*< Number of mission items in the sequence*/ uint8_t target_system; /*< System ID*/ uint8_t target_component; /*< Component ID*/ uint8_t mission_type; /*< Mission type.*/ -} mavlink_mission_count_t; - -#define MAVLINK_MSG_ID_MISSION_COUNT_LEN 5 + uint32_t opaque_id; /*< Id of current on-vehicle mission, fence, or rally point plan (on download from vehicle). + This field is used when downloading a plan from a vehicle to a GCS. + 0 on upload to the vehicle from GCS. + 0 if plan ids are not supported. + The current on-vehicle plan ids are streamed in `MISSION_CURRENT`, allowing a GCS to determine if any part of the plan has changed and needs to be re-uploaded. + The ids are recalculated by the vehicle when any part of the on-vehicle plan changes (when a new plan is uploaded, the vehicle returns the new id to the GCS in MISSION_ACK). + */ +}) mavlink_mission_count_t; + +#define MAVLINK_MSG_ID_MISSION_COUNT_LEN 9 #define MAVLINK_MSG_ID_MISSION_COUNT_MIN_LEN 4 -#define MAVLINK_MSG_ID_44_LEN 5 +#define MAVLINK_MSG_ID_44_LEN 9 #define MAVLINK_MSG_ID_44_MIN_LEN 4 #define MAVLINK_MSG_ID_MISSION_COUNT_CRC 221 @@ -25,21 +32,23 @@ typedef struct __mavlink_mission_count_t { #define MAVLINK_MESSAGE_INFO_MISSION_COUNT { \ 44, \ "MISSION_COUNT", \ - 4, \ + 5, \ { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_mission_count_t, target_system) }, \ { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_mission_count_t, target_component) }, \ { "count", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_mission_count_t, count) }, \ { "mission_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_mission_count_t, mission_type) }, \ + { "opaque_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 5, offsetof(mavlink_mission_count_t, opaque_id) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_MISSION_COUNT { \ "MISSION_COUNT", \ - 4, \ + 5, \ { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_mission_count_t, target_system) }, \ { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_mission_count_t, target_component) }, \ { "count", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_mission_count_t, count) }, \ { "mission_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_mission_count_t, mission_type) }, \ + { "opaque_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 5, offsetof(mavlink_mission_count_t, opaque_id) }, \ } \ } #endif @@ -54,10 +63,17 @@ typedef struct __mavlink_mission_count_t { * @param target_component Component ID * @param count Number of mission items in the sequence * @param mission_type Mission type. + * @param opaque_id Id of current on-vehicle mission, fence, or rally point plan (on download from vehicle). + This field is used when downloading a plan from a vehicle to a GCS. + 0 on upload to the vehicle from GCS. + 0 if plan ids are not supported. + The current on-vehicle plan ids are streamed in `MISSION_CURRENT`, allowing a GCS to determine if any part of the plan has changed and needs to be re-uploaded. + The ids are recalculated by the vehicle when any part of the on-vehicle plan changes (when a new plan is uploaded, the vehicle returns the new id to the GCS in MISSION_ACK). + * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_mission_count_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, uint16_t count, uint8_t mission_type) + uint8_t target_system, uint8_t target_component, uint16_t count, uint8_t mission_type, uint32_t opaque_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_MISSION_COUNT_LEN]; @@ -65,6 +81,7 @@ static inline uint16_t mavlink_msg_mission_count_pack(uint8_t system_id, uint8_t _mav_put_uint8_t(buf, 2, target_system); _mav_put_uint8_t(buf, 3, target_component); _mav_put_uint8_t(buf, 4, mission_type); + _mav_put_uint32_t(buf, 5, opaque_id); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_COUNT_LEN); #else @@ -73,6 +90,7 @@ static inline uint16_t mavlink_msg_mission_count_pack(uint8_t system_id, uint8_t packet.target_system = target_system; packet.target_component = target_component; packet.mission_type = mission_type; + packet.opaque_id = opaque_id; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_COUNT_LEN); #endif @@ -81,6 +99,57 @@ static inline uint16_t mavlink_msg_mission_count_pack(uint8_t system_id, uint8_t return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MISSION_COUNT_MIN_LEN, MAVLINK_MSG_ID_MISSION_COUNT_LEN, MAVLINK_MSG_ID_MISSION_COUNT_CRC); } +/** + * @brief Pack a mission_count message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param count Number of mission items in the sequence + * @param mission_type Mission type. + * @param opaque_id Id of current on-vehicle mission, fence, or rally point plan (on download from vehicle). + This field is used when downloading a plan from a vehicle to a GCS. + 0 on upload to the vehicle from GCS. + 0 if plan ids are not supported. + The current on-vehicle plan ids are streamed in `MISSION_CURRENT`, allowing a GCS to determine if any part of the plan has changed and needs to be re-uploaded. + The ids are recalculated by the vehicle when any part of the on-vehicle plan changes (when a new plan is uploaded, the vehicle returns the new id to the GCS in MISSION_ACK). + + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_mission_count_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint16_t count, uint8_t mission_type, uint32_t opaque_id) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_MISSION_COUNT_LEN]; + _mav_put_uint16_t(buf, 0, count); + _mav_put_uint8_t(buf, 2, target_system); + _mav_put_uint8_t(buf, 3, target_component); + _mav_put_uint8_t(buf, 4, mission_type); + _mav_put_uint32_t(buf, 5, opaque_id); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_COUNT_LEN); +#else + mavlink_mission_count_t packet; + packet.count = count; + packet.target_system = target_system; + packet.target_component = target_component; + packet.mission_type = mission_type; + packet.opaque_id = opaque_id; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_COUNT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_MISSION_COUNT; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MISSION_COUNT_MIN_LEN, MAVLINK_MSG_ID_MISSION_COUNT_LEN, MAVLINK_MSG_ID_MISSION_COUNT_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MISSION_COUNT_MIN_LEN, MAVLINK_MSG_ID_MISSION_COUNT_LEN); +#endif +} + /** * @brief Pack a mission_count message on a channel * @param system_id ID of this system @@ -91,11 +160,18 @@ static inline uint16_t mavlink_msg_mission_count_pack(uint8_t system_id, uint8_t * @param target_component Component ID * @param count Number of mission items in the sequence * @param mission_type Mission type. + * @param opaque_id Id of current on-vehicle mission, fence, or rally point plan (on download from vehicle). + This field is used when downloading a plan from a vehicle to a GCS. + 0 on upload to the vehicle from GCS. + 0 if plan ids are not supported. + The current on-vehicle plan ids are streamed in `MISSION_CURRENT`, allowing a GCS to determine if any part of the plan has changed and needs to be re-uploaded. + The ids are recalculated by the vehicle when any part of the on-vehicle plan changes (when a new plan is uploaded, the vehicle returns the new id to the GCS in MISSION_ACK). + * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_mission_count_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,uint16_t count,uint8_t mission_type) + uint8_t target_system,uint8_t target_component,uint16_t count,uint8_t mission_type,uint32_t opaque_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_MISSION_COUNT_LEN]; @@ -103,6 +179,7 @@ static inline uint16_t mavlink_msg_mission_count_pack_chan(uint8_t system_id, ui _mav_put_uint8_t(buf, 2, target_system); _mav_put_uint8_t(buf, 3, target_component); _mav_put_uint8_t(buf, 4, mission_type); + _mav_put_uint32_t(buf, 5, opaque_id); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_COUNT_LEN); #else @@ -111,6 +188,7 @@ static inline uint16_t mavlink_msg_mission_count_pack_chan(uint8_t system_id, ui packet.target_system = target_system; packet.target_component = target_component; packet.mission_type = mission_type; + packet.opaque_id = opaque_id; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_COUNT_LEN); #endif @@ -129,7 +207,7 @@ static inline uint16_t mavlink_msg_mission_count_pack_chan(uint8_t system_id, ui */ static inline uint16_t mavlink_msg_mission_count_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_mission_count_t* mission_count) { - return mavlink_msg_mission_count_pack(system_id, component_id, msg, mission_count->target_system, mission_count->target_component, mission_count->count, mission_count->mission_type); + return mavlink_msg_mission_count_pack(system_id, component_id, msg, mission_count->target_system, mission_count->target_component, mission_count->count, mission_count->mission_type, mission_count->opaque_id); } /** @@ -143,7 +221,21 @@ static inline uint16_t mavlink_msg_mission_count_encode(uint8_t system_id, uint8 */ static inline uint16_t mavlink_msg_mission_count_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_mission_count_t* mission_count) { - return mavlink_msg_mission_count_pack_chan(system_id, component_id, chan, msg, mission_count->target_system, mission_count->target_component, mission_count->count, mission_count->mission_type); + return mavlink_msg_mission_count_pack_chan(system_id, component_id, chan, msg, mission_count->target_system, mission_count->target_component, mission_count->count, mission_count->mission_type, mission_count->opaque_id); +} + +/** + * @brief Encode a mission_count struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param mission_count C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_mission_count_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_mission_count_t* mission_count) +{ + return mavlink_msg_mission_count_pack_status(system_id, component_id, _status, msg, mission_count->target_system, mission_count->target_component, mission_count->count, mission_count->mission_type, mission_count->opaque_id); } /** @@ -154,10 +246,17 @@ static inline uint16_t mavlink_msg_mission_count_encode_chan(uint8_t system_id, * @param target_component Component ID * @param count Number of mission items in the sequence * @param mission_type Mission type. + * @param opaque_id Id of current on-vehicle mission, fence, or rally point plan (on download from vehicle). + This field is used when downloading a plan from a vehicle to a GCS. + 0 on upload to the vehicle from GCS. + 0 if plan ids are not supported. + The current on-vehicle plan ids are streamed in `MISSION_CURRENT`, allowing a GCS to determine if any part of the plan has changed and needs to be re-uploaded. + The ids are recalculated by the vehicle when any part of the on-vehicle plan changes (when a new plan is uploaded, the vehicle returns the new id to the GCS in MISSION_ACK). + */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_mission_count_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint16_t count, uint8_t mission_type) +static inline void mavlink_msg_mission_count_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint16_t count, uint8_t mission_type, uint32_t opaque_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_MISSION_COUNT_LEN]; @@ -165,6 +264,7 @@ static inline void mavlink_msg_mission_count_send(mavlink_channel_t chan, uint8_ _mav_put_uint8_t(buf, 2, target_system); _mav_put_uint8_t(buf, 3, target_component); _mav_put_uint8_t(buf, 4, mission_type); + _mav_put_uint32_t(buf, 5, opaque_id); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_COUNT, buf, MAVLINK_MSG_ID_MISSION_COUNT_MIN_LEN, MAVLINK_MSG_ID_MISSION_COUNT_LEN, MAVLINK_MSG_ID_MISSION_COUNT_CRC); #else @@ -173,6 +273,7 @@ static inline void mavlink_msg_mission_count_send(mavlink_channel_t chan, uint8_ packet.target_system = target_system; packet.target_component = target_component; packet.mission_type = mission_type; + packet.opaque_id = opaque_id; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_COUNT, (const char *)&packet, MAVLINK_MSG_ID_MISSION_COUNT_MIN_LEN, MAVLINK_MSG_ID_MISSION_COUNT_LEN, MAVLINK_MSG_ID_MISSION_COUNT_CRC); #endif @@ -186,7 +287,7 @@ static inline void mavlink_msg_mission_count_send(mavlink_channel_t chan, uint8_ static inline void mavlink_msg_mission_count_send_struct(mavlink_channel_t chan, const mavlink_mission_count_t* mission_count) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_mission_count_send(chan, mission_count->target_system, mission_count->target_component, mission_count->count, mission_count->mission_type); + mavlink_msg_mission_count_send(chan, mission_count->target_system, mission_count->target_component, mission_count->count, mission_count->mission_type, mission_count->opaque_id); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_COUNT, (const char *)mission_count, MAVLINK_MSG_ID_MISSION_COUNT_MIN_LEN, MAVLINK_MSG_ID_MISSION_COUNT_LEN, MAVLINK_MSG_ID_MISSION_COUNT_CRC); #endif @@ -194,13 +295,13 @@ static inline void mavlink_msg_mission_count_send_struct(mavlink_channel_t chan, #if MAVLINK_MSG_ID_MISSION_COUNT_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_mission_count_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint16_t count, uint8_t mission_type) +static inline void mavlink_msg_mission_count_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint16_t count, uint8_t mission_type, uint32_t opaque_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; @@ -208,6 +309,7 @@ static inline void mavlink_msg_mission_count_send_buf(mavlink_message_t *msgbuf, _mav_put_uint8_t(buf, 2, target_system); _mav_put_uint8_t(buf, 3, target_component); _mav_put_uint8_t(buf, 4, mission_type); + _mav_put_uint32_t(buf, 5, opaque_id); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_COUNT, buf, MAVLINK_MSG_ID_MISSION_COUNT_MIN_LEN, MAVLINK_MSG_ID_MISSION_COUNT_LEN, MAVLINK_MSG_ID_MISSION_COUNT_CRC); #else @@ -216,6 +318,7 @@ static inline void mavlink_msg_mission_count_send_buf(mavlink_message_t *msgbuf, packet->target_system = target_system; packet->target_component = target_component; packet->mission_type = mission_type; + packet->opaque_id = opaque_id; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_COUNT, (const char *)packet, MAVLINK_MSG_ID_MISSION_COUNT_MIN_LEN, MAVLINK_MSG_ID_MISSION_COUNT_LEN, MAVLINK_MSG_ID_MISSION_COUNT_CRC); #endif @@ -267,6 +370,22 @@ static inline uint8_t mavlink_msg_mission_count_get_mission_type(const mavlink_m return _MAV_RETURN_uint8_t(msg, 4); } +/** + * @brief Get field opaque_id from mission_count message + * + * @return Id of current on-vehicle mission, fence, or rally point plan (on download from vehicle). + This field is used when downloading a plan from a vehicle to a GCS. + 0 on upload to the vehicle from GCS. + 0 if plan ids are not supported. + The current on-vehicle plan ids are streamed in `MISSION_CURRENT`, allowing a GCS to determine if any part of the plan has changed and needs to be re-uploaded. + The ids are recalculated by the vehicle when any part of the on-vehicle plan changes (when a new plan is uploaded, the vehicle returns the new id to the GCS in MISSION_ACK). + + */ +static inline uint32_t mavlink_msg_mission_count_get_opaque_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 5); +} + /** * @brief Decode a mission_count message into a struct * @@ -280,6 +399,7 @@ static inline void mavlink_msg_mission_count_decode(const mavlink_message_t* msg mission_count->target_system = mavlink_msg_mission_count_get_target_system(msg); mission_count->target_component = mavlink_msg_mission_count_get_target_component(msg); mission_count->mission_type = mavlink_msg_mission_count_get_mission_type(msg); + mission_count->opaque_id = mavlink_msg_mission_count_get_opaque_id(msg); #else uint8_t len = msg->len < MAVLINK_MSG_ID_MISSION_COUNT_LEN? msg->len : MAVLINK_MSG_ID_MISSION_COUNT_LEN; memset(mission_count, 0, MAVLINK_MSG_ID_MISSION_COUNT_LEN); diff --git a/common/mavlink_msg_mission_current.h b/common/mavlink_msg_mission_current.h index 13f0fb62b..e7a402b91 100644 --- a/common/mavlink_msg_mission_current.h +++ b/common/mavlink_msg_mission_current.h @@ -3,14 +3,20 @@ #define MAVLINK_MSG_ID_MISSION_CURRENT 42 - +MAVPACKED( typedef struct __mavlink_mission_current_t { uint16_t seq; /*< Sequence*/ -} mavlink_mission_current_t; + uint16_t total; /*< Total number of mission items on vehicle (on last item, sequence == total). If the autopilot stores its home location as part of the mission this will be excluded from the total. 0: Not supported, UINT16_MAX if no mission is present on the vehicle.*/ + uint8_t mission_state; /*< Mission state machine state. MISSION_STATE_UNKNOWN if state reporting not supported.*/ + uint8_t mission_mode; /*< Vehicle is in a mode that can execute mission items or suspended. 0: Unknown, 1: In mission mode, 2: Suspended (not in mission mode).*/ + uint32_t mission_id; /*< Id of current on-vehicle mission plan, or 0 if IDs are not supported or there is no mission loaded. GCS can use this to track changes to the mission plan type. The same value is returned on mission upload (in the MISSION_ACK).*/ + uint32_t fence_id; /*< Id of current on-vehicle fence plan, or 0 if IDs are not supported or there is no fence loaded. GCS can use this to track changes to the fence plan type. The same value is returned on fence upload (in the MISSION_ACK).*/ + uint32_t rally_points_id; /*< Id of current on-vehicle rally point plan, or 0 if IDs are not supported or there are no rally points loaded. GCS can use this to track changes to the rally point plan type. The same value is returned on rally point upload (in the MISSION_ACK).*/ +}) mavlink_mission_current_t; -#define MAVLINK_MSG_ID_MISSION_CURRENT_LEN 2 +#define MAVLINK_MSG_ID_MISSION_CURRENT_LEN 18 #define MAVLINK_MSG_ID_MISSION_CURRENT_MIN_LEN 2 -#define MAVLINK_MSG_ID_42_LEN 2 +#define MAVLINK_MSG_ID_42_LEN 18 #define MAVLINK_MSG_ID_42_MIN_LEN 2 #define MAVLINK_MSG_ID_MISSION_CURRENT_CRC 28 @@ -22,15 +28,27 @@ typedef struct __mavlink_mission_current_t { #define MAVLINK_MESSAGE_INFO_MISSION_CURRENT { \ 42, \ "MISSION_CURRENT", \ - 1, \ + 7, \ { { "seq", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_mission_current_t, seq) }, \ + { "total", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_mission_current_t, total) }, \ + { "mission_state", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_mission_current_t, mission_state) }, \ + { "mission_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_mission_current_t, mission_mode) }, \ + { "mission_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 6, offsetof(mavlink_mission_current_t, mission_id) }, \ + { "fence_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 10, offsetof(mavlink_mission_current_t, fence_id) }, \ + { "rally_points_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 14, offsetof(mavlink_mission_current_t, rally_points_id) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_MISSION_CURRENT { \ "MISSION_CURRENT", \ - 1, \ + 7, \ { { "seq", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_mission_current_t, seq) }, \ + { "total", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_mission_current_t, total) }, \ + { "mission_state", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_mission_current_t, mission_state) }, \ + { "mission_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_mission_current_t, mission_mode) }, \ + { "mission_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 6, offsetof(mavlink_mission_current_t, mission_id) }, \ + { "fence_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 10, offsetof(mavlink_mission_current_t, fence_id) }, \ + { "rally_points_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 14, offsetof(mavlink_mission_current_t, rally_points_id) }, \ } \ } #endif @@ -42,19 +60,37 @@ typedef struct __mavlink_mission_current_t { * @param msg The MAVLink message to compress the data into * * @param seq Sequence + * @param total Total number of mission items on vehicle (on last item, sequence == total). If the autopilot stores its home location as part of the mission this will be excluded from the total. 0: Not supported, UINT16_MAX if no mission is present on the vehicle. + * @param mission_state Mission state machine state. MISSION_STATE_UNKNOWN if state reporting not supported. + * @param mission_mode Vehicle is in a mode that can execute mission items or suspended. 0: Unknown, 1: In mission mode, 2: Suspended (not in mission mode). + * @param mission_id Id of current on-vehicle mission plan, or 0 if IDs are not supported or there is no mission loaded. GCS can use this to track changes to the mission plan type. The same value is returned on mission upload (in the MISSION_ACK). + * @param fence_id Id of current on-vehicle fence plan, or 0 if IDs are not supported or there is no fence loaded. GCS can use this to track changes to the fence plan type. The same value is returned on fence upload (in the MISSION_ACK). + * @param rally_points_id Id of current on-vehicle rally point plan, or 0 if IDs are not supported or there are no rally points loaded. GCS can use this to track changes to the rally point plan type. The same value is returned on rally point upload (in the MISSION_ACK). * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_mission_current_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint16_t seq) + uint16_t seq, uint16_t total, uint8_t mission_state, uint8_t mission_mode, uint32_t mission_id, uint32_t fence_id, uint32_t rally_points_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_MISSION_CURRENT_LEN]; _mav_put_uint16_t(buf, 0, seq); + _mav_put_uint16_t(buf, 2, total); + _mav_put_uint8_t(buf, 4, mission_state); + _mav_put_uint8_t(buf, 5, mission_mode); + _mav_put_uint32_t(buf, 6, mission_id); + _mav_put_uint32_t(buf, 10, fence_id); + _mav_put_uint32_t(buf, 14, rally_points_id); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_CURRENT_LEN); #else mavlink_mission_current_t packet; packet.seq = seq; + packet.total = total; + packet.mission_state = mission_state; + packet.mission_mode = mission_mode; + packet.mission_id = mission_id; + packet.fence_id = fence_id; + packet.rally_points_id = rally_points_id; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_CURRENT_LEN); #endif @@ -63,6 +99,57 @@ static inline uint16_t mavlink_msg_mission_current_pack(uint8_t system_id, uint8 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MISSION_CURRENT_MIN_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_CRC); } +/** + * @brief Pack a mission_current message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param seq Sequence + * @param total Total number of mission items on vehicle (on last item, sequence == total). If the autopilot stores its home location as part of the mission this will be excluded from the total. 0: Not supported, UINT16_MAX if no mission is present on the vehicle. + * @param mission_state Mission state machine state. MISSION_STATE_UNKNOWN if state reporting not supported. + * @param mission_mode Vehicle is in a mode that can execute mission items or suspended. 0: Unknown, 1: In mission mode, 2: Suspended (not in mission mode). + * @param mission_id Id of current on-vehicle mission plan, or 0 if IDs are not supported or there is no mission loaded. GCS can use this to track changes to the mission plan type. The same value is returned on mission upload (in the MISSION_ACK). + * @param fence_id Id of current on-vehicle fence plan, or 0 if IDs are not supported or there is no fence loaded. GCS can use this to track changes to the fence plan type. The same value is returned on fence upload (in the MISSION_ACK). + * @param rally_points_id Id of current on-vehicle rally point plan, or 0 if IDs are not supported or there are no rally points loaded. GCS can use this to track changes to the rally point plan type. The same value is returned on rally point upload (in the MISSION_ACK). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_mission_current_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint16_t seq, uint16_t total, uint8_t mission_state, uint8_t mission_mode, uint32_t mission_id, uint32_t fence_id, uint32_t rally_points_id) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_MISSION_CURRENT_LEN]; + _mav_put_uint16_t(buf, 0, seq); + _mav_put_uint16_t(buf, 2, total); + _mav_put_uint8_t(buf, 4, mission_state); + _mav_put_uint8_t(buf, 5, mission_mode); + _mav_put_uint32_t(buf, 6, mission_id); + _mav_put_uint32_t(buf, 10, fence_id); + _mav_put_uint32_t(buf, 14, rally_points_id); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_CURRENT_LEN); +#else + mavlink_mission_current_t packet; + packet.seq = seq; + packet.total = total; + packet.mission_state = mission_state; + packet.mission_mode = mission_mode; + packet.mission_id = mission_id; + packet.fence_id = fence_id; + packet.rally_points_id = rally_points_id; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_CURRENT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_MISSION_CURRENT; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MISSION_CURRENT_MIN_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MISSION_CURRENT_MIN_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_LEN); +#endif +} + /** * @brief Pack a mission_current message on a channel * @param system_id ID of this system @@ -70,20 +157,38 @@ static inline uint16_t mavlink_msg_mission_current_pack(uint8_t system_id, uint8 * @param chan The MAVLink channel this message will be sent over * @param msg The MAVLink message to compress the data into * @param seq Sequence + * @param total Total number of mission items on vehicle (on last item, sequence == total). If the autopilot stores its home location as part of the mission this will be excluded from the total. 0: Not supported, UINT16_MAX if no mission is present on the vehicle. + * @param mission_state Mission state machine state. MISSION_STATE_UNKNOWN if state reporting not supported. + * @param mission_mode Vehicle is in a mode that can execute mission items or suspended. 0: Unknown, 1: In mission mode, 2: Suspended (not in mission mode). + * @param mission_id Id of current on-vehicle mission plan, or 0 if IDs are not supported or there is no mission loaded. GCS can use this to track changes to the mission plan type. The same value is returned on mission upload (in the MISSION_ACK). + * @param fence_id Id of current on-vehicle fence plan, or 0 if IDs are not supported or there is no fence loaded. GCS can use this to track changes to the fence plan type. The same value is returned on fence upload (in the MISSION_ACK). + * @param rally_points_id Id of current on-vehicle rally point plan, or 0 if IDs are not supported or there are no rally points loaded. GCS can use this to track changes to the rally point plan type. The same value is returned on rally point upload (in the MISSION_ACK). * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_mission_current_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - uint16_t seq) + uint16_t seq,uint16_t total,uint8_t mission_state,uint8_t mission_mode,uint32_t mission_id,uint32_t fence_id,uint32_t rally_points_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_MISSION_CURRENT_LEN]; _mav_put_uint16_t(buf, 0, seq); + _mav_put_uint16_t(buf, 2, total); + _mav_put_uint8_t(buf, 4, mission_state); + _mav_put_uint8_t(buf, 5, mission_mode); + _mav_put_uint32_t(buf, 6, mission_id); + _mav_put_uint32_t(buf, 10, fence_id); + _mav_put_uint32_t(buf, 14, rally_points_id); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_CURRENT_LEN); #else mavlink_mission_current_t packet; packet.seq = seq; + packet.total = total; + packet.mission_state = mission_state; + packet.mission_mode = mission_mode; + packet.mission_id = mission_id; + packet.fence_id = fence_id; + packet.rally_points_id = rally_points_id; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_CURRENT_LEN); #endif @@ -102,7 +207,7 @@ static inline uint16_t mavlink_msg_mission_current_pack_chan(uint8_t system_id, */ static inline uint16_t mavlink_msg_mission_current_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_mission_current_t* mission_current) { - return mavlink_msg_mission_current_pack(system_id, component_id, msg, mission_current->seq); + return mavlink_msg_mission_current_pack(system_id, component_id, msg, mission_current->seq, mission_current->total, mission_current->mission_state, mission_current->mission_mode, mission_current->mission_id, mission_current->fence_id, mission_current->rally_points_id); } /** @@ -116,7 +221,21 @@ static inline uint16_t mavlink_msg_mission_current_encode(uint8_t system_id, uin */ static inline uint16_t mavlink_msg_mission_current_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_mission_current_t* mission_current) { - return mavlink_msg_mission_current_pack_chan(system_id, component_id, chan, msg, mission_current->seq); + return mavlink_msg_mission_current_pack_chan(system_id, component_id, chan, msg, mission_current->seq, mission_current->total, mission_current->mission_state, mission_current->mission_mode, mission_current->mission_id, mission_current->fence_id, mission_current->rally_points_id); +} + +/** + * @brief Encode a mission_current struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param mission_current C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_mission_current_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_mission_current_t* mission_current) +{ + return mavlink_msg_mission_current_pack_status(system_id, component_id, _status, msg, mission_current->seq, mission_current->total, mission_current->mission_state, mission_current->mission_mode, mission_current->mission_id, mission_current->fence_id, mission_current->rally_points_id); } /** @@ -124,19 +243,37 @@ static inline uint16_t mavlink_msg_mission_current_encode_chan(uint8_t system_id * @param chan MAVLink channel to send the message * * @param seq Sequence + * @param total Total number of mission items on vehicle (on last item, sequence == total). If the autopilot stores its home location as part of the mission this will be excluded from the total. 0: Not supported, UINT16_MAX if no mission is present on the vehicle. + * @param mission_state Mission state machine state. MISSION_STATE_UNKNOWN if state reporting not supported. + * @param mission_mode Vehicle is in a mode that can execute mission items or suspended. 0: Unknown, 1: In mission mode, 2: Suspended (not in mission mode). + * @param mission_id Id of current on-vehicle mission plan, or 0 if IDs are not supported or there is no mission loaded. GCS can use this to track changes to the mission plan type. The same value is returned on mission upload (in the MISSION_ACK). + * @param fence_id Id of current on-vehicle fence plan, or 0 if IDs are not supported or there is no fence loaded. GCS can use this to track changes to the fence plan type. The same value is returned on fence upload (in the MISSION_ACK). + * @param rally_points_id Id of current on-vehicle rally point plan, or 0 if IDs are not supported or there are no rally points loaded. GCS can use this to track changes to the rally point plan type. The same value is returned on rally point upload (in the MISSION_ACK). */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_mission_current_send(mavlink_channel_t chan, uint16_t seq) +static inline void mavlink_msg_mission_current_send(mavlink_channel_t chan, uint16_t seq, uint16_t total, uint8_t mission_state, uint8_t mission_mode, uint32_t mission_id, uint32_t fence_id, uint32_t rally_points_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_MISSION_CURRENT_LEN]; _mav_put_uint16_t(buf, 0, seq); + _mav_put_uint16_t(buf, 2, total); + _mav_put_uint8_t(buf, 4, mission_state); + _mav_put_uint8_t(buf, 5, mission_mode); + _mav_put_uint32_t(buf, 6, mission_id); + _mav_put_uint32_t(buf, 10, fence_id); + _mav_put_uint32_t(buf, 14, rally_points_id); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CURRENT, buf, MAVLINK_MSG_ID_MISSION_CURRENT_MIN_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_CRC); #else mavlink_mission_current_t packet; packet.seq = seq; + packet.total = total; + packet.mission_state = mission_state; + packet.mission_mode = mission_mode; + packet.mission_id = mission_id; + packet.fence_id = fence_id; + packet.rally_points_id = rally_points_id; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CURRENT, (const char *)&packet, MAVLINK_MSG_ID_MISSION_CURRENT_MIN_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_CRC); #endif @@ -150,7 +287,7 @@ static inline void mavlink_msg_mission_current_send(mavlink_channel_t chan, uint static inline void mavlink_msg_mission_current_send_struct(mavlink_channel_t chan, const mavlink_mission_current_t* mission_current) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_mission_current_send(chan, mission_current->seq); + mavlink_msg_mission_current_send(chan, mission_current->seq, mission_current->total, mission_current->mission_state, mission_current->mission_mode, mission_current->mission_id, mission_current->fence_id, mission_current->rally_points_id); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CURRENT, (const char *)mission_current, MAVLINK_MSG_ID_MISSION_CURRENT_MIN_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_CRC); #endif @@ -158,22 +295,34 @@ static inline void mavlink_msg_mission_current_send_struct(mavlink_channel_t cha #if MAVLINK_MSG_ID_MISSION_CURRENT_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_mission_current_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint16_t seq) +static inline void mavlink_msg_mission_current_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint16_t seq, uint16_t total, uint8_t mission_state, uint8_t mission_mode, uint32_t mission_id, uint32_t fence_id, uint32_t rally_points_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; _mav_put_uint16_t(buf, 0, seq); + _mav_put_uint16_t(buf, 2, total); + _mav_put_uint8_t(buf, 4, mission_state); + _mav_put_uint8_t(buf, 5, mission_mode); + _mav_put_uint32_t(buf, 6, mission_id); + _mav_put_uint32_t(buf, 10, fence_id); + _mav_put_uint32_t(buf, 14, rally_points_id); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CURRENT, buf, MAVLINK_MSG_ID_MISSION_CURRENT_MIN_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_CRC); #else mavlink_mission_current_t *packet = (mavlink_mission_current_t *)msgbuf; packet->seq = seq; + packet->total = total; + packet->mission_state = mission_state; + packet->mission_mode = mission_mode; + packet->mission_id = mission_id; + packet->fence_id = fence_id; + packet->rally_points_id = rally_points_id; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CURRENT, (const char *)packet, MAVLINK_MSG_ID_MISSION_CURRENT_MIN_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_CRC); #endif @@ -195,6 +344,66 @@ static inline uint16_t mavlink_msg_mission_current_get_seq(const mavlink_message return _MAV_RETURN_uint16_t(msg, 0); } +/** + * @brief Get field total from mission_current message + * + * @return Total number of mission items on vehicle (on last item, sequence == total). If the autopilot stores its home location as part of the mission this will be excluded from the total. 0: Not supported, UINT16_MAX if no mission is present on the vehicle. + */ +static inline uint16_t mavlink_msg_mission_current_get_total(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 2); +} + +/** + * @brief Get field mission_state from mission_current message + * + * @return Mission state machine state. MISSION_STATE_UNKNOWN if state reporting not supported. + */ +static inline uint8_t mavlink_msg_mission_current_get_mission_state(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 4); +} + +/** + * @brief Get field mission_mode from mission_current message + * + * @return Vehicle is in a mode that can execute mission items or suspended. 0: Unknown, 1: In mission mode, 2: Suspended (not in mission mode). + */ +static inline uint8_t mavlink_msg_mission_current_get_mission_mode(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 5); +} + +/** + * @brief Get field mission_id from mission_current message + * + * @return Id of current on-vehicle mission plan, or 0 if IDs are not supported or there is no mission loaded. GCS can use this to track changes to the mission plan type. The same value is returned on mission upload (in the MISSION_ACK). + */ +static inline uint32_t mavlink_msg_mission_current_get_mission_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 6); +} + +/** + * @brief Get field fence_id from mission_current message + * + * @return Id of current on-vehicle fence plan, or 0 if IDs are not supported or there is no fence loaded. GCS can use this to track changes to the fence plan type. The same value is returned on fence upload (in the MISSION_ACK). + */ +static inline uint32_t mavlink_msg_mission_current_get_fence_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 10); +} + +/** + * @brief Get field rally_points_id from mission_current message + * + * @return Id of current on-vehicle rally point plan, or 0 if IDs are not supported or there are no rally points loaded. GCS can use this to track changes to the rally point plan type. The same value is returned on rally point upload (in the MISSION_ACK). + */ +static inline uint32_t mavlink_msg_mission_current_get_rally_points_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 14); +} + /** * @brief Decode a mission_current message into a struct * @@ -205,6 +414,12 @@ static inline void mavlink_msg_mission_current_decode(const mavlink_message_t* m { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS mission_current->seq = mavlink_msg_mission_current_get_seq(msg); + mission_current->total = mavlink_msg_mission_current_get_total(msg); + mission_current->mission_state = mavlink_msg_mission_current_get_mission_state(msg); + mission_current->mission_mode = mavlink_msg_mission_current_get_mission_mode(msg); + mission_current->mission_id = mavlink_msg_mission_current_get_mission_id(msg); + mission_current->fence_id = mavlink_msg_mission_current_get_fence_id(msg); + mission_current->rally_points_id = mavlink_msg_mission_current_get_rally_points_id(msg); #else uint8_t len = msg->len < MAVLINK_MSG_ID_MISSION_CURRENT_LEN? msg->len : MAVLINK_MSG_ID_MISSION_CURRENT_LEN; memset(mission_current, 0, MAVLINK_MSG_ID_MISSION_CURRENT_LEN); diff --git a/common/mavlink_msg_mission_item.h b/common/mavlink_msg_mission_item.h index b14d151b2..55cabb1c3 100644 --- a/common/mavlink_msg_mission_item.h +++ b/common/mavlink_msg_mission_item.h @@ -18,7 +18,7 @@ typedef struct __mavlink_mission_item_t { uint8_t target_component; /*< Component ID*/ uint8_t frame; /*< The coordinate system of the waypoint.*/ uint8_t current; /*< false:0, true:1*/ - uint8_t autocontinue; /*< Autocontinue to next waypoint*/ + uint8_t autocontinue; /*< Autocontinue to next waypoint. 0: false, 1: true. Set false to pause mission after the item completes.*/ uint8_t mission_type; /*< Mission type.*/ } mavlink_mission_item_t; @@ -89,7 +89,7 @@ typedef struct __mavlink_mission_item_t { * @param frame The coordinate system of the waypoint. * @param command The scheduled action for the waypoint. * @param current false:0, true:1 - * @param autocontinue Autocontinue to next waypoint + * @param autocontinue Autocontinue to next waypoint. 0: false, 1: true. Set false to pause mission after the item completes. * @param param1 PARAM1, see MAV_CMD enum * @param param2 PARAM2, see MAV_CMD enum * @param param3 PARAM3, see MAV_CMD enum @@ -147,6 +147,81 @@ static inline uint16_t mavlink_msg_mission_item_pack(uint8_t system_id, uint8_t return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MISSION_ITEM_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_LEN, MAVLINK_MSG_ID_MISSION_ITEM_CRC); } +/** + * @brief Pack a mission_item message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param seq Sequence + * @param frame The coordinate system of the waypoint. + * @param command The scheduled action for the waypoint. + * @param current false:0, true:1 + * @param autocontinue Autocontinue to next waypoint. 0: false, 1: true. Set false to pause mission after the item completes. + * @param param1 PARAM1, see MAV_CMD enum + * @param param2 PARAM2, see MAV_CMD enum + * @param param3 PARAM3, see MAV_CMD enum + * @param param4 PARAM4, see MAV_CMD enum + * @param x PARAM5 / local: X coordinate, global: latitude + * @param y PARAM6 / local: Y coordinate, global: longitude + * @param z PARAM7 / local: Z coordinate, global: altitude (relative or absolute, depending on frame). + * @param mission_type Mission type. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_mission_item_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint16_t seq, uint8_t frame, uint16_t command, uint8_t current, uint8_t autocontinue, float param1, float param2, float param3, float param4, float x, float y, float z, uint8_t mission_type) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_MISSION_ITEM_LEN]; + _mav_put_float(buf, 0, param1); + _mav_put_float(buf, 4, param2); + _mav_put_float(buf, 8, param3); + _mav_put_float(buf, 12, param4); + _mav_put_float(buf, 16, x); + _mav_put_float(buf, 20, y); + _mav_put_float(buf, 24, z); + _mav_put_uint16_t(buf, 28, seq); + _mav_put_uint16_t(buf, 30, command); + _mav_put_uint8_t(buf, 32, target_system); + _mav_put_uint8_t(buf, 33, target_component); + _mav_put_uint8_t(buf, 34, frame); + _mav_put_uint8_t(buf, 35, current); + _mav_put_uint8_t(buf, 36, autocontinue); + _mav_put_uint8_t(buf, 37, mission_type); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_ITEM_LEN); +#else + mavlink_mission_item_t packet; + packet.param1 = param1; + packet.param2 = param2; + packet.param3 = param3; + packet.param4 = param4; + packet.x = x; + packet.y = y; + packet.z = z; + packet.seq = seq; + packet.command = command; + packet.target_system = target_system; + packet.target_component = target_component; + packet.frame = frame; + packet.current = current; + packet.autocontinue = autocontinue; + packet.mission_type = mission_type; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_ITEM_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_MISSION_ITEM; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MISSION_ITEM_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_LEN, MAVLINK_MSG_ID_MISSION_ITEM_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MISSION_ITEM_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_LEN); +#endif +} + /** * @brief Pack a mission_item message on a channel * @param system_id ID of this system @@ -159,7 +234,7 @@ static inline uint16_t mavlink_msg_mission_item_pack(uint8_t system_id, uint8_t * @param frame The coordinate system of the waypoint. * @param command The scheduled action for the waypoint. * @param current false:0, true:1 - * @param autocontinue Autocontinue to next waypoint + * @param autocontinue Autocontinue to next waypoint. 0: false, 1: true. Set false to pause mission after the item completes. * @param param1 PARAM1, see MAV_CMD enum * @param param2 PARAM2, see MAV_CMD enum * @param param3 PARAM3, see MAV_CMD enum @@ -245,6 +320,20 @@ static inline uint16_t mavlink_msg_mission_item_encode_chan(uint8_t system_id, u return mavlink_msg_mission_item_pack_chan(system_id, component_id, chan, msg, mission_item->target_system, mission_item->target_component, mission_item->seq, mission_item->frame, mission_item->command, mission_item->current, mission_item->autocontinue, mission_item->param1, mission_item->param2, mission_item->param3, mission_item->param4, mission_item->x, mission_item->y, mission_item->z, mission_item->mission_type); } +/** + * @brief Encode a mission_item struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param mission_item C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_mission_item_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_mission_item_t* mission_item) +{ + return mavlink_msg_mission_item_pack_status(system_id, component_id, _status, msg, mission_item->target_system, mission_item->target_component, mission_item->seq, mission_item->frame, mission_item->command, mission_item->current, mission_item->autocontinue, mission_item->param1, mission_item->param2, mission_item->param3, mission_item->param4, mission_item->x, mission_item->y, mission_item->z, mission_item->mission_type); +} + /** * @brief Send a mission_item message * @param chan MAVLink channel to send the message @@ -255,7 +344,7 @@ static inline uint16_t mavlink_msg_mission_item_encode_chan(uint8_t system_id, u * @param frame The coordinate system of the waypoint. * @param command The scheduled action for the waypoint. * @param current false:0, true:1 - * @param autocontinue Autocontinue to next waypoint + * @param autocontinue Autocontinue to next waypoint. 0: false, 1: true. Set false to pause mission after the item completes. * @param param1 PARAM1, see MAV_CMD enum * @param param2 PARAM2, see MAV_CMD enum * @param param3 PARAM3, see MAV_CMD enum @@ -326,7 +415,7 @@ static inline void mavlink_msg_mission_item_send_struct(mavlink_channel_t chan, #if MAVLINK_MSG_ID_MISSION_ITEM_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -444,7 +533,7 @@ static inline uint8_t mavlink_msg_mission_item_get_current(const mavlink_message /** * @brief Get field autocontinue from mission_item message * - * @return Autocontinue to next waypoint + * @return Autocontinue to next waypoint. 0: false, 1: true. Set false to pause mission after the item completes. */ static inline uint8_t mavlink_msg_mission_item_get_autocontinue(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_mission_item_int.h b/common/mavlink_msg_mission_item_int.h index 74ad3a5ed..eb9b423fc 100644 --- a/common/mavlink_msg_mission_item_int.h +++ b/common/mavlink_msg_mission_item_int.h @@ -18,7 +18,7 @@ typedef struct __mavlink_mission_item_int_t { uint8_t target_component; /*< Component ID*/ uint8_t frame; /*< The coordinate system of the waypoint.*/ uint8_t current; /*< false:0, true:1*/ - uint8_t autocontinue; /*< Autocontinue to next waypoint*/ + uint8_t autocontinue; /*< Autocontinue to next waypoint. 0: false, 1: true. Set false to pause mission after the item completes.*/ uint8_t mission_type; /*< Mission type.*/ } mavlink_mission_item_int_t; @@ -89,7 +89,7 @@ typedef struct __mavlink_mission_item_int_t { * @param frame The coordinate system of the waypoint. * @param command The scheduled action for the waypoint. * @param current false:0, true:1 - * @param autocontinue Autocontinue to next waypoint + * @param autocontinue Autocontinue to next waypoint. 0: false, 1: true. Set false to pause mission after the item completes. * @param param1 PARAM1, see MAV_CMD enum * @param param2 PARAM2, see MAV_CMD enum * @param param3 PARAM3, see MAV_CMD enum @@ -147,6 +147,81 @@ static inline uint16_t mavlink_msg_mission_item_int_pack(uint8_t system_id, uint return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MISSION_ITEM_INT_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_INT_LEN, MAVLINK_MSG_ID_MISSION_ITEM_INT_CRC); } +/** + * @brief Pack a mission_item_int message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param seq Waypoint ID (sequence number). Starts at zero. Increases monotonically for each waypoint, no gaps in the sequence (0,1,2,3,4). + * @param frame The coordinate system of the waypoint. + * @param command The scheduled action for the waypoint. + * @param current false:0, true:1 + * @param autocontinue Autocontinue to next waypoint. 0: false, 1: true. Set false to pause mission after the item completes. + * @param param1 PARAM1, see MAV_CMD enum + * @param param2 PARAM2, see MAV_CMD enum + * @param param3 PARAM3, see MAV_CMD enum + * @param param4 PARAM4, see MAV_CMD enum + * @param x PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7 + * @param y PARAM6 / y position: local: x position in meters * 1e4, global: longitude in degrees *10^7 + * @param z PARAM7 / z position: global: altitude in meters (relative or absolute, depending on frame. + * @param mission_type Mission type. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_mission_item_int_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint16_t seq, uint8_t frame, uint16_t command, uint8_t current, uint8_t autocontinue, float param1, float param2, float param3, float param4, int32_t x, int32_t y, float z, uint8_t mission_type) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_MISSION_ITEM_INT_LEN]; + _mav_put_float(buf, 0, param1); + _mav_put_float(buf, 4, param2); + _mav_put_float(buf, 8, param3); + _mav_put_float(buf, 12, param4); + _mav_put_int32_t(buf, 16, x); + _mav_put_int32_t(buf, 20, y); + _mav_put_float(buf, 24, z); + _mav_put_uint16_t(buf, 28, seq); + _mav_put_uint16_t(buf, 30, command); + _mav_put_uint8_t(buf, 32, target_system); + _mav_put_uint8_t(buf, 33, target_component); + _mav_put_uint8_t(buf, 34, frame); + _mav_put_uint8_t(buf, 35, current); + _mav_put_uint8_t(buf, 36, autocontinue); + _mav_put_uint8_t(buf, 37, mission_type); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_ITEM_INT_LEN); +#else + mavlink_mission_item_int_t packet; + packet.param1 = param1; + packet.param2 = param2; + packet.param3 = param3; + packet.param4 = param4; + packet.x = x; + packet.y = y; + packet.z = z; + packet.seq = seq; + packet.command = command; + packet.target_system = target_system; + packet.target_component = target_component; + packet.frame = frame; + packet.current = current; + packet.autocontinue = autocontinue; + packet.mission_type = mission_type; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_ITEM_INT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_MISSION_ITEM_INT; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MISSION_ITEM_INT_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_INT_LEN, MAVLINK_MSG_ID_MISSION_ITEM_INT_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MISSION_ITEM_INT_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_INT_LEN); +#endif +} + /** * @brief Pack a mission_item_int message on a channel * @param system_id ID of this system @@ -159,7 +234,7 @@ static inline uint16_t mavlink_msg_mission_item_int_pack(uint8_t system_id, uint * @param frame The coordinate system of the waypoint. * @param command The scheduled action for the waypoint. * @param current false:0, true:1 - * @param autocontinue Autocontinue to next waypoint + * @param autocontinue Autocontinue to next waypoint. 0: false, 1: true. Set false to pause mission after the item completes. * @param param1 PARAM1, see MAV_CMD enum * @param param2 PARAM2, see MAV_CMD enum * @param param3 PARAM3, see MAV_CMD enum @@ -245,6 +320,20 @@ static inline uint16_t mavlink_msg_mission_item_int_encode_chan(uint8_t system_i return mavlink_msg_mission_item_int_pack_chan(system_id, component_id, chan, msg, mission_item_int->target_system, mission_item_int->target_component, mission_item_int->seq, mission_item_int->frame, mission_item_int->command, mission_item_int->current, mission_item_int->autocontinue, mission_item_int->param1, mission_item_int->param2, mission_item_int->param3, mission_item_int->param4, mission_item_int->x, mission_item_int->y, mission_item_int->z, mission_item_int->mission_type); } +/** + * @brief Encode a mission_item_int struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param mission_item_int C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_mission_item_int_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_mission_item_int_t* mission_item_int) +{ + return mavlink_msg_mission_item_int_pack_status(system_id, component_id, _status, msg, mission_item_int->target_system, mission_item_int->target_component, mission_item_int->seq, mission_item_int->frame, mission_item_int->command, mission_item_int->current, mission_item_int->autocontinue, mission_item_int->param1, mission_item_int->param2, mission_item_int->param3, mission_item_int->param4, mission_item_int->x, mission_item_int->y, mission_item_int->z, mission_item_int->mission_type); +} + /** * @brief Send a mission_item_int message * @param chan MAVLink channel to send the message @@ -255,7 +344,7 @@ static inline uint16_t mavlink_msg_mission_item_int_encode_chan(uint8_t system_i * @param frame The coordinate system of the waypoint. * @param command The scheduled action for the waypoint. * @param current false:0, true:1 - * @param autocontinue Autocontinue to next waypoint + * @param autocontinue Autocontinue to next waypoint. 0: false, 1: true. Set false to pause mission after the item completes. * @param param1 PARAM1, see MAV_CMD enum * @param param2 PARAM2, see MAV_CMD enum * @param param3 PARAM3, see MAV_CMD enum @@ -326,7 +415,7 @@ static inline void mavlink_msg_mission_item_int_send_struct(mavlink_channel_t ch #if MAVLINK_MSG_ID_MISSION_ITEM_INT_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -444,7 +533,7 @@ static inline uint8_t mavlink_msg_mission_item_int_get_current(const mavlink_mes /** * @brief Get field autocontinue from mission_item_int message * - * @return Autocontinue to next waypoint + * @return Autocontinue to next waypoint. 0: false, 1: true. Set false to pause mission after the item completes. */ static inline uint8_t mavlink_msg_mission_item_int_get_autocontinue(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_mission_item_reached.h b/common/mavlink_msg_mission_item_reached.h index 647176b9c..cf7090ab8 100644 --- a/common/mavlink_msg_mission_item_reached.h +++ b/common/mavlink_msg_mission_item_reached.h @@ -63,6 +63,39 @@ static inline uint16_t mavlink_msg_mission_item_reached_pack(uint8_t system_id, return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_CRC); } +/** + * @brief Pack a mission_item_reached message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param seq Sequence + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_mission_item_reached_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint16_t seq) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN]; + _mav_put_uint16_t(buf, 0, seq); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN); +#else + mavlink_mission_item_reached_t packet; + packet.seq = seq; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_MISSION_ITEM_REACHED; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN); +#endif +} + /** * @brief Pack a mission_item_reached message on a channel * @param system_id ID of this system @@ -119,6 +152,20 @@ static inline uint16_t mavlink_msg_mission_item_reached_encode_chan(uint8_t syst return mavlink_msg_mission_item_reached_pack_chan(system_id, component_id, chan, msg, mission_item_reached->seq); } +/** + * @brief Encode a mission_item_reached struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param mission_item_reached C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_mission_item_reached_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_mission_item_reached_t* mission_item_reached) +{ + return mavlink_msg_mission_item_reached_pack_status(system_id, component_id, _status, msg, mission_item_reached->seq); +} + /** * @brief Send a mission_item_reached message * @param chan MAVLink channel to send the message @@ -158,7 +205,7 @@ static inline void mavlink_msg_mission_item_reached_send_struct(mavlink_channel_ #if MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_mission_request.h b/common/mavlink_msg_mission_request.h index 4f8c0fe77..323e66f64 100644 --- a/common/mavlink_msg_mission_request.h +++ b/common/mavlink_msg_mission_request.h @@ -81,6 +81,48 @@ static inline uint16_t mavlink_msg_mission_request_pack(uint8_t system_id, uint8 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MISSION_REQUEST_MIN_LEN, MAVLINK_MSG_ID_MISSION_REQUEST_LEN, MAVLINK_MSG_ID_MISSION_REQUEST_CRC); } +/** + * @brief Pack a mission_request message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param seq Sequence + * @param mission_type Mission type. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_mission_request_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint16_t seq, uint8_t mission_type) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_MISSION_REQUEST_LEN]; + _mav_put_uint16_t(buf, 0, seq); + _mav_put_uint8_t(buf, 2, target_system); + _mav_put_uint8_t(buf, 3, target_component); + _mav_put_uint8_t(buf, 4, mission_type); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_REQUEST_LEN); +#else + mavlink_mission_request_t packet; + packet.seq = seq; + packet.target_system = target_system; + packet.target_component = target_component; + packet.mission_type = mission_type; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_REQUEST_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_MISSION_REQUEST; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MISSION_REQUEST_MIN_LEN, MAVLINK_MSG_ID_MISSION_REQUEST_LEN, MAVLINK_MSG_ID_MISSION_REQUEST_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MISSION_REQUEST_MIN_LEN, MAVLINK_MSG_ID_MISSION_REQUEST_LEN); +#endif +} + /** * @brief Pack a mission_request message on a channel * @param system_id ID of this system @@ -146,6 +188,20 @@ static inline uint16_t mavlink_msg_mission_request_encode_chan(uint8_t system_id return mavlink_msg_mission_request_pack_chan(system_id, component_id, chan, msg, mission_request->target_system, mission_request->target_component, mission_request->seq, mission_request->mission_type); } +/** + * @brief Encode a mission_request struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param mission_request C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_mission_request_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_mission_request_t* mission_request) +{ + return mavlink_msg_mission_request_pack_status(system_id, component_id, _status, msg, mission_request->target_system, mission_request->target_component, mission_request->seq, mission_request->mission_type); +} + /** * @brief Send a mission_request message * @param chan MAVLink channel to send the message @@ -194,7 +250,7 @@ static inline void mavlink_msg_mission_request_send_struct(mavlink_channel_t cha #if MAVLINK_MSG_ID_MISSION_REQUEST_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_mission_request_int.h b/common/mavlink_msg_mission_request_int.h index c131f78f7..70da4590e 100644 --- a/common/mavlink_msg_mission_request_int.h +++ b/common/mavlink_msg_mission_request_int.h @@ -81,6 +81,48 @@ static inline uint16_t mavlink_msg_mission_request_int_pack(uint8_t system_id, u return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MISSION_REQUEST_INT_MIN_LEN, MAVLINK_MSG_ID_MISSION_REQUEST_INT_LEN, MAVLINK_MSG_ID_MISSION_REQUEST_INT_CRC); } +/** + * @brief Pack a mission_request_int message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param seq Sequence + * @param mission_type Mission type. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_mission_request_int_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint16_t seq, uint8_t mission_type) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_MISSION_REQUEST_INT_LEN]; + _mav_put_uint16_t(buf, 0, seq); + _mav_put_uint8_t(buf, 2, target_system); + _mav_put_uint8_t(buf, 3, target_component); + _mav_put_uint8_t(buf, 4, mission_type); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_REQUEST_INT_LEN); +#else + mavlink_mission_request_int_t packet; + packet.seq = seq; + packet.target_system = target_system; + packet.target_component = target_component; + packet.mission_type = mission_type; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_REQUEST_INT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_MISSION_REQUEST_INT; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MISSION_REQUEST_INT_MIN_LEN, MAVLINK_MSG_ID_MISSION_REQUEST_INT_LEN, MAVLINK_MSG_ID_MISSION_REQUEST_INT_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MISSION_REQUEST_INT_MIN_LEN, MAVLINK_MSG_ID_MISSION_REQUEST_INT_LEN); +#endif +} + /** * @brief Pack a mission_request_int message on a channel * @param system_id ID of this system @@ -146,6 +188,20 @@ static inline uint16_t mavlink_msg_mission_request_int_encode_chan(uint8_t syste return mavlink_msg_mission_request_int_pack_chan(system_id, component_id, chan, msg, mission_request_int->target_system, mission_request_int->target_component, mission_request_int->seq, mission_request_int->mission_type); } +/** + * @brief Encode a mission_request_int struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param mission_request_int C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_mission_request_int_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_mission_request_int_t* mission_request_int) +{ + return mavlink_msg_mission_request_int_pack_status(system_id, component_id, _status, msg, mission_request_int->target_system, mission_request_int->target_component, mission_request_int->seq, mission_request_int->mission_type); +} + /** * @brief Send a mission_request_int message * @param chan MAVLink channel to send the message @@ -194,7 +250,7 @@ static inline void mavlink_msg_mission_request_int_send_struct(mavlink_channel_t #if MAVLINK_MSG_ID_MISSION_REQUEST_INT_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_mission_request_list.h b/common/mavlink_msg_mission_request_list.h index a1633f43f..69885c89b 100644 --- a/common/mavlink_msg_mission_request_list.h +++ b/common/mavlink_msg_mission_request_list.h @@ -75,6 +75,45 @@ static inline uint16_t mavlink_msg_mission_request_list_pack(uint8_t system_id, return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MISSION_REQUEST_LIST_MIN_LEN, MAVLINK_MSG_ID_MISSION_REQUEST_LIST_LEN, MAVLINK_MSG_ID_MISSION_REQUEST_LIST_CRC); } +/** + * @brief Pack a mission_request_list message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param mission_type Mission type. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_mission_request_list_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint8_t mission_type) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_MISSION_REQUEST_LIST_LEN]; + _mav_put_uint8_t(buf, 0, target_system); + _mav_put_uint8_t(buf, 1, target_component); + _mav_put_uint8_t(buf, 2, mission_type); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_REQUEST_LIST_LEN); +#else + mavlink_mission_request_list_t packet; + packet.target_system = target_system; + packet.target_component = target_component; + packet.mission_type = mission_type; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_REQUEST_LIST_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_MISSION_REQUEST_LIST; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MISSION_REQUEST_LIST_MIN_LEN, MAVLINK_MSG_ID_MISSION_REQUEST_LIST_LEN, MAVLINK_MSG_ID_MISSION_REQUEST_LIST_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MISSION_REQUEST_LIST_MIN_LEN, MAVLINK_MSG_ID_MISSION_REQUEST_LIST_LEN); +#endif +} + /** * @brief Pack a mission_request_list message on a channel * @param system_id ID of this system @@ -137,6 +176,20 @@ static inline uint16_t mavlink_msg_mission_request_list_encode_chan(uint8_t syst return mavlink_msg_mission_request_list_pack_chan(system_id, component_id, chan, msg, mission_request_list->target_system, mission_request_list->target_component, mission_request_list->mission_type); } +/** + * @brief Encode a mission_request_list struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param mission_request_list C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_mission_request_list_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_mission_request_list_t* mission_request_list) +{ + return mavlink_msg_mission_request_list_pack_status(system_id, component_id, _status, msg, mission_request_list->target_system, mission_request_list->target_component, mission_request_list->mission_type); +} + /** * @brief Send a mission_request_list message * @param chan MAVLink channel to send the message @@ -182,7 +235,7 @@ static inline void mavlink_msg_mission_request_list_send_struct(mavlink_channel_ #if MAVLINK_MSG_ID_MISSION_REQUEST_LIST_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_mission_request_partial_list.h b/common/mavlink_msg_mission_request_partial_list.h index 93906934b..7f5f102ed 100644 --- a/common/mavlink_msg_mission_request_partial_list.h +++ b/common/mavlink_msg_mission_request_partial_list.h @@ -87,6 +87,51 @@ static inline uint16_t mavlink_msg_mission_request_partial_list_pack(uint8_t sys return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST_MIN_LEN, MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST_LEN, MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST_CRC); } +/** + * @brief Pack a mission_request_partial_list message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param start_index Start index + * @param end_index End index, -1 by default (-1: send list to end). Else a valid index of the list + * @param mission_type Mission type. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_mission_request_partial_list_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, int16_t start_index, int16_t end_index, uint8_t mission_type) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST_LEN]; + _mav_put_int16_t(buf, 0, start_index); + _mav_put_int16_t(buf, 2, end_index); + _mav_put_uint8_t(buf, 4, target_system); + _mav_put_uint8_t(buf, 5, target_component); + _mav_put_uint8_t(buf, 6, mission_type); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST_LEN); +#else + mavlink_mission_request_partial_list_t packet; + packet.start_index = start_index; + packet.end_index = end_index; + packet.target_system = target_system; + packet.target_component = target_component; + packet.mission_type = mission_type; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST_MIN_LEN, MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST_LEN, MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST_MIN_LEN, MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST_LEN); +#endif +} + /** * @brief Pack a mission_request_partial_list message on a channel * @param system_id ID of this system @@ -155,6 +200,20 @@ static inline uint16_t mavlink_msg_mission_request_partial_list_encode_chan(uint return mavlink_msg_mission_request_partial_list_pack_chan(system_id, component_id, chan, msg, mission_request_partial_list->target_system, mission_request_partial_list->target_component, mission_request_partial_list->start_index, mission_request_partial_list->end_index, mission_request_partial_list->mission_type); } +/** + * @brief Encode a mission_request_partial_list struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param mission_request_partial_list C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_mission_request_partial_list_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_mission_request_partial_list_t* mission_request_partial_list) +{ + return mavlink_msg_mission_request_partial_list_pack_status(system_id, component_id, _status, msg, mission_request_partial_list->target_system, mission_request_partial_list->target_component, mission_request_partial_list->start_index, mission_request_partial_list->end_index, mission_request_partial_list->mission_type); +} + /** * @brief Send a mission_request_partial_list message * @param chan MAVLink channel to send the message @@ -206,7 +265,7 @@ static inline void mavlink_msg_mission_request_partial_list_send_struct(mavlink_ #if MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_mission_set_current.h b/common/mavlink_msg_mission_set_current.h index 41eeba3f5..e92d98e39 100644 --- a/common/mavlink_msg_mission_set_current.h +++ b/common/mavlink_msg_mission_set_current.h @@ -75,6 +75,45 @@ static inline uint16_t mavlink_msg_mission_set_current_pack(uint8_t system_id, u return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MISSION_SET_CURRENT_MIN_LEN, MAVLINK_MSG_ID_MISSION_SET_CURRENT_LEN, MAVLINK_MSG_ID_MISSION_SET_CURRENT_CRC); } +/** + * @brief Pack a mission_set_current message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param seq Sequence + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_mission_set_current_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint16_t seq) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_MISSION_SET_CURRENT_LEN]; + _mav_put_uint16_t(buf, 0, seq); + _mav_put_uint8_t(buf, 2, target_system); + _mav_put_uint8_t(buf, 3, target_component); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_SET_CURRENT_LEN); +#else + mavlink_mission_set_current_t packet; + packet.seq = seq; + packet.target_system = target_system; + packet.target_component = target_component; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_SET_CURRENT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_MISSION_SET_CURRENT; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MISSION_SET_CURRENT_MIN_LEN, MAVLINK_MSG_ID_MISSION_SET_CURRENT_LEN, MAVLINK_MSG_ID_MISSION_SET_CURRENT_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MISSION_SET_CURRENT_MIN_LEN, MAVLINK_MSG_ID_MISSION_SET_CURRENT_LEN); +#endif +} + /** * @brief Pack a mission_set_current message on a channel * @param system_id ID of this system @@ -137,6 +176,20 @@ static inline uint16_t mavlink_msg_mission_set_current_encode_chan(uint8_t syste return mavlink_msg_mission_set_current_pack_chan(system_id, component_id, chan, msg, mission_set_current->target_system, mission_set_current->target_component, mission_set_current->seq); } +/** + * @brief Encode a mission_set_current struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param mission_set_current C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_mission_set_current_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_mission_set_current_t* mission_set_current) +{ + return mavlink_msg_mission_set_current_pack_status(system_id, component_id, _status, msg, mission_set_current->target_system, mission_set_current->target_component, mission_set_current->seq); +} + /** * @brief Send a mission_set_current message * @param chan MAVLink channel to send the message @@ -182,7 +235,7 @@ static inline void mavlink_msg_mission_set_current_send_struct(mavlink_channel_t #if MAVLINK_MSG_ID_MISSION_SET_CURRENT_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_mission_write_partial_list.h b/common/mavlink_msg_mission_write_partial_list.h index 9f8bd08f8..4df36c627 100644 --- a/common/mavlink_msg_mission_write_partial_list.h +++ b/common/mavlink_msg_mission_write_partial_list.h @@ -87,6 +87,51 @@ static inline uint16_t mavlink_msg_mission_write_partial_list_pack(uint8_t syste return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST_MIN_LEN, MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST_LEN, MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST_CRC); } +/** + * @brief Pack a mission_write_partial_list message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param start_index Start index. Must be smaller / equal to the largest index of the current onboard list. + * @param end_index End index, equal or greater than start index. + * @param mission_type Mission type. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_mission_write_partial_list_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, int16_t start_index, int16_t end_index, uint8_t mission_type) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST_LEN]; + _mav_put_int16_t(buf, 0, start_index); + _mav_put_int16_t(buf, 2, end_index); + _mav_put_uint8_t(buf, 4, target_system); + _mav_put_uint8_t(buf, 5, target_component); + _mav_put_uint8_t(buf, 6, mission_type); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST_LEN); +#else + mavlink_mission_write_partial_list_t packet; + packet.start_index = start_index; + packet.end_index = end_index; + packet.target_system = target_system; + packet.target_component = target_component; + packet.mission_type = mission_type; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST_MIN_LEN, MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST_LEN, MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST_MIN_LEN, MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST_LEN); +#endif +} + /** * @brief Pack a mission_write_partial_list message on a channel * @param system_id ID of this system @@ -155,6 +200,20 @@ static inline uint16_t mavlink_msg_mission_write_partial_list_encode_chan(uint8_ return mavlink_msg_mission_write_partial_list_pack_chan(system_id, component_id, chan, msg, mission_write_partial_list->target_system, mission_write_partial_list->target_component, mission_write_partial_list->start_index, mission_write_partial_list->end_index, mission_write_partial_list->mission_type); } +/** + * @brief Encode a mission_write_partial_list struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param mission_write_partial_list C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_mission_write_partial_list_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_mission_write_partial_list_t* mission_write_partial_list) +{ + return mavlink_msg_mission_write_partial_list_pack_status(system_id, component_id, _status, msg, mission_write_partial_list->target_system, mission_write_partial_list->target_component, mission_write_partial_list->start_index, mission_write_partial_list->end_index, mission_write_partial_list->mission_type); +} + /** * @brief Send a mission_write_partial_list message * @param chan MAVLink channel to send the message @@ -206,7 +265,7 @@ static inline void mavlink_msg_mission_write_partial_list_send_struct(mavlink_ch #if MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_mount_orientation.h b/common/mavlink_msg_mount_orientation.h index 96bfda250..474e47802 100644 --- a/common/mavlink_msg_mount_orientation.h +++ b/common/mavlink_msg_mount_orientation.h @@ -87,6 +87,51 @@ static inline uint16_t mavlink_msg_mount_orientation_pack(uint8_t system_id, uin return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MOUNT_ORIENTATION_MIN_LEN, MAVLINK_MSG_ID_MOUNT_ORIENTATION_LEN, MAVLINK_MSG_ID_MOUNT_ORIENTATION_CRC); } +/** + * @brief Pack a mount_orientation message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param roll [deg] Roll in global frame (set to NaN for invalid). + * @param pitch [deg] Pitch in global frame (set to NaN for invalid). + * @param yaw [deg] Yaw relative to vehicle (set to NaN for invalid). + * @param yaw_absolute [deg] Yaw in absolute frame relative to Earth's North, north is 0 (set to NaN for invalid). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_mount_orientation_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, float roll, float pitch, float yaw, float yaw_absolute) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_MOUNT_ORIENTATION_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_float(buf, 4, roll); + _mav_put_float(buf, 8, pitch); + _mav_put_float(buf, 12, yaw); + _mav_put_float(buf, 16, yaw_absolute); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MOUNT_ORIENTATION_LEN); +#else + mavlink_mount_orientation_t packet; + packet.time_boot_ms = time_boot_ms; + packet.roll = roll; + packet.pitch = pitch; + packet.yaw = yaw; + packet.yaw_absolute = yaw_absolute; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MOUNT_ORIENTATION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_MOUNT_ORIENTATION; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MOUNT_ORIENTATION_MIN_LEN, MAVLINK_MSG_ID_MOUNT_ORIENTATION_LEN, MAVLINK_MSG_ID_MOUNT_ORIENTATION_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MOUNT_ORIENTATION_MIN_LEN, MAVLINK_MSG_ID_MOUNT_ORIENTATION_LEN); +#endif +} + /** * @brief Pack a mount_orientation message on a channel * @param system_id ID of this system @@ -155,6 +200,20 @@ static inline uint16_t mavlink_msg_mount_orientation_encode_chan(uint8_t system_ return mavlink_msg_mount_orientation_pack_chan(system_id, component_id, chan, msg, mount_orientation->time_boot_ms, mount_orientation->roll, mount_orientation->pitch, mount_orientation->yaw, mount_orientation->yaw_absolute); } +/** + * @brief Encode a mount_orientation struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param mount_orientation C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_mount_orientation_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_mount_orientation_t* mount_orientation) +{ + return mavlink_msg_mount_orientation_pack_status(system_id, component_id, _status, msg, mount_orientation->time_boot_ms, mount_orientation->roll, mount_orientation->pitch, mount_orientation->yaw, mount_orientation->yaw_absolute); +} + /** * @brief Send a mount_orientation message * @param chan MAVLink channel to send the message @@ -206,7 +265,7 @@ static inline void mavlink_msg_mount_orientation_send_struct(mavlink_channel_t c #if MAVLINK_MSG_ID_MOUNT_ORIENTATION_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_named_value_float.h b/common/mavlink_msg_named_value_float.h index ac3e8382f..0ded95fcb 100644 --- a/common/mavlink_msg_named_value_float.h +++ b/common/mavlink_msg_named_value_float.h @@ -65,7 +65,7 @@ static inline uint16_t mavlink_msg_named_value_float_pack(uint8_t system_id, uin mavlink_named_value_float_t packet; packet.time_boot_ms = time_boot_ms; packet.value = value; - mav_array_memcpy(packet.name, name, sizeof(char)*10); + mav_array_assign_char(packet.name, name, 10); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN); #endif @@ -73,6 +73,43 @@ static inline uint16_t mavlink_msg_named_value_float_pack(uint8_t system_id, uin return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_MIN_LEN, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_CRC); } +/** + * @brief Pack a named_value_float message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param name Name of the debug variable + * @param value Floating point value + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_named_value_float_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, const char *name, float value) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_float(buf, 4, value); + _mav_put_char_array(buf, 8, name, 10); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN); +#else + mavlink_named_value_float_t packet; + packet.time_boot_ms = time_boot_ms; + packet.value = value; + mav_array_memcpy(packet.name, name, sizeof(char)*10); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_NAMED_VALUE_FLOAT; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_MIN_LEN, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_MIN_LEN, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN); +#endif +} + /** * @brief Pack a named_value_float message on a channel * @param system_id ID of this system @@ -98,7 +135,7 @@ static inline uint16_t mavlink_msg_named_value_float_pack_chan(uint8_t system_id mavlink_named_value_float_t packet; packet.time_boot_ms = time_boot_ms; packet.value = value; - mav_array_memcpy(packet.name, name, sizeof(char)*10); + mav_array_assign_char(packet.name, name, 10); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN); #endif @@ -133,6 +170,20 @@ static inline uint16_t mavlink_msg_named_value_float_encode_chan(uint8_t system_ return mavlink_msg_named_value_float_pack_chan(system_id, component_id, chan, msg, named_value_float->time_boot_ms, named_value_float->name, named_value_float->value); } +/** + * @brief Encode a named_value_float struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param named_value_float C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_named_value_float_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_named_value_float_t* named_value_float) +{ + return mavlink_msg_named_value_float_pack_status(system_id, component_id, _status, msg, named_value_float->time_boot_ms, named_value_float->name, named_value_float->value); +} + /** * @brief Send a named_value_float message * @param chan MAVLink channel to send the message @@ -155,7 +206,7 @@ static inline void mavlink_msg_named_value_float_send(mavlink_channel_t chan, ui mavlink_named_value_float_t packet; packet.time_boot_ms = time_boot_ms; packet.value = value; - mav_array_memcpy(packet.name, name, sizeof(char)*10); + mav_array_assign_char(packet.name, name, 10); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT, (const char *)&packet, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_MIN_LEN, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_CRC); #endif } @@ -176,7 +227,7 @@ static inline void mavlink_msg_named_value_float_send_struct(mavlink_channel_t c #if MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -194,7 +245,7 @@ static inline void mavlink_msg_named_value_float_send_buf(mavlink_message_t *msg mavlink_named_value_float_t *packet = (mavlink_named_value_float_t *)msgbuf; packet->time_boot_ms = time_boot_ms; packet->value = value; - mav_array_memcpy(packet->name, name, sizeof(char)*10); + mav_array_assign_char(packet->name, name, 10); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT, (const char *)packet, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_MIN_LEN, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_CRC); #endif } diff --git a/common/mavlink_msg_named_value_int.h b/common/mavlink_msg_named_value_int.h index 32dbdc91c..c5cbe7e80 100644 --- a/common/mavlink_msg_named_value_int.h +++ b/common/mavlink_msg_named_value_int.h @@ -65,7 +65,7 @@ static inline uint16_t mavlink_msg_named_value_int_pack(uint8_t system_id, uint8 mavlink_named_value_int_t packet; packet.time_boot_ms = time_boot_ms; packet.value = value; - mav_array_memcpy(packet.name, name, sizeof(char)*10); + mav_array_assign_char(packet.name, name, 10); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN); #endif @@ -73,6 +73,43 @@ static inline uint16_t mavlink_msg_named_value_int_pack(uint8_t system_id, uint8 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_NAMED_VALUE_INT_MIN_LEN, MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN, MAVLINK_MSG_ID_NAMED_VALUE_INT_CRC); } +/** + * @brief Pack a named_value_int message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param name Name of the debug variable + * @param value Signed integer value + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_named_value_int_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, const char *name, int32_t value) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_int32_t(buf, 4, value); + _mav_put_char_array(buf, 8, name, 10); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN); +#else + mavlink_named_value_int_t packet; + packet.time_boot_ms = time_boot_ms; + packet.value = value; + mav_array_memcpy(packet.name, name, sizeof(char)*10); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_NAMED_VALUE_INT; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_NAMED_VALUE_INT_MIN_LEN, MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN, MAVLINK_MSG_ID_NAMED_VALUE_INT_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_NAMED_VALUE_INT_MIN_LEN, MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN); +#endif +} + /** * @brief Pack a named_value_int message on a channel * @param system_id ID of this system @@ -98,7 +135,7 @@ static inline uint16_t mavlink_msg_named_value_int_pack_chan(uint8_t system_id, mavlink_named_value_int_t packet; packet.time_boot_ms = time_boot_ms; packet.value = value; - mav_array_memcpy(packet.name, name, sizeof(char)*10); + mav_array_assign_char(packet.name, name, 10); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN); #endif @@ -133,6 +170,20 @@ static inline uint16_t mavlink_msg_named_value_int_encode_chan(uint8_t system_id return mavlink_msg_named_value_int_pack_chan(system_id, component_id, chan, msg, named_value_int->time_boot_ms, named_value_int->name, named_value_int->value); } +/** + * @brief Encode a named_value_int struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param named_value_int C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_named_value_int_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_named_value_int_t* named_value_int) +{ + return mavlink_msg_named_value_int_pack_status(system_id, component_id, _status, msg, named_value_int->time_boot_ms, named_value_int->name, named_value_int->value); +} + /** * @brief Send a named_value_int message * @param chan MAVLink channel to send the message @@ -155,7 +206,7 @@ static inline void mavlink_msg_named_value_int_send(mavlink_channel_t chan, uint mavlink_named_value_int_t packet; packet.time_boot_ms = time_boot_ms; packet.value = value; - mav_array_memcpy(packet.name, name, sizeof(char)*10); + mav_array_assign_char(packet.name, name, 10); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_NAMED_VALUE_INT, (const char *)&packet, MAVLINK_MSG_ID_NAMED_VALUE_INT_MIN_LEN, MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN, MAVLINK_MSG_ID_NAMED_VALUE_INT_CRC); #endif } @@ -176,7 +227,7 @@ static inline void mavlink_msg_named_value_int_send_struct(mavlink_channel_t cha #if MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -194,7 +245,7 @@ static inline void mavlink_msg_named_value_int_send_buf(mavlink_message_t *msgbu mavlink_named_value_int_t *packet = (mavlink_named_value_int_t *)msgbuf; packet->time_boot_ms = time_boot_ms; packet->value = value; - mav_array_memcpy(packet->name, name, sizeof(char)*10); + mav_array_assign_char(packet->name, name, 10); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_NAMED_VALUE_INT, (const char *)packet, MAVLINK_MSG_ID_NAMED_VALUE_INT_MIN_LEN, MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN, MAVLINK_MSG_ID_NAMED_VALUE_INT_CRC); #endif } diff --git a/common/mavlink_msg_nav_controller_output.h b/common/mavlink_msg_nav_controller_output.h index 2d9e8c0c5..0ede7d2f5 100644 --- a/common/mavlink_msg_nav_controller_output.h +++ b/common/mavlink_msg_nav_controller_output.h @@ -105,6 +105,60 @@ static inline uint16_t mavlink_msg_nav_controller_output_pack(uint8_t system_id, return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_MIN_LEN, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_CRC); } +/** + * @brief Pack a nav_controller_output message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param nav_roll [deg] Current desired roll + * @param nav_pitch [deg] Current desired pitch + * @param nav_bearing [deg] Current desired heading + * @param target_bearing [deg] Bearing to current waypoint/target + * @param wp_dist [m] Distance to active waypoint + * @param alt_error [m] Current altitude error + * @param aspd_error [m/s] Current airspeed error + * @param xtrack_error [m] Current crosstrack error on x-y plane + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_nav_controller_output_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + float nav_roll, float nav_pitch, int16_t nav_bearing, int16_t target_bearing, uint16_t wp_dist, float alt_error, float aspd_error, float xtrack_error) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN]; + _mav_put_float(buf, 0, nav_roll); + _mav_put_float(buf, 4, nav_pitch); + _mav_put_float(buf, 8, alt_error); + _mav_put_float(buf, 12, aspd_error); + _mav_put_float(buf, 16, xtrack_error); + _mav_put_int16_t(buf, 20, nav_bearing); + _mav_put_int16_t(buf, 22, target_bearing); + _mav_put_uint16_t(buf, 24, wp_dist); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN); +#else + mavlink_nav_controller_output_t packet; + packet.nav_roll = nav_roll; + packet.nav_pitch = nav_pitch; + packet.alt_error = alt_error; + packet.aspd_error = aspd_error; + packet.xtrack_error = xtrack_error; + packet.nav_bearing = nav_bearing; + packet.target_bearing = target_bearing; + packet.wp_dist = wp_dist; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_MIN_LEN, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_MIN_LEN, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN); +#endif +} + /** * @brief Pack a nav_controller_output message on a channel * @param system_id ID of this system @@ -182,6 +236,20 @@ static inline uint16_t mavlink_msg_nav_controller_output_encode_chan(uint8_t sys return mavlink_msg_nav_controller_output_pack_chan(system_id, component_id, chan, msg, nav_controller_output->nav_roll, nav_controller_output->nav_pitch, nav_controller_output->nav_bearing, nav_controller_output->target_bearing, nav_controller_output->wp_dist, nav_controller_output->alt_error, nav_controller_output->aspd_error, nav_controller_output->xtrack_error); } +/** + * @brief Encode a nav_controller_output struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param nav_controller_output C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_nav_controller_output_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_nav_controller_output_t* nav_controller_output) +{ + return mavlink_msg_nav_controller_output_pack_status(system_id, component_id, _status, msg, nav_controller_output->nav_roll, nav_controller_output->nav_pitch, nav_controller_output->nav_bearing, nav_controller_output->target_bearing, nav_controller_output->wp_dist, nav_controller_output->alt_error, nav_controller_output->aspd_error, nav_controller_output->xtrack_error); +} + /** * @brief Send a nav_controller_output message * @param chan MAVLink channel to send the message @@ -242,7 +310,7 @@ static inline void mavlink_msg_nav_controller_output_send_struct(mavlink_channel #if MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_obstacle_distance.h b/common/mavlink_msg_obstacle_distance.h index 641f2627f..df3f31e86 100644 --- a/common/mavlink_msg_obstacle_distance.h +++ b/common/mavlink_msg_obstacle_distance.h @@ -101,7 +101,7 @@ static inline uint16_t mavlink_msg_obstacle_distance_pack(uint8_t system_id, uin packet.increment_f = increment_f; packet.angle_offset = angle_offset; packet.frame = frame; - mav_array_memcpy(packet.distances, distances, sizeof(uint16_t)*72); + mav_array_assign_uint16_t(packet.distances, distances, 72); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_LEN); #endif @@ -109,6 +109,61 @@ static inline uint16_t mavlink_msg_obstacle_distance_pack(uint8_t system_id, uin return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_MIN_LEN, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_LEN, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_CRC); } +/** + * @brief Pack a obstacle_distance message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param sensor_type Class id of the distance sensor type. + * @param distances [cm] Distance of obstacles around the vehicle with index 0 corresponding to north + angle_offset, unless otherwise specified in the frame. A value of 0 is valid and means that the obstacle is practically touching the sensor. A value of max_distance +1 means no obstacle is present. A value of UINT16_MAX for unknown/not used. In a array element, one unit corresponds to 1cm. + * @param increment [deg] Angular width in degrees of each array element. Increment direction is clockwise. This field is ignored if increment_f is non-zero. + * @param min_distance [cm] Minimum distance the sensor can measure. + * @param max_distance [cm] Maximum distance the sensor can measure. + * @param increment_f [deg] Angular width in degrees of each array element as a float. If non-zero then this value is used instead of the uint8_t increment field. Positive is clockwise direction, negative is counter-clockwise. + * @param angle_offset [deg] Relative angle offset of the 0-index element in the distances array. Value of 0 corresponds to forward. Positive is clockwise direction, negative is counter-clockwise. + * @param frame Coordinate frame of reference for the yaw rotation and offset of the sensor data. Defaults to MAV_FRAME_GLOBAL, which is north aligned. For body-mounted sensors use MAV_FRAME_BODY_FRD, which is vehicle front aligned. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_obstacle_distance_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, uint8_t sensor_type, const uint16_t *distances, uint8_t increment, uint16_t min_distance, uint16_t max_distance, float increment_f, float angle_offset, uint8_t frame) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_OBSTACLE_DISTANCE_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint16_t(buf, 152, min_distance); + _mav_put_uint16_t(buf, 154, max_distance); + _mav_put_uint8_t(buf, 156, sensor_type); + _mav_put_uint8_t(buf, 157, increment); + _mav_put_float(buf, 158, increment_f); + _mav_put_float(buf, 162, angle_offset); + _mav_put_uint8_t(buf, 166, frame); + _mav_put_uint16_t_array(buf, 8, distances, 72); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_LEN); +#else + mavlink_obstacle_distance_t packet; + packet.time_usec = time_usec; + packet.min_distance = min_distance; + packet.max_distance = max_distance; + packet.sensor_type = sensor_type; + packet.increment = increment; + packet.increment_f = increment_f; + packet.angle_offset = angle_offset; + packet.frame = frame; + mav_array_memcpy(packet.distances, distances, sizeof(uint16_t)*72); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_OBSTACLE_DISTANCE; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_MIN_LEN, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_LEN, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_MIN_LEN, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_LEN); +#endif +} + /** * @brief Pack a obstacle_distance message on a channel * @param system_id ID of this system @@ -152,7 +207,7 @@ static inline uint16_t mavlink_msg_obstacle_distance_pack_chan(uint8_t system_id packet.increment_f = increment_f; packet.angle_offset = angle_offset; packet.frame = frame; - mav_array_memcpy(packet.distances, distances, sizeof(uint16_t)*72); + mav_array_assign_uint16_t(packet.distances, distances, 72); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_LEN); #endif @@ -187,6 +242,20 @@ static inline uint16_t mavlink_msg_obstacle_distance_encode_chan(uint8_t system_ return mavlink_msg_obstacle_distance_pack_chan(system_id, component_id, chan, msg, obstacle_distance->time_usec, obstacle_distance->sensor_type, obstacle_distance->distances, obstacle_distance->increment, obstacle_distance->min_distance, obstacle_distance->max_distance, obstacle_distance->increment_f, obstacle_distance->angle_offset, obstacle_distance->frame); } +/** + * @brief Encode a obstacle_distance struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param obstacle_distance C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_obstacle_distance_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_obstacle_distance_t* obstacle_distance) +{ + return mavlink_msg_obstacle_distance_pack_status(system_id, component_id, _status, msg, obstacle_distance->time_usec, obstacle_distance->sensor_type, obstacle_distance->distances, obstacle_distance->increment, obstacle_distance->min_distance, obstacle_distance->max_distance, obstacle_distance->increment_f, obstacle_distance->angle_offset, obstacle_distance->frame); +} + /** * @brief Send a obstacle_distance message * @param chan MAVLink channel to send the message @@ -227,7 +296,7 @@ static inline void mavlink_msg_obstacle_distance_send(mavlink_channel_t chan, ui packet.increment_f = increment_f; packet.angle_offset = angle_offset; packet.frame = frame; - mav_array_memcpy(packet.distances, distances, sizeof(uint16_t)*72); + mav_array_assign_uint16_t(packet.distances, distances, 72); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OBSTACLE_DISTANCE, (const char *)&packet, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_MIN_LEN, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_LEN, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_CRC); #endif } @@ -248,7 +317,7 @@ static inline void mavlink_msg_obstacle_distance_send_struct(mavlink_channel_t c #if MAVLINK_MSG_ID_OBSTACLE_DISTANCE_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -278,7 +347,7 @@ static inline void mavlink_msg_obstacle_distance_send_buf(mavlink_message_t *msg packet->increment_f = increment_f; packet->angle_offset = angle_offset; packet->frame = frame; - mav_array_memcpy(packet->distances, distances, sizeof(uint16_t)*72); + mav_array_assign_uint16_t(packet->distances, distances, 72); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OBSTACLE_DISTANCE, (const char *)packet, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_MIN_LEN, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_LEN, MAVLINK_MSG_ID_OBSTACLE_DISTANCE_CRC); #endif } diff --git a/common/mavlink_msg_odometry.h b/common/mavlink_msg_odometry.h index 93869b791..ff4de1dca 100644 --- a/common/mavlink_msg_odometry.h +++ b/common/mavlink_msg_odometry.h @@ -22,11 +22,12 @@ typedef struct __mavlink_odometry_t { uint8_t child_frame_id; /*< Coordinate frame of reference for the velocity in free space (twist) data.*/ uint8_t reset_counter; /*< Estimate reset counter. This should be incremented when the estimate resets in any of the dimensions (position, velocity, attitude, angular speed). This is designed to be used when e.g an external SLAM system detects a loop-closure and the estimate jumps.*/ uint8_t estimator_type; /*< Type of estimator that is providing the odometry.*/ + int8_t quality; /*< [%] Optional odometry quality metric as a percentage. -1 = odometry has failed, 0 = unknown/unset quality, 1 = worst quality, 100 = best quality*/ } mavlink_odometry_t; -#define MAVLINK_MSG_ID_ODOMETRY_LEN 232 +#define MAVLINK_MSG_ID_ODOMETRY_LEN 233 #define MAVLINK_MSG_ID_ODOMETRY_MIN_LEN 230 -#define MAVLINK_MSG_ID_331_LEN 232 +#define MAVLINK_MSG_ID_331_LEN 233 #define MAVLINK_MSG_ID_331_MIN_LEN 230 #define MAVLINK_MSG_ID_ODOMETRY_CRC 91 @@ -40,7 +41,7 @@ typedef struct __mavlink_odometry_t { #define MAVLINK_MESSAGE_INFO_ODOMETRY { \ 331, \ "ODOMETRY", \ - 17, \ + 18, \ { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_odometry_t, time_usec) }, \ { "frame_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 228, offsetof(mavlink_odometry_t, frame_id) }, \ { "child_frame_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 229, offsetof(mavlink_odometry_t, child_frame_id) }, \ @@ -58,12 +59,13 @@ typedef struct __mavlink_odometry_t { { "velocity_covariance", NULL, MAVLINK_TYPE_FLOAT, 21, 144, offsetof(mavlink_odometry_t, velocity_covariance) }, \ { "reset_counter", NULL, MAVLINK_TYPE_UINT8_T, 0, 230, offsetof(mavlink_odometry_t, reset_counter) }, \ { "estimator_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 231, offsetof(mavlink_odometry_t, estimator_type) }, \ + { "quality", NULL, MAVLINK_TYPE_INT8_T, 0, 232, offsetof(mavlink_odometry_t, quality) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_ODOMETRY { \ "ODOMETRY", \ - 17, \ + 18, \ { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_odometry_t, time_usec) }, \ { "frame_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 228, offsetof(mavlink_odometry_t, frame_id) }, \ { "child_frame_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 229, offsetof(mavlink_odometry_t, child_frame_id) }, \ @@ -81,6 +83,7 @@ typedef struct __mavlink_odometry_t { { "velocity_covariance", NULL, MAVLINK_TYPE_FLOAT, 21, 144, offsetof(mavlink_odometry_t, velocity_covariance) }, \ { "reset_counter", NULL, MAVLINK_TYPE_UINT8_T, 0, 230, offsetof(mavlink_odometry_t, reset_counter) }, \ { "estimator_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 231, offsetof(mavlink_odometry_t, estimator_type) }, \ + { "quality", NULL, MAVLINK_TYPE_INT8_T, 0, 232, offsetof(mavlink_odometry_t, quality) }, \ } \ } #endif @@ -108,10 +111,11 @@ typedef struct __mavlink_odometry_t { * @param velocity_covariance Row-major representation of a 6x6 velocity cross-covariance matrix upper right triangle (states: vx, vy, vz, rollspeed, pitchspeed, yawspeed; first six entries are the first ROW, next five entries are the second ROW, etc.). If unknown, assign NaN value to first element in the array. * @param reset_counter Estimate reset counter. This should be incremented when the estimate resets in any of the dimensions (position, velocity, attitude, angular speed). This is designed to be used when e.g an external SLAM system detects a loop-closure and the estimate jumps. * @param estimator_type Type of estimator that is providing the odometry. + * @param quality [%] Optional odometry quality metric as a percentage. -1 = odometry has failed, 0 = unknown/unset quality, 1 = worst quality, 100 = best quality * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_odometry_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint64_t time_usec, uint8_t frame_id, uint8_t child_frame_id, float x, float y, float z, const float *q, float vx, float vy, float vz, float rollspeed, float pitchspeed, float yawspeed, const float *pose_covariance, const float *velocity_covariance, uint8_t reset_counter, uint8_t estimator_type) + uint64_t time_usec, uint8_t frame_id, uint8_t child_frame_id, float x, float y, float z, const float *q, float vx, float vy, float vz, float rollspeed, float pitchspeed, float yawspeed, const float *pose_covariance, const float *velocity_covariance, uint8_t reset_counter, uint8_t estimator_type, int8_t quality) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_ODOMETRY_LEN]; @@ -129,6 +133,7 @@ static inline uint16_t mavlink_msg_odometry_pack(uint8_t system_id, uint8_t comp _mav_put_uint8_t(buf, 229, child_frame_id); _mav_put_uint8_t(buf, 230, reset_counter); _mav_put_uint8_t(buf, 231, estimator_type); + _mav_put_int8_t(buf, 232, quality); _mav_put_float_array(buf, 20, q, 4); _mav_put_float_array(buf, 60, pose_covariance, 21); _mav_put_float_array(buf, 144, velocity_covariance, 21); @@ -149,6 +154,85 @@ static inline uint16_t mavlink_msg_odometry_pack(uint8_t system_id, uint8_t comp packet.child_frame_id = child_frame_id; packet.reset_counter = reset_counter; packet.estimator_type = estimator_type; + packet.quality = quality; + mav_array_assign_float(packet.q, q, 4); + mav_array_assign_float(packet.pose_covariance, pose_covariance, 21); + mav_array_assign_float(packet.velocity_covariance, velocity_covariance, 21); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ODOMETRY_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_ODOMETRY; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ODOMETRY_MIN_LEN, MAVLINK_MSG_ID_ODOMETRY_LEN, MAVLINK_MSG_ID_ODOMETRY_CRC); +} + +/** + * @brief Pack a odometry message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param frame_id Coordinate frame of reference for the pose data. + * @param child_frame_id Coordinate frame of reference for the velocity in free space (twist) data. + * @param x [m] X Position + * @param y [m] Y Position + * @param z [m] Z Position + * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation) + * @param vx [m/s] X linear speed + * @param vy [m/s] Y linear speed + * @param vz [m/s] Z linear speed + * @param rollspeed [rad/s] Roll angular speed + * @param pitchspeed [rad/s] Pitch angular speed + * @param yawspeed [rad/s] Yaw angular speed + * @param pose_covariance Row-major representation of a 6x6 pose cross-covariance matrix upper right triangle (states: x, y, z, roll, pitch, yaw; first six entries are the first ROW, next five entries are the second ROW, etc.). If unknown, assign NaN value to first element in the array. + * @param velocity_covariance Row-major representation of a 6x6 velocity cross-covariance matrix upper right triangle (states: vx, vy, vz, rollspeed, pitchspeed, yawspeed; first six entries are the first ROW, next five entries are the second ROW, etc.). If unknown, assign NaN value to first element in the array. + * @param reset_counter Estimate reset counter. This should be incremented when the estimate resets in any of the dimensions (position, velocity, attitude, angular speed). This is designed to be used when e.g an external SLAM system detects a loop-closure and the estimate jumps. + * @param estimator_type Type of estimator that is providing the odometry. + * @param quality [%] Optional odometry quality metric as a percentage. -1 = odometry has failed, 0 = unknown/unset quality, 1 = worst quality, 100 = best quality + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_odometry_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, uint8_t frame_id, uint8_t child_frame_id, float x, float y, float z, const float *q, float vx, float vy, float vz, float rollspeed, float pitchspeed, float yawspeed, const float *pose_covariance, const float *velocity_covariance, uint8_t reset_counter, uint8_t estimator_type, int8_t quality) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_ODOMETRY_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, x); + _mav_put_float(buf, 12, y); + _mav_put_float(buf, 16, z); + _mav_put_float(buf, 36, vx); + _mav_put_float(buf, 40, vy); + _mav_put_float(buf, 44, vz); + _mav_put_float(buf, 48, rollspeed); + _mav_put_float(buf, 52, pitchspeed); + _mav_put_float(buf, 56, yawspeed); + _mav_put_uint8_t(buf, 228, frame_id); + _mav_put_uint8_t(buf, 229, child_frame_id); + _mav_put_uint8_t(buf, 230, reset_counter); + _mav_put_uint8_t(buf, 231, estimator_type); + _mav_put_int8_t(buf, 232, quality); + _mav_put_float_array(buf, 20, q, 4); + _mav_put_float_array(buf, 60, pose_covariance, 21); + _mav_put_float_array(buf, 144, velocity_covariance, 21); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ODOMETRY_LEN); +#else + mavlink_odometry_t packet; + packet.time_usec = time_usec; + packet.x = x; + packet.y = y; + packet.z = z; + packet.vx = vx; + packet.vy = vy; + packet.vz = vz; + packet.rollspeed = rollspeed; + packet.pitchspeed = pitchspeed; + packet.yawspeed = yawspeed; + packet.frame_id = frame_id; + packet.child_frame_id = child_frame_id; + packet.reset_counter = reset_counter; + packet.estimator_type = estimator_type; + packet.quality = quality; mav_array_memcpy(packet.q, q, sizeof(float)*4); mav_array_memcpy(packet.pose_covariance, pose_covariance, sizeof(float)*21); mav_array_memcpy(packet.velocity_covariance, velocity_covariance, sizeof(float)*21); @@ -156,7 +240,11 @@ static inline uint16_t mavlink_msg_odometry_pack(uint8_t system_id, uint8_t comp #endif msg->msgid = MAVLINK_MSG_ID_ODOMETRY; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ODOMETRY_MIN_LEN, MAVLINK_MSG_ID_ODOMETRY_LEN, MAVLINK_MSG_ID_ODOMETRY_CRC); +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ODOMETRY_MIN_LEN, MAVLINK_MSG_ID_ODOMETRY_LEN, MAVLINK_MSG_ID_ODOMETRY_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ODOMETRY_MIN_LEN, MAVLINK_MSG_ID_ODOMETRY_LEN); +#endif } /** @@ -182,11 +270,12 @@ static inline uint16_t mavlink_msg_odometry_pack(uint8_t system_id, uint8_t comp * @param velocity_covariance Row-major representation of a 6x6 velocity cross-covariance matrix upper right triangle (states: vx, vy, vz, rollspeed, pitchspeed, yawspeed; first six entries are the first ROW, next five entries are the second ROW, etc.). If unknown, assign NaN value to first element in the array. * @param reset_counter Estimate reset counter. This should be incremented when the estimate resets in any of the dimensions (position, velocity, attitude, angular speed). This is designed to be used when e.g an external SLAM system detects a loop-closure and the estimate jumps. * @param estimator_type Type of estimator that is providing the odometry. + * @param quality [%] Optional odometry quality metric as a percentage. -1 = odometry has failed, 0 = unknown/unset quality, 1 = worst quality, 100 = best quality * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_odometry_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - uint64_t time_usec,uint8_t frame_id,uint8_t child_frame_id,float x,float y,float z,const float *q,float vx,float vy,float vz,float rollspeed,float pitchspeed,float yawspeed,const float *pose_covariance,const float *velocity_covariance,uint8_t reset_counter,uint8_t estimator_type) + uint64_t time_usec,uint8_t frame_id,uint8_t child_frame_id,float x,float y,float z,const float *q,float vx,float vy,float vz,float rollspeed,float pitchspeed,float yawspeed,const float *pose_covariance,const float *velocity_covariance,uint8_t reset_counter,uint8_t estimator_type,int8_t quality) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_ODOMETRY_LEN]; @@ -204,6 +293,7 @@ static inline uint16_t mavlink_msg_odometry_pack_chan(uint8_t system_id, uint8_t _mav_put_uint8_t(buf, 229, child_frame_id); _mav_put_uint8_t(buf, 230, reset_counter); _mav_put_uint8_t(buf, 231, estimator_type); + _mav_put_int8_t(buf, 232, quality); _mav_put_float_array(buf, 20, q, 4); _mav_put_float_array(buf, 60, pose_covariance, 21); _mav_put_float_array(buf, 144, velocity_covariance, 21); @@ -224,9 +314,10 @@ static inline uint16_t mavlink_msg_odometry_pack_chan(uint8_t system_id, uint8_t packet.child_frame_id = child_frame_id; packet.reset_counter = reset_counter; packet.estimator_type = estimator_type; - mav_array_memcpy(packet.q, q, sizeof(float)*4); - mav_array_memcpy(packet.pose_covariance, pose_covariance, sizeof(float)*21); - mav_array_memcpy(packet.velocity_covariance, velocity_covariance, sizeof(float)*21); + packet.quality = quality; + mav_array_assign_float(packet.q, q, 4); + mav_array_assign_float(packet.pose_covariance, pose_covariance, 21); + mav_array_assign_float(packet.velocity_covariance, velocity_covariance, 21); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ODOMETRY_LEN); #endif @@ -244,7 +335,7 @@ static inline uint16_t mavlink_msg_odometry_pack_chan(uint8_t system_id, uint8_t */ static inline uint16_t mavlink_msg_odometry_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_odometry_t* odometry) { - return mavlink_msg_odometry_pack(system_id, component_id, msg, odometry->time_usec, odometry->frame_id, odometry->child_frame_id, odometry->x, odometry->y, odometry->z, odometry->q, odometry->vx, odometry->vy, odometry->vz, odometry->rollspeed, odometry->pitchspeed, odometry->yawspeed, odometry->pose_covariance, odometry->velocity_covariance, odometry->reset_counter, odometry->estimator_type); + return mavlink_msg_odometry_pack(system_id, component_id, msg, odometry->time_usec, odometry->frame_id, odometry->child_frame_id, odometry->x, odometry->y, odometry->z, odometry->q, odometry->vx, odometry->vy, odometry->vz, odometry->rollspeed, odometry->pitchspeed, odometry->yawspeed, odometry->pose_covariance, odometry->velocity_covariance, odometry->reset_counter, odometry->estimator_type, odometry->quality); } /** @@ -258,7 +349,21 @@ static inline uint16_t mavlink_msg_odometry_encode(uint8_t system_id, uint8_t co */ static inline uint16_t mavlink_msg_odometry_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_odometry_t* odometry) { - return mavlink_msg_odometry_pack_chan(system_id, component_id, chan, msg, odometry->time_usec, odometry->frame_id, odometry->child_frame_id, odometry->x, odometry->y, odometry->z, odometry->q, odometry->vx, odometry->vy, odometry->vz, odometry->rollspeed, odometry->pitchspeed, odometry->yawspeed, odometry->pose_covariance, odometry->velocity_covariance, odometry->reset_counter, odometry->estimator_type); + return mavlink_msg_odometry_pack_chan(system_id, component_id, chan, msg, odometry->time_usec, odometry->frame_id, odometry->child_frame_id, odometry->x, odometry->y, odometry->z, odometry->q, odometry->vx, odometry->vy, odometry->vz, odometry->rollspeed, odometry->pitchspeed, odometry->yawspeed, odometry->pose_covariance, odometry->velocity_covariance, odometry->reset_counter, odometry->estimator_type, odometry->quality); +} + +/** + * @brief Encode a odometry struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param odometry C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_odometry_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_odometry_t* odometry) +{ + return mavlink_msg_odometry_pack_status(system_id, component_id, _status, msg, odometry->time_usec, odometry->frame_id, odometry->child_frame_id, odometry->x, odometry->y, odometry->z, odometry->q, odometry->vx, odometry->vy, odometry->vz, odometry->rollspeed, odometry->pitchspeed, odometry->yawspeed, odometry->pose_covariance, odometry->velocity_covariance, odometry->reset_counter, odometry->estimator_type, odometry->quality); } /** @@ -282,10 +387,11 @@ static inline uint16_t mavlink_msg_odometry_encode_chan(uint8_t system_id, uint8 * @param velocity_covariance Row-major representation of a 6x6 velocity cross-covariance matrix upper right triangle (states: vx, vy, vz, rollspeed, pitchspeed, yawspeed; first six entries are the first ROW, next five entries are the second ROW, etc.). If unknown, assign NaN value to first element in the array. * @param reset_counter Estimate reset counter. This should be incremented when the estimate resets in any of the dimensions (position, velocity, attitude, angular speed). This is designed to be used when e.g an external SLAM system detects a loop-closure and the estimate jumps. * @param estimator_type Type of estimator that is providing the odometry. + * @param quality [%] Optional odometry quality metric as a percentage. -1 = odometry has failed, 0 = unknown/unset quality, 1 = worst quality, 100 = best quality */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_odometry_send(mavlink_channel_t chan, uint64_t time_usec, uint8_t frame_id, uint8_t child_frame_id, float x, float y, float z, const float *q, float vx, float vy, float vz, float rollspeed, float pitchspeed, float yawspeed, const float *pose_covariance, const float *velocity_covariance, uint8_t reset_counter, uint8_t estimator_type) +static inline void mavlink_msg_odometry_send(mavlink_channel_t chan, uint64_t time_usec, uint8_t frame_id, uint8_t child_frame_id, float x, float y, float z, const float *q, float vx, float vy, float vz, float rollspeed, float pitchspeed, float yawspeed, const float *pose_covariance, const float *velocity_covariance, uint8_t reset_counter, uint8_t estimator_type, int8_t quality) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_ODOMETRY_LEN]; @@ -303,6 +409,7 @@ static inline void mavlink_msg_odometry_send(mavlink_channel_t chan, uint64_t ti _mav_put_uint8_t(buf, 229, child_frame_id); _mav_put_uint8_t(buf, 230, reset_counter); _mav_put_uint8_t(buf, 231, estimator_type); + _mav_put_int8_t(buf, 232, quality); _mav_put_float_array(buf, 20, q, 4); _mav_put_float_array(buf, 60, pose_covariance, 21); _mav_put_float_array(buf, 144, velocity_covariance, 21); @@ -323,9 +430,10 @@ static inline void mavlink_msg_odometry_send(mavlink_channel_t chan, uint64_t ti packet.child_frame_id = child_frame_id; packet.reset_counter = reset_counter; packet.estimator_type = estimator_type; - mav_array_memcpy(packet.q, q, sizeof(float)*4); - mav_array_memcpy(packet.pose_covariance, pose_covariance, sizeof(float)*21); - mav_array_memcpy(packet.velocity_covariance, velocity_covariance, sizeof(float)*21); + packet.quality = quality; + mav_array_assign_float(packet.q, q, 4); + mav_array_assign_float(packet.pose_covariance, pose_covariance, 21); + mav_array_assign_float(packet.velocity_covariance, velocity_covariance, 21); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ODOMETRY, (const char *)&packet, MAVLINK_MSG_ID_ODOMETRY_MIN_LEN, MAVLINK_MSG_ID_ODOMETRY_LEN, MAVLINK_MSG_ID_ODOMETRY_CRC); #endif } @@ -338,7 +446,7 @@ static inline void mavlink_msg_odometry_send(mavlink_channel_t chan, uint64_t ti static inline void mavlink_msg_odometry_send_struct(mavlink_channel_t chan, const mavlink_odometry_t* odometry) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_odometry_send(chan, odometry->time_usec, odometry->frame_id, odometry->child_frame_id, odometry->x, odometry->y, odometry->z, odometry->q, odometry->vx, odometry->vy, odometry->vz, odometry->rollspeed, odometry->pitchspeed, odometry->yawspeed, odometry->pose_covariance, odometry->velocity_covariance, odometry->reset_counter, odometry->estimator_type); + mavlink_msg_odometry_send(chan, odometry->time_usec, odometry->frame_id, odometry->child_frame_id, odometry->x, odometry->y, odometry->z, odometry->q, odometry->vx, odometry->vy, odometry->vz, odometry->rollspeed, odometry->pitchspeed, odometry->yawspeed, odometry->pose_covariance, odometry->velocity_covariance, odometry->reset_counter, odometry->estimator_type, odometry->quality); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ODOMETRY, (const char *)odometry, MAVLINK_MSG_ID_ODOMETRY_MIN_LEN, MAVLINK_MSG_ID_ODOMETRY_LEN, MAVLINK_MSG_ID_ODOMETRY_CRC); #endif @@ -346,13 +454,13 @@ static inline void mavlink_msg_odometry_send_struct(mavlink_channel_t chan, cons #if MAVLINK_MSG_ID_ODOMETRY_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_odometry_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint8_t frame_id, uint8_t child_frame_id, float x, float y, float z, const float *q, float vx, float vy, float vz, float rollspeed, float pitchspeed, float yawspeed, const float *pose_covariance, const float *velocity_covariance, uint8_t reset_counter, uint8_t estimator_type) +static inline void mavlink_msg_odometry_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint8_t frame_id, uint8_t child_frame_id, float x, float y, float z, const float *q, float vx, float vy, float vz, float rollspeed, float pitchspeed, float yawspeed, const float *pose_covariance, const float *velocity_covariance, uint8_t reset_counter, uint8_t estimator_type, int8_t quality) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; @@ -370,6 +478,7 @@ static inline void mavlink_msg_odometry_send_buf(mavlink_message_t *msgbuf, mavl _mav_put_uint8_t(buf, 229, child_frame_id); _mav_put_uint8_t(buf, 230, reset_counter); _mav_put_uint8_t(buf, 231, estimator_type); + _mav_put_int8_t(buf, 232, quality); _mav_put_float_array(buf, 20, q, 4); _mav_put_float_array(buf, 60, pose_covariance, 21); _mav_put_float_array(buf, 144, velocity_covariance, 21); @@ -390,9 +499,10 @@ static inline void mavlink_msg_odometry_send_buf(mavlink_message_t *msgbuf, mavl packet->child_frame_id = child_frame_id; packet->reset_counter = reset_counter; packet->estimator_type = estimator_type; - mav_array_memcpy(packet->q, q, sizeof(float)*4); - mav_array_memcpy(packet->pose_covariance, pose_covariance, sizeof(float)*21); - mav_array_memcpy(packet->velocity_covariance, velocity_covariance, sizeof(float)*21); + packet->quality = quality; + mav_array_assign_float(packet->q, q, 4); + mav_array_assign_float(packet->pose_covariance, pose_covariance, 21); + mav_array_assign_float(packet->velocity_covariance, velocity_covariance, 21); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ODOMETRY, (const char *)packet, MAVLINK_MSG_ID_ODOMETRY_MIN_LEN, MAVLINK_MSG_ID_ODOMETRY_LEN, MAVLINK_MSG_ID_ODOMETRY_CRC); #endif } @@ -573,6 +683,16 @@ static inline uint8_t mavlink_msg_odometry_get_estimator_type(const mavlink_mess return _MAV_RETURN_uint8_t(msg, 231); } +/** + * @brief Get field quality from odometry message + * + * @return [%] Optional odometry quality metric as a percentage. -1 = odometry has failed, 0 = unknown/unset quality, 1 = worst quality, 100 = best quality + */ +static inline int8_t mavlink_msg_odometry_get_quality(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int8_t(msg, 232); +} + /** * @brief Decode a odometry message into a struct * @@ -599,6 +719,7 @@ static inline void mavlink_msg_odometry_decode(const mavlink_message_t* msg, mav odometry->child_frame_id = mavlink_msg_odometry_get_child_frame_id(msg); odometry->reset_counter = mavlink_msg_odometry_get_reset_counter(msg); odometry->estimator_type = mavlink_msg_odometry_get_estimator_type(msg); + odometry->quality = mavlink_msg_odometry_get_quality(msg); #else uint8_t len = msg->len < MAVLINK_MSG_ID_ODOMETRY_LEN? msg->len : MAVLINK_MSG_ID_ODOMETRY_LEN; memset(odometry, 0, MAVLINK_MSG_ID_ODOMETRY_LEN); diff --git a/common/mavlink_msg_onboard_computer_status.h b/common/mavlink_msg_onboard_computer_status.h index 6da258142..008aac314 100644 --- a/common/mavlink_msg_onboard_computer_status.h +++ b/common/mavlink_msg_onboard_computer_status.h @@ -25,11 +25,12 @@ typedef struct __mavlink_onboard_computer_status_t { uint8_t gpu_combined[10]; /*< Combined GPU usage as the last 10 slices of 100 MS (a histogram). This allows to identify spikes in load that max out the system, but only for a short amount of time. A value of UINT8_MAX implies the field is unused.*/ int8_t temperature_board; /*< [degC] Temperature of the board. A value of INT8_MAX implies the field is unused.*/ int8_t temperature_core[8]; /*< [degC] Temperature of the CPU core. A value of INT8_MAX implies the field is unused.*/ + uint16_t status_flags; /*< Bitmap of status flags.*/ } mavlink_onboard_computer_status_t; -#define MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN 238 +#define MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN 240 #define MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_MIN_LEN 238 -#define MAVLINK_MSG_ID_390_LEN 238 +#define MAVLINK_MSG_ID_390_LEN 240 #define MAVLINK_MSG_ID_390_MIN_LEN 238 #define MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_CRC 156 @@ -54,7 +55,7 @@ typedef struct __mavlink_onboard_computer_status_t { #define MAVLINK_MESSAGE_INFO_ONBOARD_COMPUTER_STATUS { \ 390, \ "ONBOARD_COMPUTER_STATUS", \ - 20, \ + 21, \ { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_onboard_computer_status_t, time_usec) }, \ { "uptime", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_onboard_computer_status_t, uptime) }, \ { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 196, offsetof(mavlink_onboard_computer_status_t, type) }, \ @@ -75,12 +76,13 @@ typedef struct __mavlink_onboard_computer_status_t { { "link_rx_rate", NULL, MAVLINK_TYPE_UINT32_T, 6, 116, offsetof(mavlink_onboard_computer_status_t, link_rx_rate) }, \ { "link_tx_max", NULL, MAVLINK_TYPE_UINT32_T, 6, 140, offsetof(mavlink_onboard_computer_status_t, link_tx_max) }, \ { "link_rx_max", NULL, MAVLINK_TYPE_UINT32_T, 6, 164, offsetof(mavlink_onboard_computer_status_t, link_rx_max) }, \ + { "status_flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 238, offsetof(mavlink_onboard_computer_status_t, status_flags) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_ONBOARD_COMPUTER_STATUS { \ "ONBOARD_COMPUTER_STATUS", \ - 20, \ + 21, \ { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_onboard_computer_status_t, time_usec) }, \ { "uptime", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_onboard_computer_status_t, uptime) }, \ { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 196, offsetof(mavlink_onboard_computer_status_t, type) }, \ @@ -101,6 +103,7 @@ typedef struct __mavlink_onboard_computer_status_t { { "link_rx_rate", NULL, MAVLINK_TYPE_UINT32_T, 6, 116, offsetof(mavlink_onboard_computer_status_t, link_rx_rate) }, \ { "link_tx_max", NULL, MAVLINK_TYPE_UINT32_T, 6, 140, offsetof(mavlink_onboard_computer_status_t, link_tx_max) }, \ { "link_rx_max", NULL, MAVLINK_TYPE_UINT32_T, 6, 164, offsetof(mavlink_onboard_computer_status_t, link_rx_max) }, \ + { "status_flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 238, offsetof(mavlink_onboard_computer_status_t, status_flags) }, \ } \ } #endif @@ -131,10 +134,11 @@ typedef struct __mavlink_onboard_computer_status_t { * @param link_rx_rate [KiB/s] Network traffic to the component system. A value of UINT32_MAX implies the field is unused. * @param link_tx_max [KiB/s] Network capacity from the component system. A value of UINT32_MAX implies the field is unused. * @param link_rx_max [KiB/s] Network capacity to the component system. A value of UINT32_MAX implies the field is unused. + * @param status_flags Bitmap of status flags. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_onboard_computer_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint64_t time_usec, uint32_t uptime, uint8_t type, const uint8_t *cpu_cores, const uint8_t *cpu_combined, const uint8_t *gpu_cores, const uint8_t *gpu_combined, int8_t temperature_board, const int8_t *temperature_core, const int16_t *fan_speed, uint32_t ram_usage, uint32_t ram_total, const uint32_t *storage_type, const uint32_t *storage_usage, const uint32_t *storage_total, const uint32_t *link_type, const uint32_t *link_tx_rate, const uint32_t *link_rx_rate, const uint32_t *link_tx_max, const uint32_t *link_rx_max) + uint64_t time_usec, uint32_t uptime, uint8_t type, const uint8_t *cpu_cores, const uint8_t *cpu_combined, const uint8_t *gpu_cores, const uint8_t *gpu_combined, int8_t temperature_board, const int8_t *temperature_core, const int16_t *fan_speed, uint32_t ram_usage, uint32_t ram_total, const uint32_t *storage_type, const uint32_t *storage_usage, const uint32_t *storage_total, const uint32_t *link_type, const uint32_t *link_tx_rate, const uint32_t *link_rx_rate, const uint32_t *link_tx_max, const uint32_t *link_rx_max, uint16_t status_flags) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN]; @@ -144,6 +148,7 @@ static inline uint16_t mavlink_msg_onboard_computer_status_pack(uint8_t system_i _mav_put_uint32_t(buf, 16, ram_total); _mav_put_uint8_t(buf, 196, type); _mav_put_int8_t(buf, 229, temperature_board); + _mav_put_uint16_t(buf, 238, status_flags); _mav_put_uint32_t_array(buf, 20, storage_type, 4); _mav_put_uint32_t_array(buf, 36, storage_usage, 4); _mav_put_uint32_t_array(buf, 52, storage_total, 4); @@ -167,6 +172,94 @@ static inline uint16_t mavlink_msg_onboard_computer_status_pack(uint8_t system_i packet.ram_total = ram_total; packet.type = type; packet.temperature_board = temperature_board; + packet.status_flags = status_flags; + mav_array_assign_uint32_t(packet.storage_type, storage_type, 4); + mav_array_assign_uint32_t(packet.storage_usage, storage_usage, 4); + mav_array_assign_uint32_t(packet.storage_total, storage_total, 4); + mav_array_assign_uint32_t(packet.link_type, link_type, 6); + mav_array_assign_uint32_t(packet.link_tx_rate, link_tx_rate, 6); + mav_array_assign_uint32_t(packet.link_rx_rate, link_rx_rate, 6); + mav_array_assign_uint32_t(packet.link_tx_max, link_tx_max, 6); + mav_array_assign_uint32_t(packet.link_rx_max, link_rx_max, 6); + mav_array_assign_int16_t(packet.fan_speed, fan_speed, 4); + mav_array_assign_uint8_t(packet.cpu_cores, cpu_cores, 8); + mav_array_assign_uint8_t(packet.cpu_combined, cpu_combined, 10); + mav_array_assign_uint8_t(packet.gpu_cores, gpu_cores, 4); + mav_array_assign_uint8_t(packet.gpu_combined, gpu_combined, 10); + mav_array_assign_int8_t(packet.temperature_core, temperature_core, 8); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_MIN_LEN, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_CRC); +} + +/** + * @brief Pack a onboard_computer_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param uptime [ms] Time since system boot. + * @param type Type of the onboard computer: 0: Mission computer primary, 1: Mission computer backup 1, 2: Mission computer backup 2, 3: Compute node, 4-5: Compute spares, 6-9: Payload computers. + * @param cpu_cores CPU usage on the component in percent (100 - idle). A value of UINT8_MAX implies the field is unused. + * @param cpu_combined Combined CPU usage as the last 10 slices of 100 MS (a histogram). This allows to identify spikes in load that max out the system, but only for a short amount of time. A value of UINT8_MAX implies the field is unused. + * @param gpu_cores GPU usage on the component in percent (100 - idle). A value of UINT8_MAX implies the field is unused. + * @param gpu_combined Combined GPU usage as the last 10 slices of 100 MS (a histogram). This allows to identify spikes in load that max out the system, but only for a short amount of time. A value of UINT8_MAX implies the field is unused. + * @param temperature_board [degC] Temperature of the board. A value of INT8_MAX implies the field is unused. + * @param temperature_core [degC] Temperature of the CPU core. A value of INT8_MAX implies the field is unused. + * @param fan_speed [rpm] Fan speeds. A value of INT16_MAX implies the field is unused. + * @param ram_usage [MiB] Amount of used RAM on the component system. A value of UINT32_MAX implies the field is unused. + * @param ram_total [MiB] Total amount of RAM on the component system. A value of UINT32_MAX implies the field is unused. + * @param storage_type Storage type: 0: HDD, 1: SSD, 2: EMMC, 3: SD card (non-removable), 4: SD card (removable). A value of UINT32_MAX implies the field is unused. + * @param storage_usage [MiB] Amount of used storage space on the component system. A value of UINT32_MAX implies the field is unused. + * @param storage_total [MiB] Total amount of storage space on the component system. A value of UINT32_MAX implies the field is unused. + * @param link_type Link type: 0-9: UART, 10-19: Wired network, 20-29: Wifi, 30-39: Point-to-point proprietary, 40-49: Mesh proprietary + * @param link_tx_rate [KiB/s] Network traffic from the component system. A value of UINT32_MAX implies the field is unused. + * @param link_rx_rate [KiB/s] Network traffic to the component system. A value of UINT32_MAX implies the field is unused. + * @param link_tx_max [KiB/s] Network capacity from the component system. A value of UINT32_MAX implies the field is unused. + * @param link_rx_max [KiB/s] Network capacity to the component system. A value of UINT32_MAX implies the field is unused. + * @param status_flags Bitmap of status flags. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_onboard_computer_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, uint32_t uptime, uint8_t type, const uint8_t *cpu_cores, const uint8_t *cpu_combined, const uint8_t *gpu_cores, const uint8_t *gpu_combined, int8_t temperature_board, const int8_t *temperature_core, const int16_t *fan_speed, uint32_t ram_usage, uint32_t ram_total, const uint32_t *storage_type, const uint32_t *storage_usage, const uint32_t *storage_total, const uint32_t *link_type, const uint32_t *link_tx_rate, const uint32_t *link_rx_rate, const uint32_t *link_tx_max, const uint32_t *link_rx_max, uint16_t status_flags) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint32_t(buf, 8, uptime); + _mav_put_uint32_t(buf, 12, ram_usage); + _mav_put_uint32_t(buf, 16, ram_total); + _mav_put_uint8_t(buf, 196, type); + _mav_put_int8_t(buf, 229, temperature_board); + _mav_put_uint16_t(buf, 238, status_flags); + _mav_put_uint32_t_array(buf, 20, storage_type, 4); + _mav_put_uint32_t_array(buf, 36, storage_usage, 4); + _mav_put_uint32_t_array(buf, 52, storage_total, 4); + _mav_put_uint32_t_array(buf, 68, link_type, 6); + _mav_put_uint32_t_array(buf, 92, link_tx_rate, 6); + _mav_put_uint32_t_array(buf, 116, link_rx_rate, 6); + _mav_put_uint32_t_array(buf, 140, link_tx_max, 6); + _mav_put_uint32_t_array(buf, 164, link_rx_max, 6); + _mav_put_int16_t_array(buf, 188, fan_speed, 4); + _mav_put_uint8_t_array(buf, 197, cpu_cores, 8); + _mav_put_uint8_t_array(buf, 205, cpu_combined, 10); + _mav_put_uint8_t_array(buf, 215, gpu_cores, 4); + _mav_put_uint8_t_array(buf, 219, gpu_combined, 10); + _mav_put_int8_t_array(buf, 230, temperature_core, 8); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN); +#else + mavlink_onboard_computer_status_t packet; + packet.time_usec = time_usec; + packet.uptime = uptime; + packet.ram_usage = ram_usage; + packet.ram_total = ram_total; + packet.type = type; + packet.temperature_board = temperature_board; + packet.status_flags = status_flags; mav_array_memcpy(packet.storage_type, storage_type, sizeof(uint32_t)*4); mav_array_memcpy(packet.storage_usage, storage_usage, sizeof(uint32_t)*4); mav_array_memcpy(packet.storage_total, storage_total, sizeof(uint32_t)*4); @@ -185,7 +278,11 @@ static inline uint16_t mavlink_msg_onboard_computer_status_pack(uint8_t system_i #endif msg->msgid = MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_MIN_LEN, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_CRC); +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_MIN_LEN, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_MIN_LEN, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN); +#endif } /** @@ -214,11 +311,12 @@ static inline uint16_t mavlink_msg_onboard_computer_status_pack(uint8_t system_i * @param link_rx_rate [KiB/s] Network traffic to the component system. A value of UINT32_MAX implies the field is unused. * @param link_tx_max [KiB/s] Network capacity from the component system. A value of UINT32_MAX implies the field is unused. * @param link_rx_max [KiB/s] Network capacity to the component system. A value of UINT32_MAX implies the field is unused. + * @param status_flags Bitmap of status flags. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_onboard_computer_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - uint64_t time_usec,uint32_t uptime,uint8_t type,const uint8_t *cpu_cores,const uint8_t *cpu_combined,const uint8_t *gpu_cores,const uint8_t *gpu_combined,int8_t temperature_board,const int8_t *temperature_core,const int16_t *fan_speed,uint32_t ram_usage,uint32_t ram_total,const uint32_t *storage_type,const uint32_t *storage_usage,const uint32_t *storage_total,const uint32_t *link_type,const uint32_t *link_tx_rate,const uint32_t *link_rx_rate,const uint32_t *link_tx_max,const uint32_t *link_rx_max) + uint64_t time_usec,uint32_t uptime,uint8_t type,const uint8_t *cpu_cores,const uint8_t *cpu_combined,const uint8_t *gpu_cores,const uint8_t *gpu_combined,int8_t temperature_board,const int8_t *temperature_core,const int16_t *fan_speed,uint32_t ram_usage,uint32_t ram_total,const uint32_t *storage_type,const uint32_t *storage_usage,const uint32_t *storage_total,const uint32_t *link_type,const uint32_t *link_tx_rate,const uint32_t *link_rx_rate,const uint32_t *link_tx_max,const uint32_t *link_rx_max,uint16_t status_flags) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN]; @@ -228,6 +326,7 @@ static inline uint16_t mavlink_msg_onboard_computer_status_pack_chan(uint8_t sys _mav_put_uint32_t(buf, 16, ram_total); _mav_put_uint8_t(buf, 196, type); _mav_put_int8_t(buf, 229, temperature_board); + _mav_put_uint16_t(buf, 238, status_flags); _mav_put_uint32_t_array(buf, 20, storage_type, 4); _mav_put_uint32_t_array(buf, 36, storage_usage, 4); _mav_put_uint32_t_array(buf, 52, storage_total, 4); @@ -251,20 +350,21 @@ static inline uint16_t mavlink_msg_onboard_computer_status_pack_chan(uint8_t sys packet.ram_total = ram_total; packet.type = type; packet.temperature_board = temperature_board; - mav_array_memcpy(packet.storage_type, storage_type, sizeof(uint32_t)*4); - mav_array_memcpy(packet.storage_usage, storage_usage, sizeof(uint32_t)*4); - mav_array_memcpy(packet.storage_total, storage_total, sizeof(uint32_t)*4); - mav_array_memcpy(packet.link_type, link_type, sizeof(uint32_t)*6); - mav_array_memcpy(packet.link_tx_rate, link_tx_rate, sizeof(uint32_t)*6); - mav_array_memcpy(packet.link_rx_rate, link_rx_rate, sizeof(uint32_t)*6); - mav_array_memcpy(packet.link_tx_max, link_tx_max, sizeof(uint32_t)*6); - mav_array_memcpy(packet.link_rx_max, link_rx_max, sizeof(uint32_t)*6); - mav_array_memcpy(packet.fan_speed, fan_speed, sizeof(int16_t)*4); - mav_array_memcpy(packet.cpu_cores, cpu_cores, sizeof(uint8_t)*8); - mav_array_memcpy(packet.cpu_combined, cpu_combined, sizeof(uint8_t)*10); - mav_array_memcpy(packet.gpu_cores, gpu_cores, sizeof(uint8_t)*4); - mav_array_memcpy(packet.gpu_combined, gpu_combined, sizeof(uint8_t)*10); - mav_array_memcpy(packet.temperature_core, temperature_core, sizeof(int8_t)*8); + packet.status_flags = status_flags; + mav_array_assign_uint32_t(packet.storage_type, storage_type, 4); + mav_array_assign_uint32_t(packet.storage_usage, storage_usage, 4); + mav_array_assign_uint32_t(packet.storage_total, storage_total, 4); + mav_array_assign_uint32_t(packet.link_type, link_type, 6); + mav_array_assign_uint32_t(packet.link_tx_rate, link_tx_rate, 6); + mav_array_assign_uint32_t(packet.link_rx_rate, link_rx_rate, 6); + mav_array_assign_uint32_t(packet.link_tx_max, link_tx_max, 6); + mav_array_assign_uint32_t(packet.link_rx_max, link_rx_max, 6); + mav_array_assign_int16_t(packet.fan_speed, fan_speed, 4); + mav_array_assign_uint8_t(packet.cpu_cores, cpu_cores, 8); + mav_array_assign_uint8_t(packet.cpu_combined, cpu_combined, 10); + mav_array_assign_uint8_t(packet.gpu_cores, gpu_cores, 4); + mav_array_assign_uint8_t(packet.gpu_combined, gpu_combined, 10); + mav_array_assign_int8_t(packet.temperature_core, temperature_core, 8); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN); #endif @@ -282,7 +382,7 @@ static inline uint16_t mavlink_msg_onboard_computer_status_pack_chan(uint8_t sys */ static inline uint16_t mavlink_msg_onboard_computer_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_onboard_computer_status_t* onboard_computer_status) { - return mavlink_msg_onboard_computer_status_pack(system_id, component_id, msg, onboard_computer_status->time_usec, onboard_computer_status->uptime, onboard_computer_status->type, onboard_computer_status->cpu_cores, onboard_computer_status->cpu_combined, onboard_computer_status->gpu_cores, onboard_computer_status->gpu_combined, onboard_computer_status->temperature_board, onboard_computer_status->temperature_core, onboard_computer_status->fan_speed, onboard_computer_status->ram_usage, onboard_computer_status->ram_total, onboard_computer_status->storage_type, onboard_computer_status->storage_usage, onboard_computer_status->storage_total, onboard_computer_status->link_type, onboard_computer_status->link_tx_rate, onboard_computer_status->link_rx_rate, onboard_computer_status->link_tx_max, onboard_computer_status->link_rx_max); + return mavlink_msg_onboard_computer_status_pack(system_id, component_id, msg, onboard_computer_status->time_usec, onboard_computer_status->uptime, onboard_computer_status->type, onboard_computer_status->cpu_cores, onboard_computer_status->cpu_combined, onboard_computer_status->gpu_cores, onboard_computer_status->gpu_combined, onboard_computer_status->temperature_board, onboard_computer_status->temperature_core, onboard_computer_status->fan_speed, onboard_computer_status->ram_usage, onboard_computer_status->ram_total, onboard_computer_status->storage_type, onboard_computer_status->storage_usage, onboard_computer_status->storage_total, onboard_computer_status->link_type, onboard_computer_status->link_tx_rate, onboard_computer_status->link_rx_rate, onboard_computer_status->link_tx_max, onboard_computer_status->link_rx_max, onboard_computer_status->status_flags); } /** @@ -296,7 +396,21 @@ static inline uint16_t mavlink_msg_onboard_computer_status_encode(uint8_t system */ static inline uint16_t mavlink_msg_onboard_computer_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_onboard_computer_status_t* onboard_computer_status) { - return mavlink_msg_onboard_computer_status_pack_chan(system_id, component_id, chan, msg, onboard_computer_status->time_usec, onboard_computer_status->uptime, onboard_computer_status->type, onboard_computer_status->cpu_cores, onboard_computer_status->cpu_combined, onboard_computer_status->gpu_cores, onboard_computer_status->gpu_combined, onboard_computer_status->temperature_board, onboard_computer_status->temperature_core, onboard_computer_status->fan_speed, onboard_computer_status->ram_usage, onboard_computer_status->ram_total, onboard_computer_status->storage_type, onboard_computer_status->storage_usage, onboard_computer_status->storage_total, onboard_computer_status->link_type, onboard_computer_status->link_tx_rate, onboard_computer_status->link_rx_rate, onboard_computer_status->link_tx_max, onboard_computer_status->link_rx_max); + return mavlink_msg_onboard_computer_status_pack_chan(system_id, component_id, chan, msg, onboard_computer_status->time_usec, onboard_computer_status->uptime, onboard_computer_status->type, onboard_computer_status->cpu_cores, onboard_computer_status->cpu_combined, onboard_computer_status->gpu_cores, onboard_computer_status->gpu_combined, onboard_computer_status->temperature_board, onboard_computer_status->temperature_core, onboard_computer_status->fan_speed, onboard_computer_status->ram_usage, onboard_computer_status->ram_total, onboard_computer_status->storage_type, onboard_computer_status->storage_usage, onboard_computer_status->storage_total, onboard_computer_status->link_type, onboard_computer_status->link_tx_rate, onboard_computer_status->link_rx_rate, onboard_computer_status->link_tx_max, onboard_computer_status->link_rx_max, onboard_computer_status->status_flags); +} + +/** + * @brief Encode a onboard_computer_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param onboard_computer_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_onboard_computer_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_onboard_computer_status_t* onboard_computer_status) +{ + return mavlink_msg_onboard_computer_status_pack_status(system_id, component_id, _status, msg, onboard_computer_status->time_usec, onboard_computer_status->uptime, onboard_computer_status->type, onboard_computer_status->cpu_cores, onboard_computer_status->cpu_combined, onboard_computer_status->gpu_cores, onboard_computer_status->gpu_combined, onboard_computer_status->temperature_board, onboard_computer_status->temperature_core, onboard_computer_status->fan_speed, onboard_computer_status->ram_usage, onboard_computer_status->ram_total, onboard_computer_status->storage_type, onboard_computer_status->storage_usage, onboard_computer_status->storage_total, onboard_computer_status->link_type, onboard_computer_status->link_tx_rate, onboard_computer_status->link_rx_rate, onboard_computer_status->link_tx_max, onboard_computer_status->link_rx_max, onboard_computer_status->status_flags); } /** @@ -323,10 +437,11 @@ static inline uint16_t mavlink_msg_onboard_computer_status_encode_chan(uint8_t s * @param link_rx_rate [KiB/s] Network traffic to the component system. A value of UINT32_MAX implies the field is unused. * @param link_tx_max [KiB/s] Network capacity from the component system. A value of UINT32_MAX implies the field is unused. * @param link_rx_max [KiB/s] Network capacity to the component system. A value of UINT32_MAX implies the field is unused. + * @param status_flags Bitmap of status flags. */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_onboard_computer_status_send(mavlink_channel_t chan, uint64_t time_usec, uint32_t uptime, uint8_t type, const uint8_t *cpu_cores, const uint8_t *cpu_combined, const uint8_t *gpu_cores, const uint8_t *gpu_combined, int8_t temperature_board, const int8_t *temperature_core, const int16_t *fan_speed, uint32_t ram_usage, uint32_t ram_total, const uint32_t *storage_type, const uint32_t *storage_usage, const uint32_t *storage_total, const uint32_t *link_type, const uint32_t *link_tx_rate, const uint32_t *link_rx_rate, const uint32_t *link_tx_max, const uint32_t *link_rx_max) +static inline void mavlink_msg_onboard_computer_status_send(mavlink_channel_t chan, uint64_t time_usec, uint32_t uptime, uint8_t type, const uint8_t *cpu_cores, const uint8_t *cpu_combined, const uint8_t *gpu_cores, const uint8_t *gpu_combined, int8_t temperature_board, const int8_t *temperature_core, const int16_t *fan_speed, uint32_t ram_usage, uint32_t ram_total, const uint32_t *storage_type, const uint32_t *storage_usage, const uint32_t *storage_total, const uint32_t *link_type, const uint32_t *link_tx_rate, const uint32_t *link_rx_rate, const uint32_t *link_tx_max, const uint32_t *link_rx_max, uint16_t status_flags) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN]; @@ -336,6 +451,7 @@ static inline void mavlink_msg_onboard_computer_status_send(mavlink_channel_t ch _mav_put_uint32_t(buf, 16, ram_total); _mav_put_uint8_t(buf, 196, type); _mav_put_int8_t(buf, 229, temperature_board); + _mav_put_uint16_t(buf, 238, status_flags); _mav_put_uint32_t_array(buf, 20, storage_type, 4); _mav_put_uint32_t_array(buf, 36, storage_usage, 4); _mav_put_uint32_t_array(buf, 52, storage_total, 4); @@ -359,20 +475,21 @@ static inline void mavlink_msg_onboard_computer_status_send(mavlink_channel_t ch packet.ram_total = ram_total; packet.type = type; packet.temperature_board = temperature_board; - mav_array_memcpy(packet.storage_type, storage_type, sizeof(uint32_t)*4); - mav_array_memcpy(packet.storage_usage, storage_usage, sizeof(uint32_t)*4); - mav_array_memcpy(packet.storage_total, storage_total, sizeof(uint32_t)*4); - mav_array_memcpy(packet.link_type, link_type, sizeof(uint32_t)*6); - mav_array_memcpy(packet.link_tx_rate, link_tx_rate, sizeof(uint32_t)*6); - mav_array_memcpy(packet.link_rx_rate, link_rx_rate, sizeof(uint32_t)*6); - mav_array_memcpy(packet.link_tx_max, link_tx_max, sizeof(uint32_t)*6); - mav_array_memcpy(packet.link_rx_max, link_rx_max, sizeof(uint32_t)*6); - mav_array_memcpy(packet.fan_speed, fan_speed, sizeof(int16_t)*4); - mav_array_memcpy(packet.cpu_cores, cpu_cores, sizeof(uint8_t)*8); - mav_array_memcpy(packet.cpu_combined, cpu_combined, sizeof(uint8_t)*10); - mav_array_memcpy(packet.gpu_cores, gpu_cores, sizeof(uint8_t)*4); - mav_array_memcpy(packet.gpu_combined, gpu_combined, sizeof(uint8_t)*10); - mav_array_memcpy(packet.temperature_core, temperature_core, sizeof(int8_t)*8); + packet.status_flags = status_flags; + mav_array_assign_uint32_t(packet.storage_type, storage_type, 4); + mav_array_assign_uint32_t(packet.storage_usage, storage_usage, 4); + mav_array_assign_uint32_t(packet.storage_total, storage_total, 4); + mav_array_assign_uint32_t(packet.link_type, link_type, 6); + mav_array_assign_uint32_t(packet.link_tx_rate, link_tx_rate, 6); + mav_array_assign_uint32_t(packet.link_rx_rate, link_rx_rate, 6); + mav_array_assign_uint32_t(packet.link_tx_max, link_tx_max, 6); + mav_array_assign_uint32_t(packet.link_rx_max, link_rx_max, 6); + mav_array_assign_int16_t(packet.fan_speed, fan_speed, 4); + mav_array_assign_uint8_t(packet.cpu_cores, cpu_cores, 8); + mav_array_assign_uint8_t(packet.cpu_combined, cpu_combined, 10); + mav_array_assign_uint8_t(packet.gpu_cores, gpu_cores, 4); + mav_array_assign_uint8_t(packet.gpu_combined, gpu_combined, 10); + mav_array_assign_int8_t(packet.temperature_core, temperature_core, 8); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS, (const char *)&packet, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_MIN_LEN, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_CRC); #endif } @@ -385,7 +502,7 @@ static inline void mavlink_msg_onboard_computer_status_send(mavlink_channel_t ch static inline void mavlink_msg_onboard_computer_status_send_struct(mavlink_channel_t chan, const mavlink_onboard_computer_status_t* onboard_computer_status) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_onboard_computer_status_send(chan, onboard_computer_status->time_usec, onboard_computer_status->uptime, onboard_computer_status->type, onboard_computer_status->cpu_cores, onboard_computer_status->cpu_combined, onboard_computer_status->gpu_cores, onboard_computer_status->gpu_combined, onboard_computer_status->temperature_board, onboard_computer_status->temperature_core, onboard_computer_status->fan_speed, onboard_computer_status->ram_usage, onboard_computer_status->ram_total, onboard_computer_status->storage_type, onboard_computer_status->storage_usage, onboard_computer_status->storage_total, onboard_computer_status->link_type, onboard_computer_status->link_tx_rate, onboard_computer_status->link_rx_rate, onboard_computer_status->link_tx_max, onboard_computer_status->link_rx_max); + mavlink_msg_onboard_computer_status_send(chan, onboard_computer_status->time_usec, onboard_computer_status->uptime, onboard_computer_status->type, onboard_computer_status->cpu_cores, onboard_computer_status->cpu_combined, onboard_computer_status->gpu_cores, onboard_computer_status->gpu_combined, onboard_computer_status->temperature_board, onboard_computer_status->temperature_core, onboard_computer_status->fan_speed, onboard_computer_status->ram_usage, onboard_computer_status->ram_total, onboard_computer_status->storage_type, onboard_computer_status->storage_usage, onboard_computer_status->storage_total, onboard_computer_status->link_type, onboard_computer_status->link_tx_rate, onboard_computer_status->link_rx_rate, onboard_computer_status->link_tx_max, onboard_computer_status->link_rx_max, onboard_computer_status->status_flags); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS, (const char *)onboard_computer_status, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_MIN_LEN, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_CRC); #endif @@ -393,13 +510,13 @@ static inline void mavlink_msg_onboard_computer_status_send_struct(mavlink_chann #if MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_onboard_computer_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint32_t uptime, uint8_t type, const uint8_t *cpu_cores, const uint8_t *cpu_combined, const uint8_t *gpu_cores, const uint8_t *gpu_combined, int8_t temperature_board, const int8_t *temperature_core, const int16_t *fan_speed, uint32_t ram_usage, uint32_t ram_total, const uint32_t *storage_type, const uint32_t *storage_usage, const uint32_t *storage_total, const uint32_t *link_type, const uint32_t *link_tx_rate, const uint32_t *link_rx_rate, const uint32_t *link_tx_max, const uint32_t *link_rx_max) +static inline void mavlink_msg_onboard_computer_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint32_t uptime, uint8_t type, const uint8_t *cpu_cores, const uint8_t *cpu_combined, const uint8_t *gpu_cores, const uint8_t *gpu_combined, int8_t temperature_board, const int8_t *temperature_core, const int16_t *fan_speed, uint32_t ram_usage, uint32_t ram_total, const uint32_t *storage_type, const uint32_t *storage_usage, const uint32_t *storage_total, const uint32_t *link_type, const uint32_t *link_tx_rate, const uint32_t *link_rx_rate, const uint32_t *link_tx_max, const uint32_t *link_rx_max, uint16_t status_flags) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; @@ -409,6 +526,7 @@ static inline void mavlink_msg_onboard_computer_status_send_buf(mavlink_message_ _mav_put_uint32_t(buf, 16, ram_total); _mav_put_uint8_t(buf, 196, type); _mav_put_int8_t(buf, 229, temperature_board); + _mav_put_uint16_t(buf, 238, status_flags); _mav_put_uint32_t_array(buf, 20, storage_type, 4); _mav_put_uint32_t_array(buf, 36, storage_usage, 4); _mav_put_uint32_t_array(buf, 52, storage_total, 4); @@ -432,20 +550,21 @@ static inline void mavlink_msg_onboard_computer_status_send_buf(mavlink_message_ packet->ram_total = ram_total; packet->type = type; packet->temperature_board = temperature_board; - mav_array_memcpy(packet->storage_type, storage_type, sizeof(uint32_t)*4); - mav_array_memcpy(packet->storage_usage, storage_usage, sizeof(uint32_t)*4); - mav_array_memcpy(packet->storage_total, storage_total, sizeof(uint32_t)*4); - mav_array_memcpy(packet->link_type, link_type, sizeof(uint32_t)*6); - mav_array_memcpy(packet->link_tx_rate, link_tx_rate, sizeof(uint32_t)*6); - mav_array_memcpy(packet->link_rx_rate, link_rx_rate, sizeof(uint32_t)*6); - mav_array_memcpy(packet->link_tx_max, link_tx_max, sizeof(uint32_t)*6); - mav_array_memcpy(packet->link_rx_max, link_rx_max, sizeof(uint32_t)*6); - mav_array_memcpy(packet->fan_speed, fan_speed, sizeof(int16_t)*4); - mav_array_memcpy(packet->cpu_cores, cpu_cores, sizeof(uint8_t)*8); - mav_array_memcpy(packet->cpu_combined, cpu_combined, sizeof(uint8_t)*10); - mav_array_memcpy(packet->gpu_cores, gpu_cores, sizeof(uint8_t)*4); - mav_array_memcpy(packet->gpu_combined, gpu_combined, sizeof(uint8_t)*10); - mav_array_memcpy(packet->temperature_core, temperature_core, sizeof(int8_t)*8); + packet->status_flags = status_flags; + mav_array_assign_uint32_t(packet->storage_type, storage_type, 4); + mav_array_assign_uint32_t(packet->storage_usage, storage_usage, 4); + mav_array_assign_uint32_t(packet->storage_total, storage_total, 4); + mav_array_assign_uint32_t(packet->link_type, link_type, 6); + mav_array_assign_uint32_t(packet->link_tx_rate, link_tx_rate, 6); + mav_array_assign_uint32_t(packet->link_rx_rate, link_rx_rate, 6); + mav_array_assign_uint32_t(packet->link_tx_max, link_tx_max, 6); + mav_array_assign_uint32_t(packet->link_rx_max, link_rx_max, 6); + mav_array_assign_int16_t(packet->fan_speed, fan_speed, 4); + mav_array_assign_uint8_t(packet->cpu_cores, cpu_cores, 8); + mav_array_assign_uint8_t(packet->cpu_combined, cpu_combined, 10); + mav_array_assign_uint8_t(packet->gpu_cores, gpu_cores, 4); + mav_array_assign_uint8_t(packet->gpu_combined, gpu_combined, 10); + mav_array_assign_int8_t(packet->temperature_core, temperature_core, 8); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS, (const char *)packet, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_MIN_LEN, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_CRC); #endif } @@ -656,6 +775,16 @@ static inline uint16_t mavlink_msg_onboard_computer_status_get_link_rx_max(const return _MAV_RETURN_uint32_t_array(msg, link_rx_max, 6, 164); } +/** + * @brief Get field status_flags from onboard_computer_status message + * + * @return Bitmap of status flags. + */ +static inline uint16_t mavlink_msg_onboard_computer_status_get_status_flags(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 238); +} + /** * @brief Decode a onboard_computer_status message into a struct * @@ -685,6 +814,7 @@ static inline void mavlink_msg_onboard_computer_status_decode(const mavlink_mess mavlink_msg_onboard_computer_status_get_gpu_combined(msg, onboard_computer_status->gpu_combined); onboard_computer_status->temperature_board = mavlink_msg_onboard_computer_status_get_temperature_board(msg); mavlink_msg_onboard_computer_status_get_temperature_core(msg, onboard_computer_status->temperature_core); + onboard_computer_status->status_flags = mavlink_msg_onboard_computer_status_get_status_flags(msg); #else uint8_t len = msg->len < MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN? msg->len : MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN; memset(onboard_computer_status, 0, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN); diff --git a/common/mavlink_msg_open_drone_id_arm_status.h b/common/mavlink_msg_open_drone_id_arm_status.h new file mode 100644 index 000000000..8b9f57100 --- /dev/null +++ b/common/mavlink_msg_open_drone_id_arm_status.h @@ -0,0 +1,278 @@ +#pragma once +// MESSAGE OPEN_DRONE_ID_ARM_STATUS PACKING + +#define MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS 12918 + + +typedef struct __mavlink_open_drone_id_arm_status_t { + uint8_t status; /*< Status level indicating if arming is allowed.*/ + char error[50]; /*< Text error message, should be empty if status is good to arm. Fill with nulls in unused portion.*/ +} mavlink_open_drone_id_arm_status_t; + +#define MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_LEN 51 +#define MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_MIN_LEN 51 +#define MAVLINK_MSG_ID_12918_LEN 51 +#define MAVLINK_MSG_ID_12918_MIN_LEN 51 + +#define MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_CRC 139 +#define MAVLINK_MSG_ID_12918_CRC 139 + +#define MAVLINK_MSG_OPEN_DRONE_ID_ARM_STATUS_FIELD_ERROR_LEN 50 + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_ARM_STATUS { \ + 12918, \ + "OPEN_DRONE_ID_ARM_STATUS", \ + 2, \ + { { "status", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_open_drone_id_arm_status_t, status) }, \ + { "error", NULL, MAVLINK_TYPE_CHAR, 50, 1, offsetof(mavlink_open_drone_id_arm_status_t, error) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_ARM_STATUS { \ + "OPEN_DRONE_ID_ARM_STATUS", \ + 2, \ + { { "status", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_open_drone_id_arm_status_t, status) }, \ + { "error", NULL, MAVLINK_TYPE_CHAR, 50, 1, offsetof(mavlink_open_drone_id_arm_status_t, error) }, \ + } \ +} +#endif + +/** + * @brief Pack a open_drone_id_arm_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param status Status level indicating if arming is allowed. + * @param error Text error message, should be empty if status is good to arm. Fill with nulls in unused portion. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_open_drone_id_arm_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t status, const char *error) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_LEN]; + _mav_put_uint8_t(buf, 0, status); + _mav_put_char_array(buf, 1, error, 50); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_LEN); +#else + mavlink_open_drone_id_arm_status_t packet; + packet.status = status; + mav_array_assign_char(packet.error, error, 50); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_CRC); +} + +/** + * @brief Pack a open_drone_id_arm_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param status Status level indicating if arming is allowed. + * @param error Text error message, should be empty if status is good to arm. Fill with nulls in unused portion. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_open_drone_id_arm_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t status, const char *error) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_LEN]; + _mav_put_uint8_t(buf, 0, status); + _mav_put_char_array(buf, 1, error, 50); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_LEN); +#else + mavlink_open_drone_id_arm_status_t packet; + packet.status = status; + mav_array_memcpy(packet.error, error, sizeof(char)*50); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_LEN); +#endif +} + +/** + * @brief Pack a open_drone_id_arm_status message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param status Status level indicating if arming is allowed. + * @param error Text error message, should be empty if status is good to arm. Fill with nulls in unused portion. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_open_drone_id_arm_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t status,const char *error) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_LEN]; + _mav_put_uint8_t(buf, 0, status); + _mav_put_char_array(buf, 1, error, 50); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_LEN); +#else + mavlink_open_drone_id_arm_status_t packet; + packet.status = status; + mav_array_assign_char(packet.error, error, 50); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_CRC); +} + +/** + * @brief Encode a open_drone_id_arm_status struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param open_drone_id_arm_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_open_drone_id_arm_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_open_drone_id_arm_status_t* open_drone_id_arm_status) +{ + return mavlink_msg_open_drone_id_arm_status_pack(system_id, component_id, msg, open_drone_id_arm_status->status, open_drone_id_arm_status->error); +} + +/** + * @brief Encode a open_drone_id_arm_status struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param open_drone_id_arm_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_open_drone_id_arm_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_open_drone_id_arm_status_t* open_drone_id_arm_status) +{ + return mavlink_msg_open_drone_id_arm_status_pack_chan(system_id, component_id, chan, msg, open_drone_id_arm_status->status, open_drone_id_arm_status->error); +} + +/** + * @brief Encode a open_drone_id_arm_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param open_drone_id_arm_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_open_drone_id_arm_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_open_drone_id_arm_status_t* open_drone_id_arm_status) +{ + return mavlink_msg_open_drone_id_arm_status_pack_status(system_id, component_id, _status, msg, open_drone_id_arm_status->status, open_drone_id_arm_status->error); +} + +/** + * @brief Send a open_drone_id_arm_status message + * @param chan MAVLink channel to send the message + * + * @param status Status level indicating if arming is allowed. + * @param error Text error message, should be empty if status is good to arm. Fill with nulls in unused portion. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_open_drone_id_arm_status_send(mavlink_channel_t chan, uint8_t status, const char *error) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_LEN]; + _mav_put_uint8_t(buf, 0, status); + _mav_put_char_array(buf, 1, error, 50); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS, buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_CRC); +#else + mavlink_open_drone_id_arm_status_t packet; + packet.status = status; + mav_array_assign_char(packet.error, error, 50); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS, (const char *)&packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_CRC); +#endif +} + +/** + * @brief Send a open_drone_id_arm_status message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_open_drone_id_arm_status_send_struct(mavlink_channel_t chan, const mavlink_open_drone_id_arm_status_t* open_drone_id_arm_status) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_open_drone_id_arm_status_send(chan, open_drone_id_arm_status->status, open_drone_id_arm_status->error); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS, (const char *)open_drone_id_arm_status, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_CRC); +#endif +} + +#if MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_open_drone_id_arm_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t status, const char *error) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint8_t(buf, 0, status); + _mav_put_char_array(buf, 1, error, 50); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS, buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_CRC); +#else + mavlink_open_drone_id_arm_status_t *packet = (mavlink_open_drone_id_arm_status_t *)msgbuf; + packet->status = status; + mav_array_assign_char(packet->error, error, 50); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS, (const char *)packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_CRC); +#endif +} +#endif + +#endif + +// MESSAGE OPEN_DRONE_ID_ARM_STATUS UNPACKING + + +/** + * @brief Get field status from open_drone_id_arm_status message + * + * @return Status level indicating if arming is allowed. + */ +static inline uint8_t mavlink_msg_open_drone_id_arm_status_get_status(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 0); +} + +/** + * @brief Get field error from open_drone_id_arm_status message + * + * @return Text error message, should be empty if status is good to arm. Fill with nulls in unused portion. + */ +static inline uint16_t mavlink_msg_open_drone_id_arm_status_get_error(const mavlink_message_t* msg, char *error) +{ + return _MAV_RETURN_char_array(msg, error, 50, 1); +} + +/** + * @brief Decode a open_drone_id_arm_status message into a struct + * + * @param msg The message to decode + * @param open_drone_id_arm_status C-struct to decode the message contents into + */ +static inline void mavlink_msg_open_drone_id_arm_status_decode(const mavlink_message_t* msg, mavlink_open_drone_id_arm_status_t* open_drone_id_arm_status) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + open_drone_id_arm_status->status = mavlink_msg_open_drone_id_arm_status_get_status(msg); + mavlink_msg_open_drone_id_arm_status_get_error(msg, open_drone_id_arm_status->error); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_LEN? msg->len : MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_LEN; + memset(open_drone_id_arm_status, 0, MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_LEN); + memcpy(open_drone_id_arm_status, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/common/mavlink_msg_open_drone_id_authentication.h b/common/mavlink_msg_open_drone_id_authentication.h index cd7b68e02..8f1bd42c3 100644 --- a/common/mavlink_msg_open_drone_id_authentication.h +++ b/common/mavlink_msg_open_drone_id_authentication.h @@ -10,9 +10,9 @@ typedef struct __mavlink_open_drone_id_authentication_t { uint8_t target_component; /*< Component ID (0 for broadcast).*/ uint8_t id_or_mac[20]; /*< Only used for drone ID data received from other UAs. See detailed description at https://mavlink.io/en/services/opendroneid.html. */ uint8_t authentication_type; /*< Indicates the type of authentication.*/ - uint8_t data_page; /*< Allowed range is 0 - 4.*/ - uint8_t page_count; /*< This field is only present for page 0. Allowed range is 0 - 5.*/ - uint8_t length; /*< [bytes] This field is only present for page 0. Total bytes of authentication_data from all data pages. Allowed range is 0 - 109 (17 + 23*4).*/ + uint8_t data_page; /*< Allowed range is 0 - 15.*/ + uint8_t last_page_index; /*< This field is only present for page 0. Allowed range is 0 - 15. See the description of struct ODID_Auth_data at https://github.com/opendroneid/opendroneid-core-c/blob/master/libopendroneid/opendroneid.h.*/ + uint8_t length; /*< [bytes] This field is only present for page 0. Total bytes of authentication_data from all data pages. See the description of struct ODID_Auth_data at https://github.com/opendroneid/opendroneid-core-c/blob/master/libopendroneid/opendroneid.h.*/ uint8_t authentication_data[23]; /*< Opaque authentication data. For page 0, the size is only 17 bytes. For other pages, the size is 23 bytes. Shall be filled with nulls in the unused portion of the field.*/ } mavlink_open_drone_id_authentication_t; @@ -21,8 +21,8 @@ typedef struct __mavlink_open_drone_id_authentication_t { #define MAVLINK_MSG_ID_12902_LEN 53 #define MAVLINK_MSG_ID_12902_MIN_LEN 53 -#define MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_CRC 49 -#define MAVLINK_MSG_ID_12902_CRC 49 +#define MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_CRC 140 +#define MAVLINK_MSG_ID_12902_CRC 140 #define MAVLINK_MSG_OPEN_DRONE_ID_AUTHENTICATION_FIELD_ID_OR_MAC_LEN 20 #define MAVLINK_MSG_OPEN_DRONE_ID_AUTHENTICATION_FIELD_AUTHENTICATION_DATA_LEN 23 @@ -37,7 +37,7 @@ typedef struct __mavlink_open_drone_id_authentication_t { { "id_or_mac", NULL, MAVLINK_TYPE_UINT8_T, 20, 6, offsetof(mavlink_open_drone_id_authentication_t, id_or_mac) }, \ { "authentication_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_open_drone_id_authentication_t, authentication_type) }, \ { "data_page", NULL, MAVLINK_TYPE_UINT8_T, 0, 27, offsetof(mavlink_open_drone_id_authentication_t, data_page) }, \ - { "page_count", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_open_drone_id_authentication_t, page_count) }, \ + { "last_page_index", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_open_drone_id_authentication_t, last_page_index) }, \ { "length", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_open_drone_id_authentication_t, length) }, \ { "timestamp", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_open_drone_id_authentication_t, timestamp) }, \ { "authentication_data", NULL, MAVLINK_TYPE_UINT8_T, 23, 30, offsetof(mavlink_open_drone_id_authentication_t, authentication_data) }, \ @@ -52,7 +52,7 @@ typedef struct __mavlink_open_drone_id_authentication_t { { "id_or_mac", NULL, MAVLINK_TYPE_UINT8_T, 20, 6, offsetof(mavlink_open_drone_id_authentication_t, id_or_mac) }, \ { "authentication_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_open_drone_id_authentication_t, authentication_type) }, \ { "data_page", NULL, MAVLINK_TYPE_UINT8_T, 0, 27, offsetof(mavlink_open_drone_id_authentication_t, data_page) }, \ - { "page_count", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_open_drone_id_authentication_t, page_count) }, \ + { "last_page_index", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_open_drone_id_authentication_t, last_page_index) }, \ { "length", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_open_drone_id_authentication_t, length) }, \ { "timestamp", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_open_drone_id_authentication_t, timestamp) }, \ { "authentication_data", NULL, MAVLINK_TYPE_UINT8_T, 23, 30, offsetof(mavlink_open_drone_id_authentication_t, authentication_data) }, \ @@ -70,15 +70,15 @@ typedef struct __mavlink_open_drone_id_authentication_t { * @param target_component Component ID (0 for broadcast). * @param id_or_mac Only used for drone ID data received from other UAs. See detailed description at https://mavlink.io/en/services/opendroneid.html. * @param authentication_type Indicates the type of authentication. - * @param data_page Allowed range is 0 - 4. - * @param page_count This field is only present for page 0. Allowed range is 0 - 5. - * @param length [bytes] This field is only present for page 0. Total bytes of authentication_data from all data pages. Allowed range is 0 - 109 (17 + 23*4). + * @param data_page Allowed range is 0 - 15. + * @param last_page_index This field is only present for page 0. Allowed range is 0 - 15. See the description of struct ODID_Auth_data at https://github.com/opendroneid/opendroneid-core-c/blob/master/libopendroneid/opendroneid.h. + * @param length [bytes] This field is only present for page 0. Total bytes of authentication_data from all data pages. See the description of struct ODID_Auth_data at https://github.com/opendroneid/opendroneid-core-c/blob/master/libopendroneid/opendroneid.h. * @param timestamp [s] This field is only present for page 0. 32 bit Unix Timestamp in seconds since 00:00:00 01/01/2019. * @param authentication_data Opaque authentication data. For page 0, the size is only 17 bytes. For other pages, the size is 23 bytes. Shall be filled with nulls in the unused portion of the field. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_open_drone_id_authentication_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, const uint8_t *id_or_mac, uint8_t authentication_type, uint8_t data_page, uint8_t page_count, uint8_t length, uint32_t timestamp, const uint8_t *authentication_data) + uint8_t target_system, uint8_t target_component, const uint8_t *id_or_mac, uint8_t authentication_type, uint8_t data_page, uint8_t last_page_index, uint8_t length, uint32_t timestamp, const uint8_t *authentication_data) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN]; @@ -87,7 +87,7 @@ static inline uint16_t mavlink_msg_open_drone_id_authentication_pack(uint8_t sys _mav_put_uint8_t(buf, 5, target_component); _mav_put_uint8_t(buf, 26, authentication_type); _mav_put_uint8_t(buf, 27, data_page); - _mav_put_uint8_t(buf, 28, page_count); + _mav_put_uint8_t(buf, 28, last_page_index); _mav_put_uint8_t(buf, 29, length); _mav_put_uint8_t_array(buf, 6, id_or_mac, 20); _mav_put_uint8_t_array(buf, 30, authentication_data, 23); @@ -99,7 +99,58 @@ static inline uint16_t mavlink_msg_open_drone_id_authentication_pack(uint8_t sys packet.target_component = target_component; packet.authentication_type = authentication_type; packet.data_page = data_page; - packet.page_count = page_count; + packet.last_page_index = last_page_index; + packet.length = length; + mav_array_assign_uint8_t(packet.id_or_mac, id_or_mac, 20); + mav_array_assign_uint8_t(packet.authentication_data, authentication_data, 23); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_CRC); +} + +/** + * @brief Pack a open_drone_id_authentication message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID (0 for broadcast). + * @param target_component Component ID (0 for broadcast). + * @param id_or_mac Only used for drone ID data received from other UAs. See detailed description at https://mavlink.io/en/services/opendroneid.html. + * @param authentication_type Indicates the type of authentication. + * @param data_page Allowed range is 0 - 15. + * @param last_page_index This field is only present for page 0. Allowed range is 0 - 15. See the description of struct ODID_Auth_data at https://github.com/opendroneid/opendroneid-core-c/blob/master/libopendroneid/opendroneid.h. + * @param length [bytes] This field is only present for page 0. Total bytes of authentication_data from all data pages. See the description of struct ODID_Auth_data at https://github.com/opendroneid/opendroneid-core-c/blob/master/libopendroneid/opendroneid.h. + * @param timestamp [s] This field is only present for page 0. 32 bit Unix Timestamp in seconds since 00:00:00 01/01/2019. + * @param authentication_data Opaque authentication data. For page 0, the size is only 17 bytes. For other pages, the size is 23 bytes. Shall be filled with nulls in the unused portion of the field. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_open_drone_id_authentication_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, const uint8_t *id_or_mac, uint8_t authentication_type, uint8_t data_page, uint8_t last_page_index, uint8_t length, uint32_t timestamp, const uint8_t *authentication_data) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN]; + _mav_put_uint32_t(buf, 0, timestamp); + _mav_put_uint8_t(buf, 4, target_system); + _mav_put_uint8_t(buf, 5, target_component); + _mav_put_uint8_t(buf, 26, authentication_type); + _mav_put_uint8_t(buf, 27, data_page); + _mav_put_uint8_t(buf, 28, last_page_index); + _mav_put_uint8_t(buf, 29, length); + _mav_put_uint8_t_array(buf, 6, id_or_mac, 20); + _mav_put_uint8_t_array(buf, 30, authentication_data, 23); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN); +#else + mavlink_open_drone_id_authentication_t packet; + packet.timestamp = timestamp; + packet.target_system = target_system; + packet.target_component = target_component; + packet.authentication_type = authentication_type; + packet.data_page = data_page; + packet.last_page_index = last_page_index; packet.length = length; mav_array_memcpy(packet.id_or_mac, id_or_mac, sizeof(uint8_t)*20); mav_array_memcpy(packet.authentication_data, authentication_data, sizeof(uint8_t)*23); @@ -107,7 +158,11 @@ static inline uint16_t mavlink_msg_open_drone_id_authentication_pack(uint8_t sys #endif msg->msgid = MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_CRC); +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN); +#endif } /** @@ -120,16 +175,16 @@ static inline uint16_t mavlink_msg_open_drone_id_authentication_pack(uint8_t sys * @param target_component Component ID (0 for broadcast). * @param id_or_mac Only used for drone ID data received from other UAs. See detailed description at https://mavlink.io/en/services/opendroneid.html. * @param authentication_type Indicates the type of authentication. - * @param data_page Allowed range is 0 - 4. - * @param page_count This field is only present for page 0. Allowed range is 0 - 5. - * @param length [bytes] This field is only present for page 0. Total bytes of authentication_data from all data pages. Allowed range is 0 - 109 (17 + 23*4). + * @param data_page Allowed range is 0 - 15. + * @param last_page_index This field is only present for page 0. Allowed range is 0 - 15. See the description of struct ODID_Auth_data at https://github.com/opendroneid/opendroneid-core-c/blob/master/libopendroneid/opendroneid.h. + * @param length [bytes] This field is only present for page 0. Total bytes of authentication_data from all data pages. See the description of struct ODID_Auth_data at https://github.com/opendroneid/opendroneid-core-c/blob/master/libopendroneid/opendroneid.h. * @param timestamp [s] This field is only present for page 0. 32 bit Unix Timestamp in seconds since 00:00:00 01/01/2019. * @param authentication_data Opaque authentication data. For page 0, the size is only 17 bytes. For other pages, the size is 23 bytes. Shall be filled with nulls in the unused portion of the field. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_open_drone_id_authentication_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,const uint8_t *id_or_mac,uint8_t authentication_type,uint8_t data_page,uint8_t page_count,uint8_t length,uint32_t timestamp,const uint8_t *authentication_data) + uint8_t target_system,uint8_t target_component,const uint8_t *id_or_mac,uint8_t authentication_type,uint8_t data_page,uint8_t last_page_index,uint8_t length,uint32_t timestamp,const uint8_t *authentication_data) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN]; @@ -138,7 +193,7 @@ static inline uint16_t mavlink_msg_open_drone_id_authentication_pack_chan(uint8_ _mav_put_uint8_t(buf, 5, target_component); _mav_put_uint8_t(buf, 26, authentication_type); _mav_put_uint8_t(buf, 27, data_page); - _mav_put_uint8_t(buf, 28, page_count); + _mav_put_uint8_t(buf, 28, last_page_index); _mav_put_uint8_t(buf, 29, length); _mav_put_uint8_t_array(buf, 6, id_or_mac, 20); _mav_put_uint8_t_array(buf, 30, authentication_data, 23); @@ -150,10 +205,10 @@ static inline uint16_t mavlink_msg_open_drone_id_authentication_pack_chan(uint8_ packet.target_component = target_component; packet.authentication_type = authentication_type; packet.data_page = data_page; - packet.page_count = page_count; + packet.last_page_index = last_page_index; packet.length = length; - mav_array_memcpy(packet.id_or_mac, id_or_mac, sizeof(uint8_t)*20); - mav_array_memcpy(packet.authentication_data, authentication_data, sizeof(uint8_t)*23); + mav_array_assign_uint8_t(packet.id_or_mac, id_or_mac, 20); + mav_array_assign_uint8_t(packet.authentication_data, authentication_data, 23); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN); #endif @@ -171,7 +226,7 @@ static inline uint16_t mavlink_msg_open_drone_id_authentication_pack_chan(uint8_ */ static inline uint16_t mavlink_msg_open_drone_id_authentication_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_open_drone_id_authentication_t* open_drone_id_authentication) { - return mavlink_msg_open_drone_id_authentication_pack(system_id, component_id, msg, open_drone_id_authentication->target_system, open_drone_id_authentication->target_component, open_drone_id_authentication->id_or_mac, open_drone_id_authentication->authentication_type, open_drone_id_authentication->data_page, open_drone_id_authentication->page_count, open_drone_id_authentication->length, open_drone_id_authentication->timestamp, open_drone_id_authentication->authentication_data); + return mavlink_msg_open_drone_id_authentication_pack(system_id, component_id, msg, open_drone_id_authentication->target_system, open_drone_id_authentication->target_component, open_drone_id_authentication->id_or_mac, open_drone_id_authentication->authentication_type, open_drone_id_authentication->data_page, open_drone_id_authentication->last_page_index, open_drone_id_authentication->length, open_drone_id_authentication->timestamp, open_drone_id_authentication->authentication_data); } /** @@ -185,7 +240,21 @@ static inline uint16_t mavlink_msg_open_drone_id_authentication_encode(uint8_t s */ static inline uint16_t mavlink_msg_open_drone_id_authentication_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_open_drone_id_authentication_t* open_drone_id_authentication) { - return mavlink_msg_open_drone_id_authentication_pack_chan(system_id, component_id, chan, msg, open_drone_id_authentication->target_system, open_drone_id_authentication->target_component, open_drone_id_authentication->id_or_mac, open_drone_id_authentication->authentication_type, open_drone_id_authentication->data_page, open_drone_id_authentication->page_count, open_drone_id_authentication->length, open_drone_id_authentication->timestamp, open_drone_id_authentication->authentication_data); + return mavlink_msg_open_drone_id_authentication_pack_chan(system_id, component_id, chan, msg, open_drone_id_authentication->target_system, open_drone_id_authentication->target_component, open_drone_id_authentication->id_or_mac, open_drone_id_authentication->authentication_type, open_drone_id_authentication->data_page, open_drone_id_authentication->last_page_index, open_drone_id_authentication->length, open_drone_id_authentication->timestamp, open_drone_id_authentication->authentication_data); +} + +/** + * @brief Encode a open_drone_id_authentication struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param open_drone_id_authentication C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_open_drone_id_authentication_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_open_drone_id_authentication_t* open_drone_id_authentication) +{ + return mavlink_msg_open_drone_id_authentication_pack_status(system_id, component_id, _status, msg, open_drone_id_authentication->target_system, open_drone_id_authentication->target_component, open_drone_id_authentication->id_or_mac, open_drone_id_authentication->authentication_type, open_drone_id_authentication->data_page, open_drone_id_authentication->last_page_index, open_drone_id_authentication->length, open_drone_id_authentication->timestamp, open_drone_id_authentication->authentication_data); } /** @@ -196,15 +265,15 @@ static inline uint16_t mavlink_msg_open_drone_id_authentication_encode_chan(uint * @param target_component Component ID (0 for broadcast). * @param id_or_mac Only used for drone ID data received from other UAs. See detailed description at https://mavlink.io/en/services/opendroneid.html. * @param authentication_type Indicates the type of authentication. - * @param data_page Allowed range is 0 - 4. - * @param page_count This field is only present for page 0. Allowed range is 0 - 5. - * @param length [bytes] This field is only present for page 0. Total bytes of authentication_data from all data pages. Allowed range is 0 - 109 (17 + 23*4). + * @param data_page Allowed range is 0 - 15. + * @param last_page_index This field is only present for page 0. Allowed range is 0 - 15. See the description of struct ODID_Auth_data at https://github.com/opendroneid/opendroneid-core-c/blob/master/libopendroneid/opendroneid.h. + * @param length [bytes] This field is only present for page 0. Total bytes of authentication_data from all data pages. See the description of struct ODID_Auth_data at https://github.com/opendroneid/opendroneid-core-c/blob/master/libopendroneid/opendroneid.h. * @param timestamp [s] This field is only present for page 0. 32 bit Unix Timestamp in seconds since 00:00:00 01/01/2019. * @param authentication_data Opaque authentication data. For page 0, the size is only 17 bytes. For other pages, the size is 23 bytes. Shall be filled with nulls in the unused portion of the field. */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_open_drone_id_authentication_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, const uint8_t *id_or_mac, uint8_t authentication_type, uint8_t data_page, uint8_t page_count, uint8_t length, uint32_t timestamp, const uint8_t *authentication_data) +static inline void mavlink_msg_open_drone_id_authentication_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, const uint8_t *id_or_mac, uint8_t authentication_type, uint8_t data_page, uint8_t last_page_index, uint8_t length, uint32_t timestamp, const uint8_t *authentication_data) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN]; @@ -213,7 +282,7 @@ static inline void mavlink_msg_open_drone_id_authentication_send(mavlink_channel _mav_put_uint8_t(buf, 5, target_component); _mav_put_uint8_t(buf, 26, authentication_type); _mav_put_uint8_t(buf, 27, data_page); - _mav_put_uint8_t(buf, 28, page_count); + _mav_put_uint8_t(buf, 28, last_page_index); _mav_put_uint8_t(buf, 29, length); _mav_put_uint8_t_array(buf, 6, id_or_mac, 20); _mav_put_uint8_t_array(buf, 30, authentication_data, 23); @@ -225,10 +294,10 @@ static inline void mavlink_msg_open_drone_id_authentication_send(mavlink_channel packet.target_component = target_component; packet.authentication_type = authentication_type; packet.data_page = data_page; - packet.page_count = page_count; + packet.last_page_index = last_page_index; packet.length = length; - mav_array_memcpy(packet.id_or_mac, id_or_mac, sizeof(uint8_t)*20); - mav_array_memcpy(packet.authentication_data, authentication_data, sizeof(uint8_t)*23); + mav_array_assign_uint8_t(packet.id_or_mac, id_or_mac, 20); + mav_array_assign_uint8_t(packet.authentication_data, authentication_data, 23); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION, (const char *)&packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_CRC); #endif } @@ -241,7 +310,7 @@ static inline void mavlink_msg_open_drone_id_authentication_send(mavlink_channel static inline void mavlink_msg_open_drone_id_authentication_send_struct(mavlink_channel_t chan, const mavlink_open_drone_id_authentication_t* open_drone_id_authentication) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_open_drone_id_authentication_send(chan, open_drone_id_authentication->target_system, open_drone_id_authentication->target_component, open_drone_id_authentication->id_or_mac, open_drone_id_authentication->authentication_type, open_drone_id_authentication->data_page, open_drone_id_authentication->page_count, open_drone_id_authentication->length, open_drone_id_authentication->timestamp, open_drone_id_authentication->authentication_data); + mavlink_msg_open_drone_id_authentication_send(chan, open_drone_id_authentication->target_system, open_drone_id_authentication->target_component, open_drone_id_authentication->id_or_mac, open_drone_id_authentication->authentication_type, open_drone_id_authentication->data_page, open_drone_id_authentication->last_page_index, open_drone_id_authentication->length, open_drone_id_authentication->timestamp, open_drone_id_authentication->authentication_data); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION, (const char *)open_drone_id_authentication, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_CRC); #endif @@ -249,13 +318,13 @@ static inline void mavlink_msg_open_drone_id_authentication_send_struct(mavlink_ #if MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_open_drone_id_authentication_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, const uint8_t *id_or_mac, uint8_t authentication_type, uint8_t data_page, uint8_t page_count, uint8_t length, uint32_t timestamp, const uint8_t *authentication_data) +static inline void mavlink_msg_open_drone_id_authentication_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, const uint8_t *id_or_mac, uint8_t authentication_type, uint8_t data_page, uint8_t last_page_index, uint8_t length, uint32_t timestamp, const uint8_t *authentication_data) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; @@ -264,7 +333,7 @@ static inline void mavlink_msg_open_drone_id_authentication_send_buf(mavlink_mes _mav_put_uint8_t(buf, 5, target_component); _mav_put_uint8_t(buf, 26, authentication_type); _mav_put_uint8_t(buf, 27, data_page); - _mav_put_uint8_t(buf, 28, page_count); + _mav_put_uint8_t(buf, 28, last_page_index); _mav_put_uint8_t(buf, 29, length); _mav_put_uint8_t_array(buf, 6, id_or_mac, 20); _mav_put_uint8_t_array(buf, 30, authentication_data, 23); @@ -276,10 +345,10 @@ static inline void mavlink_msg_open_drone_id_authentication_send_buf(mavlink_mes packet->target_component = target_component; packet->authentication_type = authentication_type; packet->data_page = data_page; - packet->page_count = page_count; + packet->last_page_index = last_page_index; packet->length = length; - mav_array_memcpy(packet->id_or_mac, id_or_mac, sizeof(uint8_t)*20); - mav_array_memcpy(packet->authentication_data, authentication_data, sizeof(uint8_t)*23); + mav_array_assign_uint8_t(packet->id_or_mac, id_or_mac, 20); + mav_array_assign_uint8_t(packet->authentication_data, authentication_data, 23); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION, (const char *)packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_CRC); #endif } @@ -333,7 +402,7 @@ static inline uint8_t mavlink_msg_open_drone_id_authentication_get_authenticatio /** * @brief Get field data_page from open_drone_id_authentication message * - * @return Allowed range is 0 - 4. + * @return Allowed range is 0 - 15. */ static inline uint8_t mavlink_msg_open_drone_id_authentication_get_data_page(const mavlink_message_t* msg) { @@ -341,11 +410,11 @@ static inline uint8_t mavlink_msg_open_drone_id_authentication_get_data_page(con } /** - * @brief Get field page_count from open_drone_id_authentication message + * @brief Get field last_page_index from open_drone_id_authentication message * - * @return This field is only present for page 0. Allowed range is 0 - 5. + * @return This field is only present for page 0. Allowed range is 0 - 15. See the description of struct ODID_Auth_data at https://github.com/opendroneid/opendroneid-core-c/blob/master/libopendroneid/opendroneid.h. */ -static inline uint8_t mavlink_msg_open_drone_id_authentication_get_page_count(const mavlink_message_t* msg) +static inline uint8_t mavlink_msg_open_drone_id_authentication_get_last_page_index(const mavlink_message_t* msg) { return _MAV_RETURN_uint8_t(msg, 28); } @@ -353,7 +422,7 @@ static inline uint8_t mavlink_msg_open_drone_id_authentication_get_page_count(co /** * @brief Get field length from open_drone_id_authentication message * - * @return [bytes] This field is only present for page 0. Total bytes of authentication_data from all data pages. Allowed range is 0 - 109 (17 + 23*4). + * @return [bytes] This field is only present for page 0. Total bytes of authentication_data from all data pages. See the description of struct ODID_Auth_data at https://github.com/opendroneid/opendroneid-core-c/blob/master/libopendroneid/opendroneid.h. */ static inline uint8_t mavlink_msg_open_drone_id_authentication_get_length(const mavlink_message_t* msg) { @@ -395,7 +464,7 @@ static inline void mavlink_msg_open_drone_id_authentication_decode(const mavlink mavlink_msg_open_drone_id_authentication_get_id_or_mac(msg, open_drone_id_authentication->id_or_mac); open_drone_id_authentication->authentication_type = mavlink_msg_open_drone_id_authentication_get_authentication_type(msg); open_drone_id_authentication->data_page = mavlink_msg_open_drone_id_authentication_get_data_page(msg); - open_drone_id_authentication->page_count = mavlink_msg_open_drone_id_authentication_get_page_count(msg); + open_drone_id_authentication->last_page_index = mavlink_msg_open_drone_id_authentication_get_last_page_index(msg); open_drone_id_authentication->length = mavlink_msg_open_drone_id_authentication_get_length(msg); mavlink_msg_open_drone_id_authentication_get_authentication_data(msg, open_drone_id_authentication->authentication_data); #else diff --git a/common/mavlink_msg_open_drone_id_basic_id.h b/common/mavlink_msg_open_drone_id_basic_id.h index 1102960b7..6ec8c3fee 100644 --- a/common/mavlink_msg_open_drone_id_basic_id.h +++ b/common/mavlink_msg_open_drone_id_basic_id.h @@ -68,6 +68,48 @@ typedef struct __mavlink_open_drone_id_basic_id_t { static inline uint16_t mavlink_msg_open_drone_id_basic_id_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t target_system, uint8_t target_component, const uint8_t *id_or_mac, uint8_t id_type, uint8_t ua_type, const uint8_t *uas_id) { +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_BASIC_ID_LEN]; + _mav_put_uint8_t(buf, 0, target_system); + _mav_put_uint8_t(buf, 1, target_component); + _mav_put_uint8_t(buf, 22, id_type); + _mav_put_uint8_t(buf, 23, ua_type); + _mav_put_uint8_t_array(buf, 2, id_or_mac, 20); + _mav_put_uint8_t_array(buf, 24, uas_id, 20); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_BASIC_ID_LEN); +#else + mavlink_open_drone_id_basic_id_t packet; + packet.target_system = target_system; + packet.target_component = target_component; + packet.id_type = id_type; + packet.ua_type = ua_type; + mav_array_assign_uint8_t(packet.id_or_mac, id_or_mac, 20); + mav_array_assign_uint8_t(packet.uas_id, uas_id, 20); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_BASIC_ID_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_OPEN_DRONE_ID_BASIC_ID; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_OPEN_DRONE_ID_BASIC_ID_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_BASIC_ID_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_BASIC_ID_CRC); +} + +/** + * @brief Pack a open_drone_id_basic_id message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID (0 for broadcast). + * @param target_component Component ID (0 for broadcast). + * @param id_or_mac Only used for drone ID data received from other UAs. See detailed description at https://mavlink.io/en/services/opendroneid.html. + * @param id_type Indicates the format for the uas_id field of this message. + * @param ua_type Indicates the type of UA (Unmanned Aircraft). + * @param uas_id UAS (Unmanned Aircraft System) ID following the format specified by id_type. Shall be filled with nulls in the unused portion of the field. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_open_drone_id_basic_id_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, const uint8_t *id_or_mac, uint8_t id_type, uint8_t ua_type, const uint8_t *uas_id) +{ #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_BASIC_ID_LEN]; _mav_put_uint8_t(buf, 0, target_system); @@ -89,7 +131,11 @@ static inline uint16_t mavlink_msg_open_drone_id_basic_id_pack(uint8_t system_id #endif msg->msgid = MAVLINK_MSG_ID_OPEN_DRONE_ID_BASIC_ID; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_OPEN_DRONE_ID_BASIC_ID_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_BASIC_ID_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_BASIC_ID_CRC); +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_OPEN_DRONE_ID_BASIC_ID_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_BASIC_ID_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_BASIC_ID_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_OPEN_DRONE_ID_BASIC_ID_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_BASIC_ID_LEN); +#endif } /** @@ -125,8 +171,8 @@ static inline uint16_t mavlink_msg_open_drone_id_basic_id_pack_chan(uint8_t syst packet.target_component = target_component; packet.id_type = id_type; packet.ua_type = ua_type; - mav_array_memcpy(packet.id_or_mac, id_or_mac, sizeof(uint8_t)*20); - mav_array_memcpy(packet.uas_id, uas_id, sizeof(uint8_t)*20); + mav_array_assign_uint8_t(packet.id_or_mac, id_or_mac, 20); + mav_array_assign_uint8_t(packet.uas_id, uas_id, 20); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_BASIC_ID_LEN); #endif @@ -161,6 +207,20 @@ static inline uint16_t mavlink_msg_open_drone_id_basic_id_encode_chan(uint8_t sy return mavlink_msg_open_drone_id_basic_id_pack_chan(system_id, component_id, chan, msg, open_drone_id_basic_id->target_system, open_drone_id_basic_id->target_component, open_drone_id_basic_id->id_or_mac, open_drone_id_basic_id->id_type, open_drone_id_basic_id->ua_type, open_drone_id_basic_id->uas_id); } +/** + * @brief Encode a open_drone_id_basic_id struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param open_drone_id_basic_id C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_open_drone_id_basic_id_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_open_drone_id_basic_id_t* open_drone_id_basic_id) +{ + return mavlink_msg_open_drone_id_basic_id_pack_status(system_id, component_id, _status, msg, open_drone_id_basic_id->target_system, open_drone_id_basic_id->target_component, open_drone_id_basic_id->id_or_mac, open_drone_id_basic_id->id_type, open_drone_id_basic_id->ua_type, open_drone_id_basic_id->uas_id); +} + /** * @brief Send a open_drone_id_basic_id message * @param chan MAVLink channel to send the message @@ -191,8 +251,8 @@ static inline void mavlink_msg_open_drone_id_basic_id_send(mavlink_channel_t cha packet.target_component = target_component; packet.id_type = id_type; packet.ua_type = ua_type; - mav_array_memcpy(packet.id_or_mac, id_or_mac, sizeof(uint8_t)*20); - mav_array_memcpy(packet.uas_id, uas_id, sizeof(uint8_t)*20); + mav_array_assign_uint8_t(packet.id_or_mac, id_or_mac, 20); + mav_array_assign_uint8_t(packet.uas_id, uas_id, 20); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_BASIC_ID, (const char *)&packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_BASIC_ID_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_BASIC_ID_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_BASIC_ID_CRC); #endif } @@ -213,7 +273,7 @@ static inline void mavlink_msg_open_drone_id_basic_id_send_struct(mavlink_channe #if MAVLINK_MSG_ID_OPEN_DRONE_ID_BASIC_ID_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -236,8 +296,8 @@ static inline void mavlink_msg_open_drone_id_basic_id_send_buf(mavlink_message_t packet->target_component = target_component; packet->id_type = id_type; packet->ua_type = ua_type; - mav_array_memcpy(packet->id_or_mac, id_or_mac, sizeof(uint8_t)*20); - mav_array_memcpy(packet->uas_id, uas_id, sizeof(uint8_t)*20); + mav_array_assign_uint8_t(packet->id_or_mac, id_or_mac, 20); + mav_array_assign_uint8_t(packet->uas_id, uas_id, 20); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_BASIC_ID, (const char *)packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_BASIC_ID_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_BASIC_ID_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_BASIC_ID_CRC); #endif } diff --git a/common/mavlink_msg_open_drone_id_location.h b/common/mavlink_msg_open_drone_id_location.h index 0c2834393..730b96a5c 100644 --- a/common/mavlink_msg_open_drone_id_location.h +++ b/common/mavlink_msg_open_drone_id_location.h @@ -7,10 +7,10 @@ typedef struct __mavlink_open_drone_id_location_t { int32_t latitude; /*< [degE7] Current latitude of the unmanned aircraft. If unknown: 0 (both Lat/Lon).*/ int32_t longitude; /*< [degE7] Current longitude of the unmanned aircraft. If unknown: 0 (both Lat/Lon).*/ - float altitude_barometric; /*< [m] The altitude calculated from the barometric pressue. Reference is against 29.92inHg or 1013.2mb. If unknown: -1000 m.*/ + float altitude_barometric; /*< [m] The altitude calculated from the barometric pressure. Reference is against 29.92inHg or 1013.2mb. If unknown: -1000 m.*/ float altitude_geodetic; /*< [m] The geodetic altitude as defined by WGS84. If unknown: -1000 m.*/ float height; /*< [m] The current height of the unmanned aircraft above the take-off location or the ground as indicated by height_reference. If unknown: -1000 m.*/ - float timestamp; /*< [s] Seconds after the full hour with reference to UTC time. Typically the GPS outputs a time-of-week value in milliseconds. First convert that to UTC and then convert for this field using ((float) (time_week_ms % (60*60*1000))) / 1000.*/ + float timestamp; /*< [s] Seconds after the full hour with reference to UTC time. Typically the GPS outputs a time-of-week value in milliseconds. First convert that to UTC and then convert for this field using ((float) (time_week_ms % (60*60*1000))) / 1000. If unknown: 0xFFFF.*/ uint16_t direction; /*< [cdeg] Direction over ground (not heading, but direction of movement) measured clockwise from true North: 0 - 35999 centi-degrees. If unknown: 36100 centi-degrees.*/ uint16_t speed_horizontal; /*< [cm/s] Ground speed. Positive only. If unknown: 25500 cm/s. If speed is larger than 25425 cm/s, use 25425 cm/s.*/ int16_t speed_vertical; /*< [cm/s] The vertical speed. Up is positive. If unknown: 6300 cm/s. If speed is larger than 6200 cm/s, use 6200 cm/s. If lower than -6200 cm/s, use -6200 cm/s.*/ @@ -104,7 +104,7 @@ typedef struct __mavlink_open_drone_id_location_t { * @param speed_vertical [cm/s] The vertical speed. Up is positive. If unknown: 6300 cm/s. If speed is larger than 6200 cm/s, use 6200 cm/s. If lower than -6200 cm/s, use -6200 cm/s. * @param latitude [degE7] Current latitude of the unmanned aircraft. If unknown: 0 (both Lat/Lon). * @param longitude [degE7] Current longitude of the unmanned aircraft. If unknown: 0 (both Lat/Lon). - * @param altitude_barometric [m] The altitude calculated from the barometric pressue. Reference is against 29.92inHg or 1013.2mb. If unknown: -1000 m. + * @param altitude_barometric [m] The altitude calculated from the barometric pressure. Reference is against 29.92inHg or 1013.2mb. If unknown: -1000 m. * @param altitude_geodetic [m] The geodetic altitude as defined by WGS84. If unknown: -1000 m. * @param height_reference Indicates the reference point for the height field. * @param height [m] The current height of the unmanned aircraft above the take-off location or the ground as indicated by height_reference. If unknown: -1000 m. @@ -112,7 +112,7 @@ typedef struct __mavlink_open_drone_id_location_t { * @param vertical_accuracy The accuracy of the vertical position. * @param barometer_accuracy The accuracy of the barometric altitude. * @param speed_accuracy The accuracy of the horizontal and vertical speed. - * @param timestamp [s] Seconds after the full hour with reference to UTC time. Typically the GPS outputs a time-of-week value in milliseconds. First convert that to UTC and then convert for this field using ((float) (time_week_ms % (60*60*1000))) / 1000. + * @param timestamp [s] Seconds after the full hour with reference to UTC time. Typically the GPS outputs a time-of-week value in milliseconds. First convert that to UTC and then convert for this field using ((float) (time_week_ms % (60*60*1000))) / 1000. If unknown: 0xFFFF. * @param timestamp_accuracy The accuracy of the timestamps. * @return length of the message in bytes (excluding serial stream start sign) */ @@ -161,7 +161,7 @@ static inline uint16_t mavlink_msg_open_drone_id_location_pack(uint8_t system_id packet.barometer_accuracy = barometer_accuracy; packet.speed_accuracy = speed_accuracy; packet.timestamp_accuracy = timestamp_accuracy; - mav_array_memcpy(packet.id_or_mac, id_or_mac, sizeof(uint8_t)*20); + mav_array_assign_uint8_t(packet.id_or_mac, id_or_mac, 20); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN); #endif @@ -169,6 +169,91 @@ static inline uint16_t mavlink_msg_open_drone_id_location_pack(uint8_t system_id return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_CRC); } +/** + * @brief Pack a open_drone_id_location message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID (0 for broadcast). + * @param target_component Component ID (0 for broadcast). + * @param id_or_mac Only used for drone ID data received from other UAs. See detailed description at https://mavlink.io/en/services/opendroneid.html. + * @param status Indicates whether the unmanned aircraft is on the ground or in the air. + * @param direction [cdeg] Direction over ground (not heading, but direction of movement) measured clockwise from true North: 0 - 35999 centi-degrees. If unknown: 36100 centi-degrees. + * @param speed_horizontal [cm/s] Ground speed. Positive only. If unknown: 25500 cm/s. If speed is larger than 25425 cm/s, use 25425 cm/s. + * @param speed_vertical [cm/s] The vertical speed. Up is positive. If unknown: 6300 cm/s. If speed is larger than 6200 cm/s, use 6200 cm/s. If lower than -6200 cm/s, use -6200 cm/s. + * @param latitude [degE7] Current latitude of the unmanned aircraft. If unknown: 0 (both Lat/Lon). + * @param longitude [degE7] Current longitude of the unmanned aircraft. If unknown: 0 (both Lat/Lon). + * @param altitude_barometric [m] The altitude calculated from the barometric pressure. Reference is against 29.92inHg or 1013.2mb. If unknown: -1000 m. + * @param altitude_geodetic [m] The geodetic altitude as defined by WGS84. If unknown: -1000 m. + * @param height_reference Indicates the reference point for the height field. + * @param height [m] The current height of the unmanned aircraft above the take-off location or the ground as indicated by height_reference. If unknown: -1000 m. + * @param horizontal_accuracy The accuracy of the horizontal position. + * @param vertical_accuracy The accuracy of the vertical position. + * @param barometer_accuracy The accuracy of the barometric altitude. + * @param speed_accuracy The accuracy of the horizontal and vertical speed. + * @param timestamp [s] Seconds after the full hour with reference to UTC time. Typically the GPS outputs a time-of-week value in milliseconds. First convert that to UTC and then convert for this field using ((float) (time_week_ms % (60*60*1000))) / 1000. If unknown: 0xFFFF. + * @param timestamp_accuracy The accuracy of the timestamps. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_open_drone_id_location_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, const uint8_t *id_or_mac, uint8_t status, uint16_t direction, uint16_t speed_horizontal, int16_t speed_vertical, int32_t latitude, int32_t longitude, float altitude_barometric, float altitude_geodetic, uint8_t height_reference, float height, uint8_t horizontal_accuracy, uint8_t vertical_accuracy, uint8_t barometer_accuracy, uint8_t speed_accuracy, float timestamp, uint8_t timestamp_accuracy) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN]; + _mav_put_int32_t(buf, 0, latitude); + _mav_put_int32_t(buf, 4, longitude); + _mav_put_float(buf, 8, altitude_barometric); + _mav_put_float(buf, 12, altitude_geodetic); + _mav_put_float(buf, 16, height); + _mav_put_float(buf, 20, timestamp); + _mav_put_uint16_t(buf, 24, direction); + _mav_put_uint16_t(buf, 26, speed_horizontal); + _mav_put_int16_t(buf, 28, speed_vertical); + _mav_put_uint8_t(buf, 30, target_system); + _mav_put_uint8_t(buf, 31, target_component); + _mav_put_uint8_t(buf, 52, status); + _mav_put_uint8_t(buf, 53, height_reference); + _mav_put_uint8_t(buf, 54, horizontal_accuracy); + _mav_put_uint8_t(buf, 55, vertical_accuracy); + _mav_put_uint8_t(buf, 56, barometer_accuracy); + _mav_put_uint8_t(buf, 57, speed_accuracy); + _mav_put_uint8_t(buf, 58, timestamp_accuracy); + _mav_put_uint8_t_array(buf, 32, id_or_mac, 20); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN); +#else + mavlink_open_drone_id_location_t packet; + packet.latitude = latitude; + packet.longitude = longitude; + packet.altitude_barometric = altitude_barometric; + packet.altitude_geodetic = altitude_geodetic; + packet.height = height; + packet.timestamp = timestamp; + packet.direction = direction; + packet.speed_horizontal = speed_horizontal; + packet.speed_vertical = speed_vertical; + packet.target_system = target_system; + packet.target_component = target_component; + packet.status = status; + packet.height_reference = height_reference; + packet.horizontal_accuracy = horizontal_accuracy; + packet.vertical_accuracy = vertical_accuracy; + packet.barometer_accuracy = barometer_accuracy; + packet.speed_accuracy = speed_accuracy; + packet.timestamp_accuracy = timestamp_accuracy; + mav_array_memcpy(packet.id_or_mac, id_or_mac, sizeof(uint8_t)*20); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN); +#endif +} + /** * @brief Pack a open_drone_id_location message on a channel * @param system_id ID of this system @@ -184,7 +269,7 @@ static inline uint16_t mavlink_msg_open_drone_id_location_pack(uint8_t system_id * @param speed_vertical [cm/s] The vertical speed. Up is positive. If unknown: 6300 cm/s. If speed is larger than 6200 cm/s, use 6200 cm/s. If lower than -6200 cm/s, use -6200 cm/s. * @param latitude [degE7] Current latitude of the unmanned aircraft. If unknown: 0 (both Lat/Lon). * @param longitude [degE7] Current longitude of the unmanned aircraft. If unknown: 0 (both Lat/Lon). - * @param altitude_barometric [m] The altitude calculated from the barometric pressue. Reference is against 29.92inHg or 1013.2mb. If unknown: -1000 m. + * @param altitude_barometric [m] The altitude calculated from the barometric pressure. Reference is against 29.92inHg or 1013.2mb. If unknown: -1000 m. * @param altitude_geodetic [m] The geodetic altitude as defined by WGS84. If unknown: -1000 m. * @param height_reference Indicates the reference point for the height field. * @param height [m] The current height of the unmanned aircraft above the take-off location or the ground as indicated by height_reference. If unknown: -1000 m. @@ -192,7 +277,7 @@ static inline uint16_t mavlink_msg_open_drone_id_location_pack(uint8_t system_id * @param vertical_accuracy The accuracy of the vertical position. * @param barometer_accuracy The accuracy of the barometric altitude. * @param speed_accuracy The accuracy of the horizontal and vertical speed. - * @param timestamp [s] Seconds after the full hour with reference to UTC time. Typically the GPS outputs a time-of-week value in milliseconds. First convert that to UTC and then convert for this field using ((float) (time_week_ms % (60*60*1000))) / 1000. + * @param timestamp [s] Seconds after the full hour with reference to UTC time. Typically the GPS outputs a time-of-week value in milliseconds. First convert that to UTC and then convert for this field using ((float) (time_week_ms % (60*60*1000))) / 1000. If unknown: 0xFFFF. * @param timestamp_accuracy The accuracy of the timestamps. * @return length of the message in bytes (excluding serial stream start sign) */ @@ -242,7 +327,7 @@ static inline uint16_t mavlink_msg_open_drone_id_location_pack_chan(uint8_t syst packet.barometer_accuracy = barometer_accuracy; packet.speed_accuracy = speed_accuracy; packet.timestamp_accuracy = timestamp_accuracy; - mav_array_memcpy(packet.id_or_mac, id_or_mac, sizeof(uint8_t)*20); + mav_array_assign_uint8_t(packet.id_or_mac, id_or_mac, 20); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN); #endif @@ -277,6 +362,20 @@ static inline uint16_t mavlink_msg_open_drone_id_location_encode_chan(uint8_t sy return mavlink_msg_open_drone_id_location_pack_chan(system_id, component_id, chan, msg, open_drone_id_location->target_system, open_drone_id_location->target_component, open_drone_id_location->id_or_mac, open_drone_id_location->status, open_drone_id_location->direction, open_drone_id_location->speed_horizontal, open_drone_id_location->speed_vertical, open_drone_id_location->latitude, open_drone_id_location->longitude, open_drone_id_location->altitude_barometric, open_drone_id_location->altitude_geodetic, open_drone_id_location->height_reference, open_drone_id_location->height, open_drone_id_location->horizontal_accuracy, open_drone_id_location->vertical_accuracy, open_drone_id_location->barometer_accuracy, open_drone_id_location->speed_accuracy, open_drone_id_location->timestamp, open_drone_id_location->timestamp_accuracy); } +/** + * @brief Encode a open_drone_id_location struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param open_drone_id_location C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_open_drone_id_location_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_open_drone_id_location_t* open_drone_id_location) +{ + return mavlink_msg_open_drone_id_location_pack_status(system_id, component_id, _status, msg, open_drone_id_location->target_system, open_drone_id_location->target_component, open_drone_id_location->id_or_mac, open_drone_id_location->status, open_drone_id_location->direction, open_drone_id_location->speed_horizontal, open_drone_id_location->speed_vertical, open_drone_id_location->latitude, open_drone_id_location->longitude, open_drone_id_location->altitude_barometric, open_drone_id_location->altitude_geodetic, open_drone_id_location->height_reference, open_drone_id_location->height, open_drone_id_location->horizontal_accuracy, open_drone_id_location->vertical_accuracy, open_drone_id_location->barometer_accuracy, open_drone_id_location->speed_accuracy, open_drone_id_location->timestamp, open_drone_id_location->timestamp_accuracy); +} + /** * @brief Send a open_drone_id_location message * @param chan MAVLink channel to send the message @@ -290,7 +389,7 @@ static inline uint16_t mavlink_msg_open_drone_id_location_encode_chan(uint8_t sy * @param speed_vertical [cm/s] The vertical speed. Up is positive. If unknown: 6300 cm/s. If speed is larger than 6200 cm/s, use 6200 cm/s. If lower than -6200 cm/s, use -6200 cm/s. * @param latitude [degE7] Current latitude of the unmanned aircraft. If unknown: 0 (both Lat/Lon). * @param longitude [degE7] Current longitude of the unmanned aircraft. If unknown: 0 (both Lat/Lon). - * @param altitude_barometric [m] The altitude calculated from the barometric pressue. Reference is against 29.92inHg or 1013.2mb. If unknown: -1000 m. + * @param altitude_barometric [m] The altitude calculated from the barometric pressure. Reference is against 29.92inHg or 1013.2mb. If unknown: -1000 m. * @param altitude_geodetic [m] The geodetic altitude as defined by WGS84. If unknown: -1000 m. * @param height_reference Indicates the reference point for the height field. * @param height [m] The current height of the unmanned aircraft above the take-off location or the ground as indicated by height_reference. If unknown: -1000 m. @@ -298,7 +397,7 @@ static inline uint16_t mavlink_msg_open_drone_id_location_encode_chan(uint8_t sy * @param vertical_accuracy The accuracy of the vertical position. * @param barometer_accuracy The accuracy of the barometric altitude. * @param speed_accuracy The accuracy of the horizontal and vertical speed. - * @param timestamp [s] Seconds after the full hour with reference to UTC time. Typically the GPS outputs a time-of-week value in milliseconds. First convert that to UTC and then convert for this field using ((float) (time_week_ms % (60*60*1000))) / 1000. + * @param timestamp [s] Seconds after the full hour with reference to UTC time. Typically the GPS outputs a time-of-week value in milliseconds. First convert that to UTC and then convert for this field using ((float) (time_week_ms % (60*60*1000))) / 1000. If unknown: 0xFFFF. * @param timestamp_accuracy The accuracy of the timestamps. */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS @@ -347,7 +446,7 @@ static inline void mavlink_msg_open_drone_id_location_send(mavlink_channel_t cha packet.barometer_accuracy = barometer_accuracy; packet.speed_accuracy = speed_accuracy; packet.timestamp_accuracy = timestamp_accuracy; - mav_array_memcpy(packet.id_or_mac, id_or_mac, sizeof(uint8_t)*20); + mav_array_assign_uint8_t(packet.id_or_mac, id_or_mac, 20); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION, (const char *)&packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_CRC); #endif } @@ -368,7 +467,7 @@ static inline void mavlink_msg_open_drone_id_location_send_struct(mavlink_channe #if MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -418,7 +517,7 @@ static inline void mavlink_msg_open_drone_id_location_send_buf(mavlink_message_t packet->barometer_accuracy = barometer_accuracy; packet->speed_accuracy = speed_accuracy; packet->timestamp_accuracy = timestamp_accuracy; - mav_array_memcpy(packet->id_or_mac, id_or_mac, sizeof(uint8_t)*20); + mav_array_assign_uint8_t(packet->id_or_mac, id_or_mac, 20); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION, (const char *)packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_CRC); #endif } @@ -522,7 +621,7 @@ static inline int32_t mavlink_msg_open_drone_id_location_get_longitude(const mav /** * @brief Get field altitude_barometric from open_drone_id_location message * - * @return [m] The altitude calculated from the barometric pressue. Reference is against 29.92inHg or 1013.2mb. If unknown: -1000 m. + * @return [m] The altitude calculated from the barometric pressure. Reference is against 29.92inHg or 1013.2mb. If unknown: -1000 m. */ static inline float mavlink_msg_open_drone_id_location_get_altitude_barometric(const mavlink_message_t* msg) { @@ -602,7 +701,7 @@ static inline uint8_t mavlink_msg_open_drone_id_location_get_speed_accuracy(cons /** * @brief Get field timestamp from open_drone_id_location message * - * @return [s] Seconds after the full hour with reference to UTC time. Typically the GPS outputs a time-of-week value in milliseconds. First convert that to UTC and then convert for this field using ((float) (time_week_ms % (60*60*1000))) / 1000. + * @return [s] Seconds after the full hour with reference to UTC time. Typically the GPS outputs a time-of-week value in milliseconds. First convert that to UTC and then convert for this field using ((float) (time_week_ms % (60*60*1000))) / 1000. If unknown: 0xFFFF. */ static inline float mavlink_msg_open_drone_id_location_get_timestamp(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_open_drone_id_message_pack.h b/common/mavlink_msg_open_drone_id_message_pack.h index 16407cfb3..80e096244 100644 --- a/common/mavlink_msg_open_drone_id_message_pack.h +++ b/common/mavlink_msg_open_drone_id_message_pack.h @@ -7,42 +7,46 @@ typedef struct __mavlink_open_drone_id_message_pack_t { uint8_t target_system; /*< System ID (0 for broadcast).*/ uint8_t target_component; /*< Component ID (0 for broadcast).*/ - uint8_t single_message_size; /*< [bytes] This field must currently always be equal to 25 (bytes), since all encoded OpenDroneID messages are specificed to have this length.*/ - uint8_t msg_pack_size; /*< Number of encoded messages in the pack (not the number of bytes). Allowed range is 1 - 10.*/ - uint8_t messages[250]; /*< Concatenation of encoded OpenDroneID messages. Shall be filled with nulls in the unused portion of the field.*/ + uint8_t id_or_mac[20]; /*< Only used for drone ID data received from other UAs. See detailed description at https://mavlink.io/en/services/opendroneid.html. */ + uint8_t single_message_size; /*< [bytes] This field must currently always be equal to 25 (bytes), since all encoded OpenDroneID messages are specified to have this length.*/ + uint8_t msg_pack_size; /*< Number of encoded messages in the pack (not the number of bytes). Allowed range is 1 - 9.*/ + uint8_t messages[225]; /*< Concatenation of encoded OpenDroneID messages. Shall be filled with nulls in the unused portion of the field.*/ } mavlink_open_drone_id_message_pack_t; -#define MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_LEN 254 -#define MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_MIN_LEN 254 -#define MAVLINK_MSG_ID_12915_LEN 254 -#define MAVLINK_MSG_ID_12915_MIN_LEN 254 +#define MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_LEN 249 +#define MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_MIN_LEN 249 +#define MAVLINK_MSG_ID_12915_LEN 249 +#define MAVLINK_MSG_ID_12915_MIN_LEN 249 -#define MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_CRC 62 -#define MAVLINK_MSG_ID_12915_CRC 62 +#define MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_CRC 94 +#define MAVLINK_MSG_ID_12915_CRC 94 -#define MAVLINK_MSG_OPEN_DRONE_ID_MESSAGE_PACK_FIELD_MESSAGES_LEN 250 +#define MAVLINK_MSG_OPEN_DRONE_ID_MESSAGE_PACK_FIELD_ID_OR_MAC_LEN 20 +#define MAVLINK_MSG_OPEN_DRONE_ID_MESSAGE_PACK_FIELD_MESSAGES_LEN 225 #if MAVLINK_COMMAND_24BIT #define MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_MESSAGE_PACK { \ 12915, \ "OPEN_DRONE_ID_MESSAGE_PACK", \ - 5, \ + 6, \ { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_open_drone_id_message_pack_t, target_system) }, \ { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_open_drone_id_message_pack_t, target_component) }, \ - { "single_message_size", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_open_drone_id_message_pack_t, single_message_size) }, \ - { "msg_pack_size", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_open_drone_id_message_pack_t, msg_pack_size) }, \ - { "messages", NULL, MAVLINK_TYPE_UINT8_T, 250, 4, offsetof(mavlink_open_drone_id_message_pack_t, messages) }, \ + { "id_or_mac", NULL, MAVLINK_TYPE_UINT8_T, 20, 2, offsetof(mavlink_open_drone_id_message_pack_t, id_or_mac) }, \ + { "single_message_size", NULL, MAVLINK_TYPE_UINT8_T, 0, 22, offsetof(mavlink_open_drone_id_message_pack_t, single_message_size) }, \ + { "msg_pack_size", NULL, MAVLINK_TYPE_UINT8_T, 0, 23, offsetof(mavlink_open_drone_id_message_pack_t, msg_pack_size) }, \ + { "messages", NULL, MAVLINK_TYPE_UINT8_T, 225, 24, offsetof(mavlink_open_drone_id_message_pack_t, messages) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_MESSAGE_PACK { \ "OPEN_DRONE_ID_MESSAGE_PACK", \ - 5, \ + 6, \ { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_open_drone_id_message_pack_t, target_system) }, \ { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_open_drone_id_message_pack_t, target_component) }, \ - { "single_message_size", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_open_drone_id_message_pack_t, single_message_size) }, \ - { "msg_pack_size", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_open_drone_id_message_pack_t, msg_pack_size) }, \ - { "messages", NULL, MAVLINK_TYPE_UINT8_T, 250, 4, offsetof(mavlink_open_drone_id_message_pack_t, messages) }, \ + { "id_or_mac", NULL, MAVLINK_TYPE_UINT8_T, 20, 2, offsetof(mavlink_open_drone_id_message_pack_t, id_or_mac) }, \ + { "single_message_size", NULL, MAVLINK_TYPE_UINT8_T, 0, 22, offsetof(mavlink_open_drone_id_message_pack_t, single_message_size) }, \ + { "msg_pack_size", NULL, MAVLINK_TYPE_UINT8_T, 0, 23, offsetof(mavlink_open_drone_id_message_pack_t, msg_pack_size) }, \ + { "messages", NULL, MAVLINK_TYPE_UINT8_T, 225, 24, offsetof(mavlink_open_drone_id_message_pack_t, messages) }, \ } \ } #endif @@ -55,21 +59,23 @@ typedef struct __mavlink_open_drone_id_message_pack_t { * * @param target_system System ID (0 for broadcast). * @param target_component Component ID (0 for broadcast). - * @param single_message_size [bytes] This field must currently always be equal to 25 (bytes), since all encoded OpenDroneID messages are specificed to have this length. - * @param msg_pack_size Number of encoded messages in the pack (not the number of bytes). Allowed range is 1 - 10. + * @param id_or_mac Only used for drone ID data received from other UAs. See detailed description at https://mavlink.io/en/services/opendroneid.html. + * @param single_message_size [bytes] This field must currently always be equal to 25 (bytes), since all encoded OpenDroneID messages are specified to have this length. + * @param msg_pack_size Number of encoded messages in the pack (not the number of bytes). Allowed range is 1 - 9. * @param messages Concatenation of encoded OpenDroneID messages. Shall be filled with nulls in the unused portion of the field. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_open_drone_id_message_pack_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, uint8_t single_message_size, uint8_t msg_pack_size, const uint8_t *messages) + uint8_t target_system, uint8_t target_component, const uint8_t *id_or_mac, uint8_t single_message_size, uint8_t msg_pack_size, const uint8_t *messages) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_LEN]; _mav_put_uint8_t(buf, 0, target_system); _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, single_message_size); - _mav_put_uint8_t(buf, 3, msg_pack_size); - _mav_put_uint8_t_array(buf, 4, messages, 250); + _mav_put_uint8_t(buf, 22, single_message_size); + _mav_put_uint8_t(buf, 23, msg_pack_size); + _mav_put_uint8_t_array(buf, 2, id_or_mac, 20); + _mav_put_uint8_t_array(buf, 24, messages, 225); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_LEN); #else mavlink_open_drone_id_message_pack_t packet; @@ -77,7 +83,8 @@ static inline uint16_t mavlink_msg_open_drone_id_message_pack_pack(uint8_t syste packet.target_component = target_component; packet.single_message_size = single_message_size; packet.msg_pack_size = msg_pack_size; - mav_array_memcpy(packet.messages, messages, sizeof(uint8_t)*250); + mav_array_assign_uint8_t(packet.id_or_mac, id_or_mac, 20); + mav_array_assign_uint8_t(packet.messages, messages, 225); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_LEN); #endif @@ -85,6 +92,52 @@ static inline uint16_t mavlink_msg_open_drone_id_message_pack_pack(uint8_t syste return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_CRC); } +/** + * @brief Pack a open_drone_id_message_pack message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID (0 for broadcast). + * @param target_component Component ID (0 for broadcast). + * @param id_or_mac Only used for drone ID data received from other UAs. See detailed description at https://mavlink.io/en/services/opendroneid.html. + * @param single_message_size [bytes] This field must currently always be equal to 25 (bytes), since all encoded OpenDroneID messages are specified to have this length. + * @param msg_pack_size Number of encoded messages in the pack (not the number of bytes). Allowed range is 1 - 9. + * @param messages Concatenation of encoded OpenDroneID messages. Shall be filled with nulls in the unused portion of the field. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_open_drone_id_message_pack_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, const uint8_t *id_or_mac, uint8_t single_message_size, uint8_t msg_pack_size, const uint8_t *messages) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_LEN]; + _mav_put_uint8_t(buf, 0, target_system); + _mav_put_uint8_t(buf, 1, target_component); + _mav_put_uint8_t(buf, 22, single_message_size); + _mav_put_uint8_t(buf, 23, msg_pack_size); + _mav_put_uint8_t_array(buf, 2, id_or_mac, 20); + _mav_put_uint8_t_array(buf, 24, messages, 225); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_LEN); +#else + mavlink_open_drone_id_message_pack_t packet; + packet.target_system = target_system; + packet.target_component = target_component; + packet.single_message_size = single_message_size; + packet.msg_pack_size = msg_pack_size; + mav_array_memcpy(packet.id_or_mac, id_or_mac, sizeof(uint8_t)*20); + mav_array_memcpy(packet.messages, messages, sizeof(uint8_t)*225); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_LEN); +#endif +} + /** * @brief Pack a open_drone_id_message_pack message on a channel * @param system_id ID of this system @@ -93,22 +146,24 @@ static inline uint16_t mavlink_msg_open_drone_id_message_pack_pack(uint8_t syste * @param msg The MAVLink message to compress the data into * @param target_system System ID (0 for broadcast). * @param target_component Component ID (0 for broadcast). - * @param single_message_size [bytes] This field must currently always be equal to 25 (bytes), since all encoded OpenDroneID messages are specificed to have this length. - * @param msg_pack_size Number of encoded messages in the pack (not the number of bytes). Allowed range is 1 - 10. + * @param id_or_mac Only used for drone ID data received from other UAs. See detailed description at https://mavlink.io/en/services/opendroneid.html. + * @param single_message_size [bytes] This field must currently always be equal to 25 (bytes), since all encoded OpenDroneID messages are specified to have this length. + * @param msg_pack_size Number of encoded messages in the pack (not the number of bytes). Allowed range is 1 - 9. * @param messages Concatenation of encoded OpenDroneID messages. Shall be filled with nulls in the unused portion of the field. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_open_drone_id_message_pack_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,uint8_t single_message_size,uint8_t msg_pack_size,const uint8_t *messages) + uint8_t target_system,uint8_t target_component,const uint8_t *id_or_mac,uint8_t single_message_size,uint8_t msg_pack_size,const uint8_t *messages) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_LEN]; _mav_put_uint8_t(buf, 0, target_system); _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, single_message_size); - _mav_put_uint8_t(buf, 3, msg_pack_size); - _mav_put_uint8_t_array(buf, 4, messages, 250); + _mav_put_uint8_t(buf, 22, single_message_size); + _mav_put_uint8_t(buf, 23, msg_pack_size); + _mav_put_uint8_t_array(buf, 2, id_or_mac, 20); + _mav_put_uint8_t_array(buf, 24, messages, 225); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_LEN); #else mavlink_open_drone_id_message_pack_t packet; @@ -116,7 +171,8 @@ static inline uint16_t mavlink_msg_open_drone_id_message_pack_pack_chan(uint8_t packet.target_component = target_component; packet.single_message_size = single_message_size; packet.msg_pack_size = msg_pack_size; - mav_array_memcpy(packet.messages, messages, sizeof(uint8_t)*250); + mav_array_assign_uint8_t(packet.id_or_mac, id_or_mac, 20); + mav_array_assign_uint8_t(packet.messages, messages, 225); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_LEN); #endif @@ -134,7 +190,7 @@ static inline uint16_t mavlink_msg_open_drone_id_message_pack_pack_chan(uint8_t */ static inline uint16_t mavlink_msg_open_drone_id_message_pack_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_open_drone_id_message_pack_t* open_drone_id_message_pack) { - return mavlink_msg_open_drone_id_message_pack_pack(system_id, component_id, msg, open_drone_id_message_pack->target_system, open_drone_id_message_pack->target_component, open_drone_id_message_pack->single_message_size, open_drone_id_message_pack->msg_pack_size, open_drone_id_message_pack->messages); + return mavlink_msg_open_drone_id_message_pack_pack(system_id, component_id, msg, open_drone_id_message_pack->target_system, open_drone_id_message_pack->target_component, open_drone_id_message_pack->id_or_mac, open_drone_id_message_pack->single_message_size, open_drone_id_message_pack->msg_pack_size, open_drone_id_message_pack->messages); } /** @@ -148,7 +204,21 @@ static inline uint16_t mavlink_msg_open_drone_id_message_pack_encode(uint8_t sys */ static inline uint16_t mavlink_msg_open_drone_id_message_pack_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_open_drone_id_message_pack_t* open_drone_id_message_pack) { - return mavlink_msg_open_drone_id_message_pack_pack_chan(system_id, component_id, chan, msg, open_drone_id_message_pack->target_system, open_drone_id_message_pack->target_component, open_drone_id_message_pack->single_message_size, open_drone_id_message_pack->msg_pack_size, open_drone_id_message_pack->messages); + return mavlink_msg_open_drone_id_message_pack_pack_chan(system_id, component_id, chan, msg, open_drone_id_message_pack->target_system, open_drone_id_message_pack->target_component, open_drone_id_message_pack->id_or_mac, open_drone_id_message_pack->single_message_size, open_drone_id_message_pack->msg_pack_size, open_drone_id_message_pack->messages); +} + +/** + * @brief Encode a open_drone_id_message_pack struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param open_drone_id_message_pack C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_open_drone_id_message_pack_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_open_drone_id_message_pack_t* open_drone_id_message_pack) +{ + return mavlink_msg_open_drone_id_message_pack_pack_status(system_id, component_id, _status, msg, open_drone_id_message_pack->target_system, open_drone_id_message_pack->target_component, open_drone_id_message_pack->id_or_mac, open_drone_id_message_pack->single_message_size, open_drone_id_message_pack->msg_pack_size, open_drone_id_message_pack->messages); } /** @@ -157,21 +227,23 @@ static inline uint16_t mavlink_msg_open_drone_id_message_pack_encode_chan(uint8_ * * @param target_system System ID (0 for broadcast). * @param target_component Component ID (0 for broadcast). - * @param single_message_size [bytes] This field must currently always be equal to 25 (bytes), since all encoded OpenDroneID messages are specificed to have this length. - * @param msg_pack_size Number of encoded messages in the pack (not the number of bytes). Allowed range is 1 - 10. + * @param id_or_mac Only used for drone ID data received from other UAs. See detailed description at https://mavlink.io/en/services/opendroneid.html. + * @param single_message_size [bytes] This field must currently always be equal to 25 (bytes), since all encoded OpenDroneID messages are specified to have this length. + * @param msg_pack_size Number of encoded messages in the pack (not the number of bytes). Allowed range is 1 - 9. * @param messages Concatenation of encoded OpenDroneID messages. Shall be filled with nulls in the unused portion of the field. */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_open_drone_id_message_pack_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t single_message_size, uint8_t msg_pack_size, const uint8_t *messages) +static inline void mavlink_msg_open_drone_id_message_pack_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, const uint8_t *id_or_mac, uint8_t single_message_size, uint8_t msg_pack_size, const uint8_t *messages) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_LEN]; _mav_put_uint8_t(buf, 0, target_system); _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, single_message_size); - _mav_put_uint8_t(buf, 3, msg_pack_size); - _mav_put_uint8_t_array(buf, 4, messages, 250); + _mav_put_uint8_t(buf, 22, single_message_size); + _mav_put_uint8_t(buf, 23, msg_pack_size); + _mav_put_uint8_t_array(buf, 2, id_or_mac, 20); + _mav_put_uint8_t_array(buf, 24, messages, 225); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK, buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_CRC); #else mavlink_open_drone_id_message_pack_t packet; @@ -179,7 +251,8 @@ static inline void mavlink_msg_open_drone_id_message_pack_send(mavlink_channel_t packet.target_component = target_component; packet.single_message_size = single_message_size; packet.msg_pack_size = msg_pack_size; - mav_array_memcpy(packet.messages, messages, sizeof(uint8_t)*250); + mav_array_assign_uint8_t(packet.id_or_mac, id_or_mac, 20); + mav_array_assign_uint8_t(packet.messages, messages, 225); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK, (const char *)&packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_CRC); #endif } @@ -192,7 +265,7 @@ static inline void mavlink_msg_open_drone_id_message_pack_send(mavlink_channel_t static inline void mavlink_msg_open_drone_id_message_pack_send_struct(mavlink_channel_t chan, const mavlink_open_drone_id_message_pack_t* open_drone_id_message_pack) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_open_drone_id_message_pack_send(chan, open_drone_id_message_pack->target_system, open_drone_id_message_pack->target_component, open_drone_id_message_pack->single_message_size, open_drone_id_message_pack->msg_pack_size, open_drone_id_message_pack->messages); + mavlink_msg_open_drone_id_message_pack_send(chan, open_drone_id_message_pack->target_system, open_drone_id_message_pack->target_component, open_drone_id_message_pack->id_or_mac, open_drone_id_message_pack->single_message_size, open_drone_id_message_pack->msg_pack_size, open_drone_id_message_pack->messages); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK, (const char *)open_drone_id_message_pack, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_CRC); #endif @@ -200,21 +273,22 @@ static inline void mavlink_msg_open_drone_id_message_pack_send_struct(mavlink_ch #if MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_open_drone_id_message_pack_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t single_message_size, uint8_t msg_pack_size, const uint8_t *messages) +static inline void mavlink_msg_open_drone_id_message_pack_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, const uint8_t *id_or_mac, uint8_t single_message_size, uint8_t msg_pack_size, const uint8_t *messages) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; _mav_put_uint8_t(buf, 0, target_system); _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, single_message_size); - _mav_put_uint8_t(buf, 3, msg_pack_size); - _mav_put_uint8_t_array(buf, 4, messages, 250); + _mav_put_uint8_t(buf, 22, single_message_size); + _mav_put_uint8_t(buf, 23, msg_pack_size); + _mav_put_uint8_t_array(buf, 2, id_or_mac, 20); + _mav_put_uint8_t_array(buf, 24, messages, 225); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK, buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_CRC); #else mavlink_open_drone_id_message_pack_t *packet = (mavlink_open_drone_id_message_pack_t *)msgbuf; @@ -222,7 +296,8 @@ static inline void mavlink_msg_open_drone_id_message_pack_send_buf(mavlink_messa packet->target_component = target_component; packet->single_message_size = single_message_size; packet->msg_pack_size = msg_pack_size; - mav_array_memcpy(packet->messages, messages, sizeof(uint8_t)*250); + mav_array_assign_uint8_t(packet->id_or_mac, id_or_mac, 20); + mav_array_assign_uint8_t(packet->messages, messages, 225); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK, (const char *)packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_CRC); #endif } @@ -253,24 +328,34 @@ static inline uint8_t mavlink_msg_open_drone_id_message_pack_get_target_componen return _MAV_RETURN_uint8_t(msg, 1); } +/** + * @brief Get field id_or_mac from open_drone_id_message_pack message + * + * @return Only used for drone ID data received from other UAs. See detailed description at https://mavlink.io/en/services/opendroneid.html. + */ +static inline uint16_t mavlink_msg_open_drone_id_message_pack_get_id_or_mac(const mavlink_message_t* msg, uint8_t *id_or_mac) +{ + return _MAV_RETURN_uint8_t_array(msg, id_or_mac, 20, 2); +} + /** * @brief Get field single_message_size from open_drone_id_message_pack message * - * @return [bytes] This field must currently always be equal to 25 (bytes), since all encoded OpenDroneID messages are specificed to have this length. + * @return [bytes] This field must currently always be equal to 25 (bytes), since all encoded OpenDroneID messages are specified to have this length. */ static inline uint8_t mavlink_msg_open_drone_id_message_pack_get_single_message_size(const mavlink_message_t* msg) { - return _MAV_RETURN_uint8_t(msg, 2); + return _MAV_RETURN_uint8_t(msg, 22); } /** * @brief Get field msg_pack_size from open_drone_id_message_pack message * - * @return Number of encoded messages in the pack (not the number of bytes). Allowed range is 1 - 10. + * @return Number of encoded messages in the pack (not the number of bytes). Allowed range is 1 - 9. */ static inline uint8_t mavlink_msg_open_drone_id_message_pack_get_msg_pack_size(const mavlink_message_t* msg) { - return _MAV_RETURN_uint8_t(msg, 3); + return _MAV_RETURN_uint8_t(msg, 23); } /** @@ -280,7 +365,7 @@ static inline uint8_t mavlink_msg_open_drone_id_message_pack_get_msg_pack_size(c */ static inline uint16_t mavlink_msg_open_drone_id_message_pack_get_messages(const mavlink_message_t* msg, uint8_t *messages) { - return _MAV_RETURN_uint8_t_array(msg, messages, 250, 4); + return _MAV_RETURN_uint8_t_array(msg, messages, 225, 24); } /** @@ -294,6 +379,7 @@ static inline void mavlink_msg_open_drone_id_message_pack_decode(const mavlink_m #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS open_drone_id_message_pack->target_system = mavlink_msg_open_drone_id_message_pack_get_target_system(msg); open_drone_id_message_pack->target_component = mavlink_msg_open_drone_id_message_pack_get_target_component(msg); + mavlink_msg_open_drone_id_message_pack_get_id_or_mac(msg, open_drone_id_message_pack->id_or_mac); open_drone_id_message_pack->single_message_size = mavlink_msg_open_drone_id_message_pack_get_single_message_size(msg); open_drone_id_message_pack->msg_pack_size = mavlink_msg_open_drone_id_message_pack_get_msg_pack_size(msg); mavlink_msg_open_drone_id_message_pack_get_messages(msg, open_drone_id_message_pack->messages); diff --git a/common/mavlink_msg_open_drone_id_operator_id.h b/common/mavlink_msg_open_drone_id_operator_id.h index f3bf5aff2..2d9b3f779 100644 --- a/common/mavlink_msg_open_drone_id_operator_id.h +++ b/common/mavlink_msg_open_drone_id_operator_id.h @@ -64,6 +64,45 @@ typedef struct __mavlink_open_drone_id_operator_id_t { static inline uint16_t mavlink_msg_open_drone_id_operator_id_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t target_system, uint8_t target_component, const uint8_t *id_or_mac, uint8_t operator_id_type, const char *operator_id) { +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_OPERATOR_ID_LEN]; + _mav_put_uint8_t(buf, 0, target_system); + _mav_put_uint8_t(buf, 1, target_component); + _mav_put_uint8_t(buf, 22, operator_id_type); + _mav_put_uint8_t_array(buf, 2, id_or_mac, 20); + _mav_put_char_array(buf, 23, operator_id, 20); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_OPERATOR_ID_LEN); +#else + mavlink_open_drone_id_operator_id_t packet; + packet.target_system = target_system; + packet.target_component = target_component; + packet.operator_id_type = operator_id_type; + mav_array_assign_uint8_t(packet.id_or_mac, id_or_mac, 20); + mav_array_assign_char(packet.operator_id, operator_id, 20); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_OPERATOR_ID_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_OPEN_DRONE_ID_OPERATOR_ID; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_OPEN_DRONE_ID_OPERATOR_ID_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_OPERATOR_ID_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_OPERATOR_ID_CRC); +} + +/** + * @brief Pack a open_drone_id_operator_id message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID (0 for broadcast). + * @param target_component Component ID (0 for broadcast). + * @param id_or_mac Only used for drone ID data received from other UAs. See detailed description at https://mavlink.io/en/services/opendroneid.html. + * @param operator_id_type Indicates the type of the operator_id field. + * @param operator_id Text description or numeric value expressed as ASCII characters. Shall be filled with nulls in the unused portion of the field. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_open_drone_id_operator_id_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, const uint8_t *id_or_mac, uint8_t operator_id_type, const char *operator_id) +{ #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_OPERATOR_ID_LEN]; _mav_put_uint8_t(buf, 0, target_system); @@ -83,7 +122,11 @@ static inline uint16_t mavlink_msg_open_drone_id_operator_id_pack(uint8_t system #endif msg->msgid = MAVLINK_MSG_ID_OPEN_DRONE_ID_OPERATOR_ID; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_OPEN_DRONE_ID_OPERATOR_ID_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_OPERATOR_ID_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_OPERATOR_ID_CRC); +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_OPEN_DRONE_ID_OPERATOR_ID_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_OPERATOR_ID_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_OPERATOR_ID_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_OPEN_DRONE_ID_OPERATOR_ID_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_OPERATOR_ID_LEN); +#endif } /** @@ -116,8 +159,8 @@ static inline uint16_t mavlink_msg_open_drone_id_operator_id_pack_chan(uint8_t s packet.target_system = target_system; packet.target_component = target_component; packet.operator_id_type = operator_id_type; - mav_array_memcpy(packet.id_or_mac, id_or_mac, sizeof(uint8_t)*20); - mav_array_memcpy(packet.operator_id, operator_id, sizeof(char)*20); + mav_array_assign_uint8_t(packet.id_or_mac, id_or_mac, 20); + mav_array_assign_char(packet.operator_id, operator_id, 20); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_OPERATOR_ID_LEN); #endif @@ -152,6 +195,20 @@ static inline uint16_t mavlink_msg_open_drone_id_operator_id_encode_chan(uint8_t return mavlink_msg_open_drone_id_operator_id_pack_chan(system_id, component_id, chan, msg, open_drone_id_operator_id->target_system, open_drone_id_operator_id->target_component, open_drone_id_operator_id->id_or_mac, open_drone_id_operator_id->operator_id_type, open_drone_id_operator_id->operator_id); } +/** + * @brief Encode a open_drone_id_operator_id struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param open_drone_id_operator_id C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_open_drone_id_operator_id_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_open_drone_id_operator_id_t* open_drone_id_operator_id) +{ + return mavlink_msg_open_drone_id_operator_id_pack_status(system_id, component_id, _status, msg, open_drone_id_operator_id->target_system, open_drone_id_operator_id->target_component, open_drone_id_operator_id->id_or_mac, open_drone_id_operator_id->operator_id_type, open_drone_id_operator_id->operator_id); +} + /** * @brief Send a open_drone_id_operator_id message * @param chan MAVLink channel to send the message @@ -179,8 +236,8 @@ static inline void mavlink_msg_open_drone_id_operator_id_send(mavlink_channel_t packet.target_system = target_system; packet.target_component = target_component; packet.operator_id_type = operator_id_type; - mav_array_memcpy(packet.id_or_mac, id_or_mac, sizeof(uint8_t)*20); - mav_array_memcpy(packet.operator_id, operator_id, sizeof(char)*20); + mav_array_assign_uint8_t(packet.id_or_mac, id_or_mac, 20); + mav_array_assign_char(packet.operator_id, operator_id, 20); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_OPERATOR_ID, (const char *)&packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_OPERATOR_ID_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_OPERATOR_ID_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_OPERATOR_ID_CRC); #endif } @@ -201,7 +258,7 @@ static inline void mavlink_msg_open_drone_id_operator_id_send_struct(mavlink_cha #if MAVLINK_MSG_ID_OPEN_DRONE_ID_OPERATOR_ID_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -222,8 +279,8 @@ static inline void mavlink_msg_open_drone_id_operator_id_send_buf(mavlink_messag packet->target_system = target_system; packet->target_component = target_component; packet->operator_id_type = operator_id_type; - mav_array_memcpy(packet->id_or_mac, id_or_mac, sizeof(uint8_t)*20); - mav_array_memcpy(packet->operator_id, operator_id, sizeof(char)*20); + mav_array_assign_uint8_t(packet->id_or_mac, id_or_mac, 20); + mav_array_assign_char(packet->operator_id, operator_id, 20); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_OPERATOR_ID, (const char *)packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_OPERATOR_ID_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_OPERATOR_ID_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_OPERATOR_ID_CRC); #endif } diff --git a/common/mavlink_msg_open_drone_id_self_id.h b/common/mavlink_msg_open_drone_id_self_id.h index 0750472ac..67ce4f5a9 100644 --- a/common/mavlink_msg_open_drone_id_self_id.h +++ b/common/mavlink_msg_open_drone_id_self_id.h @@ -64,6 +64,45 @@ typedef struct __mavlink_open_drone_id_self_id_t { static inline uint16_t mavlink_msg_open_drone_id_self_id_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t target_system, uint8_t target_component, const uint8_t *id_or_mac, uint8_t description_type, const char *description) { +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_SELF_ID_LEN]; + _mav_put_uint8_t(buf, 0, target_system); + _mav_put_uint8_t(buf, 1, target_component); + _mav_put_uint8_t(buf, 22, description_type); + _mav_put_uint8_t_array(buf, 2, id_or_mac, 20); + _mav_put_char_array(buf, 23, description, 23); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_SELF_ID_LEN); +#else + mavlink_open_drone_id_self_id_t packet; + packet.target_system = target_system; + packet.target_component = target_component; + packet.description_type = description_type; + mav_array_assign_uint8_t(packet.id_or_mac, id_or_mac, 20); + mav_array_assign_char(packet.description, description, 23); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_SELF_ID_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_OPEN_DRONE_ID_SELF_ID; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_OPEN_DRONE_ID_SELF_ID_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SELF_ID_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SELF_ID_CRC); +} + +/** + * @brief Pack a open_drone_id_self_id message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID (0 for broadcast). + * @param target_component Component ID (0 for broadcast). + * @param id_or_mac Only used for drone ID data received from other UAs. See detailed description at https://mavlink.io/en/services/opendroneid.html. + * @param description_type Indicates the type of the description field. + * @param description Text description or numeric value expressed as ASCII characters. Shall be filled with nulls in the unused portion of the field. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_open_drone_id_self_id_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, const uint8_t *id_or_mac, uint8_t description_type, const char *description) +{ #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_SELF_ID_LEN]; _mav_put_uint8_t(buf, 0, target_system); @@ -83,7 +122,11 @@ static inline uint16_t mavlink_msg_open_drone_id_self_id_pack(uint8_t system_id, #endif msg->msgid = MAVLINK_MSG_ID_OPEN_DRONE_ID_SELF_ID; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_OPEN_DRONE_ID_SELF_ID_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SELF_ID_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SELF_ID_CRC); +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_OPEN_DRONE_ID_SELF_ID_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SELF_ID_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SELF_ID_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_OPEN_DRONE_ID_SELF_ID_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SELF_ID_LEN); +#endif } /** @@ -116,8 +159,8 @@ static inline uint16_t mavlink_msg_open_drone_id_self_id_pack_chan(uint8_t syste packet.target_system = target_system; packet.target_component = target_component; packet.description_type = description_type; - mav_array_memcpy(packet.id_or_mac, id_or_mac, sizeof(uint8_t)*20); - mav_array_memcpy(packet.description, description, sizeof(char)*23); + mav_array_assign_uint8_t(packet.id_or_mac, id_or_mac, 20); + mav_array_assign_char(packet.description, description, 23); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_SELF_ID_LEN); #endif @@ -152,6 +195,20 @@ static inline uint16_t mavlink_msg_open_drone_id_self_id_encode_chan(uint8_t sys return mavlink_msg_open_drone_id_self_id_pack_chan(system_id, component_id, chan, msg, open_drone_id_self_id->target_system, open_drone_id_self_id->target_component, open_drone_id_self_id->id_or_mac, open_drone_id_self_id->description_type, open_drone_id_self_id->description); } +/** + * @brief Encode a open_drone_id_self_id struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param open_drone_id_self_id C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_open_drone_id_self_id_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_open_drone_id_self_id_t* open_drone_id_self_id) +{ + return mavlink_msg_open_drone_id_self_id_pack_status(system_id, component_id, _status, msg, open_drone_id_self_id->target_system, open_drone_id_self_id->target_component, open_drone_id_self_id->id_or_mac, open_drone_id_self_id->description_type, open_drone_id_self_id->description); +} + /** * @brief Send a open_drone_id_self_id message * @param chan MAVLink channel to send the message @@ -179,8 +236,8 @@ static inline void mavlink_msg_open_drone_id_self_id_send(mavlink_channel_t chan packet.target_system = target_system; packet.target_component = target_component; packet.description_type = description_type; - mav_array_memcpy(packet.id_or_mac, id_or_mac, sizeof(uint8_t)*20); - mav_array_memcpy(packet.description, description, sizeof(char)*23); + mav_array_assign_uint8_t(packet.id_or_mac, id_or_mac, 20); + mav_array_assign_char(packet.description, description, 23); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_SELF_ID, (const char *)&packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_SELF_ID_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SELF_ID_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SELF_ID_CRC); #endif } @@ -201,7 +258,7 @@ static inline void mavlink_msg_open_drone_id_self_id_send_struct(mavlink_channel #if MAVLINK_MSG_ID_OPEN_DRONE_ID_SELF_ID_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -222,8 +279,8 @@ static inline void mavlink_msg_open_drone_id_self_id_send_buf(mavlink_message_t packet->target_system = target_system; packet->target_component = target_component; packet->description_type = description_type; - mav_array_memcpy(packet->id_or_mac, id_or_mac, sizeof(uint8_t)*20); - mav_array_memcpy(packet->description, description, sizeof(char)*23); + mav_array_assign_uint8_t(packet->id_or_mac, id_or_mac, 20); + mav_array_assign_char(packet->description, description, 23); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_SELF_ID, (const char *)packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_SELF_ID_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SELF_ID_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SELF_ID_CRC); #endif } diff --git a/common/mavlink_msg_open_drone_id_system.h b/common/mavlink_msg_open_drone_id_system.h index 2af999649..f7ce48741 100644 --- a/common/mavlink_msg_open_drone_id_system.h +++ b/common/mavlink_msg_open_drone_id_system.h @@ -7,10 +7,12 @@ typedef struct __mavlink_open_drone_id_system_t { int32_t operator_latitude; /*< [degE7] Latitude of the operator. If unknown: 0 (both Lat/Lon).*/ int32_t operator_longitude; /*< [degE7] Longitude of the operator. If unknown: 0 (both Lat/Lon).*/ - float area_ceiling; /*< [m] Area Operations Ceiling relative to WGS84. If unknown: -1000 m.*/ - float area_floor; /*< [m] Area Operations Floor relative to WGS84. If unknown: -1000 m.*/ - uint16_t area_count; /*< Number of aircraft in the area, group or formation (default 1).*/ - uint16_t area_radius; /*< [m] Radius of the cylindrical area of the group or formation (default 0).*/ + float area_ceiling; /*< [m] Area Operations Ceiling relative to WGS84. If unknown: -1000 m. Used only for swarms/multiple UA.*/ + float area_floor; /*< [m] Area Operations Floor relative to WGS84. If unknown: -1000 m. Used only for swarms/multiple UA.*/ + float operator_altitude_geo; /*< [m] Geodetic altitude of the operator relative to WGS84. If unknown: -1000 m.*/ + uint32_t timestamp; /*< [s] 32 bit Unix Timestamp in seconds since 00:00:00 01/01/2019.*/ + uint16_t area_count; /*< Number of aircraft in the area, group or formation (default 1). Used only for swarms/multiple UA.*/ + uint16_t area_radius; /*< [m] Radius of the cylindrical area of the group or formation (default 0). Used only for swarms/multiple UA.*/ uint8_t target_system; /*< System ID (0 for broadcast).*/ uint8_t target_component; /*< Component ID (0 for broadcast).*/ uint8_t id_or_mac[20]; /*< Only used for drone ID data received from other UAs. See detailed description at https://mavlink.io/en/services/opendroneid.html. */ @@ -20,13 +22,13 @@ typedef struct __mavlink_open_drone_id_system_t { uint8_t class_eu; /*< When classification_type is MAV_ODID_CLASSIFICATION_TYPE_EU, specifies the class of the UA.*/ } mavlink_open_drone_id_system_t; -#define MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_LEN 46 -#define MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_MIN_LEN 46 -#define MAVLINK_MSG_ID_12904_LEN 46 -#define MAVLINK_MSG_ID_12904_MIN_LEN 46 +#define MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_LEN 54 +#define MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_MIN_LEN 54 +#define MAVLINK_MSG_ID_12904_LEN 54 +#define MAVLINK_MSG_ID_12904_MIN_LEN 54 -#define MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_CRC 203 -#define MAVLINK_MSG_ID_12904_CRC 203 +#define MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_CRC 77 +#define MAVLINK_MSG_ID_12904_CRC 77 #define MAVLINK_MSG_OPEN_DRONE_ID_SYSTEM_FIELD_ID_OR_MAC_LEN 20 @@ -34,39 +36,43 @@ typedef struct __mavlink_open_drone_id_system_t { #define MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_SYSTEM { \ 12904, \ "OPEN_DRONE_ID_SYSTEM", \ - 13, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 20, offsetof(mavlink_open_drone_id_system_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 21, offsetof(mavlink_open_drone_id_system_t, target_component) }, \ - { "id_or_mac", NULL, MAVLINK_TYPE_UINT8_T, 20, 22, offsetof(mavlink_open_drone_id_system_t, id_or_mac) }, \ - { "operator_location_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 42, offsetof(mavlink_open_drone_id_system_t, operator_location_type) }, \ - { "classification_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 43, offsetof(mavlink_open_drone_id_system_t, classification_type) }, \ + 15, \ + { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_open_drone_id_system_t, target_system) }, \ + { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_open_drone_id_system_t, target_component) }, \ + { "id_or_mac", NULL, MAVLINK_TYPE_UINT8_T, 20, 30, offsetof(mavlink_open_drone_id_system_t, id_or_mac) }, \ + { "operator_location_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 50, offsetof(mavlink_open_drone_id_system_t, operator_location_type) }, \ + { "classification_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 51, offsetof(mavlink_open_drone_id_system_t, classification_type) }, \ { "operator_latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_open_drone_id_system_t, operator_latitude) }, \ { "operator_longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_open_drone_id_system_t, operator_longitude) }, \ - { "area_count", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_open_drone_id_system_t, area_count) }, \ - { "area_radius", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_open_drone_id_system_t, area_radius) }, \ + { "area_count", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_open_drone_id_system_t, area_count) }, \ + { "area_radius", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_open_drone_id_system_t, area_radius) }, \ { "area_ceiling", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_open_drone_id_system_t, area_ceiling) }, \ { "area_floor", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_open_drone_id_system_t, area_floor) }, \ - { "category_eu", NULL, MAVLINK_TYPE_UINT8_T, 0, 44, offsetof(mavlink_open_drone_id_system_t, category_eu) }, \ - { "class_eu", NULL, MAVLINK_TYPE_UINT8_T, 0, 45, offsetof(mavlink_open_drone_id_system_t, class_eu) }, \ + { "category_eu", NULL, MAVLINK_TYPE_UINT8_T, 0, 52, offsetof(mavlink_open_drone_id_system_t, category_eu) }, \ + { "class_eu", NULL, MAVLINK_TYPE_UINT8_T, 0, 53, offsetof(mavlink_open_drone_id_system_t, class_eu) }, \ + { "operator_altitude_geo", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_open_drone_id_system_t, operator_altitude_geo) }, \ + { "timestamp", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_open_drone_id_system_t, timestamp) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_SYSTEM { \ "OPEN_DRONE_ID_SYSTEM", \ - 13, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 20, offsetof(mavlink_open_drone_id_system_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 21, offsetof(mavlink_open_drone_id_system_t, target_component) }, \ - { "id_or_mac", NULL, MAVLINK_TYPE_UINT8_T, 20, 22, offsetof(mavlink_open_drone_id_system_t, id_or_mac) }, \ - { "operator_location_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 42, offsetof(mavlink_open_drone_id_system_t, operator_location_type) }, \ - { "classification_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 43, offsetof(mavlink_open_drone_id_system_t, classification_type) }, \ + 15, \ + { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_open_drone_id_system_t, target_system) }, \ + { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_open_drone_id_system_t, target_component) }, \ + { "id_or_mac", NULL, MAVLINK_TYPE_UINT8_T, 20, 30, offsetof(mavlink_open_drone_id_system_t, id_or_mac) }, \ + { "operator_location_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 50, offsetof(mavlink_open_drone_id_system_t, operator_location_type) }, \ + { "classification_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 51, offsetof(mavlink_open_drone_id_system_t, classification_type) }, \ { "operator_latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_open_drone_id_system_t, operator_latitude) }, \ { "operator_longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_open_drone_id_system_t, operator_longitude) }, \ - { "area_count", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_open_drone_id_system_t, area_count) }, \ - { "area_radius", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_open_drone_id_system_t, area_radius) }, \ + { "area_count", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_open_drone_id_system_t, area_count) }, \ + { "area_radius", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_open_drone_id_system_t, area_radius) }, \ { "area_ceiling", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_open_drone_id_system_t, area_ceiling) }, \ { "area_floor", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_open_drone_id_system_t, area_floor) }, \ - { "category_eu", NULL, MAVLINK_TYPE_UINT8_T, 0, 44, offsetof(mavlink_open_drone_id_system_t, category_eu) }, \ - { "class_eu", NULL, MAVLINK_TYPE_UINT8_T, 0, 45, offsetof(mavlink_open_drone_id_system_t, class_eu) }, \ + { "category_eu", NULL, MAVLINK_TYPE_UINT8_T, 0, 52, offsetof(mavlink_open_drone_id_system_t, category_eu) }, \ + { "class_eu", NULL, MAVLINK_TYPE_UINT8_T, 0, 53, offsetof(mavlink_open_drone_id_system_t, class_eu) }, \ + { "operator_altitude_geo", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_open_drone_id_system_t, operator_altitude_geo) }, \ + { "timestamp", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_open_drone_id_system_t, timestamp) }, \ } \ } #endif @@ -84,16 +90,18 @@ typedef struct __mavlink_open_drone_id_system_t { * @param classification_type Specifies the classification type of the UA. * @param operator_latitude [degE7] Latitude of the operator. If unknown: 0 (both Lat/Lon). * @param operator_longitude [degE7] Longitude of the operator. If unknown: 0 (both Lat/Lon). - * @param area_count Number of aircraft in the area, group or formation (default 1). - * @param area_radius [m] Radius of the cylindrical area of the group or formation (default 0). - * @param area_ceiling [m] Area Operations Ceiling relative to WGS84. If unknown: -1000 m. - * @param area_floor [m] Area Operations Floor relative to WGS84. If unknown: -1000 m. + * @param area_count Number of aircraft in the area, group or formation (default 1). Used only for swarms/multiple UA. + * @param area_radius [m] Radius of the cylindrical area of the group or formation (default 0). Used only for swarms/multiple UA. + * @param area_ceiling [m] Area Operations Ceiling relative to WGS84. If unknown: -1000 m. Used only for swarms/multiple UA. + * @param area_floor [m] Area Operations Floor relative to WGS84. If unknown: -1000 m. Used only for swarms/multiple UA. * @param category_eu When classification_type is MAV_ODID_CLASSIFICATION_TYPE_EU, specifies the category of the UA. * @param class_eu When classification_type is MAV_ODID_CLASSIFICATION_TYPE_EU, specifies the class of the UA. + * @param operator_altitude_geo [m] Geodetic altitude of the operator relative to WGS84. If unknown: -1000 m. + * @param timestamp [s] 32 bit Unix Timestamp in seconds since 00:00:00 01/01/2019. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_open_drone_id_system_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, const uint8_t *id_or_mac, uint8_t operator_location_type, uint8_t classification_type, int32_t operator_latitude, int32_t operator_longitude, uint16_t area_count, uint16_t area_radius, float area_ceiling, float area_floor, uint8_t category_eu, uint8_t class_eu) + uint8_t target_system, uint8_t target_component, const uint8_t *id_or_mac, uint8_t operator_location_type, uint8_t classification_type, int32_t operator_latitude, int32_t operator_longitude, uint16_t area_count, uint16_t area_radius, float area_ceiling, float area_floor, uint8_t category_eu, uint8_t class_eu, float operator_altitude_geo, uint32_t timestamp) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_LEN]; @@ -101,15 +109,17 @@ static inline uint16_t mavlink_msg_open_drone_id_system_pack(uint8_t system_id, _mav_put_int32_t(buf, 4, operator_longitude); _mav_put_float(buf, 8, area_ceiling); _mav_put_float(buf, 12, area_floor); - _mav_put_uint16_t(buf, 16, area_count); - _mav_put_uint16_t(buf, 18, area_radius); - _mav_put_uint8_t(buf, 20, target_system); - _mav_put_uint8_t(buf, 21, target_component); - _mav_put_uint8_t(buf, 42, operator_location_type); - _mav_put_uint8_t(buf, 43, classification_type); - _mav_put_uint8_t(buf, 44, category_eu); - _mav_put_uint8_t(buf, 45, class_eu); - _mav_put_uint8_t_array(buf, 22, id_or_mac, 20); + _mav_put_float(buf, 16, operator_altitude_geo); + _mav_put_uint32_t(buf, 20, timestamp); + _mav_put_uint16_t(buf, 24, area_count); + _mav_put_uint16_t(buf, 26, area_radius); + _mav_put_uint8_t(buf, 28, target_system); + _mav_put_uint8_t(buf, 29, target_component); + _mav_put_uint8_t(buf, 50, operator_location_type); + _mav_put_uint8_t(buf, 51, classification_type); + _mav_put_uint8_t(buf, 52, category_eu); + _mav_put_uint8_t(buf, 53, class_eu); + _mav_put_uint8_t_array(buf, 30, id_or_mac, 20); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_LEN); #else mavlink_open_drone_id_system_t packet; @@ -117,6 +127,8 @@ static inline uint16_t mavlink_msg_open_drone_id_system_pack(uint8_t system_id, packet.operator_longitude = operator_longitude; packet.area_ceiling = area_ceiling; packet.area_floor = area_floor; + packet.operator_altitude_geo = operator_altitude_geo; + packet.timestamp = timestamp; packet.area_count = area_count; packet.area_radius = area_radius; packet.target_system = target_system; @@ -125,7 +137,7 @@ static inline uint16_t mavlink_msg_open_drone_id_system_pack(uint8_t system_id, packet.classification_type = classification_type; packet.category_eu = category_eu; packet.class_eu = class_eu; - mav_array_memcpy(packet.id_or_mac, id_or_mac, sizeof(uint8_t)*20); + mav_array_assign_uint8_t(packet.id_or_mac, id_or_mac, 20); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_LEN); #endif @@ -133,6 +145,79 @@ static inline uint16_t mavlink_msg_open_drone_id_system_pack(uint8_t system_id, return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_CRC); } +/** + * @brief Pack a open_drone_id_system message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID (0 for broadcast). + * @param target_component Component ID (0 for broadcast). + * @param id_or_mac Only used for drone ID data received from other UAs. See detailed description at https://mavlink.io/en/services/opendroneid.html. + * @param operator_location_type Specifies the operator location type. + * @param classification_type Specifies the classification type of the UA. + * @param operator_latitude [degE7] Latitude of the operator. If unknown: 0 (both Lat/Lon). + * @param operator_longitude [degE7] Longitude of the operator. If unknown: 0 (both Lat/Lon). + * @param area_count Number of aircraft in the area, group or formation (default 1). Used only for swarms/multiple UA. + * @param area_radius [m] Radius of the cylindrical area of the group or formation (default 0). Used only for swarms/multiple UA. + * @param area_ceiling [m] Area Operations Ceiling relative to WGS84. If unknown: -1000 m. Used only for swarms/multiple UA. + * @param area_floor [m] Area Operations Floor relative to WGS84. If unknown: -1000 m. Used only for swarms/multiple UA. + * @param category_eu When classification_type is MAV_ODID_CLASSIFICATION_TYPE_EU, specifies the category of the UA. + * @param class_eu When classification_type is MAV_ODID_CLASSIFICATION_TYPE_EU, specifies the class of the UA. + * @param operator_altitude_geo [m] Geodetic altitude of the operator relative to WGS84. If unknown: -1000 m. + * @param timestamp [s] 32 bit Unix Timestamp in seconds since 00:00:00 01/01/2019. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_open_drone_id_system_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, const uint8_t *id_or_mac, uint8_t operator_location_type, uint8_t classification_type, int32_t operator_latitude, int32_t operator_longitude, uint16_t area_count, uint16_t area_radius, float area_ceiling, float area_floor, uint8_t category_eu, uint8_t class_eu, float operator_altitude_geo, uint32_t timestamp) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_LEN]; + _mav_put_int32_t(buf, 0, operator_latitude); + _mav_put_int32_t(buf, 4, operator_longitude); + _mav_put_float(buf, 8, area_ceiling); + _mav_put_float(buf, 12, area_floor); + _mav_put_float(buf, 16, operator_altitude_geo); + _mav_put_uint32_t(buf, 20, timestamp); + _mav_put_uint16_t(buf, 24, area_count); + _mav_put_uint16_t(buf, 26, area_radius); + _mav_put_uint8_t(buf, 28, target_system); + _mav_put_uint8_t(buf, 29, target_component); + _mav_put_uint8_t(buf, 50, operator_location_type); + _mav_put_uint8_t(buf, 51, classification_type); + _mav_put_uint8_t(buf, 52, category_eu); + _mav_put_uint8_t(buf, 53, class_eu); + _mav_put_uint8_t_array(buf, 30, id_or_mac, 20); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_LEN); +#else + mavlink_open_drone_id_system_t packet; + packet.operator_latitude = operator_latitude; + packet.operator_longitude = operator_longitude; + packet.area_ceiling = area_ceiling; + packet.area_floor = area_floor; + packet.operator_altitude_geo = operator_altitude_geo; + packet.timestamp = timestamp; + packet.area_count = area_count; + packet.area_radius = area_radius; + packet.target_system = target_system; + packet.target_component = target_component; + packet.operator_location_type = operator_location_type; + packet.classification_type = classification_type; + packet.category_eu = category_eu; + packet.class_eu = class_eu; + mav_array_memcpy(packet.id_or_mac, id_or_mac, sizeof(uint8_t)*20); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_LEN); +#endif +} + /** * @brief Pack a open_drone_id_system message on a channel * @param system_id ID of this system @@ -146,17 +231,19 @@ static inline uint16_t mavlink_msg_open_drone_id_system_pack(uint8_t system_id, * @param classification_type Specifies the classification type of the UA. * @param operator_latitude [degE7] Latitude of the operator. If unknown: 0 (both Lat/Lon). * @param operator_longitude [degE7] Longitude of the operator. If unknown: 0 (both Lat/Lon). - * @param area_count Number of aircraft in the area, group or formation (default 1). - * @param area_radius [m] Radius of the cylindrical area of the group or formation (default 0). - * @param area_ceiling [m] Area Operations Ceiling relative to WGS84. If unknown: -1000 m. - * @param area_floor [m] Area Operations Floor relative to WGS84. If unknown: -1000 m. + * @param area_count Number of aircraft in the area, group or formation (default 1). Used only for swarms/multiple UA. + * @param area_radius [m] Radius of the cylindrical area of the group or formation (default 0). Used only for swarms/multiple UA. + * @param area_ceiling [m] Area Operations Ceiling relative to WGS84. If unknown: -1000 m. Used only for swarms/multiple UA. + * @param area_floor [m] Area Operations Floor relative to WGS84. If unknown: -1000 m. Used only for swarms/multiple UA. * @param category_eu When classification_type is MAV_ODID_CLASSIFICATION_TYPE_EU, specifies the category of the UA. * @param class_eu When classification_type is MAV_ODID_CLASSIFICATION_TYPE_EU, specifies the class of the UA. + * @param operator_altitude_geo [m] Geodetic altitude of the operator relative to WGS84. If unknown: -1000 m. + * @param timestamp [s] 32 bit Unix Timestamp in seconds since 00:00:00 01/01/2019. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_open_drone_id_system_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,const uint8_t *id_or_mac,uint8_t operator_location_type,uint8_t classification_type,int32_t operator_latitude,int32_t operator_longitude,uint16_t area_count,uint16_t area_radius,float area_ceiling,float area_floor,uint8_t category_eu,uint8_t class_eu) + uint8_t target_system,uint8_t target_component,const uint8_t *id_or_mac,uint8_t operator_location_type,uint8_t classification_type,int32_t operator_latitude,int32_t operator_longitude,uint16_t area_count,uint16_t area_radius,float area_ceiling,float area_floor,uint8_t category_eu,uint8_t class_eu,float operator_altitude_geo,uint32_t timestamp) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_LEN]; @@ -164,15 +251,17 @@ static inline uint16_t mavlink_msg_open_drone_id_system_pack_chan(uint8_t system _mav_put_int32_t(buf, 4, operator_longitude); _mav_put_float(buf, 8, area_ceiling); _mav_put_float(buf, 12, area_floor); - _mav_put_uint16_t(buf, 16, area_count); - _mav_put_uint16_t(buf, 18, area_radius); - _mav_put_uint8_t(buf, 20, target_system); - _mav_put_uint8_t(buf, 21, target_component); - _mav_put_uint8_t(buf, 42, operator_location_type); - _mav_put_uint8_t(buf, 43, classification_type); - _mav_put_uint8_t(buf, 44, category_eu); - _mav_put_uint8_t(buf, 45, class_eu); - _mav_put_uint8_t_array(buf, 22, id_or_mac, 20); + _mav_put_float(buf, 16, operator_altitude_geo); + _mav_put_uint32_t(buf, 20, timestamp); + _mav_put_uint16_t(buf, 24, area_count); + _mav_put_uint16_t(buf, 26, area_radius); + _mav_put_uint8_t(buf, 28, target_system); + _mav_put_uint8_t(buf, 29, target_component); + _mav_put_uint8_t(buf, 50, operator_location_type); + _mav_put_uint8_t(buf, 51, classification_type); + _mav_put_uint8_t(buf, 52, category_eu); + _mav_put_uint8_t(buf, 53, class_eu); + _mav_put_uint8_t_array(buf, 30, id_or_mac, 20); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_LEN); #else mavlink_open_drone_id_system_t packet; @@ -180,6 +269,8 @@ static inline uint16_t mavlink_msg_open_drone_id_system_pack_chan(uint8_t system packet.operator_longitude = operator_longitude; packet.area_ceiling = area_ceiling; packet.area_floor = area_floor; + packet.operator_altitude_geo = operator_altitude_geo; + packet.timestamp = timestamp; packet.area_count = area_count; packet.area_radius = area_radius; packet.target_system = target_system; @@ -188,7 +279,7 @@ static inline uint16_t mavlink_msg_open_drone_id_system_pack_chan(uint8_t system packet.classification_type = classification_type; packet.category_eu = category_eu; packet.class_eu = class_eu; - mav_array_memcpy(packet.id_or_mac, id_or_mac, sizeof(uint8_t)*20); + mav_array_assign_uint8_t(packet.id_or_mac, id_or_mac, 20); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_LEN); #endif @@ -206,7 +297,7 @@ static inline uint16_t mavlink_msg_open_drone_id_system_pack_chan(uint8_t system */ static inline uint16_t mavlink_msg_open_drone_id_system_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_open_drone_id_system_t* open_drone_id_system) { - return mavlink_msg_open_drone_id_system_pack(system_id, component_id, msg, open_drone_id_system->target_system, open_drone_id_system->target_component, open_drone_id_system->id_or_mac, open_drone_id_system->operator_location_type, open_drone_id_system->classification_type, open_drone_id_system->operator_latitude, open_drone_id_system->operator_longitude, open_drone_id_system->area_count, open_drone_id_system->area_radius, open_drone_id_system->area_ceiling, open_drone_id_system->area_floor, open_drone_id_system->category_eu, open_drone_id_system->class_eu); + return mavlink_msg_open_drone_id_system_pack(system_id, component_id, msg, open_drone_id_system->target_system, open_drone_id_system->target_component, open_drone_id_system->id_or_mac, open_drone_id_system->operator_location_type, open_drone_id_system->classification_type, open_drone_id_system->operator_latitude, open_drone_id_system->operator_longitude, open_drone_id_system->area_count, open_drone_id_system->area_radius, open_drone_id_system->area_ceiling, open_drone_id_system->area_floor, open_drone_id_system->category_eu, open_drone_id_system->class_eu, open_drone_id_system->operator_altitude_geo, open_drone_id_system->timestamp); } /** @@ -220,7 +311,21 @@ static inline uint16_t mavlink_msg_open_drone_id_system_encode(uint8_t system_id */ static inline uint16_t mavlink_msg_open_drone_id_system_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_open_drone_id_system_t* open_drone_id_system) { - return mavlink_msg_open_drone_id_system_pack_chan(system_id, component_id, chan, msg, open_drone_id_system->target_system, open_drone_id_system->target_component, open_drone_id_system->id_or_mac, open_drone_id_system->operator_location_type, open_drone_id_system->classification_type, open_drone_id_system->operator_latitude, open_drone_id_system->operator_longitude, open_drone_id_system->area_count, open_drone_id_system->area_radius, open_drone_id_system->area_ceiling, open_drone_id_system->area_floor, open_drone_id_system->category_eu, open_drone_id_system->class_eu); + return mavlink_msg_open_drone_id_system_pack_chan(system_id, component_id, chan, msg, open_drone_id_system->target_system, open_drone_id_system->target_component, open_drone_id_system->id_or_mac, open_drone_id_system->operator_location_type, open_drone_id_system->classification_type, open_drone_id_system->operator_latitude, open_drone_id_system->operator_longitude, open_drone_id_system->area_count, open_drone_id_system->area_radius, open_drone_id_system->area_ceiling, open_drone_id_system->area_floor, open_drone_id_system->category_eu, open_drone_id_system->class_eu, open_drone_id_system->operator_altitude_geo, open_drone_id_system->timestamp); +} + +/** + * @brief Encode a open_drone_id_system struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param open_drone_id_system C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_open_drone_id_system_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_open_drone_id_system_t* open_drone_id_system) +{ + return mavlink_msg_open_drone_id_system_pack_status(system_id, component_id, _status, msg, open_drone_id_system->target_system, open_drone_id_system->target_component, open_drone_id_system->id_or_mac, open_drone_id_system->operator_location_type, open_drone_id_system->classification_type, open_drone_id_system->operator_latitude, open_drone_id_system->operator_longitude, open_drone_id_system->area_count, open_drone_id_system->area_radius, open_drone_id_system->area_ceiling, open_drone_id_system->area_floor, open_drone_id_system->category_eu, open_drone_id_system->class_eu, open_drone_id_system->operator_altitude_geo, open_drone_id_system->timestamp); } /** @@ -234,16 +339,18 @@ static inline uint16_t mavlink_msg_open_drone_id_system_encode_chan(uint8_t syst * @param classification_type Specifies the classification type of the UA. * @param operator_latitude [degE7] Latitude of the operator. If unknown: 0 (both Lat/Lon). * @param operator_longitude [degE7] Longitude of the operator. If unknown: 0 (both Lat/Lon). - * @param area_count Number of aircraft in the area, group or formation (default 1). - * @param area_radius [m] Radius of the cylindrical area of the group or formation (default 0). - * @param area_ceiling [m] Area Operations Ceiling relative to WGS84. If unknown: -1000 m. - * @param area_floor [m] Area Operations Floor relative to WGS84. If unknown: -1000 m. + * @param area_count Number of aircraft in the area, group or formation (default 1). Used only for swarms/multiple UA. + * @param area_radius [m] Radius of the cylindrical area of the group or formation (default 0). Used only for swarms/multiple UA. + * @param area_ceiling [m] Area Operations Ceiling relative to WGS84. If unknown: -1000 m. Used only for swarms/multiple UA. + * @param area_floor [m] Area Operations Floor relative to WGS84. If unknown: -1000 m. Used only for swarms/multiple UA. * @param category_eu When classification_type is MAV_ODID_CLASSIFICATION_TYPE_EU, specifies the category of the UA. * @param class_eu When classification_type is MAV_ODID_CLASSIFICATION_TYPE_EU, specifies the class of the UA. + * @param operator_altitude_geo [m] Geodetic altitude of the operator relative to WGS84. If unknown: -1000 m. + * @param timestamp [s] 32 bit Unix Timestamp in seconds since 00:00:00 01/01/2019. */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_open_drone_id_system_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, const uint8_t *id_or_mac, uint8_t operator_location_type, uint8_t classification_type, int32_t operator_latitude, int32_t operator_longitude, uint16_t area_count, uint16_t area_radius, float area_ceiling, float area_floor, uint8_t category_eu, uint8_t class_eu) +static inline void mavlink_msg_open_drone_id_system_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, const uint8_t *id_or_mac, uint8_t operator_location_type, uint8_t classification_type, int32_t operator_latitude, int32_t operator_longitude, uint16_t area_count, uint16_t area_radius, float area_ceiling, float area_floor, uint8_t category_eu, uint8_t class_eu, float operator_altitude_geo, uint32_t timestamp) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_LEN]; @@ -251,15 +358,17 @@ static inline void mavlink_msg_open_drone_id_system_send(mavlink_channel_t chan, _mav_put_int32_t(buf, 4, operator_longitude); _mav_put_float(buf, 8, area_ceiling); _mav_put_float(buf, 12, area_floor); - _mav_put_uint16_t(buf, 16, area_count); - _mav_put_uint16_t(buf, 18, area_radius); - _mav_put_uint8_t(buf, 20, target_system); - _mav_put_uint8_t(buf, 21, target_component); - _mav_put_uint8_t(buf, 42, operator_location_type); - _mav_put_uint8_t(buf, 43, classification_type); - _mav_put_uint8_t(buf, 44, category_eu); - _mav_put_uint8_t(buf, 45, class_eu); - _mav_put_uint8_t_array(buf, 22, id_or_mac, 20); + _mav_put_float(buf, 16, operator_altitude_geo); + _mav_put_uint32_t(buf, 20, timestamp); + _mav_put_uint16_t(buf, 24, area_count); + _mav_put_uint16_t(buf, 26, area_radius); + _mav_put_uint8_t(buf, 28, target_system); + _mav_put_uint8_t(buf, 29, target_component); + _mav_put_uint8_t(buf, 50, operator_location_type); + _mav_put_uint8_t(buf, 51, classification_type); + _mav_put_uint8_t(buf, 52, category_eu); + _mav_put_uint8_t(buf, 53, class_eu); + _mav_put_uint8_t_array(buf, 30, id_or_mac, 20); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM, buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_CRC); #else mavlink_open_drone_id_system_t packet; @@ -267,6 +376,8 @@ static inline void mavlink_msg_open_drone_id_system_send(mavlink_channel_t chan, packet.operator_longitude = operator_longitude; packet.area_ceiling = area_ceiling; packet.area_floor = area_floor; + packet.operator_altitude_geo = operator_altitude_geo; + packet.timestamp = timestamp; packet.area_count = area_count; packet.area_radius = area_radius; packet.target_system = target_system; @@ -275,7 +386,7 @@ static inline void mavlink_msg_open_drone_id_system_send(mavlink_channel_t chan, packet.classification_type = classification_type; packet.category_eu = category_eu; packet.class_eu = class_eu; - mav_array_memcpy(packet.id_or_mac, id_or_mac, sizeof(uint8_t)*20); + mav_array_assign_uint8_t(packet.id_or_mac, id_or_mac, 20); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM, (const char *)&packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_CRC); #endif } @@ -288,7 +399,7 @@ static inline void mavlink_msg_open_drone_id_system_send(mavlink_channel_t chan, static inline void mavlink_msg_open_drone_id_system_send_struct(mavlink_channel_t chan, const mavlink_open_drone_id_system_t* open_drone_id_system) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_open_drone_id_system_send(chan, open_drone_id_system->target_system, open_drone_id_system->target_component, open_drone_id_system->id_or_mac, open_drone_id_system->operator_location_type, open_drone_id_system->classification_type, open_drone_id_system->operator_latitude, open_drone_id_system->operator_longitude, open_drone_id_system->area_count, open_drone_id_system->area_radius, open_drone_id_system->area_ceiling, open_drone_id_system->area_floor, open_drone_id_system->category_eu, open_drone_id_system->class_eu); + mavlink_msg_open_drone_id_system_send(chan, open_drone_id_system->target_system, open_drone_id_system->target_component, open_drone_id_system->id_or_mac, open_drone_id_system->operator_location_type, open_drone_id_system->classification_type, open_drone_id_system->operator_latitude, open_drone_id_system->operator_longitude, open_drone_id_system->area_count, open_drone_id_system->area_radius, open_drone_id_system->area_ceiling, open_drone_id_system->area_floor, open_drone_id_system->category_eu, open_drone_id_system->class_eu, open_drone_id_system->operator_altitude_geo, open_drone_id_system->timestamp); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM, (const char *)open_drone_id_system, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_CRC); #endif @@ -296,13 +407,13 @@ static inline void mavlink_msg_open_drone_id_system_send_struct(mavlink_channel_ #if MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_open_drone_id_system_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, const uint8_t *id_or_mac, uint8_t operator_location_type, uint8_t classification_type, int32_t operator_latitude, int32_t operator_longitude, uint16_t area_count, uint16_t area_radius, float area_ceiling, float area_floor, uint8_t category_eu, uint8_t class_eu) +static inline void mavlink_msg_open_drone_id_system_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, const uint8_t *id_or_mac, uint8_t operator_location_type, uint8_t classification_type, int32_t operator_latitude, int32_t operator_longitude, uint16_t area_count, uint16_t area_radius, float area_ceiling, float area_floor, uint8_t category_eu, uint8_t class_eu, float operator_altitude_geo, uint32_t timestamp) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; @@ -310,15 +421,17 @@ static inline void mavlink_msg_open_drone_id_system_send_buf(mavlink_message_t * _mav_put_int32_t(buf, 4, operator_longitude); _mav_put_float(buf, 8, area_ceiling); _mav_put_float(buf, 12, area_floor); - _mav_put_uint16_t(buf, 16, area_count); - _mav_put_uint16_t(buf, 18, area_radius); - _mav_put_uint8_t(buf, 20, target_system); - _mav_put_uint8_t(buf, 21, target_component); - _mav_put_uint8_t(buf, 42, operator_location_type); - _mav_put_uint8_t(buf, 43, classification_type); - _mav_put_uint8_t(buf, 44, category_eu); - _mav_put_uint8_t(buf, 45, class_eu); - _mav_put_uint8_t_array(buf, 22, id_or_mac, 20); + _mav_put_float(buf, 16, operator_altitude_geo); + _mav_put_uint32_t(buf, 20, timestamp); + _mav_put_uint16_t(buf, 24, area_count); + _mav_put_uint16_t(buf, 26, area_radius); + _mav_put_uint8_t(buf, 28, target_system); + _mav_put_uint8_t(buf, 29, target_component); + _mav_put_uint8_t(buf, 50, operator_location_type); + _mav_put_uint8_t(buf, 51, classification_type); + _mav_put_uint8_t(buf, 52, category_eu); + _mav_put_uint8_t(buf, 53, class_eu); + _mav_put_uint8_t_array(buf, 30, id_or_mac, 20); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM, buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_CRC); #else mavlink_open_drone_id_system_t *packet = (mavlink_open_drone_id_system_t *)msgbuf; @@ -326,6 +439,8 @@ static inline void mavlink_msg_open_drone_id_system_send_buf(mavlink_message_t * packet->operator_longitude = operator_longitude; packet->area_ceiling = area_ceiling; packet->area_floor = area_floor; + packet->operator_altitude_geo = operator_altitude_geo; + packet->timestamp = timestamp; packet->area_count = area_count; packet->area_radius = area_radius; packet->target_system = target_system; @@ -334,7 +449,7 @@ static inline void mavlink_msg_open_drone_id_system_send_buf(mavlink_message_t * packet->classification_type = classification_type; packet->category_eu = category_eu; packet->class_eu = class_eu; - mav_array_memcpy(packet->id_or_mac, id_or_mac, sizeof(uint8_t)*20); + mav_array_assign_uint8_t(packet->id_or_mac, id_or_mac, 20); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM, (const char *)packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_CRC); #endif } @@ -352,7 +467,7 @@ static inline void mavlink_msg_open_drone_id_system_send_buf(mavlink_message_t * */ static inline uint8_t mavlink_msg_open_drone_id_system_get_target_system(const mavlink_message_t* msg) { - return _MAV_RETURN_uint8_t(msg, 20); + return _MAV_RETURN_uint8_t(msg, 28); } /** @@ -362,7 +477,7 @@ static inline uint8_t mavlink_msg_open_drone_id_system_get_target_system(const m */ static inline uint8_t mavlink_msg_open_drone_id_system_get_target_component(const mavlink_message_t* msg) { - return _MAV_RETURN_uint8_t(msg, 21); + return _MAV_RETURN_uint8_t(msg, 29); } /** @@ -372,7 +487,7 @@ static inline uint8_t mavlink_msg_open_drone_id_system_get_target_component(cons */ static inline uint16_t mavlink_msg_open_drone_id_system_get_id_or_mac(const mavlink_message_t* msg, uint8_t *id_or_mac) { - return _MAV_RETURN_uint8_t_array(msg, id_or_mac, 20, 22); + return _MAV_RETURN_uint8_t_array(msg, id_or_mac, 20, 30); } /** @@ -382,7 +497,7 @@ static inline uint16_t mavlink_msg_open_drone_id_system_get_id_or_mac(const mavl */ static inline uint8_t mavlink_msg_open_drone_id_system_get_operator_location_type(const mavlink_message_t* msg) { - return _MAV_RETURN_uint8_t(msg, 42); + return _MAV_RETURN_uint8_t(msg, 50); } /** @@ -392,7 +507,7 @@ static inline uint8_t mavlink_msg_open_drone_id_system_get_operator_location_typ */ static inline uint8_t mavlink_msg_open_drone_id_system_get_classification_type(const mavlink_message_t* msg) { - return _MAV_RETURN_uint8_t(msg, 43); + return _MAV_RETURN_uint8_t(msg, 51); } /** @@ -418,27 +533,27 @@ static inline int32_t mavlink_msg_open_drone_id_system_get_operator_longitude(co /** * @brief Get field area_count from open_drone_id_system message * - * @return Number of aircraft in the area, group or formation (default 1). + * @return Number of aircraft in the area, group or formation (default 1). Used only for swarms/multiple UA. */ static inline uint16_t mavlink_msg_open_drone_id_system_get_area_count(const mavlink_message_t* msg) { - return _MAV_RETURN_uint16_t(msg, 16); + return _MAV_RETURN_uint16_t(msg, 24); } /** * @brief Get field area_radius from open_drone_id_system message * - * @return [m] Radius of the cylindrical area of the group or formation (default 0). + * @return [m] Radius of the cylindrical area of the group or formation (default 0). Used only for swarms/multiple UA. */ static inline uint16_t mavlink_msg_open_drone_id_system_get_area_radius(const mavlink_message_t* msg) { - return _MAV_RETURN_uint16_t(msg, 18); + return _MAV_RETURN_uint16_t(msg, 26); } /** * @brief Get field area_ceiling from open_drone_id_system message * - * @return [m] Area Operations Ceiling relative to WGS84. If unknown: -1000 m. + * @return [m] Area Operations Ceiling relative to WGS84. If unknown: -1000 m. Used only for swarms/multiple UA. */ static inline float mavlink_msg_open_drone_id_system_get_area_ceiling(const mavlink_message_t* msg) { @@ -448,7 +563,7 @@ static inline float mavlink_msg_open_drone_id_system_get_area_ceiling(const mavl /** * @brief Get field area_floor from open_drone_id_system message * - * @return [m] Area Operations Floor relative to WGS84. If unknown: -1000 m. + * @return [m] Area Operations Floor relative to WGS84. If unknown: -1000 m. Used only for swarms/multiple UA. */ static inline float mavlink_msg_open_drone_id_system_get_area_floor(const mavlink_message_t* msg) { @@ -462,7 +577,7 @@ static inline float mavlink_msg_open_drone_id_system_get_area_floor(const mavlin */ static inline uint8_t mavlink_msg_open_drone_id_system_get_category_eu(const mavlink_message_t* msg) { - return _MAV_RETURN_uint8_t(msg, 44); + return _MAV_RETURN_uint8_t(msg, 52); } /** @@ -472,7 +587,27 @@ static inline uint8_t mavlink_msg_open_drone_id_system_get_category_eu(const mav */ static inline uint8_t mavlink_msg_open_drone_id_system_get_class_eu(const mavlink_message_t* msg) { - return _MAV_RETURN_uint8_t(msg, 45); + return _MAV_RETURN_uint8_t(msg, 53); +} + +/** + * @brief Get field operator_altitude_geo from open_drone_id_system message + * + * @return [m] Geodetic altitude of the operator relative to WGS84. If unknown: -1000 m. + */ +static inline float mavlink_msg_open_drone_id_system_get_operator_altitude_geo(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 16); +} + +/** + * @brief Get field timestamp from open_drone_id_system message + * + * @return [s] 32 bit Unix Timestamp in seconds since 00:00:00 01/01/2019. + */ +static inline uint32_t mavlink_msg_open_drone_id_system_get_timestamp(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 20); } /** @@ -488,6 +623,8 @@ static inline void mavlink_msg_open_drone_id_system_decode(const mavlink_message open_drone_id_system->operator_longitude = mavlink_msg_open_drone_id_system_get_operator_longitude(msg); open_drone_id_system->area_ceiling = mavlink_msg_open_drone_id_system_get_area_ceiling(msg); open_drone_id_system->area_floor = mavlink_msg_open_drone_id_system_get_area_floor(msg); + open_drone_id_system->operator_altitude_geo = mavlink_msg_open_drone_id_system_get_operator_altitude_geo(msg); + open_drone_id_system->timestamp = mavlink_msg_open_drone_id_system_get_timestamp(msg); open_drone_id_system->area_count = mavlink_msg_open_drone_id_system_get_area_count(msg); open_drone_id_system->area_radius = mavlink_msg_open_drone_id_system_get_area_radius(msg); open_drone_id_system->target_system = mavlink_msg_open_drone_id_system_get_target_system(msg); diff --git a/common/mavlink_msg_open_drone_id_system_update.h b/common/mavlink_msg_open_drone_id_system_update.h new file mode 100644 index 000000000..438f36983 --- /dev/null +++ b/common/mavlink_msg_open_drone_id_system_update.h @@ -0,0 +1,400 @@ +#pragma once +// MESSAGE OPEN_DRONE_ID_SYSTEM_UPDATE PACKING + +#define MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE 12919 + + +typedef struct __mavlink_open_drone_id_system_update_t { + int32_t operator_latitude; /*< [degE7] Latitude of the operator. If unknown: 0 (both Lat/Lon).*/ + int32_t operator_longitude; /*< [degE7] Longitude of the operator. If unknown: 0 (both Lat/Lon).*/ + float operator_altitude_geo; /*< [m] Geodetic altitude of the operator relative to WGS84. If unknown: -1000 m.*/ + uint32_t timestamp; /*< [s] 32 bit Unix Timestamp in seconds since 00:00:00 01/01/2019.*/ + uint8_t target_system; /*< System ID (0 for broadcast).*/ + uint8_t target_component; /*< Component ID (0 for broadcast).*/ +} mavlink_open_drone_id_system_update_t; + +#define MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_LEN 18 +#define MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_MIN_LEN 18 +#define MAVLINK_MSG_ID_12919_LEN 18 +#define MAVLINK_MSG_ID_12919_MIN_LEN 18 + +#define MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_CRC 7 +#define MAVLINK_MSG_ID_12919_CRC 7 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_SYSTEM_UPDATE { \ + 12919, \ + "OPEN_DRONE_ID_SYSTEM_UPDATE", \ + 6, \ + { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_open_drone_id_system_update_t, target_system) }, \ + { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 17, offsetof(mavlink_open_drone_id_system_update_t, target_component) }, \ + { "operator_latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_open_drone_id_system_update_t, operator_latitude) }, \ + { "operator_longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_open_drone_id_system_update_t, operator_longitude) }, \ + { "operator_altitude_geo", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_open_drone_id_system_update_t, operator_altitude_geo) }, \ + { "timestamp", NULL, MAVLINK_TYPE_UINT32_T, 0, 12, offsetof(mavlink_open_drone_id_system_update_t, timestamp) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_SYSTEM_UPDATE { \ + "OPEN_DRONE_ID_SYSTEM_UPDATE", \ + 6, \ + { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_open_drone_id_system_update_t, target_system) }, \ + { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 17, offsetof(mavlink_open_drone_id_system_update_t, target_component) }, \ + { "operator_latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_open_drone_id_system_update_t, operator_latitude) }, \ + { "operator_longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_open_drone_id_system_update_t, operator_longitude) }, \ + { "operator_altitude_geo", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_open_drone_id_system_update_t, operator_altitude_geo) }, \ + { "timestamp", NULL, MAVLINK_TYPE_UINT32_T, 0, 12, offsetof(mavlink_open_drone_id_system_update_t, timestamp) }, \ + } \ +} +#endif + +/** + * @brief Pack a open_drone_id_system_update message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID (0 for broadcast). + * @param target_component Component ID (0 for broadcast). + * @param operator_latitude [degE7] Latitude of the operator. If unknown: 0 (both Lat/Lon). + * @param operator_longitude [degE7] Longitude of the operator. If unknown: 0 (both Lat/Lon). + * @param operator_altitude_geo [m] Geodetic altitude of the operator relative to WGS84. If unknown: -1000 m. + * @param timestamp [s] 32 bit Unix Timestamp in seconds since 00:00:00 01/01/2019. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_open_drone_id_system_update_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, int32_t operator_latitude, int32_t operator_longitude, float operator_altitude_geo, uint32_t timestamp) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_LEN]; + _mav_put_int32_t(buf, 0, operator_latitude); + _mav_put_int32_t(buf, 4, operator_longitude); + _mav_put_float(buf, 8, operator_altitude_geo); + _mav_put_uint32_t(buf, 12, timestamp); + _mav_put_uint8_t(buf, 16, target_system); + _mav_put_uint8_t(buf, 17, target_component); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_LEN); +#else + mavlink_open_drone_id_system_update_t packet; + packet.operator_latitude = operator_latitude; + packet.operator_longitude = operator_longitude; + packet.operator_altitude_geo = operator_altitude_geo; + packet.timestamp = timestamp; + packet.target_system = target_system; + packet.target_component = target_component; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_CRC); +} + +/** + * @brief Pack a open_drone_id_system_update message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID (0 for broadcast). + * @param target_component Component ID (0 for broadcast). + * @param operator_latitude [degE7] Latitude of the operator. If unknown: 0 (both Lat/Lon). + * @param operator_longitude [degE7] Longitude of the operator. If unknown: 0 (both Lat/Lon). + * @param operator_altitude_geo [m] Geodetic altitude of the operator relative to WGS84. If unknown: -1000 m. + * @param timestamp [s] 32 bit Unix Timestamp in seconds since 00:00:00 01/01/2019. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_open_drone_id_system_update_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, int32_t operator_latitude, int32_t operator_longitude, float operator_altitude_geo, uint32_t timestamp) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_LEN]; + _mav_put_int32_t(buf, 0, operator_latitude); + _mav_put_int32_t(buf, 4, operator_longitude); + _mav_put_float(buf, 8, operator_altitude_geo); + _mav_put_uint32_t(buf, 12, timestamp); + _mav_put_uint8_t(buf, 16, target_system); + _mav_put_uint8_t(buf, 17, target_component); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_LEN); +#else + mavlink_open_drone_id_system_update_t packet; + packet.operator_latitude = operator_latitude; + packet.operator_longitude = operator_longitude; + packet.operator_altitude_geo = operator_altitude_geo; + packet.timestamp = timestamp; + packet.target_system = target_system; + packet.target_component = target_component; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_LEN); +#endif +} + +/** + * @brief Pack a open_drone_id_system_update message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param target_system System ID (0 for broadcast). + * @param target_component Component ID (0 for broadcast). + * @param operator_latitude [degE7] Latitude of the operator. If unknown: 0 (both Lat/Lon). + * @param operator_longitude [degE7] Longitude of the operator. If unknown: 0 (both Lat/Lon). + * @param operator_altitude_geo [m] Geodetic altitude of the operator relative to WGS84. If unknown: -1000 m. + * @param timestamp [s] 32 bit Unix Timestamp in seconds since 00:00:00 01/01/2019. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_open_drone_id_system_update_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t target_system,uint8_t target_component,int32_t operator_latitude,int32_t operator_longitude,float operator_altitude_geo,uint32_t timestamp) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_LEN]; + _mav_put_int32_t(buf, 0, operator_latitude); + _mav_put_int32_t(buf, 4, operator_longitude); + _mav_put_float(buf, 8, operator_altitude_geo); + _mav_put_uint32_t(buf, 12, timestamp); + _mav_put_uint8_t(buf, 16, target_system); + _mav_put_uint8_t(buf, 17, target_component); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_LEN); +#else + mavlink_open_drone_id_system_update_t packet; + packet.operator_latitude = operator_latitude; + packet.operator_longitude = operator_longitude; + packet.operator_altitude_geo = operator_altitude_geo; + packet.timestamp = timestamp; + packet.target_system = target_system; + packet.target_component = target_component; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_CRC); +} + +/** + * @brief Encode a open_drone_id_system_update struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param open_drone_id_system_update C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_open_drone_id_system_update_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_open_drone_id_system_update_t* open_drone_id_system_update) +{ + return mavlink_msg_open_drone_id_system_update_pack(system_id, component_id, msg, open_drone_id_system_update->target_system, open_drone_id_system_update->target_component, open_drone_id_system_update->operator_latitude, open_drone_id_system_update->operator_longitude, open_drone_id_system_update->operator_altitude_geo, open_drone_id_system_update->timestamp); +} + +/** + * @brief Encode a open_drone_id_system_update struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param open_drone_id_system_update C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_open_drone_id_system_update_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_open_drone_id_system_update_t* open_drone_id_system_update) +{ + return mavlink_msg_open_drone_id_system_update_pack_chan(system_id, component_id, chan, msg, open_drone_id_system_update->target_system, open_drone_id_system_update->target_component, open_drone_id_system_update->operator_latitude, open_drone_id_system_update->operator_longitude, open_drone_id_system_update->operator_altitude_geo, open_drone_id_system_update->timestamp); +} + +/** + * @brief Encode a open_drone_id_system_update struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param open_drone_id_system_update C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_open_drone_id_system_update_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_open_drone_id_system_update_t* open_drone_id_system_update) +{ + return mavlink_msg_open_drone_id_system_update_pack_status(system_id, component_id, _status, msg, open_drone_id_system_update->target_system, open_drone_id_system_update->target_component, open_drone_id_system_update->operator_latitude, open_drone_id_system_update->operator_longitude, open_drone_id_system_update->operator_altitude_geo, open_drone_id_system_update->timestamp); +} + +/** + * @brief Send a open_drone_id_system_update message + * @param chan MAVLink channel to send the message + * + * @param target_system System ID (0 for broadcast). + * @param target_component Component ID (0 for broadcast). + * @param operator_latitude [degE7] Latitude of the operator. If unknown: 0 (both Lat/Lon). + * @param operator_longitude [degE7] Longitude of the operator. If unknown: 0 (both Lat/Lon). + * @param operator_altitude_geo [m] Geodetic altitude of the operator relative to WGS84. If unknown: -1000 m. + * @param timestamp [s] 32 bit Unix Timestamp in seconds since 00:00:00 01/01/2019. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_open_drone_id_system_update_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, int32_t operator_latitude, int32_t operator_longitude, float operator_altitude_geo, uint32_t timestamp) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_LEN]; + _mav_put_int32_t(buf, 0, operator_latitude); + _mav_put_int32_t(buf, 4, operator_longitude); + _mav_put_float(buf, 8, operator_altitude_geo); + _mav_put_uint32_t(buf, 12, timestamp); + _mav_put_uint8_t(buf, 16, target_system); + _mav_put_uint8_t(buf, 17, target_component); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE, buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_CRC); +#else + mavlink_open_drone_id_system_update_t packet; + packet.operator_latitude = operator_latitude; + packet.operator_longitude = operator_longitude; + packet.operator_altitude_geo = operator_altitude_geo; + packet.timestamp = timestamp; + packet.target_system = target_system; + packet.target_component = target_component; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE, (const char *)&packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_CRC); +#endif +} + +/** + * @brief Send a open_drone_id_system_update message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_open_drone_id_system_update_send_struct(mavlink_channel_t chan, const mavlink_open_drone_id_system_update_t* open_drone_id_system_update) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_open_drone_id_system_update_send(chan, open_drone_id_system_update->target_system, open_drone_id_system_update->target_component, open_drone_id_system_update->operator_latitude, open_drone_id_system_update->operator_longitude, open_drone_id_system_update->operator_altitude_geo, open_drone_id_system_update->timestamp); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE, (const char *)open_drone_id_system_update, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_CRC); +#endif +} + +#if MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_open_drone_id_system_update_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, int32_t operator_latitude, int32_t operator_longitude, float operator_altitude_geo, uint32_t timestamp) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_int32_t(buf, 0, operator_latitude); + _mav_put_int32_t(buf, 4, operator_longitude); + _mav_put_float(buf, 8, operator_altitude_geo); + _mav_put_uint32_t(buf, 12, timestamp); + _mav_put_uint8_t(buf, 16, target_system); + _mav_put_uint8_t(buf, 17, target_component); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE, buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_CRC); +#else + mavlink_open_drone_id_system_update_t *packet = (mavlink_open_drone_id_system_update_t *)msgbuf; + packet->operator_latitude = operator_latitude; + packet->operator_longitude = operator_longitude; + packet->operator_altitude_geo = operator_altitude_geo; + packet->timestamp = timestamp; + packet->target_system = target_system; + packet->target_component = target_component; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE, (const char *)packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_CRC); +#endif +} +#endif + +#endif + +// MESSAGE OPEN_DRONE_ID_SYSTEM_UPDATE UNPACKING + + +/** + * @brief Get field target_system from open_drone_id_system_update message + * + * @return System ID (0 for broadcast). + */ +static inline uint8_t mavlink_msg_open_drone_id_system_update_get_target_system(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 16); +} + +/** + * @brief Get field target_component from open_drone_id_system_update message + * + * @return Component ID (0 for broadcast). + */ +static inline uint8_t mavlink_msg_open_drone_id_system_update_get_target_component(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 17); +} + +/** + * @brief Get field operator_latitude from open_drone_id_system_update message + * + * @return [degE7] Latitude of the operator. If unknown: 0 (both Lat/Lon). + */ +static inline int32_t mavlink_msg_open_drone_id_system_update_get_operator_latitude(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 0); +} + +/** + * @brief Get field operator_longitude from open_drone_id_system_update message + * + * @return [degE7] Longitude of the operator. If unknown: 0 (both Lat/Lon). + */ +static inline int32_t mavlink_msg_open_drone_id_system_update_get_operator_longitude(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 4); +} + +/** + * @brief Get field operator_altitude_geo from open_drone_id_system_update message + * + * @return [m] Geodetic altitude of the operator relative to WGS84. If unknown: -1000 m. + */ +static inline float mavlink_msg_open_drone_id_system_update_get_operator_altitude_geo(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 8); +} + +/** + * @brief Get field timestamp from open_drone_id_system_update message + * + * @return [s] 32 bit Unix Timestamp in seconds since 00:00:00 01/01/2019. + */ +static inline uint32_t mavlink_msg_open_drone_id_system_update_get_timestamp(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 12); +} + +/** + * @brief Decode a open_drone_id_system_update message into a struct + * + * @param msg The message to decode + * @param open_drone_id_system_update C-struct to decode the message contents into + */ +static inline void mavlink_msg_open_drone_id_system_update_decode(const mavlink_message_t* msg, mavlink_open_drone_id_system_update_t* open_drone_id_system_update) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + open_drone_id_system_update->operator_latitude = mavlink_msg_open_drone_id_system_update_get_operator_latitude(msg); + open_drone_id_system_update->operator_longitude = mavlink_msg_open_drone_id_system_update_get_operator_longitude(msg); + open_drone_id_system_update->operator_altitude_geo = mavlink_msg_open_drone_id_system_update_get_operator_altitude_geo(msg); + open_drone_id_system_update->timestamp = mavlink_msg_open_drone_id_system_update_get_timestamp(msg); + open_drone_id_system_update->target_system = mavlink_msg_open_drone_id_system_update_get_target_system(msg); + open_drone_id_system_update->target_component = mavlink_msg_open_drone_id_system_update_get_target_component(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_LEN? msg->len : MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_LEN; + memset(open_drone_id_system_update, 0, MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_LEN); + memcpy(open_drone_id_system_update, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/common/mavlink_msg_optical_flow.h b/common/mavlink_msg_optical_flow.h index 25c888642..689cd8d4e 100644 --- a/common/mavlink_msg_optical_flow.h +++ b/common/mavlink_msg_optical_flow.h @@ -117,6 +117,66 @@ static inline uint16_t mavlink_msg_optical_flow_pack(uint8_t system_id, uint8_t return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_OPTICAL_FLOW_MIN_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_CRC); } +/** + * @brief Pack a optical_flow message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param sensor_id Sensor ID + * @param flow_x [dpix] Flow in x-sensor direction + * @param flow_y [dpix] Flow in y-sensor direction + * @param flow_comp_m_x [m/s] Flow in x-sensor direction, angular-speed compensated + * @param flow_comp_m_y [m/s] Flow in y-sensor direction, angular-speed compensated + * @param quality Optical flow quality / confidence. 0: bad, 255: maximum quality + * @param ground_distance [m] Ground distance. Positive value: distance known. Negative value: Unknown distance + * @param flow_rate_x [rad/s] Flow rate about X axis + * @param flow_rate_y [rad/s] Flow rate about Y axis + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_optical_flow_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, uint8_t sensor_id, int16_t flow_x, int16_t flow_y, float flow_comp_m_x, float flow_comp_m_y, uint8_t quality, float ground_distance, float flow_rate_x, float flow_rate_y) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_OPTICAL_FLOW_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, flow_comp_m_x); + _mav_put_float(buf, 12, flow_comp_m_y); + _mav_put_float(buf, 16, ground_distance); + _mav_put_int16_t(buf, 20, flow_x); + _mav_put_int16_t(buf, 22, flow_y); + _mav_put_uint8_t(buf, 24, sensor_id); + _mav_put_uint8_t(buf, 25, quality); + _mav_put_float(buf, 26, flow_rate_x); + _mav_put_float(buf, 30, flow_rate_y); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OPTICAL_FLOW_LEN); +#else + mavlink_optical_flow_t packet; + packet.time_usec = time_usec; + packet.flow_comp_m_x = flow_comp_m_x; + packet.flow_comp_m_y = flow_comp_m_y; + packet.ground_distance = ground_distance; + packet.flow_x = flow_x; + packet.flow_y = flow_y; + packet.sensor_id = sensor_id; + packet.quality = quality; + packet.flow_rate_x = flow_rate_x; + packet.flow_rate_y = flow_rate_y; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPTICAL_FLOW_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_OPTICAL_FLOW; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_OPTICAL_FLOW_MIN_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_OPTICAL_FLOW_MIN_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_LEN); +#endif +} + /** * @brief Pack a optical_flow message on a channel * @param system_id ID of this system @@ -200,6 +260,20 @@ static inline uint16_t mavlink_msg_optical_flow_encode_chan(uint8_t system_id, u return mavlink_msg_optical_flow_pack_chan(system_id, component_id, chan, msg, optical_flow->time_usec, optical_flow->sensor_id, optical_flow->flow_x, optical_flow->flow_y, optical_flow->flow_comp_m_x, optical_flow->flow_comp_m_y, optical_flow->quality, optical_flow->ground_distance, optical_flow->flow_rate_x, optical_flow->flow_rate_y); } +/** + * @brief Encode a optical_flow struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param optical_flow C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_optical_flow_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_optical_flow_t* optical_flow) +{ + return mavlink_msg_optical_flow_pack_status(system_id, component_id, _status, msg, optical_flow->time_usec, optical_flow->sensor_id, optical_flow->flow_x, optical_flow->flow_y, optical_flow->flow_comp_m_x, optical_flow->flow_comp_m_y, optical_flow->quality, optical_flow->ground_distance, optical_flow->flow_rate_x, optical_flow->flow_rate_y); +} + /** * @brief Send a optical_flow message * @param chan MAVLink channel to send the message @@ -266,7 +340,7 @@ static inline void mavlink_msg_optical_flow_send_struct(mavlink_channel_t chan, #if MAVLINK_MSG_ID_OPTICAL_FLOW_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_optical_flow_rad.h b/common/mavlink_msg_optical_flow_rad.h index 593533bf6..0ab098abd 100644 --- a/common/mavlink_msg_optical_flow_rad.h +++ b/common/mavlink_msg_optical_flow_rad.h @@ -129,6 +129,72 @@ static inline uint16_t mavlink_msg_optical_flow_rad_pack(uint8_t system_id, uint return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_MIN_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_CRC); } +/** + * @brief Pack a optical_flow_rad message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param sensor_id Sensor ID + * @param integration_time_us [us] Integration time. Divide integrated_x and integrated_y by the integration time to obtain average flow. The integration time also indicates the. + * @param integrated_x [rad] Flow around X axis (Sensor RH rotation about the X axis induces a positive flow. Sensor linear motion along the positive Y axis induces a negative flow.) + * @param integrated_y [rad] Flow around Y axis (Sensor RH rotation about the Y axis induces a positive flow. Sensor linear motion along the positive X axis induces a positive flow.) + * @param integrated_xgyro [rad] RH rotation around X axis + * @param integrated_ygyro [rad] RH rotation around Y axis + * @param integrated_zgyro [rad] RH rotation around Z axis + * @param temperature [cdegC] Temperature + * @param quality Optical flow quality / confidence. 0: no valid flow, 255: maximum quality + * @param time_delta_distance_us [us] Time since the distance was sampled. + * @param distance [m] Distance to the center of the flow field. Positive value (including zero): distance known. Negative value: Unknown distance. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_optical_flow_rad_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, uint8_t sensor_id, uint32_t integration_time_us, float integrated_x, float integrated_y, float integrated_xgyro, float integrated_ygyro, float integrated_zgyro, int16_t temperature, uint8_t quality, uint32_t time_delta_distance_us, float distance) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint32_t(buf, 8, integration_time_us); + _mav_put_float(buf, 12, integrated_x); + _mav_put_float(buf, 16, integrated_y); + _mav_put_float(buf, 20, integrated_xgyro); + _mav_put_float(buf, 24, integrated_ygyro); + _mav_put_float(buf, 28, integrated_zgyro); + _mav_put_uint32_t(buf, 32, time_delta_distance_us); + _mav_put_float(buf, 36, distance); + _mav_put_int16_t(buf, 40, temperature); + _mav_put_uint8_t(buf, 42, sensor_id); + _mav_put_uint8_t(buf, 43, quality); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_LEN); +#else + mavlink_optical_flow_rad_t packet; + packet.time_usec = time_usec; + packet.integration_time_us = integration_time_us; + packet.integrated_x = integrated_x; + packet.integrated_y = integrated_y; + packet.integrated_xgyro = integrated_xgyro; + packet.integrated_ygyro = integrated_ygyro; + packet.integrated_zgyro = integrated_zgyro; + packet.time_delta_distance_us = time_delta_distance_us; + packet.distance = distance; + packet.temperature = temperature; + packet.sensor_id = sensor_id; + packet.quality = quality; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_OPTICAL_FLOW_RAD; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_MIN_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_MIN_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_LEN); +#endif +} + /** * @brief Pack a optical_flow_rad message on a channel * @param system_id ID of this system @@ -218,6 +284,20 @@ static inline uint16_t mavlink_msg_optical_flow_rad_encode_chan(uint8_t system_i return mavlink_msg_optical_flow_rad_pack_chan(system_id, component_id, chan, msg, optical_flow_rad->time_usec, optical_flow_rad->sensor_id, optical_flow_rad->integration_time_us, optical_flow_rad->integrated_x, optical_flow_rad->integrated_y, optical_flow_rad->integrated_xgyro, optical_flow_rad->integrated_ygyro, optical_flow_rad->integrated_zgyro, optical_flow_rad->temperature, optical_flow_rad->quality, optical_flow_rad->time_delta_distance_us, optical_flow_rad->distance); } +/** + * @brief Encode a optical_flow_rad struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param optical_flow_rad C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_optical_flow_rad_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_optical_flow_rad_t* optical_flow_rad) +{ + return mavlink_msg_optical_flow_rad_pack_status(system_id, component_id, _status, msg, optical_flow_rad->time_usec, optical_flow_rad->sensor_id, optical_flow_rad->integration_time_us, optical_flow_rad->integrated_x, optical_flow_rad->integrated_y, optical_flow_rad->integrated_xgyro, optical_flow_rad->integrated_ygyro, optical_flow_rad->integrated_zgyro, optical_flow_rad->temperature, optical_flow_rad->quality, optical_flow_rad->time_delta_distance_us, optical_flow_rad->distance); +} + /** * @brief Send a optical_flow_rad message * @param chan MAVLink channel to send the message @@ -290,7 +370,7 @@ static inline void mavlink_msg_optical_flow_rad_send_struct(mavlink_channel_t ch #if MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_orbit_execution_status.h b/common/mavlink_msg_orbit_execution_status.h index 29e2915a7..a5df2d12b 100644 --- a/common/mavlink_msg_orbit_execution_status.h +++ b/common/mavlink_msg_orbit_execution_status.h @@ -93,6 +93,54 @@ static inline uint16_t mavlink_msg_orbit_execution_status_pack(uint8_t system_id return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ORBIT_EXECUTION_STATUS_MIN_LEN, MAVLINK_MSG_ID_ORBIT_EXECUTION_STATUS_LEN, MAVLINK_MSG_ID_ORBIT_EXECUTION_STATUS_CRC); } +/** + * @brief Pack a orbit_execution_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param radius [m] Radius of the orbit circle. Positive values orbit clockwise, negative values orbit counter-clockwise. + * @param frame The coordinate system of the fields: x, y, z. + * @param x X coordinate of center point. Coordinate system depends on frame field: local = x position in meters * 1e4, global = latitude in degrees * 1e7. + * @param y Y coordinate of center point. Coordinate system depends on frame field: local = x position in meters * 1e4, global = latitude in degrees * 1e7. + * @param z [m] Altitude of center point. Coordinate system depends on frame field. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_orbit_execution_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, float radius, uint8_t frame, int32_t x, int32_t y, float z) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_ORBIT_EXECUTION_STATUS_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, radius); + _mav_put_int32_t(buf, 12, x); + _mav_put_int32_t(buf, 16, y); + _mav_put_float(buf, 20, z); + _mav_put_uint8_t(buf, 24, frame); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ORBIT_EXECUTION_STATUS_LEN); +#else + mavlink_orbit_execution_status_t packet; + packet.time_usec = time_usec; + packet.radius = radius; + packet.x = x; + packet.y = y; + packet.z = z; + packet.frame = frame; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ORBIT_EXECUTION_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_ORBIT_EXECUTION_STATUS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ORBIT_EXECUTION_STATUS_MIN_LEN, MAVLINK_MSG_ID_ORBIT_EXECUTION_STATUS_LEN, MAVLINK_MSG_ID_ORBIT_EXECUTION_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ORBIT_EXECUTION_STATUS_MIN_LEN, MAVLINK_MSG_ID_ORBIT_EXECUTION_STATUS_LEN); +#endif +} + /** * @brief Pack a orbit_execution_status message on a channel * @param system_id ID of this system @@ -164,6 +212,20 @@ static inline uint16_t mavlink_msg_orbit_execution_status_encode_chan(uint8_t sy return mavlink_msg_orbit_execution_status_pack_chan(system_id, component_id, chan, msg, orbit_execution_status->time_usec, orbit_execution_status->radius, orbit_execution_status->frame, orbit_execution_status->x, orbit_execution_status->y, orbit_execution_status->z); } +/** + * @brief Encode a orbit_execution_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param orbit_execution_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_orbit_execution_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_orbit_execution_status_t* orbit_execution_status) +{ + return mavlink_msg_orbit_execution_status_pack_status(system_id, component_id, _status, msg, orbit_execution_status->time_usec, orbit_execution_status->radius, orbit_execution_status->frame, orbit_execution_status->x, orbit_execution_status->y, orbit_execution_status->z); +} + /** * @brief Send a orbit_execution_status message * @param chan MAVLink channel to send the message @@ -218,7 +280,7 @@ static inline void mavlink_msg_orbit_execution_status_send_struct(mavlink_channe #if MAVLINK_MSG_ID_ORBIT_EXECUTION_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_param_error.h b/common/mavlink_msg_param_error.h new file mode 100644 index 000000000..bc8266ca2 --- /dev/null +++ b/common/mavlink_msg_param_error.h @@ -0,0 +1,362 @@ +#pragma once +// MESSAGE PARAM_ERROR PACKING + +#define MAVLINK_MSG_ID_PARAM_ERROR 345 + + +typedef struct __mavlink_param_error_t { + int16_t param_index; /*< Parameter index. Will be -1 if the param ID field should be used as an identifier (else the param id will be ignored)*/ + uint8_t target_system; /*< System ID*/ + uint8_t target_component; /*< Component ID*/ + char param_id[16]; /*< Parameter id. Terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string*/ + uint8_t error; /*< Error being returned to client.*/ +} mavlink_param_error_t; + +#define MAVLINK_MSG_ID_PARAM_ERROR_LEN 21 +#define MAVLINK_MSG_ID_PARAM_ERROR_MIN_LEN 21 +#define MAVLINK_MSG_ID_345_LEN 21 +#define MAVLINK_MSG_ID_345_MIN_LEN 21 + +#define MAVLINK_MSG_ID_PARAM_ERROR_CRC 209 +#define MAVLINK_MSG_ID_345_CRC 209 + +#define MAVLINK_MSG_PARAM_ERROR_FIELD_PARAM_ID_LEN 16 + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_PARAM_ERROR { \ + 345, \ + "PARAM_ERROR", \ + 5, \ + { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_param_error_t, target_system) }, \ + { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_param_error_t, target_component) }, \ + { "param_id", NULL, MAVLINK_TYPE_CHAR, 16, 4, offsetof(mavlink_param_error_t, param_id) }, \ + { "param_index", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_param_error_t, param_index) }, \ + { "error", NULL, MAVLINK_TYPE_UINT8_T, 0, 20, offsetof(mavlink_param_error_t, error) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_PARAM_ERROR { \ + "PARAM_ERROR", \ + 5, \ + { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_param_error_t, target_system) }, \ + { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_param_error_t, target_component) }, \ + { "param_id", NULL, MAVLINK_TYPE_CHAR, 16, 4, offsetof(mavlink_param_error_t, param_id) }, \ + { "param_index", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_param_error_t, param_index) }, \ + { "error", NULL, MAVLINK_TYPE_UINT8_T, 0, 20, offsetof(mavlink_param_error_t, error) }, \ + } \ +} +#endif + +/** + * @brief Pack a param_error message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param param_id Parameter id. Terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string + * @param param_index Parameter index. Will be -1 if the param ID field should be used as an identifier (else the param id will be ignored) + * @param error Error being returned to client. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_param_error_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, const char *param_id, int16_t param_index, uint8_t error) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PARAM_ERROR_LEN]; + _mav_put_int16_t(buf, 0, param_index); + _mav_put_uint8_t(buf, 2, target_system); + _mav_put_uint8_t(buf, 3, target_component); + _mav_put_uint8_t(buf, 20, error); + _mav_put_char_array(buf, 4, param_id, 16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PARAM_ERROR_LEN); +#else + mavlink_param_error_t packet; + packet.param_index = param_index; + packet.target_system = target_system; + packet.target_component = target_component; + packet.error = error; + mav_array_assign_char(packet.param_id, param_id, 16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_ERROR_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_PARAM_ERROR; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PARAM_ERROR_MIN_LEN, MAVLINK_MSG_ID_PARAM_ERROR_LEN, MAVLINK_MSG_ID_PARAM_ERROR_CRC); +} + +/** + * @brief Pack a param_error message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param param_id Parameter id. Terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string + * @param param_index Parameter index. Will be -1 if the param ID field should be used as an identifier (else the param id will be ignored) + * @param error Error being returned to client. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_param_error_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, const char *param_id, int16_t param_index, uint8_t error) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PARAM_ERROR_LEN]; + _mav_put_int16_t(buf, 0, param_index); + _mav_put_uint8_t(buf, 2, target_system); + _mav_put_uint8_t(buf, 3, target_component); + _mav_put_uint8_t(buf, 20, error); + _mav_put_char_array(buf, 4, param_id, 16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PARAM_ERROR_LEN); +#else + mavlink_param_error_t packet; + packet.param_index = param_index; + packet.target_system = target_system; + packet.target_component = target_component; + packet.error = error; + mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_ERROR_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_PARAM_ERROR; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PARAM_ERROR_MIN_LEN, MAVLINK_MSG_ID_PARAM_ERROR_LEN, MAVLINK_MSG_ID_PARAM_ERROR_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PARAM_ERROR_MIN_LEN, MAVLINK_MSG_ID_PARAM_ERROR_LEN); +#endif +} + +/** + * @brief Pack a param_error message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param target_system System ID + * @param target_component Component ID + * @param param_id Parameter id. Terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string + * @param param_index Parameter index. Will be -1 if the param ID field should be used as an identifier (else the param id will be ignored) + * @param error Error being returned to client. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_param_error_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t target_system,uint8_t target_component,const char *param_id,int16_t param_index,uint8_t error) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PARAM_ERROR_LEN]; + _mav_put_int16_t(buf, 0, param_index); + _mav_put_uint8_t(buf, 2, target_system); + _mav_put_uint8_t(buf, 3, target_component); + _mav_put_uint8_t(buf, 20, error); + _mav_put_char_array(buf, 4, param_id, 16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PARAM_ERROR_LEN); +#else + mavlink_param_error_t packet; + packet.param_index = param_index; + packet.target_system = target_system; + packet.target_component = target_component; + packet.error = error; + mav_array_assign_char(packet.param_id, param_id, 16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_ERROR_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_PARAM_ERROR; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_PARAM_ERROR_MIN_LEN, MAVLINK_MSG_ID_PARAM_ERROR_LEN, MAVLINK_MSG_ID_PARAM_ERROR_CRC); +} + +/** + * @brief Encode a param_error struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param param_error C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_param_error_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_param_error_t* param_error) +{ + return mavlink_msg_param_error_pack(system_id, component_id, msg, param_error->target_system, param_error->target_component, param_error->param_id, param_error->param_index, param_error->error); +} + +/** + * @brief Encode a param_error struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param param_error C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_param_error_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_param_error_t* param_error) +{ + return mavlink_msg_param_error_pack_chan(system_id, component_id, chan, msg, param_error->target_system, param_error->target_component, param_error->param_id, param_error->param_index, param_error->error); +} + +/** + * @brief Encode a param_error struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param param_error C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_param_error_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_param_error_t* param_error) +{ + return mavlink_msg_param_error_pack_status(system_id, component_id, _status, msg, param_error->target_system, param_error->target_component, param_error->param_id, param_error->param_index, param_error->error); +} + +/** + * @brief Send a param_error message + * @param chan MAVLink channel to send the message + * + * @param target_system System ID + * @param target_component Component ID + * @param param_id Parameter id. Terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string + * @param param_index Parameter index. Will be -1 if the param ID field should be used as an identifier (else the param id will be ignored) + * @param error Error being returned to client. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_param_error_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, const char *param_id, int16_t param_index, uint8_t error) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PARAM_ERROR_LEN]; + _mav_put_int16_t(buf, 0, param_index); + _mav_put_uint8_t(buf, 2, target_system); + _mav_put_uint8_t(buf, 3, target_component); + _mav_put_uint8_t(buf, 20, error); + _mav_put_char_array(buf, 4, param_id, 16); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_ERROR, buf, MAVLINK_MSG_ID_PARAM_ERROR_MIN_LEN, MAVLINK_MSG_ID_PARAM_ERROR_LEN, MAVLINK_MSG_ID_PARAM_ERROR_CRC); +#else + mavlink_param_error_t packet; + packet.param_index = param_index; + packet.target_system = target_system; + packet.target_component = target_component; + packet.error = error; + mav_array_assign_char(packet.param_id, param_id, 16); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_ERROR, (const char *)&packet, MAVLINK_MSG_ID_PARAM_ERROR_MIN_LEN, MAVLINK_MSG_ID_PARAM_ERROR_LEN, MAVLINK_MSG_ID_PARAM_ERROR_CRC); +#endif +} + +/** + * @brief Send a param_error message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_param_error_send_struct(mavlink_channel_t chan, const mavlink_param_error_t* param_error) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_param_error_send(chan, param_error->target_system, param_error->target_component, param_error->param_id, param_error->param_index, param_error->error); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_ERROR, (const char *)param_error, MAVLINK_MSG_ID_PARAM_ERROR_MIN_LEN, MAVLINK_MSG_ID_PARAM_ERROR_LEN, MAVLINK_MSG_ID_PARAM_ERROR_CRC); +#endif +} + +#if MAVLINK_MSG_ID_PARAM_ERROR_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_param_error_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, const char *param_id, int16_t param_index, uint8_t error) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_int16_t(buf, 0, param_index); + _mav_put_uint8_t(buf, 2, target_system); + _mav_put_uint8_t(buf, 3, target_component); + _mav_put_uint8_t(buf, 20, error); + _mav_put_char_array(buf, 4, param_id, 16); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_ERROR, buf, MAVLINK_MSG_ID_PARAM_ERROR_MIN_LEN, MAVLINK_MSG_ID_PARAM_ERROR_LEN, MAVLINK_MSG_ID_PARAM_ERROR_CRC); +#else + mavlink_param_error_t *packet = (mavlink_param_error_t *)msgbuf; + packet->param_index = param_index; + packet->target_system = target_system; + packet->target_component = target_component; + packet->error = error; + mav_array_assign_char(packet->param_id, param_id, 16); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_ERROR, (const char *)packet, MAVLINK_MSG_ID_PARAM_ERROR_MIN_LEN, MAVLINK_MSG_ID_PARAM_ERROR_LEN, MAVLINK_MSG_ID_PARAM_ERROR_CRC); +#endif +} +#endif + +#endif + +// MESSAGE PARAM_ERROR UNPACKING + + +/** + * @brief Get field target_system from param_error message + * + * @return System ID + */ +static inline uint8_t mavlink_msg_param_error_get_target_system(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 2); +} + +/** + * @brief Get field target_component from param_error message + * + * @return Component ID + */ +static inline uint8_t mavlink_msg_param_error_get_target_component(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 3); +} + +/** + * @brief Get field param_id from param_error message + * + * @return Parameter id. Terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string + */ +static inline uint16_t mavlink_msg_param_error_get_param_id(const mavlink_message_t* msg, char *param_id) +{ + return _MAV_RETURN_char_array(msg, param_id, 16, 4); +} + +/** + * @brief Get field param_index from param_error message + * + * @return Parameter index. Will be -1 if the param ID field should be used as an identifier (else the param id will be ignored) + */ +static inline int16_t mavlink_msg_param_error_get_param_index(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int16_t(msg, 0); +} + +/** + * @brief Get field error from param_error message + * + * @return Error being returned to client. + */ +static inline uint8_t mavlink_msg_param_error_get_error(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 20); +} + +/** + * @brief Decode a param_error message into a struct + * + * @param msg The message to decode + * @param param_error C-struct to decode the message contents into + */ +static inline void mavlink_msg_param_error_decode(const mavlink_message_t* msg, mavlink_param_error_t* param_error) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + param_error->param_index = mavlink_msg_param_error_get_param_index(msg); + param_error->target_system = mavlink_msg_param_error_get_target_system(msg); + param_error->target_component = mavlink_msg_param_error_get_target_component(msg); + mavlink_msg_param_error_get_param_id(msg, param_error->param_id); + param_error->error = mavlink_msg_param_error_get_error(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_PARAM_ERROR_LEN? msg->len : MAVLINK_MSG_ID_PARAM_ERROR_LEN; + memset(param_error, 0, MAVLINK_MSG_ID_PARAM_ERROR_LEN); + memcpy(param_error, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/common/mavlink_msg_param_ext_ack.h b/common/mavlink_msg_param_ext_ack.h index 3a560d2b8..aebb8c4e3 100644 --- a/common/mavlink_msg_param_ext_ack.h +++ b/common/mavlink_msg_param_ext_ack.h @@ -60,6 +60,42 @@ typedef struct __mavlink_param_ext_ack_t { static inline uint16_t mavlink_msg_param_ext_ack_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const char *param_id, const char *param_value, uint8_t param_type, uint8_t param_result) { +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PARAM_EXT_ACK_LEN]; + _mav_put_uint8_t(buf, 144, param_type); + _mav_put_uint8_t(buf, 145, param_result); + _mav_put_char_array(buf, 0, param_id, 16); + _mav_put_char_array(buf, 16, param_value, 128); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PARAM_EXT_ACK_LEN); +#else + mavlink_param_ext_ack_t packet; + packet.param_type = param_type; + packet.param_result = param_result; + mav_array_assign_char(packet.param_id, param_id, 16); + mav_array_assign_char(packet.param_value, param_value, 128); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_EXT_ACK_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_PARAM_EXT_ACK; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PARAM_EXT_ACK_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_ACK_LEN, MAVLINK_MSG_ID_PARAM_EXT_ACK_CRC); +} + +/** + * @brief Pack a param_ext_ack message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param param_id Parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string + * @param param_value Parameter value (new value if PARAM_ACK_ACCEPTED, current value otherwise) + * @param param_type Parameter type. + * @param param_result Result code. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_param_ext_ack_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + const char *param_id, const char *param_value, uint8_t param_type, uint8_t param_result) +{ #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_PARAM_EXT_ACK_LEN]; _mav_put_uint8_t(buf, 144, param_type); @@ -77,7 +113,11 @@ static inline uint16_t mavlink_msg_param_ext_ack_pack(uint8_t system_id, uint8_t #endif msg->msgid = MAVLINK_MSG_ID_PARAM_EXT_ACK; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PARAM_EXT_ACK_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_ACK_LEN, MAVLINK_MSG_ID_PARAM_EXT_ACK_CRC); +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PARAM_EXT_ACK_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_ACK_LEN, MAVLINK_MSG_ID_PARAM_EXT_ACK_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PARAM_EXT_ACK_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_ACK_LEN); +#endif } /** @@ -107,8 +147,8 @@ static inline uint16_t mavlink_msg_param_ext_ack_pack_chan(uint8_t system_id, ui mavlink_param_ext_ack_t packet; packet.param_type = param_type; packet.param_result = param_result; - mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); - mav_array_memcpy(packet.param_value, param_value, sizeof(char)*128); + mav_array_assign_char(packet.param_id, param_id, 16); + mav_array_assign_char(packet.param_value, param_value, 128); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_EXT_ACK_LEN); #endif @@ -143,6 +183,20 @@ static inline uint16_t mavlink_msg_param_ext_ack_encode_chan(uint8_t system_id, return mavlink_msg_param_ext_ack_pack_chan(system_id, component_id, chan, msg, param_ext_ack->param_id, param_ext_ack->param_value, param_ext_ack->param_type, param_ext_ack->param_result); } +/** + * @brief Encode a param_ext_ack struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param param_ext_ack C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_param_ext_ack_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_param_ext_ack_t* param_ext_ack) +{ + return mavlink_msg_param_ext_ack_pack_status(system_id, component_id, _status, msg, param_ext_ack->param_id, param_ext_ack->param_value, param_ext_ack->param_type, param_ext_ack->param_result); +} + /** * @brief Send a param_ext_ack message * @param chan MAVLink channel to send the message @@ -167,8 +221,8 @@ static inline void mavlink_msg_param_ext_ack_send(mavlink_channel_t chan, const mavlink_param_ext_ack_t packet; packet.param_type = param_type; packet.param_result = param_result; - mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); - mav_array_memcpy(packet.param_value, param_value, sizeof(char)*128); + mav_array_assign_char(packet.param_id, param_id, 16); + mav_array_assign_char(packet.param_value, param_value, 128); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_EXT_ACK, (const char *)&packet, MAVLINK_MSG_ID_PARAM_EXT_ACK_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_ACK_LEN, MAVLINK_MSG_ID_PARAM_EXT_ACK_CRC); #endif } @@ -189,7 +243,7 @@ static inline void mavlink_msg_param_ext_ack_send_struct(mavlink_channel_t chan, #if MAVLINK_MSG_ID_PARAM_EXT_ACK_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -208,8 +262,8 @@ static inline void mavlink_msg_param_ext_ack_send_buf(mavlink_message_t *msgbuf, mavlink_param_ext_ack_t *packet = (mavlink_param_ext_ack_t *)msgbuf; packet->param_type = param_type; packet->param_result = param_result; - mav_array_memcpy(packet->param_id, param_id, sizeof(char)*16); - mav_array_memcpy(packet->param_value, param_value, sizeof(char)*128); + mav_array_assign_char(packet->param_id, param_id, 16); + mav_array_assign_char(packet->param_value, param_value, 128); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_EXT_ACK, (const char *)packet, MAVLINK_MSG_ID_PARAM_EXT_ACK_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_ACK_LEN, MAVLINK_MSG_ID_PARAM_EXT_ACK_CRC); #endif } diff --git a/common/mavlink_msg_param_ext_request_list.h b/common/mavlink_msg_param_ext_request_list.h index a3983dfb8..d8561e384 100644 --- a/common/mavlink_msg_param_ext_request_list.h +++ b/common/mavlink_msg_param_ext_request_list.h @@ -69,6 +69,42 @@ static inline uint16_t mavlink_msg_param_ext_request_list_pack(uint8_t system_id return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PARAM_EXT_REQUEST_LIST_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_REQUEST_LIST_LEN, MAVLINK_MSG_ID_PARAM_EXT_REQUEST_LIST_CRC); } +/** + * @brief Pack a param_ext_request_list message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_param_ext_request_list_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PARAM_EXT_REQUEST_LIST_LEN]; + _mav_put_uint8_t(buf, 0, target_system); + _mav_put_uint8_t(buf, 1, target_component); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PARAM_EXT_REQUEST_LIST_LEN); +#else + mavlink_param_ext_request_list_t packet; + packet.target_system = target_system; + packet.target_component = target_component; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_EXT_REQUEST_LIST_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_PARAM_EXT_REQUEST_LIST; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PARAM_EXT_REQUEST_LIST_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_REQUEST_LIST_LEN, MAVLINK_MSG_ID_PARAM_EXT_REQUEST_LIST_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PARAM_EXT_REQUEST_LIST_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_REQUEST_LIST_LEN); +#endif +} + /** * @brief Pack a param_ext_request_list message on a channel * @param system_id ID of this system @@ -128,6 +164,20 @@ static inline uint16_t mavlink_msg_param_ext_request_list_encode_chan(uint8_t sy return mavlink_msg_param_ext_request_list_pack_chan(system_id, component_id, chan, msg, param_ext_request_list->target_system, param_ext_request_list->target_component); } +/** + * @brief Encode a param_ext_request_list struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param param_ext_request_list C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_param_ext_request_list_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_param_ext_request_list_t* param_ext_request_list) +{ + return mavlink_msg_param_ext_request_list_pack_status(system_id, component_id, _status, msg, param_ext_request_list->target_system, param_ext_request_list->target_component); +} + /** * @brief Send a param_ext_request_list message * @param chan MAVLink channel to send the message @@ -170,7 +220,7 @@ static inline void mavlink_msg_param_ext_request_list_send_struct(mavlink_channe #if MAVLINK_MSG_ID_PARAM_EXT_REQUEST_LIST_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_param_ext_request_read.h b/common/mavlink_msg_param_ext_request_read.h index 974f68566..ed5409606 100644 --- a/common/mavlink_msg_param_ext_request_read.h +++ b/common/mavlink_msg_param_ext_request_read.h @@ -71,7 +71,7 @@ static inline uint16_t mavlink_msg_param_ext_request_read_pack(uint8_t system_id packet.param_index = param_index; packet.target_system = target_system; packet.target_component = target_component; - mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); + mav_array_assign_char(packet.param_id, param_id, 16); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ_LEN); #endif @@ -79,6 +79,46 @@ static inline uint16_t mavlink_msg_param_ext_request_read_pack(uint8_t system_id return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ_LEN, MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ_CRC); } +/** + * @brief Pack a param_ext_request_read message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param param_id Parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string + * @param param_index Parameter index. Set to -1 to use the Parameter ID field as identifier (else param_id will be ignored) + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_param_ext_request_read_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, const char *param_id, int16_t param_index) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ_LEN]; + _mav_put_int16_t(buf, 0, param_index); + _mav_put_uint8_t(buf, 2, target_system); + _mav_put_uint8_t(buf, 3, target_component); + _mav_put_char_array(buf, 4, param_id, 16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ_LEN); +#else + mavlink_param_ext_request_read_t packet; + packet.param_index = param_index; + packet.target_system = target_system; + packet.target_component = target_component; + mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ_LEN, MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ_LEN); +#endif +} + /** * @brief Pack a param_ext_request_read message on a channel * @param system_id ID of this system @@ -107,7 +147,7 @@ static inline uint16_t mavlink_msg_param_ext_request_read_pack_chan(uint8_t syst packet.param_index = param_index; packet.target_system = target_system; packet.target_component = target_component; - mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); + mav_array_assign_char(packet.param_id, param_id, 16); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ_LEN); #endif @@ -142,6 +182,20 @@ static inline uint16_t mavlink_msg_param_ext_request_read_encode_chan(uint8_t sy return mavlink_msg_param_ext_request_read_pack_chan(system_id, component_id, chan, msg, param_ext_request_read->target_system, param_ext_request_read->target_component, param_ext_request_read->param_id, param_ext_request_read->param_index); } +/** + * @brief Encode a param_ext_request_read struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param param_ext_request_read C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_param_ext_request_read_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_param_ext_request_read_t* param_ext_request_read) +{ + return mavlink_msg_param_ext_request_read_pack_status(system_id, component_id, _status, msg, param_ext_request_read->target_system, param_ext_request_read->target_component, param_ext_request_read->param_id, param_ext_request_read->param_index); +} + /** * @brief Send a param_ext_request_read message * @param chan MAVLink channel to send the message @@ -167,7 +221,7 @@ static inline void mavlink_msg_param_ext_request_read_send(mavlink_channel_t cha packet.param_index = param_index; packet.target_system = target_system; packet.target_component = target_component; - mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); + mav_array_assign_char(packet.param_id, param_id, 16); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ, (const char *)&packet, MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ_LEN, MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ_CRC); #endif } @@ -188,7 +242,7 @@ static inline void mavlink_msg_param_ext_request_read_send_struct(mavlink_channe #if MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -208,7 +262,7 @@ static inline void mavlink_msg_param_ext_request_read_send_buf(mavlink_message_t packet->param_index = param_index; packet->target_system = target_system; packet->target_component = target_component; - mav_array_memcpy(packet->param_id, param_id, sizeof(char)*16); + mav_array_assign_char(packet->param_id, param_id, 16); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ, (const char *)packet, MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ_LEN, MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ_CRC); #endif } diff --git a/common/mavlink_msg_param_ext_set.h b/common/mavlink_msg_param_ext_set.h index bb4c7ccf0..b536e4179 100644 --- a/common/mavlink_msg_param_ext_set.h +++ b/common/mavlink_msg_param_ext_set.h @@ -64,6 +64,45 @@ typedef struct __mavlink_param_ext_set_t { static inline uint16_t mavlink_msg_param_ext_set_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t target_system, uint8_t target_component, const char *param_id, const char *param_value, uint8_t param_type) { +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PARAM_EXT_SET_LEN]; + _mav_put_uint8_t(buf, 0, target_system); + _mav_put_uint8_t(buf, 1, target_component); + _mav_put_uint8_t(buf, 146, param_type); + _mav_put_char_array(buf, 2, param_id, 16); + _mav_put_char_array(buf, 18, param_value, 128); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PARAM_EXT_SET_LEN); +#else + mavlink_param_ext_set_t packet; + packet.target_system = target_system; + packet.target_component = target_component; + packet.param_type = param_type; + mav_array_assign_char(packet.param_id, param_id, 16); + mav_array_assign_char(packet.param_value, param_value, 128); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_EXT_SET_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_PARAM_EXT_SET; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PARAM_EXT_SET_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_SET_LEN, MAVLINK_MSG_ID_PARAM_EXT_SET_CRC); +} + +/** + * @brief Pack a param_ext_set message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param param_id Parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string + * @param param_value Parameter value + * @param param_type Parameter type. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_param_ext_set_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, const char *param_id, const char *param_value, uint8_t param_type) +{ #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_PARAM_EXT_SET_LEN]; _mav_put_uint8_t(buf, 0, target_system); @@ -83,7 +122,11 @@ static inline uint16_t mavlink_msg_param_ext_set_pack(uint8_t system_id, uint8_t #endif msg->msgid = MAVLINK_MSG_ID_PARAM_EXT_SET; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PARAM_EXT_SET_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_SET_LEN, MAVLINK_MSG_ID_PARAM_EXT_SET_CRC); +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PARAM_EXT_SET_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_SET_LEN, MAVLINK_MSG_ID_PARAM_EXT_SET_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PARAM_EXT_SET_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_SET_LEN); +#endif } /** @@ -116,8 +159,8 @@ static inline uint16_t mavlink_msg_param_ext_set_pack_chan(uint8_t system_id, ui packet.target_system = target_system; packet.target_component = target_component; packet.param_type = param_type; - mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); - mav_array_memcpy(packet.param_value, param_value, sizeof(char)*128); + mav_array_assign_char(packet.param_id, param_id, 16); + mav_array_assign_char(packet.param_value, param_value, 128); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_EXT_SET_LEN); #endif @@ -152,6 +195,20 @@ static inline uint16_t mavlink_msg_param_ext_set_encode_chan(uint8_t system_id, return mavlink_msg_param_ext_set_pack_chan(system_id, component_id, chan, msg, param_ext_set->target_system, param_ext_set->target_component, param_ext_set->param_id, param_ext_set->param_value, param_ext_set->param_type); } +/** + * @brief Encode a param_ext_set struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param param_ext_set C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_param_ext_set_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_param_ext_set_t* param_ext_set) +{ + return mavlink_msg_param_ext_set_pack_status(system_id, component_id, _status, msg, param_ext_set->target_system, param_ext_set->target_component, param_ext_set->param_id, param_ext_set->param_value, param_ext_set->param_type); +} + /** * @brief Send a param_ext_set message * @param chan MAVLink channel to send the message @@ -179,8 +236,8 @@ static inline void mavlink_msg_param_ext_set_send(mavlink_channel_t chan, uint8_ packet.target_system = target_system; packet.target_component = target_component; packet.param_type = param_type; - mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); - mav_array_memcpy(packet.param_value, param_value, sizeof(char)*128); + mav_array_assign_char(packet.param_id, param_id, 16); + mav_array_assign_char(packet.param_value, param_value, 128); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_EXT_SET, (const char *)&packet, MAVLINK_MSG_ID_PARAM_EXT_SET_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_SET_LEN, MAVLINK_MSG_ID_PARAM_EXT_SET_CRC); #endif } @@ -201,7 +258,7 @@ static inline void mavlink_msg_param_ext_set_send_struct(mavlink_channel_t chan, #if MAVLINK_MSG_ID_PARAM_EXT_SET_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -222,8 +279,8 @@ static inline void mavlink_msg_param_ext_set_send_buf(mavlink_message_t *msgbuf, packet->target_system = target_system; packet->target_component = target_component; packet->param_type = param_type; - mav_array_memcpy(packet->param_id, param_id, sizeof(char)*16); - mav_array_memcpy(packet->param_value, param_value, sizeof(char)*128); + mav_array_assign_char(packet->param_id, param_id, 16); + mav_array_assign_char(packet->param_value, param_value, 128); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_EXT_SET, (const char *)packet, MAVLINK_MSG_ID_PARAM_EXT_SET_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_SET_LEN, MAVLINK_MSG_ID_PARAM_EXT_SET_CRC); #endif } diff --git a/common/mavlink_msg_param_ext_value.h b/common/mavlink_msg_param_ext_value.h index 1bf131c39..7953dcdad 100644 --- a/common/mavlink_msg_param_ext_value.h +++ b/common/mavlink_msg_param_ext_value.h @@ -64,6 +64,45 @@ typedef struct __mavlink_param_ext_value_t { static inline uint16_t mavlink_msg_param_ext_value_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const char *param_id, const char *param_value, uint8_t param_type, uint16_t param_count, uint16_t param_index) { +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN]; + _mav_put_uint16_t(buf, 0, param_count); + _mav_put_uint16_t(buf, 2, param_index); + _mav_put_uint8_t(buf, 148, param_type); + _mav_put_char_array(buf, 4, param_id, 16); + _mav_put_char_array(buf, 20, param_value, 128); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN); +#else + mavlink_param_ext_value_t packet; + packet.param_count = param_count; + packet.param_index = param_index; + packet.param_type = param_type; + mav_array_assign_char(packet.param_id, param_id, 16); + mav_array_assign_char(packet.param_value, param_value, 128); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_PARAM_EXT_VALUE; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PARAM_EXT_VALUE_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN, MAVLINK_MSG_ID_PARAM_EXT_VALUE_CRC); +} + +/** + * @brief Pack a param_ext_value message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param param_id Parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string + * @param param_value Parameter value + * @param param_type Parameter type. + * @param param_count Total number of parameters + * @param param_index Index of this parameter + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_param_ext_value_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + const char *param_id, const char *param_value, uint8_t param_type, uint16_t param_count, uint16_t param_index) +{ #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN]; _mav_put_uint16_t(buf, 0, param_count); @@ -83,7 +122,11 @@ static inline uint16_t mavlink_msg_param_ext_value_pack(uint8_t system_id, uint8 #endif msg->msgid = MAVLINK_MSG_ID_PARAM_EXT_VALUE; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PARAM_EXT_VALUE_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN, MAVLINK_MSG_ID_PARAM_EXT_VALUE_CRC); +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PARAM_EXT_VALUE_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN, MAVLINK_MSG_ID_PARAM_EXT_VALUE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PARAM_EXT_VALUE_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN); +#endif } /** @@ -116,8 +159,8 @@ static inline uint16_t mavlink_msg_param_ext_value_pack_chan(uint8_t system_id, packet.param_count = param_count; packet.param_index = param_index; packet.param_type = param_type; - mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); - mav_array_memcpy(packet.param_value, param_value, sizeof(char)*128); + mav_array_assign_char(packet.param_id, param_id, 16); + mav_array_assign_char(packet.param_value, param_value, 128); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN); #endif @@ -152,6 +195,20 @@ static inline uint16_t mavlink_msg_param_ext_value_encode_chan(uint8_t system_id return mavlink_msg_param_ext_value_pack_chan(system_id, component_id, chan, msg, param_ext_value->param_id, param_ext_value->param_value, param_ext_value->param_type, param_ext_value->param_count, param_ext_value->param_index); } +/** + * @brief Encode a param_ext_value struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param param_ext_value C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_param_ext_value_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_param_ext_value_t* param_ext_value) +{ + return mavlink_msg_param_ext_value_pack_status(system_id, component_id, _status, msg, param_ext_value->param_id, param_ext_value->param_value, param_ext_value->param_type, param_ext_value->param_count, param_ext_value->param_index); +} + /** * @brief Send a param_ext_value message * @param chan MAVLink channel to send the message @@ -179,8 +236,8 @@ static inline void mavlink_msg_param_ext_value_send(mavlink_channel_t chan, cons packet.param_count = param_count; packet.param_index = param_index; packet.param_type = param_type; - mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); - mav_array_memcpy(packet.param_value, param_value, sizeof(char)*128); + mav_array_assign_char(packet.param_id, param_id, 16); + mav_array_assign_char(packet.param_value, param_value, 128); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_EXT_VALUE, (const char *)&packet, MAVLINK_MSG_ID_PARAM_EXT_VALUE_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN, MAVLINK_MSG_ID_PARAM_EXT_VALUE_CRC); #endif } @@ -201,7 +258,7 @@ static inline void mavlink_msg_param_ext_value_send_struct(mavlink_channel_t cha #if MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -222,8 +279,8 @@ static inline void mavlink_msg_param_ext_value_send_buf(mavlink_message_t *msgbu packet->param_count = param_count; packet->param_index = param_index; packet->param_type = param_type; - mav_array_memcpy(packet->param_id, param_id, sizeof(char)*16); - mav_array_memcpy(packet->param_value, param_value, sizeof(char)*128); + mav_array_assign_char(packet->param_id, param_id, 16); + mav_array_assign_char(packet->param_value, param_value, 128); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_EXT_VALUE, (const char *)packet, MAVLINK_MSG_ID_PARAM_EXT_VALUE_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN, MAVLINK_MSG_ID_PARAM_EXT_VALUE_CRC); #endif } diff --git a/common/mavlink_msg_param_map_rc.h b/common/mavlink_msg_param_map_rc.h index 5bea16c7c..8009d8998 100644 --- a/common/mavlink_msg_param_map_rc.h +++ b/common/mavlink_msg_param_map_rc.h @@ -101,7 +101,7 @@ static inline uint16_t mavlink_msg_param_map_rc_pack(uint8_t system_id, uint8_t packet.target_system = target_system; packet.target_component = target_component; packet.parameter_rc_channel_index = parameter_rc_channel_index; - mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); + mav_array_assign_char(packet.param_id, param_id, 16); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN); #endif @@ -109,6 +109,61 @@ static inline uint16_t mavlink_msg_param_map_rc_pack(uint8_t system_id, uint8_t return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PARAM_MAP_RC_MIN_LEN, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN, MAVLINK_MSG_ID_PARAM_MAP_RC_CRC); } +/** + * @brief Pack a param_map_rc message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param param_id Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string + * @param param_index Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored), send -2 to disable any existing map for this rc_channel_index. + * @param parameter_rc_channel_index Index of parameter RC channel. Not equal to the RC channel id. Typically corresponds to a potentiometer-knob on the RC. + * @param param_value0 Initial parameter value + * @param scale Scale, maps the RC range [-1, 1] to a parameter value + * @param param_value_min Minimum param value. The protocol does not define if this overwrites an onboard minimum value. (Depends on implementation) + * @param param_value_max Maximum param value. The protocol does not define if this overwrites an onboard maximum value. (Depends on implementation) + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_param_map_rc_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, const char *param_id, int16_t param_index, uint8_t parameter_rc_channel_index, float param_value0, float scale, float param_value_min, float param_value_max) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PARAM_MAP_RC_LEN]; + _mav_put_float(buf, 0, param_value0); + _mav_put_float(buf, 4, scale); + _mav_put_float(buf, 8, param_value_min); + _mav_put_float(buf, 12, param_value_max); + _mav_put_int16_t(buf, 16, param_index); + _mav_put_uint8_t(buf, 18, target_system); + _mav_put_uint8_t(buf, 19, target_component); + _mav_put_uint8_t(buf, 36, parameter_rc_channel_index); + _mav_put_char_array(buf, 20, param_id, 16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN); +#else + mavlink_param_map_rc_t packet; + packet.param_value0 = param_value0; + packet.scale = scale; + packet.param_value_min = param_value_min; + packet.param_value_max = param_value_max; + packet.param_index = param_index; + packet.target_system = target_system; + packet.target_component = target_component; + packet.parameter_rc_channel_index = parameter_rc_channel_index; + mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_PARAM_MAP_RC; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PARAM_MAP_RC_MIN_LEN, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN, MAVLINK_MSG_ID_PARAM_MAP_RC_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PARAM_MAP_RC_MIN_LEN, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN); +#endif +} + /** * @brief Pack a param_map_rc message on a channel * @param system_id ID of this system @@ -152,7 +207,7 @@ static inline uint16_t mavlink_msg_param_map_rc_pack_chan(uint8_t system_id, uin packet.target_system = target_system; packet.target_component = target_component; packet.parameter_rc_channel_index = parameter_rc_channel_index; - mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); + mav_array_assign_char(packet.param_id, param_id, 16); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN); #endif @@ -187,6 +242,20 @@ static inline uint16_t mavlink_msg_param_map_rc_encode_chan(uint8_t system_id, u return mavlink_msg_param_map_rc_pack_chan(system_id, component_id, chan, msg, param_map_rc->target_system, param_map_rc->target_component, param_map_rc->param_id, param_map_rc->param_index, param_map_rc->parameter_rc_channel_index, param_map_rc->param_value0, param_map_rc->scale, param_map_rc->param_value_min, param_map_rc->param_value_max); } +/** + * @brief Encode a param_map_rc struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param param_map_rc C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_param_map_rc_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_param_map_rc_t* param_map_rc) +{ + return mavlink_msg_param_map_rc_pack_status(system_id, component_id, _status, msg, param_map_rc->target_system, param_map_rc->target_component, param_map_rc->param_id, param_map_rc->param_index, param_map_rc->parameter_rc_channel_index, param_map_rc->param_value0, param_map_rc->scale, param_map_rc->param_value_min, param_map_rc->param_value_max); +} + /** * @brief Send a param_map_rc message * @param chan MAVLink channel to send the message @@ -227,7 +296,7 @@ static inline void mavlink_msg_param_map_rc_send(mavlink_channel_t chan, uint8_t packet.target_system = target_system; packet.target_component = target_component; packet.parameter_rc_channel_index = parameter_rc_channel_index; - mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); + mav_array_assign_char(packet.param_id, param_id, 16); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_MAP_RC, (const char *)&packet, MAVLINK_MSG_ID_PARAM_MAP_RC_MIN_LEN, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN, MAVLINK_MSG_ID_PARAM_MAP_RC_CRC); #endif } @@ -248,7 +317,7 @@ static inline void mavlink_msg_param_map_rc_send_struct(mavlink_channel_t chan, #if MAVLINK_MSG_ID_PARAM_MAP_RC_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -278,7 +347,7 @@ static inline void mavlink_msg_param_map_rc_send_buf(mavlink_message_t *msgbuf, packet->target_system = target_system; packet->target_component = target_component; packet->parameter_rc_channel_index = parameter_rc_channel_index; - mav_array_memcpy(packet->param_id, param_id, sizeof(char)*16); + mav_array_assign_char(packet->param_id, param_id, 16); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_MAP_RC, (const char *)packet, MAVLINK_MSG_ID_PARAM_MAP_RC_MIN_LEN, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN, MAVLINK_MSG_ID_PARAM_MAP_RC_CRC); #endif } diff --git a/common/mavlink_msg_param_request_list.h b/common/mavlink_msg_param_request_list.h index e8ad2157d..0b95a1ca2 100644 --- a/common/mavlink_msg_param_request_list.h +++ b/common/mavlink_msg_param_request_list.h @@ -69,6 +69,42 @@ static inline uint16_t mavlink_msg_param_request_list_pack(uint8_t system_id, ui return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PARAM_REQUEST_LIST_MIN_LEN, MAVLINK_MSG_ID_PARAM_REQUEST_LIST_LEN, MAVLINK_MSG_ID_PARAM_REQUEST_LIST_CRC); } +/** + * @brief Pack a param_request_list message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_param_request_list_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PARAM_REQUEST_LIST_LEN]; + _mav_put_uint8_t(buf, 0, target_system); + _mav_put_uint8_t(buf, 1, target_component); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PARAM_REQUEST_LIST_LEN); +#else + mavlink_param_request_list_t packet; + packet.target_system = target_system; + packet.target_component = target_component; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_REQUEST_LIST_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_PARAM_REQUEST_LIST; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PARAM_REQUEST_LIST_MIN_LEN, MAVLINK_MSG_ID_PARAM_REQUEST_LIST_LEN, MAVLINK_MSG_ID_PARAM_REQUEST_LIST_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PARAM_REQUEST_LIST_MIN_LEN, MAVLINK_MSG_ID_PARAM_REQUEST_LIST_LEN); +#endif +} + /** * @brief Pack a param_request_list message on a channel * @param system_id ID of this system @@ -128,6 +164,20 @@ static inline uint16_t mavlink_msg_param_request_list_encode_chan(uint8_t system return mavlink_msg_param_request_list_pack_chan(system_id, component_id, chan, msg, param_request_list->target_system, param_request_list->target_component); } +/** + * @brief Encode a param_request_list struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param param_request_list C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_param_request_list_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_param_request_list_t* param_request_list) +{ + return mavlink_msg_param_request_list_pack_status(system_id, component_id, _status, msg, param_request_list->target_system, param_request_list->target_component); +} + /** * @brief Send a param_request_list message * @param chan MAVLink channel to send the message @@ -170,7 +220,7 @@ static inline void mavlink_msg_param_request_list_send_struct(mavlink_channel_t #if MAVLINK_MSG_ID_PARAM_REQUEST_LIST_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_param_request_read.h b/common/mavlink_msg_param_request_read.h index 92a3e8668..2b1dc5d8d 100644 --- a/common/mavlink_msg_param_request_read.h +++ b/common/mavlink_msg_param_request_read.h @@ -71,7 +71,7 @@ static inline uint16_t mavlink_msg_param_request_read_pack(uint8_t system_id, ui packet.param_index = param_index; packet.target_system = target_system; packet.target_component = target_component; - mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); + mav_array_assign_char(packet.param_id, param_id, 16); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN); #endif @@ -79,6 +79,46 @@ static inline uint16_t mavlink_msg_param_request_read_pack(uint8_t system_id, ui return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PARAM_REQUEST_READ_MIN_LEN, MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN, MAVLINK_MSG_ID_PARAM_REQUEST_READ_CRC); } +/** + * @brief Pack a param_request_read message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param param_id Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string + * @param param_index Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored) + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_param_request_read_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, const char *param_id, int16_t param_index) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN]; + _mav_put_int16_t(buf, 0, param_index); + _mav_put_uint8_t(buf, 2, target_system); + _mav_put_uint8_t(buf, 3, target_component); + _mav_put_char_array(buf, 4, param_id, 16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN); +#else + mavlink_param_request_read_t packet; + packet.param_index = param_index; + packet.target_system = target_system; + packet.target_component = target_component; + mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_PARAM_REQUEST_READ; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PARAM_REQUEST_READ_MIN_LEN, MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN, MAVLINK_MSG_ID_PARAM_REQUEST_READ_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PARAM_REQUEST_READ_MIN_LEN, MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN); +#endif +} + /** * @brief Pack a param_request_read message on a channel * @param system_id ID of this system @@ -107,7 +147,7 @@ static inline uint16_t mavlink_msg_param_request_read_pack_chan(uint8_t system_i packet.param_index = param_index; packet.target_system = target_system; packet.target_component = target_component; - mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); + mav_array_assign_char(packet.param_id, param_id, 16); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN); #endif @@ -142,6 +182,20 @@ static inline uint16_t mavlink_msg_param_request_read_encode_chan(uint8_t system return mavlink_msg_param_request_read_pack_chan(system_id, component_id, chan, msg, param_request_read->target_system, param_request_read->target_component, param_request_read->param_id, param_request_read->param_index); } +/** + * @brief Encode a param_request_read struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param param_request_read C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_param_request_read_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_param_request_read_t* param_request_read) +{ + return mavlink_msg_param_request_read_pack_status(system_id, component_id, _status, msg, param_request_read->target_system, param_request_read->target_component, param_request_read->param_id, param_request_read->param_index); +} + /** * @brief Send a param_request_read message * @param chan MAVLink channel to send the message @@ -167,7 +221,7 @@ static inline void mavlink_msg_param_request_read_send(mavlink_channel_t chan, u packet.param_index = param_index; packet.target_system = target_system; packet.target_component = target_component; - mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); + mav_array_assign_char(packet.param_id, param_id, 16); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_REQUEST_READ, (const char *)&packet, MAVLINK_MSG_ID_PARAM_REQUEST_READ_MIN_LEN, MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN, MAVLINK_MSG_ID_PARAM_REQUEST_READ_CRC); #endif } @@ -188,7 +242,7 @@ static inline void mavlink_msg_param_request_read_send_struct(mavlink_channel_t #if MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -208,7 +262,7 @@ static inline void mavlink_msg_param_request_read_send_buf(mavlink_message_t *ms packet->param_index = param_index; packet->target_system = target_system; packet->target_component = target_component; - mav_array_memcpy(packet->param_id, param_id, sizeof(char)*16); + mav_array_assign_char(packet->param_id, param_id, 16); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_REQUEST_READ, (const char *)packet, MAVLINK_MSG_ID_PARAM_REQUEST_READ_MIN_LEN, MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN, MAVLINK_MSG_ID_PARAM_REQUEST_READ_CRC); #endif } diff --git a/common/mavlink_msg_param_set.h b/common/mavlink_msg_param_set.h index 72039bca9..98e493f55 100644 --- a/common/mavlink_msg_param_set.h +++ b/common/mavlink_msg_param_set.h @@ -77,7 +77,7 @@ static inline uint16_t mavlink_msg_param_set_pack(uint8_t system_id, uint8_t com packet.target_system = target_system; packet.target_component = target_component; packet.param_type = param_type; - mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); + mav_array_assign_char(packet.param_id, param_id, 16); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_SET_LEN); #endif @@ -85,6 +85,49 @@ static inline uint16_t mavlink_msg_param_set_pack(uint8_t system_id, uint8_t com return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PARAM_SET_MIN_LEN, MAVLINK_MSG_ID_PARAM_SET_LEN, MAVLINK_MSG_ID_PARAM_SET_CRC); } +/** + * @brief Pack a param_set message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param param_id Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string + * @param param_value Onboard parameter value + * @param param_type Onboard parameter type. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_param_set_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, const char *param_id, float param_value, uint8_t param_type) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PARAM_SET_LEN]; + _mav_put_float(buf, 0, param_value); + _mav_put_uint8_t(buf, 4, target_system); + _mav_put_uint8_t(buf, 5, target_component); + _mav_put_uint8_t(buf, 22, param_type); + _mav_put_char_array(buf, 6, param_id, 16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PARAM_SET_LEN); +#else + mavlink_param_set_t packet; + packet.param_value = param_value; + packet.target_system = target_system; + packet.target_component = target_component; + packet.param_type = param_type; + mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_SET_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_PARAM_SET; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PARAM_SET_MIN_LEN, MAVLINK_MSG_ID_PARAM_SET_LEN, MAVLINK_MSG_ID_PARAM_SET_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PARAM_SET_MIN_LEN, MAVLINK_MSG_ID_PARAM_SET_LEN); +#endif +} + /** * @brief Pack a param_set message on a channel * @param system_id ID of this system @@ -116,7 +159,7 @@ static inline uint16_t mavlink_msg_param_set_pack_chan(uint8_t system_id, uint8_ packet.target_system = target_system; packet.target_component = target_component; packet.param_type = param_type; - mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); + mav_array_assign_char(packet.param_id, param_id, 16); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_SET_LEN); #endif @@ -151,6 +194,20 @@ static inline uint16_t mavlink_msg_param_set_encode_chan(uint8_t system_id, uint return mavlink_msg_param_set_pack_chan(system_id, component_id, chan, msg, param_set->target_system, param_set->target_component, param_set->param_id, param_set->param_value, param_set->param_type); } +/** + * @brief Encode a param_set struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param param_set C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_param_set_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_param_set_t* param_set) +{ + return mavlink_msg_param_set_pack_status(system_id, component_id, _status, msg, param_set->target_system, param_set->target_component, param_set->param_id, param_set->param_value, param_set->param_type); +} + /** * @brief Send a param_set message * @param chan MAVLink channel to send the message @@ -179,7 +236,7 @@ static inline void mavlink_msg_param_set_send(mavlink_channel_t chan, uint8_t ta packet.target_system = target_system; packet.target_component = target_component; packet.param_type = param_type; - mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); + mav_array_assign_char(packet.param_id, param_id, 16); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_SET, (const char *)&packet, MAVLINK_MSG_ID_PARAM_SET_MIN_LEN, MAVLINK_MSG_ID_PARAM_SET_LEN, MAVLINK_MSG_ID_PARAM_SET_CRC); #endif } @@ -200,7 +257,7 @@ static inline void mavlink_msg_param_set_send_struct(mavlink_channel_t chan, con #if MAVLINK_MSG_ID_PARAM_SET_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -222,7 +279,7 @@ static inline void mavlink_msg_param_set_send_buf(mavlink_message_t *msgbuf, mav packet->target_system = target_system; packet->target_component = target_component; packet->param_type = param_type; - mav_array_memcpy(packet->param_id, param_id, sizeof(char)*16); + mav_array_assign_char(packet->param_id, param_id, 16); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_SET, (const char *)packet, MAVLINK_MSG_ID_PARAM_SET_MIN_LEN, MAVLINK_MSG_ID_PARAM_SET_LEN, MAVLINK_MSG_ID_PARAM_SET_CRC); #endif } diff --git a/common/mavlink_msg_param_value.h b/common/mavlink_msg_param_value.h index e487917cc..ad33f333c 100644 --- a/common/mavlink_msg_param_value.h +++ b/common/mavlink_msg_param_value.h @@ -77,7 +77,7 @@ static inline uint16_t mavlink_msg_param_value_pack(uint8_t system_id, uint8_t c packet.param_count = param_count; packet.param_index = param_index; packet.param_type = param_type; - mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); + mav_array_assign_char(packet.param_id, param_id, 16); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_VALUE_LEN); #endif @@ -85,6 +85,49 @@ static inline uint16_t mavlink_msg_param_value_pack(uint8_t system_id, uint8_t c return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PARAM_VALUE_MIN_LEN, MAVLINK_MSG_ID_PARAM_VALUE_LEN, MAVLINK_MSG_ID_PARAM_VALUE_CRC); } +/** + * @brief Pack a param_value message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param param_id Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string + * @param param_value Onboard parameter value + * @param param_type Onboard parameter type. + * @param param_count Total number of onboard parameters + * @param param_index Index of this onboard parameter + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_param_value_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + const char *param_id, float param_value, uint8_t param_type, uint16_t param_count, uint16_t param_index) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PARAM_VALUE_LEN]; + _mav_put_float(buf, 0, param_value); + _mav_put_uint16_t(buf, 4, param_count); + _mav_put_uint16_t(buf, 6, param_index); + _mav_put_uint8_t(buf, 24, param_type); + _mav_put_char_array(buf, 8, param_id, 16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PARAM_VALUE_LEN); +#else + mavlink_param_value_t packet; + packet.param_value = param_value; + packet.param_count = param_count; + packet.param_index = param_index; + packet.param_type = param_type; + mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_VALUE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_PARAM_VALUE; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PARAM_VALUE_MIN_LEN, MAVLINK_MSG_ID_PARAM_VALUE_LEN, MAVLINK_MSG_ID_PARAM_VALUE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PARAM_VALUE_MIN_LEN, MAVLINK_MSG_ID_PARAM_VALUE_LEN); +#endif +} + /** * @brief Pack a param_value message on a channel * @param system_id ID of this system @@ -116,7 +159,7 @@ static inline uint16_t mavlink_msg_param_value_pack_chan(uint8_t system_id, uint packet.param_count = param_count; packet.param_index = param_index; packet.param_type = param_type; - mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); + mav_array_assign_char(packet.param_id, param_id, 16); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_VALUE_LEN); #endif @@ -151,6 +194,20 @@ static inline uint16_t mavlink_msg_param_value_encode_chan(uint8_t system_id, ui return mavlink_msg_param_value_pack_chan(system_id, component_id, chan, msg, param_value->param_id, param_value->param_value, param_value->param_type, param_value->param_count, param_value->param_index); } +/** + * @brief Encode a param_value struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param param_value C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_param_value_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_param_value_t* param_value) +{ + return mavlink_msg_param_value_pack_status(system_id, component_id, _status, msg, param_value->param_id, param_value->param_value, param_value->param_type, param_value->param_count, param_value->param_index); +} + /** * @brief Send a param_value message * @param chan MAVLink channel to send the message @@ -179,7 +236,7 @@ static inline void mavlink_msg_param_value_send(mavlink_channel_t chan, const ch packet.param_count = param_count; packet.param_index = param_index; packet.param_type = param_type; - mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); + mav_array_assign_char(packet.param_id, param_id, 16); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_VALUE, (const char *)&packet, MAVLINK_MSG_ID_PARAM_VALUE_MIN_LEN, MAVLINK_MSG_ID_PARAM_VALUE_LEN, MAVLINK_MSG_ID_PARAM_VALUE_CRC); #endif } @@ -200,7 +257,7 @@ static inline void mavlink_msg_param_value_send_struct(mavlink_channel_t chan, c #if MAVLINK_MSG_ID_PARAM_VALUE_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -222,7 +279,7 @@ static inline void mavlink_msg_param_value_send_buf(mavlink_message_t *msgbuf, m packet->param_count = param_count; packet->param_index = param_index; packet->param_type = param_type; - mav_array_memcpy(packet->param_id, param_id, sizeof(char)*16); + mav_array_assign_char(packet->param_id, param_id, 16); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_VALUE, (const char *)packet, MAVLINK_MSG_ID_PARAM_VALUE_MIN_LEN, MAVLINK_MSG_ID_PARAM_VALUE_LEN, MAVLINK_MSG_ID_PARAM_VALUE_CRC); #endif } diff --git a/common/mavlink_msg_ping.h b/common/mavlink_msg_ping.h index 1e5508d44..cd4518738 100644 --- a/common/mavlink_msg_ping.h +++ b/common/mavlink_msg_ping.h @@ -81,6 +81,48 @@ static inline uint16_t mavlink_msg_ping_pack(uint8_t system_id, uint8_t componen return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PING_MIN_LEN, MAVLINK_MSG_ID_PING_LEN, MAVLINK_MSG_ID_PING_CRC); } +/** + * @brief Pack a ping message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param seq PING sequence + * @param target_system 0: request ping from all receiving systems. If greater than 0: message is a ping response and number is the system id of the requesting system + * @param target_component 0: request ping from all receiving components. If greater than 0: message is a ping response and number is the component id of the requesting component. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_ping_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, uint32_t seq, uint8_t target_system, uint8_t target_component) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PING_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint32_t(buf, 8, seq); + _mav_put_uint8_t(buf, 12, target_system); + _mav_put_uint8_t(buf, 13, target_component); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PING_LEN); +#else + mavlink_ping_t packet; + packet.time_usec = time_usec; + packet.seq = seq; + packet.target_system = target_system; + packet.target_component = target_component; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PING_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_PING; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PING_MIN_LEN, MAVLINK_MSG_ID_PING_LEN, MAVLINK_MSG_ID_PING_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PING_MIN_LEN, MAVLINK_MSG_ID_PING_LEN); +#endif +} + /** * @brief Pack a ping message on a channel * @param system_id ID of this system @@ -146,6 +188,20 @@ static inline uint16_t mavlink_msg_ping_encode_chan(uint8_t system_id, uint8_t c return mavlink_msg_ping_pack_chan(system_id, component_id, chan, msg, ping->time_usec, ping->seq, ping->target_system, ping->target_component); } +/** + * @brief Encode a ping struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param ping C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_ping_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_ping_t* ping) +{ + return mavlink_msg_ping_pack_status(system_id, component_id, _status, msg, ping->time_usec, ping->seq, ping->target_system, ping->target_component); +} + /** * @brief Send a ping message * @param chan MAVLink channel to send the message @@ -194,7 +250,7 @@ static inline void mavlink_msg_ping_send_struct(mavlink_channel_t chan, const ma #if MAVLINK_MSG_ID_PING_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_play_tune.h b/common/mavlink_msg_play_tune.h index c318448e2..1e8de9ce4 100644 --- a/common/mavlink_msg_play_tune.h +++ b/common/mavlink_msg_play_tune.h @@ -60,6 +60,42 @@ typedef struct __mavlink_play_tune_t { static inline uint16_t mavlink_msg_play_tune_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t target_system, uint8_t target_component, const char *tune, const char *tune2) { +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PLAY_TUNE_LEN]; + _mav_put_uint8_t(buf, 0, target_system); + _mav_put_uint8_t(buf, 1, target_component); + _mav_put_char_array(buf, 2, tune, 30); + _mav_put_char_array(buf, 32, tune2, 200); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PLAY_TUNE_LEN); +#else + mavlink_play_tune_t packet; + packet.target_system = target_system; + packet.target_component = target_component; + mav_array_assign_char(packet.tune, tune, 30); + mav_array_assign_char(packet.tune2, tune2, 200); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PLAY_TUNE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_PLAY_TUNE; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PLAY_TUNE_MIN_LEN, MAVLINK_MSG_ID_PLAY_TUNE_LEN, MAVLINK_MSG_ID_PLAY_TUNE_CRC); +} + +/** + * @brief Pack a play_tune message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param tune tune in board specific format + * @param tune2 tune extension (appended to tune) + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_play_tune_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, const char *tune, const char *tune2) +{ #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_PLAY_TUNE_LEN]; _mav_put_uint8_t(buf, 0, target_system); @@ -77,7 +113,11 @@ static inline uint16_t mavlink_msg_play_tune_pack(uint8_t system_id, uint8_t com #endif msg->msgid = MAVLINK_MSG_ID_PLAY_TUNE; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PLAY_TUNE_MIN_LEN, MAVLINK_MSG_ID_PLAY_TUNE_LEN, MAVLINK_MSG_ID_PLAY_TUNE_CRC); +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PLAY_TUNE_MIN_LEN, MAVLINK_MSG_ID_PLAY_TUNE_LEN, MAVLINK_MSG_ID_PLAY_TUNE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PLAY_TUNE_MIN_LEN, MAVLINK_MSG_ID_PLAY_TUNE_LEN); +#endif } /** @@ -107,8 +147,8 @@ static inline uint16_t mavlink_msg_play_tune_pack_chan(uint8_t system_id, uint8_ mavlink_play_tune_t packet; packet.target_system = target_system; packet.target_component = target_component; - mav_array_memcpy(packet.tune, tune, sizeof(char)*30); - mav_array_memcpy(packet.tune2, tune2, sizeof(char)*200); + mav_array_assign_char(packet.tune, tune, 30); + mav_array_assign_char(packet.tune2, tune2, 200); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PLAY_TUNE_LEN); #endif @@ -143,6 +183,20 @@ static inline uint16_t mavlink_msg_play_tune_encode_chan(uint8_t system_id, uint return mavlink_msg_play_tune_pack_chan(system_id, component_id, chan, msg, play_tune->target_system, play_tune->target_component, play_tune->tune, play_tune->tune2); } +/** + * @brief Encode a play_tune struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param play_tune C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_play_tune_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_play_tune_t* play_tune) +{ + return mavlink_msg_play_tune_pack_status(system_id, component_id, _status, msg, play_tune->target_system, play_tune->target_component, play_tune->tune, play_tune->tune2); +} + /** * @brief Send a play_tune message * @param chan MAVLink channel to send the message @@ -167,8 +221,8 @@ static inline void mavlink_msg_play_tune_send(mavlink_channel_t chan, uint8_t ta mavlink_play_tune_t packet; packet.target_system = target_system; packet.target_component = target_component; - mav_array_memcpy(packet.tune, tune, sizeof(char)*30); - mav_array_memcpy(packet.tune2, tune2, sizeof(char)*200); + mav_array_assign_char(packet.tune, tune, 30); + mav_array_assign_char(packet.tune2, tune2, 200); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PLAY_TUNE, (const char *)&packet, MAVLINK_MSG_ID_PLAY_TUNE_MIN_LEN, MAVLINK_MSG_ID_PLAY_TUNE_LEN, MAVLINK_MSG_ID_PLAY_TUNE_CRC); #endif } @@ -189,7 +243,7 @@ static inline void mavlink_msg_play_tune_send_struct(mavlink_channel_t chan, con #if MAVLINK_MSG_ID_PLAY_TUNE_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -208,8 +262,8 @@ static inline void mavlink_msg_play_tune_send_buf(mavlink_message_t *msgbuf, mav mavlink_play_tune_t *packet = (mavlink_play_tune_t *)msgbuf; packet->target_system = target_system; packet->target_component = target_component; - mav_array_memcpy(packet->tune, tune, sizeof(char)*30); - mav_array_memcpy(packet->tune2, tune2, sizeof(char)*200); + mav_array_assign_char(packet->tune, tune, 30); + mav_array_assign_char(packet->tune2, tune2, 200); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PLAY_TUNE, (const char *)packet, MAVLINK_MSG_ID_PLAY_TUNE_MIN_LEN, MAVLINK_MSG_ID_PLAY_TUNE_LEN, MAVLINK_MSG_ID_PLAY_TUNE_CRC); #endif } diff --git a/common/mavlink_msg_play_tune_v2.h b/common/mavlink_msg_play_tune_v2.h index c47d6e6a8..b81de5307 100644 --- a/common/mavlink_msg_play_tune_v2.h +++ b/common/mavlink_msg_play_tune_v2.h @@ -71,7 +71,7 @@ static inline uint16_t mavlink_msg_play_tune_v2_pack(uint8_t system_id, uint8_t packet.format = format; packet.target_system = target_system; packet.target_component = target_component; - mav_array_memcpy(packet.tune, tune, sizeof(char)*248); + mav_array_assign_char(packet.tune, tune, 248); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PLAY_TUNE_V2_LEN); #endif @@ -79,6 +79,46 @@ static inline uint16_t mavlink_msg_play_tune_v2_pack(uint8_t system_id, uint8_t return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PLAY_TUNE_V2_MIN_LEN, MAVLINK_MSG_ID_PLAY_TUNE_V2_LEN, MAVLINK_MSG_ID_PLAY_TUNE_V2_CRC); } +/** + * @brief Pack a play_tune_v2 message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param format Tune format + * @param tune Tune definition as a NULL-terminated string. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_play_tune_v2_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint32_t format, const char *tune) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PLAY_TUNE_V2_LEN]; + _mav_put_uint32_t(buf, 0, format); + _mav_put_uint8_t(buf, 4, target_system); + _mav_put_uint8_t(buf, 5, target_component); + _mav_put_char_array(buf, 6, tune, 248); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PLAY_TUNE_V2_LEN); +#else + mavlink_play_tune_v2_t packet; + packet.format = format; + packet.target_system = target_system; + packet.target_component = target_component; + mav_array_memcpy(packet.tune, tune, sizeof(char)*248); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PLAY_TUNE_V2_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_PLAY_TUNE_V2; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PLAY_TUNE_V2_MIN_LEN, MAVLINK_MSG_ID_PLAY_TUNE_V2_LEN, MAVLINK_MSG_ID_PLAY_TUNE_V2_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PLAY_TUNE_V2_MIN_LEN, MAVLINK_MSG_ID_PLAY_TUNE_V2_LEN); +#endif +} + /** * @brief Pack a play_tune_v2 message on a channel * @param system_id ID of this system @@ -107,7 +147,7 @@ static inline uint16_t mavlink_msg_play_tune_v2_pack_chan(uint8_t system_id, uin packet.format = format; packet.target_system = target_system; packet.target_component = target_component; - mav_array_memcpy(packet.tune, tune, sizeof(char)*248); + mav_array_assign_char(packet.tune, tune, 248); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PLAY_TUNE_V2_LEN); #endif @@ -142,6 +182,20 @@ static inline uint16_t mavlink_msg_play_tune_v2_encode_chan(uint8_t system_id, u return mavlink_msg_play_tune_v2_pack_chan(system_id, component_id, chan, msg, play_tune_v2->target_system, play_tune_v2->target_component, play_tune_v2->format, play_tune_v2->tune); } +/** + * @brief Encode a play_tune_v2 struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param play_tune_v2 C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_play_tune_v2_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_play_tune_v2_t* play_tune_v2) +{ + return mavlink_msg_play_tune_v2_pack_status(system_id, component_id, _status, msg, play_tune_v2->target_system, play_tune_v2->target_component, play_tune_v2->format, play_tune_v2->tune); +} + /** * @brief Send a play_tune_v2 message * @param chan MAVLink channel to send the message @@ -167,7 +221,7 @@ static inline void mavlink_msg_play_tune_v2_send(mavlink_channel_t chan, uint8_t packet.format = format; packet.target_system = target_system; packet.target_component = target_component; - mav_array_memcpy(packet.tune, tune, sizeof(char)*248); + mav_array_assign_char(packet.tune, tune, 248); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PLAY_TUNE_V2, (const char *)&packet, MAVLINK_MSG_ID_PLAY_TUNE_V2_MIN_LEN, MAVLINK_MSG_ID_PLAY_TUNE_V2_LEN, MAVLINK_MSG_ID_PLAY_TUNE_V2_CRC); #endif } @@ -188,7 +242,7 @@ static inline void mavlink_msg_play_tune_v2_send_struct(mavlink_channel_t chan, #if MAVLINK_MSG_ID_PLAY_TUNE_V2_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -208,7 +262,7 @@ static inline void mavlink_msg_play_tune_v2_send_buf(mavlink_message_t *msgbuf, packet->format = format; packet->target_system = target_system; packet->target_component = target_component; - mav_array_memcpy(packet->tune, tune, sizeof(char)*248); + mav_array_assign_char(packet->tune, tune, 248); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PLAY_TUNE_V2, (const char *)packet, MAVLINK_MSG_ID_PLAY_TUNE_V2_MIN_LEN, MAVLINK_MSG_ID_PLAY_TUNE_V2_LEN, MAVLINK_MSG_ID_PLAY_TUNE_V2_CRC); #endif } diff --git a/common/mavlink_msg_position_target_global_int.h b/common/mavlink_msg_position_target_global_int.h index 93386fab7..aec85b66d 100644 --- a/common/mavlink_msg_position_target_global_int.h +++ b/common/mavlink_msg_position_target_global_int.h @@ -6,8 +6,8 @@ typedef struct __mavlink_position_target_global_int_t { uint32_t time_boot_ms; /*< [ms] Timestamp (time since system boot). The rationale for the timestamp in the setpoint is to allow the system to compensate for the transport delay of the setpoint. This allows the system to compensate processing latency.*/ - int32_t lat_int; /*< [degE7] X Position in WGS84 frame*/ - int32_t lon_int; /*< [degE7] Y Position in WGS84 frame*/ + int32_t lat_int; /*< [degE7] Latitude in WGS84 frame*/ + int32_t lon_int; /*< [degE7] Longitude in WGS84 frame*/ float alt; /*< [m] Altitude (MSL, AGL or relative to home altitude, depending on frame)*/ float vx; /*< [m/s] X velocity in NED frame*/ float vy; /*< [m/s] Y velocity in NED frame*/ @@ -18,7 +18,7 @@ typedef struct __mavlink_position_target_global_int_t { float yaw; /*< [rad] yaw setpoint*/ float yaw_rate; /*< [rad/s] yaw rate setpoint*/ uint16_t type_mask; /*< Bitmap to indicate which dimensions should be ignored by the vehicle.*/ - uint8_t coordinate_frame; /*< Valid options are: MAV_FRAME_GLOBAL_INT = 5, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT = 6, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT = 11*/ + uint8_t coordinate_frame; /*< Valid options are: MAV_FRAME_GLOBAL = 0, MAV_FRAME_GLOBAL_RELATIVE_ALT = 3, MAV_FRAME_GLOBAL_TERRAIN_ALT = 10 (MAV_FRAME_GLOBAL_INT, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT are allowed synonyms, but have been deprecated)*/ } mavlink_position_target_global_int_t; #define MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN 51 @@ -81,10 +81,10 @@ typedef struct __mavlink_position_target_global_int_t { * @param msg The MAVLink message to compress the data into * * @param time_boot_ms [ms] Timestamp (time since system boot). The rationale for the timestamp in the setpoint is to allow the system to compensate for the transport delay of the setpoint. This allows the system to compensate processing latency. - * @param coordinate_frame Valid options are: MAV_FRAME_GLOBAL_INT = 5, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT = 6, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT = 11 + * @param coordinate_frame Valid options are: MAV_FRAME_GLOBAL = 0, MAV_FRAME_GLOBAL_RELATIVE_ALT = 3, MAV_FRAME_GLOBAL_TERRAIN_ALT = 10 (MAV_FRAME_GLOBAL_INT, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT are allowed synonyms, but have been deprecated) * @param type_mask Bitmap to indicate which dimensions should be ignored by the vehicle. - * @param lat_int [degE7] X Position in WGS84 frame - * @param lon_int [degE7] Y Position in WGS84 frame + * @param lat_int [degE7] Latitude in WGS84 frame + * @param lon_int [degE7] Longitude in WGS84 frame * @param alt [m] Altitude (MSL, AGL or relative to home altitude, depending on frame) * @param vx [m/s] X velocity in NED frame * @param vy [m/s] Y velocity in NED frame @@ -141,6 +141,78 @@ static inline uint16_t mavlink_msg_position_target_global_int_pack(uint8_t syste return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_MIN_LEN, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_CRC); } +/** + * @brief Pack a position_target_global_int message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). The rationale for the timestamp in the setpoint is to allow the system to compensate for the transport delay of the setpoint. This allows the system to compensate processing latency. + * @param coordinate_frame Valid options are: MAV_FRAME_GLOBAL = 0, MAV_FRAME_GLOBAL_RELATIVE_ALT = 3, MAV_FRAME_GLOBAL_TERRAIN_ALT = 10 (MAV_FRAME_GLOBAL_INT, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT are allowed synonyms, but have been deprecated) + * @param type_mask Bitmap to indicate which dimensions should be ignored by the vehicle. + * @param lat_int [degE7] Latitude in WGS84 frame + * @param lon_int [degE7] Longitude in WGS84 frame + * @param alt [m] Altitude (MSL, AGL or relative to home altitude, depending on frame) + * @param vx [m/s] X velocity in NED frame + * @param vy [m/s] Y velocity in NED frame + * @param vz [m/s] Z velocity in NED frame + * @param afx [m/s/s] X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + * @param afy [m/s/s] Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + * @param afz [m/s/s] Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + * @param yaw [rad] yaw setpoint + * @param yaw_rate [rad/s] yaw rate setpoint + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_position_target_global_int_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, uint8_t coordinate_frame, uint16_t type_mask, int32_t lat_int, int32_t lon_int, float alt, float vx, float vy, float vz, float afx, float afy, float afz, float yaw, float yaw_rate) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_int32_t(buf, 4, lat_int); + _mav_put_int32_t(buf, 8, lon_int); + _mav_put_float(buf, 12, alt); + _mav_put_float(buf, 16, vx); + _mav_put_float(buf, 20, vy); + _mav_put_float(buf, 24, vz); + _mav_put_float(buf, 28, afx); + _mav_put_float(buf, 32, afy); + _mav_put_float(buf, 36, afz); + _mav_put_float(buf, 40, yaw); + _mav_put_float(buf, 44, yaw_rate); + _mav_put_uint16_t(buf, 48, type_mask); + _mav_put_uint8_t(buf, 50, coordinate_frame); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN); +#else + mavlink_position_target_global_int_t packet; + packet.time_boot_ms = time_boot_ms; + packet.lat_int = lat_int; + packet.lon_int = lon_int; + packet.alt = alt; + packet.vx = vx; + packet.vy = vy; + packet.vz = vz; + packet.afx = afx; + packet.afy = afy; + packet.afz = afz; + packet.yaw = yaw; + packet.yaw_rate = yaw_rate; + packet.type_mask = type_mask; + packet.coordinate_frame = coordinate_frame; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_MIN_LEN, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_MIN_LEN, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN); +#endif +} + /** * @brief Pack a position_target_global_int message on a channel * @param system_id ID of this system @@ -148,10 +220,10 @@ static inline uint16_t mavlink_msg_position_target_global_int_pack(uint8_t syste * @param chan The MAVLink channel this message will be sent over * @param msg The MAVLink message to compress the data into * @param time_boot_ms [ms] Timestamp (time since system boot). The rationale for the timestamp in the setpoint is to allow the system to compensate for the transport delay of the setpoint. This allows the system to compensate processing latency. - * @param coordinate_frame Valid options are: MAV_FRAME_GLOBAL_INT = 5, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT = 6, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT = 11 + * @param coordinate_frame Valid options are: MAV_FRAME_GLOBAL = 0, MAV_FRAME_GLOBAL_RELATIVE_ALT = 3, MAV_FRAME_GLOBAL_TERRAIN_ALT = 10 (MAV_FRAME_GLOBAL_INT, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT are allowed synonyms, but have been deprecated) * @param type_mask Bitmap to indicate which dimensions should be ignored by the vehicle. - * @param lat_int [degE7] X Position in WGS84 frame - * @param lon_int [degE7] Y Position in WGS84 frame + * @param lat_int [degE7] Latitude in WGS84 frame + * @param lon_int [degE7] Longitude in WGS84 frame * @param alt [m] Altitude (MSL, AGL or relative to home altitude, depending on frame) * @param vx [m/s] X velocity in NED frame * @param vy [m/s] Y velocity in NED frame @@ -236,15 +308,29 @@ static inline uint16_t mavlink_msg_position_target_global_int_encode_chan(uint8_ return mavlink_msg_position_target_global_int_pack_chan(system_id, component_id, chan, msg, position_target_global_int->time_boot_ms, position_target_global_int->coordinate_frame, position_target_global_int->type_mask, position_target_global_int->lat_int, position_target_global_int->lon_int, position_target_global_int->alt, position_target_global_int->vx, position_target_global_int->vy, position_target_global_int->vz, position_target_global_int->afx, position_target_global_int->afy, position_target_global_int->afz, position_target_global_int->yaw, position_target_global_int->yaw_rate); } +/** + * @brief Encode a position_target_global_int struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param position_target_global_int C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_position_target_global_int_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_position_target_global_int_t* position_target_global_int) +{ + return mavlink_msg_position_target_global_int_pack_status(system_id, component_id, _status, msg, position_target_global_int->time_boot_ms, position_target_global_int->coordinate_frame, position_target_global_int->type_mask, position_target_global_int->lat_int, position_target_global_int->lon_int, position_target_global_int->alt, position_target_global_int->vx, position_target_global_int->vy, position_target_global_int->vz, position_target_global_int->afx, position_target_global_int->afy, position_target_global_int->afz, position_target_global_int->yaw, position_target_global_int->yaw_rate); +} + /** * @brief Send a position_target_global_int message * @param chan MAVLink channel to send the message * * @param time_boot_ms [ms] Timestamp (time since system boot). The rationale for the timestamp in the setpoint is to allow the system to compensate for the transport delay of the setpoint. This allows the system to compensate processing latency. - * @param coordinate_frame Valid options are: MAV_FRAME_GLOBAL_INT = 5, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT = 6, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT = 11 + * @param coordinate_frame Valid options are: MAV_FRAME_GLOBAL = 0, MAV_FRAME_GLOBAL_RELATIVE_ALT = 3, MAV_FRAME_GLOBAL_TERRAIN_ALT = 10 (MAV_FRAME_GLOBAL_INT, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT are allowed synonyms, but have been deprecated) * @param type_mask Bitmap to indicate which dimensions should be ignored by the vehicle. - * @param lat_int [degE7] X Position in WGS84 frame - * @param lon_int [degE7] Y Position in WGS84 frame + * @param lat_int [degE7] Latitude in WGS84 frame + * @param lon_int [degE7] Longitude in WGS84 frame * @param alt [m] Altitude (MSL, AGL or relative to home altitude, depending on frame) * @param vx [m/s] X velocity in NED frame * @param vy [m/s] Y velocity in NED frame @@ -314,7 +400,7 @@ static inline void mavlink_msg_position_target_global_int_send_struct(mavlink_ch #if MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -380,7 +466,7 @@ static inline uint32_t mavlink_msg_position_target_global_int_get_time_boot_ms(c /** * @brief Get field coordinate_frame from position_target_global_int message * - * @return Valid options are: MAV_FRAME_GLOBAL_INT = 5, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT = 6, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT = 11 + * @return Valid options are: MAV_FRAME_GLOBAL = 0, MAV_FRAME_GLOBAL_RELATIVE_ALT = 3, MAV_FRAME_GLOBAL_TERRAIN_ALT = 10 (MAV_FRAME_GLOBAL_INT, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT are allowed synonyms, but have been deprecated) */ static inline uint8_t mavlink_msg_position_target_global_int_get_coordinate_frame(const mavlink_message_t* msg) { @@ -400,7 +486,7 @@ static inline uint16_t mavlink_msg_position_target_global_int_get_type_mask(cons /** * @brief Get field lat_int from position_target_global_int message * - * @return [degE7] X Position in WGS84 frame + * @return [degE7] Latitude in WGS84 frame */ static inline int32_t mavlink_msg_position_target_global_int_get_lat_int(const mavlink_message_t* msg) { @@ -410,7 +496,7 @@ static inline int32_t mavlink_msg_position_target_global_int_get_lat_int(const m /** * @brief Get field lon_int from position_target_global_int message * - * @return [degE7] Y Position in WGS84 frame + * @return [degE7] Longitude in WGS84 frame */ static inline int32_t mavlink_msg_position_target_global_int_get_lon_int(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_position_target_local_ned.h b/common/mavlink_msg_position_target_local_ned.h index f3cfde26e..9ea5ec630 100644 --- a/common/mavlink_msg_position_target_local_ned.h +++ b/common/mavlink_msg_position_target_local_ned.h @@ -141,6 +141,78 @@ static inline uint16_t mavlink_msg_position_target_local_ned_pack(uint8_t system return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_MIN_LEN, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_LEN, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_CRC); } +/** + * @brief Pack a position_target_local_ned message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param coordinate_frame Valid options are: MAV_FRAME_LOCAL_NED = 1, MAV_FRAME_LOCAL_OFFSET_NED = 7, MAV_FRAME_BODY_NED = 8, MAV_FRAME_BODY_OFFSET_NED = 9 + * @param type_mask Bitmap to indicate which dimensions should be ignored by the vehicle. + * @param x [m] X Position in NED frame + * @param y [m] Y Position in NED frame + * @param z [m] Z Position in NED frame (note, altitude is negative in NED) + * @param vx [m/s] X velocity in NED frame + * @param vy [m/s] Y velocity in NED frame + * @param vz [m/s] Z velocity in NED frame + * @param afx [m/s/s] X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + * @param afy [m/s/s] Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + * @param afz [m/s/s] Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + * @param yaw [rad] yaw setpoint + * @param yaw_rate [rad/s] yaw rate setpoint + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_position_target_local_ned_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, uint8_t coordinate_frame, uint16_t type_mask, float x, float y, float z, float vx, float vy, float vz, float afx, float afy, float afz, float yaw, float yaw_rate) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_float(buf, 4, x); + _mav_put_float(buf, 8, y); + _mav_put_float(buf, 12, z); + _mav_put_float(buf, 16, vx); + _mav_put_float(buf, 20, vy); + _mav_put_float(buf, 24, vz); + _mav_put_float(buf, 28, afx); + _mav_put_float(buf, 32, afy); + _mav_put_float(buf, 36, afz); + _mav_put_float(buf, 40, yaw); + _mav_put_float(buf, 44, yaw_rate); + _mav_put_uint16_t(buf, 48, type_mask); + _mav_put_uint8_t(buf, 50, coordinate_frame); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_LEN); +#else + mavlink_position_target_local_ned_t packet; + packet.time_boot_ms = time_boot_ms; + packet.x = x; + packet.y = y; + packet.z = z; + packet.vx = vx; + packet.vy = vy; + packet.vz = vz; + packet.afx = afx; + packet.afy = afy; + packet.afz = afz; + packet.yaw = yaw; + packet.yaw_rate = yaw_rate; + packet.type_mask = type_mask; + packet.coordinate_frame = coordinate_frame; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_MIN_LEN, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_LEN, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_MIN_LEN, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_LEN); +#endif +} + /** * @brief Pack a position_target_local_ned message on a channel * @param system_id ID of this system @@ -236,6 +308,20 @@ static inline uint16_t mavlink_msg_position_target_local_ned_encode_chan(uint8_t return mavlink_msg_position_target_local_ned_pack_chan(system_id, component_id, chan, msg, position_target_local_ned->time_boot_ms, position_target_local_ned->coordinate_frame, position_target_local_ned->type_mask, position_target_local_ned->x, position_target_local_ned->y, position_target_local_ned->z, position_target_local_ned->vx, position_target_local_ned->vy, position_target_local_ned->vz, position_target_local_ned->afx, position_target_local_ned->afy, position_target_local_ned->afz, position_target_local_ned->yaw, position_target_local_ned->yaw_rate); } +/** + * @brief Encode a position_target_local_ned struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param position_target_local_ned C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_position_target_local_ned_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_position_target_local_ned_t* position_target_local_ned) +{ + return mavlink_msg_position_target_local_ned_pack_status(system_id, component_id, _status, msg, position_target_local_ned->time_boot_ms, position_target_local_ned->coordinate_frame, position_target_local_ned->type_mask, position_target_local_ned->x, position_target_local_ned->y, position_target_local_ned->z, position_target_local_ned->vx, position_target_local_ned->vy, position_target_local_ned->vz, position_target_local_ned->afx, position_target_local_ned->afy, position_target_local_ned->afz, position_target_local_ned->yaw, position_target_local_ned->yaw_rate); +} + /** * @brief Send a position_target_local_ned message * @param chan MAVLink channel to send the message @@ -314,7 +400,7 @@ static inline void mavlink_msg_position_target_local_ned_send_struct(mavlink_cha #if MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_power_status.h b/common/mavlink_msg_power_status.h index 67567680c..e9436c7e5 100644 --- a/common/mavlink_msg_power_status.h +++ b/common/mavlink_msg_power_status.h @@ -75,6 +75,45 @@ static inline uint16_t mavlink_msg_power_status_pack(uint8_t system_id, uint8_t return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_POWER_STATUS_MIN_LEN, MAVLINK_MSG_ID_POWER_STATUS_LEN, MAVLINK_MSG_ID_POWER_STATUS_CRC); } +/** + * @brief Pack a power_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param Vcc [mV] 5V rail voltage. + * @param Vservo [mV] Servo rail voltage. + * @param flags Bitmap of power supply status flags. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_power_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint16_t Vcc, uint16_t Vservo, uint16_t flags) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_POWER_STATUS_LEN]; + _mav_put_uint16_t(buf, 0, Vcc); + _mav_put_uint16_t(buf, 2, Vservo); + _mav_put_uint16_t(buf, 4, flags); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_POWER_STATUS_LEN); +#else + mavlink_power_status_t packet; + packet.Vcc = Vcc; + packet.Vservo = Vservo; + packet.flags = flags; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_POWER_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_POWER_STATUS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_POWER_STATUS_MIN_LEN, MAVLINK_MSG_ID_POWER_STATUS_LEN, MAVLINK_MSG_ID_POWER_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_POWER_STATUS_MIN_LEN, MAVLINK_MSG_ID_POWER_STATUS_LEN); +#endif +} + /** * @brief Pack a power_status message on a channel * @param system_id ID of this system @@ -137,6 +176,20 @@ static inline uint16_t mavlink_msg_power_status_encode_chan(uint8_t system_id, u return mavlink_msg_power_status_pack_chan(system_id, component_id, chan, msg, power_status->Vcc, power_status->Vservo, power_status->flags); } +/** + * @brief Encode a power_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param power_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_power_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_power_status_t* power_status) +{ + return mavlink_msg_power_status_pack_status(system_id, component_id, _status, msg, power_status->Vcc, power_status->Vservo, power_status->flags); +} + /** * @brief Send a power_status message * @param chan MAVLink channel to send the message @@ -182,7 +235,7 @@ static inline void mavlink_msg_power_status_send_struct(mavlink_channel_t chan, #if MAVLINK_MSG_ID_POWER_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_radio_status.h b/common/mavlink_msg_radio_status.h index 8983a20a4..4c5f2ab4d 100644 --- a/common/mavlink_msg_radio_status.h +++ b/common/mavlink_msg_radio_status.h @@ -7,11 +7,11 @@ typedef struct __mavlink_radio_status_t { uint16_t rxerrors; /*< Count of radio packet receive errors (since boot).*/ uint16_t fixed; /*< Count of error corrected radio packets (since boot).*/ - uint8_t rssi; /*< Local (message sender) recieved signal strength indication in device-dependent units/scale. Values: [0-254], 255: invalid/unknown.*/ - uint8_t remrssi; /*< Remote (message receiver) signal strength indication in device-dependent units/scale. Values: [0-254], 255: invalid/unknown.*/ + uint8_t rssi; /*< Local (message sender) received signal strength indication in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown.*/ + uint8_t remrssi; /*< Remote (message receiver) signal strength indication in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown.*/ uint8_t txbuf; /*< [%] Remaining free transmitter buffer space.*/ - uint8_t noise; /*< Local background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], 255: invalid/unknown.*/ - uint8_t remnoise; /*< Remote background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], 255: invalid/unknown.*/ + uint8_t noise; /*< Local background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], UINT8_MAX: invalid/unknown.*/ + uint8_t remnoise; /*< Remote background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], UINT8_MAX: invalid/unknown.*/ } mavlink_radio_status_t; #define MAVLINK_MSG_ID_RADIO_STATUS_LEN 9 @@ -59,11 +59,11 @@ typedef struct __mavlink_radio_status_t { * @param component_id ID of this component (e.g. 200 for IMU) * @param msg The MAVLink message to compress the data into * - * @param rssi Local (message sender) recieved signal strength indication in device-dependent units/scale. Values: [0-254], 255: invalid/unknown. - * @param remrssi Remote (message receiver) signal strength indication in device-dependent units/scale. Values: [0-254], 255: invalid/unknown. + * @param rssi Local (message sender) received signal strength indication in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown. + * @param remrssi Remote (message receiver) signal strength indication in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown. * @param txbuf [%] Remaining free transmitter buffer space. - * @param noise Local background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], 255: invalid/unknown. - * @param remnoise Remote background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], 255: invalid/unknown. + * @param noise Local background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], UINT8_MAX: invalid/unknown. + * @param remnoise Remote background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], UINT8_MAX: invalid/unknown. * @param rxerrors Count of radio packet receive errors (since boot). * @param fixed Count of error corrected radio packets (since boot). * @return length of the message in bytes (excluding serial stream start sign) @@ -99,17 +99,68 @@ static inline uint16_t mavlink_msg_radio_status_pack(uint8_t system_id, uint8_t return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RADIO_STATUS_MIN_LEN, MAVLINK_MSG_ID_RADIO_STATUS_LEN, MAVLINK_MSG_ID_RADIO_STATUS_CRC); } +/** + * @brief Pack a radio_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param rssi Local (message sender) received signal strength indication in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown. + * @param remrssi Remote (message receiver) signal strength indication in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown. + * @param txbuf [%] Remaining free transmitter buffer space. + * @param noise Local background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], UINT8_MAX: invalid/unknown. + * @param remnoise Remote background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], UINT8_MAX: invalid/unknown. + * @param rxerrors Count of radio packet receive errors (since boot). + * @param fixed Count of error corrected radio packets (since boot). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_radio_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t rssi, uint8_t remrssi, uint8_t txbuf, uint8_t noise, uint8_t remnoise, uint16_t rxerrors, uint16_t fixed) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RADIO_STATUS_LEN]; + _mav_put_uint16_t(buf, 0, rxerrors); + _mav_put_uint16_t(buf, 2, fixed); + _mav_put_uint8_t(buf, 4, rssi); + _mav_put_uint8_t(buf, 5, remrssi); + _mav_put_uint8_t(buf, 6, txbuf); + _mav_put_uint8_t(buf, 7, noise); + _mav_put_uint8_t(buf, 8, remnoise); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RADIO_STATUS_LEN); +#else + mavlink_radio_status_t packet; + packet.rxerrors = rxerrors; + packet.fixed = fixed; + packet.rssi = rssi; + packet.remrssi = remrssi; + packet.txbuf = txbuf; + packet.noise = noise; + packet.remnoise = remnoise; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RADIO_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_RADIO_STATUS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RADIO_STATUS_MIN_LEN, MAVLINK_MSG_ID_RADIO_STATUS_LEN, MAVLINK_MSG_ID_RADIO_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RADIO_STATUS_MIN_LEN, MAVLINK_MSG_ID_RADIO_STATUS_LEN); +#endif +} + /** * @brief Pack a radio_status message on a channel * @param system_id ID of this system * @param component_id ID of this component (e.g. 200 for IMU) * @param chan The MAVLink channel this message will be sent over * @param msg The MAVLink message to compress the data into - * @param rssi Local (message sender) recieved signal strength indication in device-dependent units/scale. Values: [0-254], 255: invalid/unknown. - * @param remrssi Remote (message receiver) signal strength indication in device-dependent units/scale. Values: [0-254], 255: invalid/unknown. + * @param rssi Local (message sender) received signal strength indication in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown. + * @param remrssi Remote (message receiver) signal strength indication in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown. * @param txbuf [%] Remaining free transmitter buffer space. - * @param noise Local background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], 255: invalid/unknown. - * @param remnoise Remote background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], 255: invalid/unknown. + * @param noise Local background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], UINT8_MAX: invalid/unknown. + * @param remnoise Remote background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], UINT8_MAX: invalid/unknown. * @param rxerrors Count of radio packet receive errors (since boot). * @param fixed Count of error corrected radio packets (since boot). * @return length of the message in bytes (excluding serial stream start sign) @@ -173,15 +224,29 @@ static inline uint16_t mavlink_msg_radio_status_encode_chan(uint8_t system_id, u return mavlink_msg_radio_status_pack_chan(system_id, component_id, chan, msg, radio_status->rssi, radio_status->remrssi, radio_status->txbuf, radio_status->noise, radio_status->remnoise, radio_status->rxerrors, radio_status->fixed); } +/** + * @brief Encode a radio_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param radio_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_radio_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_radio_status_t* radio_status) +{ + return mavlink_msg_radio_status_pack_status(system_id, component_id, _status, msg, radio_status->rssi, radio_status->remrssi, radio_status->txbuf, radio_status->noise, radio_status->remnoise, radio_status->rxerrors, radio_status->fixed); +} + /** * @brief Send a radio_status message * @param chan MAVLink channel to send the message * - * @param rssi Local (message sender) recieved signal strength indication in device-dependent units/scale. Values: [0-254], 255: invalid/unknown. - * @param remrssi Remote (message receiver) signal strength indication in device-dependent units/scale. Values: [0-254], 255: invalid/unknown. + * @param rssi Local (message sender) received signal strength indication in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown. + * @param remrssi Remote (message receiver) signal strength indication in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown. * @param txbuf [%] Remaining free transmitter buffer space. - * @param noise Local background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], 255: invalid/unknown. - * @param remnoise Remote background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], 255: invalid/unknown. + * @param noise Local background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], UINT8_MAX: invalid/unknown. + * @param remnoise Remote background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], UINT8_MAX: invalid/unknown. * @param rxerrors Count of radio packet receive errors (since boot). * @param fixed Count of error corrected radio packets (since boot). */ @@ -230,7 +295,7 @@ static inline void mavlink_msg_radio_status_send_struct(mavlink_channel_t chan, #if MAVLINK_MSG_ID_RADIO_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -272,7 +337,7 @@ static inline void mavlink_msg_radio_status_send_buf(mavlink_message_t *msgbuf, /** * @brief Get field rssi from radio_status message * - * @return Local (message sender) recieved signal strength indication in device-dependent units/scale. Values: [0-254], 255: invalid/unknown. + * @return Local (message sender) received signal strength indication in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown. */ static inline uint8_t mavlink_msg_radio_status_get_rssi(const mavlink_message_t* msg) { @@ -282,7 +347,7 @@ static inline uint8_t mavlink_msg_radio_status_get_rssi(const mavlink_message_t* /** * @brief Get field remrssi from radio_status message * - * @return Remote (message receiver) signal strength indication in device-dependent units/scale. Values: [0-254], 255: invalid/unknown. + * @return Remote (message receiver) signal strength indication in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown. */ static inline uint8_t mavlink_msg_radio_status_get_remrssi(const mavlink_message_t* msg) { @@ -302,7 +367,7 @@ static inline uint8_t mavlink_msg_radio_status_get_txbuf(const mavlink_message_t /** * @brief Get field noise from radio_status message * - * @return Local background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], 255: invalid/unknown. + * @return Local background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], UINT8_MAX: invalid/unknown. */ static inline uint8_t mavlink_msg_radio_status_get_noise(const mavlink_message_t* msg) { @@ -312,7 +377,7 @@ static inline uint8_t mavlink_msg_radio_status_get_noise(const mavlink_message_t /** * @brief Get field remnoise from radio_status message * - * @return Remote background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], 255: invalid/unknown. + * @return Remote background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], UINT8_MAX: invalid/unknown. */ static inline uint8_t mavlink_msg_radio_status_get_remnoise(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_raw_imu.h b/common/mavlink_msg_raw_imu.h index eeb4eacb2..2819a3bc4 100644 --- a/common/mavlink_msg_raw_imu.h +++ b/common/mavlink_msg_raw_imu.h @@ -129,6 +129,72 @@ static inline uint16_t mavlink_msg_raw_imu_pack(uint8_t system_id, uint8_t compo return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RAW_IMU_MIN_LEN, MAVLINK_MSG_ID_RAW_IMU_LEN, MAVLINK_MSG_ID_RAW_IMU_CRC); } +/** + * @brief Pack a raw_imu message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param xacc X acceleration (raw) + * @param yacc Y acceleration (raw) + * @param zacc Z acceleration (raw) + * @param xgyro Angular speed around X axis (raw) + * @param ygyro Angular speed around Y axis (raw) + * @param zgyro Angular speed around Z axis (raw) + * @param xmag X Magnetic field (raw) + * @param ymag Y Magnetic field (raw) + * @param zmag Z Magnetic field (raw) + * @param id Id. Ids are numbered from 0 and map to IMUs numbered from 1 (e.g. IMU1 will have a message with id=0) + * @param temperature [cdegC] Temperature, 0: IMU does not provide temperature values. If the IMU is at 0C it must send 1 (0.01C). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_raw_imu_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, int16_t xacc, int16_t yacc, int16_t zacc, int16_t xgyro, int16_t ygyro, int16_t zgyro, int16_t xmag, int16_t ymag, int16_t zmag, uint8_t id, int16_t temperature) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RAW_IMU_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_int16_t(buf, 8, xacc); + _mav_put_int16_t(buf, 10, yacc); + _mav_put_int16_t(buf, 12, zacc); + _mav_put_int16_t(buf, 14, xgyro); + _mav_put_int16_t(buf, 16, ygyro); + _mav_put_int16_t(buf, 18, zgyro); + _mav_put_int16_t(buf, 20, xmag); + _mav_put_int16_t(buf, 22, ymag); + _mav_put_int16_t(buf, 24, zmag); + _mav_put_uint8_t(buf, 26, id); + _mav_put_int16_t(buf, 27, temperature); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RAW_IMU_LEN); +#else + mavlink_raw_imu_t packet; + packet.time_usec = time_usec; + packet.xacc = xacc; + packet.yacc = yacc; + packet.zacc = zacc; + packet.xgyro = xgyro; + packet.ygyro = ygyro; + packet.zgyro = zgyro; + packet.xmag = xmag; + packet.ymag = ymag; + packet.zmag = zmag; + packet.id = id; + packet.temperature = temperature; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RAW_IMU_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_RAW_IMU; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RAW_IMU_MIN_LEN, MAVLINK_MSG_ID_RAW_IMU_LEN, MAVLINK_MSG_ID_RAW_IMU_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RAW_IMU_MIN_LEN, MAVLINK_MSG_ID_RAW_IMU_LEN); +#endif +} + /** * @brief Pack a raw_imu message on a channel * @param system_id ID of this system @@ -218,6 +284,20 @@ static inline uint16_t mavlink_msg_raw_imu_encode_chan(uint8_t system_id, uint8_ return mavlink_msg_raw_imu_pack_chan(system_id, component_id, chan, msg, raw_imu->time_usec, raw_imu->xacc, raw_imu->yacc, raw_imu->zacc, raw_imu->xgyro, raw_imu->ygyro, raw_imu->zgyro, raw_imu->xmag, raw_imu->ymag, raw_imu->zmag, raw_imu->id, raw_imu->temperature); } +/** + * @brief Encode a raw_imu struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param raw_imu C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_raw_imu_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_raw_imu_t* raw_imu) +{ + return mavlink_msg_raw_imu_pack_status(system_id, component_id, _status, msg, raw_imu->time_usec, raw_imu->xacc, raw_imu->yacc, raw_imu->zacc, raw_imu->xgyro, raw_imu->ygyro, raw_imu->zgyro, raw_imu->xmag, raw_imu->ymag, raw_imu->zmag, raw_imu->id, raw_imu->temperature); +} + /** * @brief Send a raw_imu message * @param chan MAVLink channel to send the message @@ -290,7 +370,7 @@ static inline void mavlink_msg_raw_imu_send_struct(mavlink_channel_t chan, const #if MAVLINK_MSG_ID_RAW_IMU_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_raw_pressure.h b/common/mavlink_msg_raw_pressure.h index 9b80a848e..62273820f 100644 --- a/common/mavlink_msg_raw_pressure.h +++ b/common/mavlink_msg_raw_pressure.h @@ -87,6 +87,51 @@ static inline uint16_t mavlink_msg_raw_pressure_pack(uint8_t system_id, uint8_t return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RAW_PRESSURE_MIN_LEN, MAVLINK_MSG_ID_RAW_PRESSURE_LEN, MAVLINK_MSG_ID_RAW_PRESSURE_CRC); } +/** + * @brief Pack a raw_pressure message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param press_abs Absolute pressure (raw) + * @param press_diff1 Differential pressure 1 (raw, 0 if nonexistent) + * @param press_diff2 Differential pressure 2 (raw, 0 if nonexistent) + * @param temperature Raw Temperature measurement (raw) + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_raw_pressure_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, int16_t press_abs, int16_t press_diff1, int16_t press_diff2, int16_t temperature) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RAW_PRESSURE_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_int16_t(buf, 8, press_abs); + _mav_put_int16_t(buf, 10, press_diff1); + _mav_put_int16_t(buf, 12, press_diff2); + _mav_put_int16_t(buf, 14, temperature); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RAW_PRESSURE_LEN); +#else + mavlink_raw_pressure_t packet; + packet.time_usec = time_usec; + packet.press_abs = press_abs; + packet.press_diff1 = press_diff1; + packet.press_diff2 = press_diff2; + packet.temperature = temperature; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RAW_PRESSURE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_RAW_PRESSURE; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RAW_PRESSURE_MIN_LEN, MAVLINK_MSG_ID_RAW_PRESSURE_LEN, MAVLINK_MSG_ID_RAW_PRESSURE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RAW_PRESSURE_MIN_LEN, MAVLINK_MSG_ID_RAW_PRESSURE_LEN); +#endif +} + /** * @brief Pack a raw_pressure message on a channel * @param system_id ID of this system @@ -155,6 +200,20 @@ static inline uint16_t mavlink_msg_raw_pressure_encode_chan(uint8_t system_id, u return mavlink_msg_raw_pressure_pack_chan(system_id, component_id, chan, msg, raw_pressure->time_usec, raw_pressure->press_abs, raw_pressure->press_diff1, raw_pressure->press_diff2, raw_pressure->temperature); } +/** + * @brief Encode a raw_pressure struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param raw_pressure C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_raw_pressure_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_raw_pressure_t* raw_pressure) +{ + return mavlink_msg_raw_pressure_pack_status(system_id, component_id, _status, msg, raw_pressure->time_usec, raw_pressure->press_abs, raw_pressure->press_diff1, raw_pressure->press_diff2, raw_pressure->temperature); +} + /** * @brief Send a raw_pressure message * @param chan MAVLink channel to send the message @@ -206,7 +265,7 @@ static inline void mavlink_msg_raw_pressure_send_struct(mavlink_channel_t chan, #if MAVLINK_MSG_ID_RAW_PRESSURE_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_raw_rpm.h b/common/mavlink_msg_raw_rpm.h index 0fa4f1a0b..946f15242 100644 --- a/common/mavlink_msg_raw_rpm.h +++ b/common/mavlink_msg_raw_rpm.h @@ -69,6 +69,42 @@ static inline uint16_t mavlink_msg_raw_rpm_pack(uint8_t system_id, uint8_t compo return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RAW_RPM_MIN_LEN, MAVLINK_MSG_ID_RAW_RPM_LEN, MAVLINK_MSG_ID_RAW_RPM_CRC); } +/** + * @brief Pack a raw_rpm message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param index Index of this RPM sensor (0-indexed) + * @param frequency [rpm] Indicated rate + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_raw_rpm_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t index, float frequency) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RAW_RPM_LEN]; + _mav_put_float(buf, 0, frequency); + _mav_put_uint8_t(buf, 4, index); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RAW_RPM_LEN); +#else + mavlink_raw_rpm_t packet; + packet.frequency = frequency; + packet.index = index; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RAW_RPM_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_RAW_RPM; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RAW_RPM_MIN_LEN, MAVLINK_MSG_ID_RAW_RPM_LEN, MAVLINK_MSG_ID_RAW_RPM_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RAW_RPM_MIN_LEN, MAVLINK_MSG_ID_RAW_RPM_LEN); +#endif +} + /** * @brief Pack a raw_rpm message on a channel * @param system_id ID of this system @@ -128,6 +164,20 @@ static inline uint16_t mavlink_msg_raw_rpm_encode_chan(uint8_t system_id, uint8_ return mavlink_msg_raw_rpm_pack_chan(system_id, component_id, chan, msg, raw_rpm->index, raw_rpm->frequency); } +/** + * @brief Encode a raw_rpm struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param raw_rpm C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_raw_rpm_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_raw_rpm_t* raw_rpm) +{ + return mavlink_msg_raw_rpm_pack_status(system_id, component_id, _status, msg, raw_rpm->index, raw_rpm->frequency); +} + /** * @brief Send a raw_rpm message * @param chan MAVLink channel to send the message @@ -170,7 +220,7 @@ static inline void mavlink_msg_raw_rpm_send_struct(mavlink_channel_t chan, const #if MAVLINK_MSG_ID_RAW_RPM_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_rc_channels.h b/common/mavlink_msg_rc_channels.h index f4694f1b8..55207fa1f 100644 --- a/common/mavlink_msg_rc_channels.h +++ b/common/mavlink_msg_rc_channels.h @@ -25,7 +25,7 @@ typedef struct __mavlink_rc_channels_t { uint16_t chan17_raw; /*< [us] RC channel 17 value.*/ uint16_t chan18_raw; /*< [us] RC channel 18 value.*/ uint8_t chancount; /*< Total number of RC channels being received. This can be larger than 18, indicating that more channels are available but not given in this message. This value should be 0 when no RC channels are available.*/ - uint8_t rssi; /*< Receive signal strength indicator in device-dependent units/scale. Values: [0-254], 255: invalid/unknown.*/ + uint8_t rssi; /*< Receive signal strength indicator in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown.*/ } mavlink_rc_channels_t; #define MAVLINK_MSG_ID_RC_CHANNELS_LEN 42 @@ -121,7 +121,7 @@ typedef struct __mavlink_rc_channels_t { * @param chan16_raw [us] RC channel 16 value. * @param chan17_raw [us] RC channel 17 value. * @param chan18_raw [us] RC channel 18 value. - * @param rssi Receive signal strength indicator in device-dependent units/scale. Values: [0-254], 255: invalid/unknown. + * @param rssi Receive signal strength indicator in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_rc_channels_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, @@ -183,6 +183,99 @@ static inline uint16_t mavlink_msg_rc_channels_pack(uint8_t system_id, uint8_t c return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RC_CHANNELS_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_LEN, MAVLINK_MSG_ID_RC_CHANNELS_CRC); } +/** + * @brief Pack a rc_channels message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param chancount Total number of RC channels being received. This can be larger than 18, indicating that more channels are available but not given in this message. This value should be 0 when no RC channels are available. + * @param chan1_raw [us] RC channel 1 value. + * @param chan2_raw [us] RC channel 2 value. + * @param chan3_raw [us] RC channel 3 value. + * @param chan4_raw [us] RC channel 4 value. + * @param chan5_raw [us] RC channel 5 value. + * @param chan6_raw [us] RC channel 6 value. + * @param chan7_raw [us] RC channel 7 value. + * @param chan8_raw [us] RC channel 8 value. + * @param chan9_raw [us] RC channel 9 value. + * @param chan10_raw [us] RC channel 10 value. + * @param chan11_raw [us] RC channel 11 value. + * @param chan12_raw [us] RC channel 12 value. + * @param chan13_raw [us] RC channel 13 value. + * @param chan14_raw [us] RC channel 14 value. + * @param chan15_raw [us] RC channel 15 value. + * @param chan16_raw [us] RC channel 16 value. + * @param chan17_raw [us] RC channel 17 value. + * @param chan18_raw [us] RC channel 18 value. + * @param rssi Receive signal strength indicator in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_rc_channels_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, uint8_t chancount, uint16_t chan1_raw, uint16_t chan2_raw, uint16_t chan3_raw, uint16_t chan4_raw, uint16_t chan5_raw, uint16_t chan6_raw, uint16_t chan7_raw, uint16_t chan8_raw, uint16_t chan9_raw, uint16_t chan10_raw, uint16_t chan11_raw, uint16_t chan12_raw, uint16_t chan13_raw, uint16_t chan14_raw, uint16_t chan15_raw, uint16_t chan16_raw, uint16_t chan17_raw, uint16_t chan18_raw, uint8_t rssi) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RC_CHANNELS_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_uint16_t(buf, 4, chan1_raw); + _mav_put_uint16_t(buf, 6, chan2_raw); + _mav_put_uint16_t(buf, 8, chan3_raw); + _mav_put_uint16_t(buf, 10, chan4_raw); + _mav_put_uint16_t(buf, 12, chan5_raw); + _mav_put_uint16_t(buf, 14, chan6_raw); + _mav_put_uint16_t(buf, 16, chan7_raw); + _mav_put_uint16_t(buf, 18, chan8_raw); + _mav_put_uint16_t(buf, 20, chan9_raw); + _mav_put_uint16_t(buf, 22, chan10_raw); + _mav_put_uint16_t(buf, 24, chan11_raw); + _mav_put_uint16_t(buf, 26, chan12_raw); + _mav_put_uint16_t(buf, 28, chan13_raw); + _mav_put_uint16_t(buf, 30, chan14_raw); + _mav_put_uint16_t(buf, 32, chan15_raw); + _mav_put_uint16_t(buf, 34, chan16_raw); + _mav_put_uint16_t(buf, 36, chan17_raw); + _mav_put_uint16_t(buf, 38, chan18_raw); + _mav_put_uint8_t(buf, 40, chancount); + _mav_put_uint8_t(buf, 41, rssi); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RC_CHANNELS_LEN); +#else + mavlink_rc_channels_t packet; + packet.time_boot_ms = time_boot_ms; + packet.chan1_raw = chan1_raw; + packet.chan2_raw = chan2_raw; + packet.chan3_raw = chan3_raw; + packet.chan4_raw = chan4_raw; + packet.chan5_raw = chan5_raw; + packet.chan6_raw = chan6_raw; + packet.chan7_raw = chan7_raw; + packet.chan8_raw = chan8_raw; + packet.chan9_raw = chan9_raw; + packet.chan10_raw = chan10_raw; + packet.chan11_raw = chan11_raw; + packet.chan12_raw = chan12_raw; + packet.chan13_raw = chan13_raw; + packet.chan14_raw = chan14_raw; + packet.chan15_raw = chan15_raw; + packet.chan16_raw = chan16_raw; + packet.chan17_raw = chan17_raw; + packet.chan18_raw = chan18_raw; + packet.chancount = chancount; + packet.rssi = rssi; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RC_CHANNELS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_RC_CHANNELS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RC_CHANNELS_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_LEN, MAVLINK_MSG_ID_RC_CHANNELS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RC_CHANNELS_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_LEN); +#endif +} + /** * @brief Pack a rc_channels message on a channel * @param system_id ID of this system @@ -209,7 +302,7 @@ static inline uint16_t mavlink_msg_rc_channels_pack(uint8_t system_id, uint8_t c * @param chan16_raw [us] RC channel 16 value. * @param chan17_raw [us] RC channel 17 value. * @param chan18_raw [us] RC channel 18 value. - * @param rssi Receive signal strength indicator in device-dependent units/scale. Values: [0-254], 255: invalid/unknown. + * @param rssi Receive signal strength indicator in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_rc_channels_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, @@ -299,6 +392,20 @@ static inline uint16_t mavlink_msg_rc_channels_encode_chan(uint8_t system_id, ui return mavlink_msg_rc_channels_pack_chan(system_id, component_id, chan, msg, rc_channels->time_boot_ms, rc_channels->chancount, rc_channels->chan1_raw, rc_channels->chan2_raw, rc_channels->chan3_raw, rc_channels->chan4_raw, rc_channels->chan5_raw, rc_channels->chan6_raw, rc_channels->chan7_raw, rc_channels->chan8_raw, rc_channels->chan9_raw, rc_channels->chan10_raw, rc_channels->chan11_raw, rc_channels->chan12_raw, rc_channels->chan13_raw, rc_channels->chan14_raw, rc_channels->chan15_raw, rc_channels->chan16_raw, rc_channels->chan17_raw, rc_channels->chan18_raw, rc_channels->rssi); } +/** + * @brief Encode a rc_channels struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param rc_channels C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_rc_channels_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_rc_channels_t* rc_channels) +{ + return mavlink_msg_rc_channels_pack_status(system_id, component_id, _status, msg, rc_channels->time_boot_ms, rc_channels->chancount, rc_channels->chan1_raw, rc_channels->chan2_raw, rc_channels->chan3_raw, rc_channels->chan4_raw, rc_channels->chan5_raw, rc_channels->chan6_raw, rc_channels->chan7_raw, rc_channels->chan8_raw, rc_channels->chan9_raw, rc_channels->chan10_raw, rc_channels->chan11_raw, rc_channels->chan12_raw, rc_channels->chan13_raw, rc_channels->chan14_raw, rc_channels->chan15_raw, rc_channels->chan16_raw, rc_channels->chan17_raw, rc_channels->chan18_raw, rc_channels->rssi); +} + /** * @brief Send a rc_channels message * @param chan MAVLink channel to send the message @@ -323,7 +430,7 @@ static inline uint16_t mavlink_msg_rc_channels_encode_chan(uint8_t system_id, ui * @param chan16_raw [us] RC channel 16 value. * @param chan17_raw [us] RC channel 17 value. * @param chan18_raw [us] RC channel 18 value. - * @param rssi Receive signal strength indicator in device-dependent units/scale. Values: [0-254], 255: invalid/unknown. + * @param rssi Receive signal strength indicator in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown. */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS @@ -398,7 +505,7 @@ static inline void mavlink_msg_rc_channels_send_struct(mavlink_channel_t chan, c #if MAVLINK_MSG_ID_RC_CHANNELS_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -668,7 +775,7 @@ static inline uint16_t mavlink_msg_rc_channels_get_chan18_raw(const mavlink_mess /** * @brief Get field rssi from rc_channels message * - * @return Receive signal strength indicator in device-dependent units/scale. Values: [0-254], 255: invalid/unknown. + * @return Receive signal strength indicator in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown. */ static inline uint8_t mavlink_msg_rc_channels_get_rssi(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_rc_channels_override.h b/common/mavlink_msg_rc_channels_override.h index a0d2a767e..3e2286947 100644 --- a/common/mavlink_msg_rc_channels_override.h +++ b/common/mavlink_msg_rc_channels_override.h @@ -177,6 +177,96 @@ static inline uint16_t mavlink_msg_rc_channels_override_pack(uint8_t system_id, return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE_LEN, MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE_CRC); } +/** + * @brief Pack a rc_channels_override message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param chan1_raw [us] RC channel 1 value. A value of UINT16_MAX means to ignore this field. A value of 0 means to release this channel back to the RC radio. + * @param chan2_raw [us] RC channel 2 value. A value of UINT16_MAX means to ignore this field. A value of 0 means to release this channel back to the RC radio. + * @param chan3_raw [us] RC channel 3 value. A value of UINT16_MAX means to ignore this field. A value of 0 means to release this channel back to the RC radio. + * @param chan4_raw [us] RC channel 4 value. A value of UINT16_MAX means to ignore this field. A value of 0 means to release this channel back to the RC radio. + * @param chan5_raw [us] RC channel 5 value. A value of UINT16_MAX means to ignore this field. A value of 0 means to release this channel back to the RC radio. + * @param chan6_raw [us] RC channel 6 value. A value of UINT16_MAX means to ignore this field. A value of 0 means to release this channel back to the RC radio. + * @param chan7_raw [us] RC channel 7 value. A value of UINT16_MAX means to ignore this field. A value of 0 means to release this channel back to the RC radio. + * @param chan8_raw [us] RC channel 8 value. A value of UINT16_MAX means to ignore this field. A value of 0 means to release this channel back to the RC radio. + * @param chan9_raw [us] RC channel 9 value. A value of 0 or UINT16_MAX means to ignore this field. A value of UINT16_MAX-1 means to release this channel back to the RC radio. + * @param chan10_raw [us] RC channel 10 value. A value of 0 or UINT16_MAX means to ignore this field. A value of UINT16_MAX-1 means to release this channel back to the RC radio. + * @param chan11_raw [us] RC channel 11 value. A value of 0 or UINT16_MAX means to ignore this field. A value of UINT16_MAX-1 means to release this channel back to the RC radio. + * @param chan12_raw [us] RC channel 12 value. A value of 0 or UINT16_MAX means to ignore this field. A value of UINT16_MAX-1 means to release this channel back to the RC radio. + * @param chan13_raw [us] RC channel 13 value. A value of 0 or UINT16_MAX means to ignore this field. A value of UINT16_MAX-1 means to release this channel back to the RC radio. + * @param chan14_raw [us] RC channel 14 value. A value of 0 or UINT16_MAX means to ignore this field. A value of UINT16_MAX-1 means to release this channel back to the RC radio. + * @param chan15_raw [us] RC channel 15 value. A value of 0 or UINT16_MAX means to ignore this field. A value of UINT16_MAX-1 means to release this channel back to the RC radio. + * @param chan16_raw [us] RC channel 16 value. A value of 0 or UINT16_MAX means to ignore this field. A value of UINT16_MAX-1 means to release this channel back to the RC radio. + * @param chan17_raw [us] RC channel 17 value. A value of 0 or UINT16_MAX means to ignore this field. A value of UINT16_MAX-1 means to release this channel back to the RC radio. + * @param chan18_raw [us] RC channel 18 value. A value of 0 or UINT16_MAX means to ignore this field. A value of UINT16_MAX-1 means to release this channel back to the RC radio. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_rc_channels_override_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint16_t chan1_raw, uint16_t chan2_raw, uint16_t chan3_raw, uint16_t chan4_raw, uint16_t chan5_raw, uint16_t chan6_raw, uint16_t chan7_raw, uint16_t chan8_raw, uint16_t chan9_raw, uint16_t chan10_raw, uint16_t chan11_raw, uint16_t chan12_raw, uint16_t chan13_raw, uint16_t chan14_raw, uint16_t chan15_raw, uint16_t chan16_raw, uint16_t chan17_raw, uint16_t chan18_raw) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE_LEN]; + _mav_put_uint16_t(buf, 0, chan1_raw); + _mav_put_uint16_t(buf, 2, chan2_raw); + _mav_put_uint16_t(buf, 4, chan3_raw); + _mav_put_uint16_t(buf, 6, chan4_raw); + _mav_put_uint16_t(buf, 8, chan5_raw); + _mav_put_uint16_t(buf, 10, chan6_raw); + _mav_put_uint16_t(buf, 12, chan7_raw); + _mav_put_uint16_t(buf, 14, chan8_raw); + _mav_put_uint8_t(buf, 16, target_system); + _mav_put_uint8_t(buf, 17, target_component); + _mav_put_uint16_t(buf, 18, chan9_raw); + _mav_put_uint16_t(buf, 20, chan10_raw); + _mav_put_uint16_t(buf, 22, chan11_raw); + _mav_put_uint16_t(buf, 24, chan12_raw); + _mav_put_uint16_t(buf, 26, chan13_raw); + _mav_put_uint16_t(buf, 28, chan14_raw); + _mav_put_uint16_t(buf, 30, chan15_raw); + _mav_put_uint16_t(buf, 32, chan16_raw); + _mav_put_uint16_t(buf, 34, chan17_raw); + _mav_put_uint16_t(buf, 36, chan18_raw); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE_LEN); +#else + mavlink_rc_channels_override_t packet; + packet.chan1_raw = chan1_raw; + packet.chan2_raw = chan2_raw; + packet.chan3_raw = chan3_raw; + packet.chan4_raw = chan4_raw; + packet.chan5_raw = chan5_raw; + packet.chan6_raw = chan6_raw; + packet.chan7_raw = chan7_raw; + packet.chan8_raw = chan8_raw; + packet.target_system = target_system; + packet.target_component = target_component; + packet.chan9_raw = chan9_raw; + packet.chan10_raw = chan10_raw; + packet.chan11_raw = chan11_raw; + packet.chan12_raw = chan12_raw; + packet.chan13_raw = chan13_raw; + packet.chan14_raw = chan14_raw; + packet.chan15_raw = chan15_raw; + packet.chan16_raw = chan16_raw; + packet.chan17_raw = chan17_raw; + packet.chan18_raw = chan18_raw; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE_LEN, MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE_LEN); +#endif +} + /** * @brief Pack a rc_channels_override message on a channel * @param system_id ID of this system @@ -290,6 +380,20 @@ static inline uint16_t mavlink_msg_rc_channels_override_encode_chan(uint8_t syst return mavlink_msg_rc_channels_override_pack_chan(system_id, component_id, chan, msg, rc_channels_override->target_system, rc_channels_override->target_component, rc_channels_override->chan1_raw, rc_channels_override->chan2_raw, rc_channels_override->chan3_raw, rc_channels_override->chan4_raw, rc_channels_override->chan5_raw, rc_channels_override->chan6_raw, rc_channels_override->chan7_raw, rc_channels_override->chan8_raw, rc_channels_override->chan9_raw, rc_channels_override->chan10_raw, rc_channels_override->chan11_raw, rc_channels_override->chan12_raw, rc_channels_override->chan13_raw, rc_channels_override->chan14_raw, rc_channels_override->chan15_raw, rc_channels_override->chan16_raw, rc_channels_override->chan17_raw, rc_channels_override->chan18_raw); } +/** + * @brief Encode a rc_channels_override struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param rc_channels_override C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_rc_channels_override_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_rc_channels_override_t* rc_channels_override) +{ + return mavlink_msg_rc_channels_override_pack_status(system_id, component_id, _status, msg, rc_channels_override->target_system, rc_channels_override->target_component, rc_channels_override->chan1_raw, rc_channels_override->chan2_raw, rc_channels_override->chan3_raw, rc_channels_override->chan4_raw, rc_channels_override->chan5_raw, rc_channels_override->chan6_raw, rc_channels_override->chan7_raw, rc_channels_override->chan8_raw, rc_channels_override->chan9_raw, rc_channels_override->chan10_raw, rc_channels_override->chan11_raw, rc_channels_override->chan12_raw, rc_channels_override->chan13_raw, rc_channels_override->chan14_raw, rc_channels_override->chan15_raw, rc_channels_override->chan16_raw, rc_channels_override->chan17_raw, rc_channels_override->chan18_raw); +} + /** * @brief Send a rc_channels_override message * @param chan MAVLink channel to send the message @@ -386,7 +490,7 @@ static inline void mavlink_msg_rc_channels_override_send_struct(mavlink_channel_ #if MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_rc_channels_raw.h b/common/mavlink_msg_rc_channels_raw.h index cbd7fd842..80a7b9ee8 100644 --- a/common/mavlink_msg_rc_channels_raw.h +++ b/common/mavlink_msg_rc_channels_raw.h @@ -15,7 +15,7 @@ typedef struct __mavlink_rc_channels_raw_t { uint16_t chan7_raw; /*< [us] RC channel 7 value.*/ uint16_t chan8_raw; /*< [us] RC channel 8 value.*/ uint8_t port; /*< Servo output port (set of 8 outputs = 1 port). Flight stacks running on Pixhawk should use: 0 = MAIN, 1 = AUX.*/ - uint8_t rssi; /*< Receive signal strength indicator in device-dependent units/scale. Values: [0-254], 255: invalid/unknown.*/ + uint8_t rssi; /*< Receive signal strength indicator in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown.*/ } mavlink_rc_channels_raw_t; #define MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN 22 @@ -81,7 +81,7 @@ typedef struct __mavlink_rc_channels_raw_t { * @param chan6_raw [us] RC channel 6 value. * @param chan7_raw [us] RC channel 7 value. * @param chan8_raw [us] RC channel 8 value. - * @param rssi Receive signal strength indicator in device-dependent units/scale. Values: [0-254], 255: invalid/unknown. + * @param rssi Receive signal strength indicator in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_rc_channels_raw_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, @@ -123,6 +123,69 @@ static inline uint16_t mavlink_msg_rc_channels_raw_pack(uint8_t system_id, uint8 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RC_CHANNELS_RAW_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_CRC); } +/** + * @brief Pack a rc_channels_raw message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param port Servo output port (set of 8 outputs = 1 port). Flight stacks running on Pixhawk should use: 0 = MAIN, 1 = AUX. + * @param chan1_raw [us] RC channel 1 value. + * @param chan2_raw [us] RC channel 2 value. + * @param chan3_raw [us] RC channel 3 value. + * @param chan4_raw [us] RC channel 4 value. + * @param chan5_raw [us] RC channel 5 value. + * @param chan6_raw [us] RC channel 6 value. + * @param chan7_raw [us] RC channel 7 value. + * @param chan8_raw [us] RC channel 8 value. + * @param rssi Receive signal strength indicator in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_rc_channels_raw_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, uint8_t port, uint16_t chan1_raw, uint16_t chan2_raw, uint16_t chan3_raw, uint16_t chan4_raw, uint16_t chan5_raw, uint16_t chan6_raw, uint16_t chan7_raw, uint16_t chan8_raw, uint8_t rssi) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_uint16_t(buf, 4, chan1_raw); + _mav_put_uint16_t(buf, 6, chan2_raw); + _mav_put_uint16_t(buf, 8, chan3_raw); + _mav_put_uint16_t(buf, 10, chan4_raw); + _mav_put_uint16_t(buf, 12, chan5_raw); + _mav_put_uint16_t(buf, 14, chan6_raw); + _mav_put_uint16_t(buf, 16, chan7_raw); + _mav_put_uint16_t(buf, 18, chan8_raw); + _mav_put_uint8_t(buf, 20, port); + _mav_put_uint8_t(buf, 21, rssi); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN); +#else + mavlink_rc_channels_raw_t packet; + packet.time_boot_ms = time_boot_ms; + packet.chan1_raw = chan1_raw; + packet.chan2_raw = chan2_raw; + packet.chan3_raw = chan3_raw; + packet.chan4_raw = chan4_raw; + packet.chan5_raw = chan5_raw; + packet.chan6_raw = chan6_raw; + packet.chan7_raw = chan7_raw; + packet.chan8_raw = chan8_raw; + packet.port = port; + packet.rssi = rssi; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_RC_CHANNELS_RAW; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RC_CHANNELS_RAW_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RC_CHANNELS_RAW_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN); +#endif +} + /** * @brief Pack a rc_channels_raw message on a channel * @param system_id ID of this system @@ -139,7 +202,7 @@ static inline uint16_t mavlink_msg_rc_channels_raw_pack(uint8_t system_id, uint8 * @param chan6_raw [us] RC channel 6 value. * @param chan7_raw [us] RC channel 7 value. * @param chan8_raw [us] RC channel 8 value. - * @param rssi Receive signal strength indicator in device-dependent units/scale. Values: [0-254], 255: invalid/unknown. + * @param rssi Receive signal strength indicator in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_rc_channels_raw_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, @@ -209,6 +272,20 @@ static inline uint16_t mavlink_msg_rc_channels_raw_encode_chan(uint8_t system_id return mavlink_msg_rc_channels_raw_pack_chan(system_id, component_id, chan, msg, rc_channels_raw->time_boot_ms, rc_channels_raw->port, rc_channels_raw->chan1_raw, rc_channels_raw->chan2_raw, rc_channels_raw->chan3_raw, rc_channels_raw->chan4_raw, rc_channels_raw->chan5_raw, rc_channels_raw->chan6_raw, rc_channels_raw->chan7_raw, rc_channels_raw->chan8_raw, rc_channels_raw->rssi); } +/** + * @brief Encode a rc_channels_raw struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param rc_channels_raw C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_rc_channels_raw_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_rc_channels_raw_t* rc_channels_raw) +{ + return mavlink_msg_rc_channels_raw_pack_status(system_id, component_id, _status, msg, rc_channels_raw->time_boot_ms, rc_channels_raw->port, rc_channels_raw->chan1_raw, rc_channels_raw->chan2_raw, rc_channels_raw->chan3_raw, rc_channels_raw->chan4_raw, rc_channels_raw->chan5_raw, rc_channels_raw->chan6_raw, rc_channels_raw->chan7_raw, rc_channels_raw->chan8_raw, rc_channels_raw->rssi); +} + /** * @brief Send a rc_channels_raw message * @param chan MAVLink channel to send the message @@ -223,7 +300,7 @@ static inline uint16_t mavlink_msg_rc_channels_raw_encode_chan(uint8_t system_id * @param chan6_raw [us] RC channel 6 value. * @param chan7_raw [us] RC channel 7 value. * @param chan8_raw [us] RC channel 8 value. - * @param rssi Receive signal strength indicator in device-dependent units/scale. Values: [0-254], 255: invalid/unknown. + * @param rssi Receive signal strength indicator in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown. */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS @@ -278,7 +355,7 @@ static inline void mavlink_msg_rc_channels_raw_send_struct(mavlink_channel_t cha #if MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -428,7 +505,7 @@ static inline uint16_t mavlink_msg_rc_channels_raw_get_chan8_raw(const mavlink_m /** * @brief Get field rssi from rc_channels_raw message * - * @return Receive signal strength indicator in device-dependent units/scale. Values: [0-254], 255: invalid/unknown. + * @return Receive signal strength indicator in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown. */ static inline uint8_t mavlink_msg_rc_channels_raw_get_rssi(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_rc_channels_scaled.h b/common/mavlink_msg_rc_channels_scaled.h index 9d516d1cc..3a74b26ad 100644 --- a/common/mavlink_msg_rc_channels_scaled.h +++ b/common/mavlink_msg_rc_channels_scaled.h @@ -15,7 +15,7 @@ typedef struct __mavlink_rc_channels_scaled_t { int16_t chan7_scaled; /*< RC channel 7 value scaled.*/ int16_t chan8_scaled; /*< RC channel 8 value scaled.*/ uint8_t port; /*< Servo output port (set of 8 outputs = 1 port). Flight stacks running on Pixhawk should use: 0 = MAIN, 1 = AUX.*/ - uint8_t rssi; /*< Receive signal strength indicator in device-dependent units/scale. Values: [0-254], 255: invalid/unknown.*/ + uint8_t rssi; /*< Receive signal strength indicator in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown.*/ } mavlink_rc_channels_scaled_t; #define MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN 22 @@ -81,7 +81,7 @@ typedef struct __mavlink_rc_channels_scaled_t { * @param chan6_scaled RC channel 6 value scaled. * @param chan7_scaled RC channel 7 value scaled. * @param chan8_scaled RC channel 8 value scaled. - * @param rssi Receive signal strength indicator in device-dependent units/scale. Values: [0-254], 255: invalid/unknown. + * @param rssi Receive signal strength indicator in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_rc_channels_scaled_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, @@ -123,6 +123,69 @@ static inline uint16_t mavlink_msg_rc_channels_scaled_pack(uint8_t system_id, ui return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_CRC); } +/** + * @brief Pack a rc_channels_scaled message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param port Servo output port (set of 8 outputs = 1 port). Flight stacks running on Pixhawk should use: 0 = MAIN, 1 = AUX. + * @param chan1_scaled RC channel 1 value scaled. + * @param chan2_scaled RC channel 2 value scaled. + * @param chan3_scaled RC channel 3 value scaled. + * @param chan4_scaled RC channel 4 value scaled. + * @param chan5_scaled RC channel 5 value scaled. + * @param chan6_scaled RC channel 6 value scaled. + * @param chan7_scaled RC channel 7 value scaled. + * @param chan8_scaled RC channel 8 value scaled. + * @param rssi Receive signal strength indicator in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_rc_channels_scaled_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, uint8_t port, int16_t chan1_scaled, int16_t chan2_scaled, int16_t chan3_scaled, int16_t chan4_scaled, int16_t chan5_scaled, int16_t chan6_scaled, int16_t chan7_scaled, int16_t chan8_scaled, uint8_t rssi) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_int16_t(buf, 4, chan1_scaled); + _mav_put_int16_t(buf, 6, chan2_scaled); + _mav_put_int16_t(buf, 8, chan3_scaled); + _mav_put_int16_t(buf, 10, chan4_scaled); + _mav_put_int16_t(buf, 12, chan5_scaled); + _mav_put_int16_t(buf, 14, chan6_scaled); + _mav_put_int16_t(buf, 16, chan7_scaled); + _mav_put_int16_t(buf, 18, chan8_scaled); + _mav_put_uint8_t(buf, 20, port); + _mav_put_uint8_t(buf, 21, rssi); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN); +#else + mavlink_rc_channels_scaled_t packet; + packet.time_boot_ms = time_boot_ms; + packet.chan1_scaled = chan1_scaled; + packet.chan2_scaled = chan2_scaled; + packet.chan3_scaled = chan3_scaled; + packet.chan4_scaled = chan4_scaled; + packet.chan5_scaled = chan5_scaled; + packet.chan6_scaled = chan6_scaled; + packet.chan7_scaled = chan7_scaled; + packet.chan8_scaled = chan8_scaled; + packet.port = port; + packet.rssi = rssi; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_RC_CHANNELS_SCALED; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN); +#endif +} + /** * @brief Pack a rc_channels_scaled message on a channel * @param system_id ID of this system @@ -139,7 +202,7 @@ static inline uint16_t mavlink_msg_rc_channels_scaled_pack(uint8_t system_id, ui * @param chan6_scaled RC channel 6 value scaled. * @param chan7_scaled RC channel 7 value scaled. * @param chan8_scaled RC channel 8 value scaled. - * @param rssi Receive signal strength indicator in device-dependent units/scale. Values: [0-254], 255: invalid/unknown. + * @param rssi Receive signal strength indicator in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_rc_channels_scaled_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, @@ -209,6 +272,20 @@ static inline uint16_t mavlink_msg_rc_channels_scaled_encode_chan(uint8_t system return mavlink_msg_rc_channels_scaled_pack_chan(system_id, component_id, chan, msg, rc_channels_scaled->time_boot_ms, rc_channels_scaled->port, rc_channels_scaled->chan1_scaled, rc_channels_scaled->chan2_scaled, rc_channels_scaled->chan3_scaled, rc_channels_scaled->chan4_scaled, rc_channels_scaled->chan5_scaled, rc_channels_scaled->chan6_scaled, rc_channels_scaled->chan7_scaled, rc_channels_scaled->chan8_scaled, rc_channels_scaled->rssi); } +/** + * @brief Encode a rc_channels_scaled struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param rc_channels_scaled C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_rc_channels_scaled_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_rc_channels_scaled_t* rc_channels_scaled) +{ + return mavlink_msg_rc_channels_scaled_pack_status(system_id, component_id, _status, msg, rc_channels_scaled->time_boot_ms, rc_channels_scaled->port, rc_channels_scaled->chan1_scaled, rc_channels_scaled->chan2_scaled, rc_channels_scaled->chan3_scaled, rc_channels_scaled->chan4_scaled, rc_channels_scaled->chan5_scaled, rc_channels_scaled->chan6_scaled, rc_channels_scaled->chan7_scaled, rc_channels_scaled->chan8_scaled, rc_channels_scaled->rssi); +} + /** * @brief Send a rc_channels_scaled message * @param chan MAVLink channel to send the message @@ -223,7 +300,7 @@ static inline uint16_t mavlink_msg_rc_channels_scaled_encode_chan(uint8_t system * @param chan6_scaled RC channel 6 value scaled. * @param chan7_scaled RC channel 7 value scaled. * @param chan8_scaled RC channel 8 value scaled. - * @param rssi Receive signal strength indicator in device-dependent units/scale. Values: [0-254], 255: invalid/unknown. + * @param rssi Receive signal strength indicator in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown. */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS @@ -278,7 +355,7 @@ static inline void mavlink_msg_rc_channels_scaled_send_struct(mavlink_channel_t #if MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -428,7 +505,7 @@ static inline int16_t mavlink_msg_rc_channels_scaled_get_chan8_scaled(const mavl /** * @brief Get field rssi from rc_channels_scaled message * - * @return Receive signal strength indicator in device-dependent units/scale. Values: [0-254], 255: invalid/unknown. + * @return Receive signal strength indicator in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown. */ static inline uint8_t mavlink_msg_rc_channels_scaled_get_rssi(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_request_data_stream.h b/common/mavlink_msg_request_data_stream.h index f1d739588..f3a81d5cf 100644 --- a/common/mavlink_msg_request_data_stream.h +++ b/common/mavlink_msg_request_data_stream.h @@ -87,6 +87,51 @@ static inline uint16_t mavlink_msg_request_data_stream_pack(uint8_t system_id, u return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_MIN_LEN, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_LEN, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_CRC); } +/** + * @brief Pack a request_data_stream message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system The target requested to send the message stream. + * @param target_component The target requested to send the message stream. + * @param req_stream_id The ID of the requested data stream + * @param req_message_rate [Hz] The requested message rate + * @param start_stop 1 to start sending, 0 to stop sending. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_request_data_stream_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint8_t req_stream_id, uint16_t req_message_rate, uint8_t start_stop) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_REQUEST_DATA_STREAM_LEN]; + _mav_put_uint16_t(buf, 0, req_message_rate); + _mav_put_uint8_t(buf, 2, target_system); + _mav_put_uint8_t(buf, 3, target_component); + _mav_put_uint8_t(buf, 4, req_stream_id); + _mav_put_uint8_t(buf, 5, start_stop); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_LEN); +#else + mavlink_request_data_stream_t packet; + packet.req_message_rate = req_message_rate; + packet.target_system = target_system; + packet.target_component = target_component; + packet.req_stream_id = req_stream_id; + packet.start_stop = start_stop; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_REQUEST_DATA_STREAM; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_MIN_LEN, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_LEN, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_MIN_LEN, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_LEN); +#endif +} + /** * @brief Pack a request_data_stream message on a channel * @param system_id ID of this system @@ -155,6 +200,20 @@ static inline uint16_t mavlink_msg_request_data_stream_encode_chan(uint8_t syste return mavlink_msg_request_data_stream_pack_chan(system_id, component_id, chan, msg, request_data_stream->target_system, request_data_stream->target_component, request_data_stream->req_stream_id, request_data_stream->req_message_rate, request_data_stream->start_stop); } +/** + * @brief Encode a request_data_stream struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param request_data_stream C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_request_data_stream_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_request_data_stream_t* request_data_stream) +{ + return mavlink_msg_request_data_stream_pack_status(system_id, component_id, _status, msg, request_data_stream->target_system, request_data_stream->target_component, request_data_stream->req_stream_id, request_data_stream->req_message_rate, request_data_stream->start_stop); +} + /** * @brief Send a request_data_stream message * @param chan MAVLink channel to send the message @@ -206,7 +265,7 @@ static inline void mavlink_msg_request_data_stream_send_struct(mavlink_channel_t #if MAVLINK_MSG_ID_REQUEST_DATA_STREAM_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_request_event.h b/common/mavlink_msg_request_event.h new file mode 100644 index 000000000..6b596de9a --- /dev/null +++ b/common/mavlink_msg_request_event.h @@ -0,0 +1,344 @@ +#pragma once +// MESSAGE REQUEST_EVENT PACKING + +#define MAVLINK_MSG_ID_REQUEST_EVENT 412 + + +typedef struct __mavlink_request_event_t { + uint16_t first_sequence; /*< First sequence number of the requested event.*/ + uint16_t last_sequence; /*< Last sequence number of the requested event.*/ + uint8_t target_system; /*< System ID*/ + uint8_t target_component; /*< Component ID*/ +} mavlink_request_event_t; + +#define MAVLINK_MSG_ID_REQUEST_EVENT_LEN 6 +#define MAVLINK_MSG_ID_REQUEST_EVENT_MIN_LEN 6 +#define MAVLINK_MSG_ID_412_LEN 6 +#define MAVLINK_MSG_ID_412_MIN_LEN 6 + +#define MAVLINK_MSG_ID_REQUEST_EVENT_CRC 33 +#define MAVLINK_MSG_ID_412_CRC 33 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_REQUEST_EVENT { \ + 412, \ + "REQUEST_EVENT", \ + 4, \ + { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_request_event_t, target_system) }, \ + { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_request_event_t, target_component) }, \ + { "first_sequence", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_request_event_t, first_sequence) }, \ + { "last_sequence", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_request_event_t, last_sequence) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_REQUEST_EVENT { \ + "REQUEST_EVENT", \ + 4, \ + { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_request_event_t, target_system) }, \ + { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_request_event_t, target_component) }, \ + { "first_sequence", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_request_event_t, first_sequence) }, \ + { "last_sequence", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_request_event_t, last_sequence) }, \ + } \ +} +#endif + +/** + * @brief Pack a request_event message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param first_sequence First sequence number of the requested event. + * @param last_sequence Last sequence number of the requested event. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_request_event_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint16_t first_sequence, uint16_t last_sequence) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_REQUEST_EVENT_LEN]; + _mav_put_uint16_t(buf, 0, first_sequence); + _mav_put_uint16_t(buf, 2, last_sequence); + _mav_put_uint8_t(buf, 4, target_system); + _mav_put_uint8_t(buf, 5, target_component); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_REQUEST_EVENT_LEN); +#else + mavlink_request_event_t packet; + packet.first_sequence = first_sequence; + packet.last_sequence = last_sequence; + packet.target_system = target_system; + packet.target_component = target_component; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_REQUEST_EVENT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_REQUEST_EVENT; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_REQUEST_EVENT_MIN_LEN, MAVLINK_MSG_ID_REQUEST_EVENT_LEN, MAVLINK_MSG_ID_REQUEST_EVENT_CRC); +} + +/** + * @brief Pack a request_event message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param first_sequence First sequence number of the requested event. + * @param last_sequence Last sequence number of the requested event. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_request_event_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint16_t first_sequence, uint16_t last_sequence) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_REQUEST_EVENT_LEN]; + _mav_put_uint16_t(buf, 0, first_sequence); + _mav_put_uint16_t(buf, 2, last_sequence); + _mav_put_uint8_t(buf, 4, target_system); + _mav_put_uint8_t(buf, 5, target_component); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_REQUEST_EVENT_LEN); +#else + mavlink_request_event_t packet; + packet.first_sequence = first_sequence; + packet.last_sequence = last_sequence; + packet.target_system = target_system; + packet.target_component = target_component; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_REQUEST_EVENT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_REQUEST_EVENT; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_REQUEST_EVENT_MIN_LEN, MAVLINK_MSG_ID_REQUEST_EVENT_LEN, MAVLINK_MSG_ID_REQUEST_EVENT_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_REQUEST_EVENT_MIN_LEN, MAVLINK_MSG_ID_REQUEST_EVENT_LEN); +#endif +} + +/** + * @brief Pack a request_event message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param target_system System ID + * @param target_component Component ID + * @param first_sequence First sequence number of the requested event. + * @param last_sequence Last sequence number of the requested event. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_request_event_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t target_system,uint8_t target_component,uint16_t first_sequence,uint16_t last_sequence) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_REQUEST_EVENT_LEN]; + _mav_put_uint16_t(buf, 0, first_sequence); + _mav_put_uint16_t(buf, 2, last_sequence); + _mav_put_uint8_t(buf, 4, target_system); + _mav_put_uint8_t(buf, 5, target_component); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_REQUEST_EVENT_LEN); +#else + mavlink_request_event_t packet; + packet.first_sequence = first_sequence; + packet.last_sequence = last_sequence; + packet.target_system = target_system; + packet.target_component = target_component; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_REQUEST_EVENT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_REQUEST_EVENT; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_REQUEST_EVENT_MIN_LEN, MAVLINK_MSG_ID_REQUEST_EVENT_LEN, MAVLINK_MSG_ID_REQUEST_EVENT_CRC); +} + +/** + * @brief Encode a request_event struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param request_event C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_request_event_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_request_event_t* request_event) +{ + return mavlink_msg_request_event_pack(system_id, component_id, msg, request_event->target_system, request_event->target_component, request_event->first_sequence, request_event->last_sequence); +} + +/** + * @brief Encode a request_event struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param request_event C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_request_event_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_request_event_t* request_event) +{ + return mavlink_msg_request_event_pack_chan(system_id, component_id, chan, msg, request_event->target_system, request_event->target_component, request_event->first_sequence, request_event->last_sequence); +} + +/** + * @brief Encode a request_event struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param request_event C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_request_event_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_request_event_t* request_event) +{ + return mavlink_msg_request_event_pack_status(system_id, component_id, _status, msg, request_event->target_system, request_event->target_component, request_event->first_sequence, request_event->last_sequence); +} + +/** + * @brief Send a request_event message + * @param chan MAVLink channel to send the message + * + * @param target_system System ID + * @param target_component Component ID + * @param first_sequence First sequence number of the requested event. + * @param last_sequence Last sequence number of the requested event. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_request_event_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint16_t first_sequence, uint16_t last_sequence) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_REQUEST_EVENT_LEN]; + _mav_put_uint16_t(buf, 0, first_sequence); + _mav_put_uint16_t(buf, 2, last_sequence); + _mav_put_uint8_t(buf, 4, target_system); + _mav_put_uint8_t(buf, 5, target_component); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REQUEST_EVENT, buf, MAVLINK_MSG_ID_REQUEST_EVENT_MIN_LEN, MAVLINK_MSG_ID_REQUEST_EVENT_LEN, MAVLINK_MSG_ID_REQUEST_EVENT_CRC); +#else + mavlink_request_event_t packet; + packet.first_sequence = first_sequence; + packet.last_sequence = last_sequence; + packet.target_system = target_system; + packet.target_component = target_component; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REQUEST_EVENT, (const char *)&packet, MAVLINK_MSG_ID_REQUEST_EVENT_MIN_LEN, MAVLINK_MSG_ID_REQUEST_EVENT_LEN, MAVLINK_MSG_ID_REQUEST_EVENT_CRC); +#endif +} + +/** + * @brief Send a request_event message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_request_event_send_struct(mavlink_channel_t chan, const mavlink_request_event_t* request_event) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_request_event_send(chan, request_event->target_system, request_event->target_component, request_event->first_sequence, request_event->last_sequence); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REQUEST_EVENT, (const char *)request_event, MAVLINK_MSG_ID_REQUEST_EVENT_MIN_LEN, MAVLINK_MSG_ID_REQUEST_EVENT_LEN, MAVLINK_MSG_ID_REQUEST_EVENT_CRC); +#endif +} + +#if MAVLINK_MSG_ID_REQUEST_EVENT_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_request_event_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint16_t first_sequence, uint16_t last_sequence) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint16_t(buf, 0, first_sequence); + _mav_put_uint16_t(buf, 2, last_sequence); + _mav_put_uint8_t(buf, 4, target_system); + _mav_put_uint8_t(buf, 5, target_component); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REQUEST_EVENT, buf, MAVLINK_MSG_ID_REQUEST_EVENT_MIN_LEN, MAVLINK_MSG_ID_REQUEST_EVENT_LEN, MAVLINK_MSG_ID_REQUEST_EVENT_CRC); +#else + mavlink_request_event_t *packet = (mavlink_request_event_t *)msgbuf; + packet->first_sequence = first_sequence; + packet->last_sequence = last_sequence; + packet->target_system = target_system; + packet->target_component = target_component; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REQUEST_EVENT, (const char *)packet, MAVLINK_MSG_ID_REQUEST_EVENT_MIN_LEN, MAVLINK_MSG_ID_REQUEST_EVENT_LEN, MAVLINK_MSG_ID_REQUEST_EVENT_CRC); +#endif +} +#endif + +#endif + +// MESSAGE REQUEST_EVENT UNPACKING + + +/** + * @brief Get field target_system from request_event message + * + * @return System ID + */ +static inline uint8_t mavlink_msg_request_event_get_target_system(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 4); +} + +/** + * @brief Get field target_component from request_event message + * + * @return Component ID + */ +static inline uint8_t mavlink_msg_request_event_get_target_component(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 5); +} + +/** + * @brief Get field first_sequence from request_event message + * + * @return First sequence number of the requested event. + */ +static inline uint16_t mavlink_msg_request_event_get_first_sequence(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 0); +} + +/** + * @brief Get field last_sequence from request_event message + * + * @return Last sequence number of the requested event. + */ +static inline uint16_t mavlink_msg_request_event_get_last_sequence(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 2); +} + +/** + * @brief Decode a request_event message into a struct + * + * @param msg The message to decode + * @param request_event C-struct to decode the message contents into + */ +static inline void mavlink_msg_request_event_decode(const mavlink_message_t* msg, mavlink_request_event_t* request_event) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + request_event->first_sequence = mavlink_msg_request_event_get_first_sequence(msg); + request_event->last_sequence = mavlink_msg_request_event_get_last_sequence(msg); + request_event->target_system = mavlink_msg_request_event_get_target_system(msg); + request_event->target_component = mavlink_msg_request_event_get_target_component(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_REQUEST_EVENT_LEN? msg->len : MAVLINK_MSG_ID_REQUEST_EVENT_LEN; + memset(request_event, 0, MAVLINK_MSG_ID_REQUEST_EVENT_LEN); + memcpy(request_event, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/common/mavlink_msg_resource_request.h b/common/mavlink_msg_resource_request.h index a8ee9a639..e68aadcec 100644 --- a/common/mavlink_msg_resource_request.h +++ b/common/mavlink_msg_resource_request.h @@ -5,7 +5,7 @@ typedef struct __mavlink_resource_request_t { - uint8_t request_id; /*< Request ID. This ID should be re-used when sending back URI contents*/ + uint8_t request_id; /*< Request ID. This ID should be reused when sending back URI contents*/ uint8_t uri_type; /*< The type of requested URI. 0 = a file via URL. 1 = a UAVCAN binary*/ uint8_t uri[120]; /*< The requested unique resource identifier (URI). It is not necessarily a straight domain name (depends on the URI type enum)*/ uint8_t transfer_type; /*< The way the autopilot wants to receive the URI. 0 = MAVLink FTP. 1 = binary stream.*/ @@ -54,7 +54,7 @@ typedef struct __mavlink_resource_request_t { * @param component_id ID of this component (e.g. 200 for IMU) * @param msg The MAVLink message to compress the data into * - * @param request_id Request ID. This ID should be re-used when sending back URI contents + * @param request_id Request ID. This ID should be reused when sending back URI contents * @param uri_type The type of requested URI. 0 = a file via URL. 1 = a UAVCAN binary * @param uri The requested unique resource identifier (URI). It is not necessarily a straight domain name (depends on the URI type enum) * @param transfer_type The way the autopilot wants to receive the URI. 0 = MAVLink FTP. 1 = binary stream. @@ -64,6 +64,45 @@ typedef struct __mavlink_resource_request_t { static inline uint16_t mavlink_msg_resource_request_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t request_id, uint8_t uri_type, const uint8_t *uri, uint8_t transfer_type, const uint8_t *storage) { +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RESOURCE_REQUEST_LEN]; + _mav_put_uint8_t(buf, 0, request_id); + _mav_put_uint8_t(buf, 1, uri_type); + _mav_put_uint8_t(buf, 122, transfer_type); + _mav_put_uint8_t_array(buf, 2, uri, 120); + _mav_put_uint8_t_array(buf, 123, storage, 120); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RESOURCE_REQUEST_LEN); +#else + mavlink_resource_request_t packet; + packet.request_id = request_id; + packet.uri_type = uri_type; + packet.transfer_type = transfer_type; + mav_array_assign_uint8_t(packet.uri, uri, 120); + mav_array_assign_uint8_t(packet.storage, storage, 120); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RESOURCE_REQUEST_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_RESOURCE_REQUEST; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RESOURCE_REQUEST_MIN_LEN, MAVLINK_MSG_ID_RESOURCE_REQUEST_LEN, MAVLINK_MSG_ID_RESOURCE_REQUEST_CRC); +} + +/** + * @brief Pack a resource_request message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param request_id Request ID. This ID should be reused when sending back URI contents + * @param uri_type The type of requested URI. 0 = a file via URL. 1 = a UAVCAN binary + * @param uri The requested unique resource identifier (URI). It is not necessarily a straight domain name (depends on the URI type enum) + * @param transfer_type The way the autopilot wants to receive the URI. 0 = MAVLink FTP. 1 = binary stream. + * @param storage The storage path the autopilot wants the URI to be stored in. Will only be valid if the transfer_type has a storage associated (e.g. MAVLink FTP). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_resource_request_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t request_id, uint8_t uri_type, const uint8_t *uri, uint8_t transfer_type, const uint8_t *storage) +{ #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_RESOURCE_REQUEST_LEN]; _mav_put_uint8_t(buf, 0, request_id); @@ -83,7 +122,11 @@ static inline uint16_t mavlink_msg_resource_request_pack(uint8_t system_id, uint #endif msg->msgid = MAVLINK_MSG_ID_RESOURCE_REQUEST; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RESOURCE_REQUEST_MIN_LEN, MAVLINK_MSG_ID_RESOURCE_REQUEST_LEN, MAVLINK_MSG_ID_RESOURCE_REQUEST_CRC); +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RESOURCE_REQUEST_MIN_LEN, MAVLINK_MSG_ID_RESOURCE_REQUEST_LEN, MAVLINK_MSG_ID_RESOURCE_REQUEST_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RESOURCE_REQUEST_MIN_LEN, MAVLINK_MSG_ID_RESOURCE_REQUEST_LEN); +#endif } /** @@ -92,7 +135,7 @@ static inline uint16_t mavlink_msg_resource_request_pack(uint8_t system_id, uint * @param component_id ID of this component (e.g. 200 for IMU) * @param chan The MAVLink channel this message will be sent over * @param msg The MAVLink message to compress the data into - * @param request_id Request ID. This ID should be re-used when sending back URI contents + * @param request_id Request ID. This ID should be reused when sending back URI contents * @param uri_type The type of requested URI. 0 = a file via URL. 1 = a UAVCAN binary * @param uri The requested unique resource identifier (URI). It is not necessarily a straight domain name (depends on the URI type enum) * @param transfer_type The way the autopilot wants to receive the URI. 0 = MAVLink FTP. 1 = binary stream. @@ -116,8 +159,8 @@ static inline uint16_t mavlink_msg_resource_request_pack_chan(uint8_t system_id, packet.request_id = request_id; packet.uri_type = uri_type; packet.transfer_type = transfer_type; - mav_array_memcpy(packet.uri, uri, sizeof(uint8_t)*120); - mav_array_memcpy(packet.storage, storage, sizeof(uint8_t)*120); + mav_array_assign_uint8_t(packet.uri, uri, 120); + mav_array_assign_uint8_t(packet.storage, storage, 120); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RESOURCE_REQUEST_LEN); #endif @@ -152,11 +195,25 @@ static inline uint16_t mavlink_msg_resource_request_encode_chan(uint8_t system_i return mavlink_msg_resource_request_pack_chan(system_id, component_id, chan, msg, resource_request->request_id, resource_request->uri_type, resource_request->uri, resource_request->transfer_type, resource_request->storage); } +/** + * @brief Encode a resource_request struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param resource_request C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_resource_request_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_resource_request_t* resource_request) +{ + return mavlink_msg_resource_request_pack_status(system_id, component_id, _status, msg, resource_request->request_id, resource_request->uri_type, resource_request->uri, resource_request->transfer_type, resource_request->storage); +} + /** * @brief Send a resource_request message * @param chan MAVLink channel to send the message * - * @param request_id Request ID. This ID should be re-used when sending back URI contents + * @param request_id Request ID. This ID should be reused when sending back URI contents * @param uri_type The type of requested URI. 0 = a file via URL. 1 = a UAVCAN binary * @param uri The requested unique resource identifier (URI). It is not necessarily a straight domain name (depends on the URI type enum) * @param transfer_type The way the autopilot wants to receive the URI. 0 = MAVLink FTP. 1 = binary stream. @@ -179,8 +236,8 @@ static inline void mavlink_msg_resource_request_send(mavlink_channel_t chan, uin packet.request_id = request_id; packet.uri_type = uri_type; packet.transfer_type = transfer_type; - mav_array_memcpy(packet.uri, uri, sizeof(uint8_t)*120); - mav_array_memcpy(packet.storage, storage, sizeof(uint8_t)*120); + mav_array_assign_uint8_t(packet.uri, uri, 120); + mav_array_assign_uint8_t(packet.storage, storage, 120); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RESOURCE_REQUEST, (const char *)&packet, MAVLINK_MSG_ID_RESOURCE_REQUEST_MIN_LEN, MAVLINK_MSG_ID_RESOURCE_REQUEST_LEN, MAVLINK_MSG_ID_RESOURCE_REQUEST_CRC); #endif } @@ -201,7 +258,7 @@ static inline void mavlink_msg_resource_request_send_struct(mavlink_channel_t ch #if MAVLINK_MSG_ID_RESOURCE_REQUEST_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -222,8 +279,8 @@ static inline void mavlink_msg_resource_request_send_buf(mavlink_message_t *msgb packet->request_id = request_id; packet->uri_type = uri_type; packet->transfer_type = transfer_type; - mav_array_memcpy(packet->uri, uri, sizeof(uint8_t)*120); - mav_array_memcpy(packet->storage, storage, sizeof(uint8_t)*120); + mav_array_assign_uint8_t(packet->uri, uri, 120); + mav_array_assign_uint8_t(packet->storage, storage, 120); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RESOURCE_REQUEST, (const char *)packet, MAVLINK_MSG_ID_RESOURCE_REQUEST_MIN_LEN, MAVLINK_MSG_ID_RESOURCE_REQUEST_LEN, MAVLINK_MSG_ID_RESOURCE_REQUEST_CRC); #endif } @@ -237,7 +294,7 @@ static inline void mavlink_msg_resource_request_send_buf(mavlink_message_t *msgb /** * @brief Get field request_id from resource_request message * - * @return Request ID. This ID should be re-used when sending back URI contents + * @return Request ID. This ID should be reused when sending back URI contents */ static inline uint8_t mavlink_msg_resource_request_get_request_id(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_response_event_error.h b/common/mavlink_msg_response_event_error.h new file mode 100644 index 000000000..3182cea2e --- /dev/null +++ b/common/mavlink_msg_response_event_error.h @@ -0,0 +1,372 @@ +#pragma once +// MESSAGE RESPONSE_EVENT_ERROR PACKING + +#define MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR 413 + + +typedef struct __mavlink_response_event_error_t { + uint16_t sequence; /*< Sequence number.*/ + uint16_t sequence_oldest_available; /*< Oldest Sequence number that is still available after the sequence set in REQUEST_EVENT.*/ + uint8_t target_system; /*< System ID*/ + uint8_t target_component; /*< Component ID*/ + uint8_t reason; /*< Error reason.*/ +} mavlink_response_event_error_t; + +#define MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN 7 +#define MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_MIN_LEN 7 +#define MAVLINK_MSG_ID_413_LEN 7 +#define MAVLINK_MSG_ID_413_MIN_LEN 7 + +#define MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_CRC 77 +#define MAVLINK_MSG_ID_413_CRC 77 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_RESPONSE_EVENT_ERROR { \ + 413, \ + "RESPONSE_EVENT_ERROR", \ + 5, \ + { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_response_event_error_t, target_system) }, \ + { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_response_event_error_t, target_component) }, \ + { "sequence", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_response_event_error_t, sequence) }, \ + { "sequence_oldest_available", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_response_event_error_t, sequence_oldest_available) }, \ + { "reason", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_response_event_error_t, reason) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_RESPONSE_EVENT_ERROR { \ + "RESPONSE_EVENT_ERROR", \ + 5, \ + { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_response_event_error_t, target_system) }, \ + { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_response_event_error_t, target_component) }, \ + { "sequence", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_response_event_error_t, sequence) }, \ + { "sequence_oldest_available", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_response_event_error_t, sequence_oldest_available) }, \ + { "reason", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_response_event_error_t, reason) }, \ + } \ +} +#endif + +/** + * @brief Pack a response_event_error message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param sequence Sequence number. + * @param sequence_oldest_available Oldest Sequence number that is still available after the sequence set in REQUEST_EVENT. + * @param reason Error reason. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_response_event_error_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint16_t sequence, uint16_t sequence_oldest_available, uint8_t reason) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN]; + _mav_put_uint16_t(buf, 0, sequence); + _mav_put_uint16_t(buf, 2, sequence_oldest_available); + _mav_put_uint8_t(buf, 4, target_system); + _mav_put_uint8_t(buf, 5, target_component); + _mav_put_uint8_t(buf, 6, reason); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN); +#else + mavlink_response_event_error_t packet; + packet.sequence = sequence; + packet.sequence_oldest_available = sequence_oldest_available; + packet.target_system = target_system; + packet.target_component = target_component; + packet.reason = reason; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_MIN_LEN, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_CRC); +} + +/** + * @brief Pack a response_event_error message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param sequence Sequence number. + * @param sequence_oldest_available Oldest Sequence number that is still available after the sequence set in REQUEST_EVENT. + * @param reason Error reason. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_response_event_error_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint16_t sequence, uint16_t sequence_oldest_available, uint8_t reason) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN]; + _mav_put_uint16_t(buf, 0, sequence); + _mav_put_uint16_t(buf, 2, sequence_oldest_available); + _mav_put_uint8_t(buf, 4, target_system); + _mav_put_uint8_t(buf, 5, target_component); + _mav_put_uint8_t(buf, 6, reason); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN); +#else + mavlink_response_event_error_t packet; + packet.sequence = sequence; + packet.sequence_oldest_available = sequence_oldest_available; + packet.target_system = target_system; + packet.target_component = target_component; + packet.reason = reason; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_MIN_LEN, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_MIN_LEN, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN); +#endif +} + +/** + * @brief Pack a response_event_error message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param target_system System ID + * @param target_component Component ID + * @param sequence Sequence number. + * @param sequence_oldest_available Oldest Sequence number that is still available after the sequence set in REQUEST_EVENT. + * @param reason Error reason. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_response_event_error_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t target_system,uint8_t target_component,uint16_t sequence,uint16_t sequence_oldest_available,uint8_t reason) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN]; + _mav_put_uint16_t(buf, 0, sequence); + _mav_put_uint16_t(buf, 2, sequence_oldest_available); + _mav_put_uint8_t(buf, 4, target_system); + _mav_put_uint8_t(buf, 5, target_component); + _mav_put_uint8_t(buf, 6, reason); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN); +#else + mavlink_response_event_error_t packet; + packet.sequence = sequence; + packet.sequence_oldest_available = sequence_oldest_available; + packet.target_system = target_system; + packet.target_component = target_component; + packet.reason = reason; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_MIN_LEN, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_CRC); +} + +/** + * @brief Encode a response_event_error struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param response_event_error C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_response_event_error_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_response_event_error_t* response_event_error) +{ + return mavlink_msg_response_event_error_pack(system_id, component_id, msg, response_event_error->target_system, response_event_error->target_component, response_event_error->sequence, response_event_error->sequence_oldest_available, response_event_error->reason); +} + +/** + * @brief Encode a response_event_error struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param response_event_error C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_response_event_error_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_response_event_error_t* response_event_error) +{ + return mavlink_msg_response_event_error_pack_chan(system_id, component_id, chan, msg, response_event_error->target_system, response_event_error->target_component, response_event_error->sequence, response_event_error->sequence_oldest_available, response_event_error->reason); +} + +/** + * @brief Encode a response_event_error struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param response_event_error C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_response_event_error_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_response_event_error_t* response_event_error) +{ + return mavlink_msg_response_event_error_pack_status(system_id, component_id, _status, msg, response_event_error->target_system, response_event_error->target_component, response_event_error->sequence, response_event_error->sequence_oldest_available, response_event_error->reason); +} + +/** + * @brief Send a response_event_error message + * @param chan MAVLink channel to send the message + * + * @param target_system System ID + * @param target_component Component ID + * @param sequence Sequence number. + * @param sequence_oldest_available Oldest Sequence number that is still available after the sequence set in REQUEST_EVENT. + * @param reason Error reason. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_response_event_error_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint16_t sequence, uint16_t sequence_oldest_available, uint8_t reason) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN]; + _mav_put_uint16_t(buf, 0, sequence); + _mav_put_uint16_t(buf, 2, sequence_oldest_available); + _mav_put_uint8_t(buf, 4, target_system); + _mav_put_uint8_t(buf, 5, target_component); + _mav_put_uint8_t(buf, 6, reason); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR, buf, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_MIN_LEN, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_CRC); +#else + mavlink_response_event_error_t packet; + packet.sequence = sequence; + packet.sequence_oldest_available = sequence_oldest_available; + packet.target_system = target_system; + packet.target_component = target_component; + packet.reason = reason; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR, (const char *)&packet, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_MIN_LEN, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_CRC); +#endif +} + +/** + * @brief Send a response_event_error message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_response_event_error_send_struct(mavlink_channel_t chan, const mavlink_response_event_error_t* response_event_error) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_response_event_error_send(chan, response_event_error->target_system, response_event_error->target_component, response_event_error->sequence, response_event_error->sequence_oldest_available, response_event_error->reason); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR, (const char *)response_event_error, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_MIN_LEN, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_CRC); +#endif +} + +#if MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_response_event_error_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint16_t sequence, uint16_t sequence_oldest_available, uint8_t reason) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint16_t(buf, 0, sequence); + _mav_put_uint16_t(buf, 2, sequence_oldest_available); + _mav_put_uint8_t(buf, 4, target_system); + _mav_put_uint8_t(buf, 5, target_component); + _mav_put_uint8_t(buf, 6, reason); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR, buf, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_MIN_LEN, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_CRC); +#else + mavlink_response_event_error_t *packet = (mavlink_response_event_error_t *)msgbuf; + packet->sequence = sequence; + packet->sequence_oldest_available = sequence_oldest_available; + packet->target_system = target_system; + packet->target_component = target_component; + packet->reason = reason; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR, (const char *)packet, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_MIN_LEN, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_CRC); +#endif +} +#endif + +#endif + +// MESSAGE RESPONSE_EVENT_ERROR UNPACKING + + +/** + * @brief Get field target_system from response_event_error message + * + * @return System ID + */ +static inline uint8_t mavlink_msg_response_event_error_get_target_system(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 4); +} + +/** + * @brief Get field target_component from response_event_error message + * + * @return Component ID + */ +static inline uint8_t mavlink_msg_response_event_error_get_target_component(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 5); +} + +/** + * @brief Get field sequence from response_event_error message + * + * @return Sequence number. + */ +static inline uint16_t mavlink_msg_response_event_error_get_sequence(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 0); +} + +/** + * @brief Get field sequence_oldest_available from response_event_error message + * + * @return Oldest Sequence number that is still available after the sequence set in REQUEST_EVENT. + */ +static inline uint16_t mavlink_msg_response_event_error_get_sequence_oldest_available(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 2); +} + +/** + * @brief Get field reason from response_event_error message + * + * @return Error reason. + */ +static inline uint8_t mavlink_msg_response_event_error_get_reason(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 6); +} + +/** + * @brief Decode a response_event_error message into a struct + * + * @param msg The message to decode + * @param response_event_error C-struct to decode the message contents into + */ +static inline void mavlink_msg_response_event_error_decode(const mavlink_message_t* msg, mavlink_response_event_error_t* response_event_error) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + response_event_error->sequence = mavlink_msg_response_event_error_get_sequence(msg); + response_event_error->sequence_oldest_available = mavlink_msg_response_event_error_get_sequence_oldest_available(msg); + response_event_error->target_system = mavlink_msg_response_event_error_get_target_system(msg); + response_event_error->target_component = mavlink_msg_response_event_error_get_target_component(msg); + response_event_error->reason = mavlink_msg_response_event_error_get_reason(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN? msg->len : MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN; + memset(response_event_error, 0, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN); + memcpy(response_event_error, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/common/mavlink_msg_safety_allowed_area.h b/common/mavlink_msg_safety_allowed_area.h index bad669a0c..dcbfffeba 100644 --- a/common/mavlink_msg_safety_allowed_area.h +++ b/common/mavlink_msg_safety_allowed_area.h @@ -99,6 +99,57 @@ static inline uint16_t mavlink_msg_safety_allowed_area_pack(uint8_t system_id, u return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_CRC); } +/** + * @brief Pack a safety_allowed_area message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param frame Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down. + * @param p1x [m] x position 1 / Latitude 1 + * @param p1y [m] y position 1 / Longitude 1 + * @param p1z [m] z position 1 / Altitude 1 + * @param p2x [m] x position 2 / Latitude 2 + * @param p2y [m] y position 2 / Longitude 2 + * @param p2z [m] z position 2 / Altitude 2 + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_safety_allowed_area_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t frame, float p1x, float p1y, float p1z, float p2x, float p2y, float p2z) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN]; + _mav_put_float(buf, 0, p1x); + _mav_put_float(buf, 4, p1y); + _mav_put_float(buf, 8, p1z); + _mav_put_float(buf, 12, p2x); + _mav_put_float(buf, 16, p2y); + _mav_put_float(buf, 20, p2z); + _mav_put_uint8_t(buf, 24, frame); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN); +#else + mavlink_safety_allowed_area_t packet; + packet.p1x = p1x; + packet.p1y = p1y; + packet.p1z = p1z; + packet.p2x = p2x; + packet.p2y = p2y; + packet.p2z = p2z; + packet.frame = frame; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN); +#endif +} + /** * @brief Pack a safety_allowed_area message on a channel * @param system_id ID of this system @@ -173,6 +224,20 @@ static inline uint16_t mavlink_msg_safety_allowed_area_encode_chan(uint8_t syste return mavlink_msg_safety_allowed_area_pack_chan(system_id, component_id, chan, msg, safety_allowed_area->frame, safety_allowed_area->p1x, safety_allowed_area->p1y, safety_allowed_area->p1z, safety_allowed_area->p2x, safety_allowed_area->p2y, safety_allowed_area->p2z); } +/** + * @brief Encode a safety_allowed_area struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param safety_allowed_area C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_safety_allowed_area_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_safety_allowed_area_t* safety_allowed_area) +{ + return mavlink_msg_safety_allowed_area_pack_status(system_id, component_id, _status, msg, safety_allowed_area->frame, safety_allowed_area->p1x, safety_allowed_area->p1y, safety_allowed_area->p1z, safety_allowed_area->p2x, safety_allowed_area->p2y, safety_allowed_area->p2z); +} + /** * @brief Send a safety_allowed_area message * @param chan MAVLink channel to send the message @@ -230,7 +295,7 @@ static inline void mavlink_msg_safety_allowed_area_send_struct(mavlink_channel_t #if MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_safety_set_allowed_area.h b/common/mavlink_msg_safety_set_allowed_area.h index eca9b274f..c2deea3f2 100644 --- a/common/mavlink_msg_safety_set_allowed_area.h +++ b/common/mavlink_msg_safety_set_allowed_area.h @@ -111,6 +111,63 @@ static inline uint16_t mavlink_msg_safety_set_allowed_area_pack(uint8_t system_i return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC); } +/** + * @brief Pack a safety_set_allowed_area message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param frame Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down. + * @param p1x [m] x position 1 / Latitude 1 + * @param p1y [m] y position 1 / Longitude 1 + * @param p1z [m] z position 1 / Altitude 1 + * @param p2x [m] x position 2 / Latitude 2 + * @param p2y [m] y position 2 / Longitude 2 + * @param p2z [m] z position 2 / Altitude 2 + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_safety_set_allowed_area_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint8_t frame, float p1x, float p1y, float p1z, float p2x, float p2y, float p2z) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN]; + _mav_put_float(buf, 0, p1x); + _mav_put_float(buf, 4, p1y); + _mav_put_float(buf, 8, p1z); + _mav_put_float(buf, 12, p2x); + _mav_put_float(buf, 16, p2y); + _mav_put_float(buf, 20, p2z); + _mav_put_uint8_t(buf, 24, target_system); + _mav_put_uint8_t(buf, 25, target_component); + _mav_put_uint8_t(buf, 26, frame); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN); +#else + mavlink_safety_set_allowed_area_t packet; + packet.p1x = p1x; + packet.p1y = p1y; + packet.p1z = p1z; + packet.p2x = p2x; + packet.p2y = p2y; + packet.p2z = p2z; + packet.target_system = target_system; + packet.target_component = target_component; + packet.frame = frame; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN); +#endif +} + /** * @brief Pack a safety_set_allowed_area message on a channel * @param system_id ID of this system @@ -191,6 +248,20 @@ static inline uint16_t mavlink_msg_safety_set_allowed_area_encode_chan(uint8_t s return mavlink_msg_safety_set_allowed_area_pack_chan(system_id, component_id, chan, msg, safety_set_allowed_area->target_system, safety_set_allowed_area->target_component, safety_set_allowed_area->frame, safety_set_allowed_area->p1x, safety_set_allowed_area->p1y, safety_set_allowed_area->p1z, safety_set_allowed_area->p2x, safety_set_allowed_area->p2y, safety_set_allowed_area->p2z); } +/** + * @brief Encode a safety_set_allowed_area struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param safety_set_allowed_area C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_safety_set_allowed_area_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_safety_set_allowed_area_t* safety_set_allowed_area) +{ + return mavlink_msg_safety_set_allowed_area_pack_status(system_id, component_id, _status, msg, safety_set_allowed_area->target_system, safety_set_allowed_area->target_component, safety_set_allowed_area->frame, safety_set_allowed_area->p1x, safety_set_allowed_area->p1y, safety_set_allowed_area->p1z, safety_set_allowed_area->p2x, safety_set_allowed_area->p2y, safety_set_allowed_area->p2z); +} + /** * @brief Send a safety_set_allowed_area message * @param chan MAVLink channel to send the message @@ -254,7 +325,7 @@ static inline void mavlink_msg_safety_set_allowed_area_send_struct(mavlink_chann #if MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_scaled_imu.h b/common/mavlink_msg_scaled_imu.h index 14b1257ce..cebcefcd0 100644 --- a/common/mavlink_msg_scaled_imu.h +++ b/common/mavlink_msg_scaled_imu.h @@ -123,6 +123,69 @@ static inline uint16_t mavlink_msg_scaled_imu_pack(uint8_t system_id, uint8_t co return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SCALED_IMU_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU_LEN, MAVLINK_MSG_ID_SCALED_IMU_CRC); } +/** + * @brief Pack a scaled_imu message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param xacc [mG] X acceleration + * @param yacc [mG] Y acceleration + * @param zacc [mG] Z acceleration + * @param xgyro [mrad/s] Angular speed around X axis + * @param ygyro [mrad/s] Angular speed around Y axis + * @param zgyro [mrad/s] Angular speed around Z axis + * @param xmag [mgauss] X Magnetic field + * @param ymag [mgauss] Y Magnetic field + * @param zmag [mgauss] Z Magnetic field + * @param temperature [cdegC] Temperature, 0: IMU does not provide temperature values. If the IMU is at 0C it must send 1 (0.01C). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_scaled_imu_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, int16_t xacc, int16_t yacc, int16_t zacc, int16_t xgyro, int16_t ygyro, int16_t zgyro, int16_t xmag, int16_t ymag, int16_t zmag, int16_t temperature) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_SCALED_IMU_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_int16_t(buf, 4, xacc); + _mav_put_int16_t(buf, 6, yacc); + _mav_put_int16_t(buf, 8, zacc); + _mav_put_int16_t(buf, 10, xgyro); + _mav_put_int16_t(buf, 12, ygyro); + _mav_put_int16_t(buf, 14, zgyro); + _mav_put_int16_t(buf, 16, xmag); + _mav_put_int16_t(buf, 18, ymag); + _mav_put_int16_t(buf, 20, zmag); + _mav_put_int16_t(buf, 22, temperature); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SCALED_IMU_LEN); +#else + mavlink_scaled_imu_t packet; + packet.time_boot_ms = time_boot_ms; + packet.xacc = xacc; + packet.yacc = yacc; + packet.zacc = zacc; + packet.xgyro = xgyro; + packet.ygyro = ygyro; + packet.zgyro = zgyro; + packet.xmag = xmag; + packet.ymag = ymag; + packet.zmag = zmag; + packet.temperature = temperature; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SCALED_IMU_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_SCALED_IMU; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SCALED_IMU_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU_LEN, MAVLINK_MSG_ID_SCALED_IMU_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SCALED_IMU_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU_LEN); +#endif +} + /** * @brief Pack a scaled_imu message on a channel * @param system_id ID of this system @@ -209,6 +272,20 @@ static inline uint16_t mavlink_msg_scaled_imu_encode_chan(uint8_t system_id, uin return mavlink_msg_scaled_imu_pack_chan(system_id, component_id, chan, msg, scaled_imu->time_boot_ms, scaled_imu->xacc, scaled_imu->yacc, scaled_imu->zacc, scaled_imu->xgyro, scaled_imu->ygyro, scaled_imu->zgyro, scaled_imu->xmag, scaled_imu->ymag, scaled_imu->zmag, scaled_imu->temperature); } +/** + * @brief Encode a scaled_imu struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param scaled_imu C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_scaled_imu_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_scaled_imu_t* scaled_imu) +{ + return mavlink_msg_scaled_imu_pack_status(system_id, component_id, _status, msg, scaled_imu->time_boot_ms, scaled_imu->xacc, scaled_imu->yacc, scaled_imu->zacc, scaled_imu->xgyro, scaled_imu->ygyro, scaled_imu->zgyro, scaled_imu->xmag, scaled_imu->ymag, scaled_imu->zmag, scaled_imu->temperature); +} + /** * @brief Send a scaled_imu message * @param chan MAVLink channel to send the message @@ -278,7 +355,7 @@ static inline void mavlink_msg_scaled_imu_send_struct(mavlink_channel_t chan, co #if MAVLINK_MSG_ID_SCALED_IMU_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_scaled_imu2.h b/common/mavlink_msg_scaled_imu2.h index 2106cefd1..287d045f0 100644 --- a/common/mavlink_msg_scaled_imu2.h +++ b/common/mavlink_msg_scaled_imu2.h @@ -123,6 +123,69 @@ static inline uint16_t mavlink_msg_scaled_imu2_pack(uint8_t system_id, uint8_t c return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SCALED_IMU2_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU2_LEN, MAVLINK_MSG_ID_SCALED_IMU2_CRC); } +/** + * @brief Pack a scaled_imu2 message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param xacc [mG] X acceleration + * @param yacc [mG] Y acceleration + * @param zacc [mG] Z acceleration + * @param xgyro [mrad/s] Angular speed around X axis + * @param ygyro [mrad/s] Angular speed around Y axis + * @param zgyro [mrad/s] Angular speed around Z axis + * @param xmag [mgauss] X Magnetic field + * @param ymag [mgauss] Y Magnetic field + * @param zmag [mgauss] Z Magnetic field + * @param temperature [cdegC] Temperature, 0: IMU does not provide temperature values. If the IMU is at 0C it must send 1 (0.01C). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_scaled_imu2_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, int16_t xacc, int16_t yacc, int16_t zacc, int16_t xgyro, int16_t ygyro, int16_t zgyro, int16_t xmag, int16_t ymag, int16_t zmag, int16_t temperature) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_SCALED_IMU2_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_int16_t(buf, 4, xacc); + _mav_put_int16_t(buf, 6, yacc); + _mav_put_int16_t(buf, 8, zacc); + _mav_put_int16_t(buf, 10, xgyro); + _mav_put_int16_t(buf, 12, ygyro); + _mav_put_int16_t(buf, 14, zgyro); + _mav_put_int16_t(buf, 16, xmag); + _mav_put_int16_t(buf, 18, ymag); + _mav_put_int16_t(buf, 20, zmag); + _mav_put_int16_t(buf, 22, temperature); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SCALED_IMU2_LEN); +#else + mavlink_scaled_imu2_t packet; + packet.time_boot_ms = time_boot_ms; + packet.xacc = xacc; + packet.yacc = yacc; + packet.zacc = zacc; + packet.xgyro = xgyro; + packet.ygyro = ygyro; + packet.zgyro = zgyro; + packet.xmag = xmag; + packet.ymag = ymag; + packet.zmag = zmag; + packet.temperature = temperature; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SCALED_IMU2_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_SCALED_IMU2; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SCALED_IMU2_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU2_LEN, MAVLINK_MSG_ID_SCALED_IMU2_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SCALED_IMU2_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU2_LEN); +#endif +} + /** * @brief Pack a scaled_imu2 message on a channel * @param system_id ID of this system @@ -209,6 +272,20 @@ static inline uint16_t mavlink_msg_scaled_imu2_encode_chan(uint8_t system_id, ui return mavlink_msg_scaled_imu2_pack_chan(system_id, component_id, chan, msg, scaled_imu2->time_boot_ms, scaled_imu2->xacc, scaled_imu2->yacc, scaled_imu2->zacc, scaled_imu2->xgyro, scaled_imu2->ygyro, scaled_imu2->zgyro, scaled_imu2->xmag, scaled_imu2->ymag, scaled_imu2->zmag, scaled_imu2->temperature); } +/** + * @brief Encode a scaled_imu2 struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param scaled_imu2 C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_scaled_imu2_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_scaled_imu2_t* scaled_imu2) +{ + return mavlink_msg_scaled_imu2_pack_status(system_id, component_id, _status, msg, scaled_imu2->time_boot_ms, scaled_imu2->xacc, scaled_imu2->yacc, scaled_imu2->zacc, scaled_imu2->xgyro, scaled_imu2->ygyro, scaled_imu2->zgyro, scaled_imu2->xmag, scaled_imu2->ymag, scaled_imu2->zmag, scaled_imu2->temperature); +} + /** * @brief Send a scaled_imu2 message * @param chan MAVLink channel to send the message @@ -278,7 +355,7 @@ static inline void mavlink_msg_scaled_imu2_send_struct(mavlink_channel_t chan, c #if MAVLINK_MSG_ID_SCALED_IMU2_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_scaled_imu3.h b/common/mavlink_msg_scaled_imu3.h index cd20f2356..5fa8ecd57 100644 --- a/common/mavlink_msg_scaled_imu3.h +++ b/common/mavlink_msg_scaled_imu3.h @@ -123,6 +123,69 @@ static inline uint16_t mavlink_msg_scaled_imu3_pack(uint8_t system_id, uint8_t c return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SCALED_IMU3_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU3_LEN, MAVLINK_MSG_ID_SCALED_IMU3_CRC); } +/** + * @brief Pack a scaled_imu3 message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param xacc [mG] X acceleration + * @param yacc [mG] Y acceleration + * @param zacc [mG] Z acceleration + * @param xgyro [mrad/s] Angular speed around X axis + * @param ygyro [mrad/s] Angular speed around Y axis + * @param zgyro [mrad/s] Angular speed around Z axis + * @param xmag [mgauss] X Magnetic field + * @param ymag [mgauss] Y Magnetic field + * @param zmag [mgauss] Z Magnetic field + * @param temperature [cdegC] Temperature, 0: IMU does not provide temperature values. If the IMU is at 0C it must send 1 (0.01C). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_scaled_imu3_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, int16_t xacc, int16_t yacc, int16_t zacc, int16_t xgyro, int16_t ygyro, int16_t zgyro, int16_t xmag, int16_t ymag, int16_t zmag, int16_t temperature) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_SCALED_IMU3_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_int16_t(buf, 4, xacc); + _mav_put_int16_t(buf, 6, yacc); + _mav_put_int16_t(buf, 8, zacc); + _mav_put_int16_t(buf, 10, xgyro); + _mav_put_int16_t(buf, 12, ygyro); + _mav_put_int16_t(buf, 14, zgyro); + _mav_put_int16_t(buf, 16, xmag); + _mav_put_int16_t(buf, 18, ymag); + _mav_put_int16_t(buf, 20, zmag); + _mav_put_int16_t(buf, 22, temperature); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SCALED_IMU3_LEN); +#else + mavlink_scaled_imu3_t packet; + packet.time_boot_ms = time_boot_ms; + packet.xacc = xacc; + packet.yacc = yacc; + packet.zacc = zacc; + packet.xgyro = xgyro; + packet.ygyro = ygyro; + packet.zgyro = zgyro; + packet.xmag = xmag; + packet.ymag = ymag; + packet.zmag = zmag; + packet.temperature = temperature; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SCALED_IMU3_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_SCALED_IMU3; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SCALED_IMU3_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU3_LEN, MAVLINK_MSG_ID_SCALED_IMU3_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SCALED_IMU3_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU3_LEN); +#endif +} + /** * @brief Pack a scaled_imu3 message on a channel * @param system_id ID of this system @@ -209,6 +272,20 @@ static inline uint16_t mavlink_msg_scaled_imu3_encode_chan(uint8_t system_id, ui return mavlink_msg_scaled_imu3_pack_chan(system_id, component_id, chan, msg, scaled_imu3->time_boot_ms, scaled_imu3->xacc, scaled_imu3->yacc, scaled_imu3->zacc, scaled_imu3->xgyro, scaled_imu3->ygyro, scaled_imu3->zgyro, scaled_imu3->xmag, scaled_imu3->ymag, scaled_imu3->zmag, scaled_imu3->temperature); } +/** + * @brief Encode a scaled_imu3 struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param scaled_imu3 C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_scaled_imu3_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_scaled_imu3_t* scaled_imu3) +{ + return mavlink_msg_scaled_imu3_pack_status(system_id, component_id, _status, msg, scaled_imu3->time_boot_ms, scaled_imu3->xacc, scaled_imu3->yacc, scaled_imu3->zacc, scaled_imu3->xgyro, scaled_imu3->ygyro, scaled_imu3->zgyro, scaled_imu3->xmag, scaled_imu3->ymag, scaled_imu3->zmag, scaled_imu3->temperature); +} + /** * @brief Send a scaled_imu3 message * @param chan MAVLink channel to send the message @@ -278,7 +355,7 @@ static inline void mavlink_msg_scaled_imu3_send_struct(mavlink_channel_t chan, c #if MAVLINK_MSG_ID_SCALED_IMU3_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_scaled_pressure.h b/common/mavlink_msg_scaled_pressure.h index 13344a8a6..06c0ce62d 100644 --- a/common/mavlink_msg_scaled_pressure.h +++ b/common/mavlink_msg_scaled_pressure.h @@ -87,6 +87,51 @@ static inline uint16_t mavlink_msg_scaled_pressure_pack(uint8_t system_id, uint8 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SCALED_PRESSURE_MIN_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE_CRC); } +/** + * @brief Pack a scaled_pressure message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param press_abs [hPa] Absolute pressure + * @param press_diff [hPa] Differential pressure 1 + * @param temperature [cdegC] Absolute pressure temperature + * @param temperature_press_diff [cdegC] Differential pressure temperature (0, if not available). Report values of 0 (or 1) as 1 cdegC. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_scaled_pressure_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, float press_abs, float press_diff, int16_t temperature, int16_t temperature_press_diff) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_SCALED_PRESSURE_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_float(buf, 4, press_abs); + _mav_put_float(buf, 8, press_diff); + _mav_put_int16_t(buf, 12, temperature); + _mav_put_int16_t(buf, 14, temperature_press_diff); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SCALED_PRESSURE_LEN); +#else + mavlink_scaled_pressure_t packet; + packet.time_boot_ms = time_boot_ms; + packet.press_abs = press_abs; + packet.press_diff = press_diff; + packet.temperature = temperature; + packet.temperature_press_diff = temperature_press_diff; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SCALED_PRESSURE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_SCALED_PRESSURE; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SCALED_PRESSURE_MIN_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SCALED_PRESSURE_MIN_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE_LEN); +#endif +} + /** * @brief Pack a scaled_pressure message on a channel * @param system_id ID of this system @@ -155,6 +200,20 @@ static inline uint16_t mavlink_msg_scaled_pressure_encode_chan(uint8_t system_id return mavlink_msg_scaled_pressure_pack_chan(system_id, component_id, chan, msg, scaled_pressure->time_boot_ms, scaled_pressure->press_abs, scaled_pressure->press_diff, scaled_pressure->temperature, scaled_pressure->temperature_press_diff); } +/** + * @brief Encode a scaled_pressure struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param scaled_pressure C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_scaled_pressure_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_scaled_pressure_t* scaled_pressure) +{ + return mavlink_msg_scaled_pressure_pack_status(system_id, component_id, _status, msg, scaled_pressure->time_boot_ms, scaled_pressure->press_abs, scaled_pressure->press_diff, scaled_pressure->temperature, scaled_pressure->temperature_press_diff); +} + /** * @brief Send a scaled_pressure message * @param chan MAVLink channel to send the message @@ -206,7 +265,7 @@ static inline void mavlink_msg_scaled_pressure_send_struct(mavlink_channel_t cha #if MAVLINK_MSG_ID_SCALED_PRESSURE_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_scaled_pressure2.h b/common/mavlink_msg_scaled_pressure2.h index 8dc28850e..6203bbc3f 100644 --- a/common/mavlink_msg_scaled_pressure2.h +++ b/common/mavlink_msg_scaled_pressure2.h @@ -87,6 +87,51 @@ static inline uint16_t mavlink_msg_scaled_pressure2_pack(uint8_t system_id, uint return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SCALED_PRESSURE2_MIN_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE2_CRC); } +/** + * @brief Pack a scaled_pressure2 message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param press_abs [hPa] Absolute pressure + * @param press_diff [hPa] Differential pressure + * @param temperature [cdegC] Absolute pressure temperature + * @param temperature_press_diff [cdegC] Differential pressure temperature (0, if not available). Report values of 0 (or 1) as 1 cdegC. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_scaled_pressure2_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, float press_abs, float press_diff, int16_t temperature, int16_t temperature_press_diff) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_float(buf, 4, press_abs); + _mav_put_float(buf, 8, press_diff); + _mav_put_int16_t(buf, 12, temperature); + _mav_put_int16_t(buf, 14, temperature_press_diff); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN); +#else + mavlink_scaled_pressure2_t packet; + packet.time_boot_ms = time_boot_ms; + packet.press_abs = press_abs; + packet.press_diff = press_diff; + packet.temperature = temperature; + packet.temperature_press_diff = temperature_press_diff; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_SCALED_PRESSURE2; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SCALED_PRESSURE2_MIN_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE2_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SCALED_PRESSURE2_MIN_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN); +#endif +} + /** * @brief Pack a scaled_pressure2 message on a channel * @param system_id ID of this system @@ -155,6 +200,20 @@ static inline uint16_t mavlink_msg_scaled_pressure2_encode_chan(uint8_t system_i return mavlink_msg_scaled_pressure2_pack_chan(system_id, component_id, chan, msg, scaled_pressure2->time_boot_ms, scaled_pressure2->press_abs, scaled_pressure2->press_diff, scaled_pressure2->temperature, scaled_pressure2->temperature_press_diff); } +/** + * @brief Encode a scaled_pressure2 struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param scaled_pressure2 C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_scaled_pressure2_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_scaled_pressure2_t* scaled_pressure2) +{ + return mavlink_msg_scaled_pressure2_pack_status(system_id, component_id, _status, msg, scaled_pressure2->time_boot_ms, scaled_pressure2->press_abs, scaled_pressure2->press_diff, scaled_pressure2->temperature, scaled_pressure2->temperature_press_diff); +} + /** * @brief Send a scaled_pressure2 message * @param chan MAVLink channel to send the message @@ -206,7 +265,7 @@ static inline void mavlink_msg_scaled_pressure2_send_struct(mavlink_channel_t ch #if MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_scaled_pressure3.h b/common/mavlink_msg_scaled_pressure3.h index 34368b1ef..660ca4fae 100644 --- a/common/mavlink_msg_scaled_pressure3.h +++ b/common/mavlink_msg_scaled_pressure3.h @@ -87,6 +87,51 @@ static inline uint16_t mavlink_msg_scaled_pressure3_pack(uint8_t system_id, uint return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SCALED_PRESSURE3_MIN_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE3_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE3_CRC); } +/** + * @brief Pack a scaled_pressure3 message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param press_abs [hPa] Absolute pressure + * @param press_diff [hPa] Differential pressure + * @param temperature [cdegC] Absolute pressure temperature + * @param temperature_press_diff [cdegC] Differential pressure temperature (0, if not available). Report values of 0 (or 1) as 1 cdegC. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_scaled_pressure3_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, float press_abs, float press_diff, int16_t temperature, int16_t temperature_press_diff) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_SCALED_PRESSURE3_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_float(buf, 4, press_abs); + _mav_put_float(buf, 8, press_diff); + _mav_put_int16_t(buf, 12, temperature); + _mav_put_int16_t(buf, 14, temperature_press_diff); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SCALED_PRESSURE3_LEN); +#else + mavlink_scaled_pressure3_t packet; + packet.time_boot_ms = time_boot_ms; + packet.press_abs = press_abs; + packet.press_diff = press_diff; + packet.temperature = temperature; + packet.temperature_press_diff = temperature_press_diff; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SCALED_PRESSURE3_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_SCALED_PRESSURE3; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SCALED_PRESSURE3_MIN_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE3_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE3_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SCALED_PRESSURE3_MIN_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE3_LEN); +#endif +} + /** * @brief Pack a scaled_pressure3 message on a channel * @param system_id ID of this system @@ -155,6 +200,20 @@ static inline uint16_t mavlink_msg_scaled_pressure3_encode_chan(uint8_t system_i return mavlink_msg_scaled_pressure3_pack_chan(system_id, component_id, chan, msg, scaled_pressure3->time_boot_ms, scaled_pressure3->press_abs, scaled_pressure3->press_diff, scaled_pressure3->temperature, scaled_pressure3->temperature_press_diff); } +/** + * @brief Encode a scaled_pressure3 struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param scaled_pressure3 C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_scaled_pressure3_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_scaled_pressure3_t* scaled_pressure3) +{ + return mavlink_msg_scaled_pressure3_pack_status(system_id, component_id, _status, msg, scaled_pressure3->time_boot_ms, scaled_pressure3->press_abs, scaled_pressure3->press_diff, scaled_pressure3->temperature, scaled_pressure3->temperature_press_diff); +} + /** * @brief Send a scaled_pressure3 message * @param chan MAVLink channel to send the message @@ -206,7 +265,7 @@ static inline void mavlink_msg_scaled_pressure3_send_struct(mavlink_channel_t ch #if MAVLINK_MSG_ID_SCALED_PRESSURE3_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_serial_control.h b/common/mavlink_msg_serial_control.h index 16ed754cf..a411f26f9 100644 --- a/common/mavlink_msg_serial_control.h +++ b/common/mavlink_msg_serial_control.h @@ -11,11 +11,13 @@ typedef struct __mavlink_serial_control_t { uint8_t flags; /*< Bitmap of serial control flags.*/ uint8_t count; /*< [bytes] how many bytes in this transfer*/ uint8_t data[70]; /*< serial data*/ + uint8_t target_system; /*< System ID*/ + uint8_t target_component; /*< Component ID*/ } mavlink_serial_control_t; -#define MAVLINK_MSG_ID_SERIAL_CONTROL_LEN 79 +#define MAVLINK_MSG_ID_SERIAL_CONTROL_LEN 81 #define MAVLINK_MSG_ID_SERIAL_CONTROL_MIN_LEN 79 -#define MAVLINK_MSG_ID_126_LEN 79 +#define MAVLINK_MSG_ID_126_LEN 81 #define MAVLINK_MSG_ID_126_MIN_LEN 79 #define MAVLINK_MSG_ID_SERIAL_CONTROL_CRC 220 @@ -27,25 +29,29 @@ typedef struct __mavlink_serial_control_t { #define MAVLINK_MESSAGE_INFO_SERIAL_CONTROL { \ 126, \ "SERIAL_CONTROL", \ - 6, \ + 8, \ { { "device", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_serial_control_t, device) }, \ { "flags", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_serial_control_t, flags) }, \ { "timeout", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_serial_control_t, timeout) }, \ { "baudrate", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_serial_control_t, baudrate) }, \ { "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_serial_control_t, count) }, \ { "data", NULL, MAVLINK_TYPE_UINT8_T, 70, 9, offsetof(mavlink_serial_control_t, data) }, \ + { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 79, offsetof(mavlink_serial_control_t, target_system) }, \ + { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 80, offsetof(mavlink_serial_control_t, target_component) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_SERIAL_CONTROL { \ "SERIAL_CONTROL", \ - 6, \ + 8, \ { { "device", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_serial_control_t, device) }, \ { "flags", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_serial_control_t, flags) }, \ { "timeout", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_serial_control_t, timeout) }, \ { "baudrate", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_serial_control_t, baudrate) }, \ { "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_serial_control_t, count) }, \ { "data", NULL, MAVLINK_TYPE_UINT8_T, 70, 9, offsetof(mavlink_serial_control_t, data) }, \ + { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 79, offsetof(mavlink_serial_control_t, target_system) }, \ + { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 80, offsetof(mavlink_serial_control_t, target_component) }, \ } \ } #endif @@ -62,10 +68,12 @@ typedef struct __mavlink_serial_control_t { * @param baudrate [bits/s] Baudrate of transfer. Zero means no change. * @param count [bytes] how many bytes in this transfer * @param data serial data + * @param target_system System ID + * @param target_component Component ID * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_serial_control_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t device, uint8_t flags, uint16_t timeout, uint32_t baudrate, uint8_t count, const uint8_t *data) + uint8_t device, uint8_t flags, uint16_t timeout, uint32_t baudrate, uint8_t count, const uint8_t *data, uint8_t target_system, uint8_t target_component) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_SERIAL_CONTROL_LEN]; @@ -74,6 +82,8 @@ static inline uint16_t mavlink_msg_serial_control_pack(uint8_t system_id, uint8_ _mav_put_uint8_t(buf, 6, device); _mav_put_uint8_t(buf, 7, flags); _mav_put_uint8_t(buf, 8, count); + _mav_put_uint8_t(buf, 79, target_system); + _mav_put_uint8_t(buf, 80, target_component); _mav_put_uint8_t_array(buf, 9, data, 70); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_CONTROL_LEN); #else @@ -83,7 +93,9 @@ static inline uint16_t mavlink_msg_serial_control_pack(uint8_t system_id, uint8_ packet.device = device; packet.flags = flags; packet.count = count; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*70); + packet.target_system = target_system; + packet.target_component = target_component; + mav_array_assign_uint8_t(packet.data, data, 70); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_CONTROL_LEN); #endif @@ -91,6 +103,58 @@ static inline uint16_t mavlink_msg_serial_control_pack(uint8_t system_id, uint8_ return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SERIAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_SERIAL_CONTROL_LEN, MAVLINK_MSG_ID_SERIAL_CONTROL_CRC); } +/** + * @brief Pack a serial_control message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param device Serial control device type. + * @param flags Bitmap of serial control flags. + * @param timeout [ms] Timeout for reply data + * @param baudrate [bits/s] Baudrate of transfer. Zero means no change. + * @param count [bytes] how many bytes in this transfer + * @param data serial data + * @param target_system System ID + * @param target_component Component ID + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_serial_control_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t device, uint8_t flags, uint16_t timeout, uint32_t baudrate, uint8_t count, const uint8_t *data, uint8_t target_system, uint8_t target_component) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_SERIAL_CONTROL_LEN]; + _mav_put_uint32_t(buf, 0, baudrate); + _mav_put_uint16_t(buf, 4, timeout); + _mav_put_uint8_t(buf, 6, device); + _mav_put_uint8_t(buf, 7, flags); + _mav_put_uint8_t(buf, 8, count); + _mav_put_uint8_t(buf, 79, target_system); + _mav_put_uint8_t(buf, 80, target_component); + _mav_put_uint8_t_array(buf, 9, data, 70); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_CONTROL_LEN); +#else + mavlink_serial_control_t packet; + packet.baudrate = baudrate; + packet.timeout = timeout; + packet.device = device; + packet.flags = flags; + packet.count = count; + packet.target_system = target_system; + packet.target_component = target_component; + mav_array_memcpy(packet.data, data, sizeof(uint8_t)*70); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_CONTROL_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_SERIAL_CONTROL; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SERIAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_SERIAL_CONTROL_LEN, MAVLINK_MSG_ID_SERIAL_CONTROL_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SERIAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_SERIAL_CONTROL_LEN); +#endif +} + /** * @brief Pack a serial_control message on a channel * @param system_id ID of this system @@ -103,11 +167,13 @@ static inline uint16_t mavlink_msg_serial_control_pack(uint8_t system_id, uint8_ * @param baudrate [bits/s] Baudrate of transfer. Zero means no change. * @param count [bytes] how many bytes in this transfer * @param data serial data + * @param target_system System ID + * @param target_component Component ID * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_serial_control_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - uint8_t device,uint8_t flags,uint16_t timeout,uint32_t baudrate,uint8_t count,const uint8_t *data) + uint8_t device,uint8_t flags,uint16_t timeout,uint32_t baudrate,uint8_t count,const uint8_t *data,uint8_t target_system,uint8_t target_component) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_SERIAL_CONTROL_LEN]; @@ -116,6 +182,8 @@ static inline uint16_t mavlink_msg_serial_control_pack_chan(uint8_t system_id, u _mav_put_uint8_t(buf, 6, device); _mav_put_uint8_t(buf, 7, flags); _mav_put_uint8_t(buf, 8, count); + _mav_put_uint8_t(buf, 79, target_system); + _mav_put_uint8_t(buf, 80, target_component); _mav_put_uint8_t_array(buf, 9, data, 70); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_CONTROL_LEN); #else @@ -125,7 +193,9 @@ static inline uint16_t mavlink_msg_serial_control_pack_chan(uint8_t system_id, u packet.device = device; packet.flags = flags; packet.count = count; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*70); + packet.target_system = target_system; + packet.target_component = target_component; + mav_array_assign_uint8_t(packet.data, data, 70); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_CONTROL_LEN); #endif @@ -143,7 +213,7 @@ static inline uint16_t mavlink_msg_serial_control_pack_chan(uint8_t system_id, u */ static inline uint16_t mavlink_msg_serial_control_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_serial_control_t* serial_control) { - return mavlink_msg_serial_control_pack(system_id, component_id, msg, serial_control->device, serial_control->flags, serial_control->timeout, serial_control->baudrate, serial_control->count, serial_control->data); + return mavlink_msg_serial_control_pack(system_id, component_id, msg, serial_control->device, serial_control->flags, serial_control->timeout, serial_control->baudrate, serial_control->count, serial_control->data, serial_control->target_system, serial_control->target_component); } /** @@ -157,7 +227,21 @@ static inline uint16_t mavlink_msg_serial_control_encode(uint8_t system_id, uint */ static inline uint16_t mavlink_msg_serial_control_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_serial_control_t* serial_control) { - return mavlink_msg_serial_control_pack_chan(system_id, component_id, chan, msg, serial_control->device, serial_control->flags, serial_control->timeout, serial_control->baudrate, serial_control->count, serial_control->data); + return mavlink_msg_serial_control_pack_chan(system_id, component_id, chan, msg, serial_control->device, serial_control->flags, serial_control->timeout, serial_control->baudrate, serial_control->count, serial_control->data, serial_control->target_system, serial_control->target_component); +} + +/** + * @brief Encode a serial_control struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param serial_control C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_serial_control_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_serial_control_t* serial_control) +{ + return mavlink_msg_serial_control_pack_status(system_id, component_id, _status, msg, serial_control->device, serial_control->flags, serial_control->timeout, serial_control->baudrate, serial_control->count, serial_control->data, serial_control->target_system, serial_control->target_component); } /** @@ -170,10 +254,12 @@ static inline uint16_t mavlink_msg_serial_control_encode_chan(uint8_t system_id, * @param baudrate [bits/s] Baudrate of transfer. Zero means no change. * @param count [bytes] how many bytes in this transfer * @param data serial data + * @param target_system System ID + * @param target_component Component ID */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_serial_control_send(mavlink_channel_t chan, uint8_t device, uint8_t flags, uint16_t timeout, uint32_t baudrate, uint8_t count, const uint8_t *data) +static inline void mavlink_msg_serial_control_send(mavlink_channel_t chan, uint8_t device, uint8_t flags, uint16_t timeout, uint32_t baudrate, uint8_t count, const uint8_t *data, uint8_t target_system, uint8_t target_component) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_SERIAL_CONTROL_LEN]; @@ -182,6 +268,8 @@ static inline void mavlink_msg_serial_control_send(mavlink_channel_t chan, uint8 _mav_put_uint8_t(buf, 6, device); _mav_put_uint8_t(buf, 7, flags); _mav_put_uint8_t(buf, 8, count); + _mav_put_uint8_t(buf, 79, target_system); + _mav_put_uint8_t(buf, 80, target_component); _mav_put_uint8_t_array(buf, 9, data, 70); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_CONTROL, buf, MAVLINK_MSG_ID_SERIAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_SERIAL_CONTROL_LEN, MAVLINK_MSG_ID_SERIAL_CONTROL_CRC); #else @@ -191,7 +279,9 @@ static inline void mavlink_msg_serial_control_send(mavlink_channel_t chan, uint8 packet.device = device; packet.flags = flags; packet.count = count; - mav_array_memcpy(packet.data, data, sizeof(uint8_t)*70); + packet.target_system = target_system; + packet.target_component = target_component; + mav_array_assign_uint8_t(packet.data, data, 70); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_CONTROL, (const char *)&packet, MAVLINK_MSG_ID_SERIAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_SERIAL_CONTROL_LEN, MAVLINK_MSG_ID_SERIAL_CONTROL_CRC); #endif } @@ -204,7 +294,7 @@ static inline void mavlink_msg_serial_control_send(mavlink_channel_t chan, uint8 static inline void mavlink_msg_serial_control_send_struct(mavlink_channel_t chan, const mavlink_serial_control_t* serial_control) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_serial_control_send(chan, serial_control->device, serial_control->flags, serial_control->timeout, serial_control->baudrate, serial_control->count, serial_control->data); + mavlink_msg_serial_control_send(chan, serial_control->device, serial_control->flags, serial_control->timeout, serial_control->baudrate, serial_control->count, serial_control->data, serial_control->target_system, serial_control->target_component); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_CONTROL, (const char *)serial_control, MAVLINK_MSG_ID_SERIAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_SERIAL_CONTROL_LEN, MAVLINK_MSG_ID_SERIAL_CONTROL_CRC); #endif @@ -212,13 +302,13 @@ static inline void mavlink_msg_serial_control_send_struct(mavlink_channel_t chan #if MAVLINK_MSG_ID_SERIAL_CONTROL_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_serial_control_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t device, uint8_t flags, uint16_t timeout, uint32_t baudrate, uint8_t count, const uint8_t *data) +static inline void mavlink_msg_serial_control_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t device, uint8_t flags, uint16_t timeout, uint32_t baudrate, uint8_t count, const uint8_t *data, uint8_t target_system, uint8_t target_component) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; @@ -227,6 +317,8 @@ static inline void mavlink_msg_serial_control_send_buf(mavlink_message_t *msgbuf _mav_put_uint8_t(buf, 6, device); _mav_put_uint8_t(buf, 7, flags); _mav_put_uint8_t(buf, 8, count); + _mav_put_uint8_t(buf, 79, target_system); + _mav_put_uint8_t(buf, 80, target_component); _mav_put_uint8_t_array(buf, 9, data, 70); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_CONTROL, buf, MAVLINK_MSG_ID_SERIAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_SERIAL_CONTROL_LEN, MAVLINK_MSG_ID_SERIAL_CONTROL_CRC); #else @@ -236,7 +328,9 @@ static inline void mavlink_msg_serial_control_send_buf(mavlink_message_t *msgbuf packet->device = device; packet->flags = flags; packet->count = count; - mav_array_memcpy(packet->data, data, sizeof(uint8_t)*70); + packet->target_system = target_system; + packet->target_component = target_component; + mav_array_assign_uint8_t(packet->data, data, 70); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_CONTROL, (const char *)packet, MAVLINK_MSG_ID_SERIAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_SERIAL_CONTROL_LEN, MAVLINK_MSG_ID_SERIAL_CONTROL_CRC); #endif } @@ -307,6 +401,26 @@ static inline uint16_t mavlink_msg_serial_control_get_data(const mavlink_message return _MAV_RETURN_uint8_t_array(msg, data, 70, 9); } +/** + * @brief Get field target_system from serial_control message + * + * @return System ID + */ +static inline uint8_t mavlink_msg_serial_control_get_target_system(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 79); +} + +/** + * @brief Get field target_component from serial_control message + * + * @return Component ID + */ +static inline uint8_t mavlink_msg_serial_control_get_target_component(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 80); +} + /** * @brief Decode a serial_control message into a struct * @@ -322,6 +436,8 @@ static inline void mavlink_msg_serial_control_decode(const mavlink_message_t* ms serial_control->flags = mavlink_msg_serial_control_get_flags(msg); serial_control->count = mavlink_msg_serial_control_get_count(msg); mavlink_msg_serial_control_get_data(msg, serial_control->data); + serial_control->target_system = mavlink_msg_serial_control_get_target_system(msg); + serial_control->target_component = mavlink_msg_serial_control_get_target_component(msg); #else uint8_t len = msg->len < MAVLINK_MSG_ID_SERIAL_CONTROL_LEN? msg->len : MAVLINK_MSG_ID_SERIAL_CONTROL_LEN; memset(serial_control, 0, MAVLINK_MSG_ID_SERIAL_CONTROL_LEN); diff --git a/common/mavlink_msg_servo_output_raw.h b/common/mavlink_msg_servo_output_raw.h index 4b76d20a8..92cf5f95f 100644 --- a/common/mavlink_msg_servo_output_raw.h +++ b/common/mavlink_msg_servo_output_raw.h @@ -165,6 +165,90 @@ static inline uint16_t mavlink_msg_servo_output_raw_pack(uint8_t system_id, uint return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_MIN_LEN, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_CRC); } +/** + * @brief Pack a servo_output_raw message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param port Servo output port (set of 8 outputs = 1 port). Flight stacks running on Pixhawk should use: 0 = MAIN, 1 = AUX. + * @param servo1_raw [us] Servo output 1 value + * @param servo2_raw [us] Servo output 2 value + * @param servo3_raw [us] Servo output 3 value + * @param servo4_raw [us] Servo output 4 value + * @param servo5_raw [us] Servo output 5 value + * @param servo6_raw [us] Servo output 6 value + * @param servo7_raw [us] Servo output 7 value + * @param servo8_raw [us] Servo output 8 value + * @param servo9_raw [us] Servo output 9 value + * @param servo10_raw [us] Servo output 10 value + * @param servo11_raw [us] Servo output 11 value + * @param servo12_raw [us] Servo output 12 value + * @param servo13_raw [us] Servo output 13 value + * @param servo14_raw [us] Servo output 14 value + * @param servo15_raw [us] Servo output 15 value + * @param servo16_raw [us] Servo output 16 value + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_servo_output_raw_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_usec, uint8_t port, uint16_t servo1_raw, uint16_t servo2_raw, uint16_t servo3_raw, uint16_t servo4_raw, uint16_t servo5_raw, uint16_t servo6_raw, uint16_t servo7_raw, uint16_t servo8_raw, uint16_t servo9_raw, uint16_t servo10_raw, uint16_t servo11_raw, uint16_t servo12_raw, uint16_t servo13_raw, uint16_t servo14_raw, uint16_t servo15_raw, uint16_t servo16_raw) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN]; + _mav_put_uint32_t(buf, 0, time_usec); + _mav_put_uint16_t(buf, 4, servo1_raw); + _mav_put_uint16_t(buf, 6, servo2_raw); + _mav_put_uint16_t(buf, 8, servo3_raw); + _mav_put_uint16_t(buf, 10, servo4_raw); + _mav_put_uint16_t(buf, 12, servo5_raw); + _mav_put_uint16_t(buf, 14, servo6_raw); + _mav_put_uint16_t(buf, 16, servo7_raw); + _mav_put_uint16_t(buf, 18, servo8_raw); + _mav_put_uint8_t(buf, 20, port); + _mav_put_uint16_t(buf, 21, servo9_raw); + _mav_put_uint16_t(buf, 23, servo10_raw); + _mav_put_uint16_t(buf, 25, servo11_raw); + _mav_put_uint16_t(buf, 27, servo12_raw); + _mav_put_uint16_t(buf, 29, servo13_raw); + _mav_put_uint16_t(buf, 31, servo14_raw); + _mav_put_uint16_t(buf, 33, servo15_raw); + _mav_put_uint16_t(buf, 35, servo16_raw); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN); +#else + mavlink_servo_output_raw_t packet; + packet.time_usec = time_usec; + packet.servo1_raw = servo1_raw; + packet.servo2_raw = servo2_raw; + packet.servo3_raw = servo3_raw; + packet.servo4_raw = servo4_raw; + packet.servo5_raw = servo5_raw; + packet.servo6_raw = servo6_raw; + packet.servo7_raw = servo7_raw; + packet.servo8_raw = servo8_raw; + packet.port = port; + packet.servo9_raw = servo9_raw; + packet.servo10_raw = servo10_raw; + packet.servo11_raw = servo11_raw; + packet.servo12_raw = servo12_raw; + packet.servo13_raw = servo13_raw; + packet.servo14_raw = servo14_raw; + packet.servo15_raw = servo15_raw; + packet.servo16_raw = servo16_raw; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_SERVO_OUTPUT_RAW; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_MIN_LEN, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_MIN_LEN, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN); +#endif +} + /** * @brief Pack a servo_output_raw message on a channel * @param system_id ID of this system @@ -272,6 +356,20 @@ static inline uint16_t mavlink_msg_servo_output_raw_encode_chan(uint8_t system_i return mavlink_msg_servo_output_raw_pack_chan(system_id, component_id, chan, msg, servo_output_raw->time_usec, servo_output_raw->port, servo_output_raw->servo1_raw, servo_output_raw->servo2_raw, servo_output_raw->servo3_raw, servo_output_raw->servo4_raw, servo_output_raw->servo5_raw, servo_output_raw->servo6_raw, servo_output_raw->servo7_raw, servo_output_raw->servo8_raw, servo_output_raw->servo9_raw, servo_output_raw->servo10_raw, servo_output_raw->servo11_raw, servo_output_raw->servo12_raw, servo_output_raw->servo13_raw, servo_output_raw->servo14_raw, servo_output_raw->servo15_raw, servo_output_raw->servo16_raw); } +/** + * @brief Encode a servo_output_raw struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param servo_output_raw C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_servo_output_raw_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_servo_output_raw_t* servo_output_raw) +{ + return mavlink_msg_servo_output_raw_pack_status(system_id, component_id, _status, msg, servo_output_raw->time_usec, servo_output_raw->port, servo_output_raw->servo1_raw, servo_output_raw->servo2_raw, servo_output_raw->servo3_raw, servo_output_raw->servo4_raw, servo_output_raw->servo5_raw, servo_output_raw->servo6_raw, servo_output_raw->servo7_raw, servo_output_raw->servo8_raw, servo_output_raw->servo9_raw, servo_output_raw->servo10_raw, servo_output_raw->servo11_raw, servo_output_raw->servo12_raw, servo_output_raw->servo13_raw, servo_output_raw->servo14_raw, servo_output_raw->servo15_raw, servo_output_raw->servo16_raw); +} + /** * @brief Send a servo_output_raw message * @param chan MAVLink channel to send the message @@ -362,7 +460,7 @@ static inline void mavlink_msg_servo_output_raw_send_struct(mavlink_channel_t ch #if MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_set_actuator_control_target.h b/common/mavlink_msg_set_actuator_control_target.h index 7d21dac9d..ee24edd6e 100644 --- a/common/mavlink_msg_set_actuator_control_target.h +++ b/common/mavlink_msg_set_actuator_control_target.h @@ -77,7 +77,7 @@ static inline uint16_t mavlink_msg_set_actuator_control_target_pack(uint8_t syst packet.group_mlx = group_mlx; packet.target_system = target_system; packet.target_component = target_component; - mav_array_memcpy(packet.controls, controls, sizeof(float)*8); + mav_array_assign_float(packet.controls, controls, 8); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_LEN); #endif @@ -85,6 +85,49 @@ static inline uint16_t mavlink_msg_set_actuator_control_target_pack(uint8_t syst return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_MIN_LEN, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_CRC); } +/** + * @brief Pack a set_actuator_control_target message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param group_mlx Actuator group. The "_mlx" indicates this is a multi-instance message and a MAVLink parser should use this field to difference between instances. + * @param target_system System ID + * @param target_component Component ID + * @param controls Actuator controls. Normed to -1..+1 where 0 is neutral position. Throttle for single rotation direction motors is 0..1, negative range for reverse direction. Standard mapping for attitude controls (group 0): (index 0-7): roll, pitch, yaw, throttle, flaps, spoilers, airbrakes, landing gear. Load a pass-through mixer to repurpose them as generic outputs. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_set_actuator_control_target_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, uint8_t group_mlx, uint8_t target_system, uint8_t target_component, const float *controls) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint8_t(buf, 40, group_mlx); + _mav_put_uint8_t(buf, 41, target_system); + _mav_put_uint8_t(buf, 42, target_component); + _mav_put_float_array(buf, 8, controls, 8); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_LEN); +#else + mavlink_set_actuator_control_target_t packet; + packet.time_usec = time_usec; + packet.group_mlx = group_mlx; + packet.target_system = target_system; + packet.target_component = target_component; + mav_array_memcpy(packet.controls, controls, sizeof(float)*8); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_MIN_LEN, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_MIN_LEN, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_LEN); +#endif +} + /** * @brief Pack a set_actuator_control_target message on a channel * @param system_id ID of this system @@ -116,7 +159,7 @@ static inline uint16_t mavlink_msg_set_actuator_control_target_pack_chan(uint8_t packet.group_mlx = group_mlx; packet.target_system = target_system; packet.target_component = target_component; - mav_array_memcpy(packet.controls, controls, sizeof(float)*8); + mav_array_assign_float(packet.controls, controls, 8); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_LEN); #endif @@ -151,6 +194,20 @@ static inline uint16_t mavlink_msg_set_actuator_control_target_encode_chan(uint8 return mavlink_msg_set_actuator_control_target_pack_chan(system_id, component_id, chan, msg, set_actuator_control_target->time_usec, set_actuator_control_target->group_mlx, set_actuator_control_target->target_system, set_actuator_control_target->target_component, set_actuator_control_target->controls); } +/** + * @brief Encode a set_actuator_control_target struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param set_actuator_control_target C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_set_actuator_control_target_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_set_actuator_control_target_t* set_actuator_control_target) +{ + return mavlink_msg_set_actuator_control_target_pack_status(system_id, component_id, _status, msg, set_actuator_control_target->time_usec, set_actuator_control_target->group_mlx, set_actuator_control_target->target_system, set_actuator_control_target->target_component, set_actuator_control_target->controls); +} + /** * @brief Send a set_actuator_control_target message * @param chan MAVLink channel to send the message @@ -179,7 +236,7 @@ static inline void mavlink_msg_set_actuator_control_target_send(mavlink_channel_ packet.group_mlx = group_mlx; packet.target_system = target_system; packet.target_component = target_component; - mav_array_memcpy(packet.controls, controls, sizeof(float)*8); + mav_array_assign_float(packet.controls, controls, 8); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET, (const char *)&packet, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_MIN_LEN, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_CRC); #endif } @@ -200,7 +257,7 @@ static inline void mavlink_msg_set_actuator_control_target_send_struct(mavlink_c #if MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -222,7 +279,7 @@ static inline void mavlink_msg_set_actuator_control_target_send_buf(mavlink_mess packet->group_mlx = group_mlx; packet->target_system = target_system; packet->target_component = target_component; - mav_array_memcpy(packet->controls, controls, sizeof(float)*8); + mav_array_assign_float(packet->controls, controls, 8); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET, (const char *)packet, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_MIN_LEN, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_CRC); #endif } diff --git a/common/mavlink_msg_set_attitude_target.h b/common/mavlink_msg_set_attitude_target.h index df1e851eb..e9ed2e044 100644 --- a/common/mavlink_msg_set_attitude_target.h +++ b/common/mavlink_msg_set_attitude_target.h @@ -3,10 +3,10 @@ #define MAVLINK_MSG_ID_SET_ATTITUDE_TARGET 82 - +MAVPACKED( typedef struct __mavlink_set_attitude_target_t { uint32_t time_boot_ms; /*< [ms] Timestamp (time since system boot).*/ - float q[4]; /*< Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0)*/ + float q[4]; /*< Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) from MAV_FRAME_LOCAL_NED to MAV_FRAME_BODY_FRD*/ float body_roll_rate; /*< [rad/s] Body roll rate*/ float body_pitch_rate; /*< [rad/s] Body pitch rate*/ float body_yaw_rate; /*< [rad/s] Body yaw rate*/ @@ -14,23 +14,25 @@ typedef struct __mavlink_set_attitude_target_t { uint8_t target_system; /*< System ID*/ uint8_t target_component; /*< Component ID*/ uint8_t type_mask; /*< Bitmap to indicate which dimensions should be ignored by the vehicle.*/ -} mavlink_set_attitude_target_t; + float thrust_body[3]; /*< 3D thrust setpoint in the body NED frame, normalized to -1 .. 1*/ +}) mavlink_set_attitude_target_t; -#define MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN 39 +#define MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN 51 #define MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_MIN_LEN 39 -#define MAVLINK_MSG_ID_82_LEN 39 +#define MAVLINK_MSG_ID_82_LEN 51 #define MAVLINK_MSG_ID_82_MIN_LEN 39 #define MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_CRC 49 #define MAVLINK_MSG_ID_82_CRC 49 #define MAVLINK_MSG_SET_ATTITUDE_TARGET_FIELD_Q_LEN 4 +#define MAVLINK_MSG_SET_ATTITUDE_TARGET_FIELD_THRUST_BODY_LEN 3 #if MAVLINK_COMMAND_24BIT #define MAVLINK_MESSAGE_INFO_SET_ATTITUDE_TARGET { \ 82, \ "SET_ATTITUDE_TARGET", \ - 9, \ + 10, \ { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_set_attitude_target_t, time_boot_ms) }, \ { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_set_attitude_target_t, target_system) }, \ { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 37, offsetof(mavlink_set_attitude_target_t, target_component) }, \ @@ -40,12 +42,13 @@ typedef struct __mavlink_set_attitude_target_t { { "body_pitch_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_set_attitude_target_t, body_pitch_rate) }, \ { "body_yaw_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_set_attitude_target_t, body_yaw_rate) }, \ { "thrust", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_set_attitude_target_t, thrust) }, \ + { "thrust_body", NULL, MAVLINK_TYPE_FLOAT, 3, 39, offsetof(mavlink_set_attitude_target_t, thrust_body) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_SET_ATTITUDE_TARGET { \ "SET_ATTITUDE_TARGET", \ - 9, \ + 10, \ { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_set_attitude_target_t, time_boot_ms) }, \ { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_set_attitude_target_t, target_system) }, \ { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 37, offsetof(mavlink_set_attitude_target_t, target_component) }, \ @@ -55,6 +58,7 @@ typedef struct __mavlink_set_attitude_target_t { { "body_pitch_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_set_attitude_target_t, body_pitch_rate) }, \ { "body_yaw_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_set_attitude_target_t, body_yaw_rate) }, \ { "thrust", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_set_attitude_target_t, thrust) }, \ + { "thrust_body", NULL, MAVLINK_TYPE_FLOAT, 3, 39, offsetof(mavlink_set_attitude_target_t, thrust_body) }, \ } \ } #endif @@ -69,15 +73,16 @@ typedef struct __mavlink_set_attitude_target_t { * @param target_system System ID * @param target_component Component ID * @param type_mask Bitmap to indicate which dimensions should be ignored by the vehicle. - * @param q Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) + * @param q Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) from MAV_FRAME_LOCAL_NED to MAV_FRAME_BODY_FRD * @param body_roll_rate [rad/s] Body roll rate * @param body_pitch_rate [rad/s] Body pitch rate * @param body_yaw_rate [rad/s] Body yaw rate * @param thrust Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse trust) + * @param thrust_body 3D thrust setpoint in the body NED frame, normalized to -1 .. 1 * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_set_attitude_target_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint32_t time_boot_ms, uint8_t target_system, uint8_t target_component, uint8_t type_mask, const float *q, float body_roll_rate, float body_pitch_rate, float body_yaw_rate, float thrust) + uint32_t time_boot_ms, uint8_t target_system, uint8_t target_component, uint8_t type_mask, const float *q, float body_roll_rate, float body_pitch_rate, float body_yaw_rate, float thrust, const float *thrust_body) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN]; @@ -90,6 +95,7 @@ static inline uint16_t mavlink_msg_set_attitude_target_pack(uint8_t system_id, u _mav_put_uint8_t(buf, 37, target_component); _mav_put_uint8_t(buf, 38, type_mask); _mav_put_float_array(buf, 4, q, 4); + _mav_put_float_array(buf, 39, thrust_body, 3); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN); #else mavlink_set_attitude_target_t packet; @@ -101,7 +107,8 @@ static inline uint16_t mavlink_msg_set_attitude_target_pack(uint8_t system_id, u packet.target_system = target_system; packet.target_component = target_component; packet.type_mask = type_mask; - mav_array_memcpy(packet.q, q, sizeof(float)*4); + mav_array_assign_float(packet.q, q, 4); + mav_array_assign_float(packet.thrust_body, thrust_body, 3); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN); #endif @@ -109,6 +116,64 @@ static inline uint16_t mavlink_msg_set_attitude_target_pack(uint8_t system_id, u return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_MIN_LEN, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_CRC); } +/** + * @brief Pack a set_attitude_target message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param target_system System ID + * @param target_component Component ID + * @param type_mask Bitmap to indicate which dimensions should be ignored by the vehicle. + * @param q Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) from MAV_FRAME_LOCAL_NED to MAV_FRAME_BODY_FRD + * @param body_roll_rate [rad/s] Body roll rate + * @param body_pitch_rate [rad/s] Body pitch rate + * @param body_yaw_rate [rad/s] Body yaw rate + * @param thrust Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse trust) + * @param thrust_body 3D thrust setpoint in the body NED frame, normalized to -1 .. 1 + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_set_attitude_target_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, uint8_t target_system, uint8_t target_component, uint8_t type_mask, const float *q, float body_roll_rate, float body_pitch_rate, float body_yaw_rate, float thrust, const float *thrust_body) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_float(buf, 20, body_roll_rate); + _mav_put_float(buf, 24, body_pitch_rate); + _mav_put_float(buf, 28, body_yaw_rate); + _mav_put_float(buf, 32, thrust); + _mav_put_uint8_t(buf, 36, target_system); + _mav_put_uint8_t(buf, 37, target_component); + _mav_put_uint8_t(buf, 38, type_mask); + _mav_put_float_array(buf, 4, q, 4); + _mav_put_float_array(buf, 39, thrust_body, 3); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN); +#else + mavlink_set_attitude_target_t packet; + packet.time_boot_ms = time_boot_ms; + packet.body_roll_rate = body_roll_rate; + packet.body_pitch_rate = body_pitch_rate; + packet.body_yaw_rate = body_yaw_rate; + packet.thrust = thrust; + packet.target_system = target_system; + packet.target_component = target_component; + packet.type_mask = type_mask; + mav_array_memcpy(packet.q, q, sizeof(float)*4); + mav_array_memcpy(packet.thrust_body, thrust_body, sizeof(float)*3); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_SET_ATTITUDE_TARGET; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_MIN_LEN, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_MIN_LEN, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN); +#endif +} + /** * @brief Pack a set_attitude_target message on a channel * @param system_id ID of this system @@ -119,16 +184,17 @@ static inline uint16_t mavlink_msg_set_attitude_target_pack(uint8_t system_id, u * @param target_system System ID * @param target_component Component ID * @param type_mask Bitmap to indicate which dimensions should be ignored by the vehicle. - * @param q Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) + * @param q Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) from MAV_FRAME_LOCAL_NED to MAV_FRAME_BODY_FRD * @param body_roll_rate [rad/s] Body roll rate * @param body_pitch_rate [rad/s] Body pitch rate * @param body_yaw_rate [rad/s] Body yaw rate * @param thrust Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse trust) + * @param thrust_body 3D thrust setpoint in the body NED frame, normalized to -1 .. 1 * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_set_attitude_target_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - uint32_t time_boot_ms,uint8_t target_system,uint8_t target_component,uint8_t type_mask,const float *q,float body_roll_rate,float body_pitch_rate,float body_yaw_rate,float thrust) + uint32_t time_boot_ms,uint8_t target_system,uint8_t target_component,uint8_t type_mask,const float *q,float body_roll_rate,float body_pitch_rate,float body_yaw_rate,float thrust,const float *thrust_body) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN]; @@ -141,6 +207,7 @@ static inline uint16_t mavlink_msg_set_attitude_target_pack_chan(uint8_t system_ _mav_put_uint8_t(buf, 37, target_component); _mav_put_uint8_t(buf, 38, type_mask); _mav_put_float_array(buf, 4, q, 4); + _mav_put_float_array(buf, 39, thrust_body, 3); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN); #else mavlink_set_attitude_target_t packet; @@ -152,7 +219,8 @@ static inline uint16_t mavlink_msg_set_attitude_target_pack_chan(uint8_t system_ packet.target_system = target_system; packet.target_component = target_component; packet.type_mask = type_mask; - mav_array_memcpy(packet.q, q, sizeof(float)*4); + mav_array_assign_float(packet.q, q, 4); + mav_array_assign_float(packet.thrust_body, thrust_body, 3); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN); #endif @@ -170,7 +238,7 @@ static inline uint16_t mavlink_msg_set_attitude_target_pack_chan(uint8_t system_ */ static inline uint16_t mavlink_msg_set_attitude_target_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_set_attitude_target_t* set_attitude_target) { - return mavlink_msg_set_attitude_target_pack(system_id, component_id, msg, set_attitude_target->time_boot_ms, set_attitude_target->target_system, set_attitude_target->target_component, set_attitude_target->type_mask, set_attitude_target->q, set_attitude_target->body_roll_rate, set_attitude_target->body_pitch_rate, set_attitude_target->body_yaw_rate, set_attitude_target->thrust); + return mavlink_msg_set_attitude_target_pack(system_id, component_id, msg, set_attitude_target->time_boot_ms, set_attitude_target->target_system, set_attitude_target->target_component, set_attitude_target->type_mask, set_attitude_target->q, set_attitude_target->body_roll_rate, set_attitude_target->body_pitch_rate, set_attitude_target->body_yaw_rate, set_attitude_target->thrust, set_attitude_target->thrust_body); } /** @@ -184,7 +252,21 @@ static inline uint16_t mavlink_msg_set_attitude_target_encode(uint8_t system_id, */ static inline uint16_t mavlink_msg_set_attitude_target_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_set_attitude_target_t* set_attitude_target) { - return mavlink_msg_set_attitude_target_pack_chan(system_id, component_id, chan, msg, set_attitude_target->time_boot_ms, set_attitude_target->target_system, set_attitude_target->target_component, set_attitude_target->type_mask, set_attitude_target->q, set_attitude_target->body_roll_rate, set_attitude_target->body_pitch_rate, set_attitude_target->body_yaw_rate, set_attitude_target->thrust); + return mavlink_msg_set_attitude_target_pack_chan(system_id, component_id, chan, msg, set_attitude_target->time_boot_ms, set_attitude_target->target_system, set_attitude_target->target_component, set_attitude_target->type_mask, set_attitude_target->q, set_attitude_target->body_roll_rate, set_attitude_target->body_pitch_rate, set_attitude_target->body_yaw_rate, set_attitude_target->thrust, set_attitude_target->thrust_body); +} + +/** + * @brief Encode a set_attitude_target struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param set_attitude_target C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_set_attitude_target_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_set_attitude_target_t* set_attitude_target) +{ + return mavlink_msg_set_attitude_target_pack_status(system_id, component_id, _status, msg, set_attitude_target->time_boot_ms, set_attitude_target->target_system, set_attitude_target->target_component, set_attitude_target->type_mask, set_attitude_target->q, set_attitude_target->body_roll_rate, set_attitude_target->body_pitch_rate, set_attitude_target->body_yaw_rate, set_attitude_target->thrust, set_attitude_target->thrust_body); } /** @@ -195,15 +277,16 @@ static inline uint16_t mavlink_msg_set_attitude_target_encode_chan(uint8_t syste * @param target_system System ID * @param target_component Component ID * @param type_mask Bitmap to indicate which dimensions should be ignored by the vehicle. - * @param q Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) + * @param q Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) from MAV_FRAME_LOCAL_NED to MAV_FRAME_BODY_FRD * @param body_roll_rate [rad/s] Body roll rate * @param body_pitch_rate [rad/s] Body pitch rate * @param body_yaw_rate [rad/s] Body yaw rate * @param thrust Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse trust) + * @param thrust_body 3D thrust setpoint in the body NED frame, normalized to -1 .. 1 */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_set_attitude_target_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t target_system, uint8_t target_component, uint8_t type_mask, const float *q, float body_roll_rate, float body_pitch_rate, float body_yaw_rate, float thrust) +static inline void mavlink_msg_set_attitude_target_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t target_system, uint8_t target_component, uint8_t type_mask, const float *q, float body_roll_rate, float body_pitch_rate, float body_yaw_rate, float thrust, const float *thrust_body) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN]; @@ -216,6 +299,7 @@ static inline void mavlink_msg_set_attitude_target_send(mavlink_channel_t chan, _mav_put_uint8_t(buf, 37, target_component); _mav_put_uint8_t(buf, 38, type_mask); _mav_put_float_array(buf, 4, q, 4); + _mav_put_float_array(buf, 39, thrust_body, 3); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET, buf, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_MIN_LEN, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_CRC); #else mavlink_set_attitude_target_t packet; @@ -227,7 +311,8 @@ static inline void mavlink_msg_set_attitude_target_send(mavlink_channel_t chan, packet.target_system = target_system; packet.target_component = target_component; packet.type_mask = type_mask; - mav_array_memcpy(packet.q, q, sizeof(float)*4); + mav_array_assign_float(packet.q, q, 4); + mav_array_assign_float(packet.thrust_body, thrust_body, 3); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET, (const char *)&packet, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_MIN_LEN, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_CRC); #endif } @@ -240,7 +325,7 @@ static inline void mavlink_msg_set_attitude_target_send(mavlink_channel_t chan, static inline void mavlink_msg_set_attitude_target_send_struct(mavlink_channel_t chan, const mavlink_set_attitude_target_t* set_attitude_target) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_set_attitude_target_send(chan, set_attitude_target->time_boot_ms, set_attitude_target->target_system, set_attitude_target->target_component, set_attitude_target->type_mask, set_attitude_target->q, set_attitude_target->body_roll_rate, set_attitude_target->body_pitch_rate, set_attitude_target->body_yaw_rate, set_attitude_target->thrust); + mavlink_msg_set_attitude_target_send(chan, set_attitude_target->time_boot_ms, set_attitude_target->target_system, set_attitude_target->target_component, set_attitude_target->type_mask, set_attitude_target->q, set_attitude_target->body_roll_rate, set_attitude_target->body_pitch_rate, set_attitude_target->body_yaw_rate, set_attitude_target->thrust, set_attitude_target->thrust_body); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET, (const char *)set_attitude_target, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_MIN_LEN, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_CRC); #endif @@ -248,13 +333,13 @@ static inline void mavlink_msg_set_attitude_target_send_struct(mavlink_channel_t #if MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_set_attitude_target_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t target_system, uint8_t target_component, uint8_t type_mask, const float *q, float body_roll_rate, float body_pitch_rate, float body_yaw_rate, float thrust) +static inline void mavlink_msg_set_attitude_target_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t target_system, uint8_t target_component, uint8_t type_mask, const float *q, float body_roll_rate, float body_pitch_rate, float body_yaw_rate, float thrust, const float *thrust_body) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; @@ -267,6 +352,7 @@ static inline void mavlink_msg_set_attitude_target_send_buf(mavlink_message_t *m _mav_put_uint8_t(buf, 37, target_component); _mav_put_uint8_t(buf, 38, type_mask); _mav_put_float_array(buf, 4, q, 4); + _mav_put_float_array(buf, 39, thrust_body, 3); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET, buf, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_MIN_LEN, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_CRC); #else mavlink_set_attitude_target_t *packet = (mavlink_set_attitude_target_t *)msgbuf; @@ -278,7 +364,8 @@ static inline void mavlink_msg_set_attitude_target_send_buf(mavlink_message_t *m packet->target_system = target_system; packet->target_component = target_component; packet->type_mask = type_mask; - mav_array_memcpy(packet->q, q, sizeof(float)*4); + mav_array_assign_float(packet->q, q, 4); + mav_array_assign_float(packet->thrust_body, thrust_body, 3); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET, (const char *)packet, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_MIN_LEN, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_CRC); #endif } @@ -332,7 +419,7 @@ static inline uint8_t mavlink_msg_set_attitude_target_get_type_mask(const mavlin /** * @brief Get field q from set_attitude_target message * - * @return Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) + * @return Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) from MAV_FRAME_LOCAL_NED to MAV_FRAME_BODY_FRD */ static inline uint16_t mavlink_msg_set_attitude_target_get_q(const mavlink_message_t* msg, float *q) { @@ -379,6 +466,16 @@ static inline float mavlink_msg_set_attitude_target_get_thrust(const mavlink_mes return _MAV_RETURN_float(msg, 32); } +/** + * @brief Get field thrust_body from set_attitude_target message + * + * @return 3D thrust setpoint in the body NED frame, normalized to -1 .. 1 + */ +static inline uint16_t mavlink_msg_set_attitude_target_get_thrust_body(const mavlink_message_t* msg, float *thrust_body) +{ + return _MAV_RETURN_float_array(msg, thrust_body, 3, 39); +} + /** * @brief Decode a set_attitude_target message into a struct * @@ -397,6 +494,7 @@ static inline void mavlink_msg_set_attitude_target_decode(const mavlink_message_ set_attitude_target->target_system = mavlink_msg_set_attitude_target_get_target_system(msg); set_attitude_target->target_component = mavlink_msg_set_attitude_target_get_target_component(msg); set_attitude_target->type_mask = mavlink_msg_set_attitude_target_get_type_mask(msg); + mavlink_msg_set_attitude_target_get_thrust_body(msg, set_attitude_target->thrust_body); #else uint8_t len = msg->len < MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN? msg->len : MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN; memset(set_attitude_target, 0, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN); diff --git a/common/mavlink_msg_set_gps_global_origin.h b/common/mavlink_msg_set_gps_global_origin.h index 62a2f448f..ddee55703 100644 --- a/common/mavlink_msg_set_gps_global_origin.h +++ b/common/mavlink_msg_set_gps_global_origin.h @@ -87,6 +87,51 @@ static inline uint16_t mavlink_msg_set_gps_global_origin_pack(uint8_t system_id, return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_MIN_LEN, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_CRC); } +/** + * @brief Pack a set_gps_global_origin message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param latitude [degE7] Latitude (WGS84) + * @param longitude [degE7] Longitude (WGS84) + * @param altitude [mm] Altitude (MSL). Positive for up. + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_set_gps_global_origin_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, int32_t latitude, int32_t longitude, int32_t altitude, uint64_t time_usec) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN]; + _mav_put_int32_t(buf, 0, latitude); + _mav_put_int32_t(buf, 4, longitude); + _mav_put_int32_t(buf, 8, altitude); + _mav_put_uint8_t(buf, 12, target_system); + _mav_put_uint64_t(buf, 13, time_usec); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN); +#else + mavlink_set_gps_global_origin_t packet; + packet.latitude = latitude; + packet.longitude = longitude; + packet.altitude = altitude; + packet.target_system = target_system; + packet.time_usec = time_usec; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_MIN_LEN, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_MIN_LEN, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN); +#endif +} + /** * @brief Pack a set_gps_global_origin message on a channel * @param system_id ID of this system @@ -155,6 +200,20 @@ static inline uint16_t mavlink_msg_set_gps_global_origin_encode_chan(uint8_t sys return mavlink_msg_set_gps_global_origin_pack_chan(system_id, component_id, chan, msg, set_gps_global_origin->target_system, set_gps_global_origin->latitude, set_gps_global_origin->longitude, set_gps_global_origin->altitude, set_gps_global_origin->time_usec); } +/** + * @brief Encode a set_gps_global_origin struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param set_gps_global_origin C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_set_gps_global_origin_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_set_gps_global_origin_t* set_gps_global_origin) +{ + return mavlink_msg_set_gps_global_origin_pack_status(system_id, component_id, _status, msg, set_gps_global_origin->target_system, set_gps_global_origin->latitude, set_gps_global_origin->longitude, set_gps_global_origin->altitude, set_gps_global_origin->time_usec); +} + /** * @brief Send a set_gps_global_origin message * @param chan MAVLink channel to send the message @@ -206,7 +265,7 @@ static inline void mavlink_msg_set_gps_global_origin_send_struct(mavlink_channel #if MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_set_home_position.h b/common/mavlink_msg_set_home_position.h index ea7d2d0f2..e7c22e96c 100644 --- a/common/mavlink_msg_set_home_position.h +++ b/common/mavlink_msg_set_home_position.h @@ -8,9 +8,9 @@ typedef struct __mavlink_set_home_position_t { int32_t latitude; /*< [degE7] Latitude (WGS84)*/ int32_t longitude; /*< [degE7] Longitude (WGS84)*/ int32_t altitude; /*< [mm] Altitude (MSL). Positive for up.*/ - float x; /*< [m] Local X position of this position in the local coordinate frame*/ - float y; /*< [m] Local Y position of this position in the local coordinate frame*/ - float z; /*< [m] Local Z position of this position in the local coordinate frame*/ + float x; /*< [m] Local X position of this position in the local coordinate frame (NED)*/ + float y; /*< [m] Local Y position of this position in the local coordinate frame (NED)*/ + float z; /*< [m] Local Z position of this position in the local coordinate frame (NED: positive "down")*/ float q[4]; /*< World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground*/ float approach_x; /*< [m] Local X position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone.*/ float approach_y; /*< [m] Local Y position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone.*/ @@ -78,9 +78,9 @@ typedef struct __mavlink_set_home_position_t { * @param latitude [degE7] Latitude (WGS84) * @param longitude [degE7] Longitude (WGS84) * @param altitude [mm] Altitude (MSL). Positive for up. - * @param x [m] Local X position of this position in the local coordinate frame - * @param y [m] Local Y position of this position in the local coordinate frame - * @param z [m] Local Z position of this position in the local coordinate frame + * @param x [m] Local X position of this position in the local coordinate frame (NED) + * @param y [m] Local Y position of this position in the local coordinate frame (NED) + * @param z [m] Local Z position of this position in the local coordinate frame (NED: positive "down") * @param q World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground * @param approach_x [m] Local X position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. * @param approach_y [m] Local Y position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. @@ -119,7 +119,7 @@ static inline uint16_t mavlink_msg_set_home_position_pack(uint8_t system_id, uin packet.approach_z = approach_z; packet.target_system = target_system; packet.time_usec = time_usec; - mav_array_memcpy(packet.q, q, sizeof(float)*4); + mav_array_assign_float(packet.q, q, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_HOME_POSITION_LEN); #endif @@ -127,6 +127,70 @@ static inline uint16_t mavlink_msg_set_home_position_pack(uint8_t system_id, uin return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SET_HOME_POSITION_MIN_LEN, MAVLINK_MSG_ID_SET_HOME_POSITION_LEN, MAVLINK_MSG_ID_SET_HOME_POSITION_CRC); } +/** + * @brief Pack a set_home_position message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID. + * @param latitude [degE7] Latitude (WGS84) + * @param longitude [degE7] Longitude (WGS84) + * @param altitude [mm] Altitude (MSL). Positive for up. + * @param x [m] Local X position of this position in the local coordinate frame (NED) + * @param y [m] Local Y position of this position in the local coordinate frame (NED) + * @param z [m] Local Z position of this position in the local coordinate frame (NED: positive "down") + * @param q World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground + * @param approach_x [m] Local X position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. + * @param approach_y [m] Local Y position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. + * @param approach_z [m] Local Z position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_set_home_position_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, int32_t latitude, int32_t longitude, int32_t altitude, float x, float y, float z, const float *q, float approach_x, float approach_y, float approach_z, uint64_t time_usec) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_SET_HOME_POSITION_LEN]; + _mav_put_int32_t(buf, 0, latitude); + _mav_put_int32_t(buf, 4, longitude); + _mav_put_int32_t(buf, 8, altitude); + _mav_put_float(buf, 12, x); + _mav_put_float(buf, 16, y); + _mav_put_float(buf, 20, z); + _mav_put_float(buf, 40, approach_x); + _mav_put_float(buf, 44, approach_y); + _mav_put_float(buf, 48, approach_z); + _mav_put_uint8_t(buf, 52, target_system); + _mav_put_uint64_t(buf, 53, time_usec); + _mav_put_float_array(buf, 24, q, 4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_HOME_POSITION_LEN); +#else + mavlink_set_home_position_t packet; + packet.latitude = latitude; + packet.longitude = longitude; + packet.altitude = altitude; + packet.x = x; + packet.y = y; + packet.z = z; + packet.approach_x = approach_x; + packet.approach_y = approach_y; + packet.approach_z = approach_z; + packet.target_system = target_system; + packet.time_usec = time_usec; + mav_array_memcpy(packet.q, q, sizeof(float)*4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_HOME_POSITION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_SET_HOME_POSITION; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SET_HOME_POSITION_MIN_LEN, MAVLINK_MSG_ID_SET_HOME_POSITION_LEN, MAVLINK_MSG_ID_SET_HOME_POSITION_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SET_HOME_POSITION_MIN_LEN, MAVLINK_MSG_ID_SET_HOME_POSITION_LEN); +#endif +} + /** * @brief Pack a set_home_position message on a channel * @param system_id ID of this system @@ -137,9 +201,9 @@ static inline uint16_t mavlink_msg_set_home_position_pack(uint8_t system_id, uin * @param latitude [degE7] Latitude (WGS84) * @param longitude [degE7] Longitude (WGS84) * @param altitude [mm] Altitude (MSL). Positive for up. - * @param x [m] Local X position of this position in the local coordinate frame - * @param y [m] Local Y position of this position in the local coordinate frame - * @param z [m] Local Z position of this position in the local coordinate frame + * @param x [m] Local X position of this position in the local coordinate frame (NED) + * @param y [m] Local Y position of this position in the local coordinate frame (NED) + * @param z [m] Local Z position of this position in the local coordinate frame (NED: positive "down") * @param q World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground * @param approach_x [m] Local X position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. * @param approach_y [m] Local Y position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. @@ -179,7 +243,7 @@ static inline uint16_t mavlink_msg_set_home_position_pack_chan(uint8_t system_id packet.approach_z = approach_z; packet.target_system = target_system; packet.time_usec = time_usec; - mav_array_memcpy(packet.q, q, sizeof(float)*4); + mav_array_assign_float(packet.q, q, 4); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_HOME_POSITION_LEN); #endif @@ -214,6 +278,20 @@ static inline uint16_t mavlink_msg_set_home_position_encode_chan(uint8_t system_ return mavlink_msg_set_home_position_pack_chan(system_id, component_id, chan, msg, set_home_position->target_system, set_home_position->latitude, set_home_position->longitude, set_home_position->altitude, set_home_position->x, set_home_position->y, set_home_position->z, set_home_position->q, set_home_position->approach_x, set_home_position->approach_y, set_home_position->approach_z, set_home_position->time_usec); } +/** + * @brief Encode a set_home_position struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param set_home_position C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_set_home_position_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_set_home_position_t* set_home_position) +{ + return mavlink_msg_set_home_position_pack_status(system_id, component_id, _status, msg, set_home_position->target_system, set_home_position->latitude, set_home_position->longitude, set_home_position->altitude, set_home_position->x, set_home_position->y, set_home_position->z, set_home_position->q, set_home_position->approach_x, set_home_position->approach_y, set_home_position->approach_z, set_home_position->time_usec); +} + /** * @brief Send a set_home_position message * @param chan MAVLink channel to send the message @@ -222,9 +300,9 @@ static inline uint16_t mavlink_msg_set_home_position_encode_chan(uint8_t system_ * @param latitude [degE7] Latitude (WGS84) * @param longitude [degE7] Longitude (WGS84) * @param altitude [mm] Altitude (MSL). Positive for up. - * @param x [m] Local X position of this position in the local coordinate frame - * @param y [m] Local Y position of this position in the local coordinate frame - * @param z [m] Local Z position of this position in the local coordinate frame + * @param x [m] Local X position of this position in the local coordinate frame (NED) + * @param y [m] Local Y position of this position in the local coordinate frame (NED) + * @param z [m] Local Z position of this position in the local coordinate frame (NED: positive "down") * @param q World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground * @param approach_x [m] Local X position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. * @param approach_y [m] Local Y position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. @@ -263,7 +341,7 @@ static inline void mavlink_msg_set_home_position_send(mavlink_channel_t chan, ui packet.approach_z = approach_z; packet.target_system = target_system; packet.time_usec = time_usec; - mav_array_memcpy(packet.q, q, sizeof(float)*4); + mav_array_assign_float(packet.q, q, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_HOME_POSITION, (const char *)&packet, MAVLINK_MSG_ID_SET_HOME_POSITION_MIN_LEN, MAVLINK_MSG_ID_SET_HOME_POSITION_LEN, MAVLINK_MSG_ID_SET_HOME_POSITION_CRC); #endif } @@ -284,7 +362,7 @@ static inline void mavlink_msg_set_home_position_send_struct(mavlink_channel_t c #if MAVLINK_MSG_ID_SET_HOME_POSITION_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -320,7 +398,7 @@ static inline void mavlink_msg_set_home_position_send_buf(mavlink_message_t *msg packet->approach_z = approach_z; packet->target_system = target_system; packet->time_usec = time_usec; - mav_array_memcpy(packet->q, q, sizeof(float)*4); + mav_array_assign_float(packet->q, q, 4); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_HOME_POSITION, (const char *)packet, MAVLINK_MSG_ID_SET_HOME_POSITION_MIN_LEN, MAVLINK_MSG_ID_SET_HOME_POSITION_LEN, MAVLINK_MSG_ID_SET_HOME_POSITION_CRC); #endif } @@ -374,7 +452,7 @@ static inline int32_t mavlink_msg_set_home_position_get_altitude(const mavlink_m /** * @brief Get field x from set_home_position message * - * @return [m] Local X position of this position in the local coordinate frame + * @return [m] Local X position of this position in the local coordinate frame (NED) */ static inline float mavlink_msg_set_home_position_get_x(const mavlink_message_t* msg) { @@ -384,7 +462,7 @@ static inline float mavlink_msg_set_home_position_get_x(const mavlink_message_t* /** * @brief Get field y from set_home_position message * - * @return [m] Local Y position of this position in the local coordinate frame + * @return [m] Local Y position of this position in the local coordinate frame (NED) */ static inline float mavlink_msg_set_home_position_get_y(const mavlink_message_t* msg) { @@ -394,7 +472,7 @@ static inline float mavlink_msg_set_home_position_get_y(const mavlink_message_t* /** * @brief Get field z from set_home_position message * - * @return [m] Local Z position of this position in the local coordinate frame + * @return [m] Local Z position of this position in the local coordinate frame (NED: positive "down") */ static inline float mavlink_msg_set_home_position_get_z(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_set_mode.h b/common/mavlink_msg_set_mode.h index d2d087452..613f92b55 100644 --- a/common/mavlink_msg_set_mode.h +++ b/common/mavlink_msg_set_mode.h @@ -75,6 +75,45 @@ static inline uint16_t mavlink_msg_set_mode_pack(uint8_t system_id, uint8_t comp return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SET_MODE_MIN_LEN, MAVLINK_MSG_ID_SET_MODE_LEN, MAVLINK_MSG_ID_SET_MODE_CRC); } +/** + * @brief Pack a set_mode message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system The system setting the mode + * @param base_mode The new base mode. + * @param custom_mode The new autopilot-specific mode. This field can be ignored by an autopilot. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_set_mode_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t base_mode, uint32_t custom_mode) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_SET_MODE_LEN]; + _mav_put_uint32_t(buf, 0, custom_mode); + _mav_put_uint8_t(buf, 4, target_system); + _mav_put_uint8_t(buf, 5, base_mode); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_MODE_LEN); +#else + mavlink_set_mode_t packet; + packet.custom_mode = custom_mode; + packet.target_system = target_system; + packet.base_mode = base_mode; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_MODE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_SET_MODE; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SET_MODE_MIN_LEN, MAVLINK_MSG_ID_SET_MODE_LEN, MAVLINK_MSG_ID_SET_MODE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SET_MODE_MIN_LEN, MAVLINK_MSG_ID_SET_MODE_LEN); +#endif +} + /** * @brief Pack a set_mode message on a channel * @param system_id ID of this system @@ -137,6 +176,20 @@ static inline uint16_t mavlink_msg_set_mode_encode_chan(uint8_t system_id, uint8 return mavlink_msg_set_mode_pack_chan(system_id, component_id, chan, msg, set_mode->target_system, set_mode->base_mode, set_mode->custom_mode); } +/** + * @brief Encode a set_mode struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param set_mode C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_set_mode_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_set_mode_t* set_mode) +{ + return mavlink_msg_set_mode_pack_status(system_id, component_id, _status, msg, set_mode->target_system, set_mode->base_mode, set_mode->custom_mode); +} + /** * @brief Send a set_mode message * @param chan MAVLink channel to send the message @@ -182,7 +235,7 @@ static inline void mavlink_msg_set_mode_send_struct(mavlink_channel_t chan, cons #if MAVLINK_MSG_ID_SET_MODE_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_set_position_target_global_int.h b/common/mavlink_msg_set_position_target_global_int.h index 3a1523078..29c4c7015 100644 --- a/common/mavlink_msg_set_position_target_global_int.h +++ b/common/mavlink_msg_set_position_target_global_int.h @@ -6,8 +6,8 @@ typedef struct __mavlink_set_position_target_global_int_t { uint32_t time_boot_ms; /*< [ms] Timestamp (time since system boot). The rationale for the timestamp in the setpoint is to allow the system to compensate for the transport delay of the setpoint. This allows the system to compensate processing latency.*/ - int32_t lat_int; /*< [degE7] X Position in WGS84 frame*/ - int32_t lon_int; /*< [degE7] Y Position in WGS84 frame*/ + int32_t lat_int; /*< [degE7] Latitude in WGS84 frame*/ + int32_t lon_int; /*< [degE7] Longitude in WGS84 frame*/ float alt; /*< [m] Altitude (MSL, Relative to home, or AGL - depending on frame)*/ float vx; /*< [m/s] X velocity in NED frame*/ float vy; /*< [m/s] Y velocity in NED frame*/ @@ -20,7 +20,7 @@ typedef struct __mavlink_set_position_target_global_int_t { uint16_t type_mask; /*< Bitmap to indicate which dimensions should be ignored by the vehicle.*/ uint8_t target_system; /*< System ID*/ uint8_t target_component; /*< Component ID*/ - uint8_t coordinate_frame; /*< Valid options are: MAV_FRAME_GLOBAL_INT = 5, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT = 6, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT = 11*/ + uint8_t coordinate_frame; /*< Valid options are: MAV_FRAME_GLOBAL = 0, MAV_FRAME_GLOBAL_RELATIVE_ALT = 3, MAV_FRAME_GLOBAL_TERRAIN_ALT = 10 (MAV_FRAME_GLOBAL_INT, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT are allowed synonyms, but have been deprecated)*/ } mavlink_set_position_target_global_int_t; #define MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT_LEN 53 @@ -89,10 +89,10 @@ typedef struct __mavlink_set_position_target_global_int_t { * @param time_boot_ms [ms] Timestamp (time since system boot). The rationale for the timestamp in the setpoint is to allow the system to compensate for the transport delay of the setpoint. This allows the system to compensate processing latency. * @param target_system System ID * @param target_component Component ID - * @param coordinate_frame Valid options are: MAV_FRAME_GLOBAL_INT = 5, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT = 6, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT = 11 + * @param coordinate_frame Valid options are: MAV_FRAME_GLOBAL = 0, MAV_FRAME_GLOBAL_RELATIVE_ALT = 3, MAV_FRAME_GLOBAL_TERRAIN_ALT = 10 (MAV_FRAME_GLOBAL_INT, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT are allowed synonyms, but have been deprecated) * @param type_mask Bitmap to indicate which dimensions should be ignored by the vehicle. - * @param lat_int [degE7] X Position in WGS84 frame - * @param lon_int [degE7] Y Position in WGS84 frame + * @param lat_int [degE7] Latitude in WGS84 frame + * @param lon_int [degE7] Longitude in WGS84 frame * @param alt [m] Altitude (MSL, Relative to home, or AGL - depending on frame) * @param vx [m/s] X velocity in NED frame * @param vy [m/s] Y velocity in NED frame @@ -153,6 +153,84 @@ static inline uint16_t mavlink_msg_set_position_target_global_int_pack(uint8_t s return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT_MIN_LEN, MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT_LEN, MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT_CRC); } +/** + * @brief Pack a set_position_target_global_int message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). The rationale for the timestamp in the setpoint is to allow the system to compensate for the transport delay of the setpoint. This allows the system to compensate processing latency. + * @param target_system System ID + * @param target_component Component ID + * @param coordinate_frame Valid options are: MAV_FRAME_GLOBAL = 0, MAV_FRAME_GLOBAL_RELATIVE_ALT = 3, MAV_FRAME_GLOBAL_TERRAIN_ALT = 10 (MAV_FRAME_GLOBAL_INT, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT are allowed synonyms, but have been deprecated) + * @param type_mask Bitmap to indicate which dimensions should be ignored by the vehicle. + * @param lat_int [degE7] Latitude in WGS84 frame + * @param lon_int [degE7] Longitude in WGS84 frame + * @param alt [m] Altitude (MSL, Relative to home, or AGL - depending on frame) + * @param vx [m/s] X velocity in NED frame + * @param vy [m/s] Y velocity in NED frame + * @param vz [m/s] Z velocity in NED frame + * @param afx [m/s/s] X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + * @param afy [m/s/s] Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + * @param afz [m/s/s] Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + * @param yaw [rad] yaw setpoint + * @param yaw_rate [rad/s] yaw rate setpoint + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_set_position_target_global_int_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, uint8_t target_system, uint8_t target_component, uint8_t coordinate_frame, uint16_t type_mask, int32_t lat_int, int32_t lon_int, float alt, float vx, float vy, float vz, float afx, float afy, float afz, float yaw, float yaw_rate) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_int32_t(buf, 4, lat_int); + _mav_put_int32_t(buf, 8, lon_int); + _mav_put_float(buf, 12, alt); + _mav_put_float(buf, 16, vx); + _mav_put_float(buf, 20, vy); + _mav_put_float(buf, 24, vz); + _mav_put_float(buf, 28, afx); + _mav_put_float(buf, 32, afy); + _mav_put_float(buf, 36, afz); + _mav_put_float(buf, 40, yaw); + _mav_put_float(buf, 44, yaw_rate); + _mav_put_uint16_t(buf, 48, type_mask); + _mav_put_uint8_t(buf, 50, target_system); + _mav_put_uint8_t(buf, 51, target_component); + _mav_put_uint8_t(buf, 52, coordinate_frame); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT_LEN); +#else + mavlink_set_position_target_global_int_t packet; + packet.time_boot_ms = time_boot_ms; + packet.lat_int = lat_int; + packet.lon_int = lon_int; + packet.alt = alt; + packet.vx = vx; + packet.vy = vy; + packet.vz = vz; + packet.afx = afx; + packet.afy = afy; + packet.afz = afz; + packet.yaw = yaw; + packet.yaw_rate = yaw_rate; + packet.type_mask = type_mask; + packet.target_system = target_system; + packet.target_component = target_component; + packet.coordinate_frame = coordinate_frame; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT_MIN_LEN, MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT_LEN, MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT_MIN_LEN, MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT_LEN); +#endif +} + /** * @brief Pack a set_position_target_global_int message on a channel * @param system_id ID of this system @@ -162,10 +240,10 @@ static inline uint16_t mavlink_msg_set_position_target_global_int_pack(uint8_t s * @param time_boot_ms [ms] Timestamp (time since system boot). The rationale for the timestamp in the setpoint is to allow the system to compensate for the transport delay of the setpoint. This allows the system to compensate processing latency. * @param target_system System ID * @param target_component Component ID - * @param coordinate_frame Valid options are: MAV_FRAME_GLOBAL_INT = 5, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT = 6, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT = 11 + * @param coordinate_frame Valid options are: MAV_FRAME_GLOBAL = 0, MAV_FRAME_GLOBAL_RELATIVE_ALT = 3, MAV_FRAME_GLOBAL_TERRAIN_ALT = 10 (MAV_FRAME_GLOBAL_INT, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT are allowed synonyms, but have been deprecated) * @param type_mask Bitmap to indicate which dimensions should be ignored by the vehicle. - * @param lat_int [degE7] X Position in WGS84 frame - * @param lon_int [degE7] Y Position in WGS84 frame + * @param lat_int [degE7] Latitude in WGS84 frame + * @param lon_int [degE7] Longitude in WGS84 frame * @param alt [m] Altitude (MSL, Relative to home, or AGL - depending on frame) * @param vx [m/s] X velocity in NED frame * @param vy [m/s] Y velocity in NED frame @@ -254,6 +332,20 @@ static inline uint16_t mavlink_msg_set_position_target_global_int_encode_chan(ui return mavlink_msg_set_position_target_global_int_pack_chan(system_id, component_id, chan, msg, set_position_target_global_int->time_boot_ms, set_position_target_global_int->target_system, set_position_target_global_int->target_component, set_position_target_global_int->coordinate_frame, set_position_target_global_int->type_mask, set_position_target_global_int->lat_int, set_position_target_global_int->lon_int, set_position_target_global_int->alt, set_position_target_global_int->vx, set_position_target_global_int->vy, set_position_target_global_int->vz, set_position_target_global_int->afx, set_position_target_global_int->afy, set_position_target_global_int->afz, set_position_target_global_int->yaw, set_position_target_global_int->yaw_rate); } +/** + * @brief Encode a set_position_target_global_int struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param set_position_target_global_int C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_set_position_target_global_int_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_set_position_target_global_int_t* set_position_target_global_int) +{ + return mavlink_msg_set_position_target_global_int_pack_status(system_id, component_id, _status, msg, set_position_target_global_int->time_boot_ms, set_position_target_global_int->target_system, set_position_target_global_int->target_component, set_position_target_global_int->coordinate_frame, set_position_target_global_int->type_mask, set_position_target_global_int->lat_int, set_position_target_global_int->lon_int, set_position_target_global_int->alt, set_position_target_global_int->vx, set_position_target_global_int->vy, set_position_target_global_int->vz, set_position_target_global_int->afx, set_position_target_global_int->afy, set_position_target_global_int->afz, set_position_target_global_int->yaw, set_position_target_global_int->yaw_rate); +} + /** * @brief Send a set_position_target_global_int message * @param chan MAVLink channel to send the message @@ -261,10 +353,10 @@ static inline uint16_t mavlink_msg_set_position_target_global_int_encode_chan(ui * @param time_boot_ms [ms] Timestamp (time since system boot). The rationale for the timestamp in the setpoint is to allow the system to compensate for the transport delay of the setpoint. This allows the system to compensate processing latency. * @param target_system System ID * @param target_component Component ID - * @param coordinate_frame Valid options are: MAV_FRAME_GLOBAL_INT = 5, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT = 6, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT = 11 + * @param coordinate_frame Valid options are: MAV_FRAME_GLOBAL = 0, MAV_FRAME_GLOBAL_RELATIVE_ALT = 3, MAV_FRAME_GLOBAL_TERRAIN_ALT = 10 (MAV_FRAME_GLOBAL_INT, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT are allowed synonyms, but have been deprecated) * @param type_mask Bitmap to indicate which dimensions should be ignored by the vehicle. - * @param lat_int [degE7] X Position in WGS84 frame - * @param lon_int [degE7] Y Position in WGS84 frame + * @param lat_int [degE7] Latitude in WGS84 frame + * @param lon_int [degE7] Longitude in WGS84 frame * @param alt [m] Altitude (MSL, Relative to home, or AGL - depending on frame) * @param vx [m/s] X velocity in NED frame * @param vy [m/s] Y velocity in NED frame @@ -338,7 +430,7 @@ static inline void mavlink_msg_set_position_target_global_int_send_struct(mavlin #if MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -428,7 +520,7 @@ static inline uint8_t mavlink_msg_set_position_target_global_int_get_target_comp /** * @brief Get field coordinate_frame from set_position_target_global_int message * - * @return Valid options are: MAV_FRAME_GLOBAL_INT = 5, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT = 6, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT = 11 + * @return Valid options are: MAV_FRAME_GLOBAL = 0, MAV_FRAME_GLOBAL_RELATIVE_ALT = 3, MAV_FRAME_GLOBAL_TERRAIN_ALT = 10 (MAV_FRAME_GLOBAL_INT, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT are allowed synonyms, but have been deprecated) */ static inline uint8_t mavlink_msg_set_position_target_global_int_get_coordinate_frame(const mavlink_message_t* msg) { @@ -448,7 +540,7 @@ static inline uint16_t mavlink_msg_set_position_target_global_int_get_type_mask( /** * @brief Get field lat_int from set_position_target_global_int message * - * @return [degE7] X Position in WGS84 frame + * @return [degE7] Latitude in WGS84 frame */ static inline int32_t mavlink_msg_set_position_target_global_int_get_lat_int(const mavlink_message_t* msg) { @@ -458,7 +550,7 @@ static inline int32_t mavlink_msg_set_position_target_global_int_get_lat_int(con /** * @brief Get field lon_int from set_position_target_global_int message * - * @return [degE7] Y Position in WGS84 frame + * @return [degE7] Longitude in WGS84 frame */ static inline int32_t mavlink_msg_set_position_target_global_int_get_lon_int(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_set_position_target_local_ned.h b/common/mavlink_msg_set_position_target_local_ned.h index 4e16b2ab3..3c7256d45 100644 --- a/common/mavlink_msg_set_position_target_local_ned.h +++ b/common/mavlink_msg_set_position_target_local_ned.h @@ -153,6 +153,84 @@ static inline uint16_t mavlink_msg_set_position_target_local_ned_pack(uint8_t sy return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_MIN_LEN, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_LEN, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_CRC); } +/** + * @brief Pack a set_position_target_local_ned message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param target_system System ID + * @param target_component Component ID + * @param coordinate_frame Valid options are: MAV_FRAME_LOCAL_NED = 1, MAV_FRAME_LOCAL_OFFSET_NED = 7, MAV_FRAME_BODY_NED = 8, MAV_FRAME_BODY_OFFSET_NED = 9 + * @param type_mask Bitmap to indicate which dimensions should be ignored by the vehicle. + * @param x [m] X Position in NED frame + * @param y [m] Y Position in NED frame + * @param z [m] Z Position in NED frame (note, altitude is negative in NED) + * @param vx [m/s] X velocity in NED frame + * @param vy [m/s] Y velocity in NED frame + * @param vz [m/s] Z velocity in NED frame + * @param afx [m/s/s] X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + * @param afy [m/s/s] Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + * @param afz [m/s/s] Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + * @param yaw [rad] yaw setpoint + * @param yaw_rate [rad/s] yaw rate setpoint + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_set_position_target_local_ned_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, uint8_t target_system, uint8_t target_component, uint8_t coordinate_frame, uint16_t type_mask, float x, float y, float z, float vx, float vy, float vz, float afx, float afy, float afz, float yaw, float yaw_rate) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_float(buf, 4, x); + _mav_put_float(buf, 8, y); + _mav_put_float(buf, 12, z); + _mav_put_float(buf, 16, vx); + _mav_put_float(buf, 20, vy); + _mav_put_float(buf, 24, vz); + _mav_put_float(buf, 28, afx); + _mav_put_float(buf, 32, afy); + _mav_put_float(buf, 36, afz); + _mav_put_float(buf, 40, yaw); + _mav_put_float(buf, 44, yaw_rate); + _mav_put_uint16_t(buf, 48, type_mask); + _mav_put_uint8_t(buf, 50, target_system); + _mav_put_uint8_t(buf, 51, target_component); + _mav_put_uint8_t(buf, 52, coordinate_frame); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_LEN); +#else + mavlink_set_position_target_local_ned_t packet; + packet.time_boot_ms = time_boot_ms; + packet.x = x; + packet.y = y; + packet.z = z; + packet.vx = vx; + packet.vy = vy; + packet.vz = vz; + packet.afx = afx; + packet.afy = afy; + packet.afz = afz; + packet.yaw = yaw; + packet.yaw_rate = yaw_rate; + packet.type_mask = type_mask; + packet.target_system = target_system; + packet.target_component = target_component; + packet.coordinate_frame = coordinate_frame; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_MIN_LEN, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_LEN, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_MIN_LEN, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_LEN); +#endif +} + /** * @brief Pack a set_position_target_local_ned message on a channel * @param system_id ID of this system @@ -254,6 +332,20 @@ static inline uint16_t mavlink_msg_set_position_target_local_ned_encode_chan(uin return mavlink_msg_set_position_target_local_ned_pack_chan(system_id, component_id, chan, msg, set_position_target_local_ned->time_boot_ms, set_position_target_local_ned->target_system, set_position_target_local_ned->target_component, set_position_target_local_ned->coordinate_frame, set_position_target_local_ned->type_mask, set_position_target_local_ned->x, set_position_target_local_ned->y, set_position_target_local_ned->z, set_position_target_local_ned->vx, set_position_target_local_ned->vy, set_position_target_local_ned->vz, set_position_target_local_ned->afx, set_position_target_local_ned->afy, set_position_target_local_ned->afz, set_position_target_local_ned->yaw, set_position_target_local_ned->yaw_rate); } +/** + * @brief Encode a set_position_target_local_ned struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param set_position_target_local_ned C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_set_position_target_local_ned_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_set_position_target_local_ned_t* set_position_target_local_ned) +{ + return mavlink_msg_set_position_target_local_ned_pack_status(system_id, component_id, _status, msg, set_position_target_local_ned->time_boot_ms, set_position_target_local_ned->target_system, set_position_target_local_ned->target_component, set_position_target_local_ned->coordinate_frame, set_position_target_local_ned->type_mask, set_position_target_local_ned->x, set_position_target_local_ned->y, set_position_target_local_ned->z, set_position_target_local_ned->vx, set_position_target_local_ned->vy, set_position_target_local_ned->vz, set_position_target_local_ned->afx, set_position_target_local_ned->afy, set_position_target_local_ned->afz, set_position_target_local_ned->yaw, set_position_target_local_ned->yaw_rate); +} + /** * @brief Send a set_position_target_local_ned message * @param chan MAVLink channel to send the message @@ -338,7 +430,7 @@ static inline void mavlink_msg_set_position_target_local_ned_send_struct(mavlink #if MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_setup_signing.h b/common/mavlink_msg_setup_signing.h index e9bab0cba..d415fd6bd 100644 --- a/common/mavlink_msg_setup_signing.h +++ b/common/mavlink_msg_setup_signing.h @@ -71,7 +71,7 @@ static inline uint16_t mavlink_msg_setup_signing_pack(uint8_t system_id, uint8_t packet.initial_timestamp = initial_timestamp; packet.target_system = target_system; packet.target_component = target_component; - mav_array_memcpy(packet.secret_key, secret_key, sizeof(uint8_t)*32); + mav_array_assign_uint8_t(packet.secret_key, secret_key, 32); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SETUP_SIGNING_LEN); #endif @@ -79,6 +79,46 @@ static inline uint16_t mavlink_msg_setup_signing_pack(uint8_t system_id, uint8_t return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SETUP_SIGNING_MIN_LEN, MAVLINK_MSG_ID_SETUP_SIGNING_LEN, MAVLINK_MSG_ID_SETUP_SIGNING_CRC); } +/** + * @brief Pack a setup_signing message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system system id of the target + * @param target_component component ID of the target + * @param secret_key signing key + * @param initial_timestamp initial timestamp + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_setup_signing_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, const uint8_t *secret_key, uint64_t initial_timestamp) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_SETUP_SIGNING_LEN]; + _mav_put_uint64_t(buf, 0, initial_timestamp); + _mav_put_uint8_t(buf, 8, target_system); + _mav_put_uint8_t(buf, 9, target_component); + _mav_put_uint8_t_array(buf, 10, secret_key, 32); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SETUP_SIGNING_LEN); +#else + mavlink_setup_signing_t packet; + packet.initial_timestamp = initial_timestamp; + packet.target_system = target_system; + packet.target_component = target_component; + mav_array_memcpy(packet.secret_key, secret_key, sizeof(uint8_t)*32); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SETUP_SIGNING_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_SETUP_SIGNING; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SETUP_SIGNING_MIN_LEN, MAVLINK_MSG_ID_SETUP_SIGNING_LEN, MAVLINK_MSG_ID_SETUP_SIGNING_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SETUP_SIGNING_MIN_LEN, MAVLINK_MSG_ID_SETUP_SIGNING_LEN); +#endif +} + /** * @brief Pack a setup_signing message on a channel * @param system_id ID of this system @@ -107,7 +147,7 @@ static inline uint16_t mavlink_msg_setup_signing_pack_chan(uint8_t system_id, ui packet.initial_timestamp = initial_timestamp; packet.target_system = target_system; packet.target_component = target_component; - mav_array_memcpy(packet.secret_key, secret_key, sizeof(uint8_t)*32); + mav_array_assign_uint8_t(packet.secret_key, secret_key, 32); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SETUP_SIGNING_LEN); #endif @@ -142,6 +182,20 @@ static inline uint16_t mavlink_msg_setup_signing_encode_chan(uint8_t system_id, return mavlink_msg_setup_signing_pack_chan(system_id, component_id, chan, msg, setup_signing->target_system, setup_signing->target_component, setup_signing->secret_key, setup_signing->initial_timestamp); } +/** + * @brief Encode a setup_signing struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param setup_signing C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_setup_signing_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_setup_signing_t* setup_signing) +{ + return mavlink_msg_setup_signing_pack_status(system_id, component_id, _status, msg, setup_signing->target_system, setup_signing->target_component, setup_signing->secret_key, setup_signing->initial_timestamp); +} + /** * @brief Send a setup_signing message * @param chan MAVLink channel to send the message @@ -167,7 +221,7 @@ static inline void mavlink_msg_setup_signing_send(mavlink_channel_t chan, uint8_ packet.initial_timestamp = initial_timestamp; packet.target_system = target_system; packet.target_component = target_component; - mav_array_memcpy(packet.secret_key, secret_key, sizeof(uint8_t)*32); + mav_array_assign_uint8_t(packet.secret_key, secret_key, 32); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SETUP_SIGNING, (const char *)&packet, MAVLINK_MSG_ID_SETUP_SIGNING_MIN_LEN, MAVLINK_MSG_ID_SETUP_SIGNING_LEN, MAVLINK_MSG_ID_SETUP_SIGNING_CRC); #endif } @@ -188,7 +242,7 @@ static inline void mavlink_msg_setup_signing_send_struct(mavlink_channel_t chan, #if MAVLINK_MSG_ID_SETUP_SIGNING_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -208,7 +262,7 @@ static inline void mavlink_msg_setup_signing_send_buf(mavlink_message_t *msgbuf, packet->initial_timestamp = initial_timestamp; packet->target_system = target_system; packet->target_component = target_component; - mav_array_memcpy(packet->secret_key, secret_key, sizeof(uint8_t)*32); + mav_array_assign_uint8_t(packet->secret_key, secret_key, 32); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SETUP_SIGNING, (const char *)packet, MAVLINK_MSG_ID_SETUP_SIGNING_MIN_LEN, MAVLINK_MSG_ID_SETUP_SIGNING_LEN, MAVLINK_MSG_ID_SETUP_SIGNING_CRC); #endif } diff --git a/common/mavlink_msg_sim_state.h b/common/mavlink_msg_sim_state.h index b128b8d54..c49735f65 100644 --- a/common/mavlink_msg_sim_state.h +++ b/common/mavlink_msg_sim_state.h @@ -9,28 +9,30 @@ typedef struct __mavlink_sim_state_t { float q2; /*< True attitude quaternion component 2, x (0 in null-rotation)*/ float q3; /*< True attitude quaternion component 3, y (0 in null-rotation)*/ float q4; /*< True attitude quaternion component 4, z (0 in null-rotation)*/ - float roll; /*< Attitude roll expressed as Euler angles, not recommended except for human-readable outputs*/ - float pitch; /*< Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs*/ - float yaw; /*< Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs*/ + float roll; /*< [rad] Attitude roll expressed as Euler angles, not recommended except for human-readable outputs*/ + float pitch; /*< [rad] Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs*/ + float yaw; /*< [rad] Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs*/ float xacc; /*< [m/s/s] X acceleration*/ float yacc; /*< [m/s/s] Y acceleration*/ float zacc; /*< [m/s/s] Z acceleration*/ float xgyro; /*< [rad/s] Angular speed around X axis*/ float ygyro; /*< [rad/s] Angular speed around Y axis*/ float zgyro; /*< [rad/s] Angular speed around Z axis*/ - float lat; /*< [deg] Latitude*/ - float lon; /*< [deg] Longitude*/ + float lat; /*< [deg] Latitude (lower precision). Both this and the lat_int field should be set.*/ + float lon; /*< [deg] Longitude (lower precision). Both this and the lon_int field should be set.*/ float alt; /*< [m] Altitude*/ float std_dev_horz; /*< Horizontal position standard deviation*/ float std_dev_vert; /*< Vertical position standard deviation*/ float vn; /*< [m/s] True velocity in north direction in earth-fixed NED frame*/ float ve; /*< [m/s] True velocity in east direction in earth-fixed NED frame*/ float vd; /*< [m/s] True velocity in down direction in earth-fixed NED frame*/ + int32_t lat_int; /*< [degE7] Latitude (higher precision). If 0, recipients should use the lat field value (otherwise this field is preferred).*/ + int32_t lon_int; /*< [degE7] Longitude (higher precision). If 0, recipients should use the lon field value (otherwise this field is preferred).*/ } mavlink_sim_state_t; -#define MAVLINK_MSG_ID_SIM_STATE_LEN 84 +#define MAVLINK_MSG_ID_SIM_STATE_LEN 92 #define MAVLINK_MSG_ID_SIM_STATE_MIN_LEN 84 -#define MAVLINK_MSG_ID_108_LEN 84 +#define MAVLINK_MSG_ID_108_LEN 92 #define MAVLINK_MSG_ID_108_MIN_LEN 84 #define MAVLINK_MSG_ID_SIM_STATE_CRC 32 @@ -42,7 +44,7 @@ typedef struct __mavlink_sim_state_t { #define MAVLINK_MESSAGE_INFO_SIM_STATE { \ 108, \ "SIM_STATE", \ - 21, \ + 23, \ { { "q1", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_sim_state_t, q1) }, \ { "q2", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_sim_state_t, q2) }, \ { "q3", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_sim_state_t, q3) }, \ @@ -64,12 +66,14 @@ typedef struct __mavlink_sim_state_t { { "vn", NULL, MAVLINK_TYPE_FLOAT, 0, 72, offsetof(mavlink_sim_state_t, vn) }, \ { "ve", NULL, MAVLINK_TYPE_FLOAT, 0, 76, offsetof(mavlink_sim_state_t, ve) }, \ { "vd", NULL, MAVLINK_TYPE_FLOAT, 0, 80, offsetof(mavlink_sim_state_t, vd) }, \ + { "lat_int", NULL, MAVLINK_TYPE_INT32_T, 0, 84, offsetof(mavlink_sim_state_t, lat_int) }, \ + { "lon_int", NULL, MAVLINK_TYPE_INT32_T, 0, 88, offsetof(mavlink_sim_state_t, lon_int) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_SIM_STATE { \ "SIM_STATE", \ - 21, \ + 23, \ { { "q1", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_sim_state_t, q1) }, \ { "q2", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_sim_state_t, q2) }, \ { "q3", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_sim_state_t, q3) }, \ @@ -91,6 +95,8 @@ typedef struct __mavlink_sim_state_t { { "vn", NULL, MAVLINK_TYPE_FLOAT, 0, 72, offsetof(mavlink_sim_state_t, vn) }, \ { "ve", NULL, MAVLINK_TYPE_FLOAT, 0, 76, offsetof(mavlink_sim_state_t, ve) }, \ { "vd", NULL, MAVLINK_TYPE_FLOAT, 0, 80, offsetof(mavlink_sim_state_t, vd) }, \ + { "lat_int", NULL, MAVLINK_TYPE_INT32_T, 0, 84, offsetof(mavlink_sim_state_t, lat_int) }, \ + { "lon_int", NULL, MAVLINK_TYPE_INT32_T, 0, 88, offsetof(mavlink_sim_state_t, lon_int) }, \ } \ } #endif @@ -105,27 +111,29 @@ typedef struct __mavlink_sim_state_t { * @param q2 True attitude quaternion component 2, x (0 in null-rotation) * @param q3 True attitude quaternion component 3, y (0 in null-rotation) * @param q4 True attitude quaternion component 4, z (0 in null-rotation) - * @param roll Attitude roll expressed as Euler angles, not recommended except for human-readable outputs - * @param pitch Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs - * @param yaw Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs + * @param roll [rad] Attitude roll expressed as Euler angles, not recommended except for human-readable outputs + * @param pitch [rad] Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs + * @param yaw [rad] Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs * @param xacc [m/s/s] X acceleration * @param yacc [m/s/s] Y acceleration * @param zacc [m/s/s] Z acceleration * @param xgyro [rad/s] Angular speed around X axis * @param ygyro [rad/s] Angular speed around Y axis * @param zgyro [rad/s] Angular speed around Z axis - * @param lat [deg] Latitude - * @param lon [deg] Longitude + * @param lat [deg] Latitude (lower precision). Both this and the lat_int field should be set. + * @param lon [deg] Longitude (lower precision). Both this and the lon_int field should be set. * @param alt [m] Altitude * @param std_dev_horz Horizontal position standard deviation * @param std_dev_vert Vertical position standard deviation * @param vn [m/s] True velocity in north direction in earth-fixed NED frame * @param ve [m/s] True velocity in east direction in earth-fixed NED frame * @param vd [m/s] True velocity in down direction in earth-fixed NED frame + * @param lat_int [degE7] Latitude (higher precision). If 0, recipients should use the lat field value (otherwise this field is preferred). + * @param lon_int [degE7] Longitude (higher precision). If 0, recipients should use the lon field value (otherwise this field is preferred). * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_sim_state_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - float q1, float q2, float q3, float q4, float roll, float pitch, float yaw, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float lat, float lon, float alt, float std_dev_horz, float std_dev_vert, float vn, float ve, float vd) + float q1, float q2, float q3, float q4, float roll, float pitch, float yaw, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float lat, float lon, float alt, float std_dev_horz, float std_dev_vert, float vn, float ve, float vd, int32_t lat_int, int32_t lon_int) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_SIM_STATE_LEN]; @@ -150,6 +158,8 @@ static inline uint16_t mavlink_msg_sim_state_pack(uint8_t system_id, uint8_t com _mav_put_float(buf, 72, vn); _mav_put_float(buf, 76, ve); _mav_put_float(buf, 80, vd); + _mav_put_int32_t(buf, 84, lat_int); + _mav_put_int32_t(buf, 88, lon_int); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SIM_STATE_LEN); #else @@ -175,6 +185,8 @@ static inline uint16_t mavlink_msg_sim_state_pack(uint8_t system_id, uint8_t com packet.vn = vn; packet.ve = ve; packet.vd = vd; + packet.lat_int = lat_int; + packet.lon_int = lon_int; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SIM_STATE_LEN); #endif @@ -183,6 +195,105 @@ static inline uint16_t mavlink_msg_sim_state_pack(uint8_t system_id, uint8_t com return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SIM_STATE_MIN_LEN, MAVLINK_MSG_ID_SIM_STATE_LEN, MAVLINK_MSG_ID_SIM_STATE_CRC); } +/** + * @brief Pack a sim_state message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param q1 True attitude quaternion component 1, w (1 in null-rotation) + * @param q2 True attitude quaternion component 2, x (0 in null-rotation) + * @param q3 True attitude quaternion component 3, y (0 in null-rotation) + * @param q4 True attitude quaternion component 4, z (0 in null-rotation) + * @param roll [rad] Attitude roll expressed as Euler angles, not recommended except for human-readable outputs + * @param pitch [rad] Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs + * @param yaw [rad] Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs + * @param xacc [m/s/s] X acceleration + * @param yacc [m/s/s] Y acceleration + * @param zacc [m/s/s] Z acceleration + * @param xgyro [rad/s] Angular speed around X axis + * @param ygyro [rad/s] Angular speed around Y axis + * @param zgyro [rad/s] Angular speed around Z axis + * @param lat [deg] Latitude (lower precision). Both this and the lat_int field should be set. + * @param lon [deg] Longitude (lower precision). Both this and the lon_int field should be set. + * @param alt [m] Altitude + * @param std_dev_horz Horizontal position standard deviation + * @param std_dev_vert Vertical position standard deviation + * @param vn [m/s] True velocity in north direction in earth-fixed NED frame + * @param ve [m/s] True velocity in east direction in earth-fixed NED frame + * @param vd [m/s] True velocity in down direction in earth-fixed NED frame + * @param lat_int [degE7] Latitude (higher precision). If 0, recipients should use the lat field value (otherwise this field is preferred). + * @param lon_int [degE7] Longitude (higher precision). If 0, recipients should use the lon field value (otherwise this field is preferred). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_sim_state_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + float q1, float q2, float q3, float q4, float roll, float pitch, float yaw, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float lat, float lon, float alt, float std_dev_horz, float std_dev_vert, float vn, float ve, float vd, int32_t lat_int, int32_t lon_int) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_SIM_STATE_LEN]; + _mav_put_float(buf, 0, q1); + _mav_put_float(buf, 4, q2); + _mav_put_float(buf, 8, q3); + _mav_put_float(buf, 12, q4); + _mav_put_float(buf, 16, roll); + _mav_put_float(buf, 20, pitch); + _mav_put_float(buf, 24, yaw); + _mav_put_float(buf, 28, xacc); + _mav_put_float(buf, 32, yacc); + _mav_put_float(buf, 36, zacc); + _mav_put_float(buf, 40, xgyro); + _mav_put_float(buf, 44, ygyro); + _mav_put_float(buf, 48, zgyro); + _mav_put_float(buf, 52, lat); + _mav_put_float(buf, 56, lon); + _mav_put_float(buf, 60, alt); + _mav_put_float(buf, 64, std_dev_horz); + _mav_put_float(buf, 68, std_dev_vert); + _mav_put_float(buf, 72, vn); + _mav_put_float(buf, 76, ve); + _mav_put_float(buf, 80, vd); + _mav_put_int32_t(buf, 84, lat_int); + _mav_put_int32_t(buf, 88, lon_int); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SIM_STATE_LEN); +#else + mavlink_sim_state_t packet; + packet.q1 = q1; + packet.q2 = q2; + packet.q3 = q3; + packet.q4 = q4; + packet.roll = roll; + packet.pitch = pitch; + packet.yaw = yaw; + packet.xacc = xacc; + packet.yacc = yacc; + packet.zacc = zacc; + packet.xgyro = xgyro; + packet.ygyro = ygyro; + packet.zgyro = zgyro; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.std_dev_horz = std_dev_horz; + packet.std_dev_vert = std_dev_vert; + packet.vn = vn; + packet.ve = ve; + packet.vd = vd; + packet.lat_int = lat_int; + packet.lon_int = lon_int; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SIM_STATE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_SIM_STATE; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SIM_STATE_MIN_LEN, MAVLINK_MSG_ID_SIM_STATE_LEN, MAVLINK_MSG_ID_SIM_STATE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SIM_STATE_MIN_LEN, MAVLINK_MSG_ID_SIM_STATE_LEN); +#endif +} + /** * @brief Pack a sim_state message on a channel * @param system_id ID of this system @@ -193,28 +304,30 @@ static inline uint16_t mavlink_msg_sim_state_pack(uint8_t system_id, uint8_t com * @param q2 True attitude quaternion component 2, x (0 in null-rotation) * @param q3 True attitude quaternion component 3, y (0 in null-rotation) * @param q4 True attitude quaternion component 4, z (0 in null-rotation) - * @param roll Attitude roll expressed as Euler angles, not recommended except for human-readable outputs - * @param pitch Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs - * @param yaw Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs + * @param roll [rad] Attitude roll expressed as Euler angles, not recommended except for human-readable outputs + * @param pitch [rad] Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs + * @param yaw [rad] Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs * @param xacc [m/s/s] X acceleration * @param yacc [m/s/s] Y acceleration * @param zacc [m/s/s] Z acceleration * @param xgyro [rad/s] Angular speed around X axis * @param ygyro [rad/s] Angular speed around Y axis * @param zgyro [rad/s] Angular speed around Z axis - * @param lat [deg] Latitude - * @param lon [deg] Longitude + * @param lat [deg] Latitude (lower precision). Both this and the lat_int field should be set. + * @param lon [deg] Longitude (lower precision). Both this and the lon_int field should be set. * @param alt [m] Altitude * @param std_dev_horz Horizontal position standard deviation * @param std_dev_vert Vertical position standard deviation * @param vn [m/s] True velocity in north direction in earth-fixed NED frame * @param ve [m/s] True velocity in east direction in earth-fixed NED frame * @param vd [m/s] True velocity in down direction in earth-fixed NED frame + * @param lat_int [degE7] Latitude (higher precision). If 0, recipients should use the lat field value (otherwise this field is preferred). + * @param lon_int [degE7] Longitude (higher precision). If 0, recipients should use the lon field value (otherwise this field is preferred). * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_sim_state_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - float q1,float q2,float q3,float q4,float roll,float pitch,float yaw,float xacc,float yacc,float zacc,float xgyro,float ygyro,float zgyro,float lat,float lon,float alt,float std_dev_horz,float std_dev_vert,float vn,float ve,float vd) + float q1,float q2,float q3,float q4,float roll,float pitch,float yaw,float xacc,float yacc,float zacc,float xgyro,float ygyro,float zgyro,float lat,float lon,float alt,float std_dev_horz,float std_dev_vert,float vn,float ve,float vd,int32_t lat_int,int32_t lon_int) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_SIM_STATE_LEN]; @@ -239,6 +352,8 @@ static inline uint16_t mavlink_msg_sim_state_pack_chan(uint8_t system_id, uint8_ _mav_put_float(buf, 72, vn); _mav_put_float(buf, 76, ve); _mav_put_float(buf, 80, vd); + _mav_put_int32_t(buf, 84, lat_int); + _mav_put_int32_t(buf, 88, lon_int); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SIM_STATE_LEN); #else @@ -264,6 +379,8 @@ static inline uint16_t mavlink_msg_sim_state_pack_chan(uint8_t system_id, uint8_ packet.vn = vn; packet.ve = ve; packet.vd = vd; + packet.lat_int = lat_int; + packet.lon_int = lon_int; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SIM_STATE_LEN); #endif @@ -282,7 +399,7 @@ static inline uint16_t mavlink_msg_sim_state_pack_chan(uint8_t system_id, uint8_ */ static inline uint16_t mavlink_msg_sim_state_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_sim_state_t* sim_state) { - return mavlink_msg_sim_state_pack(system_id, component_id, msg, sim_state->q1, sim_state->q2, sim_state->q3, sim_state->q4, sim_state->roll, sim_state->pitch, sim_state->yaw, sim_state->xacc, sim_state->yacc, sim_state->zacc, sim_state->xgyro, sim_state->ygyro, sim_state->zgyro, sim_state->lat, sim_state->lon, sim_state->alt, sim_state->std_dev_horz, sim_state->std_dev_vert, sim_state->vn, sim_state->ve, sim_state->vd); + return mavlink_msg_sim_state_pack(system_id, component_id, msg, sim_state->q1, sim_state->q2, sim_state->q3, sim_state->q4, sim_state->roll, sim_state->pitch, sim_state->yaw, sim_state->xacc, sim_state->yacc, sim_state->zacc, sim_state->xgyro, sim_state->ygyro, sim_state->zgyro, sim_state->lat, sim_state->lon, sim_state->alt, sim_state->std_dev_horz, sim_state->std_dev_vert, sim_state->vn, sim_state->ve, sim_state->vd, sim_state->lat_int, sim_state->lon_int); } /** @@ -296,7 +413,21 @@ static inline uint16_t mavlink_msg_sim_state_encode(uint8_t system_id, uint8_t c */ static inline uint16_t mavlink_msg_sim_state_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_sim_state_t* sim_state) { - return mavlink_msg_sim_state_pack_chan(system_id, component_id, chan, msg, sim_state->q1, sim_state->q2, sim_state->q3, sim_state->q4, sim_state->roll, sim_state->pitch, sim_state->yaw, sim_state->xacc, sim_state->yacc, sim_state->zacc, sim_state->xgyro, sim_state->ygyro, sim_state->zgyro, sim_state->lat, sim_state->lon, sim_state->alt, sim_state->std_dev_horz, sim_state->std_dev_vert, sim_state->vn, sim_state->ve, sim_state->vd); + return mavlink_msg_sim_state_pack_chan(system_id, component_id, chan, msg, sim_state->q1, sim_state->q2, sim_state->q3, sim_state->q4, sim_state->roll, sim_state->pitch, sim_state->yaw, sim_state->xacc, sim_state->yacc, sim_state->zacc, sim_state->xgyro, sim_state->ygyro, sim_state->zgyro, sim_state->lat, sim_state->lon, sim_state->alt, sim_state->std_dev_horz, sim_state->std_dev_vert, sim_state->vn, sim_state->ve, sim_state->vd, sim_state->lat_int, sim_state->lon_int); +} + +/** + * @brief Encode a sim_state struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param sim_state C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_sim_state_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_sim_state_t* sim_state) +{ + return mavlink_msg_sim_state_pack_status(system_id, component_id, _status, msg, sim_state->q1, sim_state->q2, sim_state->q3, sim_state->q4, sim_state->roll, sim_state->pitch, sim_state->yaw, sim_state->xacc, sim_state->yacc, sim_state->zacc, sim_state->xgyro, sim_state->ygyro, sim_state->zgyro, sim_state->lat, sim_state->lon, sim_state->alt, sim_state->std_dev_horz, sim_state->std_dev_vert, sim_state->vn, sim_state->ve, sim_state->vd, sim_state->lat_int, sim_state->lon_int); } /** @@ -307,27 +438,29 @@ static inline uint16_t mavlink_msg_sim_state_encode_chan(uint8_t system_id, uint * @param q2 True attitude quaternion component 2, x (0 in null-rotation) * @param q3 True attitude quaternion component 3, y (0 in null-rotation) * @param q4 True attitude quaternion component 4, z (0 in null-rotation) - * @param roll Attitude roll expressed as Euler angles, not recommended except for human-readable outputs - * @param pitch Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs - * @param yaw Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs + * @param roll [rad] Attitude roll expressed as Euler angles, not recommended except for human-readable outputs + * @param pitch [rad] Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs + * @param yaw [rad] Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs * @param xacc [m/s/s] X acceleration * @param yacc [m/s/s] Y acceleration * @param zacc [m/s/s] Z acceleration * @param xgyro [rad/s] Angular speed around X axis * @param ygyro [rad/s] Angular speed around Y axis * @param zgyro [rad/s] Angular speed around Z axis - * @param lat [deg] Latitude - * @param lon [deg] Longitude + * @param lat [deg] Latitude (lower precision). Both this and the lat_int field should be set. + * @param lon [deg] Longitude (lower precision). Both this and the lon_int field should be set. * @param alt [m] Altitude * @param std_dev_horz Horizontal position standard deviation * @param std_dev_vert Vertical position standard deviation * @param vn [m/s] True velocity in north direction in earth-fixed NED frame * @param ve [m/s] True velocity in east direction in earth-fixed NED frame * @param vd [m/s] True velocity in down direction in earth-fixed NED frame + * @param lat_int [degE7] Latitude (higher precision). If 0, recipients should use the lat field value (otherwise this field is preferred). + * @param lon_int [degE7] Longitude (higher precision). If 0, recipients should use the lon field value (otherwise this field is preferred). */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_sim_state_send(mavlink_channel_t chan, float q1, float q2, float q3, float q4, float roll, float pitch, float yaw, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float lat, float lon, float alt, float std_dev_horz, float std_dev_vert, float vn, float ve, float vd) +static inline void mavlink_msg_sim_state_send(mavlink_channel_t chan, float q1, float q2, float q3, float q4, float roll, float pitch, float yaw, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float lat, float lon, float alt, float std_dev_horz, float std_dev_vert, float vn, float ve, float vd, int32_t lat_int, int32_t lon_int) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_SIM_STATE_LEN]; @@ -352,6 +485,8 @@ static inline void mavlink_msg_sim_state_send(mavlink_channel_t chan, float q1, _mav_put_float(buf, 72, vn); _mav_put_float(buf, 76, ve); _mav_put_float(buf, 80, vd); + _mav_put_int32_t(buf, 84, lat_int); + _mav_put_int32_t(buf, 88, lon_int); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SIM_STATE, buf, MAVLINK_MSG_ID_SIM_STATE_MIN_LEN, MAVLINK_MSG_ID_SIM_STATE_LEN, MAVLINK_MSG_ID_SIM_STATE_CRC); #else @@ -377,6 +512,8 @@ static inline void mavlink_msg_sim_state_send(mavlink_channel_t chan, float q1, packet.vn = vn; packet.ve = ve; packet.vd = vd; + packet.lat_int = lat_int; + packet.lon_int = lon_int; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SIM_STATE, (const char *)&packet, MAVLINK_MSG_ID_SIM_STATE_MIN_LEN, MAVLINK_MSG_ID_SIM_STATE_LEN, MAVLINK_MSG_ID_SIM_STATE_CRC); #endif @@ -390,7 +527,7 @@ static inline void mavlink_msg_sim_state_send(mavlink_channel_t chan, float q1, static inline void mavlink_msg_sim_state_send_struct(mavlink_channel_t chan, const mavlink_sim_state_t* sim_state) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_sim_state_send(chan, sim_state->q1, sim_state->q2, sim_state->q3, sim_state->q4, sim_state->roll, sim_state->pitch, sim_state->yaw, sim_state->xacc, sim_state->yacc, sim_state->zacc, sim_state->xgyro, sim_state->ygyro, sim_state->zgyro, sim_state->lat, sim_state->lon, sim_state->alt, sim_state->std_dev_horz, sim_state->std_dev_vert, sim_state->vn, sim_state->ve, sim_state->vd); + mavlink_msg_sim_state_send(chan, sim_state->q1, sim_state->q2, sim_state->q3, sim_state->q4, sim_state->roll, sim_state->pitch, sim_state->yaw, sim_state->xacc, sim_state->yacc, sim_state->zacc, sim_state->xgyro, sim_state->ygyro, sim_state->zgyro, sim_state->lat, sim_state->lon, sim_state->alt, sim_state->std_dev_horz, sim_state->std_dev_vert, sim_state->vn, sim_state->ve, sim_state->vd, sim_state->lat_int, sim_state->lon_int); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SIM_STATE, (const char *)sim_state, MAVLINK_MSG_ID_SIM_STATE_MIN_LEN, MAVLINK_MSG_ID_SIM_STATE_LEN, MAVLINK_MSG_ID_SIM_STATE_CRC); #endif @@ -398,13 +535,13 @@ static inline void mavlink_msg_sim_state_send_struct(mavlink_channel_t chan, con #if MAVLINK_MSG_ID_SIM_STATE_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_sim_state_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, float q1, float q2, float q3, float q4, float roll, float pitch, float yaw, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float lat, float lon, float alt, float std_dev_horz, float std_dev_vert, float vn, float ve, float vd) +static inline void mavlink_msg_sim_state_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, float q1, float q2, float q3, float q4, float roll, float pitch, float yaw, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float lat, float lon, float alt, float std_dev_horz, float std_dev_vert, float vn, float ve, float vd, int32_t lat_int, int32_t lon_int) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; @@ -429,6 +566,8 @@ static inline void mavlink_msg_sim_state_send_buf(mavlink_message_t *msgbuf, mav _mav_put_float(buf, 72, vn); _mav_put_float(buf, 76, ve); _mav_put_float(buf, 80, vd); + _mav_put_int32_t(buf, 84, lat_int); + _mav_put_int32_t(buf, 88, lon_int); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SIM_STATE, buf, MAVLINK_MSG_ID_SIM_STATE_MIN_LEN, MAVLINK_MSG_ID_SIM_STATE_LEN, MAVLINK_MSG_ID_SIM_STATE_CRC); #else @@ -454,6 +593,8 @@ static inline void mavlink_msg_sim_state_send_buf(mavlink_message_t *msgbuf, mav packet->vn = vn; packet->ve = ve; packet->vd = vd; + packet->lat_int = lat_int; + packet->lon_int = lon_int; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SIM_STATE, (const char *)packet, MAVLINK_MSG_ID_SIM_STATE_MIN_LEN, MAVLINK_MSG_ID_SIM_STATE_LEN, MAVLINK_MSG_ID_SIM_STATE_CRC); #endif @@ -508,7 +649,7 @@ static inline float mavlink_msg_sim_state_get_q4(const mavlink_message_t* msg) /** * @brief Get field roll from sim_state message * - * @return Attitude roll expressed as Euler angles, not recommended except for human-readable outputs + * @return [rad] Attitude roll expressed as Euler angles, not recommended except for human-readable outputs */ static inline float mavlink_msg_sim_state_get_roll(const mavlink_message_t* msg) { @@ -518,7 +659,7 @@ static inline float mavlink_msg_sim_state_get_roll(const mavlink_message_t* msg) /** * @brief Get field pitch from sim_state message * - * @return Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs + * @return [rad] Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs */ static inline float mavlink_msg_sim_state_get_pitch(const mavlink_message_t* msg) { @@ -528,7 +669,7 @@ static inline float mavlink_msg_sim_state_get_pitch(const mavlink_message_t* msg /** * @brief Get field yaw from sim_state message * - * @return Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs + * @return [rad] Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs */ static inline float mavlink_msg_sim_state_get_yaw(const mavlink_message_t* msg) { @@ -598,7 +739,7 @@ static inline float mavlink_msg_sim_state_get_zgyro(const mavlink_message_t* msg /** * @brief Get field lat from sim_state message * - * @return [deg] Latitude + * @return [deg] Latitude (lower precision). Both this and the lat_int field should be set. */ static inline float mavlink_msg_sim_state_get_lat(const mavlink_message_t* msg) { @@ -608,7 +749,7 @@ static inline float mavlink_msg_sim_state_get_lat(const mavlink_message_t* msg) /** * @brief Get field lon from sim_state message * - * @return [deg] Longitude + * @return [deg] Longitude (lower precision). Both this and the lon_int field should be set. */ static inline float mavlink_msg_sim_state_get_lon(const mavlink_message_t* msg) { @@ -675,6 +816,26 @@ static inline float mavlink_msg_sim_state_get_vd(const mavlink_message_t* msg) return _MAV_RETURN_float(msg, 80); } +/** + * @brief Get field lat_int from sim_state message + * + * @return [degE7] Latitude (higher precision). If 0, recipients should use the lat field value (otherwise this field is preferred). + */ +static inline int32_t mavlink_msg_sim_state_get_lat_int(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 84); +} + +/** + * @brief Get field lon_int from sim_state message + * + * @return [degE7] Longitude (higher precision). If 0, recipients should use the lon field value (otherwise this field is preferred). + */ +static inline int32_t mavlink_msg_sim_state_get_lon_int(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 88); +} + /** * @brief Decode a sim_state message into a struct * @@ -705,6 +866,8 @@ static inline void mavlink_msg_sim_state_decode(const mavlink_message_t* msg, ma sim_state->vn = mavlink_msg_sim_state_get_vn(msg); sim_state->ve = mavlink_msg_sim_state_get_ve(msg); sim_state->vd = mavlink_msg_sim_state_get_vd(msg); + sim_state->lat_int = mavlink_msg_sim_state_get_lat_int(msg); + sim_state->lon_int = mavlink_msg_sim_state_get_lon_int(msg); #else uint8_t len = msg->len < MAVLINK_MSG_ID_SIM_STATE_LEN? msg->len : MAVLINK_MSG_ID_SIM_STATE_LEN; memset(sim_state, 0, MAVLINK_MSG_ID_SIM_STATE_LEN); diff --git a/common/mavlink_msg_smart_battery_info.h b/common/mavlink_msg_smart_battery_info.h index 174c197f3..94810e7dc 100644 --- a/common/mavlink_msg_smart_battery_info.h +++ b/common/mavlink_msg_smart_battery_info.h @@ -3,7 +3,7 @@ #define MAVLINK_MSG_ID_SMART_BATTERY_INFO 370 - +MAVPACKED( typedef struct __mavlink_smart_battery_info_t { int32_t capacity_full_specification; /*< [mAh] Capacity when full according to manufacturer, -1: field not provided.*/ int32_t capacity_full; /*< [mAh] Capacity when full (accounting for battery degradation), -1: field not provided.*/ @@ -16,12 +16,17 @@ typedef struct __mavlink_smart_battery_info_t { uint8_t battery_function; /*< Function of the battery*/ uint8_t type; /*< Type (chemistry) of the battery*/ char serial_number[16]; /*< Serial number in ASCII characters, 0 terminated. All 0: field not provided.*/ - char device_name[50]; /*< Static device name. Encode as manufacturer and product names separated using an underscore.*/ -} mavlink_smart_battery_info_t; - -#define MAVLINK_MSG_ID_SMART_BATTERY_INFO_LEN 87 + char device_name[50]; /*< Static device name in ASCII characters, 0 terminated. All 0: field not provided. Encode as manufacturer name then product name separated using an underscore.*/ + uint16_t charging_maximum_voltage; /*< [mV] Maximum per-cell voltage when charged. 0: field not provided.*/ + uint8_t cells_in_series; /*< Number of battery cells in series. 0: field not provided.*/ + uint32_t discharge_maximum_current; /*< [mA] Maximum pack discharge current. 0: field not provided.*/ + uint32_t discharge_maximum_burst_current; /*< [mA] Maximum pack discharge burst current. 0: field not provided.*/ + char manufacture_date[11]; /*< Manufacture date (DD/MM/YYYY) in ASCII characters, 0 terminated. All 0: field not provided.*/ +}) mavlink_smart_battery_info_t; + +#define MAVLINK_MSG_ID_SMART_BATTERY_INFO_LEN 109 #define MAVLINK_MSG_ID_SMART_BATTERY_INFO_MIN_LEN 87 -#define MAVLINK_MSG_ID_370_LEN 87 +#define MAVLINK_MSG_ID_370_LEN 109 #define MAVLINK_MSG_ID_370_MIN_LEN 87 #define MAVLINK_MSG_ID_SMART_BATTERY_INFO_CRC 75 @@ -29,12 +34,13 @@ typedef struct __mavlink_smart_battery_info_t { #define MAVLINK_MSG_SMART_BATTERY_INFO_FIELD_SERIAL_NUMBER_LEN 16 #define MAVLINK_MSG_SMART_BATTERY_INFO_FIELD_DEVICE_NAME_LEN 50 +#define MAVLINK_MSG_SMART_BATTERY_INFO_FIELD_MANUFACTURE_DATE_LEN 11 #if MAVLINK_COMMAND_24BIT #define MAVLINK_MESSAGE_INFO_SMART_BATTERY_INFO { \ 370, \ "SMART_BATTERY_INFO", \ - 12, \ + 17, \ { { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 18, offsetof(mavlink_smart_battery_info_t, id) }, \ { "battery_function", NULL, MAVLINK_TYPE_UINT8_T, 0, 19, offsetof(mavlink_smart_battery_info_t, battery_function) }, \ { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 20, offsetof(mavlink_smart_battery_info_t, type) }, \ @@ -47,12 +53,17 @@ typedef struct __mavlink_smart_battery_info_t { { "discharge_minimum_voltage", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_smart_battery_info_t, discharge_minimum_voltage) }, \ { "charging_minimum_voltage", NULL, MAVLINK_TYPE_UINT16_T, 0, 14, offsetof(mavlink_smart_battery_info_t, charging_minimum_voltage) }, \ { "resting_minimum_voltage", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_smart_battery_info_t, resting_minimum_voltage) }, \ + { "charging_maximum_voltage", NULL, MAVLINK_TYPE_UINT16_T, 0, 87, offsetof(mavlink_smart_battery_info_t, charging_maximum_voltage) }, \ + { "cells_in_series", NULL, MAVLINK_TYPE_UINT8_T, 0, 89, offsetof(mavlink_smart_battery_info_t, cells_in_series) }, \ + { "discharge_maximum_current", NULL, MAVLINK_TYPE_UINT32_T, 0, 90, offsetof(mavlink_smart_battery_info_t, discharge_maximum_current) }, \ + { "discharge_maximum_burst_current", NULL, MAVLINK_TYPE_UINT32_T, 0, 94, offsetof(mavlink_smart_battery_info_t, discharge_maximum_burst_current) }, \ + { "manufacture_date", NULL, MAVLINK_TYPE_CHAR, 11, 98, offsetof(mavlink_smart_battery_info_t, manufacture_date) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_SMART_BATTERY_INFO { \ "SMART_BATTERY_INFO", \ - 12, \ + 17, \ { { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 18, offsetof(mavlink_smart_battery_info_t, id) }, \ { "battery_function", NULL, MAVLINK_TYPE_UINT8_T, 0, 19, offsetof(mavlink_smart_battery_info_t, battery_function) }, \ { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 20, offsetof(mavlink_smart_battery_info_t, type) }, \ @@ -65,6 +76,11 @@ typedef struct __mavlink_smart_battery_info_t { { "discharge_minimum_voltage", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_smart_battery_info_t, discharge_minimum_voltage) }, \ { "charging_minimum_voltage", NULL, MAVLINK_TYPE_UINT16_T, 0, 14, offsetof(mavlink_smart_battery_info_t, charging_minimum_voltage) }, \ { "resting_minimum_voltage", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_smart_battery_info_t, resting_minimum_voltage) }, \ + { "charging_maximum_voltage", NULL, MAVLINK_TYPE_UINT16_T, 0, 87, offsetof(mavlink_smart_battery_info_t, charging_maximum_voltage) }, \ + { "cells_in_series", NULL, MAVLINK_TYPE_UINT8_T, 0, 89, offsetof(mavlink_smart_battery_info_t, cells_in_series) }, \ + { "discharge_maximum_current", NULL, MAVLINK_TYPE_UINT32_T, 0, 90, offsetof(mavlink_smart_battery_info_t, discharge_maximum_current) }, \ + { "discharge_maximum_burst_current", NULL, MAVLINK_TYPE_UINT32_T, 0, 94, offsetof(mavlink_smart_battery_info_t, discharge_maximum_burst_current) }, \ + { "manufacture_date", NULL, MAVLINK_TYPE_CHAR, 11, 98, offsetof(mavlink_smart_battery_info_t, manufacture_date) }, \ } \ } #endif @@ -82,15 +98,20 @@ typedef struct __mavlink_smart_battery_info_t { * @param capacity_full [mAh] Capacity when full (accounting for battery degradation), -1: field not provided. * @param cycle_count Charge/discharge cycle count. UINT16_MAX: field not provided. * @param serial_number Serial number in ASCII characters, 0 terminated. All 0: field not provided. - * @param device_name Static device name. Encode as manufacturer and product names separated using an underscore. + * @param device_name Static device name in ASCII characters, 0 terminated. All 0: field not provided. Encode as manufacturer name then product name separated using an underscore. * @param weight [g] Battery weight. 0: field not provided. * @param discharge_minimum_voltage [mV] Minimum per-cell voltage when discharging. If not supplied set to UINT16_MAX value. * @param charging_minimum_voltage [mV] Minimum per-cell voltage when charging. If not supplied set to UINT16_MAX value. * @param resting_minimum_voltage [mV] Minimum per-cell voltage when resting. If not supplied set to UINT16_MAX value. + * @param charging_maximum_voltage [mV] Maximum per-cell voltage when charged. 0: field not provided. + * @param cells_in_series Number of battery cells in series. 0: field not provided. + * @param discharge_maximum_current [mA] Maximum pack discharge current. 0: field not provided. + * @param discharge_maximum_burst_current [mA] Maximum pack discharge burst current. 0: field not provided. + * @param manufacture_date Manufacture date (DD/MM/YYYY) in ASCII characters, 0 terminated. All 0: field not provided. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_smart_battery_info_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t id, uint8_t battery_function, uint8_t type, int32_t capacity_full_specification, int32_t capacity_full, uint16_t cycle_count, const char *serial_number, const char *device_name, uint16_t weight, uint16_t discharge_minimum_voltage, uint16_t charging_minimum_voltage, uint16_t resting_minimum_voltage) + uint8_t id, uint8_t battery_function, uint8_t type, int32_t capacity_full_specification, int32_t capacity_full, uint16_t cycle_count, const char *serial_number, const char *device_name, uint16_t weight, uint16_t discharge_minimum_voltage, uint16_t charging_minimum_voltage, uint16_t resting_minimum_voltage, uint16_t charging_maximum_voltage, uint8_t cells_in_series, uint32_t discharge_maximum_current, uint32_t discharge_maximum_burst_current, const char *manufacture_date) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_SMART_BATTERY_INFO_LEN]; @@ -104,8 +125,13 @@ static inline uint16_t mavlink_msg_smart_battery_info_pack(uint8_t system_id, ui _mav_put_uint8_t(buf, 18, id); _mav_put_uint8_t(buf, 19, battery_function); _mav_put_uint8_t(buf, 20, type); + _mav_put_uint16_t(buf, 87, charging_maximum_voltage); + _mav_put_uint8_t(buf, 89, cells_in_series); + _mav_put_uint32_t(buf, 90, discharge_maximum_current); + _mav_put_uint32_t(buf, 94, discharge_maximum_burst_current); _mav_put_char_array(buf, 21, serial_number, 16); _mav_put_char_array(buf, 37, device_name, 50); + _mav_put_char_array(buf, 98, manufacture_date, 11); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SMART_BATTERY_INFO_LEN); #else mavlink_smart_battery_info_t packet; @@ -119,13 +145,97 @@ static inline uint16_t mavlink_msg_smart_battery_info_pack(uint8_t system_id, ui packet.id = id; packet.battery_function = battery_function; packet.type = type; + packet.charging_maximum_voltage = charging_maximum_voltage; + packet.cells_in_series = cells_in_series; + packet.discharge_maximum_current = discharge_maximum_current; + packet.discharge_maximum_burst_current = discharge_maximum_burst_current; + mav_array_assign_char(packet.serial_number, serial_number, 16); + mav_array_assign_char(packet.device_name, device_name, 50); + mav_array_assign_char(packet.manufacture_date, manufacture_date, 11); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SMART_BATTERY_INFO_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_SMART_BATTERY_INFO; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SMART_BATTERY_INFO_MIN_LEN, MAVLINK_MSG_ID_SMART_BATTERY_INFO_LEN, MAVLINK_MSG_ID_SMART_BATTERY_INFO_CRC); +} + +/** + * @brief Pack a smart_battery_info message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param id Battery ID + * @param battery_function Function of the battery + * @param type Type (chemistry) of the battery + * @param capacity_full_specification [mAh] Capacity when full according to manufacturer, -1: field not provided. + * @param capacity_full [mAh] Capacity when full (accounting for battery degradation), -1: field not provided. + * @param cycle_count Charge/discharge cycle count. UINT16_MAX: field not provided. + * @param serial_number Serial number in ASCII characters, 0 terminated. All 0: field not provided. + * @param device_name Static device name in ASCII characters, 0 terminated. All 0: field not provided. Encode as manufacturer name then product name separated using an underscore. + * @param weight [g] Battery weight. 0: field not provided. + * @param discharge_minimum_voltage [mV] Minimum per-cell voltage when discharging. If not supplied set to UINT16_MAX value. + * @param charging_minimum_voltage [mV] Minimum per-cell voltage when charging. If not supplied set to UINT16_MAX value. + * @param resting_minimum_voltage [mV] Minimum per-cell voltage when resting. If not supplied set to UINT16_MAX value. + * @param charging_maximum_voltage [mV] Maximum per-cell voltage when charged. 0: field not provided. + * @param cells_in_series Number of battery cells in series. 0: field not provided. + * @param discharge_maximum_current [mA] Maximum pack discharge current. 0: field not provided. + * @param discharge_maximum_burst_current [mA] Maximum pack discharge burst current. 0: field not provided. + * @param manufacture_date Manufacture date (DD/MM/YYYY) in ASCII characters, 0 terminated. All 0: field not provided. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_smart_battery_info_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t id, uint8_t battery_function, uint8_t type, int32_t capacity_full_specification, int32_t capacity_full, uint16_t cycle_count, const char *serial_number, const char *device_name, uint16_t weight, uint16_t discharge_minimum_voltage, uint16_t charging_minimum_voltage, uint16_t resting_minimum_voltage, uint16_t charging_maximum_voltage, uint8_t cells_in_series, uint32_t discharge_maximum_current, uint32_t discharge_maximum_burst_current, const char *manufacture_date) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_SMART_BATTERY_INFO_LEN]; + _mav_put_int32_t(buf, 0, capacity_full_specification); + _mav_put_int32_t(buf, 4, capacity_full); + _mav_put_uint16_t(buf, 8, cycle_count); + _mav_put_uint16_t(buf, 10, weight); + _mav_put_uint16_t(buf, 12, discharge_minimum_voltage); + _mav_put_uint16_t(buf, 14, charging_minimum_voltage); + _mav_put_uint16_t(buf, 16, resting_minimum_voltage); + _mav_put_uint8_t(buf, 18, id); + _mav_put_uint8_t(buf, 19, battery_function); + _mav_put_uint8_t(buf, 20, type); + _mav_put_uint16_t(buf, 87, charging_maximum_voltage); + _mav_put_uint8_t(buf, 89, cells_in_series); + _mav_put_uint32_t(buf, 90, discharge_maximum_current); + _mav_put_uint32_t(buf, 94, discharge_maximum_burst_current); + _mav_put_char_array(buf, 21, serial_number, 16); + _mav_put_char_array(buf, 37, device_name, 50); + _mav_put_char_array(buf, 98, manufacture_date, 11); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SMART_BATTERY_INFO_LEN); +#else + mavlink_smart_battery_info_t packet; + packet.capacity_full_specification = capacity_full_specification; + packet.capacity_full = capacity_full; + packet.cycle_count = cycle_count; + packet.weight = weight; + packet.discharge_minimum_voltage = discharge_minimum_voltage; + packet.charging_minimum_voltage = charging_minimum_voltage; + packet.resting_minimum_voltage = resting_minimum_voltage; + packet.id = id; + packet.battery_function = battery_function; + packet.type = type; + packet.charging_maximum_voltage = charging_maximum_voltage; + packet.cells_in_series = cells_in_series; + packet.discharge_maximum_current = discharge_maximum_current; + packet.discharge_maximum_burst_current = discharge_maximum_burst_current; mav_array_memcpy(packet.serial_number, serial_number, sizeof(char)*16); mav_array_memcpy(packet.device_name, device_name, sizeof(char)*50); + mav_array_memcpy(packet.manufacture_date, manufacture_date, sizeof(char)*11); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SMART_BATTERY_INFO_LEN); #endif msg->msgid = MAVLINK_MSG_ID_SMART_BATTERY_INFO; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SMART_BATTERY_INFO_MIN_LEN, MAVLINK_MSG_ID_SMART_BATTERY_INFO_LEN, MAVLINK_MSG_ID_SMART_BATTERY_INFO_CRC); +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SMART_BATTERY_INFO_MIN_LEN, MAVLINK_MSG_ID_SMART_BATTERY_INFO_LEN, MAVLINK_MSG_ID_SMART_BATTERY_INFO_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SMART_BATTERY_INFO_MIN_LEN, MAVLINK_MSG_ID_SMART_BATTERY_INFO_LEN); +#endif } /** @@ -141,16 +251,21 @@ static inline uint16_t mavlink_msg_smart_battery_info_pack(uint8_t system_id, ui * @param capacity_full [mAh] Capacity when full (accounting for battery degradation), -1: field not provided. * @param cycle_count Charge/discharge cycle count. UINT16_MAX: field not provided. * @param serial_number Serial number in ASCII characters, 0 terminated. All 0: field not provided. - * @param device_name Static device name. Encode as manufacturer and product names separated using an underscore. + * @param device_name Static device name in ASCII characters, 0 terminated. All 0: field not provided. Encode as manufacturer name then product name separated using an underscore. * @param weight [g] Battery weight. 0: field not provided. * @param discharge_minimum_voltage [mV] Minimum per-cell voltage when discharging. If not supplied set to UINT16_MAX value. * @param charging_minimum_voltage [mV] Minimum per-cell voltage when charging. If not supplied set to UINT16_MAX value. * @param resting_minimum_voltage [mV] Minimum per-cell voltage when resting. If not supplied set to UINT16_MAX value. + * @param charging_maximum_voltage [mV] Maximum per-cell voltage when charged. 0: field not provided. + * @param cells_in_series Number of battery cells in series. 0: field not provided. + * @param discharge_maximum_current [mA] Maximum pack discharge current. 0: field not provided. + * @param discharge_maximum_burst_current [mA] Maximum pack discharge burst current. 0: field not provided. + * @param manufacture_date Manufacture date (DD/MM/YYYY) in ASCII characters, 0 terminated. All 0: field not provided. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_smart_battery_info_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - uint8_t id,uint8_t battery_function,uint8_t type,int32_t capacity_full_specification,int32_t capacity_full,uint16_t cycle_count,const char *serial_number,const char *device_name,uint16_t weight,uint16_t discharge_minimum_voltage,uint16_t charging_minimum_voltage,uint16_t resting_minimum_voltage) + uint8_t id,uint8_t battery_function,uint8_t type,int32_t capacity_full_specification,int32_t capacity_full,uint16_t cycle_count,const char *serial_number,const char *device_name,uint16_t weight,uint16_t discharge_minimum_voltage,uint16_t charging_minimum_voltage,uint16_t resting_minimum_voltage,uint16_t charging_maximum_voltage,uint8_t cells_in_series,uint32_t discharge_maximum_current,uint32_t discharge_maximum_burst_current,const char *manufacture_date) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_SMART_BATTERY_INFO_LEN]; @@ -164,8 +279,13 @@ static inline uint16_t mavlink_msg_smart_battery_info_pack_chan(uint8_t system_i _mav_put_uint8_t(buf, 18, id); _mav_put_uint8_t(buf, 19, battery_function); _mav_put_uint8_t(buf, 20, type); + _mav_put_uint16_t(buf, 87, charging_maximum_voltage); + _mav_put_uint8_t(buf, 89, cells_in_series); + _mav_put_uint32_t(buf, 90, discharge_maximum_current); + _mav_put_uint32_t(buf, 94, discharge_maximum_burst_current); _mav_put_char_array(buf, 21, serial_number, 16); _mav_put_char_array(buf, 37, device_name, 50); + _mav_put_char_array(buf, 98, manufacture_date, 11); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SMART_BATTERY_INFO_LEN); #else mavlink_smart_battery_info_t packet; @@ -179,8 +299,13 @@ static inline uint16_t mavlink_msg_smart_battery_info_pack_chan(uint8_t system_i packet.id = id; packet.battery_function = battery_function; packet.type = type; - mav_array_memcpy(packet.serial_number, serial_number, sizeof(char)*16); - mav_array_memcpy(packet.device_name, device_name, sizeof(char)*50); + packet.charging_maximum_voltage = charging_maximum_voltage; + packet.cells_in_series = cells_in_series; + packet.discharge_maximum_current = discharge_maximum_current; + packet.discharge_maximum_burst_current = discharge_maximum_burst_current; + mav_array_assign_char(packet.serial_number, serial_number, 16); + mav_array_assign_char(packet.device_name, device_name, 50); + mav_array_assign_char(packet.manufacture_date, manufacture_date, 11); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SMART_BATTERY_INFO_LEN); #endif @@ -198,7 +323,7 @@ static inline uint16_t mavlink_msg_smart_battery_info_pack_chan(uint8_t system_i */ static inline uint16_t mavlink_msg_smart_battery_info_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_smart_battery_info_t* smart_battery_info) { - return mavlink_msg_smart_battery_info_pack(system_id, component_id, msg, smart_battery_info->id, smart_battery_info->battery_function, smart_battery_info->type, smart_battery_info->capacity_full_specification, smart_battery_info->capacity_full, smart_battery_info->cycle_count, smart_battery_info->serial_number, smart_battery_info->device_name, smart_battery_info->weight, smart_battery_info->discharge_minimum_voltage, smart_battery_info->charging_minimum_voltage, smart_battery_info->resting_minimum_voltage); + return mavlink_msg_smart_battery_info_pack(system_id, component_id, msg, smart_battery_info->id, smart_battery_info->battery_function, smart_battery_info->type, smart_battery_info->capacity_full_specification, smart_battery_info->capacity_full, smart_battery_info->cycle_count, smart_battery_info->serial_number, smart_battery_info->device_name, smart_battery_info->weight, smart_battery_info->discharge_minimum_voltage, smart_battery_info->charging_minimum_voltage, smart_battery_info->resting_minimum_voltage, smart_battery_info->charging_maximum_voltage, smart_battery_info->cells_in_series, smart_battery_info->discharge_maximum_current, smart_battery_info->discharge_maximum_burst_current, smart_battery_info->manufacture_date); } /** @@ -212,7 +337,21 @@ static inline uint16_t mavlink_msg_smart_battery_info_encode(uint8_t system_id, */ static inline uint16_t mavlink_msg_smart_battery_info_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_smart_battery_info_t* smart_battery_info) { - return mavlink_msg_smart_battery_info_pack_chan(system_id, component_id, chan, msg, smart_battery_info->id, smart_battery_info->battery_function, smart_battery_info->type, smart_battery_info->capacity_full_specification, smart_battery_info->capacity_full, smart_battery_info->cycle_count, smart_battery_info->serial_number, smart_battery_info->device_name, smart_battery_info->weight, smart_battery_info->discharge_minimum_voltage, smart_battery_info->charging_minimum_voltage, smart_battery_info->resting_minimum_voltage); + return mavlink_msg_smart_battery_info_pack_chan(system_id, component_id, chan, msg, smart_battery_info->id, smart_battery_info->battery_function, smart_battery_info->type, smart_battery_info->capacity_full_specification, smart_battery_info->capacity_full, smart_battery_info->cycle_count, smart_battery_info->serial_number, smart_battery_info->device_name, smart_battery_info->weight, smart_battery_info->discharge_minimum_voltage, smart_battery_info->charging_minimum_voltage, smart_battery_info->resting_minimum_voltage, smart_battery_info->charging_maximum_voltage, smart_battery_info->cells_in_series, smart_battery_info->discharge_maximum_current, smart_battery_info->discharge_maximum_burst_current, smart_battery_info->manufacture_date); +} + +/** + * @brief Encode a smart_battery_info struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param smart_battery_info C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_smart_battery_info_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_smart_battery_info_t* smart_battery_info) +{ + return mavlink_msg_smart_battery_info_pack_status(system_id, component_id, _status, msg, smart_battery_info->id, smart_battery_info->battery_function, smart_battery_info->type, smart_battery_info->capacity_full_specification, smart_battery_info->capacity_full, smart_battery_info->cycle_count, smart_battery_info->serial_number, smart_battery_info->device_name, smart_battery_info->weight, smart_battery_info->discharge_minimum_voltage, smart_battery_info->charging_minimum_voltage, smart_battery_info->resting_minimum_voltage, smart_battery_info->charging_maximum_voltage, smart_battery_info->cells_in_series, smart_battery_info->discharge_maximum_current, smart_battery_info->discharge_maximum_burst_current, smart_battery_info->manufacture_date); } /** @@ -226,15 +365,20 @@ static inline uint16_t mavlink_msg_smart_battery_info_encode_chan(uint8_t system * @param capacity_full [mAh] Capacity when full (accounting for battery degradation), -1: field not provided. * @param cycle_count Charge/discharge cycle count. UINT16_MAX: field not provided. * @param serial_number Serial number in ASCII characters, 0 terminated. All 0: field not provided. - * @param device_name Static device name. Encode as manufacturer and product names separated using an underscore. + * @param device_name Static device name in ASCII characters, 0 terminated. All 0: field not provided. Encode as manufacturer name then product name separated using an underscore. * @param weight [g] Battery weight. 0: field not provided. * @param discharge_minimum_voltage [mV] Minimum per-cell voltage when discharging. If not supplied set to UINT16_MAX value. * @param charging_minimum_voltage [mV] Minimum per-cell voltage when charging. If not supplied set to UINT16_MAX value. * @param resting_minimum_voltage [mV] Minimum per-cell voltage when resting. If not supplied set to UINT16_MAX value. + * @param charging_maximum_voltage [mV] Maximum per-cell voltage when charged. 0: field not provided. + * @param cells_in_series Number of battery cells in series. 0: field not provided. + * @param discharge_maximum_current [mA] Maximum pack discharge current. 0: field not provided. + * @param discharge_maximum_burst_current [mA] Maximum pack discharge burst current. 0: field not provided. + * @param manufacture_date Manufacture date (DD/MM/YYYY) in ASCII characters, 0 terminated. All 0: field not provided. */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_smart_battery_info_send(mavlink_channel_t chan, uint8_t id, uint8_t battery_function, uint8_t type, int32_t capacity_full_specification, int32_t capacity_full, uint16_t cycle_count, const char *serial_number, const char *device_name, uint16_t weight, uint16_t discharge_minimum_voltage, uint16_t charging_minimum_voltage, uint16_t resting_minimum_voltage) +static inline void mavlink_msg_smart_battery_info_send(mavlink_channel_t chan, uint8_t id, uint8_t battery_function, uint8_t type, int32_t capacity_full_specification, int32_t capacity_full, uint16_t cycle_count, const char *serial_number, const char *device_name, uint16_t weight, uint16_t discharge_minimum_voltage, uint16_t charging_minimum_voltage, uint16_t resting_minimum_voltage, uint16_t charging_maximum_voltage, uint8_t cells_in_series, uint32_t discharge_maximum_current, uint32_t discharge_maximum_burst_current, const char *manufacture_date) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_SMART_BATTERY_INFO_LEN]; @@ -248,8 +392,13 @@ static inline void mavlink_msg_smart_battery_info_send(mavlink_channel_t chan, u _mav_put_uint8_t(buf, 18, id); _mav_put_uint8_t(buf, 19, battery_function); _mav_put_uint8_t(buf, 20, type); + _mav_put_uint16_t(buf, 87, charging_maximum_voltage); + _mav_put_uint8_t(buf, 89, cells_in_series); + _mav_put_uint32_t(buf, 90, discharge_maximum_current); + _mav_put_uint32_t(buf, 94, discharge_maximum_burst_current); _mav_put_char_array(buf, 21, serial_number, 16); _mav_put_char_array(buf, 37, device_name, 50); + _mav_put_char_array(buf, 98, manufacture_date, 11); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SMART_BATTERY_INFO, buf, MAVLINK_MSG_ID_SMART_BATTERY_INFO_MIN_LEN, MAVLINK_MSG_ID_SMART_BATTERY_INFO_LEN, MAVLINK_MSG_ID_SMART_BATTERY_INFO_CRC); #else mavlink_smart_battery_info_t packet; @@ -263,8 +412,13 @@ static inline void mavlink_msg_smart_battery_info_send(mavlink_channel_t chan, u packet.id = id; packet.battery_function = battery_function; packet.type = type; - mav_array_memcpy(packet.serial_number, serial_number, sizeof(char)*16); - mav_array_memcpy(packet.device_name, device_name, sizeof(char)*50); + packet.charging_maximum_voltage = charging_maximum_voltage; + packet.cells_in_series = cells_in_series; + packet.discharge_maximum_current = discharge_maximum_current; + packet.discharge_maximum_burst_current = discharge_maximum_burst_current; + mav_array_assign_char(packet.serial_number, serial_number, 16); + mav_array_assign_char(packet.device_name, device_name, 50); + mav_array_assign_char(packet.manufacture_date, manufacture_date, 11); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SMART_BATTERY_INFO, (const char *)&packet, MAVLINK_MSG_ID_SMART_BATTERY_INFO_MIN_LEN, MAVLINK_MSG_ID_SMART_BATTERY_INFO_LEN, MAVLINK_MSG_ID_SMART_BATTERY_INFO_CRC); #endif } @@ -277,7 +431,7 @@ static inline void mavlink_msg_smart_battery_info_send(mavlink_channel_t chan, u static inline void mavlink_msg_smart_battery_info_send_struct(mavlink_channel_t chan, const mavlink_smart_battery_info_t* smart_battery_info) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_smart_battery_info_send(chan, smart_battery_info->id, smart_battery_info->battery_function, smart_battery_info->type, smart_battery_info->capacity_full_specification, smart_battery_info->capacity_full, smart_battery_info->cycle_count, smart_battery_info->serial_number, smart_battery_info->device_name, smart_battery_info->weight, smart_battery_info->discharge_minimum_voltage, smart_battery_info->charging_minimum_voltage, smart_battery_info->resting_minimum_voltage); + mavlink_msg_smart_battery_info_send(chan, smart_battery_info->id, smart_battery_info->battery_function, smart_battery_info->type, smart_battery_info->capacity_full_specification, smart_battery_info->capacity_full, smart_battery_info->cycle_count, smart_battery_info->serial_number, smart_battery_info->device_name, smart_battery_info->weight, smart_battery_info->discharge_minimum_voltage, smart_battery_info->charging_minimum_voltage, smart_battery_info->resting_minimum_voltage, smart_battery_info->charging_maximum_voltage, smart_battery_info->cells_in_series, smart_battery_info->discharge_maximum_current, smart_battery_info->discharge_maximum_burst_current, smart_battery_info->manufacture_date); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SMART_BATTERY_INFO, (const char *)smart_battery_info, MAVLINK_MSG_ID_SMART_BATTERY_INFO_MIN_LEN, MAVLINK_MSG_ID_SMART_BATTERY_INFO_LEN, MAVLINK_MSG_ID_SMART_BATTERY_INFO_CRC); #endif @@ -285,13 +439,13 @@ static inline void mavlink_msg_smart_battery_info_send_struct(mavlink_channel_t #if MAVLINK_MSG_ID_SMART_BATTERY_INFO_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_smart_battery_info_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t id, uint8_t battery_function, uint8_t type, int32_t capacity_full_specification, int32_t capacity_full, uint16_t cycle_count, const char *serial_number, const char *device_name, uint16_t weight, uint16_t discharge_minimum_voltage, uint16_t charging_minimum_voltage, uint16_t resting_minimum_voltage) +static inline void mavlink_msg_smart_battery_info_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t id, uint8_t battery_function, uint8_t type, int32_t capacity_full_specification, int32_t capacity_full, uint16_t cycle_count, const char *serial_number, const char *device_name, uint16_t weight, uint16_t discharge_minimum_voltage, uint16_t charging_minimum_voltage, uint16_t resting_minimum_voltage, uint16_t charging_maximum_voltage, uint8_t cells_in_series, uint32_t discharge_maximum_current, uint32_t discharge_maximum_burst_current, const char *manufacture_date) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; @@ -305,8 +459,13 @@ static inline void mavlink_msg_smart_battery_info_send_buf(mavlink_message_t *ms _mav_put_uint8_t(buf, 18, id); _mav_put_uint8_t(buf, 19, battery_function); _mav_put_uint8_t(buf, 20, type); + _mav_put_uint16_t(buf, 87, charging_maximum_voltage); + _mav_put_uint8_t(buf, 89, cells_in_series); + _mav_put_uint32_t(buf, 90, discharge_maximum_current); + _mav_put_uint32_t(buf, 94, discharge_maximum_burst_current); _mav_put_char_array(buf, 21, serial_number, 16); _mav_put_char_array(buf, 37, device_name, 50); + _mav_put_char_array(buf, 98, manufacture_date, 11); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SMART_BATTERY_INFO, buf, MAVLINK_MSG_ID_SMART_BATTERY_INFO_MIN_LEN, MAVLINK_MSG_ID_SMART_BATTERY_INFO_LEN, MAVLINK_MSG_ID_SMART_BATTERY_INFO_CRC); #else mavlink_smart_battery_info_t *packet = (mavlink_smart_battery_info_t *)msgbuf; @@ -320,8 +479,13 @@ static inline void mavlink_msg_smart_battery_info_send_buf(mavlink_message_t *ms packet->id = id; packet->battery_function = battery_function; packet->type = type; - mav_array_memcpy(packet->serial_number, serial_number, sizeof(char)*16); - mav_array_memcpy(packet->device_name, device_name, sizeof(char)*50); + packet->charging_maximum_voltage = charging_maximum_voltage; + packet->cells_in_series = cells_in_series; + packet->discharge_maximum_current = discharge_maximum_current; + packet->discharge_maximum_burst_current = discharge_maximum_burst_current; + mav_array_assign_char(packet->serial_number, serial_number, 16); + mav_array_assign_char(packet->device_name, device_name, 50); + mav_array_assign_char(packet->manufacture_date, manufacture_date, 11); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SMART_BATTERY_INFO, (const char *)packet, MAVLINK_MSG_ID_SMART_BATTERY_INFO_MIN_LEN, MAVLINK_MSG_ID_SMART_BATTERY_INFO_LEN, MAVLINK_MSG_ID_SMART_BATTERY_INFO_CRC); #endif } @@ -405,7 +569,7 @@ static inline uint16_t mavlink_msg_smart_battery_info_get_serial_number(const ma /** * @brief Get field device_name from smart_battery_info message * - * @return Static device name. Encode as manufacturer and product names separated using an underscore. + * @return Static device name in ASCII characters, 0 terminated. All 0: field not provided. Encode as manufacturer name then product name separated using an underscore. */ static inline uint16_t mavlink_msg_smart_battery_info_get_device_name(const mavlink_message_t* msg, char *device_name) { @@ -452,6 +616,56 @@ static inline uint16_t mavlink_msg_smart_battery_info_get_resting_minimum_voltag return _MAV_RETURN_uint16_t(msg, 16); } +/** + * @brief Get field charging_maximum_voltage from smart_battery_info message + * + * @return [mV] Maximum per-cell voltage when charged. 0: field not provided. + */ +static inline uint16_t mavlink_msg_smart_battery_info_get_charging_maximum_voltage(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 87); +} + +/** + * @brief Get field cells_in_series from smart_battery_info message + * + * @return Number of battery cells in series. 0: field not provided. + */ +static inline uint8_t mavlink_msg_smart_battery_info_get_cells_in_series(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 89); +} + +/** + * @brief Get field discharge_maximum_current from smart_battery_info message + * + * @return [mA] Maximum pack discharge current. 0: field not provided. + */ +static inline uint32_t mavlink_msg_smart_battery_info_get_discharge_maximum_current(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 90); +} + +/** + * @brief Get field discharge_maximum_burst_current from smart_battery_info message + * + * @return [mA] Maximum pack discharge burst current. 0: field not provided. + */ +static inline uint32_t mavlink_msg_smart_battery_info_get_discharge_maximum_burst_current(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 94); +} + +/** + * @brief Get field manufacture_date from smart_battery_info message + * + * @return Manufacture date (DD/MM/YYYY) in ASCII characters, 0 terminated. All 0: field not provided. + */ +static inline uint16_t mavlink_msg_smart_battery_info_get_manufacture_date(const mavlink_message_t* msg, char *manufacture_date) +{ + return _MAV_RETURN_char_array(msg, manufacture_date, 11, 98); +} + /** * @brief Decode a smart_battery_info message into a struct * @@ -473,6 +687,11 @@ static inline void mavlink_msg_smart_battery_info_decode(const mavlink_message_t smart_battery_info->type = mavlink_msg_smart_battery_info_get_type(msg); mavlink_msg_smart_battery_info_get_serial_number(msg, smart_battery_info->serial_number); mavlink_msg_smart_battery_info_get_device_name(msg, smart_battery_info->device_name); + smart_battery_info->charging_maximum_voltage = mavlink_msg_smart_battery_info_get_charging_maximum_voltage(msg); + smart_battery_info->cells_in_series = mavlink_msg_smart_battery_info_get_cells_in_series(msg); + smart_battery_info->discharge_maximum_current = mavlink_msg_smart_battery_info_get_discharge_maximum_current(msg); + smart_battery_info->discharge_maximum_burst_current = mavlink_msg_smart_battery_info_get_discharge_maximum_burst_current(msg); + mavlink_msg_smart_battery_info_get_manufacture_date(msg, smart_battery_info->manufacture_date); #else uint8_t len = msg->len < MAVLINK_MSG_ID_SMART_BATTERY_INFO_LEN? msg->len : MAVLINK_MSG_ID_SMART_BATTERY_INFO_LEN; memset(smart_battery_info, 0, MAVLINK_MSG_ID_SMART_BATTERY_INFO_LEN); diff --git a/common/mavlink_msg_statustext.h b/common/mavlink_msg_statustext.h index 28e0c0b0f..57facb8a5 100644 --- a/common/mavlink_msg_statustext.h +++ b/common/mavlink_msg_statustext.h @@ -71,7 +71,7 @@ static inline uint16_t mavlink_msg_statustext_pack(uint8_t system_id, uint8_t co packet.severity = severity; packet.id = id; packet.chunk_seq = chunk_seq; - mav_array_memcpy(packet.text, text, sizeof(char)*50); + mav_array_assign_char(packet.text, text, 50); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_STATUSTEXT_LEN); #endif @@ -79,6 +79,46 @@ static inline uint16_t mavlink_msg_statustext_pack(uint8_t system_id, uint8_t co return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_STATUSTEXT_MIN_LEN, MAVLINK_MSG_ID_STATUSTEXT_LEN, MAVLINK_MSG_ID_STATUSTEXT_CRC); } +/** + * @brief Pack a statustext message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param severity Severity of status. Relies on the definitions within RFC-5424. + * @param text Status text message, without null termination character + * @param id Unique (opaque) identifier for this statustext message. May be used to reassemble a logical long-statustext message from a sequence of chunks. A value of zero indicates this is the only chunk in the sequence and the message can be emitted immediately. + * @param chunk_seq This chunk's sequence number; indexing is from zero. Any null character in the text field is taken to mean this was the last chunk. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_statustext_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t severity, const char *text, uint16_t id, uint8_t chunk_seq) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_STATUSTEXT_LEN]; + _mav_put_uint8_t(buf, 0, severity); + _mav_put_uint16_t(buf, 51, id); + _mav_put_uint8_t(buf, 53, chunk_seq); + _mav_put_char_array(buf, 1, text, 50); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_STATUSTEXT_LEN); +#else + mavlink_statustext_t packet; + packet.severity = severity; + packet.id = id; + packet.chunk_seq = chunk_seq; + mav_array_memcpy(packet.text, text, sizeof(char)*50); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_STATUSTEXT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_STATUSTEXT; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_STATUSTEXT_MIN_LEN, MAVLINK_MSG_ID_STATUSTEXT_LEN, MAVLINK_MSG_ID_STATUSTEXT_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_STATUSTEXT_MIN_LEN, MAVLINK_MSG_ID_STATUSTEXT_LEN); +#endif +} + /** * @brief Pack a statustext message on a channel * @param system_id ID of this system @@ -107,7 +147,7 @@ static inline uint16_t mavlink_msg_statustext_pack_chan(uint8_t system_id, uint8 packet.severity = severity; packet.id = id; packet.chunk_seq = chunk_seq; - mav_array_memcpy(packet.text, text, sizeof(char)*50); + mav_array_assign_char(packet.text, text, 50); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_STATUSTEXT_LEN); #endif @@ -142,6 +182,20 @@ static inline uint16_t mavlink_msg_statustext_encode_chan(uint8_t system_id, uin return mavlink_msg_statustext_pack_chan(system_id, component_id, chan, msg, statustext->severity, statustext->text, statustext->id, statustext->chunk_seq); } +/** + * @brief Encode a statustext struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param statustext C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_statustext_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_statustext_t* statustext) +{ + return mavlink_msg_statustext_pack_status(system_id, component_id, _status, msg, statustext->severity, statustext->text, statustext->id, statustext->chunk_seq); +} + /** * @brief Send a statustext message * @param chan MAVLink channel to send the message @@ -167,7 +221,7 @@ static inline void mavlink_msg_statustext_send(mavlink_channel_t chan, uint8_t s packet.severity = severity; packet.id = id; packet.chunk_seq = chunk_seq; - mav_array_memcpy(packet.text, text, sizeof(char)*50); + mav_array_assign_char(packet.text, text, 50); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT, (const char *)&packet, MAVLINK_MSG_ID_STATUSTEXT_MIN_LEN, MAVLINK_MSG_ID_STATUSTEXT_LEN, MAVLINK_MSG_ID_STATUSTEXT_CRC); #endif } @@ -188,7 +242,7 @@ static inline void mavlink_msg_statustext_send_struct(mavlink_channel_t chan, co #if MAVLINK_MSG_ID_STATUSTEXT_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -208,7 +262,7 @@ static inline void mavlink_msg_statustext_send_buf(mavlink_message_t *msgbuf, ma packet->severity = severity; packet->id = id; packet->chunk_seq = chunk_seq; - mav_array_memcpy(packet->text, text, sizeof(char)*50); + mav_array_assign_char(packet->text, text, 50); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT, (const char *)packet, MAVLINK_MSG_ID_STATUSTEXT_MIN_LEN, MAVLINK_MSG_ID_STATUSTEXT_LEN, MAVLINK_MSG_ID_STATUSTEXT_CRC); #endif } diff --git a/common/mavlink_msg_storage_information.h b/common/mavlink_msg_storage_information.h index 76d8afd57..59db68826 100644 --- a/common/mavlink_msg_storage_information.h +++ b/common/mavlink_msg_storage_information.h @@ -16,11 +16,15 @@ typedef struct __mavlink_storage_information_t { uint8_t status; /*< Status of storage*/ uint8_t type; /*< Type of storage*/ char name[32]; /*< Textual storage name to be used in UI (microSD 1, Internal Memory, etc.) This is a NULL terminated string. If it is exactly 32 characters long, add a terminating NULL. If this string is empty, the generic type is shown to the user.*/ + uint8_t storage_usage; /*< Flags indicating whether this instance is preferred storage for photos, videos, etc. + Note: Implementations should initially set the flags on the system-default storage id used for saving media (if possible/supported). + This setting can then be overridden using MAV_CMD_SET_STORAGE_USAGE. + If the media usage flags are not set, a GCS may assume storage ID 1 is the default storage for all media types.*/ } mavlink_storage_information_t; -#define MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN 60 +#define MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN 61 #define MAVLINK_MSG_ID_STORAGE_INFORMATION_MIN_LEN 27 -#define MAVLINK_MSG_ID_261_LEN 60 +#define MAVLINK_MSG_ID_261_LEN 61 #define MAVLINK_MSG_ID_261_MIN_LEN 27 #define MAVLINK_MSG_ID_STORAGE_INFORMATION_CRC 179 @@ -32,7 +36,7 @@ typedef struct __mavlink_storage_information_t { #define MAVLINK_MESSAGE_INFO_STORAGE_INFORMATION { \ 261, \ "STORAGE_INFORMATION", \ - 11, \ + 12, \ { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_storage_information_t, time_boot_ms) }, \ { "storage_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_storage_information_t, storage_id) }, \ { "storage_count", NULL, MAVLINK_TYPE_UINT8_T, 0, 25, offsetof(mavlink_storage_information_t, storage_count) }, \ @@ -44,12 +48,13 @@ typedef struct __mavlink_storage_information_t { { "write_speed", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_storage_information_t, write_speed) }, \ { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 27, offsetof(mavlink_storage_information_t, type) }, \ { "name", NULL, MAVLINK_TYPE_CHAR, 32, 28, offsetof(mavlink_storage_information_t, name) }, \ + { "storage_usage", NULL, MAVLINK_TYPE_UINT8_T, 0, 60, offsetof(mavlink_storage_information_t, storage_usage) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_STORAGE_INFORMATION { \ "STORAGE_INFORMATION", \ - 11, \ + 12, \ { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_storage_information_t, time_boot_ms) }, \ { "storage_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_storage_information_t, storage_id) }, \ { "storage_count", NULL, MAVLINK_TYPE_UINT8_T, 0, 25, offsetof(mavlink_storage_information_t, storage_count) }, \ @@ -61,6 +66,7 @@ typedef struct __mavlink_storage_information_t { { "write_speed", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_storage_information_t, write_speed) }, \ { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 27, offsetof(mavlink_storage_information_t, type) }, \ { "name", NULL, MAVLINK_TYPE_CHAR, 32, 28, offsetof(mavlink_storage_information_t, name) }, \ + { "storage_usage", NULL, MAVLINK_TYPE_UINT8_T, 0, 60, offsetof(mavlink_storage_information_t, storage_usage) }, \ } \ } #endif @@ -82,10 +88,14 @@ typedef struct __mavlink_storage_information_t { * @param write_speed [MiB/s] Write speed. * @param type Type of storage * @param name Textual storage name to be used in UI (microSD 1, Internal Memory, etc.) This is a NULL terminated string. If it is exactly 32 characters long, add a terminating NULL. If this string is empty, the generic type is shown to the user. + * @param storage_usage Flags indicating whether this instance is preferred storage for photos, videos, etc. + Note: Implementations should initially set the flags on the system-default storage id used for saving media (if possible/supported). + This setting can then be overridden using MAV_CMD_SET_STORAGE_USAGE. + If the media usage flags are not set, a GCS may assume storage ID 1 is the default storage for all media types. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_storage_information_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint32_t time_boot_ms, uint8_t storage_id, uint8_t storage_count, uint8_t status, float total_capacity, float used_capacity, float available_capacity, float read_speed, float write_speed, uint8_t type, const char *name) + uint32_t time_boot_ms, uint8_t storage_id, uint8_t storage_count, uint8_t status, float total_capacity, float used_capacity, float available_capacity, float read_speed, float write_speed, uint8_t type, const char *name, uint8_t storage_usage) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN]; @@ -99,6 +109,7 @@ static inline uint16_t mavlink_msg_storage_information_pack(uint8_t system_id, u _mav_put_uint8_t(buf, 25, storage_count); _mav_put_uint8_t(buf, 26, status); _mav_put_uint8_t(buf, 27, type); + _mav_put_uint8_t(buf, 60, storage_usage); _mav_put_char_array(buf, 28, name, 32); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN); #else @@ -113,7 +124,8 @@ static inline uint16_t mavlink_msg_storage_information_pack(uint8_t system_id, u packet.storage_count = storage_count; packet.status = status; packet.type = type; - mav_array_memcpy(packet.name, name, sizeof(char)*32); + packet.storage_usage = storage_usage; + mav_array_assign_char(packet.name, name, 32); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN); #endif @@ -121,6 +133,73 @@ static inline uint16_t mavlink_msg_storage_information_pack(uint8_t system_id, u return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_STORAGE_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN, MAVLINK_MSG_ID_STORAGE_INFORMATION_CRC); } +/** + * @brief Pack a storage_information message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param storage_id Storage ID (1 for first, 2 for second, etc.) + * @param storage_count Number of storage devices + * @param status Status of storage + * @param total_capacity [MiB] Total capacity. If storage is not ready (STORAGE_STATUS_READY) value will be ignored. + * @param used_capacity [MiB] Used capacity. If storage is not ready (STORAGE_STATUS_READY) value will be ignored. + * @param available_capacity [MiB] Available storage capacity. If storage is not ready (STORAGE_STATUS_READY) value will be ignored. + * @param read_speed [MiB/s] Read speed. + * @param write_speed [MiB/s] Write speed. + * @param type Type of storage + * @param name Textual storage name to be used in UI (microSD 1, Internal Memory, etc.) This is a NULL terminated string. If it is exactly 32 characters long, add a terminating NULL. If this string is empty, the generic type is shown to the user. + * @param storage_usage Flags indicating whether this instance is preferred storage for photos, videos, etc. + Note: Implementations should initially set the flags on the system-default storage id used for saving media (if possible/supported). + This setting can then be overridden using MAV_CMD_SET_STORAGE_USAGE. + If the media usage flags are not set, a GCS may assume storage ID 1 is the default storage for all media types. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_storage_information_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, uint8_t storage_id, uint8_t storage_count, uint8_t status, float total_capacity, float used_capacity, float available_capacity, float read_speed, float write_speed, uint8_t type, const char *name, uint8_t storage_usage) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_float(buf, 4, total_capacity); + _mav_put_float(buf, 8, used_capacity); + _mav_put_float(buf, 12, available_capacity); + _mav_put_float(buf, 16, read_speed); + _mav_put_float(buf, 20, write_speed); + _mav_put_uint8_t(buf, 24, storage_id); + _mav_put_uint8_t(buf, 25, storage_count); + _mav_put_uint8_t(buf, 26, status); + _mav_put_uint8_t(buf, 27, type); + _mav_put_uint8_t(buf, 60, storage_usage); + _mav_put_char_array(buf, 28, name, 32); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN); +#else + mavlink_storage_information_t packet; + packet.time_boot_ms = time_boot_ms; + packet.total_capacity = total_capacity; + packet.used_capacity = used_capacity; + packet.available_capacity = available_capacity; + packet.read_speed = read_speed; + packet.write_speed = write_speed; + packet.storage_id = storage_id; + packet.storage_count = storage_count; + packet.status = status; + packet.type = type; + packet.storage_usage = storage_usage; + mav_array_memcpy(packet.name, name, sizeof(char)*32); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_STORAGE_INFORMATION; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_STORAGE_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN, MAVLINK_MSG_ID_STORAGE_INFORMATION_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_STORAGE_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN); +#endif +} + /** * @brief Pack a storage_information message on a channel * @param system_id ID of this system @@ -138,11 +217,15 @@ static inline uint16_t mavlink_msg_storage_information_pack(uint8_t system_id, u * @param write_speed [MiB/s] Write speed. * @param type Type of storage * @param name Textual storage name to be used in UI (microSD 1, Internal Memory, etc.) This is a NULL terminated string. If it is exactly 32 characters long, add a terminating NULL. If this string is empty, the generic type is shown to the user. + * @param storage_usage Flags indicating whether this instance is preferred storage for photos, videos, etc. + Note: Implementations should initially set the flags on the system-default storage id used for saving media (if possible/supported). + This setting can then be overridden using MAV_CMD_SET_STORAGE_USAGE. + If the media usage flags are not set, a GCS may assume storage ID 1 is the default storage for all media types. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_storage_information_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - uint32_t time_boot_ms,uint8_t storage_id,uint8_t storage_count,uint8_t status,float total_capacity,float used_capacity,float available_capacity,float read_speed,float write_speed,uint8_t type,const char *name) + uint32_t time_boot_ms,uint8_t storage_id,uint8_t storage_count,uint8_t status,float total_capacity,float used_capacity,float available_capacity,float read_speed,float write_speed,uint8_t type,const char *name,uint8_t storage_usage) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN]; @@ -156,6 +239,7 @@ static inline uint16_t mavlink_msg_storage_information_pack_chan(uint8_t system_ _mav_put_uint8_t(buf, 25, storage_count); _mav_put_uint8_t(buf, 26, status); _mav_put_uint8_t(buf, 27, type); + _mav_put_uint8_t(buf, 60, storage_usage); _mav_put_char_array(buf, 28, name, 32); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN); #else @@ -170,7 +254,8 @@ static inline uint16_t mavlink_msg_storage_information_pack_chan(uint8_t system_ packet.storage_count = storage_count; packet.status = status; packet.type = type; - mav_array_memcpy(packet.name, name, sizeof(char)*32); + packet.storage_usage = storage_usage; + mav_array_assign_char(packet.name, name, 32); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN); #endif @@ -188,7 +273,7 @@ static inline uint16_t mavlink_msg_storage_information_pack_chan(uint8_t system_ */ static inline uint16_t mavlink_msg_storage_information_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_storage_information_t* storage_information) { - return mavlink_msg_storage_information_pack(system_id, component_id, msg, storage_information->time_boot_ms, storage_information->storage_id, storage_information->storage_count, storage_information->status, storage_information->total_capacity, storage_information->used_capacity, storage_information->available_capacity, storage_information->read_speed, storage_information->write_speed, storage_information->type, storage_information->name); + return mavlink_msg_storage_information_pack(system_id, component_id, msg, storage_information->time_boot_ms, storage_information->storage_id, storage_information->storage_count, storage_information->status, storage_information->total_capacity, storage_information->used_capacity, storage_information->available_capacity, storage_information->read_speed, storage_information->write_speed, storage_information->type, storage_information->name, storage_information->storage_usage); } /** @@ -202,7 +287,21 @@ static inline uint16_t mavlink_msg_storage_information_encode(uint8_t system_id, */ static inline uint16_t mavlink_msg_storage_information_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_storage_information_t* storage_information) { - return mavlink_msg_storage_information_pack_chan(system_id, component_id, chan, msg, storage_information->time_boot_ms, storage_information->storage_id, storage_information->storage_count, storage_information->status, storage_information->total_capacity, storage_information->used_capacity, storage_information->available_capacity, storage_information->read_speed, storage_information->write_speed, storage_information->type, storage_information->name); + return mavlink_msg_storage_information_pack_chan(system_id, component_id, chan, msg, storage_information->time_boot_ms, storage_information->storage_id, storage_information->storage_count, storage_information->status, storage_information->total_capacity, storage_information->used_capacity, storage_information->available_capacity, storage_information->read_speed, storage_information->write_speed, storage_information->type, storage_information->name, storage_information->storage_usage); +} + +/** + * @brief Encode a storage_information struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param storage_information C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_storage_information_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_storage_information_t* storage_information) +{ + return mavlink_msg_storage_information_pack_status(system_id, component_id, _status, msg, storage_information->time_boot_ms, storage_information->storage_id, storage_information->storage_count, storage_information->status, storage_information->total_capacity, storage_information->used_capacity, storage_information->available_capacity, storage_information->read_speed, storage_information->write_speed, storage_information->type, storage_information->name, storage_information->storage_usage); } /** @@ -220,10 +319,14 @@ static inline uint16_t mavlink_msg_storage_information_encode_chan(uint8_t syste * @param write_speed [MiB/s] Write speed. * @param type Type of storage * @param name Textual storage name to be used in UI (microSD 1, Internal Memory, etc.) This is a NULL terminated string. If it is exactly 32 characters long, add a terminating NULL. If this string is empty, the generic type is shown to the user. + * @param storage_usage Flags indicating whether this instance is preferred storage for photos, videos, etc. + Note: Implementations should initially set the flags on the system-default storage id used for saving media (if possible/supported). + This setting can then be overridden using MAV_CMD_SET_STORAGE_USAGE. + If the media usage flags are not set, a GCS may assume storage ID 1 is the default storage for all media types. */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_storage_information_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t storage_id, uint8_t storage_count, uint8_t status, float total_capacity, float used_capacity, float available_capacity, float read_speed, float write_speed, uint8_t type, const char *name) +static inline void mavlink_msg_storage_information_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t storage_id, uint8_t storage_count, uint8_t status, float total_capacity, float used_capacity, float available_capacity, float read_speed, float write_speed, uint8_t type, const char *name, uint8_t storage_usage) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN]; @@ -237,6 +340,7 @@ static inline void mavlink_msg_storage_information_send(mavlink_channel_t chan, _mav_put_uint8_t(buf, 25, storage_count); _mav_put_uint8_t(buf, 26, status); _mav_put_uint8_t(buf, 27, type); + _mav_put_uint8_t(buf, 60, storage_usage); _mav_put_char_array(buf, 28, name, 32); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STORAGE_INFORMATION, buf, MAVLINK_MSG_ID_STORAGE_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN, MAVLINK_MSG_ID_STORAGE_INFORMATION_CRC); #else @@ -251,7 +355,8 @@ static inline void mavlink_msg_storage_information_send(mavlink_channel_t chan, packet.storage_count = storage_count; packet.status = status; packet.type = type; - mav_array_memcpy(packet.name, name, sizeof(char)*32); + packet.storage_usage = storage_usage; + mav_array_assign_char(packet.name, name, 32); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STORAGE_INFORMATION, (const char *)&packet, MAVLINK_MSG_ID_STORAGE_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN, MAVLINK_MSG_ID_STORAGE_INFORMATION_CRC); #endif } @@ -264,7 +369,7 @@ static inline void mavlink_msg_storage_information_send(mavlink_channel_t chan, static inline void mavlink_msg_storage_information_send_struct(mavlink_channel_t chan, const mavlink_storage_information_t* storage_information) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_storage_information_send(chan, storage_information->time_boot_ms, storage_information->storage_id, storage_information->storage_count, storage_information->status, storage_information->total_capacity, storage_information->used_capacity, storage_information->available_capacity, storage_information->read_speed, storage_information->write_speed, storage_information->type, storage_information->name); + mavlink_msg_storage_information_send(chan, storage_information->time_boot_ms, storage_information->storage_id, storage_information->storage_count, storage_information->status, storage_information->total_capacity, storage_information->used_capacity, storage_information->available_capacity, storage_information->read_speed, storage_information->write_speed, storage_information->type, storage_information->name, storage_information->storage_usage); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STORAGE_INFORMATION, (const char *)storage_information, MAVLINK_MSG_ID_STORAGE_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN, MAVLINK_MSG_ID_STORAGE_INFORMATION_CRC); #endif @@ -272,13 +377,13 @@ static inline void mavlink_msg_storage_information_send_struct(mavlink_channel_t #if MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_storage_information_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t storage_id, uint8_t storage_count, uint8_t status, float total_capacity, float used_capacity, float available_capacity, float read_speed, float write_speed, uint8_t type, const char *name) +static inline void mavlink_msg_storage_information_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t storage_id, uint8_t storage_count, uint8_t status, float total_capacity, float used_capacity, float available_capacity, float read_speed, float write_speed, uint8_t type, const char *name, uint8_t storage_usage) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; @@ -292,6 +397,7 @@ static inline void mavlink_msg_storage_information_send_buf(mavlink_message_t *m _mav_put_uint8_t(buf, 25, storage_count); _mav_put_uint8_t(buf, 26, status); _mav_put_uint8_t(buf, 27, type); + _mav_put_uint8_t(buf, 60, storage_usage); _mav_put_char_array(buf, 28, name, 32); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STORAGE_INFORMATION, buf, MAVLINK_MSG_ID_STORAGE_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN, MAVLINK_MSG_ID_STORAGE_INFORMATION_CRC); #else @@ -306,7 +412,8 @@ static inline void mavlink_msg_storage_information_send_buf(mavlink_message_t *m packet->storage_count = storage_count; packet->status = status; packet->type = type; - mav_array_memcpy(packet->name, name, sizeof(char)*32); + packet->storage_usage = storage_usage; + mav_array_assign_char(packet->name, name, 32); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STORAGE_INFORMATION, (const char *)packet, MAVLINK_MSG_ID_STORAGE_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN, MAVLINK_MSG_ID_STORAGE_INFORMATION_CRC); #endif } @@ -427,6 +534,19 @@ static inline uint16_t mavlink_msg_storage_information_get_name(const mavlink_me return _MAV_RETURN_char_array(msg, name, 32, 28); } +/** + * @brief Get field storage_usage from storage_information message + * + * @return Flags indicating whether this instance is preferred storage for photos, videos, etc. + Note: Implementations should initially set the flags on the system-default storage id used for saving media (if possible/supported). + This setting can then be overridden using MAV_CMD_SET_STORAGE_USAGE. + If the media usage flags are not set, a GCS may assume storage ID 1 is the default storage for all media types. + */ +static inline uint8_t mavlink_msg_storage_information_get_storage_usage(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 60); +} + /** * @brief Decode a storage_information message into a struct * @@ -447,6 +567,7 @@ static inline void mavlink_msg_storage_information_decode(const mavlink_message_ storage_information->status = mavlink_msg_storage_information_get_status(msg); storage_information->type = mavlink_msg_storage_information_get_type(msg); mavlink_msg_storage_information_get_name(msg, storage_information->name); + storage_information->storage_usage = mavlink_msg_storage_information_get_storage_usage(msg); #else uint8_t len = msg->len < MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN? msg->len : MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN; memset(storage_information, 0, MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN); diff --git a/common/mavlink_msg_supported_tunes.h b/common/mavlink_msg_supported_tunes.h index a8fb9a3ab..801414a7e 100644 --- a/common/mavlink_msg_supported_tunes.h +++ b/common/mavlink_msg_supported_tunes.h @@ -75,6 +75,45 @@ static inline uint16_t mavlink_msg_supported_tunes_pack(uint8_t system_id, uint8 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SUPPORTED_TUNES_MIN_LEN, MAVLINK_MSG_ID_SUPPORTED_TUNES_LEN, MAVLINK_MSG_ID_SUPPORTED_TUNES_CRC); } +/** + * @brief Pack a supported_tunes message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID + * @param target_component Component ID + * @param format Bitfield of supported tune formats. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_supported_tunes_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint32_t format) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_SUPPORTED_TUNES_LEN]; + _mav_put_uint32_t(buf, 0, format); + _mav_put_uint8_t(buf, 4, target_system); + _mav_put_uint8_t(buf, 5, target_component); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SUPPORTED_TUNES_LEN); +#else + mavlink_supported_tunes_t packet; + packet.format = format; + packet.target_system = target_system; + packet.target_component = target_component; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SUPPORTED_TUNES_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_SUPPORTED_TUNES; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SUPPORTED_TUNES_MIN_LEN, MAVLINK_MSG_ID_SUPPORTED_TUNES_LEN, MAVLINK_MSG_ID_SUPPORTED_TUNES_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SUPPORTED_TUNES_MIN_LEN, MAVLINK_MSG_ID_SUPPORTED_TUNES_LEN); +#endif +} + /** * @brief Pack a supported_tunes message on a channel * @param system_id ID of this system @@ -137,6 +176,20 @@ static inline uint16_t mavlink_msg_supported_tunes_encode_chan(uint8_t system_id return mavlink_msg_supported_tunes_pack_chan(system_id, component_id, chan, msg, supported_tunes->target_system, supported_tunes->target_component, supported_tunes->format); } +/** + * @brief Encode a supported_tunes struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param supported_tunes C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_supported_tunes_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_supported_tunes_t* supported_tunes) +{ + return mavlink_msg_supported_tunes_pack_status(system_id, component_id, _status, msg, supported_tunes->target_system, supported_tunes->target_component, supported_tunes->format); +} + /** * @brief Send a supported_tunes message * @param chan MAVLink channel to send the message @@ -182,7 +235,7 @@ static inline void mavlink_msg_supported_tunes_send_struct(mavlink_channel_t cha #if MAVLINK_MSG_ID_SUPPORTED_TUNES_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_sys_status.h b/common/mavlink_msg_sys_status.h index 301302a14..75fc3bb64 100644 --- a/common/mavlink_msg_sys_status.h +++ b/common/mavlink_msg_sys_status.h @@ -3,7 +3,7 @@ #define MAVLINK_MSG_ID_SYS_STATUS 1 - +MAVPACKED( typedef struct __mavlink_sys_status_t { uint32_t onboard_control_sensors_present; /*< Bitmap showing which onboard controllers and sensors are present. Value of 0: not present. Value of 1: present.*/ uint32_t onboard_control_sensors_enabled; /*< Bitmap showing which onboard controllers and sensors are enabled: Value of 0: not enabled. Value of 1: enabled.*/ @@ -18,11 +18,14 @@ typedef struct __mavlink_sys_status_t { uint16_t errors_count3; /*< Autopilot-specific errors*/ uint16_t errors_count4; /*< Autopilot-specific errors*/ int8_t battery_remaining; /*< [%] Battery energy remaining, -1: Battery remaining energy not sent by autopilot*/ -} mavlink_sys_status_t; + uint32_t onboard_control_sensors_present_extended; /*< Bitmap showing which onboard controllers and sensors are present. Value of 0: not present. Value of 1: present.*/ + uint32_t onboard_control_sensors_enabled_extended; /*< Bitmap showing which onboard controllers and sensors are enabled: Value of 0: not enabled. Value of 1: enabled.*/ + uint32_t onboard_control_sensors_health_extended; /*< Bitmap showing which onboard controllers and sensors have an error (or are operational). Value of 0: error. Value of 1: healthy.*/ +}) mavlink_sys_status_t; -#define MAVLINK_MSG_ID_SYS_STATUS_LEN 31 +#define MAVLINK_MSG_ID_SYS_STATUS_LEN 43 #define MAVLINK_MSG_ID_SYS_STATUS_MIN_LEN 31 -#define MAVLINK_MSG_ID_1_LEN 31 +#define MAVLINK_MSG_ID_1_LEN 43 #define MAVLINK_MSG_ID_1_MIN_LEN 31 #define MAVLINK_MSG_ID_SYS_STATUS_CRC 124 @@ -34,7 +37,7 @@ typedef struct __mavlink_sys_status_t { #define MAVLINK_MESSAGE_INFO_SYS_STATUS { \ 1, \ "SYS_STATUS", \ - 13, \ + 16, \ { { "onboard_control_sensors_present", "0x%04x", MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_sys_status_t, onboard_control_sensors_present) }, \ { "onboard_control_sensors_enabled", "0x%04x", MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_sys_status_t, onboard_control_sensors_enabled) }, \ { "onboard_control_sensors_health", "0x%04x", MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_sys_status_t, onboard_control_sensors_health) }, \ @@ -48,12 +51,15 @@ typedef struct __mavlink_sys_status_t { { "errors_count2", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_sys_status_t, errors_count2) }, \ { "errors_count3", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_sys_status_t, errors_count3) }, \ { "errors_count4", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_sys_status_t, errors_count4) }, \ + { "onboard_control_sensors_present_extended", "0x%04x", MAVLINK_TYPE_UINT32_T, 0, 31, offsetof(mavlink_sys_status_t, onboard_control_sensors_present_extended) }, \ + { "onboard_control_sensors_enabled_extended", "0x%04x", MAVLINK_TYPE_UINT32_T, 0, 35, offsetof(mavlink_sys_status_t, onboard_control_sensors_enabled_extended) }, \ + { "onboard_control_sensors_health_extended", "0x%04x", MAVLINK_TYPE_UINT32_T, 0, 39, offsetof(mavlink_sys_status_t, onboard_control_sensors_health_extended) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_SYS_STATUS { \ "SYS_STATUS", \ - 13, \ + 16, \ { { "onboard_control_sensors_present", "0x%04x", MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_sys_status_t, onboard_control_sensors_present) }, \ { "onboard_control_sensors_enabled", "0x%04x", MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_sys_status_t, onboard_control_sensors_enabled) }, \ { "onboard_control_sensors_health", "0x%04x", MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_sys_status_t, onboard_control_sensors_health) }, \ @@ -67,6 +73,9 @@ typedef struct __mavlink_sys_status_t { { "errors_count2", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_sys_status_t, errors_count2) }, \ { "errors_count3", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_sys_status_t, errors_count3) }, \ { "errors_count4", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_sys_status_t, errors_count4) }, \ + { "onboard_control_sensors_present_extended", "0x%04x", MAVLINK_TYPE_UINT32_T, 0, 31, offsetof(mavlink_sys_status_t, onboard_control_sensors_present_extended) }, \ + { "onboard_control_sensors_enabled_extended", "0x%04x", MAVLINK_TYPE_UINT32_T, 0, 35, offsetof(mavlink_sys_status_t, onboard_control_sensors_enabled_extended) }, \ + { "onboard_control_sensors_health_extended", "0x%04x", MAVLINK_TYPE_UINT32_T, 0, 39, offsetof(mavlink_sys_status_t, onboard_control_sensors_health_extended) }, \ } \ } #endif @@ -90,10 +99,13 @@ typedef struct __mavlink_sys_status_t { * @param errors_count2 Autopilot-specific errors * @param errors_count3 Autopilot-specific errors * @param errors_count4 Autopilot-specific errors + * @param onboard_control_sensors_present_extended Bitmap showing which onboard controllers and sensors are present. Value of 0: not present. Value of 1: present. + * @param onboard_control_sensors_enabled_extended Bitmap showing which onboard controllers and sensors are enabled: Value of 0: not enabled. Value of 1: enabled. + * @param onboard_control_sensors_health_extended Bitmap showing which onboard controllers and sensors have an error (or are operational). Value of 0: error. Value of 1: healthy. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_sys_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint32_t onboard_control_sensors_present, uint32_t onboard_control_sensors_enabled, uint32_t onboard_control_sensors_health, uint16_t load, uint16_t voltage_battery, int16_t current_battery, int8_t battery_remaining, uint16_t drop_rate_comm, uint16_t errors_comm, uint16_t errors_count1, uint16_t errors_count2, uint16_t errors_count3, uint16_t errors_count4) + uint32_t onboard_control_sensors_present, uint32_t onboard_control_sensors_enabled, uint32_t onboard_control_sensors_health, uint16_t load, uint16_t voltage_battery, int16_t current_battery, int8_t battery_remaining, uint16_t drop_rate_comm, uint16_t errors_comm, uint16_t errors_count1, uint16_t errors_count2, uint16_t errors_count3, uint16_t errors_count4, uint32_t onboard_control_sensors_present_extended, uint32_t onboard_control_sensors_enabled_extended, uint32_t onboard_control_sensors_health_extended) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_SYS_STATUS_LEN]; @@ -110,6 +122,9 @@ static inline uint16_t mavlink_msg_sys_status_pack(uint8_t system_id, uint8_t co _mav_put_uint16_t(buf, 26, errors_count3); _mav_put_uint16_t(buf, 28, errors_count4); _mav_put_int8_t(buf, 30, battery_remaining); + _mav_put_uint32_t(buf, 31, onboard_control_sensors_present_extended); + _mav_put_uint32_t(buf, 35, onboard_control_sensors_enabled_extended); + _mav_put_uint32_t(buf, 39, onboard_control_sensors_health_extended); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SYS_STATUS_LEN); #else @@ -127,6 +142,9 @@ static inline uint16_t mavlink_msg_sys_status_pack(uint8_t system_id, uint8_t co packet.errors_count3 = errors_count3; packet.errors_count4 = errors_count4; packet.battery_remaining = battery_remaining; + packet.onboard_control_sensors_present_extended = onboard_control_sensors_present_extended; + packet.onboard_control_sensors_enabled_extended = onboard_control_sensors_enabled_extended; + packet.onboard_control_sensors_health_extended = onboard_control_sensors_health_extended; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SYS_STATUS_LEN); #endif @@ -135,6 +153,84 @@ static inline uint16_t mavlink_msg_sys_status_pack(uint8_t system_id, uint8_t co return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SYS_STATUS_MIN_LEN, MAVLINK_MSG_ID_SYS_STATUS_LEN, MAVLINK_MSG_ID_SYS_STATUS_CRC); } +/** + * @brief Pack a sys_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param onboard_control_sensors_present Bitmap showing which onboard controllers and sensors are present. Value of 0: not present. Value of 1: present. + * @param onboard_control_sensors_enabled Bitmap showing which onboard controllers and sensors are enabled: Value of 0: not enabled. Value of 1: enabled. + * @param onboard_control_sensors_health Bitmap showing which onboard controllers and sensors have an error (or are operational). Value of 0: error. Value of 1: healthy. + * @param load [d%] Maximum usage in percent of the mainloop time. Values: [0-1000] - should always be below 1000 + * @param voltage_battery [mV] Battery voltage, UINT16_MAX: Voltage not sent by autopilot + * @param current_battery [cA] Battery current, -1: Current not sent by autopilot + * @param battery_remaining [%] Battery energy remaining, -1: Battery remaining energy not sent by autopilot + * @param drop_rate_comm [c%] Communication drop rate, (UART, I2C, SPI, CAN), dropped packets on all links (packets that were corrupted on reception on the MAV) + * @param errors_comm Communication errors (UART, I2C, SPI, CAN), dropped packets on all links (packets that were corrupted on reception on the MAV) + * @param errors_count1 Autopilot-specific errors + * @param errors_count2 Autopilot-specific errors + * @param errors_count3 Autopilot-specific errors + * @param errors_count4 Autopilot-specific errors + * @param onboard_control_sensors_present_extended Bitmap showing which onboard controllers and sensors are present. Value of 0: not present. Value of 1: present. + * @param onboard_control_sensors_enabled_extended Bitmap showing which onboard controllers and sensors are enabled: Value of 0: not enabled. Value of 1: enabled. + * @param onboard_control_sensors_health_extended Bitmap showing which onboard controllers and sensors have an error (or are operational). Value of 0: error. Value of 1: healthy. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_sys_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t onboard_control_sensors_present, uint32_t onboard_control_sensors_enabled, uint32_t onboard_control_sensors_health, uint16_t load, uint16_t voltage_battery, int16_t current_battery, int8_t battery_remaining, uint16_t drop_rate_comm, uint16_t errors_comm, uint16_t errors_count1, uint16_t errors_count2, uint16_t errors_count3, uint16_t errors_count4, uint32_t onboard_control_sensors_present_extended, uint32_t onboard_control_sensors_enabled_extended, uint32_t onboard_control_sensors_health_extended) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_SYS_STATUS_LEN]; + _mav_put_uint32_t(buf, 0, onboard_control_sensors_present); + _mav_put_uint32_t(buf, 4, onboard_control_sensors_enabled); + _mav_put_uint32_t(buf, 8, onboard_control_sensors_health); + _mav_put_uint16_t(buf, 12, load); + _mav_put_uint16_t(buf, 14, voltage_battery); + _mav_put_int16_t(buf, 16, current_battery); + _mav_put_uint16_t(buf, 18, drop_rate_comm); + _mav_put_uint16_t(buf, 20, errors_comm); + _mav_put_uint16_t(buf, 22, errors_count1); + _mav_put_uint16_t(buf, 24, errors_count2); + _mav_put_uint16_t(buf, 26, errors_count3); + _mav_put_uint16_t(buf, 28, errors_count4); + _mav_put_int8_t(buf, 30, battery_remaining); + _mav_put_uint32_t(buf, 31, onboard_control_sensors_present_extended); + _mav_put_uint32_t(buf, 35, onboard_control_sensors_enabled_extended); + _mav_put_uint32_t(buf, 39, onboard_control_sensors_health_extended); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SYS_STATUS_LEN); +#else + mavlink_sys_status_t packet; + packet.onboard_control_sensors_present = onboard_control_sensors_present; + packet.onboard_control_sensors_enabled = onboard_control_sensors_enabled; + packet.onboard_control_sensors_health = onboard_control_sensors_health; + packet.load = load; + packet.voltage_battery = voltage_battery; + packet.current_battery = current_battery; + packet.drop_rate_comm = drop_rate_comm; + packet.errors_comm = errors_comm; + packet.errors_count1 = errors_count1; + packet.errors_count2 = errors_count2; + packet.errors_count3 = errors_count3; + packet.errors_count4 = errors_count4; + packet.battery_remaining = battery_remaining; + packet.onboard_control_sensors_present_extended = onboard_control_sensors_present_extended; + packet.onboard_control_sensors_enabled_extended = onboard_control_sensors_enabled_extended; + packet.onboard_control_sensors_health_extended = onboard_control_sensors_health_extended; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SYS_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_SYS_STATUS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SYS_STATUS_MIN_LEN, MAVLINK_MSG_ID_SYS_STATUS_LEN, MAVLINK_MSG_ID_SYS_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SYS_STATUS_MIN_LEN, MAVLINK_MSG_ID_SYS_STATUS_LEN); +#endif +} + /** * @brief Pack a sys_status message on a channel * @param system_id ID of this system @@ -154,11 +250,14 @@ static inline uint16_t mavlink_msg_sys_status_pack(uint8_t system_id, uint8_t co * @param errors_count2 Autopilot-specific errors * @param errors_count3 Autopilot-specific errors * @param errors_count4 Autopilot-specific errors + * @param onboard_control_sensors_present_extended Bitmap showing which onboard controllers and sensors are present. Value of 0: not present. Value of 1: present. + * @param onboard_control_sensors_enabled_extended Bitmap showing which onboard controllers and sensors are enabled: Value of 0: not enabled. Value of 1: enabled. + * @param onboard_control_sensors_health_extended Bitmap showing which onboard controllers and sensors have an error (or are operational). Value of 0: error. Value of 1: healthy. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_sys_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - uint32_t onboard_control_sensors_present,uint32_t onboard_control_sensors_enabled,uint32_t onboard_control_sensors_health,uint16_t load,uint16_t voltage_battery,int16_t current_battery,int8_t battery_remaining,uint16_t drop_rate_comm,uint16_t errors_comm,uint16_t errors_count1,uint16_t errors_count2,uint16_t errors_count3,uint16_t errors_count4) + uint32_t onboard_control_sensors_present,uint32_t onboard_control_sensors_enabled,uint32_t onboard_control_sensors_health,uint16_t load,uint16_t voltage_battery,int16_t current_battery,int8_t battery_remaining,uint16_t drop_rate_comm,uint16_t errors_comm,uint16_t errors_count1,uint16_t errors_count2,uint16_t errors_count3,uint16_t errors_count4,uint32_t onboard_control_sensors_present_extended,uint32_t onboard_control_sensors_enabled_extended,uint32_t onboard_control_sensors_health_extended) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_SYS_STATUS_LEN]; @@ -175,6 +274,9 @@ static inline uint16_t mavlink_msg_sys_status_pack_chan(uint8_t system_id, uint8 _mav_put_uint16_t(buf, 26, errors_count3); _mav_put_uint16_t(buf, 28, errors_count4); _mav_put_int8_t(buf, 30, battery_remaining); + _mav_put_uint32_t(buf, 31, onboard_control_sensors_present_extended); + _mav_put_uint32_t(buf, 35, onboard_control_sensors_enabled_extended); + _mav_put_uint32_t(buf, 39, onboard_control_sensors_health_extended); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SYS_STATUS_LEN); #else @@ -192,6 +294,9 @@ static inline uint16_t mavlink_msg_sys_status_pack_chan(uint8_t system_id, uint8 packet.errors_count3 = errors_count3; packet.errors_count4 = errors_count4; packet.battery_remaining = battery_remaining; + packet.onboard_control_sensors_present_extended = onboard_control_sensors_present_extended; + packet.onboard_control_sensors_enabled_extended = onboard_control_sensors_enabled_extended; + packet.onboard_control_sensors_health_extended = onboard_control_sensors_health_extended; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SYS_STATUS_LEN); #endif @@ -210,7 +315,7 @@ static inline uint16_t mavlink_msg_sys_status_pack_chan(uint8_t system_id, uint8 */ static inline uint16_t mavlink_msg_sys_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_sys_status_t* sys_status) { - return mavlink_msg_sys_status_pack(system_id, component_id, msg, sys_status->onboard_control_sensors_present, sys_status->onboard_control_sensors_enabled, sys_status->onboard_control_sensors_health, sys_status->load, sys_status->voltage_battery, sys_status->current_battery, sys_status->battery_remaining, sys_status->drop_rate_comm, sys_status->errors_comm, sys_status->errors_count1, sys_status->errors_count2, sys_status->errors_count3, sys_status->errors_count4); + return mavlink_msg_sys_status_pack(system_id, component_id, msg, sys_status->onboard_control_sensors_present, sys_status->onboard_control_sensors_enabled, sys_status->onboard_control_sensors_health, sys_status->load, sys_status->voltage_battery, sys_status->current_battery, sys_status->battery_remaining, sys_status->drop_rate_comm, sys_status->errors_comm, sys_status->errors_count1, sys_status->errors_count2, sys_status->errors_count3, sys_status->errors_count4, sys_status->onboard_control_sensors_present_extended, sys_status->onboard_control_sensors_enabled_extended, sys_status->onboard_control_sensors_health_extended); } /** @@ -224,7 +329,21 @@ static inline uint16_t mavlink_msg_sys_status_encode(uint8_t system_id, uint8_t */ static inline uint16_t mavlink_msg_sys_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_sys_status_t* sys_status) { - return mavlink_msg_sys_status_pack_chan(system_id, component_id, chan, msg, sys_status->onboard_control_sensors_present, sys_status->onboard_control_sensors_enabled, sys_status->onboard_control_sensors_health, sys_status->load, sys_status->voltage_battery, sys_status->current_battery, sys_status->battery_remaining, sys_status->drop_rate_comm, sys_status->errors_comm, sys_status->errors_count1, sys_status->errors_count2, sys_status->errors_count3, sys_status->errors_count4); + return mavlink_msg_sys_status_pack_chan(system_id, component_id, chan, msg, sys_status->onboard_control_sensors_present, sys_status->onboard_control_sensors_enabled, sys_status->onboard_control_sensors_health, sys_status->load, sys_status->voltage_battery, sys_status->current_battery, sys_status->battery_remaining, sys_status->drop_rate_comm, sys_status->errors_comm, sys_status->errors_count1, sys_status->errors_count2, sys_status->errors_count3, sys_status->errors_count4, sys_status->onboard_control_sensors_present_extended, sys_status->onboard_control_sensors_enabled_extended, sys_status->onboard_control_sensors_health_extended); +} + +/** + * @brief Encode a sys_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param sys_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_sys_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_sys_status_t* sys_status) +{ + return mavlink_msg_sys_status_pack_status(system_id, component_id, _status, msg, sys_status->onboard_control_sensors_present, sys_status->onboard_control_sensors_enabled, sys_status->onboard_control_sensors_health, sys_status->load, sys_status->voltage_battery, sys_status->current_battery, sys_status->battery_remaining, sys_status->drop_rate_comm, sys_status->errors_comm, sys_status->errors_count1, sys_status->errors_count2, sys_status->errors_count3, sys_status->errors_count4, sys_status->onboard_control_sensors_present_extended, sys_status->onboard_control_sensors_enabled_extended, sys_status->onboard_control_sensors_health_extended); } /** @@ -244,10 +363,13 @@ static inline uint16_t mavlink_msg_sys_status_encode_chan(uint8_t system_id, uin * @param errors_count2 Autopilot-specific errors * @param errors_count3 Autopilot-specific errors * @param errors_count4 Autopilot-specific errors + * @param onboard_control_sensors_present_extended Bitmap showing which onboard controllers and sensors are present. Value of 0: not present. Value of 1: present. + * @param onboard_control_sensors_enabled_extended Bitmap showing which onboard controllers and sensors are enabled: Value of 0: not enabled. Value of 1: enabled. + * @param onboard_control_sensors_health_extended Bitmap showing which onboard controllers and sensors have an error (or are operational). Value of 0: error. Value of 1: healthy. */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_sys_status_send(mavlink_channel_t chan, uint32_t onboard_control_sensors_present, uint32_t onboard_control_sensors_enabled, uint32_t onboard_control_sensors_health, uint16_t load, uint16_t voltage_battery, int16_t current_battery, int8_t battery_remaining, uint16_t drop_rate_comm, uint16_t errors_comm, uint16_t errors_count1, uint16_t errors_count2, uint16_t errors_count3, uint16_t errors_count4) +static inline void mavlink_msg_sys_status_send(mavlink_channel_t chan, uint32_t onboard_control_sensors_present, uint32_t onboard_control_sensors_enabled, uint32_t onboard_control_sensors_health, uint16_t load, uint16_t voltage_battery, int16_t current_battery, int8_t battery_remaining, uint16_t drop_rate_comm, uint16_t errors_comm, uint16_t errors_count1, uint16_t errors_count2, uint16_t errors_count3, uint16_t errors_count4, uint32_t onboard_control_sensors_present_extended, uint32_t onboard_control_sensors_enabled_extended, uint32_t onboard_control_sensors_health_extended) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_SYS_STATUS_LEN]; @@ -264,6 +386,9 @@ static inline void mavlink_msg_sys_status_send(mavlink_channel_t chan, uint32_t _mav_put_uint16_t(buf, 26, errors_count3); _mav_put_uint16_t(buf, 28, errors_count4); _mav_put_int8_t(buf, 30, battery_remaining); + _mav_put_uint32_t(buf, 31, onboard_control_sensors_present_extended); + _mav_put_uint32_t(buf, 35, onboard_control_sensors_enabled_extended); + _mav_put_uint32_t(buf, 39, onboard_control_sensors_health_extended); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SYS_STATUS, buf, MAVLINK_MSG_ID_SYS_STATUS_MIN_LEN, MAVLINK_MSG_ID_SYS_STATUS_LEN, MAVLINK_MSG_ID_SYS_STATUS_CRC); #else @@ -281,6 +406,9 @@ static inline void mavlink_msg_sys_status_send(mavlink_channel_t chan, uint32_t packet.errors_count3 = errors_count3; packet.errors_count4 = errors_count4; packet.battery_remaining = battery_remaining; + packet.onboard_control_sensors_present_extended = onboard_control_sensors_present_extended; + packet.onboard_control_sensors_enabled_extended = onboard_control_sensors_enabled_extended; + packet.onboard_control_sensors_health_extended = onboard_control_sensors_health_extended; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SYS_STATUS, (const char *)&packet, MAVLINK_MSG_ID_SYS_STATUS_MIN_LEN, MAVLINK_MSG_ID_SYS_STATUS_LEN, MAVLINK_MSG_ID_SYS_STATUS_CRC); #endif @@ -294,7 +422,7 @@ static inline void mavlink_msg_sys_status_send(mavlink_channel_t chan, uint32_t static inline void mavlink_msg_sys_status_send_struct(mavlink_channel_t chan, const mavlink_sys_status_t* sys_status) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_sys_status_send(chan, sys_status->onboard_control_sensors_present, sys_status->onboard_control_sensors_enabled, sys_status->onboard_control_sensors_health, sys_status->load, sys_status->voltage_battery, sys_status->current_battery, sys_status->battery_remaining, sys_status->drop_rate_comm, sys_status->errors_comm, sys_status->errors_count1, sys_status->errors_count2, sys_status->errors_count3, sys_status->errors_count4); + mavlink_msg_sys_status_send(chan, sys_status->onboard_control_sensors_present, sys_status->onboard_control_sensors_enabled, sys_status->onboard_control_sensors_health, sys_status->load, sys_status->voltage_battery, sys_status->current_battery, sys_status->battery_remaining, sys_status->drop_rate_comm, sys_status->errors_comm, sys_status->errors_count1, sys_status->errors_count2, sys_status->errors_count3, sys_status->errors_count4, sys_status->onboard_control_sensors_present_extended, sys_status->onboard_control_sensors_enabled_extended, sys_status->onboard_control_sensors_health_extended); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SYS_STATUS, (const char *)sys_status, MAVLINK_MSG_ID_SYS_STATUS_MIN_LEN, MAVLINK_MSG_ID_SYS_STATUS_LEN, MAVLINK_MSG_ID_SYS_STATUS_CRC); #endif @@ -302,13 +430,13 @@ static inline void mavlink_msg_sys_status_send_struct(mavlink_channel_t chan, co #if MAVLINK_MSG_ID_SYS_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_sys_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t onboard_control_sensors_present, uint32_t onboard_control_sensors_enabled, uint32_t onboard_control_sensors_health, uint16_t load, uint16_t voltage_battery, int16_t current_battery, int8_t battery_remaining, uint16_t drop_rate_comm, uint16_t errors_comm, uint16_t errors_count1, uint16_t errors_count2, uint16_t errors_count3, uint16_t errors_count4) +static inline void mavlink_msg_sys_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t onboard_control_sensors_present, uint32_t onboard_control_sensors_enabled, uint32_t onboard_control_sensors_health, uint16_t load, uint16_t voltage_battery, int16_t current_battery, int8_t battery_remaining, uint16_t drop_rate_comm, uint16_t errors_comm, uint16_t errors_count1, uint16_t errors_count2, uint16_t errors_count3, uint16_t errors_count4, uint32_t onboard_control_sensors_present_extended, uint32_t onboard_control_sensors_enabled_extended, uint32_t onboard_control_sensors_health_extended) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; @@ -325,6 +453,9 @@ static inline void mavlink_msg_sys_status_send_buf(mavlink_message_t *msgbuf, ma _mav_put_uint16_t(buf, 26, errors_count3); _mav_put_uint16_t(buf, 28, errors_count4); _mav_put_int8_t(buf, 30, battery_remaining); + _mav_put_uint32_t(buf, 31, onboard_control_sensors_present_extended); + _mav_put_uint32_t(buf, 35, onboard_control_sensors_enabled_extended); + _mav_put_uint32_t(buf, 39, onboard_control_sensors_health_extended); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SYS_STATUS, buf, MAVLINK_MSG_ID_SYS_STATUS_MIN_LEN, MAVLINK_MSG_ID_SYS_STATUS_LEN, MAVLINK_MSG_ID_SYS_STATUS_CRC); #else @@ -342,6 +473,9 @@ static inline void mavlink_msg_sys_status_send_buf(mavlink_message_t *msgbuf, ma packet->errors_count3 = errors_count3; packet->errors_count4 = errors_count4; packet->battery_remaining = battery_remaining; + packet->onboard_control_sensors_present_extended = onboard_control_sensors_present_extended; + packet->onboard_control_sensors_enabled_extended = onboard_control_sensors_enabled_extended; + packet->onboard_control_sensors_health_extended = onboard_control_sensors_health_extended; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SYS_STATUS, (const char *)packet, MAVLINK_MSG_ID_SYS_STATUS_MIN_LEN, MAVLINK_MSG_ID_SYS_STATUS_LEN, MAVLINK_MSG_ID_SYS_STATUS_CRC); #endif @@ -483,6 +617,36 @@ static inline uint16_t mavlink_msg_sys_status_get_errors_count4(const mavlink_me return _MAV_RETURN_uint16_t(msg, 28); } +/** + * @brief Get field onboard_control_sensors_present_extended from sys_status message + * + * @return Bitmap showing which onboard controllers and sensors are present. Value of 0: not present. Value of 1: present. + */ +static inline uint32_t mavlink_msg_sys_status_get_onboard_control_sensors_present_extended(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 31); +} + +/** + * @brief Get field onboard_control_sensors_enabled_extended from sys_status message + * + * @return Bitmap showing which onboard controllers and sensors are enabled: Value of 0: not enabled. Value of 1: enabled. + */ +static inline uint32_t mavlink_msg_sys_status_get_onboard_control_sensors_enabled_extended(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 35); +} + +/** + * @brief Get field onboard_control_sensors_health_extended from sys_status message + * + * @return Bitmap showing which onboard controllers and sensors have an error (or are operational). Value of 0: error. Value of 1: healthy. + */ +static inline uint32_t mavlink_msg_sys_status_get_onboard_control_sensors_health_extended(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 39); +} + /** * @brief Decode a sys_status message into a struct * @@ -505,6 +669,9 @@ static inline void mavlink_msg_sys_status_decode(const mavlink_message_t* msg, m sys_status->errors_count3 = mavlink_msg_sys_status_get_errors_count3(msg); sys_status->errors_count4 = mavlink_msg_sys_status_get_errors_count4(msg); sys_status->battery_remaining = mavlink_msg_sys_status_get_battery_remaining(msg); + sys_status->onboard_control_sensors_present_extended = mavlink_msg_sys_status_get_onboard_control_sensors_present_extended(msg); + sys_status->onboard_control_sensors_enabled_extended = mavlink_msg_sys_status_get_onboard_control_sensors_enabled_extended(msg); + sys_status->onboard_control_sensors_health_extended = mavlink_msg_sys_status_get_onboard_control_sensors_health_extended(msg); #else uint8_t len = msg->len < MAVLINK_MSG_ID_SYS_STATUS_LEN? msg->len : MAVLINK_MSG_ID_SYS_STATUS_LEN; memset(sys_status, 0, MAVLINK_MSG_ID_SYS_STATUS_LEN); diff --git a/common/mavlink_msg_system_time.h b/common/mavlink_msg_system_time.h index a3848c741..1c57e692a 100644 --- a/common/mavlink_msg_system_time.h +++ b/common/mavlink_msg_system_time.h @@ -69,6 +69,42 @@ static inline uint16_t mavlink_msg_system_time_pack(uint8_t system_id, uint8_t c return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SYSTEM_TIME_MIN_LEN, MAVLINK_MSG_ID_SYSTEM_TIME_LEN, MAVLINK_MSG_ID_SYSTEM_TIME_CRC); } +/** + * @brief Pack a system_time message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_unix_usec [us] Timestamp (UNIX epoch time). + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_system_time_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_unix_usec, uint32_t time_boot_ms) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_SYSTEM_TIME_LEN]; + _mav_put_uint64_t(buf, 0, time_unix_usec); + _mav_put_uint32_t(buf, 8, time_boot_ms); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SYSTEM_TIME_LEN); +#else + mavlink_system_time_t packet; + packet.time_unix_usec = time_unix_usec; + packet.time_boot_ms = time_boot_ms; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SYSTEM_TIME_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_SYSTEM_TIME; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SYSTEM_TIME_MIN_LEN, MAVLINK_MSG_ID_SYSTEM_TIME_LEN, MAVLINK_MSG_ID_SYSTEM_TIME_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SYSTEM_TIME_MIN_LEN, MAVLINK_MSG_ID_SYSTEM_TIME_LEN); +#endif +} + /** * @brief Pack a system_time message on a channel * @param system_id ID of this system @@ -128,6 +164,20 @@ static inline uint16_t mavlink_msg_system_time_encode_chan(uint8_t system_id, ui return mavlink_msg_system_time_pack_chan(system_id, component_id, chan, msg, system_time->time_unix_usec, system_time->time_boot_ms); } +/** + * @brief Encode a system_time struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param system_time C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_system_time_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_system_time_t* system_time) +{ + return mavlink_msg_system_time_pack_status(system_id, component_id, _status, msg, system_time->time_unix_usec, system_time->time_boot_ms); +} + /** * @brief Send a system_time message * @param chan MAVLink channel to send the message @@ -170,7 +220,7 @@ static inline void mavlink_msg_system_time_send_struct(mavlink_channel_t chan, c #if MAVLINK_MSG_ID_SYSTEM_TIME_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_terrain_check.h b/common/mavlink_msg_terrain_check.h index 74afd52ee..d1e4b35e7 100644 --- a/common/mavlink_msg_terrain_check.h +++ b/common/mavlink_msg_terrain_check.h @@ -69,6 +69,42 @@ static inline uint16_t mavlink_msg_terrain_check_pack(uint8_t system_id, uint8_t return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_TERRAIN_CHECK_MIN_LEN, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN, MAVLINK_MSG_ID_TERRAIN_CHECK_CRC); } +/** + * @brief Pack a terrain_check message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param lat [degE7] Latitude + * @param lon [degE7] Longitude + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_terrain_check_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + int32_t lat, int32_t lon) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_TERRAIN_CHECK_LEN]; + _mav_put_int32_t(buf, 0, lat); + _mav_put_int32_t(buf, 4, lon); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN); +#else + mavlink_terrain_check_t packet; + packet.lat = lat; + packet.lon = lon; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_TERRAIN_CHECK; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_TERRAIN_CHECK_MIN_LEN, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN, MAVLINK_MSG_ID_TERRAIN_CHECK_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_TERRAIN_CHECK_MIN_LEN, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN); +#endif +} + /** * @brief Pack a terrain_check message on a channel * @param system_id ID of this system @@ -128,6 +164,20 @@ static inline uint16_t mavlink_msg_terrain_check_encode_chan(uint8_t system_id, return mavlink_msg_terrain_check_pack_chan(system_id, component_id, chan, msg, terrain_check->lat, terrain_check->lon); } +/** + * @brief Encode a terrain_check struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param terrain_check C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_terrain_check_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_terrain_check_t* terrain_check) +{ + return mavlink_msg_terrain_check_pack_status(system_id, component_id, _status, msg, terrain_check->lat, terrain_check->lon); +} + /** * @brief Send a terrain_check message * @param chan MAVLink channel to send the message @@ -170,7 +220,7 @@ static inline void mavlink_msg_terrain_check_send_struct(mavlink_channel_t chan, #if MAVLINK_MSG_ID_TERRAIN_CHECK_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_terrain_data.h b/common/mavlink_msg_terrain_data.h index 3099502ca..610c94dba 100644 --- a/common/mavlink_msg_terrain_data.h +++ b/common/mavlink_msg_terrain_data.h @@ -77,7 +77,7 @@ static inline uint16_t mavlink_msg_terrain_data_pack(uint8_t system_id, uint8_t packet.lon = lon; packet.grid_spacing = grid_spacing; packet.gridbit = gridbit; - mav_array_memcpy(packet.data, data, sizeof(int16_t)*16); + mav_array_assign_int16_t(packet.data, data, 16); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TERRAIN_DATA_LEN); #endif @@ -85,6 +85,49 @@ static inline uint16_t mavlink_msg_terrain_data_pack(uint8_t system_id, uint8_t return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_TERRAIN_DATA_MIN_LEN, MAVLINK_MSG_ID_TERRAIN_DATA_LEN, MAVLINK_MSG_ID_TERRAIN_DATA_CRC); } +/** + * @brief Pack a terrain_data message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param lat [degE7] Latitude of SW corner of first grid + * @param lon [degE7] Longitude of SW corner of first grid + * @param grid_spacing [m] Grid spacing + * @param gridbit bit within the terrain request mask + * @param data [m] Terrain data MSL + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_terrain_data_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + int32_t lat, int32_t lon, uint16_t grid_spacing, uint8_t gridbit, const int16_t *data) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_TERRAIN_DATA_LEN]; + _mav_put_int32_t(buf, 0, lat); + _mav_put_int32_t(buf, 4, lon); + _mav_put_uint16_t(buf, 8, grid_spacing); + _mav_put_uint8_t(buf, 42, gridbit); + _mav_put_int16_t_array(buf, 10, data, 16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TERRAIN_DATA_LEN); +#else + mavlink_terrain_data_t packet; + packet.lat = lat; + packet.lon = lon; + packet.grid_spacing = grid_spacing; + packet.gridbit = gridbit; + mav_array_memcpy(packet.data, data, sizeof(int16_t)*16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TERRAIN_DATA_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_TERRAIN_DATA; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_TERRAIN_DATA_MIN_LEN, MAVLINK_MSG_ID_TERRAIN_DATA_LEN, MAVLINK_MSG_ID_TERRAIN_DATA_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_TERRAIN_DATA_MIN_LEN, MAVLINK_MSG_ID_TERRAIN_DATA_LEN); +#endif +} + /** * @brief Pack a terrain_data message on a channel * @param system_id ID of this system @@ -116,7 +159,7 @@ static inline uint16_t mavlink_msg_terrain_data_pack_chan(uint8_t system_id, uin packet.lon = lon; packet.grid_spacing = grid_spacing; packet.gridbit = gridbit; - mav_array_memcpy(packet.data, data, sizeof(int16_t)*16); + mav_array_assign_int16_t(packet.data, data, 16); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TERRAIN_DATA_LEN); #endif @@ -151,6 +194,20 @@ static inline uint16_t mavlink_msg_terrain_data_encode_chan(uint8_t system_id, u return mavlink_msg_terrain_data_pack_chan(system_id, component_id, chan, msg, terrain_data->lat, terrain_data->lon, terrain_data->grid_spacing, terrain_data->gridbit, terrain_data->data); } +/** + * @brief Encode a terrain_data struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param terrain_data C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_terrain_data_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_terrain_data_t* terrain_data) +{ + return mavlink_msg_terrain_data_pack_status(system_id, component_id, _status, msg, terrain_data->lat, terrain_data->lon, terrain_data->grid_spacing, terrain_data->gridbit, terrain_data->data); +} + /** * @brief Send a terrain_data message * @param chan MAVLink channel to send the message @@ -179,7 +236,7 @@ static inline void mavlink_msg_terrain_data_send(mavlink_channel_t chan, int32_t packet.lon = lon; packet.grid_spacing = grid_spacing; packet.gridbit = gridbit; - mav_array_memcpy(packet.data, data, sizeof(int16_t)*16); + mav_array_assign_int16_t(packet.data, data, 16); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TERRAIN_DATA, (const char *)&packet, MAVLINK_MSG_ID_TERRAIN_DATA_MIN_LEN, MAVLINK_MSG_ID_TERRAIN_DATA_LEN, MAVLINK_MSG_ID_TERRAIN_DATA_CRC); #endif } @@ -200,7 +257,7 @@ static inline void mavlink_msg_terrain_data_send_struct(mavlink_channel_t chan, #if MAVLINK_MSG_ID_TERRAIN_DATA_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -222,7 +279,7 @@ static inline void mavlink_msg_terrain_data_send_buf(mavlink_message_t *msgbuf, packet->lon = lon; packet->grid_spacing = grid_spacing; packet->gridbit = gridbit; - mav_array_memcpy(packet->data, data, sizeof(int16_t)*16); + mav_array_assign_int16_t(packet->data, data, 16); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TERRAIN_DATA, (const char *)packet, MAVLINK_MSG_ID_TERRAIN_DATA_MIN_LEN, MAVLINK_MSG_ID_TERRAIN_DATA_LEN, MAVLINK_MSG_ID_TERRAIN_DATA_CRC); #endif } diff --git a/common/mavlink_msg_terrain_report.h b/common/mavlink_msg_terrain_report.h index 8757a75a2..b09a95bbb 100644 --- a/common/mavlink_msg_terrain_report.h +++ b/common/mavlink_msg_terrain_report.h @@ -99,6 +99,57 @@ static inline uint16_t mavlink_msg_terrain_report_pack(uint8_t system_id, uint8_ return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_TERRAIN_REPORT_MIN_LEN, MAVLINK_MSG_ID_TERRAIN_REPORT_LEN, MAVLINK_MSG_ID_TERRAIN_REPORT_CRC); } +/** + * @brief Pack a terrain_report message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param lat [degE7] Latitude + * @param lon [degE7] Longitude + * @param spacing grid spacing (zero if terrain at this location unavailable) + * @param terrain_height [m] Terrain height MSL + * @param current_height [m] Current vehicle height above lat/lon terrain height + * @param pending Number of 4x4 terrain blocks waiting to be received or read from disk + * @param loaded Number of 4x4 terrain blocks in memory + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_terrain_report_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + int32_t lat, int32_t lon, uint16_t spacing, float terrain_height, float current_height, uint16_t pending, uint16_t loaded) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_TERRAIN_REPORT_LEN]; + _mav_put_int32_t(buf, 0, lat); + _mav_put_int32_t(buf, 4, lon); + _mav_put_float(buf, 8, terrain_height); + _mav_put_float(buf, 12, current_height); + _mav_put_uint16_t(buf, 16, spacing); + _mav_put_uint16_t(buf, 18, pending); + _mav_put_uint16_t(buf, 20, loaded); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TERRAIN_REPORT_LEN); +#else + mavlink_terrain_report_t packet; + packet.lat = lat; + packet.lon = lon; + packet.terrain_height = terrain_height; + packet.current_height = current_height; + packet.spacing = spacing; + packet.pending = pending; + packet.loaded = loaded; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TERRAIN_REPORT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_TERRAIN_REPORT; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_TERRAIN_REPORT_MIN_LEN, MAVLINK_MSG_ID_TERRAIN_REPORT_LEN, MAVLINK_MSG_ID_TERRAIN_REPORT_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_TERRAIN_REPORT_MIN_LEN, MAVLINK_MSG_ID_TERRAIN_REPORT_LEN); +#endif +} + /** * @brief Pack a terrain_report message on a channel * @param system_id ID of this system @@ -173,6 +224,20 @@ static inline uint16_t mavlink_msg_terrain_report_encode_chan(uint8_t system_id, return mavlink_msg_terrain_report_pack_chan(system_id, component_id, chan, msg, terrain_report->lat, terrain_report->lon, terrain_report->spacing, terrain_report->terrain_height, terrain_report->current_height, terrain_report->pending, terrain_report->loaded); } +/** + * @brief Encode a terrain_report struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param terrain_report C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_terrain_report_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_terrain_report_t* terrain_report) +{ + return mavlink_msg_terrain_report_pack_status(system_id, component_id, _status, msg, terrain_report->lat, terrain_report->lon, terrain_report->spacing, terrain_report->terrain_height, terrain_report->current_height, terrain_report->pending, terrain_report->loaded); +} + /** * @brief Send a terrain_report message * @param chan MAVLink channel to send the message @@ -230,7 +295,7 @@ static inline void mavlink_msg_terrain_report_send_struct(mavlink_channel_t chan #if MAVLINK_MSG_ID_TERRAIN_REPORT_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_terrain_request.h b/common/mavlink_msg_terrain_request.h index 9889edd7d..9712e1ca2 100644 --- a/common/mavlink_msg_terrain_request.h +++ b/common/mavlink_msg_terrain_request.h @@ -81,6 +81,48 @@ static inline uint16_t mavlink_msg_terrain_request_pack(uint8_t system_id, uint8 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_TERRAIN_REQUEST_MIN_LEN, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN, MAVLINK_MSG_ID_TERRAIN_REQUEST_CRC); } +/** + * @brief Pack a terrain_request message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param lat [degE7] Latitude of SW corner of first grid + * @param lon [degE7] Longitude of SW corner of first grid + * @param grid_spacing [m] Grid spacing + * @param mask Bitmask of requested 4x4 grids (row major 8x7 array of grids, 56 bits) + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_terrain_request_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + int32_t lat, int32_t lon, uint16_t grid_spacing, uint64_t mask) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN]; + _mav_put_uint64_t(buf, 0, mask); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_uint16_t(buf, 16, grid_spacing); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN); +#else + mavlink_terrain_request_t packet; + packet.mask = mask; + packet.lat = lat; + packet.lon = lon; + packet.grid_spacing = grid_spacing; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_TERRAIN_REQUEST; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_TERRAIN_REQUEST_MIN_LEN, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN, MAVLINK_MSG_ID_TERRAIN_REQUEST_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_TERRAIN_REQUEST_MIN_LEN, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN); +#endif +} + /** * @brief Pack a terrain_request message on a channel * @param system_id ID of this system @@ -146,6 +188,20 @@ static inline uint16_t mavlink_msg_terrain_request_encode_chan(uint8_t system_id return mavlink_msg_terrain_request_pack_chan(system_id, component_id, chan, msg, terrain_request->lat, terrain_request->lon, terrain_request->grid_spacing, terrain_request->mask); } +/** + * @brief Encode a terrain_request struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param terrain_request C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_terrain_request_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_terrain_request_t* terrain_request) +{ + return mavlink_msg_terrain_request_pack_status(system_id, component_id, _status, msg, terrain_request->lat, terrain_request->lon, terrain_request->grid_spacing, terrain_request->mask); +} + /** * @brief Send a terrain_request message * @param chan MAVLink channel to send the message @@ -194,7 +250,7 @@ static inline void mavlink_msg_terrain_request_send_struct(mavlink_channel_t cha #if MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_time_estimate_to_target.h b/common/mavlink_msg_time_estimate_to_target.h index 29d03d594..95295fba1 100644 --- a/common/mavlink_msg_time_estimate_to_target.h +++ b/common/mavlink_msg_time_estimate_to_target.h @@ -87,6 +87,51 @@ static inline uint16_t mavlink_msg_time_estimate_to_target_pack(uint8_t system_i return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_MIN_LEN, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_CRC); } +/** + * @brief Pack a time_estimate_to_target message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param safe_return [s] Estimated time to complete the vehicle's configured "safe return" action from its current position (e.g. RTL, Smart RTL, etc.). -1 indicates that the vehicle is landed, or that no time estimate available. + * @param land [s] Estimated time for vehicle to complete the LAND action from its current position. -1 indicates that the vehicle is landed, or that no time estimate available. + * @param mission_next_item [s] Estimated time for reaching/completing the currently active mission item. -1 means no time estimate available. + * @param mission_end [s] Estimated time for completing the current mission. -1 means no mission active and/or no estimate available. + * @param commanded_action [s] Estimated time for completing the current commanded action (i.e. Go To, Takeoff, Land, etc.). -1 means no action active and/or no estimate available. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_time_estimate_to_target_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + int32_t safe_return, int32_t land, int32_t mission_next_item, int32_t mission_end, int32_t commanded_action) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN]; + _mav_put_int32_t(buf, 0, safe_return); + _mav_put_int32_t(buf, 4, land); + _mav_put_int32_t(buf, 8, mission_next_item); + _mav_put_int32_t(buf, 12, mission_end); + _mav_put_int32_t(buf, 16, commanded_action); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN); +#else + mavlink_time_estimate_to_target_t packet; + packet.safe_return = safe_return; + packet.land = land; + packet.mission_next_item = mission_next_item; + packet.mission_end = mission_end; + packet.commanded_action = commanded_action; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_MIN_LEN, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_MIN_LEN, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN); +#endif +} + /** * @brief Pack a time_estimate_to_target message on a channel * @param system_id ID of this system @@ -155,6 +200,20 @@ static inline uint16_t mavlink_msg_time_estimate_to_target_encode_chan(uint8_t s return mavlink_msg_time_estimate_to_target_pack_chan(system_id, component_id, chan, msg, time_estimate_to_target->safe_return, time_estimate_to_target->land, time_estimate_to_target->mission_next_item, time_estimate_to_target->mission_end, time_estimate_to_target->commanded_action); } +/** + * @brief Encode a time_estimate_to_target struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param time_estimate_to_target C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_time_estimate_to_target_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_time_estimate_to_target_t* time_estimate_to_target) +{ + return mavlink_msg_time_estimate_to_target_pack_status(system_id, component_id, _status, msg, time_estimate_to_target->safe_return, time_estimate_to_target->land, time_estimate_to_target->mission_next_item, time_estimate_to_target->mission_end, time_estimate_to_target->commanded_action); +} + /** * @brief Send a time_estimate_to_target message * @param chan MAVLink channel to send the message @@ -206,7 +265,7 @@ static inline void mavlink_msg_time_estimate_to_target_send_struct(mavlink_chann #if MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_timesync.h b/common/mavlink_msg_timesync.h index a9de47dd4..1a73dfaf1 100644 --- a/common/mavlink_msg_timesync.h +++ b/common/mavlink_msg_timesync.h @@ -5,13 +5,15 @@ typedef struct __mavlink_timesync_t { - int64_t tc1; /*< Time sync timestamp 1*/ - int64_t ts1; /*< Time sync timestamp 2*/ + int64_t tc1; /*< [ns] Time sync timestamp 1. Syncing: 0. Responding: Timestamp of responding component.*/ + int64_t ts1; /*< [ns] Time sync timestamp 2. Timestamp of syncing component (mirrored in response).*/ + uint8_t target_system; /*< Target system id. Request: 0 (broadcast) or id of specific system. Response must contain system id of the requesting component.*/ + uint8_t target_component; /*< Target component id. Request: 0 (broadcast) or id of specific component. Response must contain component id of the requesting component.*/ } mavlink_timesync_t; -#define MAVLINK_MSG_ID_TIMESYNC_LEN 16 +#define MAVLINK_MSG_ID_TIMESYNC_LEN 18 #define MAVLINK_MSG_ID_TIMESYNC_MIN_LEN 16 -#define MAVLINK_MSG_ID_111_LEN 16 +#define MAVLINK_MSG_ID_111_LEN 18 #define MAVLINK_MSG_ID_111_MIN_LEN 16 #define MAVLINK_MSG_ID_TIMESYNC_CRC 34 @@ -23,17 +25,21 @@ typedef struct __mavlink_timesync_t { #define MAVLINK_MESSAGE_INFO_TIMESYNC { \ 111, \ "TIMESYNC", \ - 2, \ + 4, \ { { "tc1", NULL, MAVLINK_TYPE_INT64_T, 0, 0, offsetof(mavlink_timesync_t, tc1) }, \ { "ts1", NULL, MAVLINK_TYPE_INT64_T, 0, 8, offsetof(mavlink_timesync_t, ts1) }, \ + { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_timesync_t, target_system) }, \ + { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 17, offsetof(mavlink_timesync_t, target_component) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_TIMESYNC { \ "TIMESYNC", \ - 2, \ + 4, \ { { "tc1", NULL, MAVLINK_TYPE_INT64_T, 0, 0, offsetof(mavlink_timesync_t, tc1) }, \ { "ts1", NULL, MAVLINK_TYPE_INT64_T, 0, 8, offsetof(mavlink_timesync_t, ts1) }, \ + { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_timesync_t, target_system) }, \ + { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 17, offsetof(mavlink_timesync_t, target_component) }, \ } \ } #endif @@ -44,23 +50,29 @@ typedef struct __mavlink_timesync_t { * @param component_id ID of this component (e.g. 200 for IMU) * @param msg The MAVLink message to compress the data into * - * @param tc1 Time sync timestamp 1 - * @param ts1 Time sync timestamp 2 + * @param tc1 [ns] Time sync timestamp 1. Syncing: 0. Responding: Timestamp of responding component. + * @param ts1 [ns] Time sync timestamp 2. Timestamp of syncing component (mirrored in response). + * @param target_system Target system id. Request: 0 (broadcast) or id of specific system. Response must contain system id of the requesting component. + * @param target_component Target component id. Request: 0 (broadcast) or id of specific component. Response must contain component id of the requesting component. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_timesync_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - int64_t tc1, int64_t ts1) + int64_t tc1, int64_t ts1, uint8_t target_system, uint8_t target_component) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_TIMESYNC_LEN]; _mav_put_int64_t(buf, 0, tc1); _mav_put_int64_t(buf, 8, ts1); + _mav_put_uint8_t(buf, 16, target_system); + _mav_put_uint8_t(buf, 17, target_component); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TIMESYNC_LEN); #else mavlink_timesync_t packet; packet.tc1 = tc1; packet.ts1 = ts1; + packet.target_system = target_system; + packet.target_component = target_component; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TIMESYNC_LEN); #endif @@ -69,30 +81,78 @@ static inline uint16_t mavlink_msg_timesync_pack(uint8_t system_id, uint8_t comp return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_TIMESYNC_MIN_LEN, MAVLINK_MSG_ID_TIMESYNC_LEN, MAVLINK_MSG_ID_TIMESYNC_CRC); } +/** + * @brief Pack a timesync message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param tc1 [ns] Time sync timestamp 1. Syncing: 0. Responding: Timestamp of responding component. + * @param ts1 [ns] Time sync timestamp 2. Timestamp of syncing component (mirrored in response). + * @param target_system Target system id. Request: 0 (broadcast) or id of specific system. Response must contain system id of the requesting component. + * @param target_component Target component id. Request: 0 (broadcast) or id of specific component. Response must contain component id of the requesting component. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_timesync_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + int64_t tc1, int64_t ts1, uint8_t target_system, uint8_t target_component) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_TIMESYNC_LEN]; + _mav_put_int64_t(buf, 0, tc1); + _mav_put_int64_t(buf, 8, ts1); + _mav_put_uint8_t(buf, 16, target_system); + _mav_put_uint8_t(buf, 17, target_component); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TIMESYNC_LEN); +#else + mavlink_timesync_t packet; + packet.tc1 = tc1; + packet.ts1 = ts1; + packet.target_system = target_system; + packet.target_component = target_component; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TIMESYNC_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_TIMESYNC; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_TIMESYNC_MIN_LEN, MAVLINK_MSG_ID_TIMESYNC_LEN, MAVLINK_MSG_ID_TIMESYNC_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_TIMESYNC_MIN_LEN, MAVLINK_MSG_ID_TIMESYNC_LEN); +#endif +} + /** * @brief Pack a timesync message on a channel * @param system_id ID of this system * @param component_id ID of this component (e.g. 200 for IMU) * @param chan The MAVLink channel this message will be sent over * @param msg The MAVLink message to compress the data into - * @param tc1 Time sync timestamp 1 - * @param ts1 Time sync timestamp 2 + * @param tc1 [ns] Time sync timestamp 1. Syncing: 0. Responding: Timestamp of responding component. + * @param ts1 [ns] Time sync timestamp 2. Timestamp of syncing component (mirrored in response). + * @param target_system Target system id. Request: 0 (broadcast) or id of specific system. Response must contain system id of the requesting component. + * @param target_component Target component id. Request: 0 (broadcast) or id of specific component. Response must contain component id of the requesting component. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_timesync_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - int64_t tc1,int64_t ts1) + int64_t tc1,int64_t ts1,uint8_t target_system,uint8_t target_component) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_TIMESYNC_LEN]; _mav_put_int64_t(buf, 0, tc1); _mav_put_int64_t(buf, 8, ts1); + _mav_put_uint8_t(buf, 16, target_system); + _mav_put_uint8_t(buf, 17, target_component); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TIMESYNC_LEN); #else mavlink_timesync_t packet; packet.tc1 = tc1; packet.ts1 = ts1; + packet.target_system = target_system; + packet.target_component = target_component; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TIMESYNC_LEN); #endif @@ -111,7 +171,7 @@ static inline uint16_t mavlink_msg_timesync_pack_chan(uint8_t system_id, uint8_t */ static inline uint16_t mavlink_msg_timesync_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_timesync_t* timesync) { - return mavlink_msg_timesync_pack(system_id, component_id, msg, timesync->tc1, timesync->ts1); + return mavlink_msg_timesync_pack(system_id, component_id, msg, timesync->tc1, timesync->ts1, timesync->target_system, timesync->target_component); } /** @@ -125,30 +185,50 @@ static inline uint16_t mavlink_msg_timesync_encode(uint8_t system_id, uint8_t co */ static inline uint16_t mavlink_msg_timesync_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_timesync_t* timesync) { - return mavlink_msg_timesync_pack_chan(system_id, component_id, chan, msg, timesync->tc1, timesync->ts1); + return mavlink_msg_timesync_pack_chan(system_id, component_id, chan, msg, timesync->tc1, timesync->ts1, timesync->target_system, timesync->target_component); +} + +/** + * @brief Encode a timesync struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param timesync C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_timesync_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_timesync_t* timesync) +{ + return mavlink_msg_timesync_pack_status(system_id, component_id, _status, msg, timesync->tc1, timesync->ts1, timesync->target_system, timesync->target_component); } /** * @brief Send a timesync message * @param chan MAVLink channel to send the message * - * @param tc1 Time sync timestamp 1 - * @param ts1 Time sync timestamp 2 + * @param tc1 [ns] Time sync timestamp 1. Syncing: 0. Responding: Timestamp of responding component. + * @param ts1 [ns] Time sync timestamp 2. Timestamp of syncing component (mirrored in response). + * @param target_system Target system id. Request: 0 (broadcast) or id of specific system. Response must contain system id of the requesting component. + * @param target_component Target component id. Request: 0 (broadcast) or id of specific component. Response must contain component id of the requesting component. */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_timesync_send(mavlink_channel_t chan, int64_t tc1, int64_t ts1) +static inline void mavlink_msg_timesync_send(mavlink_channel_t chan, int64_t tc1, int64_t ts1, uint8_t target_system, uint8_t target_component) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_TIMESYNC_LEN]; _mav_put_int64_t(buf, 0, tc1); _mav_put_int64_t(buf, 8, ts1); + _mav_put_uint8_t(buf, 16, target_system); + _mav_put_uint8_t(buf, 17, target_component); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TIMESYNC, buf, MAVLINK_MSG_ID_TIMESYNC_MIN_LEN, MAVLINK_MSG_ID_TIMESYNC_LEN, MAVLINK_MSG_ID_TIMESYNC_CRC); #else mavlink_timesync_t packet; packet.tc1 = tc1; packet.ts1 = ts1; + packet.target_system = target_system; + packet.target_component = target_component; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TIMESYNC, (const char *)&packet, MAVLINK_MSG_ID_TIMESYNC_MIN_LEN, MAVLINK_MSG_ID_TIMESYNC_LEN, MAVLINK_MSG_ID_TIMESYNC_CRC); #endif @@ -162,7 +242,7 @@ static inline void mavlink_msg_timesync_send(mavlink_channel_t chan, int64_t tc1 static inline void mavlink_msg_timesync_send_struct(mavlink_channel_t chan, const mavlink_timesync_t* timesync) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_timesync_send(chan, timesync->tc1, timesync->ts1); + mavlink_msg_timesync_send(chan, timesync->tc1, timesync->ts1, timesync->target_system, timesync->target_component); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TIMESYNC, (const char *)timesync, MAVLINK_MSG_ID_TIMESYNC_MIN_LEN, MAVLINK_MSG_ID_TIMESYNC_LEN, MAVLINK_MSG_ID_TIMESYNC_CRC); #endif @@ -170,24 +250,28 @@ static inline void mavlink_msg_timesync_send_struct(mavlink_channel_t chan, cons #if MAVLINK_MSG_ID_TIMESYNC_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_timesync_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, int64_t tc1, int64_t ts1) +static inline void mavlink_msg_timesync_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, int64_t tc1, int64_t ts1, uint8_t target_system, uint8_t target_component) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; _mav_put_int64_t(buf, 0, tc1); _mav_put_int64_t(buf, 8, ts1); + _mav_put_uint8_t(buf, 16, target_system); + _mav_put_uint8_t(buf, 17, target_component); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TIMESYNC, buf, MAVLINK_MSG_ID_TIMESYNC_MIN_LEN, MAVLINK_MSG_ID_TIMESYNC_LEN, MAVLINK_MSG_ID_TIMESYNC_CRC); #else mavlink_timesync_t *packet = (mavlink_timesync_t *)msgbuf; packet->tc1 = tc1; packet->ts1 = ts1; + packet->target_system = target_system; + packet->target_component = target_component; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TIMESYNC, (const char *)packet, MAVLINK_MSG_ID_TIMESYNC_MIN_LEN, MAVLINK_MSG_ID_TIMESYNC_LEN, MAVLINK_MSG_ID_TIMESYNC_CRC); #endif @@ -202,7 +286,7 @@ static inline void mavlink_msg_timesync_send_buf(mavlink_message_t *msgbuf, mavl /** * @brief Get field tc1 from timesync message * - * @return Time sync timestamp 1 + * @return [ns] Time sync timestamp 1. Syncing: 0. Responding: Timestamp of responding component. */ static inline int64_t mavlink_msg_timesync_get_tc1(const mavlink_message_t* msg) { @@ -212,13 +296,33 @@ static inline int64_t mavlink_msg_timesync_get_tc1(const mavlink_message_t* msg) /** * @brief Get field ts1 from timesync message * - * @return Time sync timestamp 2 + * @return [ns] Time sync timestamp 2. Timestamp of syncing component (mirrored in response). */ static inline int64_t mavlink_msg_timesync_get_ts1(const mavlink_message_t* msg) { return _MAV_RETURN_int64_t(msg, 8); } +/** + * @brief Get field target_system from timesync message + * + * @return Target system id. Request: 0 (broadcast) or id of specific system. Response must contain system id of the requesting component. + */ +static inline uint8_t mavlink_msg_timesync_get_target_system(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 16); +} + +/** + * @brief Get field target_component from timesync message + * + * @return Target component id. Request: 0 (broadcast) or id of specific component. Response must contain component id of the requesting component. + */ +static inline uint8_t mavlink_msg_timesync_get_target_component(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 17); +} + /** * @brief Decode a timesync message into a struct * @@ -230,6 +334,8 @@ static inline void mavlink_msg_timesync_decode(const mavlink_message_t* msg, mav #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS timesync->tc1 = mavlink_msg_timesync_get_tc1(msg); timesync->ts1 = mavlink_msg_timesync_get_ts1(msg); + timesync->target_system = mavlink_msg_timesync_get_target_system(msg); + timesync->target_component = mavlink_msg_timesync_get_target_component(msg); #else uint8_t len = msg->len < MAVLINK_MSG_ID_TIMESYNC_LEN? msg->len : MAVLINK_MSG_ID_TIMESYNC_LEN; memset(timesync, 0, MAVLINK_MSG_ID_TIMESYNC_LEN); diff --git a/common/mavlink_msg_trajectory_representation_bezier.h b/common/mavlink_msg_trajectory_representation_bezier.h index c535fd441..a6a57b293 100644 --- a/common/mavlink_msg_trajectory_representation_bezier.h +++ b/common/mavlink_msg_trajectory_representation_bezier.h @@ -75,6 +75,51 @@ typedef struct __mavlink_trajectory_representation_bezier_t { static inline uint16_t mavlink_msg_trajectory_representation_bezier_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint64_t time_usec, uint8_t valid_points, const float *pos_x, const float *pos_y, const float *pos_z, const float *delta, const float *pos_yaw) { +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint8_t(buf, 108, valid_points); + _mav_put_float_array(buf, 8, pos_x, 5); + _mav_put_float_array(buf, 28, pos_y, 5); + _mav_put_float_array(buf, 48, pos_z, 5); + _mav_put_float_array(buf, 68, delta, 5); + _mav_put_float_array(buf, 88, pos_yaw, 5); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN); +#else + mavlink_trajectory_representation_bezier_t packet; + packet.time_usec = time_usec; + packet.valid_points = valid_points; + mav_array_assign_float(packet.pos_x, pos_x, 5); + mav_array_assign_float(packet.pos_y, pos_y, 5); + mav_array_assign_float(packet.pos_z, pos_z, 5); + mav_array_assign_float(packet.delta, delta, 5); + mav_array_assign_float(packet.pos_yaw, pos_yaw, 5); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_CRC); +} + +/** + * @brief Pack a trajectory_representation_bezier message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param valid_points Number of valid control points (up-to 5 points are possible) + * @param pos_x [m] X-coordinate of bezier control points. Set to NaN if not being used + * @param pos_y [m] Y-coordinate of bezier control points. Set to NaN if not being used + * @param pos_z [m] Z-coordinate of bezier control points. Set to NaN if not being used + * @param delta [s] Bezier time horizon. Set to NaN if velocity/acceleration should not be incorporated + * @param pos_yaw [rad] Yaw. Set to NaN for unchanged + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_trajectory_representation_bezier_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, uint8_t valid_points, const float *pos_x, const float *pos_y, const float *pos_z, const float *delta, const float *pos_yaw) +{ #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN]; _mav_put_uint64_t(buf, 0, time_usec); @@ -98,7 +143,11 @@ static inline uint16_t mavlink_msg_trajectory_representation_bezier_pack(uint8_t #endif msg->msgid = MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_CRC); +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN); +#endif } /** @@ -134,11 +183,11 @@ static inline uint16_t mavlink_msg_trajectory_representation_bezier_pack_chan(ui mavlink_trajectory_representation_bezier_t packet; packet.time_usec = time_usec; packet.valid_points = valid_points; - mav_array_memcpy(packet.pos_x, pos_x, sizeof(float)*5); - mav_array_memcpy(packet.pos_y, pos_y, sizeof(float)*5); - mav_array_memcpy(packet.pos_z, pos_z, sizeof(float)*5); - mav_array_memcpy(packet.delta, delta, sizeof(float)*5); - mav_array_memcpy(packet.pos_yaw, pos_yaw, sizeof(float)*5); + mav_array_assign_float(packet.pos_x, pos_x, 5); + mav_array_assign_float(packet.pos_y, pos_y, 5); + mav_array_assign_float(packet.pos_z, pos_z, 5); + mav_array_assign_float(packet.delta, delta, 5); + mav_array_assign_float(packet.pos_yaw, pos_yaw, 5); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN); #endif @@ -173,6 +222,20 @@ static inline uint16_t mavlink_msg_trajectory_representation_bezier_encode_chan( return mavlink_msg_trajectory_representation_bezier_pack_chan(system_id, component_id, chan, msg, trajectory_representation_bezier->time_usec, trajectory_representation_bezier->valid_points, trajectory_representation_bezier->pos_x, trajectory_representation_bezier->pos_y, trajectory_representation_bezier->pos_z, trajectory_representation_bezier->delta, trajectory_representation_bezier->pos_yaw); } +/** + * @brief Encode a trajectory_representation_bezier struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param trajectory_representation_bezier C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_trajectory_representation_bezier_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_trajectory_representation_bezier_t* trajectory_representation_bezier) +{ + return mavlink_msg_trajectory_representation_bezier_pack_status(system_id, component_id, _status, msg, trajectory_representation_bezier->time_usec, trajectory_representation_bezier->valid_points, trajectory_representation_bezier->pos_x, trajectory_representation_bezier->pos_y, trajectory_representation_bezier->pos_z, trajectory_representation_bezier->delta, trajectory_representation_bezier->pos_yaw); +} + /** * @brief Send a trajectory_representation_bezier message * @param chan MAVLink channel to send the message @@ -203,11 +266,11 @@ static inline void mavlink_msg_trajectory_representation_bezier_send(mavlink_cha mavlink_trajectory_representation_bezier_t packet; packet.time_usec = time_usec; packet.valid_points = valid_points; - mav_array_memcpy(packet.pos_x, pos_x, sizeof(float)*5); - mav_array_memcpy(packet.pos_y, pos_y, sizeof(float)*5); - mav_array_memcpy(packet.pos_z, pos_z, sizeof(float)*5); - mav_array_memcpy(packet.delta, delta, sizeof(float)*5); - mav_array_memcpy(packet.pos_yaw, pos_yaw, sizeof(float)*5); + mav_array_assign_float(packet.pos_x, pos_x, 5); + mav_array_assign_float(packet.pos_y, pos_y, 5); + mav_array_assign_float(packet.pos_z, pos_z, 5); + mav_array_assign_float(packet.delta, delta, 5); + mav_array_assign_float(packet.pos_yaw, pos_yaw, 5); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER, (const char *)&packet, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_CRC); #endif } @@ -228,7 +291,7 @@ static inline void mavlink_msg_trajectory_representation_bezier_send_struct(mavl #if MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -250,11 +313,11 @@ static inline void mavlink_msg_trajectory_representation_bezier_send_buf(mavlink mavlink_trajectory_representation_bezier_t *packet = (mavlink_trajectory_representation_bezier_t *)msgbuf; packet->time_usec = time_usec; packet->valid_points = valid_points; - mav_array_memcpy(packet->pos_x, pos_x, sizeof(float)*5); - mav_array_memcpy(packet->pos_y, pos_y, sizeof(float)*5); - mav_array_memcpy(packet->pos_z, pos_z, sizeof(float)*5); - mav_array_memcpy(packet->delta, delta, sizeof(float)*5); - mav_array_memcpy(packet->pos_yaw, pos_yaw, sizeof(float)*5); + mav_array_assign_float(packet->pos_x, pos_x, 5); + mav_array_assign_float(packet->pos_y, pos_y, 5); + mav_array_assign_float(packet->pos_z, pos_z, 5); + mav_array_assign_float(packet->delta, delta, 5); + mav_array_assign_float(packet->pos_yaw, pos_yaw, 5); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER, (const char *)packet, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_CRC); #endif } diff --git a/common/mavlink_msg_trajectory_representation_waypoints.h b/common/mavlink_msg_trajectory_representation_waypoints.h index 470c4626f..0581ebaaa 100644 --- a/common/mavlink_msg_trajectory_representation_waypoints.h +++ b/common/mavlink_msg_trajectory_representation_waypoints.h @@ -17,7 +17,7 @@ typedef struct __mavlink_trajectory_representation_waypoints_t { float acc_z[5]; /*< [m/s/s] Z-acceleration of waypoint, set to NaN if not being used*/ float pos_yaw[5]; /*< [rad] Yaw angle, set to NaN if not being used*/ float vel_yaw[5]; /*< [rad/s] Yaw rate, set to NaN if not being used*/ - uint16_t command[5]; /*< Scheduled action for each waypoint, UINT16_MAX if not being used.*/ + uint16_t command[5]; /*< MAV_CMD command id of waypoint, set to UINT16_MAX if not being used.*/ uint8_t valid_points; /*< Number of valid points (up-to 5 waypoints are possible)*/ } mavlink_trajectory_representation_waypoints_t; @@ -104,12 +104,78 @@ typedef struct __mavlink_trajectory_representation_waypoints_t { * @param acc_z [m/s/s] Z-acceleration of waypoint, set to NaN if not being used * @param pos_yaw [rad] Yaw angle, set to NaN if not being used * @param vel_yaw [rad/s] Yaw rate, set to NaN if not being used - * @param command Scheduled action for each waypoint, UINT16_MAX if not being used. + * @param command MAV_CMD command id of waypoint, set to UINT16_MAX if not being used. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_trajectory_representation_waypoints_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint64_t time_usec, uint8_t valid_points, const float *pos_x, const float *pos_y, const float *pos_z, const float *vel_x, const float *vel_y, const float *vel_z, const float *acc_x, const float *acc_y, const float *acc_z, const float *pos_yaw, const float *vel_yaw, const uint16_t *command) { +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint8_t(buf, 238, valid_points); + _mav_put_float_array(buf, 8, pos_x, 5); + _mav_put_float_array(buf, 28, pos_y, 5); + _mav_put_float_array(buf, 48, pos_z, 5); + _mav_put_float_array(buf, 68, vel_x, 5); + _mav_put_float_array(buf, 88, vel_y, 5); + _mav_put_float_array(buf, 108, vel_z, 5); + _mav_put_float_array(buf, 128, acc_x, 5); + _mav_put_float_array(buf, 148, acc_y, 5); + _mav_put_float_array(buf, 168, acc_z, 5); + _mav_put_float_array(buf, 188, pos_yaw, 5); + _mav_put_float_array(buf, 208, vel_yaw, 5); + _mav_put_uint16_t_array(buf, 228, command, 5); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN); +#else + mavlink_trajectory_representation_waypoints_t packet; + packet.time_usec = time_usec; + packet.valid_points = valid_points; + mav_array_assign_float(packet.pos_x, pos_x, 5); + mav_array_assign_float(packet.pos_y, pos_y, 5); + mav_array_assign_float(packet.pos_z, pos_z, 5); + mav_array_assign_float(packet.vel_x, vel_x, 5); + mav_array_assign_float(packet.vel_y, vel_y, 5); + mav_array_assign_float(packet.vel_z, vel_z, 5); + mav_array_assign_float(packet.acc_x, acc_x, 5); + mav_array_assign_float(packet.acc_y, acc_y, 5); + mav_array_assign_float(packet.acc_z, acc_z, 5); + mav_array_assign_float(packet.pos_yaw, pos_yaw, 5); + mav_array_assign_float(packet.vel_yaw, vel_yaw, 5); + mav_array_assign_uint16_t(packet.command, command, 5); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_CRC); +} + +/** + * @brief Pack a trajectory_representation_waypoints message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param valid_points Number of valid points (up-to 5 waypoints are possible) + * @param pos_x [m] X-coordinate of waypoint, set to NaN if not being used + * @param pos_y [m] Y-coordinate of waypoint, set to NaN if not being used + * @param pos_z [m] Z-coordinate of waypoint, set to NaN if not being used + * @param vel_x [m/s] X-velocity of waypoint, set to NaN if not being used + * @param vel_y [m/s] Y-velocity of waypoint, set to NaN if not being used + * @param vel_z [m/s] Z-velocity of waypoint, set to NaN if not being used + * @param acc_x [m/s/s] X-acceleration of waypoint, set to NaN if not being used + * @param acc_y [m/s/s] Y-acceleration of waypoint, set to NaN if not being used + * @param acc_z [m/s/s] Z-acceleration of waypoint, set to NaN if not being used + * @param pos_yaw [rad] Yaw angle, set to NaN if not being used + * @param vel_yaw [rad/s] Yaw rate, set to NaN if not being used + * @param command MAV_CMD command id of waypoint, set to UINT16_MAX if not being used. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_trajectory_representation_waypoints_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, uint8_t valid_points, const float *pos_x, const float *pos_y, const float *pos_z, const float *vel_x, const float *vel_y, const float *vel_z, const float *acc_x, const float *acc_y, const float *acc_z, const float *pos_yaw, const float *vel_yaw, const uint16_t *command) +{ #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN]; _mav_put_uint64_t(buf, 0, time_usec); @@ -147,7 +213,11 @@ static inline uint16_t mavlink_msg_trajectory_representation_waypoints_pack(uint #endif msg->msgid = MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_CRC); +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN); +#endif } /** @@ -169,7 +239,7 @@ static inline uint16_t mavlink_msg_trajectory_representation_waypoints_pack(uint * @param acc_z [m/s/s] Z-acceleration of waypoint, set to NaN if not being used * @param pos_yaw [rad] Yaw angle, set to NaN if not being used * @param vel_yaw [rad/s] Yaw rate, set to NaN if not being used - * @param command Scheduled action for each waypoint, UINT16_MAX if not being used. + * @param command MAV_CMD command id of waypoint, set to UINT16_MAX if not being used. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_trajectory_representation_waypoints_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, @@ -197,18 +267,18 @@ static inline uint16_t mavlink_msg_trajectory_representation_waypoints_pack_chan mavlink_trajectory_representation_waypoints_t packet; packet.time_usec = time_usec; packet.valid_points = valid_points; - mav_array_memcpy(packet.pos_x, pos_x, sizeof(float)*5); - mav_array_memcpy(packet.pos_y, pos_y, sizeof(float)*5); - mav_array_memcpy(packet.pos_z, pos_z, sizeof(float)*5); - mav_array_memcpy(packet.vel_x, vel_x, sizeof(float)*5); - mav_array_memcpy(packet.vel_y, vel_y, sizeof(float)*5); - mav_array_memcpy(packet.vel_z, vel_z, sizeof(float)*5); - mav_array_memcpy(packet.acc_x, acc_x, sizeof(float)*5); - mav_array_memcpy(packet.acc_y, acc_y, sizeof(float)*5); - mav_array_memcpy(packet.acc_z, acc_z, sizeof(float)*5); - mav_array_memcpy(packet.pos_yaw, pos_yaw, sizeof(float)*5); - mav_array_memcpy(packet.vel_yaw, vel_yaw, sizeof(float)*5); - mav_array_memcpy(packet.command, command, sizeof(uint16_t)*5); + mav_array_assign_float(packet.pos_x, pos_x, 5); + mav_array_assign_float(packet.pos_y, pos_y, 5); + mav_array_assign_float(packet.pos_z, pos_z, 5); + mav_array_assign_float(packet.vel_x, vel_x, 5); + mav_array_assign_float(packet.vel_y, vel_y, 5); + mav_array_assign_float(packet.vel_z, vel_z, 5); + mav_array_assign_float(packet.acc_x, acc_x, 5); + mav_array_assign_float(packet.acc_y, acc_y, 5); + mav_array_assign_float(packet.acc_z, acc_z, 5); + mav_array_assign_float(packet.pos_yaw, pos_yaw, 5); + mav_array_assign_float(packet.vel_yaw, vel_yaw, 5); + mav_array_assign_uint16_t(packet.command, command, 5); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN); #endif @@ -243,6 +313,20 @@ static inline uint16_t mavlink_msg_trajectory_representation_waypoints_encode_ch return mavlink_msg_trajectory_representation_waypoints_pack_chan(system_id, component_id, chan, msg, trajectory_representation_waypoints->time_usec, trajectory_representation_waypoints->valid_points, trajectory_representation_waypoints->pos_x, trajectory_representation_waypoints->pos_y, trajectory_representation_waypoints->pos_z, trajectory_representation_waypoints->vel_x, trajectory_representation_waypoints->vel_y, trajectory_representation_waypoints->vel_z, trajectory_representation_waypoints->acc_x, trajectory_representation_waypoints->acc_y, trajectory_representation_waypoints->acc_z, trajectory_representation_waypoints->pos_yaw, trajectory_representation_waypoints->vel_yaw, trajectory_representation_waypoints->command); } +/** + * @brief Encode a trajectory_representation_waypoints struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param trajectory_representation_waypoints C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_trajectory_representation_waypoints_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_trajectory_representation_waypoints_t* trajectory_representation_waypoints) +{ + return mavlink_msg_trajectory_representation_waypoints_pack_status(system_id, component_id, _status, msg, trajectory_representation_waypoints->time_usec, trajectory_representation_waypoints->valid_points, trajectory_representation_waypoints->pos_x, trajectory_representation_waypoints->pos_y, trajectory_representation_waypoints->pos_z, trajectory_representation_waypoints->vel_x, trajectory_representation_waypoints->vel_y, trajectory_representation_waypoints->vel_z, trajectory_representation_waypoints->acc_x, trajectory_representation_waypoints->acc_y, trajectory_representation_waypoints->acc_z, trajectory_representation_waypoints->pos_yaw, trajectory_representation_waypoints->vel_yaw, trajectory_representation_waypoints->command); +} + /** * @brief Send a trajectory_representation_waypoints message * @param chan MAVLink channel to send the message @@ -260,7 +344,7 @@ static inline uint16_t mavlink_msg_trajectory_representation_waypoints_encode_ch * @param acc_z [m/s/s] Z-acceleration of waypoint, set to NaN if not being used * @param pos_yaw [rad] Yaw angle, set to NaN if not being used * @param vel_yaw [rad/s] Yaw rate, set to NaN if not being used - * @param command Scheduled action for each waypoint, UINT16_MAX if not being used. + * @param command MAV_CMD command id of waypoint, set to UINT16_MAX if not being used. */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS @@ -287,18 +371,18 @@ static inline void mavlink_msg_trajectory_representation_waypoints_send(mavlink_ mavlink_trajectory_representation_waypoints_t packet; packet.time_usec = time_usec; packet.valid_points = valid_points; - mav_array_memcpy(packet.pos_x, pos_x, sizeof(float)*5); - mav_array_memcpy(packet.pos_y, pos_y, sizeof(float)*5); - mav_array_memcpy(packet.pos_z, pos_z, sizeof(float)*5); - mav_array_memcpy(packet.vel_x, vel_x, sizeof(float)*5); - mav_array_memcpy(packet.vel_y, vel_y, sizeof(float)*5); - mav_array_memcpy(packet.vel_z, vel_z, sizeof(float)*5); - mav_array_memcpy(packet.acc_x, acc_x, sizeof(float)*5); - mav_array_memcpy(packet.acc_y, acc_y, sizeof(float)*5); - mav_array_memcpy(packet.acc_z, acc_z, sizeof(float)*5); - mav_array_memcpy(packet.pos_yaw, pos_yaw, sizeof(float)*5); - mav_array_memcpy(packet.vel_yaw, vel_yaw, sizeof(float)*5); - mav_array_memcpy(packet.command, command, sizeof(uint16_t)*5); + mav_array_assign_float(packet.pos_x, pos_x, 5); + mav_array_assign_float(packet.pos_y, pos_y, 5); + mav_array_assign_float(packet.pos_z, pos_z, 5); + mav_array_assign_float(packet.vel_x, vel_x, 5); + mav_array_assign_float(packet.vel_y, vel_y, 5); + mav_array_assign_float(packet.vel_z, vel_z, 5); + mav_array_assign_float(packet.acc_x, acc_x, 5); + mav_array_assign_float(packet.acc_y, acc_y, 5); + mav_array_assign_float(packet.acc_z, acc_z, 5); + mav_array_assign_float(packet.pos_yaw, pos_yaw, 5); + mav_array_assign_float(packet.vel_yaw, vel_yaw, 5); + mav_array_assign_uint16_t(packet.command, command, 5); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS, (const char *)&packet, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_CRC); #endif } @@ -319,7 +403,7 @@ static inline void mavlink_msg_trajectory_representation_waypoints_send_struct(m #if MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -348,18 +432,18 @@ static inline void mavlink_msg_trajectory_representation_waypoints_send_buf(mavl mavlink_trajectory_representation_waypoints_t *packet = (mavlink_trajectory_representation_waypoints_t *)msgbuf; packet->time_usec = time_usec; packet->valid_points = valid_points; - mav_array_memcpy(packet->pos_x, pos_x, sizeof(float)*5); - mav_array_memcpy(packet->pos_y, pos_y, sizeof(float)*5); - mav_array_memcpy(packet->pos_z, pos_z, sizeof(float)*5); - mav_array_memcpy(packet->vel_x, vel_x, sizeof(float)*5); - mav_array_memcpy(packet->vel_y, vel_y, sizeof(float)*5); - mav_array_memcpy(packet->vel_z, vel_z, sizeof(float)*5); - mav_array_memcpy(packet->acc_x, acc_x, sizeof(float)*5); - mav_array_memcpy(packet->acc_y, acc_y, sizeof(float)*5); - mav_array_memcpy(packet->acc_z, acc_z, sizeof(float)*5); - mav_array_memcpy(packet->pos_yaw, pos_yaw, sizeof(float)*5); - mav_array_memcpy(packet->vel_yaw, vel_yaw, sizeof(float)*5); - mav_array_memcpy(packet->command, command, sizeof(uint16_t)*5); + mav_array_assign_float(packet->pos_x, pos_x, 5); + mav_array_assign_float(packet->pos_y, pos_y, 5); + mav_array_assign_float(packet->pos_z, pos_z, 5); + mav_array_assign_float(packet->vel_x, vel_x, 5); + mav_array_assign_float(packet->vel_y, vel_y, 5); + mav_array_assign_float(packet->vel_z, vel_z, 5); + mav_array_assign_float(packet->acc_x, acc_x, 5); + mav_array_assign_float(packet->acc_y, acc_y, 5); + mav_array_assign_float(packet->acc_z, acc_z, 5); + mav_array_assign_float(packet->pos_yaw, pos_yaw, 5); + mav_array_assign_float(packet->vel_yaw, vel_yaw, 5); + mav_array_assign_uint16_t(packet->command, command, 5); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS, (const char *)packet, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_CRC); #endif } @@ -503,7 +587,7 @@ static inline uint16_t mavlink_msg_trajectory_representation_waypoints_get_vel_y /** * @brief Get field command from trajectory_representation_waypoints message * - * @return Scheduled action for each waypoint, UINT16_MAX if not being used. + * @return MAV_CMD command id of waypoint, set to UINT16_MAX if not being used. */ static inline uint16_t mavlink_msg_trajectory_representation_waypoints_get_command(const mavlink_message_t* msg, uint16_t *command) { diff --git a/common/mavlink_msg_tunnel.h b/common/mavlink_msg_tunnel.h index 871315882..7cb555853 100644 --- a/common/mavlink_msg_tunnel.h +++ b/common/mavlink_msg_tunnel.h @@ -77,7 +77,7 @@ static inline uint16_t mavlink_msg_tunnel_pack(uint8_t system_id, uint8_t compon packet.target_system = target_system; packet.target_component = target_component; packet.payload_length = payload_length; - mav_array_memcpy(packet.payload, payload, sizeof(uint8_t)*128); + mav_array_assign_uint8_t(packet.payload, payload, 128); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TUNNEL_LEN); #endif @@ -85,6 +85,49 @@ static inline uint16_t mavlink_msg_tunnel_pack(uint8_t system_id, uint8_t compon return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_TUNNEL_MIN_LEN, MAVLINK_MSG_ID_TUNNEL_LEN, MAVLINK_MSG_ID_TUNNEL_CRC); } +/** + * @brief Pack a tunnel message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID (can be 0 for broadcast, but this is discouraged) + * @param target_component Component ID (can be 0 for broadcast, but this is discouraged) + * @param payload_type A code that identifies the content of the payload (0 for unknown, which is the default). If this code is less than 32768, it is a 'registered' payload type and the corresponding code should be added to the MAV_TUNNEL_PAYLOAD_TYPE enum. Software creators can register blocks of types as needed. Codes greater than 32767 are considered local experiments and should not be checked in to any widely distributed codebase. + * @param payload_length Length of the data transported in payload + * @param payload Variable length payload. The payload length is defined by payload_length. The entire content of this block is opaque unless you understand the encoding specified by payload_type. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_tunnel_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint16_t payload_type, uint8_t payload_length, const uint8_t *payload) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_TUNNEL_LEN]; + _mav_put_uint16_t(buf, 0, payload_type); + _mav_put_uint8_t(buf, 2, target_system); + _mav_put_uint8_t(buf, 3, target_component); + _mav_put_uint8_t(buf, 4, payload_length); + _mav_put_uint8_t_array(buf, 5, payload, 128); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TUNNEL_LEN); +#else + mavlink_tunnel_t packet; + packet.payload_type = payload_type; + packet.target_system = target_system; + packet.target_component = target_component; + packet.payload_length = payload_length; + mav_array_memcpy(packet.payload, payload, sizeof(uint8_t)*128); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TUNNEL_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_TUNNEL; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_TUNNEL_MIN_LEN, MAVLINK_MSG_ID_TUNNEL_LEN, MAVLINK_MSG_ID_TUNNEL_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_TUNNEL_MIN_LEN, MAVLINK_MSG_ID_TUNNEL_LEN); +#endif +} + /** * @brief Pack a tunnel message on a channel * @param system_id ID of this system @@ -116,7 +159,7 @@ static inline uint16_t mavlink_msg_tunnel_pack_chan(uint8_t system_id, uint8_t c packet.target_system = target_system; packet.target_component = target_component; packet.payload_length = payload_length; - mav_array_memcpy(packet.payload, payload, sizeof(uint8_t)*128); + mav_array_assign_uint8_t(packet.payload, payload, 128); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TUNNEL_LEN); #endif @@ -151,6 +194,20 @@ static inline uint16_t mavlink_msg_tunnel_encode_chan(uint8_t system_id, uint8_t return mavlink_msg_tunnel_pack_chan(system_id, component_id, chan, msg, tunnel->target_system, tunnel->target_component, tunnel->payload_type, tunnel->payload_length, tunnel->payload); } +/** + * @brief Encode a tunnel struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param tunnel C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_tunnel_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_tunnel_t* tunnel) +{ + return mavlink_msg_tunnel_pack_status(system_id, component_id, _status, msg, tunnel->target_system, tunnel->target_component, tunnel->payload_type, tunnel->payload_length, tunnel->payload); +} + /** * @brief Send a tunnel message * @param chan MAVLink channel to send the message @@ -179,7 +236,7 @@ static inline void mavlink_msg_tunnel_send(mavlink_channel_t chan, uint8_t targe packet.target_system = target_system; packet.target_component = target_component; packet.payload_length = payload_length; - mav_array_memcpy(packet.payload, payload, sizeof(uint8_t)*128); + mav_array_assign_uint8_t(packet.payload, payload, 128); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TUNNEL, (const char *)&packet, MAVLINK_MSG_ID_TUNNEL_MIN_LEN, MAVLINK_MSG_ID_TUNNEL_LEN, MAVLINK_MSG_ID_TUNNEL_CRC); #endif } @@ -200,7 +257,7 @@ static inline void mavlink_msg_tunnel_send_struct(mavlink_channel_t chan, const #if MAVLINK_MSG_ID_TUNNEL_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -222,7 +279,7 @@ static inline void mavlink_msg_tunnel_send_buf(mavlink_message_t *msgbuf, mavlin packet->target_system = target_system; packet->target_component = target_component; packet->payload_length = payload_length; - mav_array_memcpy(packet->payload, payload, sizeof(uint8_t)*128); + mav_array_assign_uint8_t(packet->payload, payload, 128); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TUNNEL, (const char *)packet, MAVLINK_MSG_ID_TUNNEL_MIN_LEN, MAVLINK_MSG_ID_TUNNEL_LEN, MAVLINK_MSG_ID_TUNNEL_CRC); #endif } diff --git a/common/mavlink_msg_uavcan_node_info.h b/common/mavlink_msg_uavcan_node_info.h index a042c5c4e..d388a0548 100644 --- a/common/mavlink_msg_uavcan_node_info.h +++ b/common/mavlink_msg_uavcan_node_info.h @@ -7,7 +7,7 @@ typedef struct __mavlink_uavcan_node_info_t { uint64_t time_usec; /*< [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.*/ uint32_t uptime_sec; /*< [s] Time since the start-up of the node.*/ - uint32_t sw_vcs_commit; /*< Version control system (VCS) revision identifier (e.g. git short commit hash). Zero if unknown.*/ + uint32_t sw_vcs_commit; /*< Version control system (VCS) revision identifier (e.g. git short commit hash). 0 if unknown.*/ char name[80]; /*< Node name string. For example, "sapog.px4.io".*/ uint8_t hw_version_major; /*< Hardware major version number.*/ uint8_t hw_version_minor; /*< Hardware minor version number.*/ @@ -74,12 +74,63 @@ typedef struct __mavlink_uavcan_node_info_t { * @param hw_unique_id Hardware unique 128-bit ID. * @param sw_version_major Software major version number. * @param sw_version_minor Software minor version number. - * @param sw_vcs_commit Version control system (VCS) revision identifier (e.g. git short commit hash). Zero if unknown. + * @param sw_vcs_commit Version control system (VCS) revision identifier (e.g. git short commit hash). 0 if unknown. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_uavcan_node_info_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint64_t time_usec, uint32_t uptime_sec, const char *name, uint8_t hw_version_major, uint8_t hw_version_minor, const uint8_t *hw_unique_id, uint8_t sw_version_major, uint8_t sw_version_minor, uint32_t sw_vcs_commit) { +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint32_t(buf, 8, uptime_sec); + _mav_put_uint32_t(buf, 12, sw_vcs_commit); + _mav_put_uint8_t(buf, 96, hw_version_major); + _mav_put_uint8_t(buf, 97, hw_version_minor); + _mav_put_uint8_t(buf, 114, sw_version_major); + _mav_put_uint8_t(buf, 115, sw_version_minor); + _mav_put_char_array(buf, 16, name, 80); + _mav_put_uint8_t_array(buf, 98, hw_unique_id, 16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN); +#else + mavlink_uavcan_node_info_t packet; + packet.time_usec = time_usec; + packet.uptime_sec = uptime_sec; + packet.sw_vcs_commit = sw_vcs_commit; + packet.hw_version_major = hw_version_major; + packet.hw_version_minor = hw_version_minor; + packet.sw_version_major = sw_version_major; + packet.sw_version_minor = sw_version_minor; + mav_array_assign_char(packet.name, name, 80); + mav_array_assign_uint8_t(packet.hw_unique_id, hw_unique_id, 16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_UAVCAN_NODE_INFO; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_MIN_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_CRC); +} + +/** + * @brief Pack a uavcan_node_info message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param uptime_sec [s] Time since the start-up of the node. + * @param name Node name string. For example, "sapog.px4.io". + * @param hw_version_major Hardware major version number. + * @param hw_version_minor Hardware minor version number. + * @param hw_unique_id Hardware unique 128-bit ID. + * @param sw_version_major Software major version number. + * @param sw_version_minor Software minor version number. + * @param sw_vcs_commit Version control system (VCS) revision identifier (e.g. git short commit hash). 0 if unknown. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_uavcan_node_info_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, uint32_t uptime_sec, const char *name, uint8_t hw_version_major, uint8_t hw_version_minor, const uint8_t *hw_unique_id, uint8_t sw_version_major, uint8_t sw_version_minor, uint32_t sw_vcs_commit) +{ #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN]; _mav_put_uint64_t(buf, 0, time_usec); @@ -107,7 +158,11 @@ static inline uint16_t mavlink_msg_uavcan_node_info_pack(uint8_t system_id, uint #endif msg->msgid = MAVLINK_MSG_ID_UAVCAN_NODE_INFO; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_MIN_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_CRC); +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_MIN_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_MIN_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN); +#endif } /** @@ -124,7 +179,7 @@ static inline uint16_t mavlink_msg_uavcan_node_info_pack(uint8_t system_id, uint * @param hw_unique_id Hardware unique 128-bit ID. * @param sw_version_major Software major version number. * @param sw_version_minor Software minor version number. - * @param sw_vcs_commit Version control system (VCS) revision identifier (e.g. git short commit hash). Zero if unknown. + * @param sw_vcs_commit Version control system (VCS) revision identifier (e.g. git short commit hash). 0 if unknown. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_uavcan_node_info_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, @@ -152,8 +207,8 @@ static inline uint16_t mavlink_msg_uavcan_node_info_pack_chan(uint8_t system_id, packet.hw_version_minor = hw_version_minor; packet.sw_version_major = sw_version_major; packet.sw_version_minor = sw_version_minor; - mav_array_memcpy(packet.name, name, sizeof(char)*80); - mav_array_memcpy(packet.hw_unique_id, hw_unique_id, sizeof(uint8_t)*16); + mav_array_assign_char(packet.name, name, 80); + mav_array_assign_uint8_t(packet.hw_unique_id, hw_unique_id, 16); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN); #endif @@ -188,6 +243,20 @@ static inline uint16_t mavlink_msg_uavcan_node_info_encode_chan(uint8_t system_i return mavlink_msg_uavcan_node_info_pack_chan(system_id, component_id, chan, msg, uavcan_node_info->time_usec, uavcan_node_info->uptime_sec, uavcan_node_info->name, uavcan_node_info->hw_version_major, uavcan_node_info->hw_version_minor, uavcan_node_info->hw_unique_id, uavcan_node_info->sw_version_major, uavcan_node_info->sw_version_minor, uavcan_node_info->sw_vcs_commit); } +/** + * @brief Encode a uavcan_node_info struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param uavcan_node_info C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_uavcan_node_info_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_uavcan_node_info_t* uavcan_node_info) +{ + return mavlink_msg_uavcan_node_info_pack_status(system_id, component_id, _status, msg, uavcan_node_info->time_usec, uavcan_node_info->uptime_sec, uavcan_node_info->name, uavcan_node_info->hw_version_major, uavcan_node_info->hw_version_minor, uavcan_node_info->hw_unique_id, uavcan_node_info->sw_version_major, uavcan_node_info->sw_version_minor, uavcan_node_info->sw_vcs_commit); +} + /** * @brief Send a uavcan_node_info message * @param chan MAVLink channel to send the message @@ -200,7 +269,7 @@ static inline uint16_t mavlink_msg_uavcan_node_info_encode_chan(uint8_t system_i * @param hw_unique_id Hardware unique 128-bit ID. * @param sw_version_major Software major version number. * @param sw_version_minor Software minor version number. - * @param sw_vcs_commit Version control system (VCS) revision identifier (e.g. git short commit hash). Zero if unknown. + * @param sw_vcs_commit Version control system (VCS) revision identifier (e.g. git short commit hash). 0 if unknown. */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS @@ -227,8 +296,8 @@ static inline void mavlink_msg_uavcan_node_info_send(mavlink_channel_t chan, uin packet.hw_version_minor = hw_version_minor; packet.sw_version_major = sw_version_major; packet.sw_version_minor = sw_version_minor; - mav_array_memcpy(packet.name, name, sizeof(char)*80); - mav_array_memcpy(packet.hw_unique_id, hw_unique_id, sizeof(uint8_t)*16); + mav_array_assign_char(packet.name, name, 80); + mav_array_assign_uint8_t(packet.hw_unique_id, hw_unique_id, 16); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UAVCAN_NODE_INFO, (const char *)&packet, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_MIN_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_CRC); #endif } @@ -249,7 +318,7 @@ static inline void mavlink_msg_uavcan_node_info_send_struct(mavlink_channel_t ch #if MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -278,8 +347,8 @@ static inline void mavlink_msg_uavcan_node_info_send_buf(mavlink_message_t *msgb packet->hw_version_minor = hw_version_minor; packet->sw_version_major = sw_version_major; packet->sw_version_minor = sw_version_minor; - mav_array_memcpy(packet->name, name, sizeof(char)*80); - mav_array_memcpy(packet->hw_unique_id, hw_unique_id, sizeof(uint8_t)*16); + mav_array_assign_char(packet->name, name, 80); + mav_array_assign_uint8_t(packet->hw_unique_id, hw_unique_id, 16); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UAVCAN_NODE_INFO, (const char *)packet, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_MIN_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_CRC); #endif } @@ -373,7 +442,7 @@ static inline uint8_t mavlink_msg_uavcan_node_info_get_sw_version_minor(const ma /** * @brief Get field sw_vcs_commit from uavcan_node_info message * - * @return Version control system (VCS) revision identifier (e.g. git short commit hash). Zero if unknown. + * @return Version control system (VCS) revision identifier (e.g. git short commit hash). 0 if unknown. */ static inline uint32_t mavlink_msg_uavcan_node_info_get_sw_vcs_commit(const mavlink_message_t* msg) { diff --git a/common/mavlink_msg_uavcan_node_status.h b/common/mavlink_msg_uavcan_node_status.h index 6f1d8d8fd..743f31c46 100644 --- a/common/mavlink_msg_uavcan_node_status.h +++ b/common/mavlink_msg_uavcan_node_status.h @@ -93,6 +93,54 @@ static inline uint16_t mavlink_msg_uavcan_node_status_pack(uint8_t system_id, ui return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_UAVCAN_NODE_STATUS_MIN_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_STATUS_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_STATUS_CRC); } +/** + * @brief Pack a uavcan_node_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param uptime_sec [s] Time since the start-up of the node. + * @param health Generalized node health status. + * @param mode Generalized operating mode. + * @param sub_mode Not used currently. + * @param vendor_specific_status_code Vendor-specific status information. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_uavcan_node_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, uint32_t uptime_sec, uint8_t health, uint8_t mode, uint8_t sub_mode, uint16_t vendor_specific_status_code) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_UAVCAN_NODE_STATUS_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint32_t(buf, 8, uptime_sec); + _mav_put_uint16_t(buf, 12, vendor_specific_status_code); + _mav_put_uint8_t(buf, 14, health); + _mav_put_uint8_t(buf, 15, mode); + _mav_put_uint8_t(buf, 16, sub_mode); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_UAVCAN_NODE_STATUS_LEN); +#else + mavlink_uavcan_node_status_t packet; + packet.time_usec = time_usec; + packet.uptime_sec = uptime_sec; + packet.vendor_specific_status_code = vendor_specific_status_code; + packet.health = health; + packet.mode = mode; + packet.sub_mode = sub_mode; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_UAVCAN_NODE_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_UAVCAN_NODE_STATUS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_UAVCAN_NODE_STATUS_MIN_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_STATUS_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_UAVCAN_NODE_STATUS_MIN_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_STATUS_LEN); +#endif +} + /** * @brief Pack a uavcan_node_status message on a channel * @param system_id ID of this system @@ -164,6 +212,20 @@ static inline uint16_t mavlink_msg_uavcan_node_status_encode_chan(uint8_t system return mavlink_msg_uavcan_node_status_pack_chan(system_id, component_id, chan, msg, uavcan_node_status->time_usec, uavcan_node_status->uptime_sec, uavcan_node_status->health, uavcan_node_status->mode, uavcan_node_status->sub_mode, uavcan_node_status->vendor_specific_status_code); } +/** + * @brief Encode a uavcan_node_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param uavcan_node_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_uavcan_node_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_uavcan_node_status_t* uavcan_node_status) +{ + return mavlink_msg_uavcan_node_status_pack_status(system_id, component_id, _status, msg, uavcan_node_status->time_usec, uavcan_node_status->uptime_sec, uavcan_node_status->health, uavcan_node_status->mode, uavcan_node_status->sub_mode, uavcan_node_status->vendor_specific_status_code); +} + /** * @brief Send a uavcan_node_status message * @param chan MAVLink channel to send the message @@ -218,7 +280,7 @@ static inline void mavlink_msg_uavcan_node_status_send_struct(mavlink_channel_t #if MAVLINK_MSG_ID_UAVCAN_NODE_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_utm_global_position.h b/common/mavlink_msg_utm_global_position.h index 0c8ee7226..2e257cc1a 100644 --- a/common/mavlink_msg_utm_global_position.h +++ b/common/mavlink_msg_utm_global_position.h @@ -155,7 +155,7 @@ static inline uint16_t mavlink_msg_utm_global_position_pack(uint8_t system_id, u packet.update_rate = update_rate; packet.flight_state = flight_state; packet.flags = flags; - mav_array_memcpy(packet.uas_id, uas_id, sizeof(uint8_t)*18); + mav_array_assign_uint8_t(packet.uas_id, uas_id, 18); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN); #endif @@ -163,6 +163,88 @@ static inline uint16_t mavlink_msg_utm_global_position_pack(uint8_t system_id, u return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_CRC); } +/** + * @brief Pack a utm_global_position message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time [us] Time of applicability of position (microseconds since UNIX epoch). + * @param uas_id Unique UAS ID. + * @param lat [degE7] Latitude (WGS84) + * @param lon [degE7] Longitude (WGS84) + * @param alt [mm] Altitude (WGS84) + * @param relative_alt [mm] Altitude above ground + * @param vx [cm/s] Ground X speed (latitude, positive north) + * @param vy [cm/s] Ground Y speed (longitude, positive east) + * @param vz [cm/s] Ground Z speed (altitude, positive down) + * @param h_acc [mm] Horizontal position uncertainty (standard deviation) + * @param v_acc [mm] Altitude uncertainty (standard deviation) + * @param vel_acc [cm/s] Speed uncertainty (standard deviation) + * @param next_lat [degE7] Next waypoint, latitude (WGS84) + * @param next_lon [degE7] Next waypoint, longitude (WGS84) + * @param next_alt [mm] Next waypoint, altitude (WGS84) + * @param update_rate [cs] Time until next update. Set to 0 if unknown or in data driven mode. + * @param flight_state Flight state + * @param flags Bitwise OR combination of the data available flags. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_utm_global_position_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time, const uint8_t *uas_id, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, int16_t vx, int16_t vy, int16_t vz, uint16_t h_acc, uint16_t v_acc, uint16_t vel_acc, int32_t next_lat, int32_t next_lon, int32_t next_alt, uint16_t update_rate, uint8_t flight_state, uint8_t flags) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN]; + _mav_put_uint64_t(buf, 0, time); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_int32_t(buf, 16, alt); + _mav_put_int32_t(buf, 20, relative_alt); + _mav_put_int32_t(buf, 24, next_lat); + _mav_put_int32_t(buf, 28, next_lon); + _mav_put_int32_t(buf, 32, next_alt); + _mav_put_int16_t(buf, 36, vx); + _mav_put_int16_t(buf, 38, vy); + _mav_put_int16_t(buf, 40, vz); + _mav_put_uint16_t(buf, 42, h_acc); + _mav_put_uint16_t(buf, 44, v_acc); + _mav_put_uint16_t(buf, 46, vel_acc); + _mav_put_uint16_t(buf, 48, update_rate); + _mav_put_uint8_t(buf, 68, flight_state); + _mav_put_uint8_t(buf, 69, flags); + _mav_put_uint8_t_array(buf, 50, uas_id, 18); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN); +#else + mavlink_utm_global_position_t packet; + packet.time = time; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.relative_alt = relative_alt; + packet.next_lat = next_lat; + packet.next_lon = next_lon; + packet.next_alt = next_alt; + packet.vx = vx; + packet.vy = vy; + packet.vz = vz; + packet.h_acc = h_acc; + packet.v_acc = v_acc; + packet.vel_acc = vel_acc; + packet.update_rate = update_rate; + packet.flight_state = flight_state; + packet.flags = flags; + mav_array_memcpy(packet.uas_id, uas_id, sizeof(uint8_t)*18); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_UTM_GLOBAL_POSITION; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN); +#endif +} + /** * @brief Pack a utm_global_position message on a channel * @param system_id ID of this system @@ -233,7 +315,7 @@ static inline uint16_t mavlink_msg_utm_global_position_pack_chan(uint8_t system_ packet.update_rate = update_rate; packet.flight_state = flight_state; packet.flags = flags; - mav_array_memcpy(packet.uas_id, uas_id, sizeof(uint8_t)*18); + mav_array_assign_uint8_t(packet.uas_id, uas_id, 18); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN); #endif @@ -268,6 +350,20 @@ static inline uint16_t mavlink_msg_utm_global_position_encode_chan(uint8_t syste return mavlink_msg_utm_global_position_pack_chan(system_id, component_id, chan, msg, utm_global_position->time, utm_global_position->uas_id, utm_global_position->lat, utm_global_position->lon, utm_global_position->alt, utm_global_position->relative_alt, utm_global_position->vx, utm_global_position->vy, utm_global_position->vz, utm_global_position->h_acc, utm_global_position->v_acc, utm_global_position->vel_acc, utm_global_position->next_lat, utm_global_position->next_lon, utm_global_position->next_alt, utm_global_position->update_rate, utm_global_position->flight_state, utm_global_position->flags); } +/** + * @brief Encode a utm_global_position struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param utm_global_position C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_utm_global_position_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_utm_global_position_t* utm_global_position) +{ + return mavlink_msg_utm_global_position_pack_status(system_id, component_id, _status, msg, utm_global_position->time, utm_global_position->uas_id, utm_global_position->lat, utm_global_position->lon, utm_global_position->alt, utm_global_position->relative_alt, utm_global_position->vx, utm_global_position->vy, utm_global_position->vz, utm_global_position->h_acc, utm_global_position->v_acc, utm_global_position->vel_acc, utm_global_position->next_lat, utm_global_position->next_lon, utm_global_position->next_alt, utm_global_position->update_rate, utm_global_position->flight_state, utm_global_position->flags); +} + /** * @brief Send a utm_global_position message * @param chan MAVLink channel to send the message @@ -335,7 +431,7 @@ static inline void mavlink_msg_utm_global_position_send(mavlink_channel_t chan, packet.update_rate = update_rate; packet.flight_state = flight_state; packet.flags = flags; - mav_array_memcpy(packet.uas_id, uas_id, sizeof(uint8_t)*18); + mav_array_assign_uint8_t(packet.uas_id, uas_id, 18); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION, (const char *)&packet, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_CRC); #endif } @@ -356,7 +452,7 @@ static inline void mavlink_msg_utm_global_position_send_struct(mavlink_channel_t #if MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -404,7 +500,7 @@ static inline void mavlink_msg_utm_global_position_send_buf(mavlink_message_t *m packet->update_rate = update_rate; packet->flight_state = flight_state; packet->flags = flags; - mav_array_memcpy(packet->uas_id, uas_id, sizeof(uint8_t)*18); + mav_array_assign_uint8_t(packet->uas_id, uas_id, 18); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION, (const char *)packet, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_CRC); #endif } diff --git a/common/mavlink_msg_v2_extension.h b/common/mavlink_msg_v2_extension.h index 689e89114..4eff8fc94 100644 --- a/common/mavlink_msg_v2_extension.h +++ b/common/mavlink_msg_v2_extension.h @@ -77,7 +77,7 @@ static inline uint16_t mavlink_msg_v2_extension_pack(uint8_t system_id, uint8_t packet.target_network = target_network; packet.target_system = target_system; packet.target_component = target_component; - mav_array_memcpy(packet.payload, payload, sizeof(uint8_t)*249); + mav_array_assign_uint8_t(packet.payload, payload, 249); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_V2_EXTENSION_LEN); #endif @@ -85,6 +85,49 @@ static inline uint16_t mavlink_msg_v2_extension_pack(uint8_t system_id, uint8_t return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_V2_EXTENSION_MIN_LEN, MAVLINK_MSG_ID_V2_EXTENSION_LEN, MAVLINK_MSG_ID_V2_EXTENSION_CRC); } +/** + * @brief Pack a v2_extension message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_network Network ID (0 for broadcast) + * @param target_system System ID (0 for broadcast) + * @param target_component Component ID (0 for broadcast) + * @param message_type A code that identifies the software component that understands this message (analogous to USB device classes or mime type strings). If this code is less than 32768, it is considered a 'registered' protocol extension and the corresponding entry should be added to https://github.com/mavlink/mavlink/definition_files/extension_message_ids.xml. Software creators can register blocks of message IDs as needed (useful for GCS specific metadata, etc...). Message_types greater than 32767 are considered local experiments and should not be checked in to any widely distributed codebase. + * @param payload Variable length payload. The length must be encoded in the payload as part of the message_type protocol, e.g. by including the length as payload data, or by terminating the payload data with a non-zero marker. This is required in order to reconstruct zero-terminated payloads that are (or otherwise would be) trimmed by MAVLink 2 empty-byte truncation. The entire content of the payload block is opaque unless you understand the encoding message_type. The particular encoding used can be extension specific and might not always be documented as part of the MAVLink specification. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_v2_extension_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_network, uint8_t target_system, uint8_t target_component, uint16_t message_type, const uint8_t *payload) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_V2_EXTENSION_LEN]; + _mav_put_uint16_t(buf, 0, message_type); + _mav_put_uint8_t(buf, 2, target_network); + _mav_put_uint8_t(buf, 3, target_system); + _mav_put_uint8_t(buf, 4, target_component); + _mav_put_uint8_t_array(buf, 5, payload, 249); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_V2_EXTENSION_LEN); +#else + mavlink_v2_extension_t packet; + packet.message_type = message_type; + packet.target_network = target_network; + packet.target_system = target_system; + packet.target_component = target_component; + mav_array_memcpy(packet.payload, payload, sizeof(uint8_t)*249); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_V2_EXTENSION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_V2_EXTENSION; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_V2_EXTENSION_MIN_LEN, MAVLINK_MSG_ID_V2_EXTENSION_LEN, MAVLINK_MSG_ID_V2_EXTENSION_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_V2_EXTENSION_MIN_LEN, MAVLINK_MSG_ID_V2_EXTENSION_LEN); +#endif +} + /** * @brief Pack a v2_extension message on a channel * @param system_id ID of this system @@ -116,7 +159,7 @@ static inline uint16_t mavlink_msg_v2_extension_pack_chan(uint8_t system_id, uin packet.target_network = target_network; packet.target_system = target_system; packet.target_component = target_component; - mav_array_memcpy(packet.payload, payload, sizeof(uint8_t)*249); + mav_array_assign_uint8_t(packet.payload, payload, 249); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_V2_EXTENSION_LEN); #endif @@ -151,6 +194,20 @@ static inline uint16_t mavlink_msg_v2_extension_encode_chan(uint8_t system_id, u return mavlink_msg_v2_extension_pack_chan(system_id, component_id, chan, msg, v2_extension->target_network, v2_extension->target_system, v2_extension->target_component, v2_extension->message_type, v2_extension->payload); } +/** + * @brief Encode a v2_extension struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param v2_extension C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_v2_extension_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_v2_extension_t* v2_extension) +{ + return mavlink_msg_v2_extension_pack_status(system_id, component_id, _status, msg, v2_extension->target_network, v2_extension->target_system, v2_extension->target_component, v2_extension->message_type, v2_extension->payload); +} + /** * @brief Send a v2_extension message * @param chan MAVLink channel to send the message @@ -179,7 +236,7 @@ static inline void mavlink_msg_v2_extension_send(mavlink_channel_t chan, uint8_t packet.target_network = target_network; packet.target_system = target_system; packet.target_component = target_component; - mav_array_memcpy(packet.payload, payload, sizeof(uint8_t)*249); + mav_array_assign_uint8_t(packet.payload, payload, 249); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_V2_EXTENSION, (const char *)&packet, MAVLINK_MSG_ID_V2_EXTENSION_MIN_LEN, MAVLINK_MSG_ID_V2_EXTENSION_LEN, MAVLINK_MSG_ID_V2_EXTENSION_CRC); #endif } @@ -200,7 +257,7 @@ static inline void mavlink_msg_v2_extension_send_struct(mavlink_channel_t chan, #if MAVLINK_MSG_ID_V2_EXTENSION_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -222,7 +279,7 @@ static inline void mavlink_msg_v2_extension_send_buf(mavlink_message_t *msgbuf, packet->target_network = target_network; packet->target_system = target_system; packet->target_component = target_component; - mav_array_memcpy(packet->payload, payload, sizeof(uint8_t)*249); + mav_array_assign_uint8_t(packet->payload, payload, 249); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_V2_EXTENSION, (const char *)packet, MAVLINK_MSG_ID_V2_EXTENSION_MIN_LEN, MAVLINK_MSG_ID_V2_EXTENSION_LEN, MAVLINK_MSG_ID_V2_EXTENSION_CRC); #endif } diff --git a/common/mavlink_msg_vfr_hud.h b/common/mavlink_msg_vfr_hud.h index f1706ea65..5597261f0 100644 --- a/common/mavlink_msg_vfr_hud.h +++ b/common/mavlink_msg_vfr_hud.h @@ -93,6 +93,54 @@ static inline uint16_t mavlink_msg_vfr_hud_pack(uint8_t system_id, uint8_t compo return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_VFR_HUD_MIN_LEN, MAVLINK_MSG_ID_VFR_HUD_LEN, MAVLINK_MSG_ID_VFR_HUD_CRC); } +/** + * @brief Pack a vfr_hud message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param airspeed [m/s] Vehicle speed in form appropriate for vehicle type. For standard aircraft this is typically calibrated airspeed (CAS) or indicated airspeed (IAS) - either of which can be used by a pilot to estimate stall speed. + * @param groundspeed [m/s] Current ground speed. + * @param heading [deg] Current heading in compass units (0-360, 0=north). + * @param throttle [%] Current throttle setting (0 to 100). + * @param alt [m] Current altitude (MSL). + * @param climb [m/s] Current climb rate. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_vfr_hud_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + float airspeed, float groundspeed, int16_t heading, uint16_t throttle, float alt, float climb) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_VFR_HUD_LEN]; + _mav_put_float(buf, 0, airspeed); + _mav_put_float(buf, 4, groundspeed); + _mav_put_float(buf, 8, alt); + _mav_put_float(buf, 12, climb); + _mav_put_int16_t(buf, 16, heading); + _mav_put_uint16_t(buf, 18, throttle); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VFR_HUD_LEN); +#else + mavlink_vfr_hud_t packet; + packet.airspeed = airspeed; + packet.groundspeed = groundspeed; + packet.alt = alt; + packet.climb = climb; + packet.heading = heading; + packet.throttle = throttle; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VFR_HUD_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_VFR_HUD; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VFR_HUD_MIN_LEN, MAVLINK_MSG_ID_VFR_HUD_LEN, MAVLINK_MSG_ID_VFR_HUD_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VFR_HUD_MIN_LEN, MAVLINK_MSG_ID_VFR_HUD_LEN); +#endif +} + /** * @brief Pack a vfr_hud message on a channel * @param system_id ID of this system @@ -164,6 +212,20 @@ static inline uint16_t mavlink_msg_vfr_hud_encode_chan(uint8_t system_id, uint8_ return mavlink_msg_vfr_hud_pack_chan(system_id, component_id, chan, msg, vfr_hud->airspeed, vfr_hud->groundspeed, vfr_hud->heading, vfr_hud->throttle, vfr_hud->alt, vfr_hud->climb); } +/** + * @brief Encode a vfr_hud struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param vfr_hud C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_vfr_hud_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_vfr_hud_t* vfr_hud) +{ + return mavlink_msg_vfr_hud_pack_status(system_id, component_id, _status, msg, vfr_hud->airspeed, vfr_hud->groundspeed, vfr_hud->heading, vfr_hud->throttle, vfr_hud->alt, vfr_hud->climb); +} + /** * @brief Send a vfr_hud message * @param chan MAVLink channel to send the message @@ -218,7 +280,7 @@ static inline void mavlink_msg_vfr_hud_send_struct(mavlink_channel_t chan, const #if MAVLINK_MSG_ID_VFR_HUD_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_vibration.h b/common/mavlink_msg_vibration.h index acc99c4f6..b7a29f1fa 100644 --- a/common/mavlink_msg_vibration.h +++ b/common/mavlink_msg_vibration.h @@ -99,6 +99,57 @@ static inline uint16_t mavlink_msg_vibration_pack(uint8_t system_id, uint8_t com return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_VIBRATION_MIN_LEN, MAVLINK_MSG_ID_VIBRATION_LEN, MAVLINK_MSG_ID_VIBRATION_CRC); } +/** + * @brief Pack a vibration message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param vibration_x Vibration levels on X-axis + * @param vibration_y Vibration levels on Y-axis + * @param vibration_z Vibration levels on Z-axis + * @param clipping_0 first accelerometer clipping count + * @param clipping_1 second accelerometer clipping count + * @param clipping_2 third accelerometer clipping count + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_vibration_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, float vibration_x, float vibration_y, float vibration_z, uint32_t clipping_0, uint32_t clipping_1, uint32_t clipping_2) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_VIBRATION_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, vibration_x); + _mav_put_float(buf, 12, vibration_y); + _mav_put_float(buf, 16, vibration_z); + _mav_put_uint32_t(buf, 20, clipping_0); + _mav_put_uint32_t(buf, 24, clipping_1); + _mav_put_uint32_t(buf, 28, clipping_2); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VIBRATION_LEN); +#else + mavlink_vibration_t packet; + packet.time_usec = time_usec; + packet.vibration_x = vibration_x; + packet.vibration_y = vibration_y; + packet.vibration_z = vibration_z; + packet.clipping_0 = clipping_0; + packet.clipping_1 = clipping_1; + packet.clipping_2 = clipping_2; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VIBRATION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_VIBRATION; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VIBRATION_MIN_LEN, MAVLINK_MSG_ID_VIBRATION_LEN, MAVLINK_MSG_ID_VIBRATION_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VIBRATION_MIN_LEN, MAVLINK_MSG_ID_VIBRATION_LEN); +#endif +} + /** * @brief Pack a vibration message on a channel * @param system_id ID of this system @@ -173,6 +224,20 @@ static inline uint16_t mavlink_msg_vibration_encode_chan(uint8_t system_id, uint return mavlink_msg_vibration_pack_chan(system_id, component_id, chan, msg, vibration->time_usec, vibration->vibration_x, vibration->vibration_y, vibration->vibration_z, vibration->clipping_0, vibration->clipping_1, vibration->clipping_2); } +/** + * @brief Encode a vibration struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param vibration C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_vibration_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_vibration_t* vibration) +{ + return mavlink_msg_vibration_pack_status(system_id, component_id, _status, msg, vibration->time_usec, vibration->vibration_x, vibration->vibration_y, vibration->vibration_z, vibration->clipping_0, vibration->clipping_1, vibration->clipping_2); +} + /** * @brief Send a vibration message * @param chan MAVLink channel to send the message @@ -230,7 +295,7 @@ static inline void mavlink_msg_vibration_send_struct(mavlink_channel_t chan, con #if MAVLINK_MSG_ID_VIBRATION_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_vicon_position_estimate.h b/common/mavlink_msg_vicon_position_estimate.h index 753f52603..8a5980460 100644 --- a/common/mavlink_msg_vicon_position_estimate.h +++ b/common/mavlink_msg_vicon_position_estimate.h @@ -95,7 +95,7 @@ static inline uint16_t mavlink_msg_vicon_position_estimate_pack(uint8_t system_i packet.roll = roll; packet.pitch = pitch; packet.yaw = yaw; - mav_array_memcpy(packet.covariance, covariance, sizeof(float)*21); + mav_array_assign_float(packet.covariance, covariance, 21); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE_LEN); #endif @@ -103,6 +103,58 @@ static inline uint16_t mavlink_msg_vicon_position_estimate_pack(uint8_t system_i return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE_MIN_LEN, MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE_LEN, MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE_CRC); } +/** + * @brief Pack a vicon_position_estimate message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param usec [us] Timestamp (UNIX time or time since system boot) + * @param x [m] Global X position + * @param y [m] Global Y position + * @param z [m] Global Z position + * @param roll [rad] Roll angle + * @param pitch [rad] Pitch angle + * @param yaw [rad] Yaw angle + * @param covariance Row-major representation of 6x6 pose cross-covariance matrix upper right triangle (states: x, y, z, roll, pitch, yaw; first six entries are the first ROW, next five entries are the second ROW, etc.). If unknown, assign NaN value to first element in the array. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_vicon_position_estimate_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t usec, float x, float y, float z, float roll, float pitch, float yaw, const float *covariance) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE_LEN]; + _mav_put_uint64_t(buf, 0, usec); + _mav_put_float(buf, 8, x); + _mav_put_float(buf, 12, y); + _mav_put_float(buf, 16, z); + _mav_put_float(buf, 20, roll); + _mav_put_float(buf, 24, pitch); + _mav_put_float(buf, 28, yaw); + _mav_put_float_array(buf, 32, covariance, 21); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE_LEN); +#else + mavlink_vicon_position_estimate_t packet; + packet.usec = usec; + packet.x = x; + packet.y = y; + packet.z = z; + packet.roll = roll; + packet.pitch = pitch; + packet.yaw = yaw; + mav_array_memcpy(packet.covariance, covariance, sizeof(float)*21); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE_MIN_LEN, MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE_LEN, MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE_MIN_LEN, MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE_LEN); +#endif +} + /** * @brief Pack a vicon_position_estimate message on a channel * @param system_id ID of this system @@ -143,7 +195,7 @@ static inline uint16_t mavlink_msg_vicon_position_estimate_pack_chan(uint8_t sys packet.roll = roll; packet.pitch = pitch; packet.yaw = yaw; - mav_array_memcpy(packet.covariance, covariance, sizeof(float)*21); + mav_array_assign_float(packet.covariance, covariance, 21); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE_LEN); #endif @@ -178,6 +230,20 @@ static inline uint16_t mavlink_msg_vicon_position_estimate_encode_chan(uint8_t s return mavlink_msg_vicon_position_estimate_pack_chan(system_id, component_id, chan, msg, vicon_position_estimate->usec, vicon_position_estimate->x, vicon_position_estimate->y, vicon_position_estimate->z, vicon_position_estimate->roll, vicon_position_estimate->pitch, vicon_position_estimate->yaw, vicon_position_estimate->covariance); } +/** + * @brief Encode a vicon_position_estimate struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param vicon_position_estimate C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_vicon_position_estimate_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_vicon_position_estimate_t* vicon_position_estimate) +{ + return mavlink_msg_vicon_position_estimate_pack_status(system_id, component_id, _status, msg, vicon_position_estimate->usec, vicon_position_estimate->x, vicon_position_estimate->y, vicon_position_estimate->z, vicon_position_estimate->roll, vicon_position_estimate->pitch, vicon_position_estimate->yaw, vicon_position_estimate->covariance); +} + /** * @brief Send a vicon_position_estimate message * @param chan MAVLink channel to send the message @@ -215,7 +281,7 @@ static inline void mavlink_msg_vicon_position_estimate_send(mavlink_channel_t ch packet.roll = roll; packet.pitch = pitch; packet.yaw = yaw; - mav_array_memcpy(packet.covariance, covariance, sizeof(float)*21); + mav_array_assign_float(packet.covariance, covariance, 21); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE, (const char *)&packet, MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE_MIN_LEN, MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE_LEN, MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE_CRC); #endif } @@ -236,7 +302,7 @@ static inline void mavlink_msg_vicon_position_estimate_send_struct(mavlink_chann #if MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -264,7 +330,7 @@ static inline void mavlink_msg_vicon_position_estimate_send_buf(mavlink_message_ packet->roll = roll; packet->pitch = pitch; packet->yaw = yaw; - mav_array_memcpy(packet->covariance, covariance, sizeof(float)*21); + mav_array_assign_float(packet->covariance, covariance, 21); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE, (const char *)packet, MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE_MIN_LEN, MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE_LEN, MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE_CRC); #endif } diff --git a/common/mavlink_msg_video_stream_information.h b/common/mavlink_msg_video_stream_information.h index aa6d84b74..5118b1e33 100644 --- a/common/mavlink_msg_video_stream_information.h +++ b/common/mavlink_msg_video_stream_information.h @@ -17,11 +17,13 @@ typedef struct __mavlink_video_stream_information_t { uint8_t type; /*< Type of stream.*/ char name[32]; /*< Stream name.*/ char uri[160]; /*< Video stream URI (TCP or RTSP URI ground station should connect to) or port number (UDP port ground station should listen to).*/ + uint8_t encoding; /*< Encoding of stream.*/ + uint8_t camera_device_id; /*< Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id).*/ } mavlink_video_stream_information_t; -#define MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN 213 +#define MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN 215 #define MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_MIN_LEN 213 -#define MAVLINK_MSG_ID_269_LEN 213 +#define MAVLINK_MSG_ID_269_LEN 215 #define MAVLINK_MSG_ID_269_MIN_LEN 213 #define MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_CRC 109 @@ -34,7 +36,7 @@ typedef struct __mavlink_video_stream_information_t { #define MAVLINK_MESSAGE_INFO_VIDEO_STREAM_INFORMATION { \ 269, \ "VIDEO_STREAM_INFORMATION", \ - 12, \ + 14, \ { { "stream_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 18, offsetof(mavlink_video_stream_information_t, stream_id) }, \ { "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 19, offsetof(mavlink_video_stream_information_t, count) }, \ { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 20, offsetof(mavlink_video_stream_information_t, type) }, \ @@ -47,12 +49,14 @@ typedef struct __mavlink_video_stream_information_t { { "hfov", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_video_stream_information_t, hfov) }, \ { "name", NULL, MAVLINK_TYPE_CHAR, 32, 21, offsetof(mavlink_video_stream_information_t, name) }, \ { "uri", NULL, MAVLINK_TYPE_CHAR, 160, 53, offsetof(mavlink_video_stream_information_t, uri) }, \ + { "encoding", NULL, MAVLINK_TYPE_UINT8_T, 0, 213, offsetof(mavlink_video_stream_information_t, encoding) }, \ + { "camera_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 214, offsetof(mavlink_video_stream_information_t, camera_device_id) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_VIDEO_STREAM_INFORMATION { \ "VIDEO_STREAM_INFORMATION", \ - 12, \ + 14, \ { { "stream_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 18, offsetof(mavlink_video_stream_information_t, stream_id) }, \ { "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 19, offsetof(mavlink_video_stream_information_t, count) }, \ { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 20, offsetof(mavlink_video_stream_information_t, type) }, \ @@ -65,6 +69,8 @@ typedef struct __mavlink_video_stream_information_t { { "hfov", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_video_stream_information_t, hfov) }, \ { "name", NULL, MAVLINK_TYPE_CHAR, 32, 21, offsetof(mavlink_video_stream_information_t, name) }, \ { "uri", NULL, MAVLINK_TYPE_CHAR, 160, 53, offsetof(mavlink_video_stream_information_t, uri) }, \ + { "encoding", NULL, MAVLINK_TYPE_UINT8_T, 0, 213, offsetof(mavlink_video_stream_information_t, encoding) }, \ + { "camera_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 214, offsetof(mavlink_video_stream_information_t, camera_device_id) }, \ } \ } #endif @@ -87,10 +93,12 @@ typedef struct __mavlink_video_stream_information_t { * @param hfov [deg] Horizontal Field of view. * @param name Stream name. * @param uri Video stream URI (TCP or RTSP URI ground station should connect to) or port number (UDP port ground station should listen to). + * @param encoding Encoding of stream. + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_video_stream_information_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t stream_id, uint8_t count, uint8_t type, uint16_t flags, float framerate, uint16_t resolution_h, uint16_t resolution_v, uint32_t bitrate, uint16_t rotation, uint16_t hfov, const char *name, const char *uri) + uint8_t stream_id, uint8_t count, uint8_t type, uint16_t flags, float framerate, uint16_t resolution_h, uint16_t resolution_v, uint32_t bitrate, uint16_t rotation, uint16_t hfov, const char *name, const char *uri, uint8_t encoding, uint8_t camera_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN]; @@ -104,6 +112,8 @@ static inline uint16_t mavlink_msg_video_stream_information_pack(uint8_t system_ _mav_put_uint8_t(buf, 18, stream_id); _mav_put_uint8_t(buf, 19, count); _mav_put_uint8_t(buf, 20, type); + _mav_put_uint8_t(buf, 213, encoding); + _mav_put_uint8_t(buf, 214, camera_device_id); _mav_put_char_array(buf, 21, name, 32); _mav_put_char_array(buf, 53, uri, 160); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN); @@ -119,13 +129,85 @@ static inline uint16_t mavlink_msg_video_stream_information_pack(uint8_t system_ packet.stream_id = stream_id; packet.count = count; packet.type = type; + packet.encoding = encoding; + packet.camera_device_id = camera_device_id; + mav_array_assign_char(packet.name, name, 32); + mav_array_assign_char(packet.uri, uri, 160); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_CRC); +} + +/** + * @brief Pack a video_stream_information message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param stream_id Video Stream ID (1 for first, 2 for second, etc.) + * @param count Number of streams available. + * @param type Type of stream. + * @param flags Bitmap of stream status flags. + * @param framerate [Hz] Frame rate. + * @param resolution_h [pix] Horizontal resolution. + * @param resolution_v [pix] Vertical resolution. + * @param bitrate [bits/s] Bit rate. + * @param rotation [deg] Video image rotation clockwise. + * @param hfov [deg] Horizontal Field of view. + * @param name Stream name. + * @param uri Video stream URI (TCP or RTSP URI ground station should connect to) or port number (UDP port ground station should listen to). + * @param encoding Encoding of stream. + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_video_stream_information_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t stream_id, uint8_t count, uint8_t type, uint16_t flags, float framerate, uint16_t resolution_h, uint16_t resolution_v, uint32_t bitrate, uint16_t rotation, uint16_t hfov, const char *name, const char *uri, uint8_t encoding, uint8_t camera_device_id) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN]; + _mav_put_float(buf, 0, framerate); + _mav_put_uint32_t(buf, 4, bitrate); + _mav_put_uint16_t(buf, 8, flags); + _mav_put_uint16_t(buf, 10, resolution_h); + _mav_put_uint16_t(buf, 12, resolution_v); + _mav_put_uint16_t(buf, 14, rotation); + _mav_put_uint16_t(buf, 16, hfov); + _mav_put_uint8_t(buf, 18, stream_id); + _mav_put_uint8_t(buf, 19, count); + _mav_put_uint8_t(buf, 20, type); + _mav_put_uint8_t(buf, 213, encoding); + _mav_put_uint8_t(buf, 214, camera_device_id); + _mav_put_char_array(buf, 21, name, 32); + _mav_put_char_array(buf, 53, uri, 160); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN); +#else + mavlink_video_stream_information_t packet; + packet.framerate = framerate; + packet.bitrate = bitrate; + packet.flags = flags; + packet.resolution_h = resolution_h; + packet.resolution_v = resolution_v; + packet.rotation = rotation; + packet.hfov = hfov; + packet.stream_id = stream_id; + packet.count = count; + packet.type = type; + packet.encoding = encoding; + packet.camera_device_id = camera_device_id; mav_array_memcpy(packet.name, name, sizeof(char)*32); mav_array_memcpy(packet.uri, uri, sizeof(char)*160); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN); #endif msg->msgid = MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_CRC); +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN); +#endif } /** @@ -146,11 +228,13 @@ static inline uint16_t mavlink_msg_video_stream_information_pack(uint8_t system_ * @param hfov [deg] Horizontal Field of view. * @param name Stream name. * @param uri Video stream URI (TCP or RTSP URI ground station should connect to) or port number (UDP port ground station should listen to). + * @param encoding Encoding of stream. + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_video_stream_information_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - uint8_t stream_id,uint8_t count,uint8_t type,uint16_t flags,float framerate,uint16_t resolution_h,uint16_t resolution_v,uint32_t bitrate,uint16_t rotation,uint16_t hfov,const char *name,const char *uri) + uint8_t stream_id,uint8_t count,uint8_t type,uint16_t flags,float framerate,uint16_t resolution_h,uint16_t resolution_v,uint32_t bitrate,uint16_t rotation,uint16_t hfov,const char *name,const char *uri,uint8_t encoding,uint8_t camera_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN]; @@ -164,6 +248,8 @@ static inline uint16_t mavlink_msg_video_stream_information_pack_chan(uint8_t sy _mav_put_uint8_t(buf, 18, stream_id); _mav_put_uint8_t(buf, 19, count); _mav_put_uint8_t(buf, 20, type); + _mav_put_uint8_t(buf, 213, encoding); + _mav_put_uint8_t(buf, 214, camera_device_id); _mav_put_char_array(buf, 21, name, 32); _mav_put_char_array(buf, 53, uri, 160); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN); @@ -179,8 +265,10 @@ static inline uint16_t mavlink_msg_video_stream_information_pack_chan(uint8_t sy packet.stream_id = stream_id; packet.count = count; packet.type = type; - mav_array_memcpy(packet.name, name, sizeof(char)*32); - mav_array_memcpy(packet.uri, uri, sizeof(char)*160); + packet.encoding = encoding; + packet.camera_device_id = camera_device_id; + mav_array_assign_char(packet.name, name, 32); + mav_array_assign_char(packet.uri, uri, 160); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN); #endif @@ -198,7 +286,7 @@ static inline uint16_t mavlink_msg_video_stream_information_pack_chan(uint8_t sy */ static inline uint16_t mavlink_msg_video_stream_information_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_video_stream_information_t* video_stream_information) { - return mavlink_msg_video_stream_information_pack(system_id, component_id, msg, video_stream_information->stream_id, video_stream_information->count, video_stream_information->type, video_stream_information->flags, video_stream_information->framerate, video_stream_information->resolution_h, video_stream_information->resolution_v, video_stream_information->bitrate, video_stream_information->rotation, video_stream_information->hfov, video_stream_information->name, video_stream_information->uri); + return mavlink_msg_video_stream_information_pack(system_id, component_id, msg, video_stream_information->stream_id, video_stream_information->count, video_stream_information->type, video_stream_information->flags, video_stream_information->framerate, video_stream_information->resolution_h, video_stream_information->resolution_v, video_stream_information->bitrate, video_stream_information->rotation, video_stream_information->hfov, video_stream_information->name, video_stream_information->uri, video_stream_information->encoding, video_stream_information->camera_device_id); } /** @@ -212,7 +300,21 @@ static inline uint16_t mavlink_msg_video_stream_information_encode(uint8_t syste */ static inline uint16_t mavlink_msg_video_stream_information_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_video_stream_information_t* video_stream_information) { - return mavlink_msg_video_stream_information_pack_chan(system_id, component_id, chan, msg, video_stream_information->stream_id, video_stream_information->count, video_stream_information->type, video_stream_information->flags, video_stream_information->framerate, video_stream_information->resolution_h, video_stream_information->resolution_v, video_stream_information->bitrate, video_stream_information->rotation, video_stream_information->hfov, video_stream_information->name, video_stream_information->uri); + return mavlink_msg_video_stream_information_pack_chan(system_id, component_id, chan, msg, video_stream_information->stream_id, video_stream_information->count, video_stream_information->type, video_stream_information->flags, video_stream_information->framerate, video_stream_information->resolution_h, video_stream_information->resolution_v, video_stream_information->bitrate, video_stream_information->rotation, video_stream_information->hfov, video_stream_information->name, video_stream_information->uri, video_stream_information->encoding, video_stream_information->camera_device_id); +} + +/** + * @brief Encode a video_stream_information struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param video_stream_information C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_video_stream_information_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_video_stream_information_t* video_stream_information) +{ + return mavlink_msg_video_stream_information_pack_status(system_id, component_id, _status, msg, video_stream_information->stream_id, video_stream_information->count, video_stream_information->type, video_stream_information->flags, video_stream_information->framerate, video_stream_information->resolution_h, video_stream_information->resolution_v, video_stream_information->bitrate, video_stream_information->rotation, video_stream_information->hfov, video_stream_information->name, video_stream_information->uri, video_stream_information->encoding, video_stream_information->camera_device_id); } /** @@ -231,10 +333,12 @@ static inline uint16_t mavlink_msg_video_stream_information_encode_chan(uint8_t * @param hfov [deg] Horizontal Field of view. * @param name Stream name. * @param uri Video stream URI (TCP or RTSP URI ground station should connect to) or port number (UDP port ground station should listen to). + * @param encoding Encoding of stream. + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_video_stream_information_send(mavlink_channel_t chan, uint8_t stream_id, uint8_t count, uint8_t type, uint16_t flags, float framerate, uint16_t resolution_h, uint16_t resolution_v, uint32_t bitrate, uint16_t rotation, uint16_t hfov, const char *name, const char *uri) +static inline void mavlink_msg_video_stream_information_send(mavlink_channel_t chan, uint8_t stream_id, uint8_t count, uint8_t type, uint16_t flags, float framerate, uint16_t resolution_h, uint16_t resolution_v, uint32_t bitrate, uint16_t rotation, uint16_t hfov, const char *name, const char *uri, uint8_t encoding, uint8_t camera_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN]; @@ -248,6 +352,8 @@ static inline void mavlink_msg_video_stream_information_send(mavlink_channel_t c _mav_put_uint8_t(buf, 18, stream_id); _mav_put_uint8_t(buf, 19, count); _mav_put_uint8_t(buf, 20, type); + _mav_put_uint8_t(buf, 213, encoding); + _mav_put_uint8_t(buf, 214, camera_device_id); _mav_put_char_array(buf, 21, name, 32); _mav_put_char_array(buf, 53, uri, 160); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION, buf, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_CRC); @@ -263,8 +369,10 @@ static inline void mavlink_msg_video_stream_information_send(mavlink_channel_t c packet.stream_id = stream_id; packet.count = count; packet.type = type; - mav_array_memcpy(packet.name, name, sizeof(char)*32); - mav_array_memcpy(packet.uri, uri, sizeof(char)*160); + packet.encoding = encoding; + packet.camera_device_id = camera_device_id; + mav_array_assign_char(packet.name, name, 32); + mav_array_assign_char(packet.uri, uri, 160); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION, (const char *)&packet, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_CRC); #endif } @@ -277,7 +385,7 @@ static inline void mavlink_msg_video_stream_information_send(mavlink_channel_t c static inline void mavlink_msg_video_stream_information_send_struct(mavlink_channel_t chan, const mavlink_video_stream_information_t* video_stream_information) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_video_stream_information_send(chan, video_stream_information->stream_id, video_stream_information->count, video_stream_information->type, video_stream_information->flags, video_stream_information->framerate, video_stream_information->resolution_h, video_stream_information->resolution_v, video_stream_information->bitrate, video_stream_information->rotation, video_stream_information->hfov, video_stream_information->name, video_stream_information->uri); + mavlink_msg_video_stream_information_send(chan, video_stream_information->stream_id, video_stream_information->count, video_stream_information->type, video_stream_information->flags, video_stream_information->framerate, video_stream_information->resolution_h, video_stream_information->resolution_v, video_stream_information->bitrate, video_stream_information->rotation, video_stream_information->hfov, video_stream_information->name, video_stream_information->uri, video_stream_information->encoding, video_stream_information->camera_device_id); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION, (const char *)video_stream_information, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_CRC); #endif @@ -285,13 +393,13 @@ static inline void mavlink_msg_video_stream_information_send_struct(mavlink_chan #if MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_video_stream_information_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t stream_id, uint8_t count, uint8_t type, uint16_t flags, float framerate, uint16_t resolution_h, uint16_t resolution_v, uint32_t bitrate, uint16_t rotation, uint16_t hfov, const char *name, const char *uri) +static inline void mavlink_msg_video_stream_information_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t stream_id, uint8_t count, uint8_t type, uint16_t flags, float framerate, uint16_t resolution_h, uint16_t resolution_v, uint32_t bitrate, uint16_t rotation, uint16_t hfov, const char *name, const char *uri, uint8_t encoding, uint8_t camera_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; @@ -305,6 +413,8 @@ static inline void mavlink_msg_video_stream_information_send_buf(mavlink_message _mav_put_uint8_t(buf, 18, stream_id); _mav_put_uint8_t(buf, 19, count); _mav_put_uint8_t(buf, 20, type); + _mav_put_uint8_t(buf, 213, encoding); + _mav_put_uint8_t(buf, 214, camera_device_id); _mav_put_char_array(buf, 21, name, 32); _mav_put_char_array(buf, 53, uri, 160); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION, buf, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_CRC); @@ -320,8 +430,10 @@ static inline void mavlink_msg_video_stream_information_send_buf(mavlink_message packet->stream_id = stream_id; packet->count = count; packet->type = type; - mav_array_memcpy(packet->name, name, sizeof(char)*32); - mav_array_memcpy(packet->uri, uri, sizeof(char)*160); + packet->encoding = encoding; + packet->camera_device_id = camera_device_id; + mav_array_assign_char(packet->name, name, 32); + mav_array_assign_char(packet->uri, uri, 160); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION, (const char *)packet, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_CRC); #endif } @@ -452,6 +564,26 @@ static inline uint16_t mavlink_msg_video_stream_information_get_uri(const mavlin return _MAV_RETURN_char_array(msg, uri, 160, 53); } +/** + * @brief Get field encoding from video_stream_information message + * + * @return Encoding of stream. + */ +static inline uint8_t mavlink_msg_video_stream_information_get_encoding(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 213); +} + +/** + * @brief Get field camera_device_id from video_stream_information message + * + * @return Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). + */ +static inline uint8_t mavlink_msg_video_stream_information_get_camera_device_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 214); +} + /** * @brief Decode a video_stream_information message into a struct * @@ -473,6 +605,8 @@ static inline void mavlink_msg_video_stream_information_decode(const mavlink_mes video_stream_information->type = mavlink_msg_video_stream_information_get_type(msg); mavlink_msg_video_stream_information_get_name(msg, video_stream_information->name); mavlink_msg_video_stream_information_get_uri(msg, video_stream_information->uri); + video_stream_information->encoding = mavlink_msg_video_stream_information_get_encoding(msg); + video_stream_information->camera_device_id = mavlink_msg_video_stream_information_get_camera_device_id(msg); #else uint8_t len = msg->len < MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN? msg->len : MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN; memset(video_stream_information, 0, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN); diff --git a/common/mavlink_msg_video_stream_status.h b/common/mavlink_msg_video_stream_status.h index 380941005..f73b16989 100644 --- a/common/mavlink_msg_video_stream_status.h +++ b/common/mavlink_msg_video_stream_status.h @@ -13,11 +13,12 @@ typedef struct __mavlink_video_stream_status_t { uint16_t rotation; /*< [deg] Video image rotation clockwise*/ uint16_t hfov; /*< [deg] Horizontal Field of view*/ uint8_t stream_id; /*< Video Stream ID (1 for first, 2 for second, etc.)*/ + uint8_t camera_device_id; /*< Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id).*/ } mavlink_video_stream_status_t; -#define MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN 19 +#define MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN 20 #define MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_MIN_LEN 19 -#define MAVLINK_MSG_ID_270_LEN 19 +#define MAVLINK_MSG_ID_270_LEN 20 #define MAVLINK_MSG_ID_270_MIN_LEN 19 #define MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_CRC 59 @@ -29,7 +30,7 @@ typedef struct __mavlink_video_stream_status_t { #define MAVLINK_MESSAGE_INFO_VIDEO_STREAM_STATUS { \ 270, \ "VIDEO_STREAM_STATUS", \ - 8, \ + 9, \ { { "stream_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 18, offsetof(mavlink_video_stream_status_t, stream_id) }, \ { "flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_video_stream_status_t, flags) }, \ { "framerate", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_video_stream_status_t, framerate) }, \ @@ -38,12 +39,13 @@ typedef struct __mavlink_video_stream_status_t { { "bitrate", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_video_stream_status_t, bitrate) }, \ { "rotation", NULL, MAVLINK_TYPE_UINT16_T, 0, 14, offsetof(mavlink_video_stream_status_t, rotation) }, \ { "hfov", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_video_stream_status_t, hfov) }, \ + { "camera_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 19, offsetof(mavlink_video_stream_status_t, camera_device_id) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_VIDEO_STREAM_STATUS { \ "VIDEO_STREAM_STATUS", \ - 8, \ + 9, \ { { "stream_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 18, offsetof(mavlink_video_stream_status_t, stream_id) }, \ { "flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_video_stream_status_t, flags) }, \ { "framerate", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_video_stream_status_t, framerate) }, \ @@ -52,6 +54,7 @@ typedef struct __mavlink_video_stream_status_t { { "bitrate", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_video_stream_status_t, bitrate) }, \ { "rotation", NULL, MAVLINK_TYPE_UINT16_T, 0, 14, offsetof(mavlink_video_stream_status_t, rotation) }, \ { "hfov", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_video_stream_status_t, hfov) }, \ + { "camera_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 19, offsetof(mavlink_video_stream_status_t, camera_device_id) }, \ } \ } #endif @@ -70,10 +73,11 @@ typedef struct __mavlink_video_stream_status_t { * @param bitrate [bits/s] Bit rate * @param rotation [deg] Video image rotation clockwise * @param hfov [deg] Horizontal Field of view + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_video_stream_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t stream_id, uint16_t flags, float framerate, uint16_t resolution_h, uint16_t resolution_v, uint32_t bitrate, uint16_t rotation, uint16_t hfov) + uint8_t stream_id, uint16_t flags, float framerate, uint16_t resolution_h, uint16_t resolution_v, uint32_t bitrate, uint16_t rotation, uint16_t hfov, uint8_t camera_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN]; @@ -85,6 +89,7 @@ static inline uint16_t mavlink_msg_video_stream_status_pack(uint8_t system_id, u _mav_put_uint16_t(buf, 14, rotation); _mav_put_uint16_t(buf, 16, hfov); _mav_put_uint8_t(buf, 18, stream_id); + _mav_put_uint8_t(buf, 19, camera_device_id); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN); #else @@ -97,6 +102,7 @@ static inline uint16_t mavlink_msg_video_stream_status_pack(uint8_t system_id, u packet.rotation = rotation; packet.hfov = hfov; packet.stream_id = stream_id; + packet.camera_device_id = camera_device_id; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN); #endif @@ -105,6 +111,63 @@ static inline uint16_t mavlink_msg_video_stream_status_pack(uint8_t system_id, u return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_CRC); } +/** + * @brief Pack a video_stream_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param stream_id Video Stream ID (1 for first, 2 for second, etc.) + * @param flags Bitmap of stream status flags + * @param framerate [Hz] Frame rate + * @param resolution_h [pix] Horizontal resolution + * @param resolution_v [pix] Vertical resolution + * @param bitrate [bits/s] Bit rate + * @param rotation [deg] Video image rotation clockwise + * @param hfov [deg] Horizontal Field of view + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_video_stream_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t stream_id, uint16_t flags, float framerate, uint16_t resolution_h, uint16_t resolution_v, uint32_t bitrate, uint16_t rotation, uint16_t hfov, uint8_t camera_device_id) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN]; + _mav_put_float(buf, 0, framerate); + _mav_put_uint32_t(buf, 4, bitrate); + _mav_put_uint16_t(buf, 8, flags); + _mav_put_uint16_t(buf, 10, resolution_h); + _mav_put_uint16_t(buf, 12, resolution_v); + _mav_put_uint16_t(buf, 14, rotation); + _mav_put_uint16_t(buf, 16, hfov); + _mav_put_uint8_t(buf, 18, stream_id); + _mav_put_uint8_t(buf, 19, camera_device_id); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN); +#else + mavlink_video_stream_status_t packet; + packet.framerate = framerate; + packet.bitrate = bitrate; + packet.flags = flags; + packet.resolution_h = resolution_h; + packet.resolution_v = resolution_v; + packet.rotation = rotation; + packet.hfov = hfov; + packet.stream_id = stream_id; + packet.camera_device_id = camera_device_id; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_VIDEO_STREAM_STATUS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN); +#endif +} + /** * @brief Pack a video_stream_status message on a channel * @param system_id ID of this system @@ -119,11 +182,12 @@ static inline uint16_t mavlink_msg_video_stream_status_pack(uint8_t system_id, u * @param bitrate [bits/s] Bit rate * @param rotation [deg] Video image rotation clockwise * @param hfov [deg] Horizontal Field of view + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_video_stream_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - uint8_t stream_id,uint16_t flags,float framerate,uint16_t resolution_h,uint16_t resolution_v,uint32_t bitrate,uint16_t rotation,uint16_t hfov) + uint8_t stream_id,uint16_t flags,float framerate,uint16_t resolution_h,uint16_t resolution_v,uint32_t bitrate,uint16_t rotation,uint16_t hfov,uint8_t camera_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN]; @@ -135,6 +199,7 @@ static inline uint16_t mavlink_msg_video_stream_status_pack_chan(uint8_t system_ _mav_put_uint16_t(buf, 14, rotation); _mav_put_uint16_t(buf, 16, hfov); _mav_put_uint8_t(buf, 18, stream_id); + _mav_put_uint8_t(buf, 19, camera_device_id); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN); #else @@ -147,6 +212,7 @@ static inline uint16_t mavlink_msg_video_stream_status_pack_chan(uint8_t system_ packet.rotation = rotation; packet.hfov = hfov; packet.stream_id = stream_id; + packet.camera_device_id = camera_device_id; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN); #endif @@ -165,7 +231,7 @@ static inline uint16_t mavlink_msg_video_stream_status_pack_chan(uint8_t system_ */ static inline uint16_t mavlink_msg_video_stream_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_video_stream_status_t* video_stream_status) { - return mavlink_msg_video_stream_status_pack(system_id, component_id, msg, video_stream_status->stream_id, video_stream_status->flags, video_stream_status->framerate, video_stream_status->resolution_h, video_stream_status->resolution_v, video_stream_status->bitrate, video_stream_status->rotation, video_stream_status->hfov); + return mavlink_msg_video_stream_status_pack(system_id, component_id, msg, video_stream_status->stream_id, video_stream_status->flags, video_stream_status->framerate, video_stream_status->resolution_h, video_stream_status->resolution_v, video_stream_status->bitrate, video_stream_status->rotation, video_stream_status->hfov, video_stream_status->camera_device_id); } /** @@ -179,7 +245,21 @@ static inline uint16_t mavlink_msg_video_stream_status_encode(uint8_t system_id, */ static inline uint16_t mavlink_msg_video_stream_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_video_stream_status_t* video_stream_status) { - return mavlink_msg_video_stream_status_pack_chan(system_id, component_id, chan, msg, video_stream_status->stream_id, video_stream_status->flags, video_stream_status->framerate, video_stream_status->resolution_h, video_stream_status->resolution_v, video_stream_status->bitrate, video_stream_status->rotation, video_stream_status->hfov); + return mavlink_msg_video_stream_status_pack_chan(system_id, component_id, chan, msg, video_stream_status->stream_id, video_stream_status->flags, video_stream_status->framerate, video_stream_status->resolution_h, video_stream_status->resolution_v, video_stream_status->bitrate, video_stream_status->rotation, video_stream_status->hfov, video_stream_status->camera_device_id); +} + +/** + * @brief Encode a video_stream_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param video_stream_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_video_stream_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_video_stream_status_t* video_stream_status) +{ + return mavlink_msg_video_stream_status_pack_status(system_id, component_id, _status, msg, video_stream_status->stream_id, video_stream_status->flags, video_stream_status->framerate, video_stream_status->resolution_h, video_stream_status->resolution_v, video_stream_status->bitrate, video_stream_status->rotation, video_stream_status->hfov, video_stream_status->camera_device_id); } /** @@ -194,10 +274,11 @@ static inline uint16_t mavlink_msg_video_stream_status_encode_chan(uint8_t syste * @param bitrate [bits/s] Bit rate * @param rotation [deg] Video image rotation clockwise * @param hfov [deg] Horizontal Field of view + * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_video_stream_status_send(mavlink_channel_t chan, uint8_t stream_id, uint16_t flags, float framerate, uint16_t resolution_h, uint16_t resolution_v, uint32_t bitrate, uint16_t rotation, uint16_t hfov) +static inline void mavlink_msg_video_stream_status_send(mavlink_channel_t chan, uint8_t stream_id, uint16_t flags, float framerate, uint16_t resolution_h, uint16_t resolution_v, uint32_t bitrate, uint16_t rotation, uint16_t hfov, uint8_t camera_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN]; @@ -209,6 +290,7 @@ static inline void mavlink_msg_video_stream_status_send(mavlink_channel_t chan, _mav_put_uint16_t(buf, 14, rotation); _mav_put_uint16_t(buf, 16, hfov); _mav_put_uint8_t(buf, 18, stream_id); + _mav_put_uint8_t(buf, 19, camera_device_id); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS, buf, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_CRC); #else @@ -221,6 +303,7 @@ static inline void mavlink_msg_video_stream_status_send(mavlink_channel_t chan, packet.rotation = rotation; packet.hfov = hfov; packet.stream_id = stream_id; + packet.camera_device_id = camera_device_id; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS, (const char *)&packet, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_CRC); #endif @@ -234,7 +317,7 @@ static inline void mavlink_msg_video_stream_status_send(mavlink_channel_t chan, static inline void mavlink_msg_video_stream_status_send_struct(mavlink_channel_t chan, const mavlink_video_stream_status_t* video_stream_status) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_video_stream_status_send(chan, video_stream_status->stream_id, video_stream_status->flags, video_stream_status->framerate, video_stream_status->resolution_h, video_stream_status->resolution_v, video_stream_status->bitrate, video_stream_status->rotation, video_stream_status->hfov); + mavlink_msg_video_stream_status_send(chan, video_stream_status->stream_id, video_stream_status->flags, video_stream_status->framerate, video_stream_status->resolution_h, video_stream_status->resolution_v, video_stream_status->bitrate, video_stream_status->rotation, video_stream_status->hfov, video_stream_status->camera_device_id); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS, (const char *)video_stream_status, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_CRC); #endif @@ -242,13 +325,13 @@ static inline void mavlink_msg_video_stream_status_send_struct(mavlink_channel_t #if MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ -static inline void mavlink_msg_video_stream_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t stream_id, uint16_t flags, float framerate, uint16_t resolution_h, uint16_t resolution_v, uint32_t bitrate, uint16_t rotation, uint16_t hfov) +static inline void mavlink_msg_video_stream_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t stream_id, uint16_t flags, float framerate, uint16_t resolution_h, uint16_t resolution_v, uint32_t bitrate, uint16_t rotation, uint16_t hfov, uint8_t camera_device_id) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; @@ -260,6 +343,7 @@ static inline void mavlink_msg_video_stream_status_send_buf(mavlink_message_t *m _mav_put_uint16_t(buf, 14, rotation); _mav_put_uint16_t(buf, 16, hfov); _mav_put_uint8_t(buf, 18, stream_id); + _mav_put_uint8_t(buf, 19, camera_device_id); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS, buf, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_CRC); #else @@ -272,6 +356,7 @@ static inline void mavlink_msg_video_stream_status_send_buf(mavlink_message_t *m packet->rotation = rotation; packet->hfov = hfov; packet->stream_id = stream_id; + packet->camera_device_id = camera_device_id; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS, (const char *)packet, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_CRC); #endif @@ -363,6 +448,16 @@ static inline uint16_t mavlink_msg_video_stream_status_get_hfov(const mavlink_me return _MAV_RETURN_uint16_t(msg, 16); } +/** + * @brief Get field camera_device_id from video_stream_status message + * + * @return Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id). + */ +static inline uint8_t mavlink_msg_video_stream_status_get_camera_device_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 19); +} + /** * @brief Decode a video_stream_status message into a struct * @@ -380,6 +475,7 @@ static inline void mavlink_msg_video_stream_status_decode(const mavlink_message_ video_stream_status->rotation = mavlink_msg_video_stream_status_get_rotation(msg); video_stream_status->hfov = mavlink_msg_video_stream_status_get_hfov(msg); video_stream_status->stream_id = mavlink_msg_video_stream_status_get_stream_id(msg); + video_stream_status->camera_device_id = mavlink_msg_video_stream_status_get_camera_device_id(msg); #else uint8_t len = msg->len < MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN? msg->len : MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN; memset(video_stream_status, 0, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN); diff --git a/common/mavlink_msg_vision_position_estimate.h b/common/mavlink_msg_vision_position_estimate.h index 438b8c5bb..1865a69b8 100644 --- a/common/mavlink_msg_vision_position_estimate.h +++ b/common/mavlink_msg_vision_position_estimate.h @@ -101,7 +101,7 @@ static inline uint16_t mavlink_msg_vision_position_estimate_pack(uint8_t system_ packet.pitch = pitch; packet.yaw = yaw; packet.reset_counter = reset_counter; - mav_array_memcpy(packet.covariance, covariance, sizeof(float)*21); + mav_array_assign_float(packet.covariance, covariance, 21); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN); #endif @@ -109,6 +109,61 @@ static inline uint16_t mavlink_msg_vision_position_estimate_pack(uint8_t system_ return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_MIN_LEN, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_CRC); } +/** + * @brief Pack a vision_position_estimate message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param usec [us] Timestamp (UNIX time or time since system boot) + * @param x [m] Local X position + * @param y [m] Local Y position + * @param z [m] Local Z position + * @param roll [rad] Roll angle + * @param pitch [rad] Pitch angle + * @param yaw [rad] Yaw angle + * @param covariance Row-major representation of pose 6x6 cross-covariance matrix upper right triangle (states: x, y, z, roll, pitch, yaw; first six entries are the first ROW, next five entries are the second ROW, etc.). If unknown, assign NaN value to first element in the array. + * @param reset_counter Estimate reset counter. This should be incremented when the estimate resets in any of the dimensions (position, velocity, attitude, angular speed). This is designed to be used when e.g an external SLAM system detects a loop-closure and the estimate jumps. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_vision_position_estimate_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t usec, float x, float y, float z, float roll, float pitch, float yaw, const float *covariance, uint8_t reset_counter) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN]; + _mav_put_uint64_t(buf, 0, usec); + _mav_put_float(buf, 8, x); + _mav_put_float(buf, 12, y); + _mav_put_float(buf, 16, z); + _mav_put_float(buf, 20, roll); + _mav_put_float(buf, 24, pitch); + _mav_put_float(buf, 28, yaw); + _mav_put_uint8_t(buf, 116, reset_counter); + _mav_put_float_array(buf, 32, covariance, 21); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN); +#else + mavlink_vision_position_estimate_t packet; + packet.usec = usec; + packet.x = x; + packet.y = y; + packet.z = z; + packet.roll = roll; + packet.pitch = pitch; + packet.yaw = yaw; + packet.reset_counter = reset_counter; + mav_array_memcpy(packet.covariance, covariance, sizeof(float)*21); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_MIN_LEN, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_MIN_LEN, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN); +#endif +} + /** * @brief Pack a vision_position_estimate message on a channel * @param system_id ID of this system @@ -152,7 +207,7 @@ static inline uint16_t mavlink_msg_vision_position_estimate_pack_chan(uint8_t sy packet.pitch = pitch; packet.yaw = yaw; packet.reset_counter = reset_counter; - mav_array_memcpy(packet.covariance, covariance, sizeof(float)*21); + mav_array_assign_float(packet.covariance, covariance, 21); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN); #endif @@ -187,6 +242,20 @@ static inline uint16_t mavlink_msg_vision_position_estimate_encode_chan(uint8_t return mavlink_msg_vision_position_estimate_pack_chan(system_id, component_id, chan, msg, vision_position_estimate->usec, vision_position_estimate->x, vision_position_estimate->y, vision_position_estimate->z, vision_position_estimate->roll, vision_position_estimate->pitch, vision_position_estimate->yaw, vision_position_estimate->covariance, vision_position_estimate->reset_counter); } +/** + * @brief Encode a vision_position_estimate struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param vision_position_estimate C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_vision_position_estimate_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_vision_position_estimate_t* vision_position_estimate) +{ + return mavlink_msg_vision_position_estimate_pack_status(system_id, component_id, _status, msg, vision_position_estimate->usec, vision_position_estimate->x, vision_position_estimate->y, vision_position_estimate->z, vision_position_estimate->roll, vision_position_estimate->pitch, vision_position_estimate->yaw, vision_position_estimate->covariance, vision_position_estimate->reset_counter); +} + /** * @brief Send a vision_position_estimate message * @param chan MAVLink channel to send the message @@ -227,7 +296,7 @@ static inline void mavlink_msg_vision_position_estimate_send(mavlink_channel_t c packet.pitch = pitch; packet.yaw = yaw; packet.reset_counter = reset_counter; - mav_array_memcpy(packet.covariance, covariance, sizeof(float)*21); + mav_array_assign_float(packet.covariance, covariance, 21); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE, (const char *)&packet, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_MIN_LEN, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_CRC); #endif } @@ -248,7 +317,7 @@ static inline void mavlink_msg_vision_position_estimate_send_struct(mavlink_chan #if MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -278,7 +347,7 @@ static inline void mavlink_msg_vision_position_estimate_send_buf(mavlink_message packet->pitch = pitch; packet->yaw = yaw; packet->reset_counter = reset_counter; - mav_array_memcpy(packet->covariance, covariance, sizeof(float)*21); + mav_array_assign_float(packet->covariance, covariance, 21); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE, (const char *)packet, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_MIN_LEN, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_CRC); #endif } diff --git a/common/mavlink_msg_vision_speed_estimate.h b/common/mavlink_msg_vision_speed_estimate.h index 7c993e8fd..af3bb0137 100644 --- a/common/mavlink_msg_vision_speed_estimate.h +++ b/common/mavlink_msg_vision_speed_estimate.h @@ -83,7 +83,7 @@ static inline uint16_t mavlink_msg_vision_speed_estimate_pack(uint8_t system_id, packet.y = y; packet.z = z; packet.reset_counter = reset_counter; - mav_array_memcpy(packet.covariance, covariance, sizeof(float)*9); + mav_array_assign_float(packet.covariance, covariance, 9); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_LEN); #endif @@ -91,6 +91,52 @@ static inline uint16_t mavlink_msg_vision_speed_estimate_pack(uint8_t system_id, return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_MIN_LEN, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_LEN, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_CRC); } +/** + * @brief Pack a vision_speed_estimate message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param usec [us] Timestamp (UNIX time or time since system boot) + * @param x [m/s] Global X speed + * @param y [m/s] Global Y speed + * @param z [m/s] Global Z speed + * @param covariance Row-major representation of 3x3 linear velocity covariance matrix (states: vx, vy, vz; 1st three entries - 1st row, etc.). If unknown, assign NaN value to first element in the array. + * @param reset_counter Estimate reset counter. This should be incremented when the estimate resets in any of the dimensions (position, velocity, attitude, angular speed). This is designed to be used when e.g an external SLAM system detects a loop-closure and the estimate jumps. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_vision_speed_estimate_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t usec, float x, float y, float z, const float *covariance, uint8_t reset_counter) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_LEN]; + _mav_put_uint64_t(buf, 0, usec); + _mav_put_float(buf, 8, x); + _mav_put_float(buf, 12, y); + _mav_put_float(buf, 16, z); + _mav_put_uint8_t(buf, 56, reset_counter); + _mav_put_float_array(buf, 20, covariance, 9); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_LEN); +#else + mavlink_vision_speed_estimate_t packet; + packet.usec = usec; + packet.x = x; + packet.y = y; + packet.z = z; + packet.reset_counter = reset_counter; + mav_array_memcpy(packet.covariance, covariance, sizeof(float)*9); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_MIN_LEN, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_LEN, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_MIN_LEN, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_LEN); +#endif +} + /** * @brief Pack a vision_speed_estimate message on a channel * @param system_id ID of this system @@ -125,7 +171,7 @@ static inline uint16_t mavlink_msg_vision_speed_estimate_pack_chan(uint8_t syste packet.y = y; packet.z = z; packet.reset_counter = reset_counter; - mav_array_memcpy(packet.covariance, covariance, sizeof(float)*9); + mav_array_assign_float(packet.covariance, covariance, 9); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_LEN); #endif @@ -160,6 +206,20 @@ static inline uint16_t mavlink_msg_vision_speed_estimate_encode_chan(uint8_t sys return mavlink_msg_vision_speed_estimate_pack_chan(system_id, component_id, chan, msg, vision_speed_estimate->usec, vision_speed_estimate->x, vision_speed_estimate->y, vision_speed_estimate->z, vision_speed_estimate->covariance, vision_speed_estimate->reset_counter); } +/** + * @brief Encode a vision_speed_estimate struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param vision_speed_estimate C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_vision_speed_estimate_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_vision_speed_estimate_t* vision_speed_estimate) +{ + return mavlink_msg_vision_speed_estimate_pack_status(system_id, component_id, _status, msg, vision_speed_estimate->usec, vision_speed_estimate->x, vision_speed_estimate->y, vision_speed_estimate->z, vision_speed_estimate->covariance, vision_speed_estimate->reset_counter); +} + /** * @brief Send a vision_speed_estimate message * @param chan MAVLink channel to send the message @@ -191,7 +251,7 @@ static inline void mavlink_msg_vision_speed_estimate_send(mavlink_channel_t chan packet.y = y; packet.z = z; packet.reset_counter = reset_counter; - mav_array_memcpy(packet.covariance, covariance, sizeof(float)*9); + mav_array_assign_float(packet.covariance, covariance, 9); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE, (const char *)&packet, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_MIN_LEN, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_LEN, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_CRC); #endif } @@ -212,7 +272,7 @@ static inline void mavlink_msg_vision_speed_estimate_send_struct(mavlink_channel #if MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -236,7 +296,7 @@ static inline void mavlink_msg_vision_speed_estimate_send_buf(mavlink_message_t packet->y = y; packet->z = z; packet->reset_counter = reset_counter; - mav_array_memcpy(packet->covariance, covariance, sizeof(float)*9); + mav_array_assign_float(packet->covariance, covariance, 9); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE, (const char *)packet, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_MIN_LEN, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_LEN, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_CRC); #endif } diff --git a/common/mavlink_msg_wheel_distance.h b/common/mavlink_msg_wheel_distance.h index d506f0036..ac99950b4 100644 --- a/common/mavlink_msg_wheel_distance.h +++ b/common/mavlink_msg_wheel_distance.h @@ -65,7 +65,7 @@ static inline uint16_t mavlink_msg_wheel_distance_pack(uint8_t system_id, uint8_ mavlink_wheel_distance_t packet; packet.time_usec = time_usec; packet.count = count; - mav_array_memcpy(packet.distance, distance, sizeof(double)*16); + mav_array_assign_double(packet.distance, distance, 16); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_WHEEL_DISTANCE_LEN); #endif @@ -73,6 +73,43 @@ static inline uint16_t mavlink_msg_wheel_distance_pack(uint8_t system_id, uint8_ return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_WHEEL_DISTANCE_MIN_LEN, MAVLINK_MSG_ID_WHEEL_DISTANCE_LEN, MAVLINK_MSG_ID_WHEEL_DISTANCE_CRC); } +/** + * @brief Pack a wheel_distance message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (synced to UNIX time or since system boot). + * @param count Number of wheels reported. + * @param distance [m] Distance reported by individual wheel encoders. Forward rotations increase values, reverse rotations decrease them. Not all wheels will necessarily have wheel encoders; the mapping of encoders to wheel positions must be agreed/understood by the endpoints. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_wheel_distance_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, uint8_t count, const double *distance) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_WHEEL_DISTANCE_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint8_t(buf, 136, count); + _mav_put_double_array(buf, 8, distance, 16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_WHEEL_DISTANCE_LEN); +#else + mavlink_wheel_distance_t packet; + packet.time_usec = time_usec; + packet.count = count; + mav_array_memcpy(packet.distance, distance, sizeof(double)*16); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_WHEEL_DISTANCE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_WHEEL_DISTANCE; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_WHEEL_DISTANCE_MIN_LEN, MAVLINK_MSG_ID_WHEEL_DISTANCE_LEN, MAVLINK_MSG_ID_WHEEL_DISTANCE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_WHEEL_DISTANCE_MIN_LEN, MAVLINK_MSG_ID_WHEEL_DISTANCE_LEN); +#endif +} + /** * @brief Pack a wheel_distance message on a channel * @param system_id ID of this system @@ -98,7 +135,7 @@ static inline uint16_t mavlink_msg_wheel_distance_pack_chan(uint8_t system_id, u mavlink_wheel_distance_t packet; packet.time_usec = time_usec; packet.count = count; - mav_array_memcpy(packet.distance, distance, sizeof(double)*16); + mav_array_assign_double(packet.distance, distance, 16); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_WHEEL_DISTANCE_LEN); #endif @@ -133,6 +170,20 @@ static inline uint16_t mavlink_msg_wheel_distance_encode_chan(uint8_t system_id, return mavlink_msg_wheel_distance_pack_chan(system_id, component_id, chan, msg, wheel_distance->time_usec, wheel_distance->count, wheel_distance->distance); } +/** + * @brief Encode a wheel_distance struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param wheel_distance C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_wheel_distance_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_wheel_distance_t* wheel_distance) +{ + return mavlink_msg_wheel_distance_pack_status(system_id, component_id, _status, msg, wheel_distance->time_usec, wheel_distance->count, wheel_distance->distance); +} + /** * @brief Send a wheel_distance message * @param chan MAVLink channel to send the message @@ -155,7 +206,7 @@ static inline void mavlink_msg_wheel_distance_send(mavlink_channel_t chan, uint6 mavlink_wheel_distance_t packet; packet.time_usec = time_usec; packet.count = count; - mav_array_memcpy(packet.distance, distance, sizeof(double)*16); + mav_array_assign_double(packet.distance, distance, 16); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WHEEL_DISTANCE, (const char *)&packet, MAVLINK_MSG_ID_WHEEL_DISTANCE_MIN_LEN, MAVLINK_MSG_ID_WHEEL_DISTANCE_LEN, MAVLINK_MSG_ID_WHEEL_DISTANCE_CRC); #endif } @@ -176,7 +227,7 @@ static inline void mavlink_msg_wheel_distance_send_struct(mavlink_channel_t chan #if MAVLINK_MSG_ID_WHEEL_DISTANCE_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -194,7 +245,7 @@ static inline void mavlink_msg_wheel_distance_send_buf(mavlink_message_t *msgbuf mavlink_wheel_distance_t *packet = (mavlink_wheel_distance_t *)msgbuf; packet->time_usec = time_usec; packet->count = count; - mav_array_memcpy(packet->distance, distance, sizeof(double)*16); + mav_array_assign_double(packet->distance, distance, 16); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WHEEL_DISTANCE, (const char *)packet, MAVLINK_MSG_ID_WHEEL_DISTANCE_MIN_LEN, MAVLINK_MSG_ID_WHEEL_DISTANCE_LEN, MAVLINK_MSG_ID_WHEEL_DISTANCE_CRC); #endif } diff --git a/common/mavlink_msg_wifi_config_ap.h b/common/mavlink_msg_wifi_config_ap.h index f5abc2473..8e115ffab 100644 --- a/common/mavlink_msg_wifi_config_ap.h +++ b/common/mavlink_msg_wifi_config_ap.h @@ -60,6 +60,42 @@ typedef struct __mavlink_wifi_config_ap_t { static inline uint16_t mavlink_msg_wifi_config_ap_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const char *ssid, const char *password, int8_t mode, int8_t response) { +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN]; + _mav_put_int8_t(buf, 96, mode); + _mav_put_int8_t(buf, 97, response); + _mav_put_char_array(buf, 0, ssid, 32); + _mav_put_char_array(buf, 32, password, 64); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN); +#else + mavlink_wifi_config_ap_t packet; + packet.mode = mode; + packet.response = response; + mav_array_assign_char(packet.ssid, ssid, 32); + mav_array_assign_char(packet.password, password, 64); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_WIFI_CONFIG_AP; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_WIFI_CONFIG_AP_MIN_LEN, MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN, MAVLINK_MSG_ID_WIFI_CONFIG_AP_CRC); +} + +/** + * @brief Pack a wifi_config_ap message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param ssid Name of Wi-Fi network (SSID). Blank to leave it unchanged when setting. Current SSID when sent back as a response. + * @param password Password. Blank for an open AP. MD5 hash when message is sent back as a response. + * @param mode WiFi Mode. + * @param response Message acceptance response (sent back to GS). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_wifi_config_ap_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + const char *ssid, const char *password, int8_t mode, int8_t response) +{ #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN]; _mav_put_int8_t(buf, 96, mode); @@ -77,7 +113,11 @@ static inline uint16_t mavlink_msg_wifi_config_ap_pack(uint8_t system_id, uint8_ #endif msg->msgid = MAVLINK_MSG_ID_WIFI_CONFIG_AP; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_WIFI_CONFIG_AP_MIN_LEN, MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN, MAVLINK_MSG_ID_WIFI_CONFIG_AP_CRC); +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_WIFI_CONFIG_AP_MIN_LEN, MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN, MAVLINK_MSG_ID_WIFI_CONFIG_AP_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_WIFI_CONFIG_AP_MIN_LEN, MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN); +#endif } /** @@ -107,8 +147,8 @@ static inline uint16_t mavlink_msg_wifi_config_ap_pack_chan(uint8_t system_id, u mavlink_wifi_config_ap_t packet; packet.mode = mode; packet.response = response; - mav_array_memcpy(packet.ssid, ssid, sizeof(char)*32); - mav_array_memcpy(packet.password, password, sizeof(char)*64); + mav_array_assign_char(packet.ssid, ssid, 32); + mav_array_assign_char(packet.password, password, 64); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN); #endif @@ -143,6 +183,20 @@ static inline uint16_t mavlink_msg_wifi_config_ap_encode_chan(uint8_t system_id, return mavlink_msg_wifi_config_ap_pack_chan(system_id, component_id, chan, msg, wifi_config_ap->ssid, wifi_config_ap->password, wifi_config_ap->mode, wifi_config_ap->response); } +/** + * @brief Encode a wifi_config_ap struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param wifi_config_ap C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_wifi_config_ap_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_wifi_config_ap_t* wifi_config_ap) +{ + return mavlink_msg_wifi_config_ap_pack_status(system_id, component_id, _status, msg, wifi_config_ap->ssid, wifi_config_ap->password, wifi_config_ap->mode, wifi_config_ap->response); +} + /** * @brief Send a wifi_config_ap message * @param chan MAVLink channel to send the message @@ -167,8 +221,8 @@ static inline void mavlink_msg_wifi_config_ap_send(mavlink_channel_t chan, const mavlink_wifi_config_ap_t packet; packet.mode = mode; packet.response = response; - mav_array_memcpy(packet.ssid, ssid, sizeof(char)*32); - mav_array_memcpy(packet.password, password, sizeof(char)*64); + mav_array_assign_char(packet.ssid, ssid, 32); + mav_array_assign_char(packet.password, password, 64); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WIFI_CONFIG_AP, (const char *)&packet, MAVLINK_MSG_ID_WIFI_CONFIG_AP_MIN_LEN, MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN, MAVLINK_MSG_ID_WIFI_CONFIG_AP_CRC); #endif } @@ -189,7 +243,7 @@ static inline void mavlink_msg_wifi_config_ap_send_struct(mavlink_channel_t chan #if MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -208,8 +262,8 @@ static inline void mavlink_msg_wifi_config_ap_send_buf(mavlink_message_t *msgbuf mavlink_wifi_config_ap_t *packet = (mavlink_wifi_config_ap_t *)msgbuf; packet->mode = mode; packet->response = response; - mav_array_memcpy(packet->ssid, ssid, sizeof(char)*32); - mav_array_memcpy(packet->password, password, sizeof(char)*64); + mav_array_assign_char(packet->ssid, ssid, 32); + mav_array_assign_char(packet->password, password, 64); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WIFI_CONFIG_AP, (const char *)packet, MAVLINK_MSG_ID_WIFI_CONFIG_AP_MIN_LEN, MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN, MAVLINK_MSG_ID_WIFI_CONFIG_AP_CRC); #endif } diff --git a/common/mavlink_msg_winch_status.h b/common/mavlink_msg_winch_status.h index 62bd61695..c8574ef1f 100644 --- a/common/mavlink_msg_winch_status.h +++ b/common/mavlink_msg_winch_status.h @@ -105,6 +105,60 @@ static inline uint16_t mavlink_msg_winch_status_pack(uint8_t system_id, uint8_t return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_WINCH_STATUS_MIN_LEN, MAVLINK_MSG_ID_WINCH_STATUS_LEN, MAVLINK_MSG_ID_WINCH_STATUS_CRC); } +/** + * @brief Pack a winch_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (synced to UNIX time or since system boot). + * @param line_length [m] Length of line released. NaN if unknown + * @param speed [m/s] Speed line is being released or retracted. Positive values if being released, negative values if being retracted, NaN if unknown + * @param tension [kg] Tension on the line. NaN if unknown + * @param voltage [V] Voltage of the battery supplying the winch. NaN if unknown + * @param current [A] Current draw from the winch. NaN if unknown + * @param temperature [degC] Temperature of the motor. INT16_MAX if unknown + * @param status Status flags + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_winch_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, float line_length, float speed, float tension, float voltage, float current, int16_t temperature, uint32_t status) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_WINCH_STATUS_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, line_length); + _mav_put_float(buf, 12, speed); + _mav_put_float(buf, 16, tension); + _mav_put_float(buf, 20, voltage); + _mav_put_float(buf, 24, current); + _mav_put_uint32_t(buf, 28, status); + _mav_put_int16_t(buf, 32, temperature); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_WINCH_STATUS_LEN); +#else + mavlink_winch_status_t packet; + packet.time_usec = time_usec; + packet.line_length = line_length; + packet.speed = speed; + packet.tension = tension; + packet.voltage = voltage; + packet.current = current; + packet.status = status; + packet.temperature = temperature; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_WINCH_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_WINCH_STATUS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_WINCH_STATUS_MIN_LEN, MAVLINK_MSG_ID_WINCH_STATUS_LEN, MAVLINK_MSG_ID_WINCH_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_WINCH_STATUS_MIN_LEN, MAVLINK_MSG_ID_WINCH_STATUS_LEN); +#endif +} + /** * @brief Pack a winch_status message on a channel * @param system_id ID of this system @@ -182,6 +236,20 @@ static inline uint16_t mavlink_msg_winch_status_encode_chan(uint8_t system_id, u return mavlink_msg_winch_status_pack_chan(system_id, component_id, chan, msg, winch_status->time_usec, winch_status->line_length, winch_status->speed, winch_status->tension, winch_status->voltage, winch_status->current, winch_status->temperature, winch_status->status); } +/** + * @brief Encode a winch_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param winch_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_winch_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_winch_status_t* winch_status) +{ + return mavlink_msg_winch_status_pack_status(system_id, component_id, _status, msg, winch_status->time_usec, winch_status->line_length, winch_status->speed, winch_status->tension, winch_status->voltage, winch_status->current, winch_status->temperature, winch_status->status); +} + /** * @brief Send a winch_status message * @param chan MAVLink channel to send the message @@ -242,7 +310,7 @@ static inline void mavlink_msg_winch_status_send_struct(mavlink_channel_t chan, #if MAVLINK_MSG_ID_WINCH_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/common/mavlink_msg_wind_cov.h b/common/mavlink_msg_wind_cov.h index abce953e2..28ea62ea4 100644 --- a/common/mavlink_msg_wind_cov.h +++ b/common/mavlink_msg_wind_cov.h @@ -6,14 +6,14 @@ typedef struct __mavlink_wind_cov_t { uint64_t time_usec; /*< [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.*/ - float wind_x; /*< [m/s] Wind in X (NED) direction*/ - float wind_y; /*< [m/s] Wind in Y (NED) direction*/ - float wind_z; /*< [m/s] Wind in Z (NED) direction*/ - float var_horiz; /*< [m/s] Variability of the wind in XY. RMS of a 1 Hz lowpassed wind estimate.*/ - float var_vert; /*< [m/s] Variability of the wind in Z. RMS of a 1 Hz lowpassed wind estimate.*/ - float wind_alt; /*< [m] Altitude (MSL) that this measurement was taken at*/ - float horiz_accuracy; /*< [m] Horizontal speed 1-STD accuracy*/ - float vert_accuracy; /*< [m] Vertical speed 1-STD accuracy*/ + float wind_x; /*< [m/s] Wind in North (NED) direction (NAN if unknown)*/ + float wind_y; /*< [m/s] Wind in East (NED) direction (NAN if unknown)*/ + float wind_z; /*< [m/s] Wind in down (NED) direction (NAN if unknown)*/ + float var_horiz; /*< [m/s] Variability of wind in XY, 1-STD estimated from a 1 Hz lowpassed wind estimate (NAN if unknown)*/ + float var_vert; /*< [m/s] Variability of wind in Z, 1-STD estimated from a 1 Hz lowpassed wind estimate (NAN if unknown)*/ + float wind_alt; /*< [m] Altitude (MSL) that this measurement was taken at (NAN if unknown)*/ + float horiz_accuracy; /*< [m/s] Horizontal speed 1-STD accuracy (0 if unknown)*/ + float vert_accuracy; /*< [m/s] Vertical speed 1-STD accuracy (0 if unknown)*/ } mavlink_wind_cov_t; #define MAVLINK_MSG_ID_WIND_COV_LEN 40 @@ -66,14 +66,14 @@ typedef struct __mavlink_wind_cov_t { * @param msg The MAVLink message to compress the data into * * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - * @param wind_x [m/s] Wind in X (NED) direction - * @param wind_y [m/s] Wind in Y (NED) direction - * @param wind_z [m/s] Wind in Z (NED) direction - * @param var_horiz [m/s] Variability of the wind in XY. RMS of a 1 Hz lowpassed wind estimate. - * @param var_vert [m/s] Variability of the wind in Z. RMS of a 1 Hz lowpassed wind estimate. - * @param wind_alt [m] Altitude (MSL) that this measurement was taken at - * @param horiz_accuracy [m] Horizontal speed 1-STD accuracy - * @param vert_accuracy [m] Vertical speed 1-STD accuracy + * @param wind_x [m/s] Wind in North (NED) direction (NAN if unknown) + * @param wind_y [m/s] Wind in East (NED) direction (NAN if unknown) + * @param wind_z [m/s] Wind in down (NED) direction (NAN if unknown) + * @param var_horiz [m/s] Variability of wind in XY, 1-STD estimated from a 1 Hz lowpassed wind estimate (NAN if unknown) + * @param var_vert [m/s] Variability of wind in Z, 1-STD estimated from a 1 Hz lowpassed wind estimate (NAN if unknown) + * @param wind_alt [m] Altitude (MSL) that this measurement was taken at (NAN if unknown) + * @param horiz_accuracy [m/s] Horizontal speed 1-STD accuracy (0 if unknown) + * @param vert_accuracy [m/s] Vertical speed 1-STD accuracy (0 if unknown) * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_wind_cov_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, @@ -111,6 +111,63 @@ static inline uint16_t mavlink_msg_wind_cov_pack(uint8_t system_id, uint8_t comp return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_WIND_COV_MIN_LEN, MAVLINK_MSG_ID_WIND_COV_LEN, MAVLINK_MSG_ID_WIND_COV_CRC); } +/** + * @brief Pack a wind_cov message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param wind_x [m/s] Wind in North (NED) direction (NAN if unknown) + * @param wind_y [m/s] Wind in East (NED) direction (NAN if unknown) + * @param wind_z [m/s] Wind in down (NED) direction (NAN if unknown) + * @param var_horiz [m/s] Variability of wind in XY, 1-STD estimated from a 1 Hz lowpassed wind estimate (NAN if unknown) + * @param var_vert [m/s] Variability of wind in Z, 1-STD estimated from a 1 Hz lowpassed wind estimate (NAN if unknown) + * @param wind_alt [m] Altitude (MSL) that this measurement was taken at (NAN if unknown) + * @param horiz_accuracy [m/s] Horizontal speed 1-STD accuracy (0 if unknown) + * @param vert_accuracy [m/s] Vertical speed 1-STD accuracy (0 if unknown) + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_wind_cov_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, float wind_x, float wind_y, float wind_z, float var_horiz, float var_vert, float wind_alt, float horiz_accuracy, float vert_accuracy) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_WIND_COV_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, wind_x); + _mav_put_float(buf, 12, wind_y); + _mav_put_float(buf, 16, wind_z); + _mav_put_float(buf, 20, var_horiz); + _mav_put_float(buf, 24, var_vert); + _mav_put_float(buf, 28, wind_alt); + _mav_put_float(buf, 32, horiz_accuracy); + _mav_put_float(buf, 36, vert_accuracy); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_WIND_COV_LEN); +#else + mavlink_wind_cov_t packet; + packet.time_usec = time_usec; + packet.wind_x = wind_x; + packet.wind_y = wind_y; + packet.wind_z = wind_z; + packet.var_horiz = var_horiz; + packet.var_vert = var_vert; + packet.wind_alt = wind_alt; + packet.horiz_accuracy = horiz_accuracy; + packet.vert_accuracy = vert_accuracy; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_WIND_COV_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_WIND_COV; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_WIND_COV_MIN_LEN, MAVLINK_MSG_ID_WIND_COV_LEN, MAVLINK_MSG_ID_WIND_COV_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_WIND_COV_MIN_LEN, MAVLINK_MSG_ID_WIND_COV_LEN); +#endif +} + /** * @brief Pack a wind_cov message on a channel * @param system_id ID of this system @@ -118,14 +175,14 @@ static inline uint16_t mavlink_msg_wind_cov_pack(uint8_t system_id, uint8_t comp * @param chan The MAVLink channel this message will be sent over * @param msg The MAVLink message to compress the data into * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - * @param wind_x [m/s] Wind in X (NED) direction - * @param wind_y [m/s] Wind in Y (NED) direction - * @param wind_z [m/s] Wind in Z (NED) direction - * @param var_horiz [m/s] Variability of the wind in XY. RMS of a 1 Hz lowpassed wind estimate. - * @param var_vert [m/s] Variability of the wind in Z. RMS of a 1 Hz lowpassed wind estimate. - * @param wind_alt [m] Altitude (MSL) that this measurement was taken at - * @param horiz_accuracy [m] Horizontal speed 1-STD accuracy - * @param vert_accuracy [m] Vertical speed 1-STD accuracy + * @param wind_x [m/s] Wind in North (NED) direction (NAN if unknown) + * @param wind_y [m/s] Wind in East (NED) direction (NAN if unknown) + * @param wind_z [m/s] Wind in down (NED) direction (NAN if unknown) + * @param var_horiz [m/s] Variability of wind in XY, 1-STD estimated from a 1 Hz lowpassed wind estimate (NAN if unknown) + * @param var_vert [m/s] Variability of wind in Z, 1-STD estimated from a 1 Hz lowpassed wind estimate (NAN if unknown) + * @param wind_alt [m] Altitude (MSL) that this measurement was taken at (NAN if unknown) + * @param horiz_accuracy [m/s] Horizontal speed 1-STD accuracy (0 if unknown) + * @param vert_accuracy [m/s] Vertical speed 1-STD accuracy (0 if unknown) * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_wind_cov_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, @@ -191,19 +248,33 @@ static inline uint16_t mavlink_msg_wind_cov_encode_chan(uint8_t system_id, uint8 return mavlink_msg_wind_cov_pack_chan(system_id, component_id, chan, msg, wind_cov->time_usec, wind_cov->wind_x, wind_cov->wind_y, wind_cov->wind_z, wind_cov->var_horiz, wind_cov->var_vert, wind_cov->wind_alt, wind_cov->horiz_accuracy, wind_cov->vert_accuracy); } +/** + * @brief Encode a wind_cov struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param wind_cov C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_wind_cov_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_wind_cov_t* wind_cov) +{ + return mavlink_msg_wind_cov_pack_status(system_id, component_id, _status, msg, wind_cov->time_usec, wind_cov->wind_x, wind_cov->wind_y, wind_cov->wind_z, wind_cov->var_horiz, wind_cov->var_vert, wind_cov->wind_alt, wind_cov->horiz_accuracy, wind_cov->vert_accuracy); +} + /** * @brief Send a wind_cov message * @param chan MAVLink channel to send the message * * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - * @param wind_x [m/s] Wind in X (NED) direction - * @param wind_y [m/s] Wind in Y (NED) direction - * @param wind_z [m/s] Wind in Z (NED) direction - * @param var_horiz [m/s] Variability of the wind in XY. RMS of a 1 Hz lowpassed wind estimate. - * @param var_vert [m/s] Variability of the wind in Z. RMS of a 1 Hz lowpassed wind estimate. - * @param wind_alt [m] Altitude (MSL) that this measurement was taken at - * @param horiz_accuracy [m] Horizontal speed 1-STD accuracy - * @param vert_accuracy [m] Vertical speed 1-STD accuracy + * @param wind_x [m/s] Wind in North (NED) direction (NAN if unknown) + * @param wind_y [m/s] Wind in East (NED) direction (NAN if unknown) + * @param wind_z [m/s] Wind in down (NED) direction (NAN if unknown) + * @param var_horiz [m/s] Variability of wind in XY, 1-STD estimated from a 1 Hz lowpassed wind estimate (NAN if unknown) + * @param var_vert [m/s] Variability of wind in Z, 1-STD estimated from a 1 Hz lowpassed wind estimate (NAN if unknown) + * @param wind_alt [m] Altitude (MSL) that this measurement was taken at (NAN if unknown) + * @param horiz_accuracy [m/s] Horizontal speed 1-STD accuracy (0 if unknown) + * @param vert_accuracy [m/s] Vertical speed 1-STD accuracy (0 if unknown) */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS @@ -254,7 +325,7 @@ static inline void mavlink_msg_wind_cov_send_struct(mavlink_channel_t chan, cons #if MAVLINK_MSG_ID_WIND_COV_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -310,7 +381,7 @@ static inline uint64_t mavlink_msg_wind_cov_get_time_usec(const mavlink_message_ /** * @brief Get field wind_x from wind_cov message * - * @return [m/s] Wind in X (NED) direction + * @return [m/s] Wind in North (NED) direction (NAN if unknown) */ static inline float mavlink_msg_wind_cov_get_wind_x(const mavlink_message_t* msg) { @@ -320,7 +391,7 @@ static inline float mavlink_msg_wind_cov_get_wind_x(const mavlink_message_t* msg /** * @brief Get field wind_y from wind_cov message * - * @return [m/s] Wind in Y (NED) direction + * @return [m/s] Wind in East (NED) direction (NAN if unknown) */ static inline float mavlink_msg_wind_cov_get_wind_y(const mavlink_message_t* msg) { @@ -330,7 +401,7 @@ static inline float mavlink_msg_wind_cov_get_wind_y(const mavlink_message_t* msg /** * @brief Get field wind_z from wind_cov message * - * @return [m/s] Wind in Z (NED) direction + * @return [m/s] Wind in down (NED) direction (NAN if unknown) */ static inline float mavlink_msg_wind_cov_get_wind_z(const mavlink_message_t* msg) { @@ -340,7 +411,7 @@ static inline float mavlink_msg_wind_cov_get_wind_z(const mavlink_message_t* msg /** * @brief Get field var_horiz from wind_cov message * - * @return [m/s] Variability of the wind in XY. RMS of a 1 Hz lowpassed wind estimate. + * @return [m/s] Variability of wind in XY, 1-STD estimated from a 1 Hz lowpassed wind estimate (NAN if unknown) */ static inline float mavlink_msg_wind_cov_get_var_horiz(const mavlink_message_t* msg) { @@ -350,7 +421,7 @@ static inline float mavlink_msg_wind_cov_get_var_horiz(const mavlink_message_t* /** * @brief Get field var_vert from wind_cov message * - * @return [m/s] Variability of the wind in Z. RMS of a 1 Hz lowpassed wind estimate. + * @return [m/s] Variability of wind in Z, 1-STD estimated from a 1 Hz lowpassed wind estimate (NAN if unknown) */ static inline float mavlink_msg_wind_cov_get_var_vert(const mavlink_message_t* msg) { @@ -360,7 +431,7 @@ static inline float mavlink_msg_wind_cov_get_var_vert(const mavlink_message_t* m /** * @brief Get field wind_alt from wind_cov message * - * @return [m] Altitude (MSL) that this measurement was taken at + * @return [m] Altitude (MSL) that this measurement was taken at (NAN if unknown) */ static inline float mavlink_msg_wind_cov_get_wind_alt(const mavlink_message_t* msg) { @@ -370,7 +441,7 @@ static inline float mavlink_msg_wind_cov_get_wind_alt(const mavlink_message_t* m /** * @brief Get field horiz_accuracy from wind_cov message * - * @return [m] Horizontal speed 1-STD accuracy + * @return [m/s] Horizontal speed 1-STD accuracy (0 if unknown) */ static inline float mavlink_msg_wind_cov_get_horiz_accuracy(const mavlink_message_t* msg) { @@ -380,7 +451,7 @@ static inline float mavlink_msg_wind_cov_get_horiz_accuracy(const mavlink_messag /** * @brief Get field vert_accuracy from wind_cov message * - * @return [m] Vertical speed 1-STD accuracy + * @return [m/s] Vertical speed 1-STD accuracy (0 if unknown) */ static inline float mavlink_msg_wind_cov_get_vert_accuracy(const mavlink_message_t* msg) { diff --git a/common/testsuite.h b/common/testsuite.h index 8cea37554..2c2a036cb 100644 --- a/common/testsuite.h +++ b/common/testsuite.h @@ -1,6 +1,6 @@ /** @file * @brief MAVLink comm protocol testsuite generated from common.xml - * @see http://qgroundcontrol.org/mavlink/ + * @see https://mavlink.io/en/ */ #pragma once #ifndef COMMON_TESTSUITE_H @@ -12,17 +12,17 @@ extern "C" { #ifndef MAVLINK_TEST_ALL #define MAVLINK_TEST_ALL -static void mavlink_test_minimal(uint8_t, uint8_t, mavlink_message_t *last_msg); +static void mavlink_test_standard(uint8_t, uint8_t, mavlink_message_t *last_msg); static void mavlink_test_common(uint8_t, uint8_t, mavlink_message_t *last_msg); static void mavlink_test_all(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) { - mavlink_test_minimal(system_id, component_id, last_msg); + mavlink_test_standard(system_id, component_id, last_msg); mavlink_test_common(system_id, component_id, last_msg); } #endif -#include "../minimal/testsuite.h" +#include "../standard/testsuite.h" static void mavlink_test_sys_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -37,7 +37,7 @@ static void mavlink_test_sys_status(uint8_t system_id, uint8_t component_id, mav uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; uint16_t i; mavlink_sys_status_t packet_in = { - 963497464,963497672,963497880,17859,17963,18067,18171,18275,18379,18483,18587,18691,223 + 963497464,963497672,963497880,17859,17963,18067,18171,18275,18379,18483,18587,18691,223,963499076,963499284,963499492 }; mavlink_sys_status_t packet1, packet2; memset(&packet1, 0, sizeof(packet1)); @@ -54,6 +54,9 @@ static void mavlink_test_sys_status(uint8_t system_id, uint8_t component_id, mav packet1.errors_count3 = packet_in.errors_count3; packet1.errors_count4 = packet_in.errors_count4; packet1.battery_remaining = packet_in.battery_remaining; + packet1.onboard_control_sensors_present_extended = packet_in.onboard_control_sensors_present_extended; + packet1.onboard_control_sensors_enabled_extended = packet_in.onboard_control_sensors_enabled_extended; + packet1.onboard_control_sensors_health_extended = packet_in.onboard_control_sensors_health_extended; #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 @@ -68,12 +71,12 @@ static void mavlink_test_sys_status(uint8_t system_id, uint8_t component_id, mav MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - 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 ); + 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 , packet1.onboard_control_sensors_present_extended , packet1.onboard_control_sensors_enabled_extended , packet1.onboard_control_sensors_health_extended ); mavlink_msg_sys_status_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - 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 ); + 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 , packet1.onboard_control_sensors_present_extended , packet1.onboard_control_sensors_enabled_extended , packet1.onboard_control_sensors_health_extended ); mavlink_msg_sys_status_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); @@ -86,9 +89,14 @@ static void mavlink_test_sys_status(uint8_t system_id, uint8_t component_id, mav MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - 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 ); + 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 , packet1.onboard_control_sensors_present_extended , packet1.onboard_control_sensors_enabled_extended , packet1.onboard_control_sensors_health_extended ); mavlink_msg_sys_status_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("SYS_STATUS") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_SYS_STATUS) != NULL); +#endif } static void mavlink_test_system_time(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -144,6 +152,11 @@ static void mavlink_test_system_time(uint8_t system_id, uint8_t component_id, ma mavlink_msg_system_time_send(MAVLINK_COMM_1 , packet1.time_unix_usec , packet1.time_boot_ms ); mavlink_msg_system_time_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("SYSTEM_TIME") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_SYSTEM_TIME) != NULL); +#endif } static void mavlink_test_ping(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -201,6 +214,11 @@ static void mavlink_test_ping(uint8_t system_id, uint8_t component_id, mavlink_m mavlink_msg_ping_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.seq , packet1.target_system , packet1.target_component ); mavlink_msg_ping_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("PING") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_PING) != NULL); +#endif } static void mavlink_test_change_operator_control(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -258,6 +276,11 @@ static void mavlink_test_change_operator_control(uint8_t system_id, uint8_t comp mavlink_msg_change_operator_control_send(MAVLINK_COMM_1 , packet1.target_system , packet1.control_request , packet1.version , packet1.passkey ); mavlink_msg_change_operator_control_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("CHANGE_OPERATOR_CONTROL") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL) != NULL); +#endif } static void mavlink_test_change_operator_control_ack(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -314,6 +337,11 @@ static void mavlink_test_change_operator_control_ack(uint8_t system_id, uint8_t mavlink_msg_change_operator_control_ack_send(MAVLINK_COMM_1 , packet1.gcs_system_id , packet1.control_request , packet1.ack ); mavlink_msg_change_operator_control_ack_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("CHANGE_OPERATOR_CONTROL_ACK") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK) != NULL); +#endif } static void mavlink_test_auth_key(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -368,6 +396,11 @@ static void mavlink_test_auth_key(uint8_t system_id, uint8_t component_id, mavli mavlink_msg_auth_key_send(MAVLINK_COMM_1 , packet1.key ); mavlink_msg_auth_key_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("AUTH_KEY") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_AUTH_KEY) != NULL); +#endif } static void mavlink_test_link_node_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -432,6 +465,11 @@ static void mavlink_test_link_node_status(uint8_t system_id, uint8_t component_i mavlink_msg_link_node_status_send(MAVLINK_COMM_1 , packet1.timestamp , packet1.tx_buf , packet1.rx_buf , packet1.tx_rate , packet1.rx_rate , packet1.rx_parse_err , packet1.tx_overflows , packet1.rx_overflows , packet1.messages_sent , packet1.messages_received , packet1.messages_lost ); mavlink_msg_link_node_status_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("LINK_NODE_STATUS") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_LINK_NODE_STATUS) != NULL); +#endif } static void mavlink_test_set_mode(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -488,65 +526,11 @@ static void mavlink_test_set_mode(uint8_t system_id, uint8_t component_id, mavli mavlink_msg_set_mode_send(MAVLINK_COMM_1 , packet1.target_system , packet1.base_mode , packet1.custom_mode ); mavlink_msg_set_mode_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); -} -static void mavlink_test_param_ack_transaction(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) -{ -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); - if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_param_ack_transaction_t packet_in = { - 17.0,17,84,"GHIJKLMNOPQRSTU",199,10 - }; - mavlink_param_ack_transaction_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.param_value = packet_in.param_value; - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - packet1.param_type = packet_in.param_type; - packet1.param_result = packet_in.param_result; - - mav_array_memcpy(packet1.param_id, packet_in.param_id, sizeof(char)*16); - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_MIN_LEN); - } +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("SET_MODE") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_SET_MODE) != NULL); #endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_param_ack_transaction_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_param_ack_transaction_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_param_ack_transaction_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_value , packet1.param_type , packet1.param_result ); - mavlink_msg_param_ack_transaction_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_param_ack_transaction_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_value , packet1.param_type , packet1.param_result ); - mavlink_msg_param_ack_transaction_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GLOBAL_POSITION_INT >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_global_position_int_t packet_in = { - 963497464,963497672,963497880,963498088,963498296,18275,18379,18483,18587 - }; - mavlink_global_position_int_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.time_boot_ms = packet_in.time_boot_ms; - packet1.lat = packet_in.lat; - packet1.lon = packet_in.lon; - packet1.alt = packet_in.alt; - packet1.relative_alt = packet_in.relative_alt; - packet1.vx = packet_in.vx; - packet1.vy = packet_in.vy; - packet1.vz = packet_in.vz; - packet1.hdg = packet_in.hdg; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_GLOBAL_POSITION_INT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GLOBAL_POSITION_INT_MIN_LEN); - } +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("LOCAL_POSITION_NED") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_LOCAL_POSITION_NED) != NULL); #endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_global_position_int_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_global_position_int_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_global_position_int_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.lat , packet1.lon , packet1.alt , packet1.relative_alt , packet1.vx , packet1.vy , packet1.vz , packet1.hdg ); - mavlink_msg_global_position_int_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_global_position_int_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.lat , packet1.lon , packet1.alt , packet1.relative_alt , packet1.vx , packet1.vy , packet1.vz , packet1.hdg ); - mavlink_msg_global_position_int_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MISSION_CHANGED >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_mission_changed_t packet_in = { - 17235,17339,17,84,151 - }; - mavlink_mission_changed_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.start_index = packet_in.start_index; - packet1.end_index = packet_in.end_index; - packet1.origin_sysid = packet_in.origin_sysid; - packet1.origin_compid = packet_in.origin_compid; - packet1.mission_type = packet_in.mission_type; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_MISSION_CHANGED_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MISSION_CHANGED_MIN_LEN); - } +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("MISSION_REQUEST_INT") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_MISSION_REQUEST_INT) != NULL); #endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_mission_changed_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_mission_changed_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_mission_changed_pack(system_id, component_id, &msg , packet1.start_index , packet1.end_index , packet1.origin_sysid , packet1.origin_compid , packet1.mission_type ); - mavlink_msg_mission_changed_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_mission_changed_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.start_index , packet1.end_index , packet1.origin_sysid , packet1.origin_compid , packet1.mission_type ); - mavlink_msg_mission_changed_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { @@ -3677,12 +3805,12 @@ static void mavlink_test_set_attitude_target(uint8_t system_id, uint8_t componen MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_set_attitude_target_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.target_system , packet1.target_component , packet1.type_mask , packet1.q , packet1.body_roll_rate , packet1.body_pitch_rate , packet1.body_yaw_rate , packet1.thrust ); + mavlink_msg_set_attitude_target_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.target_system , packet1.target_component , packet1.type_mask , packet1.q , packet1.body_roll_rate , packet1.body_pitch_rate , packet1.body_yaw_rate , packet1.thrust , packet1.thrust_body ); mavlink_msg_set_attitude_target_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_set_attitude_target_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.target_system , packet1.target_component , packet1.type_mask , packet1.q , packet1.body_roll_rate , packet1.body_pitch_rate , packet1.body_yaw_rate , packet1.thrust ); + mavlink_msg_set_attitude_target_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.target_system , packet1.target_component , packet1.type_mask , packet1.q , packet1.body_roll_rate , packet1.body_pitch_rate , packet1.body_yaw_rate , packet1.thrust , packet1.thrust_body ); mavlink_msg_set_attitude_target_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); @@ -3695,9 +3823,14 @@ static void mavlink_test_set_attitude_target(uint8_t system_id, uint8_t componen MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_set_attitude_target_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.target_system , packet1.target_component , packet1.type_mask , packet1.q , packet1.body_roll_rate , packet1.body_pitch_rate , packet1.body_yaw_rate , packet1.thrust ); + mavlink_msg_set_attitude_target_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.target_system , packet1.target_component , packet1.type_mask , packet1.q , packet1.body_roll_rate , packet1.body_pitch_rate , packet1.body_yaw_rate , packet1.thrust , packet1.thrust_body ); mavlink_msg_set_attitude_target_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("SET_ATTITUDE_TARGET") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_SET_ATTITUDE_TARGET) != NULL); +#endif } static void mavlink_test_attitude_target(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -3758,6 +3891,11 @@ static void mavlink_test_attitude_target(uint8_t system_id, uint8_t component_id mavlink_msg_attitude_target_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.type_mask , packet1.q , packet1.body_roll_rate , packet1.body_pitch_rate , packet1.body_yaw_rate , packet1.thrust ); mavlink_msg_attitude_target_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("ATTITUDE_TARGET") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_ATTITUDE_TARGET) != NULL); +#endif } static void mavlink_test_set_position_target_local_ned(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -3827,6 +3965,11 @@ static void mavlink_test_set_position_target_local_ned(uint8_t system_id, uint8_ mavlink_msg_set_position_target_local_ned_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.target_system , packet1.target_component , packet1.coordinate_frame , packet1.type_mask , packet1.x , packet1.y , packet1.z , packet1.vx , packet1.vy , packet1.vz , packet1.afx , packet1.afy , packet1.afz , packet1.yaw , packet1.yaw_rate ); mavlink_msg_set_position_target_local_ned_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("SET_POSITION_TARGET_LOCAL_NED") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED) != NULL); +#endif } static void mavlink_test_position_target_local_ned(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -3894,6 +4037,11 @@ static void mavlink_test_position_target_local_ned(uint8_t system_id, uint8_t co mavlink_msg_position_target_local_ned_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.coordinate_frame , packet1.type_mask , packet1.x , packet1.y , packet1.z , packet1.vx , packet1.vy , packet1.vz , packet1.afx , packet1.afy , packet1.afz , packet1.yaw , packet1.yaw_rate ); mavlink_msg_position_target_local_ned_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("POSITION_TARGET_LOCAL_NED") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED) != NULL); +#endif } static void mavlink_test_set_position_target_global_int(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -3963,6 +4111,11 @@ static void mavlink_test_set_position_target_global_int(uint8_t system_id, uint8 mavlink_msg_set_position_target_global_int_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.target_system , packet1.target_component , packet1.coordinate_frame , packet1.type_mask , packet1.lat_int , packet1.lon_int , packet1.alt , packet1.vx , packet1.vy , packet1.vz , packet1.afx , packet1.afy , packet1.afz , packet1.yaw , packet1.yaw_rate ); mavlink_msg_set_position_target_global_int_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("SET_POSITION_TARGET_GLOBAL_INT") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT) != NULL); +#endif } static void mavlink_test_position_target_global_int(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -4030,6 +4183,11 @@ static void mavlink_test_position_target_global_int(uint8_t system_id, uint8_t c mavlink_msg_position_target_global_int_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.coordinate_frame , packet1.type_mask , packet1.lat_int , packet1.lon_int , packet1.alt , packet1.vx , packet1.vy , packet1.vz , packet1.afx , packet1.afy , packet1.afz , packet1.yaw , packet1.yaw_rate ); mavlink_msg_position_target_global_int_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("POSITION_TARGET_GLOBAL_INT") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT) != NULL); +#endif } static void mavlink_test_local_position_ned_system_global_offset(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -4090,6 +4248,11 @@ static void mavlink_test_local_position_ned_system_global_offset(uint8_t system_ mavlink_msg_local_position_ned_system_global_offset_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw ); mavlink_msg_local_position_ned_system_global_offset_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET) != NULL); +#endif } static void mavlink_test_hil_state(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -4159,7 +4322,12 @@ static void mavlink_test_hil_state(uint8_t system_id, uint8_t component_id, mavl mavlink_msg_hil_state_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.roll , packet1.pitch , packet1.yaw , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.lat , packet1.lon , packet1.alt , packet1.vx , packet1.vy , packet1.vz , packet1.xacc , packet1.yacc , packet1.zacc ); mavlink_msg_hil_state_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); -} + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("HIL_STATE") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_HIL_STATE) != NULL); +#endif +} static void mavlink_test_hil_controls(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) { @@ -4223,6 +4391,11 @@ static void mavlink_test_hil_controls(uint8_t system_id, uint8_t component_id, m mavlink_msg_hil_controls_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.roll_ailerons , packet1.pitch_elevator , packet1.yaw_rudder , packet1.throttle , packet1.aux1 , packet1.aux2 , packet1.aux3 , packet1.aux4 , packet1.mode , packet1.nav_mode ); mavlink_msg_hil_controls_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("HIL_CONTROLS") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_HIL_CONTROLS) != NULL); +#endif } static void mavlink_test_hil_rc_inputs_raw(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -4290,6 +4463,11 @@ static void mavlink_test_hil_rc_inputs_raw(uint8_t system_id, uint8_t component_ mavlink_msg_hil_rc_inputs_raw_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw , packet1.chan9_raw , packet1.chan10_raw , packet1.chan11_raw , packet1.chan12_raw , packet1.rssi ); mavlink_msg_hil_rc_inputs_raw_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("HIL_RC_INPUTS_RAW") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW) != NULL); +#endif } static void mavlink_test_hil_actuator_controls(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -4347,6 +4525,11 @@ static void mavlink_test_hil_actuator_controls(uint8_t system_id, uint8_t compon mavlink_msg_hil_actuator_controls_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.controls , packet1.mode , packet1.flags ); mavlink_msg_hil_actuator_controls_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("HIL_ACTUATOR_CONTROLS") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS) != NULL); +#endif } static void mavlink_test_optical_flow(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -4410,6 +4593,11 @@ static void mavlink_test_optical_flow(uint8_t system_id, uint8_t component_id, m mavlink_msg_optical_flow_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.sensor_id , packet1.flow_x , packet1.flow_y , packet1.flow_comp_m_x , packet1.flow_comp_m_y , packet1.quality , packet1.ground_distance , packet1.flow_rate_x , packet1.flow_rate_y ); mavlink_msg_optical_flow_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("OPTICAL_FLOW") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_OPTICAL_FLOW) != NULL); +#endif } static void mavlink_test_global_vision_position_estimate(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -4472,6 +4660,11 @@ static void mavlink_test_global_vision_position_estimate(uint8_t system_id, uint mavlink_msg_global_vision_position_estimate_send(MAVLINK_COMM_1 , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw , packet1.covariance , packet1.reset_counter ); mavlink_msg_global_vision_position_estimate_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("GLOBAL_VISION_POSITION_ESTIMATE") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE) != NULL); +#endif } static void mavlink_test_vision_position_estimate(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -4534,6 +4727,11 @@ static void mavlink_test_vision_position_estimate(uint8_t system_id, uint8_t com mavlink_msg_vision_position_estimate_send(MAVLINK_COMM_1 , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw , packet1.covariance , packet1.reset_counter ); mavlink_msg_vision_position_estimate_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("VISION_POSITION_ESTIMATE") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE) != NULL); +#endif } static void mavlink_test_vision_speed_estimate(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -4593,6 +4791,11 @@ static void mavlink_test_vision_speed_estimate(uint8_t system_id, uint8_t compon mavlink_msg_vision_speed_estimate_send(MAVLINK_COMM_1 , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.covariance , packet1.reset_counter ); mavlink_msg_vision_speed_estimate_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("VISION_SPEED_ESTIMATE") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE) != NULL); +#endif } static void mavlink_test_vicon_position_estimate(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -4654,6 +4857,11 @@ static void mavlink_test_vicon_position_estimate(uint8_t system_id, uint8_t comp mavlink_msg_vicon_position_estimate_send(MAVLINK_COMM_1 , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw , packet1.covariance ); mavlink_msg_vicon_position_estimate_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("VICON_POSITION_ESTIMATE") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE) != NULL); +#endif } static void mavlink_test_highres_imu(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -4723,6 +4931,11 @@ static void mavlink_test_highres_imu(uint8_t system_id, uint8_t component_id, ma mavlink_msg_highres_imu_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag , packet1.abs_pressure , packet1.diff_pressure , packet1.pressure_alt , packet1.temperature , packet1.fields_updated , packet1.id ); mavlink_msg_highres_imu_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("HIGHRES_IMU") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_HIGHRES_IMU) != NULL); +#endif } static void mavlink_test_optical_flow_rad(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -4788,6 +5001,11 @@ static void mavlink_test_optical_flow_rad(uint8_t system_id, uint8_t component_i mavlink_msg_optical_flow_rad_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.sensor_id , packet1.integration_time_us , packet1.integrated_x , packet1.integrated_y , packet1.integrated_xgyro , packet1.integrated_ygyro , packet1.integrated_zgyro , packet1.temperature , packet1.quality , packet1.time_delta_distance_us , packet1.distance ); mavlink_msg_optical_flow_rad_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("OPTICAL_FLOW_RAD") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_OPTICAL_FLOW_RAD) != NULL); +#endif } static void mavlink_test_hil_sensor(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -4857,6 +5075,11 @@ static void mavlink_test_hil_sensor(uint8_t system_id, uint8_t component_id, mav mavlink_msg_hil_sensor_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag , packet1.abs_pressure , packet1.diff_pressure , packet1.pressure_alt , packet1.temperature , packet1.fields_updated , packet1.id ); mavlink_msg_hil_sensor_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("HIL_SENSOR") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_HIL_SENSOR) != NULL); +#endif } static void mavlink_test_sim_state(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -4871,7 +5094,7 @@ static void mavlink_test_sim_state(uint8_t system_id, uint8_t component_id, mavl uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; uint16_t i; mavlink_sim_state_t packet_in = { - 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,381.0,409.0,437.0,465.0,493.0,521.0,549.0,577.0 + 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,381.0,409.0,437.0,465.0,493.0,521.0,549.0,577.0,963501832,963502040 }; mavlink_sim_state_t packet1, packet2; memset(&packet1, 0, sizeof(packet1)); @@ -4896,6 +5119,8 @@ static void mavlink_test_sim_state(uint8_t system_id, uint8_t component_id, mavl packet1.vn = packet_in.vn; packet1.ve = packet_in.ve; packet1.vd = packet_in.vd; + packet1.lat_int = packet_in.lat_int; + packet1.lon_int = packet_in.lon_int; #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 @@ -4910,12 +5135,12 @@ static void mavlink_test_sim_state(uint8_t system_id, uint8_t component_id, mavl MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_sim_state_pack(system_id, component_id, &msg , packet1.q1 , packet1.q2 , packet1.q3 , packet1.q4 , packet1.roll , packet1.pitch , packet1.yaw , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.lat , packet1.lon , packet1.alt , packet1.std_dev_horz , packet1.std_dev_vert , packet1.vn , packet1.ve , packet1.vd ); + mavlink_msg_sim_state_pack(system_id, component_id, &msg , packet1.q1 , packet1.q2 , packet1.q3 , packet1.q4 , packet1.roll , packet1.pitch , packet1.yaw , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.lat , packet1.lon , packet1.alt , packet1.std_dev_horz , packet1.std_dev_vert , packet1.vn , packet1.ve , packet1.vd , packet1.lat_int , packet1.lon_int ); mavlink_msg_sim_state_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_sim_state_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.q1 , packet1.q2 , packet1.q3 , packet1.q4 , packet1.roll , packet1.pitch , packet1.yaw , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.lat , packet1.lon , packet1.alt , packet1.std_dev_horz , packet1.std_dev_vert , packet1.vn , packet1.ve , packet1.vd ); + mavlink_msg_sim_state_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.q1 , packet1.q2 , packet1.q3 , packet1.q4 , packet1.roll , packet1.pitch , packet1.yaw , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.lat , packet1.lon , packet1.alt , packet1.std_dev_horz , packet1.std_dev_vert , packet1.vn , packet1.ve , packet1.vd , packet1.lat_int , packet1.lon_int ); mavlink_msg_sim_state_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); @@ -4928,9 +5153,14 @@ static void mavlink_test_sim_state(uint8_t system_id, uint8_t component_id, mavl MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_sim_state_send(MAVLINK_COMM_1 , packet1.q1 , packet1.q2 , packet1.q3 , packet1.q4 , packet1.roll , packet1.pitch , packet1.yaw , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.lat , packet1.lon , packet1.alt , packet1.std_dev_horz , packet1.std_dev_vert , packet1.vn , packet1.ve , packet1.vd ); + mavlink_msg_sim_state_send(MAVLINK_COMM_1 , packet1.q1 , packet1.q2 , packet1.q3 , packet1.q4 , packet1.roll , packet1.pitch , packet1.yaw , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.lat , packet1.lon , packet1.alt , packet1.std_dev_horz , packet1.std_dev_vert , packet1.vn , packet1.ve , packet1.vd , packet1.lat_int , packet1.lon_int ); mavlink_msg_sim_state_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("SIM_STATE") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_SIM_STATE) != NULL); +#endif } static void mavlink_test_radio_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -4991,6 +5221,11 @@ static void mavlink_test_radio_status(uint8_t system_id, uint8_t component_id, m mavlink_msg_radio_status_send(MAVLINK_COMM_1 , packet1.rssi , packet1.remrssi , packet1.txbuf , packet1.noise , packet1.remnoise , packet1.rxerrors , packet1.fixed ); mavlink_msg_radio_status_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("RADIO_STATUS") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_RADIO_STATUS) != NULL); +#endif } static void mavlink_test_file_transfer_protocol(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -5048,6 +5283,11 @@ static void mavlink_test_file_transfer_protocol(uint8_t system_id, uint8_t compo mavlink_msg_file_transfer_protocol_send(MAVLINK_COMM_1 , packet1.target_network , packet1.target_system , packet1.target_component , packet1.payload ); mavlink_msg_file_transfer_protocol_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("FILE_TRANSFER_PROTOCOL") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL) != NULL); +#endif } static void mavlink_test_timesync(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -5062,12 +5302,14 @@ static void mavlink_test_timesync(uint8_t system_id, uint8_t component_id, mavli uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; uint16_t i; mavlink_timesync_t packet_in = { - 93372036854775807LL,93372036854776311LL + 93372036854775807LL,93372036854776311LL,53,120 }; mavlink_timesync_t packet1, packet2; memset(&packet1, 0, sizeof(packet1)); packet1.tc1 = packet_in.tc1; packet1.ts1 = packet_in.ts1; + packet1.target_system = packet_in.target_system; + packet1.target_component = packet_in.target_component; #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 @@ -5082,12 +5324,12 @@ static void mavlink_test_timesync(uint8_t system_id, uint8_t component_id, mavli MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_timesync_pack(system_id, component_id, &msg , packet1.tc1 , packet1.ts1 ); + mavlink_msg_timesync_pack(system_id, component_id, &msg , packet1.tc1 , packet1.ts1 , packet1.target_system , packet1.target_component ); mavlink_msg_timesync_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_timesync_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.tc1 , packet1.ts1 ); + mavlink_msg_timesync_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.tc1 , packet1.ts1 , packet1.target_system , packet1.target_component ); mavlink_msg_timesync_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); @@ -5100,9 +5342,14 @@ static void mavlink_test_timesync(uint8_t system_id, uint8_t component_id, mavli MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_timesync_send(MAVLINK_COMM_1 , packet1.tc1 , packet1.ts1 ); + mavlink_msg_timesync_send(MAVLINK_COMM_1 , packet1.tc1 , packet1.ts1 , packet1.target_system , packet1.target_component ); mavlink_msg_timesync_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("TIMESYNC") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_TIMESYNC) != NULL); +#endif } static void mavlink_test_camera_trigger(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -5158,6 +5405,11 @@ static void mavlink_test_camera_trigger(uint8_t system_id, uint8_t component_id, mavlink_msg_camera_trigger_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.seq ); mavlink_msg_camera_trigger_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("CAMERA_TRIGGER") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_CAMERA_TRIGGER) != NULL); +#endif } static void mavlink_test_hil_gps(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -5226,6 +5478,11 @@ static void mavlink_test_hil_gps(uint8_t system_id, uint8_t component_id, mavlin mavlink_msg_hil_gps_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.eph , packet1.epv , packet1.vel , packet1.vn , packet1.ve , packet1.vd , packet1.cog , packet1.satellites_visible , packet1.id , packet1.yaw ); mavlink_msg_hil_gps_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("HIL_GPS") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_HIL_GPS) != NULL); +#endif } static void mavlink_test_hil_optical_flow(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -5291,6 +5548,11 @@ static void mavlink_test_hil_optical_flow(uint8_t system_id, uint8_t component_i mavlink_msg_hil_optical_flow_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.sensor_id , packet1.integration_time_us , packet1.integrated_x , packet1.integrated_y , packet1.integrated_xgyro , packet1.integrated_ygyro , packet1.integrated_zgyro , packet1.temperature , packet1.quality , packet1.time_delta_distance_us , packet1.distance ); mavlink_msg_hil_optical_flow_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("HIL_OPTICAL_FLOW") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_HIL_OPTICAL_FLOW) != NULL); +#endif } static void mavlink_test_hil_state_quaternion(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -5360,6 +5622,11 @@ static void mavlink_test_hil_state_quaternion(uint8_t system_id, uint8_t compone mavlink_msg_hil_state_quaternion_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.attitude_quaternion , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.lat , packet1.lon , packet1.alt , packet1.vx , packet1.vy , packet1.vz , packet1.ind_airspeed , packet1.true_airspeed , packet1.xacc , packet1.yacc , packet1.zacc ); mavlink_msg_hil_state_quaternion_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("HIL_STATE_QUATERNION") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_HIL_STATE_QUATERNION) != NULL); +#endif } static void mavlink_test_scaled_imu2(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -5424,6 +5691,11 @@ static void mavlink_test_scaled_imu2(uint8_t system_id, uint8_t component_id, ma mavlink_msg_scaled_imu2_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 , packet1.temperature ); mavlink_msg_scaled_imu2_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("SCALED_IMU2") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_SCALED_IMU2) != NULL); +#endif } static void mavlink_test_log_request_list(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -5481,6 +5753,11 @@ static void mavlink_test_log_request_list(uint8_t system_id, uint8_t component_i mavlink_msg_log_request_list_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.start , packet1.end ); mavlink_msg_log_request_list_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("LOG_REQUEST_LIST") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_LOG_REQUEST_LIST) != NULL); +#endif } static void mavlink_test_log_entry(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -5539,6 +5816,11 @@ static void mavlink_test_log_entry(uint8_t system_id, uint8_t component_id, mavl mavlink_msg_log_entry_send(MAVLINK_COMM_1 , packet1.id , packet1.num_logs , packet1.last_log_num , packet1.time_utc , packet1.size ); mavlink_msg_log_entry_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("LOG_ENTRY") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_LOG_ENTRY) != NULL); +#endif } static void mavlink_test_log_request_data(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -5597,6 +5879,11 @@ static void mavlink_test_log_request_data(uint8_t system_id, uint8_t component_i mavlink_msg_log_request_data_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.id , packet1.ofs , packet1.count ); mavlink_msg_log_request_data_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("LOG_REQUEST_DATA") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_LOG_REQUEST_DATA) != NULL); +#endif } static void mavlink_test_log_data(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -5654,6 +5941,11 @@ static void mavlink_test_log_data(uint8_t system_id, uint8_t component_id, mavli mavlink_msg_log_data_send(MAVLINK_COMM_1 , packet1.id , packet1.ofs , packet1.count , packet1.data ); mavlink_msg_log_data_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("LOG_DATA") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_LOG_DATA) != NULL); +#endif } static void mavlink_test_log_erase(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -5709,6 +6001,11 @@ static void mavlink_test_log_erase(uint8_t system_id, uint8_t component_id, mavl mavlink_msg_log_erase_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component ); mavlink_msg_log_erase_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("LOG_ERASE") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_LOG_ERASE) != NULL); +#endif } static void mavlink_test_log_request_end(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -5764,6 +6061,11 @@ static void mavlink_test_log_request_end(uint8_t system_id, uint8_t component_id mavlink_msg_log_request_end_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component ); mavlink_msg_log_request_end_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("LOG_REQUEST_END") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_LOG_REQUEST_END) != NULL); +#endif } static void mavlink_test_gps_inject_data(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -5821,6 +6123,11 @@ static void mavlink_test_gps_inject_data(uint8_t system_id, uint8_t component_id mavlink_msg_gps_inject_data_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.len , packet1.data ); mavlink_msg_gps_inject_data_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("GPS_INJECT_DATA") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_GPS_INJECT_DATA) != NULL); +#endif } static void mavlink_test_gps2_raw(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -5835,7 +6142,7 @@ static void mavlink_test_gps2_raw(uint8_t system_id, uint8_t component_id, mavli uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; uint16_t i; mavlink_gps2_raw_t packet_in = { - 93372036854775807ULL,963497880,963498088,963498296,963498504,18483,18587,18691,18795,101,168,235,19055 + 93372036854775807ULL,963497880,963498088,963498296,963498504,18483,18587,18691,18795,101,168,235,19055,963499388,963499596,963499804,963500012,963500220 }; mavlink_gps2_raw_t packet1, packet2; memset(&packet1, 0, sizeof(packet1)); @@ -5852,6 +6159,11 @@ static void mavlink_test_gps2_raw(uint8_t system_id, uint8_t component_id, mavli packet1.satellites_visible = packet_in.satellites_visible; packet1.dgps_numch = packet_in.dgps_numch; packet1.yaw = packet_in.yaw; + packet1.alt_ellipsoid = packet_in.alt_ellipsoid; + packet1.h_acc = packet_in.h_acc; + packet1.v_acc = packet_in.v_acc; + packet1.vel_acc = packet_in.vel_acc; + packet1.hdg_acc = packet_in.hdg_acc; #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 @@ -5866,12 +6178,12 @@ static void mavlink_test_gps2_raw(uint8_t system_id, uint8_t component_id, mavli MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gps2_raw_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 , packet1.dgps_numch , packet1.dgps_age , packet1.yaw ); + mavlink_msg_gps2_raw_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 , packet1.dgps_numch , packet1.dgps_age , packet1.yaw , packet1.alt_ellipsoid , packet1.h_acc , packet1.v_acc , packet1.vel_acc , packet1.hdg_acc ); mavlink_msg_gps2_raw_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gps2_raw_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 , packet1.dgps_numch , packet1.dgps_age , packet1.yaw ); + mavlink_msg_gps2_raw_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 , packet1.dgps_numch , packet1.dgps_age , packet1.yaw , packet1.alt_ellipsoid , packet1.h_acc , packet1.v_acc , packet1.vel_acc , packet1.hdg_acc ); mavlink_msg_gps2_raw_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); @@ -5884,9 +6196,14 @@ static void mavlink_test_gps2_raw(uint8_t system_id, uint8_t component_id, mavli MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gps2_raw_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 , packet1.dgps_numch , packet1.dgps_age , packet1.yaw ); + mavlink_msg_gps2_raw_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 , packet1.dgps_numch , packet1.dgps_age , packet1.yaw , packet1.alt_ellipsoid , packet1.h_acc , packet1.v_acc , packet1.vel_acc , packet1.hdg_acc ); mavlink_msg_gps2_raw_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("GPS2_RAW") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_GPS2_RAW) != NULL); +#endif } static void mavlink_test_power_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -5943,6 +6260,11 @@ static void mavlink_test_power_status(uint8_t system_id, uint8_t component_id, m mavlink_msg_power_status_send(MAVLINK_COMM_1 , packet1.Vcc , packet1.Vservo , packet1.flags ); mavlink_msg_power_status_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("POWER_STATUS") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_POWER_STATUS) != NULL); +#endif } static void mavlink_test_serial_control(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -5957,7 +6279,7 @@ static void mavlink_test_serial_control(uint8_t system_id, uint8_t component_id, uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; uint16_t i; mavlink_serial_control_t packet_in = { - 963497464,17443,151,218,29,{ 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165 } + 963497464,17443,151,218,29,{ 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165 },178,245 }; mavlink_serial_control_t packet1, packet2; memset(&packet1, 0, sizeof(packet1)); @@ -5966,6 +6288,8 @@ static void mavlink_test_serial_control(uint8_t system_id, uint8_t component_id, packet1.device = packet_in.device; packet1.flags = packet_in.flags; packet1.count = packet_in.count; + packet1.target_system = packet_in.target_system; + packet1.target_component = packet_in.target_component; mav_array_memcpy(packet1.data, packet_in.data, sizeof(uint8_t)*70); @@ -5981,12 +6305,12 @@ static void mavlink_test_serial_control(uint8_t system_id, uint8_t component_id, MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_control_pack(system_id, component_id, &msg , packet1.device , packet1.flags , packet1.timeout , packet1.baudrate , packet1.count , packet1.data ); + mavlink_msg_serial_control_pack(system_id, component_id, &msg , packet1.device , packet1.flags , packet1.timeout , packet1.baudrate , packet1.count , packet1.data , packet1.target_system , packet1.target_component ); mavlink_msg_serial_control_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_control_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.device , packet1.flags , packet1.timeout , packet1.baudrate , packet1.count , packet1.data ); + mavlink_msg_serial_control_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.device , packet1.flags , packet1.timeout , packet1.baudrate , packet1.count , packet1.data , packet1.target_system , packet1.target_component ); mavlink_msg_serial_control_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); @@ -5999,9 +6323,14 @@ static void mavlink_test_serial_control(uint8_t system_id, uint8_t component_id, MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_control_send(MAVLINK_COMM_1 , packet1.device , packet1.flags , packet1.timeout , packet1.baudrate , packet1.count , packet1.data ); + mavlink_msg_serial_control_send(MAVLINK_COMM_1 , packet1.device , packet1.flags , packet1.timeout , packet1.baudrate , packet1.count , packet1.data , packet1.target_system , packet1.target_component ); mavlink_msg_serial_control_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("SERIAL_CONTROL") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_SERIAL_CONTROL) != NULL); +#endif } static void mavlink_test_gps_rtk(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -6068,6 +6397,11 @@ static void mavlink_test_gps_rtk(uint8_t system_id, uint8_t component_id, mavlin mavlink_msg_gps_rtk_send(MAVLINK_COMM_1 , packet1.time_last_baseline_ms , packet1.rtk_receiver_id , packet1.wn , packet1.tow , packet1.rtk_health , packet1.rtk_rate , packet1.nsats , packet1.baseline_coords_type , packet1.baseline_a_mm , packet1.baseline_b_mm , packet1.baseline_c_mm , packet1.accuracy , packet1.iar_num_hypotheses ); mavlink_msg_gps_rtk_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("GPS_RTK") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_GPS_RTK) != NULL); +#endif } static void mavlink_test_gps2_rtk(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -6134,6 +6468,11 @@ static void mavlink_test_gps2_rtk(uint8_t system_id, uint8_t component_id, mavli mavlink_msg_gps2_rtk_send(MAVLINK_COMM_1 , packet1.time_last_baseline_ms , packet1.rtk_receiver_id , packet1.wn , packet1.tow , packet1.rtk_health , packet1.rtk_rate , packet1.nsats , packet1.baseline_coords_type , packet1.baseline_a_mm , packet1.baseline_b_mm , packet1.baseline_c_mm , packet1.accuracy , packet1.iar_num_hypotheses ); mavlink_msg_gps2_rtk_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("GPS2_RTK") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_GPS2_RTK) != NULL); +#endif } static void mavlink_test_scaled_imu3(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -6198,6 +6537,11 @@ static void mavlink_test_scaled_imu3(uint8_t system_id, uint8_t component_id, ma mavlink_msg_scaled_imu3_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 , packet1.temperature ); mavlink_msg_scaled_imu3_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("SCALED_IMU3") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_SCALED_IMU3) != NULL); +#endif } static void mavlink_test_data_transmission_handshake(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -6258,6 +6602,11 @@ static void mavlink_test_data_transmission_handshake(uint8_t system_id, uint8_t mavlink_msg_data_transmission_handshake_send(MAVLINK_COMM_1 , packet1.type , packet1.size , packet1.width , packet1.height , packet1.packets , packet1.payload , packet1.jpg_quality ); mavlink_msg_data_transmission_handshake_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("DATA_TRANSMISSION_HANDSHAKE") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE) != NULL); +#endif } static void mavlink_test_encapsulated_data(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -6313,6 +6662,11 @@ static void mavlink_test_encapsulated_data(uint8_t system_id, uint8_t component_ mavlink_msg_encapsulated_data_send(MAVLINK_COMM_1 , packet1.seqnr , packet1.data ); mavlink_msg_encapsulated_data_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("ENCAPSULATED_DATA") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_ENCAPSULATED_DATA) != NULL); +#endif } static void mavlink_test_distance_sensor(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -6378,6 +6732,11 @@ static void mavlink_test_distance_sensor(uint8_t system_id, uint8_t component_id mavlink_msg_distance_sensor_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.min_distance , packet1.max_distance , packet1.current_distance , packet1.type , packet1.id , packet1.orientation , packet1.covariance , packet1.horizontal_fov , packet1.vertical_fov , packet1.quaternion , packet1.signal_quality ); mavlink_msg_distance_sensor_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("DISTANCE_SENSOR") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_DISTANCE_SENSOR) != NULL); +#endif } static void mavlink_test_terrain_request(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -6435,6 +6794,11 @@ static void mavlink_test_terrain_request(uint8_t system_id, uint8_t component_id mavlink_msg_terrain_request_send(MAVLINK_COMM_1 , packet1.lat , packet1.lon , packet1.grid_spacing , packet1.mask ); mavlink_msg_terrain_request_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("TERRAIN_REQUEST") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_TERRAIN_REQUEST) != NULL); +#endif } static void mavlink_test_terrain_data(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -6493,6 +6857,11 @@ static void mavlink_test_terrain_data(uint8_t system_id, uint8_t component_id, m mavlink_msg_terrain_data_send(MAVLINK_COMM_1 , packet1.lat , packet1.lon , packet1.grid_spacing , packet1.gridbit , packet1.data ); mavlink_msg_terrain_data_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("TERRAIN_DATA") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_TERRAIN_DATA) != NULL); +#endif } static void mavlink_test_terrain_check(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -6548,6 +6917,11 @@ static void mavlink_test_terrain_check(uint8_t system_id, uint8_t component_id, mavlink_msg_terrain_check_send(MAVLINK_COMM_1 , packet1.lat , packet1.lon ); mavlink_msg_terrain_check_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("TERRAIN_CHECK") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_TERRAIN_CHECK) != NULL); +#endif } static void mavlink_test_terrain_report(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -6608,6 +6982,11 @@ static void mavlink_test_terrain_report(uint8_t system_id, uint8_t component_id, mavlink_msg_terrain_report_send(MAVLINK_COMM_1 , packet1.lat , packet1.lon , packet1.spacing , packet1.terrain_height , packet1.current_height , packet1.pending , packet1.loaded ); mavlink_msg_terrain_report_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("TERRAIN_REPORT") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_TERRAIN_REPORT) != NULL); +#endif } static void mavlink_test_scaled_pressure2(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -6666,6 +7045,11 @@ static void mavlink_test_scaled_pressure2(uint8_t system_id, uint8_t component_i mavlink_msg_scaled_pressure2_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.press_abs , packet1.press_diff , packet1.temperature , packet1.temperature_press_diff ); mavlink_msg_scaled_pressure2_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("SCALED_PRESSURE2") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_SCALED_PRESSURE2) != NULL); +#endif } static void mavlink_test_att_pos_mocap(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -6725,6 +7109,11 @@ static void mavlink_test_att_pos_mocap(uint8_t system_id, uint8_t component_id, mavlink_msg_att_pos_mocap_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.q , packet1.x , packet1.y , packet1.z , packet1.covariance ); mavlink_msg_att_pos_mocap_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("ATT_POS_MOCAP") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_ATT_POS_MOCAP) != NULL); +#endif } static void mavlink_test_set_actuator_control_target(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -6783,6 +7172,11 @@ static void mavlink_test_set_actuator_control_target(uint8_t system_id, uint8_t mavlink_msg_set_actuator_control_target_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.group_mlx , packet1.target_system , packet1.target_component , packet1.controls ); mavlink_msg_set_actuator_control_target_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("SET_ACTUATOR_CONTROL_TARGET") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET) != NULL); +#endif } static void mavlink_test_actuator_control_target(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -6839,6 +7233,11 @@ static void mavlink_test_actuator_control_target(uint8_t system_id, uint8_t comp mavlink_msg_actuator_control_target_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.group_mlx , packet1.controls ); mavlink_msg_actuator_control_target_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("ACTUATOR_CONTROL_TARGET") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET) != NULL); +#endif } static void mavlink_test_altitude(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -6899,6 +7298,11 @@ static void mavlink_test_altitude(uint8_t system_id, uint8_t component_id, mavli mavlink_msg_altitude_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.altitude_monotonic , packet1.altitude_amsl , packet1.altitude_local , packet1.altitude_relative , packet1.altitude_terrain , packet1.bottom_clearance ); mavlink_msg_altitude_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("ALTITUDE") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_ALTITUDE) != NULL); +#endif } static void mavlink_test_resource_request(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -6957,6 +7361,11 @@ static void mavlink_test_resource_request(uint8_t system_id, uint8_t component_i mavlink_msg_resource_request_send(MAVLINK_COMM_1 , packet1.request_id , packet1.uri_type , packet1.uri , packet1.transfer_type , packet1.storage ); mavlink_msg_resource_request_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("RESOURCE_REQUEST") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_RESOURCE_REQUEST) != NULL); +#endif } static void mavlink_test_scaled_pressure3(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -7015,6 +7424,11 @@ static void mavlink_test_scaled_pressure3(uint8_t system_id, uint8_t component_i mavlink_msg_scaled_pressure3_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.press_abs , packet1.press_diff , packet1.temperature , packet1.temperature_press_diff ); mavlink_msg_scaled_pressure3_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("SCALED_PRESSURE3") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_SCALED_PRESSURE3) != NULL); +#endif } static void mavlink_test_follow_target(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -7079,6 +7493,11 @@ static void mavlink_test_follow_target(uint8_t system_id, uint8_t component_id, mavlink_msg_follow_target_send(MAVLINK_COMM_1 , packet1.timestamp , packet1.est_capabilities , packet1.lat , packet1.lon , packet1.alt , packet1.vel , packet1.acc , packet1.attitude_q , packet1.rates , packet1.position_cov , packet1.custom_state ); mavlink_msg_follow_target_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("FOLLOW_TARGET") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_FOLLOW_TARGET) != NULL); +#endif } static void mavlink_test_control_system_state(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -7149,6 +7568,11 @@ static void mavlink_test_control_system_state(uint8_t system_id, uint8_t compone mavlink_msg_control_system_state_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.x_acc , packet1.y_acc , packet1.z_acc , packet1.x_vel , packet1.y_vel , packet1.z_vel , packet1.x_pos , packet1.y_pos , packet1.z_pos , packet1.airspeed , packet1.vel_variance , packet1.pos_variance , packet1.q , packet1.roll_rate , packet1.pitch_rate , packet1.yaw_rate ); mavlink_msg_control_system_state_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("CONTROL_SYSTEM_STATE") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE) != NULL); +#endif } static void mavlink_test_battery_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -7216,71 +7640,11 @@ static void mavlink_test_battery_status(uint8_t system_id, uint8_t component_id, mavlink_msg_battery_status_send(MAVLINK_COMM_1 , packet1.id , packet1.battery_function , packet1.type , packet1.temperature , packet1.voltages , packet1.current_battery , packet1.current_consumed , packet1.energy_consumed , packet1.battery_remaining , packet1.time_remaining , packet1.charge_state , packet1.voltages_ext , packet1.mode , packet1.fault_bitmask ); mavlink_msg_battery_status_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); -} -static void mavlink_test_autopilot_version(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) -{ -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); - if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_AUTOPILOT_VERSION >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_autopilot_version_t packet_in = { - 93372036854775807ULL,93372036854776311ULL,963498296,963498504,963498712,963498920,18899,19003,{ 113, 114, 115, 116, 117, 118, 119, 120 },{ 137, 138, 139, 140, 141, 142, 143, 144 },{ 161, 162, 163, 164, 165, 166, 167, 168 },{ 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202 } - }; - mavlink_autopilot_version_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.capabilities = packet_in.capabilities; - packet1.uid = packet_in.uid; - packet1.flight_sw_version = packet_in.flight_sw_version; - packet1.middleware_sw_version = packet_in.middleware_sw_version; - packet1.os_sw_version = packet_in.os_sw_version; - packet1.board_version = packet_in.board_version; - packet1.vendor_id = packet_in.vendor_id; - packet1.product_id = packet_in.product_id; - - mav_array_memcpy(packet1.flight_custom_version, packet_in.flight_custom_version, sizeof(uint8_t)*8); - mav_array_memcpy(packet1.middleware_custom_version, packet_in.middleware_custom_version, sizeof(uint8_t)*8); - mav_array_memcpy(packet1.os_custom_version, packet_in.os_custom_version, sizeof(uint8_t)*8); - mav_array_memcpy(packet1.uid2, packet_in.uid2, sizeof(uint8_t)*18); - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_AUTOPILOT_VERSION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_AUTOPILOT_VERSION_MIN_LEN); - } +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("BATTERY_STATUS") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_BATTERY_STATUS) != NULL); #endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_autopilot_version_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_autopilot_version_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_autopilot_version_pack(system_id, component_id, &msg , packet1.capabilities , packet1.flight_sw_version , packet1.middleware_sw_version , packet1.os_sw_version , packet1.board_version , packet1.flight_custom_version , packet1.middleware_custom_version , packet1.os_custom_version , packet1.vendor_id , packet1.product_id , packet1.uid , packet1.uid2 ); - mavlink_msg_autopilot_version_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_autopilot_version_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.capabilities , packet1.flight_sw_version , packet1.middleware_sw_version , packet1.os_sw_version , packet1.board_version , packet1.flight_custom_version , packet1.middleware_custom_version , packet1.os_custom_version , packet1.vendor_id , packet1.product_id , packet1.uid , packet1.uid2 ); - mavlink_msg_autopilot_version_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GIMBAL_MANAGER_INFORMATION >= 256) { + if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE >= 256) { return; } #endif mavlink_message_t msg; uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; uint16_t i; - mavlink_gimbal_manager_information_t packet_in = { - 963497464,963497672,73.0,101.0,129.0,157.0,185.0,213.0,101 + mavlink_camera_thermal_range_t packet_in = { + 963497464,45.0,73.0,101.0,129.0,157.0,185.0,89,156 }; - mavlink_gimbal_manager_information_t packet1, packet2; + mavlink_camera_thermal_range_t packet1, packet2; memset(&packet1, 0, sizeof(packet1)); packet1.time_boot_ms = packet_in.time_boot_ms; - packet1.cap_flags = packet_in.cap_flags; - packet1.roll_min = packet_in.roll_min; - packet1.roll_max = packet_in.roll_max; - packet1.pitch_min = packet_in.pitch_min; - packet1.pitch_max = packet_in.pitch_max; - packet1.yaw_min = packet_in.yaw_min; - packet1.yaw_max = packet_in.yaw_max; - packet1.gimbal_device_id = packet_in.gimbal_device_id; + packet1.max = packet_in.max; + packet1.max_point_x = packet_in.max_point_x; + packet1.max_point_y = packet_in.max_point_y; + packet1.min = packet_in.min; + packet1.min_point_x = packet_in.min_point_x; + packet1.min_point_y = packet_in.min_point_y; + packet1.stream_id = packet_in.stream_id; + packet1.camera_device_id = packet_in.camera_device_id; #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { // cope with extensions - memset(MAVLINK_MSG_ID_GIMBAL_MANAGER_INFORMATION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GIMBAL_MANAGER_INFORMATION_MIN_LEN); + memset(MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_CAMERA_THERMAL_RANGE_MIN_LEN); } #endif memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gimbal_manager_information_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_gimbal_manager_information_decode(&msg, &packet2); + mavlink_msg_camera_thermal_range_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_camera_thermal_range_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gimbal_manager_information_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.cap_flags , packet1.gimbal_device_id , packet1.roll_min , packet1.roll_max , packet1.pitch_min , packet1.pitch_max , packet1.yaw_min , packet1.yaw_max ); - mavlink_msg_gimbal_manager_information_decode(&msg, &packet2); + mavlink_msg_camera_thermal_range_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.stream_id , packet1.camera_device_id , packet1.max , packet1.max_point_x , packet1.max_point_y , packet1.min , packet1.min_point_x , packet1.min_point_y ); + mavlink_msg_camera_thermal_range_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gimbal_manager_information_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.cap_flags , packet1.gimbal_device_id , packet1.roll_min , packet1.roll_max , packet1.pitch_min , packet1.pitch_max , packet1.yaw_min , packet1.yaw_max ); - mavlink_msg_gimbal_manager_information_decode(&msg, &packet2); + mavlink_msg_camera_thermal_range_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.stream_id , packet1.camera_device_id , packet1.max , packet1.max_point_x , packet1.max_point_y , packet1.min , packet1.min_point_x , packet1.min_point_y ); + mavlink_msg_camera_thermal_range_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GIMBAL_MANAGER_INFORMATION >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_gimbal_manager_information_t packet_in = { + 963497464,963497672,73.0,101.0,129.0,157.0,185.0,213.0,101 + }; + mavlink_gimbal_manager_information_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.time_boot_ms = packet_in.time_boot_ms; + packet1.cap_flags = packet_in.cap_flags; + packet1.roll_min = packet_in.roll_min; + packet1.roll_max = packet_in.roll_max; + packet1.pitch_min = packet_in.pitch_min; + packet1.pitch_max = packet_in.pitch_max; + packet1.yaw_min = packet_in.yaw_min; + packet1.yaw_max = packet_in.yaw_max; + packet1.gimbal_device_id = packet_in.gimbal_device_id; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_GIMBAL_MANAGER_INFORMATION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GIMBAL_MANAGER_INFORMATION_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_gimbal_manager_information_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_gimbal_manager_information_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_gimbal_manager_information_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.cap_flags , packet1.gimbal_device_id , packet1.roll_min , packet1.roll_max , packet1.pitch_min , packet1.pitch_max , packet1.yaw_min , packet1.yaw_max ); + mavlink_msg_gimbal_manager_information_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_gimbal_manager_information_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.cap_flags , packet1.gimbal_device_id , packet1.roll_min , packet1.roll_max , packet1.pitch_min , packet1.pitch_max , packet1.yaw_min , packet1.yaw_max ); + mavlink_msg_gimbal_manager_information_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); @@ -9930,6 +10585,11 @@ static void mavlink_test_gimbal_manager_information(uint8_t system_id, uint8_t c mavlink_msg_gimbal_manager_information_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.cap_flags , packet1.gimbal_device_id , packet1.roll_min , packet1.roll_max , packet1.pitch_min , packet1.pitch_max , packet1.yaw_min , packet1.yaw_max ); mavlink_msg_gimbal_manager_information_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("GIMBAL_MANAGER_INFORMATION") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_GIMBAL_MANAGER_INFORMATION) != NULL); +#endif } static void mavlink_test_gimbal_manager_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -9990,6 +10650,11 @@ static void mavlink_test_gimbal_manager_status(uint8_t system_id, uint8_t compon mavlink_msg_gimbal_manager_status_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.flags , packet1.gimbal_device_id , packet1.primary_control_sysid , packet1.primary_control_compid , packet1.secondary_control_sysid , packet1.secondary_control_compid ); mavlink_msg_gimbal_manager_status_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("GIMBAL_MANAGER_STATUS") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS) != NULL); +#endif } static void mavlink_test_gimbal_manager_set_attitude(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -10051,6 +10716,11 @@ static void mavlink_test_gimbal_manager_set_attitude(uint8_t system_id, uint8_t mavlink_msg_gimbal_manager_set_attitude_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.flags , packet1.gimbal_device_id , packet1.q , packet1.angular_velocity_x , packet1.angular_velocity_y , packet1.angular_velocity_z ); mavlink_msg_gimbal_manager_set_attitude_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("GIMBAL_MANAGER_SET_ATTITUDE") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_ATTITUDE) != NULL); +#endif } static void mavlink_test_gimbal_device_information(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -10065,7 +10735,7 @@ static void mavlink_test_gimbal_device_information(uint8_t system_id, uint8_t co uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; uint16_t i; mavlink_gimbal_device_information_t packet_in = { - 93372036854775807ULL,963497880,963498088,963498296,157.0,185.0,213.0,241.0,269.0,297.0,19523,19627,"WXYZABCDEFGHIJKLMNOPQRSTUVWXYZA","CDEFGHIJKLMNOPQRSTUVWXYZABCDEFG","IJKLMNOPQRSTUVWXYZABCDEFGHIJKLM" + 93372036854775807ULL,963497880,963498088,963498296,157.0,185.0,213.0,241.0,269.0,297.0,19523,19627,"WXYZABCDEFGHIJKLMNOPQRSTUVWXYZA","CDEFGHIJKLMNOPQRSTUVWXYZABCDEFG","IJKLMNOPQRSTUVWXYZABCDEFGHIJKLM",181 }; mavlink_gimbal_device_information_t packet1, packet2; memset(&packet1, 0, sizeof(packet1)); @@ -10081,6 +10751,7 @@ static void mavlink_test_gimbal_device_information(uint8_t system_id, uint8_t co packet1.yaw_max = packet_in.yaw_max; packet1.cap_flags = packet_in.cap_flags; packet1.custom_cap_flags = packet_in.custom_cap_flags; + packet1.gimbal_device_id = packet_in.gimbal_device_id; mav_array_memcpy(packet1.vendor_name, packet_in.vendor_name, sizeof(char)*32); mav_array_memcpy(packet1.model_name, packet_in.model_name, sizeof(char)*32); @@ -10098,12 +10769,12 @@ static void mavlink_test_gimbal_device_information(uint8_t system_id, uint8_t co MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gimbal_device_information_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.vendor_name , packet1.model_name , packet1.custom_name , packet1.firmware_version , packet1.hardware_version , packet1.uid , packet1.cap_flags , packet1.custom_cap_flags , packet1.roll_min , packet1.roll_max , packet1.pitch_min , packet1.pitch_max , packet1.yaw_min , packet1.yaw_max ); + mavlink_msg_gimbal_device_information_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.vendor_name , packet1.model_name , packet1.custom_name , packet1.firmware_version , packet1.hardware_version , packet1.uid , packet1.cap_flags , packet1.custom_cap_flags , packet1.roll_min , packet1.roll_max , packet1.pitch_min , packet1.pitch_max , packet1.yaw_min , packet1.yaw_max , packet1.gimbal_device_id ); mavlink_msg_gimbal_device_information_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gimbal_device_information_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.vendor_name , packet1.model_name , packet1.custom_name , packet1.firmware_version , packet1.hardware_version , packet1.uid , packet1.cap_flags , packet1.custom_cap_flags , packet1.roll_min , packet1.roll_max , packet1.pitch_min , packet1.pitch_max , packet1.yaw_min , packet1.yaw_max ); + mavlink_msg_gimbal_device_information_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.vendor_name , packet1.model_name , packet1.custom_name , packet1.firmware_version , packet1.hardware_version , packet1.uid , packet1.cap_flags , packet1.custom_cap_flags , packet1.roll_min , packet1.roll_max , packet1.pitch_min , packet1.pitch_max , packet1.yaw_min , packet1.yaw_max , packet1.gimbal_device_id ); mavlink_msg_gimbal_device_information_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); @@ -10116,9 +10787,14 @@ static void mavlink_test_gimbal_device_information(uint8_t system_id, uint8_t co MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gimbal_device_information_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.vendor_name , packet1.model_name , packet1.custom_name , packet1.firmware_version , packet1.hardware_version , packet1.uid , packet1.cap_flags , packet1.custom_cap_flags , packet1.roll_min , packet1.roll_max , packet1.pitch_min , packet1.pitch_max , packet1.yaw_min , packet1.yaw_max ); + mavlink_msg_gimbal_device_information_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.vendor_name , packet1.model_name , packet1.custom_name , packet1.firmware_version , packet1.hardware_version , packet1.uid , packet1.cap_flags , packet1.custom_cap_flags , packet1.roll_min , packet1.roll_max , packet1.pitch_min , packet1.pitch_max , packet1.yaw_min , packet1.yaw_max , packet1.gimbal_device_id ); mavlink_msg_gimbal_device_information_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("GIMBAL_DEVICE_INFORMATION") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION) != NULL); +#endif } static void mavlink_test_gimbal_device_set_attitude(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -10179,6 +10855,11 @@ static void mavlink_test_gimbal_device_set_attitude(uint8_t system_id, uint8_t c mavlink_msg_gimbal_device_set_attitude_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.flags , packet1.q , packet1.angular_velocity_x , packet1.angular_velocity_y , packet1.angular_velocity_z ); mavlink_msg_gimbal_device_set_attitude_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("GIMBAL_DEVICE_SET_ATTITUDE") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_GIMBAL_DEVICE_SET_ATTITUDE) != NULL); +#endif } static void mavlink_test_gimbal_device_attitude_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -10193,7 +10874,7 @@ static void mavlink_test_gimbal_device_attitude_status(uint8_t system_id, uint8_ uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; uint16_t i; mavlink_gimbal_device_attitude_status_t packet_in = { - 963497464,{ 45.0, 46.0, 47.0, 48.0 },157.0,185.0,213.0,963499128,19107,247,58 + 963497464,{ 45.0, 46.0, 47.0, 48.0 },157.0,185.0,213.0,963499128,19107,247,58,297.0,325.0,149 }; mavlink_gimbal_device_attitude_status_t packet1, packet2; memset(&packet1, 0, sizeof(packet1)); @@ -10205,6 +10886,9 @@ static void mavlink_test_gimbal_device_attitude_status(uint8_t system_id, uint8_ packet1.flags = packet_in.flags; packet1.target_system = packet_in.target_system; packet1.target_component = packet_in.target_component; + packet1.delta_yaw = packet_in.delta_yaw; + packet1.delta_yaw_velocity = packet_in.delta_yaw_velocity; + packet1.gimbal_device_id = packet_in.gimbal_device_id; mav_array_memcpy(packet1.q, packet_in.q, sizeof(float)*4); @@ -10220,12 +10904,12 @@ static void mavlink_test_gimbal_device_attitude_status(uint8_t system_id, uint8_ MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gimbal_device_attitude_status_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.time_boot_ms , packet1.flags , packet1.q , packet1.angular_velocity_x , packet1.angular_velocity_y , packet1.angular_velocity_z , packet1.failure_flags ); + mavlink_msg_gimbal_device_attitude_status_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.time_boot_ms , packet1.flags , packet1.q , packet1.angular_velocity_x , packet1.angular_velocity_y , packet1.angular_velocity_z , packet1.failure_flags , packet1.delta_yaw , packet1.delta_yaw_velocity , packet1.gimbal_device_id ); mavlink_msg_gimbal_device_attitude_status_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gimbal_device_attitude_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.time_boot_ms , packet1.flags , packet1.q , packet1.angular_velocity_x , packet1.angular_velocity_y , packet1.angular_velocity_z , packet1.failure_flags ); + mavlink_msg_gimbal_device_attitude_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.time_boot_ms , packet1.flags , packet1.q , packet1.angular_velocity_x , packet1.angular_velocity_y , packet1.angular_velocity_z , packet1.failure_flags , packet1.delta_yaw , packet1.delta_yaw_velocity , packet1.gimbal_device_id ); mavlink_msg_gimbal_device_attitude_status_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); @@ -10238,9 +10922,14 @@ static void mavlink_test_gimbal_device_attitude_status(uint8_t system_id, uint8_ MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_gimbal_device_attitude_status_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.time_boot_ms , packet1.flags , packet1.q , packet1.angular_velocity_x , packet1.angular_velocity_y , packet1.angular_velocity_z , packet1.failure_flags ); + mavlink_msg_gimbal_device_attitude_status_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.time_boot_ms , packet1.flags , packet1.q , packet1.angular_velocity_x , packet1.angular_velocity_y , packet1.angular_velocity_z , packet1.failure_flags , packet1.delta_yaw , packet1.delta_yaw_velocity , packet1.gimbal_device_id ); mavlink_msg_gimbal_device_attitude_status_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("GIMBAL_DEVICE_ATTITUDE_STATUS") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS) != NULL); +#endif } static void mavlink_test_autopilot_state_for_gimbal_device(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -10255,7 +10944,7 @@ static void mavlink_test_autopilot_state_for_gimbal_device(uint8_t system_id, ui uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; uint16_t i; mavlink_autopilot_state_for_gimbal_device_t packet_in = { - 93372036854775807ULL,{ 73.0, 74.0, 75.0, 76.0 },963498712,213.0,241.0,269.0,963499544,325.0,19731,27,94,161 + 93372036854775807ULL,{ 73.0, 74.0, 75.0, 76.0 },963498712,213.0,241.0,269.0,963499544,325.0,19731,27,94,161,388.0 }; mavlink_autopilot_state_for_gimbal_device_t packet1, packet2; memset(&packet1, 0, sizeof(packet1)); @@ -10270,6 +10959,7 @@ static void mavlink_test_autopilot_state_for_gimbal_device(uint8_t system_id, ui packet1.target_system = packet_in.target_system; packet1.target_component = packet_in.target_component; packet1.landed_state = packet_in.landed_state; + packet1.angular_velocity_z = packet_in.angular_velocity_z; mav_array_memcpy(packet1.q, packet_in.q, sizeof(float)*4); @@ -10285,12 +10975,12 @@ static void mavlink_test_autopilot_state_for_gimbal_device(uint8_t system_id, ui MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_autopilot_state_for_gimbal_device_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.time_boot_us , packet1.q , packet1.q_estimated_delay_us , packet1.vx , packet1.vy , packet1.vz , packet1.v_estimated_delay_us , packet1.feed_forward_angular_velocity_z , packet1.estimator_status , packet1.landed_state ); + mavlink_msg_autopilot_state_for_gimbal_device_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.time_boot_us , packet1.q , packet1.q_estimated_delay_us , packet1.vx , packet1.vy , packet1.vz , packet1.v_estimated_delay_us , packet1.feed_forward_angular_velocity_z , packet1.estimator_status , packet1.landed_state , packet1.angular_velocity_z ); mavlink_msg_autopilot_state_for_gimbal_device_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_autopilot_state_for_gimbal_device_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.time_boot_us , packet1.q , packet1.q_estimated_delay_us , packet1.vx , packet1.vy , packet1.vz , packet1.v_estimated_delay_us , packet1.feed_forward_angular_velocity_z , packet1.estimator_status , packet1.landed_state ); + mavlink_msg_autopilot_state_for_gimbal_device_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.time_boot_us , packet1.q , packet1.q_estimated_delay_us , packet1.vx , packet1.vy , packet1.vz , packet1.v_estimated_delay_us , packet1.feed_forward_angular_velocity_z , packet1.estimator_status , packet1.landed_state , packet1.angular_velocity_z ); mavlink_msg_autopilot_state_for_gimbal_device_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); @@ -10303,9 +10993,14 @@ static void mavlink_test_autopilot_state_for_gimbal_device(uint8_t system_id, ui MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_autopilot_state_for_gimbal_device_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.time_boot_us , packet1.q , packet1.q_estimated_delay_us , packet1.vx , packet1.vy , packet1.vz , packet1.v_estimated_delay_us , packet1.feed_forward_angular_velocity_z , packet1.estimator_status , packet1.landed_state ); + mavlink_msg_autopilot_state_for_gimbal_device_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.time_boot_us , packet1.q , packet1.q_estimated_delay_us , packet1.vx , packet1.vy , packet1.vz , packet1.v_estimated_delay_us , packet1.feed_forward_angular_velocity_z , packet1.estimator_status , packet1.landed_state , packet1.angular_velocity_z ); mavlink_msg_autopilot_state_for_gimbal_device_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("AUTOPILOT_STATE_FOR_GIMBAL_DEVICE") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE) != NULL); +#endif } static void mavlink_test_gimbal_manager_set_pitchyaw(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -10367,6 +11062,11 @@ static void mavlink_test_gimbal_manager_set_pitchyaw(uint8_t system_id, uint8_t mavlink_msg_gimbal_manager_set_pitchyaw_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.flags , packet1.gimbal_device_id , packet1.pitch , packet1.yaw , packet1.pitch_rate , packet1.yaw_rate ); mavlink_msg_gimbal_manager_set_pitchyaw_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("GIMBAL_MANAGER_SET_PITCHYAW") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_PITCHYAW) != NULL); +#endif } static void mavlink_test_gimbal_manager_set_manual_control(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -10428,6 +11128,11 @@ static void mavlink_test_gimbal_manager_set_manual_control(uint8_t system_id, ui mavlink_msg_gimbal_manager_set_manual_control_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.flags , packet1.gimbal_device_id , packet1.pitch , packet1.yaw , packet1.pitch_rate , packet1.yaw_rate ); mavlink_msg_gimbal_manager_set_manual_control_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("GIMBAL_MANAGER_SET_MANUAL_CONTROL") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_MANUAL_CONTROL) != NULL); +#endif } static void mavlink_test_esc_info(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -10442,7 +11147,7 @@ static void mavlink_test_esc_info(uint8_t system_id, uint8_t component_id, mavli uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; uint16_t i; mavlink_esc_info_t packet_in = { - 93372036854775807ULL,{ 963497880, 963497881, 963497882, 963497883 },18483,{ 18587, 18588, 18589, 18590 },235,46,113,180,{ 247, 248, 249, 250 } + 93372036854775807ULL,{ 963497880, 963497881, 963497882, 963497883 },18483,{ 18587, 18588, 18589, 18590 },{ 19003, 19004, 19005, 19006 },3,70,137,204 }; mavlink_esc_info_t packet1, packet2; memset(&packet1, 0, sizeof(packet1)); @@ -10455,7 +11160,7 @@ static void mavlink_test_esc_info(uint8_t system_id, uint8_t component_id, mavli mav_array_memcpy(packet1.error_count, packet_in.error_count, sizeof(uint32_t)*4); mav_array_memcpy(packet1.failure_flags, packet_in.failure_flags, sizeof(uint16_t)*4); - mav_array_memcpy(packet1.temperature, packet_in.temperature, sizeof(uint8_t)*4); + mav_array_memcpy(packet1.temperature, packet_in.temperature, sizeof(int16_t)*4); #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { @@ -10490,6 +11195,11 @@ static void mavlink_test_esc_info(uint8_t system_id, uint8_t component_id, mavli mavlink_msg_esc_info_send(MAVLINK_COMM_1 , packet1.index , packet1.time_usec , packet1.counter , packet1.count , packet1.connection_type , packet1.info , packet1.failure_flags , packet1.error_count , packet1.temperature ); mavlink_msg_esc_info_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("ESC_INFO") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_ESC_INFO) != NULL); +#endif } static void mavlink_test_esc_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -10548,6 +11258,11 @@ static void mavlink_test_esc_status(uint8_t system_id, uint8_t component_id, mav mavlink_msg_esc_status_send(MAVLINK_COMM_1 , packet1.index , packet1.time_usec , packet1.rpm , packet1.voltage , packet1.current ); mavlink_msg_esc_status_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("ESC_STATUS") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_ESC_STATUS) != NULL); +#endif } static void mavlink_test_wifi_config_ap(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -10605,6 +11320,11 @@ static void mavlink_test_wifi_config_ap(uint8_t system_id, uint8_t component_id, mavlink_msg_wifi_config_ap_send(MAVLINK_COMM_1 , packet1.ssid , packet1.password , packet1.mode , packet1.response ); mavlink_msg_wifi_config_ap_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("WIFI_CONFIG_AP") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_WIFI_CONFIG_AP) != NULL); +#endif } static void mavlink_test_ais_vessel(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -10675,6 +11395,11 @@ static void mavlink_test_ais_vessel(uint8_t system_id, uint8_t component_id, mav mavlink_msg_ais_vessel_send(MAVLINK_COMM_1 , packet1.MMSI , packet1.lat , packet1.lon , packet1.COG , packet1.heading , packet1.velocity , packet1.turn_rate , packet1.navigational_status , packet1.type , packet1.dimension_bow , packet1.dimension_stern , packet1.dimension_port , packet1.dimension_starboard , packet1.callsign , packet1.name , packet1.tslc , packet1.flags ); mavlink_msg_ais_vessel_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("AIS_VESSEL") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_AIS_VESSEL) != NULL); +#endif } static void mavlink_test_uavcan_node_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -10734,6 +11459,11 @@ static void mavlink_test_uavcan_node_status(uint8_t system_id, uint8_t component mavlink_msg_uavcan_node_status_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.uptime_sec , packet1.health , packet1.mode , packet1.sub_mode , packet1.vendor_specific_status_code ); mavlink_msg_uavcan_node_status_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("UAVCAN_NODE_STATUS") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_UAVCAN_NODE_STATUS) != NULL); +#endif } static void mavlink_test_uavcan_node_info(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -10796,6 +11526,11 @@ static void mavlink_test_uavcan_node_info(uint8_t system_id, uint8_t component_i mavlink_msg_uavcan_node_info_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.uptime_sec , packet1.name , packet1.hw_version_major , packet1.hw_version_minor , packet1.hw_unique_id , packet1.sw_version_major , packet1.sw_version_minor , packet1.sw_vcs_commit ); mavlink_msg_uavcan_node_info_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("UAVCAN_NODE_INFO") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_UAVCAN_NODE_INFO) != NULL); +#endif } static void mavlink_test_param_ext_request_read(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -10853,6 +11588,11 @@ static void mavlink_test_param_ext_request_read(uint8_t system_id, uint8_t compo mavlink_msg_param_ext_request_read_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_index ); mavlink_msg_param_ext_request_read_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("PARAM_EXT_REQUEST_READ") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ) != NULL); +#endif } static void mavlink_test_param_ext_request_list(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -10908,6 +11648,11 @@ static void mavlink_test_param_ext_request_list(uint8_t system_id, uint8_t compo mavlink_msg_param_ext_request_list_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component ); mavlink_msg_param_ext_request_list_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("PARAM_EXT_REQUEST_LIST") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_PARAM_EXT_REQUEST_LIST) != NULL); +#endif } static void mavlink_test_param_ext_value(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -10966,6 +11711,11 @@ static void mavlink_test_param_ext_value(uint8_t system_id, uint8_t component_id mavlink_msg_param_ext_value_send(MAVLINK_COMM_1 , packet1.param_id , packet1.param_value , packet1.param_type , packet1.param_count , packet1.param_index ); mavlink_msg_param_ext_value_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("PARAM_EXT_VALUE") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_PARAM_EXT_VALUE) != NULL); +#endif } static void mavlink_test_param_ext_set(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -11024,6 +11774,11 @@ static void mavlink_test_param_ext_set(uint8_t system_id, uint8_t component_id, mavlink_msg_param_ext_set_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_value , packet1.param_type ); mavlink_msg_param_ext_set_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("PARAM_EXT_SET") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_PARAM_EXT_SET) != NULL); +#endif } static void mavlink_test_param_ext_ack(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -11081,6 +11836,11 @@ static void mavlink_test_param_ext_ack(uint8_t system_id, uint8_t component_id, mavlink_msg_param_ext_ack_send(MAVLINK_COMM_1 , packet1.param_id , packet1.param_value , packet1.param_type , packet1.param_result ); mavlink_msg_param_ext_ack_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("PARAM_EXT_ACK") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_PARAM_EXT_ACK) != NULL); +#endif } static void mavlink_test_obstacle_distance(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -11143,6 +11903,11 @@ static void mavlink_test_obstacle_distance(uint8_t system_id, uint8_t component_ mavlink_msg_obstacle_distance_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.sensor_type , packet1.distances , packet1.increment , packet1.min_distance , packet1.max_distance , packet1.increment_f , packet1.angle_offset , packet1.frame ); mavlink_msg_obstacle_distance_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("OBSTACLE_DISTANCE") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_OBSTACLE_DISTANCE) != NULL); +#endif } static void mavlink_test_odometry(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -11157,7 +11922,7 @@ static void mavlink_test_odometry(uint8_t system_id, uint8_t component_id, mavli uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; uint16_t i; mavlink_odometry_t packet_in = { - 93372036854775807ULL,73.0,101.0,129.0,{ 157.0, 158.0, 159.0, 160.0 },269.0,297.0,325.0,353.0,381.0,409.0,{ 437.0, 438.0, 439.0, 440.0, 441.0, 442.0, 443.0, 444.0, 445.0, 446.0, 447.0, 448.0, 449.0, 450.0, 451.0, 452.0, 453.0, 454.0, 455.0, 456.0, 457.0 },{ 1025.0, 1026.0, 1027.0, 1028.0, 1029.0, 1030.0, 1031.0, 1032.0, 1033.0, 1034.0, 1035.0, 1036.0, 1037.0, 1038.0, 1039.0, 1040.0, 1041.0, 1042.0, 1043.0, 1044.0, 1045.0 },177,244,55,122 + 93372036854775807ULL,73.0,101.0,129.0,{ 157.0, 158.0, 159.0, 160.0 },269.0,297.0,325.0,353.0,381.0,409.0,{ 437.0, 438.0, 439.0, 440.0, 441.0, 442.0, 443.0, 444.0, 445.0, 446.0, 447.0, 448.0, 449.0, 450.0, 451.0, 452.0, 453.0, 454.0, 455.0, 456.0, 457.0 },{ 1025.0, 1026.0, 1027.0, 1028.0, 1029.0, 1030.0, 1031.0, 1032.0, 1033.0, 1034.0, 1035.0, 1036.0, 1037.0, 1038.0, 1039.0, 1040.0, 1041.0, 1042.0, 1043.0, 1044.0, 1045.0 },177,244,55,122,189 }; mavlink_odometry_t packet1, packet2; memset(&packet1, 0, sizeof(packet1)); @@ -11175,6 +11940,7 @@ static void mavlink_test_odometry(uint8_t system_id, uint8_t component_id, mavli packet1.child_frame_id = packet_in.child_frame_id; packet1.reset_counter = packet_in.reset_counter; packet1.estimator_type = packet_in.estimator_type; + packet1.quality = packet_in.quality; mav_array_memcpy(packet1.q, packet_in.q, sizeof(float)*4); mav_array_memcpy(packet1.pose_covariance, packet_in.pose_covariance, sizeof(float)*21); @@ -11192,12 +11958,12 @@ static void mavlink_test_odometry(uint8_t system_id, uint8_t component_id, mavli MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_odometry_pack(system_id, component_id, &msg , packet1.time_usec , packet1.frame_id , packet1.child_frame_id , packet1.x , packet1.y , packet1.z , packet1.q , packet1.vx , packet1.vy , packet1.vz , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.pose_covariance , packet1.velocity_covariance , packet1.reset_counter , packet1.estimator_type ); + mavlink_msg_odometry_pack(system_id, component_id, &msg , packet1.time_usec , packet1.frame_id , packet1.child_frame_id , packet1.x , packet1.y , packet1.z , packet1.q , packet1.vx , packet1.vy , packet1.vz , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.pose_covariance , packet1.velocity_covariance , packet1.reset_counter , packet1.estimator_type , packet1.quality ); mavlink_msg_odometry_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_odometry_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.frame_id , packet1.child_frame_id , packet1.x , packet1.y , packet1.z , packet1.q , packet1.vx , packet1.vy , packet1.vz , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.pose_covariance , packet1.velocity_covariance , packet1.reset_counter , packet1.estimator_type ); + mavlink_msg_odometry_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.frame_id , packet1.child_frame_id , packet1.x , packet1.y , packet1.z , packet1.q , packet1.vx , packet1.vy , packet1.vz , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.pose_covariance , packet1.velocity_covariance , packet1.reset_counter , packet1.estimator_type , packet1.quality ); mavlink_msg_odometry_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); @@ -11210,9 +11976,14 @@ static void mavlink_test_odometry(uint8_t system_id, uint8_t component_id, mavli MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_odometry_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.frame_id , packet1.child_frame_id , packet1.x , packet1.y , packet1.z , packet1.q , packet1.vx , packet1.vy , packet1.vz , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.pose_covariance , packet1.velocity_covariance , packet1.reset_counter , packet1.estimator_type ); + mavlink_msg_odometry_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.frame_id , packet1.child_frame_id , packet1.x , packet1.y , packet1.z , packet1.q , packet1.vx , packet1.vy , packet1.vz , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.pose_covariance , packet1.velocity_covariance , packet1.reset_counter , packet1.estimator_type , packet1.quality ); mavlink_msg_odometry_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("ODOMETRY") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_ODOMETRY) != NULL); +#endif } static void mavlink_test_trajectory_representation_waypoints(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -11280,6 +12051,11 @@ static void mavlink_test_trajectory_representation_waypoints(uint8_t system_id, mavlink_msg_trajectory_representation_waypoints_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.valid_points , packet1.pos_x , packet1.pos_y , packet1.pos_z , packet1.vel_x , packet1.vel_y , packet1.vel_z , packet1.acc_x , packet1.acc_y , packet1.acc_z , packet1.pos_yaw , packet1.vel_yaw , packet1.command ); mavlink_msg_trajectory_representation_waypoints_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("TRAJECTORY_REPRESENTATION_WAYPOINTS") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS) != NULL); +#endif } static void mavlink_test_trajectory_representation_bezier(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -11340,6 +12116,11 @@ static void mavlink_test_trajectory_representation_bezier(uint8_t system_id, uin mavlink_msg_trajectory_representation_bezier_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.valid_points , packet1.pos_x , packet1.pos_y , packet1.pos_z , packet1.delta , packet1.pos_yaw ); mavlink_msg_trajectory_representation_bezier_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("TRAJECTORY_REPRESENTATION_BEZIER") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER) != NULL); +#endif } static void mavlink_test_cellular_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -11354,7 +12135,7 @@ static void mavlink_test_cellular_status(uint8_t system_id, uint8_t component_id uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; uint16_t i; mavlink_cellular_status_t packet_in = { - 17235,17339,17443,151,218,29,96 + 17235,17339,17443,151,218,29,96,163,94.0,18015,136.0,164.0,192.0,963498972,963499180,19159,58,"OPQRSTUV" }; mavlink_cellular_status_t packet1, packet2; memset(&packet1, 0, sizeof(packet1)); @@ -11365,7 +12146,18 @@ static void mavlink_test_cellular_status(uint8_t system_id, uint8_t component_id packet1.failure_reason = packet_in.failure_reason; packet1.type = packet_in.type; packet1.quality = packet_in.quality; + packet1.band_number = packet_in.band_number; + packet1.band_frequency = packet_in.band_frequency; + packet1.channel_number = packet_in.channel_number; + packet1.rx_level = packet_in.rx_level; + packet1.tx_level = packet_in.tx_level; + packet1.rx_quality = packet_in.rx_quality; + packet1.link_tx_rate = packet_in.link_tx_rate; + packet1.link_rx_rate = packet_in.link_rx_rate; + packet1.ber = packet_in.ber; + packet1.id = packet_in.id; + mav_array_memcpy(packet1.cell_tower_id, packet_in.cell_tower_id, sizeof(char)*9); #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { @@ -11379,12 +12171,12 @@ static void mavlink_test_cellular_status(uint8_t system_id, uint8_t component_id MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_cellular_status_pack(system_id, component_id, &msg , packet1.status , packet1.failure_reason , packet1.type , packet1.quality , packet1.mcc , packet1.mnc , packet1.lac ); + mavlink_msg_cellular_status_pack(system_id, component_id, &msg , packet1.status , packet1.failure_reason , packet1.type , packet1.quality , packet1.mcc , packet1.mnc , packet1.lac , packet1.band_number , packet1.band_frequency , packet1.channel_number , packet1.rx_level , packet1.tx_level , packet1.rx_quality , packet1.link_tx_rate , packet1.link_rx_rate , packet1.ber , packet1.id , packet1.cell_tower_id ); mavlink_msg_cellular_status_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_cellular_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.status , packet1.failure_reason , packet1.type , packet1.quality , packet1.mcc , packet1.mnc , packet1.lac ); + mavlink_msg_cellular_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.status , packet1.failure_reason , packet1.type , packet1.quality , packet1.mcc , packet1.mnc , packet1.lac , packet1.band_number , packet1.band_frequency , packet1.channel_number , packet1.rx_level , packet1.tx_level , packet1.rx_quality , packet1.link_tx_rate , packet1.link_rx_rate , packet1.ber , packet1.id , packet1.cell_tower_id ); mavlink_msg_cellular_status_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); @@ -11397,9 +12189,14 @@ static void mavlink_test_cellular_status(uint8_t system_id, uint8_t component_id MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_cellular_status_send(MAVLINK_COMM_1 , packet1.status , packet1.failure_reason , packet1.type , packet1.quality , packet1.mcc , packet1.mnc , packet1.lac ); + mavlink_msg_cellular_status_send(MAVLINK_COMM_1 , packet1.status , packet1.failure_reason , packet1.type , packet1.quality , packet1.mcc , packet1.mnc , packet1.lac , packet1.band_number , packet1.band_frequency , packet1.channel_number , packet1.rx_level , packet1.tx_level , packet1.rx_quality , packet1.link_tx_rate , packet1.link_rx_rate , packet1.ber , packet1.id , packet1.cell_tower_id ); mavlink_msg_cellular_status_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("CELLULAR_STATUS") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_CELLULAR_STATUS) != NULL); +#endif } static void mavlink_test_isbd_link_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -11461,6 +12258,11 @@ static void mavlink_test_isbd_link_status(uint8_t system_id, uint8_t component_i mavlink_msg_isbd_link_status_send(MAVLINK_COMM_1 , packet1.timestamp , packet1.last_heartbeat , packet1.failed_sessions , packet1.successful_sessions , packet1.signal_quality , packet1.ring_pending , packet1.tx_session_pending , packet1.rx_session_pending ); mavlink_msg_isbd_link_status_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("ISBD_LINK_STATUS") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_ISBD_LINK_STATUS) != NULL); +#endif } static void mavlink_test_cellular_config(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -11522,6 +12324,11 @@ static void mavlink_test_cellular_config(uint8_t system_id, uint8_t component_id mavlink_msg_cellular_config_send(MAVLINK_COMM_1 , packet1.enable_lte , packet1.enable_pin , packet1.pin , packet1.new_pin , packet1.apn , packet1.puk , packet1.roaming , packet1.response ); mavlink_msg_cellular_config_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("CELLULAR_CONFIG") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_CELLULAR_CONFIG) != NULL); +#endif } static void mavlink_test_raw_rpm(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -11577,6 +12384,11 @@ static void mavlink_test_raw_rpm(uint8_t system_id, uint8_t component_id, mavlin mavlink_msg_raw_rpm_send(MAVLINK_COMM_1 , packet1.index , packet1.frequency ); mavlink_msg_raw_rpm_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("RAW_RPM") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_RAW_RPM) != NULL); +#endif } static void mavlink_test_utm_global_position(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -11648,6 +12460,74 @@ static void mavlink_test_utm_global_position(uint8_t system_id, uint8_t componen mavlink_msg_utm_global_position_send(MAVLINK_COMM_1 , packet1.time , packet1.uas_id , packet1.lat , packet1.lon , packet1.alt , packet1.relative_alt , packet1.vx , packet1.vy , packet1.vz , packet1.h_acc , packet1.v_acc , packet1.vel_acc , packet1.next_lat , packet1.next_lon , packet1.next_alt , packet1.update_rate , packet1.flight_state , packet1.flags ); mavlink_msg_utm_global_position_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("UTM_GLOBAL_POSITION") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_UTM_GLOBAL_POSITION) != NULL); +#endif +} + +static void mavlink_test_param_error(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) +{ +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); + if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_PARAM_ERROR >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_param_error_t packet_in = { + 17235,139,206,"EFGHIJKLMNOPQRS",65 + }; + mavlink_param_error_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.param_index = packet_in.param_index; + packet1.target_system = packet_in.target_system; + packet1.target_component = packet_in.target_component; + packet1.error = packet_in.error; + + mav_array_memcpy(packet1.param_id, packet_in.param_id, sizeof(char)*16); + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_PARAM_ERROR_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_PARAM_ERROR_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_param_error_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_param_error_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_param_error_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_index , packet1.error ); + mavlink_msg_param_error_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_param_error_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_index , packet1.error ); + mavlink_msg_param_error_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { @@ -11808,12 +12703,12 @@ static void mavlink_test_smart_battery_info(uint8_t system_id, uint8_t component MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_smart_battery_info_pack(system_id, component_id, &msg , packet1.id , packet1.battery_function , packet1.type , packet1.capacity_full_specification , packet1.capacity_full , packet1.cycle_count , packet1.serial_number , packet1.device_name , packet1.weight , packet1.discharge_minimum_voltage , packet1.charging_minimum_voltage , packet1.resting_minimum_voltage ); + mavlink_msg_smart_battery_info_pack(system_id, component_id, &msg , packet1.id , packet1.battery_function , packet1.type , packet1.capacity_full_specification , packet1.capacity_full , packet1.cycle_count , packet1.serial_number , packet1.device_name , packet1.weight , packet1.discharge_minimum_voltage , packet1.charging_minimum_voltage , packet1.resting_minimum_voltage , packet1.charging_maximum_voltage , packet1.cells_in_series , packet1.discharge_maximum_current , packet1.discharge_maximum_burst_current , packet1.manufacture_date ); mavlink_msg_smart_battery_info_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_smart_battery_info_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.id , packet1.battery_function , packet1.type , packet1.capacity_full_specification , packet1.capacity_full , packet1.cycle_count , packet1.serial_number , packet1.device_name , packet1.weight , packet1.discharge_minimum_voltage , packet1.charging_minimum_voltage , packet1.resting_minimum_voltage ); + mavlink_msg_smart_battery_info_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.id , packet1.battery_function , packet1.type , packet1.capacity_full_specification , packet1.capacity_full , packet1.cycle_count , packet1.serial_number , packet1.device_name , packet1.weight , packet1.discharge_minimum_voltage , packet1.charging_minimum_voltage , packet1.resting_minimum_voltage , packet1.charging_maximum_voltage , packet1.cells_in_series , packet1.discharge_maximum_current , packet1.discharge_maximum_burst_current , packet1.manufacture_date ); mavlink_msg_smart_battery_info_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); @@ -11826,59 +12721,61 @@ static void mavlink_test_smart_battery_info(uint8_t system_id, uint8_t component MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_smart_battery_info_send(MAVLINK_COMM_1 , packet1.id , packet1.battery_function , packet1.type , packet1.capacity_full_specification , packet1.capacity_full , packet1.cycle_count , packet1.serial_number , packet1.device_name , packet1.weight , packet1.discharge_minimum_voltage , packet1.charging_minimum_voltage , packet1.resting_minimum_voltage ); + mavlink_msg_smart_battery_info_send(MAVLINK_COMM_1 , packet1.id , packet1.battery_function , packet1.type , packet1.capacity_full_specification , packet1.capacity_full , packet1.cycle_count , packet1.serial_number , packet1.device_name , packet1.weight , packet1.discharge_minimum_voltage , packet1.charging_minimum_voltage , packet1.resting_minimum_voltage , packet1.charging_maximum_voltage , packet1.cells_in_series , packet1.discharge_maximum_current , packet1.discharge_maximum_burst_current , packet1.manufacture_date ); mavlink_msg_smart_battery_info_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("SMART_BATTERY_INFO") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_SMART_BATTERY_INFO) != NULL); +#endif } -static void mavlink_test_generator_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) +static void mavlink_test_fuel_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) { #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); - if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GENERATOR_STATUS >= 256) { + if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_FUEL_STATUS >= 256) { return; } #endif mavlink_message_t msg; uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; uint16_t i; - mavlink_generator_status_t packet_in = { - 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,963498920,963499128,19107,19211,19315 + mavlink_fuel_status_t packet_in = { + 17.0,45.0,73.0,101.0,129.0,963498504,77,144 }; - mavlink_generator_status_t packet1, packet2; + mavlink_fuel_status_t packet1, packet2; memset(&packet1, 0, sizeof(packet1)); - packet1.status = packet_in.status; - packet1.battery_current = packet_in.battery_current; - packet1.load_current = packet_in.load_current; - packet1.power_generated = packet_in.power_generated; - packet1.bus_voltage = packet_in.bus_voltage; - packet1.bat_current_setpoint = packet_in.bat_current_setpoint; - packet1.runtime = packet_in.runtime; - packet1.time_until_maintenance = packet_in.time_until_maintenance; - packet1.generator_speed = packet_in.generator_speed; - packet1.rectifier_temperature = packet_in.rectifier_temperature; - packet1.generator_temperature = packet_in.generator_temperature; + packet1.maximum_fuel = packet_in.maximum_fuel; + packet1.consumed_fuel = packet_in.consumed_fuel; + packet1.remaining_fuel = packet_in.remaining_fuel; + packet1.flow_rate = packet_in.flow_rate; + packet1.temperature = packet_in.temperature; + packet1.fuel_type = packet_in.fuel_type; + packet1.id = packet_in.id; + packet1.percent_remaining = packet_in.percent_remaining; #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { // cope with extensions - memset(MAVLINK_MSG_ID_GENERATOR_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GENERATOR_STATUS_MIN_LEN); + memset(MAVLINK_MSG_ID_FUEL_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_FUEL_STATUS_MIN_LEN); } #endif memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_generator_status_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_generator_status_decode(&msg, &packet2); + mavlink_msg_fuel_status_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_fuel_status_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_generator_status_pack(system_id, component_id, &msg , packet1.status , packet1.generator_speed , packet1.battery_current , packet1.load_current , packet1.power_generated , packet1.bus_voltage , packet1.rectifier_temperature , packet1.bat_current_setpoint , packet1.generator_temperature , packet1.runtime , packet1.time_until_maintenance ); - mavlink_msg_generator_status_decode(&msg, &packet2); + mavlink_msg_fuel_status_pack(system_id, component_id, &msg , packet1.id , packet1.maximum_fuel , packet1.consumed_fuel , packet1.remaining_fuel , packet1.percent_remaining , packet1.flow_rate , packet1.temperature , packet1.fuel_type ); + mavlink_msg_fuel_status_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_generator_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.status , packet1.generator_speed , packet1.battery_current , packet1.load_current , packet1.power_generated , packet1.bus_voltage , packet1.rectifier_temperature , packet1.bat_current_setpoint , packet1.generator_temperature , packet1.runtime , packet1.time_until_maintenance ); - mavlink_msg_generator_status_decode(&msg, &packet2); + mavlink_msg_fuel_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.id , packet1.maximum_fuel , packet1.consumed_fuel , packet1.remaining_fuel , packet1.percent_remaining , packet1.flow_rate , packet1.temperature , packet1.fuel_type ); + mavlink_msg_fuel_status_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); @@ -11886,55 +12783,77 @@ static void mavlink_test_generator_status(uint8_t system_id, uint8_t component_i for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ACTUATOR_OUTPUT_STATUS >= 256) { + if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_BATTERY_INFO >= 256) { return; } #endif mavlink_message_t msg; uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; uint16_t i; - mavlink_actuator_output_status_t packet_in = { - 93372036854775807ULL,963497880,{ 101.0, 102.0, 103.0, 104.0, 105.0, 106.0, 107.0, 108.0, 109.0, 110.0, 111.0, 112.0, 113.0, 114.0, 115.0, 116.0, 117.0, 118.0, 119.0, 120.0, 121.0, 122.0, 123.0, 124.0, 125.0, 126.0, 127.0, 128.0, 129.0, 130.0, 131.0, 132.0 } + mavlink_battery_info_t packet_in = { + 17.0,45.0,73.0,101.0,129.0,157.0,185.0,213.0,241.0,269.0,19315,19419,137,204,15,82,149,"XYZABCDE","GHIJKLMNOPQRSTUVWXYZABCDEFGHIJK","MNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI" }; - mavlink_actuator_output_status_t packet1, packet2; + mavlink_battery_info_t packet1, packet2; memset(&packet1, 0, sizeof(packet1)); - packet1.time_usec = packet_in.time_usec; - packet1.active = packet_in.active; + packet1.discharge_minimum_voltage = packet_in.discharge_minimum_voltage; + packet1.charging_minimum_voltage = packet_in.charging_minimum_voltage; + packet1.resting_minimum_voltage = packet_in.resting_minimum_voltage; + packet1.charging_maximum_voltage = packet_in.charging_maximum_voltage; + packet1.charging_maximum_current = packet_in.charging_maximum_current; + packet1.nominal_voltage = packet_in.nominal_voltage; + packet1.discharge_maximum_current = packet_in.discharge_maximum_current; + packet1.discharge_maximum_burst_current = packet_in.discharge_maximum_burst_current; + packet1.design_capacity = packet_in.design_capacity; + packet1.full_charge_capacity = packet_in.full_charge_capacity; + packet1.cycle_count = packet_in.cycle_count; + packet1.weight = packet_in.weight; + packet1.id = packet_in.id; + packet1.battery_function = packet_in.battery_function; + packet1.type = packet_in.type; + packet1.state_of_health = packet_in.state_of_health; + packet1.cells_in_series = packet_in.cells_in_series; - mav_array_memcpy(packet1.actuator, packet_in.actuator, sizeof(float)*32); + mav_array_memcpy(packet1.manufacture_date, packet_in.manufacture_date, sizeof(char)*9); + mav_array_memcpy(packet1.serial_number, packet_in.serial_number, sizeof(char)*32); + mav_array_memcpy(packet1.name, packet_in.name, sizeof(char)*50); #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { // cope with extensions - memset(MAVLINK_MSG_ID_ACTUATOR_OUTPUT_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ACTUATOR_OUTPUT_STATUS_MIN_LEN); + memset(MAVLINK_MSG_ID_BATTERY_INFO_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_BATTERY_INFO_MIN_LEN); } #endif memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_actuator_output_status_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_actuator_output_status_decode(&msg, &packet2); + mavlink_msg_battery_info_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_battery_info_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_actuator_output_status_pack(system_id, component_id, &msg , packet1.time_usec , packet1.active , packet1.actuator ); - mavlink_msg_actuator_output_status_decode(&msg, &packet2); + mavlink_msg_battery_info_pack(system_id, component_id, &msg , packet1.id , packet1.battery_function , packet1.type , packet1.state_of_health , packet1.cells_in_series , packet1.cycle_count , packet1.weight , packet1.discharge_minimum_voltage , packet1.charging_minimum_voltage , packet1.resting_minimum_voltage , packet1.charging_maximum_voltage , packet1.charging_maximum_current , packet1.nominal_voltage , packet1.discharge_maximum_current , packet1.discharge_maximum_burst_current , packet1.design_capacity , packet1.full_charge_capacity , packet1.manufacture_date , packet1.serial_number , packet1.name ); + mavlink_msg_battery_info_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_actuator_output_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.active , packet1.actuator ); - mavlink_msg_actuator_output_status_decode(&msg, &packet2); + mavlink_msg_battery_info_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.id , packet1.battery_function , packet1.type , packet1.state_of_health , packet1.cells_in_series , packet1.cycle_count , packet1.weight , packet1.discharge_minimum_voltage , packet1.charging_minimum_voltage , packet1.resting_minimum_voltage , packet1.charging_maximum_voltage , packet1.charging_maximum_current , packet1.nominal_voltage , packet1.discharge_maximum_current , packet1.discharge_maximum_burst_current , packet1.design_capacity , packet1.full_charge_capacity , packet1.manufacture_date , packet1.serial_number , packet1.name ); + mavlink_msg_battery_info_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); @@ -11942,45 +12861,180 @@ static void mavlink_test_actuator_output_status(uint8_t system_id, uint8_t compo for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET >= 256) { + if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GENERATOR_STATUS >= 256) { return; } #endif mavlink_message_t msg; uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; uint16_t i; - mavlink_time_estimate_to_target_t packet_in = { - 963497464,963497672,963497880,963498088,963498296 + mavlink_generator_status_t packet_in = { + 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,963498920,963499128,19107,19211,19315 }; - mavlink_time_estimate_to_target_t packet1, packet2; + mavlink_generator_status_t packet1, packet2; memset(&packet1, 0, sizeof(packet1)); - packet1.safe_return = packet_in.safe_return; - packet1.land = packet_in.land; - packet1.mission_next_item = packet_in.mission_next_item; - packet1.mission_end = packet_in.mission_end; - packet1.commanded_action = packet_in.commanded_action; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); + packet1.status = packet_in.status; + packet1.battery_current = packet_in.battery_current; + packet1.load_current = packet_in.load_current; + packet1.power_generated = packet_in.power_generated; + packet1.bus_voltage = packet_in.bus_voltage; + packet1.bat_current_setpoint = packet_in.bat_current_setpoint; + packet1.runtime = packet_in.runtime; + packet1.time_until_maintenance = packet_in.time_until_maintenance; + packet1.generator_speed = packet_in.generator_speed; + packet1.rectifier_temperature = packet_in.rectifier_temperature; + packet1.generator_temperature = packet_in.generator_temperature; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_GENERATOR_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GENERATOR_STATUS_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_generator_status_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_generator_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_generator_status_pack(system_id, component_id, &msg , packet1.status , packet1.generator_speed , packet1.battery_current , packet1.load_current , packet1.power_generated , packet1.bus_voltage , packet1.rectifier_temperature , packet1.bat_current_setpoint , packet1.generator_temperature , packet1.runtime , packet1.time_until_maintenance ); + mavlink_msg_generator_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_generator_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.status , packet1.generator_speed , packet1.battery_current , packet1.load_current , packet1.power_generated , packet1.bus_voltage , packet1.rectifier_temperature , packet1.bat_current_setpoint , packet1.generator_temperature , packet1.runtime , packet1.time_until_maintenance ); + mavlink_msg_generator_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ACTUATOR_OUTPUT_STATUS >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_actuator_output_status_t packet_in = { + 93372036854775807ULL,963497880,{ 101.0, 102.0, 103.0, 104.0, 105.0, 106.0, 107.0, 108.0, 109.0, 110.0, 111.0, 112.0, 113.0, 114.0, 115.0, 116.0, 117.0, 118.0, 119.0, 120.0, 121.0, 122.0, 123.0, 124.0, 125.0, 126.0, 127.0, 128.0, 129.0, 130.0, 131.0, 132.0 } + }; + mavlink_actuator_output_status_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.time_usec = packet_in.time_usec; + packet1.active = packet_in.active; + + mav_array_memcpy(packet1.actuator, packet_in.actuator, sizeof(float)*32); + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_ACTUATOR_OUTPUT_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ACTUATOR_OUTPUT_STATUS_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_actuator_output_status_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_actuator_output_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_actuator_output_status_pack(system_id, component_id, &msg , packet1.time_usec , packet1.active , packet1.actuator ); + mavlink_msg_actuator_output_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_actuator_output_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.active , packet1.actuator ); + mavlink_msg_actuator_output_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_time_estimate_to_target_t packet_in = { + 963497464,963497672,963497880,963498088,963498296 + }; + mavlink_time_estimate_to_target_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.safe_return = packet_in.safe_return; + packet1.land = packet_in.land; + packet1.mission_next_item = packet_in.mission_next_item; + packet1.mission_end = packet_in.mission_end; + packet1.commanded_action = packet_in.commanded_action; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); mavlink_msg_time_estimate_to_target_encode(system_id, component_id, &msg, &packet1); mavlink_msg_time_estimate_to_target_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); @@ -12007,6 +13061,11 @@ static void mavlink_test_time_estimate_to_target(uint8_t system_id, uint8_t comp mavlink_msg_time_estimate_to_target_send(MAVLINK_COMM_1 , packet1.safe_return , packet1.land , packet1.mission_next_item , packet1.mission_end , packet1.commanded_action ); mavlink_msg_time_estimate_to_target_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("TIME_ESTIMATE_TO_TARGET") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET) != NULL); +#endif } static void mavlink_test_tunnel(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -12023,34 +13082,865 @@ static void mavlink_test_tunnel(uint8_t system_id, uint8_t component_id, mavlink mavlink_tunnel_t packet_in = { 17235,139,206,17,{ 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211 } }; - mavlink_tunnel_t packet1, packet2; + mavlink_tunnel_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.payload_type = packet_in.payload_type; + packet1.target_system = packet_in.target_system; + packet1.target_component = packet_in.target_component; + packet1.payload_length = packet_in.payload_length; + + mav_array_memcpy(packet1.payload, packet_in.payload, sizeof(uint8_t)*128); + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_TUNNEL_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_TUNNEL_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_tunnel_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_tunnel_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_tunnel_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.payload_type , packet1.payload_length , packet1.payload ); + mavlink_msg_tunnel_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_tunnel_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.payload_type , packet1.payload_length , packet1.payload ); + mavlink_msg_tunnel_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_CAN_FRAME >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_can_frame_t packet_in = { + 963497464,17,84,151,218,{ 29, 30, 31, 32, 33, 34, 35, 36 } + }; + mavlink_can_frame_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.id = packet_in.id; + packet1.target_system = packet_in.target_system; + packet1.target_component = packet_in.target_component; + packet1.bus = packet_in.bus; + packet1.len = packet_in.len; + + mav_array_memcpy(packet1.data, packet_in.data, sizeof(uint8_t)*8); + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_CAN_FRAME_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_CAN_FRAME_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_can_frame_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_can_frame_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_can_frame_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.bus , packet1.len , packet1.id , packet1.data ); + mavlink_msg_can_frame_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_can_frame_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.bus , packet1.len , packet1.id , packet1.data ); + mavlink_msg_can_frame_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_onboard_computer_status_t packet_in = { + 93372036854775807ULL,963497880,963498088,963498296,{ 963498504, 963498505, 963498506, 963498507 },{ 963499336, 963499337, 963499338, 963499339 },{ 963500168, 963500169, 963500170, 963500171 },{ 963501000, 963501001, 963501002, 963501003, 963501004, 963501005 },{ 963502248, 963502249, 963502250, 963502251, 963502252, 963502253 },{ 963503496, 963503497, 963503498, 963503499, 963503500, 963503501 },{ 963504744, 963504745, 963504746, 963504747, 963504748, 963504749 },{ 963505992, 963505993, 963505994, 963505995, 963505996, 963505997 },{ 27011, 27012, 27013, 27014 },81,{ 148, 149, 150, 151, 152, 153, 154, 155 },{ 172, 173, 174, 175, 176, 177, 178, 179, 180, 181 },{ 74, 75, 76, 77 },{ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95 },244,{ 55, 56, 57, 58, 59, 60, 61, 62 },29611 + }; + mavlink_onboard_computer_status_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.time_usec = packet_in.time_usec; + packet1.uptime = packet_in.uptime; + packet1.ram_usage = packet_in.ram_usage; + packet1.ram_total = packet_in.ram_total; + packet1.type = packet_in.type; + packet1.temperature_board = packet_in.temperature_board; + packet1.status_flags = packet_in.status_flags; + + mav_array_memcpy(packet1.storage_type, packet_in.storage_type, sizeof(uint32_t)*4); + mav_array_memcpy(packet1.storage_usage, packet_in.storage_usage, sizeof(uint32_t)*4); + mav_array_memcpy(packet1.storage_total, packet_in.storage_total, sizeof(uint32_t)*4); + mav_array_memcpy(packet1.link_type, packet_in.link_type, sizeof(uint32_t)*6); + mav_array_memcpy(packet1.link_tx_rate, packet_in.link_tx_rate, sizeof(uint32_t)*6); + mav_array_memcpy(packet1.link_rx_rate, packet_in.link_rx_rate, sizeof(uint32_t)*6); + mav_array_memcpy(packet1.link_tx_max, packet_in.link_tx_max, sizeof(uint32_t)*6); + mav_array_memcpy(packet1.link_rx_max, packet_in.link_rx_max, sizeof(uint32_t)*6); + mav_array_memcpy(packet1.fan_speed, packet_in.fan_speed, sizeof(int16_t)*4); + mav_array_memcpy(packet1.cpu_cores, packet_in.cpu_cores, sizeof(uint8_t)*8); + mav_array_memcpy(packet1.cpu_combined, packet_in.cpu_combined, sizeof(uint8_t)*10); + mav_array_memcpy(packet1.gpu_cores, packet_in.gpu_cores, sizeof(uint8_t)*4); + mav_array_memcpy(packet1.gpu_combined, packet_in.gpu_combined, sizeof(uint8_t)*10); + mav_array_memcpy(packet1.temperature_core, packet_in.temperature_core, sizeof(int8_t)*8); + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_onboard_computer_status_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_onboard_computer_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_onboard_computer_status_pack(system_id, component_id, &msg , packet1.time_usec , packet1.uptime , packet1.type , packet1.cpu_cores , packet1.cpu_combined , packet1.gpu_cores , packet1.gpu_combined , packet1.temperature_board , packet1.temperature_core , packet1.fan_speed , packet1.ram_usage , packet1.ram_total , packet1.storage_type , packet1.storage_usage , packet1.storage_total , packet1.link_type , packet1.link_tx_rate , packet1.link_rx_rate , packet1.link_tx_max , packet1.link_rx_max , packet1.status_flags ); + mavlink_msg_onboard_computer_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_onboard_computer_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.uptime , packet1.type , packet1.cpu_cores , packet1.cpu_combined , packet1.gpu_cores , packet1.gpu_combined , packet1.temperature_board , packet1.temperature_core , packet1.fan_speed , packet1.ram_usage , packet1.ram_total , packet1.storage_type , packet1.storage_usage , packet1.storage_total , packet1.link_type , packet1.link_tx_rate , packet1.link_rx_rate , packet1.link_tx_max , packet1.link_rx_max , packet1.status_flags ); + mavlink_msg_onboard_computer_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_COMPONENT_INFORMATION >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_component_information_t packet_in = { + 963497464,963497672,963497880,"MNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG","IJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABC" + }; + mavlink_component_information_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.time_boot_ms = packet_in.time_boot_ms; + packet1.general_metadata_file_crc = packet_in.general_metadata_file_crc; + packet1.peripherals_metadata_file_crc = packet_in.peripherals_metadata_file_crc; + + mav_array_memcpy(packet1.general_metadata_uri, packet_in.general_metadata_uri, sizeof(char)*100); + mav_array_memcpy(packet1.peripherals_metadata_uri, packet_in.peripherals_metadata_uri, sizeof(char)*100); + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_COMPONENT_INFORMATION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_COMPONENT_INFORMATION_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_component_information_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_component_information_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_component_information_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.general_metadata_file_crc , packet1.general_metadata_uri , packet1.peripherals_metadata_file_crc , packet1.peripherals_metadata_uri ); + mavlink_msg_component_information_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_component_information_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.general_metadata_file_crc , packet1.general_metadata_uri , packet1.peripherals_metadata_file_crc , packet1.peripherals_metadata_uri ); + mavlink_msg_component_information_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_component_information_basic_t packet_in = { + 93372036854775807ULL,963497880,963498088,"QRSTUVWXYZABCDEFGHIJKLMNOPQRSTU","WXYZABCDEFGHIJKLMNOPQRSTUVWXYZA","CDEFGHIJKLMNOPQRSTUVWXY","ABCDEFGHIJKLMNOPQRSTUVW","YZABCDEFGHIJKLMNOPQRSTUVWXYZABC" + }; + mavlink_component_information_basic_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.capabilities = packet_in.capabilities; + packet1.time_boot_ms = packet_in.time_boot_ms; + packet1.time_manufacture_s = packet_in.time_manufacture_s; + + mav_array_memcpy(packet1.vendor_name, packet_in.vendor_name, sizeof(char)*32); + mav_array_memcpy(packet1.model_name, packet_in.model_name, sizeof(char)*32); + mav_array_memcpy(packet1.software_version, packet_in.software_version, sizeof(char)*24); + mav_array_memcpy(packet1.hardware_version, packet_in.hardware_version, sizeof(char)*24); + mav_array_memcpy(packet1.serial_number, packet_in.serial_number, sizeof(char)*32); + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_COMPONENT_INFORMATION_BASIC_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_component_information_basic_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_component_information_basic_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_component_information_basic_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.capabilities , packet1.time_manufacture_s , packet1.vendor_name , packet1.model_name , packet1.software_version , packet1.hardware_version , packet1.serial_number ); + mavlink_msg_component_information_basic_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_component_information_basic_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.capabilities , packet1.time_manufacture_s , packet1.vendor_name , packet1.model_name , packet1.software_version , packet1.hardware_version , packet1.serial_number ); + mavlink_msg_component_information_basic_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_COMPONENT_METADATA >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_component_metadata_t packet_in = { + 963497464,963497672,"IJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABC" + }; + mavlink_component_metadata_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.time_boot_ms = packet_in.time_boot_ms; + packet1.file_crc = packet_in.file_crc; + + mav_array_memcpy(packet1.uri, packet_in.uri, sizeof(char)*100); + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_COMPONENT_METADATA_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_COMPONENT_METADATA_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_component_metadata_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_component_metadata_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_component_metadata_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.file_crc , packet1.uri ); + mavlink_msg_component_metadata_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_component_metadata_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.file_crc , packet1.uri ); + mavlink_msg_component_metadata_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_PLAY_TUNE_V2 >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_play_tune_v2_t packet_in = { + 963497464,17,84,"GHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRS" + }; + mavlink_play_tune_v2_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.format = packet_in.format; + packet1.target_system = packet_in.target_system; + packet1.target_component = packet_in.target_component; + + mav_array_memcpy(packet1.tune, packet_in.tune, sizeof(char)*248); + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_PLAY_TUNE_V2_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_PLAY_TUNE_V2_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_play_tune_v2_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_play_tune_v2_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_play_tune_v2_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.format , packet1.tune ); + mavlink_msg_play_tune_v2_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_play_tune_v2_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.format , packet1.tune ); + mavlink_msg_play_tune_v2_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SUPPORTED_TUNES >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_supported_tunes_t packet_in = { + 963497464,17,84 + }; + mavlink_supported_tunes_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.format = packet_in.format; + packet1.target_system = packet_in.target_system; + packet1.target_component = packet_in.target_component; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_SUPPORTED_TUNES_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SUPPORTED_TUNES_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_supported_tunes_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_supported_tunes_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_supported_tunes_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.format ); + mavlink_msg_supported_tunes_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_supported_tunes_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.format ); + mavlink_msg_supported_tunes_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_EVENT >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_event_t packet_in = { + 963497464,963497672,17651,163,230,41,{ 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147 } + }; + mavlink_event_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.id = packet_in.id; + packet1.event_time_boot_ms = packet_in.event_time_boot_ms; + packet1.sequence = packet_in.sequence; + packet1.destination_component = packet_in.destination_component; + packet1.destination_system = packet_in.destination_system; + packet1.log_levels = packet_in.log_levels; + + mav_array_memcpy(packet1.arguments, packet_in.arguments, sizeof(uint8_t)*40); + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_EVENT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_EVENT_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_event_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_event_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_event_pack(system_id, component_id, &msg , packet1.destination_component , packet1.destination_system , packet1.id , packet1.event_time_boot_ms , packet1.sequence , packet1.log_levels , packet1.arguments ); + mavlink_msg_event_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_event_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.destination_component , packet1.destination_system , packet1.id , packet1.event_time_boot_ms , packet1.sequence , packet1.log_levels , packet1.arguments ); + mavlink_msg_event_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_current_event_sequence_t packet_in = { + 17235,139 + }; + mavlink_current_event_sequence_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.sequence = packet_in.sequence; + packet1.flags = packet_in.flags; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_current_event_sequence_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_current_event_sequence_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_current_event_sequence_pack(system_id, component_id, &msg , packet1.sequence , packet1.flags ); + mavlink_msg_current_event_sequence_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_current_event_sequence_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.sequence , packet1.flags ); + mavlink_msg_current_event_sequence_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_REQUEST_EVENT >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_request_event_t packet_in = { + 17235,17339,17,84 + }; + mavlink_request_event_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.first_sequence = packet_in.first_sequence; + packet1.last_sequence = packet_in.last_sequence; + packet1.target_system = packet_in.target_system; + packet1.target_component = packet_in.target_component; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_REQUEST_EVENT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_REQUEST_EVENT_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_request_event_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_request_event_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_request_event_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.first_sequence , packet1.last_sequence ); + mavlink_msg_request_event_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_request_event_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.first_sequence , packet1.last_sequence ); + mavlink_msg_request_event_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_response_event_error_t packet_in = { + 17235,17339,17,84,151 + }; + mavlink_response_event_error_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.sequence = packet_in.sequence; + packet1.sequence_oldest_available = packet_in.sequence_oldest_available; + packet1.target_system = packet_in.target_system; + packet1.target_component = packet_in.target_component; + packet1.reason = packet_in.reason; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_response_event_error_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_response_event_error_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_response_event_error_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.sequence , packet1.sequence_oldest_available , packet1.reason ); + mavlink_msg_response_event_error_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_response_event_error_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.sequence , packet1.sequence_oldest_available , packet1.reason ); + mavlink_msg_response_event_error_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_AVAILABLE_MODES >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_available_modes_t packet_in = { + 963497464,963497672,29,96,163,"LMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRS" + }; + mavlink_available_modes_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.custom_mode = packet_in.custom_mode; + packet1.properties = packet_in.properties; + packet1.number_modes = packet_in.number_modes; + packet1.mode_index = packet_in.mode_index; + packet1.standard_mode = packet_in.standard_mode; + + mav_array_memcpy(packet1.mode_name, packet_in.mode_name, sizeof(char)*35); + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_AVAILABLE_MODES_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_AVAILABLE_MODES_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_available_modes_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_available_modes_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_available_modes_pack(system_id, component_id, &msg , packet1.number_modes , packet1.mode_index , packet1.standard_mode , packet1.custom_mode , packet1.properties , packet1.mode_name ); + mavlink_msg_available_modes_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_available_modes_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.number_modes , packet1.mode_index , packet1.standard_mode , packet1.custom_mode , packet1.properties , packet1.mode_name ); + mavlink_msg_available_modes_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_CURRENT_MODE >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_current_mode_t packet_in = { + 963497464,963497672,29 + }; + mavlink_current_mode_t packet1, packet2; memset(&packet1, 0, sizeof(packet1)); - packet1.payload_type = packet_in.payload_type; - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - packet1.payload_length = packet_in.payload_length; + packet1.custom_mode = packet_in.custom_mode; + packet1.intended_custom_mode = packet_in.intended_custom_mode; + packet1.standard_mode = packet_in.standard_mode; - mav_array_memcpy(packet1.payload, packet_in.payload, sizeof(uint8_t)*128); #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { // cope with extensions - memset(MAVLINK_MSG_ID_TUNNEL_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_TUNNEL_MIN_LEN); + memset(MAVLINK_MSG_ID_CURRENT_MODE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_CURRENT_MODE_MIN_LEN); } #endif memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_tunnel_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_tunnel_decode(&msg, &packet2); + mavlink_msg_current_mode_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_current_mode_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_tunnel_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.payload_type , packet1.payload_length , packet1.payload ); - mavlink_msg_tunnel_decode(&msg, &packet2); + mavlink_msg_current_mode_pack(system_id, component_id, &msg , packet1.standard_mode , packet1.custom_mode , packet1.intended_custom_mode ); + mavlink_msg_current_mode_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_tunnel_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.payload_type , packet1.payload_length , packet1.payload ); - mavlink_msg_tunnel_decode(&msg, &packet2); + mavlink_msg_current_mode_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.standard_mode , packet1.custom_mode , packet1.intended_custom_mode ); + mavlink_msg_current_mode_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); @@ -12058,72 +13948,58 @@ static void mavlink_test_tunnel(uint8_t system_id, uint8_t component_id, mavlink for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS >= 256) { + if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR >= 256) { return; } #endif mavlink_message_t msg; uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; uint16_t i; - mavlink_onboard_computer_status_t packet_in = { - 93372036854775807ULL,963497880,963498088,963498296,{ 963498504, 963498505, 963498506, 963498507 },{ 963499336, 963499337, 963499338, 963499339 },{ 963500168, 963500169, 963500170, 963500171 },{ 963501000, 963501001, 963501002, 963501003, 963501004, 963501005 },{ 963502248, 963502249, 963502250, 963502251, 963502252, 963502253 },{ 963503496, 963503497, 963503498, 963503499, 963503500, 963503501 },{ 963504744, 963504745, 963504746, 963504747, 963504748, 963504749 },{ 963505992, 963505993, 963505994, 963505995, 963505996, 963505997 },{ 27011, 27012, 27013, 27014 },81,{ 148, 149, 150, 151, 152, 153, 154, 155 },{ 172, 173, 174, 175, 176, 177, 178, 179, 180, 181 },{ 74, 75, 76, 77 },{ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95 },244,{ 55, 56, 57, 58, 59, 60, 61, 62 } + mavlink_available_modes_monitor_t packet_in = { + 5 }; - mavlink_onboard_computer_status_t packet1, packet2; + mavlink_available_modes_monitor_t packet1, packet2; memset(&packet1, 0, sizeof(packet1)); - packet1.time_usec = packet_in.time_usec; - packet1.uptime = packet_in.uptime; - packet1.ram_usage = packet_in.ram_usage; - packet1.ram_total = packet_in.ram_total; - packet1.type = packet_in.type; - packet1.temperature_board = packet_in.temperature_board; + packet1.seq = packet_in.seq; - mav_array_memcpy(packet1.storage_type, packet_in.storage_type, sizeof(uint32_t)*4); - mav_array_memcpy(packet1.storage_usage, packet_in.storage_usage, sizeof(uint32_t)*4); - mav_array_memcpy(packet1.storage_total, packet_in.storage_total, sizeof(uint32_t)*4); - mav_array_memcpy(packet1.link_type, packet_in.link_type, sizeof(uint32_t)*6); - mav_array_memcpy(packet1.link_tx_rate, packet_in.link_tx_rate, sizeof(uint32_t)*6); - mav_array_memcpy(packet1.link_rx_rate, packet_in.link_rx_rate, sizeof(uint32_t)*6); - mav_array_memcpy(packet1.link_tx_max, packet_in.link_tx_max, sizeof(uint32_t)*6); - mav_array_memcpy(packet1.link_rx_max, packet_in.link_rx_max, sizeof(uint32_t)*6); - mav_array_memcpy(packet1.fan_speed, packet_in.fan_speed, sizeof(int16_t)*4); - mav_array_memcpy(packet1.cpu_cores, packet_in.cpu_cores, sizeof(uint8_t)*8); - mav_array_memcpy(packet1.cpu_combined, packet_in.cpu_combined, sizeof(uint8_t)*10); - mav_array_memcpy(packet1.gpu_cores, packet_in.gpu_cores, sizeof(uint8_t)*4); - mav_array_memcpy(packet1.gpu_combined, packet_in.gpu_combined, sizeof(uint8_t)*10); - mav_array_memcpy(packet1.temperature_core, packet_in.temperature_core, sizeof(int8_t)*8); #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { // cope with extensions - memset(MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_MIN_LEN); + memset(MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_MIN_LEN); } #endif memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_onboard_computer_status_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_onboard_computer_status_decode(&msg, &packet2); + mavlink_msg_available_modes_monitor_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_available_modes_monitor_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_onboard_computer_status_pack(system_id, component_id, &msg , packet1.time_usec , packet1.uptime , packet1.type , packet1.cpu_cores , packet1.cpu_combined , packet1.gpu_cores , packet1.gpu_combined , packet1.temperature_board , packet1.temperature_core , packet1.fan_speed , packet1.ram_usage , packet1.ram_total , packet1.storage_type , packet1.storage_usage , packet1.storage_total , packet1.link_type , packet1.link_tx_rate , packet1.link_rx_rate , packet1.link_tx_max , packet1.link_rx_max ); - mavlink_msg_onboard_computer_status_decode(&msg, &packet2); + mavlink_msg_available_modes_monitor_pack(system_id, component_id, &msg , packet1.seq ); + mavlink_msg_available_modes_monitor_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_onboard_computer_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.uptime , packet1.type , packet1.cpu_cores , packet1.cpu_combined , packet1.gpu_cores , packet1.gpu_combined , packet1.temperature_board , packet1.temperature_core , packet1.fan_speed , packet1.ram_usage , packet1.ram_total , packet1.storage_type , packet1.storage_usage , packet1.storage_total , packet1.link_type , packet1.link_tx_rate , packet1.link_rx_rate , packet1.link_tx_max , packet1.link_rx_max ); - mavlink_msg_onboard_computer_status_decode(&msg, &packet2); + mavlink_msg_available_modes_monitor_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.seq ); + mavlink_msg_available_modes_monitor_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); @@ -12131,58 +14007,68 @@ static void mavlink_test_onboard_computer_status(uint8_t system_id, uint8_t comp for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_COMPONENT_INFORMATION >= 256) { + if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ILLUMINATOR_STATUS >= 256) { return; } #endif mavlink_message_t msg; uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; uint16_t i; - mavlink_component_information_t packet_in = { - 963497464,963497672,963497880,963498088,"QRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG","IJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXY" + mavlink_illuminator_status_t packet_in = { + 963497464,963497672,73.0,101.0,129.0,157.0,185.0,213.0,101,168,235 }; - mavlink_component_information_t packet1, packet2; + mavlink_illuminator_status_t packet1, packet2; memset(&packet1, 0, sizeof(packet1)); - packet1.time_boot_ms = packet_in.time_boot_ms; - packet1.metadata_type = packet_in.metadata_type; - packet1.metadata_uid = packet_in.metadata_uid; - packet1.translation_uid = packet_in.translation_uid; + packet1.uptime_ms = packet_in.uptime_ms; + packet1.error_status = packet_in.error_status; + packet1.brightness = packet_in.brightness; + packet1.strobe_period = packet_in.strobe_period; + packet1.strobe_duty_cycle = packet_in.strobe_duty_cycle; + packet1.temp_c = packet_in.temp_c; + packet1.min_strobe_period = packet_in.min_strobe_period; + packet1.max_strobe_period = packet_in.max_strobe_period; + packet1.enable = packet_in.enable; + packet1.mode_bitmask = packet_in.mode_bitmask; + packet1.mode = packet_in.mode; - mav_array_memcpy(packet1.metadata_uri, packet_in.metadata_uri, sizeof(char)*70); - mav_array_memcpy(packet1.translation_uri, packet_in.translation_uri, sizeof(char)*70); #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { // cope with extensions - memset(MAVLINK_MSG_ID_COMPONENT_INFORMATION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_COMPONENT_INFORMATION_MIN_LEN); + memset(MAVLINK_MSG_ID_ILLUMINATOR_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ILLUMINATOR_STATUS_MIN_LEN); } #endif memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_component_information_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_component_information_decode(&msg, &packet2); + mavlink_msg_illuminator_status_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_illuminator_status_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_component_information_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.metadata_type , packet1.metadata_uid , packet1.metadata_uri , packet1.translation_uid , packet1.translation_uri ); - mavlink_msg_component_information_decode(&msg, &packet2); + mavlink_msg_illuminator_status_pack(system_id, component_id, &msg , packet1.uptime_ms , packet1.enable , packet1.mode_bitmask , packet1.error_status , packet1.mode , packet1.brightness , packet1.strobe_period , packet1.strobe_duty_cycle , packet1.temp_c , packet1.min_strobe_period , packet1.max_strobe_period ); + mavlink_msg_illuminator_status_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_component_information_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.metadata_type , packet1.metadata_uid , packet1.metadata_uri , packet1.translation_uid , packet1.translation_uri ); - mavlink_msg_component_information_decode(&msg, &packet2); + mavlink_msg_illuminator_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.uptime_ms , packet1.enable , packet1.mode_bitmask , packet1.error_status , packet1.mode , packet1.brightness , packet1.strobe_period , packet1.strobe_duty_cycle , packet1.temp_c , packet1.min_strobe_period , packet1.max_strobe_period ); + mavlink_msg_illuminator_status_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); @@ -12190,56 +14076,63 @@ static void mavlink_test_component_information(uint8_t system_id, uint8_t compon for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_PLAY_TUNE_V2 >= 256) { + if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_CANFD_FRAME >= 256) { return; } #endif mavlink_message_t msg; uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; uint16_t i; - mavlink_play_tune_v2_t packet_in = { - 963497464,17,84,"GHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRS" + mavlink_canfd_frame_t packet_in = { + 963497464,17,84,151,218,{ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92 } }; - mavlink_play_tune_v2_t packet1, packet2; + mavlink_canfd_frame_t packet1, packet2; memset(&packet1, 0, sizeof(packet1)); - packet1.format = packet_in.format; + packet1.id = packet_in.id; packet1.target_system = packet_in.target_system; packet1.target_component = packet_in.target_component; + packet1.bus = packet_in.bus; + packet1.len = packet_in.len; - mav_array_memcpy(packet1.tune, packet_in.tune, sizeof(char)*248); + mav_array_memcpy(packet1.data, packet_in.data, sizeof(uint8_t)*64); #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { // cope with extensions - memset(MAVLINK_MSG_ID_PLAY_TUNE_V2_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_PLAY_TUNE_V2_MIN_LEN); + memset(MAVLINK_MSG_ID_CANFD_FRAME_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_CANFD_FRAME_MIN_LEN); } #endif memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_play_tune_v2_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_play_tune_v2_decode(&msg, &packet2); + mavlink_msg_canfd_frame_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_canfd_frame_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_play_tune_v2_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.format , packet1.tune ); - mavlink_msg_play_tune_v2_decode(&msg, &packet2); + mavlink_msg_canfd_frame_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.bus , packet1.len , packet1.id , packet1.data ); + mavlink_msg_canfd_frame_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_play_tune_v2_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.format , packet1.tune ); - mavlink_msg_play_tune_v2_decode(&msg, &packet2); + mavlink_msg_canfd_frame_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.bus , packet1.len , packet1.id , packet1.data ); + mavlink_msg_canfd_frame_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); @@ -12247,55 +14140,63 @@ static void mavlink_test_play_tune_v2(uint8_t system_id, uint8_t component_id, m for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SUPPORTED_TUNES >= 256) { + if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_CAN_FILTER_MODIFY >= 256) { return; } #endif mavlink_message_t msg; uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; uint16_t i; - mavlink_supported_tunes_t packet_in = { - 963497464,17,84 + mavlink_can_filter_modify_t packet_in = { + { 17235, 17236, 17237, 17238, 17239, 17240, 17241, 17242, 17243, 17244, 17245, 17246, 17247, 17248, 17249, 17250 },101,168,235,46,113 }; - mavlink_supported_tunes_t packet1, packet2; + mavlink_can_filter_modify_t packet1, packet2; memset(&packet1, 0, sizeof(packet1)); - packet1.format = packet_in.format; packet1.target_system = packet_in.target_system; packet1.target_component = packet_in.target_component; + packet1.bus = packet_in.bus; + packet1.operation = packet_in.operation; + packet1.num_ids = packet_in.num_ids; + mav_array_memcpy(packet1.ids, packet_in.ids, sizeof(uint16_t)*16); #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { // cope with extensions - memset(MAVLINK_MSG_ID_SUPPORTED_TUNES_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SUPPORTED_TUNES_MIN_LEN); + memset(MAVLINK_MSG_ID_CAN_FILTER_MODIFY_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_CAN_FILTER_MODIFY_MIN_LEN); } #endif memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_supported_tunes_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_supported_tunes_decode(&msg, &packet2); + mavlink_msg_can_filter_modify_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_can_filter_modify_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_supported_tunes_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.format ); - mavlink_msg_supported_tunes_decode(&msg, &packet2); + mavlink_msg_can_filter_modify_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.bus , packet1.operation , packet1.num_ids , packet1.ids ); + mavlink_msg_can_filter_modify_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_supported_tunes_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.format ); - mavlink_msg_supported_tunes_decode(&msg, &packet2); + mavlink_msg_can_filter_modify_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.bus , packet1.operation , packet1.num_ids , packet1.ids ); + mavlink_msg_can_filter_modify_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); @@ -12303,13 +14204,18 @@ static void mavlink_test_supported_tunes(uint8_t system_id, uint8_t component_id for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { @@ -12839,12 +14788,12 @@ static void mavlink_test_open_drone_id_message_pack(uint8_t system_id, uint8_t c MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_open_drone_id_message_pack_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.single_message_size , packet1.msg_pack_size , packet1.messages ); + mavlink_msg_open_drone_id_message_pack_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.id_or_mac , packet1.single_message_size , packet1.msg_pack_size , packet1.messages ); mavlink_msg_open_drone_id_message_pack_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_open_drone_id_message_pack_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.single_message_size , packet1.msg_pack_size , packet1.messages ); + mavlink_msg_open_drone_id_message_pack_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.id_or_mac , packet1.single_message_size , packet1.msg_pack_size , packet1.messages ); mavlink_msg_open_drone_id_message_pack_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); @@ -12857,9 +14806,199 @@ static void mavlink_test_open_drone_id_message_pack(uint8_t system_id, uint8_t c MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_open_drone_id_message_pack_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.single_message_size , packet1.msg_pack_size , packet1.messages ); + mavlink_msg_open_drone_id_message_pack_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.id_or_mac , packet1.single_message_size , packet1.msg_pack_size , packet1.messages ); mavlink_msg_open_drone_id_message_pack_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("OPEN_DRONE_ID_MESSAGE_PACK") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK) != NULL); +#endif +} + +static void mavlink_test_open_drone_id_arm_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) +{ +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); + if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_open_drone_id_arm_status_t packet_in = { + 5,"BCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWX" + }; + mavlink_open_drone_id_arm_status_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.status = packet_in.status; + + mav_array_memcpy(packet1.error, packet_in.error, sizeof(char)*50); + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_OPEN_DRONE_ID_ARM_STATUS_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_open_drone_id_arm_status_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_open_drone_id_arm_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_open_drone_id_arm_status_pack(system_id, component_id, &msg , packet1.status , packet1.error ); + mavlink_msg_open_drone_id_arm_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_open_drone_id_arm_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.status , packet1.error ); + mavlink_msg_open_drone_id_arm_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_open_drone_id_system_update_t packet_in = { + 963497464,963497672,73.0,963498088,53,120 + }; + mavlink_open_drone_id_system_update_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.operator_latitude = packet_in.operator_latitude; + packet1.operator_longitude = packet_in.operator_longitude; + packet1.operator_altitude_geo = packet_in.operator_altitude_geo; + packet1.timestamp = packet_in.timestamp; + packet1.target_system = packet_in.target_system; + packet1.target_component = packet_in.target_component; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_open_drone_id_system_update_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_open_drone_id_system_update_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_open_drone_id_system_update_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.operator_latitude , packet1.operator_longitude , packet1.operator_altitude_geo , packet1.timestamp ); + mavlink_msg_open_drone_id_system_update_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_open_drone_id_system_update_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.operator_latitude , packet1.operator_longitude , packet1.operator_altitude_geo , packet1.timestamp ); + mavlink_msg_open_drone_id_system_update_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_HYGROMETER_SENSOR >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_hygrometer_sensor_t packet_in = { + 17235,17339,17 + }; + mavlink_hygrometer_sensor_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.temperature = packet_in.temperature; + packet1.humidity = packet_in.humidity; + packet1.id = packet_in.id; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_HYGROMETER_SENSOR_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_HYGROMETER_SENSOR_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_hygrometer_sensor_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_hygrometer_sensor_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_hygrometer_sensor_pack(system_id, component_id, &msg , packet1.id , packet1.temperature , packet1.humidity ); + mavlink_msg_hygrometer_sensor_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_hygrometer_sensor_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.id , packet1.temperature , packet1.humidity ); + mavlink_msg_hygrometer_sensor_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; imsgid = MAVLINK_MSG_ID_AIRSPEED; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AIRSPEED_MIN_LEN, MAVLINK_MSG_ID_AIRSPEED_LEN, MAVLINK_MSG_ID_AIRSPEED_CRC); +} + +/** + * @brief Pack a airspeed message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param id Sensor ID. + * @param airspeed [m/s] Calibrated airspeed (CAS). + * @param temperature [cdegC] Temperature. INT16_MAX for value unknown/not supplied. + * @param raw_press [hPa] Raw differential pressure. NaN for value unknown/not supplied. + * @param flags Airspeed sensor flags. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_airspeed_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t id, float airspeed, int16_t temperature, float raw_press, uint8_t flags) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_AIRSPEED_LEN]; + _mav_put_float(buf, 0, airspeed); + _mav_put_float(buf, 4, raw_press); + _mav_put_int16_t(buf, 8, temperature); + _mav_put_uint8_t(buf, 10, id); + _mav_put_uint8_t(buf, 11, flags); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AIRSPEED_LEN); +#else + mavlink_airspeed_t packet; + packet.airspeed = airspeed; + packet.raw_press = raw_press; + packet.temperature = temperature; + packet.id = id; + packet.flags = flags; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AIRSPEED_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_AIRSPEED; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_AIRSPEED_MIN_LEN, MAVLINK_MSG_ID_AIRSPEED_LEN, MAVLINK_MSG_ID_AIRSPEED_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_AIRSPEED_MIN_LEN, MAVLINK_MSG_ID_AIRSPEED_LEN); +#endif +} + +/** + * @brief Pack a airspeed message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param id Sensor ID. + * @param airspeed [m/s] Calibrated airspeed (CAS). + * @param temperature [cdegC] Temperature. INT16_MAX for value unknown/not supplied. + * @param raw_press [hPa] Raw differential pressure. NaN for value unknown/not supplied. + * @param flags Airspeed sensor flags. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_airspeed_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t id,float airspeed,int16_t temperature,float raw_press,uint8_t flags) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_AIRSPEED_LEN]; + _mav_put_float(buf, 0, airspeed); + _mav_put_float(buf, 4, raw_press); + _mav_put_int16_t(buf, 8, temperature); + _mav_put_uint8_t(buf, 10, id); + _mav_put_uint8_t(buf, 11, flags); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AIRSPEED_LEN); +#else + mavlink_airspeed_t packet; + packet.airspeed = airspeed; + packet.raw_press = raw_press; + packet.temperature = temperature; + packet.id = id; + packet.flags = flags; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AIRSPEED_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_AIRSPEED; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AIRSPEED_MIN_LEN, MAVLINK_MSG_ID_AIRSPEED_LEN, MAVLINK_MSG_ID_AIRSPEED_CRC); +} + +/** + * @brief Encode a airspeed struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param airspeed C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_airspeed_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_airspeed_t* airspeed) +{ + return mavlink_msg_airspeed_pack(system_id, component_id, msg, airspeed->id, airspeed->airspeed, airspeed->temperature, airspeed->raw_press, airspeed->flags); +} + +/** + * @brief Encode a airspeed struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param airspeed C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_airspeed_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_airspeed_t* airspeed) +{ + return mavlink_msg_airspeed_pack_chan(system_id, component_id, chan, msg, airspeed->id, airspeed->airspeed, airspeed->temperature, airspeed->raw_press, airspeed->flags); +} + +/** + * @brief Encode a airspeed struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param airspeed C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_airspeed_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_airspeed_t* airspeed) +{ + return mavlink_msg_airspeed_pack_status(system_id, component_id, _status, msg, airspeed->id, airspeed->airspeed, airspeed->temperature, airspeed->raw_press, airspeed->flags); +} + +/** + * @brief Send a airspeed message + * @param chan MAVLink channel to send the message + * + * @param id Sensor ID. + * @param airspeed [m/s] Calibrated airspeed (CAS). + * @param temperature [cdegC] Temperature. INT16_MAX for value unknown/not supplied. + * @param raw_press [hPa] Raw differential pressure. NaN for value unknown/not supplied. + * @param flags Airspeed sensor flags. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_airspeed_send(mavlink_channel_t chan, uint8_t id, float airspeed, int16_t temperature, float raw_press, uint8_t flags) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_AIRSPEED_LEN]; + _mav_put_float(buf, 0, airspeed); + _mav_put_float(buf, 4, raw_press); + _mav_put_int16_t(buf, 8, temperature); + _mav_put_uint8_t(buf, 10, id); + _mav_put_uint8_t(buf, 11, flags); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIRSPEED, buf, MAVLINK_MSG_ID_AIRSPEED_MIN_LEN, MAVLINK_MSG_ID_AIRSPEED_LEN, MAVLINK_MSG_ID_AIRSPEED_CRC); +#else + mavlink_airspeed_t packet; + packet.airspeed = airspeed; + packet.raw_press = raw_press; + packet.temperature = temperature; + packet.id = id; + packet.flags = flags; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIRSPEED, (const char *)&packet, MAVLINK_MSG_ID_AIRSPEED_MIN_LEN, MAVLINK_MSG_ID_AIRSPEED_LEN, MAVLINK_MSG_ID_AIRSPEED_CRC); +#endif +} + +/** + * @brief Send a airspeed message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_airspeed_send_struct(mavlink_channel_t chan, const mavlink_airspeed_t* airspeed) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_airspeed_send(chan, airspeed->id, airspeed->airspeed, airspeed->temperature, airspeed->raw_press, airspeed->flags); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIRSPEED, (const char *)airspeed, MAVLINK_MSG_ID_AIRSPEED_MIN_LEN, MAVLINK_MSG_ID_AIRSPEED_LEN, MAVLINK_MSG_ID_AIRSPEED_CRC); +#endif +} + +#if MAVLINK_MSG_ID_AIRSPEED_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_airspeed_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t id, float airspeed, int16_t temperature, float raw_press, uint8_t flags) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_float(buf, 0, airspeed); + _mav_put_float(buf, 4, raw_press); + _mav_put_int16_t(buf, 8, temperature); + _mav_put_uint8_t(buf, 10, id); + _mav_put_uint8_t(buf, 11, flags); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIRSPEED, buf, MAVLINK_MSG_ID_AIRSPEED_MIN_LEN, MAVLINK_MSG_ID_AIRSPEED_LEN, MAVLINK_MSG_ID_AIRSPEED_CRC); +#else + mavlink_airspeed_t *packet = (mavlink_airspeed_t *)msgbuf; + packet->airspeed = airspeed; + packet->raw_press = raw_press; + packet->temperature = temperature; + packet->id = id; + packet->flags = flags; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIRSPEED, (const char *)packet, MAVLINK_MSG_ID_AIRSPEED_MIN_LEN, MAVLINK_MSG_ID_AIRSPEED_LEN, MAVLINK_MSG_ID_AIRSPEED_CRC); +#endif +} +#endif + +#endif + +// MESSAGE AIRSPEED UNPACKING + + +/** + * @brief Get field id from airspeed message + * + * @return Sensor ID. + */ +static inline uint8_t mavlink_msg_airspeed_get_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 10); +} + +/** + * @brief Get field airspeed from airspeed message + * + * @return [m/s] Calibrated airspeed (CAS). + */ +static inline float mavlink_msg_airspeed_get_airspeed(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 0); +} + +/** + * @brief Get field temperature from airspeed message + * + * @return [cdegC] Temperature. INT16_MAX for value unknown/not supplied. + */ +static inline int16_t mavlink_msg_airspeed_get_temperature(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int16_t(msg, 8); +} + +/** + * @brief Get field raw_press from airspeed message + * + * @return [hPa] Raw differential pressure. NaN for value unknown/not supplied. + */ +static inline float mavlink_msg_airspeed_get_raw_press(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 4); +} + +/** + * @brief Get field flags from airspeed message + * + * @return Airspeed sensor flags. + */ +static inline uint8_t mavlink_msg_airspeed_get_flags(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 11); +} + +/** + * @brief Decode a airspeed message into a struct + * + * @param msg The message to decode + * @param airspeed C-struct to decode the message contents into + */ +static inline void mavlink_msg_airspeed_decode(const mavlink_message_t* msg, mavlink_airspeed_t* airspeed) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + airspeed->airspeed = mavlink_msg_airspeed_get_airspeed(msg); + airspeed->raw_press = mavlink_msg_airspeed_get_raw_press(msg); + airspeed->temperature = mavlink_msg_airspeed_get_temperature(msg); + airspeed->id = mavlink_msg_airspeed_get_id(msg); + airspeed->flags = mavlink_msg_airspeed_get_flags(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_AIRSPEED_LEN? msg->len : MAVLINK_MSG_ID_AIRSPEED_LEN; + memset(airspeed, 0, MAVLINK_MSG_ID_AIRSPEED_LEN); + memcpy(airspeed, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/development/mavlink_msg_available_modes.h b/development/mavlink_msg_available_modes.h new file mode 100644 index 000000000..ee7112f24 --- /dev/null +++ b/development/mavlink_msg_available_modes.h @@ -0,0 +1,390 @@ +#pragma once +// MESSAGE AVAILABLE_MODES PACKING + +#define MAVLINK_MSG_ID_AVAILABLE_MODES 435 + + +typedef struct __mavlink_available_modes_t { + uint32_t custom_mode; /*< A bitfield for use for autopilot-specific flags*/ + uint32_t properties; /*< Mode properties.*/ + uint8_t number_modes; /*< The total number of available modes for the current vehicle type.*/ + uint8_t mode_index; /*< The current mode index within number_modes, indexed from 1.*/ + uint8_t standard_mode; /*< Standard mode.*/ + char mode_name[35]; /*< Name of custom mode, with null termination character. Should be omitted for standard modes.*/ +} mavlink_available_modes_t; + +#define MAVLINK_MSG_ID_AVAILABLE_MODES_LEN 46 +#define MAVLINK_MSG_ID_AVAILABLE_MODES_MIN_LEN 46 +#define MAVLINK_MSG_ID_435_LEN 46 +#define MAVLINK_MSG_ID_435_MIN_LEN 46 + +#define MAVLINK_MSG_ID_AVAILABLE_MODES_CRC 134 +#define MAVLINK_MSG_ID_435_CRC 134 + +#define MAVLINK_MSG_AVAILABLE_MODES_FIELD_MODE_NAME_LEN 35 + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_AVAILABLE_MODES { \ + 435, \ + "AVAILABLE_MODES", \ + 6, \ + { { "number_modes", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_available_modes_t, number_modes) }, \ + { "mode_index", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_available_modes_t, mode_index) }, \ + { "standard_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_available_modes_t, standard_mode) }, \ + { "custom_mode", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_available_modes_t, custom_mode) }, \ + { "properties", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_available_modes_t, properties) }, \ + { "mode_name", NULL, MAVLINK_TYPE_CHAR, 35, 11, offsetof(mavlink_available_modes_t, mode_name) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_AVAILABLE_MODES { \ + "AVAILABLE_MODES", \ + 6, \ + { { "number_modes", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_available_modes_t, number_modes) }, \ + { "mode_index", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_available_modes_t, mode_index) }, \ + { "standard_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_available_modes_t, standard_mode) }, \ + { "custom_mode", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_available_modes_t, custom_mode) }, \ + { "properties", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_available_modes_t, properties) }, \ + { "mode_name", NULL, MAVLINK_TYPE_CHAR, 35, 11, offsetof(mavlink_available_modes_t, mode_name) }, \ + } \ +} +#endif + +/** + * @brief Pack a available_modes message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param number_modes The total number of available modes for the current vehicle type. + * @param mode_index The current mode index within number_modes, indexed from 1. + * @param standard_mode Standard mode. + * @param custom_mode A bitfield for use for autopilot-specific flags + * @param properties Mode properties. + * @param mode_name Name of custom mode, with null termination character. Should be omitted for standard modes. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_available_modes_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t number_modes, uint8_t mode_index, uint8_t standard_mode, uint32_t custom_mode, uint32_t properties, const char *mode_name) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_AVAILABLE_MODES_LEN]; + _mav_put_uint32_t(buf, 0, custom_mode); + _mav_put_uint32_t(buf, 4, properties); + _mav_put_uint8_t(buf, 8, number_modes); + _mav_put_uint8_t(buf, 9, mode_index); + _mav_put_uint8_t(buf, 10, standard_mode); + _mav_put_char_array(buf, 11, mode_name, 35); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AVAILABLE_MODES_LEN); +#else + mavlink_available_modes_t packet; + packet.custom_mode = custom_mode; + packet.properties = properties; + packet.number_modes = number_modes; + packet.mode_index = mode_index; + packet.standard_mode = standard_mode; + mav_array_memcpy(packet.mode_name, mode_name, sizeof(char)*35); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AVAILABLE_MODES_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_AVAILABLE_MODES; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AVAILABLE_MODES_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_CRC); +} + +/** + * @brief Pack a available_modes message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param number_modes The total number of available modes for the current vehicle type. + * @param mode_index The current mode index within number_modes, indexed from 1. + * @param standard_mode Standard mode. + * @param custom_mode A bitfield for use for autopilot-specific flags + * @param properties Mode properties. + * @param mode_name Name of custom mode, with null termination character. Should be omitted for standard modes. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_available_modes_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t number_modes, uint8_t mode_index, uint8_t standard_mode, uint32_t custom_mode, uint32_t properties, const char *mode_name) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_AVAILABLE_MODES_LEN]; + _mav_put_uint32_t(buf, 0, custom_mode); + _mav_put_uint32_t(buf, 4, properties); + _mav_put_uint8_t(buf, 8, number_modes); + _mav_put_uint8_t(buf, 9, mode_index); + _mav_put_uint8_t(buf, 10, standard_mode); + _mav_put_char_array(buf, 11, mode_name, 35); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AVAILABLE_MODES_LEN); +#else + mavlink_available_modes_t packet; + packet.custom_mode = custom_mode; + packet.properties = properties; + packet.number_modes = number_modes; + packet.mode_index = mode_index; + packet.standard_mode = standard_mode; + mav_array_memcpy(packet.mode_name, mode_name, sizeof(char)*35); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AVAILABLE_MODES_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_AVAILABLE_MODES; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_AVAILABLE_MODES_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_AVAILABLE_MODES_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_LEN); +#endif +} + +/** + * @brief Pack a available_modes message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param number_modes The total number of available modes for the current vehicle type. + * @param mode_index The current mode index within number_modes, indexed from 1. + * @param standard_mode Standard mode. + * @param custom_mode A bitfield for use for autopilot-specific flags + * @param properties Mode properties. + * @param mode_name Name of custom mode, with null termination character. Should be omitted for standard modes. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_available_modes_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t number_modes,uint8_t mode_index,uint8_t standard_mode,uint32_t custom_mode,uint32_t properties,const char *mode_name) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_AVAILABLE_MODES_LEN]; + _mav_put_uint32_t(buf, 0, custom_mode); + _mav_put_uint32_t(buf, 4, properties); + _mav_put_uint8_t(buf, 8, number_modes); + _mav_put_uint8_t(buf, 9, mode_index); + _mav_put_uint8_t(buf, 10, standard_mode); + _mav_put_char_array(buf, 11, mode_name, 35); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AVAILABLE_MODES_LEN); +#else + mavlink_available_modes_t packet; + packet.custom_mode = custom_mode; + packet.properties = properties; + packet.number_modes = number_modes; + packet.mode_index = mode_index; + packet.standard_mode = standard_mode; + mav_array_memcpy(packet.mode_name, mode_name, sizeof(char)*35); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AVAILABLE_MODES_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_AVAILABLE_MODES; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AVAILABLE_MODES_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_CRC); +} + +/** + * @brief Encode a available_modes struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param available_modes C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_available_modes_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_available_modes_t* available_modes) +{ + return mavlink_msg_available_modes_pack(system_id, component_id, msg, available_modes->number_modes, available_modes->mode_index, available_modes->standard_mode, available_modes->custom_mode, available_modes->properties, available_modes->mode_name); +} + +/** + * @brief Encode a available_modes struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param available_modes C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_available_modes_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_available_modes_t* available_modes) +{ + return mavlink_msg_available_modes_pack_chan(system_id, component_id, chan, msg, available_modes->number_modes, available_modes->mode_index, available_modes->standard_mode, available_modes->custom_mode, available_modes->properties, available_modes->mode_name); +} + +/** + * @brief Encode a available_modes struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param available_modes C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_available_modes_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_available_modes_t* available_modes) +{ + return mavlink_msg_available_modes_pack_status(system_id, component_id, _status, msg, available_modes->number_modes, available_modes->mode_index, available_modes->standard_mode, available_modes->custom_mode, available_modes->properties, available_modes->mode_name); +} + +/** + * @brief Send a available_modes message + * @param chan MAVLink channel to send the message + * + * @param number_modes The total number of available modes for the current vehicle type. + * @param mode_index The current mode index within number_modes, indexed from 1. + * @param standard_mode Standard mode. + * @param custom_mode A bitfield for use for autopilot-specific flags + * @param properties Mode properties. + * @param mode_name Name of custom mode, with null termination character. Should be omitted for standard modes. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_available_modes_send(mavlink_channel_t chan, uint8_t number_modes, uint8_t mode_index, uint8_t standard_mode, uint32_t custom_mode, uint32_t properties, const char *mode_name) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_AVAILABLE_MODES_LEN]; + _mav_put_uint32_t(buf, 0, custom_mode); + _mav_put_uint32_t(buf, 4, properties); + _mav_put_uint8_t(buf, 8, number_modes); + _mav_put_uint8_t(buf, 9, mode_index); + _mav_put_uint8_t(buf, 10, standard_mode); + _mav_put_char_array(buf, 11, mode_name, 35); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AVAILABLE_MODES, buf, MAVLINK_MSG_ID_AVAILABLE_MODES_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_CRC); +#else + mavlink_available_modes_t packet; + packet.custom_mode = custom_mode; + packet.properties = properties; + packet.number_modes = number_modes; + packet.mode_index = mode_index; + packet.standard_mode = standard_mode; + mav_array_memcpy(packet.mode_name, mode_name, sizeof(char)*35); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AVAILABLE_MODES, (const char *)&packet, MAVLINK_MSG_ID_AVAILABLE_MODES_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_CRC); +#endif +} + +/** + * @brief Send a available_modes message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_available_modes_send_struct(mavlink_channel_t chan, const mavlink_available_modes_t* available_modes) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_available_modes_send(chan, available_modes->number_modes, available_modes->mode_index, available_modes->standard_mode, available_modes->custom_mode, available_modes->properties, available_modes->mode_name); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AVAILABLE_MODES, (const char *)available_modes, MAVLINK_MSG_ID_AVAILABLE_MODES_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_CRC); +#endif +} + +#if MAVLINK_MSG_ID_AVAILABLE_MODES_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by re-using + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_available_modes_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t number_modes, uint8_t mode_index, uint8_t standard_mode, uint32_t custom_mode, uint32_t properties, const char *mode_name) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint32_t(buf, 0, custom_mode); + _mav_put_uint32_t(buf, 4, properties); + _mav_put_uint8_t(buf, 8, number_modes); + _mav_put_uint8_t(buf, 9, mode_index); + _mav_put_uint8_t(buf, 10, standard_mode); + _mav_put_char_array(buf, 11, mode_name, 35); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AVAILABLE_MODES, buf, MAVLINK_MSG_ID_AVAILABLE_MODES_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_CRC); +#else + mavlink_available_modes_t *packet = (mavlink_available_modes_t *)msgbuf; + packet->custom_mode = custom_mode; + packet->properties = properties; + packet->number_modes = number_modes; + packet->mode_index = mode_index; + packet->standard_mode = standard_mode; + mav_array_memcpy(packet->mode_name, mode_name, sizeof(char)*35); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AVAILABLE_MODES, (const char *)packet, MAVLINK_MSG_ID_AVAILABLE_MODES_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_CRC); +#endif +} +#endif + +#endif + +// MESSAGE AVAILABLE_MODES UNPACKING + + +/** + * @brief Get field number_modes from available_modes message + * + * @return The total number of available modes for the current vehicle type. + */ +static inline uint8_t mavlink_msg_available_modes_get_number_modes(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 8); +} + +/** + * @brief Get field mode_index from available_modes message + * + * @return The current mode index within number_modes, indexed from 1. + */ +static inline uint8_t mavlink_msg_available_modes_get_mode_index(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 9); +} + +/** + * @brief Get field standard_mode from available_modes message + * + * @return Standard mode. + */ +static inline uint8_t mavlink_msg_available_modes_get_standard_mode(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 10); +} + +/** + * @brief Get field custom_mode from available_modes message + * + * @return A bitfield for use for autopilot-specific flags + */ +static inline uint32_t mavlink_msg_available_modes_get_custom_mode(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 0); +} + +/** + * @brief Get field properties from available_modes message + * + * @return Mode properties. + */ +static inline uint32_t mavlink_msg_available_modes_get_properties(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 4); +} + +/** + * @brief Get field mode_name from available_modes message + * + * @return Name of custom mode, with null termination character. Should be omitted for standard modes. + */ +static inline uint16_t mavlink_msg_available_modes_get_mode_name(const mavlink_message_t* msg, char *mode_name) +{ + return _MAV_RETURN_char_array(msg, mode_name, 35, 11); +} + +/** + * @brief Decode a available_modes message into a struct + * + * @param msg The message to decode + * @param available_modes C-struct to decode the message contents into + */ +static inline void mavlink_msg_available_modes_decode(const mavlink_message_t* msg, mavlink_available_modes_t* available_modes) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + available_modes->custom_mode = mavlink_msg_available_modes_get_custom_mode(msg); + available_modes->properties = mavlink_msg_available_modes_get_properties(msg); + available_modes->number_modes = mavlink_msg_available_modes_get_number_modes(msg); + available_modes->mode_index = mavlink_msg_available_modes_get_mode_index(msg); + available_modes->standard_mode = mavlink_msg_available_modes_get_standard_mode(msg); + mavlink_msg_available_modes_get_mode_name(msg, available_modes->mode_name); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_AVAILABLE_MODES_LEN? msg->len : MAVLINK_MSG_ID_AVAILABLE_MODES_LEN; + memset(available_modes, 0, MAVLINK_MSG_ID_AVAILABLE_MODES_LEN); + memcpy(available_modes, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/development/mavlink_msg_available_modes_monitor.h b/development/mavlink_msg_available_modes_monitor.h new file mode 100644 index 000000000..48821cc2a --- /dev/null +++ b/development/mavlink_msg_available_modes_monitor.h @@ -0,0 +1,260 @@ +#pragma once +// MESSAGE AVAILABLE_MODES_MONITOR PACKING + +#define MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR 437 + + +typedef struct __mavlink_available_modes_monitor_t { + uint8_t seq; /*< Sequence number. The value iterates sequentially whenever AVAILABLE_MODES changes (e.g. support for a new mode is added/removed dynamically).*/ +} mavlink_available_modes_monitor_t; + +#define MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN 1 +#define MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_MIN_LEN 1 +#define MAVLINK_MSG_ID_437_LEN 1 +#define MAVLINK_MSG_ID_437_MIN_LEN 1 + +#define MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_CRC 30 +#define MAVLINK_MSG_ID_437_CRC 30 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_AVAILABLE_MODES_MONITOR { \ + 437, \ + "AVAILABLE_MODES_MONITOR", \ + 1, \ + { { "seq", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_available_modes_monitor_t, seq) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_AVAILABLE_MODES_MONITOR { \ + "AVAILABLE_MODES_MONITOR", \ + 1, \ + { { "seq", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_available_modes_monitor_t, seq) }, \ + } \ +} +#endif + +/** + * @brief Pack a available_modes_monitor message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param seq Sequence number. The value iterates sequentially whenever AVAILABLE_MODES changes (e.g. support for a new mode is added/removed dynamically). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_available_modes_monitor_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t seq) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN]; + _mav_put_uint8_t(buf, 0, seq); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN); +#else + mavlink_available_modes_monitor_t packet; + packet.seq = seq; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_CRC); +} + +/** + * @brief Pack a available_modes_monitor message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param seq Sequence number. The value iterates sequentially whenever AVAILABLE_MODES changes (e.g. support for a new mode is added/removed dynamically). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_available_modes_monitor_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t seq) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN]; + _mav_put_uint8_t(buf, 0, seq); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN); +#else + mavlink_available_modes_monitor_t packet; + packet.seq = seq; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN); +#endif +} + +/** + * @brief Pack a available_modes_monitor message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param seq Sequence number. The value iterates sequentially whenever AVAILABLE_MODES changes (e.g. support for a new mode is added/removed dynamically). + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_available_modes_monitor_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t seq) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN]; + _mav_put_uint8_t(buf, 0, seq); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN); +#else + mavlink_available_modes_monitor_t packet; + packet.seq = seq; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_CRC); +} + +/** + * @brief Encode a available_modes_monitor struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param available_modes_monitor C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_available_modes_monitor_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_available_modes_monitor_t* available_modes_monitor) +{ + return mavlink_msg_available_modes_monitor_pack(system_id, component_id, msg, available_modes_monitor->seq); +} + +/** + * @brief Encode a available_modes_monitor struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param available_modes_monitor C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_available_modes_monitor_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_available_modes_monitor_t* available_modes_monitor) +{ + return mavlink_msg_available_modes_monitor_pack_chan(system_id, component_id, chan, msg, available_modes_monitor->seq); +} + +/** + * @brief Encode a available_modes_monitor struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param available_modes_monitor C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_available_modes_monitor_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_available_modes_monitor_t* available_modes_monitor) +{ + return mavlink_msg_available_modes_monitor_pack_status(system_id, component_id, _status, msg, available_modes_monitor->seq); +} + +/** + * @brief Send a available_modes_monitor message + * @param chan MAVLink channel to send the message + * + * @param seq Sequence number. The value iterates sequentially whenever AVAILABLE_MODES changes (e.g. support for a new mode is added/removed dynamically). + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_available_modes_monitor_send(mavlink_channel_t chan, uint8_t seq) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN]; + _mav_put_uint8_t(buf, 0, seq); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR, buf, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_CRC); +#else + mavlink_available_modes_monitor_t packet; + packet.seq = seq; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR, (const char *)&packet, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_CRC); +#endif +} + +/** + * @brief Send a available_modes_monitor message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_available_modes_monitor_send_struct(mavlink_channel_t chan, const mavlink_available_modes_monitor_t* available_modes_monitor) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_available_modes_monitor_send(chan, available_modes_monitor->seq); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR, (const char *)available_modes_monitor, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_CRC); +#endif +} + +#if MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by re-using + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_available_modes_monitor_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t seq) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint8_t(buf, 0, seq); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR, buf, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_CRC); +#else + mavlink_available_modes_monitor_t *packet = (mavlink_available_modes_monitor_t *)msgbuf; + packet->seq = seq; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR, (const char *)packet, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_MIN_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_CRC); +#endif +} +#endif + +#endif + +// MESSAGE AVAILABLE_MODES_MONITOR UNPACKING + + +/** + * @brief Get field seq from available_modes_monitor message + * + * @return Sequence number. The value iterates sequentially whenever AVAILABLE_MODES changes (e.g. support for a new mode is added/removed dynamically). + */ +static inline uint8_t mavlink_msg_available_modes_monitor_get_seq(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 0); +} + +/** + * @brief Decode a available_modes_monitor message into a struct + * + * @param msg The message to decode + * @param available_modes_monitor C-struct to decode the message contents into + */ +static inline void mavlink_msg_available_modes_monitor_decode(const mavlink_message_t* msg, mavlink_available_modes_monitor_t* available_modes_monitor) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + available_modes_monitor->seq = mavlink_msg_available_modes_monitor_get_seq(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN? msg->len : MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN; + memset(available_modes_monitor, 0, MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR_LEN); + memcpy(available_modes_monitor, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/development/mavlink_msg_battery_status_v2.h b/development/mavlink_msg_battery_status_v2.h new file mode 100644 index 000000000..00d5067e5 --- /dev/null +++ b/development/mavlink_msg_battery_status_v2.h @@ -0,0 +1,456 @@ +#pragma once +// MESSAGE BATTERY_STATUS_V2 PACKING + +#define MAVLINK_MSG_ID_BATTERY_STATUS_V2 369 + + +typedef struct __mavlink_battery_status_v2_t { + float voltage; /*< [V] Battery voltage (total). NaN: field not provided.*/ + float current; /*< [A] Battery current (through all cells/loads). Positive value when discharging and negative if charging. NaN: field not provided.*/ + float capacity_consumed; /*< [Ah] Consumed charge. NaN: field not provided. This is either the consumption since power-on or since the battery was full, depending on the value of MAV_BATTERY_STATUS_FLAGS_CAPACITY_RELATIVE_TO_FULL.*/ + float capacity_remaining; /*< [Ah] Remaining charge (until empty). NaN: field not provided. Note: If MAV_BATTERY_STATUS_FLAGS_CAPACITY_RELATIVE_TO_FULL is unset, this value is based on the assumption the battery was full when the system was powered.*/ + uint32_t status_flags; /*< Fault, health, readiness, and other status indications.*/ + int16_t temperature; /*< [cdegC] Temperature of the whole battery pack (not internal electronics). INT16_MAX field not provided.*/ + uint8_t id; /*< Battery ID*/ + uint8_t percent_remaining; /*< [%] Remaining battery energy. Values: [0-100], UINT8_MAX: field not provided.*/ +} mavlink_battery_status_v2_t; + +#define MAVLINK_MSG_ID_BATTERY_STATUS_V2_LEN 24 +#define MAVLINK_MSG_ID_BATTERY_STATUS_V2_MIN_LEN 24 +#define MAVLINK_MSG_ID_369_LEN 24 +#define MAVLINK_MSG_ID_369_MIN_LEN 24 + +#define MAVLINK_MSG_ID_BATTERY_STATUS_V2_CRC 151 +#define MAVLINK_MSG_ID_369_CRC 151 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_BATTERY_STATUS_V2 { \ + 369, \ + "BATTERY_STATUS_V2", \ + 8, \ + { { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 22, offsetof(mavlink_battery_status_v2_t, id) }, \ + { "temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_battery_status_v2_t, temperature) }, \ + { "voltage", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_battery_status_v2_t, voltage) }, \ + { "current", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_battery_status_v2_t, current) }, \ + { "capacity_consumed", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_battery_status_v2_t, capacity_consumed) }, \ + { "capacity_remaining", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_battery_status_v2_t, capacity_remaining) }, \ + { "percent_remaining", NULL, MAVLINK_TYPE_UINT8_T, 0, 23, offsetof(mavlink_battery_status_v2_t, percent_remaining) }, \ + { "status_flags", NULL, MAVLINK_TYPE_UINT32_T, 0, 16, offsetof(mavlink_battery_status_v2_t, status_flags) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_BATTERY_STATUS_V2 { \ + "BATTERY_STATUS_V2", \ + 8, \ + { { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 22, offsetof(mavlink_battery_status_v2_t, id) }, \ + { "temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_battery_status_v2_t, temperature) }, \ + { "voltage", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_battery_status_v2_t, voltage) }, \ + { "current", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_battery_status_v2_t, current) }, \ + { "capacity_consumed", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_battery_status_v2_t, capacity_consumed) }, \ + { "capacity_remaining", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_battery_status_v2_t, capacity_remaining) }, \ + { "percent_remaining", NULL, MAVLINK_TYPE_UINT8_T, 0, 23, offsetof(mavlink_battery_status_v2_t, percent_remaining) }, \ + { "status_flags", NULL, MAVLINK_TYPE_UINT32_T, 0, 16, offsetof(mavlink_battery_status_v2_t, status_flags) }, \ + } \ +} +#endif + +/** + * @brief Pack a battery_status_v2 message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param id Battery ID + * @param temperature [cdegC] Temperature of the whole battery pack (not internal electronics). INT16_MAX field not provided. + * @param voltage [V] Battery voltage (total). NaN: field not provided. + * @param current [A] Battery current (through all cells/loads). Positive value when discharging and negative if charging. NaN: field not provided. + * @param capacity_consumed [Ah] Consumed charge. NaN: field not provided. This is either the consumption since power-on or since the battery was full, depending on the value of MAV_BATTERY_STATUS_FLAGS_CAPACITY_RELATIVE_TO_FULL. + * @param capacity_remaining [Ah] Remaining charge (until empty). NaN: field not provided. Note: If MAV_BATTERY_STATUS_FLAGS_CAPACITY_RELATIVE_TO_FULL is unset, this value is based on the assumption the battery was full when the system was powered. + * @param percent_remaining [%] Remaining battery energy. Values: [0-100], UINT8_MAX: field not provided. + * @param status_flags Fault, health, readiness, and other status indications. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_battery_status_v2_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t id, int16_t temperature, float voltage, float current, float capacity_consumed, float capacity_remaining, uint8_t percent_remaining, uint32_t status_flags) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_BATTERY_STATUS_V2_LEN]; + _mav_put_float(buf, 0, voltage); + _mav_put_float(buf, 4, current); + _mav_put_float(buf, 8, capacity_consumed); + _mav_put_float(buf, 12, capacity_remaining); + _mav_put_uint32_t(buf, 16, status_flags); + _mav_put_int16_t(buf, 20, temperature); + _mav_put_uint8_t(buf, 22, id); + _mav_put_uint8_t(buf, 23, percent_remaining); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_BATTERY_STATUS_V2_LEN); +#else + mavlink_battery_status_v2_t packet; + packet.voltage = voltage; + packet.current = current; + packet.capacity_consumed = capacity_consumed; + packet.capacity_remaining = capacity_remaining; + packet.status_flags = status_flags; + packet.temperature = temperature; + packet.id = id; + packet.percent_remaining = percent_remaining; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_BATTERY_STATUS_V2_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_BATTERY_STATUS_V2; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_BATTERY_STATUS_V2_MIN_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_V2_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_V2_CRC); +} + +/** + * @brief Pack a battery_status_v2 message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param id Battery ID + * @param temperature [cdegC] Temperature of the whole battery pack (not internal electronics). INT16_MAX field not provided. + * @param voltage [V] Battery voltage (total). NaN: field not provided. + * @param current [A] Battery current (through all cells/loads). Positive value when discharging and negative if charging. NaN: field not provided. + * @param capacity_consumed [Ah] Consumed charge. NaN: field not provided. This is either the consumption since power-on or since the battery was full, depending on the value of MAV_BATTERY_STATUS_FLAGS_CAPACITY_RELATIVE_TO_FULL. + * @param capacity_remaining [Ah] Remaining charge (until empty). NaN: field not provided. Note: If MAV_BATTERY_STATUS_FLAGS_CAPACITY_RELATIVE_TO_FULL is unset, this value is based on the assumption the battery was full when the system was powered. + * @param percent_remaining [%] Remaining battery energy. Values: [0-100], UINT8_MAX: field not provided. + * @param status_flags Fault, health, readiness, and other status indications. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_battery_status_v2_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t id, int16_t temperature, float voltage, float current, float capacity_consumed, float capacity_remaining, uint8_t percent_remaining, uint32_t status_flags) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_BATTERY_STATUS_V2_LEN]; + _mav_put_float(buf, 0, voltage); + _mav_put_float(buf, 4, current); + _mav_put_float(buf, 8, capacity_consumed); + _mav_put_float(buf, 12, capacity_remaining); + _mav_put_uint32_t(buf, 16, status_flags); + _mav_put_int16_t(buf, 20, temperature); + _mav_put_uint8_t(buf, 22, id); + _mav_put_uint8_t(buf, 23, percent_remaining); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_BATTERY_STATUS_V2_LEN); +#else + mavlink_battery_status_v2_t packet; + packet.voltage = voltage; + packet.current = current; + packet.capacity_consumed = capacity_consumed; + packet.capacity_remaining = capacity_remaining; + packet.status_flags = status_flags; + packet.temperature = temperature; + packet.id = id; + packet.percent_remaining = percent_remaining; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_BATTERY_STATUS_V2_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_BATTERY_STATUS_V2; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_BATTERY_STATUS_V2_MIN_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_V2_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_V2_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_BATTERY_STATUS_V2_MIN_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_V2_LEN); +#endif +} + +/** + * @brief Pack a battery_status_v2 message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param id Battery ID + * @param temperature [cdegC] Temperature of the whole battery pack (not internal electronics). INT16_MAX field not provided. + * @param voltage [V] Battery voltage (total). NaN: field not provided. + * @param current [A] Battery current (through all cells/loads). Positive value when discharging and negative if charging. NaN: field not provided. + * @param capacity_consumed [Ah] Consumed charge. NaN: field not provided. This is either the consumption since power-on or since the battery was full, depending on the value of MAV_BATTERY_STATUS_FLAGS_CAPACITY_RELATIVE_TO_FULL. + * @param capacity_remaining [Ah] Remaining charge (until empty). NaN: field not provided. Note: If MAV_BATTERY_STATUS_FLAGS_CAPACITY_RELATIVE_TO_FULL is unset, this value is based on the assumption the battery was full when the system was powered. + * @param percent_remaining [%] Remaining battery energy. Values: [0-100], UINT8_MAX: field not provided. + * @param status_flags Fault, health, readiness, and other status indications. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_battery_status_v2_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t id,int16_t temperature,float voltage,float current,float capacity_consumed,float capacity_remaining,uint8_t percent_remaining,uint32_t status_flags) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_BATTERY_STATUS_V2_LEN]; + _mav_put_float(buf, 0, voltage); + _mav_put_float(buf, 4, current); + _mav_put_float(buf, 8, capacity_consumed); + _mav_put_float(buf, 12, capacity_remaining); + _mav_put_uint32_t(buf, 16, status_flags); + _mav_put_int16_t(buf, 20, temperature); + _mav_put_uint8_t(buf, 22, id); + _mav_put_uint8_t(buf, 23, percent_remaining); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_BATTERY_STATUS_V2_LEN); +#else + mavlink_battery_status_v2_t packet; + packet.voltage = voltage; + packet.current = current; + packet.capacity_consumed = capacity_consumed; + packet.capacity_remaining = capacity_remaining; + packet.status_flags = status_flags; + packet.temperature = temperature; + packet.id = id; + packet.percent_remaining = percent_remaining; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_BATTERY_STATUS_V2_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_BATTERY_STATUS_V2; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_BATTERY_STATUS_V2_MIN_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_V2_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_V2_CRC); +} + +/** + * @brief Encode a battery_status_v2 struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param battery_status_v2 C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_battery_status_v2_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_battery_status_v2_t* battery_status_v2) +{ + return mavlink_msg_battery_status_v2_pack(system_id, component_id, msg, battery_status_v2->id, battery_status_v2->temperature, battery_status_v2->voltage, battery_status_v2->current, battery_status_v2->capacity_consumed, battery_status_v2->capacity_remaining, battery_status_v2->percent_remaining, battery_status_v2->status_flags); +} + +/** + * @brief Encode a battery_status_v2 struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param battery_status_v2 C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_battery_status_v2_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_battery_status_v2_t* battery_status_v2) +{ + return mavlink_msg_battery_status_v2_pack_chan(system_id, component_id, chan, msg, battery_status_v2->id, battery_status_v2->temperature, battery_status_v2->voltage, battery_status_v2->current, battery_status_v2->capacity_consumed, battery_status_v2->capacity_remaining, battery_status_v2->percent_remaining, battery_status_v2->status_flags); +} + +/** + * @brief Encode a battery_status_v2 struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param battery_status_v2 C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_battery_status_v2_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_battery_status_v2_t* battery_status_v2) +{ + return mavlink_msg_battery_status_v2_pack_status(system_id, component_id, _status, msg, battery_status_v2->id, battery_status_v2->temperature, battery_status_v2->voltage, battery_status_v2->current, battery_status_v2->capacity_consumed, battery_status_v2->capacity_remaining, battery_status_v2->percent_remaining, battery_status_v2->status_flags); +} + +/** + * @brief Send a battery_status_v2 message + * @param chan MAVLink channel to send the message + * + * @param id Battery ID + * @param temperature [cdegC] Temperature of the whole battery pack (not internal electronics). INT16_MAX field not provided. + * @param voltage [V] Battery voltage (total). NaN: field not provided. + * @param current [A] Battery current (through all cells/loads). Positive value when discharging and negative if charging. NaN: field not provided. + * @param capacity_consumed [Ah] Consumed charge. NaN: field not provided. This is either the consumption since power-on or since the battery was full, depending on the value of MAV_BATTERY_STATUS_FLAGS_CAPACITY_RELATIVE_TO_FULL. + * @param capacity_remaining [Ah] Remaining charge (until empty). NaN: field not provided. Note: If MAV_BATTERY_STATUS_FLAGS_CAPACITY_RELATIVE_TO_FULL is unset, this value is based on the assumption the battery was full when the system was powered. + * @param percent_remaining [%] Remaining battery energy. Values: [0-100], UINT8_MAX: field not provided. + * @param status_flags Fault, health, readiness, and other status indications. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_battery_status_v2_send(mavlink_channel_t chan, uint8_t id, int16_t temperature, float voltage, float current, float capacity_consumed, float capacity_remaining, uint8_t percent_remaining, uint32_t status_flags) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_BATTERY_STATUS_V2_LEN]; + _mav_put_float(buf, 0, voltage); + _mav_put_float(buf, 4, current); + _mav_put_float(buf, 8, capacity_consumed); + _mav_put_float(buf, 12, capacity_remaining); + _mav_put_uint32_t(buf, 16, status_flags); + _mav_put_int16_t(buf, 20, temperature); + _mav_put_uint8_t(buf, 22, id); + _mav_put_uint8_t(buf, 23, percent_remaining); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BATTERY_STATUS_V2, buf, MAVLINK_MSG_ID_BATTERY_STATUS_V2_MIN_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_V2_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_V2_CRC); +#else + mavlink_battery_status_v2_t packet; + packet.voltage = voltage; + packet.current = current; + packet.capacity_consumed = capacity_consumed; + packet.capacity_remaining = capacity_remaining; + packet.status_flags = status_flags; + packet.temperature = temperature; + packet.id = id; + packet.percent_remaining = percent_remaining; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BATTERY_STATUS_V2, (const char *)&packet, MAVLINK_MSG_ID_BATTERY_STATUS_V2_MIN_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_V2_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_V2_CRC); +#endif +} + +/** + * @brief Send a battery_status_v2 message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_battery_status_v2_send_struct(mavlink_channel_t chan, const mavlink_battery_status_v2_t* battery_status_v2) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_battery_status_v2_send(chan, battery_status_v2->id, battery_status_v2->temperature, battery_status_v2->voltage, battery_status_v2->current, battery_status_v2->capacity_consumed, battery_status_v2->capacity_remaining, battery_status_v2->percent_remaining, battery_status_v2->status_flags); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BATTERY_STATUS_V2, (const char *)battery_status_v2, MAVLINK_MSG_ID_BATTERY_STATUS_V2_MIN_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_V2_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_V2_CRC); +#endif +} + +#if MAVLINK_MSG_ID_BATTERY_STATUS_V2_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_battery_status_v2_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t id, int16_t temperature, float voltage, float current, float capacity_consumed, float capacity_remaining, uint8_t percent_remaining, uint32_t status_flags) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_float(buf, 0, voltage); + _mav_put_float(buf, 4, current); + _mav_put_float(buf, 8, capacity_consumed); + _mav_put_float(buf, 12, capacity_remaining); + _mav_put_uint32_t(buf, 16, status_flags); + _mav_put_int16_t(buf, 20, temperature); + _mav_put_uint8_t(buf, 22, id); + _mav_put_uint8_t(buf, 23, percent_remaining); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BATTERY_STATUS_V2, buf, MAVLINK_MSG_ID_BATTERY_STATUS_V2_MIN_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_V2_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_V2_CRC); +#else + mavlink_battery_status_v2_t *packet = (mavlink_battery_status_v2_t *)msgbuf; + packet->voltage = voltage; + packet->current = current; + packet->capacity_consumed = capacity_consumed; + packet->capacity_remaining = capacity_remaining; + packet->status_flags = status_flags; + packet->temperature = temperature; + packet->id = id; + packet->percent_remaining = percent_remaining; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BATTERY_STATUS_V2, (const char *)packet, MAVLINK_MSG_ID_BATTERY_STATUS_V2_MIN_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_V2_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_V2_CRC); +#endif +} +#endif + +#endif + +// MESSAGE BATTERY_STATUS_V2 UNPACKING + + +/** + * @brief Get field id from battery_status_v2 message + * + * @return Battery ID + */ +static inline uint8_t mavlink_msg_battery_status_v2_get_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 22); +} + +/** + * @brief Get field temperature from battery_status_v2 message + * + * @return [cdegC] Temperature of the whole battery pack (not internal electronics). INT16_MAX field not provided. + */ +static inline int16_t mavlink_msg_battery_status_v2_get_temperature(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int16_t(msg, 20); +} + +/** + * @brief Get field voltage from battery_status_v2 message + * + * @return [V] Battery voltage (total). NaN: field not provided. + */ +static inline float mavlink_msg_battery_status_v2_get_voltage(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 0); +} + +/** + * @brief Get field current from battery_status_v2 message + * + * @return [A] Battery current (through all cells/loads). Positive value when discharging and negative if charging. NaN: field not provided. + */ +static inline float mavlink_msg_battery_status_v2_get_current(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 4); +} + +/** + * @brief Get field capacity_consumed from battery_status_v2 message + * + * @return [Ah] Consumed charge. NaN: field not provided. This is either the consumption since power-on or since the battery was full, depending on the value of MAV_BATTERY_STATUS_FLAGS_CAPACITY_RELATIVE_TO_FULL. + */ +static inline float mavlink_msg_battery_status_v2_get_capacity_consumed(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 8); +} + +/** + * @brief Get field capacity_remaining from battery_status_v2 message + * + * @return [Ah] Remaining charge (until empty). NaN: field not provided. Note: If MAV_BATTERY_STATUS_FLAGS_CAPACITY_RELATIVE_TO_FULL is unset, this value is based on the assumption the battery was full when the system was powered. + */ +static inline float mavlink_msg_battery_status_v2_get_capacity_remaining(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 12); +} + +/** + * @brief Get field percent_remaining from battery_status_v2 message + * + * @return [%] Remaining battery energy. Values: [0-100], UINT8_MAX: field not provided. + */ +static inline uint8_t mavlink_msg_battery_status_v2_get_percent_remaining(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 23); +} + +/** + * @brief Get field status_flags from battery_status_v2 message + * + * @return Fault, health, readiness, and other status indications. + */ +static inline uint32_t mavlink_msg_battery_status_v2_get_status_flags(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 16); +} + +/** + * @brief Decode a battery_status_v2 message into a struct + * + * @param msg The message to decode + * @param battery_status_v2 C-struct to decode the message contents into + */ +static inline void mavlink_msg_battery_status_v2_decode(const mavlink_message_t* msg, mavlink_battery_status_v2_t* battery_status_v2) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + battery_status_v2->voltage = mavlink_msg_battery_status_v2_get_voltage(msg); + battery_status_v2->current = mavlink_msg_battery_status_v2_get_current(msg); + battery_status_v2->capacity_consumed = mavlink_msg_battery_status_v2_get_capacity_consumed(msg); + battery_status_v2->capacity_remaining = mavlink_msg_battery_status_v2_get_capacity_remaining(msg); + battery_status_v2->status_flags = mavlink_msg_battery_status_v2_get_status_flags(msg); + battery_status_v2->temperature = mavlink_msg_battery_status_v2_get_temperature(msg); + battery_status_v2->id = mavlink_msg_battery_status_v2_get_id(msg); + battery_status_v2->percent_remaining = mavlink_msg_battery_status_v2_get_percent_remaining(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_BATTERY_STATUS_V2_LEN? msg->len : MAVLINK_MSG_ID_BATTERY_STATUS_V2_LEN; + memset(battery_status_v2, 0, MAVLINK_MSG_ID_BATTERY_STATUS_V2_LEN); + memcpy(battery_status_v2, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/development/mavlink_msg_cellular_modem_information.h b/development/mavlink_msg_cellular_modem_information.h new file mode 100644 index 000000000..8b27234c9 --- /dev/null +++ b/development/mavlink_msg_cellular_modem_information.h @@ -0,0 +1,421 @@ +#pragma once +// MESSAGE CELLULAR_MODEM_INFORMATION PACKING + +#define MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION 337 + + +typedef struct __mavlink_cellular_modem_information_t { + uint64_t imei; /*< Unique Modem International Mobile Equipment Identity Number.*/ + uint64_t imsi; /*< Current SIM International mobile subscriber identity.*/ + uint8_t id; /*< Modem instance number. Indexed from 1. Matches index in corresponding CELLULAR_STATUS message.*/ + char modem_id[10]; /*< Unique id for modem. This must be NULL terminated if the length is less than 10 human-readable chars, and without the null termination (NULL) byte if the length is exactly 10 chars.*/ + char iccid[20]; /*< Integrated Circuit Card Identification Number of SIM Card. This must be NULL terminated if the length is less than 20 human-readable chars, and without the null termination (NULL) byte if the length is exactly 20 chars.*/ + char firmware[24]; /*< The firmware version installed on the modem. This must be NULL terminated if the length is less than 24 human-readable chars, and without the null termination (NULL) byte if the length is exactly 24 chars. The format is not intended for display.*/ + char modem_model[50]; /*< Modem model name. This must be NULL terminated if the length is less than 50 human-readable chars, and without the null termination (NULL) byte if the length is exactly 50 chars.*/ +} mavlink_cellular_modem_information_t; + +#define MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_LEN 121 +#define MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_MIN_LEN 121 +#define MAVLINK_MSG_ID_337_LEN 121 +#define MAVLINK_MSG_ID_337_MIN_LEN 121 + +#define MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_CRC 198 +#define MAVLINK_MSG_ID_337_CRC 198 + +#define MAVLINK_MSG_CELLULAR_MODEM_INFORMATION_FIELD_MODEM_ID_LEN 10 +#define MAVLINK_MSG_CELLULAR_MODEM_INFORMATION_FIELD_ICCID_LEN 20 +#define MAVLINK_MSG_CELLULAR_MODEM_INFORMATION_FIELD_FIRMWARE_LEN 24 +#define MAVLINK_MSG_CELLULAR_MODEM_INFORMATION_FIELD_MODEM_MODEL_LEN 50 + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_CELLULAR_MODEM_INFORMATION { \ + 337, \ + "CELLULAR_MODEM_INFORMATION", \ + 7, \ + { { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_cellular_modem_information_t, id) }, \ + { "imei", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_cellular_modem_information_t, imei) }, \ + { "imsi", NULL, MAVLINK_TYPE_UINT64_T, 0, 8, offsetof(mavlink_cellular_modem_information_t, imsi) }, \ + { "modem_id", NULL, MAVLINK_TYPE_CHAR, 10, 17, offsetof(mavlink_cellular_modem_information_t, modem_id) }, \ + { "iccid", NULL, MAVLINK_TYPE_CHAR, 20, 27, offsetof(mavlink_cellular_modem_information_t, iccid) }, \ + { "firmware", NULL, MAVLINK_TYPE_CHAR, 24, 47, offsetof(mavlink_cellular_modem_information_t, firmware) }, \ + { "modem_model", NULL, MAVLINK_TYPE_CHAR, 50, 71, offsetof(mavlink_cellular_modem_information_t, modem_model) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_CELLULAR_MODEM_INFORMATION { \ + "CELLULAR_MODEM_INFORMATION", \ + 7, \ + { { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_cellular_modem_information_t, id) }, \ + { "imei", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_cellular_modem_information_t, imei) }, \ + { "imsi", NULL, MAVLINK_TYPE_UINT64_T, 0, 8, offsetof(mavlink_cellular_modem_information_t, imsi) }, \ + { "modem_id", NULL, MAVLINK_TYPE_CHAR, 10, 17, offsetof(mavlink_cellular_modem_information_t, modem_id) }, \ + { "iccid", NULL, MAVLINK_TYPE_CHAR, 20, 27, offsetof(mavlink_cellular_modem_information_t, iccid) }, \ + { "firmware", NULL, MAVLINK_TYPE_CHAR, 24, 47, offsetof(mavlink_cellular_modem_information_t, firmware) }, \ + { "modem_model", NULL, MAVLINK_TYPE_CHAR, 50, 71, offsetof(mavlink_cellular_modem_information_t, modem_model) }, \ + } \ +} +#endif + +/** + * @brief Pack a cellular_modem_information message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param id Modem instance number. Indexed from 1. Matches index in corresponding CELLULAR_STATUS message. + * @param imei Unique Modem International Mobile Equipment Identity Number. + * @param imsi Current SIM International mobile subscriber identity. + * @param modem_id Unique id for modem. This must be NULL terminated if the length is less than 10 human-readable chars, and without the null termination (NULL) byte if the length is exactly 10 chars. + * @param iccid Integrated Circuit Card Identification Number of SIM Card. This must be NULL terminated if the length is less than 20 human-readable chars, and without the null termination (NULL) byte if the length is exactly 20 chars. + * @param firmware The firmware version installed on the modem. This must be NULL terminated if the length is less than 24 human-readable chars, and without the null termination (NULL) byte if the length is exactly 24 chars. The format is not intended for display. + * @param modem_model Modem model name. This must be NULL terminated if the length is less than 50 human-readable chars, and without the null termination (NULL) byte if the length is exactly 50 chars. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_cellular_modem_information_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t id, uint64_t imei, uint64_t imsi, const char *modem_id, const char *iccid, const char *firmware, const char *modem_model) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_LEN]; + _mav_put_uint64_t(buf, 0, imei); + _mav_put_uint64_t(buf, 8, imsi); + _mav_put_uint8_t(buf, 16, id); + _mav_put_char_array(buf, 17, modem_id, 10); + _mav_put_char_array(buf, 27, iccid, 20); + _mav_put_char_array(buf, 47, firmware, 24); + _mav_put_char_array(buf, 71, modem_model, 50); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_LEN); +#else + mavlink_cellular_modem_information_t packet; + packet.imei = imei; + packet.imsi = imsi; + packet.id = id; + mav_array_assign_char(packet.modem_id, modem_id, 10); + mav_array_assign_char(packet.iccid, iccid, 20); + mav_array_assign_char(packet.firmware, firmware, 24); + mav_array_assign_char(packet.modem_model, modem_model, 50); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_LEN, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_CRC); +} + +/** + * @brief Pack a cellular_modem_information message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param id Modem instance number. Indexed from 1. Matches index in corresponding CELLULAR_STATUS message. + * @param imei Unique Modem International Mobile Equipment Identity Number. + * @param imsi Current SIM International mobile subscriber identity. + * @param modem_id Unique id for modem. This must be NULL terminated if the length is less than 10 human-readable chars, and without the null termination (NULL) byte if the length is exactly 10 chars. + * @param iccid Integrated Circuit Card Identification Number of SIM Card. This must be NULL terminated if the length is less than 20 human-readable chars, and without the null termination (NULL) byte if the length is exactly 20 chars. + * @param firmware The firmware version installed on the modem. This must be NULL terminated if the length is less than 24 human-readable chars, and without the null termination (NULL) byte if the length is exactly 24 chars. The format is not intended for display. + * @param modem_model Modem model name. This must be NULL terminated if the length is less than 50 human-readable chars, and without the null termination (NULL) byte if the length is exactly 50 chars. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_cellular_modem_information_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t id, uint64_t imei, uint64_t imsi, const char *modem_id, const char *iccid, const char *firmware, const char *modem_model) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_LEN]; + _mav_put_uint64_t(buf, 0, imei); + _mav_put_uint64_t(buf, 8, imsi); + _mav_put_uint8_t(buf, 16, id); + _mav_put_char_array(buf, 17, modem_id, 10); + _mav_put_char_array(buf, 27, iccid, 20); + _mav_put_char_array(buf, 47, firmware, 24); + _mav_put_char_array(buf, 71, modem_model, 50); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_LEN); +#else + mavlink_cellular_modem_information_t packet; + packet.imei = imei; + packet.imsi = imsi; + packet.id = id; + mav_array_memcpy(packet.modem_id, modem_id, sizeof(char)*10); + mav_array_memcpy(packet.iccid, iccid, sizeof(char)*20); + mav_array_memcpy(packet.firmware, firmware, sizeof(char)*24); + mav_array_memcpy(packet.modem_model, modem_model, sizeof(char)*50); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_LEN, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_LEN); +#endif +} + +/** + * @brief Pack a cellular_modem_information message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param id Modem instance number. Indexed from 1. Matches index in corresponding CELLULAR_STATUS message. + * @param imei Unique Modem International Mobile Equipment Identity Number. + * @param imsi Current SIM International mobile subscriber identity. + * @param modem_id Unique id for modem. This must be NULL terminated if the length is less than 10 human-readable chars, and without the null termination (NULL) byte if the length is exactly 10 chars. + * @param iccid Integrated Circuit Card Identification Number of SIM Card. This must be NULL terminated if the length is less than 20 human-readable chars, and without the null termination (NULL) byte if the length is exactly 20 chars. + * @param firmware The firmware version installed on the modem. This must be NULL terminated if the length is less than 24 human-readable chars, and without the null termination (NULL) byte if the length is exactly 24 chars. The format is not intended for display. + * @param modem_model Modem model name. This must be NULL terminated if the length is less than 50 human-readable chars, and without the null termination (NULL) byte if the length is exactly 50 chars. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_cellular_modem_information_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t id,uint64_t imei,uint64_t imsi,const char *modem_id,const char *iccid,const char *firmware,const char *modem_model) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_LEN]; + _mav_put_uint64_t(buf, 0, imei); + _mav_put_uint64_t(buf, 8, imsi); + _mav_put_uint8_t(buf, 16, id); + _mav_put_char_array(buf, 17, modem_id, 10); + _mav_put_char_array(buf, 27, iccid, 20); + _mav_put_char_array(buf, 47, firmware, 24); + _mav_put_char_array(buf, 71, modem_model, 50); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_LEN); +#else + mavlink_cellular_modem_information_t packet; + packet.imei = imei; + packet.imsi = imsi; + packet.id = id; + mav_array_assign_char(packet.modem_id, modem_id, 10); + mav_array_assign_char(packet.iccid, iccid, 20); + mav_array_assign_char(packet.firmware, firmware, 24); + mav_array_assign_char(packet.modem_model, modem_model, 50); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_LEN, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_CRC); +} + +/** + * @brief Encode a cellular_modem_information struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param cellular_modem_information C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_cellular_modem_information_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_cellular_modem_information_t* cellular_modem_information) +{ + return mavlink_msg_cellular_modem_information_pack(system_id, component_id, msg, cellular_modem_information->id, cellular_modem_information->imei, cellular_modem_information->imsi, cellular_modem_information->modem_id, cellular_modem_information->iccid, cellular_modem_information->firmware, cellular_modem_information->modem_model); +} + +/** + * @brief Encode a cellular_modem_information struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param cellular_modem_information C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_cellular_modem_information_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_cellular_modem_information_t* cellular_modem_information) +{ + return mavlink_msg_cellular_modem_information_pack_chan(system_id, component_id, chan, msg, cellular_modem_information->id, cellular_modem_information->imei, cellular_modem_information->imsi, cellular_modem_information->modem_id, cellular_modem_information->iccid, cellular_modem_information->firmware, cellular_modem_information->modem_model); +} + +/** + * @brief Encode a cellular_modem_information struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param cellular_modem_information C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_cellular_modem_information_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_cellular_modem_information_t* cellular_modem_information) +{ + return mavlink_msg_cellular_modem_information_pack_status(system_id, component_id, _status, msg, cellular_modem_information->id, cellular_modem_information->imei, cellular_modem_information->imsi, cellular_modem_information->modem_id, cellular_modem_information->iccid, cellular_modem_information->firmware, cellular_modem_information->modem_model); +} + +/** + * @brief Send a cellular_modem_information message + * @param chan MAVLink channel to send the message + * + * @param id Modem instance number. Indexed from 1. Matches index in corresponding CELLULAR_STATUS message. + * @param imei Unique Modem International Mobile Equipment Identity Number. + * @param imsi Current SIM International mobile subscriber identity. + * @param modem_id Unique id for modem. This must be NULL terminated if the length is less than 10 human-readable chars, and without the null termination (NULL) byte if the length is exactly 10 chars. + * @param iccid Integrated Circuit Card Identification Number of SIM Card. This must be NULL terminated if the length is less than 20 human-readable chars, and without the null termination (NULL) byte if the length is exactly 20 chars. + * @param firmware The firmware version installed on the modem. This must be NULL terminated if the length is less than 24 human-readable chars, and without the null termination (NULL) byte if the length is exactly 24 chars. The format is not intended for display. + * @param modem_model Modem model name. This must be NULL terminated if the length is less than 50 human-readable chars, and without the null termination (NULL) byte if the length is exactly 50 chars. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_cellular_modem_information_send(mavlink_channel_t chan, uint8_t id, uint64_t imei, uint64_t imsi, const char *modem_id, const char *iccid, const char *firmware, const char *modem_model) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_LEN]; + _mav_put_uint64_t(buf, 0, imei); + _mav_put_uint64_t(buf, 8, imsi); + _mav_put_uint8_t(buf, 16, id); + _mav_put_char_array(buf, 17, modem_id, 10); + _mav_put_char_array(buf, 27, iccid, 20); + _mav_put_char_array(buf, 47, firmware, 24); + _mav_put_char_array(buf, 71, modem_model, 50); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION, buf, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_LEN, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_CRC); +#else + mavlink_cellular_modem_information_t packet; + packet.imei = imei; + packet.imsi = imsi; + packet.id = id; + mav_array_assign_char(packet.modem_id, modem_id, 10); + mav_array_assign_char(packet.iccid, iccid, 20); + mav_array_assign_char(packet.firmware, firmware, 24); + mav_array_assign_char(packet.modem_model, modem_model, 50); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION, (const char *)&packet, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_LEN, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_CRC); +#endif +} + +/** + * @brief Send a cellular_modem_information message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_cellular_modem_information_send_struct(mavlink_channel_t chan, const mavlink_cellular_modem_information_t* cellular_modem_information) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_cellular_modem_information_send(chan, cellular_modem_information->id, cellular_modem_information->imei, cellular_modem_information->imsi, cellular_modem_information->modem_id, cellular_modem_information->iccid, cellular_modem_information->firmware, cellular_modem_information->modem_model); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION, (const char *)cellular_modem_information, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_LEN, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_CRC); +#endif +} + +#if MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_cellular_modem_information_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t id, uint64_t imei, uint64_t imsi, const char *modem_id, const char *iccid, const char *firmware, const char *modem_model) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint64_t(buf, 0, imei); + _mav_put_uint64_t(buf, 8, imsi); + _mav_put_uint8_t(buf, 16, id); + _mav_put_char_array(buf, 17, modem_id, 10); + _mav_put_char_array(buf, 27, iccid, 20); + _mav_put_char_array(buf, 47, firmware, 24); + _mav_put_char_array(buf, 71, modem_model, 50); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION, buf, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_LEN, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_CRC); +#else + mavlink_cellular_modem_information_t *packet = (mavlink_cellular_modem_information_t *)msgbuf; + packet->imei = imei; + packet->imsi = imsi; + packet->id = id; + mav_array_assign_char(packet->modem_id, modem_id, 10); + mav_array_assign_char(packet->iccid, iccid, 20); + mav_array_assign_char(packet->firmware, firmware, 24); + mav_array_assign_char(packet->modem_model, modem_model, 50); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION, (const char *)packet, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_LEN, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_CRC); +#endif +} +#endif + +#endif + +// MESSAGE CELLULAR_MODEM_INFORMATION UNPACKING + + +/** + * @brief Get field id from cellular_modem_information message + * + * @return Modem instance number. Indexed from 1. Matches index in corresponding CELLULAR_STATUS message. + */ +static inline uint8_t mavlink_msg_cellular_modem_information_get_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 16); +} + +/** + * @brief Get field imei from cellular_modem_information message + * + * @return Unique Modem International Mobile Equipment Identity Number. + */ +static inline uint64_t mavlink_msg_cellular_modem_information_get_imei(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 0); +} + +/** + * @brief Get field imsi from cellular_modem_information message + * + * @return Current SIM International mobile subscriber identity. + */ +static inline uint64_t mavlink_msg_cellular_modem_information_get_imsi(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 8); +} + +/** + * @brief Get field modem_id from cellular_modem_information message + * + * @return Unique id for modem. This must be NULL terminated if the length is less than 10 human-readable chars, and without the null termination (NULL) byte if the length is exactly 10 chars. + */ +static inline uint16_t mavlink_msg_cellular_modem_information_get_modem_id(const mavlink_message_t* msg, char *modem_id) +{ + return _MAV_RETURN_char_array(msg, modem_id, 10, 17); +} + +/** + * @brief Get field iccid from cellular_modem_information message + * + * @return Integrated Circuit Card Identification Number of SIM Card. This must be NULL terminated if the length is less than 20 human-readable chars, and without the null termination (NULL) byte if the length is exactly 20 chars. + */ +static inline uint16_t mavlink_msg_cellular_modem_information_get_iccid(const mavlink_message_t* msg, char *iccid) +{ + return _MAV_RETURN_char_array(msg, iccid, 20, 27); +} + +/** + * @brief Get field firmware from cellular_modem_information message + * + * @return The firmware version installed on the modem. This must be NULL terminated if the length is less than 24 human-readable chars, and without the null termination (NULL) byte if the length is exactly 24 chars. The format is not intended for display. + */ +static inline uint16_t mavlink_msg_cellular_modem_information_get_firmware(const mavlink_message_t* msg, char *firmware) +{ + return _MAV_RETURN_char_array(msg, firmware, 24, 47); +} + +/** + * @brief Get field modem_model from cellular_modem_information message + * + * @return Modem model name. This must be NULL terminated if the length is less than 50 human-readable chars, and without the null termination (NULL) byte if the length is exactly 50 chars. + */ +static inline uint16_t mavlink_msg_cellular_modem_information_get_modem_model(const mavlink_message_t* msg, char *modem_model) +{ + return _MAV_RETURN_char_array(msg, modem_model, 50, 71); +} + +/** + * @brief Decode a cellular_modem_information message into a struct + * + * @param msg The message to decode + * @param cellular_modem_information C-struct to decode the message contents into + */ +static inline void mavlink_msg_cellular_modem_information_decode(const mavlink_message_t* msg, mavlink_cellular_modem_information_t* cellular_modem_information) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + cellular_modem_information->imei = mavlink_msg_cellular_modem_information_get_imei(msg); + cellular_modem_information->imsi = mavlink_msg_cellular_modem_information_get_imsi(msg); + cellular_modem_information->id = mavlink_msg_cellular_modem_information_get_id(msg); + mavlink_msg_cellular_modem_information_get_modem_id(msg, cellular_modem_information->modem_id); + mavlink_msg_cellular_modem_information_get_iccid(msg, cellular_modem_information->iccid); + mavlink_msg_cellular_modem_information_get_firmware(msg, cellular_modem_information->firmware); + mavlink_msg_cellular_modem_information_get_modem_model(msg, cellular_modem_information->modem_model); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_LEN? msg->len : MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_LEN; + memset(cellular_modem_information, 0, MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_LEN); + memcpy(cellular_modem_information, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/development/mavlink_msg_control_status.h b/development/mavlink_msg_control_status.h new file mode 100644 index 000000000..acceeeacd --- /dev/null +++ b/development/mavlink_msg_control_status.h @@ -0,0 +1,288 @@ +#pragma once +// MESSAGE CONTROL_STATUS PACKING + +#define MAVLINK_MSG_ID_CONTROL_STATUS 512 + + +typedef struct __mavlink_control_status_t { + uint8_t sysid_in_control; /*< System ID of GCS MAVLink component in control (0: no GCS in control).*/ + uint8_t flags; /*< Control status. For example, whether takeover is allowed, and whether this message instance defines the default controlling GCS for the whole system.*/ +} mavlink_control_status_t; + +#define MAVLINK_MSG_ID_CONTROL_STATUS_LEN 2 +#define MAVLINK_MSG_ID_CONTROL_STATUS_MIN_LEN 2 +#define MAVLINK_MSG_ID_512_LEN 2 +#define MAVLINK_MSG_ID_512_MIN_LEN 2 + +#define MAVLINK_MSG_ID_CONTROL_STATUS_CRC 184 +#define MAVLINK_MSG_ID_512_CRC 184 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_CONTROL_STATUS { \ + 512, \ + "CONTROL_STATUS", \ + 2, \ + { { "sysid_in_control", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_control_status_t, sysid_in_control) }, \ + { "flags", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_control_status_t, flags) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_CONTROL_STATUS { \ + "CONTROL_STATUS", \ + 2, \ + { { "sysid_in_control", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_control_status_t, sysid_in_control) }, \ + { "flags", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_control_status_t, flags) }, \ + } \ +} +#endif + +/** + * @brief Pack a control_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param sysid_in_control System ID of GCS MAVLink component in control (0: no GCS in control). + * @param flags Control status. For example, whether takeover is allowed, and whether this message instance defines the default controlling GCS for the whole system. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_control_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t sysid_in_control, uint8_t flags) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CONTROL_STATUS_LEN]; + _mav_put_uint8_t(buf, 0, sysid_in_control); + _mav_put_uint8_t(buf, 1, flags); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CONTROL_STATUS_LEN); +#else + mavlink_control_status_t packet; + packet.sysid_in_control = sysid_in_control; + packet.flags = flags; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CONTROL_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CONTROL_STATUS; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CONTROL_STATUS_MIN_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_CRC); +} + +/** + * @brief Pack a control_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param sysid_in_control System ID of GCS MAVLink component in control (0: no GCS in control). + * @param flags Control status. For example, whether takeover is allowed, and whether this message instance defines the default controlling GCS for the whole system. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_control_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t sysid_in_control, uint8_t flags) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CONTROL_STATUS_LEN]; + _mav_put_uint8_t(buf, 0, sysid_in_control); + _mav_put_uint8_t(buf, 1, flags); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CONTROL_STATUS_LEN); +#else + mavlink_control_status_t packet; + packet.sysid_in_control = sysid_in_control; + packet.flags = flags; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CONTROL_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CONTROL_STATUS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CONTROL_STATUS_MIN_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CONTROL_STATUS_MIN_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_LEN); +#endif +} + +/** + * @brief Pack a control_status message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param sysid_in_control System ID of GCS MAVLink component in control (0: no GCS in control). + * @param flags Control status. For example, whether takeover is allowed, and whether this message instance defines the default controlling GCS for the whole system. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_control_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t sysid_in_control,uint8_t flags) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CONTROL_STATUS_LEN]; + _mav_put_uint8_t(buf, 0, sysid_in_control); + _mav_put_uint8_t(buf, 1, flags); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CONTROL_STATUS_LEN); +#else + mavlink_control_status_t packet; + packet.sysid_in_control = sysid_in_control; + packet.flags = flags; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CONTROL_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CONTROL_STATUS; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CONTROL_STATUS_MIN_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_CRC); +} + +/** + * @brief Encode a control_status struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param control_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_control_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_control_status_t* control_status) +{ + return mavlink_msg_control_status_pack(system_id, component_id, msg, control_status->sysid_in_control, control_status->flags); +} + +/** + * @brief Encode a control_status struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param control_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_control_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_control_status_t* control_status) +{ + return mavlink_msg_control_status_pack_chan(system_id, component_id, chan, msg, control_status->sysid_in_control, control_status->flags); +} + +/** + * @brief Encode a control_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param control_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_control_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_control_status_t* control_status) +{ + return mavlink_msg_control_status_pack_status(system_id, component_id, _status, msg, control_status->sysid_in_control, control_status->flags); +} + +/** + * @brief Send a control_status message + * @param chan MAVLink channel to send the message + * + * @param sysid_in_control System ID of GCS MAVLink component in control (0: no GCS in control). + * @param flags Control status. For example, whether takeover is allowed, and whether this message instance defines the default controlling GCS for the whole system. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_control_status_send(mavlink_channel_t chan, uint8_t sysid_in_control, uint8_t flags) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CONTROL_STATUS_LEN]; + _mav_put_uint8_t(buf, 0, sysid_in_control); + _mav_put_uint8_t(buf, 1, flags); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CONTROL_STATUS, buf, MAVLINK_MSG_ID_CONTROL_STATUS_MIN_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_CRC); +#else + mavlink_control_status_t packet; + packet.sysid_in_control = sysid_in_control; + packet.flags = flags; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CONTROL_STATUS, (const char *)&packet, MAVLINK_MSG_ID_CONTROL_STATUS_MIN_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_CRC); +#endif +} + +/** + * @brief Send a control_status message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_control_status_send_struct(mavlink_channel_t chan, const mavlink_control_status_t* control_status) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_control_status_send(chan, control_status->sysid_in_control, control_status->flags); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CONTROL_STATUS, (const char *)control_status, MAVLINK_MSG_ID_CONTROL_STATUS_MIN_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_CRC); +#endif +} + +#if MAVLINK_MSG_ID_CONTROL_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_control_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t sysid_in_control, uint8_t flags) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint8_t(buf, 0, sysid_in_control); + _mav_put_uint8_t(buf, 1, flags); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CONTROL_STATUS, buf, MAVLINK_MSG_ID_CONTROL_STATUS_MIN_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_CRC); +#else + mavlink_control_status_t *packet = (mavlink_control_status_t *)msgbuf; + packet->sysid_in_control = sysid_in_control; + packet->flags = flags; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CONTROL_STATUS, (const char *)packet, MAVLINK_MSG_ID_CONTROL_STATUS_MIN_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_LEN, MAVLINK_MSG_ID_CONTROL_STATUS_CRC); +#endif +} +#endif + +#endif + +// MESSAGE CONTROL_STATUS UNPACKING + + +/** + * @brief Get field sysid_in_control from control_status message + * + * @return System ID of GCS MAVLink component in control (0: no GCS in control). + */ +static inline uint8_t mavlink_msg_control_status_get_sysid_in_control(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 0); +} + +/** + * @brief Get field flags from control_status message + * + * @return Control status. For example, whether takeover is allowed, and whether this message instance defines the default controlling GCS for the whole system. + */ +static inline uint8_t mavlink_msg_control_status_get_flags(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 1); +} + +/** + * @brief Decode a control_status message into a struct + * + * @param msg The message to decode + * @param control_status C-struct to decode the message contents into + */ +static inline void mavlink_msg_control_status_decode(const mavlink_message_t* msg, mavlink_control_status_t* control_status) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + control_status->sysid_in_control = mavlink_msg_control_status_get_sysid_in_control(msg); + control_status->flags = mavlink_msg_control_status_get_flags(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_CONTROL_STATUS_LEN? msg->len : MAVLINK_MSG_ID_CONTROL_STATUS_LEN; + memset(control_status, 0, MAVLINK_MSG_ID_CONTROL_STATUS_LEN); + memcpy(control_status, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/development/mavlink_msg_current_mode.h b/development/mavlink_msg_current_mode.h new file mode 100644 index 000000000..cc19e250c --- /dev/null +++ b/development/mavlink_msg_current_mode.h @@ -0,0 +1,316 @@ +#pragma once +// MESSAGE CURRENT_MODE PACKING + +#define MAVLINK_MSG_ID_CURRENT_MODE 436 + + +typedef struct __mavlink_current_mode_t { + uint32_t custom_mode; /*< A bitfield for use for autopilot-specific flags*/ + uint32_t intended_custom_mode; /*< The custom_mode of the mode that was last commanded by the user (for example, with MAV_CMD_DO_SET_STANDARD_MODE, MAV_CMD_DO_SET_MODE or via RC). This should usually be the same as custom_mode. It will be different if the vehicle is unable to enter the intended mode, or has left that mode due to a failsafe condition. 0 indicates the intended custom mode is unknown/not supplied*/ + uint8_t standard_mode; /*< Standard mode.*/ +} mavlink_current_mode_t; + +#define MAVLINK_MSG_ID_CURRENT_MODE_LEN 9 +#define MAVLINK_MSG_ID_CURRENT_MODE_MIN_LEN 9 +#define MAVLINK_MSG_ID_436_LEN 9 +#define MAVLINK_MSG_ID_436_MIN_LEN 9 + +#define MAVLINK_MSG_ID_CURRENT_MODE_CRC 193 +#define MAVLINK_MSG_ID_436_CRC 193 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_CURRENT_MODE { \ + 436, \ + "CURRENT_MODE", \ + 3, \ + { { "standard_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_current_mode_t, standard_mode) }, \ + { "custom_mode", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_current_mode_t, custom_mode) }, \ + { "intended_custom_mode", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_current_mode_t, intended_custom_mode) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_CURRENT_MODE { \ + "CURRENT_MODE", \ + 3, \ + { { "standard_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_current_mode_t, standard_mode) }, \ + { "custom_mode", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_current_mode_t, custom_mode) }, \ + { "intended_custom_mode", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_current_mode_t, intended_custom_mode) }, \ + } \ +} +#endif + +/** + * @brief Pack a current_mode message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param standard_mode Standard mode. + * @param custom_mode A bitfield for use for autopilot-specific flags + * @param intended_custom_mode The custom_mode of the mode that was last commanded by the user (for example, with MAV_CMD_DO_SET_STANDARD_MODE, MAV_CMD_DO_SET_MODE or via RC). This should usually be the same as custom_mode. It will be different if the vehicle is unable to enter the intended mode, or has left that mode due to a failsafe condition. 0 indicates the intended custom mode is unknown/not supplied + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_current_mode_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t standard_mode, uint32_t custom_mode, uint32_t intended_custom_mode) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CURRENT_MODE_LEN]; + _mav_put_uint32_t(buf, 0, custom_mode); + _mav_put_uint32_t(buf, 4, intended_custom_mode); + _mav_put_uint8_t(buf, 8, standard_mode); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CURRENT_MODE_LEN); +#else + mavlink_current_mode_t packet; + packet.custom_mode = custom_mode; + packet.intended_custom_mode = intended_custom_mode; + packet.standard_mode = standard_mode; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CURRENT_MODE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CURRENT_MODE; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CURRENT_MODE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_MODE_LEN, MAVLINK_MSG_ID_CURRENT_MODE_CRC); +} + +/** + * @brief Pack a current_mode message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param standard_mode Standard mode. + * @param custom_mode A bitfield for use for autopilot-specific flags + * @param intended_custom_mode The custom_mode of the mode that was last commanded by the user (for example, with MAV_CMD_DO_SET_STANDARD_MODE, MAV_CMD_DO_SET_MODE or via RC). This should usually be the same as custom_mode. It will be different if the vehicle is unable to enter the intended mode, or has left that mode due to a failsafe condition. 0 indicates the intended custom mode is unknown/not supplied + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_current_mode_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t standard_mode, uint32_t custom_mode, uint32_t intended_custom_mode) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CURRENT_MODE_LEN]; + _mav_put_uint32_t(buf, 0, custom_mode); + _mav_put_uint32_t(buf, 4, intended_custom_mode); + _mav_put_uint8_t(buf, 8, standard_mode); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CURRENT_MODE_LEN); +#else + mavlink_current_mode_t packet; + packet.custom_mode = custom_mode; + packet.intended_custom_mode = intended_custom_mode; + packet.standard_mode = standard_mode; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CURRENT_MODE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CURRENT_MODE; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CURRENT_MODE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_MODE_LEN, MAVLINK_MSG_ID_CURRENT_MODE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CURRENT_MODE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_MODE_LEN); +#endif +} + +/** + * @brief Pack a current_mode message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param standard_mode Standard mode. + * @param custom_mode A bitfield for use for autopilot-specific flags + * @param intended_custom_mode The custom_mode of the mode that was last commanded by the user (for example, with MAV_CMD_DO_SET_STANDARD_MODE, MAV_CMD_DO_SET_MODE or via RC). This should usually be the same as custom_mode. It will be different if the vehicle is unable to enter the intended mode, or has left that mode due to a failsafe condition. 0 indicates the intended custom mode is unknown/not supplied + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_current_mode_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t standard_mode,uint32_t custom_mode,uint32_t intended_custom_mode) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CURRENT_MODE_LEN]; + _mav_put_uint32_t(buf, 0, custom_mode); + _mav_put_uint32_t(buf, 4, intended_custom_mode); + _mav_put_uint8_t(buf, 8, standard_mode); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CURRENT_MODE_LEN); +#else + mavlink_current_mode_t packet; + packet.custom_mode = custom_mode; + packet.intended_custom_mode = intended_custom_mode; + packet.standard_mode = standard_mode; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CURRENT_MODE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_CURRENT_MODE; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CURRENT_MODE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_MODE_LEN, MAVLINK_MSG_ID_CURRENT_MODE_CRC); +} + +/** + * @brief Encode a current_mode struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param current_mode C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_current_mode_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_current_mode_t* current_mode) +{ + return mavlink_msg_current_mode_pack(system_id, component_id, msg, current_mode->standard_mode, current_mode->custom_mode, current_mode->intended_custom_mode); +} + +/** + * @brief Encode a current_mode struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param current_mode C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_current_mode_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_current_mode_t* current_mode) +{ + return mavlink_msg_current_mode_pack_chan(system_id, component_id, chan, msg, current_mode->standard_mode, current_mode->custom_mode, current_mode->intended_custom_mode); +} + +/** + * @brief Encode a current_mode struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param current_mode C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_current_mode_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_current_mode_t* current_mode) +{ + return mavlink_msg_current_mode_pack_status(system_id, component_id, _status, msg, current_mode->standard_mode, current_mode->custom_mode, current_mode->intended_custom_mode); +} + +/** + * @brief Send a current_mode message + * @param chan MAVLink channel to send the message + * + * @param standard_mode Standard mode. + * @param custom_mode A bitfield for use for autopilot-specific flags + * @param intended_custom_mode The custom_mode of the mode that was last commanded by the user (for example, with MAV_CMD_DO_SET_STANDARD_MODE, MAV_CMD_DO_SET_MODE or via RC). This should usually be the same as custom_mode. It will be different if the vehicle is unable to enter the intended mode, or has left that mode due to a failsafe condition. 0 indicates the intended custom mode is unknown/not supplied + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_current_mode_send(mavlink_channel_t chan, uint8_t standard_mode, uint32_t custom_mode, uint32_t intended_custom_mode) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_CURRENT_MODE_LEN]; + _mav_put_uint32_t(buf, 0, custom_mode); + _mav_put_uint32_t(buf, 4, intended_custom_mode); + _mav_put_uint8_t(buf, 8, standard_mode); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CURRENT_MODE, buf, MAVLINK_MSG_ID_CURRENT_MODE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_MODE_LEN, MAVLINK_MSG_ID_CURRENT_MODE_CRC); +#else + mavlink_current_mode_t packet; + packet.custom_mode = custom_mode; + packet.intended_custom_mode = intended_custom_mode; + packet.standard_mode = standard_mode; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CURRENT_MODE, (const char *)&packet, MAVLINK_MSG_ID_CURRENT_MODE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_MODE_LEN, MAVLINK_MSG_ID_CURRENT_MODE_CRC); +#endif +} + +/** + * @brief Send a current_mode message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_current_mode_send_struct(mavlink_channel_t chan, const mavlink_current_mode_t* current_mode) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_current_mode_send(chan, current_mode->standard_mode, current_mode->custom_mode, current_mode->intended_custom_mode); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CURRENT_MODE, (const char *)current_mode, MAVLINK_MSG_ID_CURRENT_MODE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_MODE_LEN, MAVLINK_MSG_ID_CURRENT_MODE_CRC); +#endif +} + +#if MAVLINK_MSG_ID_CURRENT_MODE_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by re-using + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_current_mode_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t standard_mode, uint32_t custom_mode, uint32_t intended_custom_mode) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint32_t(buf, 0, custom_mode); + _mav_put_uint32_t(buf, 4, intended_custom_mode); + _mav_put_uint8_t(buf, 8, standard_mode); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CURRENT_MODE, buf, MAVLINK_MSG_ID_CURRENT_MODE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_MODE_LEN, MAVLINK_MSG_ID_CURRENT_MODE_CRC); +#else + mavlink_current_mode_t *packet = (mavlink_current_mode_t *)msgbuf; + packet->custom_mode = custom_mode; + packet->intended_custom_mode = intended_custom_mode; + packet->standard_mode = standard_mode; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CURRENT_MODE, (const char *)packet, MAVLINK_MSG_ID_CURRENT_MODE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_MODE_LEN, MAVLINK_MSG_ID_CURRENT_MODE_CRC); +#endif +} +#endif + +#endif + +// MESSAGE CURRENT_MODE UNPACKING + + +/** + * @brief Get field standard_mode from current_mode message + * + * @return Standard mode. + */ +static inline uint8_t mavlink_msg_current_mode_get_standard_mode(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 8); +} + +/** + * @brief Get field custom_mode from current_mode message + * + * @return A bitfield for use for autopilot-specific flags + */ +static inline uint32_t mavlink_msg_current_mode_get_custom_mode(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 0); +} + +/** + * @brief Get field intended_custom_mode from current_mode message + * + * @return The custom_mode of the mode that was last commanded by the user (for example, with MAV_CMD_DO_SET_STANDARD_MODE, MAV_CMD_DO_SET_MODE or via RC). This should usually be the same as custom_mode. It will be different if the vehicle is unable to enter the intended mode, or has left that mode due to a failsafe condition. 0 indicates the intended custom mode is unknown/not supplied + */ +static inline uint32_t mavlink_msg_current_mode_get_intended_custom_mode(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 4); +} + +/** + * @brief Decode a current_mode message into a struct + * + * @param msg The message to decode + * @param current_mode C-struct to decode the message contents into + */ +static inline void mavlink_msg_current_mode_decode(const mavlink_message_t* msg, mavlink_current_mode_t* current_mode) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + current_mode->custom_mode = mavlink_msg_current_mode_get_custom_mode(msg); + current_mode->intended_custom_mode = mavlink_msg_current_mode_get_intended_custom_mode(msg); + current_mode->standard_mode = mavlink_msg_current_mode_get_standard_mode(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_CURRENT_MODE_LEN? msg->len : MAVLINK_MSG_ID_CURRENT_MODE_LEN; + memset(current_mode, 0, MAVLINK_MSG_ID_CURRENT_MODE_LEN); + memcpy(current_mode, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/development/mavlink_msg_external_global_position.h b/development/mavlink_msg_external_global_position.h new file mode 100644 index 000000000..5bac7e922 --- /dev/null +++ b/development/mavlink_msg_external_global_position.h @@ -0,0 +1,568 @@ +#pragma once +// MESSAGE EXTERNAL_GLOBAL_POSITION PACKING + +#define MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION 296 + + +typedef struct __mavlink_external_global_position_t { + uint64_t time_usec; /*< [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.*/ + int32_t lat; /*< [degE7] Latitude (WGS84)*/ + int32_t lon; /*< [degE7] Longitude (WGS84)*/ + float alt; /*< [m] Altitude (MSL)*/ + float vn; /*< [m/s] GPS velocity in north direction in earth-fixed NED frame. NaN is unused*/ + float ve; /*< [m/s] GPS velocity in east direction in earth-fixed NED frame*/ + float vd; /*< [m/s] GPS velocity in down direction in earth-fixed NED frame*/ + float eph; /*< [m] Standard deviation of horizontal position error*/ + float epv; /*< [m] Standard deviation of vertical position error*/ + float evh; /*< [m] Standard deviation of horizontal velocity error*/ + float evv; /*< [m] Standard deviation of vertical velocity error*/ + uint8_t id; /*< Sensor ID*/ +} mavlink_external_global_position_t; + +#define MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN 49 +#define MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_MIN_LEN 49 +#define MAVLINK_MSG_ID_296_LEN 49 +#define MAVLINK_MSG_ID_296_MIN_LEN 49 + +#define MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_CRC 110 +#define MAVLINK_MSG_ID_296_CRC 110 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_EXTERNAL_GLOBAL_POSITION { \ + 296, \ + "EXTERNAL_GLOBAL_POSITION", \ + 12, \ + { { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 48, offsetof(mavlink_external_global_position_t, id) }, \ + { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_external_global_position_t, time_usec) }, \ + { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_external_global_position_t, lat) }, \ + { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_external_global_position_t, lon) }, \ + { "alt", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_external_global_position_t, alt) }, \ + { "vn", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_external_global_position_t, vn) }, \ + { "ve", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_external_global_position_t, ve) }, \ + { "vd", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_external_global_position_t, vd) }, \ + { "eph", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_external_global_position_t, eph) }, \ + { "epv", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_external_global_position_t, epv) }, \ + { "evh", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_external_global_position_t, evh) }, \ + { "evv", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_external_global_position_t, evv) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_EXTERNAL_GLOBAL_POSITION { \ + "EXTERNAL_GLOBAL_POSITION", \ + 12, \ + { { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 48, offsetof(mavlink_external_global_position_t, id) }, \ + { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_external_global_position_t, time_usec) }, \ + { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_external_global_position_t, lat) }, \ + { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_external_global_position_t, lon) }, \ + { "alt", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_external_global_position_t, alt) }, \ + { "vn", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_external_global_position_t, vn) }, \ + { "ve", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_external_global_position_t, ve) }, \ + { "vd", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_external_global_position_t, vd) }, \ + { "eph", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_external_global_position_t, eph) }, \ + { "epv", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_external_global_position_t, epv) }, \ + { "evh", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_external_global_position_t, evh) }, \ + { "evv", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_external_global_position_t, evv) }, \ + } \ +} +#endif + +/** + * @brief Pack a external_global_position message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param id Sensor ID + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param lat [degE7] Latitude (WGS84) + * @param lon [degE7] Longitude (WGS84) + * @param alt [m] Altitude (MSL) + * @param vn [m/s] GPS velocity in north direction in earth-fixed NED frame. NaN is unused + * @param ve [m/s] GPS velocity in east direction in earth-fixed NED frame + * @param vd [m/s] GPS velocity in down direction in earth-fixed NED frame + * @param eph [m] Standard deviation of horizontal position error + * @param epv [m] Standard deviation of vertical position error + * @param evh [m] Standard deviation of horizontal velocity error + * @param evv [m] Standard deviation of vertical velocity error + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_external_global_position_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t id, uint64_t time_usec, int32_t lat, int32_t lon, float alt, float vn, float ve, float vd, float eph, float epv, float evh, float evv) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_float(buf, 16, alt); + _mav_put_float(buf, 20, vn); + _mav_put_float(buf, 24, ve); + _mav_put_float(buf, 28, vd); + _mav_put_float(buf, 32, eph); + _mav_put_float(buf, 36, epv); + _mav_put_float(buf, 40, evh); + _mav_put_float(buf, 44, evv); + _mav_put_uint8_t(buf, 48, id); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN); +#else + mavlink_external_global_position_t packet; + packet.time_usec = time_usec; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.vn = vn; + packet.ve = ve; + packet.vd = vd; + packet.eph = eph; + packet.epv = epv; + packet.evh = evh; + packet.evv = evv; + packet.id = id; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_CRC); +} + +/** + * @brief Pack a external_global_position message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param id Sensor ID + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param lat [degE7] Latitude (WGS84) + * @param lon [degE7] Longitude (WGS84) + * @param alt [m] Altitude (MSL) + * @param vn [m/s] GPS velocity in north direction in earth-fixed NED frame. NaN is unused + * @param ve [m/s] GPS velocity in east direction in earth-fixed NED frame + * @param vd [m/s] GPS velocity in down direction in earth-fixed NED frame + * @param eph [m] Standard deviation of horizontal position error + * @param epv [m] Standard deviation of vertical position error + * @param evh [m] Standard deviation of horizontal velocity error + * @param evv [m] Standard deviation of vertical velocity error + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_external_global_position_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t id, uint64_t time_usec, int32_t lat, int32_t lon, float alt, float vn, float ve, float vd, float eph, float epv, float evh, float evv) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_float(buf, 16, alt); + _mav_put_float(buf, 20, vn); + _mav_put_float(buf, 24, ve); + _mav_put_float(buf, 28, vd); + _mav_put_float(buf, 32, eph); + _mav_put_float(buf, 36, epv); + _mav_put_float(buf, 40, evh); + _mav_put_float(buf, 44, evv); + _mav_put_uint8_t(buf, 48, id); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN); +#else + mavlink_external_global_position_t packet; + packet.time_usec = time_usec; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.vn = vn; + packet.ve = ve; + packet.vd = vd; + packet.eph = eph; + packet.epv = epv; + packet.evh = evh; + packet.evv = evv; + packet.id = id; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN); +#endif +} + +/** + * @brief Pack a external_global_position message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param id Sensor ID + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param lat [degE7] Latitude (WGS84) + * @param lon [degE7] Longitude (WGS84) + * @param alt [m] Altitude (MSL) + * @param vn [m/s] GPS velocity in north direction in earth-fixed NED frame. NaN is unused + * @param ve [m/s] GPS velocity in east direction in earth-fixed NED frame + * @param vd [m/s] GPS velocity in down direction in earth-fixed NED frame + * @param eph [m] Standard deviation of horizontal position error + * @param epv [m] Standard deviation of vertical position error + * @param evh [m] Standard deviation of horizontal velocity error + * @param evv [m] Standard deviation of vertical velocity error + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_external_global_position_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t id,uint64_t time_usec,int32_t lat,int32_t lon,float alt,float vn,float ve,float vd,float eph,float epv,float evh,float evv) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_float(buf, 16, alt); + _mav_put_float(buf, 20, vn); + _mav_put_float(buf, 24, ve); + _mav_put_float(buf, 28, vd); + _mav_put_float(buf, 32, eph); + _mav_put_float(buf, 36, epv); + _mav_put_float(buf, 40, evh); + _mav_put_float(buf, 44, evv); + _mav_put_uint8_t(buf, 48, id); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN); +#else + mavlink_external_global_position_t packet; + packet.time_usec = time_usec; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.vn = vn; + packet.ve = ve; + packet.vd = vd; + packet.eph = eph; + packet.epv = epv; + packet.evh = evh; + packet.evv = evv; + packet.id = id; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_CRC); +} + +/** + * @brief Encode a external_global_position struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param external_global_position C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_external_global_position_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_external_global_position_t* external_global_position) +{ + return mavlink_msg_external_global_position_pack(system_id, component_id, msg, external_global_position->id, external_global_position->time_usec, external_global_position->lat, external_global_position->lon, external_global_position->alt, external_global_position->vn, external_global_position->ve, external_global_position->vd, external_global_position->eph, external_global_position->epv, external_global_position->evh, external_global_position->evv); +} + +/** + * @brief Encode a external_global_position struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param external_global_position C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_external_global_position_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_external_global_position_t* external_global_position) +{ + return mavlink_msg_external_global_position_pack_chan(system_id, component_id, chan, msg, external_global_position->id, external_global_position->time_usec, external_global_position->lat, external_global_position->lon, external_global_position->alt, external_global_position->vn, external_global_position->ve, external_global_position->vd, external_global_position->eph, external_global_position->epv, external_global_position->evh, external_global_position->evv); +} + +/** + * @brief Encode a external_global_position struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param external_global_position C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_external_global_position_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_external_global_position_t* external_global_position) +{ + return mavlink_msg_external_global_position_pack_status(system_id, component_id, _status, msg, external_global_position->id, external_global_position->time_usec, external_global_position->lat, external_global_position->lon, external_global_position->alt, external_global_position->vn, external_global_position->ve, external_global_position->vd, external_global_position->eph, external_global_position->epv, external_global_position->evh, external_global_position->evv); +} + +/** + * @brief Send a external_global_position message + * @param chan MAVLink channel to send the message + * + * @param id Sensor ID + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param lat [degE7] Latitude (WGS84) + * @param lon [degE7] Longitude (WGS84) + * @param alt [m] Altitude (MSL) + * @param vn [m/s] GPS velocity in north direction in earth-fixed NED frame. NaN is unused + * @param ve [m/s] GPS velocity in east direction in earth-fixed NED frame + * @param vd [m/s] GPS velocity in down direction in earth-fixed NED frame + * @param eph [m] Standard deviation of horizontal position error + * @param epv [m] Standard deviation of vertical position error + * @param evh [m] Standard deviation of horizontal velocity error + * @param evv [m] Standard deviation of vertical velocity error + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_external_global_position_send(mavlink_channel_t chan, uint8_t id, uint64_t time_usec, int32_t lat, int32_t lon, float alt, float vn, float ve, float vd, float eph, float epv, float evh, float evv) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_float(buf, 16, alt); + _mav_put_float(buf, 20, vn); + _mav_put_float(buf, 24, ve); + _mav_put_float(buf, 28, vd); + _mav_put_float(buf, 32, eph); + _mav_put_float(buf, 36, epv); + _mav_put_float(buf, 40, evh); + _mav_put_float(buf, 44, evv); + _mav_put_uint8_t(buf, 48, id); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION, buf, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_CRC); +#else + mavlink_external_global_position_t packet; + packet.time_usec = time_usec; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.vn = vn; + packet.ve = ve; + packet.vd = vd; + packet.eph = eph; + packet.epv = epv; + packet.evh = evh; + packet.evv = evv; + packet.id = id; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION, (const char *)&packet, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_CRC); +#endif +} + +/** + * @brief Send a external_global_position message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_external_global_position_send_struct(mavlink_channel_t chan, const mavlink_external_global_position_t* external_global_position) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_external_global_position_send(chan, external_global_position->id, external_global_position->time_usec, external_global_position->lat, external_global_position->lon, external_global_position->alt, external_global_position->vn, external_global_position->ve, external_global_position->vd, external_global_position->eph, external_global_position->epv, external_global_position->evh, external_global_position->evv); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION, (const char *)external_global_position, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_CRC); +#endif +} + +#if MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by re-using + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_external_global_position_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t id, uint64_t time_usec, int32_t lat, int32_t lon, float alt, float vn, float ve, float vd, float eph, float epv, float evh, float evv) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_float(buf, 16, alt); + _mav_put_float(buf, 20, vn); + _mav_put_float(buf, 24, ve); + _mav_put_float(buf, 28, vd); + _mav_put_float(buf, 32, eph); + _mav_put_float(buf, 36, epv); + _mav_put_float(buf, 40, evh); + _mav_put_float(buf, 44, evv); + _mav_put_uint8_t(buf, 48, id); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION, buf, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_CRC); +#else + mavlink_external_global_position_t *packet = (mavlink_external_global_position_t *)msgbuf; + packet->time_usec = time_usec; + packet->lat = lat; + packet->lon = lon; + packet->alt = alt; + packet->vn = vn; + packet->ve = ve; + packet->vd = vd; + packet->eph = eph; + packet->epv = epv; + packet->evh = evh; + packet->evv = evv; + packet->id = id; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION, (const char *)packet, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_CRC); +#endif +} +#endif + +#endif + +// MESSAGE EXTERNAL_GLOBAL_POSITION UNPACKING + + +/** + * @brief Get field id from external_global_position message + * + * @return Sensor ID + */ +static inline uint8_t mavlink_msg_external_global_position_get_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 48); +} + +/** + * @brief Get field time_usec from external_global_position message + * + * @return [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + */ +static inline uint64_t mavlink_msg_external_global_position_get_time_usec(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 0); +} + +/** + * @brief Get field lat from external_global_position message + * + * @return [degE7] Latitude (WGS84) + */ +static inline int32_t mavlink_msg_external_global_position_get_lat(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 8); +} + +/** + * @brief Get field lon from external_global_position message + * + * @return [degE7] Longitude (WGS84) + */ +static inline int32_t mavlink_msg_external_global_position_get_lon(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 12); +} + +/** + * @brief Get field alt from external_global_position message + * + * @return [m] Altitude (MSL) + */ +static inline float mavlink_msg_external_global_position_get_alt(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 16); +} + +/** + * @brief Get field vn from external_global_position message + * + * @return [m/s] GPS velocity in north direction in earth-fixed NED frame. NaN is unused + */ +static inline float mavlink_msg_external_global_position_get_vn(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 20); +} + +/** + * @brief Get field ve from external_global_position message + * + * @return [m/s] GPS velocity in east direction in earth-fixed NED frame + */ +static inline float mavlink_msg_external_global_position_get_ve(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 24); +} + +/** + * @brief Get field vd from external_global_position message + * + * @return [m/s] GPS velocity in down direction in earth-fixed NED frame + */ +static inline float mavlink_msg_external_global_position_get_vd(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 28); +} + +/** + * @brief Get field eph from external_global_position message + * + * @return [m] Standard deviation of horizontal position error + */ +static inline float mavlink_msg_external_global_position_get_eph(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 32); +} + +/** + * @brief Get field epv from external_global_position message + * + * @return [m] Standard deviation of vertical position error + */ +static inline float mavlink_msg_external_global_position_get_epv(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 36); +} + +/** + * @brief Get field evh from external_global_position message + * + * @return [m] Standard deviation of horizontal velocity error + */ +static inline float mavlink_msg_external_global_position_get_evh(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 40); +} + +/** + * @brief Get field evv from external_global_position message + * + * @return [m] Standard deviation of vertical velocity error + */ +static inline float mavlink_msg_external_global_position_get_evv(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 44); +} + +/** + * @brief Decode a external_global_position message into a struct + * + * @param msg The message to decode + * @param external_global_position C-struct to decode the message contents into + */ +static inline void mavlink_msg_external_global_position_decode(const mavlink_message_t* msg, mavlink_external_global_position_t* external_global_position) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + external_global_position->time_usec = mavlink_msg_external_global_position_get_time_usec(msg); + external_global_position->lat = mavlink_msg_external_global_position_get_lat(msg); + external_global_position->lon = mavlink_msg_external_global_position_get_lon(msg); + external_global_position->alt = mavlink_msg_external_global_position_get_alt(msg); + external_global_position->vn = mavlink_msg_external_global_position_get_vn(msg); + external_global_position->ve = mavlink_msg_external_global_position_get_ve(msg); + external_global_position->vd = mavlink_msg_external_global_position_get_vd(msg); + external_global_position->eph = mavlink_msg_external_global_position_get_eph(msg); + external_global_position->epv = mavlink_msg_external_global_position_get_epv(msg); + external_global_position->evh = mavlink_msg_external_global_position_get_evh(msg); + external_global_position->evv = mavlink_msg_external_global_position_get_evv(msg); + external_global_position->id = mavlink_msg_external_global_position_get_id(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN? msg->len : MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN; + memset(external_global_position, 0, MAVLINK_MSG_ID_EXTERNAL_GLOBAL_POSITION_LEN); + memcpy(external_global_position, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/development/mavlink_msg_figure_eight_execution_status.h b/development/mavlink_msg_figure_eight_execution_status.h new file mode 100644 index 000000000..96807c533 --- /dev/null +++ b/development/mavlink_msg_figure_eight_execution_status.h @@ -0,0 +1,456 @@ +#pragma once +// MESSAGE FIGURE_EIGHT_EXECUTION_STATUS PACKING + +#define MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS 361 + + +typedef struct __mavlink_figure_eight_execution_status_t { + uint64_t time_usec; /*< [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.*/ + float major_radius; /*< [m] Major axis radius of the figure eight. Positive: orbit the north circle clockwise. Negative: orbit the north circle counter-clockwise.*/ + float minor_radius; /*< [m] Minor axis radius of the figure eight. Defines the radius of two circles that make up the figure.*/ + float orientation; /*< [rad] Orientation of the figure eight major axis with respect to true north in [-pi,pi).*/ + int32_t x; /*< X coordinate of center point. Coordinate system depends on frame field.*/ + int32_t y; /*< Y coordinate of center point. Coordinate system depends on frame field.*/ + float z; /*< [m] Altitude of center point. Coordinate system depends on frame field.*/ + uint8_t frame; /*< The coordinate system of the fields: x, y, z.*/ +} mavlink_figure_eight_execution_status_t; + +#define MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_LEN 33 +#define MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_MIN_LEN 33 +#define MAVLINK_MSG_ID_361_LEN 33 +#define MAVLINK_MSG_ID_361_MIN_LEN 33 + +#define MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_CRC 93 +#define MAVLINK_MSG_ID_361_CRC 93 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_FIGURE_EIGHT_EXECUTION_STATUS { \ + 361, \ + "FIGURE_EIGHT_EXECUTION_STATUS", \ + 8, \ + { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_figure_eight_execution_status_t, time_usec) }, \ + { "major_radius", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_figure_eight_execution_status_t, major_radius) }, \ + { "minor_radius", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_figure_eight_execution_status_t, minor_radius) }, \ + { "orientation", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_figure_eight_execution_status_t, orientation) }, \ + { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_figure_eight_execution_status_t, frame) }, \ + { "x", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_figure_eight_execution_status_t, x) }, \ + { "y", NULL, MAVLINK_TYPE_INT32_T, 0, 24, offsetof(mavlink_figure_eight_execution_status_t, y) }, \ + { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_figure_eight_execution_status_t, z) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_FIGURE_EIGHT_EXECUTION_STATUS { \ + "FIGURE_EIGHT_EXECUTION_STATUS", \ + 8, \ + { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_figure_eight_execution_status_t, time_usec) }, \ + { "major_radius", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_figure_eight_execution_status_t, major_radius) }, \ + { "minor_radius", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_figure_eight_execution_status_t, minor_radius) }, \ + { "orientation", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_figure_eight_execution_status_t, orientation) }, \ + { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_figure_eight_execution_status_t, frame) }, \ + { "x", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_figure_eight_execution_status_t, x) }, \ + { "y", NULL, MAVLINK_TYPE_INT32_T, 0, 24, offsetof(mavlink_figure_eight_execution_status_t, y) }, \ + { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_figure_eight_execution_status_t, z) }, \ + } \ +} +#endif + +/** + * @brief Pack a figure_eight_execution_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param major_radius [m] Major axis radius of the figure eight. Positive: orbit the north circle clockwise. Negative: orbit the north circle counter-clockwise. + * @param minor_radius [m] Minor axis radius of the figure eight. Defines the radius of two circles that make up the figure. + * @param orientation [rad] Orientation of the figure eight major axis with respect to true north in [-pi,pi). + * @param frame The coordinate system of the fields: x, y, z. + * @param x X coordinate of center point. Coordinate system depends on frame field. + * @param y Y coordinate of center point. Coordinate system depends on frame field. + * @param z [m] Altitude of center point. Coordinate system depends on frame field. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_figure_eight_execution_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint64_t time_usec, float major_radius, float minor_radius, float orientation, uint8_t frame, int32_t x, int32_t y, float z) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, major_radius); + _mav_put_float(buf, 12, minor_radius); + _mav_put_float(buf, 16, orientation); + _mav_put_int32_t(buf, 20, x); + _mav_put_int32_t(buf, 24, y); + _mav_put_float(buf, 28, z); + _mav_put_uint8_t(buf, 32, frame); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_LEN); +#else + mavlink_figure_eight_execution_status_t packet; + packet.time_usec = time_usec; + packet.major_radius = major_radius; + packet.minor_radius = minor_radius; + packet.orientation = orientation; + packet.x = x; + packet.y = y; + packet.z = z; + packet.frame = frame; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_MIN_LEN, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_LEN, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_CRC); +} + +/** + * @brief Pack a figure_eight_execution_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param major_radius [m] Major axis radius of the figure eight. Positive: orbit the north circle clockwise. Negative: orbit the north circle counter-clockwise. + * @param minor_radius [m] Minor axis radius of the figure eight. Defines the radius of two circles that make up the figure. + * @param orientation [rad] Orientation of the figure eight major axis with respect to true north in [-pi,pi). + * @param frame The coordinate system of the fields: x, y, z. + * @param x X coordinate of center point. Coordinate system depends on frame field. + * @param y Y coordinate of center point. Coordinate system depends on frame field. + * @param z [m] Altitude of center point. Coordinate system depends on frame field. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_figure_eight_execution_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t time_usec, float major_radius, float minor_radius, float orientation, uint8_t frame, int32_t x, int32_t y, float z) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, major_radius); + _mav_put_float(buf, 12, minor_radius); + _mav_put_float(buf, 16, orientation); + _mav_put_int32_t(buf, 20, x); + _mav_put_int32_t(buf, 24, y); + _mav_put_float(buf, 28, z); + _mav_put_uint8_t(buf, 32, frame); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_LEN); +#else + mavlink_figure_eight_execution_status_t packet; + packet.time_usec = time_usec; + packet.major_radius = major_radius; + packet.minor_radius = minor_radius; + packet.orientation = orientation; + packet.x = x; + packet.y = y; + packet.z = z; + packet.frame = frame; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_MIN_LEN, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_LEN, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_MIN_LEN, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_LEN); +#endif +} + +/** + * @brief Pack a figure_eight_execution_status message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param major_radius [m] Major axis radius of the figure eight. Positive: orbit the north circle clockwise. Negative: orbit the north circle counter-clockwise. + * @param minor_radius [m] Minor axis radius of the figure eight. Defines the radius of two circles that make up the figure. + * @param orientation [rad] Orientation of the figure eight major axis with respect to true north in [-pi,pi). + * @param frame The coordinate system of the fields: x, y, z. + * @param x X coordinate of center point. Coordinate system depends on frame field. + * @param y Y coordinate of center point. Coordinate system depends on frame field. + * @param z [m] Altitude of center point. Coordinate system depends on frame field. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_figure_eight_execution_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint64_t time_usec,float major_radius,float minor_radius,float orientation,uint8_t frame,int32_t x,int32_t y,float z) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, major_radius); + _mav_put_float(buf, 12, minor_radius); + _mav_put_float(buf, 16, orientation); + _mav_put_int32_t(buf, 20, x); + _mav_put_int32_t(buf, 24, y); + _mav_put_float(buf, 28, z); + _mav_put_uint8_t(buf, 32, frame); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_LEN); +#else + mavlink_figure_eight_execution_status_t packet; + packet.time_usec = time_usec; + packet.major_radius = major_radius; + packet.minor_radius = minor_radius; + packet.orientation = orientation; + packet.x = x; + packet.y = y; + packet.z = z; + packet.frame = frame; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_MIN_LEN, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_LEN, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_CRC); +} + +/** + * @brief Encode a figure_eight_execution_status struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param figure_eight_execution_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_figure_eight_execution_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_figure_eight_execution_status_t* figure_eight_execution_status) +{ + return mavlink_msg_figure_eight_execution_status_pack(system_id, component_id, msg, figure_eight_execution_status->time_usec, figure_eight_execution_status->major_radius, figure_eight_execution_status->minor_radius, figure_eight_execution_status->orientation, figure_eight_execution_status->frame, figure_eight_execution_status->x, figure_eight_execution_status->y, figure_eight_execution_status->z); +} + +/** + * @brief Encode a figure_eight_execution_status struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param figure_eight_execution_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_figure_eight_execution_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_figure_eight_execution_status_t* figure_eight_execution_status) +{ + return mavlink_msg_figure_eight_execution_status_pack_chan(system_id, component_id, chan, msg, figure_eight_execution_status->time_usec, figure_eight_execution_status->major_radius, figure_eight_execution_status->minor_radius, figure_eight_execution_status->orientation, figure_eight_execution_status->frame, figure_eight_execution_status->x, figure_eight_execution_status->y, figure_eight_execution_status->z); +} + +/** + * @brief Encode a figure_eight_execution_status struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param figure_eight_execution_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_figure_eight_execution_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_figure_eight_execution_status_t* figure_eight_execution_status) +{ + return mavlink_msg_figure_eight_execution_status_pack_status(system_id, component_id, _status, msg, figure_eight_execution_status->time_usec, figure_eight_execution_status->major_radius, figure_eight_execution_status->minor_radius, figure_eight_execution_status->orientation, figure_eight_execution_status->frame, figure_eight_execution_status->x, figure_eight_execution_status->y, figure_eight_execution_status->z); +} + +/** + * @brief Send a figure_eight_execution_status message + * @param chan MAVLink channel to send the message + * + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param major_radius [m] Major axis radius of the figure eight. Positive: orbit the north circle clockwise. Negative: orbit the north circle counter-clockwise. + * @param minor_radius [m] Minor axis radius of the figure eight. Defines the radius of two circles that make up the figure. + * @param orientation [rad] Orientation of the figure eight major axis with respect to true north in [-pi,pi). + * @param frame The coordinate system of the fields: x, y, z. + * @param x X coordinate of center point. Coordinate system depends on frame field. + * @param y Y coordinate of center point. Coordinate system depends on frame field. + * @param z [m] Altitude of center point. Coordinate system depends on frame field. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_figure_eight_execution_status_send(mavlink_channel_t chan, uint64_t time_usec, float major_radius, float minor_radius, float orientation, uint8_t frame, int32_t x, int32_t y, float z) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, major_radius); + _mav_put_float(buf, 12, minor_radius); + _mav_put_float(buf, 16, orientation); + _mav_put_int32_t(buf, 20, x); + _mav_put_int32_t(buf, 24, y); + _mav_put_float(buf, 28, z); + _mav_put_uint8_t(buf, 32, frame); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS, buf, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_MIN_LEN, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_LEN, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_CRC); +#else + mavlink_figure_eight_execution_status_t packet; + packet.time_usec = time_usec; + packet.major_radius = major_radius; + packet.minor_radius = minor_radius; + packet.orientation = orientation; + packet.x = x; + packet.y = y; + packet.z = z; + packet.frame = frame; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS, (const char *)&packet, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_MIN_LEN, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_LEN, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_CRC); +#endif +} + +/** + * @brief Send a figure_eight_execution_status message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_figure_eight_execution_status_send_struct(mavlink_channel_t chan, const mavlink_figure_eight_execution_status_t* figure_eight_execution_status) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_figure_eight_execution_status_send(chan, figure_eight_execution_status->time_usec, figure_eight_execution_status->major_radius, figure_eight_execution_status->minor_radius, figure_eight_execution_status->orientation, figure_eight_execution_status->frame, figure_eight_execution_status->x, figure_eight_execution_status->y, figure_eight_execution_status->z); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS, (const char *)figure_eight_execution_status, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_MIN_LEN, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_LEN, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_CRC); +#endif +} + +#if MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_figure_eight_execution_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, float major_radius, float minor_radius, float orientation, uint8_t frame, int32_t x, int32_t y, float z) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, major_radius); + _mav_put_float(buf, 12, minor_radius); + _mav_put_float(buf, 16, orientation); + _mav_put_int32_t(buf, 20, x); + _mav_put_int32_t(buf, 24, y); + _mav_put_float(buf, 28, z); + _mav_put_uint8_t(buf, 32, frame); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS, buf, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_MIN_LEN, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_LEN, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_CRC); +#else + mavlink_figure_eight_execution_status_t *packet = (mavlink_figure_eight_execution_status_t *)msgbuf; + packet->time_usec = time_usec; + packet->major_radius = major_radius; + packet->minor_radius = minor_radius; + packet->orientation = orientation; + packet->x = x; + packet->y = y; + packet->z = z; + packet->frame = frame; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS, (const char *)packet, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_MIN_LEN, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_LEN, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_CRC); +#endif +} +#endif + +#endif + +// MESSAGE FIGURE_EIGHT_EXECUTION_STATUS UNPACKING + + +/** + * @brief Get field time_usec from figure_eight_execution_status message + * + * @return [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + */ +static inline uint64_t mavlink_msg_figure_eight_execution_status_get_time_usec(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 0); +} + +/** + * @brief Get field major_radius from figure_eight_execution_status message + * + * @return [m] Major axis radius of the figure eight. Positive: orbit the north circle clockwise. Negative: orbit the north circle counter-clockwise. + */ +static inline float mavlink_msg_figure_eight_execution_status_get_major_radius(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 8); +} + +/** + * @brief Get field minor_radius from figure_eight_execution_status message + * + * @return [m] Minor axis radius of the figure eight. Defines the radius of two circles that make up the figure. + */ +static inline float mavlink_msg_figure_eight_execution_status_get_minor_radius(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 12); +} + +/** + * @brief Get field orientation from figure_eight_execution_status message + * + * @return [rad] Orientation of the figure eight major axis with respect to true north in [-pi,pi). + */ +static inline float mavlink_msg_figure_eight_execution_status_get_orientation(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 16); +} + +/** + * @brief Get field frame from figure_eight_execution_status message + * + * @return The coordinate system of the fields: x, y, z. + */ +static inline uint8_t mavlink_msg_figure_eight_execution_status_get_frame(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 32); +} + +/** + * @brief Get field x from figure_eight_execution_status message + * + * @return X coordinate of center point. Coordinate system depends on frame field. + */ +static inline int32_t mavlink_msg_figure_eight_execution_status_get_x(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 20); +} + +/** + * @brief Get field y from figure_eight_execution_status message + * + * @return Y coordinate of center point. Coordinate system depends on frame field. + */ +static inline int32_t mavlink_msg_figure_eight_execution_status_get_y(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 24); +} + +/** + * @brief Get field z from figure_eight_execution_status message + * + * @return [m] Altitude of center point. Coordinate system depends on frame field. + */ +static inline float mavlink_msg_figure_eight_execution_status_get_z(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 28); +} + +/** + * @brief Decode a figure_eight_execution_status message into a struct + * + * @param msg The message to decode + * @param figure_eight_execution_status C-struct to decode the message contents into + */ +static inline void mavlink_msg_figure_eight_execution_status_decode(const mavlink_message_t* msg, mavlink_figure_eight_execution_status_t* figure_eight_execution_status) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + figure_eight_execution_status->time_usec = mavlink_msg_figure_eight_execution_status_get_time_usec(msg); + figure_eight_execution_status->major_radius = mavlink_msg_figure_eight_execution_status_get_major_radius(msg); + figure_eight_execution_status->minor_radius = mavlink_msg_figure_eight_execution_status_get_minor_radius(msg); + figure_eight_execution_status->orientation = mavlink_msg_figure_eight_execution_status_get_orientation(msg); + figure_eight_execution_status->x = mavlink_msg_figure_eight_execution_status_get_x(msg); + figure_eight_execution_status->y = mavlink_msg_figure_eight_execution_status_get_y(msg); + figure_eight_execution_status->z = mavlink_msg_figure_eight_execution_status_get_z(msg); + figure_eight_execution_status->frame = mavlink_msg_figure_eight_execution_status_get_frame(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_LEN? msg->len : MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_LEN; + memset(figure_eight_execution_status, 0, MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_LEN); + memcpy(figure_eight_execution_status, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/development/mavlink_msg_global_position.h b/development/mavlink_msg_global_position.h new file mode 100644 index 000000000..c6c46d495 --- /dev/null +++ b/development/mavlink_msg_global_position.h @@ -0,0 +1,512 @@ +#pragma once +// MESSAGE GLOBAL_POSITION PACKING + +#define MAVLINK_MSG_ID_GLOBAL_POSITION 296 + + +typedef struct __mavlink_global_position_t { + uint64_t time_usec; /*< [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.*/ + int32_t lat; /*< [degE7] Latitude (WGS84)*/ + int32_t lon; /*< [degE7] Longitude (WGS84)*/ + float alt; /*< [m] Altitude (MSL - position-system specific value)*/ + float alt_ellipsoid; /*< [m] Altitude (WGS84 elipsoid)*/ + float eph; /*< [m] Standard deviation of horizontal position error*/ + float epv; /*< [m] Standard deviation of vertical position error*/ + uint8_t id; /*< Sensor ID*/ + uint8_t source; /*< Source of position/estimate (such as GNSS, estimator, etc.)*/ + uint8_t flags; /*< Status flags*/ +} mavlink_global_position_t; + +#define MAVLINK_MSG_ID_GLOBAL_POSITION_LEN 35 +#define MAVLINK_MSG_ID_GLOBAL_POSITION_MIN_LEN 35 +#define MAVLINK_MSG_ID_296_LEN 35 +#define MAVLINK_MSG_ID_296_MIN_LEN 35 + +#define MAVLINK_MSG_ID_GLOBAL_POSITION_CRC 50 +#define MAVLINK_MSG_ID_296_CRC 50 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_GLOBAL_POSITION { \ + 296, \ + "GLOBAL_POSITION", \ + 10, \ + { { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_global_position_t, id) }, \ + { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_global_position_t, time_usec) }, \ + { "source", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_global_position_t, source) }, \ + { "flags", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_global_position_t, flags) }, \ + { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_global_position_t, lat) }, \ + { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_global_position_t, lon) }, \ + { "alt", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_global_position_t, alt) }, \ + { "alt_ellipsoid", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_global_position_t, alt_ellipsoid) }, \ + { "eph", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_global_position_t, eph) }, \ + { "epv", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_global_position_t, epv) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_GLOBAL_POSITION { \ + "GLOBAL_POSITION", \ + 10, \ + { { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_global_position_t, id) }, \ + { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_global_position_t, time_usec) }, \ + { "source", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_global_position_t, source) }, \ + { "flags", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_global_position_t, flags) }, \ + { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_global_position_t, lat) }, \ + { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_global_position_t, lon) }, \ + { "alt", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_global_position_t, alt) }, \ + { "alt_ellipsoid", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_global_position_t, alt_ellipsoid) }, \ + { "eph", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_global_position_t, eph) }, \ + { "epv", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_global_position_t, epv) }, \ + } \ +} +#endif + +/** + * @brief Pack a global_position message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param id Sensor ID + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param source Source of position/estimate (such as GNSS, estimator, etc.) + * @param flags Status flags + * @param lat [degE7] Latitude (WGS84) + * @param lon [degE7] Longitude (WGS84) + * @param alt [m] Altitude (MSL - position-system specific value) + * @param alt_ellipsoid [m] Altitude (WGS84 elipsoid) + * @param eph [m] Standard deviation of horizontal position error + * @param epv [m] Standard deviation of vertical position error + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_global_position_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t id, uint64_t time_usec, uint8_t source, uint8_t flags, int32_t lat, int32_t lon, float alt, float alt_ellipsoid, float eph, float epv) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GLOBAL_POSITION_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_float(buf, 16, alt); + _mav_put_float(buf, 20, alt_ellipsoid); + _mav_put_float(buf, 24, eph); + _mav_put_float(buf, 28, epv); + _mav_put_uint8_t(buf, 32, id); + _mav_put_uint8_t(buf, 33, source); + _mav_put_uint8_t(buf, 34, flags); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GLOBAL_POSITION_LEN); +#else + mavlink_global_position_t packet; + packet.time_usec = time_usec; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.alt_ellipsoid = alt_ellipsoid; + packet.eph = eph; + packet.epv = epv; + packet.id = id; + packet.source = source; + packet.flags = flags; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_POSITION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GLOBAL_POSITION; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_CRC); +} + +/** + * @brief Pack a global_position message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param id Sensor ID + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param source Source of position/estimate (such as GNSS, estimator, etc.) + * @param flags Status flags + * @param lat [degE7] Latitude (WGS84) + * @param lon [degE7] Longitude (WGS84) + * @param alt [m] Altitude (MSL - position-system specific value) + * @param alt_ellipsoid [m] Altitude (WGS84 elipsoid) + * @param eph [m] Standard deviation of horizontal position error + * @param epv [m] Standard deviation of vertical position error + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_global_position_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t id, uint64_t time_usec, uint8_t source, uint8_t flags, int32_t lat, int32_t lon, float alt, float alt_ellipsoid, float eph, float epv) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GLOBAL_POSITION_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_float(buf, 16, alt); + _mav_put_float(buf, 20, alt_ellipsoid); + _mav_put_float(buf, 24, eph); + _mav_put_float(buf, 28, epv); + _mav_put_uint8_t(buf, 32, id); + _mav_put_uint8_t(buf, 33, source); + _mav_put_uint8_t(buf, 34, flags); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GLOBAL_POSITION_LEN); +#else + mavlink_global_position_t packet; + packet.time_usec = time_usec; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.alt_ellipsoid = alt_ellipsoid; + packet.eph = eph; + packet.epv = epv; + packet.id = id; + packet.source = source; + packet.flags = flags; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_POSITION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GLOBAL_POSITION; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_LEN); +#endif +} + +/** + * @brief Pack a global_position message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param id Sensor ID + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param source Source of position/estimate (such as GNSS, estimator, etc.) + * @param flags Status flags + * @param lat [degE7] Latitude (WGS84) + * @param lon [degE7] Longitude (WGS84) + * @param alt [m] Altitude (MSL - position-system specific value) + * @param alt_ellipsoid [m] Altitude (WGS84 elipsoid) + * @param eph [m] Standard deviation of horizontal position error + * @param epv [m] Standard deviation of vertical position error + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_global_position_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t id,uint64_t time_usec,uint8_t source,uint8_t flags,int32_t lat,int32_t lon,float alt,float alt_ellipsoid,float eph,float epv) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GLOBAL_POSITION_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_float(buf, 16, alt); + _mav_put_float(buf, 20, alt_ellipsoid); + _mav_put_float(buf, 24, eph); + _mav_put_float(buf, 28, epv); + _mav_put_uint8_t(buf, 32, id); + _mav_put_uint8_t(buf, 33, source); + _mav_put_uint8_t(buf, 34, flags); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GLOBAL_POSITION_LEN); +#else + mavlink_global_position_t packet; + packet.time_usec = time_usec; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.alt_ellipsoid = alt_ellipsoid; + packet.eph = eph; + packet.epv = epv; + packet.id = id; + packet.source = source; + packet.flags = flags; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_POSITION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GLOBAL_POSITION; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_CRC); +} + +/** + * @brief Encode a global_position struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param global_position C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_global_position_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_global_position_t* global_position) +{ + return mavlink_msg_global_position_pack(system_id, component_id, msg, global_position->id, global_position->time_usec, global_position->source, global_position->flags, global_position->lat, global_position->lon, global_position->alt, global_position->alt_ellipsoid, global_position->eph, global_position->epv); +} + +/** + * @brief Encode a global_position struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param global_position C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_global_position_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_global_position_t* global_position) +{ + return mavlink_msg_global_position_pack_chan(system_id, component_id, chan, msg, global_position->id, global_position->time_usec, global_position->source, global_position->flags, global_position->lat, global_position->lon, global_position->alt, global_position->alt_ellipsoid, global_position->eph, global_position->epv); +} + +/** + * @brief Encode a global_position struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param global_position C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_global_position_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_global_position_t* global_position) +{ + return mavlink_msg_global_position_pack_status(system_id, component_id, _status, msg, global_position->id, global_position->time_usec, global_position->source, global_position->flags, global_position->lat, global_position->lon, global_position->alt, global_position->alt_ellipsoid, global_position->eph, global_position->epv); +} + +/** + * @brief Send a global_position message + * @param chan MAVLink channel to send the message + * + * @param id Sensor ID + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @param source Source of position/estimate (such as GNSS, estimator, etc.) + * @param flags Status flags + * @param lat [degE7] Latitude (WGS84) + * @param lon [degE7] Longitude (WGS84) + * @param alt [m] Altitude (MSL - position-system specific value) + * @param alt_ellipsoid [m] Altitude (WGS84 elipsoid) + * @param eph [m] Standard deviation of horizontal position error + * @param epv [m] Standard deviation of vertical position error + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_global_position_send(mavlink_channel_t chan, uint8_t id, uint64_t time_usec, uint8_t source, uint8_t flags, int32_t lat, int32_t lon, float alt, float alt_ellipsoid, float eph, float epv) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GLOBAL_POSITION_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_float(buf, 16, alt); + _mav_put_float(buf, 20, alt_ellipsoid); + _mav_put_float(buf, 24, eph); + _mav_put_float(buf, 28, epv); + _mav_put_uint8_t(buf, 32, id); + _mav_put_uint8_t(buf, 33, source); + _mav_put_uint8_t(buf, 34, flags); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION, buf, MAVLINK_MSG_ID_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_CRC); +#else + mavlink_global_position_t packet; + packet.time_usec = time_usec; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.alt_ellipsoid = alt_ellipsoid; + packet.eph = eph; + packet.epv = epv; + packet.id = id; + packet.source = source; + packet.flags = flags; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION, (const char *)&packet, MAVLINK_MSG_ID_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_CRC); +#endif +} + +/** + * @brief Send a global_position message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_global_position_send_struct(mavlink_channel_t chan, const mavlink_global_position_t* global_position) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_global_position_send(chan, global_position->id, global_position->time_usec, global_position->source, global_position->flags, global_position->lat, global_position->lon, global_position->alt, global_position->alt_ellipsoid, global_position->eph, global_position->epv); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION, (const char *)global_position, MAVLINK_MSG_ID_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_CRC); +#endif +} + +#if MAVLINK_MSG_ID_GLOBAL_POSITION_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_global_position_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t id, uint64_t time_usec, uint8_t source, uint8_t flags, int32_t lat, int32_t lon, float alt, float alt_ellipsoid, float eph, float epv) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_float(buf, 16, alt); + _mav_put_float(buf, 20, alt_ellipsoid); + _mav_put_float(buf, 24, eph); + _mav_put_float(buf, 28, epv); + _mav_put_uint8_t(buf, 32, id); + _mav_put_uint8_t(buf, 33, source); + _mav_put_uint8_t(buf, 34, flags); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION, buf, MAVLINK_MSG_ID_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_CRC); +#else + mavlink_global_position_t *packet = (mavlink_global_position_t *)msgbuf; + packet->time_usec = time_usec; + packet->lat = lat; + packet->lon = lon; + packet->alt = alt; + packet->alt_ellipsoid = alt_ellipsoid; + packet->eph = eph; + packet->epv = epv; + packet->id = id; + packet->source = source; + packet->flags = flags; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION, (const char *)packet, MAVLINK_MSG_ID_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_CRC); +#endif +} +#endif + +#endif + +// MESSAGE GLOBAL_POSITION UNPACKING + + +/** + * @brief Get field id from global_position message + * + * @return Sensor ID + */ +static inline uint8_t mavlink_msg_global_position_get_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 32); +} + +/** + * @brief Get field time_usec from global_position message + * + * @return [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + */ +static inline uint64_t mavlink_msg_global_position_get_time_usec(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 0); +} + +/** + * @brief Get field source from global_position message + * + * @return Source of position/estimate (such as GNSS, estimator, etc.) + */ +static inline uint8_t mavlink_msg_global_position_get_source(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 33); +} + +/** + * @brief Get field flags from global_position message + * + * @return Status flags + */ +static inline uint8_t mavlink_msg_global_position_get_flags(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 34); +} + +/** + * @brief Get field lat from global_position message + * + * @return [degE7] Latitude (WGS84) + */ +static inline int32_t mavlink_msg_global_position_get_lat(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 8); +} + +/** + * @brief Get field lon from global_position message + * + * @return [degE7] Longitude (WGS84) + */ +static inline int32_t mavlink_msg_global_position_get_lon(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 12); +} + +/** + * @brief Get field alt from global_position message + * + * @return [m] Altitude (MSL - position-system specific value) + */ +static inline float mavlink_msg_global_position_get_alt(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 16); +} + +/** + * @brief Get field alt_ellipsoid from global_position message + * + * @return [m] Altitude (WGS84 elipsoid) + */ +static inline float mavlink_msg_global_position_get_alt_ellipsoid(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 20); +} + +/** + * @brief Get field eph from global_position message + * + * @return [m] Standard deviation of horizontal position error + */ +static inline float mavlink_msg_global_position_get_eph(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 24); +} + +/** + * @brief Get field epv from global_position message + * + * @return [m] Standard deviation of vertical position error + */ +static inline float mavlink_msg_global_position_get_epv(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 28); +} + +/** + * @brief Decode a global_position message into a struct + * + * @param msg The message to decode + * @param global_position C-struct to decode the message contents into + */ +static inline void mavlink_msg_global_position_decode(const mavlink_message_t* msg, mavlink_global_position_t* global_position) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + global_position->time_usec = mavlink_msg_global_position_get_time_usec(msg); + global_position->lat = mavlink_msg_global_position_get_lat(msg); + global_position->lon = mavlink_msg_global_position_get_lon(msg); + global_position->alt = mavlink_msg_global_position_get_alt(msg); + global_position->alt_ellipsoid = mavlink_msg_global_position_get_alt_ellipsoid(msg); + global_position->eph = mavlink_msg_global_position_get_eph(msg); + global_position->epv = mavlink_msg_global_position_get_epv(msg); + global_position->id = mavlink_msg_global_position_get_id(msg); + global_position->source = mavlink_msg_global_position_get_source(msg); + global_position->flags = mavlink_msg_global_position_get_flags(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_GLOBAL_POSITION_LEN? msg->len : MAVLINK_MSG_ID_GLOBAL_POSITION_LEN; + memset(global_position, 0, MAVLINK_MSG_ID_GLOBAL_POSITION_LEN); + memcpy(global_position, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/development/mavlink_msg_gnss_integrity.h b/development/mavlink_msg_gnss_integrity.h new file mode 100644 index 000000000..47b9eae3d --- /dev/null +++ b/development/mavlink_msg_gnss_integrity.h @@ -0,0 +1,568 @@ +#pragma once +// MESSAGE GNSS_INTEGRITY PACKING + +#define MAVLINK_MSG_ID_GNSS_INTEGRITY 441 + + +typedef struct __mavlink_gnss_integrity_t { + uint32_t system_errors; /*< Errors in the GPS system.*/ + uint16_t raim_hfom; /*< [cm] Horizontal expected accuracy using satellites successfully validated using RAIM.*/ + uint16_t raim_vfom; /*< [cm] Vertical expected accuracy using satellites successfully validated using RAIM.*/ + uint8_t id; /*< GNSS receiver id. Must match instance ids of other messages from same receiver.*/ + uint8_t authentication_state; /*< Signal authentication state of the GPS system.*/ + uint8_t jamming_state; /*< Signal jamming state of the GPS system.*/ + uint8_t spoofing_state; /*< Signal spoofing state of the GPS system.*/ + uint8_t raim_state; /*< The state of the RAIM processing.*/ + uint8_t corrections_quality; /*< An abstract value representing the estimated quality of incoming corrections, or 255 if not available.*/ + uint8_t system_status_summary; /*< An abstract value representing the overall status of the receiver, or 255 if not available.*/ + uint8_t gnss_signal_quality; /*< An abstract value representing the quality of incoming GNSS signals, or 255 if not available.*/ + uint8_t post_processing_quality; /*< An abstract value representing the estimated PPK quality, or 255 if not available.*/ +} mavlink_gnss_integrity_t; + +#define MAVLINK_MSG_ID_GNSS_INTEGRITY_LEN 17 +#define MAVLINK_MSG_ID_GNSS_INTEGRITY_MIN_LEN 17 +#define MAVLINK_MSG_ID_441_LEN 17 +#define MAVLINK_MSG_ID_441_MIN_LEN 17 + +#define MAVLINK_MSG_ID_GNSS_INTEGRITY_CRC 169 +#define MAVLINK_MSG_ID_441_CRC 169 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_GNSS_INTEGRITY { \ + 441, \ + "GNSS_INTEGRITY", \ + 12, \ + { { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_gnss_integrity_t, id) }, \ + { "system_errors", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_gnss_integrity_t, system_errors) }, \ + { "authentication_state", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_gnss_integrity_t, authentication_state) }, \ + { "jamming_state", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_gnss_integrity_t, jamming_state) }, \ + { "spoofing_state", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_gnss_integrity_t, spoofing_state) }, \ + { "raim_state", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_gnss_integrity_t, raim_state) }, \ + { "raim_hfom", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_gnss_integrity_t, raim_hfom) }, \ + { "raim_vfom", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_gnss_integrity_t, raim_vfom) }, \ + { "corrections_quality", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_gnss_integrity_t, corrections_quality) }, \ + { "system_status_summary", NULL, MAVLINK_TYPE_UINT8_T, 0, 14, offsetof(mavlink_gnss_integrity_t, system_status_summary) }, \ + { "gnss_signal_quality", NULL, MAVLINK_TYPE_UINT8_T, 0, 15, offsetof(mavlink_gnss_integrity_t, gnss_signal_quality) }, \ + { "post_processing_quality", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_gnss_integrity_t, post_processing_quality) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_GNSS_INTEGRITY { \ + "GNSS_INTEGRITY", \ + 12, \ + { { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_gnss_integrity_t, id) }, \ + { "system_errors", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_gnss_integrity_t, system_errors) }, \ + { "authentication_state", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_gnss_integrity_t, authentication_state) }, \ + { "jamming_state", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_gnss_integrity_t, jamming_state) }, \ + { "spoofing_state", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_gnss_integrity_t, spoofing_state) }, \ + { "raim_state", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_gnss_integrity_t, raim_state) }, \ + { "raim_hfom", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_gnss_integrity_t, raim_hfom) }, \ + { "raim_vfom", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_gnss_integrity_t, raim_vfom) }, \ + { "corrections_quality", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_gnss_integrity_t, corrections_quality) }, \ + { "system_status_summary", NULL, MAVLINK_TYPE_UINT8_T, 0, 14, offsetof(mavlink_gnss_integrity_t, system_status_summary) }, \ + { "gnss_signal_quality", NULL, MAVLINK_TYPE_UINT8_T, 0, 15, offsetof(mavlink_gnss_integrity_t, gnss_signal_quality) }, \ + { "post_processing_quality", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_gnss_integrity_t, post_processing_quality) }, \ + } \ +} +#endif + +/** + * @brief Pack a gnss_integrity message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param id GNSS receiver id. Must match instance ids of other messages from same receiver. + * @param system_errors Errors in the GPS system. + * @param authentication_state Signal authentication state of the GPS system. + * @param jamming_state Signal jamming state of the GPS system. + * @param spoofing_state Signal spoofing state of the GPS system. + * @param raim_state The state of the RAIM processing. + * @param raim_hfom [cm] Horizontal expected accuracy using satellites successfully validated using RAIM. + * @param raim_vfom [cm] Vertical expected accuracy using satellites successfully validated using RAIM. + * @param corrections_quality An abstract value representing the estimated quality of incoming corrections, or 255 if not available. + * @param system_status_summary An abstract value representing the overall status of the receiver, or 255 if not available. + * @param gnss_signal_quality An abstract value representing the quality of incoming GNSS signals, or 255 if not available. + * @param post_processing_quality An abstract value representing the estimated PPK quality, or 255 if not available. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_gnss_integrity_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t id, uint32_t system_errors, uint8_t authentication_state, uint8_t jamming_state, uint8_t spoofing_state, uint8_t raim_state, uint16_t raim_hfom, uint16_t raim_vfom, uint8_t corrections_quality, uint8_t system_status_summary, uint8_t gnss_signal_quality, uint8_t post_processing_quality) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GNSS_INTEGRITY_LEN]; + _mav_put_uint32_t(buf, 0, system_errors); + _mav_put_uint16_t(buf, 4, raim_hfom); + _mav_put_uint16_t(buf, 6, raim_vfom); + _mav_put_uint8_t(buf, 8, id); + _mav_put_uint8_t(buf, 9, authentication_state); + _mav_put_uint8_t(buf, 10, jamming_state); + _mav_put_uint8_t(buf, 11, spoofing_state); + _mav_put_uint8_t(buf, 12, raim_state); + _mav_put_uint8_t(buf, 13, corrections_quality); + _mav_put_uint8_t(buf, 14, system_status_summary); + _mav_put_uint8_t(buf, 15, gnss_signal_quality); + _mav_put_uint8_t(buf, 16, post_processing_quality); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GNSS_INTEGRITY_LEN); +#else + mavlink_gnss_integrity_t packet; + packet.system_errors = system_errors; + packet.raim_hfom = raim_hfom; + packet.raim_vfom = raim_vfom; + packet.id = id; + packet.authentication_state = authentication_state; + packet.jamming_state = jamming_state; + packet.spoofing_state = spoofing_state; + packet.raim_state = raim_state; + packet.corrections_quality = corrections_quality; + packet.system_status_summary = system_status_summary; + packet.gnss_signal_quality = gnss_signal_quality; + packet.post_processing_quality = post_processing_quality; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GNSS_INTEGRITY_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GNSS_INTEGRITY; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GNSS_INTEGRITY_MIN_LEN, MAVLINK_MSG_ID_GNSS_INTEGRITY_LEN, MAVLINK_MSG_ID_GNSS_INTEGRITY_CRC); +} + +/** + * @brief Pack a gnss_integrity message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param id GNSS receiver id. Must match instance ids of other messages from same receiver. + * @param system_errors Errors in the GPS system. + * @param authentication_state Signal authentication state of the GPS system. + * @param jamming_state Signal jamming state of the GPS system. + * @param spoofing_state Signal spoofing state of the GPS system. + * @param raim_state The state of the RAIM processing. + * @param raim_hfom [cm] Horizontal expected accuracy using satellites successfully validated using RAIM. + * @param raim_vfom [cm] Vertical expected accuracy using satellites successfully validated using RAIM. + * @param corrections_quality An abstract value representing the estimated quality of incoming corrections, or 255 if not available. + * @param system_status_summary An abstract value representing the overall status of the receiver, or 255 if not available. + * @param gnss_signal_quality An abstract value representing the quality of incoming GNSS signals, or 255 if not available. + * @param post_processing_quality An abstract value representing the estimated PPK quality, or 255 if not available. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_gnss_integrity_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t id, uint32_t system_errors, uint8_t authentication_state, uint8_t jamming_state, uint8_t spoofing_state, uint8_t raim_state, uint16_t raim_hfom, uint16_t raim_vfom, uint8_t corrections_quality, uint8_t system_status_summary, uint8_t gnss_signal_quality, uint8_t post_processing_quality) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GNSS_INTEGRITY_LEN]; + _mav_put_uint32_t(buf, 0, system_errors); + _mav_put_uint16_t(buf, 4, raim_hfom); + _mav_put_uint16_t(buf, 6, raim_vfom); + _mav_put_uint8_t(buf, 8, id); + _mav_put_uint8_t(buf, 9, authentication_state); + _mav_put_uint8_t(buf, 10, jamming_state); + _mav_put_uint8_t(buf, 11, spoofing_state); + _mav_put_uint8_t(buf, 12, raim_state); + _mav_put_uint8_t(buf, 13, corrections_quality); + _mav_put_uint8_t(buf, 14, system_status_summary); + _mav_put_uint8_t(buf, 15, gnss_signal_quality); + _mav_put_uint8_t(buf, 16, post_processing_quality); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GNSS_INTEGRITY_LEN); +#else + mavlink_gnss_integrity_t packet; + packet.system_errors = system_errors; + packet.raim_hfom = raim_hfom; + packet.raim_vfom = raim_vfom; + packet.id = id; + packet.authentication_state = authentication_state; + packet.jamming_state = jamming_state; + packet.spoofing_state = spoofing_state; + packet.raim_state = raim_state; + packet.corrections_quality = corrections_quality; + packet.system_status_summary = system_status_summary; + packet.gnss_signal_quality = gnss_signal_quality; + packet.post_processing_quality = post_processing_quality; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GNSS_INTEGRITY_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GNSS_INTEGRITY; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GNSS_INTEGRITY_MIN_LEN, MAVLINK_MSG_ID_GNSS_INTEGRITY_LEN, MAVLINK_MSG_ID_GNSS_INTEGRITY_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GNSS_INTEGRITY_MIN_LEN, MAVLINK_MSG_ID_GNSS_INTEGRITY_LEN); +#endif +} + +/** + * @brief Pack a gnss_integrity message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param id GNSS receiver id. Must match instance ids of other messages from same receiver. + * @param system_errors Errors in the GPS system. + * @param authentication_state Signal authentication state of the GPS system. + * @param jamming_state Signal jamming state of the GPS system. + * @param spoofing_state Signal spoofing state of the GPS system. + * @param raim_state The state of the RAIM processing. + * @param raim_hfom [cm] Horizontal expected accuracy using satellites successfully validated using RAIM. + * @param raim_vfom [cm] Vertical expected accuracy using satellites successfully validated using RAIM. + * @param corrections_quality An abstract value representing the estimated quality of incoming corrections, or 255 if not available. + * @param system_status_summary An abstract value representing the overall status of the receiver, or 255 if not available. + * @param gnss_signal_quality An abstract value representing the quality of incoming GNSS signals, or 255 if not available. + * @param post_processing_quality An abstract value representing the estimated PPK quality, or 255 if not available. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_gnss_integrity_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t id,uint32_t system_errors,uint8_t authentication_state,uint8_t jamming_state,uint8_t spoofing_state,uint8_t raim_state,uint16_t raim_hfom,uint16_t raim_vfom,uint8_t corrections_quality,uint8_t system_status_summary,uint8_t gnss_signal_quality,uint8_t post_processing_quality) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GNSS_INTEGRITY_LEN]; + _mav_put_uint32_t(buf, 0, system_errors); + _mav_put_uint16_t(buf, 4, raim_hfom); + _mav_put_uint16_t(buf, 6, raim_vfom); + _mav_put_uint8_t(buf, 8, id); + _mav_put_uint8_t(buf, 9, authentication_state); + _mav_put_uint8_t(buf, 10, jamming_state); + _mav_put_uint8_t(buf, 11, spoofing_state); + _mav_put_uint8_t(buf, 12, raim_state); + _mav_put_uint8_t(buf, 13, corrections_quality); + _mav_put_uint8_t(buf, 14, system_status_summary); + _mav_put_uint8_t(buf, 15, gnss_signal_quality); + _mav_put_uint8_t(buf, 16, post_processing_quality); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GNSS_INTEGRITY_LEN); +#else + mavlink_gnss_integrity_t packet; + packet.system_errors = system_errors; + packet.raim_hfom = raim_hfom; + packet.raim_vfom = raim_vfom; + packet.id = id; + packet.authentication_state = authentication_state; + packet.jamming_state = jamming_state; + packet.spoofing_state = spoofing_state; + packet.raim_state = raim_state; + packet.corrections_quality = corrections_quality; + packet.system_status_summary = system_status_summary; + packet.gnss_signal_quality = gnss_signal_quality; + packet.post_processing_quality = post_processing_quality; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GNSS_INTEGRITY_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GNSS_INTEGRITY; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GNSS_INTEGRITY_MIN_LEN, MAVLINK_MSG_ID_GNSS_INTEGRITY_LEN, MAVLINK_MSG_ID_GNSS_INTEGRITY_CRC); +} + +/** + * @brief Encode a gnss_integrity struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param gnss_integrity C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_gnss_integrity_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gnss_integrity_t* gnss_integrity) +{ + return mavlink_msg_gnss_integrity_pack(system_id, component_id, msg, gnss_integrity->id, gnss_integrity->system_errors, gnss_integrity->authentication_state, gnss_integrity->jamming_state, gnss_integrity->spoofing_state, gnss_integrity->raim_state, gnss_integrity->raim_hfom, gnss_integrity->raim_vfom, gnss_integrity->corrections_quality, gnss_integrity->system_status_summary, gnss_integrity->gnss_signal_quality, gnss_integrity->post_processing_quality); +} + +/** + * @brief Encode a gnss_integrity struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param gnss_integrity C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_gnss_integrity_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gnss_integrity_t* gnss_integrity) +{ + return mavlink_msg_gnss_integrity_pack_chan(system_id, component_id, chan, msg, gnss_integrity->id, gnss_integrity->system_errors, gnss_integrity->authentication_state, gnss_integrity->jamming_state, gnss_integrity->spoofing_state, gnss_integrity->raim_state, gnss_integrity->raim_hfom, gnss_integrity->raim_vfom, gnss_integrity->corrections_quality, gnss_integrity->system_status_summary, gnss_integrity->gnss_signal_quality, gnss_integrity->post_processing_quality); +} + +/** + * @brief Encode a gnss_integrity struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param gnss_integrity C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_gnss_integrity_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_gnss_integrity_t* gnss_integrity) +{ + return mavlink_msg_gnss_integrity_pack_status(system_id, component_id, _status, msg, gnss_integrity->id, gnss_integrity->system_errors, gnss_integrity->authentication_state, gnss_integrity->jamming_state, gnss_integrity->spoofing_state, gnss_integrity->raim_state, gnss_integrity->raim_hfom, gnss_integrity->raim_vfom, gnss_integrity->corrections_quality, gnss_integrity->system_status_summary, gnss_integrity->gnss_signal_quality, gnss_integrity->post_processing_quality); +} + +/** + * @brief Send a gnss_integrity message + * @param chan MAVLink channel to send the message + * + * @param id GNSS receiver id. Must match instance ids of other messages from same receiver. + * @param system_errors Errors in the GPS system. + * @param authentication_state Signal authentication state of the GPS system. + * @param jamming_state Signal jamming state of the GPS system. + * @param spoofing_state Signal spoofing state of the GPS system. + * @param raim_state The state of the RAIM processing. + * @param raim_hfom [cm] Horizontal expected accuracy using satellites successfully validated using RAIM. + * @param raim_vfom [cm] Vertical expected accuracy using satellites successfully validated using RAIM. + * @param corrections_quality An abstract value representing the estimated quality of incoming corrections, or 255 if not available. + * @param system_status_summary An abstract value representing the overall status of the receiver, or 255 if not available. + * @param gnss_signal_quality An abstract value representing the quality of incoming GNSS signals, or 255 if not available. + * @param post_processing_quality An abstract value representing the estimated PPK quality, or 255 if not available. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_gnss_integrity_send(mavlink_channel_t chan, uint8_t id, uint32_t system_errors, uint8_t authentication_state, uint8_t jamming_state, uint8_t spoofing_state, uint8_t raim_state, uint16_t raim_hfom, uint16_t raim_vfom, uint8_t corrections_quality, uint8_t system_status_summary, uint8_t gnss_signal_quality, uint8_t post_processing_quality) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GNSS_INTEGRITY_LEN]; + _mav_put_uint32_t(buf, 0, system_errors); + _mav_put_uint16_t(buf, 4, raim_hfom); + _mav_put_uint16_t(buf, 6, raim_vfom); + _mav_put_uint8_t(buf, 8, id); + _mav_put_uint8_t(buf, 9, authentication_state); + _mav_put_uint8_t(buf, 10, jamming_state); + _mav_put_uint8_t(buf, 11, spoofing_state); + _mav_put_uint8_t(buf, 12, raim_state); + _mav_put_uint8_t(buf, 13, corrections_quality); + _mav_put_uint8_t(buf, 14, system_status_summary); + _mav_put_uint8_t(buf, 15, gnss_signal_quality); + _mav_put_uint8_t(buf, 16, post_processing_quality); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GNSS_INTEGRITY, buf, MAVLINK_MSG_ID_GNSS_INTEGRITY_MIN_LEN, MAVLINK_MSG_ID_GNSS_INTEGRITY_LEN, MAVLINK_MSG_ID_GNSS_INTEGRITY_CRC); +#else + mavlink_gnss_integrity_t packet; + packet.system_errors = system_errors; + packet.raim_hfom = raim_hfom; + packet.raim_vfom = raim_vfom; + packet.id = id; + packet.authentication_state = authentication_state; + packet.jamming_state = jamming_state; + packet.spoofing_state = spoofing_state; + packet.raim_state = raim_state; + packet.corrections_quality = corrections_quality; + packet.system_status_summary = system_status_summary; + packet.gnss_signal_quality = gnss_signal_quality; + packet.post_processing_quality = post_processing_quality; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GNSS_INTEGRITY, (const char *)&packet, MAVLINK_MSG_ID_GNSS_INTEGRITY_MIN_LEN, MAVLINK_MSG_ID_GNSS_INTEGRITY_LEN, MAVLINK_MSG_ID_GNSS_INTEGRITY_CRC); +#endif +} + +/** + * @brief Send a gnss_integrity message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_gnss_integrity_send_struct(mavlink_channel_t chan, const mavlink_gnss_integrity_t* gnss_integrity) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_gnss_integrity_send(chan, gnss_integrity->id, gnss_integrity->system_errors, gnss_integrity->authentication_state, gnss_integrity->jamming_state, gnss_integrity->spoofing_state, gnss_integrity->raim_state, gnss_integrity->raim_hfom, gnss_integrity->raim_vfom, gnss_integrity->corrections_quality, gnss_integrity->system_status_summary, gnss_integrity->gnss_signal_quality, gnss_integrity->post_processing_quality); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GNSS_INTEGRITY, (const char *)gnss_integrity, MAVLINK_MSG_ID_GNSS_INTEGRITY_MIN_LEN, MAVLINK_MSG_ID_GNSS_INTEGRITY_LEN, MAVLINK_MSG_ID_GNSS_INTEGRITY_CRC); +#endif +} + +#if MAVLINK_MSG_ID_GNSS_INTEGRITY_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_gnss_integrity_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t id, uint32_t system_errors, uint8_t authentication_state, uint8_t jamming_state, uint8_t spoofing_state, uint8_t raim_state, uint16_t raim_hfom, uint16_t raim_vfom, uint8_t corrections_quality, uint8_t system_status_summary, uint8_t gnss_signal_quality, uint8_t post_processing_quality) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint32_t(buf, 0, system_errors); + _mav_put_uint16_t(buf, 4, raim_hfom); + _mav_put_uint16_t(buf, 6, raim_vfom); + _mav_put_uint8_t(buf, 8, id); + _mav_put_uint8_t(buf, 9, authentication_state); + _mav_put_uint8_t(buf, 10, jamming_state); + _mav_put_uint8_t(buf, 11, spoofing_state); + _mav_put_uint8_t(buf, 12, raim_state); + _mav_put_uint8_t(buf, 13, corrections_quality); + _mav_put_uint8_t(buf, 14, system_status_summary); + _mav_put_uint8_t(buf, 15, gnss_signal_quality); + _mav_put_uint8_t(buf, 16, post_processing_quality); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GNSS_INTEGRITY, buf, MAVLINK_MSG_ID_GNSS_INTEGRITY_MIN_LEN, MAVLINK_MSG_ID_GNSS_INTEGRITY_LEN, MAVLINK_MSG_ID_GNSS_INTEGRITY_CRC); +#else + mavlink_gnss_integrity_t *packet = (mavlink_gnss_integrity_t *)msgbuf; + packet->system_errors = system_errors; + packet->raim_hfom = raim_hfom; + packet->raim_vfom = raim_vfom; + packet->id = id; + packet->authentication_state = authentication_state; + packet->jamming_state = jamming_state; + packet->spoofing_state = spoofing_state; + packet->raim_state = raim_state; + packet->corrections_quality = corrections_quality; + packet->system_status_summary = system_status_summary; + packet->gnss_signal_quality = gnss_signal_quality; + packet->post_processing_quality = post_processing_quality; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GNSS_INTEGRITY, (const char *)packet, MAVLINK_MSG_ID_GNSS_INTEGRITY_MIN_LEN, MAVLINK_MSG_ID_GNSS_INTEGRITY_LEN, MAVLINK_MSG_ID_GNSS_INTEGRITY_CRC); +#endif +} +#endif + +#endif + +// MESSAGE GNSS_INTEGRITY UNPACKING + + +/** + * @brief Get field id from gnss_integrity message + * + * @return GNSS receiver id. Must match instance ids of other messages from same receiver. + */ +static inline uint8_t mavlink_msg_gnss_integrity_get_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 8); +} + +/** + * @brief Get field system_errors from gnss_integrity message + * + * @return Errors in the GPS system. + */ +static inline uint32_t mavlink_msg_gnss_integrity_get_system_errors(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 0); +} + +/** + * @brief Get field authentication_state from gnss_integrity message + * + * @return Signal authentication state of the GPS system. + */ +static inline uint8_t mavlink_msg_gnss_integrity_get_authentication_state(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 9); +} + +/** + * @brief Get field jamming_state from gnss_integrity message + * + * @return Signal jamming state of the GPS system. + */ +static inline uint8_t mavlink_msg_gnss_integrity_get_jamming_state(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 10); +} + +/** + * @brief Get field spoofing_state from gnss_integrity message + * + * @return Signal spoofing state of the GPS system. + */ +static inline uint8_t mavlink_msg_gnss_integrity_get_spoofing_state(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 11); +} + +/** + * @brief Get field raim_state from gnss_integrity message + * + * @return The state of the RAIM processing. + */ +static inline uint8_t mavlink_msg_gnss_integrity_get_raim_state(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 12); +} + +/** + * @brief Get field raim_hfom from gnss_integrity message + * + * @return [cm] Horizontal expected accuracy using satellites successfully validated using RAIM. + */ +static inline uint16_t mavlink_msg_gnss_integrity_get_raim_hfom(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 4); +} + +/** + * @brief Get field raim_vfom from gnss_integrity message + * + * @return [cm] Vertical expected accuracy using satellites successfully validated using RAIM. + */ +static inline uint16_t mavlink_msg_gnss_integrity_get_raim_vfom(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 6); +} + +/** + * @brief Get field corrections_quality from gnss_integrity message + * + * @return An abstract value representing the estimated quality of incoming corrections, or 255 if not available. + */ +static inline uint8_t mavlink_msg_gnss_integrity_get_corrections_quality(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 13); +} + +/** + * @brief Get field system_status_summary from gnss_integrity message + * + * @return An abstract value representing the overall status of the receiver, or 255 if not available. + */ +static inline uint8_t mavlink_msg_gnss_integrity_get_system_status_summary(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 14); +} + +/** + * @brief Get field gnss_signal_quality from gnss_integrity message + * + * @return An abstract value representing the quality of incoming GNSS signals, or 255 if not available. + */ +static inline uint8_t mavlink_msg_gnss_integrity_get_gnss_signal_quality(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 15); +} + +/** + * @brief Get field post_processing_quality from gnss_integrity message + * + * @return An abstract value representing the estimated PPK quality, or 255 if not available. + */ +static inline uint8_t mavlink_msg_gnss_integrity_get_post_processing_quality(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 16); +} + +/** + * @brief Decode a gnss_integrity message into a struct + * + * @param msg The message to decode + * @param gnss_integrity C-struct to decode the message contents into + */ +static inline void mavlink_msg_gnss_integrity_decode(const mavlink_message_t* msg, mavlink_gnss_integrity_t* gnss_integrity) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + gnss_integrity->system_errors = mavlink_msg_gnss_integrity_get_system_errors(msg); + gnss_integrity->raim_hfom = mavlink_msg_gnss_integrity_get_raim_hfom(msg); + gnss_integrity->raim_vfom = mavlink_msg_gnss_integrity_get_raim_vfom(msg); + gnss_integrity->id = mavlink_msg_gnss_integrity_get_id(msg); + gnss_integrity->authentication_state = mavlink_msg_gnss_integrity_get_authentication_state(msg); + gnss_integrity->jamming_state = mavlink_msg_gnss_integrity_get_jamming_state(msg); + gnss_integrity->spoofing_state = mavlink_msg_gnss_integrity_get_spoofing_state(msg); + gnss_integrity->raim_state = mavlink_msg_gnss_integrity_get_raim_state(msg); + gnss_integrity->corrections_quality = mavlink_msg_gnss_integrity_get_corrections_quality(msg); + gnss_integrity->system_status_summary = mavlink_msg_gnss_integrity_get_system_status_summary(msg); + gnss_integrity->gnss_signal_quality = mavlink_msg_gnss_integrity_get_gnss_signal_quality(msg); + gnss_integrity->post_processing_quality = mavlink_msg_gnss_integrity_get_post_processing_quality(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_GNSS_INTEGRITY_LEN? msg->len : MAVLINK_MSG_ID_GNSS_INTEGRITY_LEN; + memset(gnss_integrity, 0, MAVLINK_MSG_ID_GNSS_INTEGRITY_LEN); + memcpy(gnss_integrity, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/development/mavlink_msg_group_end.h b/development/mavlink_msg_group_end.h new file mode 100644 index 000000000..0c0fbfcab --- /dev/null +++ b/development/mavlink_msg_group_end.h @@ -0,0 +1,322 @@ +#pragma once +// MESSAGE GROUP_END PACKING + +#define MAVLINK_MSG_ID_GROUP_END 415 + + +typedef struct __mavlink_group_end_t { + uint64_t time_usec; /*< [us] Timestamp (UNIX Epoch time or time since system boot). + The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.*/ + uint32_t group_id; /*< Mission-unique group id (from MAV_CMD_GROUP_END).*/ + uint32_t mission_checksum; /*< CRC32 checksum of current plan for MAV_MISSION_TYPE_ALL. As defined in MISSION_CHECKSUM message.*/ +} mavlink_group_end_t; + +#define MAVLINK_MSG_ID_GROUP_END_LEN 16 +#define MAVLINK_MSG_ID_GROUP_END_MIN_LEN 16 +#define MAVLINK_MSG_ID_415_LEN 16 +#define MAVLINK_MSG_ID_415_MIN_LEN 16 + +#define MAVLINK_MSG_ID_GROUP_END_CRC 161 +#define MAVLINK_MSG_ID_415_CRC 161 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_GROUP_END { \ + 415, \ + "GROUP_END", \ + 3, \ + { { "group_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_group_end_t, group_id) }, \ + { "mission_checksum", NULL, MAVLINK_TYPE_UINT32_T, 0, 12, offsetof(mavlink_group_end_t, mission_checksum) }, \ + { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_group_end_t, time_usec) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_GROUP_END { \ + "GROUP_END", \ + 3, \ + { { "group_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_group_end_t, group_id) }, \ + { "mission_checksum", NULL, MAVLINK_TYPE_UINT32_T, 0, 12, offsetof(mavlink_group_end_t, mission_checksum) }, \ + { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_group_end_t, time_usec) }, \ + } \ +} +#endif + +/** + * @brief Pack a group_end message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param group_id Mission-unique group id (from MAV_CMD_GROUP_END). + * @param mission_checksum CRC32 checksum of current plan for MAV_MISSION_TYPE_ALL. As defined in MISSION_CHECKSUM message. + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). + The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_group_end_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint32_t group_id, uint32_t mission_checksum, uint64_t time_usec) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GROUP_END_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint32_t(buf, 8, group_id); + _mav_put_uint32_t(buf, 12, mission_checksum); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GROUP_END_LEN); +#else + mavlink_group_end_t packet; + packet.time_usec = time_usec; + packet.group_id = group_id; + packet.mission_checksum = mission_checksum; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GROUP_END_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GROUP_END; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GROUP_END_MIN_LEN, MAVLINK_MSG_ID_GROUP_END_LEN, MAVLINK_MSG_ID_GROUP_END_CRC); +} + +/** + * @brief Pack a group_end message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param group_id Mission-unique group id (from MAV_CMD_GROUP_END). + * @param mission_checksum CRC32 checksum of current plan for MAV_MISSION_TYPE_ALL. As defined in MISSION_CHECKSUM message. + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). + The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_group_end_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t group_id, uint32_t mission_checksum, uint64_t time_usec) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GROUP_END_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint32_t(buf, 8, group_id); + _mav_put_uint32_t(buf, 12, mission_checksum); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GROUP_END_LEN); +#else + mavlink_group_end_t packet; + packet.time_usec = time_usec; + packet.group_id = group_id; + packet.mission_checksum = mission_checksum; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GROUP_END_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GROUP_END; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GROUP_END_MIN_LEN, MAVLINK_MSG_ID_GROUP_END_LEN, MAVLINK_MSG_ID_GROUP_END_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GROUP_END_MIN_LEN, MAVLINK_MSG_ID_GROUP_END_LEN); +#endif +} + +/** + * @brief Pack a group_end message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param group_id Mission-unique group id (from MAV_CMD_GROUP_END). + * @param mission_checksum CRC32 checksum of current plan for MAV_MISSION_TYPE_ALL. As defined in MISSION_CHECKSUM message. + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). + The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_group_end_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint32_t group_id,uint32_t mission_checksum,uint64_t time_usec) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GROUP_END_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint32_t(buf, 8, group_id); + _mav_put_uint32_t(buf, 12, mission_checksum); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GROUP_END_LEN); +#else + mavlink_group_end_t packet; + packet.time_usec = time_usec; + packet.group_id = group_id; + packet.mission_checksum = mission_checksum; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GROUP_END_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GROUP_END; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GROUP_END_MIN_LEN, MAVLINK_MSG_ID_GROUP_END_LEN, MAVLINK_MSG_ID_GROUP_END_CRC); +} + +/** + * @brief Encode a group_end struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param group_end C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_group_end_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_group_end_t* group_end) +{ + return mavlink_msg_group_end_pack(system_id, component_id, msg, group_end->group_id, group_end->mission_checksum, group_end->time_usec); +} + +/** + * @brief Encode a group_end struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param group_end C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_group_end_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_group_end_t* group_end) +{ + return mavlink_msg_group_end_pack_chan(system_id, component_id, chan, msg, group_end->group_id, group_end->mission_checksum, group_end->time_usec); +} + +/** + * @brief Encode a group_end struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param group_end C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_group_end_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_group_end_t* group_end) +{ + return mavlink_msg_group_end_pack_status(system_id, component_id, _status, msg, group_end->group_id, group_end->mission_checksum, group_end->time_usec); +} + +/** + * @brief Send a group_end message + * @param chan MAVLink channel to send the message + * + * @param group_id Mission-unique group id (from MAV_CMD_GROUP_END). + * @param mission_checksum CRC32 checksum of current plan for MAV_MISSION_TYPE_ALL. As defined in MISSION_CHECKSUM message. + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). + The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_group_end_send(mavlink_channel_t chan, uint32_t group_id, uint32_t mission_checksum, uint64_t time_usec) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GROUP_END_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint32_t(buf, 8, group_id); + _mav_put_uint32_t(buf, 12, mission_checksum); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GROUP_END, buf, MAVLINK_MSG_ID_GROUP_END_MIN_LEN, MAVLINK_MSG_ID_GROUP_END_LEN, MAVLINK_MSG_ID_GROUP_END_CRC); +#else + mavlink_group_end_t packet; + packet.time_usec = time_usec; + packet.group_id = group_id; + packet.mission_checksum = mission_checksum; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GROUP_END, (const char *)&packet, MAVLINK_MSG_ID_GROUP_END_MIN_LEN, MAVLINK_MSG_ID_GROUP_END_LEN, MAVLINK_MSG_ID_GROUP_END_CRC); +#endif +} + +/** + * @brief Send a group_end message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_group_end_send_struct(mavlink_channel_t chan, const mavlink_group_end_t* group_end) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_group_end_send(chan, group_end->group_id, group_end->mission_checksum, group_end->time_usec); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GROUP_END, (const char *)group_end, MAVLINK_MSG_ID_GROUP_END_MIN_LEN, MAVLINK_MSG_ID_GROUP_END_LEN, MAVLINK_MSG_ID_GROUP_END_CRC); +#endif +} + +#if MAVLINK_MSG_ID_GROUP_END_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_group_end_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t group_id, uint32_t mission_checksum, uint64_t time_usec) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint32_t(buf, 8, group_id); + _mav_put_uint32_t(buf, 12, mission_checksum); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GROUP_END, buf, MAVLINK_MSG_ID_GROUP_END_MIN_LEN, MAVLINK_MSG_ID_GROUP_END_LEN, MAVLINK_MSG_ID_GROUP_END_CRC); +#else + mavlink_group_end_t *packet = (mavlink_group_end_t *)msgbuf; + packet->time_usec = time_usec; + packet->group_id = group_id; + packet->mission_checksum = mission_checksum; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GROUP_END, (const char *)packet, MAVLINK_MSG_ID_GROUP_END_MIN_LEN, MAVLINK_MSG_ID_GROUP_END_LEN, MAVLINK_MSG_ID_GROUP_END_CRC); +#endif +} +#endif + +#endif + +// MESSAGE GROUP_END UNPACKING + + +/** + * @brief Get field group_id from group_end message + * + * @return Mission-unique group id (from MAV_CMD_GROUP_END). + */ +static inline uint32_t mavlink_msg_group_end_get_group_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 8); +} + +/** + * @brief Get field mission_checksum from group_end message + * + * @return CRC32 checksum of current plan for MAV_MISSION_TYPE_ALL. As defined in MISSION_CHECKSUM message. + */ +static inline uint32_t mavlink_msg_group_end_get_mission_checksum(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 12); +} + +/** + * @brief Get field time_usec from group_end message + * + * @return [us] Timestamp (UNIX Epoch time or time since system boot). + The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + */ +static inline uint64_t mavlink_msg_group_end_get_time_usec(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 0); +} + +/** + * @brief Decode a group_end message into a struct + * + * @param msg The message to decode + * @param group_end C-struct to decode the message contents into + */ +static inline void mavlink_msg_group_end_decode(const mavlink_message_t* msg, mavlink_group_end_t* group_end) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + group_end->time_usec = mavlink_msg_group_end_get_time_usec(msg); + group_end->group_id = mavlink_msg_group_end_get_group_id(msg); + group_end->mission_checksum = mavlink_msg_group_end_get_mission_checksum(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_GROUP_END_LEN? msg->len : MAVLINK_MSG_ID_GROUP_END_LEN; + memset(group_end, 0, MAVLINK_MSG_ID_GROUP_END_LEN); + memcpy(group_end, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/development/mavlink_msg_group_start.h b/development/mavlink_msg_group_start.h new file mode 100644 index 000000000..fc43ce62e --- /dev/null +++ b/development/mavlink_msg_group_start.h @@ -0,0 +1,322 @@ +#pragma once +// MESSAGE GROUP_START PACKING + +#define MAVLINK_MSG_ID_GROUP_START 414 + + +typedef struct __mavlink_group_start_t { + uint64_t time_usec; /*< [us] Timestamp (UNIX Epoch time or time since system boot). + The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.*/ + uint32_t group_id; /*< Mission-unique group id (from MAV_CMD_GROUP_START).*/ + uint32_t mission_checksum; /*< CRC32 checksum of current plan for MAV_MISSION_TYPE_ALL. As defined in MISSION_CHECKSUM message.*/ +} mavlink_group_start_t; + +#define MAVLINK_MSG_ID_GROUP_START_LEN 16 +#define MAVLINK_MSG_ID_GROUP_START_MIN_LEN 16 +#define MAVLINK_MSG_ID_414_LEN 16 +#define MAVLINK_MSG_ID_414_MIN_LEN 16 + +#define MAVLINK_MSG_ID_GROUP_START_CRC 109 +#define MAVLINK_MSG_ID_414_CRC 109 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_GROUP_START { \ + 414, \ + "GROUP_START", \ + 3, \ + { { "group_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_group_start_t, group_id) }, \ + { "mission_checksum", NULL, MAVLINK_TYPE_UINT32_T, 0, 12, offsetof(mavlink_group_start_t, mission_checksum) }, \ + { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_group_start_t, time_usec) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_GROUP_START { \ + "GROUP_START", \ + 3, \ + { { "group_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_group_start_t, group_id) }, \ + { "mission_checksum", NULL, MAVLINK_TYPE_UINT32_T, 0, 12, offsetof(mavlink_group_start_t, mission_checksum) }, \ + { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_group_start_t, time_usec) }, \ + } \ +} +#endif + +/** + * @brief Pack a group_start message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param group_id Mission-unique group id (from MAV_CMD_GROUP_START). + * @param mission_checksum CRC32 checksum of current plan for MAV_MISSION_TYPE_ALL. As defined in MISSION_CHECKSUM message. + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). + The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_group_start_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint32_t group_id, uint32_t mission_checksum, uint64_t time_usec) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GROUP_START_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint32_t(buf, 8, group_id); + _mav_put_uint32_t(buf, 12, mission_checksum); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GROUP_START_LEN); +#else + mavlink_group_start_t packet; + packet.time_usec = time_usec; + packet.group_id = group_id; + packet.mission_checksum = mission_checksum; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GROUP_START_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GROUP_START; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GROUP_START_MIN_LEN, MAVLINK_MSG_ID_GROUP_START_LEN, MAVLINK_MSG_ID_GROUP_START_CRC); +} + +/** + * @brief Pack a group_start message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param group_id Mission-unique group id (from MAV_CMD_GROUP_START). + * @param mission_checksum CRC32 checksum of current plan for MAV_MISSION_TYPE_ALL. As defined in MISSION_CHECKSUM message. + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). + The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_group_start_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t group_id, uint32_t mission_checksum, uint64_t time_usec) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GROUP_START_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint32_t(buf, 8, group_id); + _mav_put_uint32_t(buf, 12, mission_checksum); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GROUP_START_LEN); +#else + mavlink_group_start_t packet; + packet.time_usec = time_usec; + packet.group_id = group_id; + packet.mission_checksum = mission_checksum; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GROUP_START_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GROUP_START; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GROUP_START_MIN_LEN, MAVLINK_MSG_ID_GROUP_START_LEN, MAVLINK_MSG_ID_GROUP_START_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GROUP_START_MIN_LEN, MAVLINK_MSG_ID_GROUP_START_LEN); +#endif +} + +/** + * @brief Pack a group_start message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param group_id Mission-unique group id (from MAV_CMD_GROUP_START). + * @param mission_checksum CRC32 checksum of current plan for MAV_MISSION_TYPE_ALL. As defined in MISSION_CHECKSUM message. + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). + The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_group_start_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint32_t group_id,uint32_t mission_checksum,uint64_t time_usec) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GROUP_START_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint32_t(buf, 8, group_id); + _mav_put_uint32_t(buf, 12, mission_checksum); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GROUP_START_LEN); +#else + mavlink_group_start_t packet; + packet.time_usec = time_usec; + packet.group_id = group_id; + packet.mission_checksum = mission_checksum; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GROUP_START_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GROUP_START; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GROUP_START_MIN_LEN, MAVLINK_MSG_ID_GROUP_START_LEN, MAVLINK_MSG_ID_GROUP_START_CRC); +} + +/** + * @brief Encode a group_start struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param group_start C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_group_start_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_group_start_t* group_start) +{ + return mavlink_msg_group_start_pack(system_id, component_id, msg, group_start->group_id, group_start->mission_checksum, group_start->time_usec); +} + +/** + * @brief Encode a group_start struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param group_start C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_group_start_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_group_start_t* group_start) +{ + return mavlink_msg_group_start_pack_chan(system_id, component_id, chan, msg, group_start->group_id, group_start->mission_checksum, group_start->time_usec); +} + +/** + * @brief Encode a group_start struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param group_start C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_group_start_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_group_start_t* group_start) +{ + return mavlink_msg_group_start_pack_status(system_id, component_id, _status, msg, group_start->group_id, group_start->mission_checksum, group_start->time_usec); +} + +/** + * @brief Send a group_start message + * @param chan MAVLink channel to send the message + * + * @param group_id Mission-unique group id (from MAV_CMD_GROUP_START). + * @param mission_checksum CRC32 checksum of current plan for MAV_MISSION_TYPE_ALL. As defined in MISSION_CHECKSUM message. + * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). + The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_group_start_send(mavlink_channel_t chan, uint32_t group_id, uint32_t mission_checksum, uint64_t time_usec) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GROUP_START_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint32_t(buf, 8, group_id); + _mav_put_uint32_t(buf, 12, mission_checksum); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GROUP_START, buf, MAVLINK_MSG_ID_GROUP_START_MIN_LEN, MAVLINK_MSG_ID_GROUP_START_LEN, MAVLINK_MSG_ID_GROUP_START_CRC); +#else + mavlink_group_start_t packet; + packet.time_usec = time_usec; + packet.group_id = group_id; + packet.mission_checksum = mission_checksum; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GROUP_START, (const char *)&packet, MAVLINK_MSG_ID_GROUP_START_MIN_LEN, MAVLINK_MSG_ID_GROUP_START_LEN, MAVLINK_MSG_ID_GROUP_START_CRC); +#endif +} + +/** + * @brief Send a group_start message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_group_start_send_struct(mavlink_channel_t chan, const mavlink_group_start_t* group_start) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_group_start_send(chan, group_start->group_id, group_start->mission_checksum, group_start->time_usec); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GROUP_START, (const char *)group_start, MAVLINK_MSG_ID_GROUP_START_MIN_LEN, MAVLINK_MSG_ID_GROUP_START_LEN, MAVLINK_MSG_ID_GROUP_START_CRC); +#endif +} + +#if MAVLINK_MSG_ID_GROUP_START_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_group_start_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t group_id, uint32_t mission_checksum, uint64_t time_usec) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_uint32_t(buf, 8, group_id); + _mav_put_uint32_t(buf, 12, mission_checksum); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GROUP_START, buf, MAVLINK_MSG_ID_GROUP_START_MIN_LEN, MAVLINK_MSG_ID_GROUP_START_LEN, MAVLINK_MSG_ID_GROUP_START_CRC); +#else + mavlink_group_start_t *packet = (mavlink_group_start_t *)msgbuf; + packet->time_usec = time_usec; + packet->group_id = group_id; + packet->mission_checksum = mission_checksum; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GROUP_START, (const char *)packet, MAVLINK_MSG_ID_GROUP_START_MIN_LEN, MAVLINK_MSG_ID_GROUP_START_LEN, MAVLINK_MSG_ID_GROUP_START_CRC); +#endif +} +#endif + +#endif + +// MESSAGE GROUP_START UNPACKING + + +/** + * @brief Get field group_id from group_start message + * + * @return Mission-unique group id (from MAV_CMD_GROUP_START). + */ +static inline uint32_t mavlink_msg_group_start_get_group_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 8); +} + +/** + * @brief Get field mission_checksum from group_start message + * + * @return CRC32 checksum of current plan for MAV_MISSION_TYPE_ALL. As defined in MISSION_CHECKSUM message. + */ +static inline uint32_t mavlink_msg_group_start_get_mission_checksum(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 12); +} + +/** + * @brief Get field time_usec from group_start message + * + * @return [us] Timestamp (UNIX Epoch time or time since system boot). + The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. + */ +static inline uint64_t mavlink_msg_group_start_get_time_usec(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 0); +} + +/** + * @brief Decode a group_start message into a struct + * + * @param msg The message to decode + * @param group_start C-struct to decode the message contents into + */ +static inline void mavlink_msg_group_start_decode(const mavlink_message_t* msg, mavlink_group_start_t* group_start) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + group_start->time_usec = mavlink_msg_group_start_get_time_usec(msg); + group_start->group_id = mavlink_msg_group_start_get_group_id(msg); + group_start->mission_checksum = mavlink_msg_group_start_get_mission_checksum(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_GROUP_START_LEN? msg->len : MAVLINK_MSG_ID_GROUP_START_LEN; + memset(group_start, 0, MAVLINK_MSG_ID_GROUP_START_LEN); + memcpy(group_start, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/development/mavlink_msg_radio_rc_channels.h b/development/mavlink_msg_radio_rc_channels.h new file mode 100644 index 000000000..ce8f276ae --- /dev/null +++ b/development/mavlink_msg_radio_rc_channels.h @@ -0,0 +1,402 @@ +#pragma once +// MESSAGE RADIO_RC_CHANNELS PACKING + +#define MAVLINK_MSG_ID_RADIO_RC_CHANNELS 420 + +MAVPACKED( +typedef struct __mavlink_radio_rc_channels_t { + uint32_t time_last_update_ms; /*< [ms] Time when the data in the channels field were last updated (time since boot in the receiver's time domain).*/ + uint16_t flags; /*< Radio RC channels status flags.*/ + uint8_t target_system; /*< System ID (ID of target system, normally flight controller).*/ + uint8_t target_component; /*< Component ID (normally 0 for broadcast).*/ + uint8_t count; /*< Total number of RC channels being received. This can be larger than 32, indicating that more channels are available but not given in this message.*/ + int16_t channels[32]; /*< RC channels. + Channel values are in centered 13 bit format. Range is -4096 to 4096, center is 0. Conversion to PWM is x * 5/32 + 1500. + Channels with indexes equal or above count should be set to 0, to benefit from MAVLink's trailing-zero trimming.*/ +}) mavlink_radio_rc_channels_t; + +#define MAVLINK_MSG_ID_RADIO_RC_CHANNELS_LEN 73 +#define MAVLINK_MSG_ID_RADIO_RC_CHANNELS_MIN_LEN 9 +#define MAVLINK_MSG_ID_420_LEN 73 +#define MAVLINK_MSG_ID_420_MIN_LEN 9 + +#define MAVLINK_MSG_ID_RADIO_RC_CHANNELS_CRC 20 +#define MAVLINK_MSG_ID_420_CRC 20 + +#define MAVLINK_MSG_RADIO_RC_CHANNELS_FIELD_CHANNELS_LEN 32 + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_RADIO_RC_CHANNELS { \ + 420, \ + "RADIO_RC_CHANNELS", \ + 6, \ + { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_radio_rc_channels_t, target_system) }, \ + { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_radio_rc_channels_t, target_component) }, \ + { "time_last_update_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_radio_rc_channels_t, time_last_update_ms) }, \ + { "flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_radio_rc_channels_t, flags) }, \ + { "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_radio_rc_channels_t, count) }, \ + { "channels", NULL, MAVLINK_TYPE_INT16_T, 32, 9, offsetof(mavlink_radio_rc_channels_t, channels) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_RADIO_RC_CHANNELS { \ + "RADIO_RC_CHANNELS", \ + 6, \ + { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_radio_rc_channels_t, target_system) }, \ + { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_radio_rc_channels_t, target_component) }, \ + { "time_last_update_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_radio_rc_channels_t, time_last_update_ms) }, \ + { "flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_radio_rc_channels_t, flags) }, \ + { "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_radio_rc_channels_t, count) }, \ + { "channels", NULL, MAVLINK_TYPE_INT16_T, 32, 9, offsetof(mavlink_radio_rc_channels_t, channels) }, \ + } \ +} +#endif + +/** + * @brief Pack a radio_rc_channels message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID (ID of target system, normally flight controller). + * @param target_component Component ID (normally 0 for broadcast). + * @param time_last_update_ms [ms] Time when the data in the channels field were last updated (time since boot in the receiver's time domain). + * @param flags Radio RC channels status flags. + * @param count Total number of RC channels being received. This can be larger than 32, indicating that more channels are available but not given in this message. + * @param channels RC channels. + Channel values are in centered 13 bit format. Range is -4096 to 4096, center is 0. Conversion to PWM is x * 5/32 + 1500. + Channels with indexes equal or above count should be set to 0, to benefit from MAVLink's trailing-zero trimming. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_radio_rc_channels_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint32_t time_last_update_ms, uint16_t flags, uint8_t count, const int16_t *channels) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RADIO_RC_CHANNELS_LEN]; + _mav_put_uint32_t(buf, 0, time_last_update_ms); + _mav_put_uint16_t(buf, 4, flags); + _mav_put_uint8_t(buf, 6, target_system); + _mav_put_uint8_t(buf, 7, target_component); + _mav_put_uint8_t(buf, 8, count); + _mav_put_int16_t_array(buf, 9, channels, 32); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_LEN); +#else + mavlink_radio_rc_channels_t packet; + packet.time_last_update_ms = time_last_update_ms; + packet.flags = flags; + packet.target_system = target_system; + packet.target_component = target_component; + packet.count = count; + mav_array_assign_int16_t(packet.channels, channels, 32); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_RADIO_RC_CHANNELS; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_MIN_LEN, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_LEN, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_CRC); +} + +/** + * @brief Pack a radio_rc_channels message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID (ID of target system, normally flight controller). + * @param target_component Component ID (normally 0 for broadcast). + * @param time_last_update_ms [ms] Time when the data in the channels field were last updated (time since boot in the receiver's time domain). + * @param flags Radio RC channels status flags. + * @param count Total number of RC channels being received. This can be larger than 32, indicating that more channels are available but not given in this message. + * @param channels RC channels. + Channel values are in centered 13 bit format. Range is -4096 to 4096, center is 0. Conversion to PWM is x * 5/32 + 1500. + Channels with indexes equal or above count should be set to 0, to benefit from MAVLink's trailing-zero trimming. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_radio_rc_channels_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, uint32_t time_last_update_ms, uint16_t flags, uint8_t count, const int16_t *channels) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RADIO_RC_CHANNELS_LEN]; + _mav_put_uint32_t(buf, 0, time_last_update_ms); + _mav_put_uint16_t(buf, 4, flags); + _mav_put_uint8_t(buf, 6, target_system); + _mav_put_uint8_t(buf, 7, target_component); + _mav_put_uint8_t(buf, 8, count); + _mav_put_int16_t_array(buf, 9, channels, 32); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_LEN); +#else + mavlink_radio_rc_channels_t packet; + packet.time_last_update_ms = time_last_update_ms; + packet.flags = flags; + packet.target_system = target_system; + packet.target_component = target_component; + packet.count = count; + mav_array_memcpy(packet.channels, channels, sizeof(int16_t)*32); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_RADIO_RC_CHANNELS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_MIN_LEN, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_LEN, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_MIN_LEN, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_LEN); +#endif +} + +/** + * @brief Pack a radio_rc_channels message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param target_system System ID (ID of target system, normally flight controller). + * @param target_component Component ID (normally 0 for broadcast). + * @param time_last_update_ms [ms] Time when the data in the channels field were last updated (time since boot in the receiver's time domain). + * @param flags Radio RC channels status flags. + * @param count Total number of RC channels being received. This can be larger than 32, indicating that more channels are available but not given in this message. + * @param channels RC channels. + Channel values are in centered 13 bit format. Range is -4096 to 4096, center is 0. Conversion to PWM is x * 5/32 + 1500. + Channels with indexes equal or above count should be set to 0, to benefit from MAVLink's trailing-zero trimming. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_radio_rc_channels_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t target_system,uint8_t target_component,uint32_t time_last_update_ms,uint16_t flags,uint8_t count,const int16_t *channels) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RADIO_RC_CHANNELS_LEN]; + _mav_put_uint32_t(buf, 0, time_last_update_ms); + _mav_put_uint16_t(buf, 4, flags); + _mav_put_uint8_t(buf, 6, target_system); + _mav_put_uint8_t(buf, 7, target_component); + _mav_put_uint8_t(buf, 8, count); + _mav_put_int16_t_array(buf, 9, channels, 32); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_LEN); +#else + mavlink_radio_rc_channels_t packet; + packet.time_last_update_ms = time_last_update_ms; + packet.flags = flags; + packet.target_system = target_system; + packet.target_component = target_component; + packet.count = count; + mav_array_assign_int16_t(packet.channels, channels, 32); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_RADIO_RC_CHANNELS; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_MIN_LEN, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_LEN, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_CRC); +} + +/** + * @brief Encode a radio_rc_channels struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param radio_rc_channels C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_radio_rc_channels_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_radio_rc_channels_t* radio_rc_channels) +{ + return mavlink_msg_radio_rc_channels_pack(system_id, component_id, msg, radio_rc_channels->target_system, radio_rc_channels->target_component, radio_rc_channels->time_last_update_ms, radio_rc_channels->flags, radio_rc_channels->count, radio_rc_channels->channels); +} + +/** + * @brief Encode a radio_rc_channels struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param radio_rc_channels C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_radio_rc_channels_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_radio_rc_channels_t* radio_rc_channels) +{ + return mavlink_msg_radio_rc_channels_pack_chan(system_id, component_id, chan, msg, radio_rc_channels->target_system, radio_rc_channels->target_component, radio_rc_channels->time_last_update_ms, radio_rc_channels->flags, radio_rc_channels->count, radio_rc_channels->channels); +} + +/** + * @brief Encode a radio_rc_channels struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param radio_rc_channels C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_radio_rc_channels_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_radio_rc_channels_t* radio_rc_channels) +{ + return mavlink_msg_radio_rc_channels_pack_status(system_id, component_id, _status, msg, radio_rc_channels->target_system, radio_rc_channels->target_component, radio_rc_channels->time_last_update_ms, radio_rc_channels->flags, radio_rc_channels->count, radio_rc_channels->channels); +} + +/** + * @brief Send a radio_rc_channels message + * @param chan MAVLink channel to send the message + * + * @param target_system System ID (ID of target system, normally flight controller). + * @param target_component Component ID (normally 0 for broadcast). + * @param time_last_update_ms [ms] Time when the data in the channels field were last updated (time since boot in the receiver's time domain). + * @param flags Radio RC channels status flags. + * @param count Total number of RC channels being received. This can be larger than 32, indicating that more channels are available but not given in this message. + * @param channels RC channels. + Channel values are in centered 13 bit format. Range is -4096 to 4096, center is 0. Conversion to PWM is x * 5/32 + 1500. + Channels with indexes equal or above count should be set to 0, to benefit from MAVLink's trailing-zero trimming. + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_radio_rc_channels_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint32_t time_last_update_ms, uint16_t flags, uint8_t count, const int16_t *channels) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_RADIO_RC_CHANNELS_LEN]; + _mav_put_uint32_t(buf, 0, time_last_update_ms); + _mav_put_uint16_t(buf, 4, flags); + _mav_put_uint8_t(buf, 6, target_system); + _mav_put_uint8_t(buf, 7, target_component); + _mav_put_uint8_t(buf, 8, count); + _mav_put_int16_t_array(buf, 9, channels, 32); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIO_RC_CHANNELS, buf, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_MIN_LEN, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_LEN, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_CRC); +#else + mavlink_radio_rc_channels_t packet; + packet.time_last_update_ms = time_last_update_ms; + packet.flags = flags; + packet.target_system = target_system; + packet.target_component = target_component; + packet.count = count; + mav_array_assign_int16_t(packet.channels, channels, 32); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIO_RC_CHANNELS, (const char *)&packet, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_MIN_LEN, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_LEN, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_CRC); +#endif +} + +/** + * @brief Send a radio_rc_channels message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_radio_rc_channels_send_struct(mavlink_channel_t chan, const mavlink_radio_rc_channels_t* radio_rc_channels) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_radio_rc_channels_send(chan, radio_rc_channels->target_system, radio_rc_channels->target_component, radio_rc_channels->time_last_update_ms, radio_rc_channels->flags, radio_rc_channels->count, radio_rc_channels->channels); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIO_RC_CHANNELS, (const char *)radio_rc_channels, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_MIN_LEN, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_LEN, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_CRC); +#endif +} + +#if MAVLINK_MSG_ID_RADIO_RC_CHANNELS_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_radio_rc_channels_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint32_t time_last_update_ms, uint16_t flags, uint8_t count, const int16_t *channels) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint32_t(buf, 0, time_last_update_ms); + _mav_put_uint16_t(buf, 4, flags); + _mav_put_uint8_t(buf, 6, target_system); + _mav_put_uint8_t(buf, 7, target_component); + _mav_put_uint8_t(buf, 8, count); + _mav_put_int16_t_array(buf, 9, channels, 32); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIO_RC_CHANNELS, buf, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_MIN_LEN, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_LEN, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_CRC); +#else + mavlink_radio_rc_channels_t *packet = (mavlink_radio_rc_channels_t *)msgbuf; + packet->time_last_update_ms = time_last_update_ms; + packet->flags = flags; + packet->target_system = target_system; + packet->target_component = target_component; + packet->count = count; + mav_array_assign_int16_t(packet->channels, channels, 32); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIO_RC_CHANNELS, (const char *)packet, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_MIN_LEN, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_LEN, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_CRC); +#endif +} +#endif + +#endif + +// MESSAGE RADIO_RC_CHANNELS UNPACKING + + +/** + * @brief Get field target_system from radio_rc_channels message + * + * @return System ID (ID of target system, normally flight controller). + */ +static inline uint8_t mavlink_msg_radio_rc_channels_get_target_system(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 6); +} + +/** + * @brief Get field target_component from radio_rc_channels message + * + * @return Component ID (normally 0 for broadcast). + */ +static inline uint8_t mavlink_msg_radio_rc_channels_get_target_component(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 7); +} + +/** + * @brief Get field time_last_update_ms from radio_rc_channels message + * + * @return [ms] Time when the data in the channels field were last updated (time since boot in the receiver's time domain). + */ +static inline uint32_t mavlink_msg_radio_rc_channels_get_time_last_update_ms(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 0); +} + +/** + * @brief Get field flags from radio_rc_channels message + * + * @return Radio RC channels status flags. + */ +static inline uint16_t mavlink_msg_radio_rc_channels_get_flags(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 4); +} + +/** + * @brief Get field count from radio_rc_channels message + * + * @return Total number of RC channels being received. This can be larger than 32, indicating that more channels are available but not given in this message. + */ +static inline uint8_t mavlink_msg_radio_rc_channels_get_count(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 8); +} + +/** + * @brief Get field channels from radio_rc_channels message + * + * @return RC channels. + Channel values are in centered 13 bit format. Range is -4096 to 4096, center is 0. Conversion to PWM is x * 5/32 + 1500. + Channels with indexes equal or above count should be set to 0, to benefit from MAVLink's trailing-zero trimming. + */ +static inline uint16_t mavlink_msg_radio_rc_channels_get_channels(const mavlink_message_t* msg, int16_t *channels) +{ + return _MAV_RETURN_int16_t_array(msg, channels, 32, 9); +} + +/** + * @brief Decode a radio_rc_channels message into a struct + * + * @param msg The message to decode + * @param radio_rc_channels C-struct to decode the message contents into + */ +static inline void mavlink_msg_radio_rc_channels_decode(const mavlink_message_t* msg, mavlink_radio_rc_channels_t* radio_rc_channels) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + radio_rc_channels->time_last_update_ms = mavlink_msg_radio_rc_channels_get_time_last_update_ms(msg); + radio_rc_channels->flags = mavlink_msg_radio_rc_channels_get_flags(msg); + radio_rc_channels->target_system = mavlink_msg_radio_rc_channels_get_target_system(msg); + radio_rc_channels->target_component = mavlink_msg_radio_rc_channels_get_target_component(msg); + radio_rc_channels->count = mavlink_msg_radio_rc_channels_get_count(msg); + mavlink_msg_radio_rc_channels_get_channels(msg, radio_rc_channels->channels); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_RADIO_RC_CHANNELS_LEN? msg->len : MAVLINK_MSG_ID_RADIO_RC_CHANNELS_LEN; + memset(radio_rc_channels, 0, MAVLINK_MSG_ID_RADIO_RC_CHANNELS_LEN); + memcpy(radio_rc_channels, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/development/mavlink_msg_set_velocity_limits.h b/development/mavlink_msg_set_velocity_limits.h new file mode 100644 index 000000000..f81b25aee --- /dev/null +++ b/development/mavlink_msg_set_velocity_limits.h @@ -0,0 +1,372 @@ +#pragma once +// MESSAGE SET_VELOCITY_LIMITS PACKING + +#define MAVLINK_MSG_ID_SET_VELOCITY_LIMITS 354 + + +typedef struct __mavlink_set_velocity_limits_t { + float horizontal_speed_limit; /*< [m/s] Limit for horizontal movement in MAV_FRAME_LOCAL_NED. NaN: Field not used (ignore)*/ + float vertical_speed_limit; /*< [m/s] Limit for vertical movement in MAV_FRAME_LOCAL_NED. NaN: Field not used (ignore)*/ + float yaw_rate_limit; /*< [rad/s] Limit for vehicle turn rate around its yaw axis. NaN: Field not used (ignore)*/ + uint8_t target_system; /*< System ID (0 for broadcast).*/ + uint8_t target_component; /*< Component ID (0 for broadcast).*/ +} mavlink_set_velocity_limits_t; + +#define MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_LEN 14 +#define MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_MIN_LEN 14 +#define MAVLINK_MSG_ID_354_LEN 14 +#define MAVLINK_MSG_ID_354_MIN_LEN 14 + +#define MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_CRC 210 +#define MAVLINK_MSG_ID_354_CRC 210 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_SET_VELOCITY_LIMITS { \ + 354, \ + "SET_VELOCITY_LIMITS", \ + 5, \ + { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_set_velocity_limits_t, target_system) }, \ + { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_set_velocity_limits_t, target_component) }, \ + { "horizontal_speed_limit", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_set_velocity_limits_t, horizontal_speed_limit) }, \ + { "vertical_speed_limit", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_set_velocity_limits_t, vertical_speed_limit) }, \ + { "yaw_rate_limit", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_set_velocity_limits_t, yaw_rate_limit) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_SET_VELOCITY_LIMITS { \ + "SET_VELOCITY_LIMITS", \ + 5, \ + { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_set_velocity_limits_t, target_system) }, \ + { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_set_velocity_limits_t, target_component) }, \ + { "horizontal_speed_limit", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_set_velocity_limits_t, horizontal_speed_limit) }, \ + { "vertical_speed_limit", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_set_velocity_limits_t, vertical_speed_limit) }, \ + { "yaw_rate_limit", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_set_velocity_limits_t, yaw_rate_limit) }, \ + } \ +} +#endif + +/** + * @brief Pack a set_velocity_limits message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID (0 for broadcast). + * @param target_component Component ID (0 for broadcast). + * @param horizontal_speed_limit [m/s] Limit for horizontal movement in MAV_FRAME_LOCAL_NED. NaN: Field not used (ignore) + * @param vertical_speed_limit [m/s] Limit for vertical movement in MAV_FRAME_LOCAL_NED. NaN: Field not used (ignore) + * @param yaw_rate_limit [rad/s] Limit for vehicle turn rate around its yaw axis. NaN: Field not used (ignore) + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_set_velocity_limits_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, float horizontal_speed_limit, float vertical_speed_limit, float yaw_rate_limit) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_LEN]; + _mav_put_float(buf, 0, horizontal_speed_limit); + _mav_put_float(buf, 4, vertical_speed_limit); + _mav_put_float(buf, 8, yaw_rate_limit); + _mav_put_uint8_t(buf, 12, target_system); + _mav_put_uint8_t(buf, 13, target_component); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_LEN); +#else + mavlink_set_velocity_limits_t packet; + packet.horizontal_speed_limit = horizontal_speed_limit; + packet.vertical_speed_limit = vertical_speed_limit; + packet.yaw_rate_limit = yaw_rate_limit; + packet.target_system = target_system; + packet.target_component = target_component; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_SET_VELOCITY_LIMITS; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_MIN_LEN, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_LEN, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_CRC); +} + +/** + * @brief Pack a set_velocity_limits message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param target_system System ID (0 for broadcast). + * @param target_component Component ID (0 for broadcast). + * @param horizontal_speed_limit [m/s] Limit for horizontal movement in MAV_FRAME_LOCAL_NED. NaN: Field not used (ignore) + * @param vertical_speed_limit [m/s] Limit for vertical movement in MAV_FRAME_LOCAL_NED. NaN: Field not used (ignore) + * @param yaw_rate_limit [rad/s] Limit for vehicle turn rate around its yaw axis. NaN: Field not used (ignore) + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_set_velocity_limits_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t target_system, uint8_t target_component, float horizontal_speed_limit, float vertical_speed_limit, float yaw_rate_limit) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_LEN]; + _mav_put_float(buf, 0, horizontal_speed_limit); + _mav_put_float(buf, 4, vertical_speed_limit); + _mav_put_float(buf, 8, yaw_rate_limit); + _mav_put_uint8_t(buf, 12, target_system); + _mav_put_uint8_t(buf, 13, target_component); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_LEN); +#else + mavlink_set_velocity_limits_t packet; + packet.horizontal_speed_limit = horizontal_speed_limit; + packet.vertical_speed_limit = vertical_speed_limit; + packet.yaw_rate_limit = yaw_rate_limit; + packet.target_system = target_system; + packet.target_component = target_component; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_SET_VELOCITY_LIMITS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_MIN_LEN, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_LEN, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_MIN_LEN, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_LEN); +#endif +} + +/** + * @brief Pack a set_velocity_limits message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param target_system System ID (0 for broadcast). + * @param target_component Component ID (0 for broadcast). + * @param horizontal_speed_limit [m/s] Limit for horizontal movement in MAV_FRAME_LOCAL_NED. NaN: Field not used (ignore) + * @param vertical_speed_limit [m/s] Limit for vertical movement in MAV_FRAME_LOCAL_NED. NaN: Field not used (ignore) + * @param yaw_rate_limit [rad/s] Limit for vehicle turn rate around its yaw axis. NaN: Field not used (ignore) + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_set_velocity_limits_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint8_t target_system,uint8_t target_component,float horizontal_speed_limit,float vertical_speed_limit,float yaw_rate_limit) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_LEN]; + _mav_put_float(buf, 0, horizontal_speed_limit); + _mav_put_float(buf, 4, vertical_speed_limit); + _mav_put_float(buf, 8, yaw_rate_limit); + _mav_put_uint8_t(buf, 12, target_system); + _mav_put_uint8_t(buf, 13, target_component); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_LEN); +#else + mavlink_set_velocity_limits_t packet; + packet.horizontal_speed_limit = horizontal_speed_limit; + packet.vertical_speed_limit = vertical_speed_limit; + packet.yaw_rate_limit = yaw_rate_limit; + packet.target_system = target_system; + packet.target_component = target_component; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_SET_VELOCITY_LIMITS; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_MIN_LEN, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_LEN, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_CRC); +} + +/** + * @brief Encode a set_velocity_limits struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param set_velocity_limits C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_set_velocity_limits_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_set_velocity_limits_t* set_velocity_limits) +{ + return mavlink_msg_set_velocity_limits_pack(system_id, component_id, msg, set_velocity_limits->target_system, set_velocity_limits->target_component, set_velocity_limits->horizontal_speed_limit, set_velocity_limits->vertical_speed_limit, set_velocity_limits->yaw_rate_limit); +} + +/** + * @brief Encode a set_velocity_limits struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param set_velocity_limits C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_set_velocity_limits_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_set_velocity_limits_t* set_velocity_limits) +{ + return mavlink_msg_set_velocity_limits_pack_chan(system_id, component_id, chan, msg, set_velocity_limits->target_system, set_velocity_limits->target_component, set_velocity_limits->horizontal_speed_limit, set_velocity_limits->vertical_speed_limit, set_velocity_limits->yaw_rate_limit); +} + +/** + * @brief Encode a set_velocity_limits struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param set_velocity_limits C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_set_velocity_limits_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_set_velocity_limits_t* set_velocity_limits) +{ + return mavlink_msg_set_velocity_limits_pack_status(system_id, component_id, _status, msg, set_velocity_limits->target_system, set_velocity_limits->target_component, set_velocity_limits->horizontal_speed_limit, set_velocity_limits->vertical_speed_limit, set_velocity_limits->yaw_rate_limit); +} + +/** + * @brief Send a set_velocity_limits message + * @param chan MAVLink channel to send the message + * + * @param target_system System ID (0 for broadcast). + * @param target_component Component ID (0 for broadcast). + * @param horizontal_speed_limit [m/s] Limit for horizontal movement in MAV_FRAME_LOCAL_NED. NaN: Field not used (ignore) + * @param vertical_speed_limit [m/s] Limit for vertical movement in MAV_FRAME_LOCAL_NED. NaN: Field not used (ignore) + * @param yaw_rate_limit [rad/s] Limit for vehicle turn rate around its yaw axis. NaN: Field not used (ignore) + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_set_velocity_limits_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, float horizontal_speed_limit, float vertical_speed_limit, float yaw_rate_limit) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_LEN]; + _mav_put_float(buf, 0, horizontal_speed_limit); + _mav_put_float(buf, 4, vertical_speed_limit); + _mav_put_float(buf, 8, yaw_rate_limit); + _mav_put_uint8_t(buf, 12, target_system); + _mav_put_uint8_t(buf, 13, target_component); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS, buf, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_MIN_LEN, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_LEN, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_CRC); +#else + mavlink_set_velocity_limits_t packet; + packet.horizontal_speed_limit = horizontal_speed_limit; + packet.vertical_speed_limit = vertical_speed_limit; + packet.yaw_rate_limit = yaw_rate_limit; + packet.target_system = target_system; + packet.target_component = target_component; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS, (const char *)&packet, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_MIN_LEN, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_LEN, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_CRC); +#endif +} + +/** + * @brief Send a set_velocity_limits message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_set_velocity_limits_send_struct(mavlink_channel_t chan, const mavlink_set_velocity_limits_t* set_velocity_limits) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_set_velocity_limits_send(chan, set_velocity_limits->target_system, set_velocity_limits->target_component, set_velocity_limits->horizontal_speed_limit, set_velocity_limits->vertical_speed_limit, set_velocity_limits->yaw_rate_limit); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS, (const char *)set_velocity_limits, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_MIN_LEN, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_LEN, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_CRC); +#endif +} + +#if MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_set_velocity_limits_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, float horizontal_speed_limit, float vertical_speed_limit, float yaw_rate_limit) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_float(buf, 0, horizontal_speed_limit); + _mav_put_float(buf, 4, vertical_speed_limit); + _mav_put_float(buf, 8, yaw_rate_limit); + _mav_put_uint8_t(buf, 12, target_system); + _mav_put_uint8_t(buf, 13, target_component); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS, buf, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_MIN_LEN, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_LEN, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_CRC); +#else + mavlink_set_velocity_limits_t *packet = (mavlink_set_velocity_limits_t *)msgbuf; + packet->horizontal_speed_limit = horizontal_speed_limit; + packet->vertical_speed_limit = vertical_speed_limit; + packet->yaw_rate_limit = yaw_rate_limit; + packet->target_system = target_system; + packet->target_component = target_component; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS, (const char *)packet, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_MIN_LEN, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_LEN, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_CRC); +#endif +} +#endif + +#endif + +// MESSAGE SET_VELOCITY_LIMITS UNPACKING + + +/** + * @brief Get field target_system from set_velocity_limits message + * + * @return System ID (0 for broadcast). + */ +static inline uint8_t mavlink_msg_set_velocity_limits_get_target_system(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 12); +} + +/** + * @brief Get field target_component from set_velocity_limits message + * + * @return Component ID (0 for broadcast). + */ +static inline uint8_t mavlink_msg_set_velocity_limits_get_target_component(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 13); +} + +/** + * @brief Get field horizontal_speed_limit from set_velocity_limits message + * + * @return [m/s] Limit for horizontal movement in MAV_FRAME_LOCAL_NED. NaN: Field not used (ignore) + */ +static inline float mavlink_msg_set_velocity_limits_get_horizontal_speed_limit(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 0); +} + +/** + * @brief Get field vertical_speed_limit from set_velocity_limits message + * + * @return [m/s] Limit for vertical movement in MAV_FRAME_LOCAL_NED. NaN: Field not used (ignore) + */ +static inline float mavlink_msg_set_velocity_limits_get_vertical_speed_limit(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 4); +} + +/** + * @brief Get field yaw_rate_limit from set_velocity_limits message + * + * @return [rad/s] Limit for vehicle turn rate around its yaw axis. NaN: Field not used (ignore) + */ +static inline float mavlink_msg_set_velocity_limits_get_yaw_rate_limit(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 8); +} + +/** + * @brief Decode a set_velocity_limits message into a struct + * + * @param msg The message to decode + * @param set_velocity_limits C-struct to decode the message contents into + */ +static inline void mavlink_msg_set_velocity_limits_decode(const mavlink_message_t* msg, mavlink_set_velocity_limits_t* set_velocity_limits) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + set_velocity_limits->horizontal_speed_limit = mavlink_msg_set_velocity_limits_get_horizontal_speed_limit(msg); + set_velocity_limits->vertical_speed_limit = mavlink_msg_set_velocity_limits_get_vertical_speed_limit(msg); + set_velocity_limits->yaw_rate_limit = mavlink_msg_set_velocity_limits_get_yaw_rate_limit(msg); + set_velocity_limits->target_system = mavlink_msg_set_velocity_limits_get_target_system(msg); + set_velocity_limits->target_component = mavlink_msg_set_velocity_limits_get_target_component(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_LEN? msg->len : MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_LEN; + memset(set_velocity_limits, 0, MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_LEN); + memcpy(set_velocity_limits, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/development/mavlink_msg_target_absolute.h b/development/mavlink_msg_target_absolute.h new file mode 100644 index 000000000..a5037a5b9 --- /dev/null +++ b/development/mavlink_msg_target_absolute.h @@ -0,0 +1,592 @@ +#pragma once +// MESSAGE TARGET_ABSOLUTE PACKING + +#define MAVLINK_MSG_ID_TARGET_ABSOLUTE 510 + + +typedef struct __mavlink_target_absolute_t { + uint64_t timestamp; /*< [us] Timestamp (UNIX epoch time).*/ + int32_t lat; /*< [degE7] Target's latitude (WGS84)*/ + int32_t lon; /*< [degE7] Target's longitude (WGS84)*/ + float alt; /*< [m] Target's altitude (AMSL)*/ + float vel[3]; /*< [m/s] Target's velocity in its body frame*/ + float acc[3]; /*< [m/s/s] Linear target's acceleration in its body frame*/ + float q_target[4]; /*< Quaternion of the target's orientation from its body frame to the vehicle's NED frame.*/ + float rates[3]; /*< [rad/s] Target's roll, pitch and yaw rates*/ + float position_std[2]; /*< [m] Standard deviation of horizontal (eph) and vertical (epv) position errors*/ + float vel_std[3]; /*< [m/s] Standard deviation of the target's velocity in its body frame*/ + float acc_std[3]; /*< [m/s/s] Standard deviation of the target's acceleration in its body frame*/ + uint8_t id; /*< The ID of the target if multiple targets are present*/ + uint8_t sensor_capabilities; /*< Bitmap to indicate the sensor's reporting capabilities*/ +} mavlink_target_absolute_t; + +#define MAVLINK_MSG_ID_TARGET_ABSOLUTE_LEN 106 +#define MAVLINK_MSG_ID_TARGET_ABSOLUTE_MIN_LEN 106 +#define MAVLINK_MSG_ID_510_LEN 106 +#define MAVLINK_MSG_ID_510_MIN_LEN 106 + +#define MAVLINK_MSG_ID_TARGET_ABSOLUTE_CRC 245 +#define MAVLINK_MSG_ID_510_CRC 245 + +#define MAVLINK_MSG_TARGET_ABSOLUTE_FIELD_VEL_LEN 3 +#define MAVLINK_MSG_TARGET_ABSOLUTE_FIELD_ACC_LEN 3 +#define MAVLINK_MSG_TARGET_ABSOLUTE_FIELD_Q_TARGET_LEN 4 +#define MAVLINK_MSG_TARGET_ABSOLUTE_FIELD_RATES_LEN 3 +#define MAVLINK_MSG_TARGET_ABSOLUTE_FIELD_POSITION_STD_LEN 2 +#define MAVLINK_MSG_TARGET_ABSOLUTE_FIELD_VEL_STD_LEN 3 +#define MAVLINK_MSG_TARGET_ABSOLUTE_FIELD_ACC_STD_LEN 3 + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_TARGET_ABSOLUTE { \ + 510, \ + "TARGET_ABSOLUTE", \ + 13, \ + { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_target_absolute_t, timestamp) }, \ + { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 104, offsetof(mavlink_target_absolute_t, id) }, \ + { "sensor_capabilities", NULL, MAVLINK_TYPE_UINT8_T, 0, 105, offsetof(mavlink_target_absolute_t, sensor_capabilities) }, \ + { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_target_absolute_t, lat) }, \ + { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_target_absolute_t, lon) }, \ + { "alt", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_target_absolute_t, alt) }, \ + { "vel", NULL, MAVLINK_TYPE_FLOAT, 3, 20, offsetof(mavlink_target_absolute_t, vel) }, \ + { "acc", NULL, MAVLINK_TYPE_FLOAT, 3, 32, offsetof(mavlink_target_absolute_t, acc) }, \ + { "q_target", NULL, MAVLINK_TYPE_FLOAT, 4, 44, offsetof(mavlink_target_absolute_t, q_target) }, \ + { "rates", NULL, MAVLINK_TYPE_FLOAT, 3, 60, offsetof(mavlink_target_absolute_t, rates) }, \ + { "position_std", NULL, MAVLINK_TYPE_FLOAT, 2, 72, offsetof(mavlink_target_absolute_t, position_std) }, \ + { "vel_std", NULL, MAVLINK_TYPE_FLOAT, 3, 80, offsetof(mavlink_target_absolute_t, vel_std) }, \ + { "acc_std", NULL, MAVLINK_TYPE_FLOAT, 3, 92, offsetof(mavlink_target_absolute_t, acc_std) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_TARGET_ABSOLUTE { \ + "TARGET_ABSOLUTE", \ + 13, \ + { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_target_absolute_t, timestamp) }, \ + { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 104, offsetof(mavlink_target_absolute_t, id) }, \ + { "sensor_capabilities", NULL, MAVLINK_TYPE_UINT8_T, 0, 105, offsetof(mavlink_target_absolute_t, sensor_capabilities) }, \ + { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_target_absolute_t, lat) }, \ + { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_target_absolute_t, lon) }, \ + { "alt", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_target_absolute_t, alt) }, \ + { "vel", NULL, MAVLINK_TYPE_FLOAT, 3, 20, offsetof(mavlink_target_absolute_t, vel) }, \ + { "acc", NULL, MAVLINK_TYPE_FLOAT, 3, 32, offsetof(mavlink_target_absolute_t, acc) }, \ + { "q_target", NULL, MAVLINK_TYPE_FLOAT, 4, 44, offsetof(mavlink_target_absolute_t, q_target) }, \ + { "rates", NULL, MAVLINK_TYPE_FLOAT, 3, 60, offsetof(mavlink_target_absolute_t, rates) }, \ + { "position_std", NULL, MAVLINK_TYPE_FLOAT, 2, 72, offsetof(mavlink_target_absolute_t, position_std) }, \ + { "vel_std", NULL, MAVLINK_TYPE_FLOAT, 3, 80, offsetof(mavlink_target_absolute_t, vel_std) }, \ + { "acc_std", NULL, MAVLINK_TYPE_FLOAT, 3, 92, offsetof(mavlink_target_absolute_t, acc_std) }, \ + } \ +} +#endif + +/** + * @brief Pack a target_absolute message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param timestamp [us] Timestamp (UNIX epoch time). + * @param id The ID of the target if multiple targets are present + * @param sensor_capabilities Bitmap to indicate the sensor's reporting capabilities + * @param lat [degE7] Target's latitude (WGS84) + * @param lon [degE7] Target's longitude (WGS84) + * @param alt [m] Target's altitude (AMSL) + * @param vel [m/s] Target's velocity in its body frame + * @param acc [m/s/s] Linear target's acceleration in its body frame + * @param q_target Quaternion of the target's orientation from its body frame to the vehicle's NED frame. + * @param rates [rad/s] Target's roll, pitch and yaw rates + * @param position_std [m] Standard deviation of horizontal (eph) and vertical (epv) position errors + * @param vel_std [m/s] Standard deviation of the target's velocity in its body frame + * @param acc_std [m/s/s] Standard deviation of the target's acceleration in its body frame + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_target_absolute_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint64_t timestamp, uint8_t id, uint8_t sensor_capabilities, int32_t lat, int32_t lon, float alt, const float *vel, const float *acc, const float *q_target, const float *rates, const float *position_std, const float *vel_std, const float *acc_std) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_TARGET_ABSOLUTE_LEN]; + _mav_put_uint64_t(buf, 0, timestamp); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_float(buf, 16, alt); + _mav_put_uint8_t(buf, 104, id); + _mav_put_uint8_t(buf, 105, sensor_capabilities); + _mav_put_float_array(buf, 20, vel, 3); + _mav_put_float_array(buf, 32, acc, 3); + _mav_put_float_array(buf, 44, q_target, 4); + _mav_put_float_array(buf, 60, rates, 3); + _mav_put_float_array(buf, 72, position_std, 2); + _mav_put_float_array(buf, 80, vel_std, 3); + _mav_put_float_array(buf, 92, acc_std, 3); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TARGET_ABSOLUTE_LEN); +#else + mavlink_target_absolute_t packet; + packet.timestamp = timestamp; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.id = id; + packet.sensor_capabilities = sensor_capabilities; + mav_array_assign_float(packet.vel, vel, 3); + mav_array_assign_float(packet.acc, acc, 3); + mav_array_assign_float(packet.q_target, q_target, 4); + mav_array_assign_float(packet.rates, rates, 3); + mav_array_assign_float(packet.position_std, position_std, 2); + mav_array_assign_float(packet.vel_std, vel_std, 3); + mav_array_assign_float(packet.acc_std, acc_std, 3); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TARGET_ABSOLUTE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_TARGET_ABSOLUTE; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_TARGET_ABSOLUTE_MIN_LEN, MAVLINK_MSG_ID_TARGET_ABSOLUTE_LEN, MAVLINK_MSG_ID_TARGET_ABSOLUTE_CRC); +} + +/** + * @brief Pack a target_absolute message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param timestamp [us] Timestamp (UNIX epoch time). + * @param id The ID of the target if multiple targets are present + * @param sensor_capabilities Bitmap to indicate the sensor's reporting capabilities + * @param lat [degE7] Target's latitude (WGS84) + * @param lon [degE7] Target's longitude (WGS84) + * @param alt [m] Target's altitude (AMSL) + * @param vel [m/s] Target's velocity in its body frame + * @param acc [m/s/s] Linear target's acceleration in its body frame + * @param q_target Quaternion of the target's orientation from its body frame to the vehicle's NED frame. + * @param rates [rad/s] Target's roll, pitch and yaw rates + * @param position_std [m] Standard deviation of horizontal (eph) and vertical (epv) position errors + * @param vel_std [m/s] Standard deviation of the target's velocity in its body frame + * @param acc_std [m/s/s] Standard deviation of the target's acceleration in its body frame + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_target_absolute_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t timestamp, uint8_t id, uint8_t sensor_capabilities, int32_t lat, int32_t lon, float alt, const float *vel, const float *acc, const float *q_target, const float *rates, const float *position_std, const float *vel_std, const float *acc_std) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_TARGET_ABSOLUTE_LEN]; + _mav_put_uint64_t(buf, 0, timestamp); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_float(buf, 16, alt); + _mav_put_uint8_t(buf, 104, id); + _mav_put_uint8_t(buf, 105, sensor_capabilities); + _mav_put_float_array(buf, 20, vel, 3); + _mav_put_float_array(buf, 32, acc, 3); + _mav_put_float_array(buf, 44, q_target, 4); + _mav_put_float_array(buf, 60, rates, 3); + _mav_put_float_array(buf, 72, position_std, 2); + _mav_put_float_array(buf, 80, vel_std, 3); + _mav_put_float_array(buf, 92, acc_std, 3); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TARGET_ABSOLUTE_LEN); +#else + mavlink_target_absolute_t packet; + packet.timestamp = timestamp; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.id = id; + packet.sensor_capabilities = sensor_capabilities; + mav_array_memcpy(packet.vel, vel, sizeof(float)*3); + mav_array_memcpy(packet.acc, acc, sizeof(float)*3); + mav_array_memcpy(packet.q_target, q_target, sizeof(float)*4); + mav_array_memcpy(packet.rates, rates, sizeof(float)*3); + mav_array_memcpy(packet.position_std, position_std, sizeof(float)*2); + mav_array_memcpy(packet.vel_std, vel_std, sizeof(float)*3); + mav_array_memcpy(packet.acc_std, acc_std, sizeof(float)*3); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TARGET_ABSOLUTE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_TARGET_ABSOLUTE; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_TARGET_ABSOLUTE_MIN_LEN, MAVLINK_MSG_ID_TARGET_ABSOLUTE_LEN, MAVLINK_MSG_ID_TARGET_ABSOLUTE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_TARGET_ABSOLUTE_MIN_LEN, MAVLINK_MSG_ID_TARGET_ABSOLUTE_LEN); +#endif +} + +/** + * @brief Pack a target_absolute message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param timestamp [us] Timestamp (UNIX epoch time). + * @param id The ID of the target if multiple targets are present + * @param sensor_capabilities Bitmap to indicate the sensor's reporting capabilities + * @param lat [degE7] Target's latitude (WGS84) + * @param lon [degE7] Target's longitude (WGS84) + * @param alt [m] Target's altitude (AMSL) + * @param vel [m/s] Target's velocity in its body frame + * @param acc [m/s/s] Linear target's acceleration in its body frame + * @param q_target Quaternion of the target's orientation from its body frame to the vehicle's NED frame. + * @param rates [rad/s] Target's roll, pitch and yaw rates + * @param position_std [m] Standard deviation of horizontal (eph) and vertical (epv) position errors + * @param vel_std [m/s] Standard deviation of the target's velocity in its body frame + * @param acc_std [m/s/s] Standard deviation of the target's acceleration in its body frame + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_target_absolute_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint64_t timestamp,uint8_t id,uint8_t sensor_capabilities,int32_t lat,int32_t lon,float alt,const float *vel,const float *acc,const float *q_target,const float *rates,const float *position_std,const float *vel_std,const float *acc_std) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_TARGET_ABSOLUTE_LEN]; + _mav_put_uint64_t(buf, 0, timestamp); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_float(buf, 16, alt); + _mav_put_uint8_t(buf, 104, id); + _mav_put_uint8_t(buf, 105, sensor_capabilities); + _mav_put_float_array(buf, 20, vel, 3); + _mav_put_float_array(buf, 32, acc, 3); + _mav_put_float_array(buf, 44, q_target, 4); + _mav_put_float_array(buf, 60, rates, 3); + _mav_put_float_array(buf, 72, position_std, 2); + _mav_put_float_array(buf, 80, vel_std, 3); + _mav_put_float_array(buf, 92, acc_std, 3); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TARGET_ABSOLUTE_LEN); +#else + mavlink_target_absolute_t packet; + packet.timestamp = timestamp; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.id = id; + packet.sensor_capabilities = sensor_capabilities; + mav_array_assign_float(packet.vel, vel, 3); + mav_array_assign_float(packet.acc, acc, 3); + mav_array_assign_float(packet.q_target, q_target, 4); + mav_array_assign_float(packet.rates, rates, 3); + mav_array_assign_float(packet.position_std, position_std, 2); + mav_array_assign_float(packet.vel_std, vel_std, 3); + mav_array_assign_float(packet.acc_std, acc_std, 3); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TARGET_ABSOLUTE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_TARGET_ABSOLUTE; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_TARGET_ABSOLUTE_MIN_LEN, MAVLINK_MSG_ID_TARGET_ABSOLUTE_LEN, MAVLINK_MSG_ID_TARGET_ABSOLUTE_CRC); +} + +/** + * @brief Encode a target_absolute struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param target_absolute C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_target_absolute_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_target_absolute_t* target_absolute) +{ + return mavlink_msg_target_absolute_pack(system_id, component_id, msg, target_absolute->timestamp, target_absolute->id, target_absolute->sensor_capabilities, target_absolute->lat, target_absolute->lon, target_absolute->alt, target_absolute->vel, target_absolute->acc, target_absolute->q_target, target_absolute->rates, target_absolute->position_std, target_absolute->vel_std, target_absolute->acc_std); +} + +/** + * @brief Encode a target_absolute struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param target_absolute C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_target_absolute_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_target_absolute_t* target_absolute) +{ + return mavlink_msg_target_absolute_pack_chan(system_id, component_id, chan, msg, target_absolute->timestamp, target_absolute->id, target_absolute->sensor_capabilities, target_absolute->lat, target_absolute->lon, target_absolute->alt, target_absolute->vel, target_absolute->acc, target_absolute->q_target, target_absolute->rates, target_absolute->position_std, target_absolute->vel_std, target_absolute->acc_std); +} + +/** + * @brief Encode a target_absolute struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param target_absolute C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_target_absolute_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_target_absolute_t* target_absolute) +{ + return mavlink_msg_target_absolute_pack_status(system_id, component_id, _status, msg, target_absolute->timestamp, target_absolute->id, target_absolute->sensor_capabilities, target_absolute->lat, target_absolute->lon, target_absolute->alt, target_absolute->vel, target_absolute->acc, target_absolute->q_target, target_absolute->rates, target_absolute->position_std, target_absolute->vel_std, target_absolute->acc_std); +} + +/** + * @brief Send a target_absolute message + * @param chan MAVLink channel to send the message + * + * @param timestamp [us] Timestamp (UNIX epoch time). + * @param id The ID of the target if multiple targets are present + * @param sensor_capabilities Bitmap to indicate the sensor's reporting capabilities + * @param lat [degE7] Target's latitude (WGS84) + * @param lon [degE7] Target's longitude (WGS84) + * @param alt [m] Target's altitude (AMSL) + * @param vel [m/s] Target's velocity in its body frame + * @param acc [m/s/s] Linear target's acceleration in its body frame + * @param q_target Quaternion of the target's orientation from its body frame to the vehicle's NED frame. + * @param rates [rad/s] Target's roll, pitch and yaw rates + * @param position_std [m] Standard deviation of horizontal (eph) and vertical (epv) position errors + * @param vel_std [m/s] Standard deviation of the target's velocity in its body frame + * @param acc_std [m/s/s] Standard deviation of the target's acceleration in its body frame + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_target_absolute_send(mavlink_channel_t chan, uint64_t timestamp, uint8_t id, uint8_t sensor_capabilities, int32_t lat, int32_t lon, float alt, const float *vel, const float *acc, const float *q_target, const float *rates, const float *position_std, const float *vel_std, const float *acc_std) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_TARGET_ABSOLUTE_LEN]; + _mav_put_uint64_t(buf, 0, timestamp); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_float(buf, 16, alt); + _mav_put_uint8_t(buf, 104, id); + _mav_put_uint8_t(buf, 105, sensor_capabilities); + _mav_put_float_array(buf, 20, vel, 3); + _mav_put_float_array(buf, 32, acc, 3); + _mav_put_float_array(buf, 44, q_target, 4); + _mav_put_float_array(buf, 60, rates, 3); + _mav_put_float_array(buf, 72, position_std, 2); + _mav_put_float_array(buf, 80, vel_std, 3); + _mav_put_float_array(buf, 92, acc_std, 3); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TARGET_ABSOLUTE, buf, MAVLINK_MSG_ID_TARGET_ABSOLUTE_MIN_LEN, MAVLINK_MSG_ID_TARGET_ABSOLUTE_LEN, MAVLINK_MSG_ID_TARGET_ABSOLUTE_CRC); +#else + mavlink_target_absolute_t packet; + packet.timestamp = timestamp; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.id = id; + packet.sensor_capabilities = sensor_capabilities; + mav_array_assign_float(packet.vel, vel, 3); + mav_array_assign_float(packet.acc, acc, 3); + mav_array_assign_float(packet.q_target, q_target, 4); + mav_array_assign_float(packet.rates, rates, 3); + mav_array_assign_float(packet.position_std, position_std, 2); + mav_array_assign_float(packet.vel_std, vel_std, 3); + mav_array_assign_float(packet.acc_std, acc_std, 3); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TARGET_ABSOLUTE, (const char *)&packet, MAVLINK_MSG_ID_TARGET_ABSOLUTE_MIN_LEN, MAVLINK_MSG_ID_TARGET_ABSOLUTE_LEN, MAVLINK_MSG_ID_TARGET_ABSOLUTE_CRC); +#endif +} + +/** + * @brief Send a target_absolute message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_target_absolute_send_struct(mavlink_channel_t chan, const mavlink_target_absolute_t* target_absolute) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_target_absolute_send(chan, target_absolute->timestamp, target_absolute->id, target_absolute->sensor_capabilities, target_absolute->lat, target_absolute->lon, target_absolute->alt, target_absolute->vel, target_absolute->acc, target_absolute->q_target, target_absolute->rates, target_absolute->position_std, target_absolute->vel_std, target_absolute->acc_std); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TARGET_ABSOLUTE, (const char *)target_absolute, MAVLINK_MSG_ID_TARGET_ABSOLUTE_MIN_LEN, MAVLINK_MSG_ID_TARGET_ABSOLUTE_LEN, MAVLINK_MSG_ID_TARGET_ABSOLUTE_CRC); +#endif +} + +#if MAVLINK_MSG_ID_TARGET_ABSOLUTE_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_target_absolute_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t timestamp, uint8_t id, uint8_t sensor_capabilities, int32_t lat, int32_t lon, float alt, const float *vel, const float *acc, const float *q_target, const float *rates, const float *position_std, const float *vel_std, const float *acc_std) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint64_t(buf, 0, timestamp); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_float(buf, 16, alt); + _mav_put_uint8_t(buf, 104, id); + _mav_put_uint8_t(buf, 105, sensor_capabilities); + _mav_put_float_array(buf, 20, vel, 3); + _mav_put_float_array(buf, 32, acc, 3); + _mav_put_float_array(buf, 44, q_target, 4); + _mav_put_float_array(buf, 60, rates, 3); + _mav_put_float_array(buf, 72, position_std, 2); + _mav_put_float_array(buf, 80, vel_std, 3); + _mav_put_float_array(buf, 92, acc_std, 3); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TARGET_ABSOLUTE, buf, MAVLINK_MSG_ID_TARGET_ABSOLUTE_MIN_LEN, MAVLINK_MSG_ID_TARGET_ABSOLUTE_LEN, MAVLINK_MSG_ID_TARGET_ABSOLUTE_CRC); +#else + mavlink_target_absolute_t *packet = (mavlink_target_absolute_t *)msgbuf; + packet->timestamp = timestamp; + packet->lat = lat; + packet->lon = lon; + packet->alt = alt; + packet->id = id; + packet->sensor_capabilities = sensor_capabilities; + mav_array_assign_float(packet->vel, vel, 3); + mav_array_assign_float(packet->acc, acc, 3); + mav_array_assign_float(packet->q_target, q_target, 4); + mav_array_assign_float(packet->rates, rates, 3); + mav_array_assign_float(packet->position_std, position_std, 2); + mav_array_assign_float(packet->vel_std, vel_std, 3); + mav_array_assign_float(packet->acc_std, acc_std, 3); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TARGET_ABSOLUTE, (const char *)packet, MAVLINK_MSG_ID_TARGET_ABSOLUTE_MIN_LEN, MAVLINK_MSG_ID_TARGET_ABSOLUTE_LEN, MAVLINK_MSG_ID_TARGET_ABSOLUTE_CRC); +#endif +} +#endif + +#endif + +// MESSAGE TARGET_ABSOLUTE UNPACKING + + +/** + * @brief Get field timestamp from target_absolute message + * + * @return [us] Timestamp (UNIX epoch time). + */ +static inline uint64_t mavlink_msg_target_absolute_get_timestamp(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 0); +} + +/** + * @brief Get field id from target_absolute message + * + * @return The ID of the target if multiple targets are present + */ +static inline uint8_t mavlink_msg_target_absolute_get_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 104); +} + +/** + * @brief Get field sensor_capabilities from target_absolute message + * + * @return Bitmap to indicate the sensor's reporting capabilities + */ +static inline uint8_t mavlink_msg_target_absolute_get_sensor_capabilities(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 105); +} + +/** + * @brief Get field lat from target_absolute message + * + * @return [degE7] Target's latitude (WGS84) + */ +static inline int32_t mavlink_msg_target_absolute_get_lat(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 8); +} + +/** + * @brief Get field lon from target_absolute message + * + * @return [degE7] Target's longitude (WGS84) + */ +static inline int32_t mavlink_msg_target_absolute_get_lon(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 12); +} + +/** + * @brief Get field alt from target_absolute message + * + * @return [m] Target's altitude (AMSL) + */ +static inline float mavlink_msg_target_absolute_get_alt(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 16); +} + +/** + * @brief Get field vel from target_absolute message + * + * @return [m/s] Target's velocity in its body frame + */ +static inline uint16_t mavlink_msg_target_absolute_get_vel(const mavlink_message_t* msg, float *vel) +{ + return _MAV_RETURN_float_array(msg, vel, 3, 20); +} + +/** + * @brief Get field acc from target_absolute message + * + * @return [m/s/s] Linear target's acceleration in its body frame + */ +static inline uint16_t mavlink_msg_target_absolute_get_acc(const mavlink_message_t* msg, float *acc) +{ + return _MAV_RETURN_float_array(msg, acc, 3, 32); +} + +/** + * @brief Get field q_target from target_absolute message + * + * @return Quaternion of the target's orientation from its body frame to the vehicle's NED frame. + */ +static inline uint16_t mavlink_msg_target_absolute_get_q_target(const mavlink_message_t* msg, float *q_target) +{ + return _MAV_RETURN_float_array(msg, q_target, 4, 44); +} + +/** + * @brief Get field rates from target_absolute message + * + * @return [rad/s] Target's roll, pitch and yaw rates + */ +static inline uint16_t mavlink_msg_target_absolute_get_rates(const mavlink_message_t* msg, float *rates) +{ + return _MAV_RETURN_float_array(msg, rates, 3, 60); +} + +/** + * @brief Get field position_std from target_absolute message + * + * @return [m] Standard deviation of horizontal (eph) and vertical (epv) position errors + */ +static inline uint16_t mavlink_msg_target_absolute_get_position_std(const mavlink_message_t* msg, float *position_std) +{ + return _MAV_RETURN_float_array(msg, position_std, 2, 72); +} + +/** + * @brief Get field vel_std from target_absolute message + * + * @return [m/s] Standard deviation of the target's velocity in its body frame + */ +static inline uint16_t mavlink_msg_target_absolute_get_vel_std(const mavlink_message_t* msg, float *vel_std) +{ + return _MAV_RETURN_float_array(msg, vel_std, 3, 80); +} + +/** + * @brief Get field acc_std from target_absolute message + * + * @return [m/s/s] Standard deviation of the target's acceleration in its body frame + */ +static inline uint16_t mavlink_msg_target_absolute_get_acc_std(const mavlink_message_t* msg, float *acc_std) +{ + return _MAV_RETURN_float_array(msg, acc_std, 3, 92); +} + +/** + * @brief Decode a target_absolute message into a struct + * + * @param msg The message to decode + * @param target_absolute C-struct to decode the message contents into + */ +static inline void mavlink_msg_target_absolute_decode(const mavlink_message_t* msg, mavlink_target_absolute_t* target_absolute) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + target_absolute->timestamp = mavlink_msg_target_absolute_get_timestamp(msg); + target_absolute->lat = mavlink_msg_target_absolute_get_lat(msg); + target_absolute->lon = mavlink_msg_target_absolute_get_lon(msg); + target_absolute->alt = mavlink_msg_target_absolute_get_alt(msg); + mavlink_msg_target_absolute_get_vel(msg, target_absolute->vel); + mavlink_msg_target_absolute_get_acc(msg, target_absolute->acc); + mavlink_msg_target_absolute_get_q_target(msg, target_absolute->q_target); + mavlink_msg_target_absolute_get_rates(msg, target_absolute->rates); + mavlink_msg_target_absolute_get_position_std(msg, target_absolute->position_std); + mavlink_msg_target_absolute_get_vel_std(msg, target_absolute->vel_std); + mavlink_msg_target_absolute_get_acc_std(msg, target_absolute->acc_std); + target_absolute->id = mavlink_msg_target_absolute_get_id(msg); + target_absolute->sensor_capabilities = mavlink_msg_target_absolute_get_sensor_capabilities(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_TARGET_ABSOLUTE_LEN? msg->len : MAVLINK_MSG_ID_TARGET_ABSOLUTE_LEN; + memset(target_absolute, 0, MAVLINK_MSG_ID_TARGET_ABSOLUTE_LEN); + memcpy(target_absolute, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/development/mavlink_msg_target_relative.h b/development/mavlink_msg_target_relative.h new file mode 100644 index 000000000..a176df827 --- /dev/null +++ b/development/mavlink_msg_target_relative.h @@ -0,0 +1,532 @@ +#pragma once +// MESSAGE TARGET_RELATIVE PACKING + +#define MAVLINK_MSG_ID_TARGET_RELATIVE 511 + + +typedef struct __mavlink_target_relative_t { + uint64_t timestamp; /*< [us] Timestamp (UNIX epoch time)*/ + float x; /*< [m] X Position of the target in TARGET_OBS_FRAME*/ + float y; /*< [m] Y Position of the target in TARGET_OBS_FRAME*/ + float z; /*< [m] Z Position of the target in TARGET_OBS_FRAME*/ + float pos_std[3]; /*< [m] Standard deviation of the target's position in TARGET_OBS_FRAME*/ + float yaw_std; /*< [rad] Standard deviation of the target's orientation in TARGET_OBS_FRAME*/ + float q_target[4]; /*< Quaternion of the target's orientation from the target's frame to the TARGET_OBS_FRAME (w, x, y, z order, zero-rotation is 1, 0, 0, 0)*/ + float q_sensor[4]; /*< Quaternion of the sensor's orientation from TARGET_OBS_FRAME to vehicle-carried NED. (Ignored if set to (0,0,0,0)) (w, x, y, z order, zero-rotation is 1, 0, 0, 0)*/ + uint8_t id; /*< The ID of the target if multiple targets are present*/ + uint8_t frame; /*< Coordinate frame used for following fields.*/ + uint8_t type; /*< Type of target*/ +} mavlink_target_relative_t; + +#define MAVLINK_MSG_ID_TARGET_RELATIVE_LEN 71 +#define MAVLINK_MSG_ID_TARGET_RELATIVE_MIN_LEN 71 +#define MAVLINK_MSG_ID_511_LEN 71 +#define MAVLINK_MSG_ID_511_MIN_LEN 71 + +#define MAVLINK_MSG_ID_TARGET_RELATIVE_CRC 28 +#define MAVLINK_MSG_ID_511_CRC 28 + +#define MAVLINK_MSG_TARGET_RELATIVE_FIELD_POS_STD_LEN 3 +#define MAVLINK_MSG_TARGET_RELATIVE_FIELD_Q_TARGET_LEN 4 +#define MAVLINK_MSG_TARGET_RELATIVE_FIELD_Q_SENSOR_LEN 4 + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_TARGET_RELATIVE { \ + 511, \ + "TARGET_RELATIVE", \ + 11, \ + { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_target_relative_t, timestamp) }, \ + { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 68, offsetof(mavlink_target_relative_t, id) }, \ + { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 69, offsetof(mavlink_target_relative_t, frame) }, \ + { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_target_relative_t, x) }, \ + { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_target_relative_t, y) }, \ + { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_target_relative_t, z) }, \ + { "pos_std", NULL, MAVLINK_TYPE_FLOAT, 3, 20, offsetof(mavlink_target_relative_t, pos_std) }, \ + { "yaw_std", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_target_relative_t, yaw_std) }, \ + { "q_target", NULL, MAVLINK_TYPE_FLOAT, 4, 36, offsetof(mavlink_target_relative_t, q_target) }, \ + { "q_sensor", NULL, MAVLINK_TYPE_FLOAT, 4, 52, offsetof(mavlink_target_relative_t, q_sensor) }, \ + { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 70, offsetof(mavlink_target_relative_t, type) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_TARGET_RELATIVE { \ + "TARGET_RELATIVE", \ + 11, \ + { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_target_relative_t, timestamp) }, \ + { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 68, offsetof(mavlink_target_relative_t, id) }, \ + { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 69, offsetof(mavlink_target_relative_t, frame) }, \ + { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_target_relative_t, x) }, \ + { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_target_relative_t, y) }, \ + { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_target_relative_t, z) }, \ + { "pos_std", NULL, MAVLINK_TYPE_FLOAT, 3, 20, offsetof(mavlink_target_relative_t, pos_std) }, \ + { "yaw_std", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_target_relative_t, yaw_std) }, \ + { "q_target", NULL, MAVLINK_TYPE_FLOAT, 4, 36, offsetof(mavlink_target_relative_t, q_target) }, \ + { "q_sensor", NULL, MAVLINK_TYPE_FLOAT, 4, 52, offsetof(mavlink_target_relative_t, q_sensor) }, \ + { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 70, offsetof(mavlink_target_relative_t, type) }, \ + } \ +} +#endif + +/** + * @brief Pack a target_relative message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param timestamp [us] Timestamp (UNIX epoch time) + * @param id The ID of the target if multiple targets are present + * @param frame Coordinate frame used for following fields. + * @param x [m] X Position of the target in TARGET_OBS_FRAME + * @param y [m] Y Position of the target in TARGET_OBS_FRAME + * @param z [m] Z Position of the target in TARGET_OBS_FRAME + * @param pos_std [m] Standard deviation of the target's position in TARGET_OBS_FRAME + * @param yaw_std [rad] Standard deviation of the target's orientation in TARGET_OBS_FRAME + * @param q_target Quaternion of the target's orientation from the target's frame to the TARGET_OBS_FRAME (w, x, y, z order, zero-rotation is 1, 0, 0, 0) + * @param q_sensor Quaternion of the sensor's orientation from TARGET_OBS_FRAME to vehicle-carried NED. (Ignored if set to (0,0,0,0)) (w, x, y, z order, zero-rotation is 1, 0, 0, 0) + * @param type Type of target + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_target_relative_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint64_t timestamp, uint8_t id, uint8_t frame, float x, float y, float z, const float *pos_std, float yaw_std, const float *q_target, const float *q_sensor, uint8_t type) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_TARGET_RELATIVE_LEN]; + _mav_put_uint64_t(buf, 0, timestamp); + _mav_put_float(buf, 8, x); + _mav_put_float(buf, 12, y); + _mav_put_float(buf, 16, z); + _mav_put_float(buf, 32, yaw_std); + _mav_put_uint8_t(buf, 68, id); + _mav_put_uint8_t(buf, 69, frame); + _mav_put_uint8_t(buf, 70, type); + _mav_put_float_array(buf, 20, pos_std, 3); + _mav_put_float_array(buf, 36, q_target, 4); + _mav_put_float_array(buf, 52, q_sensor, 4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TARGET_RELATIVE_LEN); +#else + mavlink_target_relative_t packet; + packet.timestamp = timestamp; + packet.x = x; + packet.y = y; + packet.z = z; + packet.yaw_std = yaw_std; + packet.id = id; + packet.frame = frame; + packet.type = type; + mav_array_assign_float(packet.pos_std, pos_std, 3); + mav_array_assign_float(packet.q_target, q_target, 4); + mav_array_assign_float(packet.q_sensor, q_sensor, 4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TARGET_RELATIVE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_TARGET_RELATIVE; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_TARGET_RELATIVE_MIN_LEN, MAVLINK_MSG_ID_TARGET_RELATIVE_LEN, MAVLINK_MSG_ID_TARGET_RELATIVE_CRC); +} + +/** + * @brief Pack a target_relative message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param timestamp [us] Timestamp (UNIX epoch time) + * @param id The ID of the target if multiple targets are present + * @param frame Coordinate frame used for following fields. + * @param x [m] X Position of the target in TARGET_OBS_FRAME + * @param y [m] Y Position of the target in TARGET_OBS_FRAME + * @param z [m] Z Position of the target in TARGET_OBS_FRAME + * @param pos_std [m] Standard deviation of the target's position in TARGET_OBS_FRAME + * @param yaw_std [rad] Standard deviation of the target's orientation in TARGET_OBS_FRAME + * @param q_target Quaternion of the target's orientation from the target's frame to the TARGET_OBS_FRAME (w, x, y, z order, zero-rotation is 1, 0, 0, 0) + * @param q_sensor Quaternion of the sensor's orientation from TARGET_OBS_FRAME to vehicle-carried NED. (Ignored if set to (0,0,0,0)) (w, x, y, z order, zero-rotation is 1, 0, 0, 0) + * @param type Type of target + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_target_relative_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t timestamp, uint8_t id, uint8_t frame, float x, float y, float z, const float *pos_std, float yaw_std, const float *q_target, const float *q_sensor, uint8_t type) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_TARGET_RELATIVE_LEN]; + _mav_put_uint64_t(buf, 0, timestamp); + _mav_put_float(buf, 8, x); + _mav_put_float(buf, 12, y); + _mav_put_float(buf, 16, z); + _mav_put_float(buf, 32, yaw_std); + _mav_put_uint8_t(buf, 68, id); + _mav_put_uint8_t(buf, 69, frame); + _mav_put_uint8_t(buf, 70, type); + _mav_put_float_array(buf, 20, pos_std, 3); + _mav_put_float_array(buf, 36, q_target, 4); + _mav_put_float_array(buf, 52, q_sensor, 4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TARGET_RELATIVE_LEN); +#else + mavlink_target_relative_t packet; + packet.timestamp = timestamp; + packet.x = x; + packet.y = y; + packet.z = z; + packet.yaw_std = yaw_std; + packet.id = id; + packet.frame = frame; + packet.type = type; + mav_array_memcpy(packet.pos_std, pos_std, sizeof(float)*3); + mav_array_memcpy(packet.q_target, q_target, sizeof(float)*4); + mav_array_memcpy(packet.q_sensor, q_sensor, sizeof(float)*4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TARGET_RELATIVE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_TARGET_RELATIVE; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_TARGET_RELATIVE_MIN_LEN, MAVLINK_MSG_ID_TARGET_RELATIVE_LEN, MAVLINK_MSG_ID_TARGET_RELATIVE_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_TARGET_RELATIVE_MIN_LEN, MAVLINK_MSG_ID_TARGET_RELATIVE_LEN); +#endif +} + +/** + * @brief Pack a target_relative message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param timestamp [us] Timestamp (UNIX epoch time) + * @param id The ID of the target if multiple targets are present + * @param frame Coordinate frame used for following fields. + * @param x [m] X Position of the target in TARGET_OBS_FRAME + * @param y [m] Y Position of the target in TARGET_OBS_FRAME + * @param z [m] Z Position of the target in TARGET_OBS_FRAME + * @param pos_std [m] Standard deviation of the target's position in TARGET_OBS_FRAME + * @param yaw_std [rad] Standard deviation of the target's orientation in TARGET_OBS_FRAME + * @param q_target Quaternion of the target's orientation from the target's frame to the TARGET_OBS_FRAME (w, x, y, z order, zero-rotation is 1, 0, 0, 0) + * @param q_sensor Quaternion of the sensor's orientation from TARGET_OBS_FRAME to vehicle-carried NED. (Ignored if set to (0,0,0,0)) (w, x, y, z order, zero-rotation is 1, 0, 0, 0) + * @param type Type of target + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_target_relative_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint64_t timestamp,uint8_t id,uint8_t frame,float x,float y,float z,const float *pos_std,float yaw_std,const float *q_target,const float *q_sensor,uint8_t type) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_TARGET_RELATIVE_LEN]; + _mav_put_uint64_t(buf, 0, timestamp); + _mav_put_float(buf, 8, x); + _mav_put_float(buf, 12, y); + _mav_put_float(buf, 16, z); + _mav_put_float(buf, 32, yaw_std); + _mav_put_uint8_t(buf, 68, id); + _mav_put_uint8_t(buf, 69, frame); + _mav_put_uint8_t(buf, 70, type); + _mav_put_float_array(buf, 20, pos_std, 3); + _mav_put_float_array(buf, 36, q_target, 4); + _mav_put_float_array(buf, 52, q_sensor, 4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TARGET_RELATIVE_LEN); +#else + mavlink_target_relative_t packet; + packet.timestamp = timestamp; + packet.x = x; + packet.y = y; + packet.z = z; + packet.yaw_std = yaw_std; + packet.id = id; + packet.frame = frame; + packet.type = type; + mav_array_assign_float(packet.pos_std, pos_std, 3); + mav_array_assign_float(packet.q_target, q_target, 4); + mav_array_assign_float(packet.q_sensor, q_sensor, 4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TARGET_RELATIVE_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_TARGET_RELATIVE; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_TARGET_RELATIVE_MIN_LEN, MAVLINK_MSG_ID_TARGET_RELATIVE_LEN, MAVLINK_MSG_ID_TARGET_RELATIVE_CRC); +} + +/** + * @brief Encode a target_relative struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param target_relative C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_target_relative_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_target_relative_t* target_relative) +{ + return mavlink_msg_target_relative_pack(system_id, component_id, msg, target_relative->timestamp, target_relative->id, target_relative->frame, target_relative->x, target_relative->y, target_relative->z, target_relative->pos_std, target_relative->yaw_std, target_relative->q_target, target_relative->q_sensor, target_relative->type); +} + +/** + * @brief Encode a target_relative struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param target_relative C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_target_relative_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_target_relative_t* target_relative) +{ + return mavlink_msg_target_relative_pack_chan(system_id, component_id, chan, msg, target_relative->timestamp, target_relative->id, target_relative->frame, target_relative->x, target_relative->y, target_relative->z, target_relative->pos_std, target_relative->yaw_std, target_relative->q_target, target_relative->q_sensor, target_relative->type); +} + +/** + * @brief Encode a target_relative struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param target_relative C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_target_relative_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_target_relative_t* target_relative) +{ + return mavlink_msg_target_relative_pack_status(system_id, component_id, _status, msg, target_relative->timestamp, target_relative->id, target_relative->frame, target_relative->x, target_relative->y, target_relative->z, target_relative->pos_std, target_relative->yaw_std, target_relative->q_target, target_relative->q_sensor, target_relative->type); +} + +/** + * @brief Send a target_relative message + * @param chan MAVLink channel to send the message + * + * @param timestamp [us] Timestamp (UNIX epoch time) + * @param id The ID of the target if multiple targets are present + * @param frame Coordinate frame used for following fields. + * @param x [m] X Position of the target in TARGET_OBS_FRAME + * @param y [m] Y Position of the target in TARGET_OBS_FRAME + * @param z [m] Z Position of the target in TARGET_OBS_FRAME + * @param pos_std [m] Standard deviation of the target's position in TARGET_OBS_FRAME + * @param yaw_std [rad] Standard deviation of the target's orientation in TARGET_OBS_FRAME + * @param q_target Quaternion of the target's orientation from the target's frame to the TARGET_OBS_FRAME (w, x, y, z order, zero-rotation is 1, 0, 0, 0) + * @param q_sensor Quaternion of the sensor's orientation from TARGET_OBS_FRAME to vehicle-carried NED. (Ignored if set to (0,0,0,0)) (w, x, y, z order, zero-rotation is 1, 0, 0, 0) + * @param type Type of target + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_target_relative_send(mavlink_channel_t chan, uint64_t timestamp, uint8_t id, uint8_t frame, float x, float y, float z, const float *pos_std, float yaw_std, const float *q_target, const float *q_sensor, uint8_t type) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_TARGET_RELATIVE_LEN]; + _mav_put_uint64_t(buf, 0, timestamp); + _mav_put_float(buf, 8, x); + _mav_put_float(buf, 12, y); + _mav_put_float(buf, 16, z); + _mav_put_float(buf, 32, yaw_std); + _mav_put_uint8_t(buf, 68, id); + _mav_put_uint8_t(buf, 69, frame); + _mav_put_uint8_t(buf, 70, type); + _mav_put_float_array(buf, 20, pos_std, 3); + _mav_put_float_array(buf, 36, q_target, 4); + _mav_put_float_array(buf, 52, q_sensor, 4); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TARGET_RELATIVE, buf, MAVLINK_MSG_ID_TARGET_RELATIVE_MIN_LEN, MAVLINK_MSG_ID_TARGET_RELATIVE_LEN, MAVLINK_MSG_ID_TARGET_RELATIVE_CRC); +#else + mavlink_target_relative_t packet; + packet.timestamp = timestamp; + packet.x = x; + packet.y = y; + packet.z = z; + packet.yaw_std = yaw_std; + packet.id = id; + packet.frame = frame; + packet.type = type; + mav_array_assign_float(packet.pos_std, pos_std, 3); + mav_array_assign_float(packet.q_target, q_target, 4); + mav_array_assign_float(packet.q_sensor, q_sensor, 4); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TARGET_RELATIVE, (const char *)&packet, MAVLINK_MSG_ID_TARGET_RELATIVE_MIN_LEN, MAVLINK_MSG_ID_TARGET_RELATIVE_LEN, MAVLINK_MSG_ID_TARGET_RELATIVE_CRC); +#endif +} + +/** + * @brief Send a target_relative message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_target_relative_send_struct(mavlink_channel_t chan, const mavlink_target_relative_t* target_relative) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_target_relative_send(chan, target_relative->timestamp, target_relative->id, target_relative->frame, target_relative->x, target_relative->y, target_relative->z, target_relative->pos_std, target_relative->yaw_std, target_relative->q_target, target_relative->q_sensor, target_relative->type); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TARGET_RELATIVE, (const char *)target_relative, MAVLINK_MSG_ID_TARGET_RELATIVE_MIN_LEN, MAVLINK_MSG_ID_TARGET_RELATIVE_LEN, MAVLINK_MSG_ID_TARGET_RELATIVE_CRC); +#endif +} + +#if MAVLINK_MSG_ID_TARGET_RELATIVE_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_target_relative_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t timestamp, uint8_t id, uint8_t frame, float x, float y, float z, const float *pos_std, float yaw_std, const float *q_target, const float *q_sensor, uint8_t type) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint64_t(buf, 0, timestamp); + _mav_put_float(buf, 8, x); + _mav_put_float(buf, 12, y); + _mav_put_float(buf, 16, z); + _mav_put_float(buf, 32, yaw_std); + _mav_put_uint8_t(buf, 68, id); + _mav_put_uint8_t(buf, 69, frame); + _mav_put_uint8_t(buf, 70, type); + _mav_put_float_array(buf, 20, pos_std, 3); + _mav_put_float_array(buf, 36, q_target, 4); + _mav_put_float_array(buf, 52, q_sensor, 4); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TARGET_RELATIVE, buf, MAVLINK_MSG_ID_TARGET_RELATIVE_MIN_LEN, MAVLINK_MSG_ID_TARGET_RELATIVE_LEN, MAVLINK_MSG_ID_TARGET_RELATIVE_CRC); +#else + mavlink_target_relative_t *packet = (mavlink_target_relative_t *)msgbuf; + packet->timestamp = timestamp; + packet->x = x; + packet->y = y; + packet->z = z; + packet->yaw_std = yaw_std; + packet->id = id; + packet->frame = frame; + packet->type = type; + mav_array_assign_float(packet->pos_std, pos_std, 3); + mav_array_assign_float(packet->q_target, q_target, 4); + mav_array_assign_float(packet->q_sensor, q_sensor, 4); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TARGET_RELATIVE, (const char *)packet, MAVLINK_MSG_ID_TARGET_RELATIVE_MIN_LEN, MAVLINK_MSG_ID_TARGET_RELATIVE_LEN, MAVLINK_MSG_ID_TARGET_RELATIVE_CRC); +#endif +} +#endif + +#endif + +// MESSAGE TARGET_RELATIVE UNPACKING + + +/** + * @brief Get field timestamp from target_relative message + * + * @return [us] Timestamp (UNIX epoch time) + */ +static inline uint64_t mavlink_msg_target_relative_get_timestamp(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 0); +} + +/** + * @brief Get field id from target_relative message + * + * @return The ID of the target if multiple targets are present + */ +static inline uint8_t mavlink_msg_target_relative_get_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 68); +} + +/** + * @brief Get field frame from target_relative message + * + * @return Coordinate frame used for following fields. + */ +static inline uint8_t mavlink_msg_target_relative_get_frame(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 69); +} + +/** + * @brief Get field x from target_relative message + * + * @return [m] X Position of the target in TARGET_OBS_FRAME + */ +static inline float mavlink_msg_target_relative_get_x(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 8); +} + +/** + * @brief Get field y from target_relative message + * + * @return [m] Y Position of the target in TARGET_OBS_FRAME + */ +static inline float mavlink_msg_target_relative_get_y(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 12); +} + +/** + * @brief Get field z from target_relative message + * + * @return [m] Z Position of the target in TARGET_OBS_FRAME + */ +static inline float mavlink_msg_target_relative_get_z(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 16); +} + +/** + * @brief Get field pos_std from target_relative message + * + * @return [m] Standard deviation of the target's position in TARGET_OBS_FRAME + */ +static inline uint16_t mavlink_msg_target_relative_get_pos_std(const mavlink_message_t* msg, float *pos_std) +{ + return _MAV_RETURN_float_array(msg, pos_std, 3, 20); +} + +/** + * @brief Get field yaw_std from target_relative message + * + * @return [rad] Standard deviation of the target's orientation in TARGET_OBS_FRAME + */ +static inline float mavlink_msg_target_relative_get_yaw_std(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 32); +} + +/** + * @brief Get field q_target from target_relative message + * + * @return Quaternion of the target's orientation from the target's frame to the TARGET_OBS_FRAME (w, x, y, z order, zero-rotation is 1, 0, 0, 0) + */ +static inline uint16_t mavlink_msg_target_relative_get_q_target(const mavlink_message_t* msg, float *q_target) +{ + return _MAV_RETURN_float_array(msg, q_target, 4, 36); +} + +/** + * @brief Get field q_sensor from target_relative message + * + * @return Quaternion of the sensor's orientation from TARGET_OBS_FRAME to vehicle-carried NED. (Ignored if set to (0,0,0,0)) (w, x, y, z order, zero-rotation is 1, 0, 0, 0) + */ +static inline uint16_t mavlink_msg_target_relative_get_q_sensor(const mavlink_message_t* msg, float *q_sensor) +{ + return _MAV_RETURN_float_array(msg, q_sensor, 4, 52); +} + +/** + * @brief Get field type from target_relative message + * + * @return Type of target + */ +static inline uint8_t mavlink_msg_target_relative_get_type(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 70); +} + +/** + * @brief Decode a target_relative message into a struct + * + * @param msg The message to decode + * @param target_relative C-struct to decode the message contents into + */ +static inline void mavlink_msg_target_relative_decode(const mavlink_message_t* msg, mavlink_target_relative_t* target_relative) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + target_relative->timestamp = mavlink_msg_target_relative_get_timestamp(msg); + target_relative->x = mavlink_msg_target_relative_get_x(msg); + target_relative->y = mavlink_msg_target_relative_get_y(msg); + target_relative->z = mavlink_msg_target_relative_get_z(msg); + mavlink_msg_target_relative_get_pos_std(msg, target_relative->pos_std); + target_relative->yaw_std = mavlink_msg_target_relative_get_yaw_std(msg); + mavlink_msg_target_relative_get_q_target(msg, target_relative->q_target); + mavlink_msg_target_relative_get_q_sensor(msg, target_relative->q_sensor); + target_relative->id = mavlink_msg_target_relative_get_id(msg); + target_relative->frame = mavlink_msg_target_relative_get_frame(msg); + target_relative->type = mavlink_msg_target_relative_get_type(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_TARGET_RELATIVE_LEN? msg->len : MAVLINK_MSG_ID_TARGET_RELATIVE_LEN; + memset(target_relative, 0, MAVLINK_MSG_ID_TARGET_RELATIVE_LEN); + memcpy(target_relative, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/development/mavlink_msg_velocity_limits.h b/development/mavlink_msg_velocity_limits.h new file mode 100644 index 000000000..8e2ce7a9d --- /dev/null +++ b/development/mavlink_msg_velocity_limits.h @@ -0,0 +1,316 @@ +#pragma once +// MESSAGE VELOCITY_LIMITS PACKING + +#define MAVLINK_MSG_ID_VELOCITY_LIMITS 355 + + +typedef struct __mavlink_velocity_limits_t { + float horizontal_speed_limit; /*< [m/s] Limit for horizontal movement in MAV_FRAME_LOCAL_NED. NaN: No limit applied*/ + float vertical_speed_limit; /*< [m/s] Limit for vertical movement in MAV_FRAME_LOCAL_NED. NaN: No limit applied*/ + float yaw_rate_limit; /*< [rad/s] Limit for vehicle turn rate around its yaw axis. NaN: No limit applied*/ +} mavlink_velocity_limits_t; + +#define MAVLINK_MSG_ID_VELOCITY_LIMITS_LEN 12 +#define MAVLINK_MSG_ID_VELOCITY_LIMITS_MIN_LEN 12 +#define MAVLINK_MSG_ID_355_LEN 12 +#define MAVLINK_MSG_ID_355_MIN_LEN 12 + +#define MAVLINK_MSG_ID_VELOCITY_LIMITS_CRC 6 +#define MAVLINK_MSG_ID_355_CRC 6 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_VELOCITY_LIMITS { \ + 355, \ + "VELOCITY_LIMITS", \ + 3, \ + { { "horizontal_speed_limit", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_velocity_limits_t, horizontal_speed_limit) }, \ + { "vertical_speed_limit", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_velocity_limits_t, vertical_speed_limit) }, \ + { "yaw_rate_limit", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_velocity_limits_t, yaw_rate_limit) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_VELOCITY_LIMITS { \ + "VELOCITY_LIMITS", \ + 3, \ + { { "horizontal_speed_limit", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_velocity_limits_t, horizontal_speed_limit) }, \ + { "vertical_speed_limit", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_velocity_limits_t, vertical_speed_limit) }, \ + { "yaw_rate_limit", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_velocity_limits_t, yaw_rate_limit) }, \ + } \ +} +#endif + +/** + * @brief Pack a velocity_limits message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param horizontal_speed_limit [m/s] Limit for horizontal movement in MAV_FRAME_LOCAL_NED. NaN: No limit applied + * @param vertical_speed_limit [m/s] Limit for vertical movement in MAV_FRAME_LOCAL_NED. NaN: No limit applied + * @param yaw_rate_limit [rad/s] Limit for vehicle turn rate around its yaw axis. NaN: No limit applied + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_velocity_limits_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + float horizontal_speed_limit, float vertical_speed_limit, float yaw_rate_limit) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_VELOCITY_LIMITS_LEN]; + _mav_put_float(buf, 0, horizontal_speed_limit); + _mav_put_float(buf, 4, vertical_speed_limit); + _mav_put_float(buf, 8, yaw_rate_limit); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VELOCITY_LIMITS_LEN); +#else + mavlink_velocity_limits_t packet; + packet.horizontal_speed_limit = horizontal_speed_limit; + packet.vertical_speed_limit = vertical_speed_limit; + packet.yaw_rate_limit = yaw_rate_limit; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VELOCITY_LIMITS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_VELOCITY_LIMITS; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_VELOCITY_LIMITS_MIN_LEN, MAVLINK_MSG_ID_VELOCITY_LIMITS_LEN, MAVLINK_MSG_ID_VELOCITY_LIMITS_CRC); +} + +/** + * @brief Pack a velocity_limits message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param horizontal_speed_limit [m/s] Limit for horizontal movement in MAV_FRAME_LOCAL_NED. NaN: No limit applied + * @param vertical_speed_limit [m/s] Limit for vertical movement in MAV_FRAME_LOCAL_NED. NaN: No limit applied + * @param yaw_rate_limit [rad/s] Limit for vehicle turn rate around its yaw axis. NaN: No limit applied + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_velocity_limits_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + float horizontal_speed_limit, float vertical_speed_limit, float yaw_rate_limit) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_VELOCITY_LIMITS_LEN]; + _mav_put_float(buf, 0, horizontal_speed_limit); + _mav_put_float(buf, 4, vertical_speed_limit); + _mav_put_float(buf, 8, yaw_rate_limit); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VELOCITY_LIMITS_LEN); +#else + mavlink_velocity_limits_t packet; + packet.horizontal_speed_limit = horizontal_speed_limit; + packet.vertical_speed_limit = vertical_speed_limit; + packet.yaw_rate_limit = yaw_rate_limit; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VELOCITY_LIMITS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_VELOCITY_LIMITS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VELOCITY_LIMITS_MIN_LEN, MAVLINK_MSG_ID_VELOCITY_LIMITS_LEN, MAVLINK_MSG_ID_VELOCITY_LIMITS_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VELOCITY_LIMITS_MIN_LEN, MAVLINK_MSG_ID_VELOCITY_LIMITS_LEN); +#endif +} + +/** + * @brief Pack a velocity_limits message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param horizontal_speed_limit [m/s] Limit for horizontal movement in MAV_FRAME_LOCAL_NED. NaN: No limit applied + * @param vertical_speed_limit [m/s] Limit for vertical movement in MAV_FRAME_LOCAL_NED. NaN: No limit applied + * @param yaw_rate_limit [rad/s] Limit for vehicle turn rate around its yaw axis. NaN: No limit applied + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_velocity_limits_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + float horizontal_speed_limit,float vertical_speed_limit,float yaw_rate_limit) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_VELOCITY_LIMITS_LEN]; + _mav_put_float(buf, 0, horizontal_speed_limit); + _mav_put_float(buf, 4, vertical_speed_limit); + _mav_put_float(buf, 8, yaw_rate_limit); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VELOCITY_LIMITS_LEN); +#else + mavlink_velocity_limits_t packet; + packet.horizontal_speed_limit = horizontal_speed_limit; + packet.vertical_speed_limit = vertical_speed_limit; + packet.yaw_rate_limit = yaw_rate_limit; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VELOCITY_LIMITS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_VELOCITY_LIMITS; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_VELOCITY_LIMITS_MIN_LEN, MAVLINK_MSG_ID_VELOCITY_LIMITS_LEN, MAVLINK_MSG_ID_VELOCITY_LIMITS_CRC); +} + +/** + * @brief Encode a velocity_limits struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param velocity_limits C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_velocity_limits_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_velocity_limits_t* velocity_limits) +{ + return mavlink_msg_velocity_limits_pack(system_id, component_id, msg, velocity_limits->horizontal_speed_limit, velocity_limits->vertical_speed_limit, velocity_limits->yaw_rate_limit); +} + +/** + * @brief Encode a velocity_limits struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param velocity_limits C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_velocity_limits_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_velocity_limits_t* velocity_limits) +{ + return mavlink_msg_velocity_limits_pack_chan(system_id, component_id, chan, msg, velocity_limits->horizontal_speed_limit, velocity_limits->vertical_speed_limit, velocity_limits->yaw_rate_limit); +} + +/** + * @brief Encode a velocity_limits struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param velocity_limits C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_velocity_limits_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_velocity_limits_t* velocity_limits) +{ + return mavlink_msg_velocity_limits_pack_status(system_id, component_id, _status, msg, velocity_limits->horizontal_speed_limit, velocity_limits->vertical_speed_limit, velocity_limits->yaw_rate_limit); +} + +/** + * @brief Send a velocity_limits message + * @param chan MAVLink channel to send the message + * + * @param horizontal_speed_limit [m/s] Limit for horizontal movement in MAV_FRAME_LOCAL_NED. NaN: No limit applied + * @param vertical_speed_limit [m/s] Limit for vertical movement in MAV_FRAME_LOCAL_NED. NaN: No limit applied + * @param yaw_rate_limit [rad/s] Limit for vehicle turn rate around its yaw axis. NaN: No limit applied + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_velocity_limits_send(mavlink_channel_t chan, float horizontal_speed_limit, float vertical_speed_limit, float yaw_rate_limit) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_VELOCITY_LIMITS_LEN]; + _mav_put_float(buf, 0, horizontal_speed_limit); + _mav_put_float(buf, 4, vertical_speed_limit); + _mav_put_float(buf, 8, yaw_rate_limit); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VELOCITY_LIMITS, buf, MAVLINK_MSG_ID_VELOCITY_LIMITS_MIN_LEN, MAVLINK_MSG_ID_VELOCITY_LIMITS_LEN, MAVLINK_MSG_ID_VELOCITY_LIMITS_CRC); +#else + mavlink_velocity_limits_t packet; + packet.horizontal_speed_limit = horizontal_speed_limit; + packet.vertical_speed_limit = vertical_speed_limit; + packet.yaw_rate_limit = yaw_rate_limit; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VELOCITY_LIMITS, (const char *)&packet, MAVLINK_MSG_ID_VELOCITY_LIMITS_MIN_LEN, MAVLINK_MSG_ID_VELOCITY_LIMITS_LEN, MAVLINK_MSG_ID_VELOCITY_LIMITS_CRC); +#endif +} + +/** + * @brief Send a velocity_limits message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_velocity_limits_send_struct(mavlink_channel_t chan, const mavlink_velocity_limits_t* velocity_limits) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_velocity_limits_send(chan, velocity_limits->horizontal_speed_limit, velocity_limits->vertical_speed_limit, velocity_limits->yaw_rate_limit); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VELOCITY_LIMITS, (const char *)velocity_limits, MAVLINK_MSG_ID_VELOCITY_LIMITS_MIN_LEN, MAVLINK_MSG_ID_VELOCITY_LIMITS_LEN, MAVLINK_MSG_ID_VELOCITY_LIMITS_CRC); +#endif +} + +#if MAVLINK_MSG_ID_VELOCITY_LIMITS_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_velocity_limits_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, float horizontal_speed_limit, float vertical_speed_limit, float yaw_rate_limit) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_float(buf, 0, horizontal_speed_limit); + _mav_put_float(buf, 4, vertical_speed_limit); + _mav_put_float(buf, 8, yaw_rate_limit); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VELOCITY_LIMITS, buf, MAVLINK_MSG_ID_VELOCITY_LIMITS_MIN_LEN, MAVLINK_MSG_ID_VELOCITY_LIMITS_LEN, MAVLINK_MSG_ID_VELOCITY_LIMITS_CRC); +#else + mavlink_velocity_limits_t *packet = (mavlink_velocity_limits_t *)msgbuf; + packet->horizontal_speed_limit = horizontal_speed_limit; + packet->vertical_speed_limit = vertical_speed_limit; + packet->yaw_rate_limit = yaw_rate_limit; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VELOCITY_LIMITS, (const char *)packet, MAVLINK_MSG_ID_VELOCITY_LIMITS_MIN_LEN, MAVLINK_MSG_ID_VELOCITY_LIMITS_LEN, MAVLINK_MSG_ID_VELOCITY_LIMITS_CRC); +#endif +} +#endif + +#endif + +// MESSAGE VELOCITY_LIMITS UNPACKING + + +/** + * @brief Get field horizontal_speed_limit from velocity_limits message + * + * @return [m/s] Limit for horizontal movement in MAV_FRAME_LOCAL_NED. NaN: No limit applied + */ +static inline float mavlink_msg_velocity_limits_get_horizontal_speed_limit(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 0); +} + +/** + * @brief Get field vertical_speed_limit from velocity_limits message + * + * @return [m/s] Limit for vertical movement in MAV_FRAME_LOCAL_NED. NaN: No limit applied + */ +static inline float mavlink_msg_velocity_limits_get_vertical_speed_limit(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 4); +} + +/** + * @brief Get field yaw_rate_limit from velocity_limits message + * + * @return [rad/s] Limit for vehicle turn rate around its yaw axis. NaN: No limit applied + */ +static inline float mavlink_msg_velocity_limits_get_yaw_rate_limit(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 8); +} + +/** + * @brief Decode a velocity_limits message into a struct + * + * @param msg The message to decode + * @param velocity_limits C-struct to decode the message contents into + */ +static inline void mavlink_msg_velocity_limits_decode(const mavlink_message_t* msg, mavlink_velocity_limits_t* velocity_limits) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + velocity_limits->horizontal_speed_limit = mavlink_msg_velocity_limits_get_horizontal_speed_limit(msg); + velocity_limits->vertical_speed_limit = mavlink_msg_velocity_limits_get_vertical_speed_limit(msg); + velocity_limits->yaw_rate_limit = mavlink_msg_velocity_limits_get_yaw_rate_limit(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_VELOCITY_LIMITS_LEN? msg->len : MAVLINK_MSG_ID_VELOCITY_LIMITS_LEN; + memset(velocity_limits, 0, MAVLINK_MSG_ID_VELOCITY_LIMITS_LEN); + memcpy(velocity_limits, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/development/testsuite.h b/development/testsuite.h new file mode 100644 index 000000000..12b5538a2 --- /dev/null +++ b/development/testsuite.h @@ -0,0 +1,957 @@ +/** @file + * @brief MAVLink comm protocol testsuite generated from development.xml + * @see https://mavlink.io/en/ + */ +#pragma once +#ifndef DEVELOPMENT_TESTSUITE_H +#define DEVELOPMENT_TESTSUITE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef MAVLINK_TEST_ALL +#define MAVLINK_TEST_ALL +static void mavlink_test_common(uint8_t, uint8_t, mavlink_message_t *last_msg); +static void mavlink_test_development(uint8_t, uint8_t, mavlink_message_t *last_msg); + +static void mavlink_test_all(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) +{ + mavlink_test_common(system_id, component_id, last_msg); + mavlink_test_development(system_id, component_id, last_msg); +} +#endif + +#include "../common/testsuite.h" + + +static void mavlink_test_airspeed(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) +{ +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); + if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_AIRSPEED >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_airspeed_t packet_in = { + 17.0,45.0,17651,163,230 + }; + mavlink_airspeed_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.airspeed = packet_in.airspeed; + packet1.raw_press = packet_in.raw_press; + packet1.temperature = packet_in.temperature; + packet1.id = packet_in.id; + packet1.flags = packet_in.flags; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_AIRSPEED_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_AIRSPEED_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_airspeed_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_airspeed_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_airspeed_pack(system_id, component_id, &msg , packet1.id , packet1.airspeed , packet1.temperature , packet1.raw_press , packet1.flags ); + mavlink_msg_airspeed_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_airspeed_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.id , packet1.airspeed , packet1.temperature , packet1.raw_press , packet1.flags ); + mavlink_msg_airspeed_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GLOBAL_POSITION >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_global_position_t packet_in = { + 93372036854775807ULL,963497880,963498088,129.0,157.0,185.0,213.0,101,168,235 + }; + mavlink_global_position_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.time_usec = packet_in.time_usec; + packet1.lat = packet_in.lat; + packet1.lon = packet_in.lon; + packet1.alt = packet_in.alt; + packet1.alt_ellipsoid = packet_in.alt_ellipsoid; + packet1.eph = packet_in.eph; + packet1.epv = packet_in.epv; + packet1.id = packet_in.id; + packet1.source = packet_in.source; + packet1.flags = packet_in.flags; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_GLOBAL_POSITION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GLOBAL_POSITION_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_global_position_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_global_position_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_global_position_pack(system_id, component_id, &msg , packet1.id , packet1.time_usec , packet1.source , packet1.flags , packet1.lat , packet1.lon , packet1.alt , packet1.alt_ellipsoid , packet1.eph , packet1.epv ); + mavlink_msg_global_position_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_global_position_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.id , packet1.time_usec , packet1.source , packet1.flags , packet1.lat , packet1.lon , packet1.alt , packet1.alt_ellipsoid , packet1.eph , packet1.epv ); + mavlink_msg_global_position_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_cellular_modem_information_t packet_in = { + 93372036854775807ULL,93372036854776311ULL,53,"RSTUVWXYZ","BCDEFGHIJKLMNOPQRST","VWXYZABCDEFGHIJKLMNOPQR","TUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOP" + }; + mavlink_cellular_modem_information_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.imei = packet_in.imei; + packet1.imsi = packet_in.imsi; + packet1.id = packet_in.id; + + mav_array_memcpy(packet1.modem_id, packet_in.modem_id, sizeof(char)*10); + mav_array_memcpy(packet1.iccid, packet_in.iccid, sizeof(char)*20); + mav_array_memcpy(packet1.firmware, packet_in.firmware, sizeof(char)*24); + mav_array_memcpy(packet1.modem_model, packet_in.modem_model, sizeof(char)*50); + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_CELLULAR_MODEM_INFORMATION_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_cellular_modem_information_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_cellular_modem_information_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_cellular_modem_information_pack(system_id, component_id, &msg , packet1.id , packet1.imei , packet1.imsi , packet1.modem_id , packet1.iccid , packet1.firmware , packet1.modem_model ); + mavlink_msg_cellular_modem_information_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_cellular_modem_information_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.id , packet1.imei , packet1.imsi , packet1.modem_id , packet1.iccid , packet1.firmware , packet1.modem_model ); + mavlink_msg_cellular_modem_information_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SET_VELOCITY_LIMITS >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_set_velocity_limits_t packet_in = { + 17.0,45.0,73.0,41,108 + }; + mavlink_set_velocity_limits_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.horizontal_speed_limit = packet_in.horizontal_speed_limit; + packet1.vertical_speed_limit = packet_in.vertical_speed_limit; + packet1.yaw_rate_limit = packet_in.yaw_rate_limit; + packet1.target_system = packet_in.target_system; + packet1.target_component = packet_in.target_component; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SET_VELOCITY_LIMITS_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_set_velocity_limits_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_set_velocity_limits_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_set_velocity_limits_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.horizontal_speed_limit , packet1.vertical_speed_limit , packet1.yaw_rate_limit ); + mavlink_msg_set_velocity_limits_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_set_velocity_limits_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.horizontal_speed_limit , packet1.vertical_speed_limit , packet1.yaw_rate_limit ); + mavlink_msg_set_velocity_limits_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_VELOCITY_LIMITS >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_velocity_limits_t packet_in = { + 17.0,45.0,73.0 + }; + mavlink_velocity_limits_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.horizontal_speed_limit = packet_in.horizontal_speed_limit; + packet1.vertical_speed_limit = packet_in.vertical_speed_limit; + packet1.yaw_rate_limit = packet_in.yaw_rate_limit; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_VELOCITY_LIMITS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_VELOCITY_LIMITS_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_velocity_limits_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_velocity_limits_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_velocity_limits_pack(system_id, component_id, &msg , packet1.horizontal_speed_limit , packet1.vertical_speed_limit , packet1.yaw_rate_limit ); + mavlink_msg_velocity_limits_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_velocity_limits_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.horizontal_speed_limit , packet1.vertical_speed_limit , packet1.yaw_rate_limit ); + mavlink_msg_velocity_limits_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_figure_eight_execution_status_t packet_in = { + 93372036854775807ULL,73.0,101.0,129.0,963498504,963498712,213.0,101 + }; + mavlink_figure_eight_execution_status_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.time_usec = packet_in.time_usec; + packet1.major_radius = packet_in.major_radius; + packet1.minor_radius = packet_in.minor_radius; + packet1.orientation = packet_in.orientation; + packet1.x = packet_in.x; + packet1.y = packet_in.y; + packet1.z = packet_in.z; + packet1.frame = packet_in.frame; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_FIGURE_EIGHT_EXECUTION_STATUS_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_figure_eight_execution_status_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_figure_eight_execution_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_figure_eight_execution_status_pack(system_id, component_id, &msg , packet1.time_usec , packet1.major_radius , packet1.minor_radius , packet1.orientation , packet1.frame , packet1.x , packet1.y , packet1.z ); + mavlink_msg_figure_eight_execution_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_figure_eight_execution_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.major_radius , packet1.minor_radius , packet1.orientation , packet1.frame , packet1.x , packet1.y , packet1.z ); + mavlink_msg_figure_eight_execution_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_BATTERY_STATUS_V2 >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_battery_status_v2_t packet_in = { + 17.0,45.0,73.0,101.0,963498296,18275,199,10 + }; + mavlink_battery_status_v2_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.voltage = packet_in.voltage; + packet1.current = packet_in.current; + packet1.capacity_consumed = packet_in.capacity_consumed; + packet1.capacity_remaining = packet_in.capacity_remaining; + packet1.status_flags = packet_in.status_flags; + packet1.temperature = packet_in.temperature; + packet1.id = packet_in.id; + packet1.percent_remaining = packet_in.percent_remaining; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_BATTERY_STATUS_V2_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_BATTERY_STATUS_V2_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_battery_status_v2_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_battery_status_v2_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_battery_status_v2_pack(system_id, component_id, &msg , packet1.id , packet1.temperature , packet1.voltage , packet1.current , packet1.capacity_consumed , packet1.capacity_remaining , packet1.percent_remaining , packet1.status_flags ); + mavlink_msg_battery_status_v2_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_battery_status_v2_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.id , packet1.temperature , packet1.voltage , packet1.current , packet1.capacity_consumed , packet1.capacity_remaining , packet1.percent_remaining , packet1.status_flags ); + mavlink_msg_battery_status_v2_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GROUP_START >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_group_start_t packet_in = { + 93372036854775807ULL,963497880,963498088 + }; + mavlink_group_start_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.time_usec = packet_in.time_usec; + packet1.group_id = packet_in.group_id; + packet1.mission_checksum = packet_in.mission_checksum; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_GROUP_START_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GROUP_START_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_group_start_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_group_start_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_group_start_pack(system_id, component_id, &msg , packet1.group_id , packet1.mission_checksum , packet1.time_usec ); + mavlink_msg_group_start_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_group_start_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.group_id , packet1.mission_checksum , packet1.time_usec ); + mavlink_msg_group_start_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GROUP_END >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_group_end_t packet_in = { + 93372036854775807ULL,963497880,963498088 + }; + mavlink_group_end_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.time_usec = packet_in.time_usec; + packet1.group_id = packet_in.group_id; + packet1.mission_checksum = packet_in.mission_checksum; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_GROUP_END_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GROUP_END_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_group_end_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_group_end_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_group_end_pack(system_id, component_id, &msg , packet1.group_id , packet1.mission_checksum , packet1.time_usec ); + mavlink_msg_group_end_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_group_end_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.group_id , packet1.mission_checksum , packet1.time_usec ); + mavlink_msg_group_end_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_RADIO_RC_CHANNELS >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_radio_rc_channels_t packet_in = { + 963497464,17443,151,218,29,{ 17703, 17704, 17705, 17706, 17707, 17708, 17709, 17710, 17711, 17712, 17713, 17714, 17715, 17716, 17717, 17718, 17719, 17720, 17721, 17722, 17723, 17724, 17725, 17726, 17727, 17728, 17729, 17730, 17731, 17732, 17733, 17734 } + }; + mavlink_radio_rc_channels_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.time_last_update_ms = packet_in.time_last_update_ms; + packet1.flags = packet_in.flags; + packet1.target_system = packet_in.target_system; + packet1.target_component = packet_in.target_component; + packet1.count = packet_in.count; + + mav_array_memcpy(packet1.channels, packet_in.channels, sizeof(int16_t)*32); + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_RADIO_RC_CHANNELS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_RADIO_RC_CHANNELS_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_radio_rc_channels_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_radio_rc_channels_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_radio_rc_channels_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.time_last_update_ms , packet1.flags , packet1.count , packet1.channels ); + mavlink_msg_radio_rc_channels_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_radio_rc_channels_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.time_last_update_ms , packet1.flags , packet1.count , packet1.channels ); + mavlink_msg_radio_rc_channels_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GNSS_INTEGRITY >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_gnss_integrity_t packet_in = { + 963497464,17443,17547,29,96,163,230,41,108,175,242,53 + }; + mavlink_gnss_integrity_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.system_errors = packet_in.system_errors; + packet1.raim_hfom = packet_in.raim_hfom; + packet1.raim_vfom = packet_in.raim_vfom; + packet1.id = packet_in.id; + packet1.authentication_state = packet_in.authentication_state; + packet1.jamming_state = packet_in.jamming_state; + packet1.spoofing_state = packet_in.spoofing_state; + packet1.raim_state = packet_in.raim_state; + packet1.corrections_quality = packet_in.corrections_quality; + packet1.system_status_summary = packet_in.system_status_summary; + packet1.gnss_signal_quality = packet_in.gnss_signal_quality; + packet1.post_processing_quality = packet_in.post_processing_quality; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_GNSS_INTEGRITY_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GNSS_INTEGRITY_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_gnss_integrity_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_gnss_integrity_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_gnss_integrity_pack(system_id, component_id, &msg , packet1.id , packet1.system_errors , packet1.authentication_state , packet1.jamming_state , packet1.spoofing_state , packet1.raim_state , packet1.raim_hfom , packet1.raim_vfom , packet1.corrections_quality , packet1.system_status_summary , packet1.gnss_signal_quality , packet1.post_processing_quality ); + mavlink_msg_gnss_integrity_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_gnss_integrity_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.id , packet1.system_errors , packet1.authentication_state , packet1.jamming_state , packet1.spoofing_state , packet1.raim_state , packet1.raim_hfom , packet1.raim_vfom , packet1.corrections_quality , packet1.system_status_summary , packet1.gnss_signal_quality , packet1.post_processing_quality ); + mavlink_msg_gnss_integrity_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_TARGET_ABSOLUTE >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_target_absolute_t packet_in = { + 93372036854775807ULL,963497880,963498088,129.0,{ 157.0, 158.0, 159.0 },{ 241.0, 242.0, 243.0 },{ 325.0, 326.0, 327.0, 328.0 },{ 437.0, 438.0, 439.0 },{ 521.0, 522.0 },{ 577.0, 578.0, 579.0 },{ 661.0, 662.0, 663.0 },61,128 + }; + mavlink_target_absolute_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.timestamp = packet_in.timestamp; + packet1.lat = packet_in.lat; + packet1.lon = packet_in.lon; + packet1.alt = packet_in.alt; + packet1.id = packet_in.id; + packet1.sensor_capabilities = packet_in.sensor_capabilities; + + mav_array_memcpy(packet1.vel, packet_in.vel, sizeof(float)*3); + mav_array_memcpy(packet1.acc, packet_in.acc, sizeof(float)*3); + mav_array_memcpy(packet1.q_target, packet_in.q_target, sizeof(float)*4); + mav_array_memcpy(packet1.rates, packet_in.rates, sizeof(float)*3); + mav_array_memcpy(packet1.position_std, packet_in.position_std, sizeof(float)*2); + mav_array_memcpy(packet1.vel_std, packet_in.vel_std, sizeof(float)*3); + mav_array_memcpy(packet1.acc_std, packet_in.acc_std, sizeof(float)*3); + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_TARGET_ABSOLUTE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_TARGET_ABSOLUTE_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_target_absolute_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_target_absolute_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_target_absolute_pack(system_id, component_id, &msg , packet1.timestamp , packet1.id , packet1.sensor_capabilities , packet1.lat , packet1.lon , packet1.alt , packet1.vel , packet1.acc , packet1.q_target , packet1.rates , packet1.position_std , packet1.vel_std , packet1.acc_std ); + mavlink_msg_target_absolute_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_target_absolute_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timestamp , packet1.id , packet1.sensor_capabilities , packet1.lat , packet1.lon , packet1.alt , packet1.vel , packet1.acc , packet1.q_target , packet1.rates , packet1.position_std , packet1.vel_std , packet1.acc_std ); + mavlink_msg_target_absolute_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_TARGET_RELATIVE >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_target_relative_t packet_in = { + 93372036854775807ULL,73.0,101.0,129.0,{ 157.0, 158.0, 159.0 },241.0,{ 269.0, 270.0, 271.0, 272.0 },{ 381.0, 382.0, 383.0, 384.0 },209,20,87 + }; + mavlink_target_relative_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.timestamp = packet_in.timestamp; + packet1.x = packet_in.x; + packet1.y = packet_in.y; + packet1.z = packet_in.z; + packet1.yaw_std = packet_in.yaw_std; + packet1.id = packet_in.id; + packet1.frame = packet_in.frame; + packet1.type = packet_in.type; + + mav_array_memcpy(packet1.pos_std, packet_in.pos_std, sizeof(float)*3); + mav_array_memcpy(packet1.q_target, packet_in.q_target, sizeof(float)*4); + mav_array_memcpy(packet1.q_sensor, packet_in.q_sensor, sizeof(float)*4); + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_TARGET_RELATIVE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_TARGET_RELATIVE_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_target_relative_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_target_relative_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_target_relative_pack(system_id, component_id, &msg , packet1.timestamp , packet1.id , packet1.frame , packet1.x , packet1.y , packet1.z , packet1.pos_std , packet1.yaw_std , packet1.q_target , packet1.q_sensor , packet1.type ); + mavlink_msg_target_relative_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_target_relative_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timestamp , packet1.id , packet1.frame , packet1.x , packet1.y , packet1.z , packet1.pos_std , packet1.yaw_std , packet1.q_target , packet1.q_sensor , packet1.type ); + mavlink_msg_target_relative_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_CONTROL_STATUS >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_control_status_t packet_in = { + 5,72 + }; + mavlink_control_status_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.sysid_in_control = packet_in.sysid_in_control; + packet1.flags = packet_in.flags; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_CONTROL_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_CONTROL_STATUS_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_control_status_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_control_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_control_status_pack(system_id, component_id, &msg , packet1.sysid_in_control , packet1.flags ); + mavlink_msg_control_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_control_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.sysid_in_control , packet1.flags ); + mavlink_msg_control_status_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; imsgid = MAVLINK_MSG_ID_ICAROUS_HEARTBEAT; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ICAROUS_HEARTBEAT_MIN_LEN, MAVLINK_MSG_ID_ICAROUS_HEARTBEAT_LEN, MAVLINK_MSG_ID_ICAROUS_HEARTBEAT_CRC); -} - -/** - * @brief Pack a icarous_heartbeat message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param status See the FMS_STATE enum. - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_icarous_heartbeat_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_ICAROUS_HEARTBEAT_LEN]; - _mav_put_uint8_t(buf, 0, status); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ICAROUS_HEARTBEAT_LEN); -#else - mavlink_icarous_heartbeat_t packet; - packet.status = status; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ICAROUS_HEARTBEAT_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_ICAROUS_HEARTBEAT; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ICAROUS_HEARTBEAT_MIN_LEN, MAVLINK_MSG_ID_ICAROUS_HEARTBEAT_LEN, MAVLINK_MSG_ID_ICAROUS_HEARTBEAT_CRC); -} - -/** - * @brief Encode a icarous_heartbeat struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param icarous_heartbeat C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_icarous_heartbeat_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_icarous_heartbeat_t* icarous_heartbeat) -{ - return mavlink_msg_icarous_heartbeat_pack(system_id, component_id, msg, icarous_heartbeat->status); -} - -/** - * @brief Encode a icarous_heartbeat struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param icarous_heartbeat C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_icarous_heartbeat_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_icarous_heartbeat_t* icarous_heartbeat) -{ - return mavlink_msg_icarous_heartbeat_pack_chan(system_id, component_id, chan, msg, icarous_heartbeat->status); -} - -/** - * @brief Send a icarous_heartbeat message - * @param chan MAVLink channel to send the message - * - * @param status See the FMS_STATE enum. - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_icarous_heartbeat_send(mavlink_channel_t chan, uint8_t status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_ICAROUS_HEARTBEAT_LEN]; - _mav_put_uint8_t(buf, 0, status); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ICAROUS_HEARTBEAT, buf, MAVLINK_MSG_ID_ICAROUS_HEARTBEAT_MIN_LEN, MAVLINK_MSG_ID_ICAROUS_HEARTBEAT_LEN, MAVLINK_MSG_ID_ICAROUS_HEARTBEAT_CRC); -#else - mavlink_icarous_heartbeat_t packet; - packet.status = status; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ICAROUS_HEARTBEAT, (const char *)&packet, MAVLINK_MSG_ID_ICAROUS_HEARTBEAT_MIN_LEN, MAVLINK_MSG_ID_ICAROUS_HEARTBEAT_LEN, MAVLINK_MSG_ID_ICAROUS_HEARTBEAT_CRC); -#endif -} - -/** - * @brief Send a icarous_heartbeat message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_icarous_heartbeat_send_struct(mavlink_channel_t chan, const mavlink_icarous_heartbeat_t* icarous_heartbeat) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_icarous_heartbeat_send(chan, icarous_heartbeat->status); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ICAROUS_HEARTBEAT, (const char *)icarous_heartbeat, MAVLINK_MSG_ID_ICAROUS_HEARTBEAT_MIN_LEN, MAVLINK_MSG_ID_ICAROUS_HEARTBEAT_LEN, MAVLINK_MSG_ID_ICAROUS_HEARTBEAT_CRC); -#endif -} - -#if MAVLINK_MSG_ID_ICAROUS_HEARTBEAT_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_icarous_heartbeat_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t status) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint8_t(buf, 0, status); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ICAROUS_HEARTBEAT, buf, MAVLINK_MSG_ID_ICAROUS_HEARTBEAT_MIN_LEN, MAVLINK_MSG_ID_ICAROUS_HEARTBEAT_LEN, MAVLINK_MSG_ID_ICAROUS_HEARTBEAT_CRC); -#else - mavlink_icarous_heartbeat_t *packet = (mavlink_icarous_heartbeat_t *)msgbuf; - packet->status = status; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ICAROUS_HEARTBEAT, (const char *)packet, MAVLINK_MSG_ID_ICAROUS_HEARTBEAT_MIN_LEN, MAVLINK_MSG_ID_ICAROUS_HEARTBEAT_LEN, MAVLINK_MSG_ID_ICAROUS_HEARTBEAT_CRC); -#endif -} -#endif - -#endif - -// MESSAGE ICAROUS_HEARTBEAT UNPACKING - - -/** - * @brief Get field status from icarous_heartbeat message - * - * @return See the FMS_STATE enum. - */ -static inline uint8_t mavlink_msg_icarous_heartbeat_get_status(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 0); -} - -/** - * @brief Decode a icarous_heartbeat message into a struct - * - * @param msg The message to decode - * @param icarous_heartbeat C-struct to decode the message contents into - */ -static inline void mavlink_msg_icarous_heartbeat_decode(const mavlink_message_t* msg, mavlink_icarous_heartbeat_t* icarous_heartbeat) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - icarous_heartbeat->status = mavlink_msg_icarous_heartbeat_get_status(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_ICAROUS_HEARTBEAT_LEN? msg->len : MAVLINK_MSG_ID_ICAROUS_HEARTBEAT_LEN; - memset(icarous_heartbeat, 0, MAVLINK_MSG_ID_ICAROUS_HEARTBEAT_LEN); - memcpy(icarous_heartbeat, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/icarous/mavlink_msg_icarous_kinematic_bands.h b/icarous/mavlink_msg_icarous_kinematic_bands.h deleted file mode 100644 index 98345f152..000000000 --- a/icarous/mavlink_msg_icarous_kinematic_bands.h +++ /dev/null @@ -1,588 +0,0 @@ -#pragma once -// MESSAGE ICAROUS_KINEMATIC_BANDS PACKING - -#define MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS 42001 - - -typedef struct __mavlink_icarous_kinematic_bands_t { - float min1; /*< [deg] min angle (degrees)*/ - float max1; /*< [deg] max angle (degrees)*/ - float min2; /*< [deg] min angle (degrees)*/ - float max2; /*< [deg] max angle (degrees)*/ - float min3; /*< [deg] min angle (degrees)*/ - float max3; /*< [deg] max angle (degrees)*/ - float min4; /*< [deg] min angle (degrees)*/ - float max4; /*< [deg] max angle (degrees)*/ - float min5; /*< [deg] min angle (degrees)*/ - float max5; /*< [deg] max angle (degrees)*/ - int8_t numBands; /*< Number of track bands*/ - uint8_t type1; /*< See the TRACK_BAND_TYPES enum.*/ - uint8_t type2; /*< See the TRACK_BAND_TYPES enum.*/ - uint8_t type3; /*< See the TRACK_BAND_TYPES enum.*/ - uint8_t type4; /*< See the TRACK_BAND_TYPES enum.*/ - uint8_t type5; /*< See the TRACK_BAND_TYPES enum.*/ -} mavlink_icarous_kinematic_bands_t; - -#define MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_LEN 46 -#define MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_MIN_LEN 46 -#define MAVLINK_MSG_ID_42001_LEN 46 -#define MAVLINK_MSG_ID_42001_MIN_LEN 46 - -#define MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_CRC 239 -#define MAVLINK_MSG_ID_42001_CRC 239 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_ICAROUS_KINEMATIC_BANDS { \ - 42001, \ - "ICAROUS_KINEMATIC_BANDS", \ - 16, \ - { { "numBands", NULL, MAVLINK_TYPE_INT8_T, 0, 40, offsetof(mavlink_icarous_kinematic_bands_t, numBands) }, \ - { "type1", NULL, MAVLINK_TYPE_UINT8_T, 0, 41, offsetof(mavlink_icarous_kinematic_bands_t, type1) }, \ - { "min1", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_icarous_kinematic_bands_t, min1) }, \ - { "max1", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_icarous_kinematic_bands_t, max1) }, \ - { "type2", NULL, MAVLINK_TYPE_UINT8_T, 0, 42, offsetof(mavlink_icarous_kinematic_bands_t, type2) }, \ - { "min2", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_icarous_kinematic_bands_t, min2) }, \ - { "max2", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_icarous_kinematic_bands_t, max2) }, \ - { "type3", NULL, MAVLINK_TYPE_UINT8_T, 0, 43, offsetof(mavlink_icarous_kinematic_bands_t, type3) }, \ - { "min3", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_icarous_kinematic_bands_t, min3) }, \ - { "max3", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_icarous_kinematic_bands_t, max3) }, \ - { "type4", NULL, MAVLINK_TYPE_UINT8_T, 0, 44, offsetof(mavlink_icarous_kinematic_bands_t, type4) }, \ - { "min4", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_icarous_kinematic_bands_t, min4) }, \ - { "max4", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_icarous_kinematic_bands_t, max4) }, \ - { "type5", NULL, MAVLINK_TYPE_UINT8_T, 0, 45, offsetof(mavlink_icarous_kinematic_bands_t, type5) }, \ - { "min5", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_icarous_kinematic_bands_t, min5) }, \ - { "max5", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_icarous_kinematic_bands_t, max5) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_ICAROUS_KINEMATIC_BANDS { \ - "ICAROUS_KINEMATIC_BANDS", \ - 16, \ - { { "numBands", NULL, MAVLINK_TYPE_INT8_T, 0, 40, offsetof(mavlink_icarous_kinematic_bands_t, numBands) }, \ - { "type1", NULL, MAVLINK_TYPE_UINT8_T, 0, 41, offsetof(mavlink_icarous_kinematic_bands_t, type1) }, \ - { "min1", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_icarous_kinematic_bands_t, min1) }, \ - { "max1", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_icarous_kinematic_bands_t, max1) }, \ - { "type2", NULL, MAVLINK_TYPE_UINT8_T, 0, 42, offsetof(mavlink_icarous_kinematic_bands_t, type2) }, \ - { "min2", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_icarous_kinematic_bands_t, min2) }, \ - { "max2", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_icarous_kinematic_bands_t, max2) }, \ - { "type3", NULL, MAVLINK_TYPE_UINT8_T, 0, 43, offsetof(mavlink_icarous_kinematic_bands_t, type3) }, \ - { "min3", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_icarous_kinematic_bands_t, min3) }, \ - { "max3", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_icarous_kinematic_bands_t, max3) }, \ - { "type4", NULL, MAVLINK_TYPE_UINT8_T, 0, 44, offsetof(mavlink_icarous_kinematic_bands_t, type4) }, \ - { "min4", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_icarous_kinematic_bands_t, min4) }, \ - { "max4", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_icarous_kinematic_bands_t, max4) }, \ - { "type5", NULL, MAVLINK_TYPE_UINT8_T, 0, 45, offsetof(mavlink_icarous_kinematic_bands_t, type5) }, \ - { "min5", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_icarous_kinematic_bands_t, min5) }, \ - { "max5", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_icarous_kinematic_bands_t, max5) }, \ - } \ -} -#endif - -/** - * @brief Pack a icarous_kinematic_bands message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param numBands Number of track bands - * @param type1 See the TRACK_BAND_TYPES enum. - * @param min1 [deg] min angle (degrees) - * @param max1 [deg] max angle (degrees) - * @param type2 See the TRACK_BAND_TYPES enum. - * @param min2 [deg] min angle (degrees) - * @param max2 [deg] max angle (degrees) - * @param type3 See the TRACK_BAND_TYPES enum. - * @param min3 [deg] min angle (degrees) - * @param max3 [deg] max angle (degrees) - * @param type4 See the TRACK_BAND_TYPES enum. - * @param min4 [deg] min angle (degrees) - * @param max4 [deg] max angle (degrees) - * @param type5 See the TRACK_BAND_TYPES enum. - * @param min5 [deg] min angle (degrees) - * @param max5 [deg] max angle (degrees) - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_icarous_kinematic_bands_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - int8_t numBands, uint8_t type1, float min1, float max1, uint8_t type2, float min2, float max2, uint8_t type3, float min3, float max3, uint8_t type4, float min4, float max4, uint8_t type5, float min5, float max5) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_LEN]; - _mav_put_float(buf, 0, min1); - _mav_put_float(buf, 4, max1); - _mav_put_float(buf, 8, min2); - _mav_put_float(buf, 12, max2); - _mav_put_float(buf, 16, min3); - _mav_put_float(buf, 20, max3); - _mav_put_float(buf, 24, min4); - _mav_put_float(buf, 28, max4); - _mav_put_float(buf, 32, min5); - _mav_put_float(buf, 36, max5); - _mav_put_int8_t(buf, 40, numBands); - _mav_put_uint8_t(buf, 41, type1); - _mav_put_uint8_t(buf, 42, type2); - _mav_put_uint8_t(buf, 43, type3); - _mav_put_uint8_t(buf, 44, type4); - _mav_put_uint8_t(buf, 45, type5); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_LEN); -#else - mavlink_icarous_kinematic_bands_t packet; - packet.min1 = min1; - packet.max1 = max1; - packet.min2 = min2; - packet.max2 = max2; - packet.min3 = min3; - packet.max3 = max3; - packet.min4 = min4; - packet.max4 = max4; - packet.min5 = min5; - packet.max5 = max5; - packet.numBands = numBands; - packet.type1 = type1; - packet.type2 = type2; - packet.type3 = type3; - packet.type4 = type4; - packet.type5 = type5; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_MIN_LEN, MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_LEN, MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_CRC); -} - -/** - * @brief Pack a icarous_kinematic_bands message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param numBands Number of track bands - * @param type1 See the TRACK_BAND_TYPES enum. - * @param min1 [deg] min angle (degrees) - * @param max1 [deg] max angle (degrees) - * @param type2 See the TRACK_BAND_TYPES enum. - * @param min2 [deg] min angle (degrees) - * @param max2 [deg] max angle (degrees) - * @param type3 See the TRACK_BAND_TYPES enum. - * @param min3 [deg] min angle (degrees) - * @param max3 [deg] max angle (degrees) - * @param type4 See the TRACK_BAND_TYPES enum. - * @param min4 [deg] min angle (degrees) - * @param max4 [deg] max angle (degrees) - * @param type5 See the TRACK_BAND_TYPES enum. - * @param min5 [deg] min angle (degrees) - * @param max5 [deg] max angle (degrees) - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_icarous_kinematic_bands_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - int8_t numBands,uint8_t type1,float min1,float max1,uint8_t type2,float min2,float max2,uint8_t type3,float min3,float max3,uint8_t type4,float min4,float max4,uint8_t type5,float min5,float max5) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_LEN]; - _mav_put_float(buf, 0, min1); - _mav_put_float(buf, 4, max1); - _mav_put_float(buf, 8, min2); - _mav_put_float(buf, 12, max2); - _mav_put_float(buf, 16, min3); - _mav_put_float(buf, 20, max3); - _mav_put_float(buf, 24, min4); - _mav_put_float(buf, 28, max4); - _mav_put_float(buf, 32, min5); - _mav_put_float(buf, 36, max5); - _mav_put_int8_t(buf, 40, numBands); - _mav_put_uint8_t(buf, 41, type1); - _mav_put_uint8_t(buf, 42, type2); - _mav_put_uint8_t(buf, 43, type3); - _mav_put_uint8_t(buf, 44, type4); - _mav_put_uint8_t(buf, 45, type5); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_LEN); -#else - mavlink_icarous_kinematic_bands_t packet; - packet.min1 = min1; - packet.max1 = max1; - packet.min2 = min2; - packet.max2 = max2; - packet.min3 = min3; - packet.max3 = max3; - packet.min4 = min4; - packet.max4 = max4; - packet.min5 = min5; - packet.max5 = max5; - packet.numBands = numBands; - packet.type1 = type1; - packet.type2 = type2; - packet.type3 = type3; - packet.type4 = type4; - packet.type5 = type5; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_MIN_LEN, MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_LEN, MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_CRC); -} - -/** - * @brief Encode a icarous_kinematic_bands struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param icarous_kinematic_bands C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_icarous_kinematic_bands_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_icarous_kinematic_bands_t* icarous_kinematic_bands) -{ - return mavlink_msg_icarous_kinematic_bands_pack(system_id, component_id, msg, icarous_kinematic_bands->numBands, icarous_kinematic_bands->type1, icarous_kinematic_bands->min1, icarous_kinematic_bands->max1, icarous_kinematic_bands->type2, icarous_kinematic_bands->min2, icarous_kinematic_bands->max2, icarous_kinematic_bands->type3, icarous_kinematic_bands->min3, icarous_kinematic_bands->max3, icarous_kinematic_bands->type4, icarous_kinematic_bands->min4, icarous_kinematic_bands->max4, icarous_kinematic_bands->type5, icarous_kinematic_bands->min5, icarous_kinematic_bands->max5); -} - -/** - * @brief Encode a icarous_kinematic_bands struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param icarous_kinematic_bands C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_icarous_kinematic_bands_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_icarous_kinematic_bands_t* icarous_kinematic_bands) -{ - return mavlink_msg_icarous_kinematic_bands_pack_chan(system_id, component_id, chan, msg, icarous_kinematic_bands->numBands, icarous_kinematic_bands->type1, icarous_kinematic_bands->min1, icarous_kinematic_bands->max1, icarous_kinematic_bands->type2, icarous_kinematic_bands->min2, icarous_kinematic_bands->max2, icarous_kinematic_bands->type3, icarous_kinematic_bands->min3, icarous_kinematic_bands->max3, icarous_kinematic_bands->type4, icarous_kinematic_bands->min4, icarous_kinematic_bands->max4, icarous_kinematic_bands->type5, icarous_kinematic_bands->min5, icarous_kinematic_bands->max5); -} - -/** - * @brief Send a icarous_kinematic_bands message - * @param chan MAVLink channel to send the message - * - * @param numBands Number of track bands - * @param type1 See the TRACK_BAND_TYPES enum. - * @param min1 [deg] min angle (degrees) - * @param max1 [deg] max angle (degrees) - * @param type2 See the TRACK_BAND_TYPES enum. - * @param min2 [deg] min angle (degrees) - * @param max2 [deg] max angle (degrees) - * @param type3 See the TRACK_BAND_TYPES enum. - * @param min3 [deg] min angle (degrees) - * @param max3 [deg] max angle (degrees) - * @param type4 See the TRACK_BAND_TYPES enum. - * @param min4 [deg] min angle (degrees) - * @param max4 [deg] max angle (degrees) - * @param type5 See the TRACK_BAND_TYPES enum. - * @param min5 [deg] min angle (degrees) - * @param max5 [deg] max angle (degrees) - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_icarous_kinematic_bands_send(mavlink_channel_t chan, int8_t numBands, uint8_t type1, float min1, float max1, uint8_t type2, float min2, float max2, uint8_t type3, float min3, float max3, uint8_t type4, float min4, float max4, uint8_t type5, float min5, float max5) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_LEN]; - _mav_put_float(buf, 0, min1); - _mav_put_float(buf, 4, max1); - _mav_put_float(buf, 8, min2); - _mav_put_float(buf, 12, max2); - _mav_put_float(buf, 16, min3); - _mav_put_float(buf, 20, max3); - _mav_put_float(buf, 24, min4); - _mav_put_float(buf, 28, max4); - _mav_put_float(buf, 32, min5); - _mav_put_float(buf, 36, max5); - _mav_put_int8_t(buf, 40, numBands); - _mav_put_uint8_t(buf, 41, type1); - _mav_put_uint8_t(buf, 42, type2); - _mav_put_uint8_t(buf, 43, type3); - _mav_put_uint8_t(buf, 44, type4); - _mav_put_uint8_t(buf, 45, type5); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS, buf, MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_MIN_LEN, MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_LEN, MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_CRC); -#else - mavlink_icarous_kinematic_bands_t packet; - packet.min1 = min1; - packet.max1 = max1; - packet.min2 = min2; - packet.max2 = max2; - packet.min3 = min3; - packet.max3 = max3; - packet.min4 = min4; - packet.max4 = max4; - packet.min5 = min5; - packet.max5 = max5; - packet.numBands = numBands; - packet.type1 = type1; - packet.type2 = type2; - packet.type3 = type3; - packet.type4 = type4; - packet.type5 = type5; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS, (const char *)&packet, MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_MIN_LEN, MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_LEN, MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_CRC); -#endif -} - -/** - * @brief Send a icarous_kinematic_bands message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_icarous_kinematic_bands_send_struct(mavlink_channel_t chan, const mavlink_icarous_kinematic_bands_t* icarous_kinematic_bands) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_icarous_kinematic_bands_send(chan, icarous_kinematic_bands->numBands, icarous_kinematic_bands->type1, icarous_kinematic_bands->min1, icarous_kinematic_bands->max1, icarous_kinematic_bands->type2, icarous_kinematic_bands->min2, icarous_kinematic_bands->max2, icarous_kinematic_bands->type3, icarous_kinematic_bands->min3, icarous_kinematic_bands->max3, icarous_kinematic_bands->type4, icarous_kinematic_bands->min4, icarous_kinematic_bands->max4, icarous_kinematic_bands->type5, icarous_kinematic_bands->min5, icarous_kinematic_bands->max5); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS, (const char *)icarous_kinematic_bands, MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_MIN_LEN, MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_LEN, MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_CRC); -#endif -} - -#if MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_icarous_kinematic_bands_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, int8_t numBands, uint8_t type1, float min1, float max1, uint8_t type2, float min2, float max2, uint8_t type3, float min3, float max3, uint8_t type4, float min4, float max4, uint8_t type5, float min5, float max5) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_float(buf, 0, min1); - _mav_put_float(buf, 4, max1); - _mav_put_float(buf, 8, min2); - _mav_put_float(buf, 12, max2); - _mav_put_float(buf, 16, min3); - _mav_put_float(buf, 20, max3); - _mav_put_float(buf, 24, min4); - _mav_put_float(buf, 28, max4); - _mav_put_float(buf, 32, min5); - _mav_put_float(buf, 36, max5); - _mav_put_int8_t(buf, 40, numBands); - _mav_put_uint8_t(buf, 41, type1); - _mav_put_uint8_t(buf, 42, type2); - _mav_put_uint8_t(buf, 43, type3); - _mav_put_uint8_t(buf, 44, type4); - _mav_put_uint8_t(buf, 45, type5); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS, buf, MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_MIN_LEN, MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_LEN, MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_CRC); -#else - mavlink_icarous_kinematic_bands_t *packet = (mavlink_icarous_kinematic_bands_t *)msgbuf; - packet->min1 = min1; - packet->max1 = max1; - packet->min2 = min2; - packet->max2 = max2; - packet->min3 = min3; - packet->max3 = max3; - packet->min4 = min4; - packet->max4 = max4; - packet->min5 = min5; - packet->max5 = max5; - packet->numBands = numBands; - packet->type1 = type1; - packet->type2 = type2; - packet->type3 = type3; - packet->type4 = type4; - packet->type5 = type5; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS, (const char *)packet, MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_MIN_LEN, MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_LEN, MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_CRC); -#endif -} -#endif - -#endif - -// MESSAGE ICAROUS_KINEMATIC_BANDS UNPACKING - - -/** - * @brief Get field numBands from icarous_kinematic_bands message - * - * @return Number of track bands - */ -static inline int8_t mavlink_msg_icarous_kinematic_bands_get_numBands(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int8_t(msg, 40); -} - -/** - * @brief Get field type1 from icarous_kinematic_bands message - * - * @return See the TRACK_BAND_TYPES enum. - */ -static inline uint8_t mavlink_msg_icarous_kinematic_bands_get_type1(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 41); -} - -/** - * @brief Get field min1 from icarous_kinematic_bands message - * - * @return [deg] min angle (degrees) - */ -static inline float mavlink_msg_icarous_kinematic_bands_get_min1(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 0); -} - -/** - * @brief Get field max1 from icarous_kinematic_bands message - * - * @return [deg] max angle (degrees) - */ -static inline float mavlink_msg_icarous_kinematic_bands_get_max1(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 4); -} - -/** - * @brief Get field type2 from icarous_kinematic_bands message - * - * @return See the TRACK_BAND_TYPES enum. - */ -static inline uint8_t mavlink_msg_icarous_kinematic_bands_get_type2(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 42); -} - -/** - * @brief Get field min2 from icarous_kinematic_bands message - * - * @return [deg] min angle (degrees) - */ -static inline float mavlink_msg_icarous_kinematic_bands_get_min2(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field max2 from icarous_kinematic_bands message - * - * @return [deg] max angle (degrees) - */ -static inline float mavlink_msg_icarous_kinematic_bands_get_max2(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Get field type3 from icarous_kinematic_bands message - * - * @return See the TRACK_BAND_TYPES enum. - */ -static inline uint8_t mavlink_msg_icarous_kinematic_bands_get_type3(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 43); -} - -/** - * @brief Get field min3 from icarous_kinematic_bands message - * - * @return [deg] min angle (degrees) - */ -static inline float mavlink_msg_icarous_kinematic_bands_get_min3(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 16); -} - -/** - * @brief Get field max3 from icarous_kinematic_bands message - * - * @return [deg] max angle (degrees) - */ -static inline float mavlink_msg_icarous_kinematic_bands_get_max3(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 20); -} - -/** - * @brief Get field type4 from icarous_kinematic_bands message - * - * @return See the TRACK_BAND_TYPES enum. - */ -static inline uint8_t mavlink_msg_icarous_kinematic_bands_get_type4(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 44); -} - -/** - * @brief Get field min4 from icarous_kinematic_bands message - * - * @return [deg] min angle (degrees) - */ -static inline float mavlink_msg_icarous_kinematic_bands_get_min4(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 24); -} - -/** - * @brief Get field max4 from icarous_kinematic_bands message - * - * @return [deg] max angle (degrees) - */ -static inline float mavlink_msg_icarous_kinematic_bands_get_max4(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 28); -} - -/** - * @brief Get field type5 from icarous_kinematic_bands message - * - * @return See the TRACK_BAND_TYPES enum. - */ -static inline uint8_t mavlink_msg_icarous_kinematic_bands_get_type5(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 45); -} - -/** - * @brief Get field min5 from icarous_kinematic_bands message - * - * @return [deg] min angle (degrees) - */ -static inline float mavlink_msg_icarous_kinematic_bands_get_min5(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 32); -} - -/** - * @brief Get field max5 from icarous_kinematic_bands message - * - * @return [deg] max angle (degrees) - */ -static inline float mavlink_msg_icarous_kinematic_bands_get_max5(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 36); -} - -/** - * @brief Decode a icarous_kinematic_bands message into a struct - * - * @param msg The message to decode - * @param icarous_kinematic_bands C-struct to decode the message contents into - */ -static inline void mavlink_msg_icarous_kinematic_bands_decode(const mavlink_message_t* msg, mavlink_icarous_kinematic_bands_t* icarous_kinematic_bands) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - icarous_kinematic_bands->min1 = mavlink_msg_icarous_kinematic_bands_get_min1(msg); - icarous_kinematic_bands->max1 = mavlink_msg_icarous_kinematic_bands_get_max1(msg); - icarous_kinematic_bands->min2 = mavlink_msg_icarous_kinematic_bands_get_min2(msg); - icarous_kinematic_bands->max2 = mavlink_msg_icarous_kinematic_bands_get_max2(msg); - icarous_kinematic_bands->min3 = mavlink_msg_icarous_kinematic_bands_get_min3(msg); - icarous_kinematic_bands->max3 = mavlink_msg_icarous_kinematic_bands_get_max3(msg); - icarous_kinematic_bands->min4 = mavlink_msg_icarous_kinematic_bands_get_min4(msg); - icarous_kinematic_bands->max4 = mavlink_msg_icarous_kinematic_bands_get_max4(msg); - icarous_kinematic_bands->min5 = mavlink_msg_icarous_kinematic_bands_get_min5(msg); - icarous_kinematic_bands->max5 = mavlink_msg_icarous_kinematic_bands_get_max5(msg); - icarous_kinematic_bands->numBands = mavlink_msg_icarous_kinematic_bands_get_numBands(msg); - icarous_kinematic_bands->type1 = mavlink_msg_icarous_kinematic_bands_get_type1(msg); - icarous_kinematic_bands->type2 = mavlink_msg_icarous_kinematic_bands_get_type2(msg); - icarous_kinematic_bands->type3 = mavlink_msg_icarous_kinematic_bands_get_type3(msg); - icarous_kinematic_bands->type4 = mavlink_msg_icarous_kinematic_bands_get_type4(msg); - icarous_kinematic_bands->type5 = mavlink_msg_icarous_kinematic_bands_get_type5(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_LEN? msg->len : MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_LEN; - memset(icarous_kinematic_bands, 0, MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_LEN); - memcpy(icarous_kinematic_bands, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/icarous/testsuite.h b/icarous/testsuite.h deleted file mode 100644 index 5c499a481..000000000 --- a/icarous/testsuite.h +++ /dev/null @@ -1,160 +0,0 @@ -/** @file - * @brief MAVLink comm protocol testsuite generated from icarous.xml - * @see http://qgroundcontrol.org/mavlink/ - */ -#pragma once -#ifndef ICAROUS_TESTSUITE_H -#define ICAROUS_TESTSUITE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef MAVLINK_TEST_ALL -#define MAVLINK_TEST_ALL - -static void mavlink_test_icarous(uint8_t, uint8_t, mavlink_message_t *last_msg); - -static void mavlink_test_all(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) -{ - - mavlink_test_icarous(system_id, component_id, last_msg); -} -#endif - - - - -static void mavlink_test_icarous_heartbeat(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) -{ -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); - if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ICAROUS_HEARTBEAT >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_icarous_heartbeat_t packet_in = { - 5 - }; - mavlink_icarous_heartbeat_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.status = packet_in.status; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_ICAROUS_HEARTBEAT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ICAROUS_HEARTBEAT_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_icarous_heartbeat_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_icarous_heartbeat_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_icarous_heartbeat_pack(system_id, component_id, &msg , packet1.status ); - mavlink_msg_icarous_heartbeat_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_icarous_heartbeat_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.status ); - mavlink_msg_icarous_heartbeat_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_icarous_kinematic_bands_t packet_in = { - 17.0,45.0,73.0,101.0,129.0,157.0,185.0,213.0,241.0,269.0,125,192,3,70,137,204 - }; - mavlink_icarous_kinematic_bands_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.min1 = packet_in.min1; - packet1.max1 = packet_in.max1; - packet1.min2 = packet_in.min2; - packet1.max2 = packet_in.max2; - packet1.min3 = packet_in.min3; - packet1.max3 = packet_in.max3; - packet1.min4 = packet_in.min4; - packet1.max4 = packet_in.max4; - packet1.min5 = packet_in.min5; - packet1.max5 = packet_in.max5; - packet1.numBands = packet_in.numBands; - packet1.type1 = packet_in.type1; - packet1.type2 = packet_in.type2; - packet1.type3 = packet_in.type3; - packet1.type4 = packet_in.type4; - packet1.type5 = packet_in.type5; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ICAROUS_KINEMATIC_BANDS_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_icarous_kinematic_bands_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_icarous_kinematic_bands_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_icarous_kinematic_bands_pack(system_id, component_id, &msg , packet1.numBands , packet1.type1 , packet1.min1 , packet1.max1 , packet1.type2 , packet1.min2 , packet1.max2 , packet1.type3 , packet1.min3 , packet1.max3 , packet1.type4 , packet1.min4 , packet1.max4 , packet1.type5 , packet1.min5 , packet1.max5 ); - mavlink_msg_icarous_kinematic_bands_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_icarous_kinematic_bands_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.numBands , packet1.type1 , packet1.min1 , packet1.max1 , packet1.type2 , packet1.min2 , packet1.max2 , packet1.type3 , packet1.min3 , packet1.max3 , packet1.type4 , packet1.min4 , packet1.max4 , packet1.type5 , packet1.min5 , packet1.max5 ); - mavlink_msg_icarous_kinematic_bands_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; i 0 radius to pass by WP. Positive value for clockwise orbit, negative value for counter-clockwise orbit. Allows trajectory control.| Desired yaw angle at waypoint (rotary wing). NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_LOITER_UNLIM=17, /* Loiter around this waypoint an unlimited amount of time |Empty| Empty| Loiter radius around waypoint for forward-only moving vehicles (not multicopters). If positive loiter clockwise, else counter-clockwise| Desired yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_LOITER_TURNS=18, /* Loiter around this waypoint for X turns |Number of turns.| Leave loiter circle only once heading towards the next waypoint (0 = False)| Loiter radius around waypoint for forward-only moving vehicles (not multicopters). If positive loiter clockwise, else counter-clockwise| Loiter circle exit location and/or path to next waypoint ("xtrack") for forward-only moving vehicles (not multicopters). 0 for the vehicle to converge towards the center xtrack when it leaves the loiter (the line between the centers of the current and next waypoint), 1 to converge to the direct line between the location that the vehicle exits the loiter radius and the next waypoint. Otherwise the angle (in degrees) between the tangent of the loiter circle and the center xtrack at which the vehicle must leave the loiter (and converge to the center xtrack). NaN to use the current system default xtrack behaviour.| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_LOITER_TIME=19, /* Loiter at the specified latitude, longitude and altitude for a certain amount of time. Multicopter vehicles stop at the point (within a vehicle-specific acceptance radius). Forward-only moving vehicles (e.g. fixed-wing) circle the point with the specified radius/direction. If the Heading Required parameter (2) is non-zero forward moving aircraft will only leave the loiter circle once heading towards the next waypoint. |Loiter time (only starts once Lat, Lon and Alt is reached).| Leave loiter circle only once heading towards the next waypoint (0 = False)| Loiter radius around waypoint for forward-only moving vehicles (not multicopters). If positive loiter clockwise, else counter-clockwise.| Loiter circle exit location and/or path to next waypoint ("xtrack") for forward-only moving vehicles (not multicopters). 0 for the vehicle to converge towards the center xtrack when it leaves the loiter (the line between the centers of the current and next waypoint), 1 to converge to the direct line between the location that the vehicle exits the loiter radius and the next waypoint. Otherwise the angle (in degrees) between the tangent of the loiter circle and the center xtrack at which the vehicle must leave the loiter (and converge to the center xtrack). NaN to use the current system default xtrack behaviour.| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_RETURN_TO_LAUNCH=20, /* Return to launch location |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_NAV_LAND=21, /* Land at location. |Minimum target altitude if landing is aborted (0 = undefined/use system default).| Precision land mode.| Empty.| Desired yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude.| Longitude.| Landing altitude (ground level in current frame).| */ - MAV_CMD_NAV_TAKEOFF=22, /* Takeoff from ground / hand. Vehicles that support multiple takeoff modes (e.g. VTOL quadplane) should take off using the currently configured mode. |Minimum pitch (if airspeed sensor present), desired pitch without sensor| Empty| Empty| Yaw angle (if magnetometer present), ignored without magnetometer. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_LAND_LOCAL=23, /* Land at local position (local frame only) |Landing target number (if available)| Maximum accepted offset from desired landing position - computed magnitude from spherical coordinates: d = sqrt(x^2 + y^2 + z^2), which gives the maximum accepted distance between the desired landing position and the position where the vehicle is about to land| Landing descend rate| Desired yaw angle| Y-axis position| X-axis position| Z-axis / ground level position| */ - MAV_CMD_NAV_TAKEOFF_LOCAL=24, /* Takeoff from local position (local frame only) |Minimum pitch (if airspeed sensor present), desired pitch without sensor| Empty| Takeoff ascend rate| Yaw angle (if magnetometer or another yaw estimation source present), ignored without one of these| Y-axis position| X-axis position| Z-axis position| */ - MAV_CMD_NAV_FOLLOW=25, /* Vehicle following, i.e. this waypoint represents the position of a moving vehicle |Following logic to use (e.g. loitering or sinusoidal following) - depends on specific autopilot implementation| Ground speed of vehicle to be followed| Radius around waypoint. If positive loiter clockwise, else counter-clockwise| Desired yaw angle.| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_CONTINUE_AND_CHANGE_ALT=30, /* Continue on the current course and climb/descend to specified altitude. When the altitude is reached continue to the next command (i.e., don't proceed to the next command until the desired altitude is reached. |Climb or Descend (0 = Neutral, command completes when within 5m of this command's altitude, 1 = Climbing, command completes when at or above this command's altitude, 2 = Descending, command completes when at or below this command's altitude.| Empty| Empty| Empty| Empty| Empty| Desired altitude| */ - MAV_CMD_NAV_LOITER_TO_ALT=31, /* Begin loiter at the specified Latitude and Longitude. If Lat=Lon=0, then loiter at the current position. Don't consider the navigation command complete (don't leave loiter) until the altitude has been reached. Additionally, if the Heading Required parameter is non-zero the aircraft will not leave the loiter until heading toward the next waypoint. |Leave loiter circle only once heading towards the next waypoint (0 = False)| Loiter radius around waypoint for forward-only moving vehicles (not multicopters). If positive loiter clockwise, negative counter-clockwise, 0 means no change to standard loiter.| Empty| Loiter circle exit location and/or path to next waypoint ("xtrack") for forward-only moving vehicles (not multicopters). 0 for the vehicle to converge towards the center xtrack when it leaves the loiter (the line between the centers of the current and next waypoint), 1 to converge to the direct line between the location that the vehicle exits the loiter radius and the next waypoint. Otherwise the angle (in degrees) between the tangent of the loiter circle and the center xtrack at which the vehicle must leave the loiter (and converge to the center xtrack). NaN to use the current system default xtrack behaviour.| Latitude| Longitude| Altitude| */ - MAV_CMD_DO_FOLLOW=32, /* Begin following a target |System ID (of the FOLLOW_TARGET beacon). Send 0 to disable follow-me and return to the default position hold mode.| Reserved| Reserved| Altitude mode: 0: Keep current altitude, 1: keep altitude difference to target, 2: go to a fixed altitude above home.| Altitude above home. (used if mode=2)| Reserved| Time to land in which the MAV should go to the default position hold mode after a message RX timeout.| */ - MAV_CMD_DO_FOLLOW_REPOSITION=33, /* Reposition the MAV after a follow target command has been sent |Camera q1 (where 0 is on the ray from the camera to the tracking device)| Camera q2| Camera q3| Camera q4| altitude offset from target| X offset from target| Y offset from target| */ - MAV_CMD_DO_ORBIT=34, /* Start orbiting on the circumference of a circle defined by the parameters. Setting any value NaN results in using defaults. |Radius of the circle. positive: Orbit clockwise. negative: Orbit counter-clockwise.| Tangential Velocity. NaN: Vehicle configuration default.| Yaw behavior of the vehicle.| Reserved (e.g. for dynamic center beacon options)| Center point latitude (if no MAV_FRAME specified) / X coordinate according to MAV_FRAME. NaN: Use current vehicle position or current center if already orbiting.| Center point longitude (if no MAV_FRAME specified) / Y coordinate according to MAV_FRAME. NaN: Use current vehicle position or current center if already orbiting.| Center point altitude (MSL) (if no MAV_FRAME specified) / Z coordinate according to MAV_FRAME. NaN: Use current vehicle position or current center if already orbiting.| */ - MAV_CMD_NAV_ROI=80, /* Sets the region of interest (ROI) for a sensor set or the vehicle itself. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. |Region of interest mode.| Waypoint index/ target ID. (see MAV_ROI enum)| ROI index (allows a vehicle to manage multiple ROI's)| Empty| x the location of the fixed ROI (see MAV_FRAME)| y| z| */ - MAV_CMD_NAV_PATHPLANNING=81, /* Control autonomous path planning on the MAV. |0: Disable local obstacle avoidance / local path planning (without resetting map), 1: Enable local path planning, 2: Enable and reset local path planning| 0: Disable full path planning (without resetting map), 1: Enable, 2: Enable and reset map/occupancy grid, 3: Enable and reset planned route, but not occupancy grid| Empty| Yaw angle at goal| Latitude/X of goal| Longitude/Y of goal| Altitude/Z of goal| */ - MAV_CMD_NAV_SPLINE_WAYPOINT=82, /* Navigate to waypoint using a spline path. |Hold time. (ignored by fixed wing, time to stay at waypoint for rotary wing)| Empty| Empty| Empty| Latitude/X of goal| Longitude/Y of goal| Altitude/Z of goal| */ - MAV_CMD_NAV_VTOL_TAKEOFF=84, /* Takeoff from ground using VTOL mode, and transition to forward flight with specified heading. The command should be ignored by vehicles that dont support both VTOL and fixed-wing flight (multicopters, boats,etc.). |Empty| Front transition heading.| Empty| Yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_VTOL_LAND=85, /* Land using VTOL mode |Empty| Empty| Approach altitude (with the same reference as the Altitude field). NaN if unspecified.| Yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).| Latitude| Longitude| Altitude (ground level)| */ - MAV_CMD_NAV_GUIDED_ENABLE=92, /* hand control over to an external controller |On / Off (> 0.5f on)| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_NAV_DELAY=93, /* Delay the next navigation command a number of seconds or until a specified time |Delay (-1 to enable time-of-day fields)| hour (24h format, UTC, -1 to ignore)| minute (24h format, UTC, -1 to ignore)| second (24h format, UTC, -1 to ignore)| Empty| Empty| Empty| */ - MAV_CMD_NAV_PAYLOAD_PLACE=94, /* Descend and place payload. Vehicle moves to specified location, descends until it detects a hanging payload has reached the ground, and then releases the payload. If ground is not detected before the reaching the maximum descent value (param1), the command will complete without releasing the payload. |Maximum distance to descend.| Empty| Empty| Empty| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_LAST=95, /* NOP - This command is only used to mark the upper limit of the NAV/ACTION commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_CONDITION_DELAY=112, /* Delay mission state machine. |Delay| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_CONDITION_CHANGE_ALT=113, /* Ascend/descend to target altitude at specified rate. Delay mission state machine until desired altitude reached. |Descent / Ascend rate.| Empty| Empty| Empty| Empty| Empty| Target Altitude| */ - MAV_CMD_CONDITION_DISTANCE=114, /* Delay mission state machine until within desired distance of next NAV point. |Distance.| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_CONDITION_YAW=115, /* Reach a certain target angle. |target angle, 0 is north| angular speed| direction: -1: counter clockwise, 1: clockwise| 0: absolute angle, 1: relative offset| Empty| Empty| Empty| */ - MAV_CMD_CONDITION_LAST=159, /* NOP - This command is only used to mark the upper limit of the CONDITION commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_MODE=176, /* Set system mode. |Mode| Custom mode - this is system specific, please refer to the individual autopilot specifications for details.| Custom sub mode - this is system specific, please refer to the individual autopilot specifications for details.| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_JUMP=177, /* Jump to the desired command in the mission list. Repeat this action only the specified number of times |Sequence number| Repeat count| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_CHANGE_SPEED=178, /* Change speed and/or throttle set points. |Speed type (0=Airspeed, 1=Ground Speed, 2=Climb Speed, 3=Descent Speed)| Speed (-1 indicates no change)| Throttle (-1 indicates no change)| 0: absolute, 1: relative| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_HOME=179, /* Changes the home location either to the current location or a specified location. |Use current (1=use current location, 0=use specified location)| Empty| Empty| Yaw angle. NaN to use default heading| Latitude| Longitude| Altitude| */ - MAV_CMD_DO_SET_PARAMETER=180, /* Set a system parameter. Caution! Use of this command requires knowledge of the numeric enumeration value of the parameter. |Parameter number| Parameter value| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_RELAY=181, /* Set a relay to a condition. |Relay instance number.| Setting. (1=on, 0=off, others possible depending on system hardware)| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_REPEAT_RELAY=182, /* Cycle a relay on and off for a desired number of cycles with a desired period. |Relay instance number.| Cycle count.| Cycle time.| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_SERVO=183, /* Set a servo to a desired PWM value. |Servo instance number.| Pulse Width Modulation.| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_REPEAT_SERVO=184, /* Cycle a between its nominal setting and a desired PWM for a desired number of cycles with a desired period. |Servo instance number.| Pulse Width Modulation.| Cycle count.| Cycle time.| Empty| Empty| Empty| */ - MAV_CMD_DO_FLIGHTTERMINATION=185, /* Terminate flight immediately |Flight termination activated if > 0.5| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_CHANGE_ALTITUDE=186, /* Change altitude set point. |Altitude.| Frame of new altitude.| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_ACTUATOR=187, /* Sets actuators (e.g. servos) to a desired value. The actuator numbers are mapped to specific outputs (e.g. on any MAIN or AUX PWM or UAVCAN) using a flight-stack specific mechanism (i.e. a parameter). |Actuator 1 value, scaled from [-1 to 1]. NaN to ignore.| Actuator 2 value, scaled from [-1 to 1]. NaN to ignore.| Actuator 3 value, scaled from [-1 to 1]. NaN to ignore.| Actuator 4 value, scaled from [-1 to 1]. NaN to ignore.| Actuator 5 value, scaled from [-1 to 1]. NaN to ignore.| Actuator 6 value, scaled from [-1 to 1]. NaN to ignore.| Index of actuator set (i.e if set to 1, Actuator 1 becomes Actuator 7)| */ - MAV_CMD_DO_LAND_START=189, /* Mission command to perform a landing. This is used as a marker in a mission to tell the autopilot where a sequence of mission items that represents a landing starts. It may also be sent via a COMMAND_LONG to trigger a landing, in which case the nearest (geographically) landing sequence in the mission will be used. The Latitude/Longitude is optional, and may be set to 0 if not needed. If specified then it will be used to help find the closest landing sequence. |Empty| Empty| Empty| Empty| Latitude| Longitude| Empty| */ - MAV_CMD_DO_RALLY_LAND=190, /* Mission command to perform a landing from a rally point. |Break altitude| Landing speed| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_GO_AROUND=191, /* Mission command to safely abort an autonomous landing. |Altitude| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_REPOSITION=192, /* Reposition the vehicle to a specific WGS84 global position. |Ground speed, less than 0 (-1) for default| Bitmask of option flags.| Reserved| Yaw heading. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.). For planes indicates loiter direction (0: clockwise, 1: counter clockwise)| Latitude| Longitude| Altitude| */ - MAV_CMD_DO_PAUSE_CONTINUE=193, /* If in a GPS controlled position mode, hold the current position or continue. |0: Pause current mission or reposition command, hold current position. 1: Continue mission. A VTOL capable vehicle should enter hover mode (multicopter and VTOL planes). A plane should loiter with the default loiter radius.| Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| */ - MAV_CMD_DO_SET_REVERSE=194, /* Set moving direction to forward or reverse. |Direction (0=Forward, 1=Reverse)| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_ROI_LOCATION=195, /* Sets the region of interest (ROI) to a location. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. This command can be sent to a gimbal manager but not to a gimbal device. A gimbal is not to react to this message. |Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| Empty| Empty| Empty| Latitude of ROI location| Longitude of ROI location| Altitude of ROI location| */ - MAV_CMD_DO_SET_ROI_WPNEXT_OFFSET=196, /* Sets the region of interest (ROI) to be toward next waypoint, with optional pitch/roll/yaw offset. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. This command can be sent to a gimbal manager but not to a gimbal device. A gimbal device is not to react to this message. |Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| Empty| Empty| Empty| Pitch offset from next waypoint, positive pitching up| Roll offset from next waypoint, positive rolling to the right| Yaw offset from next waypoint, positive yawing to the right| */ - MAV_CMD_DO_SET_ROI_NONE=197, /* Cancels any previous ROI command returning the vehicle/sensors to default flight characteristics. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. This command can be sent to a gimbal manager but not to a gimbal device. A gimbal device is not to react to this message. After this command the gimbal manager should go back to manual input if available, and otherwise assume a neutral position. |Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_ROI_SYSID=198, /* Mount tracks system with specified system ID. Determination of target vehicle position may be done with GLOBAL_POSITION_INT or any other means. This command can be sent to a gimbal manager but not to a gimbal device. A gimbal device is not to react to this message. |System ID| Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_DO_CONTROL_VIDEO=200, /* Control onboard camera system. |Camera ID (-1 for all)| Transmission: 0: disabled, 1: enabled compressed, 2: enabled raw| Transmission mode: 0: video stream, >0: single images every n seconds| Recording: 0: disabled, 1: enabled compressed, 2: enabled raw| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_ROI=201, /* Sets the region of interest (ROI) for a sensor set or the vehicle itself. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. |Region of interest mode.| Waypoint index/ target ID (depends on param 1).| Region of interest index. (allows a vehicle to manage multiple ROI's)| Empty| MAV_ROI_WPNEXT: pitch offset from next waypoint, MAV_ROI_LOCATION: latitude| MAV_ROI_WPNEXT: roll offset from next waypoint, MAV_ROI_LOCATION: longitude| MAV_ROI_WPNEXT: yaw offset from next waypoint, MAV_ROI_LOCATION: altitude| */ - MAV_CMD_DO_DIGICAM_CONFIGURE=202, /* Configure digital camera. This is a fallback message for systems that have not yet implemented PARAM_EXT_XXX messages and camera definition files (see https://mavlink.io/en/services/camera_def.html ). |Modes: P, TV, AV, M, Etc.| Shutter speed: Divisor number for one second.| Aperture: F stop number.| ISO number e.g. 80, 100, 200, Etc.| Exposure type enumerator.| Command Identity.| Main engine cut-off time before camera trigger. (0 means no cut-off)| */ - MAV_CMD_DO_DIGICAM_CONTROL=203, /* Control digital camera. This is a fallback message for systems that have not yet implemented PARAM_EXT_XXX messages and camera definition files (see https://mavlink.io/en/services/camera_def.html ). |Session control e.g. show/hide lens| Zoom's absolute position| Zooming step value to offset zoom from the current position| Focus Locking, Unlocking or Re-locking| Shooting Command| Command Identity| Test shot identifier. If set to 1, image will only be captured, but not counted towards internal frame count.| */ - MAV_CMD_DO_MOUNT_CONFIGURE=204, /* Mission command to configure a camera or antenna mount |Mount operation mode| stabilize roll? (1 = yes, 0 = no)| stabilize pitch? (1 = yes, 0 = no)| stabilize yaw? (1 = yes, 0 = no)| roll input (0 = angle body frame, 1 = angular rate, 2 = angle absolute frame)| pitch input (0 = angle body frame, 1 = angular rate, 2 = angle absolute frame)| yaw input (0 = angle body frame, 1 = angular rate, 2 = angle absolute frame)| */ - MAV_CMD_DO_MOUNT_CONTROL=205, /* Mission command to control a camera or antenna mount |pitch depending on mount mode (degrees or degrees/second depending on pitch input).| roll depending on mount mode (degrees or degrees/second depending on roll input).| yaw depending on mount mode (degrees or degrees/second depending on yaw input).| altitude depending on mount mode.| latitude, set if appropriate mount mode.| longitude, set if appropriate mount mode.| Mount mode.| */ - MAV_CMD_DO_SET_CAM_TRIGG_DIST=206, /* Mission command to set camera trigger distance for this flight. The camera is triggered each time this distance is exceeded. This command can also be used to set the shutter integration time for the camera. |Camera trigger distance. 0 to stop triggering.| Camera shutter integration time. -1 or 0 to ignore| Trigger camera once immediately. (0 = no trigger, 1 = trigger)| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_FENCE_ENABLE=207, /* Mission command to enable the geofence |enable? (0=disable, 1=enable, 2=disable_floor_only)| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_PARACHUTE=208, /* Mission item/command to release a parachute or enable/disable auto release. |Action| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_MOTOR_TEST=209, /* Mission command to perform motor test. |Motor instance number. (from 1 to max number of motors on the vehicle)| Throttle type.| Throttle.| Timeout.| Motor count. (number of motors to test to test in sequence, waiting for the timeout above between them; 0=1 motor, 1=1 motor, 2=2 motors...)| Motor test order.| Empty| */ - MAV_CMD_DO_INVERTED_FLIGHT=210, /* Change to/from inverted flight. |Inverted flight. (0=normal, 1=inverted)| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_GRIPPER=211, /* Mission command to operate a gripper. |Gripper instance number.| Gripper action to perform.| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_AUTOTUNE_ENABLE=212, /* Enable/disable autotune. |Enable (1: enable, 0:disable).| Empty.| Empty.| Empty.| Empty.| Empty.| Empty.| */ - MAV_CMD_NAV_SET_YAW_SPEED=213, /* Sets a desired vehicle turn angle and speed change. |Yaw angle to adjust steering by.| Speed.| Final angle. (0=absolute, 1=relative)| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_CAM_TRIGG_INTERVAL=214, /* Mission command to set camera trigger interval for this flight. If triggering is enabled, the camera is triggered each time this interval expires. This command can also be used to set the shutter integration time for the camera. |Camera trigger cycle time. -1 or 0 to ignore.| Camera shutter integration time. Should be less than trigger cycle time. -1 or 0 to ignore.| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_MOUNT_CONTROL_QUAT=220, /* Mission command to control a camera or antenna mount, using a quaternion as reference. |quaternion param q1, w (1 in null-rotation)| quaternion param q2, x (0 in null-rotation)| quaternion param q3, y (0 in null-rotation)| quaternion param q4, z (0 in null-rotation)| Empty| Empty| Empty| */ - MAV_CMD_DO_GUIDED_MASTER=221, /* set id of master controller |System ID| Component ID| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_GUIDED_LIMITS=222, /* Set limits for external control |Timeout - maximum time that external controller will be allowed to control vehicle. 0 means no timeout.| Altitude (MSL) min - if vehicle moves below this alt, the command will be aborted and the mission will continue. 0 means no lower altitude limit.| Altitude (MSL) max - if vehicle moves above this alt, the command will be aborted and the mission will continue. 0 means no upper altitude limit.| Horizontal move limit - if vehicle moves more than this distance from its location at the moment the command was executed, the command will be aborted and the mission will continue. 0 means no horizontal move limit.| Empty| Empty| Empty| */ - MAV_CMD_DO_ENGINE_CONTROL=223, /* Control vehicle engine. This is interpreted by the vehicles engine controller to change the target engine state. It is intended for vehicles with internal combustion engines |0: Stop engine, 1:Start Engine| 0: Warm start, 1:Cold start. Controls use of choke where applicable| Height delay. This is for commanding engine start only after the vehicle has gained the specified height. Used in VTOL vehicles during takeoff to start engine after the aircraft is off the ground. Zero for no delay.| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_SET_MISSION_CURRENT=224, /* Set the mission item with sequence number seq as current item. This means that the MAV will continue to this mission item on the shortest path (not following the mission items in-between). |Mission sequence value to set| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_DO_LAST=240, /* NOP - This command is only used to mark the upper limit of the DO commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_PREFLIGHT_CALIBRATION=241, /* Trigger calibration. This command will be only accepted if in pre-flight mode. Except for Temperature Calibration, only one sensor should be set in a single message and all others should be zero. |1: gyro calibration, 3: gyro temperature calibration| 1: magnetometer calibration| 1: ground pressure calibration| 1: radio RC calibration, 2: RC trim calibration| 1: accelerometer calibration, 2: board level calibration, 3: accelerometer temperature calibration, 4: simple accelerometer calibration| 1: APM: compass/motor interference calibration (PX4: airspeed calibration, deprecated), 2: airspeed calibration| 1: ESC calibration, 3: barometer temperature calibration| */ - MAV_CMD_PREFLIGHT_SET_SENSOR_OFFSETS=242, /* Set sensor offsets. This command will be only accepted if in pre-flight mode. |Sensor to adjust the offsets for: 0: gyros, 1: accelerometer, 2: magnetometer, 3: barometer, 4: optical flow, 5: second magnetometer, 6: third magnetometer| X axis offset (or generic dimension 1), in the sensor's raw units| Y axis offset (or generic dimension 2), in the sensor's raw units| Z axis offset (or generic dimension 3), in the sensor's raw units| Generic dimension 4, in the sensor's raw units| Generic dimension 5, in the sensor's raw units| Generic dimension 6, in the sensor's raw units| */ - MAV_CMD_PREFLIGHT_UAVCAN=243, /* Trigger UAVCAN configuration (actuator ID assignment and direction mapping). Note that this maps to the legacy UAVCAN v0 function UAVCAN_ENUMERATE, which is intended to be executed just once during initial vehicle configuration (it is not a normal pre-flight command and has been poorly named). |1: Trigger actuator ID assignment and direction mapping. 0: Cancel command.| Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| */ - MAV_CMD_PREFLIGHT_STORAGE=245, /* Request storage of different parameter values and logs. This command will be only accepted if in pre-flight mode. |Parameter storage: 0: READ FROM FLASH/EEPROM, 1: WRITE CURRENT TO FLASH/EEPROM, 2: Reset to defaults| Mission storage: 0: READ FROM FLASH/EEPROM, 1: WRITE CURRENT TO FLASH/EEPROM, 2: Reset to defaults| Onboard logging: 0: Ignore, 1: Start default rate logging, -1: Stop logging, > 1: logging rate (e.g. set to 1000 for 1000 Hz logging)| Reserved| Empty| Empty| Empty| */ - MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN=246, /* Request the reboot or shutdown of system components. |0: Do nothing for autopilot, 1: Reboot autopilot, 2: Shutdown autopilot, 3: Reboot autopilot and keep it in the bootloader until upgraded.| 0: Do nothing for onboard computer, 1: Reboot onboard computer, 2: Shutdown onboard computer, 3: Reboot onboard computer and keep it in the bootloader until upgraded.| WIP: 0: Do nothing for camera, 1: Reboot onboard camera, 2: Shutdown onboard camera, 3: Reboot onboard camera and keep it in the bootloader until upgraded| WIP: 0: Do nothing for mount (e.g. gimbal), 1: Reboot mount, 2: Shutdown mount, 3: Reboot mount and keep it in the bootloader until upgraded| Reserved (set to 0)| Reserved (set to 0)| WIP: ID (e.g. camera ID -1 for all IDs)| */ - MAV_CMD_DO_UPGRADE=247, /* Request a target system to start an upgrade of one (or all) of its components. For example, the command might be sent to a companion computer to cause it to upgrade a connected flight controller. The system doing the upgrade will report progress using the normal command protocol sequence for a long running operation. Command protocol information: https://mavlink.io/en/services/command.html. |Component id of the component to be upgraded. If set to 0, all components should be upgraded.| 0: Do not reboot component after the action is executed, 1: Reboot component after the action is executed.| Reserved| Reserved| Reserved| Reserved| WIP: upgrade progress report rate (can be used for more granular control).| */ - MAV_CMD_OVERRIDE_GOTO=252, /* Override current mission with command to pause mission, pause mission and move to position, continue/resume mission. When param 1 indicates that the mission is paused (MAV_GOTO_DO_HOLD), param 2 defines whether it holds in place or moves to another position. |MAV_GOTO_DO_HOLD: pause mission and either hold or move to specified position (depending on param2), MAV_GOTO_DO_CONTINUE: resume mission.| MAV_GOTO_HOLD_AT_CURRENT_POSITION: hold at current position, MAV_GOTO_HOLD_AT_SPECIFIED_POSITION: hold at specified position.| Coordinate frame of hold point.| Desired yaw angle.| Latitude/X position.| Longitude/Y position.| Altitude/Z position.| */ - MAV_CMD_OBLIQUE_SURVEY=260, /* Mission command to set a Camera Auto Mount Pivoting Oblique Survey (Replaces CAM_TRIGG_DIST for this purpose). The camera is triggered each time this distance is exceeded, then the mount moves to the next position. Params 4~6 set-up the angle limits and number of positions for oblique survey, where mount-enabled vehicles automatically roll the camera between shots to emulate an oblique camera setup (providing an increased HFOV). This command can also be used to set the shutter integration time for the camera. |Camera trigger distance. 0 to stop triggering.| Camera shutter integration time. 0 to ignore| The minimum interval in which the camera is capable of taking subsequent pictures repeatedly. 0 to ignore.| Total number of roll positions at which the camera will capture photos (images captures spread evenly across the limits defined by param5).| Angle limits that the camera can be rolled to left and right of center.| Fixed pitch angle that the camera will hold in oblique mode if the mount is actuated in the pitch axis.| Empty| */ - MAV_CMD_MISSION_START=300, /* start running a mission |first_item: the first mission item to run| last_item: the last mission item to run (after this item is run, the mission ends)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_COMPONENT_ARM_DISARM=400, /* Arms / Disarms a component |0: disarm, 1: arm| 0: arm-disarm unless prevented by safety checks (i.e. when landed), 21196: force arming/disarming (e.g. allow arming to override preflight checks and disarming in flight)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_ILLUMINATOR_ON_OFF=405, /* Turns illuminators ON/OFF. An illuminator is a light source that is used for lighting up dark areas external to the sytstem: e.g. a torch or searchlight (as opposed to a light source for illuminating the system itself, e.g. an indicator light). |0: Illuminators OFF, 1: Illuminators ON| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_GET_HOME_POSITION=410, /* Request the home position from the vehicle. |Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| */ - MAV_CMD_INJECT_FAILURE=420, /* Inject artificial failure for testing purposes. Note that autopilots should implement an additional protection before accepting this command such as a specific param setting. |The unit which is affected by the failure.| The type how the failure manifests itself.| Instance affected by failure (0 to signal all).| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_START_RX_PAIR=500, /* Starts receiver pairing. |0:Spektrum.| RC type.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_GET_MESSAGE_INTERVAL=510, /* Request the interval between messages for a particular MAVLink message ID. The receiver should ACK the command and then emit its response in a MESSAGE_INTERVAL message. |The MAVLink message ID| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_SET_MESSAGE_INTERVAL=511, /* Set the interval between messages for a particular MAVLink message ID. This interface replaces REQUEST_DATA_STREAM. |The MAVLink message ID| The interval between two messages. Set to -1 to disable and 0 to request default rate.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Target address of message stream (if message has target address fields). 0: Flight-stack default (recommended), 1: address of requestor, 2: broadcast.| */ - MAV_CMD_REQUEST_MESSAGE=512, /* Request the target system(s) emit a single instance of a specified message (i.e. a "one-shot" version of MAV_CMD_SET_MESSAGE_INTERVAL). |The MAVLink message ID of the requested message.| Use for index ID, if required. Otherwise, the use of this parameter (if any) must be defined in the requested message. By default assumed not used (0).| The use of this parameter (if any), must be defined in the requested message. By default assumed not used (0).| The use of this parameter (if any), must be defined in the requested message. By default assumed not used (0).| The use of this parameter (if any), must be defined in the requested message. By default assumed not used (0).| The use of this parameter (if any), must be defined in the requested message. By default assumed not used (0).| Target address for requested message (if message has target address fields). 0: Flight-stack default, 1: address of requestor, 2: broadcast.| */ - MAV_CMD_REQUEST_PROTOCOL_VERSION=519, /* Request MAVLink protocol version compatibility. All receivers should ACK the command and then emit their capabilities in an PROTOCOL_VERSION message |1: Request supported protocol versions by all nodes on the network| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES=520, /* Request autopilot capabilities. The receiver should ACK the command and then emit its capabilities in an AUTOPILOT_VERSION message |1: Request autopilot version| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_CAMERA_INFORMATION=521, /* Request camera information (CAMERA_INFORMATION). |0: No action 1: Request camera capabilities| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_CAMERA_SETTINGS=522, /* Request camera settings (CAMERA_SETTINGS). |0: No Action 1: Request camera settings| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_STORAGE_INFORMATION=525, /* Request storage information (STORAGE_INFORMATION). Use the command's target_component to target a specific component's storage. |Storage ID (0 for all, 1 for first, 2 for second, etc.)| 0: No Action 1: Request storage information| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_STORAGE_FORMAT=526, /* Format a storage medium. Once format is complete, a STORAGE_INFORMATION message is sent. Use the command's target_component to target a specific component's storage. |Storage ID (1 for first, 2 for second, etc.)| Format storage (and reset image log). 0: No action 1: Format storage| Reset Image Log (without formatting storage medium). This will reset CAMERA_CAPTURE_STATUS.image_count and CAMERA_IMAGE_CAPTURED.image_index. 0: No action 1: Reset Image Log| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_CAMERA_CAPTURE_STATUS=527, /* Request camera capture status (CAMERA_CAPTURE_STATUS) |0: No Action 1: Request camera capture status| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_FLIGHT_INFORMATION=528, /* Request flight information (FLIGHT_INFORMATION) |1: Request flight information| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_RESET_CAMERA_SETTINGS=529, /* Reset all camera settings to Factory Default |0: No Action 1: Reset all settings| Reserved (all remaining params)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_SET_CAMERA_MODE=530, /* Set camera running mode. Use NaN for reserved values. GCS will send a MAV_CMD_REQUEST_VIDEO_STREAM_STATUS command after a mode change if the camera supports video streaming. |Reserved (Set to 0)| Camera mode| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ - MAV_CMD_SET_CAMERA_ZOOM=531, /* Set camera zoom. Camera must respond with a CAMERA_SETTINGS message (on success). |Zoom type| Zoom value. The range of valid values depend on the zoom type.| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ - MAV_CMD_SET_CAMERA_FOCUS=532, /* Set camera focus. Camera must respond with a CAMERA_SETTINGS message (on success). |Focus type| Focus value| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ - MAV_CMD_JUMP_TAG=600, /* Tagged jump target. Can be jumped to with MAV_CMD_DO_JUMP_TAG. |Tag.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_DO_JUMP_TAG=601, /* Jump to the matching tag in the mission list. Repeat this action for the specified number of times. A mission should contain a single matching tag for each jump. If this is not the case then a jump to a missing tag should complete the mission, and a jump where there are multiple matching tags should always select the one with the lowest mission sequence number. |Target tag to jump to.| Repeat count.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_PARAM_TRANSACTION=900, /* Request to start or end a parameter transaction. Multiple kinds of transport layers can be used to exchange parameters in the transaction (param, param_ext and mavftp). The command response can either be a success/failure or an in progress in case the receiving side takes some time to apply the parameters. |Action to be performed (start, commit, cancel, etc.)| Possible transport layers to set and get parameters via mavlink during a parameter transaction.| Identifier for a specific transaction.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_DO_GIMBAL_MANAGER_PITCHYAW=1000, /* High level setpoint to be sent to a gimbal manager to set a gimbal attitude. It is possible to set combinations of the values below. E.g. an angle as well as a desired angular rate can be used to get to this angle at a certain angular rate, or an angular rate only will result in continuous turning. NaN is to be used to signal unset. Note: a gimbal is never to react to this command but only the gimbal manager. |Pitch angle (positive to pitch up, relative to vehicle for FOLLOW mode, relative to world horizon for LOCK mode).| Yaw angle (positive to yaw to the right, relative to vehicle for FOLLOW mode, absolute to North for LOCK mode).| Pitch rate (positive to pitch up).| Yaw rate (positive to yaw to the right).| Gimbal manager flags to use.| Reserved (default:0)| Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| */ - MAV_CMD_DO_GIMBAL_MANAGER_CONFIGURE=1001, /* Gimbal configuration to set which sysid/compid is in primary and secondary control. |Sysid for primary control (0: no one in control, -1: leave unchanged, -2: set itself in control (for missions where the own sysid is still unknown), -3: remove control if currently in control).| Compid for primary control (0: no one in control, -1: leave unchanged, -2: set itself in control (for missions where the own sysid is still unknown), -3: remove control if currently in control).| Sysid for secondary control (0: no one in control, -1: leave unchanged, -2: set itself in control (for missions where the own sysid is still unknown), -3: remove control if currently in control).| Compid for secondary control (0: no one in control, -1: leave unchanged, -2: set itself in control (for missions where the own sysid is still unknown), -3: remove control if currently in control).| Reserved (default:0)| Reserved (default:0)| Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals).| */ - MAV_CMD_IMAGE_START_CAPTURE=2000, /* Start image capture sequence. Sends CAMERA_IMAGE_CAPTURED after each capture. Use NaN for reserved values. |Reserved (Set to 0)| Desired elapsed time between two consecutive pictures (in seconds). Minimum values depend on hardware (typically greater than 2 seconds).| Total number of images to capture. 0 to capture forever/until MAV_CMD_IMAGE_STOP_CAPTURE.| Capture sequence number starting from 1. This is only valid for single-capture (param3 == 1), otherwise set to 0. Increment the capture ID for each capture command to prevent double captures when a command is re-transmitted.| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| */ - MAV_CMD_IMAGE_STOP_CAPTURE=2001, /* Stop image capture sequence Use NaN for reserved values. |Reserved (Set to 0)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ - MAV_CMD_REQUEST_CAMERA_IMAGE_CAPTURE=2002, /* Re-request a CAMERA_IMAGE_CAPTURED message. |Sequence number for missing CAMERA_IMAGE_CAPTURED message| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:0)| Reserved (default:0)| Reserved (default:NaN)| */ - MAV_CMD_DO_TRIGGER_CONTROL=2003, /* Enable or disable on-board camera triggering system. |Trigger enable/disable (0 for disable, 1 for start), -1 to ignore| 1 to reset the trigger sequence, -1 or 0 to ignore| 1 to pause triggering, but without switching the camera off or retracting it. -1 to ignore| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_CAMERA_TRACK_POINT=2004, /* If the camera supports point visual tracking (CAMERA_CAP_FLAGS_HAS_TRACKING_POINT is set), this command allows to initiate the tracking. |Point to track x value (normalized 0..1, 0 is left, 1 is right).| Point to track y value (normalized 0..1, 0 is top, 1 is bottom).| Point radius (normalized 0..1, 0 is image left, 1 is image right).| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_CAMERA_TRACK_RECTANGLE=2005, /* If the camera supports rectangle visual tracking (CAMERA_CAP_FLAGS_HAS_TRACKING_RECTANGLE is set), this command allows to initiate the tracking. |Top left corner of rectangle x value (normalized 0..1, 0 is left, 1 is right).| Top left corner of rectangle y value (normalized 0..1, 0 is top, 1 is bottom).| Bottom right corner of rectangle x value (normalized 0..1, 0 is left, 1 is right).| Bottom right corner of rectangle y value (normalized 0..1, 0 is top, 1 is bottom).| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_CAMERA_STOP_TRACKING=2010, /* Stops ongoing tracking. |Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_VIDEO_START_CAPTURE=2500, /* Starts video capture (recording). |Video Stream ID (0 for all streams)| Frequency CAMERA_CAPTURE_STATUS messages should be sent while recording (0 for no messages, otherwise frequency)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| */ - MAV_CMD_VIDEO_STOP_CAPTURE=2501, /* Stop the current video capture (recording). |Video Stream ID (0 for all streams)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| */ - MAV_CMD_VIDEO_START_STREAMING=2502, /* Start video streaming |Video Stream ID (0 for all streams, 1 for first, 2 for second, etc.)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_VIDEO_STOP_STREAMING=2503, /* Stop the given video stream |Video Stream ID (0 for all streams, 1 for first, 2 for second, etc.)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_VIDEO_STREAM_INFORMATION=2504, /* Request video stream information (VIDEO_STREAM_INFORMATION) |Video Stream ID (0 for all streams, 1 for first, 2 for second, etc.)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_REQUEST_VIDEO_STREAM_STATUS=2505, /* Request video stream status (VIDEO_STREAM_STATUS) |Video Stream ID (0 for all streams, 1 for first, 2 for second, etc.)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_LOGGING_START=2510, /* Request to start streaming logging data over MAVLink (see also LOGGING_DATA message) |Format: 0: ULog| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| */ - MAV_CMD_LOGGING_STOP=2511, /* Request to stop streaming log data over MAVLink |Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| */ - MAV_CMD_AIRFRAME_CONFIGURATION=2520, /* |Landing gear ID (default: 0, -1 for all)| Landing gear position (Down: 0, Up: 1, NaN for no change)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| Reserved (default:NaN)| */ - MAV_CMD_CONTROL_HIGH_LATENCY=2600, /* Request to start/stop transmitting over the high latency telemetry |Control transmission over high latency telemetry (0: stop, 1: start)| Empty| Empty| Empty| Empty| Empty| Empty| */ - MAV_CMD_PANORAMA_CREATE=2800, /* Create a panorama at the current position |Viewing angle horizontal of the panorama (+- 0.5 the total angle)| Viewing angle vertical of panorama.| Speed of the horizontal rotation.| Speed of the vertical rotation.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_DO_VTOL_TRANSITION=3000, /* Request VTOL transition |The target VTOL state. Only MAV_VTOL_STATE_MC and MAV_VTOL_STATE_FW can be used.| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_ARM_AUTHORIZATION_REQUEST=3001, /* Request authorization to arm the vehicle to a external entity, the arm authorizer is responsible to request all data that is needs from the vehicle before authorize or deny the request. If approved the progress of command_ack message should be set with period of time that this authorization is valid in seconds or in case it was denied it should be set with one of the reasons in ARM_AUTH_DENIED_REASON. - |Vehicle system id, this way ground station can request arm authorization on behalf of any vehicle| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_SET_GUIDED_SUBMODE_STANDARD=4000, /* This command sets the submode to standard guided when vehicle is in guided mode. The vehicle holds position and altitude and the user can input the desired velocities along all three axes. - |Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| Reserved (default:0)| */ - MAV_CMD_SET_GUIDED_SUBMODE_CIRCLE=4001, /* This command sets submode circle when vehicle is in guided mode. Vehicle flies along a circle facing the center of the circle. The user can input the velocity along the circle and change the radius. If no input is given the vehicle will hold position. - |Radius of desired circle in CIRCLE_MODE| User defined| User defined| User defined| Target latitude of center of circle in CIRCLE_MODE| Target longitude of center of circle in CIRCLE_MODE| Reserved (default:0)| */ - MAV_CMD_CONDITION_GATE=4501, /* Delay mission state machine until gate has been reached. |Geometry: 0: orthogonal to path between previous and next waypoint.| Altitude: 0: ignore altitude| Empty| Empty| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_FENCE_RETURN_POINT=5000, /* Fence return point. There can only be one fence return point. - |Reserved| Reserved| Reserved| Reserved| Latitude| Longitude| Altitude| */ - MAV_CMD_NAV_FENCE_POLYGON_VERTEX_INCLUSION=5001, /* Fence vertex for an inclusion polygon (the polygon must not be self-intersecting). The vehicle must stay within this area. Minimum of 3 vertices required. - |Polygon vertex count| Vehicle must be inside ALL inclusion zones in a single group, vehicle must be inside at least one group, must be the same for all points in each polygon| Reserved| Reserved| Latitude| Longitude| Reserved| */ - MAV_CMD_NAV_FENCE_POLYGON_VERTEX_EXCLUSION=5002, /* Fence vertex for an exclusion polygon (the polygon must not be self-intersecting). The vehicle must stay outside this area. Minimum of 3 vertices required. - |Polygon vertex count| Reserved| Reserved| Reserved| Latitude| Longitude| Reserved| */ - MAV_CMD_NAV_FENCE_CIRCLE_INCLUSION=5003, /* Circular fence area. The vehicle must stay inside this area. - |Radius.| Vehicle must be inside ALL inclusion zones in a single group, vehicle must be inside at least one group| Reserved| Reserved| Latitude| Longitude| Reserved| */ - MAV_CMD_NAV_FENCE_CIRCLE_EXCLUSION=5004, /* Circular fence area. The vehicle must stay outside this area. - |Radius.| Reserved| Reserved| Reserved| Latitude| Longitude| Reserved| */ - MAV_CMD_NAV_RALLY_POINT=5100, /* Rally point. You can have multiple rally points defined. - |Reserved| Reserved| Reserved| Reserved| Latitude| Longitude| Altitude| */ - MAV_CMD_UAVCAN_GET_NODE_INFO=5200, /* Commands the vehicle to respond with a sequence of messages UAVCAN_NODE_INFO, one message per every UAVCAN node that is online. Note that some of the response messages can be lost, which the receiver can detect easily by checking whether every received UAVCAN_NODE_STATUS has a matching message UAVCAN_NODE_INFO received earlier; if not, this command should be sent again in order to request re-transmission of the node information messages. |Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| */ - MAV_CMD_PAYLOAD_PREPARE_DEPLOY=30001, /* Deploy payload on a Lat / Lon / Alt position. This includes the navigation to reach the required release position and velocity. |Operation mode. 0: prepare single payload deploy (overwriting previous requests), but do not execute it. 1: execute payload deploy immediately (rejecting further deploy commands during execution, but allowing abort). 2: add payload deploy to existing deployment list.| Desired approach vector in compass heading. A negative value indicates the system can define the approach vector at will.| Desired ground speed at release time. This can be overridden by the airframe in case it needs to meet minimum airspeed. A negative value indicates the system can define the ground speed at will.| Minimum altitude clearance to the release position. A negative value indicates the system can define the clearance at will.| Latitude. Note, if used in MISSION_ITEM (deprecated) the units are degrees (unscaled)| Longitude. Note, if used in MISSION_ITEM (deprecated) the units are degrees (unscaled)| Altitude (MSL)| */ - MAV_CMD_PAYLOAD_CONTROL_DEPLOY=30002, /* Control the payload deployment. |Operation mode. 0: Abort deployment, continue normal mission. 1: switch to payload deployment mode. 100: delete first payload deployment request. 101: delete all payload deployment requests.| Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| */ - MAV_CMD_WAYPOINT_USER_1=31000, /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_WAYPOINT_USER_2=31001, /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_WAYPOINT_USER_3=31002, /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_WAYPOINT_USER_4=31003, /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_WAYPOINT_USER_5=31004, /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_SPATIAL_USER_1=31005, /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_SPATIAL_USER_2=31006, /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_SPATIAL_USER_3=31007, /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_SPATIAL_USER_4=31008, /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_SPATIAL_USER_5=31009, /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude (MSL)| */ - MAV_CMD_USER_1=31010, /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ - MAV_CMD_USER_2=31011, /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ - MAV_CMD_USER_3=31012, /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ - MAV_CMD_USER_4=31013, /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ - MAV_CMD_USER_5=31014, /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ - MAV_CMD_FIXED_MAG_CAL_YAW=42006, /* Magnetometer calibration based on provided known yaw. This allows for fast calibration using WMM field tables in the vehicle, given only the known yaw of the vehicle. If Latitude and longitude are both zero then use the current vehicle location. |Yaw of vehicle in earth frame.| CompassMask, 0 for all.| Latitude.| Longitude.| Empty.| Empty.| Empty.| */ - MAV_CMD_DO_WINCH=42600, /* Command to operate winch. |Winch instance number.| Action to perform.| Length of cable to release (negative to wind).| Release rate (negative to wind).| Empty.| Empty.| Empty.| */ - MAV_CMD_ENUM_END=42601, /* | */ -} MAV_CMD; -#endif - -// MAVLINK VERSION - -#ifndef MAVLINK_VERSION -#define MAVLINK_VERSION 2 -#endif - -#if (MAVLINK_VERSION == 0) -#undef MAVLINK_VERSION -#define MAVLINK_VERSION 2 -#endif - -// MESSAGE DEFINITIONS -#include "./mavlink_msg_flexifunction_set.h" -#include "./mavlink_msg_flexifunction_read_req.h" -#include "./mavlink_msg_flexifunction_buffer_function.h" -#include "./mavlink_msg_flexifunction_buffer_function_ack.h" -#include "./mavlink_msg_flexifunction_directory.h" -#include "./mavlink_msg_flexifunction_directory_ack.h" -#include "./mavlink_msg_flexifunction_command.h" -#include "./mavlink_msg_flexifunction_command_ack.h" -#include "./mavlink_msg_serial_udb_extra_f2_a.h" -#include "./mavlink_msg_serial_udb_extra_f2_b.h" -#include "./mavlink_msg_serial_udb_extra_f4.h" -#include "./mavlink_msg_serial_udb_extra_f5.h" -#include "./mavlink_msg_serial_udb_extra_f6.h" -#include "./mavlink_msg_serial_udb_extra_f7.h" -#include "./mavlink_msg_serial_udb_extra_f8.h" -#include "./mavlink_msg_serial_udb_extra_f13.h" -#include "./mavlink_msg_serial_udb_extra_f14.h" -#include "./mavlink_msg_serial_udb_extra_f15.h" -#include "./mavlink_msg_serial_udb_extra_f16.h" -#include "./mavlink_msg_altitudes.h" -#include "./mavlink_msg_airspeeds.h" -#include "./mavlink_msg_serial_udb_extra_f17.h" -#include "./mavlink_msg_serial_udb_extra_f18.h" -#include "./mavlink_msg_serial_udb_extra_f19.h" -#include "./mavlink_msg_serial_udb_extra_f20.h" -#include "./mavlink_msg_serial_udb_extra_f21.h" -#include "./mavlink_msg_serial_udb_extra_f22.h" - -// base include -#include "../common/common.h" - -#undef MAVLINK_THIS_XML_IDX -#define MAVLINK_THIS_XML_IDX 0 - -#if MAVLINK_THIS_XML_IDX == MAVLINK_PRIMARY_XML_IDX -# define MAVLINK_MESSAGE_INFO {MAVLINK_MESSAGE_INFO_HEARTBEAT, MAVLINK_MESSAGE_INFO_SYS_STATUS, MAVLINK_MESSAGE_INFO_SYSTEM_TIME, MAVLINK_MESSAGE_INFO_PING, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL_ACK, MAVLINK_MESSAGE_INFO_AUTH_KEY, MAVLINK_MESSAGE_INFO_LINK_NODE_STATUS, MAVLINK_MESSAGE_INFO_SET_MODE, MAVLINK_MESSAGE_INFO_PARAM_ACK_TRANSACTION, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_READ, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_LIST, MAVLINK_MESSAGE_INFO_PARAM_VALUE, MAVLINK_MESSAGE_INFO_PARAM_SET, MAVLINK_MESSAGE_INFO_GPS_RAW_INT, MAVLINK_MESSAGE_INFO_GPS_STATUS, MAVLINK_MESSAGE_INFO_SCALED_IMU, MAVLINK_MESSAGE_INFO_RAW_IMU, MAVLINK_MESSAGE_INFO_RAW_PRESSURE, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE, MAVLINK_MESSAGE_INFO_ATTITUDE, MAVLINK_MESSAGE_INFO_ATTITUDE_QUATERNION, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT, MAVLINK_MESSAGE_INFO_RC_CHANNELS_SCALED, MAVLINK_MESSAGE_INFO_RC_CHANNELS_RAW, MAVLINK_MESSAGE_INFO_SERVO_OUTPUT_RAW, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_PARTIAL_LIST, MAVLINK_MESSAGE_INFO_MISSION_WRITE_PARTIAL_LIST, MAVLINK_MESSAGE_INFO_MISSION_ITEM, MAVLINK_MESSAGE_INFO_MISSION_REQUEST, MAVLINK_MESSAGE_INFO_MISSION_SET_CURRENT, MAVLINK_MESSAGE_INFO_MISSION_CURRENT, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_LIST, MAVLINK_MESSAGE_INFO_MISSION_COUNT, MAVLINK_MESSAGE_INFO_MISSION_CLEAR_ALL, MAVLINK_MESSAGE_INFO_MISSION_ITEM_REACHED, MAVLINK_MESSAGE_INFO_MISSION_ACK, MAVLINK_MESSAGE_INFO_SET_GPS_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_GPS_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_PARAM_MAP_RC, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_INT, MAVLINK_MESSAGE_INFO_MISSION_CHANGED, MAVLINK_MESSAGE_INFO_SAFETY_SET_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_SAFETY_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_ATTITUDE_QUATERNION_COV, MAVLINK_MESSAGE_INFO_NAV_CONTROLLER_OUTPUT, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT_COV, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED_COV, MAVLINK_MESSAGE_INFO_RC_CHANNELS, MAVLINK_MESSAGE_INFO_REQUEST_DATA_STREAM, MAVLINK_MESSAGE_INFO_DATA_STREAM, MAVLINK_MESSAGE_INFO_MANUAL_CONTROL, MAVLINK_MESSAGE_INFO_RC_CHANNELS_OVERRIDE, MAVLINK_MESSAGE_INFO_MISSION_ITEM_INT, MAVLINK_MESSAGE_INFO_VFR_HUD, MAVLINK_MESSAGE_INFO_COMMAND_INT, MAVLINK_MESSAGE_INFO_COMMAND_LONG, MAVLINK_MESSAGE_INFO_COMMAND_ACK, MAVLINK_MESSAGE_INFO_COMMAND_CANCEL, MAVLINK_MESSAGE_INFO_MANUAL_SETPOINT, MAVLINK_MESSAGE_INFO_SET_ATTITUDE_TARGET, MAVLINK_MESSAGE_INFO_ATTITUDE_TARGET, MAVLINK_MESSAGE_INFO_SET_POSITION_TARGET_LOCAL_NED, MAVLINK_MESSAGE_INFO_POSITION_TARGET_LOCAL_NED, MAVLINK_MESSAGE_INFO_SET_POSITION_TARGET_GLOBAL_INT, MAVLINK_MESSAGE_INFO_POSITION_TARGET_GLOBAL_INT, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET, MAVLINK_MESSAGE_INFO_HIL_STATE, MAVLINK_MESSAGE_INFO_HIL_CONTROLS, MAVLINK_MESSAGE_INFO_HIL_RC_INPUTS_RAW, MAVLINK_MESSAGE_INFO_HIL_ACTUATOR_CONTROLS, MAVLINK_MESSAGE_INFO_OPTICAL_FLOW, MAVLINK_MESSAGE_INFO_GLOBAL_VISION_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_VISION_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_VISION_SPEED_ESTIMATE, MAVLINK_MESSAGE_INFO_VICON_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_HIGHRES_IMU, MAVLINK_MESSAGE_INFO_OPTICAL_FLOW_RAD, MAVLINK_MESSAGE_INFO_HIL_SENSOR, MAVLINK_MESSAGE_INFO_SIM_STATE, MAVLINK_MESSAGE_INFO_RADIO_STATUS, MAVLINK_MESSAGE_INFO_FILE_TRANSFER_PROTOCOL, MAVLINK_MESSAGE_INFO_TIMESYNC, MAVLINK_MESSAGE_INFO_CAMERA_TRIGGER, MAVLINK_MESSAGE_INFO_HIL_GPS, MAVLINK_MESSAGE_INFO_HIL_OPTICAL_FLOW, MAVLINK_MESSAGE_INFO_HIL_STATE_QUATERNION, MAVLINK_MESSAGE_INFO_SCALED_IMU2, MAVLINK_MESSAGE_INFO_LOG_REQUEST_LIST, MAVLINK_MESSAGE_INFO_LOG_ENTRY, MAVLINK_MESSAGE_INFO_LOG_REQUEST_DATA, MAVLINK_MESSAGE_INFO_LOG_DATA, MAVLINK_MESSAGE_INFO_LOG_ERASE, MAVLINK_MESSAGE_INFO_LOG_REQUEST_END, MAVLINK_MESSAGE_INFO_GPS_INJECT_DATA, MAVLINK_MESSAGE_INFO_GPS2_RAW, MAVLINK_MESSAGE_INFO_POWER_STATUS, MAVLINK_MESSAGE_INFO_SERIAL_CONTROL, MAVLINK_MESSAGE_INFO_GPS_RTK, MAVLINK_MESSAGE_INFO_GPS2_RTK, MAVLINK_MESSAGE_INFO_SCALED_IMU3, MAVLINK_MESSAGE_INFO_DATA_TRANSMISSION_HANDSHAKE, MAVLINK_MESSAGE_INFO_ENCAPSULATED_DATA, MAVLINK_MESSAGE_INFO_DISTANCE_SENSOR, MAVLINK_MESSAGE_INFO_TERRAIN_REQUEST, MAVLINK_MESSAGE_INFO_TERRAIN_DATA, MAVLINK_MESSAGE_INFO_TERRAIN_CHECK, MAVLINK_MESSAGE_INFO_TERRAIN_REPORT, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE2, MAVLINK_MESSAGE_INFO_ATT_POS_MOCAP, MAVLINK_MESSAGE_INFO_SET_ACTUATOR_CONTROL_TARGET, MAVLINK_MESSAGE_INFO_ACTUATOR_CONTROL_TARGET, MAVLINK_MESSAGE_INFO_ALTITUDE, MAVLINK_MESSAGE_INFO_RESOURCE_REQUEST, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE3, MAVLINK_MESSAGE_INFO_FOLLOW_TARGET, MAVLINK_MESSAGE_INFO_CONTROL_SYSTEM_STATE, MAVLINK_MESSAGE_INFO_BATTERY_STATUS, MAVLINK_MESSAGE_INFO_AUTOPILOT_VERSION, MAVLINK_MESSAGE_INFO_LANDING_TARGET, MAVLINK_MESSAGE_INFO_FLEXIFUNCTION_SET, MAVLINK_MESSAGE_INFO_FLEXIFUNCTION_READ_REQ, MAVLINK_MESSAGE_INFO_FLEXIFUNCTION_BUFFER_FUNCTION, MAVLINK_MESSAGE_INFO_FLEXIFUNCTION_BUFFER_FUNCTION_ACK, MAVLINK_MESSAGE_INFO_FLEXIFUNCTION_DIRECTORY, MAVLINK_MESSAGE_INFO_FLEXIFUNCTION_DIRECTORY_ACK, MAVLINK_MESSAGE_INFO_FLEXIFUNCTION_COMMAND, MAVLINK_MESSAGE_INFO_FLEXIFUNCTION_COMMAND_ACK, MAVLINK_MESSAGE_INFO_FENCE_STATUS, MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F2_A, MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F2_B, MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F4, MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F5, MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F6, MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F7, MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F8, MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F13, MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F14, MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F15, MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F16, MAVLINK_MESSAGE_INFO_ALTITUDES, MAVLINK_MESSAGE_INFO_AIRSPEEDS, MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F17, MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F18, MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F19, MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F20, MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F21, MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F22, MAVLINK_MESSAGE_INFO_MAG_CAL_REPORT, MAVLINK_MESSAGE_INFO_EFI_STATUS, MAVLINK_MESSAGE_INFO_ESTIMATOR_STATUS, MAVLINK_MESSAGE_INFO_WIND_COV, MAVLINK_MESSAGE_INFO_GPS_INPUT, MAVLINK_MESSAGE_INFO_GPS_RTCM_DATA, MAVLINK_MESSAGE_INFO_HIGH_LATENCY, MAVLINK_MESSAGE_INFO_HIGH_LATENCY2, MAVLINK_MESSAGE_INFO_VIBRATION, MAVLINK_MESSAGE_INFO_HOME_POSITION, MAVLINK_MESSAGE_INFO_SET_HOME_POSITION, MAVLINK_MESSAGE_INFO_MESSAGE_INTERVAL, MAVLINK_MESSAGE_INFO_EXTENDED_SYS_STATE, MAVLINK_MESSAGE_INFO_ADSB_VEHICLE, MAVLINK_MESSAGE_INFO_COLLISION, MAVLINK_MESSAGE_INFO_V2_EXTENSION, MAVLINK_MESSAGE_INFO_MEMORY_VECT, MAVLINK_MESSAGE_INFO_DEBUG_VECT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_FLOAT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_INT, MAVLINK_MESSAGE_INFO_STATUSTEXT, MAVLINK_MESSAGE_INFO_DEBUG, MAVLINK_MESSAGE_INFO_SETUP_SIGNING, MAVLINK_MESSAGE_INFO_BUTTON_CHANGE, MAVLINK_MESSAGE_INFO_PLAY_TUNE, MAVLINK_MESSAGE_INFO_CAMERA_INFORMATION, MAVLINK_MESSAGE_INFO_CAMERA_SETTINGS, MAVLINK_MESSAGE_INFO_STORAGE_INFORMATION, MAVLINK_MESSAGE_INFO_CAMERA_CAPTURE_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_IMAGE_CAPTURED, MAVLINK_MESSAGE_INFO_FLIGHT_INFORMATION, MAVLINK_MESSAGE_INFO_MOUNT_ORIENTATION, MAVLINK_MESSAGE_INFO_LOGGING_DATA, MAVLINK_MESSAGE_INFO_LOGGING_DATA_ACKED, MAVLINK_MESSAGE_INFO_LOGGING_ACK, MAVLINK_MESSAGE_INFO_VIDEO_STREAM_INFORMATION, MAVLINK_MESSAGE_INFO_VIDEO_STREAM_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_FOV_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_TRACKING_IMAGE_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_TRACKING_GEO_STATUS, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_INFORMATION, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_STATUS, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_SET_ATTITUDE, MAVLINK_MESSAGE_INFO_GIMBAL_DEVICE_INFORMATION, MAVLINK_MESSAGE_INFO_GIMBAL_DEVICE_SET_ATTITUDE, MAVLINK_MESSAGE_INFO_GIMBAL_DEVICE_ATTITUDE_STATUS, MAVLINK_MESSAGE_INFO_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_SET_PITCHYAW, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_SET_MANUAL_CONTROL, MAVLINK_MESSAGE_INFO_ESC_INFO, MAVLINK_MESSAGE_INFO_ESC_STATUS, MAVLINK_MESSAGE_INFO_WIFI_CONFIG_AP, MAVLINK_MESSAGE_INFO_PROTOCOL_VERSION, MAVLINK_MESSAGE_INFO_AIS_VESSEL, MAVLINK_MESSAGE_INFO_UAVCAN_NODE_STATUS, MAVLINK_MESSAGE_INFO_UAVCAN_NODE_INFO, MAVLINK_MESSAGE_INFO_PARAM_EXT_REQUEST_READ, MAVLINK_MESSAGE_INFO_PARAM_EXT_REQUEST_LIST, MAVLINK_MESSAGE_INFO_PARAM_EXT_VALUE, MAVLINK_MESSAGE_INFO_PARAM_EXT_SET, MAVLINK_MESSAGE_INFO_PARAM_EXT_ACK, MAVLINK_MESSAGE_INFO_OBSTACLE_DISTANCE, MAVLINK_MESSAGE_INFO_ODOMETRY, MAVLINK_MESSAGE_INFO_TRAJECTORY_REPRESENTATION_WAYPOINTS, MAVLINK_MESSAGE_INFO_TRAJECTORY_REPRESENTATION_BEZIER, MAVLINK_MESSAGE_INFO_CELLULAR_STATUS, MAVLINK_MESSAGE_INFO_ISBD_LINK_STATUS, MAVLINK_MESSAGE_INFO_CELLULAR_CONFIG, MAVLINK_MESSAGE_INFO_RAW_RPM, MAVLINK_MESSAGE_INFO_UTM_GLOBAL_POSITION, MAVLINK_MESSAGE_INFO_DEBUG_FLOAT_ARRAY, MAVLINK_MESSAGE_INFO_ORBIT_EXECUTION_STATUS, MAVLINK_MESSAGE_INFO_SMART_BATTERY_INFO, MAVLINK_MESSAGE_INFO_GENERATOR_STATUS, MAVLINK_MESSAGE_INFO_ACTUATOR_OUTPUT_STATUS, MAVLINK_MESSAGE_INFO_TIME_ESTIMATE_TO_TARGET, MAVLINK_MESSAGE_INFO_TUNNEL, MAVLINK_MESSAGE_INFO_ONBOARD_COMPUTER_STATUS, MAVLINK_MESSAGE_INFO_COMPONENT_INFORMATION, MAVLINK_MESSAGE_INFO_PLAY_TUNE_V2, MAVLINK_MESSAGE_INFO_SUPPORTED_TUNES, MAVLINK_MESSAGE_INFO_WHEEL_DISTANCE, MAVLINK_MESSAGE_INFO_WINCH_STATUS, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_BASIC_ID, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_LOCATION, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_AUTHENTICATION, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_SELF_ID, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_SYSTEM, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_OPERATOR_ID, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_MESSAGE_PACK} -# define MAVLINK_MESSAGE_NAMES {{ "ACTUATOR_CONTROL_TARGET", 140 }, { "ACTUATOR_OUTPUT_STATUS", 375 }, { "ADSB_VEHICLE", 246 }, { "AIRSPEEDS", 182 }, { "AIS_VESSEL", 301 }, { "ALTITUDE", 141 }, { "ALTITUDES", 181 }, { "ATTITUDE", 30 }, { "ATTITUDE_QUATERNION", 31 }, { "ATTITUDE_QUATERNION_COV", 61 }, { "ATTITUDE_TARGET", 83 }, { "ATT_POS_MOCAP", 138 }, { "AUTH_KEY", 7 }, { "AUTOPILOT_STATE_FOR_GIMBAL_DEVICE", 286 }, { "AUTOPILOT_VERSION", 148 }, { "BATTERY_STATUS", 147 }, { "BUTTON_CHANGE", 257 }, { "CAMERA_CAPTURE_STATUS", 262 }, { "CAMERA_FOV_STATUS", 271 }, { "CAMERA_IMAGE_CAPTURED", 263 }, { "CAMERA_INFORMATION", 259 }, { "CAMERA_SETTINGS", 260 }, { "CAMERA_TRACKING_GEO_STATUS", 276 }, { "CAMERA_TRACKING_IMAGE_STATUS", 275 }, { "CAMERA_TRIGGER", 112 }, { "CELLULAR_CONFIG", 336 }, { "CELLULAR_STATUS", 334 }, { "CHANGE_OPERATOR_CONTROL", 5 }, { "CHANGE_OPERATOR_CONTROL_ACK", 6 }, { "COLLISION", 247 }, { "COMMAND_ACK", 77 }, { "COMMAND_CANCEL", 80 }, { "COMMAND_INT", 75 }, { "COMMAND_LONG", 76 }, { "COMPONENT_INFORMATION", 395 }, { "CONTROL_SYSTEM_STATE", 146 }, { "DATA_STREAM", 67 }, { "DATA_TRANSMISSION_HANDSHAKE", 130 }, { "DEBUG", 254 }, { "DEBUG_FLOAT_ARRAY", 350 }, { "DEBUG_VECT", 250 }, { "DISTANCE_SENSOR", 132 }, { "EFI_STATUS", 225 }, { "ENCAPSULATED_DATA", 131 }, { "ESC_INFO", 290 }, { "ESC_STATUS", 291 }, { "ESTIMATOR_STATUS", 230 }, { "EXTENDED_SYS_STATE", 245 }, { "FENCE_STATUS", 162 }, { "FILE_TRANSFER_PROTOCOL", 110 }, { "FLEXIFUNCTION_BUFFER_FUNCTION", 152 }, { "FLEXIFUNCTION_BUFFER_FUNCTION_ACK", 153 }, { "FLEXIFUNCTION_COMMAND", 157 }, { "FLEXIFUNCTION_COMMAND_ACK", 158 }, { "FLEXIFUNCTION_DIRECTORY", 155 }, { "FLEXIFUNCTION_DIRECTORY_ACK", 156 }, { "FLEXIFUNCTION_READ_REQ", 151 }, { "FLEXIFUNCTION_SET", 150 }, { "FLIGHT_INFORMATION", 264 }, { "FOLLOW_TARGET", 144 }, { "GENERATOR_STATUS", 373 }, { "GIMBAL_DEVICE_ATTITUDE_STATUS", 285 }, { "GIMBAL_DEVICE_INFORMATION", 283 }, { "GIMBAL_DEVICE_SET_ATTITUDE", 284 }, { "GIMBAL_MANAGER_INFORMATION", 280 }, { "GIMBAL_MANAGER_SET_ATTITUDE", 282 }, { "GIMBAL_MANAGER_SET_MANUAL_CONTROL", 288 }, { "GIMBAL_MANAGER_SET_PITCHYAW", 287 }, { "GIMBAL_MANAGER_STATUS", 281 }, { "GLOBAL_POSITION_INT", 33 }, { "GLOBAL_POSITION_INT_COV", 63 }, { "GLOBAL_VISION_POSITION_ESTIMATE", 101 }, { "GPS2_RAW", 124 }, { "GPS2_RTK", 128 }, { "GPS_GLOBAL_ORIGIN", 49 }, { "GPS_INJECT_DATA", 123 }, { "GPS_INPUT", 232 }, { "GPS_RAW_INT", 24 }, { "GPS_RTCM_DATA", 233 }, { "GPS_RTK", 127 }, { "GPS_STATUS", 25 }, { "HEARTBEAT", 0 }, { "HIGHRES_IMU", 105 }, { "HIGH_LATENCY", 234 }, { "HIGH_LATENCY2", 235 }, { "HIL_ACTUATOR_CONTROLS", 93 }, { "HIL_CONTROLS", 91 }, { "HIL_GPS", 113 }, { "HIL_OPTICAL_FLOW", 114 }, { "HIL_RC_INPUTS_RAW", 92 }, { "HIL_SENSOR", 107 }, { "HIL_STATE", 90 }, { "HIL_STATE_QUATERNION", 115 }, { "HOME_POSITION", 242 }, { "ISBD_LINK_STATUS", 335 }, { "LANDING_TARGET", 149 }, { "LINK_NODE_STATUS", 8 }, { "LOCAL_POSITION_NED", 32 }, { "LOCAL_POSITION_NED_COV", 64 }, { "LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET", 89 }, { "LOGGING_ACK", 268 }, { "LOGGING_DATA", 266 }, { "LOGGING_DATA_ACKED", 267 }, { "LOG_DATA", 120 }, { "LOG_ENTRY", 118 }, { "LOG_ERASE", 121 }, { "LOG_REQUEST_DATA", 119 }, { "LOG_REQUEST_END", 122 }, { "LOG_REQUEST_LIST", 117 }, { "MAG_CAL_REPORT", 192 }, { "MANUAL_CONTROL", 69 }, { "MANUAL_SETPOINT", 81 }, { "MEMORY_VECT", 249 }, { "MESSAGE_INTERVAL", 244 }, { "MISSION_ACK", 47 }, { "MISSION_CHANGED", 52 }, { "MISSION_CLEAR_ALL", 45 }, { "MISSION_COUNT", 44 }, { "MISSION_CURRENT", 42 }, { "MISSION_ITEM", 39 }, { "MISSION_ITEM_INT", 73 }, { "MISSION_ITEM_REACHED", 46 }, { "MISSION_REQUEST", 40 }, { "MISSION_REQUEST_INT", 51 }, { "MISSION_REQUEST_LIST", 43 }, { "MISSION_REQUEST_PARTIAL_LIST", 37 }, { "MISSION_SET_CURRENT", 41 }, { "MISSION_WRITE_PARTIAL_LIST", 38 }, { "MOUNT_ORIENTATION", 265 }, { "NAMED_VALUE_FLOAT", 251 }, { "NAMED_VALUE_INT", 252 }, { "NAV_CONTROLLER_OUTPUT", 62 }, { "OBSTACLE_DISTANCE", 330 }, { "ODOMETRY", 331 }, { "ONBOARD_COMPUTER_STATUS", 390 }, { "OPEN_DRONE_ID_AUTHENTICATION", 12902 }, { "OPEN_DRONE_ID_BASIC_ID", 12900 }, { "OPEN_DRONE_ID_LOCATION", 12901 }, { "OPEN_DRONE_ID_MESSAGE_PACK", 12915 }, { "OPEN_DRONE_ID_OPERATOR_ID", 12905 }, { "OPEN_DRONE_ID_SELF_ID", 12903 }, { "OPEN_DRONE_ID_SYSTEM", 12904 }, { "OPTICAL_FLOW", 100 }, { "OPTICAL_FLOW_RAD", 106 }, { "ORBIT_EXECUTION_STATUS", 360 }, { "PARAM_ACK_TRANSACTION", 19 }, { "PARAM_EXT_ACK", 324 }, { "PARAM_EXT_REQUEST_LIST", 321 }, { "PARAM_EXT_REQUEST_READ", 320 }, { "PARAM_EXT_SET", 323 }, { "PARAM_EXT_VALUE", 322 }, { "PARAM_MAP_RC", 50 }, { "PARAM_REQUEST_LIST", 21 }, { "PARAM_REQUEST_READ", 20 }, { "PARAM_SET", 23 }, { "PARAM_VALUE", 22 }, { "PING", 4 }, { "PLAY_TUNE", 258 }, { "PLAY_TUNE_V2", 400 }, { "POSITION_TARGET_GLOBAL_INT", 87 }, { "POSITION_TARGET_LOCAL_NED", 85 }, { "POWER_STATUS", 125 }, { "PROTOCOL_VERSION", 300 }, { "RADIO_STATUS", 109 }, { "RAW_IMU", 27 }, { "RAW_PRESSURE", 28 }, { "RAW_RPM", 339 }, { "RC_CHANNELS", 65 }, { "RC_CHANNELS_OVERRIDE", 70 }, { "RC_CHANNELS_RAW", 35 }, { "RC_CHANNELS_SCALED", 34 }, { "REQUEST_DATA_STREAM", 66 }, { "RESOURCE_REQUEST", 142 }, { "SAFETY_ALLOWED_AREA", 55 }, { "SAFETY_SET_ALLOWED_AREA", 54 }, { "SCALED_IMU", 26 }, { "SCALED_IMU2", 116 }, { "SCALED_IMU3", 129 }, { "SCALED_PRESSURE", 29 }, { "SCALED_PRESSURE2", 137 }, { "SCALED_PRESSURE3", 143 }, { "SERIAL_CONTROL", 126 }, { "SERIAL_UDB_EXTRA_F13", 177 }, { "SERIAL_UDB_EXTRA_F14", 178 }, { "SERIAL_UDB_EXTRA_F15", 179 }, { "SERIAL_UDB_EXTRA_F16", 180 }, { "SERIAL_UDB_EXTRA_F17", 183 }, { "SERIAL_UDB_EXTRA_F18", 184 }, { "SERIAL_UDB_EXTRA_F19", 185 }, { "SERIAL_UDB_EXTRA_F20", 186 }, { "SERIAL_UDB_EXTRA_F21", 187 }, { "SERIAL_UDB_EXTRA_F22", 188 }, { "SERIAL_UDB_EXTRA_F2_A", 170 }, { "SERIAL_UDB_EXTRA_F2_B", 171 }, { "SERIAL_UDB_EXTRA_F4", 172 }, { "SERIAL_UDB_EXTRA_F5", 173 }, { "SERIAL_UDB_EXTRA_F6", 174 }, { "SERIAL_UDB_EXTRA_F7", 175 }, { "SERIAL_UDB_EXTRA_F8", 176 }, { "SERVO_OUTPUT_RAW", 36 }, { "SETUP_SIGNING", 256 }, { "SET_ACTUATOR_CONTROL_TARGET", 139 }, { "SET_ATTITUDE_TARGET", 82 }, { "SET_GPS_GLOBAL_ORIGIN", 48 }, { "SET_HOME_POSITION", 243 }, { "SET_MODE", 11 }, { "SET_POSITION_TARGET_GLOBAL_INT", 86 }, { "SET_POSITION_TARGET_LOCAL_NED", 84 }, { "SIM_STATE", 108 }, { "SMART_BATTERY_INFO", 370 }, { "STATUSTEXT", 253 }, { "STORAGE_INFORMATION", 261 }, { "SUPPORTED_TUNES", 401 }, { "SYSTEM_TIME", 2 }, { "SYS_STATUS", 1 }, { "TERRAIN_CHECK", 135 }, { "TERRAIN_DATA", 134 }, { "TERRAIN_REPORT", 136 }, { "TERRAIN_REQUEST", 133 }, { "TIMESYNC", 111 }, { "TIME_ESTIMATE_TO_TARGET", 380 }, { "TRAJECTORY_REPRESENTATION_BEZIER", 333 }, { "TRAJECTORY_REPRESENTATION_WAYPOINTS", 332 }, { "TUNNEL", 385 }, { "UAVCAN_NODE_INFO", 311 }, { "UAVCAN_NODE_STATUS", 310 }, { "UTM_GLOBAL_POSITION", 340 }, { "V2_EXTENSION", 248 }, { "VFR_HUD", 74 }, { "VIBRATION", 241 }, { "VICON_POSITION_ESTIMATE", 104 }, { "VIDEO_STREAM_INFORMATION", 269 }, { "VIDEO_STREAM_STATUS", 270 }, { "VISION_POSITION_ESTIMATE", 102 }, { "VISION_SPEED_ESTIMATE", 103 }, { "WHEEL_DISTANCE", 9000 }, { "WIFI_CONFIG_AP", 299 }, { "WINCH_STATUS", 9005 }, { "WIND_COV", 231 }} -# if MAVLINK_COMMAND_24BIT -# include "../mavlink_get_info.h" -# endif -#endif - -#ifdef __cplusplus -} -#endif // __cplusplus -#endif // MAVLINK_MATRIXPILOT_H diff --git a/matrixpilot/mavlink.h b/matrixpilot/mavlink.h deleted file mode 100644 index 2dc453a18..000000000 --- a/matrixpilot/mavlink.h +++ /dev/null @@ -1,34 +0,0 @@ -/** @file - * @brief MAVLink comm protocol built from matrixpilot.xml - * @see http://mavlink.org - */ -#pragma once -#ifndef MAVLINK_H -#define MAVLINK_H - -#define MAVLINK_PRIMARY_XML_IDX 0 - -#ifndef MAVLINK_STX -#define MAVLINK_STX 253 -#endif - -#ifndef MAVLINK_ENDIAN -#define MAVLINK_ENDIAN MAVLINK_LITTLE_ENDIAN -#endif - -#ifndef MAVLINK_ALIGNED_FIELDS -#define MAVLINK_ALIGNED_FIELDS 1 -#endif - -#ifndef MAVLINK_CRC_EXTRA -#define MAVLINK_CRC_EXTRA 1 -#endif - -#ifndef MAVLINK_COMMAND_24BIT -#define MAVLINK_COMMAND_24BIT 1 -#endif - -#include "version.h" -#include "matrixpilot.h" - -#endif // MAVLINK_H diff --git a/matrixpilot/mavlink_msg_airspeeds.h b/matrixpilot/mavlink_msg_airspeeds.h deleted file mode 100644 index 54d470c15..000000000 --- a/matrixpilot/mavlink_msg_airspeeds.h +++ /dev/null @@ -1,363 +0,0 @@ -#pragma once -// MESSAGE AIRSPEEDS PACKING - -#define MAVLINK_MSG_ID_AIRSPEEDS 182 - - -typedef struct __mavlink_airspeeds_t { - uint32_t time_boot_ms; /*< Timestamp (milliseconds since system boot)*/ - int16_t airspeed_imu; /*< Airspeed estimate from IMU, cm/s*/ - int16_t airspeed_pitot; /*< Pitot measured forward airpseed, cm/s*/ - int16_t airspeed_hot_wire; /*< Hot wire anenometer measured airspeed, cm/s*/ - int16_t airspeed_ultrasonic; /*< Ultrasonic measured airspeed, cm/s*/ - int16_t aoa; /*< Angle of attack sensor, degrees * 10*/ - int16_t aoy; /*< Yaw angle sensor, degrees * 10*/ -} mavlink_airspeeds_t; - -#define MAVLINK_MSG_ID_AIRSPEEDS_LEN 16 -#define MAVLINK_MSG_ID_AIRSPEEDS_MIN_LEN 16 -#define MAVLINK_MSG_ID_182_LEN 16 -#define MAVLINK_MSG_ID_182_MIN_LEN 16 - -#define MAVLINK_MSG_ID_AIRSPEEDS_CRC 154 -#define MAVLINK_MSG_ID_182_CRC 154 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_AIRSPEEDS { \ - 182, \ - "AIRSPEEDS", \ - 7, \ - { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_airspeeds_t, time_boot_ms) }, \ - { "airspeed_imu", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_airspeeds_t, airspeed_imu) }, \ - { "airspeed_pitot", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_airspeeds_t, airspeed_pitot) }, \ - { "airspeed_hot_wire", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_airspeeds_t, airspeed_hot_wire) }, \ - { "airspeed_ultrasonic", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_airspeeds_t, airspeed_ultrasonic) }, \ - { "aoa", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_airspeeds_t, aoa) }, \ - { "aoy", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_airspeeds_t, aoy) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_AIRSPEEDS { \ - "AIRSPEEDS", \ - 7, \ - { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_airspeeds_t, time_boot_ms) }, \ - { "airspeed_imu", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_airspeeds_t, airspeed_imu) }, \ - { "airspeed_pitot", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_airspeeds_t, airspeed_pitot) }, \ - { "airspeed_hot_wire", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_airspeeds_t, airspeed_hot_wire) }, \ - { "airspeed_ultrasonic", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_airspeeds_t, airspeed_ultrasonic) }, \ - { "aoa", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_airspeeds_t, aoa) }, \ - { "aoy", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_airspeeds_t, aoy) }, \ - } \ -} -#endif - -/** - * @brief Pack a airspeeds message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param time_boot_ms Timestamp (milliseconds since system boot) - * @param airspeed_imu Airspeed estimate from IMU, cm/s - * @param airspeed_pitot Pitot measured forward airpseed, cm/s - * @param airspeed_hot_wire Hot wire anenometer measured airspeed, cm/s - * @param airspeed_ultrasonic Ultrasonic measured airspeed, cm/s - * @param aoa Angle of attack sensor, degrees * 10 - * @param aoy Yaw angle sensor, degrees * 10 - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_airspeeds_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint32_t time_boot_ms, int16_t airspeed_imu, int16_t airspeed_pitot, int16_t airspeed_hot_wire, int16_t airspeed_ultrasonic, int16_t aoa, int16_t aoy) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_AIRSPEEDS_LEN]; - _mav_put_uint32_t(buf, 0, time_boot_ms); - _mav_put_int16_t(buf, 4, airspeed_imu); - _mav_put_int16_t(buf, 6, airspeed_pitot); - _mav_put_int16_t(buf, 8, airspeed_hot_wire); - _mav_put_int16_t(buf, 10, airspeed_ultrasonic); - _mav_put_int16_t(buf, 12, aoa); - _mav_put_int16_t(buf, 14, aoy); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AIRSPEEDS_LEN); -#else - mavlink_airspeeds_t packet; - packet.time_boot_ms = time_boot_ms; - packet.airspeed_imu = airspeed_imu; - packet.airspeed_pitot = airspeed_pitot; - packet.airspeed_hot_wire = airspeed_hot_wire; - packet.airspeed_ultrasonic = airspeed_ultrasonic; - packet.aoa = aoa; - packet.aoy = aoy; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AIRSPEEDS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_AIRSPEEDS; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AIRSPEEDS_MIN_LEN, MAVLINK_MSG_ID_AIRSPEEDS_LEN, MAVLINK_MSG_ID_AIRSPEEDS_CRC); -} - -/** - * @brief Pack a airspeeds message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param time_boot_ms Timestamp (milliseconds since system boot) - * @param airspeed_imu Airspeed estimate from IMU, cm/s - * @param airspeed_pitot Pitot measured forward airpseed, cm/s - * @param airspeed_hot_wire Hot wire anenometer measured airspeed, cm/s - * @param airspeed_ultrasonic Ultrasonic measured airspeed, cm/s - * @param aoa Angle of attack sensor, degrees * 10 - * @param aoy Yaw angle sensor, degrees * 10 - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_airspeeds_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint32_t time_boot_ms,int16_t airspeed_imu,int16_t airspeed_pitot,int16_t airspeed_hot_wire,int16_t airspeed_ultrasonic,int16_t aoa,int16_t aoy) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_AIRSPEEDS_LEN]; - _mav_put_uint32_t(buf, 0, time_boot_ms); - _mav_put_int16_t(buf, 4, airspeed_imu); - _mav_put_int16_t(buf, 6, airspeed_pitot); - _mav_put_int16_t(buf, 8, airspeed_hot_wire); - _mav_put_int16_t(buf, 10, airspeed_ultrasonic); - _mav_put_int16_t(buf, 12, aoa); - _mav_put_int16_t(buf, 14, aoy); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AIRSPEEDS_LEN); -#else - mavlink_airspeeds_t packet; - packet.time_boot_ms = time_boot_ms; - packet.airspeed_imu = airspeed_imu; - packet.airspeed_pitot = airspeed_pitot; - packet.airspeed_hot_wire = airspeed_hot_wire; - packet.airspeed_ultrasonic = airspeed_ultrasonic; - packet.aoa = aoa; - packet.aoy = aoy; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AIRSPEEDS_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_AIRSPEEDS; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AIRSPEEDS_MIN_LEN, MAVLINK_MSG_ID_AIRSPEEDS_LEN, MAVLINK_MSG_ID_AIRSPEEDS_CRC); -} - -/** - * @brief Encode a airspeeds struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param airspeeds C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_airspeeds_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_airspeeds_t* airspeeds) -{ - return mavlink_msg_airspeeds_pack(system_id, component_id, msg, airspeeds->time_boot_ms, airspeeds->airspeed_imu, airspeeds->airspeed_pitot, airspeeds->airspeed_hot_wire, airspeeds->airspeed_ultrasonic, airspeeds->aoa, airspeeds->aoy); -} - -/** - * @brief Encode a airspeeds struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param airspeeds C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_airspeeds_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_airspeeds_t* airspeeds) -{ - return mavlink_msg_airspeeds_pack_chan(system_id, component_id, chan, msg, airspeeds->time_boot_ms, airspeeds->airspeed_imu, airspeeds->airspeed_pitot, airspeeds->airspeed_hot_wire, airspeeds->airspeed_ultrasonic, airspeeds->aoa, airspeeds->aoy); -} - -/** - * @brief Send a airspeeds message - * @param chan MAVLink channel to send the message - * - * @param time_boot_ms Timestamp (milliseconds since system boot) - * @param airspeed_imu Airspeed estimate from IMU, cm/s - * @param airspeed_pitot Pitot measured forward airpseed, cm/s - * @param airspeed_hot_wire Hot wire anenometer measured airspeed, cm/s - * @param airspeed_ultrasonic Ultrasonic measured airspeed, cm/s - * @param aoa Angle of attack sensor, degrees * 10 - * @param aoy Yaw angle sensor, degrees * 10 - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_airspeeds_send(mavlink_channel_t chan, uint32_t time_boot_ms, int16_t airspeed_imu, int16_t airspeed_pitot, int16_t airspeed_hot_wire, int16_t airspeed_ultrasonic, int16_t aoa, int16_t aoy) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_AIRSPEEDS_LEN]; - _mav_put_uint32_t(buf, 0, time_boot_ms); - _mav_put_int16_t(buf, 4, airspeed_imu); - _mav_put_int16_t(buf, 6, airspeed_pitot); - _mav_put_int16_t(buf, 8, airspeed_hot_wire); - _mav_put_int16_t(buf, 10, airspeed_ultrasonic); - _mav_put_int16_t(buf, 12, aoa); - _mav_put_int16_t(buf, 14, aoy); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIRSPEEDS, buf, MAVLINK_MSG_ID_AIRSPEEDS_MIN_LEN, MAVLINK_MSG_ID_AIRSPEEDS_LEN, MAVLINK_MSG_ID_AIRSPEEDS_CRC); -#else - mavlink_airspeeds_t packet; - packet.time_boot_ms = time_boot_ms; - packet.airspeed_imu = airspeed_imu; - packet.airspeed_pitot = airspeed_pitot; - packet.airspeed_hot_wire = airspeed_hot_wire; - packet.airspeed_ultrasonic = airspeed_ultrasonic; - packet.aoa = aoa; - packet.aoy = aoy; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIRSPEEDS, (const char *)&packet, MAVLINK_MSG_ID_AIRSPEEDS_MIN_LEN, MAVLINK_MSG_ID_AIRSPEEDS_LEN, MAVLINK_MSG_ID_AIRSPEEDS_CRC); -#endif -} - -/** - * @brief Send a airspeeds message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_airspeeds_send_struct(mavlink_channel_t chan, const mavlink_airspeeds_t* airspeeds) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_airspeeds_send(chan, airspeeds->time_boot_ms, airspeeds->airspeed_imu, airspeeds->airspeed_pitot, airspeeds->airspeed_hot_wire, airspeeds->airspeed_ultrasonic, airspeeds->aoa, airspeeds->aoy); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIRSPEEDS, (const char *)airspeeds, MAVLINK_MSG_ID_AIRSPEEDS_MIN_LEN, MAVLINK_MSG_ID_AIRSPEEDS_LEN, MAVLINK_MSG_ID_AIRSPEEDS_CRC); -#endif -} - -#if MAVLINK_MSG_ID_AIRSPEEDS_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_airspeeds_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, int16_t airspeed_imu, int16_t airspeed_pitot, int16_t airspeed_hot_wire, int16_t airspeed_ultrasonic, int16_t aoa, int16_t aoy) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint32_t(buf, 0, time_boot_ms); - _mav_put_int16_t(buf, 4, airspeed_imu); - _mav_put_int16_t(buf, 6, airspeed_pitot); - _mav_put_int16_t(buf, 8, airspeed_hot_wire); - _mav_put_int16_t(buf, 10, airspeed_ultrasonic); - _mav_put_int16_t(buf, 12, aoa); - _mav_put_int16_t(buf, 14, aoy); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIRSPEEDS, buf, MAVLINK_MSG_ID_AIRSPEEDS_MIN_LEN, MAVLINK_MSG_ID_AIRSPEEDS_LEN, MAVLINK_MSG_ID_AIRSPEEDS_CRC); -#else - mavlink_airspeeds_t *packet = (mavlink_airspeeds_t *)msgbuf; - packet->time_boot_ms = time_boot_ms; - packet->airspeed_imu = airspeed_imu; - packet->airspeed_pitot = airspeed_pitot; - packet->airspeed_hot_wire = airspeed_hot_wire; - packet->airspeed_ultrasonic = airspeed_ultrasonic; - packet->aoa = aoa; - packet->aoy = aoy; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIRSPEEDS, (const char *)packet, MAVLINK_MSG_ID_AIRSPEEDS_MIN_LEN, MAVLINK_MSG_ID_AIRSPEEDS_LEN, MAVLINK_MSG_ID_AIRSPEEDS_CRC); -#endif -} -#endif - -#endif - -// MESSAGE AIRSPEEDS UNPACKING - - -/** - * @brief Get field time_boot_ms from airspeeds message - * - * @return Timestamp (milliseconds since system boot) - */ -static inline uint32_t mavlink_msg_airspeeds_get_time_boot_ms(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 0); -} - -/** - * @brief Get field airspeed_imu from airspeeds message - * - * @return Airspeed estimate from IMU, cm/s - */ -static inline int16_t mavlink_msg_airspeeds_get_airspeed_imu(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 4); -} - -/** - * @brief Get field airspeed_pitot from airspeeds message - * - * @return Pitot measured forward airpseed, cm/s - */ -static inline int16_t mavlink_msg_airspeeds_get_airspeed_pitot(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 6); -} - -/** - * @brief Get field airspeed_hot_wire from airspeeds message - * - * @return Hot wire anenometer measured airspeed, cm/s - */ -static inline int16_t mavlink_msg_airspeeds_get_airspeed_hot_wire(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 8); -} - -/** - * @brief Get field airspeed_ultrasonic from airspeeds message - * - * @return Ultrasonic measured airspeed, cm/s - */ -static inline int16_t mavlink_msg_airspeeds_get_airspeed_ultrasonic(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 10); -} - -/** - * @brief Get field aoa from airspeeds message - * - * @return Angle of attack sensor, degrees * 10 - */ -static inline int16_t mavlink_msg_airspeeds_get_aoa(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 12); -} - -/** - * @brief Get field aoy from airspeeds message - * - * @return Yaw angle sensor, degrees * 10 - */ -static inline int16_t mavlink_msg_airspeeds_get_aoy(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 14); -} - -/** - * @brief Decode a airspeeds message into a struct - * - * @param msg The message to decode - * @param airspeeds C-struct to decode the message contents into - */ -static inline void mavlink_msg_airspeeds_decode(const mavlink_message_t* msg, mavlink_airspeeds_t* airspeeds) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - airspeeds->time_boot_ms = mavlink_msg_airspeeds_get_time_boot_ms(msg); - airspeeds->airspeed_imu = mavlink_msg_airspeeds_get_airspeed_imu(msg); - airspeeds->airspeed_pitot = mavlink_msg_airspeeds_get_airspeed_pitot(msg); - airspeeds->airspeed_hot_wire = mavlink_msg_airspeeds_get_airspeed_hot_wire(msg); - airspeeds->airspeed_ultrasonic = mavlink_msg_airspeeds_get_airspeed_ultrasonic(msg); - airspeeds->aoa = mavlink_msg_airspeeds_get_aoa(msg); - airspeeds->aoy = mavlink_msg_airspeeds_get_aoy(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_AIRSPEEDS_LEN? msg->len : MAVLINK_MSG_ID_AIRSPEEDS_LEN; - memset(airspeeds, 0, MAVLINK_MSG_ID_AIRSPEEDS_LEN); - memcpy(airspeeds, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/matrixpilot/mavlink_msg_altitudes.h b/matrixpilot/mavlink_msg_altitudes.h deleted file mode 100644 index 535b70a59..000000000 --- a/matrixpilot/mavlink_msg_altitudes.h +++ /dev/null @@ -1,363 +0,0 @@ -#pragma once -// MESSAGE ALTITUDES PACKING - -#define MAVLINK_MSG_ID_ALTITUDES 181 - - -typedef struct __mavlink_altitudes_t { - uint32_t time_boot_ms; /*< Timestamp (milliseconds since system boot)*/ - int32_t alt_gps; /*< GPS altitude (MSL) in meters, expressed as * 1000 (millimeters)*/ - int32_t alt_imu; /*< IMU altitude above ground in meters, expressed as * 1000 (millimeters)*/ - int32_t alt_barometric; /*< barometeric altitude above ground in meters, expressed as * 1000 (millimeters)*/ - int32_t alt_optical_flow; /*< Optical flow altitude above ground in meters, expressed as * 1000 (millimeters)*/ - int32_t alt_range_finder; /*< Rangefinder Altitude above ground in meters, expressed as * 1000 (millimeters)*/ - int32_t alt_extra; /*< Extra altitude above ground in meters, expressed as * 1000 (millimeters)*/ -} mavlink_altitudes_t; - -#define MAVLINK_MSG_ID_ALTITUDES_LEN 28 -#define MAVLINK_MSG_ID_ALTITUDES_MIN_LEN 28 -#define MAVLINK_MSG_ID_181_LEN 28 -#define MAVLINK_MSG_ID_181_MIN_LEN 28 - -#define MAVLINK_MSG_ID_ALTITUDES_CRC 55 -#define MAVLINK_MSG_ID_181_CRC 55 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_ALTITUDES { \ - 181, \ - "ALTITUDES", \ - 7, \ - { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_altitudes_t, time_boot_ms) }, \ - { "alt_gps", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_altitudes_t, alt_gps) }, \ - { "alt_imu", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_altitudes_t, alt_imu) }, \ - { "alt_barometric", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_altitudes_t, alt_barometric) }, \ - { "alt_optical_flow", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_altitudes_t, alt_optical_flow) }, \ - { "alt_range_finder", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_altitudes_t, alt_range_finder) }, \ - { "alt_extra", NULL, MAVLINK_TYPE_INT32_T, 0, 24, offsetof(mavlink_altitudes_t, alt_extra) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_ALTITUDES { \ - "ALTITUDES", \ - 7, \ - { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_altitudes_t, time_boot_ms) }, \ - { "alt_gps", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_altitudes_t, alt_gps) }, \ - { "alt_imu", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_altitudes_t, alt_imu) }, \ - { "alt_barometric", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_altitudes_t, alt_barometric) }, \ - { "alt_optical_flow", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_altitudes_t, alt_optical_flow) }, \ - { "alt_range_finder", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_altitudes_t, alt_range_finder) }, \ - { "alt_extra", NULL, MAVLINK_TYPE_INT32_T, 0, 24, offsetof(mavlink_altitudes_t, alt_extra) }, \ - } \ -} -#endif - -/** - * @brief Pack a altitudes message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param time_boot_ms Timestamp (milliseconds since system boot) - * @param alt_gps GPS altitude (MSL) in meters, expressed as * 1000 (millimeters) - * @param alt_imu IMU altitude above ground in meters, expressed as * 1000 (millimeters) - * @param alt_barometric barometeric altitude above ground in meters, expressed as * 1000 (millimeters) - * @param alt_optical_flow Optical flow altitude above ground in meters, expressed as * 1000 (millimeters) - * @param alt_range_finder Rangefinder Altitude above ground in meters, expressed as * 1000 (millimeters) - * @param alt_extra Extra altitude above ground in meters, expressed as * 1000 (millimeters) - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_altitudes_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint32_t time_boot_ms, int32_t alt_gps, int32_t alt_imu, int32_t alt_barometric, int32_t alt_optical_flow, int32_t alt_range_finder, int32_t alt_extra) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_ALTITUDES_LEN]; - _mav_put_uint32_t(buf, 0, time_boot_ms); - _mav_put_int32_t(buf, 4, alt_gps); - _mav_put_int32_t(buf, 8, alt_imu); - _mav_put_int32_t(buf, 12, alt_barometric); - _mav_put_int32_t(buf, 16, alt_optical_flow); - _mav_put_int32_t(buf, 20, alt_range_finder); - _mav_put_int32_t(buf, 24, alt_extra); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ALTITUDES_LEN); -#else - mavlink_altitudes_t packet; - packet.time_boot_ms = time_boot_ms; - packet.alt_gps = alt_gps; - packet.alt_imu = alt_imu; - packet.alt_barometric = alt_barometric; - packet.alt_optical_flow = alt_optical_flow; - packet.alt_range_finder = alt_range_finder; - packet.alt_extra = alt_extra; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ALTITUDES_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_ALTITUDES; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ALTITUDES_MIN_LEN, MAVLINK_MSG_ID_ALTITUDES_LEN, MAVLINK_MSG_ID_ALTITUDES_CRC); -} - -/** - * @brief Pack a altitudes message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param time_boot_ms Timestamp (milliseconds since system boot) - * @param alt_gps GPS altitude (MSL) in meters, expressed as * 1000 (millimeters) - * @param alt_imu IMU altitude above ground in meters, expressed as * 1000 (millimeters) - * @param alt_barometric barometeric altitude above ground in meters, expressed as * 1000 (millimeters) - * @param alt_optical_flow Optical flow altitude above ground in meters, expressed as * 1000 (millimeters) - * @param alt_range_finder Rangefinder Altitude above ground in meters, expressed as * 1000 (millimeters) - * @param alt_extra Extra altitude above ground in meters, expressed as * 1000 (millimeters) - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_altitudes_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint32_t time_boot_ms,int32_t alt_gps,int32_t alt_imu,int32_t alt_barometric,int32_t alt_optical_flow,int32_t alt_range_finder,int32_t alt_extra) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_ALTITUDES_LEN]; - _mav_put_uint32_t(buf, 0, time_boot_ms); - _mav_put_int32_t(buf, 4, alt_gps); - _mav_put_int32_t(buf, 8, alt_imu); - _mav_put_int32_t(buf, 12, alt_barometric); - _mav_put_int32_t(buf, 16, alt_optical_flow); - _mav_put_int32_t(buf, 20, alt_range_finder); - _mav_put_int32_t(buf, 24, alt_extra); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ALTITUDES_LEN); -#else - mavlink_altitudes_t packet; - packet.time_boot_ms = time_boot_ms; - packet.alt_gps = alt_gps; - packet.alt_imu = alt_imu; - packet.alt_barometric = alt_barometric; - packet.alt_optical_flow = alt_optical_flow; - packet.alt_range_finder = alt_range_finder; - packet.alt_extra = alt_extra; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ALTITUDES_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_ALTITUDES; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ALTITUDES_MIN_LEN, MAVLINK_MSG_ID_ALTITUDES_LEN, MAVLINK_MSG_ID_ALTITUDES_CRC); -} - -/** - * @brief Encode a altitudes struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param altitudes C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_altitudes_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_altitudes_t* altitudes) -{ - return mavlink_msg_altitudes_pack(system_id, component_id, msg, altitudes->time_boot_ms, altitudes->alt_gps, altitudes->alt_imu, altitudes->alt_barometric, altitudes->alt_optical_flow, altitudes->alt_range_finder, altitudes->alt_extra); -} - -/** - * @brief Encode a altitudes struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param altitudes C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_altitudes_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_altitudes_t* altitudes) -{ - return mavlink_msg_altitudes_pack_chan(system_id, component_id, chan, msg, altitudes->time_boot_ms, altitudes->alt_gps, altitudes->alt_imu, altitudes->alt_barometric, altitudes->alt_optical_flow, altitudes->alt_range_finder, altitudes->alt_extra); -} - -/** - * @brief Send a altitudes message - * @param chan MAVLink channel to send the message - * - * @param time_boot_ms Timestamp (milliseconds since system boot) - * @param alt_gps GPS altitude (MSL) in meters, expressed as * 1000 (millimeters) - * @param alt_imu IMU altitude above ground in meters, expressed as * 1000 (millimeters) - * @param alt_barometric barometeric altitude above ground in meters, expressed as * 1000 (millimeters) - * @param alt_optical_flow Optical flow altitude above ground in meters, expressed as * 1000 (millimeters) - * @param alt_range_finder Rangefinder Altitude above ground in meters, expressed as * 1000 (millimeters) - * @param alt_extra Extra altitude above ground in meters, expressed as * 1000 (millimeters) - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_altitudes_send(mavlink_channel_t chan, uint32_t time_boot_ms, int32_t alt_gps, int32_t alt_imu, int32_t alt_barometric, int32_t alt_optical_flow, int32_t alt_range_finder, int32_t alt_extra) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_ALTITUDES_LEN]; - _mav_put_uint32_t(buf, 0, time_boot_ms); - _mav_put_int32_t(buf, 4, alt_gps); - _mav_put_int32_t(buf, 8, alt_imu); - _mav_put_int32_t(buf, 12, alt_barometric); - _mav_put_int32_t(buf, 16, alt_optical_flow); - _mav_put_int32_t(buf, 20, alt_range_finder); - _mav_put_int32_t(buf, 24, alt_extra); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ALTITUDES, buf, MAVLINK_MSG_ID_ALTITUDES_MIN_LEN, MAVLINK_MSG_ID_ALTITUDES_LEN, MAVLINK_MSG_ID_ALTITUDES_CRC); -#else - mavlink_altitudes_t packet; - packet.time_boot_ms = time_boot_ms; - packet.alt_gps = alt_gps; - packet.alt_imu = alt_imu; - packet.alt_barometric = alt_barometric; - packet.alt_optical_flow = alt_optical_flow; - packet.alt_range_finder = alt_range_finder; - packet.alt_extra = alt_extra; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ALTITUDES, (const char *)&packet, MAVLINK_MSG_ID_ALTITUDES_MIN_LEN, MAVLINK_MSG_ID_ALTITUDES_LEN, MAVLINK_MSG_ID_ALTITUDES_CRC); -#endif -} - -/** - * @brief Send a altitudes message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_altitudes_send_struct(mavlink_channel_t chan, const mavlink_altitudes_t* altitudes) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_altitudes_send(chan, altitudes->time_boot_ms, altitudes->alt_gps, altitudes->alt_imu, altitudes->alt_barometric, altitudes->alt_optical_flow, altitudes->alt_range_finder, altitudes->alt_extra); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ALTITUDES, (const char *)altitudes, MAVLINK_MSG_ID_ALTITUDES_MIN_LEN, MAVLINK_MSG_ID_ALTITUDES_LEN, MAVLINK_MSG_ID_ALTITUDES_CRC); -#endif -} - -#if MAVLINK_MSG_ID_ALTITUDES_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_altitudes_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, int32_t alt_gps, int32_t alt_imu, int32_t alt_barometric, int32_t alt_optical_flow, int32_t alt_range_finder, int32_t alt_extra) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint32_t(buf, 0, time_boot_ms); - _mav_put_int32_t(buf, 4, alt_gps); - _mav_put_int32_t(buf, 8, alt_imu); - _mav_put_int32_t(buf, 12, alt_barometric); - _mav_put_int32_t(buf, 16, alt_optical_flow); - _mav_put_int32_t(buf, 20, alt_range_finder); - _mav_put_int32_t(buf, 24, alt_extra); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ALTITUDES, buf, MAVLINK_MSG_ID_ALTITUDES_MIN_LEN, MAVLINK_MSG_ID_ALTITUDES_LEN, MAVLINK_MSG_ID_ALTITUDES_CRC); -#else - mavlink_altitudes_t *packet = (mavlink_altitudes_t *)msgbuf; - packet->time_boot_ms = time_boot_ms; - packet->alt_gps = alt_gps; - packet->alt_imu = alt_imu; - packet->alt_barometric = alt_barometric; - packet->alt_optical_flow = alt_optical_flow; - packet->alt_range_finder = alt_range_finder; - packet->alt_extra = alt_extra; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ALTITUDES, (const char *)packet, MAVLINK_MSG_ID_ALTITUDES_MIN_LEN, MAVLINK_MSG_ID_ALTITUDES_LEN, MAVLINK_MSG_ID_ALTITUDES_CRC); -#endif -} -#endif - -#endif - -// MESSAGE ALTITUDES UNPACKING - - -/** - * @brief Get field time_boot_ms from altitudes message - * - * @return Timestamp (milliseconds since system boot) - */ -static inline uint32_t mavlink_msg_altitudes_get_time_boot_ms(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 0); -} - -/** - * @brief Get field alt_gps from altitudes message - * - * @return GPS altitude (MSL) in meters, expressed as * 1000 (millimeters) - */ -static inline int32_t mavlink_msg_altitudes_get_alt_gps(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 4); -} - -/** - * @brief Get field alt_imu from altitudes message - * - * @return IMU altitude above ground in meters, expressed as * 1000 (millimeters) - */ -static inline int32_t mavlink_msg_altitudes_get_alt_imu(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 8); -} - -/** - * @brief Get field alt_barometric from altitudes message - * - * @return barometeric altitude above ground in meters, expressed as * 1000 (millimeters) - */ -static inline int32_t mavlink_msg_altitudes_get_alt_barometric(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 12); -} - -/** - * @brief Get field alt_optical_flow from altitudes message - * - * @return Optical flow altitude above ground in meters, expressed as * 1000 (millimeters) - */ -static inline int32_t mavlink_msg_altitudes_get_alt_optical_flow(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 16); -} - -/** - * @brief Get field alt_range_finder from altitudes message - * - * @return Rangefinder Altitude above ground in meters, expressed as * 1000 (millimeters) - */ -static inline int32_t mavlink_msg_altitudes_get_alt_range_finder(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 20); -} - -/** - * @brief Get field alt_extra from altitudes message - * - * @return Extra altitude above ground in meters, expressed as * 1000 (millimeters) - */ -static inline int32_t mavlink_msg_altitudes_get_alt_extra(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 24); -} - -/** - * @brief Decode a altitudes message into a struct - * - * @param msg The message to decode - * @param altitudes C-struct to decode the message contents into - */ -static inline void mavlink_msg_altitudes_decode(const mavlink_message_t* msg, mavlink_altitudes_t* altitudes) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - altitudes->time_boot_ms = mavlink_msg_altitudes_get_time_boot_ms(msg); - altitudes->alt_gps = mavlink_msg_altitudes_get_alt_gps(msg); - altitudes->alt_imu = mavlink_msg_altitudes_get_alt_imu(msg); - altitudes->alt_barometric = mavlink_msg_altitudes_get_alt_barometric(msg); - altitudes->alt_optical_flow = mavlink_msg_altitudes_get_alt_optical_flow(msg); - altitudes->alt_range_finder = mavlink_msg_altitudes_get_alt_range_finder(msg); - altitudes->alt_extra = mavlink_msg_altitudes_get_alt_extra(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_ALTITUDES_LEN? msg->len : MAVLINK_MSG_ID_ALTITUDES_LEN; - memset(altitudes, 0, MAVLINK_MSG_ID_ALTITUDES_LEN); - memcpy(altitudes, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/matrixpilot/mavlink_msg_flexifunction_buffer_function.h b/matrixpilot/mavlink_msg_flexifunction_buffer_function.h deleted file mode 100644 index 6b20b55a2..000000000 --- a/matrixpilot/mavlink_msg_flexifunction_buffer_function.h +++ /dev/null @@ -1,355 +0,0 @@ -#pragma once -// MESSAGE FLEXIFUNCTION_BUFFER_FUNCTION PACKING - -#define MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION 152 - - -typedef struct __mavlink_flexifunction_buffer_function_t { - uint16_t func_index; /*< Function index*/ - uint16_t func_count; /*< Total count of functions*/ - uint16_t data_address; /*< Address in the flexifunction data, Set to 0xFFFF to use address in target memory*/ - uint16_t data_size; /*< Size of the */ - uint8_t target_system; /*< System ID*/ - uint8_t target_component; /*< Component ID*/ - int8_t data[48]; /*< Settings data*/ -} mavlink_flexifunction_buffer_function_t; - -#define MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN 58 -#define MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_MIN_LEN 58 -#define MAVLINK_MSG_ID_152_LEN 58 -#define MAVLINK_MSG_ID_152_MIN_LEN 58 - -#define MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_CRC 101 -#define MAVLINK_MSG_ID_152_CRC 101 - -#define MAVLINK_MSG_FLEXIFUNCTION_BUFFER_FUNCTION_FIELD_DATA_LEN 48 - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_FLEXIFUNCTION_BUFFER_FUNCTION { \ - 152, \ - "FLEXIFUNCTION_BUFFER_FUNCTION", \ - 7, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_flexifunction_buffer_function_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_flexifunction_buffer_function_t, target_component) }, \ - { "func_index", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_flexifunction_buffer_function_t, func_index) }, \ - { "func_count", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_flexifunction_buffer_function_t, func_count) }, \ - { "data_address", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_flexifunction_buffer_function_t, data_address) }, \ - { "data_size", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_flexifunction_buffer_function_t, data_size) }, \ - { "data", NULL, MAVLINK_TYPE_INT8_T, 48, 10, offsetof(mavlink_flexifunction_buffer_function_t, data) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_FLEXIFUNCTION_BUFFER_FUNCTION { \ - "FLEXIFUNCTION_BUFFER_FUNCTION", \ - 7, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_flexifunction_buffer_function_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_flexifunction_buffer_function_t, target_component) }, \ - { "func_index", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_flexifunction_buffer_function_t, func_index) }, \ - { "func_count", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_flexifunction_buffer_function_t, func_count) }, \ - { "data_address", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_flexifunction_buffer_function_t, data_address) }, \ - { "data_size", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_flexifunction_buffer_function_t, data_size) }, \ - { "data", NULL, MAVLINK_TYPE_INT8_T, 48, 10, offsetof(mavlink_flexifunction_buffer_function_t, data) }, \ - } \ -} -#endif - -/** - * @brief Pack a flexifunction_buffer_function message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param target_system System ID - * @param target_component Component ID - * @param func_index Function index - * @param func_count Total count of functions - * @param data_address Address in the flexifunction data, Set to 0xFFFF to use address in target memory - * @param data_size Size of the - * @param data Settings data - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_flexifunction_buffer_function_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, uint16_t func_index, uint16_t func_count, uint16_t data_address, uint16_t data_size, const int8_t *data) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN]; - _mav_put_uint16_t(buf, 0, func_index); - _mav_put_uint16_t(buf, 2, func_count); - _mav_put_uint16_t(buf, 4, data_address); - _mav_put_uint16_t(buf, 6, data_size); - _mav_put_uint8_t(buf, 8, target_system); - _mav_put_uint8_t(buf, 9, target_component); - _mav_put_int8_t_array(buf, 10, data, 48); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN); -#else - mavlink_flexifunction_buffer_function_t packet; - packet.func_index = func_index; - packet.func_count = func_count; - packet.data_address = data_address; - packet.data_size = data_size; - packet.target_system = target_system; - packet.target_component = target_component; - mav_array_memcpy(packet.data, data, sizeof(int8_t)*48); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_CRC); -} - -/** - * @brief Pack a flexifunction_buffer_function message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param target_system System ID - * @param target_component Component ID - * @param func_index Function index - * @param func_count Total count of functions - * @param data_address Address in the flexifunction data, Set to 0xFFFF to use address in target memory - * @param data_size Size of the - * @param data Settings data - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_flexifunction_buffer_function_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,uint16_t func_index,uint16_t func_count,uint16_t data_address,uint16_t data_size,const int8_t *data) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN]; - _mav_put_uint16_t(buf, 0, func_index); - _mav_put_uint16_t(buf, 2, func_count); - _mav_put_uint16_t(buf, 4, data_address); - _mav_put_uint16_t(buf, 6, data_size); - _mav_put_uint8_t(buf, 8, target_system); - _mav_put_uint8_t(buf, 9, target_component); - _mav_put_int8_t_array(buf, 10, data, 48); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN); -#else - mavlink_flexifunction_buffer_function_t packet; - packet.func_index = func_index; - packet.func_count = func_count; - packet.data_address = data_address; - packet.data_size = data_size; - packet.target_system = target_system; - packet.target_component = target_component; - mav_array_memcpy(packet.data, data, sizeof(int8_t)*48); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_CRC); -} - -/** - * @brief Encode a flexifunction_buffer_function struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param flexifunction_buffer_function C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_flexifunction_buffer_function_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_flexifunction_buffer_function_t* flexifunction_buffer_function) -{ - return mavlink_msg_flexifunction_buffer_function_pack(system_id, component_id, msg, flexifunction_buffer_function->target_system, flexifunction_buffer_function->target_component, flexifunction_buffer_function->func_index, flexifunction_buffer_function->func_count, flexifunction_buffer_function->data_address, flexifunction_buffer_function->data_size, flexifunction_buffer_function->data); -} - -/** - * @brief Encode a flexifunction_buffer_function struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param flexifunction_buffer_function C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_flexifunction_buffer_function_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_flexifunction_buffer_function_t* flexifunction_buffer_function) -{ - return mavlink_msg_flexifunction_buffer_function_pack_chan(system_id, component_id, chan, msg, flexifunction_buffer_function->target_system, flexifunction_buffer_function->target_component, flexifunction_buffer_function->func_index, flexifunction_buffer_function->func_count, flexifunction_buffer_function->data_address, flexifunction_buffer_function->data_size, flexifunction_buffer_function->data); -} - -/** - * @brief Send a flexifunction_buffer_function message - * @param chan MAVLink channel to send the message - * - * @param target_system System ID - * @param target_component Component ID - * @param func_index Function index - * @param func_count Total count of functions - * @param data_address Address in the flexifunction data, Set to 0xFFFF to use address in target memory - * @param data_size Size of the - * @param data Settings data - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_flexifunction_buffer_function_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint16_t func_index, uint16_t func_count, uint16_t data_address, uint16_t data_size, const int8_t *data) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN]; - _mav_put_uint16_t(buf, 0, func_index); - _mav_put_uint16_t(buf, 2, func_count); - _mav_put_uint16_t(buf, 4, data_address); - _mav_put_uint16_t(buf, 6, data_size); - _mav_put_uint8_t(buf, 8, target_system); - _mav_put_uint8_t(buf, 9, target_component); - _mav_put_int8_t_array(buf, 10, data, 48); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION, buf, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_CRC); -#else - mavlink_flexifunction_buffer_function_t packet; - packet.func_index = func_index; - packet.func_count = func_count; - packet.data_address = data_address; - packet.data_size = data_size; - packet.target_system = target_system; - packet.target_component = target_component; - mav_array_memcpy(packet.data, data, sizeof(int8_t)*48); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION, (const char *)&packet, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_CRC); -#endif -} - -/** - * @brief Send a flexifunction_buffer_function message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_flexifunction_buffer_function_send_struct(mavlink_channel_t chan, const mavlink_flexifunction_buffer_function_t* flexifunction_buffer_function) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_flexifunction_buffer_function_send(chan, flexifunction_buffer_function->target_system, flexifunction_buffer_function->target_component, flexifunction_buffer_function->func_index, flexifunction_buffer_function->func_count, flexifunction_buffer_function->data_address, flexifunction_buffer_function->data_size, flexifunction_buffer_function->data); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION, (const char *)flexifunction_buffer_function, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_CRC); -#endif -} - -#if MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_flexifunction_buffer_function_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint16_t func_index, uint16_t func_count, uint16_t data_address, uint16_t data_size, const int8_t *data) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint16_t(buf, 0, func_index); - _mav_put_uint16_t(buf, 2, func_count); - _mav_put_uint16_t(buf, 4, data_address); - _mav_put_uint16_t(buf, 6, data_size); - _mav_put_uint8_t(buf, 8, target_system); - _mav_put_uint8_t(buf, 9, target_component); - _mav_put_int8_t_array(buf, 10, data, 48); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION, buf, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_CRC); -#else - mavlink_flexifunction_buffer_function_t *packet = (mavlink_flexifunction_buffer_function_t *)msgbuf; - packet->func_index = func_index; - packet->func_count = func_count; - packet->data_address = data_address; - packet->data_size = data_size; - packet->target_system = target_system; - packet->target_component = target_component; - mav_array_memcpy(packet->data, data, sizeof(int8_t)*48); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION, (const char *)packet, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_CRC); -#endif -} -#endif - -#endif - -// MESSAGE FLEXIFUNCTION_BUFFER_FUNCTION UNPACKING - - -/** - * @brief Get field target_system from flexifunction_buffer_function message - * - * @return System ID - */ -static inline uint8_t mavlink_msg_flexifunction_buffer_function_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 8); -} - -/** - * @brief Get field target_component from flexifunction_buffer_function message - * - * @return Component ID - */ -static inline uint8_t mavlink_msg_flexifunction_buffer_function_get_target_component(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 9); -} - -/** - * @brief Get field func_index from flexifunction_buffer_function message - * - * @return Function index - */ -static inline uint16_t mavlink_msg_flexifunction_buffer_function_get_func_index(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 0); -} - -/** - * @brief Get field func_count from flexifunction_buffer_function message - * - * @return Total count of functions - */ -static inline uint16_t mavlink_msg_flexifunction_buffer_function_get_func_count(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 2); -} - -/** - * @brief Get field data_address from flexifunction_buffer_function message - * - * @return Address in the flexifunction data, Set to 0xFFFF to use address in target memory - */ -static inline uint16_t mavlink_msg_flexifunction_buffer_function_get_data_address(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 4); -} - -/** - * @brief Get field data_size from flexifunction_buffer_function message - * - * @return Size of the - */ -static inline uint16_t mavlink_msg_flexifunction_buffer_function_get_data_size(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 6); -} - -/** - * @brief Get field data from flexifunction_buffer_function message - * - * @return Settings data - */ -static inline uint16_t mavlink_msg_flexifunction_buffer_function_get_data(const mavlink_message_t* msg, int8_t *data) -{ - return _MAV_RETURN_int8_t_array(msg, data, 48, 10); -} - -/** - * @brief Decode a flexifunction_buffer_function message into a struct - * - * @param msg The message to decode - * @param flexifunction_buffer_function C-struct to decode the message contents into - */ -static inline void mavlink_msg_flexifunction_buffer_function_decode(const mavlink_message_t* msg, mavlink_flexifunction_buffer_function_t* flexifunction_buffer_function) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - flexifunction_buffer_function->func_index = mavlink_msg_flexifunction_buffer_function_get_func_index(msg); - flexifunction_buffer_function->func_count = mavlink_msg_flexifunction_buffer_function_get_func_count(msg); - flexifunction_buffer_function->data_address = mavlink_msg_flexifunction_buffer_function_get_data_address(msg); - flexifunction_buffer_function->data_size = mavlink_msg_flexifunction_buffer_function_get_data_size(msg); - flexifunction_buffer_function->target_system = mavlink_msg_flexifunction_buffer_function_get_target_system(msg); - flexifunction_buffer_function->target_component = mavlink_msg_flexifunction_buffer_function_get_target_component(msg); - mavlink_msg_flexifunction_buffer_function_get_data(msg, flexifunction_buffer_function->data); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN? msg->len : MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN; - memset(flexifunction_buffer_function, 0, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN); - memcpy(flexifunction_buffer_function, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/matrixpilot/mavlink_msg_flexifunction_buffer_function_ack.h b/matrixpilot/mavlink_msg_flexifunction_buffer_function_ack.h deleted file mode 100644 index e7f1faf73..000000000 --- a/matrixpilot/mavlink_msg_flexifunction_buffer_function_ack.h +++ /dev/null @@ -1,288 +0,0 @@ -#pragma once -// MESSAGE FLEXIFUNCTION_BUFFER_FUNCTION_ACK PACKING - -#define MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK 153 - - -typedef struct __mavlink_flexifunction_buffer_function_ack_t { - uint16_t func_index; /*< Function index*/ - uint16_t result; /*< result of acknowledge, 0=fail, 1=good*/ - uint8_t target_system; /*< System ID*/ - uint8_t target_component; /*< Component ID*/ -} mavlink_flexifunction_buffer_function_ack_t; - -#define MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN 6 -#define MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_MIN_LEN 6 -#define MAVLINK_MSG_ID_153_LEN 6 -#define MAVLINK_MSG_ID_153_MIN_LEN 6 - -#define MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_CRC 109 -#define MAVLINK_MSG_ID_153_CRC 109 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_FLEXIFUNCTION_BUFFER_FUNCTION_ACK { \ - 153, \ - "FLEXIFUNCTION_BUFFER_FUNCTION_ACK", \ - 4, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_flexifunction_buffer_function_ack_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_flexifunction_buffer_function_ack_t, target_component) }, \ - { "func_index", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_flexifunction_buffer_function_ack_t, func_index) }, \ - { "result", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_flexifunction_buffer_function_ack_t, result) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_FLEXIFUNCTION_BUFFER_FUNCTION_ACK { \ - "FLEXIFUNCTION_BUFFER_FUNCTION_ACK", \ - 4, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_flexifunction_buffer_function_ack_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_flexifunction_buffer_function_ack_t, target_component) }, \ - { "func_index", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_flexifunction_buffer_function_ack_t, func_index) }, \ - { "result", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_flexifunction_buffer_function_ack_t, result) }, \ - } \ -} -#endif - -/** - * @brief Pack a flexifunction_buffer_function_ack message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param target_system System ID - * @param target_component Component ID - * @param func_index Function index - * @param result result of acknowledge, 0=fail, 1=good - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_flexifunction_buffer_function_ack_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, uint16_t func_index, uint16_t result) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN]; - _mav_put_uint16_t(buf, 0, func_index); - _mav_put_uint16_t(buf, 2, result); - _mav_put_uint8_t(buf, 4, target_system); - _mav_put_uint8_t(buf, 5, target_component); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN); -#else - mavlink_flexifunction_buffer_function_ack_t packet; - packet.func_index = func_index; - packet.result = result; - packet.target_system = target_system; - packet.target_component = target_component; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_CRC); -} - -/** - * @brief Pack a flexifunction_buffer_function_ack message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param target_system System ID - * @param target_component Component ID - * @param func_index Function index - * @param result result of acknowledge, 0=fail, 1=good - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_flexifunction_buffer_function_ack_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,uint16_t func_index,uint16_t result) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN]; - _mav_put_uint16_t(buf, 0, func_index); - _mav_put_uint16_t(buf, 2, result); - _mav_put_uint8_t(buf, 4, target_system); - _mav_put_uint8_t(buf, 5, target_component); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN); -#else - mavlink_flexifunction_buffer_function_ack_t packet; - packet.func_index = func_index; - packet.result = result; - packet.target_system = target_system; - packet.target_component = target_component; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_CRC); -} - -/** - * @brief Encode a flexifunction_buffer_function_ack struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param flexifunction_buffer_function_ack C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_flexifunction_buffer_function_ack_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_flexifunction_buffer_function_ack_t* flexifunction_buffer_function_ack) -{ - return mavlink_msg_flexifunction_buffer_function_ack_pack(system_id, component_id, msg, flexifunction_buffer_function_ack->target_system, flexifunction_buffer_function_ack->target_component, flexifunction_buffer_function_ack->func_index, flexifunction_buffer_function_ack->result); -} - -/** - * @brief Encode a flexifunction_buffer_function_ack struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param flexifunction_buffer_function_ack C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_flexifunction_buffer_function_ack_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_flexifunction_buffer_function_ack_t* flexifunction_buffer_function_ack) -{ - return mavlink_msg_flexifunction_buffer_function_ack_pack_chan(system_id, component_id, chan, msg, flexifunction_buffer_function_ack->target_system, flexifunction_buffer_function_ack->target_component, flexifunction_buffer_function_ack->func_index, flexifunction_buffer_function_ack->result); -} - -/** - * @brief Send a flexifunction_buffer_function_ack message - * @param chan MAVLink channel to send the message - * - * @param target_system System ID - * @param target_component Component ID - * @param func_index Function index - * @param result result of acknowledge, 0=fail, 1=good - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_flexifunction_buffer_function_ack_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint16_t func_index, uint16_t result) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN]; - _mav_put_uint16_t(buf, 0, func_index); - _mav_put_uint16_t(buf, 2, result); - _mav_put_uint8_t(buf, 4, target_system); - _mav_put_uint8_t(buf, 5, target_component); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK, buf, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_CRC); -#else - mavlink_flexifunction_buffer_function_ack_t packet; - packet.func_index = func_index; - packet.result = result; - packet.target_system = target_system; - packet.target_component = target_component; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK, (const char *)&packet, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_CRC); -#endif -} - -/** - * @brief Send a flexifunction_buffer_function_ack message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_flexifunction_buffer_function_ack_send_struct(mavlink_channel_t chan, const mavlink_flexifunction_buffer_function_ack_t* flexifunction_buffer_function_ack) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_flexifunction_buffer_function_ack_send(chan, flexifunction_buffer_function_ack->target_system, flexifunction_buffer_function_ack->target_component, flexifunction_buffer_function_ack->func_index, flexifunction_buffer_function_ack->result); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK, (const char *)flexifunction_buffer_function_ack, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_CRC); -#endif -} - -#if MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_flexifunction_buffer_function_ack_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint16_t func_index, uint16_t result) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint16_t(buf, 0, func_index); - _mav_put_uint16_t(buf, 2, result); - _mav_put_uint8_t(buf, 4, target_system); - _mav_put_uint8_t(buf, 5, target_component); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK, buf, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_CRC); -#else - mavlink_flexifunction_buffer_function_ack_t *packet = (mavlink_flexifunction_buffer_function_ack_t *)msgbuf; - packet->func_index = func_index; - packet->result = result; - packet->target_system = target_system; - packet->target_component = target_component; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK, (const char *)packet, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_CRC); -#endif -} -#endif - -#endif - -// MESSAGE FLEXIFUNCTION_BUFFER_FUNCTION_ACK UNPACKING - - -/** - * @brief Get field target_system from flexifunction_buffer_function_ack message - * - * @return System ID - */ -static inline uint8_t mavlink_msg_flexifunction_buffer_function_ack_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 4); -} - -/** - * @brief Get field target_component from flexifunction_buffer_function_ack message - * - * @return Component ID - */ -static inline uint8_t mavlink_msg_flexifunction_buffer_function_ack_get_target_component(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 5); -} - -/** - * @brief Get field func_index from flexifunction_buffer_function_ack message - * - * @return Function index - */ -static inline uint16_t mavlink_msg_flexifunction_buffer_function_ack_get_func_index(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 0); -} - -/** - * @brief Get field result from flexifunction_buffer_function_ack message - * - * @return result of acknowledge, 0=fail, 1=good - */ -static inline uint16_t mavlink_msg_flexifunction_buffer_function_ack_get_result(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 2); -} - -/** - * @brief Decode a flexifunction_buffer_function_ack message into a struct - * - * @param msg The message to decode - * @param flexifunction_buffer_function_ack C-struct to decode the message contents into - */ -static inline void mavlink_msg_flexifunction_buffer_function_ack_decode(const mavlink_message_t* msg, mavlink_flexifunction_buffer_function_ack_t* flexifunction_buffer_function_ack) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - flexifunction_buffer_function_ack->func_index = mavlink_msg_flexifunction_buffer_function_ack_get_func_index(msg); - flexifunction_buffer_function_ack->result = mavlink_msg_flexifunction_buffer_function_ack_get_result(msg); - flexifunction_buffer_function_ack->target_system = mavlink_msg_flexifunction_buffer_function_ack_get_target_system(msg); - flexifunction_buffer_function_ack->target_component = mavlink_msg_flexifunction_buffer_function_ack_get_target_component(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN? msg->len : MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN; - memset(flexifunction_buffer_function_ack, 0, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN); - memcpy(flexifunction_buffer_function_ack, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/matrixpilot/mavlink_msg_flexifunction_command.h b/matrixpilot/mavlink_msg_flexifunction_command.h deleted file mode 100644 index 0b842e9da..000000000 --- a/matrixpilot/mavlink_msg_flexifunction_command.h +++ /dev/null @@ -1,263 +0,0 @@ -#pragma once -// MESSAGE FLEXIFUNCTION_COMMAND PACKING - -#define MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND 157 - - -typedef struct __mavlink_flexifunction_command_t { - uint8_t target_system; /*< System ID*/ - uint8_t target_component; /*< Component ID*/ - uint8_t command_type; /*< Flexifunction command type*/ -} mavlink_flexifunction_command_t; - -#define MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_LEN 3 -#define MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_MIN_LEN 3 -#define MAVLINK_MSG_ID_157_LEN 3 -#define MAVLINK_MSG_ID_157_MIN_LEN 3 - -#define MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_CRC 133 -#define MAVLINK_MSG_ID_157_CRC 133 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_FLEXIFUNCTION_COMMAND { \ - 157, \ - "FLEXIFUNCTION_COMMAND", \ - 3, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_flexifunction_command_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_flexifunction_command_t, target_component) }, \ - { "command_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_flexifunction_command_t, command_type) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_FLEXIFUNCTION_COMMAND { \ - "FLEXIFUNCTION_COMMAND", \ - 3, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_flexifunction_command_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_flexifunction_command_t, target_component) }, \ - { "command_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_flexifunction_command_t, command_type) }, \ - } \ -} -#endif - -/** - * @brief Pack a flexifunction_command message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param target_system System ID - * @param target_component Component ID - * @param command_type Flexifunction command type - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_flexifunction_command_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, uint8_t command_type) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_LEN]; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, command_type); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_LEN); -#else - mavlink_flexifunction_command_t packet; - packet.target_system = target_system; - packet.target_component = target_component; - packet.command_type = command_type; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_CRC); -} - -/** - * @brief Pack a flexifunction_command message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param target_system System ID - * @param target_component Component ID - * @param command_type Flexifunction command type - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_flexifunction_command_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,uint8_t command_type) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_LEN]; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, command_type); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_LEN); -#else - mavlink_flexifunction_command_t packet; - packet.target_system = target_system; - packet.target_component = target_component; - packet.command_type = command_type; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_CRC); -} - -/** - * @brief Encode a flexifunction_command struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param flexifunction_command C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_flexifunction_command_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_flexifunction_command_t* flexifunction_command) -{ - return mavlink_msg_flexifunction_command_pack(system_id, component_id, msg, flexifunction_command->target_system, flexifunction_command->target_component, flexifunction_command->command_type); -} - -/** - * @brief Encode a flexifunction_command struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param flexifunction_command C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_flexifunction_command_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_flexifunction_command_t* flexifunction_command) -{ - return mavlink_msg_flexifunction_command_pack_chan(system_id, component_id, chan, msg, flexifunction_command->target_system, flexifunction_command->target_component, flexifunction_command->command_type); -} - -/** - * @brief Send a flexifunction_command message - * @param chan MAVLink channel to send the message - * - * @param target_system System ID - * @param target_component Component ID - * @param command_type Flexifunction command type - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_flexifunction_command_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t command_type) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_LEN]; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, command_type); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND, buf, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_CRC); -#else - mavlink_flexifunction_command_t packet; - packet.target_system = target_system; - packet.target_component = target_component; - packet.command_type = command_type; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND, (const char *)&packet, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_CRC); -#endif -} - -/** - * @brief Send a flexifunction_command message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_flexifunction_command_send_struct(mavlink_channel_t chan, const mavlink_flexifunction_command_t* flexifunction_command) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_flexifunction_command_send(chan, flexifunction_command->target_system, flexifunction_command->target_component, flexifunction_command->command_type); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND, (const char *)flexifunction_command, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_CRC); -#endif -} - -#if MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_flexifunction_command_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t command_type) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, command_type); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND, buf, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_CRC); -#else - mavlink_flexifunction_command_t *packet = (mavlink_flexifunction_command_t *)msgbuf; - packet->target_system = target_system; - packet->target_component = target_component; - packet->command_type = command_type; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND, (const char *)packet, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_CRC); -#endif -} -#endif - -#endif - -// MESSAGE FLEXIFUNCTION_COMMAND UNPACKING - - -/** - * @brief Get field target_system from flexifunction_command message - * - * @return System ID - */ -static inline uint8_t mavlink_msg_flexifunction_command_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 0); -} - -/** - * @brief Get field target_component from flexifunction_command message - * - * @return Component ID - */ -static inline uint8_t mavlink_msg_flexifunction_command_get_target_component(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 1); -} - -/** - * @brief Get field command_type from flexifunction_command message - * - * @return Flexifunction command type - */ -static inline uint8_t mavlink_msg_flexifunction_command_get_command_type(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 2); -} - -/** - * @brief Decode a flexifunction_command message into a struct - * - * @param msg The message to decode - * @param flexifunction_command C-struct to decode the message contents into - */ -static inline void mavlink_msg_flexifunction_command_decode(const mavlink_message_t* msg, mavlink_flexifunction_command_t* flexifunction_command) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - flexifunction_command->target_system = mavlink_msg_flexifunction_command_get_target_system(msg); - flexifunction_command->target_component = mavlink_msg_flexifunction_command_get_target_component(msg); - flexifunction_command->command_type = mavlink_msg_flexifunction_command_get_command_type(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_LEN? msg->len : MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_LEN; - memset(flexifunction_command, 0, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_LEN); - memcpy(flexifunction_command, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/matrixpilot/mavlink_msg_flexifunction_command_ack.h b/matrixpilot/mavlink_msg_flexifunction_command_ack.h deleted file mode 100644 index fbaa983cf..000000000 --- a/matrixpilot/mavlink_msg_flexifunction_command_ack.h +++ /dev/null @@ -1,238 +0,0 @@ -#pragma once -// MESSAGE FLEXIFUNCTION_COMMAND_ACK PACKING - -#define MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK 158 - - -typedef struct __mavlink_flexifunction_command_ack_t { - uint16_t command_type; /*< Command acknowledged*/ - uint16_t result; /*< result of acknowledge*/ -} mavlink_flexifunction_command_ack_t; - -#define MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_LEN 4 -#define MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_MIN_LEN 4 -#define MAVLINK_MSG_ID_158_LEN 4 -#define MAVLINK_MSG_ID_158_MIN_LEN 4 - -#define MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_CRC 208 -#define MAVLINK_MSG_ID_158_CRC 208 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_FLEXIFUNCTION_COMMAND_ACK { \ - 158, \ - "FLEXIFUNCTION_COMMAND_ACK", \ - 2, \ - { { "command_type", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_flexifunction_command_ack_t, command_type) }, \ - { "result", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_flexifunction_command_ack_t, result) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_FLEXIFUNCTION_COMMAND_ACK { \ - "FLEXIFUNCTION_COMMAND_ACK", \ - 2, \ - { { "command_type", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_flexifunction_command_ack_t, command_type) }, \ - { "result", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_flexifunction_command_ack_t, result) }, \ - } \ -} -#endif - -/** - * @brief Pack a flexifunction_command_ack message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param command_type Command acknowledged - * @param result result of acknowledge - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_flexifunction_command_ack_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint16_t command_type, uint16_t result) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_LEN]; - _mav_put_uint16_t(buf, 0, command_type); - _mav_put_uint16_t(buf, 2, result); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_LEN); -#else - mavlink_flexifunction_command_ack_t packet; - packet.command_type = command_type; - packet.result = result; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_CRC); -} - -/** - * @brief Pack a flexifunction_command_ack message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param command_type Command acknowledged - * @param result result of acknowledge - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_flexifunction_command_ack_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint16_t command_type,uint16_t result) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_LEN]; - _mav_put_uint16_t(buf, 0, command_type); - _mav_put_uint16_t(buf, 2, result); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_LEN); -#else - mavlink_flexifunction_command_ack_t packet; - packet.command_type = command_type; - packet.result = result; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_CRC); -} - -/** - * @brief Encode a flexifunction_command_ack struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param flexifunction_command_ack C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_flexifunction_command_ack_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_flexifunction_command_ack_t* flexifunction_command_ack) -{ - return mavlink_msg_flexifunction_command_ack_pack(system_id, component_id, msg, flexifunction_command_ack->command_type, flexifunction_command_ack->result); -} - -/** - * @brief Encode a flexifunction_command_ack struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param flexifunction_command_ack C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_flexifunction_command_ack_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_flexifunction_command_ack_t* flexifunction_command_ack) -{ - return mavlink_msg_flexifunction_command_ack_pack_chan(system_id, component_id, chan, msg, flexifunction_command_ack->command_type, flexifunction_command_ack->result); -} - -/** - * @brief Send a flexifunction_command_ack message - * @param chan MAVLink channel to send the message - * - * @param command_type Command acknowledged - * @param result result of acknowledge - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_flexifunction_command_ack_send(mavlink_channel_t chan, uint16_t command_type, uint16_t result) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_LEN]; - _mav_put_uint16_t(buf, 0, command_type); - _mav_put_uint16_t(buf, 2, result); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK, buf, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_CRC); -#else - mavlink_flexifunction_command_ack_t packet; - packet.command_type = command_type; - packet.result = result; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK, (const char *)&packet, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_CRC); -#endif -} - -/** - * @brief Send a flexifunction_command_ack message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_flexifunction_command_ack_send_struct(mavlink_channel_t chan, const mavlink_flexifunction_command_ack_t* flexifunction_command_ack) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_flexifunction_command_ack_send(chan, flexifunction_command_ack->command_type, flexifunction_command_ack->result); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK, (const char *)flexifunction_command_ack, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_CRC); -#endif -} - -#if MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_flexifunction_command_ack_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint16_t command_type, uint16_t result) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint16_t(buf, 0, command_type); - _mav_put_uint16_t(buf, 2, result); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK, buf, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_CRC); -#else - mavlink_flexifunction_command_ack_t *packet = (mavlink_flexifunction_command_ack_t *)msgbuf; - packet->command_type = command_type; - packet->result = result; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK, (const char *)packet, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_CRC); -#endif -} -#endif - -#endif - -// MESSAGE FLEXIFUNCTION_COMMAND_ACK UNPACKING - - -/** - * @brief Get field command_type from flexifunction_command_ack message - * - * @return Command acknowledged - */ -static inline uint16_t mavlink_msg_flexifunction_command_ack_get_command_type(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 0); -} - -/** - * @brief Get field result from flexifunction_command_ack message - * - * @return result of acknowledge - */ -static inline uint16_t mavlink_msg_flexifunction_command_ack_get_result(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 2); -} - -/** - * @brief Decode a flexifunction_command_ack message into a struct - * - * @param msg The message to decode - * @param flexifunction_command_ack C-struct to decode the message contents into - */ -static inline void mavlink_msg_flexifunction_command_ack_decode(const mavlink_message_t* msg, mavlink_flexifunction_command_ack_t* flexifunction_command_ack) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - flexifunction_command_ack->command_type = mavlink_msg_flexifunction_command_ack_get_command_type(msg); - flexifunction_command_ack->result = mavlink_msg_flexifunction_command_ack_get_result(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_LEN? msg->len : MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_LEN; - memset(flexifunction_command_ack, 0, MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_LEN); - memcpy(flexifunction_command_ack, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/matrixpilot/mavlink_msg_flexifunction_directory.h b/matrixpilot/mavlink_msg_flexifunction_directory.h deleted file mode 100644 index a2c7b5a1e..000000000 --- a/matrixpilot/mavlink_msg_flexifunction_directory.h +++ /dev/null @@ -1,330 +0,0 @@ -#pragma once -// MESSAGE FLEXIFUNCTION_DIRECTORY PACKING - -#define MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY 155 - - -typedef struct __mavlink_flexifunction_directory_t { - uint8_t target_system; /*< System ID*/ - uint8_t target_component; /*< Component ID*/ - uint8_t directory_type; /*< 0=inputs, 1=outputs*/ - uint8_t start_index; /*< index of first directory entry to write*/ - uint8_t count; /*< count of directory entries to write*/ - int8_t directory_data[48]; /*< Settings data*/ -} mavlink_flexifunction_directory_t; - -#define MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_LEN 53 -#define MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_MIN_LEN 53 -#define MAVLINK_MSG_ID_155_LEN 53 -#define MAVLINK_MSG_ID_155_MIN_LEN 53 - -#define MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_CRC 12 -#define MAVLINK_MSG_ID_155_CRC 12 - -#define MAVLINK_MSG_FLEXIFUNCTION_DIRECTORY_FIELD_DIRECTORY_DATA_LEN 48 - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_FLEXIFUNCTION_DIRECTORY { \ - 155, \ - "FLEXIFUNCTION_DIRECTORY", \ - 6, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_flexifunction_directory_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_flexifunction_directory_t, target_component) }, \ - { "directory_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_flexifunction_directory_t, directory_type) }, \ - { "start_index", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_flexifunction_directory_t, start_index) }, \ - { "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_flexifunction_directory_t, count) }, \ - { "directory_data", NULL, MAVLINK_TYPE_INT8_T, 48, 5, offsetof(mavlink_flexifunction_directory_t, directory_data) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_FLEXIFUNCTION_DIRECTORY { \ - "FLEXIFUNCTION_DIRECTORY", \ - 6, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_flexifunction_directory_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_flexifunction_directory_t, target_component) }, \ - { "directory_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_flexifunction_directory_t, directory_type) }, \ - { "start_index", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_flexifunction_directory_t, start_index) }, \ - { "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_flexifunction_directory_t, count) }, \ - { "directory_data", NULL, MAVLINK_TYPE_INT8_T, 48, 5, offsetof(mavlink_flexifunction_directory_t, directory_data) }, \ - } \ -} -#endif - -/** - * @brief Pack a flexifunction_directory message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param target_system System ID - * @param target_component Component ID - * @param directory_type 0=inputs, 1=outputs - * @param start_index index of first directory entry to write - * @param count count of directory entries to write - * @param directory_data Settings data - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_flexifunction_directory_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, uint8_t directory_type, uint8_t start_index, uint8_t count, const int8_t *directory_data) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_LEN]; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, directory_type); - _mav_put_uint8_t(buf, 3, start_index); - _mav_put_uint8_t(buf, 4, count); - _mav_put_int8_t_array(buf, 5, directory_data, 48); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_LEN); -#else - mavlink_flexifunction_directory_t packet; - packet.target_system = target_system; - packet.target_component = target_component; - packet.directory_type = directory_type; - packet.start_index = start_index; - packet.count = count; - mav_array_memcpy(packet.directory_data, directory_data, sizeof(int8_t)*48); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_CRC); -} - -/** - * @brief Pack a flexifunction_directory message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param target_system System ID - * @param target_component Component ID - * @param directory_type 0=inputs, 1=outputs - * @param start_index index of first directory entry to write - * @param count count of directory entries to write - * @param directory_data Settings data - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_flexifunction_directory_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,uint8_t directory_type,uint8_t start_index,uint8_t count,const int8_t *directory_data) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_LEN]; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, directory_type); - _mav_put_uint8_t(buf, 3, start_index); - _mav_put_uint8_t(buf, 4, count); - _mav_put_int8_t_array(buf, 5, directory_data, 48); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_LEN); -#else - mavlink_flexifunction_directory_t packet; - packet.target_system = target_system; - packet.target_component = target_component; - packet.directory_type = directory_type; - packet.start_index = start_index; - packet.count = count; - mav_array_memcpy(packet.directory_data, directory_data, sizeof(int8_t)*48); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_CRC); -} - -/** - * @brief Encode a flexifunction_directory struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param flexifunction_directory C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_flexifunction_directory_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_flexifunction_directory_t* flexifunction_directory) -{ - return mavlink_msg_flexifunction_directory_pack(system_id, component_id, msg, flexifunction_directory->target_system, flexifunction_directory->target_component, flexifunction_directory->directory_type, flexifunction_directory->start_index, flexifunction_directory->count, flexifunction_directory->directory_data); -} - -/** - * @brief Encode a flexifunction_directory struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param flexifunction_directory C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_flexifunction_directory_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_flexifunction_directory_t* flexifunction_directory) -{ - return mavlink_msg_flexifunction_directory_pack_chan(system_id, component_id, chan, msg, flexifunction_directory->target_system, flexifunction_directory->target_component, flexifunction_directory->directory_type, flexifunction_directory->start_index, flexifunction_directory->count, flexifunction_directory->directory_data); -} - -/** - * @brief Send a flexifunction_directory message - * @param chan MAVLink channel to send the message - * - * @param target_system System ID - * @param target_component Component ID - * @param directory_type 0=inputs, 1=outputs - * @param start_index index of first directory entry to write - * @param count count of directory entries to write - * @param directory_data Settings data - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_flexifunction_directory_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t directory_type, uint8_t start_index, uint8_t count, const int8_t *directory_data) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_LEN]; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, directory_type); - _mav_put_uint8_t(buf, 3, start_index); - _mav_put_uint8_t(buf, 4, count); - _mav_put_int8_t_array(buf, 5, directory_data, 48); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY, buf, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_CRC); -#else - mavlink_flexifunction_directory_t packet; - packet.target_system = target_system; - packet.target_component = target_component; - packet.directory_type = directory_type; - packet.start_index = start_index; - packet.count = count; - mav_array_memcpy(packet.directory_data, directory_data, sizeof(int8_t)*48); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY, (const char *)&packet, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_CRC); -#endif -} - -/** - * @brief Send a flexifunction_directory message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_flexifunction_directory_send_struct(mavlink_channel_t chan, const mavlink_flexifunction_directory_t* flexifunction_directory) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_flexifunction_directory_send(chan, flexifunction_directory->target_system, flexifunction_directory->target_component, flexifunction_directory->directory_type, flexifunction_directory->start_index, flexifunction_directory->count, flexifunction_directory->directory_data); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY, (const char *)flexifunction_directory, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_CRC); -#endif -} - -#if MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_flexifunction_directory_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t directory_type, uint8_t start_index, uint8_t count, const int8_t *directory_data) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - _mav_put_uint8_t(buf, 2, directory_type); - _mav_put_uint8_t(buf, 3, start_index); - _mav_put_uint8_t(buf, 4, count); - _mav_put_int8_t_array(buf, 5, directory_data, 48); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY, buf, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_CRC); -#else - mavlink_flexifunction_directory_t *packet = (mavlink_flexifunction_directory_t *)msgbuf; - packet->target_system = target_system; - packet->target_component = target_component; - packet->directory_type = directory_type; - packet->start_index = start_index; - packet->count = count; - mav_array_memcpy(packet->directory_data, directory_data, sizeof(int8_t)*48); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY, (const char *)packet, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_CRC); -#endif -} -#endif - -#endif - -// MESSAGE FLEXIFUNCTION_DIRECTORY UNPACKING - - -/** - * @brief Get field target_system from flexifunction_directory message - * - * @return System ID - */ -static inline uint8_t mavlink_msg_flexifunction_directory_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 0); -} - -/** - * @brief Get field target_component from flexifunction_directory message - * - * @return Component ID - */ -static inline uint8_t mavlink_msg_flexifunction_directory_get_target_component(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 1); -} - -/** - * @brief Get field directory_type from flexifunction_directory message - * - * @return 0=inputs, 1=outputs - */ -static inline uint8_t mavlink_msg_flexifunction_directory_get_directory_type(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 2); -} - -/** - * @brief Get field start_index from flexifunction_directory message - * - * @return index of first directory entry to write - */ -static inline uint8_t mavlink_msg_flexifunction_directory_get_start_index(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 3); -} - -/** - * @brief Get field count from flexifunction_directory message - * - * @return count of directory entries to write - */ -static inline uint8_t mavlink_msg_flexifunction_directory_get_count(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 4); -} - -/** - * @brief Get field directory_data from flexifunction_directory message - * - * @return Settings data - */ -static inline uint16_t mavlink_msg_flexifunction_directory_get_directory_data(const mavlink_message_t* msg, int8_t *directory_data) -{ - return _MAV_RETURN_int8_t_array(msg, directory_data, 48, 5); -} - -/** - * @brief Decode a flexifunction_directory message into a struct - * - * @param msg The message to decode - * @param flexifunction_directory C-struct to decode the message contents into - */ -static inline void mavlink_msg_flexifunction_directory_decode(const mavlink_message_t* msg, mavlink_flexifunction_directory_t* flexifunction_directory) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - flexifunction_directory->target_system = mavlink_msg_flexifunction_directory_get_target_system(msg); - flexifunction_directory->target_component = mavlink_msg_flexifunction_directory_get_target_component(msg); - flexifunction_directory->directory_type = mavlink_msg_flexifunction_directory_get_directory_type(msg); - flexifunction_directory->start_index = mavlink_msg_flexifunction_directory_get_start_index(msg); - flexifunction_directory->count = mavlink_msg_flexifunction_directory_get_count(msg); - mavlink_msg_flexifunction_directory_get_directory_data(msg, flexifunction_directory->directory_data); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_LEN? msg->len : MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_LEN; - memset(flexifunction_directory, 0, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_LEN); - memcpy(flexifunction_directory, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/matrixpilot/mavlink_msg_flexifunction_directory_ack.h b/matrixpilot/mavlink_msg_flexifunction_directory_ack.h deleted file mode 100644 index 27c9354dd..000000000 --- a/matrixpilot/mavlink_msg_flexifunction_directory_ack.h +++ /dev/null @@ -1,338 +0,0 @@ -#pragma once -// MESSAGE FLEXIFUNCTION_DIRECTORY_ACK PACKING - -#define MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK 156 - - -typedef struct __mavlink_flexifunction_directory_ack_t { - uint16_t result; /*< result of acknowledge, 0=fail, 1=good*/ - uint8_t target_system; /*< System ID*/ - uint8_t target_component; /*< Component ID*/ - uint8_t directory_type; /*< 0=inputs, 1=outputs*/ - uint8_t start_index; /*< index of first directory entry to write*/ - uint8_t count; /*< count of directory entries to write*/ -} mavlink_flexifunction_directory_ack_t; - -#define MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_LEN 7 -#define MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_MIN_LEN 7 -#define MAVLINK_MSG_ID_156_LEN 7 -#define MAVLINK_MSG_ID_156_MIN_LEN 7 - -#define MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_CRC 218 -#define MAVLINK_MSG_ID_156_CRC 218 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_FLEXIFUNCTION_DIRECTORY_ACK { \ - 156, \ - "FLEXIFUNCTION_DIRECTORY_ACK", \ - 6, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_flexifunction_directory_ack_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_flexifunction_directory_ack_t, target_component) }, \ - { "directory_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_flexifunction_directory_ack_t, directory_type) }, \ - { "start_index", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_flexifunction_directory_ack_t, start_index) }, \ - { "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_flexifunction_directory_ack_t, count) }, \ - { "result", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_flexifunction_directory_ack_t, result) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_FLEXIFUNCTION_DIRECTORY_ACK { \ - "FLEXIFUNCTION_DIRECTORY_ACK", \ - 6, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_flexifunction_directory_ack_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_flexifunction_directory_ack_t, target_component) }, \ - { "directory_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_flexifunction_directory_ack_t, directory_type) }, \ - { "start_index", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_flexifunction_directory_ack_t, start_index) }, \ - { "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_flexifunction_directory_ack_t, count) }, \ - { "result", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_flexifunction_directory_ack_t, result) }, \ - } \ -} -#endif - -/** - * @brief Pack a flexifunction_directory_ack message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param target_system System ID - * @param target_component Component ID - * @param directory_type 0=inputs, 1=outputs - * @param start_index index of first directory entry to write - * @param count count of directory entries to write - * @param result result of acknowledge, 0=fail, 1=good - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_flexifunction_directory_ack_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, uint8_t directory_type, uint8_t start_index, uint8_t count, uint16_t result) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_LEN]; - _mav_put_uint16_t(buf, 0, result); - _mav_put_uint8_t(buf, 2, target_system); - _mav_put_uint8_t(buf, 3, target_component); - _mav_put_uint8_t(buf, 4, directory_type); - _mav_put_uint8_t(buf, 5, start_index); - _mav_put_uint8_t(buf, 6, count); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_LEN); -#else - mavlink_flexifunction_directory_ack_t packet; - packet.result = result; - packet.target_system = target_system; - packet.target_component = target_component; - packet.directory_type = directory_type; - packet.start_index = start_index; - packet.count = count; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_CRC); -} - -/** - * @brief Pack a flexifunction_directory_ack message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param target_system System ID - * @param target_component Component ID - * @param directory_type 0=inputs, 1=outputs - * @param start_index index of first directory entry to write - * @param count count of directory entries to write - * @param result result of acknowledge, 0=fail, 1=good - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_flexifunction_directory_ack_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,uint8_t directory_type,uint8_t start_index,uint8_t count,uint16_t result) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_LEN]; - _mav_put_uint16_t(buf, 0, result); - _mav_put_uint8_t(buf, 2, target_system); - _mav_put_uint8_t(buf, 3, target_component); - _mav_put_uint8_t(buf, 4, directory_type); - _mav_put_uint8_t(buf, 5, start_index); - _mav_put_uint8_t(buf, 6, count); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_LEN); -#else - mavlink_flexifunction_directory_ack_t packet; - packet.result = result; - packet.target_system = target_system; - packet.target_component = target_component; - packet.directory_type = directory_type; - packet.start_index = start_index; - packet.count = count; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_CRC); -} - -/** - * @brief Encode a flexifunction_directory_ack struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param flexifunction_directory_ack C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_flexifunction_directory_ack_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_flexifunction_directory_ack_t* flexifunction_directory_ack) -{ - return mavlink_msg_flexifunction_directory_ack_pack(system_id, component_id, msg, flexifunction_directory_ack->target_system, flexifunction_directory_ack->target_component, flexifunction_directory_ack->directory_type, flexifunction_directory_ack->start_index, flexifunction_directory_ack->count, flexifunction_directory_ack->result); -} - -/** - * @brief Encode a flexifunction_directory_ack struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param flexifunction_directory_ack C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_flexifunction_directory_ack_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_flexifunction_directory_ack_t* flexifunction_directory_ack) -{ - return mavlink_msg_flexifunction_directory_ack_pack_chan(system_id, component_id, chan, msg, flexifunction_directory_ack->target_system, flexifunction_directory_ack->target_component, flexifunction_directory_ack->directory_type, flexifunction_directory_ack->start_index, flexifunction_directory_ack->count, flexifunction_directory_ack->result); -} - -/** - * @brief Send a flexifunction_directory_ack message - * @param chan MAVLink channel to send the message - * - * @param target_system System ID - * @param target_component Component ID - * @param directory_type 0=inputs, 1=outputs - * @param start_index index of first directory entry to write - * @param count count of directory entries to write - * @param result result of acknowledge, 0=fail, 1=good - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_flexifunction_directory_ack_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t directory_type, uint8_t start_index, uint8_t count, uint16_t result) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_LEN]; - _mav_put_uint16_t(buf, 0, result); - _mav_put_uint8_t(buf, 2, target_system); - _mav_put_uint8_t(buf, 3, target_component); - _mav_put_uint8_t(buf, 4, directory_type); - _mav_put_uint8_t(buf, 5, start_index); - _mav_put_uint8_t(buf, 6, count); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK, buf, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_CRC); -#else - mavlink_flexifunction_directory_ack_t packet; - packet.result = result; - packet.target_system = target_system; - packet.target_component = target_component; - packet.directory_type = directory_type; - packet.start_index = start_index; - packet.count = count; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK, (const char *)&packet, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_CRC); -#endif -} - -/** - * @brief Send a flexifunction_directory_ack message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_flexifunction_directory_ack_send_struct(mavlink_channel_t chan, const mavlink_flexifunction_directory_ack_t* flexifunction_directory_ack) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_flexifunction_directory_ack_send(chan, flexifunction_directory_ack->target_system, flexifunction_directory_ack->target_component, flexifunction_directory_ack->directory_type, flexifunction_directory_ack->start_index, flexifunction_directory_ack->count, flexifunction_directory_ack->result); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK, (const char *)flexifunction_directory_ack, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_CRC); -#endif -} - -#if MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_flexifunction_directory_ack_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t directory_type, uint8_t start_index, uint8_t count, uint16_t result) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint16_t(buf, 0, result); - _mav_put_uint8_t(buf, 2, target_system); - _mav_put_uint8_t(buf, 3, target_component); - _mav_put_uint8_t(buf, 4, directory_type); - _mav_put_uint8_t(buf, 5, start_index); - _mav_put_uint8_t(buf, 6, count); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK, buf, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_CRC); -#else - mavlink_flexifunction_directory_ack_t *packet = (mavlink_flexifunction_directory_ack_t *)msgbuf; - packet->result = result; - packet->target_system = target_system; - packet->target_component = target_component; - packet->directory_type = directory_type; - packet->start_index = start_index; - packet->count = count; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK, (const char *)packet, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_CRC); -#endif -} -#endif - -#endif - -// MESSAGE FLEXIFUNCTION_DIRECTORY_ACK UNPACKING - - -/** - * @brief Get field target_system from flexifunction_directory_ack message - * - * @return System ID - */ -static inline uint8_t mavlink_msg_flexifunction_directory_ack_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 2); -} - -/** - * @brief Get field target_component from flexifunction_directory_ack message - * - * @return Component ID - */ -static inline uint8_t mavlink_msg_flexifunction_directory_ack_get_target_component(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 3); -} - -/** - * @brief Get field directory_type from flexifunction_directory_ack message - * - * @return 0=inputs, 1=outputs - */ -static inline uint8_t mavlink_msg_flexifunction_directory_ack_get_directory_type(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 4); -} - -/** - * @brief Get field start_index from flexifunction_directory_ack message - * - * @return index of first directory entry to write - */ -static inline uint8_t mavlink_msg_flexifunction_directory_ack_get_start_index(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 5); -} - -/** - * @brief Get field count from flexifunction_directory_ack message - * - * @return count of directory entries to write - */ -static inline uint8_t mavlink_msg_flexifunction_directory_ack_get_count(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 6); -} - -/** - * @brief Get field result from flexifunction_directory_ack message - * - * @return result of acknowledge, 0=fail, 1=good - */ -static inline uint16_t mavlink_msg_flexifunction_directory_ack_get_result(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 0); -} - -/** - * @brief Decode a flexifunction_directory_ack message into a struct - * - * @param msg The message to decode - * @param flexifunction_directory_ack C-struct to decode the message contents into - */ -static inline void mavlink_msg_flexifunction_directory_ack_decode(const mavlink_message_t* msg, mavlink_flexifunction_directory_ack_t* flexifunction_directory_ack) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - flexifunction_directory_ack->result = mavlink_msg_flexifunction_directory_ack_get_result(msg); - flexifunction_directory_ack->target_system = mavlink_msg_flexifunction_directory_ack_get_target_system(msg); - flexifunction_directory_ack->target_component = mavlink_msg_flexifunction_directory_ack_get_target_component(msg); - flexifunction_directory_ack->directory_type = mavlink_msg_flexifunction_directory_ack_get_directory_type(msg); - flexifunction_directory_ack->start_index = mavlink_msg_flexifunction_directory_ack_get_start_index(msg); - flexifunction_directory_ack->count = mavlink_msg_flexifunction_directory_ack_get_count(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_LEN? msg->len : MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_LEN; - memset(flexifunction_directory_ack, 0, MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_LEN); - memcpy(flexifunction_directory_ack, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/matrixpilot/mavlink_msg_flexifunction_read_req.h b/matrixpilot/mavlink_msg_flexifunction_read_req.h deleted file mode 100644 index 329abb624..000000000 --- a/matrixpilot/mavlink_msg_flexifunction_read_req.h +++ /dev/null @@ -1,288 +0,0 @@ -#pragma once -// MESSAGE FLEXIFUNCTION_READ_REQ PACKING - -#define MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ 151 - - -typedef struct __mavlink_flexifunction_read_req_t { - int16_t read_req_type; /*< Type of flexifunction data requested*/ - int16_t data_index; /*< index into data where needed*/ - uint8_t target_system; /*< System ID*/ - uint8_t target_component; /*< Component ID*/ -} mavlink_flexifunction_read_req_t; - -#define MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_LEN 6 -#define MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_MIN_LEN 6 -#define MAVLINK_MSG_ID_151_LEN 6 -#define MAVLINK_MSG_ID_151_MIN_LEN 6 - -#define MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_CRC 26 -#define MAVLINK_MSG_ID_151_CRC 26 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_FLEXIFUNCTION_READ_REQ { \ - 151, \ - "FLEXIFUNCTION_READ_REQ", \ - 4, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_flexifunction_read_req_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_flexifunction_read_req_t, target_component) }, \ - { "read_req_type", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_flexifunction_read_req_t, read_req_type) }, \ - { "data_index", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_flexifunction_read_req_t, data_index) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_FLEXIFUNCTION_READ_REQ { \ - "FLEXIFUNCTION_READ_REQ", \ - 4, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_flexifunction_read_req_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_flexifunction_read_req_t, target_component) }, \ - { "read_req_type", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_flexifunction_read_req_t, read_req_type) }, \ - { "data_index", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_flexifunction_read_req_t, data_index) }, \ - } \ -} -#endif - -/** - * @brief Pack a flexifunction_read_req message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param target_system System ID - * @param target_component Component ID - * @param read_req_type Type of flexifunction data requested - * @param data_index index into data where needed - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_flexifunction_read_req_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component, int16_t read_req_type, int16_t data_index) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_LEN]; - _mav_put_int16_t(buf, 0, read_req_type); - _mav_put_int16_t(buf, 2, data_index); - _mav_put_uint8_t(buf, 4, target_system); - _mav_put_uint8_t(buf, 5, target_component); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_LEN); -#else - mavlink_flexifunction_read_req_t packet; - packet.read_req_type = read_req_type; - packet.data_index = data_index; - packet.target_system = target_system; - packet.target_component = target_component; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_CRC); -} - -/** - * @brief Pack a flexifunction_read_req message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param target_system System ID - * @param target_component Component ID - * @param read_req_type Type of flexifunction data requested - * @param data_index index into data where needed - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_flexifunction_read_req_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component,int16_t read_req_type,int16_t data_index) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_LEN]; - _mav_put_int16_t(buf, 0, read_req_type); - _mav_put_int16_t(buf, 2, data_index); - _mav_put_uint8_t(buf, 4, target_system); - _mav_put_uint8_t(buf, 5, target_component); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_LEN); -#else - mavlink_flexifunction_read_req_t packet; - packet.read_req_type = read_req_type; - packet.data_index = data_index; - packet.target_system = target_system; - packet.target_component = target_component; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_CRC); -} - -/** - * @brief Encode a flexifunction_read_req struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param flexifunction_read_req C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_flexifunction_read_req_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_flexifunction_read_req_t* flexifunction_read_req) -{ - return mavlink_msg_flexifunction_read_req_pack(system_id, component_id, msg, flexifunction_read_req->target_system, flexifunction_read_req->target_component, flexifunction_read_req->read_req_type, flexifunction_read_req->data_index); -} - -/** - * @brief Encode a flexifunction_read_req struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param flexifunction_read_req C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_flexifunction_read_req_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_flexifunction_read_req_t* flexifunction_read_req) -{ - return mavlink_msg_flexifunction_read_req_pack_chan(system_id, component_id, chan, msg, flexifunction_read_req->target_system, flexifunction_read_req->target_component, flexifunction_read_req->read_req_type, flexifunction_read_req->data_index); -} - -/** - * @brief Send a flexifunction_read_req message - * @param chan MAVLink channel to send the message - * - * @param target_system System ID - * @param target_component Component ID - * @param read_req_type Type of flexifunction data requested - * @param data_index index into data where needed - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_flexifunction_read_req_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, int16_t read_req_type, int16_t data_index) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_LEN]; - _mav_put_int16_t(buf, 0, read_req_type); - _mav_put_int16_t(buf, 2, data_index); - _mav_put_uint8_t(buf, 4, target_system); - _mav_put_uint8_t(buf, 5, target_component); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ, buf, MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_CRC); -#else - mavlink_flexifunction_read_req_t packet; - packet.read_req_type = read_req_type; - packet.data_index = data_index; - packet.target_system = target_system; - packet.target_component = target_component; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ, (const char *)&packet, MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_CRC); -#endif -} - -/** - * @brief Send a flexifunction_read_req message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_flexifunction_read_req_send_struct(mavlink_channel_t chan, const mavlink_flexifunction_read_req_t* flexifunction_read_req) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_flexifunction_read_req_send(chan, flexifunction_read_req->target_system, flexifunction_read_req->target_component, flexifunction_read_req->read_req_type, flexifunction_read_req->data_index); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ, (const char *)flexifunction_read_req, MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_CRC); -#endif -} - -#if MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_flexifunction_read_req_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, int16_t read_req_type, int16_t data_index) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_int16_t(buf, 0, read_req_type); - _mav_put_int16_t(buf, 2, data_index); - _mav_put_uint8_t(buf, 4, target_system); - _mav_put_uint8_t(buf, 5, target_component); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ, buf, MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_CRC); -#else - mavlink_flexifunction_read_req_t *packet = (mavlink_flexifunction_read_req_t *)msgbuf; - packet->read_req_type = read_req_type; - packet->data_index = data_index; - packet->target_system = target_system; - packet->target_component = target_component; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ, (const char *)packet, MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_CRC); -#endif -} -#endif - -#endif - -// MESSAGE FLEXIFUNCTION_READ_REQ UNPACKING - - -/** - * @brief Get field target_system from flexifunction_read_req message - * - * @return System ID - */ -static inline uint8_t mavlink_msg_flexifunction_read_req_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 4); -} - -/** - * @brief Get field target_component from flexifunction_read_req message - * - * @return Component ID - */ -static inline uint8_t mavlink_msg_flexifunction_read_req_get_target_component(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 5); -} - -/** - * @brief Get field read_req_type from flexifunction_read_req message - * - * @return Type of flexifunction data requested - */ -static inline int16_t mavlink_msg_flexifunction_read_req_get_read_req_type(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 0); -} - -/** - * @brief Get field data_index from flexifunction_read_req message - * - * @return index into data where needed - */ -static inline int16_t mavlink_msg_flexifunction_read_req_get_data_index(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 2); -} - -/** - * @brief Decode a flexifunction_read_req message into a struct - * - * @param msg The message to decode - * @param flexifunction_read_req C-struct to decode the message contents into - */ -static inline void mavlink_msg_flexifunction_read_req_decode(const mavlink_message_t* msg, mavlink_flexifunction_read_req_t* flexifunction_read_req) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - flexifunction_read_req->read_req_type = mavlink_msg_flexifunction_read_req_get_read_req_type(msg); - flexifunction_read_req->data_index = mavlink_msg_flexifunction_read_req_get_data_index(msg); - flexifunction_read_req->target_system = mavlink_msg_flexifunction_read_req_get_target_system(msg); - flexifunction_read_req->target_component = mavlink_msg_flexifunction_read_req_get_target_component(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_LEN? msg->len : MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_LEN; - memset(flexifunction_read_req, 0, MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_LEN); - memcpy(flexifunction_read_req, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/matrixpilot/mavlink_msg_flexifunction_set.h b/matrixpilot/mavlink_msg_flexifunction_set.h deleted file mode 100644 index 0371dfd1d..000000000 --- a/matrixpilot/mavlink_msg_flexifunction_set.h +++ /dev/null @@ -1,238 +0,0 @@ -#pragma once -// MESSAGE FLEXIFUNCTION_SET PACKING - -#define MAVLINK_MSG_ID_FLEXIFUNCTION_SET 150 - - -typedef struct __mavlink_flexifunction_set_t { - uint8_t target_system; /*< System ID*/ - uint8_t target_component; /*< Component ID*/ -} mavlink_flexifunction_set_t; - -#define MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN 2 -#define MAVLINK_MSG_ID_FLEXIFUNCTION_SET_MIN_LEN 2 -#define MAVLINK_MSG_ID_150_LEN 2 -#define MAVLINK_MSG_ID_150_MIN_LEN 2 - -#define MAVLINK_MSG_ID_FLEXIFUNCTION_SET_CRC 181 -#define MAVLINK_MSG_ID_150_CRC 181 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_FLEXIFUNCTION_SET { \ - 150, \ - "FLEXIFUNCTION_SET", \ - 2, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_flexifunction_set_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_flexifunction_set_t, target_component) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_FLEXIFUNCTION_SET { \ - "FLEXIFUNCTION_SET", \ - 2, \ - { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_flexifunction_set_t, target_system) }, \ - { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_flexifunction_set_t, target_component) }, \ - } \ -} -#endif - -/** - * @brief Pack a flexifunction_set message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param target_system System ID - * @param target_component Component ID - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_flexifunction_set_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t target_system, uint8_t target_component) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN]; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN); -#else - mavlink_flexifunction_set_t packet; - packet.target_system = target_system; - packet.target_component = target_component; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_FLEXIFUNCTION_SET; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_CRC); -} - -/** - * @brief Pack a flexifunction_set message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param target_system System ID - * @param target_component Component ID - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_flexifunction_set_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t target_system,uint8_t target_component) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN]; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN); -#else - mavlink_flexifunction_set_t packet; - packet.target_system = target_system; - packet.target_component = target_component; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_FLEXIFUNCTION_SET; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_CRC); -} - -/** - * @brief Encode a flexifunction_set struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param flexifunction_set C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_flexifunction_set_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_flexifunction_set_t* flexifunction_set) -{ - return mavlink_msg_flexifunction_set_pack(system_id, component_id, msg, flexifunction_set->target_system, flexifunction_set->target_component); -} - -/** - * @brief Encode a flexifunction_set struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param flexifunction_set C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_flexifunction_set_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_flexifunction_set_t* flexifunction_set) -{ - return mavlink_msg_flexifunction_set_pack_chan(system_id, component_id, chan, msg, flexifunction_set->target_system, flexifunction_set->target_component); -} - -/** - * @brief Send a flexifunction_set message - * @param chan MAVLink channel to send the message - * - * @param target_system System ID - * @param target_component Component ID - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_flexifunction_set_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN]; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_SET, buf, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_CRC); -#else - mavlink_flexifunction_set_t packet; - packet.target_system = target_system; - packet.target_component = target_component; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_SET, (const char *)&packet, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_CRC); -#endif -} - -/** - * @brief Send a flexifunction_set message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_flexifunction_set_send_struct(mavlink_channel_t chan, const mavlink_flexifunction_set_t* flexifunction_set) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_flexifunction_set_send(chan, flexifunction_set->target_system, flexifunction_set->target_component); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_SET, (const char *)flexifunction_set, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_CRC); -#endif -} - -#if MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_flexifunction_set_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint8_t(buf, 0, target_system); - _mav_put_uint8_t(buf, 1, target_component); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_SET, buf, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_CRC); -#else - mavlink_flexifunction_set_t *packet = (mavlink_flexifunction_set_t *)msgbuf; - packet->target_system = target_system; - packet->target_component = target_component; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_SET, (const char *)packet, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_CRC); -#endif -} -#endif - -#endif - -// MESSAGE FLEXIFUNCTION_SET UNPACKING - - -/** - * @brief Get field target_system from flexifunction_set message - * - * @return System ID - */ -static inline uint8_t mavlink_msg_flexifunction_set_get_target_system(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 0); -} - -/** - * @brief Get field target_component from flexifunction_set message - * - * @return Component ID - */ -static inline uint8_t mavlink_msg_flexifunction_set_get_target_component(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 1); -} - -/** - * @brief Decode a flexifunction_set message into a struct - * - * @param msg The message to decode - * @param flexifunction_set C-struct to decode the message contents into - */ -static inline void mavlink_msg_flexifunction_set_decode(const mavlink_message_t* msg, mavlink_flexifunction_set_t* flexifunction_set) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - flexifunction_set->target_system = mavlink_msg_flexifunction_set_get_target_system(msg); - flexifunction_set->target_component = mavlink_msg_flexifunction_set_get_target_component(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN? msg->len : MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN; - memset(flexifunction_set, 0, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN); - memcpy(flexifunction_set, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/matrixpilot/mavlink_msg_serial_udb_extra_f13.h b/matrixpilot/mavlink_msg_serial_udb_extra_f13.h deleted file mode 100644 index 476504fa7..000000000 --- a/matrixpilot/mavlink_msg_serial_udb_extra_f13.h +++ /dev/null @@ -1,288 +0,0 @@ -#pragma once -// MESSAGE SERIAL_UDB_EXTRA_F13 PACKING - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13 177 - - -typedef struct __mavlink_serial_udb_extra_f13_t { - int32_t sue_lat_origin; /*< Serial UDB Extra MP Origin Latitude*/ - int32_t sue_lon_origin; /*< Serial UDB Extra MP Origin Longitude*/ - int32_t sue_alt_origin; /*< Serial UDB Extra MP Origin Altitude Above Sea Level*/ - int16_t sue_week_no; /*< Serial UDB Extra GPS Week Number*/ -} mavlink_serial_udb_extra_f13_t; - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_LEN 14 -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_MIN_LEN 14 -#define MAVLINK_MSG_ID_177_LEN 14 -#define MAVLINK_MSG_ID_177_MIN_LEN 14 - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_CRC 249 -#define MAVLINK_MSG_ID_177_CRC 249 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F13 { \ - 177, \ - "SERIAL_UDB_EXTRA_F13", \ - 4, \ - { { "sue_week_no", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_serial_udb_extra_f13_t, sue_week_no) }, \ - { "sue_lat_origin", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_serial_udb_extra_f13_t, sue_lat_origin) }, \ - { "sue_lon_origin", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_serial_udb_extra_f13_t, sue_lon_origin) }, \ - { "sue_alt_origin", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_serial_udb_extra_f13_t, sue_alt_origin) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F13 { \ - "SERIAL_UDB_EXTRA_F13", \ - 4, \ - { { "sue_week_no", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_serial_udb_extra_f13_t, sue_week_no) }, \ - { "sue_lat_origin", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_serial_udb_extra_f13_t, sue_lat_origin) }, \ - { "sue_lon_origin", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_serial_udb_extra_f13_t, sue_lon_origin) }, \ - { "sue_alt_origin", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_serial_udb_extra_f13_t, sue_alt_origin) }, \ - } \ -} -#endif - -/** - * @brief Pack a serial_udb_extra_f13 message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param sue_week_no Serial UDB Extra GPS Week Number - * @param sue_lat_origin Serial UDB Extra MP Origin Latitude - * @param sue_lon_origin Serial UDB Extra MP Origin Longitude - * @param sue_alt_origin Serial UDB Extra MP Origin Altitude Above Sea Level - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f13_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - int16_t sue_week_no, int32_t sue_lat_origin, int32_t sue_lon_origin, int32_t sue_alt_origin) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_LEN]; - _mav_put_int32_t(buf, 0, sue_lat_origin); - _mav_put_int32_t(buf, 4, sue_lon_origin); - _mav_put_int32_t(buf, 8, sue_alt_origin); - _mav_put_int16_t(buf, 12, sue_week_no); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_LEN); -#else - mavlink_serial_udb_extra_f13_t packet; - packet.sue_lat_origin = sue_lat_origin; - packet.sue_lon_origin = sue_lon_origin; - packet.sue_alt_origin = sue_alt_origin; - packet.sue_week_no = sue_week_no; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_CRC); -} - -/** - * @brief Pack a serial_udb_extra_f13 message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param sue_week_no Serial UDB Extra GPS Week Number - * @param sue_lat_origin Serial UDB Extra MP Origin Latitude - * @param sue_lon_origin Serial UDB Extra MP Origin Longitude - * @param sue_alt_origin Serial UDB Extra MP Origin Altitude Above Sea Level - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f13_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - int16_t sue_week_no,int32_t sue_lat_origin,int32_t sue_lon_origin,int32_t sue_alt_origin) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_LEN]; - _mav_put_int32_t(buf, 0, sue_lat_origin); - _mav_put_int32_t(buf, 4, sue_lon_origin); - _mav_put_int32_t(buf, 8, sue_alt_origin); - _mav_put_int16_t(buf, 12, sue_week_no); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_LEN); -#else - mavlink_serial_udb_extra_f13_t packet; - packet.sue_lat_origin = sue_lat_origin; - packet.sue_lon_origin = sue_lon_origin; - packet.sue_alt_origin = sue_alt_origin; - packet.sue_week_no = sue_week_no; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_CRC); -} - -/** - * @brief Encode a serial_udb_extra_f13 struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f13 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f13_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_serial_udb_extra_f13_t* serial_udb_extra_f13) -{ - return mavlink_msg_serial_udb_extra_f13_pack(system_id, component_id, msg, serial_udb_extra_f13->sue_week_no, serial_udb_extra_f13->sue_lat_origin, serial_udb_extra_f13->sue_lon_origin, serial_udb_extra_f13->sue_alt_origin); -} - -/** - * @brief Encode a serial_udb_extra_f13 struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f13 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f13_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_serial_udb_extra_f13_t* serial_udb_extra_f13) -{ - return mavlink_msg_serial_udb_extra_f13_pack_chan(system_id, component_id, chan, msg, serial_udb_extra_f13->sue_week_no, serial_udb_extra_f13->sue_lat_origin, serial_udb_extra_f13->sue_lon_origin, serial_udb_extra_f13->sue_alt_origin); -} - -/** - * @brief Send a serial_udb_extra_f13 message - * @param chan MAVLink channel to send the message - * - * @param sue_week_no Serial UDB Extra GPS Week Number - * @param sue_lat_origin Serial UDB Extra MP Origin Latitude - * @param sue_lon_origin Serial UDB Extra MP Origin Longitude - * @param sue_alt_origin Serial UDB Extra MP Origin Altitude Above Sea Level - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_serial_udb_extra_f13_send(mavlink_channel_t chan, int16_t sue_week_no, int32_t sue_lat_origin, int32_t sue_lon_origin, int32_t sue_alt_origin) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_LEN]; - _mav_put_int32_t(buf, 0, sue_lat_origin); - _mav_put_int32_t(buf, 4, sue_lon_origin); - _mav_put_int32_t(buf, 8, sue_alt_origin); - _mav_put_int16_t(buf, 12, sue_week_no); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_CRC); -#else - mavlink_serial_udb_extra_f13_t packet; - packet.sue_lat_origin = sue_lat_origin; - packet.sue_lon_origin = sue_lon_origin; - packet.sue_alt_origin = sue_alt_origin; - packet.sue_week_no = sue_week_no; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13, (const char *)&packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_CRC); -#endif -} - -/** - * @brief Send a serial_udb_extra_f13 message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_serial_udb_extra_f13_send_struct(mavlink_channel_t chan, const mavlink_serial_udb_extra_f13_t* serial_udb_extra_f13) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_serial_udb_extra_f13_send(chan, serial_udb_extra_f13->sue_week_no, serial_udb_extra_f13->sue_lat_origin, serial_udb_extra_f13->sue_lon_origin, serial_udb_extra_f13->sue_alt_origin); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13, (const char *)serial_udb_extra_f13, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_CRC); -#endif -} - -#if MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_serial_udb_extra_f13_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, int16_t sue_week_no, int32_t sue_lat_origin, int32_t sue_lon_origin, int32_t sue_alt_origin) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_int32_t(buf, 0, sue_lat_origin); - _mav_put_int32_t(buf, 4, sue_lon_origin); - _mav_put_int32_t(buf, 8, sue_alt_origin); - _mav_put_int16_t(buf, 12, sue_week_no); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_CRC); -#else - mavlink_serial_udb_extra_f13_t *packet = (mavlink_serial_udb_extra_f13_t *)msgbuf; - packet->sue_lat_origin = sue_lat_origin; - packet->sue_lon_origin = sue_lon_origin; - packet->sue_alt_origin = sue_alt_origin; - packet->sue_week_no = sue_week_no; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13, (const char *)packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_CRC); -#endif -} -#endif - -#endif - -// MESSAGE SERIAL_UDB_EXTRA_F13 UNPACKING - - -/** - * @brief Get field sue_week_no from serial_udb_extra_f13 message - * - * @return Serial UDB Extra GPS Week Number - */ -static inline int16_t mavlink_msg_serial_udb_extra_f13_get_sue_week_no(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 12); -} - -/** - * @brief Get field sue_lat_origin from serial_udb_extra_f13 message - * - * @return Serial UDB Extra MP Origin Latitude - */ -static inline int32_t mavlink_msg_serial_udb_extra_f13_get_sue_lat_origin(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 0); -} - -/** - * @brief Get field sue_lon_origin from serial_udb_extra_f13 message - * - * @return Serial UDB Extra MP Origin Longitude - */ -static inline int32_t mavlink_msg_serial_udb_extra_f13_get_sue_lon_origin(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 4); -} - -/** - * @brief Get field sue_alt_origin from serial_udb_extra_f13 message - * - * @return Serial UDB Extra MP Origin Altitude Above Sea Level - */ -static inline int32_t mavlink_msg_serial_udb_extra_f13_get_sue_alt_origin(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 8); -} - -/** - * @brief Decode a serial_udb_extra_f13 message into a struct - * - * @param msg The message to decode - * @param serial_udb_extra_f13 C-struct to decode the message contents into - */ -static inline void mavlink_msg_serial_udb_extra_f13_decode(const mavlink_message_t* msg, mavlink_serial_udb_extra_f13_t* serial_udb_extra_f13) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - serial_udb_extra_f13->sue_lat_origin = mavlink_msg_serial_udb_extra_f13_get_sue_lat_origin(msg); - serial_udb_extra_f13->sue_lon_origin = mavlink_msg_serial_udb_extra_f13_get_sue_lon_origin(msg); - serial_udb_extra_f13->sue_alt_origin = mavlink_msg_serial_udb_extra_f13_get_sue_alt_origin(msg); - serial_udb_extra_f13->sue_week_no = mavlink_msg_serial_udb_extra_f13_get_sue_week_no(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_LEN? msg->len : MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_LEN; - memset(serial_udb_extra_f13, 0, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_LEN); - memcpy(serial_udb_extra_f13, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/matrixpilot/mavlink_msg_serial_udb_extra_f14.h b/matrixpilot/mavlink_msg_serial_udb_extra_f14.h deleted file mode 100644 index 9e1a27585..000000000 --- a/matrixpilot/mavlink_msg_serial_udb_extra_f14.h +++ /dev/null @@ -1,463 +0,0 @@ -#pragma once -// MESSAGE SERIAL_UDB_EXTRA_F14 PACKING - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14 178 - - -typedef struct __mavlink_serial_udb_extra_f14_t { - uint32_t sue_TRAP_SOURCE; /*< Serial UDB Extra Type Program Address of Last Trap*/ - int16_t sue_RCON; /*< Serial UDB Extra Reboot Register of DSPIC*/ - int16_t sue_TRAP_FLAGS; /*< Serial UDB Extra Last dspic Trap Flags*/ - int16_t sue_osc_fail_count; /*< Serial UDB Extra Number of Ocillator Failures*/ - uint8_t sue_WIND_ESTIMATION; /*< Serial UDB Extra Wind Estimation Enabled*/ - uint8_t sue_GPS_TYPE; /*< Serial UDB Extra Type of GPS Unit*/ - uint8_t sue_DR; /*< Serial UDB Extra Dead Reckoning Enabled*/ - uint8_t sue_BOARD_TYPE; /*< Serial UDB Extra Type of UDB Hardware*/ - uint8_t sue_AIRFRAME; /*< Serial UDB Extra Type of Airframe*/ - uint8_t sue_CLOCK_CONFIG; /*< Serial UDB Extra UDB Internal Clock Configuration*/ - uint8_t sue_FLIGHT_PLAN_TYPE; /*< Serial UDB Extra Type of Flight Plan*/ -} mavlink_serial_udb_extra_f14_t; - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_LEN 17 -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_MIN_LEN 17 -#define MAVLINK_MSG_ID_178_LEN 17 -#define MAVLINK_MSG_ID_178_MIN_LEN 17 - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_CRC 123 -#define MAVLINK_MSG_ID_178_CRC 123 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F14 { \ - 178, \ - "SERIAL_UDB_EXTRA_F14", \ - 11, \ - { { "sue_WIND_ESTIMATION", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_serial_udb_extra_f14_t, sue_WIND_ESTIMATION) }, \ - { "sue_GPS_TYPE", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_serial_udb_extra_f14_t, sue_GPS_TYPE) }, \ - { "sue_DR", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_serial_udb_extra_f14_t, sue_DR) }, \ - { "sue_BOARD_TYPE", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_serial_udb_extra_f14_t, sue_BOARD_TYPE) }, \ - { "sue_AIRFRAME", NULL, MAVLINK_TYPE_UINT8_T, 0, 14, offsetof(mavlink_serial_udb_extra_f14_t, sue_AIRFRAME) }, \ - { "sue_RCON", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_serial_udb_extra_f14_t, sue_RCON) }, \ - { "sue_TRAP_FLAGS", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_serial_udb_extra_f14_t, sue_TRAP_FLAGS) }, \ - { "sue_TRAP_SOURCE", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_serial_udb_extra_f14_t, sue_TRAP_SOURCE) }, \ - { "sue_osc_fail_count", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_serial_udb_extra_f14_t, sue_osc_fail_count) }, \ - { "sue_CLOCK_CONFIG", NULL, MAVLINK_TYPE_UINT8_T, 0, 15, offsetof(mavlink_serial_udb_extra_f14_t, sue_CLOCK_CONFIG) }, \ - { "sue_FLIGHT_PLAN_TYPE", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_serial_udb_extra_f14_t, sue_FLIGHT_PLAN_TYPE) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F14 { \ - "SERIAL_UDB_EXTRA_F14", \ - 11, \ - { { "sue_WIND_ESTIMATION", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_serial_udb_extra_f14_t, sue_WIND_ESTIMATION) }, \ - { "sue_GPS_TYPE", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_serial_udb_extra_f14_t, sue_GPS_TYPE) }, \ - { "sue_DR", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_serial_udb_extra_f14_t, sue_DR) }, \ - { "sue_BOARD_TYPE", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_serial_udb_extra_f14_t, sue_BOARD_TYPE) }, \ - { "sue_AIRFRAME", NULL, MAVLINK_TYPE_UINT8_T, 0, 14, offsetof(mavlink_serial_udb_extra_f14_t, sue_AIRFRAME) }, \ - { "sue_RCON", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_serial_udb_extra_f14_t, sue_RCON) }, \ - { "sue_TRAP_FLAGS", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_serial_udb_extra_f14_t, sue_TRAP_FLAGS) }, \ - { "sue_TRAP_SOURCE", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_serial_udb_extra_f14_t, sue_TRAP_SOURCE) }, \ - { "sue_osc_fail_count", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_serial_udb_extra_f14_t, sue_osc_fail_count) }, \ - { "sue_CLOCK_CONFIG", NULL, MAVLINK_TYPE_UINT8_T, 0, 15, offsetof(mavlink_serial_udb_extra_f14_t, sue_CLOCK_CONFIG) }, \ - { "sue_FLIGHT_PLAN_TYPE", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_serial_udb_extra_f14_t, sue_FLIGHT_PLAN_TYPE) }, \ - } \ -} -#endif - -/** - * @brief Pack a serial_udb_extra_f14 message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param sue_WIND_ESTIMATION Serial UDB Extra Wind Estimation Enabled - * @param sue_GPS_TYPE Serial UDB Extra Type of GPS Unit - * @param sue_DR Serial UDB Extra Dead Reckoning Enabled - * @param sue_BOARD_TYPE Serial UDB Extra Type of UDB Hardware - * @param sue_AIRFRAME Serial UDB Extra Type of Airframe - * @param sue_RCON Serial UDB Extra Reboot Register of DSPIC - * @param sue_TRAP_FLAGS Serial UDB Extra Last dspic Trap Flags - * @param sue_TRAP_SOURCE Serial UDB Extra Type Program Address of Last Trap - * @param sue_osc_fail_count Serial UDB Extra Number of Ocillator Failures - * @param sue_CLOCK_CONFIG Serial UDB Extra UDB Internal Clock Configuration - * @param sue_FLIGHT_PLAN_TYPE Serial UDB Extra Type of Flight Plan - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f14_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t sue_WIND_ESTIMATION, uint8_t sue_GPS_TYPE, uint8_t sue_DR, uint8_t sue_BOARD_TYPE, uint8_t sue_AIRFRAME, int16_t sue_RCON, int16_t sue_TRAP_FLAGS, uint32_t sue_TRAP_SOURCE, int16_t sue_osc_fail_count, uint8_t sue_CLOCK_CONFIG, uint8_t sue_FLIGHT_PLAN_TYPE) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_LEN]; - _mav_put_uint32_t(buf, 0, sue_TRAP_SOURCE); - _mav_put_int16_t(buf, 4, sue_RCON); - _mav_put_int16_t(buf, 6, sue_TRAP_FLAGS); - _mav_put_int16_t(buf, 8, sue_osc_fail_count); - _mav_put_uint8_t(buf, 10, sue_WIND_ESTIMATION); - _mav_put_uint8_t(buf, 11, sue_GPS_TYPE); - _mav_put_uint8_t(buf, 12, sue_DR); - _mav_put_uint8_t(buf, 13, sue_BOARD_TYPE); - _mav_put_uint8_t(buf, 14, sue_AIRFRAME); - _mav_put_uint8_t(buf, 15, sue_CLOCK_CONFIG); - _mav_put_uint8_t(buf, 16, sue_FLIGHT_PLAN_TYPE); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_LEN); -#else - mavlink_serial_udb_extra_f14_t packet; - packet.sue_TRAP_SOURCE = sue_TRAP_SOURCE; - packet.sue_RCON = sue_RCON; - packet.sue_TRAP_FLAGS = sue_TRAP_FLAGS; - packet.sue_osc_fail_count = sue_osc_fail_count; - packet.sue_WIND_ESTIMATION = sue_WIND_ESTIMATION; - packet.sue_GPS_TYPE = sue_GPS_TYPE; - packet.sue_DR = sue_DR; - packet.sue_BOARD_TYPE = sue_BOARD_TYPE; - packet.sue_AIRFRAME = sue_AIRFRAME; - packet.sue_CLOCK_CONFIG = sue_CLOCK_CONFIG; - packet.sue_FLIGHT_PLAN_TYPE = sue_FLIGHT_PLAN_TYPE; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_CRC); -} - -/** - * @brief Pack a serial_udb_extra_f14 message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param sue_WIND_ESTIMATION Serial UDB Extra Wind Estimation Enabled - * @param sue_GPS_TYPE Serial UDB Extra Type of GPS Unit - * @param sue_DR Serial UDB Extra Dead Reckoning Enabled - * @param sue_BOARD_TYPE Serial UDB Extra Type of UDB Hardware - * @param sue_AIRFRAME Serial UDB Extra Type of Airframe - * @param sue_RCON Serial UDB Extra Reboot Register of DSPIC - * @param sue_TRAP_FLAGS Serial UDB Extra Last dspic Trap Flags - * @param sue_TRAP_SOURCE Serial UDB Extra Type Program Address of Last Trap - * @param sue_osc_fail_count Serial UDB Extra Number of Ocillator Failures - * @param sue_CLOCK_CONFIG Serial UDB Extra UDB Internal Clock Configuration - * @param sue_FLIGHT_PLAN_TYPE Serial UDB Extra Type of Flight Plan - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f14_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t sue_WIND_ESTIMATION,uint8_t sue_GPS_TYPE,uint8_t sue_DR,uint8_t sue_BOARD_TYPE,uint8_t sue_AIRFRAME,int16_t sue_RCON,int16_t sue_TRAP_FLAGS,uint32_t sue_TRAP_SOURCE,int16_t sue_osc_fail_count,uint8_t sue_CLOCK_CONFIG,uint8_t sue_FLIGHT_PLAN_TYPE) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_LEN]; - _mav_put_uint32_t(buf, 0, sue_TRAP_SOURCE); - _mav_put_int16_t(buf, 4, sue_RCON); - _mav_put_int16_t(buf, 6, sue_TRAP_FLAGS); - _mav_put_int16_t(buf, 8, sue_osc_fail_count); - _mav_put_uint8_t(buf, 10, sue_WIND_ESTIMATION); - _mav_put_uint8_t(buf, 11, sue_GPS_TYPE); - _mav_put_uint8_t(buf, 12, sue_DR); - _mav_put_uint8_t(buf, 13, sue_BOARD_TYPE); - _mav_put_uint8_t(buf, 14, sue_AIRFRAME); - _mav_put_uint8_t(buf, 15, sue_CLOCK_CONFIG); - _mav_put_uint8_t(buf, 16, sue_FLIGHT_PLAN_TYPE); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_LEN); -#else - mavlink_serial_udb_extra_f14_t packet; - packet.sue_TRAP_SOURCE = sue_TRAP_SOURCE; - packet.sue_RCON = sue_RCON; - packet.sue_TRAP_FLAGS = sue_TRAP_FLAGS; - packet.sue_osc_fail_count = sue_osc_fail_count; - packet.sue_WIND_ESTIMATION = sue_WIND_ESTIMATION; - packet.sue_GPS_TYPE = sue_GPS_TYPE; - packet.sue_DR = sue_DR; - packet.sue_BOARD_TYPE = sue_BOARD_TYPE; - packet.sue_AIRFRAME = sue_AIRFRAME; - packet.sue_CLOCK_CONFIG = sue_CLOCK_CONFIG; - packet.sue_FLIGHT_PLAN_TYPE = sue_FLIGHT_PLAN_TYPE; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_CRC); -} - -/** - * @brief Encode a serial_udb_extra_f14 struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f14 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f14_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_serial_udb_extra_f14_t* serial_udb_extra_f14) -{ - return mavlink_msg_serial_udb_extra_f14_pack(system_id, component_id, msg, serial_udb_extra_f14->sue_WIND_ESTIMATION, serial_udb_extra_f14->sue_GPS_TYPE, serial_udb_extra_f14->sue_DR, serial_udb_extra_f14->sue_BOARD_TYPE, serial_udb_extra_f14->sue_AIRFRAME, serial_udb_extra_f14->sue_RCON, serial_udb_extra_f14->sue_TRAP_FLAGS, serial_udb_extra_f14->sue_TRAP_SOURCE, serial_udb_extra_f14->sue_osc_fail_count, serial_udb_extra_f14->sue_CLOCK_CONFIG, serial_udb_extra_f14->sue_FLIGHT_PLAN_TYPE); -} - -/** - * @brief Encode a serial_udb_extra_f14 struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f14 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f14_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_serial_udb_extra_f14_t* serial_udb_extra_f14) -{ - return mavlink_msg_serial_udb_extra_f14_pack_chan(system_id, component_id, chan, msg, serial_udb_extra_f14->sue_WIND_ESTIMATION, serial_udb_extra_f14->sue_GPS_TYPE, serial_udb_extra_f14->sue_DR, serial_udb_extra_f14->sue_BOARD_TYPE, serial_udb_extra_f14->sue_AIRFRAME, serial_udb_extra_f14->sue_RCON, serial_udb_extra_f14->sue_TRAP_FLAGS, serial_udb_extra_f14->sue_TRAP_SOURCE, serial_udb_extra_f14->sue_osc_fail_count, serial_udb_extra_f14->sue_CLOCK_CONFIG, serial_udb_extra_f14->sue_FLIGHT_PLAN_TYPE); -} - -/** - * @brief Send a serial_udb_extra_f14 message - * @param chan MAVLink channel to send the message - * - * @param sue_WIND_ESTIMATION Serial UDB Extra Wind Estimation Enabled - * @param sue_GPS_TYPE Serial UDB Extra Type of GPS Unit - * @param sue_DR Serial UDB Extra Dead Reckoning Enabled - * @param sue_BOARD_TYPE Serial UDB Extra Type of UDB Hardware - * @param sue_AIRFRAME Serial UDB Extra Type of Airframe - * @param sue_RCON Serial UDB Extra Reboot Register of DSPIC - * @param sue_TRAP_FLAGS Serial UDB Extra Last dspic Trap Flags - * @param sue_TRAP_SOURCE Serial UDB Extra Type Program Address of Last Trap - * @param sue_osc_fail_count Serial UDB Extra Number of Ocillator Failures - * @param sue_CLOCK_CONFIG Serial UDB Extra UDB Internal Clock Configuration - * @param sue_FLIGHT_PLAN_TYPE Serial UDB Extra Type of Flight Plan - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_serial_udb_extra_f14_send(mavlink_channel_t chan, uint8_t sue_WIND_ESTIMATION, uint8_t sue_GPS_TYPE, uint8_t sue_DR, uint8_t sue_BOARD_TYPE, uint8_t sue_AIRFRAME, int16_t sue_RCON, int16_t sue_TRAP_FLAGS, uint32_t sue_TRAP_SOURCE, int16_t sue_osc_fail_count, uint8_t sue_CLOCK_CONFIG, uint8_t sue_FLIGHT_PLAN_TYPE) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_LEN]; - _mav_put_uint32_t(buf, 0, sue_TRAP_SOURCE); - _mav_put_int16_t(buf, 4, sue_RCON); - _mav_put_int16_t(buf, 6, sue_TRAP_FLAGS); - _mav_put_int16_t(buf, 8, sue_osc_fail_count); - _mav_put_uint8_t(buf, 10, sue_WIND_ESTIMATION); - _mav_put_uint8_t(buf, 11, sue_GPS_TYPE); - _mav_put_uint8_t(buf, 12, sue_DR); - _mav_put_uint8_t(buf, 13, sue_BOARD_TYPE); - _mav_put_uint8_t(buf, 14, sue_AIRFRAME); - _mav_put_uint8_t(buf, 15, sue_CLOCK_CONFIG); - _mav_put_uint8_t(buf, 16, sue_FLIGHT_PLAN_TYPE); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_CRC); -#else - mavlink_serial_udb_extra_f14_t packet; - packet.sue_TRAP_SOURCE = sue_TRAP_SOURCE; - packet.sue_RCON = sue_RCON; - packet.sue_TRAP_FLAGS = sue_TRAP_FLAGS; - packet.sue_osc_fail_count = sue_osc_fail_count; - packet.sue_WIND_ESTIMATION = sue_WIND_ESTIMATION; - packet.sue_GPS_TYPE = sue_GPS_TYPE; - packet.sue_DR = sue_DR; - packet.sue_BOARD_TYPE = sue_BOARD_TYPE; - packet.sue_AIRFRAME = sue_AIRFRAME; - packet.sue_CLOCK_CONFIG = sue_CLOCK_CONFIG; - packet.sue_FLIGHT_PLAN_TYPE = sue_FLIGHT_PLAN_TYPE; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14, (const char *)&packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_CRC); -#endif -} - -/** - * @brief Send a serial_udb_extra_f14 message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_serial_udb_extra_f14_send_struct(mavlink_channel_t chan, const mavlink_serial_udb_extra_f14_t* serial_udb_extra_f14) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_serial_udb_extra_f14_send(chan, serial_udb_extra_f14->sue_WIND_ESTIMATION, serial_udb_extra_f14->sue_GPS_TYPE, serial_udb_extra_f14->sue_DR, serial_udb_extra_f14->sue_BOARD_TYPE, serial_udb_extra_f14->sue_AIRFRAME, serial_udb_extra_f14->sue_RCON, serial_udb_extra_f14->sue_TRAP_FLAGS, serial_udb_extra_f14->sue_TRAP_SOURCE, serial_udb_extra_f14->sue_osc_fail_count, serial_udb_extra_f14->sue_CLOCK_CONFIG, serial_udb_extra_f14->sue_FLIGHT_PLAN_TYPE); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14, (const char *)serial_udb_extra_f14, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_CRC); -#endif -} - -#if MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_serial_udb_extra_f14_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t sue_WIND_ESTIMATION, uint8_t sue_GPS_TYPE, uint8_t sue_DR, uint8_t sue_BOARD_TYPE, uint8_t sue_AIRFRAME, int16_t sue_RCON, int16_t sue_TRAP_FLAGS, uint32_t sue_TRAP_SOURCE, int16_t sue_osc_fail_count, uint8_t sue_CLOCK_CONFIG, uint8_t sue_FLIGHT_PLAN_TYPE) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint32_t(buf, 0, sue_TRAP_SOURCE); - _mav_put_int16_t(buf, 4, sue_RCON); - _mav_put_int16_t(buf, 6, sue_TRAP_FLAGS); - _mav_put_int16_t(buf, 8, sue_osc_fail_count); - _mav_put_uint8_t(buf, 10, sue_WIND_ESTIMATION); - _mav_put_uint8_t(buf, 11, sue_GPS_TYPE); - _mav_put_uint8_t(buf, 12, sue_DR); - _mav_put_uint8_t(buf, 13, sue_BOARD_TYPE); - _mav_put_uint8_t(buf, 14, sue_AIRFRAME); - _mav_put_uint8_t(buf, 15, sue_CLOCK_CONFIG); - _mav_put_uint8_t(buf, 16, sue_FLIGHT_PLAN_TYPE); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_CRC); -#else - mavlink_serial_udb_extra_f14_t *packet = (mavlink_serial_udb_extra_f14_t *)msgbuf; - packet->sue_TRAP_SOURCE = sue_TRAP_SOURCE; - packet->sue_RCON = sue_RCON; - packet->sue_TRAP_FLAGS = sue_TRAP_FLAGS; - packet->sue_osc_fail_count = sue_osc_fail_count; - packet->sue_WIND_ESTIMATION = sue_WIND_ESTIMATION; - packet->sue_GPS_TYPE = sue_GPS_TYPE; - packet->sue_DR = sue_DR; - packet->sue_BOARD_TYPE = sue_BOARD_TYPE; - packet->sue_AIRFRAME = sue_AIRFRAME; - packet->sue_CLOCK_CONFIG = sue_CLOCK_CONFIG; - packet->sue_FLIGHT_PLAN_TYPE = sue_FLIGHT_PLAN_TYPE; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14, (const char *)packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_CRC); -#endif -} -#endif - -#endif - -// MESSAGE SERIAL_UDB_EXTRA_F14 UNPACKING - - -/** - * @brief Get field sue_WIND_ESTIMATION from serial_udb_extra_f14 message - * - * @return Serial UDB Extra Wind Estimation Enabled - */ -static inline uint8_t mavlink_msg_serial_udb_extra_f14_get_sue_WIND_ESTIMATION(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 10); -} - -/** - * @brief Get field sue_GPS_TYPE from serial_udb_extra_f14 message - * - * @return Serial UDB Extra Type of GPS Unit - */ -static inline uint8_t mavlink_msg_serial_udb_extra_f14_get_sue_GPS_TYPE(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 11); -} - -/** - * @brief Get field sue_DR from serial_udb_extra_f14 message - * - * @return Serial UDB Extra Dead Reckoning Enabled - */ -static inline uint8_t mavlink_msg_serial_udb_extra_f14_get_sue_DR(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 12); -} - -/** - * @brief Get field sue_BOARD_TYPE from serial_udb_extra_f14 message - * - * @return Serial UDB Extra Type of UDB Hardware - */ -static inline uint8_t mavlink_msg_serial_udb_extra_f14_get_sue_BOARD_TYPE(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 13); -} - -/** - * @brief Get field sue_AIRFRAME from serial_udb_extra_f14 message - * - * @return Serial UDB Extra Type of Airframe - */ -static inline uint8_t mavlink_msg_serial_udb_extra_f14_get_sue_AIRFRAME(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 14); -} - -/** - * @brief Get field sue_RCON from serial_udb_extra_f14 message - * - * @return Serial UDB Extra Reboot Register of DSPIC - */ -static inline int16_t mavlink_msg_serial_udb_extra_f14_get_sue_RCON(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 4); -} - -/** - * @brief Get field sue_TRAP_FLAGS from serial_udb_extra_f14 message - * - * @return Serial UDB Extra Last dspic Trap Flags - */ -static inline int16_t mavlink_msg_serial_udb_extra_f14_get_sue_TRAP_FLAGS(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 6); -} - -/** - * @brief Get field sue_TRAP_SOURCE from serial_udb_extra_f14 message - * - * @return Serial UDB Extra Type Program Address of Last Trap - */ -static inline uint32_t mavlink_msg_serial_udb_extra_f14_get_sue_TRAP_SOURCE(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 0); -} - -/** - * @brief Get field sue_osc_fail_count from serial_udb_extra_f14 message - * - * @return Serial UDB Extra Number of Ocillator Failures - */ -static inline int16_t mavlink_msg_serial_udb_extra_f14_get_sue_osc_fail_count(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 8); -} - -/** - * @brief Get field sue_CLOCK_CONFIG from serial_udb_extra_f14 message - * - * @return Serial UDB Extra UDB Internal Clock Configuration - */ -static inline uint8_t mavlink_msg_serial_udb_extra_f14_get_sue_CLOCK_CONFIG(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 15); -} - -/** - * @brief Get field sue_FLIGHT_PLAN_TYPE from serial_udb_extra_f14 message - * - * @return Serial UDB Extra Type of Flight Plan - */ -static inline uint8_t mavlink_msg_serial_udb_extra_f14_get_sue_FLIGHT_PLAN_TYPE(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 16); -} - -/** - * @brief Decode a serial_udb_extra_f14 message into a struct - * - * @param msg The message to decode - * @param serial_udb_extra_f14 C-struct to decode the message contents into - */ -static inline void mavlink_msg_serial_udb_extra_f14_decode(const mavlink_message_t* msg, mavlink_serial_udb_extra_f14_t* serial_udb_extra_f14) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - serial_udb_extra_f14->sue_TRAP_SOURCE = mavlink_msg_serial_udb_extra_f14_get_sue_TRAP_SOURCE(msg); - serial_udb_extra_f14->sue_RCON = mavlink_msg_serial_udb_extra_f14_get_sue_RCON(msg); - serial_udb_extra_f14->sue_TRAP_FLAGS = mavlink_msg_serial_udb_extra_f14_get_sue_TRAP_FLAGS(msg); - serial_udb_extra_f14->sue_osc_fail_count = mavlink_msg_serial_udb_extra_f14_get_sue_osc_fail_count(msg); - serial_udb_extra_f14->sue_WIND_ESTIMATION = mavlink_msg_serial_udb_extra_f14_get_sue_WIND_ESTIMATION(msg); - serial_udb_extra_f14->sue_GPS_TYPE = mavlink_msg_serial_udb_extra_f14_get_sue_GPS_TYPE(msg); - serial_udb_extra_f14->sue_DR = mavlink_msg_serial_udb_extra_f14_get_sue_DR(msg); - serial_udb_extra_f14->sue_BOARD_TYPE = mavlink_msg_serial_udb_extra_f14_get_sue_BOARD_TYPE(msg); - serial_udb_extra_f14->sue_AIRFRAME = mavlink_msg_serial_udb_extra_f14_get_sue_AIRFRAME(msg); - serial_udb_extra_f14->sue_CLOCK_CONFIG = mavlink_msg_serial_udb_extra_f14_get_sue_CLOCK_CONFIG(msg); - serial_udb_extra_f14->sue_FLIGHT_PLAN_TYPE = mavlink_msg_serial_udb_extra_f14_get_sue_FLIGHT_PLAN_TYPE(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_LEN? msg->len : MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_LEN; - memset(serial_udb_extra_f14, 0, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_LEN); - memcpy(serial_udb_extra_f14, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/matrixpilot/mavlink_msg_serial_udb_extra_f15.h b/matrixpilot/mavlink_msg_serial_udb_extra_f15.h deleted file mode 100644 index 0f44a0fac..000000000 --- a/matrixpilot/mavlink_msg_serial_udb_extra_f15.h +++ /dev/null @@ -1,239 +0,0 @@ -#pragma once -// MESSAGE SERIAL_UDB_EXTRA_F15 PACKING - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15 179 - - -typedef struct __mavlink_serial_udb_extra_f15_t { - uint8_t sue_ID_VEHICLE_MODEL_NAME[40]; /*< Serial UDB Extra Model Name Of Vehicle*/ - uint8_t sue_ID_VEHICLE_REGISTRATION[20]; /*< Serial UDB Extra Registraton Number of Vehicle*/ -} mavlink_serial_udb_extra_f15_t; - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_LEN 60 -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_MIN_LEN 60 -#define MAVLINK_MSG_ID_179_LEN 60 -#define MAVLINK_MSG_ID_179_MIN_LEN 60 - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_CRC 7 -#define MAVLINK_MSG_ID_179_CRC 7 - -#define MAVLINK_MSG_SERIAL_UDB_EXTRA_F15_FIELD_SUE_ID_VEHICLE_MODEL_NAME_LEN 40 -#define MAVLINK_MSG_SERIAL_UDB_EXTRA_F15_FIELD_SUE_ID_VEHICLE_REGISTRATION_LEN 20 - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F15 { \ - 179, \ - "SERIAL_UDB_EXTRA_F15", \ - 2, \ - { { "sue_ID_VEHICLE_MODEL_NAME", NULL, MAVLINK_TYPE_UINT8_T, 40, 0, offsetof(mavlink_serial_udb_extra_f15_t, sue_ID_VEHICLE_MODEL_NAME) }, \ - { "sue_ID_VEHICLE_REGISTRATION", NULL, MAVLINK_TYPE_UINT8_T, 20, 40, offsetof(mavlink_serial_udb_extra_f15_t, sue_ID_VEHICLE_REGISTRATION) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F15 { \ - "SERIAL_UDB_EXTRA_F15", \ - 2, \ - { { "sue_ID_VEHICLE_MODEL_NAME", NULL, MAVLINK_TYPE_UINT8_T, 40, 0, offsetof(mavlink_serial_udb_extra_f15_t, sue_ID_VEHICLE_MODEL_NAME) }, \ - { "sue_ID_VEHICLE_REGISTRATION", NULL, MAVLINK_TYPE_UINT8_T, 20, 40, offsetof(mavlink_serial_udb_extra_f15_t, sue_ID_VEHICLE_REGISTRATION) }, \ - } \ -} -#endif - -/** - * @brief Pack a serial_udb_extra_f15 message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param sue_ID_VEHICLE_MODEL_NAME Serial UDB Extra Model Name Of Vehicle - * @param sue_ID_VEHICLE_REGISTRATION Serial UDB Extra Registraton Number of Vehicle - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f15_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - const uint8_t *sue_ID_VEHICLE_MODEL_NAME, const uint8_t *sue_ID_VEHICLE_REGISTRATION) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_LEN]; - - _mav_put_uint8_t_array(buf, 0, sue_ID_VEHICLE_MODEL_NAME, 40); - _mav_put_uint8_t_array(buf, 40, sue_ID_VEHICLE_REGISTRATION, 20); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_LEN); -#else - mavlink_serial_udb_extra_f15_t packet; - - mav_array_memcpy(packet.sue_ID_VEHICLE_MODEL_NAME, sue_ID_VEHICLE_MODEL_NAME, sizeof(uint8_t)*40); - mav_array_memcpy(packet.sue_ID_VEHICLE_REGISTRATION, sue_ID_VEHICLE_REGISTRATION, sizeof(uint8_t)*20); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_CRC); -} - -/** - * @brief Pack a serial_udb_extra_f15 message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param sue_ID_VEHICLE_MODEL_NAME Serial UDB Extra Model Name Of Vehicle - * @param sue_ID_VEHICLE_REGISTRATION Serial UDB Extra Registraton Number of Vehicle - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f15_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - const uint8_t *sue_ID_VEHICLE_MODEL_NAME,const uint8_t *sue_ID_VEHICLE_REGISTRATION) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_LEN]; - - _mav_put_uint8_t_array(buf, 0, sue_ID_VEHICLE_MODEL_NAME, 40); - _mav_put_uint8_t_array(buf, 40, sue_ID_VEHICLE_REGISTRATION, 20); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_LEN); -#else - mavlink_serial_udb_extra_f15_t packet; - - mav_array_memcpy(packet.sue_ID_VEHICLE_MODEL_NAME, sue_ID_VEHICLE_MODEL_NAME, sizeof(uint8_t)*40); - mav_array_memcpy(packet.sue_ID_VEHICLE_REGISTRATION, sue_ID_VEHICLE_REGISTRATION, sizeof(uint8_t)*20); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_CRC); -} - -/** - * @brief Encode a serial_udb_extra_f15 struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f15 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f15_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_serial_udb_extra_f15_t* serial_udb_extra_f15) -{ - return mavlink_msg_serial_udb_extra_f15_pack(system_id, component_id, msg, serial_udb_extra_f15->sue_ID_VEHICLE_MODEL_NAME, serial_udb_extra_f15->sue_ID_VEHICLE_REGISTRATION); -} - -/** - * @brief Encode a serial_udb_extra_f15 struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f15 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f15_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_serial_udb_extra_f15_t* serial_udb_extra_f15) -{ - return mavlink_msg_serial_udb_extra_f15_pack_chan(system_id, component_id, chan, msg, serial_udb_extra_f15->sue_ID_VEHICLE_MODEL_NAME, serial_udb_extra_f15->sue_ID_VEHICLE_REGISTRATION); -} - -/** - * @brief Send a serial_udb_extra_f15 message - * @param chan MAVLink channel to send the message - * - * @param sue_ID_VEHICLE_MODEL_NAME Serial UDB Extra Model Name Of Vehicle - * @param sue_ID_VEHICLE_REGISTRATION Serial UDB Extra Registraton Number of Vehicle - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_serial_udb_extra_f15_send(mavlink_channel_t chan, const uint8_t *sue_ID_VEHICLE_MODEL_NAME, const uint8_t *sue_ID_VEHICLE_REGISTRATION) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_LEN]; - - _mav_put_uint8_t_array(buf, 0, sue_ID_VEHICLE_MODEL_NAME, 40); - _mav_put_uint8_t_array(buf, 40, sue_ID_VEHICLE_REGISTRATION, 20); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_CRC); -#else - mavlink_serial_udb_extra_f15_t packet; - - mav_array_memcpy(packet.sue_ID_VEHICLE_MODEL_NAME, sue_ID_VEHICLE_MODEL_NAME, sizeof(uint8_t)*40); - mav_array_memcpy(packet.sue_ID_VEHICLE_REGISTRATION, sue_ID_VEHICLE_REGISTRATION, sizeof(uint8_t)*20); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15, (const char *)&packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_CRC); -#endif -} - -/** - * @brief Send a serial_udb_extra_f15 message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_serial_udb_extra_f15_send_struct(mavlink_channel_t chan, const mavlink_serial_udb_extra_f15_t* serial_udb_extra_f15) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_serial_udb_extra_f15_send(chan, serial_udb_extra_f15->sue_ID_VEHICLE_MODEL_NAME, serial_udb_extra_f15->sue_ID_VEHICLE_REGISTRATION); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15, (const char *)serial_udb_extra_f15, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_CRC); -#endif -} - -#if MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_serial_udb_extra_f15_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, const uint8_t *sue_ID_VEHICLE_MODEL_NAME, const uint8_t *sue_ID_VEHICLE_REGISTRATION) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - - _mav_put_uint8_t_array(buf, 0, sue_ID_VEHICLE_MODEL_NAME, 40); - _mav_put_uint8_t_array(buf, 40, sue_ID_VEHICLE_REGISTRATION, 20); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_CRC); -#else - mavlink_serial_udb_extra_f15_t *packet = (mavlink_serial_udb_extra_f15_t *)msgbuf; - - mav_array_memcpy(packet->sue_ID_VEHICLE_MODEL_NAME, sue_ID_VEHICLE_MODEL_NAME, sizeof(uint8_t)*40); - mav_array_memcpy(packet->sue_ID_VEHICLE_REGISTRATION, sue_ID_VEHICLE_REGISTRATION, sizeof(uint8_t)*20); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15, (const char *)packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_CRC); -#endif -} -#endif - -#endif - -// MESSAGE SERIAL_UDB_EXTRA_F15 UNPACKING - - -/** - * @brief Get field sue_ID_VEHICLE_MODEL_NAME from serial_udb_extra_f15 message - * - * @return Serial UDB Extra Model Name Of Vehicle - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f15_get_sue_ID_VEHICLE_MODEL_NAME(const mavlink_message_t* msg, uint8_t *sue_ID_VEHICLE_MODEL_NAME) -{ - return _MAV_RETURN_uint8_t_array(msg, sue_ID_VEHICLE_MODEL_NAME, 40, 0); -} - -/** - * @brief Get field sue_ID_VEHICLE_REGISTRATION from serial_udb_extra_f15 message - * - * @return Serial UDB Extra Registraton Number of Vehicle - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f15_get_sue_ID_VEHICLE_REGISTRATION(const mavlink_message_t* msg, uint8_t *sue_ID_VEHICLE_REGISTRATION) -{ - return _MAV_RETURN_uint8_t_array(msg, sue_ID_VEHICLE_REGISTRATION, 20, 40); -} - -/** - * @brief Decode a serial_udb_extra_f15 message into a struct - * - * @param msg The message to decode - * @param serial_udb_extra_f15 C-struct to decode the message contents into - */ -static inline void mavlink_msg_serial_udb_extra_f15_decode(const mavlink_message_t* msg, mavlink_serial_udb_extra_f15_t* serial_udb_extra_f15) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_serial_udb_extra_f15_get_sue_ID_VEHICLE_MODEL_NAME(msg, serial_udb_extra_f15->sue_ID_VEHICLE_MODEL_NAME); - mavlink_msg_serial_udb_extra_f15_get_sue_ID_VEHICLE_REGISTRATION(msg, serial_udb_extra_f15->sue_ID_VEHICLE_REGISTRATION); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_LEN? msg->len : MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_LEN; - memset(serial_udb_extra_f15, 0, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_LEN); - memcpy(serial_udb_extra_f15, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/matrixpilot/mavlink_msg_serial_udb_extra_f16.h b/matrixpilot/mavlink_msg_serial_udb_extra_f16.h deleted file mode 100644 index f88f9973c..000000000 --- a/matrixpilot/mavlink_msg_serial_udb_extra_f16.h +++ /dev/null @@ -1,239 +0,0 @@ -#pragma once -// MESSAGE SERIAL_UDB_EXTRA_F16 PACKING - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16 180 - - -typedef struct __mavlink_serial_udb_extra_f16_t { - uint8_t sue_ID_LEAD_PILOT[40]; /*< Serial UDB Extra Name of Expected Lead Pilot*/ - uint8_t sue_ID_DIY_DRONES_URL[70]; /*< Serial UDB Extra URL of Lead Pilot or Team*/ -} mavlink_serial_udb_extra_f16_t; - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_LEN 110 -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_MIN_LEN 110 -#define MAVLINK_MSG_ID_180_LEN 110 -#define MAVLINK_MSG_ID_180_MIN_LEN 110 - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_CRC 222 -#define MAVLINK_MSG_ID_180_CRC 222 - -#define MAVLINK_MSG_SERIAL_UDB_EXTRA_F16_FIELD_SUE_ID_LEAD_PILOT_LEN 40 -#define MAVLINK_MSG_SERIAL_UDB_EXTRA_F16_FIELD_SUE_ID_DIY_DRONES_URL_LEN 70 - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F16 { \ - 180, \ - "SERIAL_UDB_EXTRA_F16", \ - 2, \ - { { "sue_ID_LEAD_PILOT", NULL, MAVLINK_TYPE_UINT8_T, 40, 0, offsetof(mavlink_serial_udb_extra_f16_t, sue_ID_LEAD_PILOT) }, \ - { "sue_ID_DIY_DRONES_URL", NULL, MAVLINK_TYPE_UINT8_T, 70, 40, offsetof(mavlink_serial_udb_extra_f16_t, sue_ID_DIY_DRONES_URL) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F16 { \ - "SERIAL_UDB_EXTRA_F16", \ - 2, \ - { { "sue_ID_LEAD_PILOT", NULL, MAVLINK_TYPE_UINT8_T, 40, 0, offsetof(mavlink_serial_udb_extra_f16_t, sue_ID_LEAD_PILOT) }, \ - { "sue_ID_DIY_DRONES_URL", NULL, MAVLINK_TYPE_UINT8_T, 70, 40, offsetof(mavlink_serial_udb_extra_f16_t, sue_ID_DIY_DRONES_URL) }, \ - } \ -} -#endif - -/** - * @brief Pack a serial_udb_extra_f16 message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param sue_ID_LEAD_PILOT Serial UDB Extra Name of Expected Lead Pilot - * @param sue_ID_DIY_DRONES_URL Serial UDB Extra URL of Lead Pilot or Team - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f16_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - const uint8_t *sue_ID_LEAD_PILOT, const uint8_t *sue_ID_DIY_DRONES_URL) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_LEN]; - - _mav_put_uint8_t_array(buf, 0, sue_ID_LEAD_PILOT, 40); - _mav_put_uint8_t_array(buf, 40, sue_ID_DIY_DRONES_URL, 70); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_LEN); -#else - mavlink_serial_udb_extra_f16_t packet; - - mav_array_memcpy(packet.sue_ID_LEAD_PILOT, sue_ID_LEAD_PILOT, sizeof(uint8_t)*40); - mav_array_memcpy(packet.sue_ID_DIY_DRONES_URL, sue_ID_DIY_DRONES_URL, sizeof(uint8_t)*70); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_CRC); -} - -/** - * @brief Pack a serial_udb_extra_f16 message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param sue_ID_LEAD_PILOT Serial UDB Extra Name of Expected Lead Pilot - * @param sue_ID_DIY_DRONES_URL Serial UDB Extra URL of Lead Pilot or Team - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f16_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - const uint8_t *sue_ID_LEAD_PILOT,const uint8_t *sue_ID_DIY_DRONES_URL) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_LEN]; - - _mav_put_uint8_t_array(buf, 0, sue_ID_LEAD_PILOT, 40); - _mav_put_uint8_t_array(buf, 40, sue_ID_DIY_DRONES_URL, 70); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_LEN); -#else - mavlink_serial_udb_extra_f16_t packet; - - mav_array_memcpy(packet.sue_ID_LEAD_PILOT, sue_ID_LEAD_PILOT, sizeof(uint8_t)*40); - mav_array_memcpy(packet.sue_ID_DIY_DRONES_URL, sue_ID_DIY_DRONES_URL, sizeof(uint8_t)*70); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_CRC); -} - -/** - * @brief Encode a serial_udb_extra_f16 struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f16 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f16_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_serial_udb_extra_f16_t* serial_udb_extra_f16) -{ - return mavlink_msg_serial_udb_extra_f16_pack(system_id, component_id, msg, serial_udb_extra_f16->sue_ID_LEAD_PILOT, serial_udb_extra_f16->sue_ID_DIY_DRONES_URL); -} - -/** - * @brief Encode a serial_udb_extra_f16 struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f16 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f16_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_serial_udb_extra_f16_t* serial_udb_extra_f16) -{ - return mavlink_msg_serial_udb_extra_f16_pack_chan(system_id, component_id, chan, msg, serial_udb_extra_f16->sue_ID_LEAD_PILOT, serial_udb_extra_f16->sue_ID_DIY_DRONES_URL); -} - -/** - * @brief Send a serial_udb_extra_f16 message - * @param chan MAVLink channel to send the message - * - * @param sue_ID_LEAD_PILOT Serial UDB Extra Name of Expected Lead Pilot - * @param sue_ID_DIY_DRONES_URL Serial UDB Extra URL of Lead Pilot or Team - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_serial_udb_extra_f16_send(mavlink_channel_t chan, const uint8_t *sue_ID_LEAD_PILOT, const uint8_t *sue_ID_DIY_DRONES_URL) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_LEN]; - - _mav_put_uint8_t_array(buf, 0, sue_ID_LEAD_PILOT, 40); - _mav_put_uint8_t_array(buf, 40, sue_ID_DIY_DRONES_URL, 70); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_CRC); -#else - mavlink_serial_udb_extra_f16_t packet; - - mav_array_memcpy(packet.sue_ID_LEAD_PILOT, sue_ID_LEAD_PILOT, sizeof(uint8_t)*40); - mav_array_memcpy(packet.sue_ID_DIY_DRONES_URL, sue_ID_DIY_DRONES_URL, sizeof(uint8_t)*70); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16, (const char *)&packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_CRC); -#endif -} - -/** - * @brief Send a serial_udb_extra_f16 message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_serial_udb_extra_f16_send_struct(mavlink_channel_t chan, const mavlink_serial_udb_extra_f16_t* serial_udb_extra_f16) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_serial_udb_extra_f16_send(chan, serial_udb_extra_f16->sue_ID_LEAD_PILOT, serial_udb_extra_f16->sue_ID_DIY_DRONES_URL); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16, (const char *)serial_udb_extra_f16, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_CRC); -#endif -} - -#if MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_serial_udb_extra_f16_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, const uint8_t *sue_ID_LEAD_PILOT, const uint8_t *sue_ID_DIY_DRONES_URL) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - - _mav_put_uint8_t_array(buf, 0, sue_ID_LEAD_PILOT, 40); - _mav_put_uint8_t_array(buf, 40, sue_ID_DIY_DRONES_URL, 70); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_CRC); -#else - mavlink_serial_udb_extra_f16_t *packet = (mavlink_serial_udb_extra_f16_t *)msgbuf; - - mav_array_memcpy(packet->sue_ID_LEAD_PILOT, sue_ID_LEAD_PILOT, sizeof(uint8_t)*40); - mav_array_memcpy(packet->sue_ID_DIY_DRONES_URL, sue_ID_DIY_DRONES_URL, sizeof(uint8_t)*70); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16, (const char *)packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_CRC); -#endif -} -#endif - -#endif - -// MESSAGE SERIAL_UDB_EXTRA_F16 UNPACKING - - -/** - * @brief Get field sue_ID_LEAD_PILOT from serial_udb_extra_f16 message - * - * @return Serial UDB Extra Name of Expected Lead Pilot - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f16_get_sue_ID_LEAD_PILOT(const mavlink_message_t* msg, uint8_t *sue_ID_LEAD_PILOT) -{ - return _MAV_RETURN_uint8_t_array(msg, sue_ID_LEAD_PILOT, 40, 0); -} - -/** - * @brief Get field sue_ID_DIY_DRONES_URL from serial_udb_extra_f16 message - * - * @return Serial UDB Extra URL of Lead Pilot or Team - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f16_get_sue_ID_DIY_DRONES_URL(const mavlink_message_t* msg, uint8_t *sue_ID_DIY_DRONES_URL) -{ - return _MAV_RETURN_uint8_t_array(msg, sue_ID_DIY_DRONES_URL, 70, 40); -} - -/** - * @brief Decode a serial_udb_extra_f16 message into a struct - * - * @param msg The message to decode - * @param serial_udb_extra_f16 C-struct to decode the message contents into - */ -static inline void mavlink_msg_serial_udb_extra_f16_decode(const mavlink_message_t* msg, mavlink_serial_udb_extra_f16_t* serial_udb_extra_f16) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_serial_udb_extra_f16_get_sue_ID_LEAD_PILOT(msg, serial_udb_extra_f16->sue_ID_LEAD_PILOT); - mavlink_msg_serial_udb_extra_f16_get_sue_ID_DIY_DRONES_URL(msg, serial_udb_extra_f16->sue_ID_DIY_DRONES_URL); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_LEN? msg->len : MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_LEN; - memset(serial_udb_extra_f16, 0, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_LEN); - memcpy(serial_udb_extra_f16, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/matrixpilot/mavlink_msg_serial_udb_extra_f17.h b/matrixpilot/mavlink_msg_serial_udb_extra_f17.h deleted file mode 100644 index 5f3354275..000000000 --- a/matrixpilot/mavlink_msg_serial_udb_extra_f17.h +++ /dev/null @@ -1,263 +0,0 @@ -#pragma once -// MESSAGE SERIAL_UDB_EXTRA_F17 PACKING - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17 183 - - -typedef struct __mavlink_serial_udb_extra_f17_t { - float sue_feed_forward; /*< SUE Feed Forward Gain*/ - float sue_turn_rate_nav; /*< SUE Max Turn Rate when Navigating*/ - float sue_turn_rate_fbw; /*< SUE Max Turn Rate in Fly By Wire Mode*/ -} mavlink_serial_udb_extra_f17_t; - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_LEN 12 -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_MIN_LEN 12 -#define MAVLINK_MSG_ID_183_LEN 12 -#define MAVLINK_MSG_ID_183_MIN_LEN 12 - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_CRC 175 -#define MAVLINK_MSG_ID_183_CRC 175 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F17 { \ - 183, \ - "SERIAL_UDB_EXTRA_F17", \ - 3, \ - { { "sue_feed_forward", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_serial_udb_extra_f17_t, sue_feed_forward) }, \ - { "sue_turn_rate_nav", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_serial_udb_extra_f17_t, sue_turn_rate_nav) }, \ - { "sue_turn_rate_fbw", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_serial_udb_extra_f17_t, sue_turn_rate_fbw) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F17 { \ - "SERIAL_UDB_EXTRA_F17", \ - 3, \ - { { "sue_feed_forward", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_serial_udb_extra_f17_t, sue_feed_forward) }, \ - { "sue_turn_rate_nav", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_serial_udb_extra_f17_t, sue_turn_rate_nav) }, \ - { "sue_turn_rate_fbw", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_serial_udb_extra_f17_t, sue_turn_rate_fbw) }, \ - } \ -} -#endif - -/** - * @brief Pack a serial_udb_extra_f17 message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param sue_feed_forward SUE Feed Forward Gain - * @param sue_turn_rate_nav SUE Max Turn Rate when Navigating - * @param sue_turn_rate_fbw SUE Max Turn Rate in Fly By Wire Mode - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f17_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - float sue_feed_forward, float sue_turn_rate_nav, float sue_turn_rate_fbw) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_LEN]; - _mav_put_float(buf, 0, sue_feed_forward); - _mav_put_float(buf, 4, sue_turn_rate_nav); - _mav_put_float(buf, 8, sue_turn_rate_fbw); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_LEN); -#else - mavlink_serial_udb_extra_f17_t packet; - packet.sue_feed_forward = sue_feed_forward; - packet.sue_turn_rate_nav = sue_turn_rate_nav; - packet.sue_turn_rate_fbw = sue_turn_rate_fbw; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_CRC); -} - -/** - * @brief Pack a serial_udb_extra_f17 message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param sue_feed_forward SUE Feed Forward Gain - * @param sue_turn_rate_nav SUE Max Turn Rate when Navigating - * @param sue_turn_rate_fbw SUE Max Turn Rate in Fly By Wire Mode - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f17_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - float sue_feed_forward,float sue_turn_rate_nav,float sue_turn_rate_fbw) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_LEN]; - _mav_put_float(buf, 0, sue_feed_forward); - _mav_put_float(buf, 4, sue_turn_rate_nav); - _mav_put_float(buf, 8, sue_turn_rate_fbw); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_LEN); -#else - mavlink_serial_udb_extra_f17_t packet; - packet.sue_feed_forward = sue_feed_forward; - packet.sue_turn_rate_nav = sue_turn_rate_nav; - packet.sue_turn_rate_fbw = sue_turn_rate_fbw; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_CRC); -} - -/** - * @brief Encode a serial_udb_extra_f17 struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f17 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f17_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_serial_udb_extra_f17_t* serial_udb_extra_f17) -{ - return mavlink_msg_serial_udb_extra_f17_pack(system_id, component_id, msg, serial_udb_extra_f17->sue_feed_forward, serial_udb_extra_f17->sue_turn_rate_nav, serial_udb_extra_f17->sue_turn_rate_fbw); -} - -/** - * @brief Encode a serial_udb_extra_f17 struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f17 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f17_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_serial_udb_extra_f17_t* serial_udb_extra_f17) -{ - return mavlink_msg_serial_udb_extra_f17_pack_chan(system_id, component_id, chan, msg, serial_udb_extra_f17->sue_feed_forward, serial_udb_extra_f17->sue_turn_rate_nav, serial_udb_extra_f17->sue_turn_rate_fbw); -} - -/** - * @brief Send a serial_udb_extra_f17 message - * @param chan MAVLink channel to send the message - * - * @param sue_feed_forward SUE Feed Forward Gain - * @param sue_turn_rate_nav SUE Max Turn Rate when Navigating - * @param sue_turn_rate_fbw SUE Max Turn Rate in Fly By Wire Mode - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_serial_udb_extra_f17_send(mavlink_channel_t chan, float sue_feed_forward, float sue_turn_rate_nav, float sue_turn_rate_fbw) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_LEN]; - _mav_put_float(buf, 0, sue_feed_forward); - _mav_put_float(buf, 4, sue_turn_rate_nav); - _mav_put_float(buf, 8, sue_turn_rate_fbw); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_CRC); -#else - mavlink_serial_udb_extra_f17_t packet; - packet.sue_feed_forward = sue_feed_forward; - packet.sue_turn_rate_nav = sue_turn_rate_nav; - packet.sue_turn_rate_fbw = sue_turn_rate_fbw; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17, (const char *)&packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_CRC); -#endif -} - -/** - * @brief Send a serial_udb_extra_f17 message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_serial_udb_extra_f17_send_struct(mavlink_channel_t chan, const mavlink_serial_udb_extra_f17_t* serial_udb_extra_f17) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_serial_udb_extra_f17_send(chan, serial_udb_extra_f17->sue_feed_forward, serial_udb_extra_f17->sue_turn_rate_nav, serial_udb_extra_f17->sue_turn_rate_fbw); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17, (const char *)serial_udb_extra_f17, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_CRC); -#endif -} - -#if MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_serial_udb_extra_f17_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, float sue_feed_forward, float sue_turn_rate_nav, float sue_turn_rate_fbw) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_float(buf, 0, sue_feed_forward); - _mav_put_float(buf, 4, sue_turn_rate_nav); - _mav_put_float(buf, 8, sue_turn_rate_fbw); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_CRC); -#else - mavlink_serial_udb_extra_f17_t *packet = (mavlink_serial_udb_extra_f17_t *)msgbuf; - packet->sue_feed_forward = sue_feed_forward; - packet->sue_turn_rate_nav = sue_turn_rate_nav; - packet->sue_turn_rate_fbw = sue_turn_rate_fbw; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17, (const char *)packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_CRC); -#endif -} -#endif - -#endif - -// MESSAGE SERIAL_UDB_EXTRA_F17 UNPACKING - - -/** - * @brief Get field sue_feed_forward from serial_udb_extra_f17 message - * - * @return SUE Feed Forward Gain - */ -static inline float mavlink_msg_serial_udb_extra_f17_get_sue_feed_forward(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 0); -} - -/** - * @brief Get field sue_turn_rate_nav from serial_udb_extra_f17 message - * - * @return SUE Max Turn Rate when Navigating - */ -static inline float mavlink_msg_serial_udb_extra_f17_get_sue_turn_rate_nav(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 4); -} - -/** - * @brief Get field sue_turn_rate_fbw from serial_udb_extra_f17 message - * - * @return SUE Max Turn Rate in Fly By Wire Mode - */ -static inline float mavlink_msg_serial_udb_extra_f17_get_sue_turn_rate_fbw(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Decode a serial_udb_extra_f17 message into a struct - * - * @param msg The message to decode - * @param serial_udb_extra_f17 C-struct to decode the message contents into - */ -static inline void mavlink_msg_serial_udb_extra_f17_decode(const mavlink_message_t* msg, mavlink_serial_udb_extra_f17_t* serial_udb_extra_f17) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - serial_udb_extra_f17->sue_feed_forward = mavlink_msg_serial_udb_extra_f17_get_sue_feed_forward(msg); - serial_udb_extra_f17->sue_turn_rate_nav = mavlink_msg_serial_udb_extra_f17_get_sue_turn_rate_nav(msg); - serial_udb_extra_f17->sue_turn_rate_fbw = mavlink_msg_serial_udb_extra_f17_get_sue_turn_rate_fbw(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_LEN? msg->len : MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_LEN; - memset(serial_udb_extra_f17, 0, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_LEN); - memcpy(serial_udb_extra_f17, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/matrixpilot/mavlink_msg_serial_udb_extra_f18.h b/matrixpilot/mavlink_msg_serial_udb_extra_f18.h deleted file mode 100644 index 1de567fa7..000000000 --- a/matrixpilot/mavlink_msg_serial_udb_extra_f18.h +++ /dev/null @@ -1,313 +0,0 @@ -#pragma once -// MESSAGE SERIAL_UDB_EXTRA_F18 PACKING - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18 184 - - -typedef struct __mavlink_serial_udb_extra_f18_t { - float angle_of_attack_normal; /*< SUE Angle of Attack Normal*/ - float angle_of_attack_inverted; /*< SUE Angle of Attack Inverted*/ - float elevator_trim_normal; /*< SUE Elevator Trim Normal*/ - float elevator_trim_inverted; /*< SUE Elevator Trim Inverted*/ - float reference_speed; /*< SUE reference_speed*/ -} mavlink_serial_udb_extra_f18_t; - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_LEN 20 -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_MIN_LEN 20 -#define MAVLINK_MSG_ID_184_LEN 20 -#define MAVLINK_MSG_ID_184_MIN_LEN 20 - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_CRC 41 -#define MAVLINK_MSG_ID_184_CRC 41 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F18 { \ - 184, \ - "SERIAL_UDB_EXTRA_F18", \ - 5, \ - { { "angle_of_attack_normal", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_serial_udb_extra_f18_t, angle_of_attack_normal) }, \ - { "angle_of_attack_inverted", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_serial_udb_extra_f18_t, angle_of_attack_inverted) }, \ - { "elevator_trim_normal", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_serial_udb_extra_f18_t, elevator_trim_normal) }, \ - { "elevator_trim_inverted", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_serial_udb_extra_f18_t, elevator_trim_inverted) }, \ - { "reference_speed", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_serial_udb_extra_f18_t, reference_speed) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F18 { \ - "SERIAL_UDB_EXTRA_F18", \ - 5, \ - { { "angle_of_attack_normal", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_serial_udb_extra_f18_t, angle_of_attack_normal) }, \ - { "angle_of_attack_inverted", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_serial_udb_extra_f18_t, angle_of_attack_inverted) }, \ - { "elevator_trim_normal", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_serial_udb_extra_f18_t, elevator_trim_normal) }, \ - { "elevator_trim_inverted", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_serial_udb_extra_f18_t, elevator_trim_inverted) }, \ - { "reference_speed", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_serial_udb_extra_f18_t, reference_speed) }, \ - } \ -} -#endif - -/** - * @brief Pack a serial_udb_extra_f18 message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param angle_of_attack_normal SUE Angle of Attack Normal - * @param angle_of_attack_inverted SUE Angle of Attack Inverted - * @param elevator_trim_normal SUE Elevator Trim Normal - * @param elevator_trim_inverted SUE Elevator Trim Inverted - * @param reference_speed SUE reference_speed - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f18_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - float angle_of_attack_normal, float angle_of_attack_inverted, float elevator_trim_normal, float elevator_trim_inverted, float reference_speed) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_LEN]; - _mav_put_float(buf, 0, angle_of_attack_normal); - _mav_put_float(buf, 4, angle_of_attack_inverted); - _mav_put_float(buf, 8, elevator_trim_normal); - _mav_put_float(buf, 12, elevator_trim_inverted); - _mav_put_float(buf, 16, reference_speed); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_LEN); -#else - mavlink_serial_udb_extra_f18_t packet; - packet.angle_of_attack_normal = angle_of_attack_normal; - packet.angle_of_attack_inverted = angle_of_attack_inverted; - packet.elevator_trim_normal = elevator_trim_normal; - packet.elevator_trim_inverted = elevator_trim_inverted; - packet.reference_speed = reference_speed; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_CRC); -} - -/** - * @brief Pack a serial_udb_extra_f18 message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param angle_of_attack_normal SUE Angle of Attack Normal - * @param angle_of_attack_inverted SUE Angle of Attack Inverted - * @param elevator_trim_normal SUE Elevator Trim Normal - * @param elevator_trim_inverted SUE Elevator Trim Inverted - * @param reference_speed SUE reference_speed - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f18_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - float angle_of_attack_normal,float angle_of_attack_inverted,float elevator_trim_normal,float elevator_trim_inverted,float reference_speed) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_LEN]; - _mav_put_float(buf, 0, angle_of_attack_normal); - _mav_put_float(buf, 4, angle_of_attack_inverted); - _mav_put_float(buf, 8, elevator_trim_normal); - _mav_put_float(buf, 12, elevator_trim_inverted); - _mav_put_float(buf, 16, reference_speed); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_LEN); -#else - mavlink_serial_udb_extra_f18_t packet; - packet.angle_of_attack_normal = angle_of_attack_normal; - packet.angle_of_attack_inverted = angle_of_attack_inverted; - packet.elevator_trim_normal = elevator_trim_normal; - packet.elevator_trim_inverted = elevator_trim_inverted; - packet.reference_speed = reference_speed; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_CRC); -} - -/** - * @brief Encode a serial_udb_extra_f18 struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f18 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f18_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_serial_udb_extra_f18_t* serial_udb_extra_f18) -{ - return mavlink_msg_serial_udb_extra_f18_pack(system_id, component_id, msg, serial_udb_extra_f18->angle_of_attack_normal, serial_udb_extra_f18->angle_of_attack_inverted, serial_udb_extra_f18->elevator_trim_normal, serial_udb_extra_f18->elevator_trim_inverted, serial_udb_extra_f18->reference_speed); -} - -/** - * @brief Encode a serial_udb_extra_f18 struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f18 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f18_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_serial_udb_extra_f18_t* serial_udb_extra_f18) -{ - return mavlink_msg_serial_udb_extra_f18_pack_chan(system_id, component_id, chan, msg, serial_udb_extra_f18->angle_of_attack_normal, serial_udb_extra_f18->angle_of_attack_inverted, serial_udb_extra_f18->elevator_trim_normal, serial_udb_extra_f18->elevator_trim_inverted, serial_udb_extra_f18->reference_speed); -} - -/** - * @brief Send a serial_udb_extra_f18 message - * @param chan MAVLink channel to send the message - * - * @param angle_of_attack_normal SUE Angle of Attack Normal - * @param angle_of_attack_inverted SUE Angle of Attack Inverted - * @param elevator_trim_normal SUE Elevator Trim Normal - * @param elevator_trim_inverted SUE Elevator Trim Inverted - * @param reference_speed SUE reference_speed - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_serial_udb_extra_f18_send(mavlink_channel_t chan, float angle_of_attack_normal, float angle_of_attack_inverted, float elevator_trim_normal, float elevator_trim_inverted, float reference_speed) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_LEN]; - _mav_put_float(buf, 0, angle_of_attack_normal); - _mav_put_float(buf, 4, angle_of_attack_inverted); - _mav_put_float(buf, 8, elevator_trim_normal); - _mav_put_float(buf, 12, elevator_trim_inverted); - _mav_put_float(buf, 16, reference_speed); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_CRC); -#else - mavlink_serial_udb_extra_f18_t packet; - packet.angle_of_attack_normal = angle_of_attack_normal; - packet.angle_of_attack_inverted = angle_of_attack_inverted; - packet.elevator_trim_normal = elevator_trim_normal; - packet.elevator_trim_inverted = elevator_trim_inverted; - packet.reference_speed = reference_speed; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18, (const char *)&packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_CRC); -#endif -} - -/** - * @brief Send a serial_udb_extra_f18 message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_serial_udb_extra_f18_send_struct(mavlink_channel_t chan, const mavlink_serial_udb_extra_f18_t* serial_udb_extra_f18) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_serial_udb_extra_f18_send(chan, serial_udb_extra_f18->angle_of_attack_normal, serial_udb_extra_f18->angle_of_attack_inverted, serial_udb_extra_f18->elevator_trim_normal, serial_udb_extra_f18->elevator_trim_inverted, serial_udb_extra_f18->reference_speed); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18, (const char *)serial_udb_extra_f18, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_CRC); -#endif -} - -#if MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_serial_udb_extra_f18_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, float angle_of_attack_normal, float angle_of_attack_inverted, float elevator_trim_normal, float elevator_trim_inverted, float reference_speed) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_float(buf, 0, angle_of_attack_normal); - _mav_put_float(buf, 4, angle_of_attack_inverted); - _mav_put_float(buf, 8, elevator_trim_normal); - _mav_put_float(buf, 12, elevator_trim_inverted); - _mav_put_float(buf, 16, reference_speed); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_CRC); -#else - mavlink_serial_udb_extra_f18_t *packet = (mavlink_serial_udb_extra_f18_t *)msgbuf; - packet->angle_of_attack_normal = angle_of_attack_normal; - packet->angle_of_attack_inverted = angle_of_attack_inverted; - packet->elevator_trim_normal = elevator_trim_normal; - packet->elevator_trim_inverted = elevator_trim_inverted; - packet->reference_speed = reference_speed; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18, (const char *)packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_CRC); -#endif -} -#endif - -#endif - -// MESSAGE SERIAL_UDB_EXTRA_F18 UNPACKING - - -/** - * @brief Get field angle_of_attack_normal from serial_udb_extra_f18 message - * - * @return SUE Angle of Attack Normal - */ -static inline float mavlink_msg_serial_udb_extra_f18_get_angle_of_attack_normal(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 0); -} - -/** - * @brief Get field angle_of_attack_inverted from serial_udb_extra_f18 message - * - * @return SUE Angle of Attack Inverted - */ -static inline float mavlink_msg_serial_udb_extra_f18_get_angle_of_attack_inverted(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 4); -} - -/** - * @brief Get field elevator_trim_normal from serial_udb_extra_f18 message - * - * @return SUE Elevator Trim Normal - */ -static inline float mavlink_msg_serial_udb_extra_f18_get_elevator_trim_normal(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field elevator_trim_inverted from serial_udb_extra_f18 message - * - * @return SUE Elevator Trim Inverted - */ -static inline float mavlink_msg_serial_udb_extra_f18_get_elevator_trim_inverted(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Get field reference_speed from serial_udb_extra_f18 message - * - * @return SUE reference_speed - */ -static inline float mavlink_msg_serial_udb_extra_f18_get_reference_speed(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 16); -} - -/** - * @brief Decode a serial_udb_extra_f18 message into a struct - * - * @param msg The message to decode - * @param serial_udb_extra_f18 C-struct to decode the message contents into - */ -static inline void mavlink_msg_serial_udb_extra_f18_decode(const mavlink_message_t* msg, mavlink_serial_udb_extra_f18_t* serial_udb_extra_f18) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - serial_udb_extra_f18->angle_of_attack_normal = mavlink_msg_serial_udb_extra_f18_get_angle_of_attack_normal(msg); - serial_udb_extra_f18->angle_of_attack_inverted = mavlink_msg_serial_udb_extra_f18_get_angle_of_attack_inverted(msg); - serial_udb_extra_f18->elevator_trim_normal = mavlink_msg_serial_udb_extra_f18_get_elevator_trim_normal(msg); - serial_udb_extra_f18->elevator_trim_inverted = mavlink_msg_serial_udb_extra_f18_get_elevator_trim_inverted(msg); - serial_udb_extra_f18->reference_speed = mavlink_msg_serial_udb_extra_f18_get_reference_speed(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_LEN? msg->len : MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_LEN; - memset(serial_udb_extra_f18, 0, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_LEN); - memcpy(serial_udb_extra_f18, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/matrixpilot/mavlink_msg_serial_udb_extra_f19.h b/matrixpilot/mavlink_msg_serial_udb_extra_f19.h deleted file mode 100644 index d27716fab..000000000 --- a/matrixpilot/mavlink_msg_serial_udb_extra_f19.h +++ /dev/null @@ -1,388 +0,0 @@ -#pragma once -// MESSAGE SERIAL_UDB_EXTRA_F19 PACKING - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19 185 - - -typedef struct __mavlink_serial_udb_extra_f19_t { - uint8_t sue_aileron_output_channel; /*< SUE aileron output channel*/ - uint8_t sue_aileron_reversed; /*< SUE aileron reversed*/ - uint8_t sue_elevator_output_channel; /*< SUE elevator output channel*/ - uint8_t sue_elevator_reversed; /*< SUE elevator reversed*/ - uint8_t sue_throttle_output_channel; /*< SUE throttle output channel*/ - uint8_t sue_throttle_reversed; /*< SUE throttle reversed*/ - uint8_t sue_rudder_output_channel; /*< SUE rudder output channel*/ - uint8_t sue_rudder_reversed; /*< SUE rudder reversed*/ -} mavlink_serial_udb_extra_f19_t; - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_LEN 8 -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_MIN_LEN 8 -#define MAVLINK_MSG_ID_185_LEN 8 -#define MAVLINK_MSG_ID_185_MIN_LEN 8 - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_CRC 87 -#define MAVLINK_MSG_ID_185_CRC 87 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F19 { \ - 185, \ - "SERIAL_UDB_EXTRA_F19", \ - 8, \ - { { "sue_aileron_output_channel", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_serial_udb_extra_f19_t, sue_aileron_output_channel) }, \ - { "sue_aileron_reversed", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_serial_udb_extra_f19_t, sue_aileron_reversed) }, \ - { "sue_elevator_output_channel", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_serial_udb_extra_f19_t, sue_elevator_output_channel) }, \ - { "sue_elevator_reversed", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_serial_udb_extra_f19_t, sue_elevator_reversed) }, \ - { "sue_throttle_output_channel", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_serial_udb_extra_f19_t, sue_throttle_output_channel) }, \ - { "sue_throttle_reversed", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_serial_udb_extra_f19_t, sue_throttle_reversed) }, \ - { "sue_rudder_output_channel", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_serial_udb_extra_f19_t, sue_rudder_output_channel) }, \ - { "sue_rudder_reversed", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_serial_udb_extra_f19_t, sue_rudder_reversed) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F19 { \ - "SERIAL_UDB_EXTRA_F19", \ - 8, \ - { { "sue_aileron_output_channel", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_serial_udb_extra_f19_t, sue_aileron_output_channel) }, \ - { "sue_aileron_reversed", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_serial_udb_extra_f19_t, sue_aileron_reversed) }, \ - { "sue_elevator_output_channel", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_serial_udb_extra_f19_t, sue_elevator_output_channel) }, \ - { "sue_elevator_reversed", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_serial_udb_extra_f19_t, sue_elevator_reversed) }, \ - { "sue_throttle_output_channel", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_serial_udb_extra_f19_t, sue_throttle_output_channel) }, \ - { "sue_throttle_reversed", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_serial_udb_extra_f19_t, sue_throttle_reversed) }, \ - { "sue_rudder_output_channel", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_serial_udb_extra_f19_t, sue_rudder_output_channel) }, \ - { "sue_rudder_reversed", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_serial_udb_extra_f19_t, sue_rudder_reversed) }, \ - } \ -} -#endif - -/** - * @brief Pack a serial_udb_extra_f19 message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param sue_aileron_output_channel SUE aileron output channel - * @param sue_aileron_reversed SUE aileron reversed - * @param sue_elevator_output_channel SUE elevator output channel - * @param sue_elevator_reversed SUE elevator reversed - * @param sue_throttle_output_channel SUE throttle output channel - * @param sue_throttle_reversed SUE throttle reversed - * @param sue_rudder_output_channel SUE rudder output channel - * @param sue_rudder_reversed SUE rudder reversed - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f19_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t sue_aileron_output_channel, uint8_t sue_aileron_reversed, uint8_t sue_elevator_output_channel, uint8_t sue_elevator_reversed, uint8_t sue_throttle_output_channel, uint8_t sue_throttle_reversed, uint8_t sue_rudder_output_channel, uint8_t sue_rudder_reversed) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_LEN]; - _mav_put_uint8_t(buf, 0, sue_aileron_output_channel); - _mav_put_uint8_t(buf, 1, sue_aileron_reversed); - _mav_put_uint8_t(buf, 2, sue_elevator_output_channel); - _mav_put_uint8_t(buf, 3, sue_elevator_reversed); - _mav_put_uint8_t(buf, 4, sue_throttle_output_channel); - _mav_put_uint8_t(buf, 5, sue_throttle_reversed); - _mav_put_uint8_t(buf, 6, sue_rudder_output_channel); - _mav_put_uint8_t(buf, 7, sue_rudder_reversed); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_LEN); -#else - mavlink_serial_udb_extra_f19_t packet; - packet.sue_aileron_output_channel = sue_aileron_output_channel; - packet.sue_aileron_reversed = sue_aileron_reversed; - packet.sue_elevator_output_channel = sue_elevator_output_channel; - packet.sue_elevator_reversed = sue_elevator_reversed; - packet.sue_throttle_output_channel = sue_throttle_output_channel; - packet.sue_throttle_reversed = sue_throttle_reversed; - packet.sue_rudder_output_channel = sue_rudder_output_channel; - packet.sue_rudder_reversed = sue_rudder_reversed; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_CRC); -} - -/** - * @brief Pack a serial_udb_extra_f19 message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param sue_aileron_output_channel SUE aileron output channel - * @param sue_aileron_reversed SUE aileron reversed - * @param sue_elevator_output_channel SUE elevator output channel - * @param sue_elevator_reversed SUE elevator reversed - * @param sue_throttle_output_channel SUE throttle output channel - * @param sue_throttle_reversed SUE throttle reversed - * @param sue_rudder_output_channel SUE rudder output channel - * @param sue_rudder_reversed SUE rudder reversed - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f19_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t sue_aileron_output_channel,uint8_t sue_aileron_reversed,uint8_t sue_elevator_output_channel,uint8_t sue_elevator_reversed,uint8_t sue_throttle_output_channel,uint8_t sue_throttle_reversed,uint8_t sue_rudder_output_channel,uint8_t sue_rudder_reversed) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_LEN]; - _mav_put_uint8_t(buf, 0, sue_aileron_output_channel); - _mav_put_uint8_t(buf, 1, sue_aileron_reversed); - _mav_put_uint8_t(buf, 2, sue_elevator_output_channel); - _mav_put_uint8_t(buf, 3, sue_elevator_reversed); - _mav_put_uint8_t(buf, 4, sue_throttle_output_channel); - _mav_put_uint8_t(buf, 5, sue_throttle_reversed); - _mav_put_uint8_t(buf, 6, sue_rudder_output_channel); - _mav_put_uint8_t(buf, 7, sue_rudder_reversed); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_LEN); -#else - mavlink_serial_udb_extra_f19_t packet; - packet.sue_aileron_output_channel = sue_aileron_output_channel; - packet.sue_aileron_reversed = sue_aileron_reversed; - packet.sue_elevator_output_channel = sue_elevator_output_channel; - packet.sue_elevator_reversed = sue_elevator_reversed; - packet.sue_throttle_output_channel = sue_throttle_output_channel; - packet.sue_throttle_reversed = sue_throttle_reversed; - packet.sue_rudder_output_channel = sue_rudder_output_channel; - packet.sue_rudder_reversed = sue_rudder_reversed; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_CRC); -} - -/** - * @brief Encode a serial_udb_extra_f19 struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f19 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f19_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_serial_udb_extra_f19_t* serial_udb_extra_f19) -{ - return mavlink_msg_serial_udb_extra_f19_pack(system_id, component_id, msg, serial_udb_extra_f19->sue_aileron_output_channel, serial_udb_extra_f19->sue_aileron_reversed, serial_udb_extra_f19->sue_elevator_output_channel, serial_udb_extra_f19->sue_elevator_reversed, serial_udb_extra_f19->sue_throttle_output_channel, serial_udb_extra_f19->sue_throttle_reversed, serial_udb_extra_f19->sue_rudder_output_channel, serial_udb_extra_f19->sue_rudder_reversed); -} - -/** - * @brief Encode a serial_udb_extra_f19 struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f19 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f19_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_serial_udb_extra_f19_t* serial_udb_extra_f19) -{ - return mavlink_msg_serial_udb_extra_f19_pack_chan(system_id, component_id, chan, msg, serial_udb_extra_f19->sue_aileron_output_channel, serial_udb_extra_f19->sue_aileron_reversed, serial_udb_extra_f19->sue_elevator_output_channel, serial_udb_extra_f19->sue_elevator_reversed, serial_udb_extra_f19->sue_throttle_output_channel, serial_udb_extra_f19->sue_throttle_reversed, serial_udb_extra_f19->sue_rudder_output_channel, serial_udb_extra_f19->sue_rudder_reversed); -} - -/** - * @brief Send a serial_udb_extra_f19 message - * @param chan MAVLink channel to send the message - * - * @param sue_aileron_output_channel SUE aileron output channel - * @param sue_aileron_reversed SUE aileron reversed - * @param sue_elevator_output_channel SUE elevator output channel - * @param sue_elevator_reversed SUE elevator reversed - * @param sue_throttle_output_channel SUE throttle output channel - * @param sue_throttle_reversed SUE throttle reversed - * @param sue_rudder_output_channel SUE rudder output channel - * @param sue_rudder_reversed SUE rudder reversed - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_serial_udb_extra_f19_send(mavlink_channel_t chan, uint8_t sue_aileron_output_channel, uint8_t sue_aileron_reversed, uint8_t sue_elevator_output_channel, uint8_t sue_elevator_reversed, uint8_t sue_throttle_output_channel, uint8_t sue_throttle_reversed, uint8_t sue_rudder_output_channel, uint8_t sue_rudder_reversed) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_LEN]; - _mav_put_uint8_t(buf, 0, sue_aileron_output_channel); - _mav_put_uint8_t(buf, 1, sue_aileron_reversed); - _mav_put_uint8_t(buf, 2, sue_elevator_output_channel); - _mav_put_uint8_t(buf, 3, sue_elevator_reversed); - _mav_put_uint8_t(buf, 4, sue_throttle_output_channel); - _mav_put_uint8_t(buf, 5, sue_throttle_reversed); - _mav_put_uint8_t(buf, 6, sue_rudder_output_channel); - _mav_put_uint8_t(buf, 7, sue_rudder_reversed); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_CRC); -#else - mavlink_serial_udb_extra_f19_t packet; - packet.sue_aileron_output_channel = sue_aileron_output_channel; - packet.sue_aileron_reversed = sue_aileron_reversed; - packet.sue_elevator_output_channel = sue_elevator_output_channel; - packet.sue_elevator_reversed = sue_elevator_reversed; - packet.sue_throttle_output_channel = sue_throttle_output_channel; - packet.sue_throttle_reversed = sue_throttle_reversed; - packet.sue_rudder_output_channel = sue_rudder_output_channel; - packet.sue_rudder_reversed = sue_rudder_reversed; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19, (const char *)&packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_CRC); -#endif -} - -/** - * @brief Send a serial_udb_extra_f19 message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_serial_udb_extra_f19_send_struct(mavlink_channel_t chan, const mavlink_serial_udb_extra_f19_t* serial_udb_extra_f19) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_serial_udb_extra_f19_send(chan, serial_udb_extra_f19->sue_aileron_output_channel, serial_udb_extra_f19->sue_aileron_reversed, serial_udb_extra_f19->sue_elevator_output_channel, serial_udb_extra_f19->sue_elevator_reversed, serial_udb_extra_f19->sue_throttle_output_channel, serial_udb_extra_f19->sue_throttle_reversed, serial_udb_extra_f19->sue_rudder_output_channel, serial_udb_extra_f19->sue_rudder_reversed); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19, (const char *)serial_udb_extra_f19, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_CRC); -#endif -} - -#if MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_serial_udb_extra_f19_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t sue_aileron_output_channel, uint8_t sue_aileron_reversed, uint8_t sue_elevator_output_channel, uint8_t sue_elevator_reversed, uint8_t sue_throttle_output_channel, uint8_t sue_throttle_reversed, uint8_t sue_rudder_output_channel, uint8_t sue_rudder_reversed) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint8_t(buf, 0, sue_aileron_output_channel); - _mav_put_uint8_t(buf, 1, sue_aileron_reversed); - _mav_put_uint8_t(buf, 2, sue_elevator_output_channel); - _mav_put_uint8_t(buf, 3, sue_elevator_reversed); - _mav_put_uint8_t(buf, 4, sue_throttle_output_channel); - _mav_put_uint8_t(buf, 5, sue_throttle_reversed); - _mav_put_uint8_t(buf, 6, sue_rudder_output_channel); - _mav_put_uint8_t(buf, 7, sue_rudder_reversed); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_CRC); -#else - mavlink_serial_udb_extra_f19_t *packet = (mavlink_serial_udb_extra_f19_t *)msgbuf; - packet->sue_aileron_output_channel = sue_aileron_output_channel; - packet->sue_aileron_reversed = sue_aileron_reversed; - packet->sue_elevator_output_channel = sue_elevator_output_channel; - packet->sue_elevator_reversed = sue_elevator_reversed; - packet->sue_throttle_output_channel = sue_throttle_output_channel; - packet->sue_throttle_reversed = sue_throttle_reversed; - packet->sue_rudder_output_channel = sue_rudder_output_channel; - packet->sue_rudder_reversed = sue_rudder_reversed; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19, (const char *)packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_CRC); -#endif -} -#endif - -#endif - -// MESSAGE SERIAL_UDB_EXTRA_F19 UNPACKING - - -/** - * @brief Get field sue_aileron_output_channel from serial_udb_extra_f19 message - * - * @return SUE aileron output channel - */ -static inline uint8_t mavlink_msg_serial_udb_extra_f19_get_sue_aileron_output_channel(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 0); -} - -/** - * @brief Get field sue_aileron_reversed from serial_udb_extra_f19 message - * - * @return SUE aileron reversed - */ -static inline uint8_t mavlink_msg_serial_udb_extra_f19_get_sue_aileron_reversed(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 1); -} - -/** - * @brief Get field sue_elevator_output_channel from serial_udb_extra_f19 message - * - * @return SUE elevator output channel - */ -static inline uint8_t mavlink_msg_serial_udb_extra_f19_get_sue_elevator_output_channel(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 2); -} - -/** - * @brief Get field sue_elevator_reversed from serial_udb_extra_f19 message - * - * @return SUE elevator reversed - */ -static inline uint8_t mavlink_msg_serial_udb_extra_f19_get_sue_elevator_reversed(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 3); -} - -/** - * @brief Get field sue_throttle_output_channel from serial_udb_extra_f19 message - * - * @return SUE throttle output channel - */ -static inline uint8_t mavlink_msg_serial_udb_extra_f19_get_sue_throttle_output_channel(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 4); -} - -/** - * @brief Get field sue_throttle_reversed from serial_udb_extra_f19 message - * - * @return SUE throttle reversed - */ -static inline uint8_t mavlink_msg_serial_udb_extra_f19_get_sue_throttle_reversed(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 5); -} - -/** - * @brief Get field sue_rudder_output_channel from serial_udb_extra_f19 message - * - * @return SUE rudder output channel - */ -static inline uint8_t mavlink_msg_serial_udb_extra_f19_get_sue_rudder_output_channel(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 6); -} - -/** - * @brief Get field sue_rudder_reversed from serial_udb_extra_f19 message - * - * @return SUE rudder reversed - */ -static inline uint8_t mavlink_msg_serial_udb_extra_f19_get_sue_rudder_reversed(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 7); -} - -/** - * @brief Decode a serial_udb_extra_f19 message into a struct - * - * @param msg The message to decode - * @param serial_udb_extra_f19 C-struct to decode the message contents into - */ -static inline void mavlink_msg_serial_udb_extra_f19_decode(const mavlink_message_t* msg, mavlink_serial_udb_extra_f19_t* serial_udb_extra_f19) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - serial_udb_extra_f19->sue_aileron_output_channel = mavlink_msg_serial_udb_extra_f19_get_sue_aileron_output_channel(msg); - serial_udb_extra_f19->sue_aileron_reversed = mavlink_msg_serial_udb_extra_f19_get_sue_aileron_reversed(msg); - serial_udb_extra_f19->sue_elevator_output_channel = mavlink_msg_serial_udb_extra_f19_get_sue_elevator_output_channel(msg); - serial_udb_extra_f19->sue_elevator_reversed = mavlink_msg_serial_udb_extra_f19_get_sue_elevator_reversed(msg); - serial_udb_extra_f19->sue_throttle_output_channel = mavlink_msg_serial_udb_extra_f19_get_sue_throttle_output_channel(msg); - serial_udb_extra_f19->sue_throttle_reversed = mavlink_msg_serial_udb_extra_f19_get_sue_throttle_reversed(msg); - serial_udb_extra_f19->sue_rudder_output_channel = mavlink_msg_serial_udb_extra_f19_get_sue_rudder_output_channel(msg); - serial_udb_extra_f19->sue_rudder_reversed = mavlink_msg_serial_udb_extra_f19_get_sue_rudder_reversed(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_LEN? msg->len : MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_LEN; - memset(serial_udb_extra_f19, 0, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_LEN); - memcpy(serial_udb_extra_f19, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/matrixpilot/mavlink_msg_serial_udb_extra_f20.h b/matrixpilot/mavlink_msg_serial_udb_extra_f20.h deleted file mode 100644 index 33ef20696..000000000 --- a/matrixpilot/mavlink_msg_serial_udb_extra_f20.h +++ /dev/null @@ -1,513 +0,0 @@ -#pragma once -// MESSAGE SERIAL_UDB_EXTRA_F20 PACKING - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20 186 - - -typedef struct __mavlink_serial_udb_extra_f20_t { - int16_t sue_trim_value_input_1; /*< SUE UDB PWM Trim Value on Input 1*/ - int16_t sue_trim_value_input_2; /*< SUE UDB PWM Trim Value on Input 2*/ - int16_t sue_trim_value_input_3; /*< SUE UDB PWM Trim Value on Input 3*/ - int16_t sue_trim_value_input_4; /*< SUE UDB PWM Trim Value on Input 4*/ - int16_t sue_trim_value_input_5; /*< SUE UDB PWM Trim Value on Input 5*/ - int16_t sue_trim_value_input_6; /*< SUE UDB PWM Trim Value on Input 6*/ - int16_t sue_trim_value_input_7; /*< SUE UDB PWM Trim Value on Input 7*/ - int16_t sue_trim_value_input_8; /*< SUE UDB PWM Trim Value on Input 8*/ - int16_t sue_trim_value_input_9; /*< SUE UDB PWM Trim Value on Input 9*/ - int16_t sue_trim_value_input_10; /*< SUE UDB PWM Trim Value on Input 10*/ - int16_t sue_trim_value_input_11; /*< SUE UDB PWM Trim Value on Input 11*/ - int16_t sue_trim_value_input_12; /*< SUE UDB PWM Trim Value on Input 12*/ - uint8_t sue_number_of_inputs; /*< SUE Number of Input Channels*/ -} mavlink_serial_udb_extra_f20_t; - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_LEN 25 -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_MIN_LEN 25 -#define MAVLINK_MSG_ID_186_LEN 25 -#define MAVLINK_MSG_ID_186_MIN_LEN 25 - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_CRC 144 -#define MAVLINK_MSG_ID_186_CRC 144 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F20 { \ - 186, \ - "SERIAL_UDB_EXTRA_F20", \ - 13, \ - { { "sue_number_of_inputs", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_serial_udb_extra_f20_t, sue_number_of_inputs) }, \ - { "sue_trim_value_input_1", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_serial_udb_extra_f20_t, sue_trim_value_input_1) }, \ - { "sue_trim_value_input_2", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_serial_udb_extra_f20_t, sue_trim_value_input_2) }, \ - { "sue_trim_value_input_3", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_serial_udb_extra_f20_t, sue_trim_value_input_3) }, \ - { "sue_trim_value_input_4", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_serial_udb_extra_f20_t, sue_trim_value_input_4) }, \ - { "sue_trim_value_input_5", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_serial_udb_extra_f20_t, sue_trim_value_input_5) }, \ - { "sue_trim_value_input_6", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_serial_udb_extra_f20_t, sue_trim_value_input_6) }, \ - { "sue_trim_value_input_7", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_serial_udb_extra_f20_t, sue_trim_value_input_7) }, \ - { "sue_trim_value_input_8", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_serial_udb_extra_f20_t, sue_trim_value_input_8) }, \ - { "sue_trim_value_input_9", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_serial_udb_extra_f20_t, sue_trim_value_input_9) }, \ - { "sue_trim_value_input_10", NULL, MAVLINK_TYPE_INT16_T, 0, 18, offsetof(mavlink_serial_udb_extra_f20_t, sue_trim_value_input_10) }, \ - { "sue_trim_value_input_11", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_serial_udb_extra_f20_t, sue_trim_value_input_11) }, \ - { "sue_trim_value_input_12", NULL, MAVLINK_TYPE_INT16_T, 0, 22, offsetof(mavlink_serial_udb_extra_f20_t, sue_trim_value_input_12) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F20 { \ - "SERIAL_UDB_EXTRA_F20", \ - 13, \ - { { "sue_number_of_inputs", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_serial_udb_extra_f20_t, sue_number_of_inputs) }, \ - { "sue_trim_value_input_1", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_serial_udb_extra_f20_t, sue_trim_value_input_1) }, \ - { "sue_trim_value_input_2", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_serial_udb_extra_f20_t, sue_trim_value_input_2) }, \ - { "sue_trim_value_input_3", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_serial_udb_extra_f20_t, sue_trim_value_input_3) }, \ - { "sue_trim_value_input_4", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_serial_udb_extra_f20_t, sue_trim_value_input_4) }, \ - { "sue_trim_value_input_5", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_serial_udb_extra_f20_t, sue_trim_value_input_5) }, \ - { "sue_trim_value_input_6", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_serial_udb_extra_f20_t, sue_trim_value_input_6) }, \ - { "sue_trim_value_input_7", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_serial_udb_extra_f20_t, sue_trim_value_input_7) }, \ - { "sue_trim_value_input_8", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_serial_udb_extra_f20_t, sue_trim_value_input_8) }, \ - { "sue_trim_value_input_9", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_serial_udb_extra_f20_t, sue_trim_value_input_9) }, \ - { "sue_trim_value_input_10", NULL, MAVLINK_TYPE_INT16_T, 0, 18, offsetof(mavlink_serial_udb_extra_f20_t, sue_trim_value_input_10) }, \ - { "sue_trim_value_input_11", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_serial_udb_extra_f20_t, sue_trim_value_input_11) }, \ - { "sue_trim_value_input_12", NULL, MAVLINK_TYPE_INT16_T, 0, 22, offsetof(mavlink_serial_udb_extra_f20_t, sue_trim_value_input_12) }, \ - } \ -} -#endif - -/** - * @brief Pack a serial_udb_extra_f20 message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param sue_number_of_inputs SUE Number of Input Channels - * @param sue_trim_value_input_1 SUE UDB PWM Trim Value on Input 1 - * @param sue_trim_value_input_2 SUE UDB PWM Trim Value on Input 2 - * @param sue_trim_value_input_3 SUE UDB PWM Trim Value on Input 3 - * @param sue_trim_value_input_4 SUE UDB PWM Trim Value on Input 4 - * @param sue_trim_value_input_5 SUE UDB PWM Trim Value on Input 5 - * @param sue_trim_value_input_6 SUE UDB PWM Trim Value on Input 6 - * @param sue_trim_value_input_7 SUE UDB PWM Trim Value on Input 7 - * @param sue_trim_value_input_8 SUE UDB PWM Trim Value on Input 8 - * @param sue_trim_value_input_9 SUE UDB PWM Trim Value on Input 9 - * @param sue_trim_value_input_10 SUE UDB PWM Trim Value on Input 10 - * @param sue_trim_value_input_11 SUE UDB PWM Trim Value on Input 11 - * @param sue_trim_value_input_12 SUE UDB PWM Trim Value on Input 12 - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f20_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t sue_number_of_inputs, int16_t sue_trim_value_input_1, int16_t sue_trim_value_input_2, int16_t sue_trim_value_input_3, int16_t sue_trim_value_input_4, int16_t sue_trim_value_input_5, int16_t sue_trim_value_input_6, int16_t sue_trim_value_input_7, int16_t sue_trim_value_input_8, int16_t sue_trim_value_input_9, int16_t sue_trim_value_input_10, int16_t sue_trim_value_input_11, int16_t sue_trim_value_input_12) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_LEN]; - _mav_put_int16_t(buf, 0, sue_trim_value_input_1); - _mav_put_int16_t(buf, 2, sue_trim_value_input_2); - _mav_put_int16_t(buf, 4, sue_trim_value_input_3); - _mav_put_int16_t(buf, 6, sue_trim_value_input_4); - _mav_put_int16_t(buf, 8, sue_trim_value_input_5); - _mav_put_int16_t(buf, 10, sue_trim_value_input_6); - _mav_put_int16_t(buf, 12, sue_trim_value_input_7); - _mav_put_int16_t(buf, 14, sue_trim_value_input_8); - _mav_put_int16_t(buf, 16, sue_trim_value_input_9); - _mav_put_int16_t(buf, 18, sue_trim_value_input_10); - _mav_put_int16_t(buf, 20, sue_trim_value_input_11); - _mav_put_int16_t(buf, 22, sue_trim_value_input_12); - _mav_put_uint8_t(buf, 24, sue_number_of_inputs); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_LEN); -#else - mavlink_serial_udb_extra_f20_t packet; - packet.sue_trim_value_input_1 = sue_trim_value_input_1; - packet.sue_trim_value_input_2 = sue_trim_value_input_2; - packet.sue_trim_value_input_3 = sue_trim_value_input_3; - packet.sue_trim_value_input_4 = sue_trim_value_input_4; - packet.sue_trim_value_input_5 = sue_trim_value_input_5; - packet.sue_trim_value_input_6 = sue_trim_value_input_6; - packet.sue_trim_value_input_7 = sue_trim_value_input_7; - packet.sue_trim_value_input_8 = sue_trim_value_input_8; - packet.sue_trim_value_input_9 = sue_trim_value_input_9; - packet.sue_trim_value_input_10 = sue_trim_value_input_10; - packet.sue_trim_value_input_11 = sue_trim_value_input_11; - packet.sue_trim_value_input_12 = sue_trim_value_input_12; - packet.sue_number_of_inputs = sue_number_of_inputs; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_CRC); -} - -/** - * @brief Pack a serial_udb_extra_f20 message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param sue_number_of_inputs SUE Number of Input Channels - * @param sue_trim_value_input_1 SUE UDB PWM Trim Value on Input 1 - * @param sue_trim_value_input_2 SUE UDB PWM Trim Value on Input 2 - * @param sue_trim_value_input_3 SUE UDB PWM Trim Value on Input 3 - * @param sue_trim_value_input_4 SUE UDB PWM Trim Value on Input 4 - * @param sue_trim_value_input_5 SUE UDB PWM Trim Value on Input 5 - * @param sue_trim_value_input_6 SUE UDB PWM Trim Value on Input 6 - * @param sue_trim_value_input_7 SUE UDB PWM Trim Value on Input 7 - * @param sue_trim_value_input_8 SUE UDB PWM Trim Value on Input 8 - * @param sue_trim_value_input_9 SUE UDB PWM Trim Value on Input 9 - * @param sue_trim_value_input_10 SUE UDB PWM Trim Value on Input 10 - * @param sue_trim_value_input_11 SUE UDB PWM Trim Value on Input 11 - * @param sue_trim_value_input_12 SUE UDB PWM Trim Value on Input 12 - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f20_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t sue_number_of_inputs,int16_t sue_trim_value_input_1,int16_t sue_trim_value_input_2,int16_t sue_trim_value_input_3,int16_t sue_trim_value_input_4,int16_t sue_trim_value_input_5,int16_t sue_trim_value_input_6,int16_t sue_trim_value_input_7,int16_t sue_trim_value_input_8,int16_t sue_trim_value_input_9,int16_t sue_trim_value_input_10,int16_t sue_trim_value_input_11,int16_t sue_trim_value_input_12) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_LEN]; - _mav_put_int16_t(buf, 0, sue_trim_value_input_1); - _mav_put_int16_t(buf, 2, sue_trim_value_input_2); - _mav_put_int16_t(buf, 4, sue_trim_value_input_3); - _mav_put_int16_t(buf, 6, sue_trim_value_input_4); - _mav_put_int16_t(buf, 8, sue_trim_value_input_5); - _mav_put_int16_t(buf, 10, sue_trim_value_input_6); - _mav_put_int16_t(buf, 12, sue_trim_value_input_7); - _mav_put_int16_t(buf, 14, sue_trim_value_input_8); - _mav_put_int16_t(buf, 16, sue_trim_value_input_9); - _mav_put_int16_t(buf, 18, sue_trim_value_input_10); - _mav_put_int16_t(buf, 20, sue_trim_value_input_11); - _mav_put_int16_t(buf, 22, sue_trim_value_input_12); - _mav_put_uint8_t(buf, 24, sue_number_of_inputs); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_LEN); -#else - mavlink_serial_udb_extra_f20_t packet; - packet.sue_trim_value_input_1 = sue_trim_value_input_1; - packet.sue_trim_value_input_2 = sue_trim_value_input_2; - packet.sue_trim_value_input_3 = sue_trim_value_input_3; - packet.sue_trim_value_input_4 = sue_trim_value_input_4; - packet.sue_trim_value_input_5 = sue_trim_value_input_5; - packet.sue_trim_value_input_6 = sue_trim_value_input_6; - packet.sue_trim_value_input_7 = sue_trim_value_input_7; - packet.sue_trim_value_input_8 = sue_trim_value_input_8; - packet.sue_trim_value_input_9 = sue_trim_value_input_9; - packet.sue_trim_value_input_10 = sue_trim_value_input_10; - packet.sue_trim_value_input_11 = sue_trim_value_input_11; - packet.sue_trim_value_input_12 = sue_trim_value_input_12; - packet.sue_number_of_inputs = sue_number_of_inputs; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_CRC); -} - -/** - * @brief Encode a serial_udb_extra_f20 struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f20 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f20_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_serial_udb_extra_f20_t* serial_udb_extra_f20) -{ - return mavlink_msg_serial_udb_extra_f20_pack(system_id, component_id, msg, serial_udb_extra_f20->sue_number_of_inputs, serial_udb_extra_f20->sue_trim_value_input_1, serial_udb_extra_f20->sue_trim_value_input_2, serial_udb_extra_f20->sue_trim_value_input_3, serial_udb_extra_f20->sue_trim_value_input_4, serial_udb_extra_f20->sue_trim_value_input_5, serial_udb_extra_f20->sue_trim_value_input_6, serial_udb_extra_f20->sue_trim_value_input_7, serial_udb_extra_f20->sue_trim_value_input_8, serial_udb_extra_f20->sue_trim_value_input_9, serial_udb_extra_f20->sue_trim_value_input_10, serial_udb_extra_f20->sue_trim_value_input_11, serial_udb_extra_f20->sue_trim_value_input_12); -} - -/** - * @brief Encode a serial_udb_extra_f20 struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f20 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f20_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_serial_udb_extra_f20_t* serial_udb_extra_f20) -{ - return mavlink_msg_serial_udb_extra_f20_pack_chan(system_id, component_id, chan, msg, serial_udb_extra_f20->sue_number_of_inputs, serial_udb_extra_f20->sue_trim_value_input_1, serial_udb_extra_f20->sue_trim_value_input_2, serial_udb_extra_f20->sue_trim_value_input_3, serial_udb_extra_f20->sue_trim_value_input_4, serial_udb_extra_f20->sue_trim_value_input_5, serial_udb_extra_f20->sue_trim_value_input_6, serial_udb_extra_f20->sue_trim_value_input_7, serial_udb_extra_f20->sue_trim_value_input_8, serial_udb_extra_f20->sue_trim_value_input_9, serial_udb_extra_f20->sue_trim_value_input_10, serial_udb_extra_f20->sue_trim_value_input_11, serial_udb_extra_f20->sue_trim_value_input_12); -} - -/** - * @brief Send a serial_udb_extra_f20 message - * @param chan MAVLink channel to send the message - * - * @param sue_number_of_inputs SUE Number of Input Channels - * @param sue_trim_value_input_1 SUE UDB PWM Trim Value on Input 1 - * @param sue_trim_value_input_2 SUE UDB PWM Trim Value on Input 2 - * @param sue_trim_value_input_3 SUE UDB PWM Trim Value on Input 3 - * @param sue_trim_value_input_4 SUE UDB PWM Trim Value on Input 4 - * @param sue_trim_value_input_5 SUE UDB PWM Trim Value on Input 5 - * @param sue_trim_value_input_6 SUE UDB PWM Trim Value on Input 6 - * @param sue_trim_value_input_7 SUE UDB PWM Trim Value on Input 7 - * @param sue_trim_value_input_8 SUE UDB PWM Trim Value on Input 8 - * @param sue_trim_value_input_9 SUE UDB PWM Trim Value on Input 9 - * @param sue_trim_value_input_10 SUE UDB PWM Trim Value on Input 10 - * @param sue_trim_value_input_11 SUE UDB PWM Trim Value on Input 11 - * @param sue_trim_value_input_12 SUE UDB PWM Trim Value on Input 12 - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_serial_udb_extra_f20_send(mavlink_channel_t chan, uint8_t sue_number_of_inputs, int16_t sue_trim_value_input_1, int16_t sue_trim_value_input_2, int16_t sue_trim_value_input_3, int16_t sue_trim_value_input_4, int16_t sue_trim_value_input_5, int16_t sue_trim_value_input_6, int16_t sue_trim_value_input_7, int16_t sue_trim_value_input_8, int16_t sue_trim_value_input_9, int16_t sue_trim_value_input_10, int16_t sue_trim_value_input_11, int16_t sue_trim_value_input_12) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_LEN]; - _mav_put_int16_t(buf, 0, sue_trim_value_input_1); - _mav_put_int16_t(buf, 2, sue_trim_value_input_2); - _mav_put_int16_t(buf, 4, sue_trim_value_input_3); - _mav_put_int16_t(buf, 6, sue_trim_value_input_4); - _mav_put_int16_t(buf, 8, sue_trim_value_input_5); - _mav_put_int16_t(buf, 10, sue_trim_value_input_6); - _mav_put_int16_t(buf, 12, sue_trim_value_input_7); - _mav_put_int16_t(buf, 14, sue_trim_value_input_8); - _mav_put_int16_t(buf, 16, sue_trim_value_input_9); - _mav_put_int16_t(buf, 18, sue_trim_value_input_10); - _mav_put_int16_t(buf, 20, sue_trim_value_input_11); - _mav_put_int16_t(buf, 22, sue_trim_value_input_12); - _mav_put_uint8_t(buf, 24, sue_number_of_inputs); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_CRC); -#else - mavlink_serial_udb_extra_f20_t packet; - packet.sue_trim_value_input_1 = sue_trim_value_input_1; - packet.sue_trim_value_input_2 = sue_trim_value_input_2; - packet.sue_trim_value_input_3 = sue_trim_value_input_3; - packet.sue_trim_value_input_4 = sue_trim_value_input_4; - packet.sue_trim_value_input_5 = sue_trim_value_input_5; - packet.sue_trim_value_input_6 = sue_trim_value_input_6; - packet.sue_trim_value_input_7 = sue_trim_value_input_7; - packet.sue_trim_value_input_8 = sue_trim_value_input_8; - packet.sue_trim_value_input_9 = sue_trim_value_input_9; - packet.sue_trim_value_input_10 = sue_trim_value_input_10; - packet.sue_trim_value_input_11 = sue_trim_value_input_11; - packet.sue_trim_value_input_12 = sue_trim_value_input_12; - packet.sue_number_of_inputs = sue_number_of_inputs; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20, (const char *)&packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_CRC); -#endif -} - -/** - * @brief Send a serial_udb_extra_f20 message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_serial_udb_extra_f20_send_struct(mavlink_channel_t chan, const mavlink_serial_udb_extra_f20_t* serial_udb_extra_f20) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_serial_udb_extra_f20_send(chan, serial_udb_extra_f20->sue_number_of_inputs, serial_udb_extra_f20->sue_trim_value_input_1, serial_udb_extra_f20->sue_trim_value_input_2, serial_udb_extra_f20->sue_trim_value_input_3, serial_udb_extra_f20->sue_trim_value_input_4, serial_udb_extra_f20->sue_trim_value_input_5, serial_udb_extra_f20->sue_trim_value_input_6, serial_udb_extra_f20->sue_trim_value_input_7, serial_udb_extra_f20->sue_trim_value_input_8, serial_udb_extra_f20->sue_trim_value_input_9, serial_udb_extra_f20->sue_trim_value_input_10, serial_udb_extra_f20->sue_trim_value_input_11, serial_udb_extra_f20->sue_trim_value_input_12); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20, (const char *)serial_udb_extra_f20, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_CRC); -#endif -} - -#if MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_serial_udb_extra_f20_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t sue_number_of_inputs, int16_t sue_trim_value_input_1, int16_t sue_trim_value_input_2, int16_t sue_trim_value_input_3, int16_t sue_trim_value_input_4, int16_t sue_trim_value_input_5, int16_t sue_trim_value_input_6, int16_t sue_trim_value_input_7, int16_t sue_trim_value_input_8, int16_t sue_trim_value_input_9, int16_t sue_trim_value_input_10, int16_t sue_trim_value_input_11, int16_t sue_trim_value_input_12) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_int16_t(buf, 0, sue_trim_value_input_1); - _mav_put_int16_t(buf, 2, sue_trim_value_input_2); - _mav_put_int16_t(buf, 4, sue_trim_value_input_3); - _mav_put_int16_t(buf, 6, sue_trim_value_input_4); - _mav_put_int16_t(buf, 8, sue_trim_value_input_5); - _mav_put_int16_t(buf, 10, sue_trim_value_input_6); - _mav_put_int16_t(buf, 12, sue_trim_value_input_7); - _mav_put_int16_t(buf, 14, sue_trim_value_input_8); - _mav_put_int16_t(buf, 16, sue_trim_value_input_9); - _mav_put_int16_t(buf, 18, sue_trim_value_input_10); - _mav_put_int16_t(buf, 20, sue_trim_value_input_11); - _mav_put_int16_t(buf, 22, sue_trim_value_input_12); - _mav_put_uint8_t(buf, 24, sue_number_of_inputs); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_CRC); -#else - mavlink_serial_udb_extra_f20_t *packet = (mavlink_serial_udb_extra_f20_t *)msgbuf; - packet->sue_trim_value_input_1 = sue_trim_value_input_1; - packet->sue_trim_value_input_2 = sue_trim_value_input_2; - packet->sue_trim_value_input_3 = sue_trim_value_input_3; - packet->sue_trim_value_input_4 = sue_trim_value_input_4; - packet->sue_trim_value_input_5 = sue_trim_value_input_5; - packet->sue_trim_value_input_6 = sue_trim_value_input_6; - packet->sue_trim_value_input_7 = sue_trim_value_input_7; - packet->sue_trim_value_input_8 = sue_trim_value_input_8; - packet->sue_trim_value_input_9 = sue_trim_value_input_9; - packet->sue_trim_value_input_10 = sue_trim_value_input_10; - packet->sue_trim_value_input_11 = sue_trim_value_input_11; - packet->sue_trim_value_input_12 = sue_trim_value_input_12; - packet->sue_number_of_inputs = sue_number_of_inputs; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20, (const char *)packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_CRC); -#endif -} -#endif - -#endif - -// MESSAGE SERIAL_UDB_EXTRA_F20 UNPACKING - - -/** - * @brief Get field sue_number_of_inputs from serial_udb_extra_f20 message - * - * @return SUE Number of Input Channels - */ -static inline uint8_t mavlink_msg_serial_udb_extra_f20_get_sue_number_of_inputs(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 24); -} - -/** - * @brief Get field sue_trim_value_input_1 from serial_udb_extra_f20 message - * - * @return SUE UDB PWM Trim Value on Input 1 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f20_get_sue_trim_value_input_1(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 0); -} - -/** - * @brief Get field sue_trim_value_input_2 from serial_udb_extra_f20 message - * - * @return SUE UDB PWM Trim Value on Input 2 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f20_get_sue_trim_value_input_2(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 2); -} - -/** - * @brief Get field sue_trim_value_input_3 from serial_udb_extra_f20 message - * - * @return SUE UDB PWM Trim Value on Input 3 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f20_get_sue_trim_value_input_3(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 4); -} - -/** - * @brief Get field sue_trim_value_input_4 from serial_udb_extra_f20 message - * - * @return SUE UDB PWM Trim Value on Input 4 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f20_get_sue_trim_value_input_4(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 6); -} - -/** - * @brief Get field sue_trim_value_input_5 from serial_udb_extra_f20 message - * - * @return SUE UDB PWM Trim Value on Input 5 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f20_get_sue_trim_value_input_5(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 8); -} - -/** - * @brief Get field sue_trim_value_input_6 from serial_udb_extra_f20 message - * - * @return SUE UDB PWM Trim Value on Input 6 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f20_get_sue_trim_value_input_6(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 10); -} - -/** - * @brief Get field sue_trim_value_input_7 from serial_udb_extra_f20 message - * - * @return SUE UDB PWM Trim Value on Input 7 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f20_get_sue_trim_value_input_7(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 12); -} - -/** - * @brief Get field sue_trim_value_input_8 from serial_udb_extra_f20 message - * - * @return SUE UDB PWM Trim Value on Input 8 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f20_get_sue_trim_value_input_8(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 14); -} - -/** - * @brief Get field sue_trim_value_input_9 from serial_udb_extra_f20 message - * - * @return SUE UDB PWM Trim Value on Input 9 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f20_get_sue_trim_value_input_9(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 16); -} - -/** - * @brief Get field sue_trim_value_input_10 from serial_udb_extra_f20 message - * - * @return SUE UDB PWM Trim Value on Input 10 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f20_get_sue_trim_value_input_10(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 18); -} - -/** - * @brief Get field sue_trim_value_input_11 from serial_udb_extra_f20 message - * - * @return SUE UDB PWM Trim Value on Input 11 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f20_get_sue_trim_value_input_11(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 20); -} - -/** - * @brief Get field sue_trim_value_input_12 from serial_udb_extra_f20 message - * - * @return SUE UDB PWM Trim Value on Input 12 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f20_get_sue_trim_value_input_12(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 22); -} - -/** - * @brief Decode a serial_udb_extra_f20 message into a struct - * - * @param msg The message to decode - * @param serial_udb_extra_f20 C-struct to decode the message contents into - */ -static inline void mavlink_msg_serial_udb_extra_f20_decode(const mavlink_message_t* msg, mavlink_serial_udb_extra_f20_t* serial_udb_extra_f20) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - serial_udb_extra_f20->sue_trim_value_input_1 = mavlink_msg_serial_udb_extra_f20_get_sue_trim_value_input_1(msg); - serial_udb_extra_f20->sue_trim_value_input_2 = mavlink_msg_serial_udb_extra_f20_get_sue_trim_value_input_2(msg); - serial_udb_extra_f20->sue_trim_value_input_3 = mavlink_msg_serial_udb_extra_f20_get_sue_trim_value_input_3(msg); - serial_udb_extra_f20->sue_trim_value_input_4 = mavlink_msg_serial_udb_extra_f20_get_sue_trim_value_input_4(msg); - serial_udb_extra_f20->sue_trim_value_input_5 = mavlink_msg_serial_udb_extra_f20_get_sue_trim_value_input_5(msg); - serial_udb_extra_f20->sue_trim_value_input_6 = mavlink_msg_serial_udb_extra_f20_get_sue_trim_value_input_6(msg); - serial_udb_extra_f20->sue_trim_value_input_7 = mavlink_msg_serial_udb_extra_f20_get_sue_trim_value_input_7(msg); - serial_udb_extra_f20->sue_trim_value_input_8 = mavlink_msg_serial_udb_extra_f20_get_sue_trim_value_input_8(msg); - serial_udb_extra_f20->sue_trim_value_input_9 = mavlink_msg_serial_udb_extra_f20_get_sue_trim_value_input_9(msg); - serial_udb_extra_f20->sue_trim_value_input_10 = mavlink_msg_serial_udb_extra_f20_get_sue_trim_value_input_10(msg); - serial_udb_extra_f20->sue_trim_value_input_11 = mavlink_msg_serial_udb_extra_f20_get_sue_trim_value_input_11(msg); - serial_udb_extra_f20->sue_trim_value_input_12 = mavlink_msg_serial_udb_extra_f20_get_sue_trim_value_input_12(msg); - serial_udb_extra_f20->sue_number_of_inputs = mavlink_msg_serial_udb_extra_f20_get_sue_number_of_inputs(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_LEN? msg->len : MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_LEN; - memset(serial_udb_extra_f20, 0, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_LEN); - memcpy(serial_udb_extra_f20, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/matrixpilot/mavlink_msg_serial_udb_extra_f21.h b/matrixpilot/mavlink_msg_serial_udb_extra_f21.h deleted file mode 100644 index 6a0325ffa..000000000 --- a/matrixpilot/mavlink_msg_serial_udb_extra_f21.h +++ /dev/null @@ -1,338 +0,0 @@ -#pragma once -// MESSAGE SERIAL_UDB_EXTRA_F21 PACKING - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21 187 - - -typedef struct __mavlink_serial_udb_extra_f21_t { - int16_t sue_accel_x_offset; /*< SUE X accelerometer offset*/ - int16_t sue_accel_y_offset; /*< SUE Y accelerometer offset*/ - int16_t sue_accel_z_offset; /*< SUE Z accelerometer offset*/ - int16_t sue_gyro_x_offset; /*< SUE X gyro offset*/ - int16_t sue_gyro_y_offset; /*< SUE Y gyro offset*/ - int16_t sue_gyro_z_offset; /*< SUE Z gyro offset*/ -} mavlink_serial_udb_extra_f21_t; - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_LEN 12 -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_MIN_LEN 12 -#define MAVLINK_MSG_ID_187_LEN 12 -#define MAVLINK_MSG_ID_187_MIN_LEN 12 - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_CRC 134 -#define MAVLINK_MSG_ID_187_CRC 134 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F21 { \ - 187, \ - "SERIAL_UDB_EXTRA_F21", \ - 6, \ - { { "sue_accel_x_offset", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_serial_udb_extra_f21_t, sue_accel_x_offset) }, \ - { "sue_accel_y_offset", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_serial_udb_extra_f21_t, sue_accel_y_offset) }, \ - { "sue_accel_z_offset", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_serial_udb_extra_f21_t, sue_accel_z_offset) }, \ - { "sue_gyro_x_offset", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_serial_udb_extra_f21_t, sue_gyro_x_offset) }, \ - { "sue_gyro_y_offset", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_serial_udb_extra_f21_t, sue_gyro_y_offset) }, \ - { "sue_gyro_z_offset", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_serial_udb_extra_f21_t, sue_gyro_z_offset) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F21 { \ - "SERIAL_UDB_EXTRA_F21", \ - 6, \ - { { "sue_accel_x_offset", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_serial_udb_extra_f21_t, sue_accel_x_offset) }, \ - { "sue_accel_y_offset", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_serial_udb_extra_f21_t, sue_accel_y_offset) }, \ - { "sue_accel_z_offset", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_serial_udb_extra_f21_t, sue_accel_z_offset) }, \ - { "sue_gyro_x_offset", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_serial_udb_extra_f21_t, sue_gyro_x_offset) }, \ - { "sue_gyro_y_offset", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_serial_udb_extra_f21_t, sue_gyro_y_offset) }, \ - { "sue_gyro_z_offset", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_serial_udb_extra_f21_t, sue_gyro_z_offset) }, \ - } \ -} -#endif - -/** - * @brief Pack a serial_udb_extra_f21 message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param sue_accel_x_offset SUE X accelerometer offset - * @param sue_accel_y_offset SUE Y accelerometer offset - * @param sue_accel_z_offset SUE Z accelerometer offset - * @param sue_gyro_x_offset SUE X gyro offset - * @param sue_gyro_y_offset SUE Y gyro offset - * @param sue_gyro_z_offset SUE Z gyro offset - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f21_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - int16_t sue_accel_x_offset, int16_t sue_accel_y_offset, int16_t sue_accel_z_offset, int16_t sue_gyro_x_offset, int16_t sue_gyro_y_offset, int16_t sue_gyro_z_offset) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_LEN]; - _mav_put_int16_t(buf, 0, sue_accel_x_offset); - _mav_put_int16_t(buf, 2, sue_accel_y_offset); - _mav_put_int16_t(buf, 4, sue_accel_z_offset); - _mav_put_int16_t(buf, 6, sue_gyro_x_offset); - _mav_put_int16_t(buf, 8, sue_gyro_y_offset); - _mav_put_int16_t(buf, 10, sue_gyro_z_offset); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_LEN); -#else - mavlink_serial_udb_extra_f21_t packet; - packet.sue_accel_x_offset = sue_accel_x_offset; - packet.sue_accel_y_offset = sue_accel_y_offset; - packet.sue_accel_z_offset = sue_accel_z_offset; - packet.sue_gyro_x_offset = sue_gyro_x_offset; - packet.sue_gyro_y_offset = sue_gyro_y_offset; - packet.sue_gyro_z_offset = sue_gyro_z_offset; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_CRC); -} - -/** - * @brief Pack a serial_udb_extra_f21 message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param sue_accel_x_offset SUE X accelerometer offset - * @param sue_accel_y_offset SUE Y accelerometer offset - * @param sue_accel_z_offset SUE Z accelerometer offset - * @param sue_gyro_x_offset SUE X gyro offset - * @param sue_gyro_y_offset SUE Y gyro offset - * @param sue_gyro_z_offset SUE Z gyro offset - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f21_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - int16_t sue_accel_x_offset,int16_t sue_accel_y_offset,int16_t sue_accel_z_offset,int16_t sue_gyro_x_offset,int16_t sue_gyro_y_offset,int16_t sue_gyro_z_offset) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_LEN]; - _mav_put_int16_t(buf, 0, sue_accel_x_offset); - _mav_put_int16_t(buf, 2, sue_accel_y_offset); - _mav_put_int16_t(buf, 4, sue_accel_z_offset); - _mav_put_int16_t(buf, 6, sue_gyro_x_offset); - _mav_put_int16_t(buf, 8, sue_gyro_y_offset); - _mav_put_int16_t(buf, 10, sue_gyro_z_offset); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_LEN); -#else - mavlink_serial_udb_extra_f21_t packet; - packet.sue_accel_x_offset = sue_accel_x_offset; - packet.sue_accel_y_offset = sue_accel_y_offset; - packet.sue_accel_z_offset = sue_accel_z_offset; - packet.sue_gyro_x_offset = sue_gyro_x_offset; - packet.sue_gyro_y_offset = sue_gyro_y_offset; - packet.sue_gyro_z_offset = sue_gyro_z_offset; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_CRC); -} - -/** - * @brief Encode a serial_udb_extra_f21 struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f21 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f21_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_serial_udb_extra_f21_t* serial_udb_extra_f21) -{ - return mavlink_msg_serial_udb_extra_f21_pack(system_id, component_id, msg, serial_udb_extra_f21->sue_accel_x_offset, serial_udb_extra_f21->sue_accel_y_offset, serial_udb_extra_f21->sue_accel_z_offset, serial_udb_extra_f21->sue_gyro_x_offset, serial_udb_extra_f21->sue_gyro_y_offset, serial_udb_extra_f21->sue_gyro_z_offset); -} - -/** - * @brief Encode a serial_udb_extra_f21 struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f21 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f21_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_serial_udb_extra_f21_t* serial_udb_extra_f21) -{ - return mavlink_msg_serial_udb_extra_f21_pack_chan(system_id, component_id, chan, msg, serial_udb_extra_f21->sue_accel_x_offset, serial_udb_extra_f21->sue_accel_y_offset, serial_udb_extra_f21->sue_accel_z_offset, serial_udb_extra_f21->sue_gyro_x_offset, serial_udb_extra_f21->sue_gyro_y_offset, serial_udb_extra_f21->sue_gyro_z_offset); -} - -/** - * @brief Send a serial_udb_extra_f21 message - * @param chan MAVLink channel to send the message - * - * @param sue_accel_x_offset SUE X accelerometer offset - * @param sue_accel_y_offset SUE Y accelerometer offset - * @param sue_accel_z_offset SUE Z accelerometer offset - * @param sue_gyro_x_offset SUE X gyro offset - * @param sue_gyro_y_offset SUE Y gyro offset - * @param sue_gyro_z_offset SUE Z gyro offset - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_serial_udb_extra_f21_send(mavlink_channel_t chan, int16_t sue_accel_x_offset, int16_t sue_accel_y_offset, int16_t sue_accel_z_offset, int16_t sue_gyro_x_offset, int16_t sue_gyro_y_offset, int16_t sue_gyro_z_offset) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_LEN]; - _mav_put_int16_t(buf, 0, sue_accel_x_offset); - _mav_put_int16_t(buf, 2, sue_accel_y_offset); - _mav_put_int16_t(buf, 4, sue_accel_z_offset); - _mav_put_int16_t(buf, 6, sue_gyro_x_offset); - _mav_put_int16_t(buf, 8, sue_gyro_y_offset); - _mav_put_int16_t(buf, 10, sue_gyro_z_offset); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_CRC); -#else - mavlink_serial_udb_extra_f21_t packet; - packet.sue_accel_x_offset = sue_accel_x_offset; - packet.sue_accel_y_offset = sue_accel_y_offset; - packet.sue_accel_z_offset = sue_accel_z_offset; - packet.sue_gyro_x_offset = sue_gyro_x_offset; - packet.sue_gyro_y_offset = sue_gyro_y_offset; - packet.sue_gyro_z_offset = sue_gyro_z_offset; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21, (const char *)&packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_CRC); -#endif -} - -/** - * @brief Send a serial_udb_extra_f21 message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_serial_udb_extra_f21_send_struct(mavlink_channel_t chan, const mavlink_serial_udb_extra_f21_t* serial_udb_extra_f21) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_serial_udb_extra_f21_send(chan, serial_udb_extra_f21->sue_accel_x_offset, serial_udb_extra_f21->sue_accel_y_offset, serial_udb_extra_f21->sue_accel_z_offset, serial_udb_extra_f21->sue_gyro_x_offset, serial_udb_extra_f21->sue_gyro_y_offset, serial_udb_extra_f21->sue_gyro_z_offset); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21, (const char *)serial_udb_extra_f21, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_CRC); -#endif -} - -#if MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_serial_udb_extra_f21_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, int16_t sue_accel_x_offset, int16_t sue_accel_y_offset, int16_t sue_accel_z_offset, int16_t sue_gyro_x_offset, int16_t sue_gyro_y_offset, int16_t sue_gyro_z_offset) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_int16_t(buf, 0, sue_accel_x_offset); - _mav_put_int16_t(buf, 2, sue_accel_y_offset); - _mav_put_int16_t(buf, 4, sue_accel_z_offset); - _mav_put_int16_t(buf, 6, sue_gyro_x_offset); - _mav_put_int16_t(buf, 8, sue_gyro_y_offset); - _mav_put_int16_t(buf, 10, sue_gyro_z_offset); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_CRC); -#else - mavlink_serial_udb_extra_f21_t *packet = (mavlink_serial_udb_extra_f21_t *)msgbuf; - packet->sue_accel_x_offset = sue_accel_x_offset; - packet->sue_accel_y_offset = sue_accel_y_offset; - packet->sue_accel_z_offset = sue_accel_z_offset; - packet->sue_gyro_x_offset = sue_gyro_x_offset; - packet->sue_gyro_y_offset = sue_gyro_y_offset; - packet->sue_gyro_z_offset = sue_gyro_z_offset; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21, (const char *)packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_CRC); -#endif -} -#endif - -#endif - -// MESSAGE SERIAL_UDB_EXTRA_F21 UNPACKING - - -/** - * @brief Get field sue_accel_x_offset from serial_udb_extra_f21 message - * - * @return SUE X accelerometer offset - */ -static inline int16_t mavlink_msg_serial_udb_extra_f21_get_sue_accel_x_offset(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 0); -} - -/** - * @brief Get field sue_accel_y_offset from serial_udb_extra_f21 message - * - * @return SUE Y accelerometer offset - */ -static inline int16_t mavlink_msg_serial_udb_extra_f21_get_sue_accel_y_offset(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 2); -} - -/** - * @brief Get field sue_accel_z_offset from serial_udb_extra_f21 message - * - * @return SUE Z accelerometer offset - */ -static inline int16_t mavlink_msg_serial_udb_extra_f21_get_sue_accel_z_offset(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 4); -} - -/** - * @brief Get field sue_gyro_x_offset from serial_udb_extra_f21 message - * - * @return SUE X gyro offset - */ -static inline int16_t mavlink_msg_serial_udb_extra_f21_get_sue_gyro_x_offset(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 6); -} - -/** - * @brief Get field sue_gyro_y_offset from serial_udb_extra_f21 message - * - * @return SUE Y gyro offset - */ -static inline int16_t mavlink_msg_serial_udb_extra_f21_get_sue_gyro_y_offset(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 8); -} - -/** - * @brief Get field sue_gyro_z_offset from serial_udb_extra_f21 message - * - * @return SUE Z gyro offset - */ -static inline int16_t mavlink_msg_serial_udb_extra_f21_get_sue_gyro_z_offset(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 10); -} - -/** - * @brief Decode a serial_udb_extra_f21 message into a struct - * - * @param msg The message to decode - * @param serial_udb_extra_f21 C-struct to decode the message contents into - */ -static inline void mavlink_msg_serial_udb_extra_f21_decode(const mavlink_message_t* msg, mavlink_serial_udb_extra_f21_t* serial_udb_extra_f21) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - serial_udb_extra_f21->sue_accel_x_offset = mavlink_msg_serial_udb_extra_f21_get_sue_accel_x_offset(msg); - serial_udb_extra_f21->sue_accel_y_offset = mavlink_msg_serial_udb_extra_f21_get_sue_accel_y_offset(msg); - serial_udb_extra_f21->sue_accel_z_offset = mavlink_msg_serial_udb_extra_f21_get_sue_accel_z_offset(msg); - serial_udb_extra_f21->sue_gyro_x_offset = mavlink_msg_serial_udb_extra_f21_get_sue_gyro_x_offset(msg); - serial_udb_extra_f21->sue_gyro_y_offset = mavlink_msg_serial_udb_extra_f21_get_sue_gyro_y_offset(msg); - serial_udb_extra_f21->sue_gyro_z_offset = mavlink_msg_serial_udb_extra_f21_get_sue_gyro_z_offset(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_LEN? msg->len : MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_LEN; - memset(serial_udb_extra_f21, 0, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_LEN); - memcpy(serial_udb_extra_f21, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/matrixpilot/mavlink_msg_serial_udb_extra_f22.h b/matrixpilot/mavlink_msg_serial_udb_extra_f22.h deleted file mode 100644 index 2e9e29051..000000000 --- a/matrixpilot/mavlink_msg_serial_udb_extra_f22.h +++ /dev/null @@ -1,338 +0,0 @@ -#pragma once -// MESSAGE SERIAL_UDB_EXTRA_F22 PACKING - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22 188 - - -typedef struct __mavlink_serial_udb_extra_f22_t { - int16_t sue_accel_x_at_calibration; /*< SUE X accelerometer at calibration time*/ - int16_t sue_accel_y_at_calibration; /*< SUE Y accelerometer at calibration time*/ - int16_t sue_accel_z_at_calibration; /*< SUE Z accelerometer at calibration time*/ - int16_t sue_gyro_x_at_calibration; /*< SUE X gyro at calibration time*/ - int16_t sue_gyro_y_at_calibration; /*< SUE Y gyro at calibration time*/ - int16_t sue_gyro_z_at_calibration; /*< SUE Z gyro at calibration time*/ -} mavlink_serial_udb_extra_f22_t; - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_LEN 12 -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_MIN_LEN 12 -#define MAVLINK_MSG_ID_188_LEN 12 -#define MAVLINK_MSG_ID_188_MIN_LEN 12 - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_CRC 91 -#define MAVLINK_MSG_ID_188_CRC 91 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F22 { \ - 188, \ - "SERIAL_UDB_EXTRA_F22", \ - 6, \ - { { "sue_accel_x_at_calibration", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_serial_udb_extra_f22_t, sue_accel_x_at_calibration) }, \ - { "sue_accel_y_at_calibration", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_serial_udb_extra_f22_t, sue_accel_y_at_calibration) }, \ - { "sue_accel_z_at_calibration", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_serial_udb_extra_f22_t, sue_accel_z_at_calibration) }, \ - { "sue_gyro_x_at_calibration", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_serial_udb_extra_f22_t, sue_gyro_x_at_calibration) }, \ - { "sue_gyro_y_at_calibration", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_serial_udb_extra_f22_t, sue_gyro_y_at_calibration) }, \ - { "sue_gyro_z_at_calibration", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_serial_udb_extra_f22_t, sue_gyro_z_at_calibration) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F22 { \ - "SERIAL_UDB_EXTRA_F22", \ - 6, \ - { { "sue_accel_x_at_calibration", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_serial_udb_extra_f22_t, sue_accel_x_at_calibration) }, \ - { "sue_accel_y_at_calibration", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_serial_udb_extra_f22_t, sue_accel_y_at_calibration) }, \ - { "sue_accel_z_at_calibration", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_serial_udb_extra_f22_t, sue_accel_z_at_calibration) }, \ - { "sue_gyro_x_at_calibration", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_serial_udb_extra_f22_t, sue_gyro_x_at_calibration) }, \ - { "sue_gyro_y_at_calibration", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_serial_udb_extra_f22_t, sue_gyro_y_at_calibration) }, \ - { "sue_gyro_z_at_calibration", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_serial_udb_extra_f22_t, sue_gyro_z_at_calibration) }, \ - } \ -} -#endif - -/** - * @brief Pack a serial_udb_extra_f22 message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param sue_accel_x_at_calibration SUE X accelerometer at calibration time - * @param sue_accel_y_at_calibration SUE Y accelerometer at calibration time - * @param sue_accel_z_at_calibration SUE Z accelerometer at calibration time - * @param sue_gyro_x_at_calibration SUE X gyro at calibration time - * @param sue_gyro_y_at_calibration SUE Y gyro at calibration time - * @param sue_gyro_z_at_calibration SUE Z gyro at calibration time - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f22_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - int16_t sue_accel_x_at_calibration, int16_t sue_accel_y_at_calibration, int16_t sue_accel_z_at_calibration, int16_t sue_gyro_x_at_calibration, int16_t sue_gyro_y_at_calibration, int16_t sue_gyro_z_at_calibration) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_LEN]; - _mav_put_int16_t(buf, 0, sue_accel_x_at_calibration); - _mav_put_int16_t(buf, 2, sue_accel_y_at_calibration); - _mav_put_int16_t(buf, 4, sue_accel_z_at_calibration); - _mav_put_int16_t(buf, 6, sue_gyro_x_at_calibration); - _mav_put_int16_t(buf, 8, sue_gyro_y_at_calibration); - _mav_put_int16_t(buf, 10, sue_gyro_z_at_calibration); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_LEN); -#else - mavlink_serial_udb_extra_f22_t packet; - packet.sue_accel_x_at_calibration = sue_accel_x_at_calibration; - packet.sue_accel_y_at_calibration = sue_accel_y_at_calibration; - packet.sue_accel_z_at_calibration = sue_accel_z_at_calibration; - packet.sue_gyro_x_at_calibration = sue_gyro_x_at_calibration; - packet.sue_gyro_y_at_calibration = sue_gyro_y_at_calibration; - packet.sue_gyro_z_at_calibration = sue_gyro_z_at_calibration; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_CRC); -} - -/** - * @brief Pack a serial_udb_extra_f22 message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param sue_accel_x_at_calibration SUE X accelerometer at calibration time - * @param sue_accel_y_at_calibration SUE Y accelerometer at calibration time - * @param sue_accel_z_at_calibration SUE Z accelerometer at calibration time - * @param sue_gyro_x_at_calibration SUE X gyro at calibration time - * @param sue_gyro_y_at_calibration SUE Y gyro at calibration time - * @param sue_gyro_z_at_calibration SUE Z gyro at calibration time - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f22_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - int16_t sue_accel_x_at_calibration,int16_t sue_accel_y_at_calibration,int16_t sue_accel_z_at_calibration,int16_t sue_gyro_x_at_calibration,int16_t sue_gyro_y_at_calibration,int16_t sue_gyro_z_at_calibration) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_LEN]; - _mav_put_int16_t(buf, 0, sue_accel_x_at_calibration); - _mav_put_int16_t(buf, 2, sue_accel_y_at_calibration); - _mav_put_int16_t(buf, 4, sue_accel_z_at_calibration); - _mav_put_int16_t(buf, 6, sue_gyro_x_at_calibration); - _mav_put_int16_t(buf, 8, sue_gyro_y_at_calibration); - _mav_put_int16_t(buf, 10, sue_gyro_z_at_calibration); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_LEN); -#else - mavlink_serial_udb_extra_f22_t packet; - packet.sue_accel_x_at_calibration = sue_accel_x_at_calibration; - packet.sue_accel_y_at_calibration = sue_accel_y_at_calibration; - packet.sue_accel_z_at_calibration = sue_accel_z_at_calibration; - packet.sue_gyro_x_at_calibration = sue_gyro_x_at_calibration; - packet.sue_gyro_y_at_calibration = sue_gyro_y_at_calibration; - packet.sue_gyro_z_at_calibration = sue_gyro_z_at_calibration; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_CRC); -} - -/** - * @brief Encode a serial_udb_extra_f22 struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f22 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f22_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_serial_udb_extra_f22_t* serial_udb_extra_f22) -{ - return mavlink_msg_serial_udb_extra_f22_pack(system_id, component_id, msg, serial_udb_extra_f22->sue_accel_x_at_calibration, serial_udb_extra_f22->sue_accel_y_at_calibration, serial_udb_extra_f22->sue_accel_z_at_calibration, serial_udb_extra_f22->sue_gyro_x_at_calibration, serial_udb_extra_f22->sue_gyro_y_at_calibration, serial_udb_extra_f22->sue_gyro_z_at_calibration); -} - -/** - * @brief Encode a serial_udb_extra_f22 struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f22 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f22_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_serial_udb_extra_f22_t* serial_udb_extra_f22) -{ - return mavlink_msg_serial_udb_extra_f22_pack_chan(system_id, component_id, chan, msg, serial_udb_extra_f22->sue_accel_x_at_calibration, serial_udb_extra_f22->sue_accel_y_at_calibration, serial_udb_extra_f22->sue_accel_z_at_calibration, serial_udb_extra_f22->sue_gyro_x_at_calibration, serial_udb_extra_f22->sue_gyro_y_at_calibration, serial_udb_extra_f22->sue_gyro_z_at_calibration); -} - -/** - * @brief Send a serial_udb_extra_f22 message - * @param chan MAVLink channel to send the message - * - * @param sue_accel_x_at_calibration SUE X accelerometer at calibration time - * @param sue_accel_y_at_calibration SUE Y accelerometer at calibration time - * @param sue_accel_z_at_calibration SUE Z accelerometer at calibration time - * @param sue_gyro_x_at_calibration SUE X gyro at calibration time - * @param sue_gyro_y_at_calibration SUE Y gyro at calibration time - * @param sue_gyro_z_at_calibration SUE Z gyro at calibration time - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_serial_udb_extra_f22_send(mavlink_channel_t chan, int16_t sue_accel_x_at_calibration, int16_t sue_accel_y_at_calibration, int16_t sue_accel_z_at_calibration, int16_t sue_gyro_x_at_calibration, int16_t sue_gyro_y_at_calibration, int16_t sue_gyro_z_at_calibration) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_LEN]; - _mav_put_int16_t(buf, 0, sue_accel_x_at_calibration); - _mav_put_int16_t(buf, 2, sue_accel_y_at_calibration); - _mav_put_int16_t(buf, 4, sue_accel_z_at_calibration); - _mav_put_int16_t(buf, 6, sue_gyro_x_at_calibration); - _mav_put_int16_t(buf, 8, sue_gyro_y_at_calibration); - _mav_put_int16_t(buf, 10, sue_gyro_z_at_calibration); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_CRC); -#else - mavlink_serial_udb_extra_f22_t packet; - packet.sue_accel_x_at_calibration = sue_accel_x_at_calibration; - packet.sue_accel_y_at_calibration = sue_accel_y_at_calibration; - packet.sue_accel_z_at_calibration = sue_accel_z_at_calibration; - packet.sue_gyro_x_at_calibration = sue_gyro_x_at_calibration; - packet.sue_gyro_y_at_calibration = sue_gyro_y_at_calibration; - packet.sue_gyro_z_at_calibration = sue_gyro_z_at_calibration; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22, (const char *)&packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_CRC); -#endif -} - -/** - * @brief Send a serial_udb_extra_f22 message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_serial_udb_extra_f22_send_struct(mavlink_channel_t chan, const mavlink_serial_udb_extra_f22_t* serial_udb_extra_f22) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_serial_udb_extra_f22_send(chan, serial_udb_extra_f22->sue_accel_x_at_calibration, serial_udb_extra_f22->sue_accel_y_at_calibration, serial_udb_extra_f22->sue_accel_z_at_calibration, serial_udb_extra_f22->sue_gyro_x_at_calibration, serial_udb_extra_f22->sue_gyro_y_at_calibration, serial_udb_extra_f22->sue_gyro_z_at_calibration); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22, (const char *)serial_udb_extra_f22, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_CRC); -#endif -} - -#if MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_serial_udb_extra_f22_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, int16_t sue_accel_x_at_calibration, int16_t sue_accel_y_at_calibration, int16_t sue_accel_z_at_calibration, int16_t sue_gyro_x_at_calibration, int16_t sue_gyro_y_at_calibration, int16_t sue_gyro_z_at_calibration) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_int16_t(buf, 0, sue_accel_x_at_calibration); - _mav_put_int16_t(buf, 2, sue_accel_y_at_calibration); - _mav_put_int16_t(buf, 4, sue_accel_z_at_calibration); - _mav_put_int16_t(buf, 6, sue_gyro_x_at_calibration); - _mav_put_int16_t(buf, 8, sue_gyro_y_at_calibration); - _mav_put_int16_t(buf, 10, sue_gyro_z_at_calibration); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_CRC); -#else - mavlink_serial_udb_extra_f22_t *packet = (mavlink_serial_udb_extra_f22_t *)msgbuf; - packet->sue_accel_x_at_calibration = sue_accel_x_at_calibration; - packet->sue_accel_y_at_calibration = sue_accel_y_at_calibration; - packet->sue_accel_z_at_calibration = sue_accel_z_at_calibration; - packet->sue_gyro_x_at_calibration = sue_gyro_x_at_calibration; - packet->sue_gyro_y_at_calibration = sue_gyro_y_at_calibration; - packet->sue_gyro_z_at_calibration = sue_gyro_z_at_calibration; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22, (const char *)packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_CRC); -#endif -} -#endif - -#endif - -// MESSAGE SERIAL_UDB_EXTRA_F22 UNPACKING - - -/** - * @brief Get field sue_accel_x_at_calibration from serial_udb_extra_f22 message - * - * @return SUE X accelerometer at calibration time - */ -static inline int16_t mavlink_msg_serial_udb_extra_f22_get_sue_accel_x_at_calibration(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 0); -} - -/** - * @brief Get field sue_accel_y_at_calibration from serial_udb_extra_f22 message - * - * @return SUE Y accelerometer at calibration time - */ -static inline int16_t mavlink_msg_serial_udb_extra_f22_get_sue_accel_y_at_calibration(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 2); -} - -/** - * @brief Get field sue_accel_z_at_calibration from serial_udb_extra_f22 message - * - * @return SUE Z accelerometer at calibration time - */ -static inline int16_t mavlink_msg_serial_udb_extra_f22_get_sue_accel_z_at_calibration(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 4); -} - -/** - * @brief Get field sue_gyro_x_at_calibration from serial_udb_extra_f22 message - * - * @return SUE X gyro at calibration time - */ -static inline int16_t mavlink_msg_serial_udb_extra_f22_get_sue_gyro_x_at_calibration(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 6); -} - -/** - * @brief Get field sue_gyro_y_at_calibration from serial_udb_extra_f22 message - * - * @return SUE Y gyro at calibration time - */ -static inline int16_t mavlink_msg_serial_udb_extra_f22_get_sue_gyro_y_at_calibration(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 8); -} - -/** - * @brief Get field sue_gyro_z_at_calibration from serial_udb_extra_f22 message - * - * @return SUE Z gyro at calibration time - */ -static inline int16_t mavlink_msg_serial_udb_extra_f22_get_sue_gyro_z_at_calibration(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 10); -} - -/** - * @brief Decode a serial_udb_extra_f22 message into a struct - * - * @param msg The message to decode - * @param serial_udb_extra_f22 C-struct to decode the message contents into - */ -static inline void mavlink_msg_serial_udb_extra_f22_decode(const mavlink_message_t* msg, mavlink_serial_udb_extra_f22_t* serial_udb_extra_f22) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - serial_udb_extra_f22->sue_accel_x_at_calibration = mavlink_msg_serial_udb_extra_f22_get_sue_accel_x_at_calibration(msg); - serial_udb_extra_f22->sue_accel_y_at_calibration = mavlink_msg_serial_udb_extra_f22_get_sue_accel_y_at_calibration(msg); - serial_udb_extra_f22->sue_accel_z_at_calibration = mavlink_msg_serial_udb_extra_f22_get_sue_accel_z_at_calibration(msg); - serial_udb_extra_f22->sue_gyro_x_at_calibration = mavlink_msg_serial_udb_extra_f22_get_sue_gyro_x_at_calibration(msg); - serial_udb_extra_f22->sue_gyro_y_at_calibration = mavlink_msg_serial_udb_extra_f22_get_sue_gyro_y_at_calibration(msg); - serial_udb_extra_f22->sue_gyro_z_at_calibration = mavlink_msg_serial_udb_extra_f22_get_sue_gyro_z_at_calibration(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_LEN? msg->len : MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_LEN; - memset(serial_udb_extra_f22, 0, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_LEN); - memcpy(serial_udb_extra_f22, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/matrixpilot/mavlink_msg_serial_udb_extra_f2_a.h b/matrixpilot/mavlink_msg_serial_udb_extra_f2_a.h deleted file mode 100644 index 27f9b1f9a..000000000 --- a/matrixpilot/mavlink_msg_serial_udb_extra_f2_a.h +++ /dev/null @@ -1,863 +0,0 @@ -#pragma once -// MESSAGE SERIAL_UDB_EXTRA_F2_A PACKING - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A 170 - - -typedef struct __mavlink_serial_udb_extra_f2_a_t { - uint32_t sue_time; /*< Serial UDB Extra Time*/ - int32_t sue_latitude; /*< Serial UDB Extra Latitude*/ - int32_t sue_longitude; /*< Serial UDB Extra Longitude*/ - int32_t sue_altitude; /*< Serial UDB Extra Altitude*/ - uint16_t sue_waypoint_index; /*< Serial UDB Extra Waypoint Index*/ - int16_t sue_rmat0; /*< Serial UDB Extra Rmat 0*/ - int16_t sue_rmat1; /*< Serial UDB Extra Rmat 1*/ - int16_t sue_rmat2; /*< Serial UDB Extra Rmat 2*/ - int16_t sue_rmat3; /*< Serial UDB Extra Rmat 3*/ - int16_t sue_rmat4; /*< Serial UDB Extra Rmat 4*/ - int16_t sue_rmat5; /*< Serial UDB Extra Rmat 5*/ - int16_t sue_rmat6; /*< Serial UDB Extra Rmat 6*/ - int16_t sue_rmat7; /*< Serial UDB Extra Rmat 7*/ - int16_t sue_rmat8; /*< Serial UDB Extra Rmat 8*/ - uint16_t sue_cog; /*< Serial UDB Extra GPS Course Over Ground*/ - int16_t sue_sog; /*< Serial UDB Extra Speed Over Ground*/ - uint16_t sue_cpu_load; /*< Serial UDB Extra CPU Load*/ - uint16_t sue_air_speed_3DIMU; /*< Serial UDB Extra 3D IMU Air Speed*/ - int16_t sue_estimated_wind_0; /*< Serial UDB Extra Estimated Wind 0*/ - int16_t sue_estimated_wind_1; /*< Serial UDB Extra Estimated Wind 1*/ - int16_t sue_estimated_wind_2; /*< Serial UDB Extra Estimated Wind 2*/ - int16_t sue_magFieldEarth0; /*< Serial UDB Extra Magnetic Field Earth 0 */ - int16_t sue_magFieldEarth1; /*< Serial UDB Extra Magnetic Field Earth 1 */ - int16_t sue_magFieldEarth2; /*< Serial UDB Extra Magnetic Field Earth 2 */ - int16_t sue_svs; /*< Serial UDB Extra Number of Sattelites in View*/ - int16_t sue_hdop; /*< Serial UDB Extra GPS Horizontal Dilution of Precision*/ - uint8_t sue_status; /*< Serial UDB Extra Status*/ -} mavlink_serial_udb_extra_f2_a_t; - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_LEN 61 -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_MIN_LEN 61 -#define MAVLINK_MSG_ID_170_LEN 61 -#define MAVLINK_MSG_ID_170_MIN_LEN 61 - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_CRC 103 -#define MAVLINK_MSG_ID_170_CRC 103 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F2_A { \ - 170, \ - "SERIAL_UDB_EXTRA_F2_A", \ - 27, \ - { { "sue_time", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_time) }, \ - { "sue_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 60, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_status) }, \ - { "sue_latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_latitude) }, \ - { "sue_longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_longitude) }, \ - { "sue_altitude", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_altitude) }, \ - { "sue_waypoint_index", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_waypoint_index) }, \ - { "sue_rmat0", NULL, MAVLINK_TYPE_INT16_T, 0, 18, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_rmat0) }, \ - { "sue_rmat1", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_rmat1) }, \ - { "sue_rmat2", NULL, MAVLINK_TYPE_INT16_T, 0, 22, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_rmat2) }, \ - { "sue_rmat3", NULL, MAVLINK_TYPE_INT16_T, 0, 24, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_rmat3) }, \ - { "sue_rmat4", NULL, MAVLINK_TYPE_INT16_T, 0, 26, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_rmat4) }, \ - { "sue_rmat5", NULL, MAVLINK_TYPE_INT16_T, 0, 28, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_rmat5) }, \ - { "sue_rmat6", NULL, MAVLINK_TYPE_INT16_T, 0, 30, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_rmat6) }, \ - { "sue_rmat7", NULL, MAVLINK_TYPE_INT16_T, 0, 32, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_rmat7) }, \ - { "sue_rmat8", NULL, MAVLINK_TYPE_INT16_T, 0, 34, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_rmat8) }, \ - { "sue_cog", NULL, MAVLINK_TYPE_UINT16_T, 0, 36, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_cog) }, \ - { "sue_sog", NULL, MAVLINK_TYPE_INT16_T, 0, 38, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_sog) }, \ - { "sue_cpu_load", NULL, MAVLINK_TYPE_UINT16_T, 0, 40, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_cpu_load) }, \ - { "sue_air_speed_3DIMU", NULL, MAVLINK_TYPE_UINT16_T, 0, 42, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_air_speed_3DIMU) }, \ - { "sue_estimated_wind_0", NULL, MAVLINK_TYPE_INT16_T, 0, 44, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_estimated_wind_0) }, \ - { "sue_estimated_wind_1", NULL, MAVLINK_TYPE_INT16_T, 0, 46, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_estimated_wind_1) }, \ - { "sue_estimated_wind_2", NULL, MAVLINK_TYPE_INT16_T, 0, 48, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_estimated_wind_2) }, \ - { "sue_magFieldEarth0", NULL, MAVLINK_TYPE_INT16_T, 0, 50, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_magFieldEarth0) }, \ - { "sue_magFieldEarth1", NULL, MAVLINK_TYPE_INT16_T, 0, 52, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_magFieldEarth1) }, \ - { "sue_magFieldEarth2", NULL, MAVLINK_TYPE_INT16_T, 0, 54, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_magFieldEarth2) }, \ - { "sue_svs", NULL, MAVLINK_TYPE_INT16_T, 0, 56, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_svs) }, \ - { "sue_hdop", NULL, MAVLINK_TYPE_INT16_T, 0, 58, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_hdop) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F2_A { \ - "SERIAL_UDB_EXTRA_F2_A", \ - 27, \ - { { "sue_time", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_time) }, \ - { "sue_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 60, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_status) }, \ - { "sue_latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_latitude) }, \ - { "sue_longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_longitude) }, \ - { "sue_altitude", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_altitude) }, \ - { "sue_waypoint_index", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_waypoint_index) }, \ - { "sue_rmat0", NULL, MAVLINK_TYPE_INT16_T, 0, 18, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_rmat0) }, \ - { "sue_rmat1", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_rmat1) }, \ - { "sue_rmat2", NULL, MAVLINK_TYPE_INT16_T, 0, 22, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_rmat2) }, \ - { "sue_rmat3", NULL, MAVLINK_TYPE_INT16_T, 0, 24, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_rmat3) }, \ - { "sue_rmat4", NULL, MAVLINK_TYPE_INT16_T, 0, 26, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_rmat4) }, \ - { "sue_rmat5", NULL, MAVLINK_TYPE_INT16_T, 0, 28, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_rmat5) }, \ - { "sue_rmat6", NULL, MAVLINK_TYPE_INT16_T, 0, 30, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_rmat6) }, \ - { "sue_rmat7", NULL, MAVLINK_TYPE_INT16_T, 0, 32, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_rmat7) }, \ - { "sue_rmat8", NULL, MAVLINK_TYPE_INT16_T, 0, 34, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_rmat8) }, \ - { "sue_cog", NULL, MAVLINK_TYPE_UINT16_T, 0, 36, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_cog) }, \ - { "sue_sog", NULL, MAVLINK_TYPE_INT16_T, 0, 38, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_sog) }, \ - { "sue_cpu_load", NULL, MAVLINK_TYPE_UINT16_T, 0, 40, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_cpu_load) }, \ - { "sue_air_speed_3DIMU", NULL, MAVLINK_TYPE_UINT16_T, 0, 42, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_air_speed_3DIMU) }, \ - { "sue_estimated_wind_0", NULL, MAVLINK_TYPE_INT16_T, 0, 44, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_estimated_wind_0) }, \ - { "sue_estimated_wind_1", NULL, MAVLINK_TYPE_INT16_T, 0, 46, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_estimated_wind_1) }, \ - { "sue_estimated_wind_2", NULL, MAVLINK_TYPE_INT16_T, 0, 48, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_estimated_wind_2) }, \ - { "sue_magFieldEarth0", NULL, MAVLINK_TYPE_INT16_T, 0, 50, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_magFieldEarth0) }, \ - { "sue_magFieldEarth1", NULL, MAVLINK_TYPE_INT16_T, 0, 52, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_magFieldEarth1) }, \ - { "sue_magFieldEarth2", NULL, MAVLINK_TYPE_INT16_T, 0, 54, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_magFieldEarth2) }, \ - { "sue_svs", NULL, MAVLINK_TYPE_INT16_T, 0, 56, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_svs) }, \ - { "sue_hdop", NULL, MAVLINK_TYPE_INT16_T, 0, 58, offsetof(mavlink_serial_udb_extra_f2_a_t, sue_hdop) }, \ - } \ -} -#endif - -/** - * @brief Pack a serial_udb_extra_f2_a message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param sue_time Serial UDB Extra Time - * @param sue_status Serial UDB Extra Status - * @param sue_latitude Serial UDB Extra Latitude - * @param sue_longitude Serial UDB Extra Longitude - * @param sue_altitude Serial UDB Extra Altitude - * @param sue_waypoint_index Serial UDB Extra Waypoint Index - * @param sue_rmat0 Serial UDB Extra Rmat 0 - * @param sue_rmat1 Serial UDB Extra Rmat 1 - * @param sue_rmat2 Serial UDB Extra Rmat 2 - * @param sue_rmat3 Serial UDB Extra Rmat 3 - * @param sue_rmat4 Serial UDB Extra Rmat 4 - * @param sue_rmat5 Serial UDB Extra Rmat 5 - * @param sue_rmat6 Serial UDB Extra Rmat 6 - * @param sue_rmat7 Serial UDB Extra Rmat 7 - * @param sue_rmat8 Serial UDB Extra Rmat 8 - * @param sue_cog Serial UDB Extra GPS Course Over Ground - * @param sue_sog Serial UDB Extra Speed Over Ground - * @param sue_cpu_load Serial UDB Extra CPU Load - * @param sue_air_speed_3DIMU Serial UDB Extra 3D IMU Air Speed - * @param sue_estimated_wind_0 Serial UDB Extra Estimated Wind 0 - * @param sue_estimated_wind_1 Serial UDB Extra Estimated Wind 1 - * @param sue_estimated_wind_2 Serial UDB Extra Estimated Wind 2 - * @param sue_magFieldEarth0 Serial UDB Extra Magnetic Field Earth 0 - * @param sue_magFieldEarth1 Serial UDB Extra Magnetic Field Earth 1 - * @param sue_magFieldEarth2 Serial UDB Extra Magnetic Field Earth 2 - * @param sue_svs Serial UDB Extra Number of Sattelites in View - * @param sue_hdop Serial UDB Extra GPS Horizontal Dilution of Precision - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f2_a_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint32_t sue_time, uint8_t sue_status, int32_t sue_latitude, int32_t sue_longitude, int32_t sue_altitude, uint16_t sue_waypoint_index, int16_t sue_rmat0, int16_t sue_rmat1, int16_t sue_rmat2, int16_t sue_rmat3, int16_t sue_rmat4, int16_t sue_rmat5, int16_t sue_rmat6, int16_t sue_rmat7, int16_t sue_rmat8, uint16_t sue_cog, int16_t sue_sog, uint16_t sue_cpu_load, uint16_t sue_air_speed_3DIMU, int16_t sue_estimated_wind_0, int16_t sue_estimated_wind_1, int16_t sue_estimated_wind_2, int16_t sue_magFieldEarth0, int16_t sue_magFieldEarth1, int16_t sue_magFieldEarth2, int16_t sue_svs, int16_t sue_hdop) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_LEN]; - _mav_put_uint32_t(buf, 0, sue_time); - _mav_put_int32_t(buf, 4, sue_latitude); - _mav_put_int32_t(buf, 8, sue_longitude); - _mav_put_int32_t(buf, 12, sue_altitude); - _mav_put_uint16_t(buf, 16, sue_waypoint_index); - _mav_put_int16_t(buf, 18, sue_rmat0); - _mav_put_int16_t(buf, 20, sue_rmat1); - _mav_put_int16_t(buf, 22, sue_rmat2); - _mav_put_int16_t(buf, 24, sue_rmat3); - _mav_put_int16_t(buf, 26, sue_rmat4); - _mav_put_int16_t(buf, 28, sue_rmat5); - _mav_put_int16_t(buf, 30, sue_rmat6); - _mav_put_int16_t(buf, 32, sue_rmat7); - _mav_put_int16_t(buf, 34, sue_rmat8); - _mav_put_uint16_t(buf, 36, sue_cog); - _mav_put_int16_t(buf, 38, sue_sog); - _mav_put_uint16_t(buf, 40, sue_cpu_load); - _mav_put_uint16_t(buf, 42, sue_air_speed_3DIMU); - _mav_put_int16_t(buf, 44, sue_estimated_wind_0); - _mav_put_int16_t(buf, 46, sue_estimated_wind_1); - _mav_put_int16_t(buf, 48, sue_estimated_wind_2); - _mav_put_int16_t(buf, 50, sue_magFieldEarth0); - _mav_put_int16_t(buf, 52, sue_magFieldEarth1); - _mav_put_int16_t(buf, 54, sue_magFieldEarth2); - _mav_put_int16_t(buf, 56, sue_svs); - _mav_put_int16_t(buf, 58, sue_hdop); - _mav_put_uint8_t(buf, 60, sue_status); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_LEN); -#else - mavlink_serial_udb_extra_f2_a_t packet; - packet.sue_time = sue_time; - packet.sue_latitude = sue_latitude; - packet.sue_longitude = sue_longitude; - packet.sue_altitude = sue_altitude; - packet.sue_waypoint_index = sue_waypoint_index; - packet.sue_rmat0 = sue_rmat0; - packet.sue_rmat1 = sue_rmat1; - packet.sue_rmat2 = sue_rmat2; - packet.sue_rmat3 = sue_rmat3; - packet.sue_rmat4 = sue_rmat4; - packet.sue_rmat5 = sue_rmat5; - packet.sue_rmat6 = sue_rmat6; - packet.sue_rmat7 = sue_rmat7; - packet.sue_rmat8 = sue_rmat8; - packet.sue_cog = sue_cog; - packet.sue_sog = sue_sog; - packet.sue_cpu_load = sue_cpu_load; - packet.sue_air_speed_3DIMU = sue_air_speed_3DIMU; - packet.sue_estimated_wind_0 = sue_estimated_wind_0; - packet.sue_estimated_wind_1 = sue_estimated_wind_1; - packet.sue_estimated_wind_2 = sue_estimated_wind_2; - packet.sue_magFieldEarth0 = sue_magFieldEarth0; - packet.sue_magFieldEarth1 = sue_magFieldEarth1; - packet.sue_magFieldEarth2 = sue_magFieldEarth2; - packet.sue_svs = sue_svs; - packet.sue_hdop = sue_hdop; - packet.sue_status = sue_status; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_CRC); -} - -/** - * @brief Pack a serial_udb_extra_f2_a message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param sue_time Serial UDB Extra Time - * @param sue_status Serial UDB Extra Status - * @param sue_latitude Serial UDB Extra Latitude - * @param sue_longitude Serial UDB Extra Longitude - * @param sue_altitude Serial UDB Extra Altitude - * @param sue_waypoint_index Serial UDB Extra Waypoint Index - * @param sue_rmat0 Serial UDB Extra Rmat 0 - * @param sue_rmat1 Serial UDB Extra Rmat 1 - * @param sue_rmat2 Serial UDB Extra Rmat 2 - * @param sue_rmat3 Serial UDB Extra Rmat 3 - * @param sue_rmat4 Serial UDB Extra Rmat 4 - * @param sue_rmat5 Serial UDB Extra Rmat 5 - * @param sue_rmat6 Serial UDB Extra Rmat 6 - * @param sue_rmat7 Serial UDB Extra Rmat 7 - * @param sue_rmat8 Serial UDB Extra Rmat 8 - * @param sue_cog Serial UDB Extra GPS Course Over Ground - * @param sue_sog Serial UDB Extra Speed Over Ground - * @param sue_cpu_load Serial UDB Extra CPU Load - * @param sue_air_speed_3DIMU Serial UDB Extra 3D IMU Air Speed - * @param sue_estimated_wind_0 Serial UDB Extra Estimated Wind 0 - * @param sue_estimated_wind_1 Serial UDB Extra Estimated Wind 1 - * @param sue_estimated_wind_2 Serial UDB Extra Estimated Wind 2 - * @param sue_magFieldEarth0 Serial UDB Extra Magnetic Field Earth 0 - * @param sue_magFieldEarth1 Serial UDB Extra Magnetic Field Earth 1 - * @param sue_magFieldEarth2 Serial UDB Extra Magnetic Field Earth 2 - * @param sue_svs Serial UDB Extra Number of Sattelites in View - * @param sue_hdop Serial UDB Extra GPS Horizontal Dilution of Precision - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f2_a_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint32_t sue_time,uint8_t sue_status,int32_t sue_latitude,int32_t sue_longitude,int32_t sue_altitude,uint16_t sue_waypoint_index,int16_t sue_rmat0,int16_t sue_rmat1,int16_t sue_rmat2,int16_t sue_rmat3,int16_t sue_rmat4,int16_t sue_rmat5,int16_t sue_rmat6,int16_t sue_rmat7,int16_t sue_rmat8,uint16_t sue_cog,int16_t sue_sog,uint16_t sue_cpu_load,uint16_t sue_air_speed_3DIMU,int16_t sue_estimated_wind_0,int16_t sue_estimated_wind_1,int16_t sue_estimated_wind_2,int16_t sue_magFieldEarth0,int16_t sue_magFieldEarth1,int16_t sue_magFieldEarth2,int16_t sue_svs,int16_t sue_hdop) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_LEN]; - _mav_put_uint32_t(buf, 0, sue_time); - _mav_put_int32_t(buf, 4, sue_latitude); - _mav_put_int32_t(buf, 8, sue_longitude); - _mav_put_int32_t(buf, 12, sue_altitude); - _mav_put_uint16_t(buf, 16, sue_waypoint_index); - _mav_put_int16_t(buf, 18, sue_rmat0); - _mav_put_int16_t(buf, 20, sue_rmat1); - _mav_put_int16_t(buf, 22, sue_rmat2); - _mav_put_int16_t(buf, 24, sue_rmat3); - _mav_put_int16_t(buf, 26, sue_rmat4); - _mav_put_int16_t(buf, 28, sue_rmat5); - _mav_put_int16_t(buf, 30, sue_rmat6); - _mav_put_int16_t(buf, 32, sue_rmat7); - _mav_put_int16_t(buf, 34, sue_rmat8); - _mav_put_uint16_t(buf, 36, sue_cog); - _mav_put_int16_t(buf, 38, sue_sog); - _mav_put_uint16_t(buf, 40, sue_cpu_load); - _mav_put_uint16_t(buf, 42, sue_air_speed_3DIMU); - _mav_put_int16_t(buf, 44, sue_estimated_wind_0); - _mav_put_int16_t(buf, 46, sue_estimated_wind_1); - _mav_put_int16_t(buf, 48, sue_estimated_wind_2); - _mav_put_int16_t(buf, 50, sue_magFieldEarth0); - _mav_put_int16_t(buf, 52, sue_magFieldEarth1); - _mav_put_int16_t(buf, 54, sue_magFieldEarth2); - _mav_put_int16_t(buf, 56, sue_svs); - _mav_put_int16_t(buf, 58, sue_hdop); - _mav_put_uint8_t(buf, 60, sue_status); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_LEN); -#else - mavlink_serial_udb_extra_f2_a_t packet; - packet.sue_time = sue_time; - packet.sue_latitude = sue_latitude; - packet.sue_longitude = sue_longitude; - packet.sue_altitude = sue_altitude; - packet.sue_waypoint_index = sue_waypoint_index; - packet.sue_rmat0 = sue_rmat0; - packet.sue_rmat1 = sue_rmat1; - packet.sue_rmat2 = sue_rmat2; - packet.sue_rmat3 = sue_rmat3; - packet.sue_rmat4 = sue_rmat4; - packet.sue_rmat5 = sue_rmat5; - packet.sue_rmat6 = sue_rmat6; - packet.sue_rmat7 = sue_rmat7; - packet.sue_rmat8 = sue_rmat8; - packet.sue_cog = sue_cog; - packet.sue_sog = sue_sog; - packet.sue_cpu_load = sue_cpu_load; - packet.sue_air_speed_3DIMU = sue_air_speed_3DIMU; - packet.sue_estimated_wind_0 = sue_estimated_wind_0; - packet.sue_estimated_wind_1 = sue_estimated_wind_1; - packet.sue_estimated_wind_2 = sue_estimated_wind_2; - packet.sue_magFieldEarth0 = sue_magFieldEarth0; - packet.sue_magFieldEarth1 = sue_magFieldEarth1; - packet.sue_magFieldEarth2 = sue_magFieldEarth2; - packet.sue_svs = sue_svs; - packet.sue_hdop = sue_hdop; - packet.sue_status = sue_status; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_CRC); -} - -/** - * @brief Encode a serial_udb_extra_f2_a struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f2_a C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f2_a_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_serial_udb_extra_f2_a_t* serial_udb_extra_f2_a) -{ - return mavlink_msg_serial_udb_extra_f2_a_pack(system_id, component_id, msg, serial_udb_extra_f2_a->sue_time, serial_udb_extra_f2_a->sue_status, serial_udb_extra_f2_a->sue_latitude, serial_udb_extra_f2_a->sue_longitude, serial_udb_extra_f2_a->sue_altitude, serial_udb_extra_f2_a->sue_waypoint_index, serial_udb_extra_f2_a->sue_rmat0, serial_udb_extra_f2_a->sue_rmat1, serial_udb_extra_f2_a->sue_rmat2, serial_udb_extra_f2_a->sue_rmat3, serial_udb_extra_f2_a->sue_rmat4, serial_udb_extra_f2_a->sue_rmat5, serial_udb_extra_f2_a->sue_rmat6, serial_udb_extra_f2_a->sue_rmat7, serial_udb_extra_f2_a->sue_rmat8, serial_udb_extra_f2_a->sue_cog, serial_udb_extra_f2_a->sue_sog, serial_udb_extra_f2_a->sue_cpu_load, serial_udb_extra_f2_a->sue_air_speed_3DIMU, serial_udb_extra_f2_a->sue_estimated_wind_0, serial_udb_extra_f2_a->sue_estimated_wind_1, serial_udb_extra_f2_a->sue_estimated_wind_2, serial_udb_extra_f2_a->sue_magFieldEarth0, serial_udb_extra_f2_a->sue_magFieldEarth1, serial_udb_extra_f2_a->sue_magFieldEarth2, serial_udb_extra_f2_a->sue_svs, serial_udb_extra_f2_a->sue_hdop); -} - -/** - * @brief Encode a serial_udb_extra_f2_a struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f2_a C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f2_a_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_serial_udb_extra_f2_a_t* serial_udb_extra_f2_a) -{ - return mavlink_msg_serial_udb_extra_f2_a_pack_chan(system_id, component_id, chan, msg, serial_udb_extra_f2_a->sue_time, serial_udb_extra_f2_a->sue_status, serial_udb_extra_f2_a->sue_latitude, serial_udb_extra_f2_a->sue_longitude, serial_udb_extra_f2_a->sue_altitude, serial_udb_extra_f2_a->sue_waypoint_index, serial_udb_extra_f2_a->sue_rmat0, serial_udb_extra_f2_a->sue_rmat1, serial_udb_extra_f2_a->sue_rmat2, serial_udb_extra_f2_a->sue_rmat3, serial_udb_extra_f2_a->sue_rmat4, serial_udb_extra_f2_a->sue_rmat5, serial_udb_extra_f2_a->sue_rmat6, serial_udb_extra_f2_a->sue_rmat7, serial_udb_extra_f2_a->sue_rmat8, serial_udb_extra_f2_a->sue_cog, serial_udb_extra_f2_a->sue_sog, serial_udb_extra_f2_a->sue_cpu_load, serial_udb_extra_f2_a->sue_air_speed_3DIMU, serial_udb_extra_f2_a->sue_estimated_wind_0, serial_udb_extra_f2_a->sue_estimated_wind_1, serial_udb_extra_f2_a->sue_estimated_wind_2, serial_udb_extra_f2_a->sue_magFieldEarth0, serial_udb_extra_f2_a->sue_magFieldEarth1, serial_udb_extra_f2_a->sue_magFieldEarth2, serial_udb_extra_f2_a->sue_svs, serial_udb_extra_f2_a->sue_hdop); -} - -/** - * @brief Send a serial_udb_extra_f2_a message - * @param chan MAVLink channel to send the message - * - * @param sue_time Serial UDB Extra Time - * @param sue_status Serial UDB Extra Status - * @param sue_latitude Serial UDB Extra Latitude - * @param sue_longitude Serial UDB Extra Longitude - * @param sue_altitude Serial UDB Extra Altitude - * @param sue_waypoint_index Serial UDB Extra Waypoint Index - * @param sue_rmat0 Serial UDB Extra Rmat 0 - * @param sue_rmat1 Serial UDB Extra Rmat 1 - * @param sue_rmat2 Serial UDB Extra Rmat 2 - * @param sue_rmat3 Serial UDB Extra Rmat 3 - * @param sue_rmat4 Serial UDB Extra Rmat 4 - * @param sue_rmat5 Serial UDB Extra Rmat 5 - * @param sue_rmat6 Serial UDB Extra Rmat 6 - * @param sue_rmat7 Serial UDB Extra Rmat 7 - * @param sue_rmat8 Serial UDB Extra Rmat 8 - * @param sue_cog Serial UDB Extra GPS Course Over Ground - * @param sue_sog Serial UDB Extra Speed Over Ground - * @param sue_cpu_load Serial UDB Extra CPU Load - * @param sue_air_speed_3DIMU Serial UDB Extra 3D IMU Air Speed - * @param sue_estimated_wind_0 Serial UDB Extra Estimated Wind 0 - * @param sue_estimated_wind_1 Serial UDB Extra Estimated Wind 1 - * @param sue_estimated_wind_2 Serial UDB Extra Estimated Wind 2 - * @param sue_magFieldEarth0 Serial UDB Extra Magnetic Field Earth 0 - * @param sue_magFieldEarth1 Serial UDB Extra Magnetic Field Earth 1 - * @param sue_magFieldEarth2 Serial UDB Extra Magnetic Field Earth 2 - * @param sue_svs Serial UDB Extra Number of Sattelites in View - * @param sue_hdop Serial UDB Extra GPS Horizontal Dilution of Precision - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_serial_udb_extra_f2_a_send(mavlink_channel_t chan, uint32_t sue_time, uint8_t sue_status, int32_t sue_latitude, int32_t sue_longitude, int32_t sue_altitude, uint16_t sue_waypoint_index, int16_t sue_rmat0, int16_t sue_rmat1, int16_t sue_rmat2, int16_t sue_rmat3, int16_t sue_rmat4, int16_t sue_rmat5, int16_t sue_rmat6, int16_t sue_rmat7, int16_t sue_rmat8, uint16_t sue_cog, int16_t sue_sog, uint16_t sue_cpu_load, uint16_t sue_air_speed_3DIMU, int16_t sue_estimated_wind_0, int16_t sue_estimated_wind_1, int16_t sue_estimated_wind_2, int16_t sue_magFieldEarth0, int16_t sue_magFieldEarth1, int16_t sue_magFieldEarth2, int16_t sue_svs, int16_t sue_hdop) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_LEN]; - _mav_put_uint32_t(buf, 0, sue_time); - _mav_put_int32_t(buf, 4, sue_latitude); - _mav_put_int32_t(buf, 8, sue_longitude); - _mav_put_int32_t(buf, 12, sue_altitude); - _mav_put_uint16_t(buf, 16, sue_waypoint_index); - _mav_put_int16_t(buf, 18, sue_rmat0); - _mav_put_int16_t(buf, 20, sue_rmat1); - _mav_put_int16_t(buf, 22, sue_rmat2); - _mav_put_int16_t(buf, 24, sue_rmat3); - _mav_put_int16_t(buf, 26, sue_rmat4); - _mav_put_int16_t(buf, 28, sue_rmat5); - _mav_put_int16_t(buf, 30, sue_rmat6); - _mav_put_int16_t(buf, 32, sue_rmat7); - _mav_put_int16_t(buf, 34, sue_rmat8); - _mav_put_uint16_t(buf, 36, sue_cog); - _mav_put_int16_t(buf, 38, sue_sog); - _mav_put_uint16_t(buf, 40, sue_cpu_load); - _mav_put_uint16_t(buf, 42, sue_air_speed_3DIMU); - _mav_put_int16_t(buf, 44, sue_estimated_wind_0); - _mav_put_int16_t(buf, 46, sue_estimated_wind_1); - _mav_put_int16_t(buf, 48, sue_estimated_wind_2); - _mav_put_int16_t(buf, 50, sue_magFieldEarth0); - _mav_put_int16_t(buf, 52, sue_magFieldEarth1); - _mav_put_int16_t(buf, 54, sue_magFieldEarth2); - _mav_put_int16_t(buf, 56, sue_svs); - _mav_put_int16_t(buf, 58, sue_hdop); - _mav_put_uint8_t(buf, 60, sue_status); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_CRC); -#else - mavlink_serial_udb_extra_f2_a_t packet; - packet.sue_time = sue_time; - packet.sue_latitude = sue_latitude; - packet.sue_longitude = sue_longitude; - packet.sue_altitude = sue_altitude; - packet.sue_waypoint_index = sue_waypoint_index; - packet.sue_rmat0 = sue_rmat0; - packet.sue_rmat1 = sue_rmat1; - packet.sue_rmat2 = sue_rmat2; - packet.sue_rmat3 = sue_rmat3; - packet.sue_rmat4 = sue_rmat4; - packet.sue_rmat5 = sue_rmat5; - packet.sue_rmat6 = sue_rmat6; - packet.sue_rmat7 = sue_rmat7; - packet.sue_rmat8 = sue_rmat8; - packet.sue_cog = sue_cog; - packet.sue_sog = sue_sog; - packet.sue_cpu_load = sue_cpu_load; - packet.sue_air_speed_3DIMU = sue_air_speed_3DIMU; - packet.sue_estimated_wind_0 = sue_estimated_wind_0; - packet.sue_estimated_wind_1 = sue_estimated_wind_1; - packet.sue_estimated_wind_2 = sue_estimated_wind_2; - packet.sue_magFieldEarth0 = sue_magFieldEarth0; - packet.sue_magFieldEarth1 = sue_magFieldEarth1; - packet.sue_magFieldEarth2 = sue_magFieldEarth2; - packet.sue_svs = sue_svs; - packet.sue_hdop = sue_hdop; - packet.sue_status = sue_status; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A, (const char *)&packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_CRC); -#endif -} - -/** - * @brief Send a serial_udb_extra_f2_a message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_serial_udb_extra_f2_a_send_struct(mavlink_channel_t chan, const mavlink_serial_udb_extra_f2_a_t* serial_udb_extra_f2_a) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_serial_udb_extra_f2_a_send(chan, serial_udb_extra_f2_a->sue_time, serial_udb_extra_f2_a->sue_status, serial_udb_extra_f2_a->sue_latitude, serial_udb_extra_f2_a->sue_longitude, serial_udb_extra_f2_a->sue_altitude, serial_udb_extra_f2_a->sue_waypoint_index, serial_udb_extra_f2_a->sue_rmat0, serial_udb_extra_f2_a->sue_rmat1, serial_udb_extra_f2_a->sue_rmat2, serial_udb_extra_f2_a->sue_rmat3, serial_udb_extra_f2_a->sue_rmat4, serial_udb_extra_f2_a->sue_rmat5, serial_udb_extra_f2_a->sue_rmat6, serial_udb_extra_f2_a->sue_rmat7, serial_udb_extra_f2_a->sue_rmat8, serial_udb_extra_f2_a->sue_cog, serial_udb_extra_f2_a->sue_sog, serial_udb_extra_f2_a->sue_cpu_load, serial_udb_extra_f2_a->sue_air_speed_3DIMU, serial_udb_extra_f2_a->sue_estimated_wind_0, serial_udb_extra_f2_a->sue_estimated_wind_1, serial_udb_extra_f2_a->sue_estimated_wind_2, serial_udb_extra_f2_a->sue_magFieldEarth0, serial_udb_extra_f2_a->sue_magFieldEarth1, serial_udb_extra_f2_a->sue_magFieldEarth2, serial_udb_extra_f2_a->sue_svs, serial_udb_extra_f2_a->sue_hdop); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A, (const char *)serial_udb_extra_f2_a, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_CRC); -#endif -} - -#if MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_serial_udb_extra_f2_a_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t sue_time, uint8_t sue_status, int32_t sue_latitude, int32_t sue_longitude, int32_t sue_altitude, uint16_t sue_waypoint_index, int16_t sue_rmat0, int16_t sue_rmat1, int16_t sue_rmat2, int16_t sue_rmat3, int16_t sue_rmat4, int16_t sue_rmat5, int16_t sue_rmat6, int16_t sue_rmat7, int16_t sue_rmat8, uint16_t sue_cog, int16_t sue_sog, uint16_t sue_cpu_load, uint16_t sue_air_speed_3DIMU, int16_t sue_estimated_wind_0, int16_t sue_estimated_wind_1, int16_t sue_estimated_wind_2, int16_t sue_magFieldEarth0, int16_t sue_magFieldEarth1, int16_t sue_magFieldEarth2, int16_t sue_svs, int16_t sue_hdop) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint32_t(buf, 0, sue_time); - _mav_put_int32_t(buf, 4, sue_latitude); - _mav_put_int32_t(buf, 8, sue_longitude); - _mav_put_int32_t(buf, 12, sue_altitude); - _mav_put_uint16_t(buf, 16, sue_waypoint_index); - _mav_put_int16_t(buf, 18, sue_rmat0); - _mav_put_int16_t(buf, 20, sue_rmat1); - _mav_put_int16_t(buf, 22, sue_rmat2); - _mav_put_int16_t(buf, 24, sue_rmat3); - _mav_put_int16_t(buf, 26, sue_rmat4); - _mav_put_int16_t(buf, 28, sue_rmat5); - _mav_put_int16_t(buf, 30, sue_rmat6); - _mav_put_int16_t(buf, 32, sue_rmat7); - _mav_put_int16_t(buf, 34, sue_rmat8); - _mav_put_uint16_t(buf, 36, sue_cog); - _mav_put_int16_t(buf, 38, sue_sog); - _mav_put_uint16_t(buf, 40, sue_cpu_load); - _mav_put_uint16_t(buf, 42, sue_air_speed_3DIMU); - _mav_put_int16_t(buf, 44, sue_estimated_wind_0); - _mav_put_int16_t(buf, 46, sue_estimated_wind_1); - _mav_put_int16_t(buf, 48, sue_estimated_wind_2); - _mav_put_int16_t(buf, 50, sue_magFieldEarth0); - _mav_put_int16_t(buf, 52, sue_magFieldEarth1); - _mav_put_int16_t(buf, 54, sue_magFieldEarth2); - _mav_put_int16_t(buf, 56, sue_svs); - _mav_put_int16_t(buf, 58, sue_hdop); - _mav_put_uint8_t(buf, 60, sue_status); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_CRC); -#else - mavlink_serial_udb_extra_f2_a_t *packet = (mavlink_serial_udb_extra_f2_a_t *)msgbuf; - packet->sue_time = sue_time; - packet->sue_latitude = sue_latitude; - packet->sue_longitude = sue_longitude; - packet->sue_altitude = sue_altitude; - packet->sue_waypoint_index = sue_waypoint_index; - packet->sue_rmat0 = sue_rmat0; - packet->sue_rmat1 = sue_rmat1; - packet->sue_rmat2 = sue_rmat2; - packet->sue_rmat3 = sue_rmat3; - packet->sue_rmat4 = sue_rmat4; - packet->sue_rmat5 = sue_rmat5; - packet->sue_rmat6 = sue_rmat6; - packet->sue_rmat7 = sue_rmat7; - packet->sue_rmat8 = sue_rmat8; - packet->sue_cog = sue_cog; - packet->sue_sog = sue_sog; - packet->sue_cpu_load = sue_cpu_load; - packet->sue_air_speed_3DIMU = sue_air_speed_3DIMU; - packet->sue_estimated_wind_0 = sue_estimated_wind_0; - packet->sue_estimated_wind_1 = sue_estimated_wind_1; - packet->sue_estimated_wind_2 = sue_estimated_wind_2; - packet->sue_magFieldEarth0 = sue_magFieldEarth0; - packet->sue_magFieldEarth1 = sue_magFieldEarth1; - packet->sue_magFieldEarth2 = sue_magFieldEarth2; - packet->sue_svs = sue_svs; - packet->sue_hdop = sue_hdop; - packet->sue_status = sue_status; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A, (const char *)packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_CRC); -#endif -} -#endif - -#endif - -// MESSAGE SERIAL_UDB_EXTRA_F2_A UNPACKING - - -/** - * @brief Get field sue_time from serial_udb_extra_f2_a message - * - * @return Serial UDB Extra Time - */ -static inline uint32_t mavlink_msg_serial_udb_extra_f2_a_get_sue_time(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 0); -} - -/** - * @brief Get field sue_status from serial_udb_extra_f2_a message - * - * @return Serial UDB Extra Status - */ -static inline uint8_t mavlink_msg_serial_udb_extra_f2_a_get_sue_status(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 60); -} - -/** - * @brief Get field sue_latitude from serial_udb_extra_f2_a message - * - * @return Serial UDB Extra Latitude - */ -static inline int32_t mavlink_msg_serial_udb_extra_f2_a_get_sue_latitude(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 4); -} - -/** - * @brief Get field sue_longitude from serial_udb_extra_f2_a message - * - * @return Serial UDB Extra Longitude - */ -static inline int32_t mavlink_msg_serial_udb_extra_f2_a_get_sue_longitude(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 8); -} - -/** - * @brief Get field sue_altitude from serial_udb_extra_f2_a message - * - * @return Serial UDB Extra Altitude - */ -static inline int32_t mavlink_msg_serial_udb_extra_f2_a_get_sue_altitude(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 12); -} - -/** - * @brief Get field sue_waypoint_index from serial_udb_extra_f2_a message - * - * @return Serial UDB Extra Waypoint Index - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f2_a_get_sue_waypoint_index(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 16); -} - -/** - * @brief Get field sue_rmat0 from serial_udb_extra_f2_a message - * - * @return Serial UDB Extra Rmat 0 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_a_get_sue_rmat0(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 18); -} - -/** - * @brief Get field sue_rmat1 from serial_udb_extra_f2_a message - * - * @return Serial UDB Extra Rmat 1 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_a_get_sue_rmat1(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 20); -} - -/** - * @brief Get field sue_rmat2 from serial_udb_extra_f2_a message - * - * @return Serial UDB Extra Rmat 2 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_a_get_sue_rmat2(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 22); -} - -/** - * @brief Get field sue_rmat3 from serial_udb_extra_f2_a message - * - * @return Serial UDB Extra Rmat 3 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_a_get_sue_rmat3(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 24); -} - -/** - * @brief Get field sue_rmat4 from serial_udb_extra_f2_a message - * - * @return Serial UDB Extra Rmat 4 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_a_get_sue_rmat4(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 26); -} - -/** - * @brief Get field sue_rmat5 from serial_udb_extra_f2_a message - * - * @return Serial UDB Extra Rmat 5 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_a_get_sue_rmat5(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 28); -} - -/** - * @brief Get field sue_rmat6 from serial_udb_extra_f2_a message - * - * @return Serial UDB Extra Rmat 6 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_a_get_sue_rmat6(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 30); -} - -/** - * @brief Get field sue_rmat7 from serial_udb_extra_f2_a message - * - * @return Serial UDB Extra Rmat 7 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_a_get_sue_rmat7(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 32); -} - -/** - * @brief Get field sue_rmat8 from serial_udb_extra_f2_a message - * - * @return Serial UDB Extra Rmat 8 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_a_get_sue_rmat8(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 34); -} - -/** - * @brief Get field sue_cog from serial_udb_extra_f2_a message - * - * @return Serial UDB Extra GPS Course Over Ground - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f2_a_get_sue_cog(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 36); -} - -/** - * @brief Get field sue_sog from serial_udb_extra_f2_a message - * - * @return Serial UDB Extra Speed Over Ground - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_a_get_sue_sog(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 38); -} - -/** - * @brief Get field sue_cpu_load from serial_udb_extra_f2_a message - * - * @return Serial UDB Extra CPU Load - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f2_a_get_sue_cpu_load(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 40); -} - -/** - * @brief Get field sue_air_speed_3DIMU from serial_udb_extra_f2_a message - * - * @return Serial UDB Extra 3D IMU Air Speed - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f2_a_get_sue_air_speed_3DIMU(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 42); -} - -/** - * @brief Get field sue_estimated_wind_0 from serial_udb_extra_f2_a message - * - * @return Serial UDB Extra Estimated Wind 0 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_a_get_sue_estimated_wind_0(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 44); -} - -/** - * @brief Get field sue_estimated_wind_1 from serial_udb_extra_f2_a message - * - * @return Serial UDB Extra Estimated Wind 1 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_a_get_sue_estimated_wind_1(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 46); -} - -/** - * @brief Get field sue_estimated_wind_2 from serial_udb_extra_f2_a message - * - * @return Serial UDB Extra Estimated Wind 2 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_a_get_sue_estimated_wind_2(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 48); -} - -/** - * @brief Get field sue_magFieldEarth0 from serial_udb_extra_f2_a message - * - * @return Serial UDB Extra Magnetic Field Earth 0 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_a_get_sue_magFieldEarth0(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 50); -} - -/** - * @brief Get field sue_magFieldEarth1 from serial_udb_extra_f2_a message - * - * @return Serial UDB Extra Magnetic Field Earth 1 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_a_get_sue_magFieldEarth1(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 52); -} - -/** - * @brief Get field sue_magFieldEarth2 from serial_udb_extra_f2_a message - * - * @return Serial UDB Extra Magnetic Field Earth 2 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_a_get_sue_magFieldEarth2(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 54); -} - -/** - * @brief Get field sue_svs from serial_udb_extra_f2_a message - * - * @return Serial UDB Extra Number of Sattelites in View - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_a_get_sue_svs(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 56); -} - -/** - * @brief Get field sue_hdop from serial_udb_extra_f2_a message - * - * @return Serial UDB Extra GPS Horizontal Dilution of Precision - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_a_get_sue_hdop(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 58); -} - -/** - * @brief Decode a serial_udb_extra_f2_a message into a struct - * - * @param msg The message to decode - * @param serial_udb_extra_f2_a C-struct to decode the message contents into - */ -static inline void mavlink_msg_serial_udb_extra_f2_a_decode(const mavlink_message_t* msg, mavlink_serial_udb_extra_f2_a_t* serial_udb_extra_f2_a) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - serial_udb_extra_f2_a->sue_time = mavlink_msg_serial_udb_extra_f2_a_get_sue_time(msg); - serial_udb_extra_f2_a->sue_latitude = mavlink_msg_serial_udb_extra_f2_a_get_sue_latitude(msg); - serial_udb_extra_f2_a->sue_longitude = mavlink_msg_serial_udb_extra_f2_a_get_sue_longitude(msg); - serial_udb_extra_f2_a->sue_altitude = mavlink_msg_serial_udb_extra_f2_a_get_sue_altitude(msg); - serial_udb_extra_f2_a->sue_waypoint_index = mavlink_msg_serial_udb_extra_f2_a_get_sue_waypoint_index(msg); - serial_udb_extra_f2_a->sue_rmat0 = mavlink_msg_serial_udb_extra_f2_a_get_sue_rmat0(msg); - serial_udb_extra_f2_a->sue_rmat1 = mavlink_msg_serial_udb_extra_f2_a_get_sue_rmat1(msg); - serial_udb_extra_f2_a->sue_rmat2 = mavlink_msg_serial_udb_extra_f2_a_get_sue_rmat2(msg); - serial_udb_extra_f2_a->sue_rmat3 = mavlink_msg_serial_udb_extra_f2_a_get_sue_rmat3(msg); - serial_udb_extra_f2_a->sue_rmat4 = mavlink_msg_serial_udb_extra_f2_a_get_sue_rmat4(msg); - serial_udb_extra_f2_a->sue_rmat5 = mavlink_msg_serial_udb_extra_f2_a_get_sue_rmat5(msg); - serial_udb_extra_f2_a->sue_rmat6 = mavlink_msg_serial_udb_extra_f2_a_get_sue_rmat6(msg); - serial_udb_extra_f2_a->sue_rmat7 = mavlink_msg_serial_udb_extra_f2_a_get_sue_rmat7(msg); - serial_udb_extra_f2_a->sue_rmat8 = mavlink_msg_serial_udb_extra_f2_a_get_sue_rmat8(msg); - serial_udb_extra_f2_a->sue_cog = mavlink_msg_serial_udb_extra_f2_a_get_sue_cog(msg); - serial_udb_extra_f2_a->sue_sog = mavlink_msg_serial_udb_extra_f2_a_get_sue_sog(msg); - serial_udb_extra_f2_a->sue_cpu_load = mavlink_msg_serial_udb_extra_f2_a_get_sue_cpu_load(msg); - serial_udb_extra_f2_a->sue_air_speed_3DIMU = mavlink_msg_serial_udb_extra_f2_a_get_sue_air_speed_3DIMU(msg); - serial_udb_extra_f2_a->sue_estimated_wind_0 = mavlink_msg_serial_udb_extra_f2_a_get_sue_estimated_wind_0(msg); - serial_udb_extra_f2_a->sue_estimated_wind_1 = mavlink_msg_serial_udb_extra_f2_a_get_sue_estimated_wind_1(msg); - serial_udb_extra_f2_a->sue_estimated_wind_2 = mavlink_msg_serial_udb_extra_f2_a_get_sue_estimated_wind_2(msg); - serial_udb_extra_f2_a->sue_magFieldEarth0 = mavlink_msg_serial_udb_extra_f2_a_get_sue_magFieldEarth0(msg); - serial_udb_extra_f2_a->sue_magFieldEarth1 = mavlink_msg_serial_udb_extra_f2_a_get_sue_magFieldEarth1(msg); - serial_udb_extra_f2_a->sue_magFieldEarth2 = mavlink_msg_serial_udb_extra_f2_a_get_sue_magFieldEarth2(msg); - serial_udb_extra_f2_a->sue_svs = mavlink_msg_serial_udb_extra_f2_a_get_sue_svs(msg); - serial_udb_extra_f2_a->sue_hdop = mavlink_msg_serial_udb_extra_f2_a_get_sue_hdop(msg); - serial_udb_extra_f2_a->sue_status = mavlink_msg_serial_udb_extra_f2_a_get_sue_status(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_LEN? msg->len : MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_LEN; - memset(serial_udb_extra_f2_a, 0, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_LEN); - memcpy(serial_udb_extra_f2_a, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/matrixpilot/mavlink_msg_serial_udb_extra_f2_b.h b/matrixpilot/mavlink_msg_serial_udb_extra_f2_b.h deleted file mode 100644 index 5c148b1ff..000000000 --- a/matrixpilot/mavlink_msg_serial_udb_extra_f2_b.h +++ /dev/null @@ -1,1438 +0,0 @@ -#pragma once -// MESSAGE SERIAL_UDB_EXTRA_F2_B PACKING - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B 171 - - -typedef struct __mavlink_serial_udb_extra_f2_b_t { - uint32_t sue_time; /*< Serial UDB Extra Time*/ - uint32_t sue_flags; /*< Serial UDB Extra Status Flags*/ - int32_t sue_barom_press; /*< SUE barometer pressure*/ - int32_t sue_barom_alt; /*< SUE barometer altitude*/ - int16_t sue_pwm_input_1; /*< Serial UDB Extra PWM Input Channel 1*/ - int16_t sue_pwm_input_2; /*< Serial UDB Extra PWM Input Channel 2*/ - int16_t sue_pwm_input_3; /*< Serial UDB Extra PWM Input Channel 3*/ - int16_t sue_pwm_input_4; /*< Serial UDB Extra PWM Input Channel 4*/ - int16_t sue_pwm_input_5; /*< Serial UDB Extra PWM Input Channel 5*/ - int16_t sue_pwm_input_6; /*< Serial UDB Extra PWM Input Channel 6*/ - int16_t sue_pwm_input_7; /*< Serial UDB Extra PWM Input Channel 7*/ - int16_t sue_pwm_input_8; /*< Serial UDB Extra PWM Input Channel 8*/ - int16_t sue_pwm_input_9; /*< Serial UDB Extra PWM Input Channel 9*/ - int16_t sue_pwm_input_10; /*< Serial UDB Extra PWM Input Channel 10*/ - int16_t sue_pwm_input_11; /*< Serial UDB Extra PWM Input Channel 11*/ - int16_t sue_pwm_input_12; /*< Serial UDB Extra PWM Input Channel 12*/ - int16_t sue_pwm_output_1; /*< Serial UDB Extra PWM Output Channel 1*/ - int16_t sue_pwm_output_2; /*< Serial UDB Extra PWM Output Channel 2*/ - int16_t sue_pwm_output_3; /*< Serial UDB Extra PWM Output Channel 3*/ - int16_t sue_pwm_output_4; /*< Serial UDB Extra PWM Output Channel 4*/ - int16_t sue_pwm_output_5; /*< Serial UDB Extra PWM Output Channel 5*/ - int16_t sue_pwm_output_6; /*< Serial UDB Extra PWM Output Channel 6*/ - int16_t sue_pwm_output_7; /*< Serial UDB Extra PWM Output Channel 7*/ - int16_t sue_pwm_output_8; /*< Serial UDB Extra PWM Output Channel 8*/ - int16_t sue_pwm_output_9; /*< Serial UDB Extra PWM Output Channel 9*/ - int16_t sue_pwm_output_10; /*< Serial UDB Extra PWM Output Channel 10*/ - int16_t sue_pwm_output_11; /*< Serial UDB Extra PWM Output Channel 11*/ - int16_t sue_pwm_output_12; /*< Serial UDB Extra PWM Output Channel 12*/ - int16_t sue_imu_location_x; /*< Serial UDB Extra IMU Location X*/ - int16_t sue_imu_location_y; /*< Serial UDB Extra IMU Location Y*/ - int16_t sue_imu_location_z; /*< Serial UDB Extra IMU Location Z*/ - int16_t sue_location_error_earth_x; /*< Serial UDB Location Error Earth X*/ - int16_t sue_location_error_earth_y; /*< Serial UDB Location Error Earth Y*/ - int16_t sue_location_error_earth_z; /*< Serial UDB Location Error Earth Z*/ - int16_t sue_osc_fails; /*< Serial UDB Extra Oscillator Failure Count*/ - int16_t sue_imu_velocity_x; /*< Serial UDB Extra IMU Velocity X*/ - int16_t sue_imu_velocity_y; /*< Serial UDB Extra IMU Velocity Y*/ - int16_t sue_imu_velocity_z; /*< Serial UDB Extra IMU Velocity Z*/ - int16_t sue_waypoint_goal_x; /*< Serial UDB Extra Current Waypoint Goal X*/ - int16_t sue_waypoint_goal_y; /*< Serial UDB Extra Current Waypoint Goal Y*/ - int16_t sue_waypoint_goal_z; /*< Serial UDB Extra Current Waypoint Goal Z*/ - int16_t sue_aero_x; /*< Aeroforce in UDB X Axis*/ - int16_t sue_aero_y; /*< Aeroforce in UDB Y Axis*/ - int16_t sue_aero_z; /*< Aeroforce in UDB Z axis*/ - int16_t sue_barom_temp; /*< SUE barometer temperature*/ - int16_t sue_bat_volt; /*< SUE battery voltage*/ - int16_t sue_bat_amp; /*< SUE battery current*/ - int16_t sue_bat_amp_hours; /*< SUE battery milli amp hours used*/ - int16_t sue_desired_height; /*< Sue autopilot desired height*/ - int16_t sue_memory_stack_free; /*< Serial UDB Extra Stack Memory Free*/ -} mavlink_serial_udb_extra_f2_b_t; - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_LEN 108 -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_MIN_LEN 108 -#define MAVLINK_MSG_ID_171_LEN 108 -#define MAVLINK_MSG_ID_171_MIN_LEN 108 - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_CRC 245 -#define MAVLINK_MSG_ID_171_CRC 245 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F2_B { \ - 171, \ - "SERIAL_UDB_EXTRA_F2_B", \ - 50, \ - { { "sue_time", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_time) }, \ - { "sue_pwm_input_1", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_input_1) }, \ - { "sue_pwm_input_2", NULL, MAVLINK_TYPE_INT16_T, 0, 18, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_input_2) }, \ - { "sue_pwm_input_3", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_input_3) }, \ - { "sue_pwm_input_4", NULL, MAVLINK_TYPE_INT16_T, 0, 22, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_input_4) }, \ - { "sue_pwm_input_5", NULL, MAVLINK_TYPE_INT16_T, 0, 24, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_input_5) }, \ - { "sue_pwm_input_6", NULL, MAVLINK_TYPE_INT16_T, 0, 26, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_input_6) }, \ - { "sue_pwm_input_7", NULL, MAVLINK_TYPE_INT16_T, 0, 28, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_input_7) }, \ - { "sue_pwm_input_8", NULL, MAVLINK_TYPE_INT16_T, 0, 30, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_input_8) }, \ - { "sue_pwm_input_9", NULL, MAVLINK_TYPE_INT16_T, 0, 32, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_input_9) }, \ - { "sue_pwm_input_10", NULL, MAVLINK_TYPE_INT16_T, 0, 34, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_input_10) }, \ - { "sue_pwm_input_11", NULL, MAVLINK_TYPE_INT16_T, 0, 36, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_input_11) }, \ - { "sue_pwm_input_12", NULL, MAVLINK_TYPE_INT16_T, 0, 38, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_input_12) }, \ - { "sue_pwm_output_1", NULL, MAVLINK_TYPE_INT16_T, 0, 40, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_output_1) }, \ - { "sue_pwm_output_2", NULL, MAVLINK_TYPE_INT16_T, 0, 42, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_output_2) }, \ - { "sue_pwm_output_3", NULL, MAVLINK_TYPE_INT16_T, 0, 44, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_output_3) }, \ - { "sue_pwm_output_4", NULL, MAVLINK_TYPE_INT16_T, 0, 46, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_output_4) }, \ - { "sue_pwm_output_5", NULL, MAVLINK_TYPE_INT16_T, 0, 48, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_output_5) }, \ - { "sue_pwm_output_6", NULL, MAVLINK_TYPE_INT16_T, 0, 50, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_output_6) }, \ - { "sue_pwm_output_7", NULL, MAVLINK_TYPE_INT16_T, 0, 52, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_output_7) }, \ - { "sue_pwm_output_8", NULL, MAVLINK_TYPE_INT16_T, 0, 54, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_output_8) }, \ - { "sue_pwm_output_9", NULL, MAVLINK_TYPE_INT16_T, 0, 56, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_output_9) }, \ - { "sue_pwm_output_10", NULL, MAVLINK_TYPE_INT16_T, 0, 58, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_output_10) }, \ - { "sue_pwm_output_11", NULL, MAVLINK_TYPE_INT16_T, 0, 60, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_output_11) }, \ - { "sue_pwm_output_12", NULL, MAVLINK_TYPE_INT16_T, 0, 62, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_output_12) }, \ - { "sue_imu_location_x", NULL, MAVLINK_TYPE_INT16_T, 0, 64, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_imu_location_x) }, \ - { "sue_imu_location_y", NULL, MAVLINK_TYPE_INT16_T, 0, 66, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_imu_location_y) }, \ - { "sue_imu_location_z", NULL, MAVLINK_TYPE_INT16_T, 0, 68, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_imu_location_z) }, \ - { "sue_location_error_earth_x", NULL, MAVLINK_TYPE_INT16_T, 0, 70, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_location_error_earth_x) }, \ - { "sue_location_error_earth_y", NULL, MAVLINK_TYPE_INT16_T, 0, 72, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_location_error_earth_y) }, \ - { "sue_location_error_earth_z", NULL, MAVLINK_TYPE_INT16_T, 0, 74, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_location_error_earth_z) }, \ - { "sue_flags", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_flags) }, \ - { "sue_osc_fails", NULL, MAVLINK_TYPE_INT16_T, 0, 76, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_osc_fails) }, \ - { "sue_imu_velocity_x", NULL, MAVLINK_TYPE_INT16_T, 0, 78, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_imu_velocity_x) }, \ - { "sue_imu_velocity_y", NULL, MAVLINK_TYPE_INT16_T, 0, 80, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_imu_velocity_y) }, \ - { "sue_imu_velocity_z", NULL, MAVLINK_TYPE_INT16_T, 0, 82, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_imu_velocity_z) }, \ - { "sue_waypoint_goal_x", NULL, MAVLINK_TYPE_INT16_T, 0, 84, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_waypoint_goal_x) }, \ - { "sue_waypoint_goal_y", NULL, MAVLINK_TYPE_INT16_T, 0, 86, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_waypoint_goal_y) }, \ - { "sue_waypoint_goal_z", NULL, MAVLINK_TYPE_INT16_T, 0, 88, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_waypoint_goal_z) }, \ - { "sue_aero_x", NULL, MAVLINK_TYPE_INT16_T, 0, 90, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_aero_x) }, \ - { "sue_aero_y", NULL, MAVLINK_TYPE_INT16_T, 0, 92, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_aero_y) }, \ - { "sue_aero_z", NULL, MAVLINK_TYPE_INT16_T, 0, 94, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_aero_z) }, \ - { "sue_barom_temp", NULL, MAVLINK_TYPE_INT16_T, 0, 96, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_barom_temp) }, \ - { "sue_barom_press", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_barom_press) }, \ - { "sue_barom_alt", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_barom_alt) }, \ - { "sue_bat_volt", NULL, MAVLINK_TYPE_INT16_T, 0, 98, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_bat_volt) }, \ - { "sue_bat_amp", NULL, MAVLINK_TYPE_INT16_T, 0, 100, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_bat_amp) }, \ - { "sue_bat_amp_hours", NULL, MAVLINK_TYPE_INT16_T, 0, 102, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_bat_amp_hours) }, \ - { "sue_desired_height", NULL, MAVLINK_TYPE_INT16_T, 0, 104, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_desired_height) }, \ - { "sue_memory_stack_free", NULL, MAVLINK_TYPE_INT16_T, 0, 106, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_memory_stack_free) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F2_B { \ - "SERIAL_UDB_EXTRA_F2_B", \ - 50, \ - { { "sue_time", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_time) }, \ - { "sue_pwm_input_1", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_input_1) }, \ - { "sue_pwm_input_2", NULL, MAVLINK_TYPE_INT16_T, 0, 18, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_input_2) }, \ - { "sue_pwm_input_3", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_input_3) }, \ - { "sue_pwm_input_4", NULL, MAVLINK_TYPE_INT16_T, 0, 22, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_input_4) }, \ - { "sue_pwm_input_5", NULL, MAVLINK_TYPE_INT16_T, 0, 24, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_input_5) }, \ - { "sue_pwm_input_6", NULL, MAVLINK_TYPE_INT16_T, 0, 26, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_input_6) }, \ - { "sue_pwm_input_7", NULL, MAVLINK_TYPE_INT16_T, 0, 28, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_input_7) }, \ - { "sue_pwm_input_8", NULL, MAVLINK_TYPE_INT16_T, 0, 30, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_input_8) }, \ - { "sue_pwm_input_9", NULL, MAVLINK_TYPE_INT16_T, 0, 32, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_input_9) }, \ - { "sue_pwm_input_10", NULL, MAVLINK_TYPE_INT16_T, 0, 34, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_input_10) }, \ - { "sue_pwm_input_11", NULL, MAVLINK_TYPE_INT16_T, 0, 36, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_input_11) }, \ - { "sue_pwm_input_12", NULL, MAVLINK_TYPE_INT16_T, 0, 38, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_input_12) }, \ - { "sue_pwm_output_1", NULL, MAVLINK_TYPE_INT16_T, 0, 40, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_output_1) }, \ - { "sue_pwm_output_2", NULL, MAVLINK_TYPE_INT16_T, 0, 42, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_output_2) }, \ - { "sue_pwm_output_3", NULL, MAVLINK_TYPE_INT16_T, 0, 44, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_output_3) }, \ - { "sue_pwm_output_4", NULL, MAVLINK_TYPE_INT16_T, 0, 46, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_output_4) }, \ - { "sue_pwm_output_5", NULL, MAVLINK_TYPE_INT16_T, 0, 48, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_output_5) }, \ - { "sue_pwm_output_6", NULL, MAVLINK_TYPE_INT16_T, 0, 50, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_output_6) }, \ - { "sue_pwm_output_7", NULL, MAVLINK_TYPE_INT16_T, 0, 52, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_output_7) }, \ - { "sue_pwm_output_8", NULL, MAVLINK_TYPE_INT16_T, 0, 54, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_output_8) }, \ - { "sue_pwm_output_9", NULL, MAVLINK_TYPE_INT16_T, 0, 56, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_output_9) }, \ - { "sue_pwm_output_10", NULL, MAVLINK_TYPE_INT16_T, 0, 58, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_output_10) }, \ - { "sue_pwm_output_11", NULL, MAVLINK_TYPE_INT16_T, 0, 60, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_output_11) }, \ - { "sue_pwm_output_12", NULL, MAVLINK_TYPE_INT16_T, 0, 62, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_pwm_output_12) }, \ - { "sue_imu_location_x", NULL, MAVLINK_TYPE_INT16_T, 0, 64, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_imu_location_x) }, \ - { "sue_imu_location_y", NULL, MAVLINK_TYPE_INT16_T, 0, 66, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_imu_location_y) }, \ - { "sue_imu_location_z", NULL, MAVLINK_TYPE_INT16_T, 0, 68, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_imu_location_z) }, \ - { "sue_location_error_earth_x", NULL, MAVLINK_TYPE_INT16_T, 0, 70, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_location_error_earth_x) }, \ - { "sue_location_error_earth_y", NULL, MAVLINK_TYPE_INT16_T, 0, 72, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_location_error_earth_y) }, \ - { "sue_location_error_earth_z", NULL, MAVLINK_TYPE_INT16_T, 0, 74, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_location_error_earth_z) }, \ - { "sue_flags", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_flags) }, \ - { "sue_osc_fails", NULL, MAVLINK_TYPE_INT16_T, 0, 76, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_osc_fails) }, \ - { "sue_imu_velocity_x", NULL, MAVLINK_TYPE_INT16_T, 0, 78, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_imu_velocity_x) }, \ - { "sue_imu_velocity_y", NULL, MAVLINK_TYPE_INT16_T, 0, 80, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_imu_velocity_y) }, \ - { "sue_imu_velocity_z", NULL, MAVLINK_TYPE_INT16_T, 0, 82, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_imu_velocity_z) }, \ - { "sue_waypoint_goal_x", NULL, MAVLINK_TYPE_INT16_T, 0, 84, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_waypoint_goal_x) }, \ - { "sue_waypoint_goal_y", NULL, MAVLINK_TYPE_INT16_T, 0, 86, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_waypoint_goal_y) }, \ - { "sue_waypoint_goal_z", NULL, MAVLINK_TYPE_INT16_T, 0, 88, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_waypoint_goal_z) }, \ - { "sue_aero_x", NULL, MAVLINK_TYPE_INT16_T, 0, 90, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_aero_x) }, \ - { "sue_aero_y", NULL, MAVLINK_TYPE_INT16_T, 0, 92, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_aero_y) }, \ - { "sue_aero_z", NULL, MAVLINK_TYPE_INT16_T, 0, 94, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_aero_z) }, \ - { "sue_barom_temp", NULL, MAVLINK_TYPE_INT16_T, 0, 96, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_barom_temp) }, \ - { "sue_barom_press", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_barom_press) }, \ - { "sue_barom_alt", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_barom_alt) }, \ - { "sue_bat_volt", NULL, MAVLINK_TYPE_INT16_T, 0, 98, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_bat_volt) }, \ - { "sue_bat_amp", NULL, MAVLINK_TYPE_INT16_T, 0, 100, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_bat_amp) }, \ - { "sue_bat_amp_hours", NULL, MAVLINK_TYPE_INT16_T, 0, 102, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_bat_amp_hours) }, \ - { "sue_desired_height", NULL, MAVLINK_TYPE_INT16_T, 0, 104, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_desired_height) }, \ - { "sue_memory_stack_free", NULL, MAVLINK_TYPE_INT16_T, 0, 106, offsetof(mavlink_serial_udb_extra_f2_b_t, sue_memory_stack_free) }, \ - } \ -} -#endif - -/** - * @brief Pack a serial_udb_extra_f2_b message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param sue_time Serial UDB Extra Time - * @param sue_pwm_input_1 Serial UDB Extra PWM Input Channel 1 - * @param sue_pwm_input_2 Serial UDB Extra PWM Input Channel 2 - * @param sue_pwm_input_3 Serial UDB Extra PWM Input Channel 3 - * @param sue_pwm_input_4 Serial UDB Extra PWM Input Channel 4 - * @param sue_pwm_input_5 Serial UDB Extra PWM Input Channel 5 - * @param sue_pwm_input_6 Serial UDB Extra PWM Input Channel 6 - * @param sue_pwm_input_7 Serial UDB Extra PWM Input Channel 7 - * @param sue_pwm_input_8 Serial UDB Extra PWM Input Channel 8 - * @param sue_pwm_input_9 Serial UDB Extra PWM Input Channel 9 - * @param sue_pwm_input_10 Serial UDB Extra PWM Input Channel 10 - * @param sue_pwm_input_11 Serial UDB Extra PWM Input Channel 11 - * @param sue_pwm_input_12 Serial UDB Extra PWM Input Channel 12 - * @param sue_pwm_output_1 Serial UDB Extra PWM Output Channel 1 - * @param sue_pwm_output_2 Serial UDB Extra PWM Output Channel 2 - * @param sue_pwm_output_3 Serial UDB Extra PWM Output Channel 3 - * @param sue_pwm_output_4 Serial UDB Extra PWM Output Channel 4 - * @param sue_pwm_output_5 Serial UDB Extra PWM Output Channel 5 - * @param sue_pwm_output_6 Serial UDB Extra PWM Output Channel 6 - * @param sue_pwm_output_7 Serial UDB Extra PWM Output Channel 7 - * @param sue_pwm_output_8 Serial UDB Extra PWM Output Channel 8 - * @param sue_pwm_output_9 Serial UDB Extra PWM Output Channel 9 - * @param sue_pwm_output_10 Serial UDB Extra PWM Output Channel 10 - * @param sue_pwm_output_11 Serial UDB Extra PWM Output Channel 11 - * @param sue_pwm_output_12 Serial UDB Extra PWM Output Channel 12 - * @param sue_imu_location_x Serial UDB Extra IMU Location X - * @param sue_imu_location_y Serial UDB Extra IMU Location Y - * @param sue_imu_location_z Serial UDB Extra IMU Location Z - * @param sue_location_error_earth_x Serial UDB Location Error Earth X - * @param sue_location_error_earth_y Serial UDB Location Error Earth Y - * @param sue_location_error_earth_z Serial UDB Location Error Earth Z - * @param sue_flags Serial UDB Extra Status Flags - * @param sue_osc_fails Serial UDB Extra Oscillator Failure Count - * @param sue_imu_velocity_x Serial UDB Extra IMU Velocity X - * @param sue_imu_velocity_y Serial UDB Extra IMU Velocity Y - * @param sue_imu_velocity_z Serial UDB Extra IMU Velocity Z - * @param sue_waypoint_goal_x Serial UDB Extra Current Waypoint Goal X - * @param sue_waypoint_goal_y Serial UDB Extra Current Waypoint Goal Y - * @param sue_waypoint_goal_z Serial UDB Extra Current Waypoint Goal Z - * @param sue_aero_x Aeroforce in UDB X Axis - * @param sue_aero_y Aeroforce in UDB Y Axis - * @param sue_aero_z Aeroforce in UDB Z axis - * @param sue_barom_temp SUE barometer temperature - * @param sue_barom_press SUE barometer pressure - * @param sue_barom_alt SUE barometer altitude - * @param sue_bat_volt SUE battery voltage - * @param sue_bat_amp SUE battery current - * @param sue_bat_amp_hours SUE battery milli amp hours used - * @param sue_desired_height Sue autopilot desired height - * @param sue_memory_stack_free Serial UDB Extra Stack Memory Free - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f2_b_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint32_t sue_time, int16_t sue_pwm_input_1, int16_t sue_pwm_input_2, int16_t sue_pwm_input_3, int16_t sue_pwm_input_4, int16_t sue_pwm_input_5, int16_t sue_pwm_input_6, int16_t sue_pwm_input_7, int16_t sue_pwm_input_8, int16_t sue_pwm_input_9, int16_t sue_pwm_input_10, int16_t sue_pwm_input_11, int16_t sue_pwm_input_12, int16_t sue_pwm_output_1, int16_t sue_pwm_output_2, int16_t sue_pwm_output_3, int16_t sue_pwm_output_4, int16_t sue_pwm_output_5, int16_t sue_pwm_output_6, int16_t sue_pwm_output_7, int16_t sue_pwm_output_8, int16_t sue_pwm_output_9, int16_t sue_pwm_output_10, int16_t sue_pwm_output_11, int16_t sue_pwm_output_12, int16_t sue_imu_location_x, int16_t sue_imu_location_y, int16_t sue_imu_location_z, int16_t sue_location_error_earth_x, int16_t sue_location_error_earth_y, int16_t sue_location_error_earth_z, uint32_t sue_flags, int16_t sue_osc_fails, int16_t sue_imu_velocity_x, int16_t sue_imu_velocity_y, int16_t sue_imu_velocity_z, int16_t sue_waypoint_goal_x, int16_t sue_waypoint_goal_y, int16_t sue_waypoint_goal_z, int16_t sue_aero_x, int16_t sue_aero_y, int16_t sue_aero_z, int16_t sue_barom_temp, int32_t sue_barom_press, int32_t sue_barom_alt, int16_t sue_bat_volt, int16_t sue_bat_amp, int16_t sue_bat_amp_hours, int16_t sue_desired_height, int16_t sue_memory_stack_free) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_LEN]; - _mav_put_uint32_t(buf, 0, sue_time); - _mav_put_uint32_t(buf, 4, sue_flags); - _mav_put_int32_t(buf, 8, sue_barom_press); - _mav_put_int32_t(buf, 12, sue_barom_alt); - _mav_put_int16_t(buf, 16, sue_pwm_input_1); - _mav_put_int16_t(buf, 18, sue_pwm_input_2); - _mav_put_int16_t(buf, 20, sue_pwm_input_3); - _mav_put_int16_t(buf, 22, sue_pwm_input_4); - _mav_put_int16_t(buf, 24, sue_pwm_input_5); - _mav_put_int16_t(buf, 26, sue_pwm_input_6); - _mav_put_int16_t(buf, 28, sue_pwm_input_7); - _mav_put_int16_t(buf, 30, sue_pwm_input_8); - _mav_put_int16_t(buf, 32, sue_pwm_input_9); - _mav_put_int16_t(buf, 34, sue_pwm_input_10); - _mav_put_int16_t(buf, 36, sue_pwm_input_11); - _mav_put_int16_t(buf, 38, sue_pwm_input_12); - _mav_put_int16_t(buf, 40, sue_pwm_output_1); - _mav_put_int16_t(buf, 42, sue_pwm_output_2); - _mav_put_int16_t(buf, 44, sue_pwm_output_3); - _mav_put_int16_t(buf, 46, sue_pwm_output_4); - _mav_put_int16_t(buf, 48, sue_pwm_output_5); - _mav_put_int16_t(buf, 50, sue_pwm_output_6); - _mav_put_int16_t(buf, 52, sue_pwm_output_7); - _mav_put_int16_t(buf, 54, sue_pwm_output_8); - _mav_put_int16_t(buf, 56, sue_pwm_output_9); - _mav_put_int16_t(buf, 58, sue_pwm_output_10); - _mav_put_int16_t(buf, 60, sue_pwm_output_11); - _mav_put_int16_t(buf, 62, sue_pwm_output_12); - _mav_put_int16_t(buf, 64, sue_imu_location_x); - _mav_put_int16_t(buf, 66, sue_imu_location_y); - _mav_put_int16_t(buf, 68, sue_imu_location_z); - _mav_put_int16_t(buf, 70, sue_location_error_earth_x); - _mav_put_int16_t(buf, 72, sue_location_error_earth_y); - _mav_put_int16_t(buf, 74, sue_location_error_earth_z); - _mav_put_int16_t(buf, 76, sue_osc_fails); - _mav_put_int16_t(buf, 78, sue_imu_velocity_x); - _mav_put_int16_t(buf, 80, sue_imu_velocity_y); - _mav_put_int16_t(buf, 82, sue_imu_velocity_z); - _mav_put_int16_t(buf, 84, sue_waypoint_goal_x); - _mav_put_int16_t(buf, 86, sue_waypoint_goal_y); - _mav_put_int16_t(buf, 88, sue_waypoint_goal_z); - _mav_put_int16_t(buf, 90, sue_aero_x); - _mav_put_int16_t(buf, 92, sue_aero_y); - _mav_put_int16_t(buf, 94, sue_aero_z); - _mav_put_int16_t(buf, 96, sue_barom_temp); - _mav_put_int16_t(buf, 98, sue_bat_volt); - _mav_put_int16_t(buf, 100, sue_bat_amp); - _mav_put_int16_t(buf, 102, sue_bat_amp_hours); - _mav_put_int16_t(buf, 104, sue_desired_height); - _mav_put_int16_t(buf, 106, sue_memory_stack_free); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_LEN); -#else - mavlink_serial_udb_extra_f2_b_t packet; - packet.sue_time = sue_time; - packet.sue_flags = sue_flags; - packet.sue_barom_press = sue_barom_press; - packet.sue_barom_alt = sue_barom_alt; - packet.sue_pwm_input_1 = sue_pwm_input_1; - packet.sue_pwm_input_2 = sue_pwm_input_2; - packet.sue_pwm_input_3 = sue_pwm_input_3; - packet.sue_pwm_input_4 = sue_pwm_input_4; - packet.sue_pwm_input_5 = sue_pwm_input_5; - packet.sue_pwm_input_6 = sue_pwm_input_6; - packet.sue_pwm_input_7 = sue_pwm_input_7; - packet.sue_pwm_input_8 = sue_pwm_input_8; - packet.sue_pwm_input_9 = sue_pwm_input_9; - packet.sue_pwm_input_10 = sue_pwm_input_10; - packet.sue_pwm_input_11 = sue_pwm_input_11; - packet.sue_pwm_input_12 = sue_pwm_input_12; - packet.sue_pwm_output_1 = sue_pwm_output_1; - packet.sue_pwm_output_2 = sue_pwm_output_2; - packet.sue_pwm_output_3 = sue_pwm_output_3; - packet.sue_pwm_output_4 = sue_pwm_output_4; - packet.sue_pwm_output_5 = sue_pwm_output_5; - packet.sue_pwm_output_6 = sue_pwm_output_6; - packet.sue_pwm_output_7 = sue_pwm_output_7; - packet.sue_pwm_output_8 = sue_pwm_output_8; - packet.sue_pwm_output_9 = sue_pwm_output_9; - packet.sue_pwm_output_10 = sue_pwm_output_10; - packet.sue_pwm_output_11 = sue_pwm_output_11; - packet.sue_pwm_output_12 = sue_pwm_output_12; - packet.sue_imu_location_x = sue_imu_location_x; - packet.sue_imu_location_y = sue_imu_location_y; - packet.sue_imu_location_z = sue_imu_location_z; - packet.sue_location_error_earth_x = sue_location_error_earth_x; - packet.sue_location_error_earth_y = sue_location_error_earth_y; - packet.sue_location_error_earth_z = sue_location_error_earth_z; - packet.sue_osc_fails = sue_osc_fails; - packet.sue_imu_velocity_x = sue_imu_velocity_x; - packet.sue_imu_velocity_y = sue_imu_velocity_y; - packet.sue_imu_velocity_z = sue_imu_velocity_z; - packet.sue_waypoint_goal_x = sue_waypoint_goal_x; - packet.sue_waypoint_goal_y = sue_waypoint_goal_y; - packet.sue_waypoint_goal_z = sue_waypoint_goal_z; - packet.sue_aero_x = sue_aero_x; - packet.sue_aero_y = sue_aero_y; - packet.sue_aero_z = sue_aero_z; - packet.sue_barom_temp = sue_barom_temp; - packet.sue_bat_volt = sue_bat_volt; - packet.sue_bat_amp = sue_bat_amp; - packet.sue_bat_amp_hours = sue_bat_amp_hours; - packet.sue_desired_height = sue_desired_height; - packet.sue_memory_stack_free = sue_memory_stack_free; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_CRC); -} - -/** - * @brief Pack a serial_udb_extra_f2_b message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param sue_time Serial UDB Extra Time - * @param sue_pwm_input_1 Serial UDB Extra PWM Input Channel 1 - * @param sue_pwm_input_2 Serial UDB Extra PWM Input Channel 2 - * @param sue_pwm_input_3 Serial UDB Extra PWM Input Channel 3 - * @param sue_pwm_input_4 Serial UDB Extra PWM Input Channel 4 - * @param sue_pwm_input_5 Serial UDB Extra PWM Input Channel 5 - * @param sue_pwm_input_6 Serial UDB Extra PWM Input Channel 6 - * @param sue_pwm_input_7 Serial UDB Extra PWM Input Channel 7 - * @param sue_pwm_input_8 Serial UDB Extra PWM Input Channel 8 - * @param sue_pwm_input_9 Serial UDB Extra PWM Input Channel 9 - * @param sue_pwm_input_10 Serial UDB Extra PWM Input Channel 10 - * @param sue_pwm_input_11 Serial UDB Extra PWM Input Channel 11 - * @param sue_pwm_input_12 Serial UDB Extra PWM Input Channel 12 - * @param sue_pwm_output_1 Serial UDB Extra PWM Output Channel 1 - * @param sue_pwm_output_2 Serial UDB Extra PWM Output Channel 2 - * @param sue_pwm_output_3 Serial UDB Extra PWM Output Channel 3 - * @param sue_pwm_output_4 Serial UDB Extra PWM Output Channel 4 - * @param sue_pwm_output_5 Serial UDB Extra PWM Output Channel 5 - * @param sue_pwm_output_6 Serial UDB Extra PWM Output Channel 6 - * @param sue_pwm_output_7 Serial UDB Extra PWM Output Channel 7 - * @param sue_pwm_output_8 Serial UDB Extra PWM Output Channel 8 - * @param sue_pwm_output_9 Serial UDB Extra PWM Output Channel 9 - * @param sue_pwm_output_10 Serial UDB Extra PWM Output Channel 10 - * @param sue_pwm_output_11 Serial UDB Extra PWM Output Channel 11 - * @param sue_pwm_output_12 Serial UDB Extra PWM Output Channel 12 - * @param sue_imu_location_x Serial UDB Extra IMU Location X - * @param sue_imu_location_y Serial UDB Extra IMU Location Y - * @param sue_imu_location_z Serial UDB Extra IMU Location Z - * @param sue_location_error_earth_x Serial UDB Location Error Earth X - * @param sue_location_error_earth_y Serial UDB Location Error Earth Y - * @param sue_location_error_earth_z Serial UDB Location Error Earth Z - * @param sue_flags Serial UDB Extra Status Flags - * @param sue_osc_fails Serial UDB Extra Oscillator Failure Count - * @param sue_imu_velocity_x Serial UDB Extra IMU Velocity X - * @param sue_imu_velocity_y Serial UDB Extra IMU Velocity Y - * @param sue_imu_velocity_z Serial UDB Extra IMU Velocity Z - * @param sue_waypoint_goal_x Serial UDB Extra Current Waypoint Goal X - * @param sue_waypoint_goal_y Serial UDB Extra Current Waypoint Goal Y - * @param sue_waypoint_goal_z Serial UDB Extra Current Waypoint Goal Z - * @param sue_aero_x Aeroforce in UDB X Axis - * @param sue_aero_y Aeroforce in UDB Y Axis - * @param sue_aero_z Aeroforce in UDB Z axis - * @param sue_barom_temp SUE barometer temperature - * @param sue_barom_press SUE barometer pressure - * @param sue_barom_alt SUE barometer altitude - * @param sue_bat_volt SUE battery voltage - * @param sue_bat_amp SUE battery current - * @param sue_bat_amp_hours SUE battery milli amp hours used - * @param sue_desired_height Sue autopilot desired height - * @param sue_memory_stack_free Serial UDB Extra Stack Memory Free - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f2_b_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint32_t sue_time,int16_t sue_pwm_input_1,int16_t sue_pwm_input_2,int16_t sue_pwm_input_3,int16_t sue_pwm_input_4,int16_t sue_pwm_input_5,int16_t sue_pwm_input_6,int16_t sue_pwm_input_7,int16_t sue_pwm_input_8,int16_t sue_pwm_input_9,int16_t sue_pwm_input_10,int16_t sue_pwm_input_11,int16_t sue_pwm_input_12,int16_t sue_pwm_output_1,int16_t sue_pwm_output_2,int16_t sue_pwm_output_3,int16_t sue_pwm_output_4,int16_t sue_pwm_output_5,int16_t sue_pwm_output_6,int16_t sue_pwm_output_7,int16_t sue_pwm_output_8,int16_t sue_pwm_output_9,int16_t sue_pwm_output_10,int16_t sue_pwm_output_11,int16_t sue_pwm_output_12,int16_t sue_imu_location_x,int16_t sue_imu_location_y,int16_t sue_imu_location_z,int16_t sue_location_error_earth_x,int16_t sue_location_error_earth_y,int16_t sue_location_error_earth_z,uint32_t sue_flags,int16_t sue_osc_fails,int16_t sue_imu_velocity_x,int16_t sue_imu_velocity_y,int16_t sue_imu_velocity_z,int16_t sue_waypoint_goal_x,int16_t sue_waypoint_goal_y,int16_t sue_waypoint_goal_z,int16_t sue_aero_x,int16_t sue_aero_y,int16_t sue_aero_z,int16_t sue_barom_temp,int32_t sue_barom_press,int32_t sue_barom_alt,int16_t sue_bat_volt,int16_t sue_bat_amp,int16_t sue_bat_amp_hours,int16_t sue_desired_height,int16_t sue_memory_stack_free) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_LEN]; - _mav_put_uint32_t(buf, 0, sue_time); - _mav_put_uint32_t(buf, 4, sue_flags); - _mav_put_int32_t(buf, 8, sue_barom_press); - _mav_put_int32_t(buf, 12, sue_barom_alt); - _mav_put_int16_t(buf, 16, sue_pwm_input_1); - _mav_put_int16_t(buf, 18, sue_pwm_input_2); - _mav_put_int16_t(buf, 20, sue_pwm_input_3); - _mav_put_int16_t(buf, 22, sue_pwm_input_4); - _mav_put_int16_t(buf, 24, sue_pwm_input_5); - _mav_put_int16_t(buf, 26, sue_pwm_input_6); - _mav_put_int16_t(buf, 28, sue_pwm_input_7); - _mav_put_int16_t(buf, 30, sue_pwm_input_8); - _mav_put_int16_t(buf, 32, sue_pwm_input_9); - _mav_put_int16_t(buf, 34, sue_pwm_input_10); - _mav_put_int16_t(buf, 36, sue_pwm_input_11); - _mav_put_int16_t(buf, 38, sue_pwm_input_12); - _mav_put_int16_t(buf, 40, sue_pwm_output_1); - _mav_put_int16_t(buf, 42, sue_pwm_output_2); - _mav_put_int16_t(buf, 44, sue_pwm_output_3); - _mav_put_int16_t(buf, 46, sue_pwm_output_4); - _mav_put_int16_t(buf, 48, sue_pwm_output_5); - _mav_put_int16_t(buf, 50, sue_pwm_output_6); - _mav_put_int16_t(buf, 52, sue_pwm_output_7); - _mav_put_int16_t(buf, 54, sue_pwm_output_8); - _mav_put_int16_t(buf, 56, sue_pwm_output_9); - _mav_put_int16_t(buf, 58, sue_pwm_output_10); - _mav_put_int16_t(buf, 60, sue_pwm_output_11); - _mav_put_int16_t(buf, 62, sue_pwm_output_12); - _mav_put_int16_t(buf, 64, sue_imu_location_x); - _mav_put_int16_t(buf, 66, sue_imu_location_y); - _mav_put_int16_t(buf, 68, sue_imu_location_z); - _mav_put_int16_t(buf, 70, sue_location_error_earth_x); - _mav_put_int16_t(buf, 72, sue_location_error_earth_y); - _mav_put_int16_t(buf, 74, sue_location_error_earth_z); - _mav_put_int16_t(buf, 76, sue_osc_fails); - _mav_put_int16_t(buf, 78, sue_imu_velocity_x); - _mav_put_int16_t(buf, 80, sue_imu_velocity_y); - _mav_put_int16_t(buf, 82, sue_imu_velocity_z); - _mav_put_int16_t(buf, 84, sue_waypoint_goal_x); - _mav_put_int16_t(buf, 86, sue_waypoint_goal_y); - _mav_put_int16_t(buf, 88, sue_waypoint_goal_z); - _mav_put_int16_t(buf, 90, sue_aero_x); - _mav_put_int16_t(buf, 92, sue_aero_y); - _mav_put_int16_t(buf, 94, sue_aero_z); - _mav_put_int16_t(buf, 96, sue_barom_temp); - _mav_put_int16_t(buf, 98, sue_bat_volt); - _mav_put_int16_t(buf, 100, sue_bat_amp); - _mav_put_int16_t(buf, 102, sue_bat_amp_hours); - _mav_put_int16_t(buf, 104, sue_desired_height); - _mav_put_int16_t(buf, 106, sue_memory_stack_free); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_LEN); -#else - mavlink_serial_udb_extra_f2_b_t packet; - packet.sue_time = sue_time; - packet.sue_flags = sue_flags; - packet.sue_barom_press = sue_barom_press; - packet.sue_barom_alt = sue_barom_alt; - packet.sue_pwm_input_1 = sue_pwm_input_1; - packet.sue_pwm_input_2 = sue_pwm_input_2; - packet.sue_pwm_input_3 = sue_pwm_input_3; - packet.sue_pwm_input_4 = sue_pwm_input_4; - packet.sue_pwm_input_5 = sue_pwm_input_5; - packet.sue_pwm_input_6 = sue_pwm_input_6; - packet.sue_pwm_input_7 = sue_pwm_input_7; - packet.sue_pwm_input_8 = sue_pwm_input_8; - packet.sue_pwm_input_9 = sue_pwm_input_9; - packet.sue_pwm_input_10 = sue_pwm_input_10; - packet.sue_pwm_input_11 = sue_pwm_input_11; - packet.sue_pwm_input_12 = sue_pwm_input_12; - packet.sue_pwm_output_1 = sue_pwm_output_1; - packet.sue_pwm_output_2 = sue_pwm_output_2; - packet.sue_pwm_output_3 = sue_pwm_output_3; - packet.sue_pwm_output_4 = sue_pwm_output_4; - packet.sue_pwm_output_5 = sue_pwm_output_5; - packet.sue_pwm_output_6 = sue_pwm_output_6; - packet.sue_pwm_output_7 = sue_pwm_output_7; - packet.sue_pwm_output_8 = sue_pwm_output_8; - packet.sue_pwm_output_9 = sue_pwm_output_9; - packet.sue_pwm_output_10 = sue_pwm_output_10; - packet.sue_pwm_output_11 = sue_pwm_output_11; - packet.sue_pwm_output_12 = sue_pwm_output_12; - packet.sue_imu_location_x = sue_imu_location_x; - packet.sue_imu_location_y = sue_imu_location_y; - packet.sue_imu_location_z = sue_imu_location_z; - packet.sue_location_error_earth_x = sue_location_error_earth_x; - packet.sue_location_error_earth_y = sue_location_error_earth_y; - packet.sue_location_error_earth_z = sue_location_error_earth_z; - packet.sue_osc_fails = sue_osc_fails; - packet.sue_imu_velocity_x = sue_imu_velocity_x; - packet.sue_imu_velocity_y = sue_imu_velocity_y; - packet.sue_imu_velocity_z = sue_imu_velocity_z; - packet.sue_waypoint_goal_x = sue_waypoint_goal_x; - packet.sue_waypoint_goal_y = sue_waypoint_goal_y; - packet.sue_waypoint_goal_z = sue_waypoint_goal_z; - packet.sue_aero_x = sue_aero_x; - packet.sue_aero_y = sue_aero_y; - packet.sue_aero_z = sue_aero_z; - packet.sue_barom_temp = sue_barom_temp; - packet.sue_bat_volt = sue_bat_volt; - packet.sue_bat_amp = sue_bat_amp; - packet.sue_bat_amp_hours = sue_bat_amp_hours; - packet.sue_desired_height = sue_desired_height; - packet.sue_memory_stack_free = sue_memory_stack_free; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_CRC); -} - -/** - * @brief Encode a serial_udb_extra_f2_b struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f2_b C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f2_b_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_serial_udb_extra_f2_b_t* serial_udb_extra_f2_b) -{ - return mavlink_msg_serial_udb_extra_f2_b_pack(system_id, component_id, msg, serial_udb_extra_f2_b->sue_time, serial_udb_extra_f2_b->sue_pwm_input_1, serial_udb_extra_f2_b->sue_pwm_input_2, serial_udb_extra_f2_b->sue_pwm_input_3, serial_udb_extra_f2_b->sue_pwm_input_4, serial_udb_extra_f2_b->sue_pwm_input_5, serial_udb_extra_f2_b->sue_pwm_input_6, serial_udb_extra_f2_b->sue_pwm_input_7, serial_udb_extra_f2_b->sue_pwm_input_8, serial_udb_extra_f2_b->sue_pwm_input_9, serial_udb_extra_f2_b->sue_pwm_input_10, serial_udb_extra_f2_b->sue_pwm_input_11, serial_udb_extra_f2_b->sue_pwm_input_12, serial_udb_extra_f2_b->sue_pwm_output_1, serial_udb_extra_f2_b->sue_pwm_output_2, serial_udb_extra_f2_b->sue_pwm_output_3, serial_udb_extra_f2_b->sue_pwm_output_4, serial_udb_extra_f2_b->sue_pwm_output_5, serial_udb_extra_f2_b->sue_pwm_output_6, serial_udb_extra_f2_b->sue_pwm_output_7, serial_udb_extra_f2_b->sue_pwm_output_8, serial_udb_extra_f2_b->sue_pwm_output_9, serial_udb_extra_f2_b->sue_pwm_output_10, serial_udb_extra_f2_b->sue_pwm_output_11, serial_udb_extra_f2_b->sue_pwm_output_12, serial_udb_extra_f2_b->sue_imu_location_x, serial_udb_extra_f2_b->sue_imu_location_y, serial_udb_extra_f2_b->sue_imu_location_z, serial_udb_extra_f2_b->sue_location_error_earth_x, serial_udb_extra_f2_b->sue_location_error_earth_y, serial_udb_extra_f2_b->sue_location_error_earth_z, serial_udb_extra_f2_b->sue_flags, serial_udb_extra_f2_b->sue_osc_fails, serial_udb_extra_f2_b->sue_imu_velocity_x, serial_udb_extra_f2_b->sue_imu_velocity_y, serial_udb_extra_f2_b->sue_imu_velocity_z, serial_udb_extra_f2_b->sue_waypoint_goal_x, serial_udb_extra_f2_b->sue_waypoint_goal_y, serial_udb_extra_f2_b->sue_waypoint_goal_z, serial_udb_extra_f2_b->sue_aero_x, serial_udb_extra_f2_b->sue_aero_y, serial_udb_extra_f2_b->sue_aero_z, serial_udb_extra_f2_b->sue_barom_temp, serial_udb_extra_f2_b->sue_barom_press, serial_udb_extra_f2_b->sue_barom_alt, serial_udb_extra_f2_b->sue_bat_volt, serial_udb_extra_f2_b->sue_bat_amp, serial_udb_extra_f2_b->sue_bat_amp_hours, serial_udb_extra_f2_b->sue_desired_height, serial_udb_extra_f2_b->sue_memory_stack_free); -} - -/** - * @brief Encode a serial_udb_extra_f2_b struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f2_b C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f2_b_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_serial_udb_extra_f2_b_t* serial_udb_extra_f2_b) -{ - return mavlink_msg_serial_udb_extra_f2_b_pack_chan(system_id, component_id, chan, msg, serial_udb_extra_f2_b->sue_time, serial_udb_extra_f2_b->sue_pwm_input_1, serial_udb_extra_f2_b->sue_pwm_input_2, serial_udb_extra_f2_b->sue_pwm_input_3, serial_udb_extra_f2_b->sue_pwm_input_4, serial_udb_extra_f2_b->sue_pwm_input_5, serial_udb_extra_f2_b->sue_pwm_input_6, serial_udb_extra_f2_b->sue_pwm_input_7, serial_udb_extra_f2_b->sue_pwm_input_8, serial_udb_extra_f2_b->sue_pwm_input_9, serial_udb_extra_f2_b->sue_pwm_input_10, serial_udb_extra_f2_b->sue_pwm_input_11, serial_udb_extra_f2_b->sue_pwm_input_12, serial_udb_extra_f2_b->sue_pwm_output_1, serial_udb_extra_f2_b->sue_pwm_output_2, serial_udb_extra_f2_b->sue_pwm_output_3, serial_udb_extra_f2_b->sue_pwm_output_4, serial_udb_extra_f2_b->sue_pwm_output_5, serial_udb_extra_f2_b->sue_pwm_output_6, serial_udb_extra_f2_b->sue_pwm_output_7, serial_udb_extra_f2_b->sue_pwm_output_8, serial_udb_extra_f2_b->sue_pwm_output_9, serial_udb_extra_f2_b->sue_pwm_output_10, serial_udb_extra_f2_b->sue_pwm_output_11, serial_udb_extra_f2_b->sue_pwm_output_12, serial_udb_extra_f2_b->sue_imu_location_x, serial_udb_extra_f2_b->sue_imu_location_y, serial_udb_extra_f2_b->sue_imu_location_z, serial_udb_extra_f2_b->sue_location_error_earth_x, serial_udb_extra_f2_b->sue_location_error_earth_y, serial_udb_extra_f2_b->sue_location_error_earth_z, serial_udb_extra_f2_b->sue_flags, serial_udb_extra_f2_b->sue_osc_fails, serial_udb_extra_f2_b->sue_imu_velocity_x, serial_udb_extra_f2_b->sue_imu_velocity_y, serial_udb_extra_f2_b->sue_imu_velocity_z, serial_udb_extra_f2_b->sue_waypoint_goal_x, serial_udb_extra_f2_b->sue_waypoint_goal_y, serial_udb_extra_f2_b->sue_waypoint_goal_z, serial_udb_extra_f2_b->sue_aero_x, serial_udb_extra_f2_b->sue_aero_y, serial_udb_extra_f2_b->sue_aero_z, serial_udb_extra_f2_b->sue_barom_temp, serial_udb_extra_f2_b->sue_barom_press, serial_udb_extra_f2_b->sue_barom_alt, serial_udb_extra_f2_b->sue_bat_volt, serial_udb_extra_f2_b->sue_bat_amp, serial_udb_extra_f2_b->sue_bat_amp_hours, serial_udb_extra_f2_b->sue_desired_height, serial_udb_extra_f2_b->sue_memory_stack_free); -} - -/** - * @brief Send a serial_udb_extra_f2_b message - * @param chan MAVLink channel to send the message - * - * @param sue_time Serial UDB Extra Time - * @param sue_pwm_input_1 Serial UDB Extra PWM Input Channel 1 - * @param sue_pwm_input_2 Serial UDB Extra PWM Input Channel 2 - * @param sue_pwm_input_3 Serial UDB Extra PWM Input Channel 3 - * @param sue_pwm_input_4 Serial UDB Extra PWM Input Channel 4 - * @param sue_pwm_input_5 Serial UDB Extra PWM Input Channel 5 - * @param sue_pwm_input_6 Serial UDB Extra PWM Input Channel 6 - * @param sue_pwm_input_7 Serial UDB Extra PWM Input Channel 7 - * @param sue_pwm_input_8 Serial UDB Extra PWM Input Channel 8 - * @param sue_pwm_input_9 Serial UDB Extra PWM Input Channel 9 - * @param sue_pwm_input_10 Serial UDB Extra PWM Input Channel 10 - * @param sue_pwm_input_11 Serial UDB Extra PWM Input Channel 11 - * @param sue_pwm_input_12 Serial UDB Extra PWM Input Channel 12 - * @param sue_pwm_output_1 Serial UDB Extra PWM Output Channel 1 - * @param sue_pwm_output_2 Serial UDB Extra PWM Output Channel 2 - * @param sue_pwm_output_3 Serial UDB Extra PWM Output Channel 3 - * @param sue_pwm_output_4 Serial UDB Extra PWM Output Channel 4 - * @param sue_pwm_output_5 Serial UDB Extra PWM Output Channel 5 - * @param sue_pwm_output_6 Serial UDB Extra PWM Output Channel 6 - * @param sue_pwm_output_7 Serial UDB Extra PWM Output Channel 7 - * @param sue_pwm_output_8 Serial UDB Extra PWM Output Channel 8 - * @param sue_pwm_output_9 Serial UDB Extra PWM Output Channel 9 - * @param sue_pwm_output_10 Serial UDB Extra PWM Output Channel 10 - * @param sue_pwm_output_11 Serial UDB Extra PWM Output Channel 11 - * @param sue_pwm_output_12 Serial UDB Extra PWM Output Channel 12 - * @param sue_imu_location_x Serial UDB Extra IMU Location X - * @param sue_imu_location_y Serial UDB Extra IMU Location Y - * @param sue_imu_location_z Serial UDB Extra IMU Location Z - * @param sue_location_error_earth_x Serial UDB Location Error Earth X - * @param sue_location_error_earth_y Serial UDB Location Error Earth Y - * @param sue_location_error_earth_z Serial UDB Location Error Earth Z - * @param sue_flags Serial UDB Extra Status Flags - * @param sue_osc_fails Serial UDB Extra Oscillator Failure Count - * @param sue_imu_velocity_x Serial UDB Extra IMU Velocity X - * @param sue_imu_velocity_y Serial UDB Extra IMU Velocity Y - * @param sue_imu_velocity_z Serial UDB Extra IMU Velocity Z - * @param sue_waypoint_goal_x Serial UDB Extra Current Waypoint Goal X - * @param sue_waypoint_goal_y Serial UDB Extra Current Waypoint Goal Y - * @param sue_waypoint_goal_z Serial UDB Extra Current Waypoint Goal Z - * @param sue_aero_x Aeroforce in UDB X Axis - * @param sue_aero_y Aeroforce in UDB Y Axis - * @param sue_aero_z Aeroforce in UDB Z axis - * @param sue_barom_temp SUE barometer temperature - * @param sue_barom_press SUE barometer pressure - * @param sue_barom_alt SUE barometer altitude - * @param sue_bat_volt SUE battery voltage - * @param sue_bat_amp SUE battery current - * @param sue_bat_amp_hours SUE battery milli amp hours used - * @param sue_desired_height Sue autopilot desired height - * @param sue_memory_stack_free Serial UDB Extra Stack Memory Free - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_serial_udb_extra_f2_b_send(mavlink_channel_t chan, uint32_t sue_time, int16_t sue_pwm_input_1, int16_t sue_pwm_input_2, int16_t sue_pwm_input_3, int16_t sue_pwm_input_4, int16_t sue_pwm_input_5, int16_t sue_pwm_input_6, int16_t sue_pwm_input_7, int16_t sue_pwm_input_8, int16_t sue_pwm_input_9, int16_t sue_pwm_input_10, int16_t sue_pwm_input_11, int16_t sue_pwm_input_12, int16_t sue_pwm_output_1, int16_t sue_pwm_output_2, int16_t sue_pwm_output_3, int16_t sue_pwm_output_4, int16_t sue_pwm_output_5, int16_t sue_pwm_output_6, int16_t sue_pwm_output_7, int16_t sue_pwm_output_8, int16_t sue_pwm_output_9, int16_t sue_pwm_output_10, int16_t sue_pwm_output_11, int16_t sue_pwm_output_12, int16_t sue_imu_location_x, int16_t sue_imu_location_y, int16_t sue_imu_location_z, int16_t sue_location_error_earth_x, int16_t sue_location_error_earth_y, int16_t sue_location_error_earth_z, uint32_t sue_flags, int16_t sue_osc_fails, int16_t sue_imu_velocity_x, int16_t sue_imu_velocity_y, int16_t sue_imu_velocity_z, int16_t sue_waypoint_goal_x, int16_t sue_waypoint_goal_y, int16_t sue_waypoint_goal_z, int16_t sue_aero_x, int16_t sue_aero_y, int16_t sue_aero_z, int16_t sue_barom_temp, int32_t sue_barom_press, int32_t sue_barom_alt, int16_t sue_bat_volt, int16_t sue_bat_amp, int16_t sue_bat_amp_hours, int16_t sue_desired_height, int16_t sue_memory_stack_free) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_LEN]; - _mav_put_uint32_t(buf, 0, sue_time); - _mav_put_uint32_t(buf, 4, sue_flags); - _mav_put_int32_t(buf, 8, sue_barom_press); - _mav_put_int32_t(buf, 12, sue_barom_alt); - _mav_put_int16_t(buf, 16, sue_pwm_input_1); - _mav_put_int16_t(buf, 18, sue_pwm_input_2); - _mav_put_int16_t(buf, 20, sue_pwm_input_3); - _mav_put_int16_t(buf, 22, sue_pwm_input_4); - _mav_put_int16_t(buf, 24, sue_pwm_input_5); - _mav_put_int16_t(buf, 26, sue_pwm_input_6); - _mav_put_int16_t(buf, 28, sue_pwm_input_7); - _mav_put_int16_t(buf, 30, sue_pwm_input_8); - _mav_put_int16_t(buf, 32, sue_pwm_input_9); - _mav_put_int16_t(buf, 34, sue_pwm_input_10); - _mav_put_int16_t(buf, 36, sue_pwm_input_11); - _mav_put_int16_t(buf, 38, sue_pwm_input_12); - _mav_put_int16_t(buf, 40, sue_pwm_output_1); - _mav_put_int16_t(buf, 42, sue_pwm_output_2); - _mav_put_int16_t(buf, 44, sue_pwm_output_3); - _mav_put_int16_t(buf, 46, sue_pwm_output_4); - _mav_put_int16_t(buf, 48, sue_pwm_output_5); - _mav_put_int16_t(buf, 50, sue_pwm_output_6); - _mav_put_int16_t(buf, 52, sue_pwm_output_7); - _mav_put_int16_t(buf, 54, sue_pwm_output_8); - _mav_put_int16_t(buf, 56, sue_pwm_output_9); - _mav_put_int16_t(buf, 58, sue_pwm_output_10); - _mav_put_int16_t(buf, 60, sue_pwm_output_11); - _mav_put_int16_t(buf, 62, sue_pwm_output_12); - _mav_put_int16_t(buf, 64, sue_imu_location_x); - _mav_put_int16_t(buf, 66, sue_imu_location_y); - _mav_put_int16_t(buf, 68, sue_imu_location_z); - _mav_put_int16_t(buf, 70, sue_location_error_earth_x); - _mav_put_int16_t(buf, 72, sue_location_error_earth_y); - _mav_put_int16_t(buf, 74, sue_location_error_earth_z); - _mav_put_int16_t(buf, 76, sue_osc_fails); - _mav_put_int16_t(buf, 78, sue_imu_velocity_x); - _mav_put_int16_t(buf, 80, sue_imu_velocity_y); - _mav_put_int16_t(buf, 82, sue_imu_velocity_z); - _mav_put_int16_t(buf, 84, sue_waypoint_goal_x); - _mav_put_int16_t(buf, 86, sue_waypoint_goal_y); - _mav_put_int16_t(buf, 88, sue_waypoint_goal_z); - _mav_put_int16_t(buf, 90, sue_aero_x); - _mav_put_int16_t(buf, 92, sue_aero_y); - _mav_put_int16_t(buf, 94, sue_aero_z); - _mav_put_int16_t(buf, 96, sue_barom_temp); - _mav_put_int16_t(buf, 98, sue_bat_volt); - _mav_put_int16_t(buf, 100, sue_bat_amp); - _mav_put_int16_t(buf, 102, sue_bat_amp_hours); - _mav_put_int16_t(buf, 104, sue_desired_height); - _mav_put_int16_t(buf, 106, sue_memory_stack_free); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_CRC); -#else - mavlink_serial_udb_extra_f2_b_t packet; - packet.sue_time = sue_time; - packet.sue_flags = sue_flags; - packet.sue_barom_press = sue_barom_press; - packet.sue_barom_alt = sue_barom_alt; - packet.sue_pwm_input_1 = sue_pwm_input_1; - packet.sue_pwm_input_2 = sue_pwm_input_2; - packet.sue_pwm_input_3 = sue_pwm_input_3; - packet.sue_pwm_input_4 = sue_pwm_input_4; - packet.sue_pwm_input_5 = sue_pwm_input_5; - packet.sue_pwm_input_6 = sue_pwm_input_6; - packet.sue_pwm_input_7 = sue_pwm_input_7; - packet.sue_pwm_input_8 = sue_pwm_input_8; - packet.sue_pwm_input_9 = sue_pwm_input_9; - packet.sue_pwm_input_10 = sue_pwm_input_10; - packet.sue_pwm_input_11 = sue_pwm_input_11; - packet.sue_pwm_input_12 = sue_pwm_input_12; - packet.sue_pwm_output_1 = sue_pwm_output_1; - packet.sue_pwm_output_2 = sue_pwm_output_2; - packet.sue_pwm_output_3 = sue_pwm_output_3; - packet.sue_pwm_output_4 = sue_pwm_output_4; - packet.sue_pwm_output_5 = sue_pwm_output_5; - packet.sue_pwm_output_6 = sue_pwm_output_6; - packet.sue_pwm_output_7 = sue_pwm_output_7; - packet.sue_pwm_output_8 = sue_pwm_output_8; - packet.sue_pwm_output_9 = sue_pwm_output_9; - packet.sue_pwm_output_10 = sue_pwm_output_10; - packet.sue_pwm_output_11 = sue_pwm_output_11; - packet.sue_pwm_output_12 = sue_pwm_output_12; - packet.sue_imu_location_x = sue_imu_location_x; - packet.sue_imu_location_y = sue_imu_location_y; - packet.sue_imu_location_z = sue_imu_location_z; - packet.sue_location_error_earth_x = sue_location_error_earth_x; - packet.sue_location_error_earth_y = sue_location_error_earth_y; - packet.sue_location_error_earth_z = sue_location_error_earth_z; - packet.sue_osc_fails = sue_osc_fails; - packet.sue_imu_velocity_x = sue_imu_velocity_x; - packet.sue_imu_velocity_y = sue_imu_velocity_y; - packet.sue_imu_velocity_z = sue_imu_velocity_z; - packet.sue_waypoint_goal_x = sue_waypoint_goal_x; - packet.sue_waypoint_goal_y = sue_waypoint_goal_y; - packet.sue_waypoint_goal_z = sue_waypoint_goal_z; - packet.sue_aero_x = sue_aero_x; - packet.sue_aero_y = sue_aero_y; - packet.sue_aero_z = sue_aero_z; - packet.sue_barom_temp = sue_barom_temp; - packet.sue_bat_volt = sue_bat_volt; - packet.sue_bat_amp = sue_bat_amp; - packet.sue_bat_amp_hours = sue_bat_amp_hours; - packet.sue_desired_height = sue_desired_height; - packet.sue_memory_stack_free = sue_memory_stack_free; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B, (const char *)&packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_CRC); -#endif -} - -/** - * @brief Send a serial_udb_extra_f2_b message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_serial_udb_extra_f2_b_send_struct(mavlink_channel_t chan, const mavlink_serial_udb_extra_f2_b_t* serial_udb_extra_f2_b) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_serial_udb_extra_f2_b_send(chan, serial_udb_extra_f2_b->sue_time, serial_udb_extra_f2_b->sue_pwm_input_1, serial_udb_extra_f2_b->sue_pwm_input_2, serial_udb_extra_f2_b->sue_pwm_input_3, serial_udb_extra_f2_b->sue_pwm_input_4, serial_udb_extra_f2_b->sue_pwm_input_5, serial_udb_extra_f2_b->sue_pwm_input_6, serial_udb_extra_f2_b->sue_pwm_input_7, serial_udb_extra_f2_b->sue_pwm_input_8, serial_udb_extra_f2_b->sue_pwm_input_9, serial_udb_extra_f2_b->sue_pwm_input_10, serial_udb_extra_f2_b->sue_pwm_input_11, serial_udb_extra_f2_b->sue_pwm_input_12, serial_udb_extra_f2_b->sue_pwm_output_1, serial_udb_extra_f2_b->sue_pwm_output_2, serial_udb_extra_f2_b->sue_pwm_output_3, serial_udb_extra_f2_b->sue_pwm_output_4, serial_udb_extra_f2_b->sue_pwm_output_5, serial_udb_extra_f2_b->sue_pwm_output_6, serial_udb_extra_f2_b->sue_pwm_output_7, serial_udb_extra_f2_b->sue_pwm_output_8, serial_udb_extra_f2_b->sue_pwm_output_9, serial_udb_extra_f2_b->sue_pwm_output_10, serial_udb_extra_f2_b->sue_pwm_output_11, serial_udb_extra_f2_b->sue_pwm_output_12, serial_udb_extra_f2_b->sue_imu_location_x, serial_udb_extra_f2_b->sue_imu_location_y, serial_udb_extra_f2_b->sue_imu_location_z, serial_udb_extra_f2_b->sue_location_error_earth_x, serial_udb_extra_f2_b->sue_location_error_earth_y, serial_udb_extra_f2_b->sue_location_error_earth_z, serial_udb_extra_f2_b->sue_flags, serial_udb_extra_f2_b->sue_osc_fails, serial_udb_extra_f2_b->sue_imu_velocity_x, serial_udb_extra_f2_b->sue_imu_velocity_y, serial_udb_extra_f2_b->sue_imu_velocity_z, serial_udb_extra_f2_b->sue_waypoint_goal_x, serial_udb_extra_f2_b->sue_waypoint_goal_y, serial_udb_extra_f2_b->sue_waypoint_goal_z, serial_udb_extra_f2_b->sue_aero_x, serial_udb_extra_f2_b->sue_aero_y, serial_udb_extra_f2_b->sue_aero_z, serial_udb_extra_f2_b->sue_barom_temp, serial_udb_extra_f2_b->sue_barom_press, serial_udb_extra_f2_b->sue_barom_alt, serial_udb_extra_f2_b->sue_bat_volt, serial_udb_extra_f2_b->sue_bat_amp, serial_udb_extra_f2_b->sue_bat_amp_hours, serial_udb_extra_f2_b->sue_desired_height, serial_udb_extra_f2_b->sue_memory_stack_free); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B, (const char *)serial_udb_extra_f2_b, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_CRC); -#endif -} - -#if MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_serial_udb_extra_f2_b_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t sue_time, int16_t sue_pwm_input_1, int16_t sue_pwm_input_2, int16_t sue_pwm_input_3, int16_t sue_pwm_input_4, int16_t sue_pwm_input_5, int16_t sue_pwm_input_6, int16_t sue_pwm_input_7, int16_t sue_pwm_input_8, int16_t sue_pwm_input_9, int16_t sue_pwm_input_10, int16_t sue_pwm_input_11, int16_t sue_pwm_input_12, int16_t sue_pwm_output_1, int16_t sue_pwm_output_2, int16_t sue_pwm_output_3, int16_t sue_pwm_output_4, int16_t sue_pwm_output_5, int16_t sue_pwm_output_6, int16_t sue_pwm_output_7, int16_t sue_pwm_output_8, int16_t sue_pwm_output_9, int16_t sue_pwm_output_10, int16_t sue_pwm_output_11, int16_t sue_pwm_output_12, int16_t sue_imu_location_x, int16_t sue_imu_location_y, int16_t sue_imu_location_z, int16_t sue_location_error_earth_x, int16_t sue_location_error_earth_y, int16_t sue_location_error_earth_z, uint32_t sue_flags, int16_t sue_osc_fails, int16_t sue_imu_velocity_x, int16_t sue_imu_velocity_y, int16_t sue_imu_velocity_z, int16_t sue_waypoint_goal_x, int16_t sue_waypoint_goal_y, int16_t sue_waypoint_goal_z, int16_t sue_aero_x, int16_t sue_aero_y, int16_t sue_aero_z, int16_t sue_barom_temp, int32_t sue_barom_press, int32_t sue_barom_alt, int16_t sue_bat_volt, int16_t sue_bat_amp, int16_t sue_bat_amp_hours, int16_t sue_desired_height, int16_t sue_memory_stack_free) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint32_t(buf, 0, sue_time); - _mav_put_uint32_t(buf, 4, sue_flags); - _mav_put_int32_t(buf, 8, sue_barom_press); - _mav_put_int32_t(buf, 12, sue_barom_alt); - _mav_put_int16_t(buf, 16, sue_pwm_input_1); - _mav_put_int16_t(buf, 18, sue_pwm_input_2); - _mav_put_int16_t(buf, 20, sue_pwm_input_3); - _mav_put_int16_t(buf, 22, sue_pwm_input_4); - _mav_put_int16_t(buf, 24, sue_pwm_input_5); - _mav_put_int16_t(buf, 26, sue_pwm_input_6); - _mav_put_int16_t(buf, 28, sue_pwm_input_7); - _mav_put_int16_t(buf, 30, sue_pwm_input_8); - _mav_put_int16_t(buf, 32, sue_pwm_input_9); - _mav_put_int16_t(buf, 34, sue_pwm_input_10); - _mav_put_int16_t(buf, 36, sue_pwm_input_11); - _mav_put_int16_t(buf, 38, sue_pwm_input_12); - _mav_put_int16_t(buf, 40, sue_pwm_output_1); - _mav_put_int16_t(buf, 42, sue_pwm_output_2); - _mav_put_int16_t(buf, 44, sue_pwm_output_3); - _mav_put_int16_t(buf, 46, sue_pwm_output_4); - _mav_put_int16_t(buf, 48, sue_pwm_output_5); - _mav_put_int16_t(buf, 50, sue_pwm_output_6); - _mav_put_int16_t(buf, 52, sue_pwm_output_7); - _mav_put_int16_t(buf, 54, sue_pwm_output_8); - _mav_put_int16_t(buf, 56, sue_pwm_output_9); - _mav_put_int16_t(buf, 58, sue_pwm_output_10); - _mav_put_int16_t(buf, 60, sue_pwm_output_11); - _mav_put_int16_t(buf, 62, sue_pwm_output_12); - _mav_put_int16_t(buf, 64, sue_imu_location_x); - _mav_put_int16_t(buf, 66, sue_imu_location_y); - _mav_put_int16_t(buf, 68, sue_imu_location_z); - _mav_put_int16_t(buf, 70, sue_location_error_earth_x); - _mav_put_int16_t(buf, 72, sue_location_error_earth_y); - _mav_put_int16_t(buf, 74, sue_location_error_earth_z); - _mav_put_int16_t(buf, 76, sue_osc_fails); - _mav_put_int16_t(buf, 78, sue_imu_velocity_x); - _mav_put_int16_t(buf, 80, sue_imu_velocity_y); - _mav_put_int16_t(buf, 82, sue_imu_velocity_z); - _mav_put_int16_t(buf, 84, sue_waypoint_goal_x); - _mav_put_int16_t(buf, 86, sue_waypoint_goal_y); - _mav_put_int16_t(buf, 88, sue_waypoint_goal_z); - _mav_put_int16_t(buf, 90, sue_aero_x); - _mav_put_int16_t(buf, 92, sue_aero_y); - _mav_put_int16_t(buf, 94, sue_aero_z); - _mav_put_int16_t(buf, 96, sue_barom_temp); - _mav_put_int16_t(buf, 98, sue_bat_volt); - _mav_put_int16_t(buf, 100, sue_bat_amp); - _mav_put_int16_t(buf, 102, sue_bat_amp_hours); - _mav_put_int16_t(buf, 104, sue_desired_height); - _mav_put_int16_t(buf, 106, sue_memory_stack_free); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_CRC); -#else - mavlink_serial_udb_extra_f2_b_t *packet = (mavlink_serial_udb_extra_f2_b_t *)msgbuf; - packet->sue_time = sue_time; - packet->sue_flags = sue_flags; - packet->sue_barom_press = sue_barom_press; - packet->sue_barom_alt = sue_barom_alt; - packet->sue_pwm_input_1 = sue_pwm_input_1; - packet->sue_pwm_input_2 = sue_pwm_input_2; - packet->sue_pwm_input_3 = sue_pwm_input_3; - packet->sue_pwm_input_4 = sue_pwm_input_4; - packet->sue_pwm_input_5 = sue_pwm_input_5; - packet->sue_pwm_input_6 = sue_pwm_input_6; - packet->sue_pwm_input_7 = sue_pwm_input_7; - packet->sue_pwm_input_8 = sue_pwm_input_8; - packet->sue_pwm_input_9 = sue_pwm_input_9; - packet->sue_pwm_input_10 = sue_pwm_input_10; - packet->sue_pwm_input_11 = sue_pwm_input_11; - packet->sue_pwm_input_12 = sue_pwm_input_12; - packet->sue_pwm_output_1 = sue_pwm_output_1; - packet->sue_pwm_output_2 = sue_pwm_output_2; - packet->sue_pwm_output_3 = sue_pwm_output_3; - packet->sue_pwm_output_4 = sue_pwm_output_4; - packet->sue_pwm_output_5 = sue_pwm_output_5; - packet->sue_pwm_output_6 = sue_pwm_output_6; - packet->sue_pwm_output_7 = sue_pwm_output_7; - packet->sue_pwm_output_8 = sue_pwm_output_8; - packet->sue_pwm_output_9 = sue_pwm_output_9; - packet->sue_pwm_output_10 = sue_pwm_output_10; - packet->sue_pwm_output_11 = sue_pwm_output_11; - packet->sue_pwm_output_12 = sue_pwm_output_12; - packet->sue_imu_location_x = sue_imu_location_x; - packet->sue_imu_location_y = sue_imu_location_y; - packet->sue_imu_location_z = sue_imu_location_z; - packet->sue_location_error_earth_x = sue_location_error_earth_x; - packet->sue_location_error_earth_y = sue_location_error_earth_y; - packet->sue_location_error_earth_z = sue_location_error_earth_z; - packet->sue_osc_fails = sue_osc_fails; - packet->sue_imu_velocity_x = sue_imu_velocity_x; - packet->sue_imu_velocity_y = sue_imu_velocity_y; - packet->sue_imu_velocity_z = sue_imu_velocity_z; - packet->sue_waypoint_goal_x = sue_waypoint_goal_x; - packet->sue_waypoint_goal_y = sue_waypoint_goal_y; - packet->sue_waypoint_goal_z = sue_waypoint_goal_z; - packet->sue_aero_x = sue_aero_x; - packet->sue_aero_y = sue_aero_y; - packet->sue_aero_z = sue_aero_z; - packet->sue_barom_temp = sue_barom_temp; - packet->sue_bat_volt = sue_bat_volt; - packet->sue_bat_amp = sue_bat_amp; - packet->sue_bat_amp_hours = sue_bat_amp_hours; - packet->sue_desired_height = sue_desired_height; - packet->sue_memory_stack_free = sue_memory_stack_free; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B, (const char *)packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_CRC); -#endif -} -#endif - -#endif - -// MESSAGE SERIAL_UDB_EXTRA_F2_B UNPACKING - - -/** - * @brief Get field sue_time from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra Time - */ -static inline uint32_t mavlink_msg_serial_udb_extra_f2_b_get_sue_time(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 0); -} - -/** - * @brief Get field sue_pwm_input_1 from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra PWM Input Channel 1 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_input_1(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 16); -} - -/** - * @brief Get field sue_pwm_input_2 from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra PWM Input Channel 2 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_input_2(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 18); -} - -/** - * @brief Get field sue_pwm_input_3 from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra PWM Input Channel 3 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_input_3(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 20); -} - -/** - * @brief Get field sue_pwm_input_4 from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra PWM Input Channel 4 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_input_4(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 22); -} - -/** - * @brief Get field sue_pwm_input_5 from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra PWM Input Channel 5 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_input_5(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 24); -} - -/** - * @brief Get field sue_pwm_input_6 from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra PWM Input Channel 6 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_input_6(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 26); -} - -/** - * @brief Get field sue_pwm_input_7 from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra PWM Input Channel 7 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_input_7(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 28); -} - -/** - * @brief Get field sue_pwm_input_8 from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra PWM Input Channel 8 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_input_8(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 30); -} - -/** - * @brief Get field sue_pwm_input_9 from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra PWM Input Channel 9 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_input_9(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 32); -} - -/** - * @brief Get field sue_pwm_input_10 from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra PWM Input Channel 10 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_input_10(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 34); -} - -/** - * @brief Get field sue_pwm_input_11 from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra PWM Input Channel 11 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_input_11(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 36); -} - -/** - * @brief Get field sue_pwm_input_12 from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra PWM Input Channel 12 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_input_12(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 38); -} - -/** - * @brief Get field sue_pwm_output_1 from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra PWM Output Channel 1 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_output_1(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 40); -} - -/** - * @brief Get field sue_pwm_output_2 from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra PWM Output Channel 2 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_output_2(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 42); -} - -/** - * @brief Get field sue_pwm_output_3 from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra PWM Output Channel 3 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_output_3(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 44); -} - -/** - * @brief Get field sue_pwm_output_4 from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra PWM Output Channel 4 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_output_4(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 46); -} - -/** - * @brief Get field sue_pwm_output_5 from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra PWM Output Channel 5 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_output_5(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 48); -} - -/** - * @brief Get field sue_pwm_output_6 from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra PWM Output Channel 6 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_output_6(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 50); -} - -/** - * @brief Get field sue_pwm_output_7 from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra PWM Output Channel 7 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_output_7(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 52); -} - -/** - * @brief Get field sue_pwm_output_8 from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra PWM Output Channel 8 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_output_8(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 54); -} - -/** - * @brief Get field sue_pwm_output_9 from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra PWM Output Channel 9 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_output_9(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 56); -} - -/** - * @brief Get field sue_pwm_output_10 from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra PWM Output Channel 10 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_output_10(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 58); -} - -/** - * @brief Get field sue_pwm_output_11 from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra PWM Output Channel 11 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_output_11(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 60); -} - -/** - * @brief Get field sue_pwm_output_12 from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra PWM Output Channel 12 - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_output_12(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 62); -} - -/** - * @brief Get field sue_imu_location_x from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra IMU Location X - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_imu_location_x(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 64); -} - -/** - * @brief Get field sue_imu_location_y from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra IMU Location Y - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_imu_location_y(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 66); -} - -/** - * @brief Get field sue_imu_location_z from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra IMU Location Z - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_imu_location_z(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 68); -} - -/** - * @brief Get field sue_location_error_earth_x from serial_udb_extra_f2_b message - * - * @return Serial UDB Location Error Earth X - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_location_error_earth_x(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 70); -} - -/** - * @brief Get field sue_location_error_earth_y from serial_udb_extra_f2_b message - * - * @return Serial UDB Location Error Earth Y - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_location_error_earth_y(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 72); -} - -/** - * @brief Get field sue_location_error_earth_z from serial_udb_extra_f2_b message - * - * @return Serial UDB Location Error Earth Z - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_location_error_earth_z(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 74); -} - -/** - * @brief Get field sue_flags from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra Status Flags - */ -static inline uint32_t mavlink_msg_serial_udb_extra_f2_b_get_sue_flags(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 4); -} - -/** - * @brief Get field sue_osc_fails from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra Oscillator Failure Count - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_osc_fails(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 76); -} - -/** - * @brief Get field sue_imu_velocity_x from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra IMU Velocity X - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_imu_velocity_x(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 78); -} - -/** - * @brief Get field sue_imu_velocity_y from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra IMU Velocity Y - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_imu_velocity_y(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 80); -} - -/** - * @brief Get field sue_imu_velocity_z from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra IMU Velocity Z - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_imu_velocity_z(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 82); -} - -/** - * @brief Get field sue_waypoint_goal_x from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra Current Waypoint Goal X - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_waypoint_goal_x(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 84); -} - -/** - * @brief Get field sue_waypoint_goal_y from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra Current Waypoint Goal Y - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_waypoint_goal_y(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 86); -} - -/** - * @brief Get field sue_waypoint_goal_z from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra Current Waypoint Goal Z - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_waypoint_goal_z(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 88); -} - -/** - * @brief Get field sue_aero_x from serial_udb_extra_f2_b message - * - * @return Aeroforce in UDB X Axis - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_aero_x(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 90); -} - -/** - * @brief Get field sue_aero_y from serial_udb_extra_f2_b message - * - * @return Aeroforce in UDB Y Axis - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_aero_y(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 92); -} - -/** - * @brief Get field sue_aero_z from serial_udb_extra_f2_b message - * - * @return Aeroforce in UDB Z axis - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_aero_z(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 94); -} - -/** - * @brief Get field sue_barom_temp from serial_udb_extra_f2_b message - * - * @return SUE barometer temperature - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_barom_temp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 96); -} - -/** - * @brief Get field sue_barom_press from serial_udb_extra_f2_b message - * - * @return SUE barometer pressure - */ -static inline int32_t mavlink_msg_serial_udb_extra_f2_b_get_sue_barom_press(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 8); -} - -/** - * @brief Get field sue_barom_alt from serial_udb_extra_f2_b message - * - * @return SUE barometer altitude - */ -static inline int32_t mavlink_msg_serial_udb_extra_f2_b_get_sue_barom_alt(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 12); -} - -/** - * @brief Get field sue_bat_volt from serial_udb_extra_f2_b message - * - * @return SUE battery voltage - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_bat_volt(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 98); -} - -/** - * @brief Get field sue_bat_amp from serial_udb_extra_f2_b message - * - * @return SUE battery current - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_bat_amp(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 100); -} - -/** - * @brief Get field sue_bat_amp_hours from serial_udb_extra_f2_b message - * - * @return SUE battery milli amp hours used - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_bat_amp_hours(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 102); -} - -/** - * @brief Get field sue_desired_height from serial_udb_extra_f2_b message - * - * @return Sue autopilot desired height - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_desired_height(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 104); -} - -/** - * @brief Get field sue_memory_stack_free from serial_udb_extra_f2_b message - * - * @return Serial UDB Extra Stack Memory Free - */ -static inline int16_t mavlink_msg_serial_udb_extra_f2_b_get_sue_memory_stack_free(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 106); -} - -/** - * @brief Decode a serial_udb_extra_f2_b message into a struct - * - * @param msg The message to decode - * @param serial_udb_extra_f2_b C-struct to decode the message contents into - */ -static inline void mavlink_msg_serial_udb_extra_f2_b_decode(const mavlink_message_t* msg, mavlink_serial_udb_extra_f2_b_t* serial_udb_extra_f2_b) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - serial_udb_extra_f2_b->sue_time = mavlink_msg_serial_udb_extra_f2_b_get_sue_time(msg); - serial_udb_extra_f2_b->sue_flags = mavlink_msg_serial_udb_extra_f2_b_get_sue_flags(msg); - serial_udb_extra_f2_b->sue_barom_press = mavlink_msg_serial_udb_extra_f2_b_get_sue_barom_press(msg); - serial_udb_extra_f2_b->sue_barom_alt = mavlink_msg_serial_udb_extra_f2_b_get_sue_barom_alt(msg); - serial_udb_extra_f2_b->sue_pwm_input_1 = mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_input_1(msg); - serial_udb_extra_f2_b->sue_pwm_input_2 = mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_input_2(msg); - serial_udb_extra_f2_b->sue_pwm_input_3 = mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_input_3(msg); - serial_udb_extra_f2_b->sue_pwm_input_4 = mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_input_4(msg); - serial_udb_extra_f2_b->sue_pwm_input_5 = mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_input_5(msg); - serial_udb_extra_f2_b->sue_pwm_input_6 = mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_input_6(msg); - serial_udb_extra_f2_b->sue_pwm_input_7 = mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_input_7(msg); - serial_udb_extra_f2_b->sue_pwm_input_8 = mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_input_8(msg); - serial_udb_extra_f2_b->sue_pwm_input_9 = mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_input_9(msg); - serial_udb_extra_f2_b->sue_pwm_input_10 = mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_input_10(msg); - serial_udb_extra_f2_b->sue_pwm_input_11 = mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_input_11(msg); - serial_udb_extra_f2_b->sue_pwm_input_12 = mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_input_12(msg); - serial_udb_extra_f2_b->sue_pwm_output_1 = mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_output_1(msg); - serial_udb_extra_f2_b->sue_pwm_output_2 = mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_output_2(msg); - serial_udb_extra_f2_b->sue_pwm_output_3 = mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_output_3(msg); - serial_udb_extra_f2_b->sue_pwm_output_4 = mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_output_4(msg); - serial_udb_extra_f2_b->sue_pwm_output_5 = mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_output_5(msg); - serial_udb_extra_f2_b->sue_pwm_output_6 = mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_output_6(msg); - serial_udb_extra_f2_b->sue_pwm_output_7 = mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_output_7(msg); - serial_udb_extra_f2_b->sue_pwm_output_8 = mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_output_8(msg); - serial_udb_extra_f2_b->sue_pwm_output_9 = mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_output_9(msg); - serial_udb_extra_f2_b->sue_pwm_output_10 = mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_output_10(msg); - serial_udb_extra_f2_b->sue_pwm_output_11 = mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_output_11(msg); - serial_udb_extra_f2_b->sue_pwm_output_12 = mavlink_msg_serial_udb_extra_f2_b_get_sue_pwm_output_12(msg); - serial_udb_extra_f2_b->sue_imu_location_x = mavlink_msg_serial_udb_extra_f2_b_get_sue_imu_location_x(msg); - serial_udb_extra_f2_b->sue_imu_location_y = mavlink_msg_serial_udb_extra_f2_b_get_sue_imu_location_y(msg); - serial_udb_extra_f2_b->sue_imu_location_z = mavlink_msg_serial_udb_extra_f2_b_get_sue_imu_location_z(msg); - serial_udb_extra_f2_b->sue_location_error_earth_x = mavlink_msg_serial_udb_extra_f2_b_get_sue_location_error_earth_x(msg); - serial_udb_extra_f2_b->sue_location_error_earth_y = mavlink_msg_serial_udb_extra_f2_b_get_sue_location_error_earth_y(msg); - serial_udb_extra_f2_b->sue_location_error_earth_z = mavlink_msg_serial_udb_extra_f2_b_get_sue_location_error_earth_z(msg); - serial_udb_extra_f2_b->sue_osc_fails = mavlink_msg_serial_udb_extra_f2_b_get_sue_osc_fails(msg); - serial_udb_extra_f2_b->sue_imu_velocity_x = mavlink_msg_serial_udb_extra_f2_b_get_sue_imu_velocity_x(msg); - serial_udb_extra_f2_b->sue_imu_velocity_y = mavlink_msg_serial_udb_extra_f2_b_get_sue_imu_velocity_y(msg); - serial_udb_extra_f2_b->sue_imu_velocity_z = mavlink_msg_serial_udb_extra_f2_b_get_sue_imu_velocity_z(msg); - serial_udb_extra_f2_b->sue_waypoint_goal_x = mavlink_msg_serial_udb_extra_f2_b_get_sue_waypoint_goal_x(msg); - serial_udb_extra_f2_b->sue_waypoint_goal_y = mavlink_msg_serial_udb_extra_f2_b_get_sue_waypoint_goal_y(msg); - serial_udb_extra_f2_b->sue_waypoint_goal_z = mavlink_msg_serial_udb_extra_f2_b_get_sue_waypoint_goal_z(msg); - serial_udb_extra_f2_b->sue_aero_x = mavlink_msg_serial_udb_extra_f2_b_get_sue_aero_x(msg); - serial_udb_extra_f2_b->sue_aero_y = mavlink_msg_serial_udb_extra_f2_b_get_sue_aero_y(msg); - serial_udb_extra_f2_b->sue_aero_z = mavlink_msg_serial_udb_extra_f2_b_get_sue_aero_z(msg); - serial_udb_extra_f2_b->sue_barom_temp = mavlink_msg_serial_udb_extra_f2_b_get_sue_barom_temp(msg); - serial_udb_extra_f2_b->sue_bat_volt = mavlink_msg_serial_udb_extra_f2_b_get_sue_bat_volt(msg); - serial_udb_extra_f2_b->sue_bat_amp = mavlink_msg_serial_udb_extra_f2_b_get_sue_bat_amp(msg); - serial_udb_extra_f2_b->sue_bat_amp_hours = mavlink_msg_serial_udb_extra_f2_b_get_sue_bat_amp_hours(msg); - serial_udb_extra_f2_b->sue_desired_height = mavlink_msg_serial_udb_extra_f2_b_get_sue_desired_height(msg); - serial_udb_extra_f2_b->sue_memory_stack_free = mavlink_msg_serial_udb_extra_f2_b_get_sue_memory_stack_free(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_LEN? msg->len : MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_LEN; - memset(serial_udb_extra_f2_b, 0, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_LEN); - memcpy(serial_udb_extra_f2_b, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/matrixpilot/mavlink_msg_serial_udb_extra_f4.h b/matrixpilot/mavlink_msg_serial_udb_extra_f4.h deleted file mode 100644 index cd6d5d27a..000000000 --- a/matrixpilot/mavlink_msg_serial_udb_extra_f4.h +++ /dev/null @@ -1,438 +0,0 @@ -#pragma once -// MESSAGE SERIAL_UDB_EXTRA_F4 PACKING - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4 172 - - -typedef struct __mavlink_serial_udb_extra_f4_t { - uint8_t sue_ROLL_STABILIZATION_AILERONS; /*< Serial UDB Extra Roll Stabilization with Ailerons Enabled*/ - uint8_t sue_ROLL_STABILIZATION_RUDDER; /*< Serial UDB Extra Roll Stabilization with Rudder Enabled*/ - uint8_t sue_PITCH_STABILIZATION; /*< Serial UDB Extra Pitch Stabilization Enabled*/ - uint8_t sue_YAW_STABILIZATION_RUDDER; /*< Serial UDB Extra Yaw Stabilization using Rudder Enabled*/ - uint8_t sue_YAW_STABILIZATION_AILERON; /*< Serial UDB Extra Yaw Stabilization using Ailerons Enabled*/ - uint8_t sue_AILERON_NAVIGATION; /*< Serial UDB Extra Navigation with Ailerons Enabled*/ - uint8_t sue_RUDDER_NAVIGATION; /*< Serial UDB Extra Navigation with Rudder Enabled*/ - uint8_t sue_ALTITUDEHOLD_STABILIZED; /*< Serial UDB Extra Type of Alitude Hold when in Stabilized Mode*/ - uint8_t sue_ALTITUDEHOLD_WAYPOINT; /*< Serial UDB Extra Type of Alitude Hold when in Waypoint Mode*/ - uint8_t sue_RACING_MODE; /*< Serial UDB Extra Firmware racing mode enabled*/ -} mavlink_serial_udb_extra_f4_t; - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_LEN 10 -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_MIN_LEN 10 -#define MAVLINK_MSG_ID_172_LEN 10 -#define MAVLINK_MSG_ID_172_MIN_LEN 10 - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_CRC 191 -#define MAVLINK_MSG_ID_172_CRC 191 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F4 { \ - 172, \ - "SERIAL_UDB_EXTRA_F4", \ - 10, \ - { { "sue_ROLL_STABILIZATION_AILERONS", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_serial_udb_extra_f4_t, sue_ROLL_STABILIZATION_AILERONS) }, \ - { "sue_ROLL_STABILIZATION_RUDDER", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_serial_udb_extra_f4_t, sue_ROLL_STABILIZATION_RUDDER) }, \ - { "sue_PITCH_STABILIZATION", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_serial_udb_extra_f4_t, sue_PITCH_STABILIZATION) }, \ - { "sue_YAW_STABILIZATION_RUDDER", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_serial_udb_extra_f4_t, sue_YAW_STABILIZATION_RUDDER) }, \ - { "sue_YAW_STABILIZATION_AILERON", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_serial_udb_extra_f4_t, sue_YAW_STABILIZATION_AILERON) }, \ - { "sue_AILERON_NAVIGATION", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_serial_udb_extra_f4_t, sue_AILERON_NAVIGATION) }, \ - { "sue_RUDDER_NAVIGATION", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_serial_udb_extra_f4_t, sue_RUDDER_NAVIGATION) }, \ - { "sue_ALTITUDEHOLD_STABILIZED", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_serial_udb_extra_f4_t, sue_ALTITUDEHOLD_STABILIZED) }, \ - { "sue_ALTITUDEHOLD_WAYPOINT", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_serial_udb_extra_f4_t, sue_ALTITUDEHOLD_WAYPOINT) }, \ - { "sue_RACING_MODE", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_serial_udb_extra_f4_t, sue_RACING_MODE) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F4 { \ - "SERIAL_UDB_EXTRA_F4", \ - 10, \ - { { "sue_ROLL_STABILIZATION_AILERONS", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_serial_udb_extra_f4_t, sue_ROLL_STABILIZATION_AILERONS) }, \ - { "sue_ROLL_STABILIZATION_RUDDER", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_serial_udb_extra_f4_t, sue_ROLL_STABILIZATION_RUDDER) }, \ - { "sue_PITCH_STABILIZATION", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_serial_udb_extra_f4_t, sue_PITCH_STABILIZATION) }, \ - { "sue_YAW_STABILIZATION_RUDDER", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_serial_udb_extra_f4_t, sue_YAW_STABILIZATION_RUDDER) }, \ - { "sue_YAW_STABILIZATION_AILERON", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_serial_udb_extra_f4_t, sue_YAW_STABILIZATION_AILERON) }, \ - { "sue_AILERON_NAVIGATION", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_serial_udb_extra_f4_t, sue_AILERON_NAVIGATION) }, \ - { "sue_RUDDER_NAVIGATION", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_serial_udb_extra_f4_t, sue_RUDDER_NAVIGATION) }, \ - { "sue_ALTITUDEHOLD_STABILIZED", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_serial_udb_extra_f4_t, sue_ALTITUDEHOLD_STABILIZED) }, \ - { "sue_ALTITUDEHOLD_WAYPOINT", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_serial_udb_extra_f4_t, sue_ALTITUDEHOLD_WAYPOINT) }, \ - { "sue_RACING_MODE", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_serial_udb_extra_f4_t, sue_RACING_MODE) }, \ - } \ -} -#endif - -/** - * @brief Pack a serial_udb_extra_f4 message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param sue_ROLL_STABILIZATION_AILERONS Serial UDB Extra Roll Stabilization with Ailerons Enabled - * @param sue_ROLL_STABILIZATION_RUDDER Serial UDB Extra Roll Stabilization with Rudder Enabled - * @param sue_PITCH_STABILIZATION Serial UDB Extra Pitch Stabilization Enabled - * @param sue_YAW_STABILIZATION_RUDDER Serial UDB Extra Yaw Stabilization using Rudder Enabled - * @param sue_YAW_STABILIZATION_AILERON Serial UDB Extra Yaw Stabilization using Ailerons Enabled - * @param sue_AILERON_NAVIGATION Serial UDB Extra Navigation with Ailerons Enabled - * @param sue_RUDDER_NAVIGATION Serial UDB Extra Navigation with Rudder Enabled - * @param sue_ALTITUDEHOLD_STABILIZED Serial UDB Extra Type of Alitude Hold when in Stabilized Mode - * @param sue_ALTITUDEHOLD_WAYPOINT Serial UDB Extra Type of Alitude Hold when in Waypoint Mode - * @param sue_RACING_MODE Serial UDB Extra Firmware racing mode enabled - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f4_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t sue_ROLL_STABILIZATION_AILERONS, uint8_t sue_ROLL_STABILIZATION_RUDDER, uint8_t sue_PITCH_STABILIZATION, uint8_t sue_YAW_STABILIZATION_RUDDER, uint8_t sue_YAW_STABILIZATION_AILERON, uint8_t sue_AILERON_NAVIGATION, uint8_t sue_RUDDER_NAVIGATION, uint8_t sue_ALTITUDEHOLD_STABILIZED, uint8_t sue_ALTITUDEHOLD_WAYPOINT, uint8_t sue_RACING_MODE) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_LEN]; - _mav_put_uint8_t(buf, 0, sue_ROLL_STABILIZATION_AILERONS); - _mav_put_uint8_t(buf, 1, sue_ROLL_STABILIZATION_RUDDER); - _mav_put_uint8_t(buf, 2, sue_PITCH_STABILIZATION); - _mav_put_uint8_t(buf, 3, sue_YAW_STABILIZATION_RUDDER); - _mav_put_uint8_t(buf, 4, sue_YAW_STABILIZATION_AILERON); - _mav_put_uint8_t(buf, 5, sue_AILERON_NAVIGATION); - _mav_put_uint8_t(buf, 6, sue_RUDDER_NAVIGATION); - _mav_put_uint8_t(buf, 7, sue_ALTITUDEHOLD_STABILIZED); - _mav_put_uint8_t(buf, 8, sue_ALTITUDEHOLD_WAYPOINT); - _mav_put_uint8_t(buf, 9, sue_RACING_MODE); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_LEN); -#else - mavlink_serial_udb_extra_f4_t packet; - packet.sue_ROLL_STABILIZATION_AILERONS = sue_ROLL_STABILIZATION_AILERONS; - packet.sue_ROLL_STABILIZATION_RUDDER = sue_ROLL_STABILIZATION_RUDDER; - packet.sue_PITCH_STABILIZATION = sue_PITCH_STABILIZATION; - packet.sue_YAW_STABILIZATION_RUDDER = sue_YAW_STABILIZATION_RUDDER; - packet.sue_YAW_STABILIZATION_AILERON = sue_YAW_STABILIZATION_AILERON; - packet.sue_AILERON_NAVIGATION = sue_AILERON_NAVIGATION; - packet.sue_RUDDER_NAVIGATION = sue_RUDDER_NAVIGATION; - packet.sue_ALTITUDEHOLD_STABILIZED = sue_ALTITUDEHOLD_STABILIZED; - packet.sue_ALTITUDEHOLD_WAYPOINT = sue_ALTITUDEHOLD_WAYPOINT; - packet.sue_RACING_MODE = sue_RACING_MODE; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_CRC); -} - -/** - * @brief Pack a serial_udb_extra_f4 message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param sue_ROLL_STABILIZATION_AILERONS Serial UDB Extra Roll Stabilization with Ailerons Enabled - * @param sue_ROLL_STABILIZATION_RUDDER Serial UDB Extra Roll Stabilization with Rudder Enabled - * @param sue_PITCH_STABILIZATION Serial UDB Extra Pitch Stabilization Enabled - * @param sue_YAW_STABILIZATION_RUDDER Serial UDB Extra Yaw Stabilization using Rudder Enabled - * @param sue_YAW_STABILIZATION_AILERON Serial UDB Extra Yaw Stabilization using Ailerons Enabled - * @param sue_AILERON_NAVIGATION Serial UDB Extra Navigation with Ailerons Enabled - * @param sue_RUDDER_NAVIGATION Serial UDB Extra Navigation with Rudder Enabled - * @param sue_ALTITUDEHOLD_STABILIZED Serial UDB Extra Type of Alitude Hold when in Stabilized Mode - * @param sue_ALTITUDEHOLD_WAYPOINT Serial UDB Extra Type of Alitude Hold when in Waypoint Mode - * @param sue_RACING_MODE Serial UDB Extra Firmware racing mode enabled - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f4_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t sue_ROLL_STABILIZATION_AILERONS,uint8_t sue_ROLL_STABILIZATION_RUDDER,uint8_t sue_PITCH_STABILIZATION,uint8_t sue_YAW_STABILIZATION_RUDDER,uint8_t sue_YAW_STABILIZATION_AILERON,uint8_t sue_AILERON_NAVIGATION,uint8_t sue_RUDDER_NAVIGATION,uint8_t sue_ALTITUDEHOLD_STABILIZED,uint8_t sue_ALTITUDEHOLD_WAYPOINT,uint8_t sue_RACING_MODE) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_LEN]; - _mav_put_uint8_t(buf, 0, sue_ROLL_STABILIZATION_AILERONS); - _mav_put_uint8_t(buf, 1, sue_ROLL_STABILIZATION_RUDDER); - _mav_put_uint8_t(buf, 2, sue_PITCH_STABILIZATION); - _mav_put_uint8_t(buf, 3, sue_YAW_STABILIZATION_RUDDER); - _mav_put_uint8_t(buf, 4, sue_YAW_STABILIZATION_AILERON); - _mav_put_uint8_t(buf, 5, sue_AILERON_NAVIGATION); - _mav_put_uint8_t(buf, 6, sue_RUDDER_NAVIGATION); - _mav_put_uint8_t(buf, 7, sue_ALTITUDEHOLD_STABILIZED); - _mav_put_uint8_t(buf, 8, sue_ALTITUDEHOLD_WAYPOINT); - _mav_put_uint8_t(buf, 9, sue_RACING_MODE); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_LEN); -#else - mavlink_serial_udb_extra_f4_t packet; - packet.sue_ROLL_STABILIZATION_AILERONS = sue_ROLL_STABILIZATION_AILERONS; - packet.sue_ROLL_STABILIZATION_RUDDER = sue_ROLL_STABILIZATION_RUDDER; - packet.sue_PITCH_STABILIZATION = sue_PITCH_STABILIZATION; - packet.sue_YAW_STABILIZATION_RUDDER = sue_YAW_STABILIZATION_RUDDER; - packet.sue_YAW_STABILIZATION_AILERON = sue_YAW_STABILIZATION_AILERON; - packet.sue_AILERON_NAVIGATION = sue_AILERON_NAVIGATION; - packet.sue_RUDDER_NAVIGATION = sue_RUDDER_NAVIGATION; - packet.sue_ALTITUDEHOLD_STABILIZED = sue_ALTITUDEHOLD_STABILIZED; - packet.sue_ALTITUDEHOLD_WAYPOINT = sue_ALTITUDEHOLD_WAYPOINT; - packet.sue_RACING_MODE = sue_RACING_MODE; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_CRC); -} - -/** - * @brief Encode a serial_udb_extra_f4 struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f4 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f4_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_serial_udb_extra_f4_t* serial_udb_extra_f4) -{ - return mavlink_msg_serial_udb_extra_f4_pack(system_id, component_id, msg, serial_udb_extra_f4->sue_ROLL_STABILIZATION_AILERONS, serial_udb_extra_f4->sue_ROLL_STABILIZATION_RUDDER, serial_udb_extra_f4->sue_PITCH_STABILIZATION, serial_udb_extra_f4->sue_YAW_STABILIZATION_RUDDER, serial_udb_extra_f4->sue_YAW_STABILIZATION_AILERON, serial_udb_extra_f4->sue_AILERON_NAVIGATION, serial_udb_extra_f4->sue_RUDDER_NAVIGATION, serial_udb_extra_f4->sue_ALTITUDEHOLD_STABILIZED, serial_udb_extra_f4->sue_ALTITUDEHOLD_WAYPOINT, serial_udb_extra_f4->sue_RACING_MODE); -} - -/** - * @brief Encode a serial_udb_extra_f4 struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f4 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f4_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_serial_udb_extra_f4_t* serial_udb_extra_f4) -{ - return mavlink_msg_serial_udb_extra_f4_pack_chan(system_id, component_id, chan, msg, serial_udb_extra_f4->sue_ROLL_STABILIZATION_AILERONS, serial_udb_extra_f4->sue_ROLL_STABILIZATION_RUDDER, serial_udb_extra_f4->sue_PITCH_STABILIZATION, serial_udb_extra_f4->sue_YAW_STABILIZATION_RUDDER, serial_udb_extra_f4->sue_YAW_STABILIZATION_AILERON, serial_udb_extra_f4->sue_AILERON_NAVIGATION, serial_udb_extra_f4->sue_RUDDER_NAVIGATION, serial_udb_extra_f4->sue_ALTITUDEHOLD_STABILIZED, serial_udb_extra_f4->sue_ALTITUDEHOLD_WAYPOINT, serial_udb_extra_f4->sue_RACING_MODE); -} - -/** - * @brief Send a serial_udb_extra_f4 message - * @param chan MAVLink channel to send the message - * - * @param sue_ROLL_STABILIZATION_AILERONS Serial UDB Extra Roll Stabilization with Ailerons Enabled - * @param sue_ROLL_STABILIZATION_RUDDER Serial UDB Extra Roll Stabilization with Rudder Enabled - * @param sue_PITCH_STABILIZATION Serial UDB Extra Pitch Stabilization Enabled - * @param sue_YAW_STABILIZATION_RUDDER Serial UDB Extra Yaw Stabilization using Rudder Enabled - * @param sue_YAW_STABILIZATION_AILERON Serial UDB Extra Yaw Stabilization using Ailerons Enabled - * @param sue_AILERON_NAVIGATION Serial UDB Extra Navigation with Ailerons Enabled - * @param sue_RUDDER_NAVIGATION Serial UDB Extra Navigation with Rudder Enabled - * @param sue_ALTITUDEHOLD_STABILIZED Serial UDB Extra Type of Alitude Hold when in Stabilized Mode - * @param sue_ALTITUDEHOLD_WAYPOINT Serial UDB Extra Type of Alitude Hold when in Waypoint Mode - * @param sue_RACING_MODE Serial UDB Extra Firmware racing mode enabled - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_serial_udb_extra_f4_send(mavlink_channel_t chan, uint8_t sue_ROLL_STABILIZATION_AILERONS, uint8_t sue_ROLL_STABILIZATION_RUDDER, uint8_t sue_PITCH_STABILIZATION, uint8_t sue_YAW_STABILIZATION_RUDDER, uint8_t sue_YAW_STABILIZATION_AILERON, uint8_t sue_AILERON_NAVIGATION, uint8_t sue_RUDDER_NAVIGATION, uint8_t sue_ALTITUDEHOLD_STABILIZED, uint8_t sue_ALTITUDEHOLD_WAYPOINT, uint8_t sue_RACING_MODE) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_LEN]; - _mav_put_uint8_t(buf, 0, sue_ROLL_STABILIZATION_AILERONS); - _mav_put_uint8_t(buf, 1, sue_ROLL_STABILIZATION_RUDDER); - _mav_put_uint8_t(buf, 2, sue_PITCH_STABILIZATION); - _mav_put_uint8_t(buf, 3, sue_YAW_STABILIZATION_RUDDER); - _mav_put_uint8_t(buf, 4, sue_YAW_STABILIZATION_AILERON); - _mav_put_uint8_t(buf, 5, sue_AILERON_NAVIGATION); - _mav_put_uint8_t(buf, 6, sue_RUDDER_NAVIGATION); - _mav_put_uint8_t(buf, 7, sue_ALTITUDEHOLD_STABILIZED); - _mav_put_uint8_t(buf, 8, sue_ALTITUDEHOLD_WAYPOINT); - _mav_put_uint8_t(buf, 9, sue_RACING_MODE); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_CRC); -#else - mavlink_serial_udb_extra_f4_t packet; - packet.sue_ROLL_STABILIZATION_AILERONS = sue_ROLL_STABILIZATION_AILERONS; - packet.sue_ROLL_STABILIZATION_RUDDER = sue_ROLL_STABILIZATION_RUDDER; - packet.sue_PITCH_STABILIZATION = sue_PITCH_STABILIZATION; - packet.sue_YAW_STABILIZATION_RUDDER = sue_YAW_STABILIZATION_RUDDER; - packet.sue_YAW_STABILIZATION_AILERON = sue_YAW_STABILIZATION_AILERON; - packet.sue_AILERON_NAVIGATION = sue_AILERON_NAVIGATION; - packet.sue_RUDDER_NAVIGATION = sue_RUDDER_NAVIGATION; - packet.sue_ALTITUDEHOLD_STABILIZED = sue_ALTITUDEHOLD_STABILIZED; - packet.sue_ALTITUDEHOLD_WAYPOINT = sue_ALTITUDEHOLD_WAYPOINT; - packet.sue_RACING_MODE = sue_RACING_MODE; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4, (const char *)&packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_CRC); -#endif -} - -/** - * @brief Send a serial_udb_extra_f4 message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_serial_udb_extra_f4_send_struct(mavlink_channel_t chan, const mavlink_serial_udb_extra_f4_t* serial_udb_extra_f4) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_serial_udb_extra_f4_send(chan, serial_udb_extra_f4->sue_ROLL_STABILIZATION_AILERONS, serial_udb_extra_f4->sue_ROLL_STABILIZATION_RUDDER, serial_udb_extra_f4->sue_PITCH_STABILIZATION, serial_udb_extra_f4->sue_YAW_STABILIZATION_RUDDER, serial_udb_extra_f4->sue_YAW_STABILIZATION_AILERON, serial_udb_extra_f4->sue_AILERON_NAVIGATION, serial_udb_extra_f4->sue_RUDDER_NAVIGATION, serial_udb_extra_f4->sue_ALTITUDEHOLD_STABILIZED, serial_udb_extra_f4->sue_ALTITUDEHOLD_WAYPOINT, serial_udb_extra_f4->sue_RACING_MODE); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4, (const char *)serial_udb_extra_f4, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_CRC); -#endif -} - -#if MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_serial_udb_extra_f4_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t sue_ROLL_STABILIZATION_AILERONS, uint8_t sue_ROLL_STABILIZATION_RUDDER, uint8_t sue_PITCH_STABILIZATION, uint8_t sue_YAW_STABILIZATION_RUDDER, uint8_t sue_YAW_STABILIZATION_AILERON, uint8_t sue_AILERON_NAVIGATION, uint8_t sue_RUDDER_NAVIGATION, uint8_t sue_ALTITUDEHOLD_STABILIZED, uint8_t sue_ALTITUDEHOLD_WAYPOINT, uint8_t sue_RACING_MODE) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint8_t(buf, 0, sue_ROLL_STABILIZATION_AILERONS); - _mav_put_uint8_t(buf, 1, sue_ROLL_STABILIZATION_RUDDER); - _mav_put_uint8_t(buf, 2, sue_PITCH_STABILIZATION); - _mav_put_uint8_t(buf, 3, sue_YAW_STABILIZATION_RUDDER); - _mav_put_uint8_t(buf, 4, sue_YAW_STABILIZATION_AILERON); - _mav_put_uint8_t(buf, 5, sue_AILERON_NAVIGATION); - _mav_put_uint8_t(buf, 6, sue_RUDDER_NAVIGATION); - _mav_put_uint8_t(buf, 7, sue_ALTITUDEHOLD_STABILIZED); - _mav_put_uint8_t(buf, 8, sue_ALTITUDEHOLD_WAYPOINT); - _mav_put_uint8_t(buf, 9, sue_RACING_MODE); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_CRC); -#else - mavlink_serial_udb_extra_f4_t *packet = (mavlink_serial_udb_extra_f4_t *)msgbuf; - packet->sue_ROLL_STABILIZATION_AILERONS = sue_ROLL_STABILIZATION_AILERONS; - packet->sue_ROLL_STABILIZATION_RUDDER = sue_ROLL_STABILIZATION_RUDDER; - packet->sue_PITCH_STABILIZATION = sue_PITCH_STABILIZATION; - packet->sue_YAW_STABILIZATION_RUDDER = sue_YAW_STABILIZATION_RUDDER; - packet->sue_YAW_STABILIZATION_AILERON = sue_YAW_STABILIZATION_AILERON; - packet->sue_AILERON_NAVIGATION = sue_AILERON_NAVIGATION; - packet->sue_RUDDER_NAVIGATION = sue_RUDDER_NAVIGATION; - packet->sue_ALTITUDEHOLD_STABILIZED = sue_ALTITUDEHOLD_STABILIZED; - packet->sue_ALTITUDEHOLD_WAYPOINT = sue_ALTITUDEHOLD_WAYPOINT; - packet->sue_RACING_MODE = sue_RACING_MODE; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4, (const char *)packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_CRC); -#endif -} -#endif - -#endif - -// MESSAGE SERIAL_UDB_EXTRA_F4 UNPACKING - - -/** - * @brief Get field sue_ROLL_STABILIZATION_AILERONS from serial_udb_extra_f4 message - * - * @return Serial UDB Extra Roll Stabilization with Ailerons Enabled - */ -static inline uint8_t mavlink_msg_serial_udb_extra_f4_get_sue_ROLL_STABILIZATION_AILERONS(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 0); -} - -/** - * @brief Get field sue_ROLL_STABILIZATION_RUDDER from serial_udb_extra_f4 message - * - * @return Serial UDB Extra Roll Stabilization with Rudder Enabled - */ -static inline uint8_t mavlink_msg_serial_udb_extra_f4_get_sue_ROLL_STABILIZATION_RUDDER(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 1); -} - -/** - * @brief Get field sue_PITCH_STABILIZATION from serial_udb_extra_f4 message - * - * @return Serial UDB Extra Pitch Stabilization Enabled - */ -static inline uint8_t mavlink_msg_serial_udb_extra_f4_get_sue_PITCH_STABILIZATION(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 2); -} - -/** - * @brief Get field sue_YAW_STABILIZATION_RUDDER from serial_udb_extra_f4 message - * - * @return Serial UDB Extra Yaw Stabilization using Rudder Enabled - */ -static inline uint8_t mavlink_msg_serial_udb_extra_f4_get_sue_YAW_STABILIZATION_RUDDER(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 3); -} - -/** - * @brief Get field sue_YAW_STABILIZATION_AILERON from serial_udb_extra_f4 message - * - * @return Serial UDB Extra Yaw Stabilization using Ailerons Enabled - */ -static inline uint8_t mavlink_msg_serial_udb_extra_f4_get_sue_YAW_STABILIZATION_AILERON(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 4); -} - -/** - * @brief Get field sue_AILERON_NAVIGATION from serial_udb_extra_f4 message - * - * @return Serial UDB Extra Navigation with Ailerons Enabled - */ -static inline uint8_t mavlink_msg_serial_udb_extra_f4_get_sue_AILERON_NAVIGATION(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 5); -} - -/** - * @brief Get field sue_RUDDER_NAVIGATION from serial_udb_extra_f4 message - * - * @return Serial UDB Extra Navigation with Rudder Enabled - */ -static inline uint8_t mavlink_msg_serial_udb_extra_f4_get_sue_RUDDER_NAVIGATION(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 6); -} - -/** - * @brief Get field sue_ALTITUDEHOLD_STABILIZED from serial_udb_extra_f4 message - * - * @return Serial UDB Extra Type of Alitude Hold when in Stabilized Mode - */ -static inline uint8_t mavlink_msg_serial_udb_extra_f4_get_sue_ALTITUDEHOLD_STABILIZED(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 7); -} - -/** - * @brief Get field sue_ALTITUDEHOLD_WAYPOINT from serial_udb_extra_f4 message - * - * @return Serial UDB Extra Type of Alitude Hold when in Waypoint Mode - */ -static inline uint8_t mavlink_msg_serial_udb_extra_f4_get_sue_ALTITUDEHOLD_WAYPOINT(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 8); -} - -/** - * @brief Get field sue_RACING_MODE from serial_udb_extra_f4 message - * - * @return Serial UDB Extra Firmware racing mode enabled - */ -static inline uint8_t mavlink_msg_serial_udb_extra_f4_get_sue_RACING_MODE(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 9); -} - -/** - * @brief Decode a serial_udb_extra_f4 message into a struct - * - * @param msg The message to decode - * @param serial_udb_extra_f4 C-struct to decode the message contents into - */ -static inline void mavlink_msg_serial_udb_extra_f4_decode(const mavlink_message_t* msg, mavlink_serial_udb_extra_f4_t* serial_udb_extra_f4) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - serial_udb_extra_f4->sue_ROLL_STABILIZATION_AILERONS = mavlink_msg_serial_udb_extra_f4_get_sue_ROLL_STABILIZATION_AILERONS(msg); - serial_udb_extra_f4->sue_ROLL_STABILIZATION_RUDDER = mavlink_msg_serial_udb_extra_f4_get_sue_ROLL_STABILIZATION_RUDDER(msg); - serial_udb_extra_f4->sue_PITCH_STABILIZATION = mavlink_msg_serial_udb_extra_f4_get_sue_PITCH_STABILIZATION(msg); - serial_udb_extra_f4->sue_YAW_STABILIZATION_RUDDER = mavlink_msg_serial_udb_extra_f4_get_sue_YAW_STABILIZATION_RUDDER(msg); - serial_udb_extra_f4->sue_YAW_STABILIZATION_AILERON = mavlink_msg_serial_udb_extra_f4_get_sue_YAW_STABILIZATION_AILERON(msg); - serial_udb_extra_f4->sue_AILERON_NAVIGATION = mavlink_msg_serial_udb_extra_f4_get_sue_AILERON_NAVIGATION(msg); - serial_udb_extra_f4->sue_RUDDER_NAVIGATION = mavlink_msg_serial_udb_extra_f4_get_sue_RUDDER_NAVIGATION(msg); - serial_udb_extra_f4->sue_ALTITUDEHOLD_STABILIZED = mavlink_msg_serial_udb_extra_f4_get_sue_ALTITUDEHOLD_STABILIZED(msg); - serial_udb_extra_f4->sue_ALTITUDEHOLD_WAYPOINT = mavlink_msg_serial_udb_extra_f4_get_sue_ALTITUDEHOLD_WAYPOINT(msg); - serial_udb_extra_f4->sue_RACING_MODE = mavlink_msg_serial_udb_extra_f4_get_sue_RACING_MODE(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_LEN? msg->len : MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_LEN; - memset(serial_udb_extra_f4, 0, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_LEN); - memcpy(serial_udb_extra_f4, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/matrixpilot/mavlink_msg_serial_udb_extra_f5.h b/matrixpilot/mavlink_msg_serial_udb_extra_f5.h deleted file mode 100644 index 5d4c1bda2..000000000 --- a/matrixpilot/mavlink_msg_serial_udb_extra_f5.h +++ /dev/null @@ -1,288 +0,0 @@ -#pragma once -// MESSAGE SERIAL_UDB_EXTRA_F5 PACKING - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5 173 - - -typedef struct __mavlink_serial_udb_extra_f5_t { - float sue_YAWKP_AILERON; /*< Serial UDB YAWKP_AILERON Gain for Proporional control of navigation*/ - float sue_YAWKD_AILERON; /*< Serial UDB YAWKD_AILERON Gain for Rate control of navigation*/ - float sue_ROLLKP; /*< Serial UDB Extra ROLLKP Gain for Proportional control of roll stabilization*/ - float sue_ROLLKD; /*< Serial UDB Extra ROLLKD Gain for Rate control of roll stabilization*/ -} mavlink_serial_udb_extra_f5_t; - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN 16 -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_MIN_LEN 16 -#define MAVLINK_MSG_ID_173_LEN 16 -#define MAVLINK_MSG_ID_173_MIN_LEN 16 - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_CRC 54 -#define MAVLINK_MSG_ID_173_CRC 54 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F5 { \ - 173, \ - "SERIAL_UDB_EXTRA_F5", \ - 4, \ - { { "sue_YAWKP_AILERON", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_serial_udb_extra_f5_t, sue_YAWKP_AILERON) }, \ - { "sue_YAWKD_AILERON", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_serial_udb_extra_f5_t, sue_YAWKD_AILERON) }, \ - { "sue_ROLLKP", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_serial_udb_extra_f5_t, sue_ROLLKP) }, \ - { "sue_ROLLKD", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_serial_udb_extra_f5_t, sue_ROLLKD) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F5 { \ - "SERIAL_UDB_EXTRA_F5", \ - 4, \ - { { "sue_YAWKP_AILERON", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_serial_udb_extra_f5_t, sue_YAWKP_AILERON) }, \ - { "sue_YAWKD_AILERON", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_serial_udb_extra_f5_t, sue_YAWKD_AILERON) }, \ - { "sue_ROLLKP", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_serial_udb_extra_f5_t, sue_ROLLKP) }, \ - { "sue_ROLLKD", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_serial_udb_extra_f5_t, sue_ROLLKD) }, \ - } \ -} -#endif - -/** - * @brief Pack a serial_udb_extra_f5 message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param sue_YAWKP_AILERON Serial UDB YAWKP_AILERON Gain for Proporional control of navigation - * @param sue_YAWKD_AILERON Serial UDB YAWKD_AILERON Gain for Rate control of navigation - * @param sue_ROLLKP Serial UDB Extra ROLLKP Gain for Proportional control of roll stabilization - * @param sue_ROLLKD Serial UDB Extra ROLLKD Gain for Rate control of roll stabilization - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f5_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - float sue_YAWKP_AILERON, float sue_YAWKD_AILERON, float sue_ROLLKP, float sue_ROLLKD) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN]; - _mav_put_float(buf, 0, sue_YAWKP_AILERON); - _mav_put_float(buf, 4, sue_YAWKD_AILERON); - _mav_put_float(buf, 8, sue_ROLLKP); - _mav_put_float(buf, 12, sue_ROLLKD); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN); -#else - mavlink_serial_udb_extra_f5_t packet; - packet.sue_YAWKP_AILERON = sue_YAWKP_AILERON; - packet.sue_YAWKD_AILERON = sue_YAWKD_AILERON; - packet.sue_ROLLKP = sue_ROLLKP; - packet.sue_ROLLKD = sue_ROLLKD; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_CRC); -} - -/** - * @brief Pack a serial_udb_extra_f5 message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param sue_YAWKP_AILERON Serial UDB YAWKP_AILERON Gain for Proporional control of navigation - * @param sue_YAWKD_AILERON Serial UDB YAWKD_AILERON Gain for Rate control of navigation - * @param sue_ROLLKP Serial UDB Extra ROLLKP Gain for Proportional control of roll stabilization - * @param sue_ROLLKD Serial UDB Extra ROLLKD Gain for Rate control of roll stabilization - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f5_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - float sue_YAWKP_AILERON,float sue_YAWKD_AILERON,float sue_ROLLKP,float sue_ROLLKD) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN]; - _mav_put_float(buf, 0, sue_YAWKP_AILERON); - _mav_put_float(buf, 4, sue_YAWKD_AILERON); - _mav_put_float(buf, 8, sue_ROLLKP); - _mav_put_float(buf, 12, sue_ROLLKD); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN); -#else - mavlink_serial_udb_extra_f5_t packet; - packet.sue_YAWKP_AILERON = sue_YAWKP_AILERON; - packet.sue_YAWKD_AILERON = sue_YAWKD_AILERON; - packet.sue_ROLLKP = sue_ROLLKP; - packet.sue_ROLLKD = sue_ROLLKD; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_CRC); -} - -/** - * @brief Encode a serial_udb_extra_f5 struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f5 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f5_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_serial_udb_extra_f5_t* serial_udb_extra_f5) -{ - return mavlink_msg_serial_udb_extra_f5_pack(system_id, component_id, msg, serial_udb_extra_f5->sue_YAWKP_AILERON, serial_udb_extra_f5->sue_YAWKD_AILERON, serial_udb_extra_f5->sue_ROLLKP, serial_udb_extra_f5->sue_ROLLKD); -} - -/** - * @brief Encode a serial_udb_extra_f5 struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f5 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f5_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_serial_udb_extra_f5_t* serial_udb_extra_f5) -{ - return mavlink_msg_serial_udb_extra_f5_pack_chan(system_id, component_id, chan, msg, serial_udb_extra_f5->sue_YAWKP_AILERON, serial_udb_extra_f5->sue_YAWKD_AILERON, serial_udb_extra_f5->sue_ROLLKP, serial_udb_extra_f5->sue_ROLLKD); -} - -/** - * @brief Send a serial_udb_extra_f5 message - * @param chan MAVLink channel to send the message - * - * @param sue_YAWKP_AILERON Serial UDB YAWKP_AILERON Gain for Proporional control of navigation - * @param sue_YAWKD_AILERON Serial UDB YAWKD_AILERON Gain for Rate control of navigation - * @param sue_ROLLKP Serial UDB Extra ROLLKP Gain for Proportional control of roll stabilization - * @param sue_ROLLKD Serial UDB Extra ROLLKD Gain for Rate control of roll stabilization - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_serial_udb_extra_f5_send(mavlink_channel_t chan, float sue_YAWKP_AILERON, float sue_YAWKD_AILERON, float sue_ROLLKP, float sue_ROLLKD) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN]; - _mav_put_float(buf, 0, sue_YAWKP_AILERON); - _mav_put_float(buf, 4, sue_YAWKD_AILERON); - _mav_put_float(buf, 8, sue_ROLLKP); - _mav_put_float(buf, 12, sue_ROLLKD); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_CRC); -#else - mavlink_serial_udb_extra_f5_t packet; - packet.sue_YAWKP_AILERON = sue_YAWKP_AILERON; - packet.sue_YAWKD_AILERON = sue_YAWKD_AILERON; - packet.sue_ROLLKP = sue_ROLLKP; - packet.sue_ROLLKD = sue_ROLLKD; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5, (const char *)&packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_CRC); -#endif -} - -/** - * @brief Send a serial_udb_extra_f5 message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_serial_udb_extra_f5_send_struct(mavlink_channel_t chan, const mavlink_serial_udb_extra_f5_t* serial_udb_extra_f5) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_serial_udb_extra_f5_send(chan, serial_udb_extra_f5->sue_YAWKP_AILERON, serial_udb_extra_f5->sue_YAWKD_AILERON, serial_udb_extra_f5->sue_ROLLKP, serial_udb_extra_f5->sue_ROLLKD); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5, (const char *)serial_udb_extra_f5, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_CRC); -#endif -} - -#if MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_serial_udb_extra_f5_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, float sue_YAWKP_AILERON, float sue_YAWKD_AILERON, float sue_ROLLKP, float sue_ROLLKD) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_float(buf, 0, sue_YAWKP_AILERON); - _mav_put_float(buf, 4, sue_YAWKD_AILERON); - _mav_put_float(buf, 8, sue_ROLLKP); - _mav_put_float(buf, 12, sue_ROLLKD); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_CRC); -#else - mavlink_serial_udb_extra_f5_t *packet = (mavlink_serial_udb_extra_f5_t *)msgbuf; - packet->sue_YAWKP_AILERON = sue_YAWKP_AILERON; - packet->sue_YAWKD_AILERON = sue_YAWKD_AILERON; - packet->sue_ROLLKP = sue_ROLLKP; - packet->sue_ROLLKD = sue_ROLLKD; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5, (const char *)packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_CRC); -#endif -} -#endif - -#endif - -// MESSAGE SERIAL_UDB_EXTRA_F5 UNPACKING - - -/** - * @brief Get field sue_YAWKP_AILERON from serial_udb_extra_f5 message - * - * @return Serial UDB YAWKP_AILERON Gain for Proporional control of navigation - */ -static inline float mavlink_msg_serial_udb_extra_f5_get_sue_YAWKP_AILERON(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 0); -} - -/** - * @brief Get field sue_YAWKD_AILERON from serial_udb_extra_f5 message - * - * @return Serial UDB YAWKD_AILERON Gain for Rate control of navigation - */ -static inline float mavlink_msg_serial_udb_extra_f5_get_sue_YAWKD_AILERON(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 4); -} - -/** - * @brief Get field sue_ROLLKP from serial_udb_extra_f5 message - * - * @return Serial UDB Extra ROLLKP Gain for Proportional control of roll stabilization - */ -static inline float mavlink_msg_serial_udb_extra_f5_get_sue_ROLLKP(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field sue_ROLLKD from serial_udb_extra_f5 message - * - * @return Serial UDB Extra ROLLKD Gain for Rate control of roll stabilization - */ -static inline float mavlink_msg_serial_udb_extra_f5_get_sue_ROLLKD(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Decode a serial_udb_extra_f5 message into a struct - * - * @param msg The message to decode - * @param serial_udb_extra_f5 C-struct to decode the message contents into - */ -static inline void mavlink_msg_serial_udb_extra_f5_decode(const mavlink_message_t* msg, mavlink_serial_udb_extra_f5_t* serial_udb_extra_f5) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - serial_udb_extra_f5->sue_YAWKP_AILERON = mavlink_msg_serial_udb_extra_f5_get_sue_YAWKP_AILERON(msg); - serial_udb_extra_f5->sue_YAWKD_AILERON = mavlink_msg_serial_udb_extra_f5_get_sue_YAWKD_AILERON(msg); - serial_udb_extra_f5->sue_ROLLKP = mavlink_msg_serial_udb_extra_f5_get_sue_ROLLKP(msg); - serial_udb_extra_f5->sue_ROLLKD = mavlink_msg_serial_udb_extra_f5_get_sue_ROLLKD(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN? msg->len : MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN; - memset(serial_udb_extra_f5, 0, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN); - memcpy(serial_udb_extra_f5, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/matrixpilot/mavlink_msg_serial_udb_extra_f6.h b/matrixpilot/mavlink_msg_serial_udb_extra_f6.h deleted file mode 100644 index 1f06b36a1..000000000 --- a/matrixpilot/mavlink_msg_serial_udb_extra_f6.h +++ /dev/null @@ -1,313 +0,0 @@ -#pragma once -// MESSAGE SERIAL_UDB_EXTRA_F6 PACKING - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6 174 - - -typedef struct __mavlink_serial_udb_extra_f6_t { - float sue_PITCHGAIN; /*< Serial UDB Extra PITCHGAIN Proportional Control*/ - float sue_PITCHKD; /*< Serial UDB Extra Pitch Rate Control*/ - float sue_RUDDER_ELEV_MIX; /*< Serial UDB Extra Rudder to Elevator Mix*/ - float sue_ROLL_ELEV_MIX; /*< Serial UDB Extra Roll to Elevator Mix*/ - float sue_ELEVATOR_BOOST; /*< Gain For Boosting Manual Elevator control When Plane Stabilized*/ -} mavlink_serial_udb_extra_f6_t; - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_LEN 20 -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_MIN_LEN 20 -#define MAVLINK_MSG_ID_174_LEN 20 -#define MAVLINK_MSG_ID_174_MIN_LEN 20 - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_CRC 54 -#define MAVLINK_MSG_ID_174_CRC 54 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F6 { \ - 174, \ - "SERIAL_UDB_EXTRA_F6", \ - 5, \ - { { "sue_PITCHGAIN", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_serial_udb_extra_f6_t, sue_PITCHGAIN) }, \ - { "sue_PITCHKD", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_serial_udb_extra_f6_t, sue_PITCHKD) }, \ - { "sue_RUDDER_ELEV_MIX", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_serial_udb_extra_f6_t, sue_RUDDER_ELEV_MIX) }, \ - { "sue_ROLL_ELEV_MIX", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_serial_udb_extra_f6_t, sue_ROLL_ELEV_MIX) }, \ - { "sue_ELEVATOR_BOOST", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_serial_udb_extra_f6_t, sue_ELEVATOR_BOOST) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F6 { \ - "SERIAL_UDB_EXTRA_F6", \ - 5, \ - { { "sue_PITCHGAIN", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_serial_udb_extra_f6_t, sue_PITCHGAIN) }, \ - { "sue_PITCHKD", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_serial_udb_extra_f6_t, sue_PITCHKD) }, \ - { "sue_RUDDER_ELEV_MIX", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_serial_udb_extra_f6_t, sue_RUDDER_ELEV_MIX) }, \ - { "sue_ROLL_ELEV_MIX", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_serial_udb_extra_f6_t, sue_ROLL_ELEV_MIX) }, \ - { "sue_ELEVATOR_BOOST", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_serial_udb_extra_f6_t, sue_ELEVATOR_BOOST) }, \ - } \ -} -#endif - -/** - * @brief Pack a serial_udb_extra_f6 message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param sue_PITCHGAIN Serial UDB Extra PITCHGAIN Proportional Control - * @param sue_PITCHKD Serial UDB Extra Pitch Rate Control - * @param sue_RUDDER_ELEV_MIX Serial UDB Extra Rudder to Elevator Mix - * @param sue_ROLL_ELEV_MIX Serial UDB Extra Roll to Elevator Mix - * @param sue_ELEVATOR_BOOST Gain For Boosting Manual Elevator control When Plane Stabilized - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f6_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - float sue_PITCHGAIN, float sue_PITCHKD, float sue_RUDDER_ELEV_MIX, float sue_ROLL_ELEV_MIX, float sue_ELEVATOR_BOOST) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_LEN]; - _mav_put_float(buf, 0, sue_PITCHGAIN); - _mav_put_float(buf, 4, sue_PITCHKD); - _mav_put_float(buf, 8, sue_RUDDER_ELEV_MIX); - _mav_put_float(buf, 12, sue_ROLL_ELEV_MIX); - _mav_put_float(buf, 16, sue_ELEVATOR_BOOST); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_LEN); -#else - mavlink_serial_udb_extra_f6_t packet; - packet.sue_PITCHGAIN = sue_PITCHGAIN; - packet.sue_PITCHKD = sue_PITCHKD; - packet.sue_RUDDER_ELEV_MIX = sue_RUDDER_ELEV_MIX; - packet.sue_ROLL_ELEV_MIX = sue_ROLL_ELEV_MIX; - packet.sue_ELEVATOR_BOOST = sue_ELEVATOR_BOOST; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_CRC); -} - -/** - * @brief Pack a serial_udb_extra_f6 message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param sue_PITCHGAIN Serial UDB Extra PITCHGAIN Proportional Control - * @param sue_PITCHKD Serial UDB Extra Pitch Rate Control - * @param sue_RUDDER_ELEV_MIX Serial UDB Extra Rudder to Elevator Mix - * @param sue_ROLL_ELEV_MIX Serial UDB Extra Roll to Elevator Mix - * @param sue_ELEVATOR_BOOST Gain For Boosting Manual Elevator control When Plane Stabilized - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f6_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - float sue_PITCHGAIN,float sue_PITCHKD,float sue_RUDDER_ELEV_MIX,float sue_ROLL_ELEV_MIX,float sue_ELEVATOR_BOOST) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_LEN]; - _mav_put_float(buf, 0, sue_PITCHGAIN); - _mav_put_float(buf, 4, sue_PITCHKD); - _mav_put_float(buf, 8, sue_RUDDER_ELEV_MIX); - _mav_put_float(buf, 12, sue_ROLL_ELEV_MIX); - _mav_put_float(buf, 16, sue_ELEVATOR_BOOST); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_LEN); -#else - mavlink_serial_udb_extra_f6_t packet; - packet.sue_PITCHGAIN = sue_PITCHGAIN; - packet.sue_PITCHKD = sue_PITCHKD; - packet.sue_RUDDER_ELEV_MIX = sue_RUDDER_ELEV_MIX; - packet.sue_ROLL_ELEV_MIX = sue_ROLL_ELEV_MIX; - packet.sue_ELEVATOR_BOOST = sue_ELEVATOR_BOOST; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_CRC); -} - -/** - * @brief Encode a serial_udb_extra_f6 struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f6 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f6_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_serial_udb_extra_f6_t* serial_udb_extra_f6) -{ - return mavlink_msg_serial_udb_extra_f6_pack(system_id, component_id, msg, serial_udb_extra_f6->sue_PITCHGAIN, serial_udb_extra_f6->sue_PITCHKD, serial_udb_extra_f6->sue_RUDDER_ELEV_MIX, serial_udb_extra_f6->sue_ROLL_ELEV_MIX, serial_udb_extra_f6->sue_ELEVATOR_BOOST); -} - -/** - * @brief Encode a serial_udb_extra_f6 struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f6 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f6_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_serial_udb_extra_f6_t* serial_udb_extra_f6) -{ - return mavlink_msg_serial_udb_extra_f6_pack_chan(system_id, component_id, chan, msg, serial_udb_extra_f6->sue_PITCHGAIN, serial_udb_extra_f6->sue_PITCHKD, serial_udb_extra_f6->sue_RUDDER_ELEV_MIX, serial_udb_extra_f6->sue_ROLL_ELEV_MIX, serial_udb_extra_f6->sue_ELEVATOR_BOOST); -} - -/** - * @brief Send a serial_udb_extra_f6 message - * @param chan MAVLink channel to send the message - * - * @param sue_PITCHGAIN Serial UDB Extra PITCHGAIN Proportional Control - * @param sue_PITCHKD Serial UDB Extra Pitch Rate Control - * @param sue_RUDDER_ELEV_MIX Serial UDB Extra Rudder to Elevator Mix - * @param sue_ROLL_ELEV_MIX Serial UDB Extra Roll to Elevator Mix - * @param sue_ELEVATOR_BOOST Gain For Boosting Manual Elevator control When Plane Stabilized - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_serial_udb_extra_f6_send(mavlink_channel_t chan, float sue_PITCHGAIN, float sue_PITCHKD, float sue_RUDDER_ELEV_MIX, float sue_ROLL_ELEV_MIX, float sue_ELEVATOR_BOOST) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_LEN]; - _mav_put_float(buf, 0, sue_PITCHGAIN); - _mav_put_float(buf, 4, sue_PITCHKD); - _mav_put_float(buf, 8, sue_RUDDER_ELEV_MIX); - _mav_put_float(buf, 12, sue_ROLL_ELEV_MIX); - _mav_put_float(buf, 16, sue_ELEVATOR_BOOST); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_CRC); -#else - mavlink_serial_udb_extra_f6_t packet; - packet.sue_PITCHGAIN = sue_PITCHGAIN; - packet.sue_PITCHKD = sue_PITCHKD; - packet.sue_RUDDER_ELEV_MIX = sue_RUDDER_ELEV_MIX; - packet.sue_ROLL_ELEV_MIX = sue_ROLL_ELEV_MIX; - packet.sue_ELEVATOR_BOOST = sue_ELEVATOR_BOOST; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6, (const char *)&packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_CRC); -#endif -} - -/** - * @brief Send a serial_udb_extra_f6 message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_serial_udb_extra_f6_send_struct(mavlink_channel_t chan, const mavlink_serial_udb_extra_f6_t* serial_udb_extra_f6) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_serial_udb_extra_f6_send(chan, serial_udb_extra_f6->sue_PITCHGAIN, serial_udb_extra_f6->sue_PITCHKD, serial_udb_extra_f6->sue_RUDDER_ELEV_MIX, serial_udb_extra_f6->sue_ROLL_ELEV_MIX, serial_udb_extra_f6->sue_ELEVATOR_BOOST); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6, (const char *)serial_udb_extra_f6, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_CRC); -#endif -} - -#if MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_serial_udb_extra_f6_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, float sue_PITCHGAIN, float sue_PITCHKD, float sue_RUDDER_ELEV_MIX, float sue_ROLL_ELEV_MIX, float sue_ELEVATOR_BOOST) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_float(buf, 0, sue_PITCHGAIN); - _mav_put_float(buf, 4, sue_PITCHKD); - _mav_put_float(buf, 8, sue_RUDDER_ELEV_MIX); - _mav_put_float(buf, 12, sue_ROLL_ELEV_MIX); - _mav_put_float(buf, 16, sue_ELEVATOR_BOOST); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_CRC); -#else - mavlink_serial_udb_extra_f6_t *packet = (mavlink_serial_udb_extra_f6_t *)msgbuf; - packet->sue_PITCHGAIN = sue_PITCHGAIN; - packet->sue_PITCHKD = sue_PITCHKD; - packet->sue_RUDDER_ELEV_MIX = sue_RUDDER_ELEV_MIX; - packet->sue_ROLL_ELEV_MIX = sue_ROLL_ELEV_MIX; - packet->sue_ELEVATOR_BOOST = sue_ELEVATOR_BOOST; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6, (const char *)packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_CRC); -#endif -} -#endif - -#endif - -// MESSAGE SERIAL_UDB_EXTRA_F6 UNPACKING - - -/** - * @brief Get field sue_PITCHGAIN from serial_udb_extra_f6 message - * - * @return Serial UDB Extra PITCHGAIN Proportional Control - */ -static inline float mavlink_msg_serial_udb_extra_f6_get_sue_PITCHGAIN(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 0); -} - -/** - * @brief Get field sue_PITCHKD from serial_udb_extra_f6 message - * - * @return Serial UDB Extra Pitch Rate Control - */ -static inline float mavlink_msg_serial_udb_extra_f6_get_sue_PITCHKD(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 4); -} - -/** - * @brief Get field sue_RUDDER_ELEV_MIX from serial_udb_extra_f6 message - * - * @return Serial UDB Extra Rudder to Elevator Mix - */ -static inline float mavlink_msg_serial_udb_extra_f6_get_sue_RUDDER_ELEV_MIX(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field sue_ROLL_ELEV_MIX from serial_udb_extra_f6 message - * - * @return Serial UDB Extra Roll to Elevator Mix - */ -static inline float mavlink_msg_serial_udb_extra_f6_get_sue_ROLL_ELEV_MIX(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Get field sue_ELEVATOR_BOOST from serial_udb_extra_f6 message - * - * @return Gain For Boosting Manual Elevator control When Plane Stabilized - */ -static inline float mavlink_msg_serial_udb_extra_f6_get_sue_ELEVATOR_BOOST(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 16); -} - -/** - * @brief Decode a serial_udb_extra_f6 message into a struct - * - * @param msg The message to decode - * @param serial_udb_extra_f6 C-struct to decode the message contents into - */ -static inline void mavlink_msg_serial_udb_extra_f6_decode(const mavlink_message_t* msg, mavlink_serial_udb_extra_f6_t* serial_udb_extra_f6) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - serial_udb_extra_f6->sue_PITCHGAIN = mavlink_msg_serial_udb_extra_f6_get_sue_PITCHGAIN(msg); - serial_udb_extra_f6->sue_PITCHKD = mavlink_msg_serial_udb_extra_f6_get_sue_PITCHKD(msg); - serial_udb_extra_f6->sue_RUDDER_ELEV_MIX = mavlink_msg_serial_udb_extra_f6_get_sue_RUDDER_ELEV_MIX(msg); - serial_udb_extra_f6->sue_ROLL_ELEV_MIX = mavlink_msg_serial_udb_extra_f6_get_sue_ROLL_ELEV_MIX(msg); - serial_udb_extra_f6->sue_ELEVATOR_BOOST = mavlink_msg_serial_udb_extra_f6_get_sue_ELEVATOR_BOOST(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_LEN? msg->len : MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_LEN; - memset(serial_udb_extra_f6, 0, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_LEN); - memcpy(serial_udb_extra_f6, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/matrixpilot/mavlink_msg_serial_udb_extra_f7.h b/matrixpilot/mavlink_msg_serial_udb_extra_f7.h deleted file mode 100644 index 01cb310d1..000000000 --- a/matrixpilot/mavlink_msg_serial_udb_extra_f7.h +++ /dev/null @@ -1,338 +0,0 @@ -#pragma once -// MESSAGE SERIAL_UDB_EXTRA_F7 PACKING - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7 175 - - -typedef struct __mavlink_serial_udb_extra_f7_t { - float sue_YAWKP_RUDDER; /*< Serial UDB YAWKP_RUDDER Gain for Proporional control of navigation*/ - float sue_YAWKD_RUDDER; /*< Serial UDB YAWKD_RUDDER Gain for Rate control of navigation*/ - float sue_ROLLKP_RUDDER; /*< Serial UDB Extra ROLLKP_RUDDER Gain for Proportional control of roll stabilization*/ - float sue_ROLLKD_RUDDER; /*< Serial UDB Extra ROLLKD_RUDDER Gain for Rate control of roll stabilization*/ - float sue_RUDDER_BOOST; /*< SERIAL UDB EXTRA Rudder Boost Gain to Manual Control when stabilized*/ - float sue_RTL_PITCH_DOWN; /*< Serial UDB Extra Return To Landing - Angle to Pitch Plane Down*/ -} mavlink_serial_udb_extra_f7_t; - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_LEN 24 -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_MIN_LEN 24 -#define MAVLINK_MSG_ID_175_LEN 24 -#define MAVLINK_MSG_ID_175_MIN_LEN 24 - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_CRC 171 -#define MAVLINK_MSG_ID_175_CRC 171 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F7 { \ - 175, \ - "SERIAL_UDB_EXTRA_F7", \ - 6, \ - { { "sue_YAWKP_RUDDER", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_serial_udb_extra_f7_t, sue_YAWKP_RUDDER) }, \ - { "sue_YAWKD_RUDDER", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_serial_udb_extra_f7_t, sue_YAWKD_RUDDER) }, \ - { "sue_ROLLKP_RUDDER", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_serial_udb_extra_f7_t, sue_ROLLKP_RUDDER) }, \ - { "sue_ROLLKD_RUDDER", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_serial_udb_extra_f7_t, sue_ROLLKD_RUDDER) }, \ - { "sue_RUDDER_BOOST", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_serial_udb_extra_f7_t, sue_RUDDER_BOOST) }, \ - { "sue_RTL_PITCH_DOWN", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_serial_udb_extra_f7_t, sue_RTL_PITCH_DOWN) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F7 { \ - "SERIAL_UDB_EXTRA_F7", \ - 6, \ - { { "sue_YAWKP_RUDDER", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_serial_udb_extra_f7_t, sue_YAWKP_RUDDER) }, \ - { "sue_YAWKD_RUDDER", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_serial_udb_extra_f7_t, sue_YAWKD_RUDDER) }, \ - { "sue_ROLLKP_RUDDER", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_serial_udb_extra_f7_t, sue_ROLLKP_RUDDER) }, \ - { "sue_ROLLKD_RUDDER", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_serial_udb_extra_f7_t, sue_ROLLKD_RUDDER) }, \ - { "sue_RUDDER_BOOST", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_serial_udb_extra_f7_t, sue_RUDDER_BOOST) }, \ - { "sue_RTL_PITCH_DOWN", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_serial_udb_extra_f7_t, sue_RTL_PITCH_DOWN) }, \ - } \ -} -#endif - -/** - * @brief Pack a serial_udb_extra_f7 message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param sue_YAWKP_RUDDER Serial UDB YAWKP_RUDDER Gain for Proporional control of navigation - * @param sue_YAWKD_RUDDER Serial UDB YAWKD_RUDDER Gain for Rate control of navigation - * @param sue_ROLLKP_RUDDER Serial UDB Extra ROLLKP_RUDDER Gain for Proportional control of roll stabilization - * @param sue_ROLLKD_RUDDER Serial UDB Extra ROLLKD_RUDDER Gain for Rate control of roll stabilization - * @param sue_RUDDER_BOOST SERIAL UDB EXTRA Rudder Boost Gain to Manual Control when stabilized - * @param sue_RTL_PITCH_DOWN Serial UDB Extra Return To Landing - Angle to Pitch Plane Down - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f7_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - float sue_YAWKP_RUDDER, float sue_YAWKD_RUDDER, float sue_ROLLKP_RUDDER, float sue_ROLLKD_RUDDER, float sue_RUDDER_BOOST, float sue_RTL_PITCH_DOWN) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_LEN]; - _mav_put_float(buf, 0, sue_YAWKP_RUDDER); - _mav_put_float(buf, 4, sue_YAWKD_RUDDER); - _mav_put_float(buf, 8, sue_ROLLKP_RUDDER); - _mav_put_float(buf, 12, sue_ROLLKD_RUDDER); - _mav_put_float(buf, 16, sue_RUDDER_BOOST); - _mav_put_float(buf, 20, sue_RTL_PITCH_DOWN); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_LEN); -#else - mavlink_serial_udb_extra_f7_t packet; - packet.sue_YAWKP_RUDDER = sue_YAWKP_RUDDER; - packet.sue_YAWKD_RUDDER = sue_YAWKD_RUDDER; - packet.sue_ROLLKP_RUDDER = sue_ROLLKP_RUDDER; - packet.sue_ROLLKD_RUDDER = sue_ROLLKD_RUDDER; - packet.sue_RUDDER_BOOST = sue_RUDDER_BOOST; - packet.sue_RTL_PITCH_DOWN = sue_RTL_PITCH_DOWN; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_CRC); -} - -/** - * @brief Pack a serial_udb_extra_f7 message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param sue_YAWKP_RUDDER Serial UDB YAWKP_RUDDER Gain for Proporional control of navigation - * @param sue_YAWKD_RUDDER Serial UDB YAWKD_RUDDER Gain for Rate control of navigation - * @param sue_ROLLKP_RUDDER Serial UDB Extra ROLLKP_RUDDER Gain for Proportional control of roll stabilization - * @param sue_ROLLKD_RUDDER Serial UDB Extra ROLLKD_RUDDER Gain for Rate control of roll stabilization - * @param sue_RUDDER_BOOST SERIAL UDB EXTRA Rudder Boost Gain to Manual Control when stabilized - * @param sue_RTL_PITCH_DOWN Serial UDB Extra Return To Landing - Angle to Pitch Plane Down - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f7_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - float sue_YAWKP_RUDDER,float sue_YAWKD_RUDDER,float sue_ROLLKP_RUDDER,float sue_ROLLKD_RUDDER,float sue_RUDDER_BOOST,float sue_RTL_PITCH_DOWN) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_LEN]; - _mav_put_float(buf, 0, sue_YAWKP_RUDDER); - _mav_put_float(buf, 4, sue_YAWKD_RUDDER); - _mav_put_float(buf, 8, sue_ROLLKP_RUDDER); - _mav_put_float(buf, 12, sue_ROLLKD_RUDDER); - _mav_put_float(buf, 16, sue_RUDDER_BOOST); - _mav_put_float(buf, 20, sue_RTL_PITCH_DOWN); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_LEN); -#else - mavlink_serial_udb_extra_f7_t packet; - packet.sue_YAWKP_RUDDER = sue_YAWKP_RUDDER; - packet.sue_YAWKD_RUDDER = sue_YAWKD_RUDDER; - packet.sue_ROLLKP_RUDDER = sue_ROLLKP_RUDDER; - packet.sue_ROLLKD_RUDDER = sue_ROLLKD_RUDDER; - packet.sue_RUDDER_BOOST = sue_RUDDER_BOOST; - packet.sue_RTL_PITCH_DOWN = sue_RTL_PITCH_DOWN; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_CRC); -} - -/** - * @brief Encode a serial_udb_extra_f7 struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f7 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f7_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_serial_udb_extra_f7_t* serial_udb_extra_f7) -{ - return mavlink_msg_serial_udb_extra_f7_pack(system_id, component_id, msg, serial_udb_extra_f7->sue_YAWKP_RUDDER, serial_udb_extra_f7->sue_YAWKD_RUDDER, serial_udb_extra_f7->sue_ROLLKP_RUDDER, serial_udb_extra_f7->sue_ROLLKD_RUDDER, serial_udb_extra_f7->sue_RUDDER_BOOST, serial_udb_extra_f7->sue_RTL_PITCH_DOWN); -} - -/** - * @brief Encode a serial_udb_extra_f7 struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f7 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f7_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_serial_udb_extra_f7_t* serial_udb_extra_f7) -{ - return mavlink_msg_serial_udb_extra_f7_pack_chan(system_id, component_id, chan, msg, serial_udb_extra_f7->sue_YAWKP_RUDDER, serial_udb_extra_f7->sue_YAWKD_RUDDER, serial_udb_extra_f7->sue_ROLLKP_RUDDER, serial_udb_extra_f7->sue_ROLLKD_RUDDER, serial_udb_extra_f7->sue_RUDDER_BOOST, serial_udb_extra_f7->sue_RTL_PITCH_DOWN); -} - -/** - * @brief Send a serial_udb_extra_f7 message - * @param chan MAVLink channel to send the message - * - * @param sue_YAWKP_RUDDER Serial UDB YAWKP_RUDDER Gain for Proporional control of navigation - * @param sue_YAWKD_RUDDER Serial UDB YAWKD_RUDDER Gain for Rate control of navigation - * @param sue_ROLLKP_RUDDER Serial UDB Extra ROLLKP_RUDDER Gain for Proportional control of roll stabilization - * @param sue_ROLLKD_RUDDER Serial UDB Extra ROLLKD_RUDDER Gain for Rate control of roll stabilization - * @param sue_RUDDER_BOOST SERIAL UDB EXTRA Rudder Boost Gain to Manual Control when stabilized - * @param sue_RTL_PITCH_DOWN Serial UDB Extra Return To Landing - Angle to Pitch Plane Down - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_serial_udb_extra_f7_send(mavlink_channel_t chan, float sue_YAWKP_RUDDER, float sue_YAWKD_RUDDER, float sue_ROLLKP_RUDDER, float sue_ROLLKD_RUDDER, float sue_RUDDER_BOOST, float sue_RTL_PITCH_DOWN) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_LEN]; - _mav_put_float(buf, 0, sue_YAWKP_RUDDER); - _mav_put_float(buf, 4, sue_YAWKD_RUDDER); - _mav_put_float(buf, 8, sue_ROLLKP_RUDDER); - _mav_put_float(buf, 12, sue_ROLLKD_RUDDER); - _mav_put_float(buf, 16, sue_RUDDER_BOOST); - _mav_put_float(buf, 20, sue_RTL_PITCH_DOWN); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_CRC); -#else - mavlink_serial_udb_extra_f7_t packet; - packet.sue_YAWKP_RUDDER = sue_YAWKP_RUDDER; - packet.sue_YAWKD_RUDDER = sue_YAWKD_RUDDER; - packet.sue_ROLLKP_RUDDER = sue_ROLLKP_RUDDER; - packet.sue_ROLLKD_RUDDER = sue_ROLLKD_RUDDER; - packet.sue_RUDDER_BOOST = sue_RUDDER_BOOST; - packet.sue_RTL_PITCH_DOWN = sue_RTL_PITCH_DOWN; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7, (const char *)&packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_CRC); -#endif -} - -/** - * @brief Send a serial_udb_extra_f7 message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_serial_udb_extra_f7_send_struct(mavlink_channel_t chan, const mavlink_serial_udb_extra_f7_t* serial_udb_extra_f7) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_serial_udb_extra_f7_send(chan, serial_udb_extra_f7->sue_YAWKP_RUDDER, serial_udb_extra_f7->sue_YAWKD_RUDDER, serial_udb_extra_f7->sue_ROLLKP_RUDDER, serial_udb_extra_f7->sue_ROLLKD_RUDDER, serial_udb_extra_f7->sue_RUDDER_BOOST, serial_udb_extra_f7->sue_RTL_PITCH_DOWN); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7, (const char *)serial_udb_extra_f7, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_CRC); -#endif -} - -#if MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_serial_udb_extra_f7_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, float sue_YAWKP_RUDDER, float sue_YAWKD_RUDDER, float sue_ROLLKP_RUDDER, float sue_ROLLKD_RUDDER, float sue_RUDDER_BOOST, float sue_RTL_PITCH_DOWN) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_float(buf, 0, sue_YAWKP_RUDDER); - _mav_put_float(buf, 4, sue_YAWKD_RUDDER); - _mav_put_float(buf, 8, sue_ROLLKP_RUDDER); - _mav_put_float(buf, 12, sue_ROLLKD_RUDDER); - _mav_put_float(buf, 16, sue_RUDDER_BOOST); - _mav_put_float(buf, 20, sue_RTL_PITCH_DOWN); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_CRC); -#else - mavlink_serial_udb_extra_f7_t *packet = (mavlink_serial_udb_extra_f7_t *)msgbuf; - packet->sue_YAWKP_RUDDER = sue_YAWKP_RUDDER; - packet->sue_YAWKD_RUDDER = sue_YAWKD_RUDDER; - packet->sue_ROLLKP_RUDDER = sue_ROLLKP_RUDDER; - packet->sue_ROLLKD_RUDDER = sue_ROLLKD_RUDDER; - packet->sue_RUDDER_BOOST = sue_RUDDER_BOOST; - packet->sue_RTL_PITCH_DOWN = sue_RTL_PITCH_DOWN; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7, (const char *)packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_CRC); -#endif -} -#endif - -#endif - -// MESSAGE SERIAL_UDB_EXTRA_F7 UNPACKING - - -/** - * @brief Get field sue_YAWKP_RUDDER from serial_udb_extra_f7 message - * - * @return Serial UDB YAWKP_RUDDER Gain for Proporional control of navigation - */ -static inline float mavlink_msg_serial_udb_extra_f7_get_sue_YAWKP_RUDDER(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 0); -} - -/** - * @brief Get field sue_YAWKD_RUDDER from serial_udb_extra_f7 message - * - * @return Serial UDB YAWKD_RUDDER Gain for Rate control of navigation - */ -static inline float mavlink_msg_serial_udb_extra_f7_get_sue_YAWKD_RUDDER(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 4); -} - -/** - * @brief Get field sue_ROLLKP_RUDDER from serial_udb_extra_f7 message - * - * @return Serial UDB Extra ROLLKP_RUDDER Gain for Proportional control of roll stabilization - */ -static inline float mavlink_msg_serial_udb_extra_f7_get_sue_ROLLKP_RUDDER(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field sue_ROLLKD_RUDDER from serial_udb_extra_f7 message - * - * @return Serial UDB Extra ROLLKD_RUDDER Gain for Rate control of roll stabilization - */ -static inline float mavlink_msg_serial_udb_extra_f7_get_sue_ROLLKD_RUDDER(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Get field sue_RUDDER_BOOST from serial_udb_extra_f7 message - * - * @return SERIAL UDB EXTRA Rudder Boost Gain to Manual Control when stabilized - */ -static inline float mavlink_msg_serial_udb_extra_f7_get_sue_RUDDER_BOOST(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 16); -} - -/** - * @brief Get field sue_RTL_PITCH_DOWN from serial_udb_extra_f7 message - * - * @return Serial UDB Extra Return To Landing - Angle to Pitch Plane Down - */ -static inline float mavlink_msg_serial_udb_extra_f7_get_sue_RTL_PITCH_DOWN(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 20); -} - -/** - * @brief Decode a serial_udb_extra_f7 message into a struct - * - * @param msg The message to decode - * @param serial_udb_extra_f7 C-struct to decode the message contents into - */ -static inline void mavlink_msg_serial_udb_extra_f7_decode(const mavlink_message_t* msg, mavlink_serial_udb_extra_f7_t* serial_udb_extra_f7) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - serial_udb_extra_f7->sue_YAWKP_RUDDER = mavlink_msg_serial_udb_extra_f7_get_sue_YAWKP_RUDDER(msg); - serial_udb_extra_f7->sue_YAWKD_RUDDER = mavlink_msg_serial_udb_extra_f7_get_sue_YAWKD_RUDDER(msg); - serial_udb_extra_f7->sue_ROLLKP_RUDDER = mavlink_msg_serial_udb_extra_f7_get_sue_ROLLKP_RUDDER(msg); - serial_udb_extra_f7->sue_ROLLKD_RUDDER = mavlink_msg_serial_udb_extra_f7_get_sue_ROLLKD_RUDDER(msg); - serial_udb_extra_f7->sue_RUDDER_BOOST = mavlink_msg_serial_udb_extra_f7_get_sue_RUDDER_BOOST(msg); - serial_udb_extra_f7->sue_RTL_PITCH_DOWN = mavlink_msg_serial_udb_extra_f7_get_sue_RTL_PITCH_DOWN(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_LEN? msg->len : MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_LEN; - memset(serial_udb_extra_f7, 0, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_LEN); - memcpy(serial_udb_extra_f7, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/matrixpilot/mavlink_msg_serial_udb_extra_f8.h b/matrixpilot/mavlink_msg_serial_udb_extra_f8.h deleted file mode 100644 index fde340568..000000000 --- a/matrixpilot/mavlink_msg_serial_udb_extra_f8.h +++ /dev/null @@ -1,363 +0,0 @@ -#pragma once -// MESSAGE SERIAL_UDB_EXTRA_F8 PACKING - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8 176 - - -typedef struct __mavlink_serial_udb_extra_f8_t { - float sue_HEIGHT_TARGET_MAX; /*< Serial UDB Extra HEIGHT_TARGET_MAX*/ - float sue_HEIGHT_TARGET_MIN; /*< Serial UDB Extra HEIGHT_TARGET_MIN*/ - float sue_ALT_HOLD_THROTTLE_MIN; /*< Serial UDB Extra ALT_HOLD_THROTTLE_MIN*/ - float sue_ALT_HOLD_THROTTLE_MAX; /*< Serial UDB Extra ALT_HOLD_THROTTLE_MAX*/ - float sue_ALT_HOLD_PITCH_MIN; /*< Serial UDB Extra ALT_HOLD_PITCH_MIN*/ - float sue_ALT_HOLD_PITCH_MAX; /*< Serial UDB Extra ALT_HOLD_PITCH_MAX*/ - float sue_ALT_HOLD_PITCH_HIGH; /*< Serial UDB Extra ALT_HOLD_PITCH_HIGH*/ -} mavlink_serial_udb_extra_f8_t; - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_LEN 28 -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_MIN_LEN 28 -#define MAVLINK_MSG_ID_176_LEN 28 -#define MAVLINK_MSG_ID_176_MIN_LEN 28 - -#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_CRC 142 -#define MAVLINK_MSG_ID_176_CRC 142 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F8 { \ - 176, \ - "SERIAL_UDB_EXTRA_F8", \ - 7, \ - { { "sue_HEIGHT_TARGET_MAX", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_serial_udb_extra_f8_t, sue_HEIGHT_TARGET_MAX) }, \ - { "sue_HEIGHT_TARGET_MIN", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_serial_udb_extra_f8_t, sue_HEIGHT_TARGET_MIN) }, \ - { "sue_ALT_HOLD_THROTTLE_MIN", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_serial_udb_extra_f8_t, sue_ALT_HOLD_THROTTLE_MIN) }, \ - { "sue_ALT_HOLD_THROTTLE_MAX", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_serial_udb_extra_f8_t, sue_ALT_HOLD_THROTTLE_MAX) }, \ - { "sue_ALT_HOLD_PITCH_MIN", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_serial_udb_extra_f8_t, sue_ALT_HOLD_PITCH_MIN) }, \ - { "sue_ALT_HOLD_PITCH_MAX", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_serial_udb_extra_f8_t, sue_ALT_HOLD_PITCH_MAX) }, \ - { "sue_ALT_HOLD_PITCH_HIGH", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_serial_udb_extra_f8_t, sue_ALT_HOLD_PITCH_HIGH) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F8 { \ - "SERIAL_UDB_EXTRA_F8", \ - 7, \ - { { "sue_HEIGHT_TARGET_MAX", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_serial_udb_extra_f8_t, sue_HEIGHT_TARGET_MAX) }, \ - { "sue_HEIGHT_TARGET_MIN", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_serial_udb_extra_f8_t, sue_HEIGHT_TARGET_MIN) }, \ - { "sue_ALT_HOLD_THROTTLE_MIN", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_serial_udb_extra_f8_t, sue_ALT_HOLD_THROTTLE_MIN) }, \ - { "sue_ALT_HOLD_THROTTLE_MAX", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_serial_udb_extra_f8_t, sue_ALT_HOLD_THROTTLE_MAX) }, \ - { "sue_ALT_HOLD_PITCH_MIN", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_serial_udb_extra_f8_t, sue_ALT_HOLD_PITCH_MIN) }, \ - { "sue_ALT_HOLD_PITCH_MAX", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_serial_udb_extra_f8_t, sue_ALT_HOLD_PITCH_MAX) }, \ - { "sue_ALT_HOLD_PITCH_HIGH", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_serial_udb_extra_f8_t, sue_ALT_HOLD_PITCH_HIGH) }, \ - } \ -} -#endif - -/** - * @brief Pack a serial_udb_extra_f8 message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param sue_HEIGHT_TARGET_MAX Serial UDB Extra HEIGHT_TARGET_MAX - * @param sue_HEIGHT_TARGET_MIN Serial UDB Extra HEIGHT_TARGET_MIN - * @param sue_ALT_HOLD_THROTTLE_MIN Serial UDB Extra ALT_HOLD_THROTTLE_MIN - * @param sue_ALT_HOLD_THROTTLE_MAX Serial UDB Extra ALT_HOLD_THROTTLE_MAX - * @param sue_ALT_HOLD_PITCH_MIN Serial UDB Extra ALT_HOLD_PITCH_MIN - * @param sue_ALT_HOLD_PITCH_MAX Serial UDB Extra ALT_HOLD_PITCH_MAX - * @param sue_ALT_HOLD_PITCH_HIGH Serial UDB Extra ALT_HOLD_PITCH_HIGH - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f8_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - float sue_HEIGHT_TARGET_MAX, float sue_HEIGHT_TARGET_MIN, float sue_ALT_HOLD_THROTTLE_MIN, float sue_ALT_HOLD_THROTTLE_MAX, float sue_ALT_HOLD_PITCH_MIN, float sue_ALT_HOLD_PITCH_MAX, float sue_ALT_HOLD_PITCH_HIGH) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_LEN]; - _mav_put_float(buf, 0, sue_HEIGHT_TARGET_MAX); - _mav_put_float(buf, 4, sue_HEIGHT_TARGET_MIN); - _mav_put_float(buf, 8, sue_ALT_HOLD_THROTTLE_MIN); - _mav_put_float(buf, 12, sue_ALT_HOLD_THROTTLE_MAX); - _mav_put_float(buf, 16, sue_ALT_HOLD_PITCH_MIN); - _mav_put_float(buf, 20, sue_ALT_HOLD_PITCH_MAX); - _mav_put_float(buf, 24, sue_ALT_HOLD_PITCH_HIGH); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_LEN); -#else - mavlink_serial_udb_extra_f8_t packet; - packet.sue_HEIGHT_TARGET_MAX = sue_HEIGHT_TARGET_MAX; - packet.sue_HEIGHT_TARGET_MIN = sue_HEIGHT_TARGET_MIN; - packet.sue_ALT_HOLD_THROTTLE_MIN = sue_ALT_HOLD_THROTTLE_MIN; - packet.sue_ALT_HOLD_THROTTLE_MAX = sue_ALT_HOLD_THROTTLE_MAX; - packet.sue_ALT_HOLD_PITCH_MIN = sue_ALT_HOLD_PITCH_MIN; - packet.sue_ALT_HOLD_PITCH_MAX = sue_ALT_HOLD_PITCH_MAX; - packet.sue_ALT_HOLD_PITCH_HIGH = sue_ALT_HOLD_PITCH_HIGH; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_CRC); -} - -/** - * @brief Pack a serial_udb_extra_f8 message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param sue_HEIGHT_TARGET_MAX Serial UDB Extra HEIGHT_TARGET_MAX - * @param sue_HEIGHT_TARGET_MIN Serial UDB Extra HEIGHT_TARGET_MIN - * @param sue_ALT_HOLD_THROTTLE_MIN Serial UDB Extra ALT_HOLD_THROTTLE_MIN - * @param sue_ALT_HOLD_THROTTLE_MAX Serial UDB Extra ALT_HOLD_THROTTLE_MAX - * @param sue_ALT_HOLD_PITCH_MIN Serial UDB Extra ALT_HOLD_PITCH_MIN - * @param sue_ALT_HOLD_PITCH_MAX Serial UDB Extra ALT_HOLD_PITCH_MAX - * @param sue_ALT_HOLD_PITCH_HIGH Serial UDB Extra ALT_HOLD_PITCH_HIGH - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f8_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - float sue_HEIGHT_TARGET_MAX,float sue_HEIGHT_TARGET_MIN,float sue_ALT_HOLD_THROTTLE_MIN,float sue_ALT_HOLD_THROTTLE_MAX,float sue_ALT_HOLD_PITCH_MIN,float sue_ALT_HOLD_PITCH_MAX,float sue_ALT_HOLD_PITCH_HIGH) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_LEN]; - _mav_put_float(buf, 0, sue_HEIGHT_TARGET_MAX); - _mav_put_float(buf, 4, sue_HEIGHT_TARGET_MIN); - _mav_put_float(buf, 8, sue_ALT_HOLD_THROTTLE_MIN); - _mav_put_float(buf, 12, sue_ALT_HOLD_THROTTLE_MAX); - _mav_put_float(buf, 16, sue_ALT_HOLD_PITCH_MIN); - _mav_put_float(buf, 20, sue_ALT_HOLD_PITCH_MAX); - _mav_put_float(buf, 24, sue_ALT_HOLD_PITCH_HIGH); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_LEN); -#else - mavlink_serial_udb_extra_f8_t packet; - packet.sue_HEIGHT_TARGET_MAX = sue_HEIGHT_TARGET_MAX; - packet.sue_HEIGHT_TARGET_MIN = sue_HEIGHT_TARGET_MIN; - packet.sue_ALT_HOLD_THROTTLE_MIN = sue_ALT_HOLD_THROTTLE_MIN; - packet.sue_ALT_HOLD_THROTTLE_MAX = sue_ALT_HOLD_THROTTLE_MAX; - packet.sue_ALT_HOLD_PITCH_MIN = sue_ALT_HOLD_PITCH_MIN; - packet.sue_ALT_HOLD_PITCH_MAX = sue_ALT_HOLD_PITCH_MAX; - packet.sue_ALT_HOLD_PITCH_HIGH = sue_ALT_HOLD_PITCH_HIGH; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_CRC); -} - -/** - * @brief Encode a serial_udb_extra_f8 struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f8 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f8_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_serial_udb_extra_f8_t* serial_udb_extra_f8) -{ - return mavlink_msg_serial_udb_extra_f8_pack(system_id, component_id, msg, serial_udb_extra_f8->sue_HEIGHT_TARGET_MAX, serial_udb_extra_f8->sue_HEIGHT_TARGET_MIN, serial_udb_extra_f8->sue_ALT_HOLD_THROTTLE_MIN, serial_udb_extra_f8->sue_ALT_HOLD_THROTTLE_MAX, serial_udb_extra_f8->sue_ALT_HOLD_PITCH_MIN, serial_udb_extra_f8->sue_ALT_HOLD_PITCH_MAX, serial_udb_extra_f8->sue_ALT_HOLD_PITCH_HIGH); -} - -/** - * @brief Encode a serial_udb_extra_f8 struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param serial_udb_extra_f8 C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_serial_udb_extra_f8_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_serial_udb_extra_f8_t* serial_udb_extra_f8) -{ - return mavlink_msg_serial_udb_extra_f8_pack_chan(system_id, component_id, chan, msg, serial_udb_extra_f8->sue_HEIGHT_TARGET_MAX, serial_udb_extra_f8->sue_HEIGHT_TARGET_MIN, serial_udb_extra_f8->sue_ALT_HOLD_THROTTLE_MIN, serial_udb_extra_f8->sue_ALT_HOLD_THROTTLE_MAX, serial_udb_extra_f8->sue_ALT_HOLD_PITCH_MIN, serial_udb_extra_f8->sue_ALT_HOLD_PITCH_MAX, serial_udb_extra_f8->sue_ALT_HOLD_PITCH_HIGH); -} - -/** - * @brief Send a serial_udb_extra_f8 message - * @param chan MAVLink channel to send the message - * - * @param sue_HEIGHT_TARGET_MAX Serial UDB Extra HEIGHT_TARGET_MAX - * @param sue_HEIGHT_TARGET_MIN Serial UDB Extra HEIGHT_TARGET_MIN - * @param sue_ALT_HOLD_THROTTLE_MIN Serial UDB Extra ALT_HOLD_THROTTLE_MIN - * @param sue_ALT_HOLD_THROTTLE_MAX Serial UDB Extra ALT_HOLD_THROTTLE_MAX - * @param sue_ALT_HOLD_PITCH_MIN Serial UDB Extra ALT_HOLD_PITCH_MIN - * @param sue_ALT_HOLD_PITCH_MAX Serial UDB Extra ALT_HOLD_PITCH_MAX - * @param sue_ALT_HOLD_PITCH_HIGH Serial UDB Extra ALT_HOLD_PITCH_HIGH - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_serial_udb_extra_f8_send(mavlink_channel_t chan, float sue_HEIGHT_TARGET_MAX, float sue_HEIGHT_TARGET_MIN, float sue_ALT_HOLD_THROTTLE_MIN, float sue_ALT_HOLD_THROTTLE_MAX, float sue_ALT_HOLD_PITCH_MIN, float sue_ALT_HOLD_PITCH_MAX, float sue_ALT_HOLD_PITCH_HIGH) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_LEN]; - _mav_put_float(buf, 0, sue_HEIGHT_TARGET_MAX); - _mav_put_float(buf, 4, sue_HEIGHT_TARGET_MIN); - _mav_put_float(buf, 8, sue_ALT_HOLD_THROTTLE_MIN); - _mav_put_float(buf, 12, sue_ALT_HOLD_THROTTLE_MAX); - _mav_put_float(buf, 16, sue_ALT_HOLD_PITCH_MIN); - _mav_put_float(buf, 20, sue_ALT_HOLD_PITCH_MAX); - _mav_put_float(buf, 24, sue_ALT_HOLD_PITCH_HIGH); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_CRC); -#else - mavlink_serial_udb_extra_f8_t packet; - packet.sue_HEIGHT_TARGET_MAX = sue_HEIGHT_TARGET_MAX; - packet.sue_HEIGHT_TARGET_MIN = sue_HEIGHT_TARGET_MIN; - packet.sue_ALT_HOLD_THROTTLE_MIN = sue_ALT_HOLD_THROTTLE_MIN; - packet.sue_ALT_HOLD_THROTTLE_MAX = sue_ALT_HOLD_THROTTLE_MAX; - packet.sue_ALT_HOLD_PITCH_MIN = sue_ALT_HOLD_PITCH_MIN; - packet.sue_ALT_HOLD_PITCH_MAX = sue_ALT_HOLD_PITCH_MAX; - packet.sue_ALT_HOLD_PITCH_HIGH = sue_ALT_HOLD_PITCH_HIGH; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8, (const char *)&packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_CRC); -#endif -} - -/** - * @brief Send a serial_udb_extra_f8 message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_serial_udb_extra_f8_send_struct(mavlink_channel_t chan, const mavlink_serial_udb_extra_f8_t* serial_udb_extra_f8) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_serial_udb_extra_f8_send(chan, serial_udb_extra_f8->sue_HEIGHT_TARGET_MAX, serial_udb_extra_f8->sue_HEIGHT_TARGET_MIN, serial_udb_extra_f8->sue_ALT_HOLD_THROTTLE_MIN, serial_udb_extra_f8->sue_ALT_HOLD_THROTTLE_MAX, serial_udb_extra_f8->sue_ALT_HOLD_PITCH_MIN, serial_udb_extra_f8->sue_ALT_HOLD_PITCH_MAX, serial_udb_extra_f8->sue_ALT_HOLD_PITCH_HIGH); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8, (const char *)serial_udb_extra_f8, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_CRC); -#endif -} - -#if MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_serial_udb_extra_f8_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, float sue_HEIGHT_TARGET_MAX, float sue_HEIGHT_TARGET_MIN, float sue_ALT_HOLD_THROTTLE_MIN, float sue_ALT_HOLD_THROTTLE_MAX, float sue_ALT_HOLD_PITCH_MIN, float sue_ALT_HOLD_PITCH_MAX, float sue_ALT_HOLD_PITCH_HIGH) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_float(buf, 0, sue_HEIGHT_TARGET_MAX); - _mav_put_float(buf, 4, sue_HEIGHT_TARGET_MIN); - _mav_put_float(buf, 8, sue_ALT_HOLD_THROTTLE_MIN); - _mav_put_float(buf, 12, sue_ALT_HOLD_THROTTLE_MAX); - _mav_put_float(buf, 16, sue_ALT_HOLD_PITCH_MIN); - _mav_put_float(buf, 20, sue_ALT_HOLD_PITCH_MAX); - _mav_put_float(buf, 24, sue_ALT_HOLD_PITCH_HIGH); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_CRC); -#else - mavlink_serial_udb_extra_f8_t *packet = (mavlink_serial_udb_extra_f8_t *)msgbuf; - packet->sue_HEIGHT_TARGET_MAX = sue_HEIGHT_TARGET_MAX; - packet->sue_HEIGHT_TARGET_MIN = sue_HEIGHT_TARGET_MIN; - packet->sue_ALT_HOLD_THROTTLE_MIN = sue_ALT_HOLD_THROTTLE_MIN; - packet->sue_ALT_HOLD_THROTTLE_MAX = sue_ALT_HOLD_THROTTLE_MAX; - packet->sue_ALT_HOLD_PITCH_MIN = sue_ALT_HOLD_PITCH_MIN; - packet->sue_ALT_HOLD_PITCH_MAX = sue_ALT_HOLD_PITCH_MAX; - packet->sue_ALT_HOLD_PITCH_HIGH = sue_ALT_HOLD_PITCH_HIGH; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8, (const char *)packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_CRC); -#endif -} -#endif - -#endif - -// MESSAGE SERIAL_UDB_EXTRA_F8 UNPACKING - - -/** - * @brief Get field sue_HEIGHT_TARGET_MAX from serial_udb_extra_f8 message - * - * @return Serial UDB Extra HEIGHT_TARGET_MAX - */ -static inline float mavlink_msg_serial_udb_extra_f8_get_sue_HEIGHT_TARGET_MAX(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 0); -} - -/** - * @brief Get field sue_HEIGHT_TARGET_MIN from serial_udb_extra_f8 message - * - * @return Serial UDB Extra HEIGHT_TARGET_MIN - */ -static inline float mavlink_msg_serial_udb_extra_f8_get_sue_HEIGHT_TARGET_MIN(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 4); -} - -/** - * @brief Get field sue_ALT_HOLD_THROTTLE_MIN from serial_udb_extra_f8 message - * - * @return Serial UDB Extra ALT_HOLD_THROTTLE_MIN - */ -static inline float mavlink_msg_serial_udb_extra_f8_get_sue_ALT_HOLD_THROTTLE_MIN(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field sue_ALT_HOLD_THROTTLE_MAX from serial_udb_extra_f8 message - * - * @return Serial UDB Extra ALT_HOLD_THROTTLE_MAX - */ -static inline float mavlink_msg_serial_udb_extra_f8_get_sue_ALT_HOLD_THROTTLE_MAX(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Get field sue_ALT_HOLD_PITCH_MIN from serial_udb_extra_f8 message - * - * @return Serial UDB Extra ALT_HOLD_PITCH_MIN - */ -static inline float mavlink_msg_serial_udb_extra_f8_get_sue_ALT_HOLD_PITCH_MIN(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 16); -} - -/** - * @brief Get field sue_ALT_HOLD_PITCH_MAX from serial_udb_extra_f8 message - * - * @return Serial UDB Extra ALT_HOLD_PITCH_MAX - */ -static inline float mavlink_msg_serial_udb_extra_f8_get_sue_ALT_HOLD_PITCH_MAX(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 20); -} - -/** - * @brief Get field sue_ALT_HOLD_PITCH_HIGH from serial_udb_extra_f8 message - * - * @return Serial UDB Extra ALT_HOLD_PITCH_HIGH - */ -static inline float mavlink_msg_serial_udb_extra_f8_get_sue_ALT_HOLD_PITCH_HIGH(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 24); -} - -/** - * @brief Decode a serial_udb_extra_f8 message into a struct - * - * @param msg The message to decode - * @param serial_udb_extra_f8 C-struct to decode the message contents into - */ -static inline void mavlink_msg_serial_udb_extra_f8_decode(const mavlink_message_t* msg, mavlink_serial_udb_extra_f8_t* serial_udb_extra_f8) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - serial_udb_extra_f8->sue_HEIGHT_TARGET_MAX = mavlink_msg_serial_udb_extra_f8_get_sue_HEIGHT_TARGET_MAX(msg); - serial_udb_extra_f8->sue_HEIGHT_TARGET_MIN = mavlink_msg_serial_udb_extra_f8_get_sue_HEIGHT_TARGET_MIN(msg); - serial_udb_extra_f8->sue_ALT_HOLD_THROTTLE_MIN = mavlink_msg_serial_udb_extra_f8_get_sue_ALT_HOLD_THROTTLE_MIN(msg); - serial_udb_extra_f8->sue_ALT_HOLD_THROTTLE_MAX = mavlink_msg_serial_udb_extra_f8_get_sue_ALT_HOLD_THROTTLE_MAX(msg); - serial_udb_extra_f8->sue_ALT_HOLD_PITCH_MIN = mavlink_msg_serial_udb_extra_f8_get_sue_ALT_HOLD_PITCH_MIN(msg); - serial_udb_extra_f8->sue_ALT_HOLD_PITCH_MAX = mavlink_msg_serial_udb_extra_f8_get_sue_ALT_HOLD_PITCH_MAX(msg); - serial_udb_extra_f8->sue_ALT_HOLD_PITCH_HIGH = mavlink_msg_serial_udb_extra_f8_get_sue_ALT_HOLD_PITCH_HIGH(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_LEN? msg->len : MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_LEN; - memset(serial_udb_extra_f8, 0, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_LEN); - memcpy(serial_udb_extra_f8, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/matrixpilot/testsuite.h b/matrixpilot/testsuite.h deleted file mode 100644 index 814dc0abb..000000000 --- a/matrixpilot/testsuite.h +++ /dev/null @@ -1,1710 +0,0 @@ -/** @file - * @brief MAVLink comm protocol testsuite generated from matrixpilot.xml - * @see http://qgroundcontrol.org/mavlink/ - */ -#pragma once -#ifndef MATRIXPILOT_TESTSUITE_H -#define MATRIXPILOT_TESTSUITE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef MAVLINK_TEST_ALL -#define MAVLINK_TEST_ALL -static void mavlink_test_common(uint8_t, uint8_t, mavlink_message_t *last_msg); -static void mavlink_test_matrixpilot(uint8_t, uint8_t, mavlink_message_t *last_msg); - -static void mavlink_test_all(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) -{ - mavlink_test_common(system_id, component_id, last_msg); - mavlink_test_matrixpilot(system_id, component_id, last_msg); -} -#endif - -#include "../common/testsuite.h" - - -static void mavlink_test_flexifunction_set(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) -{ -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); - if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_FLEXIFUNCTION_SET >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_flexifunction_set_t packet_in = { - 5,72 - }; - mavlink_flexifunction_set_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_FLEXIFUNCTION_SET_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_FLEXIFUNCTION_SET_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_flexifunction_set_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_flexifunction_set_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_flexifunction_set_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component ); - mavlink_msg_flexifunction_set_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_flexifunction_set_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component ); - mavlink_msg_flexifunction_set_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_flexifunction_read_req_t packet_in = { - 17235,17339,17,84 - }; - mavlink_flexifunction_read_req_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.read_req_type = packet_in.read_req_type; - packet1.data_index = packet_in.data_index; - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_FLEXIFUNCTION_READ_REQ_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_flexifunction_read_req_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_flexifunction_read_req_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_flexifunction_read_req_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.read_req_type , packet1.data_index ); - mavlink_msg_flexifunction_read_req_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_flexifunction_read_req_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.read_req_type , packet1.data_index ); - mavlink_msg_flexifunction_read_req_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_flexifunction_buffer_function_t packet_in = { - 17235,17339,17443,17547,29,96,{ 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210 } - }; - mavlink_flexifunction_buffer_function_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.func_index = packet_in.func_index; - packet1.func_count = packet_in.func_count; - packet1.data_address = packet_in.data_address; - packet1.data_size = packet_in.data_size; - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - - mav_array_memcpy(packet1.data, packet_in.data, sizeof(int8_t)*48); - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_flexifunction_buffer_function_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_flexifunction_buffer_function_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_flexifunction_buffer_function_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.func_index , packet1.func_count , packet1.data_address , packet1.data_size , packet1.data ); - mavlink_msg_flexifunction_buffer_function_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_flexifunction_buffer_function_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.func_index , packet1.func_count , packet1.data_address , packet1.data_size , packet1.data ); - mavlink_msg_flexifunction_buffer_function_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_flexifunction_buffer_function_ack_t packet_in = { - 17235,17339,17,84 - }; - mavlink_flexifunction_buffer_function_ack_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.func_index = packet_in.func_index; - packet1.result = packet_in.result; - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_flexifunction_buffer_function_ack_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_flexifunction_buffer_function_ack_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_flexifunction_buffer_function_ack_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.func_index , packet1.result ); - mavlink_msg_flexifunction_buffer_function_ack_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_flexifunction_buffer_function_ack_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.func_index , packet1.result ); - mavlink_msg_flexifunction_buffer_function_ack_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_flexifunction_directory_t packet_in = { - 5,72,139,206,17,{ 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131 } - }; - mavlink_flexifunction_directory_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - packet1.directory_type = packet_in.directory_type; - packet1.start_index = packet_in.start_index; - packet1.count = packet_in.count; - - mav_array_memcpy(packet1.directory_data, packet_in.directory_data, sizeof(int8_t)*48); - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_flexifunction_directory_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_flexifunction_directory_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_flexifunction_directory_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.directory_type , packet1.start_index , packet1.count , packet1.directory_data ); - mavlink_msg_flexifunction_directory_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_flexifunction_directory_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.directory_type , packet1.start_index , packet1.count , packet1.directory_data ); - mavlink_msg_flexifunction_directory_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_flexifunction_directory_ack_t packet_in = { - 17235,139,206,17,84,151 - }; - mavlink_flexifunction_directory_ack_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.result = packet_in.result; - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - packet1.directory_type = packet_in.directory_type; - packet1.start_index = packet_in.start_index; - packet1.count = packet_in.count; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_FLEXIFUNCTION_DIRECTORY_ACK_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_flexifunction_directory_ack_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_flexifunction_directory_ack_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_flexifunction_directory_ack_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.directory_type , packet1.start_index , packet1.count , packet1.result ); - mavlink_msg_flexifunction_directory_ack_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_flexifunction_directory_ack_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.directory_type , packet1.start_index , packet1.count , packet1.result ); - mavlink_msg_flexifunction_directory_ack_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_flexifunction_command_t packet_in = { - 5,72,139 - }; - mavlink_flexifunction_command_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.target_system = packet_in.target_system; - packet1.target_component = packet_in.target_component; - packet1.command_type = packet_in.command_type; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_flexifunction_command_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_flexifunction_command_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_flexifunction_command_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.command_type ); - mavlink_msg_flexifunction_command_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_flexifunction_command_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.command_type ); - mavlink_msg_flexifunction_command_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_flexifunction_command_ack_t packet_in = { - 17235,17339 - }; - mavlink_flexifunction_command_ack_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.command_type = packet_in.command_type; - packet1.result = packet_in.result; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_FLEXIFUNCTION_COMMAND_ACK_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_flexifunction_command_ack_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_flexifunction_command_ack_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_flexifunction_command_ack_pack(system_id, component_id, &msg , packet1.command_type , packet1.result ); - mavlink_msg_flexifunction_command_ack_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_flexifunction_command_ack_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.command_type , packet1.result ); - mavlink_msg_flexifunction_command_ack_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_serial_udb_extra_f2_a_t packet_in = { - 963497464,963497672,963497880,963498088,18067,18171,18275,18379,18483,18587,18691,18795,18899,19003,19107,19211,19315,19419,19523,19627,19731,19835,19939,20043,20147,20251,185 - }; - mavlink_serial_udb_extra_f2_a_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.sue_time = packet_in.sue_time; - packet1.sue_latitude = packet_in.sue_latitude; - packet1.sue_longitude = packet_in.sue_longitude; - packet1.sue_altitude = packet_in.sue_altitude; - packet1.sue_waypoint_index = packet_in.sue_waypoint_index; - packet1.sue_rmat0 = packet_in.sue_rmat0; - packet1.sue_rmat1 = packet_in.sue_rmat1; - packet1.sue_rmat2 = packet_in.sue_rmat2; - packet1.sue_rmat3 = packet_in.sue_rmat3; - packet1.sue_rmat4 = packet_in.sue_rmat4; - packet1.sue_rmat5 = packet_in.sue_rmat5; - packet1.sue_rmat6 = packet_in.sue_rmat6; - packet1.sue_rmat7 = packet_in.sue_rmat7; - packet1.sue_rmat8 = packet_in.sue_rmat8; - packet1.sue_cog = packet_in.sue_cog; - packet1.sue_sog = packet_in.sue_sog; - packet1.sue_cpu_load = packet_in.sue_cpu_load; - packet1.sue_air_speed_3DIMU = packet_in.sue_air_speed_3DIMU; - packet1.sue_estimated_wind_0 = packet_in.sue_estimated_wind_0; - packet1.sue_estimated_wind_1 = packet_in.sue_estimated_wind_1; - packet1.sue_estimated_wind_2 = packet_in.sue_estimated_wind_2; - packet1.sue_magFieldEarth0 = packet_in.sue_magFieldEarth0; - packet1.sue_magFieldEarth1 = packet_in.sue_magFieldEarth1; - packet1.sue_magFieldEarth2 = packet_in.sue_magFieldEarth2; - packet1.sue_svs = packet_in.sue_svs; - packet1.sue_hdop = packet_in.sue_hdop; - packet1.sue_status = packet_in.sue_status; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_A_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f2_a_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_serial_udb_extra_f2_a_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f2_a_pack(system_id, component_id, &msg , packet1.sue_time , packet1.sue_status , packet1.sue_latitude , packet1.sue_longitude , packet1.sue_altitude , packet1.sue_waypoint_index , packet1.sue_rmat0 , packet1.sue_rmat1 , packet1.sue_rmat2 , packet1.sue_rmat3 , packet1.sue_rmat4 , packet1.sue_rmat5 , packet1.sue_rmat6 , packet1.sue_rmat7 , packet1.sue_rmat8 , packet1.sue_cog , packet1.sue_sog , packet1.sue_cpu_load , packet1.sue_air_speed_3DIMU , packet1.sue_estimated_wind_0 , packet1.sue_estimated_wind_1 , packet1.sue_estimated_wind_2 , packet1.sue_magFieldEarth0 , packet1.sue_magFieldEarth1 , packet1.sue_magFieldEarth2 , packet1.sue_svs , packet1.sue_hdop ); - mavlink_msg_serial_udb_extra_f2_a_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f2_a_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.sue_time , packet1.sue_status , packet1.sue_latitude , packet1.sue_longitude , packet1.sue_altitude , packet1.sue_waypoint_index , packet1.sue_rmat0 , packet1.sue_rmat1 , packet1.sue_rmat2 , packet1.sue_rmat3 , packet1.sue_rmat4 , packet1.sue_rmat5 , packet1.sue_rmat6 , packet1.sue_rmat7 , packet1.sue_rmat8 , packet1.sue_cog , packet1.sue_sog , packet1.sue_cpu_load , packet1.sue_air_speed_3DIMU , packet1.sue_estimated_wind_0 , packet1.sue_estimated_wind_1 , packet1.sue_estimated_wind_2 , packet1.sue_magFieldEarth0 , packet1.sue_magFieldEarth1 , packet1.sue_magFieldEarth2 , packet1.sue_svs , packet1.sue_hdop ); - mavlink_msg_serial_udb_extra_f2_a_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_serial_udb_extra_f2_b_t packet_in = { - 963497464,963497672,963497880,963498088,18067,18171,18275,18379,18483,18587,18691,18795,18899,19003,19107,19211,19315,19419,19523,19627,19731,19835,19939,20043,20147,20251,20355,20459,20563,20667,20771,20875,20979,21083,21187,21291,21395,21499,21603,21707,21811,21915,22019,22123,22227,22331,22435,22539,22643,22747 - }; - mavlink_serial_udb_extra_f2_b_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.sue_time = packet_in.sue_time; - packet1.sue_flags = packet_in.sue_flags; - packet1.sue_barom_press = packet_in.sue_barom_press; - packet1.sue_barom_alt = packet_in.sue_barom_alt; - packet1.sue_pwm_input_1 = packet_in.sue_pwm_input_1; - packet1.sue_pwm_input_2 = packet_in.sue_pwm_input_2; - packet1.sue_pwm_input_3 = packet_in.sue_pwm_input_3; - packet1.sue_pwm_input_4 = packet_in.sue_pwm_input_4; - packet1.sue_pwm_input_5 = packet_in.sue_pwm_input_5; - packet1.sue_pwm_input_6 = packet_in.sue_pwm_input_6; - packet1.sue_pwm_input_7 = packet_in.sue_pwm_input_7; - packet1.sue_pwm_input_8 = packet_in.sue_pwm_input_8; - packet1.sue_pwm_input_9 = packet_in.sue_pwm_input_9; - packet1.sue_pwm_input_10 = packet_in.sue_pwm_input_10; - packet1.sue_pwm_input_11 = packet_in.sue_pwm_input_11; - packet1.sue_pwm_input_12 = packet_in.sue_pwm_input_12; - packet1.sue_pwm_output_1 = packet_in.sue_pwm_output_1; - packet1.sue_pwm_output_2 = packet_in.sue_pwm_output_2; - packet1.sue_pwm_output_3 = packet_in.sue_pwm_output_3; - packet1.sue_pwm_output_4 = packet_in.sue_pwm_output_4; - packet1.sue_pwm_output_5 = packet_in.sue_pwm_output_5; - packet1.sue_pwm_output_6 = packet_in.sue_pwm_output_6; - packet1.sue_pwm_output_7 = packet_in.sue_pwm_output_7; - packet1.sue_pwm_output_8 = packet_in.sue_pwm_output_8; - packet1.sue_pwm_output_9 = packet_in.sue_pwm_output_9; - packet1.sue_pwm_output_10 = packet_in.sue_pwm_output_10; - packet1.sue_pwm_output_11 = packet_in.sue_pwm_output_11; - packet1.sue_pwm_output_12 = packet_in.sue_pwm_output_12; - packet1.sue_imu_location_x = packet_in.sue_imu_location_x; - packet1.sue_imu_location_y = packet_in.sue_imu_location_y; - packet1.sue_imu_location_z = packet_in.sue_imu_location_z; - packet1.sue_location_error_earth_x = packet_in.sue_location_error_earth_x; - packet1.sue_location_error_earth_y = packet_in.sue_location_error_earth_y; - packet1.sue_location_error_earth_z = packet_in.sue_location_error_earth_z; - packet1.sue_osc_fails = packet_in.sue_osc_fails; - packet1.sue_imu_velocity_x = packet_in.sue_imu_velocity_x; - packet1.sue_imu_velocity_y = packet_in.sue_imu_velocity_y; - packet1.sue_imu_velocity_z = packet_in.sue_imu_velocity_z; - packet1.sue_waypoint_goal_x = packet_in.sue_waypoint_goal_x; - packet1.sue_waypoint_goal_y = packet_in.sue_waypoint_goal_y; - packet1.sue_waypoint_goal_z = packet_in.sue_waypoint_goal_z; - packet1.sue_aero_x = packet_in.sue_aero_x; - packet1.sue_aero_y = packet_in.sue_aero_y; - packet1.sue_aero_z = packet_in.sue_aero_z; - packet1.sue_barom_temp = packet_in.sue_barom_temp; - packet1.sue_bat_volt = packet_in.sue_bat_volt; - packet1.sue_bat_amp = packet_in.sue_bat_amp; - packet1.sue_bat_amp_hours = packet_in.sue_bat_amp_hours; - packet1.sue_desired_height = packet_in.sue_desired_height; - packet1.sue_memory_stack_free = packet_in.sue_memory_stack_free; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F2_B_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f2_b_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_serial_udb_extra_f2_b_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f2_b_pack(system_id, component_id, &msg , packet1.sue_time , packet1.sue_pwm_input_1 , packet1.sue_pwm_input_2 , packet1.sue_pwm_input_3 , packet1.sue_pwm_input_4 , packet1.sue_pwm_input_5 , packet1.sue_pwm_input_6 , packet1.sue_pwm_input_7 , packet1.sue_pwm_input_8 , packet1.sue_pwm_input_9 , packet1.sue_pwm_input_10 , packet1.sue_pwm_input_11 , packet1.sue_pwm_input_12 , packet1.sue_pwm_output_1 , packet1.sue_pwm_output_2 , packet1.sue_pwm_output_3 , packet1.sue_pwm_output_4 , packet1.sue_pwm_output_5 , packet1.sue_pwm_output_6 , packet1.sue_pwm_output_7 , packet1.sue_pwm_output_8 , packet1.sue_pwm_output_9 , packet1.sue_pwm_output_10 , packet1.sue_pwm_output_11 , packet1.sue_pwm_output_12 , packet1.sue_imu_location_x , packet1.sue_imu_location_y , packet1.sue_imu_location_z , packet1.sue_location_error_earth_x , packet1.sue_location_error_earth_y , packet1.sue_location_error_earth_z , packet1.sue_flags , packet1.sue_osc_fails , packet1.sue_imu_velocity_x , packet1.sue_imu_velocity_y , packet1.sue_imu_velocity_z , packet1.sue_waypoint_goal_x , packet1.sue_waypoint_goal_y , packet1.sue_waypoint_goal_z , packet1.sue_aero_x , packet1.sue_aero_y , packet1.sue_aero_z , packet1.sue_barom_temp , packet1.sue_barom_press , packet1.sue_barom_alt , packet1.sue_bat_volt , packet1.sue_bat_amp , packet1.sue_bat_amp_hours , packet1.sue_desired_height , packet1.sue_memory_stack_free ); - mavlink_msg_serial_udb_extra_f2_b_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f2_b_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.sue_time , packet1.sue_pwm_input_1 , packet1.sue_pwm_input_2 , packet1.sue_pwm_input_3 , packet1.sue_pwm_input_4 , packet1.sue_pwm_input_5 , packet1.sue_pwm_input_6 , packet1.sue_pwm_input_7 , packet1.sue_pwm_input_8 , packet1.sue_pwm_input_9 , packet1.sue_pwm_input_10 , packet1.sue_pwm_input_11 , packet1.sue_pwm_input_12 , packet1.sue_pwm_output_1 , packet1.sue_pwm_output_2 , packet1.sue_pwm_output_3 , packet1.sue_pwm_output_4 , packet1.sue_pwm_output_5 , packet1.sue_pwm_output_6 , packet1.sue_pwm_output_7 , packet1.sue_pwm_output_8 , packet1.sue_pwm_output_9 , packet1.sue_pwm_output_10 , packet1.sue_pwm_output_11 , packet1.sue_pwm_output_12 , packet1.sue_imu_location_x , packet1.sue_imu_location_y , packet1.sue_imu_location_z , packet1.sue_location_error_earth_x , packet1.sue_location_error_earth_y , packet1.sue_location_error_earth_z , packet1.sue_flags , packet1.sue_osc_fails , packet1.sue_imu_velocity_x , packet1.sue_imu_velocity_y , packet1.sue_imu_velocity_z , packet1.sue_waypoint_goal_x , packet1.sue_waypoint_goal_y , packet1.sue_waypoint_goal_z , packet1.sue_aero_x , packet1.sue_aero_y , packet1.sue_aero_z , packet1.sue_barom_temp , packet1.sue_barom_press , packet1.sue_barom_alt , packet1.sue_bat_volt , packet1.sue_bat_amp , packet1.sue_bat_amp_hours , packet1.sue_desired_height , packet1.sue_memory_stack_free ); - mavlink_msg_serial_udb_extra_f2_b_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4 >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_serial_udb_extra_f4_t packet_in = { - 5,72,139,206,17,84,151,218,29,96 - }; - mavlink_serial_udb_extra_f4_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.sue_ROLL_STABILIZATION_AILERONS = packet_in.sue_ROLL_STABILIZATION_AILERONS; - packet1.sue_ROLL_STABILIZATION_RUDDER = packet_in.sue_ROLL_STABILIZATION_RUDDER; - packet1.sue_PITCH_STABILIZATION = packet_in.sue_PITCH_STABILIZATION; - packet1.sue_YAW_STABILIZATION_RUDDER = packet_in.sue_YAW_STABILIZATION_RUDDER; - packet1.sue_YAW_STABILIZATION_AILERON = packet_in.sue_YAW_STABILIZATION_AILERON; - packet1.sue_AILERON_NAVIGATION = packet_in.sue_AILERON_NAVIGATION; - packet1.sue_RUDDER_NAVIGATION = packet_in.sue_RUDDER_NAVIGATION; - packet1.sue_ALTITUDEHOLD_STABILIZED = packet_in.sue_ALTITUDEHOLD_STABILIZED; - packet1.sue_ALTITUDEHOLD_WAYPOINT = packet_in.sue_ALTITUDEHOLD_WAYPOINT; - packet1.sue_RACING_MODE = packet_in.sue_RACING_MODE; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F4_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f4_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_serial_udb_extra_f4_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f4_pack(system_id, component_id, &msg , packet1.sue_ROLL_STABILIZATION_AILERONS , packet1.sue_ROLL_STABILIZATION_RUDDER , packet1.sue_PITCH_STABILIZATION , packet1.sue_YAW_STABILIZATION_RUDDER , packet1.sue_YAW_STABILIZATION_AILERON , packet1.sue_AILERON_NAVIGATION , packet1.sue_RUDDER_NAVIGATION , packet1.sue_ALTITUDEHOLD_STABILIZED , packet1.sue_ALTITUDEHOLD_WAYPOINT , packet1.sue_RACING_MODE ); - mavlink_msg_serial_udb_extra_f4_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f4_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.sue_ROLL_STABILIZATION_AILERONS , packet1.sue_ROLL_STABILIZATION_RUDDER , packet1.sue_PITCH_STABILIZATION , packet1.sue_YAW_STABILIZATION_RUDDER , packet1.sue_YAW_STABILIZATION_AILERON , packet1.sue_AILERON_NAVIGATION , packet1.sue_RUDDER_NAVIGATION , packet1.sue_ALTITUDEHOLD_STABILIZED , packet1.sue_ALTITUDEHOLD_WAYPOINT , packet1.sue_RACING_MODE ); - mavlink_msg_serial_udb_extra_f4_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5 >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_serial_udb_extra_f5_t packet_in = { - 17.0,45.0,73.0,101.0 - }; - mavlink_serial_udb_extra_f5_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.sue_YAWKP_AILERON = packet_in.sue_YAWKP_AILERON; - packet1.sue_YAWKD_AILERON = packet_in.sue_YAWKD_AILERON; - packet1.sue_ROLLKP = packet_in.sue_ROLLKP; - packet1.sue_ROLLKD = packet_in.sue_ROLLKD; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f5_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_serial_udb_extra_f5_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f5_pack(system_id, component_id, &msg , packet1.sue_YAWKP_AILERON , packet1.sue_YAWKD_AILERON , packet1.sue_ROLLKP , packet1.sue_ROLLKD ); - mavlink_msg_serial_udb_extra_f5_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f5_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.sue_YAWKP_AILERON , packet1.sue_YAWKD_AILERON , packet1.sue_ROLLKP , packet1.sue_ROLLKD ); - mavlink_msg_serial_udb_extra_f5_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6 >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_serial_udb_extra_f6_t packet_in = { - 17.0,45.0,73.0,101.0,129.0 - }; - mavlink_serial_udb_extra_f6_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.sue_PITCHGAIN = packet_in.sue_PITCHGAIN; - packet1.sue_PITCHKD = packet_in.sue_PITCHKD; - packet1.sue_RUDDER_ELEV_MIX = packet_in.sue_RUDDER_ELEV_MIX; - packet1.sue_ROLL_ELEV_MIX = packet_in.sue_ROLL_ELEV_MIX; - packet1.sue_ELEVATOR_BOOST = packet_in.sue_ELEVATOR_BOOST; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F6_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f6_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_serial_udb_extra_f6_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f6_pack(system_id, component_id, &msg , packet1.sue_PITCHGAIN , packet1.sue_PITCHKD , packet1.sue_RUDDER_ELEV_MIX , packet1.sue_ROLL_ELEV_MIX , packet1.sue_ELEVATOR_BOOST ); - mavlink_msg_serial_udb_extra_f6_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f6_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.sue_PITCHGAIN , packet1.sue_PITCHKD , packet1.sue_RUDDER_ELEV_MIX , packet1.sue_ROLL_ELEV_MIX , packet1.sue_ELEVATOR_BOOST ); - mavlink_msg_serial_udb_extra_f6_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7 >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_serial_udb_extra_f7_t packet_in = { - 17.0,45.0,73.0,101.0,129.0,157.0 - }; - mavlink_serial_udb_extra_f7_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.sue_YAWKP_RUDDER = packet_in.sue_YAWKP_RUDDER; - packet1.sue_YAWKD_RUDDER = packet_in.sue_YAWKD_RUDDER; - packet1.sue_ROLLKP_RUDDER = packet_in.sue_ROLLKP_RUDDER; - packet1.sue_ROLLKD_RUDDER = packet_in.sue_ROLLKD_RUDDER; - packet1.sue_RUDDER_BOOST = packet_in.sue_RUDDER_BOOST; - packet1.sue_RTL_PITCH_DOWN = packet_in.sue_RTL_PITCH_DOWN; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F7_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f7_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_serial_udb_extra_f7_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f7_pack(system_id, component_id, &msg , packet1.sue_YAWKP_RUDDER , packet1.sue_YAWKD_RUDDER , packet1.sue_ROLLKP_RUDDER , packet1.sue_ROLLKD_RUDDER , packet1.sue_RUDDER_BOOST , packet1.sue_RTL_PITCH_DOWN ); - mavlink_msg_serial_udb_extra_f7_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f7_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.sue_YAWKP_RUDDER , packet1.sue_YAWKD_RUDDER , packet1.sue_ROLLKP_RUDDER , packet1.sue_ROLLKD_RUDDER , packet1.sue_RUDDER_BOOST , packet1.sue_RTL_PITCH_DOWN ); - mavlink_msg_serial_udb_extra_f7_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8 >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_serial_udb_extra_f8_t packet_in = { - 17.0,45.0,73.0,101.0,129.0,157.0,185.0 - }; - mavlink_serial_udb_extra_f8_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.sue_HEIGHT_TARGET_MAX = packet_in.sue_HEIGHT_TARGET_MAX; - packet1.sue_HEIGHT_TARGET_MIN = packet_in.sue_HEIGHT_TARGET_MIN; - packet1.sue_ALT_HOLD_THROTTLE_MIN = packet_in.sue_ALT_HOLD_THROTTLE_MIN; - packet1.sue_ALT_HOLD_THROTTLE_MAX = packet_in.sue_ALT_HOLD_THROTTLE_MAX; - packet1.sue_ALT_HOLD_PITCH_MIN = packet_in.sue_ALT_HOLD_PITCH_MIN; - packet1.sue_ALT_HOLD_PITCH_MAX = packet_in.sue_ALT_HOLD_PITCH_MAX; - packet1.sue_ALT_HOLD_PITCH_HIGH = packet_in.sue_ALT_HOLD_PITCH_HIGH; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F8_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f8_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_serial_udb_extra_f8_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f8_pack(system_id, component_id, &msg , packet1.sue_HEIGHT_TARGET_MAX , packet1.sue_HEIGHT_TARGET_MIN , packet1.sue_ALT_HOLD_THROTTLE_MIN , packet1.sue_ALT_HOLD_THROTTLE_MAX , packet1.sue_ALT_HOLD_PITCH_MIN , packet1.sue_ALT_HOLD_PITCH_MAX , packet1.sue_ALT_HOLD_PITCH_HIGH ); - mavlink_msg_serial_udb_extra_f8_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f8_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.sue_HEIGHT_TARGET_MAX , packet1.sue_HEIGHT_TARGET_MIN , packet1.sue_ALT_HOLD_THROTTLE_MIN , packet1.sue_ALT_HOLD_THROTTLE_MAX , packet1.sue_ALT_HOLD_PITCH_MIN , packet1.sue_ALT_HOLD_PITCH_MAX , packet1.sue_ALT_HOLD_PITCH_HIGH ); - mavlink_msg_serial_udb_extra_f8_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13 >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_serial_udb_extra_f13_t packet_in = { - 963497464,963497672,963497880,17859 - }; - mavlink_serial_udb_extra_f13_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.sue_lat_origin = packet_in.sue_lat_origin; - packet1.sue_lon_origin = packet_in.sue_lon_origin; - packet1.sue_alt_origin = packet_in.sue_alt_origin; - packet1.sue_week_no = packet_in.sue_week_no; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F13_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f13_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_serial_udb_extra_f13_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f13_pack(system_id, component_id, &msg , packet1.sue_week_no , packet1.sue_lat_origin , packet1.sue_lon_origin , packet1.sue_alt_origin ); - mavlink_msg_serial_udb_extra_f13_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f13_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.sue_week_no , packet1.sue_lat_origin , packet1.sue_lon_origin , packet1.sue_alt_origin ); - mavlink_msg_serial_udb_extra_f13_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14 >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_serial_udb_extra_f14_t packet_in = { - 963497464,17443,17547,17651,163,230,41,108,175,242,53 - }; - mavlink_serial_udb_extra_f14_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.sue_TRAP_SOURCE = packet_in.sue_TRAP_SOURCE; - packet1.sue_RCON = packet_in.sue_RCON; - packet1.sue_TRAP_FLAGS = packet_in.sue_TRAP_FLAGS; - packet1.sue_osc_fail_count = packet_in.sue_osc_fail_count; - packet1.sue_WIND_ESTIMATION = packet_in.sue_WIND_ESTIMATION; - packet1.sue_GPS_TYPE = packet_in.sue_GPS_TYPE; - packet1.sue_DR = packet_in.sue_DR; - packet1.sue_BOARD_TYPE = packet_in.sue_BOARD_TYPE; - packet1.sue_AIRFRAME = packet_in.sue_AIRFRAME; - packet1.sue_CLOCK_CONFIG = packet_in.sue_CLOCK_CONFIG; - packet1.sue_FLIGHT_PLAN_TYPE = packet_in.sue_FLIGHT_PLAN_TYPE; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F14_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f14_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_serial_udb_extra_f14_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f14_pack(system_id, component_id, &msg , packet1.sue_WIND_ESTIMATION , packet1.sue_GPS_TYPE , packet1.sue_DR , packet1.sue_BOARD_TYPE , packet1.sue_AIRFRAME , packet1.sue_RCON , packet1.sue_TRAP_FLAGS , packet1.sue_TRAP_SOURCE , packet1.sue_osc_fail_count , packet1.sue_CLOCK_CONFIG , packet1.sue_FLIGHT_PLAN_TYPE ); - mavlink_msg_serial_udb_extra_f14_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f14_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.sue_WIND_ESTIMATION , packet1.sue_GPS_TYPE , packet1.sue_DR , packet1.sue_BOARD_TYPE , packet1.sue_AIRFRAME , packet1.sue_RCON , packet1.sue_TRAP_FLAGS , packet1.sue_TRAP_SOURCE , packet1.sue_osc_fail_count , packet1.sue_CLOCK_CONFIG , packet1.sue_FLIGHT_PLAN_TYPE ); - mavlink_msg_serial_udb_extra_f14_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15 >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_serial_udb_extra_f15_t packet_in = { - { 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44 },{ 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144 } - }; - mavlink_serial_udb_extra_f15_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - - mav_array_memcpy(packet1.sue_ID_VEHICLE_MODEL_NAME, packet_in.sue_ID_VEHICLE_MODEL_NAME, sizeof(uint8_t)*40); - mav_array_memcpy(packet1.sue_ID_VEHICLE_REGISTRATION, packet_in.sue_ID_VEHICLE_REGISTRATION, sizeof(uint8_t)*20); - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F15_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f15_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_serial_udb_extra_f15_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f15_pack(system_id, component_id, &msg , packet1.sue_ID_VEHICLE_MODEL_NAME , packet1.sue_ID_VEHICLE_REGISTRATION ); - mavlink_msg_serial_udb_extra_f15_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f15_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.sue_ID_VEHICLE_MODEL_NAME , packet1.sue_ID_VEHICLE_REGISTRATION ); - mavlink_msg_serial_udb_extra_f15_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16 >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_serial_udb_extra_f16_t packet_in = { - { 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44 },{ 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194 } - }; - mavlink_serial_udb_extra_f16_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - - mav_array_memcpy(packet1.sue_ID_LEAD_PILOT, packet_in.sue_ID_LEAD_PILOT, sizeof(uint8_t)*40); - mav_array_memcpy(packet1.sue_ID_DIY_DRONES_URL, packet_in.sue_ID_DIY_DRONES_URL, sizeof(uint8_t)*70); - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F16_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f16_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_serial_udb_extra_f16_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f16_pack(system_id, component_id, &msg , packet1.sue_ID_LEAD_PILOT , packet1.sue_ID_DIY_DRONES_URL ); - mavlink_msg_serial_udb_extra_f16_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f16_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.sue_ID_LEAD_PILOT , packet1.sue_ID_DIY_DRONES_URL ); - mavlink_msg_serial_udb_extra_f16_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ALTITUDES >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_altitudes_t packet_in = { - 963497464,963497672,963497880,963498088,963498296,963498504,963498712 - }; - mavlink_altitudes_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.time_boot_ms = packet_in.time_boot_ms; - packet1.alt_gps = packet_in.alt_gps; - packet1.alt_imu = packet_in.alt_imu; - packet1.alt_barometric = packet_in.alt_barometric; - packet1.alt_optical_flow = packet_in.alt_optical_flow; - packet1.alt_range_finder = packet_in.alt_range_finder; - packet1.alt_extra = packet_in.alt_extra; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_ALTITUDES_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ALTITUDES_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_altitudes_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_altitudes_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_altitudes_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.alt_gps , packet1.alt_imu , packet1.alt_barometric , packet1.alt_optical_flow , packet1.alt_range_finder , packet1.alt_extra ); - mavlink_msg_altitudes_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_altitudes_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.alt_gps , packet1.alt_imu , packet1.alt_barometric , packet1.alt_optical_flow , packet1.alt_range_finder , packet1.alt_extra ); - mavlink_msg_altitudes_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_AIRSPEEDS >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_airspeeds_t packet_in = { - 963497464,17443,17547,17651,17755,17859,17963 - }; - mavlink_airspeeds_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.time_boot_ms = packet_in.time_boot_ms; - packet1.airspeed_imu = packet_in.airspeed_imu; - packet1.airspeed_pitot = packet_in.airspeed_pitot; - packet1.airspeed_hot_wire = packet_in.airspeed_hot_wire; - packet1.airspeed_ultrasonic = packet_in.airspeed_ultrasonic; - packet1.aoa = packet_in.aoa; - packet1.aoy = packet_in.aoy; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_AIRSPEEDS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_AIRSPEEDS_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_airspeeds_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_airspeeds_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_airspeeds_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.airspeed_imu , packet1.airspeed_pitot , packet1.airspeed_hot_wire , packet1.airspeed_ultrasonic , packet1.aoa , packet1.aoy ); - mavlink_msg_airspeeds_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_airspeeds_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.airspeed_imu , packet1.airspeed_pitot , packet1.airspeed_hot_wire , packet1.airspeed_ultrasonic , packet1.aoa , packet1.aoy ); - mavlink_msg_airspeeds_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17 >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_serial_udb_extra_f17_t packet_in = { - 17.0,45.0,73.0 - }; - mavlink_serial_udb_extra_f17_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.sue_feed_forward = packet_in.sue_feed_forward; - packet1.sue_turn_rate_nav = packet_in.sue_turn_rate_nav; - packet1.sue_turn_rate_fbw = packet_in.sue_turn_rate_fbw; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F17_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f17_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_serial_udb_extra_f17_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f17_pack(system_id, component_id, &msg , packet1.sue_feed_forward , packet1.sue_turn_rate_nav , packet1.sue_turn_rate_fbw ); - mavlink_msg_serial_udb_extra_f17_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f17_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.sue_feed_forward , packet1.sue_turn_rate_nav , packet1.sue_turn_rate_fbw ); - mavlink_msg_serial_udb_extra_f17_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18 >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_serial_udb_extra_f18_t packet_in = { - 17.0,45.0,73.0,101.0,129.0 - }; - mavlink_serial_udb_extra_f18_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.angle_of_attack_normal = packet_in.angle_of_attack_normal; - packet1.angle_of_attack_inverted = packet_in.angle_of_attack_inverted; - packet1.elevator_trim_normal = packet_in.elevator_trim_normal; - packet1.elevator_trim_inverted = packet_in.elevator_trim_inverted; - packet1.reference_speed = packet_in.reference_speed; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F18_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f18_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_serial_udb_extra_f18_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f18_pack(system_id, component_id, &msg , packet1.angle_of_attack_normal , packet1.angle_of_attack_inverted , packet1.elevator_trim_normal , packet1.elevator_trim_inverted , packet1.reference_speed ); - mavlink_msg_serial_udb_extra_f18_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f18_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.angle_of_attack_normal , packet1.angle_of_attack_inverted , packet1.elevator_trim_normal , packet1.elevator_trim_inverted , packet1.reference_speed ); - mavlink_msg_serial_udb_extra_f18_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19 >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_serial_udb_extra_f19_t packet_in = { - 5,72,139,206,17,84,151,218 - }; - mavlink_serial_udb_extra_f19_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.sue_aileron_output_channel = packet_in.sue_aileron_output_channel; - packet1.sue_aileron_reversed = packet_in.sue_aileron_reversed; - packet1.sue_elevator_output_channel = packet_in.sue_elevator_output_channel; - packet1.sue_elevator_reversed = packet_in.sue_elevator_reversed; - packet1.sue_throttle_output_channel = packet_in.sue_throttle_output_channel; - packet1.sue_throttle_reversed = packet_in.sue_throttle_reversed; - packet1.sue_rudder_output_channel = packet_in.sue_rudder_output_channel; - packet1.sue_rudder_reversed = packet_in.sue_rudder_reversed; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F19_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f19_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_serial_udb_extra_f19_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f19_pack(system_id, component_id, &msg , packet1.sue_aileron_output_channel , packet1.sue_aileron_reversed , packet1.sue_elevator_output_channel , packet1.sue_elevator_reversed , packet1.sue_throttle_output_channel , packet1.sue_throttle_reversed , packet1.sue_rudder_output_channel , packet1.sue_rudder_reversed ); - mavlink_msg_serial_udb_extra_f19_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f19_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.sue_aileron_output_channel , packet1.sue_aileron_reversed , packet1.sue_elevator_output_channel , packet1.sue_elevator_reversed , packet1.sue_throttle_output_channel , packet1.sue_throttle_reversed , packet1.sue_rudder_output_channel , packet1.sue_rudder_reversed ); - mavlink_msg_serial_udb_extra_f19_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20 >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_serial_udb_extra_f20_t packet_in = { - 17235,17339,17443,17547,17651,17755,17859,17963,18067,18171,18275,18379,77 - }; - mavlink_serial_udb_extra_f20_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.sue_trim_value_input_1 = packet_in.sue_trim_value_input_1; - packet1.sue_trim_value_input_2 = packet_in.sue_trim_value_input_2; - packet1.sue_trim_value_input_3 = packet_in.sue_trim_value_input_3; - packet1.sue_trim_value_input_4 = packet_in.sue_trim_value_input_4; - packet1.sue_trim_value_input_5 = packet_in.sue_trim_value_input_5; - packet1.sue_trim_value_input_6 = packet_in.sue_trim_value_input_6; - packet1.sue_trim_value_input_7 = packet_in.sue_trim_value_input_7; - packet1.sue_trim_value_input_8 = packet_in.sue_trim_value_input_8; - packet1.sue_trim_value_input_9 = packet_in.sue_trim_value_input_9; - packet1.sue_trim_value_input_10 = packet_in.sue_trim_value_input_10; - packet1.sue_trim_value_input_11 = packet_in.sue_trim_value_input_11; - packet1.sue_trim_value_input_12 = packet_in.sue_trim_value_input_12; - packet1.sue_number_of_inputs = packet_in.sue_number_of_inputs; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F20_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f20_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_serial_udb_extra_f20_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f20_pack(system_id, component_id, &msg , packet1.sue_number_of_inputs , packet1.sue_trim_value_input_1 , packet1.sue_trim_value_input_2 , packet1.sue_trim_value_input_3 , packet1.sue_trim_value_input_4 , packet1.sue_trim_value_input_5 , packet1.sue_trim_value_input_6 , packet1.sue_trim_value_input_7 , packet1.sue_trim_value_input_8 , packet1.sue_trim_value_input_9 , packet1.sue_trim_value_input_10 , packet1.sue_trim_value_input_11 , packet1.sue_trim_value_input_12 ); - mavlink_msg_serial_udb_extra_f20_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f20_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.sue_number_of_inputs , packet1.sue_trim_value_input_1 , packet1.sue_trim_value_input_2 , packet1.sue_trim_value_input_3 , packet1.sue_trim_value_input_4 , packet1.sue_trim_value_input_5 , packet1.sue_trim_value_input_6 , packet1.sue_trim_value_input_7 , packet1.sue_trim_value_input_8 , packet1.sue_trim_value_input_9 , packet1.sue_trim_value_input_10 , packet1.sue_trim_value_input_11 , packet1.sue_trim_value_input_12 ); - mavlink_msg_serial_udb_extra_f20_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21 >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_serial_udb_extra_f21_t packet_in = { - 17235,17339,17443,17547,17651,17755 - }; - mavlink_serial_udb_extra_f21_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.sue_accel_x_offset = packet_in.sue_accel_x_offset; - packet1.sue_accel_y_offset = packet_in.sue_accel_y_offset; - packet1.sue_accel_z_offset = packet_in.sue_accel_z_offset; - packet1.sue_gyro_x_offset = packet_in.sue_gyro_x_offset; - packet1.sue_gyro_y_offset = packet_in.sue_gyro_y_offset; - packet1.sue_gyro_z_offset = packet_in.sue_gyro_z_offset; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F21_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f21_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_serial_udb_extra_f21_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f21_pack(system_id, component_id, &msg , packet1.sue_accel_x_offset , packet1.sue_accel_y_offset , packet1.sue_accel_z_offset , packet1.sue_gyro_x_offset , packet1.sue_gyro_y_offset , packet1.sue_gyro_z_offset ); - mavlink_msg_serial_udb_extra_f21_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f21_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.sue_accel_x_offset , packet1.sue_accel_y_offset , packet1.sue_accel_z_offset , packet1.sue_gyro_x_offset , packet1.sue_gyro_y_offset , packet1.sue_gyro_z_offset ); - mavlink_msg_serial_udb_extra_f21_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22 >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_serial_udb_extra_f22_t packet_in = { - 17235,17339,17443,17547,17651,17755 - }; - mavlink_serial_udb_extra_f22_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.sue_accel_x_at_calibration = packet_in.sue_accel_x_at_calibration; - packet1.sue_accel_y_at_calibration = packet_in.sue_accel_y_at_calibration; - packet1.sue_accel_z_at_calibration = packet_in.sue_accel_z_at_calibration; - packet1.sue_gyro_x_at_calibration = packet_in.sue_gyro_x_at_calibration; - packet1.sue_gyro_y_at_calibration = packet_in.sue_gyro_y_at_calibration; - packet1.sue_gyro_z_at_calibration = packet_in.sue_gyro_z_at_calibration; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F22_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f22_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_serial_udb_extra_f22_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f22_pack(system_id, component_id, &msg , packet1.sue_accel_x_at_calibration , packet1.sue_accel_y_at_calibration , packet1.sue_accel_z_at_calibration , packet1.sue_gyro_x_at_calibration , packet1.sue_gyro_y_at_calibration , packet1.sue_gyro_z_at_calibration ); - mavlink_msg_serial_udb_extra_f22_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_serial_udb_extra_f22_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.sue_accel_x_at_calibration , packet1.sue_accel_y_at_calibration , packet1.sue_accel_z_at_calibration , packet1.sue_gyro_x_at_calibration , packet1.sue_gyro_y_at_calibration , packet1.sue_gyro_z_at_calibration ); - mavlink_msg_serial_udb_extra_f22_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; i mavlink_message_info[mid].msgid) { - low = mid; - continue; - } - low = mid; - break; - } - if (mavlink_message_info[low].msgid == msgid) { - return &mavlink_message_info[low]; - } - return NULL; + const uint32_t count = sizeof(mavlink_message_info)/sizeof(mavlink_message_info[0]); + if (count == 0) { + return NULL; + } + uint32_t low=0, high=count-1; + while (low < high) { + uint32_t mid = (low+high)/2; + if (msgid < mavlink_message_info[mid].msgid) { + high = mid; + continue; + } + if (msgid > mavlink_message_info[mid].msgid) { + low = mid+1; + continue; + } + return &mavlink_message_info[mid]; + } + if (mavlink_message_info[low].msgid == msgid) { + return &mavlink_message_info[low]; + } + return NULL; } /* @@ -47,24 +50,33 @@ MAVLINK_HELPER const mavlink_message_info_t *mavlink_get_message_info(const mavl MAVLINK_HELPER const mavlink_message_info_t *mavlink_get_message_info_by_name(const char *name) { static const struct { const char *name; uint32_t msgid; } mavlink_message_names[] = MAVLINK_MESSAGE_NAMES; - /* + /* use a bisection search to find the right entry. A perfect hash may be better Note that this assumes the table is sorted with primary key name */ - uint32_t low=0, high=sizeof(mavlink_message_names)/sizeof(mavlink_message_names[0]); - while (low < high) { - uint32_t mid = (low+1+high)/2; - int cmp = strcmp(mavlink_message_names[mid].name, name); - if (cmp == 0) { - return mavlink_get_message_info_by_id(mavlink_message_names[mid].msgid); - } - if (cmp > 0) { - high = mid-1; - } else { - low = mid; - } - } - return NULL; + const uint32_t count = sizeof(mavlink_message_names)/sizeof(mavlink_message_names[0]); + if (count == 0) { + return NULL; + } + uint32_t low=0, high=count-1; + while (low < high) { + uint32_t mid = (low+high)/2; + int cmp = strcmp(mavlink_message_names[mid].name, name); + if (cmp > 0) { + high = mid; + continue; + } + if (cmp < 0) { + low = mid+1; + continue; + } + low = mid; + break; + } + if (strcmp(mavlink_message_names[low].name, name) == 0) { + return mavlink_get_message_info_by_id(mavlink_message_names[low].msgid); + } + return NULL; } #endif // MAVLINK_USE_MESSAGE_INFO diff --git a/mavlink_helpers.h b/mavlink_helpers.h index fed04d688..4935ee04b 100644 --- a/mavlink_helpers.h +++ b/mavlink_helpers.h @@ -66,6 +66,7 @@ MAVLINK_HELPER void mavlink_reset_channel_status(uint8_t chan) status->parse_state = MAVLINK_PARSE_STATE_IDLE; } +#ifndef MAVLINK_NO_SIGN_PACKET /** * @brief create a signature block for a packet */ @@ -98,6 +99,7 @@ MAVLINK_HELPER uint8_t mavlink_sign_packet(mavlink_signing_t *signing, return MAVLINK_SIGNATURE_BLOCK_LEN; } +#endif /** * @brief Trim payload of any trailing zero-populated bytes (MAVLink 2 only). @@ -114,6 +116,7 @@ MAVLINK_HELPER uint8_t _mav_trim_payload(const char *payload, uint8_t length) return length; } +#ifndef MAVLINK_NO_SIGNATURE_CHECK /** * @brief check a signature block for a packet */ @@ -133,11 +136,13 @@ MAVLINK_HELPER bool mavlink_signature_check(mavlink_signing_t *signing, mavlink_sha256_init(&ctx); mavlink_sha256_update(&ctx, signing->secret_key, sizeof(signing->secret_key)); - mavlink_sha256_update(&ctx, p, MAVLINK_CORE_HEADER_LEN+1+msg->len); + mavlink_sha256_update(&ctx, p, MAVLINK_NUM_HEADER_BYTES); + mavlink_sha256_update(&ctx, _MAV_PAYLOAD(msg), msg->len); mavlink_sha256_update(&ctx, msg->ck, 2); mavlink_sha256_update(&ctx, psig, 1+6); mavlink_sha256_final_48(&ctx, signature); - if (memcmp(signature, incoming_signature, 6) != 0) { + if (memcmp(signature, incoming_signature, 6) != 0) { + signing->last_status = MAVLINK_SIGNING_STATUS_BAD_SIGNATURE; return false; } @@ -151,7 +156,8 @@ MAVLINK_HELPER bool mavlink_signature_check(mavlink_signing_t *signing, memcpy(tstamp.t8, psig+1, 6); if (signing_streams == NULL) { - return false; + signing->last_status = MAVLINK_SIGNING_STATUS_NO_STREAMS; + return false; } // find stream @@ -165,11 +171,13 @@ MAVLINK_HELPER bool mavlink_signature_check(mavlink_signing_t *signing, if (i == signing_streams->num_signing_streams) { if (signing_streams->num_signing_streams >= MAVLINK_MAX_SIGNING_STREAMS) { // over max number of streams - return false; + signing->last_status = MAVLINK_SIGNING_STATUS_TOO_MANY_STREAMS; + return false; } // new stream. Only accept if timestamp is not more than 1 minute old if (tstamp.t64 + 6000*1000UL < signing->timestamp) { - return false; + signing->last_status = MAVLINK_SIGNING_STATUS_OLD_TIMESTAMP; + return false; } // add new stream signing_streams->stream[i].sysid = msg->sysid; @@ -182,7 +190,8 @@ MAVLINK_HELPER bool mavlink_signature_check(mavlink_signing_t *signing, memcpy(last_tstamp.t8, signing_streams->stream[i].timestamp_bytes, 6); if (tstamp.t64 <= last_tstamp.t64) { // repeating old timestamp - return false; + signing->last_status = MAVLINK_SIGNING_STATUS_REPLAY; + return false; } } @@ -193,8 +202,10 @@ MAVLINK_HELPER bool mavlink_signature_check(mavlink_signing_t *signing, if (tstamp.t64 > signing->timestamp) { signing->timestamp = tstamp.t64; } - return true; + signing->last_status = MAVLINK_SIGNING_STATUS_OK; + return true; } +#endif /** @@ -213,7 +224,11 @@ MAVLINK_HELPER uint16_t mavlink_finalize_message_buffer(mavlink_message_t* msg, mavlink_status_t* status, uint8_t min_length, uint8_t length, uint8_t crc_extra) { bool mavlink1 = (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) != 0; +#ifndef MAVLINK_NO_SIGN_PACKET bool signing = (!mavlink1) && status->signing && (status->signing->flags & MAVLINK_SIGNING_FLAG_SIGN_OUTGOING); +#else + bool signing = false; +#endif uint8_t signature_len = signing? MAVLINK_SIGNATURE_BLOCK_LEN : 0; uint8_t header_len = MAVLINK_CORE_HEADER_LEN+1; uint8_t buf[MAVLINK_CORE_HEADER_LEN+1]; @@ -261,6 +276,7 @@ MAVLINK_HELPER uint16_t mavlink_finalize_message_buffer(mavlink_message_t* msg, msg->checksum = checksum; +#ifndef MAVLINK_NO_SIGN_PACKET if (signing) { mavlink_sign_packet(status->signing, msg->signature, @@ -268,7 +284,8 @@ MAVLINK_HELPER uint16_t mavlink_finalize_message_buffer(mavlink_message_t* msg, (const uint8_t *)_MAV_PAYLOAD(msg), msg->len, (const uint8_t *)_MAV_PAYLOAD(msg)+(uint16_t)msg->len); } - +#endif + return msg->len + header_len + 2 + signature_len; } @@ -351,12 +368,14 @@ MAVLINK_HELPER void _mav_finalize_message_chan_send(mavlink_channel_t chan, uint ck[0] = (uint8_t)(checksum & 0xFF); ck[1] = (uint8_t)(checksum >> 8); +#ifndef MAVLINK_NO_SIGN_PACKET if (signing) { // possibly add a signature signature_len = mavlink_sign_packet(status->signing, signature, buf, header_len+1, (const uint8_t *)packet, length, ck); } - +#endif + MAVLINK_START_UART_SEND(chan, header_len + 3 + (uint16_t)length + (uint16_t)signature_len); _mavlink_send_uart(chan, (const char *)buf, header_len+1); _mavlink_send_uart(chan, packet, length); @@ -574,7 +593,6 @@ MAVLINK_HELPER uint8_t mavlink_frame_char_buffer(mavlink_message_t* rxmsg, mavlink_message_t* r_message, mavlink_status_t* r_mavlink_status) { - int bufferIndex = 0; status->msg_received = MAVLINK_FRAMING_INCOMPLETE; @@ -610,7 +628,7 @@ MAVLINK_HELPER uint8_t mavlink_frame_char_buffer(mavlink_message_t* rxmsg, { status->buffer_overrun++; _mav_parse_error(status); - status->msg_received = 0; + status->msg_received = MAVLINK_FRAMING_INCOMPLETE; status->parse_state = MAVLINK_PARSE_STATE_IDLE; } else @@ -634,7 +652,7 @@ MAVLINK_HELPER uint8_t mavlink_frame_char_buffer(mavlink_message_t* rxmsg, if ((rxmsg->incompat_flags & ~MAVLINK_IFLAG_MASK) != 0) { // message includes an incompatible feature flag _mav_parse_error(status); - status->msg_received = 0; + status->msg_received = MAVLINK_FRAMING_INCOMPLETE; status->parse_state = MAVLINK_PARSE_STATE_IDLE; break; } @@ -689,7 +707,7 @@ MAVLINK_HELPER uint8_t mavlink_frame_char_buffer(mavlink_message_t* rxmsg, break; case MAVLINK_PARSE_STATE_GOT_MSGID1: - rxmsg->msgid |= c<<8; + rxmsg->msgid |= ((uint32_t)c)<<8; mavlink_update_checksum(rxmsg, c); status->parse_state = MAVLINK_PARSE_STATE_GOT_MSGID2; break; @@ -724,18 +742,24 @@ MAVLINK_HELPER uint8_t mavlink_frame_char_buffer(mavlink_message_t* rxmsg, case MAVLINK_PARSE_STATE_GOT_PAYLOAD: { const mavlink_msg_entry_t *e = mavlink_get_msg_entry(rxmsg->msgid); - uint8_t crc_extra = e?e->crc_extra:0; - mavlink_update_checksum(rxmsg, crc_extra); - if (c != (rxmsg->checksum & 0xFF)) { + if (e == NULL) { + // Message not found in CRC_EXTRA table. status->parse_state = MAVLINK_PARSE_STATE_GOT_BAD_CRC1; + rxmsg->ck[0] = c; } else { - status->parse_state = MAVLINK_PARSE_STATE_GOT_CRC1; - } - rxmsg->ck[0] = c; + uint8_t crc_extra = e->crc_extra; + mavlink_update_checksum(rxmsg, crc_extra); + if (c != (rxmsg->checksum & 0xFF)) { + status->parse_state = MAVLINK_PARSE_STATE_GOT_BAD_CRC1; + } else { + status->parse_state = MAVLINK_PARSE_STATE_GOT_CRC1; + } + rxmsg->ck[0] = c; - // zero-fill the packet to cope with short incoming packets - if (e && status->packet_idx < e->max_msg_len) { - memset(&_MAV_PAYLOAD_NON_CONST(rxmsg)[status->packet_idx], 0, e->max_msg_len - status->packet_idx); + // zero-fill the packet to cope with short incoming packets + if (e && status->packet_idx < e->max_msg_len) { + memset(&_MAV_PAYLOAD_NON_CONST(rxmsg)[status->packet_idx], 0, e->max_msg_len - status->packet_idx); + } } break; } @@ -752,14 +776,15 @@ MAVLINK_HELPER uint8_t mavlink_frame_char_buffer(mavlink_message_t* rxmsg, rxmsg->ck[1] = c; if (rxmsg->incompat_flags & MAVLINK_IFLAG_SIGNED) { - status->parse_state = MAVLINK_PARSE_STATE_SIGNATURE_WAIT; - status->signature_wait = MAVLINK_SIGNATURE_BLOCK_LEN; - - // If the CRC is already wrong, don't overwrite msg_received, - // otherwise we can end up with garbage flagged as valid. - if (status->msg_received != MAVLINK_FRAMING_BAD_CRC) { - status->msg_received = MAVLINK_FRAMING_INCOMPLETE; + if (status->msg_received == MAVLINK_FRAMING_BAD_CRC) { + // If the CRC is already wrong, don't overwrite msg_received, + // otherwise we can end up with garbage flagged as valid. + status->parse_state = MAVLINK_PARSE_STATE_SIGNATURE_WAIT_BAD_CRC; + } else { + status->parse_state = MAVLINK_PARSE_STATE_SIGNATURE_WAIT; + status->msg_received = MAVLINK_FRAMING_INCOMPLETE; } + status->signature_wait = MAVLINK_SIGNATURE_BLOCK_LEN; } else { if (status->signing && (status->signing->accept_unsigned_callback == NULL || @@ -777,21 +802,28 @@ MAVLINK_HELPER uint8_t mavlink_frame_char_buffer(mavlink_message_t* rxmsg, } break; case MAVLINK_PARSE_STATE_SIGNATURE_WAIT: + case MAVLINK_PARSE_STATE_SIGNATURE_WAIT_BAD_CRC: rxmsg->signature[MAVLINK_SIGNATURE_BLOCK_LEN-status->signature_wait] = c; status->signature_wait--; if (status->signature_wait == 0) { // we have the whole signature, check it is OK +#ifndef MAVLINK_NO_SIGNATURE_CHECK bool sig_ok = mavlink_signature_check(status->signing, status->signing_streams, rxmsg); +#else + bool sig_ok = true; +#endif if (!sig_ok && (status->signing->accept_unsigned_callback && status->signing->accept_unsigned_callback(status, rxmsg->msgid))) { // accepted via application level override sig_ok = true; } - if (sig_ok) { - status->msg_received = MAVLINK_FRAMING_OK; + if (status->parse_state == MAVLINK_PARSE_STATE_SIGNATURE_WAIT_BAD_CRC) { + status->msg_received = MAVLINK_FRAMING_BAD_CRC; + } else if (sig_ok) { + status->msg_received = MAVLINK_FRAMING_OK; } else { - status->msg_received = MAVLINK_FRAMING_BAD_SIGNATURE; + status->msg_received = MAVLINK_FRAMING_BAD_SIGNATURE; } status->parse_state = MAVLINK_PARSE_STATE_IDLE; if (r_message !=NULL) { @@ -801,8 +833,7 @@ MAVLINK_HELPER uint8_t mavlink_frame_char_buffer(mavlink_message_t* rxmsg, break; } - bufferIndex++; - // If a message has been sucessfully decoded, check index + // If a message has been successfully decoded, check index if (status->msg_received == MAVLINK_FRAMING_OK) { //while(status->current_seq != rxmsg->seq) diff --git a/mavlink_types.h b/mavlink_types.h index 8bdf0b51c..8b97cb818 100644 --- a/mavlink_types.h +++ b/mavlink_types.h @@ -199,7 +199,8 @@ typedef enum { MAVLINK_PARSE_STATE_GOT_PAYLOAD, MAVLINK_PARSE_STATE_GOT_CRC1, MAVLINK_PARSE_STATE_GOT_BAD_CRC1, - MAVLINK_PARSE_STATE_SIGNATURE_WAIT + MAVLINK_PARSE_STATE_SIGNATURE_WAIT, + MAVLINK_PARSE_STATE_SIGNATURE_WAIT_BAD_CRC } mavlink_parse_state_t; ///< The state machine for the comm parser typedef enum { @@ -242,6 +243,16 @@ typedef bool (*mavlink_accept_unsigned_t)(const mavlink_status_t *status, uint32 */ #define MAVLINK_SIGNING_FLAG_SIGN_OUTGOING 1 ///< Enable outgoing signing +typedef enum { + MAVLINK_SIGNING_STATUS_NONE=0, + MAVLINK_SIGNING_STATUS_OK=1, + MAVLINK_SIGNING_STATUS_BAD_SIGNATURE=2, + MAVLINK_SIGNING_STATUS_NO_STREAMS=3, + MAVLINK_SIGNING_STATUS_TOO_MANY_STREAMS=4, + MAVLINK_SIGNING_STATUS_OLD_TIMESTAMP=5, + MAVLINK_SIGNING_STATUS_REPLAY=6, +} mavlink_signing_status_t; + /* state of MAVLink signing for this channel */ @@ -251,6 +262,7 @@ typedef struct __mavlink_signing { uint64_t timestamp; ///< Timestamp, in microseconds since UNIX epoch GMT uint8_t secret_key[32]; mavlink_accept_unsigned_t accept_unsigned_callback; + mavlink_signing_status_t last_status; } mavlink_signing_t; /* diff --git a/message_definitions/ASLUAV.xml b/message_definitions/ASLUAV.xml deleted file mode 100644 index 9d6d75db4..000000000 --- a/message_definitions/ASLUAV.xml +++ /dev/null @@ -1,293 +0,0 @@ - - - - - common.xml - - - - - Mission command to reset Maximum Power Point Tracker (MPPT) - MPPT number - Empty - Empty - Empty - Empty - Empty - Empty - - - Mission command to perform a power cycle on payload - Complete power cycle - VISensor power cycle - Empty - Empty - Empty - Empty - Empty - - - - - no service - - - link type unknown - - - 2G (GSM/GRPS/EDGE) link - - - 3G link (WCDMA/HSDPA/HSPA) - - - 4G link (LTE) - - - - - not specified - - - HUAWEI LTE USB Stick E3372 - - - - - - Message encoding a command with parameters as scaled integers and additional metadata. Scaling depends on the actual command value. - UTC time, seconds elapsed since 01.01.1970 - Microseconds elapsed since vehicle boot - System ID - Component ID - The coordinate system of the COMMAND, as defined by MAV_FRAME enum - The scheduled action for the mission item, as defined by MAV_CMD enum - false:0, true:1 - autocontinue to next wp - PARAM1, see MAV_CMD enum - PARAM2, see MAV_CMD enum - PARAM3, see MAV_CMD enum - PARAM4, see MAV_CMD enum - PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7 - PARAM6 / local: y position in meters * 1e4, global: longitude in degrees * 10^7 - PARAM7 / z position: global: altitude in meters (MSL, WGS84, AGL or relative to home - depending on frame). - - - Send a command with up to seven parameters to the MAV and additional metadata - UTC time, seconds elapsed since 01.01.1970 - Microseconds elapsed since vehicle boot - System which should execute the command - Component which should execute the command, 0 for all components - Command ID, as defined by MAV_CMD enum. - 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command) - Parameter 1, as defined by MAV_CMD enum. - Parameter 2, as defined by MAV_CMD enum. - Parameter 3, as defined by MAV_CMD enum. - Parameter 4, as defined by MAV_CMD enum. - Parameter 5, as defined by MAV_CMD enum. - Parameter 6, as defined by MAV_CMD enum. - Parameter 7, as defined by MAV_CMD enum. - - - Voltage and current sensor data - Power board voltage sensor reading - Power board current sensor reading - Board current sensor 1 reading - Board current sensor 2 reading - - - Maximum Power Point Tracker (MPPT) sensor data for solar module power performance tracking - MPPT last timestamp - MPPT1 voltage - MPPT1 current - MPPT1 pwm - MPPT1 status - MPPT2 voltage - MPPT2 current - MPPT2 pwm - MPPT2 status - MPPT3 voltage - MPPT3 current - MPPT3 pwm - MPPT3 status - - - ASL-fixed-wing controller data - Timestamp - ASLCTRL control-mode (manual, stabilized, auto, etc...) - See sourcecode for a description of these values... - - - Pitch angle - Pitch angle reference - - - - - - - Airspeed reference - - Yaw angle - Yaw angle reference - Roll angle - Roll angle reference - - - - - - - - - ASL-fixed-wing controller debug data - Debug data - Debug data - Debug data - Debug data - Debug data - Debug data - Debug data - Debug data - Debug data - Debug data - Debug data - - - Extended state information for ASLUAVs - Status of the position-indicator LEDs - Status of the IRIDIUM satellite communication system - Status vector for up to 8 servos - Motor RPM - - - - Extended EKF state estimates for ASLUAVs - Time since system start - Magnitude of wind velocity (in lateral inertial plane) - Wind heading angle from North - Z (Down) component of inertial wind velocity - Magnitude of air velocity - Sideslip angle - Angle of attack - - - Off-board controls/commands for ASLUAVs - Time since system start - Elevator command [~] - Throttle command [~] - Throttle 2 command [~] - Left aileron command [~] - Right aileron command [~] - Rudder command [~] - Off-board computer status - - - Atmospheric sensors (temperature, humidity, ...) - Time since system boot - Ambient temperature - Relative humidity - - - Battery pack monitoring data for Li-Ion batteries - Time since system start - Battery pack temperature - Battery pack voltage - Battery pack current - Battery pack state-of-charge - Battery monitor status report bits in Hex - Battery monitor serial number in Hex - Battery monitor safetystatus report bits in Hex - Battery monitor operation status report bits in Hex - Battery pack cell 1 voltage - Battery pack cell 2 voltage - Battery pack cell 3 voltage - Battery pack cell 4 voltage - Battery pack cell 5 voltage - Battery pack cell 6 voltage - - - Fixed-wing soaring (i.e. thermal seeking) data - Timestamp - Timestamp since last mode change - Thermal core updraft strength - Thermal radius - Thermal center latitude - Thermal center longitude - Variance W - Variance R - Variance Lat - Variance Lon - Suggested loiter radius - Suggested loiter direction - Distance to soar point - Expected sink rate at current airspeed, roll and throttle - Measurement / updraft speed at current/local airplane position - Measurement / roll angle tracking error - Expected measurement 1 - Expected measurement 2 - Thermal drift (from estimator prediction step only) - Thermal drift (from estimator prediction step only) - Total specific energy change (filtered) - Debug variable 1 - Debug variable 2 - Control Mode [-] - Data valid [-] - - - Monitoring of sensorpod status - Timestamp in linuxtime (since 1.1.1970) - Rate of ROS topic 1 - Rate of ROS topic 2 - Rate of ROS topic 3 - Rate of ROS topic 4 - Number of recording nodes - Temperature of sensorpod CPU in - Free space available in recordings directory in [Gb] * 1e2 - - - Monitoring of power board status - Timestamp - Power board status register - Power board leds status - Power board system voltage - Power board servo voltage - Power board digital voltage - Power board left motor current sensor - Power board right motor current sensor - Power board analog current sensor - Power board digital current sensor - Power board extension current sensor - Power board aux current sensor - - - Status of GSM modem (connected to onboard computer) - Timestamp (of OBC) - GSM modem used - GSM link type - RSSI as reported by modem (unconverted) - RSRP (LTE) or RSCP (WCDMA) as reported by modem (unconverted) - SINR (LTE) or ECIO (WCDMA) as reported by modem (unconverted) - RSRQ (LTE only) as reported by modem (unconverted) - - - Status of the SatCom link - Timestamp - Timestamp of the last successful sbd session - Number of failed sessions - Number of successful sessions - Signal quality - Ring call pending - Transmission session pending - Receiving session pending - - - Calibrated airflow angle measurements - Timestamp - Angle of attack - Angle of attack measurement valid - Sideslip angle - Sideslip angle measurement valid - - - diff --git a/message_definitions/all.xml b/message_definitions/all.xml deleted file mode 100644 index 5634144e5..000000000 --- a/message_definitions/all.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - ardupilotmega.xml - - - - - common.xml - icarous.xml - - - minimal.xml - - - python_array_test.xml - standard.xml - test.xml - ualberta.xml - uAvionix.xml - - - ../../external/dialects/storm32.xml - - diff --git a/message_definitions/ardupilotmega.xml b/message_definitions/ardupilotmega.xml deleted file mode 100644 index 23bcc926f..000000000 --- a/message_definitions/ardupilotmega.xml +++ /dev/null @@ -1,1671 +0,0 @@ - - - common.xml - - uAvionix.xml - icarous.xml - 2 - - - - - - - - - - - - - - - - - - - - - - - - - Set the distance to be repeated on mission resume - Distance. - Empty. - Empty. - Empty. - Empty. - Empty. - Empty. - - - Mission command to wait for an altitude or downwards vertical speed. This is meant for high altitude balloon launches, allowing the aircraft to be idle until either an altitude is reached or a negative vertical speed is reached (indicating early balloon burst). The wiggle time is how often to wiggle the control surfaces to prevent them seizing up. - Altitude. - Descent speed. - How long to wiggle the control surfaces to prevent them seizing up. - Empty. - Empty. - Empty. - Empty. - - - A system wide power-off event has been initiated. - Empty. - Empty. - Empty. - Empty. - Empty. - Empty. - Empty. - - - - FLY button has been clicked. - Empty. - Empty. - Empty. - Empty. - Empty. - Empty. - Empty. - - - FLY button has been held for 1.5 seconds. - Takeoff altitude. - Empty. - Empty. - Empty. - Empty. - Empty. - Empty. - - - PAUSE button has been clicked. - 1 if Solo is in a shot mode, 0 otherwise. - Empty. - Empty. - Empty. - Empty. - Empty. - Empty. - - - Magnetometer calibration based on fixed position - in earth field given by inclination, declination and intensity. - Magnetic declination. - Magnetic inclination. - Magnetic intensity. - Yaw. - Empty. - Empty. - Empty. - - - Magnetometer calibration based on fixed expected field values. - Field strength X. - Field strength Y. - Field strength Z. - Empty. - Empty. - Empty. - Empty. - - - - Initiate a magnetometer calibration. - Bitmask of magnetometers to calibrate. Use 0 to calibrate all sensors that can be started (sensors may not start if disabled, unhealthy, etc.). The command will NACK if calibration does not start for a sensor explicitly specified by the bitmask. - Automatically retry on failure (0=no retry, 1=retry). - Save without user input (0=require input, 1=autosave). - Delay. - Autoreboot (0=user reboot, 1=autoreboot). - Empty. - Empty. - - - Accept a magnetometer calibration. - Bitmask of magnetometers that calibration is accepted (0 means all). - Empty. - Empty. - Empty. - Empty. - Empty. - Empty. - - - Cancel a running magnetometer calibration. - Bitmask of magnetometers to cancel a running calibration (0 means all). - Empty. - Empty. - Empty. - Empty. - Empty. - Empty. - - - Used when doing accelerometer calibration. When sent to the GCS tells it what position to put the vehicle in. When sent to the vehicle says what position the vehicle is in. - Position. - Empty. - Empty. - Empty. - Empty. - Empty. - Empty. - - - Reply with the version banner. - Empty. - Empty. - Empty. - Empty. - Empty. - Empty. - Empty. - - - Command autopilot to get into factory test/diagnostic mode. - 0: activate test mode, 1: exit test mode. - Empty. - Empty. - Empty. - Empty. - Empty. - Empty. - - - Causes the gimbal to reset and boot as if it was just powered on. - Empty. - Empty. - Empty. - Empty. - Empty. - Empty. - Empty. - - - Reports progress and success or failure of gimbal axis calibration procedure. - Gimbal axis we're reporting calibration progress for. - Current calibration progress for this axis. - Status of the calibration. - Empty. - Empty. - Empty. - Empty. - - - Starts commutation calibration on the gimbal. - Empty. - Empty. - Empty. - Empty. - Empty. - Empty. - Empty. - - - Erases gimbal application and parameters. - Magic number. - Magic number. - Magic number. - Magic number. - Magic number. - Magic number. - Magic number. - - - - Update the bootloader - Empty - Empty - Empty - Empty - Magic number - set to 290876 to actually flash - Empty - Empty - - - Reset battery capacity for batteries that accumulate consumed battery via integration. - Bitmask of batteries to reset. Least significant bit is for the first battery. - Battery percentage remaining to set. - - - Issue a trap signal to the autopilot process, presumably to enter the debugger. - Magic number - set to 32451 to actually trap. - Empty. - Empty. - Empty. - Empty. - Empty. - Empty. - - - Control onboard scripting. - Scripting command to execute - - - Change flight speed at a given rate. This slews the vehicle at a controllable rate between it's previous speed and the new one. (affects GUIDED only. Outside GUIDED, aircraft ignores these commands. Designed for onboard companion-computer command-and-control, not normally operator/GCS control.) - Airspeed or groundspeed. - Target Speed - Acceleration rate, 0 to take effect instantly - Empty - Empty - Empty - Empty - - - Change target altitude at a given rate. This slews the vehicle at a controllable rate between it's previous altitude and the new one. (affects GUIDED only. Outside GUIDED, aircraft ignores these commands. Designed for onboard companion-computer command-and-control, not normally operator/GCS control.) - Empty - Empty - Rate of change, toward new altitude. 0 for maximum rate change. Positive numbers only, as negative numbers will not converge on the new target alt. - Empty - Empty - Empty - Target Altitude - - - Change to target heading at a given rate, overriding previous heading/s. This slews the vehicle at a controllable rate between it's previous heading and the new one. (affects GUIDED only. Exiting GUIDED returns aircraft to normal behaviour defined elsewhere. Designed for onboard companion-computer command-and-control, not normally operator/GCS control.) - course-over-ground or raw vehicle heading. - Target heading. - Maximum centripetal accelearation, ie rate of change, toward new heading. - Empty - Empty - Empty - Empty - - - - - Start a REPL session. - - - End a REPL session. - - - - - - Pre-initialization. - - - Disabled. - - - Checking limits. - - - A limit has been breached. - - - Taking action e.g. Return/RTL. - - - We're no longer in breach of a limit. - - - - - - Pre-initialization. - - - Disabled. - - - Checking limits. - - - - - Flags in RALLY_POINT message. - - Flag set when requiring favorable winds for landing. - - - Flag set when plane is to immediately descend to break altitude and land without GCS intervention. Flag not set when plane is to loiter at Rally point until commanded to land. - - - - - - Camera heartbeat, announce camera component ID at 1Hz. - - - Camera image triggered. - - - Camera connection lost. - - - Camera unknown error. - - - Camera battery low. Parameter p1 shows reported voltage. - - - Camera storage low. Parameter p1 shows reported shots remaining. - - - Camera storage low. Parameter p1 shows reported video minutes remaining. - - - - - - Shooting photos, not video. - - - Shooting video, not stills. - - - Unable to achieve requested exposure (e.g. shutter speed too low). - - - Closed loop feedback from camera, we know for sure it has successfully taken a picture. - - - Open loop camera, an image trigger has been requested but we can't know for sure it has successfully taken a picture. - - - - - - Gimbal is powered on but has not started initializing yet. - - - Gimbal is currently running calibration on the pitch axis. - - - Gimbal is currently running calibration on the roll axis. - - - Gimbal is currently running calibration on the yaw axis. - - - Gimbal has finished calibrating and initializing, but is relaxed pending reception of first rate command from copter. - - - Gimbal is actively stabilizing. - - - Gimbal is relaxed because it missed more than 10 expected rate command messages in a row. Gimbal will move back to active mode when it receives a new rate command. - - - - - Gimbal yaw axis. - - - Gimbal pitch axis. - - - Gimbal roll axis. - - - - - Axis calibration is in progress. - - - Axis calibration succeeded. - - - Axis calibration failed. - - - - - Whether or not this axis requires calibration is unknown at this time. - - - This axis requires calibration. - - - This axis does not require calibration. - - - - - - No GoPro connected. - - - The detected GoPro is not HeroBus compatible. - - - A HeroBus compatible GoPro is connected. - - - An unrecoverable error was encountered with the connected GoPro, it may require a power cycle. - - - - - - GoPro is currently recording. - - - - - The write message with ID indicated succeeded. - - - The write message with ID indicated failed. - - - - - (Get/Set). - - - (Get/Set). - - - (___/Set). - - - (Get/___). - - - (Get/___). - - - (Get/Set). - - - - (Get/Set). - - - (Get/Set). - - - (Get/Set). - - - (Get/Set). - - - (Get/Set) Hero 3+ Only. - - - (Get/Set) Hero 3+ Only. - - - (Get/Set) Hero 3+ Only. - - - (Get/Set) Hero 3+ Only. - - - (Get/Set) Hero 3+ Only. - - - (Get/Set). - - - - (Get/Set). - - - - - Video mode. - - - Photo mode. - - - Burst mode, Hero 3+ only. - - - Time lapse mode, Hero 3+ only. - - - Multi shot mode, Hero 4 only. - - - Playback mode, Hero 4 only, silver only except when LCD or HDMI is connected to black. - - - Playback mode, Hero 4 only. - - - Mode not yet known. - - - - - 848 x 480 (480p). - - - 1280 x 720 (720p). - - - 1280 x 960 (960p). - - - 1920 x 1080 (1080p). - - - 1920 x 1440 (1440p). - - - 2704 x 1440 (2.7k-17:9). - - - 2704 x 1524 (2.7k-16:9). - - - 2704 x 2028 (2.7k-4:3). - - - 3840 x 2160 (4k-16:9). - - - 4096 x 2160 (4k-17:9). - - - 1280 x 720 (720p-SuperView). - - - 1920 x 1080 (1080p-SuperView). - - - 2704 x 1520 (2.7k-SuperView). - - - 3840 x 2160 (4k-SuperView). - - - - - 12 FPS. - - - 15 FPS. - - - 24 FPS. - - - 25 FPS. - - - 30 FPS. - - - 48 FPS. - - - 50 FPS. - - - 60 FPS. - - - 80 FPS. - - - 90 FPS. - - - 100 FPS. - - - 120 FPS. - - - 240 FPS. - - - 12.5 FPS. - - - - - 0x00: Wide. - - - 0x01: Medium. - - - 0x02: Narrow. - - - - - 0=NTSC, 1=PAL. - - - - - 5MP Medium. - - - 7MP Medium. - - - 7MP Wide. - - - 10MP Wide. - - - 12MP Wide. - - - - - Auto. - - - 3000K. - - - 5500K. - - - 6500K. - - - Camera Raw. - - - - - Auto. - - - Neutral. - - - - - ISO 400. - - - ISO 800 (Only Hero 4). - - - ISO 1600. - - - ISO 3200 (Only Hero 4). - - - ISO 6400. - - - - - Low Sharpness. - - - Medium Sharpness. - - - High Sharpness. - - - - - -5.0 EV (Hero 3+ Only). - - - -4.5 EV (Hero 3+ Only). - - - -4.0 EV (Hero 3+ Only). - - - -3.5 EV (Hero 3+ Only). - - - -3.0 EV (Hero 3+ Only). - - - -2.5 EV (Hero 3+ Only). - - - -2.0 EV. - - - -1.5 EV. - - - -1.0 EV. - - - -0.5 EV. - - - 0.0 EV. - - - +0.5 EV. - - - +1.0 EV. - - - +1.5 EV. - - - +2.0 EV. - - - +2.5 EV (Hero 3+ Only). - - - +3.0 EV (Hero 3+ Only). - - - +3.5 EV (Hero 3+ Only). - - - +4.0 EV (Hero 3+ Only). - - - +4.5 EV (Hero 3+ Only). - - - +5.0 EV (Hero 3+ Only). - - - - - Charging disabled. - - - Charging enabled. - - - - - Unknown gopro model. - - - Hero 3+ Silver (HeroBus not supported by GoPro). - - - Hero 3+ Black. - - - Hero 4 Silver. - - - Hero 4 Black. - - - - - 3 Shots / 1 Second. - - - 5 Shots / 1 Second. - - - 10 Shots / 1 Second. - - - 10 Shots / 2 Second. - - - 10 Shots / 3 Second (Hero 4 Only). - - - 30 Shots / 1 Second. - - - 30 Shots / 2 Second. - - - 30 Shots / 3 Second. - - - 30 Shots / 6 Second. - - - - - - LED patterns off (return control to regular vehicle control). - - - LEDs show pattern during firmware update. - - - Custom Pattern using custom bytes fields. - - - - - Flags in EKF_STATUS message. - - Set if EKF's attitude estimate is good. - - - Set if EKF's horizontal velocity estimate is good. - - - Set if EKF's vertical velocity estimate is good. - - - Set if EKF's horizontal position (relative) estimate is good. - - - Set if EKF's horizontal position (absolute) estimate is good. - - - Set if EKF's vertical position (absolute) estimate is good. - - - Set if EKF's vertical position (above ground) estimate is good. - - - EKF is in constant position mode and does not know it's absolute or relative position. - - - Set if EKF's predicted horizontal position (relative) estimate is good. - - - Set if EKF's predicted horizontal position (absolute) estimate is good. - - - Set if EKF has never been healthy. - - - - - - - - - - - - Special ACK block numbers control activation of dataflash log streaming. - - - - UAV to stop sending DataFlash blocks. - - - - UAV to start sending DataFlash blocks. - - - - - Possible remote log data block statuses. - - This block has NOT been received. - - - This block has been received. - - - - Bus types for device operations. - - I2C Device operation. - - - SPI Device operation. - - - - Deepstall flight stage. - - Flying to the landing point. - - - Building an estimate of the wind. - - - Waiting to breakout of the loiter to fly the approach. - - - Flying to the first arc point to turn around to the landing point. - - - Turning around back to the deepstall landing point. - - - Approaching the landing point. - - - Stalling and steering towards the land point. - - - - A mapping of plane flight modes for custom_mode field of heartbeat. - - - - - - - - - - - - - - - - - - - - - - - - - - - A mapping of copter flight modes for custom_mode field of heartbeat. - - - - - - - - - - - - - - - - - - - - - - - - - - - A mapping of sub flight modes for custom_mode field of heartbeat. - - - - - - - - - - - - A mapping of rover flight modes for custom_mode field of heartbeat. - - - - - - - - - - - - - - - A mapping of antenna tracker flight modes for custom_mode field of heartbeat. - - - - - - - - - The type of parameter for the OSD parameter editor. - - - - - - - - - - - - The error type for the OSD parameter editor. - - - - - - - - - Offsets and calibrations values for hardware sensors. This makes it easier to debug the calibration process. - Magnetometer X offset. - Magnetometer Y offset. - Magnetometer Z offset. - Magnetic declination. - Raw pressure from barometer. - Raw temperature from barometer. - Gyro X calibration. - Gyro Y calibration. - Gyro Z calibration. - Accel X calibration. - Accel Y calibration. - Accel Z calibration. - - - - Set the magnetometer offsets - System ID. - Component ID. - Magnetometer X offset. - Magnetometer Y offset. - Magnetometer Z offset. - - - State of APM memory. - Heap top. - Free memory. - - Free memory (32 bit). - - - Raw ADC output. - ADC output 1. - ADC output 2. - ADC output 3. - ADC output 4. - ADC output 5. - ADC output 6. - - - - Configure on-board Camera Control System. - System ID. - Component ID. - Mode enumeration from 1 to N //P, TV, AV, M, etc. (0 means ignore). - Divisor number //e.g. 1000 means 1/1000 (0 means ignore). - F stop number x 10 //e.g. 28 means 2.8 (0 means ignore). - ISO enumeration from 1 to N //e.g. 80, 100, 200, Etc (0 means ignore). - Exposure type enumeration from 1 to N (0 means ignore). - Command Identity (incremental loop: 0 to 255). //A command sent multiple times will be executed or pooled just once. - Main engine cut-off time before camera trigger (0 means no cut-off). - Extra parameters enumeration (0 means ignore). - Correspondent value to given extra_param. - - - Control on-board Camera Control System to take shots. - System ID. - Component ID. - 0: stop, 1: start or keep it up //Session control e.g. show/hide lens. - 1 to N //Zoom's absolute position (0 means ignore). - -100 to 100 //Zooming step value to offset zoom from the current position. - 0: unlock focus or keep unlocked, 1: lock focus or keep locked, 3: re-lock focus. - 0: ignore, 1: shot or start filming. - Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once. - Extra parameters enumeration (0 means ignore). - Correspondent value to given extra_param. - - - - Message to configure a camera mount, directional antenna, etc. - System ID. - Component ID. - Mount operating mode. - (1 = yes, 0 = no). - (1 = yes, 0 = no). - (1 = yes, 0 = no). - - - Message to control a camera mount, directional antenna, etc. - System ID. - Component ID. - Pitch (centi-degrees) or lat (degE7), depending on mount mode. - Roll (centi-degrees) or lon (degE7) depending on mount mode. - Yaw (centi-degrees) or alt (cm) depending on mount mode. - If "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING). - - - Message with some status from APM to GCS about camera or antenna mount. - System ID. - Component ID. - Pitch. - Roll. - Yaw. - - - - A fence point. Used to set a point when from GCS -> MAV. Also used to return a point from MAV -> GCS. - System ID. - Component ID. - Point index (first point is 1, 0 is for return point). - Total number of points (for sanity checking). - Latitude of point. - Longitude of point. - - - Request a current fence point from MAV. - System ID. - Component ID. - Point index (first point is 1, 0 is for return point). - - - Status of DCM attitude estimator. - X gyro drift estimate. - Y gyro drift estimate. - Z gyro drift estimate. - Average accel_weight. - Average renormalisation value. - Average error_roll_pitch value. - Average error_yaw value. - - - Status of simulation environment, if used. - Roll angle. - Pitch angle. - Yaw angle. - X acceleration. - Y acceleration. - Z acceleration. - Angular speed around X axis. - Angular speed around Y axis. - Angular speed around Z axis. - Latitude. - Longitude. - - - Status of key hardware. - Board voltage. - I2C error count. - - - Status generated by radio. - Local signal strength. - Remote signal strength. - How full the tx buffer is. - Background noise level. - Remote background noise level. - Receive errors. - Count of error corrected packets. - - - - Status of AP_Limits. Sent in extended status stream when AP_Limits is enabled. - State of AP_Limits. - Time (since boot) of last breach. - Time (since boot) of last recovery action. - Time (since boot) of last successful recovery. - Time (since boot) of last all-clear. - Number of fence breaches. - AP_Limit_Module bitfield of enabled modules. - AP_Limit_Module bitfield of required modules. - AP_Limit_Module bitfield of triggered modules. - - - Wind estimation. - Wind direction (that wind is coming from). - Wind speed in ground plane. - Vertical wind speed. - - - Data packet, size 16. - Data type. - Data length. - Raw data. - - - Data packet, size 32. - Data type. - Data length. - Raw data. - - - Data packet, size 64. - Data type. - Data length. - Raw data. - - - Data packet, size 96. - Data type. - Data length. - Raw data. - - - Rangefinder reporting. - Distance. - Raw voltage if available, zero otherwise. - - - Airspeed auto-calibration. - GPS velocity north. - GPS velocity east. - GPS velocity down. - Differential pressure. - Estimated to true airspeed ratio. - Airspeed ratio. - EKF state x. - EKF state y. - EKF state z. - EKF Pax. - EKF Pby. - EKF Pcz. - - - - A rally point. Used to set a point when from GCS -> MAV. Also used to return a point from MAV -> GCS. - System ID. - Component ID. - Point index (first point is 0). - Total number of points (for sanity checking). - Latitude of point. - Longitude of point. - Transit / loiter altitude relative to home. - - Break altitude relative to home. - Heading to aim for when landing. - Configuration flags. - - - Request a current rally point from MAV. MAV should respond with a RALLY_POINT message. MAV should not respond if the request is invalid. - System ID. - Component ID. - Point index (first point is 0). - - - Status of compassmot calibration. - Throttle. - Current. - Interference. - Motor Compensation X. - Motor Compensation Y. - Motor Compensation Z. - - - Status of secondary AHRS filter if available. - Roll angle. - Pitch angle. - Yaw angle. - Altitude (MSL). - Latitude. - Longitude. - - - - Camera Event. - Image timestamp (since UNIX epoch, according to camera clock). - System ID. - - Camera ID. - - Image index. - - Event type. - Parameter 1 (meaning depends on event_id, see CAMERA_STATUS_TYPES enum). - Parameter 2 (meaning depends on event_id, see CAMERA_STATUS_TYPES enum). - Parameter 3 (meaning depends on event_id, see CAMERA_STATUS_TYPES enum). - Parameter 4 (meaning depends on event_id, see CAMERA_STATUS_TYPES enum). - - - - Camera Capture Feedback. - Image timestamp (since UNIX epoch), as passed in by CAMERA_STATUS message (or autopilot if no CCB). - System ID. - - Camera ID. - - Image index. - - Latitude. - Longitude. - Altitude (MSL). - Altitude (Relative to HOME location). - Camera Roll angle (earth frame, +-180). - - Camera Pitch angle (earth frame, +-180). - - Camera Yaw (earth frame, 0-360, true). - - Focal Length. - - Feedback flags. - - - Completed image captures. - - - - 2nd Battery status - Voltage. - Battery current, -1: autopilot does not measure the current. - - - Status of third AHRS filter if available. This is for ANU research group (Ali and Sean). - Roll angle. - Pitch angle. - Yaw angle. - Altitude (MSL). - Latitude. - Longitude. - Test variable1. - Test variable2. - Test variable3. - Test variable4. - - - Request the autopilot version from the system/component. - System ID. - Component ID. - - - - Send a block of log data to remote location. - System ID. - Component ID. - Log data block sequence number. - Log data block. - - - Send Status of each log block that autopilot board might have sent. - System ID. - Component ID. - Log data block sequence number. - Log data block status. - - - Control vehicle LEDs. - System ID. - Component ID. - Instance (LED instance to control or 255 for all LEDs). - Pattern (see LED_PATTERN_ENUM). - Custom Byte Length. - Custom Bytes. - - - Reports progress of compass calibration. - Compass being calibrated. - Bitmask of compasses being calibrated. - Calibration Status. - Attempt number. - Completion percentage. - Bitmask of sphere sections (see http://en.wikipedia.org/wiki/Geodesic_grid). - Body frame direction vector for display. - Body frame direction vector for display. - Body frame direction vector for display. - - - - - EKF Status message including flags and variances. - Flags. - - Velocity variance. - - Horizontal Position variance. - Vertical Position variance. - Compass variance. - Terrain Altitude variance. - - Airspeed variance. - - - - PID tuning information. - Axis. - Desired rate. - Achieved rate. - FF component. - P component. - I component. - D component. - - - Deepstall path planning. - Landing latitude. - Landing longitude. - Final heading start point, latitude. - Final heading start point, longitude. - Arc entry point, latitude. - Arc entry point, longitude. - Altitude. - Distance the aircraft expects to travel during the deepstall. - Deepstall cross track error (only valid when in DEEPSTALL_STAGE_LAND). - Deepstall stage. - - - 3 axis gimbal measurements. - System ID. - Component ID. - Time since last update. - Delta angle X. - Delta angle Y. - Delta angle X. - Delta velocity X. - Delta velocity Y. - Delta velocity Z. - Joint ROLL. - Joint EL. - Joint AZ. - - - Control message for rate gimbal. - System ID. - Component ID. - Demanded angular rate X. - Demanded angular rate Y. - Demanded angular rate Z. - - - 100 Hz gimbal torque command telemetry. - System ID. - Component ID. - Roll Torque Command. - Elevation Torque Command. - Azimuth Torque Command. - - - - Heartbeat from a HeroBus attached GoPro. - Status. - Current capture mode. - Additional status bits. - - - - Request a GOPRO_COMMAND response from the GoPro. - System ID. - Component ID. - Command ID. - - - Response from a GOPRO_COMMAND get request. - Command ID. - Status. - Value. - - - Request to set a GOPRO_COMMAND with a desired. - System ID. - Component ID. - Command ID. - Value. - - - Response from a GOPRO_COMMAND set request. - Command ID. - Status. - - - - - RPM sensor output. - RPM Sensor1. - RPM Sensor2. - - - - Read registers for a device. - System ID. - Component ID. - Request ID - copied to reply. - The bus type. - Bus number. - Bus address. - Name of device on bus (for SPI). - First register to read. - Count of registers to read. - - Bank number. - - - Read registers reply. - Request ID - copied from request. - 0 for success, anything else is failure code. - Starting register. - Count of bytes read. - Reply data. - - Bank number. - - - Write registers for a device. - System ID. - Component ID. - Request ID - copied to reply. - The bus type. - Bus number. - Bus address. - Name of device on bus (for SPI). - First register to write. - Count of registers to write. - Write data. - - Bank number. - - - Write registers reply. - Request ID - copied from request. - 0 for success, anything else is failure code. - - - - Adaptive Controller tuning information. - Axis. - Desired rate. - Achieved rate. - Error between model and vehicle. - Theta estimated state predictor. - Omega estimated state predictor. - Sigma estimated state predictor. - Theta derivative. - Omega derivative. - Sigma derivative. - Projection operator value. - Projection operator derivative. - u adaptive controlled output command. - - - - Camera vision based attitude and position deltas. - Timestamp (synced to UNIX time or since system boot). - Time since the last reported camera frame. - Defines a rotation vector in body frame that rotates the vehicle from the previous to the current orientation. - Change in position from previous to current frame rotated into body frame (0=forward, 1=right, 2=down). - Normalised confidence value from 0 to 100. - - - - Angle of Attack and Side Slip Angle. - Timestamp (since boot or Unix epoch). - Angle of Attack. - Side Slip Angle. - - - ESC Telemetry Data for ESCs 1 to 4, matching data sent by BLHeli ESCs. - Temperature. - Voltage. - Current. - Total current. - RPM (eRPM). - count of telemetry packets received (wraps at 65535). - - - ESC Telemetry Data for ESCs 5 to 8, matching data sent by BLHeli ESCs. - Temperature. - Voltage. - Current. - Total current. - RPM (eRPM). - count of telemetry packets received (wraps at 65535). - - - ESC Telemetry Data for ESCs 9 to 12, matching data sent by BLHeli ESCs. - Temperature. - Voltage. - Current. - Total current. - RPM (eRPM). - count of telemetry packets received (wraps at 65535). - - - Configure an OSD parameter slot. - System ID. - Component ID. - Request ID - copied to reply. - OSD parameter screen index. - OSD parameter display index. - Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string - Config type. - OSD parameter minimum value. - OSD parameter maximum value. - OSD parameter increment. - - - Configure OSD parameter reply. - Request ID - copied from request. - Config error type. - - - Read a configured an OSD parameter slot. - System ID. - Component ID. - Request ID - copied to reply. - OSD parameter screen index. - OSD parameter display index. - - - Read configured OSD parameter reply. - Request ID - copied from request. - Config error type. - Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string - Config type. - OSD parameter minimum value. - OSD parameter maximum value. - OSD parameter increment. - - - - - Obstacle located as a 3D vector. - Timestamp (time since system boot). - Class id of the distance sensor type. - Coordinate frame of reference. - Unique ID given to each obstacle so that its movement can be tracked. Use UINT16_MAX if object ID is unknown or cannot be determined. - X position of the obstacle. - Y position of the obstacle. - Z position of the obstacle. - Minimum distance the sensor can measure. - Maximum distance the sensor can measure. - - - diff --git a/message_definitions/autoquad.xml b/message_definitions/autoquad.xml deleted file mode 100644 index a1477886b..000000000 --- a/message_definitions/autoquad.xml +++ /dev/null @@ -1,168 +0,0 @@ - - - common.xml - 3 - - - Track current version of these definitions (can be used by checking value of AUTOQUAD_MAVLINK_DEFS_VERSION_ENUM_END). Append a new entry for each published change. - - - - Available operating modes/statuses for AutoQuad flight controller. - Bitmask up to 32 bits. Low side bits for base modes, high side for - additional active features/modifiers/constraints. - - System is initializing - - - - System is *armed* and standing by, with no throttle input and no autonomous mode - - - Flying (throttle input detected), assumed under manual control unless other mode bits are set - - - Altitude hold engaged - - - Position hold engaged - - - Externally-guided (eg. GCS) navigation mode - - - Autonomous mission execution mode - - - - Ready but *not armed* - - - Calibration mode active - - - - No valid control input (eg. no radio link) - - - Battery is low (stage 1 warning) - - - Battery is depleted (stage 2 warning) - - - - Dynamic Velocity Hold is active (PH with proportional manual direction override) - - - Dynamic Altitude Override is active (AH with proportional manual adjustment) - - - Craft is at ceiling altitude - - - Ceiling altitude is set - - - Heading-Free dynamic mode active - - - Heading-Free locked mode active - - - Automatic Return to Home is active - - - System is in failsafe recovery mode - - - - - Orbit a waypoint. - Orbit radius in meters - Loiter time in decimal seconds - Maximum horizontal speed in m/s - Desired yaw angle at waypoint - Latitude - Longitude - Altitude - - - Start/stop AutoQuad telemetry values stream. - Start or stop (1 or 0) - Stream frequency in us - Dataset ID (refer to aq_mavlink.h::mavlinkCustomDataSets enum in AQ flight controller code) - Empty - Empty - Empty - Empty - - - - Request AutoQuad firmware version number. - Empty - Empty - Empty - Empty - Empty - Empty - Empty - - - - - - Motor/ESC telemetry data. - - - - - - Sends up to 20 raw float values. - Index of message - value1 - value2 - value3 - value4 - value5 - value6 - value7 - value8 - value9 - value10 - value11 - value12 - value13 - value14 - value15 - value16 - value17 - value18 - value19 - value20 - - - Sends ESC32 telemetry data for up to 4 motors. Multiple messages may be sent in sequence when system has > 4 motors. Data is described as follows: - // unsigned int state : 3; - // unsigned int vin : 12; // x 100 - // unsigned int amps : 14; // x 100 - // unsigned int rpm : 15; - // unsigned int duty : 8; // x (255/100) - // - Data Version 2 - - // unsigned int errors : 9; // Bad detects error count - // - Data Version 3 - - // unsigned int temp : 9; // (Deg C + 32) * 4 - // unsigned int errCode : 3; - - Timestamp of the component clock since boot time in ms. - Sequence number of message (first set of 4 motors is #1, next 4 is #2, etc). - Total number of active ESCs/motors on the system. - Number of active ESCs in this sequence (1 through this many array members will be populated with data) - ESC/Motor ID - Age of each ESC telemetry reading in ms compared to boot time. A value of 0xFFFF means timeout/no data. - Version of data structure (determines contents). - Data bits 1-32 for each ESC. - Data bits 33-64 for each ESC. - - - diff --git a/message_definitions/common.xml b/message_definitions/common.xml deleted file mode 100644 index 426d991ac..000000000 --- a/message_definitions/common.xml +++ /dev/null @@ -1,6782 +0,0 @@ - - - minimal.xml - 3 - 0 - - - These values define the type of firmware release. These values indicate the first version or release of this type. For example the first alpha release would be 64, the second would be 65. - - development release - - - alpha release - - - beta release - - - release candidate - - - official stable release - - - - Flags to report failure cases over the high latency telemtry. - - GPS failure. - - - Differential pressure sensor failure. - - - Absolute pressure sensor failure. - - - Accelerometer sensor failure. - - - Gyroscope sensor failure. - - - Magnetometer sensor failure. - - - Terrain subsystem failure. - - - Battery failure/critical low battery. - - - RC receiver failure/no rc connection. - - - Offboard link failure. - - - Engine failure. - - - Geofence violation. - - - Estimator failure, for example measurement rejection or large variances. - - - Mission failure. - - - - Actions that may be specified in MAV_CMD_OVERRIDE_GOTO to override mission execution. - - Hold at the current position. - - - Continue with the next item in mission execution. - - - Hold at the current position of the system - - - Hold at the position specified in the parameters of the DO_HOLD action - - - - These defines are predefined OR-combined mode flags. There is no need to use values from this enum, but it - simplifies the use of the mode flags. Note that manual input is enabled in all modes as a safety override. - - System is not ready to fly, booting, calibrating, etc. No flag is set. - - - System is allowed to be active, under assisted RC control. - - - System is allowed to be active, under assisted RC control. - - - System is allowed to be active, under manual (RC) control, no stabilization - - - System is allowed to be active, under manual (RC) control, no stabilization - - - System is allowed to be active, under autonomous control, manual setpoint - - - System is allowed to be active, under autonomous control, manual setpoint - - - System is allowed to be active, under autonomous control and navigation (the trajectory is decided onboard and not pre-programmed by waypoints) - - - System is allowed to be active, under autonomous control and navigation (the trajectory is decided onboard and not pre-programmed by waypoints) - - - UNDEFINED mode. This solely depends on the autopilot - use with caution, intended for developers only. - - - UNDEFINED mode. This solely depends on the autopilot - use with caution, intended for developers only. - - - - These encode the sensors whose status is sent as part of the SYS_STATUS message. - - 0x01 3D gyro - - - 0x02 3D accelerometer - - - 0x04 3D magnetometer - - - 0x08 absolute pressure - - - 0x10 differential pressure - - - 0x20 GPS - - - 0x40 optical flow - - - 0x80 computer vision position - - - 0x100 laser based position - - - 0x200 external ground truth (Vicon or Leica) - - - 0x400 3D angular rate control - - - 0x800 attitude stabilization - - - 0x1000 yaw position - - - 0x2000 z/altitude control - - - 0x4000 x/y position control - - - 0x8000 motor outputs / control - - - 0x10000 rc receiver - - - 0x20000 2nd 3D gyro - - - 0x40000 2nd 3D accelerometer - - - 0x80000 2nd 3D magnetometer - - - 0x100000 geofence - - - 0x200000 AHRS subsystem health - - - 0x400000 Terrain subsystem health - - - 0x800000 Motors are reversed - - - 0x1000000 Logging - - - 0x2000000 Battery - - - 0x4000000 Proximity - - - 0x8000000 Satellite Communication - - - 0x10000000 pre-arm check status. Always healthy when armed - - - 0x20000000 Avoidance/collision prevention - - - - - Global (WGS84) coordinate frame + MSL altitude. First value / x: latitude, second value / y: longitude, third value / z: positive altitude over mean sea level (MSL). - - - Local coordinate frame, Z-down (x: North, y: East, z: Down). - - - NOT a coordinate frame, indicates a mission command. - - - Global (WGS84) coordinate frame + altitude relative to the home position. First value / x: latitude, second value / y: longitude, third value / z: positive altitude with 0 being at the altitude of the home location. - - - Local coordinate frame, Z-up (x: East, y: North, z: Up). - - - Global (WGS84) coordinate frame (scaled) + MSL altitude. First value / x: latitude in degrees*1.0e-7, second value / y: longitude in degrees*1.0e-7, third value / z: positive altitude over mean sea level (MSL). - - - Global (WGS84) coordinate frame (scaled) + altitude relative to the home position. First value / x: latitude in degrees*10e-7, second value / y: longitude in degrees*10e-7, third value / z: positive altitude with 0 being at the altitude of the home location. - - - Offset to the current local frame. Anything expressed in this frame should be added to the current local frame position. - - - - Setpoint in body NED frame. This makes sense if all position control is externalized - e.g. useful to command 2 m/s^2 acceleration to the right. - - - - Offset in body NED frame. This makes sense if adding setpoints to the current flight path, to avoid an obstacle - e.g. useful to command 2 m/s^2 acceleration to the east. - - - Global (WGS84) coordinate frame with AGL altitude (at the waypoint coordinate). First value / x: latitude in degrees, second value / y: longitude in degrees, third value / z: positive altitude in meters with 0 being at ground level in terrain model. - - - Global (WGS84) coordinate frame (scaled) with AGL altitude (at the waypoint coordinate). First value / x: latitude in degrees*10e-7, second value / y: longitude in degrees*10e-7, third value / z: positive altitude in meters with 0 being at ground level in terrain model. - - - Body fixed frame of reference, Z-down (x: Forward, y: Right, z: Down). - - - - MAV_FRAME_BODY_FLU - Body fixed frame of reference, Z-up (x: Forward, y: Left, z: Up). - - - - MAV_FRAME_MOCAP_NED - Odometry local coordinate frame of data given by a motion capture system, Z-down (x: North, y: East, z: Down). - - - - MAV_FRAME_MOCAP_ENU - Odometry local coordinate frame of data given by a motion capture system, Z-up (x: East, y: North, z: Up). - - - - MAV_FRAME_VISION_NED - Odometry local coordinate frame of data given by a vision estimation system, Z-down (x: North, y: East, z: Down). - - - - MAV_FRAME_VISION_ENU - Odometry local coordinate frame of data given by a vision estimation system, Z-up (x: East, y: North, z: Up). - - - - MAV_FRAME_ESTIM_NED - Odometry local coordinate frame of data given by an estimator running onboard the vehicle, Z-down (x: North, y: East, z: Down). - - - - MAV_FRAME_ESTIM_ENU - Odometry local coordinate frame of data given by an estimator running onboard the vehicle, Z-up (x: East, y: North, z: Up). - - - Forward, Right, Down coordinate frame. This is a local frame with Z-down and arbitrary F/R alignment (i.e. not aligned with NED/earth frame). - - - Forward, Left, Up coordinate frame. This is a local frame with Z-up and arbitrary F/L alignment (i.e. not aligned with ENU/earth frame). - - - - - - - - - - - - - - - - - - - - - - - - - - Disable fenced mode - - - Switched to guided mode to return point (fence point 0) - - - Report fence breach, but don't take action - - - Switched to guided mode to return point (fence point 0) with manual throttle control - - - Switch to RTL (return to launch) mode and head for the return point. - - - - - No last fence breach - - - Breached minimum altitude - - - Breached maximum altitude - - - Breached fence boundary - - - - - Actions being taken to mitigate/prevent fence breach - - Unknown - - - No actions being taken - - - Velocity limiting active to prevent breach - - - - - - Enumeration of possible mount operation modes. This message is used by obsolete/deprecated gimbal messages. - - Load and keep safe position (Roll,Pitch,Yaw) from permant memory and stop stabilization - - - Load and keep neutral position (Roll,Pitch,Yaw) from permanent memory. - - - Load neutral position and start MAVLink Roll,Pitch,Yaw control with stabilization - - - Load neutral position and start RC Roll,Pitch,Yaw control with stabilization - - - Load neutral position and start to point to Lat,Lon,Alt - - - Gimbal tracks system with specified system ID - - - Gimbal tracks home location - - - - Gimbal device (low level) capability flags (bitmap) - - Gimbal device supports a retracted position - - - Gimbal device supports a horizontal, forward looking position, stabilized - - - Gimbal device supports rotating around roll axis. - - - Gimbal device supports to follow a roll angle relative to the vehicle - - - Gimbal device supports locking to an roll angle (generally that's the default with roll stabilized) - - - Gimbal device supports rotating around pitch axis. - - - Gimbal device supports to follow a pitch angle relative to the vehicle - - - Gimbal device supports locking to an pitch angle (generally that's the default with pitch stabilized) - - - Gimbal device supports rotating around yaw axis. - - - Gimbal device supports to follow a yaw angle relative to the vehicle (generally that's the default) - - - Gimbal device supports locking to an absolute heading (often this is an option available) - - - Gimbal device supports yawing/panning infinetely (e.g. using slip disk). - - - - Gimbal manager high level capability flags (bitmap). The first 16 bits are identical to the GIMBAL_DEVICE_CAP_FLAGS which are identical with GIMBAL_DEVICE_FLAGS. However, the gimbal manager does not need to copy the flags from the gimbal but can also enhance the capabilities and thus add flags. - - Based on GIMBAL_DEVICE_CAP_FLAGS_HAS_RETRACT. - - - Based on GIMBAL_DEVICE_CAP_FLAGS_HAS_NEUTRAL. - - - Based on GIMBAL_DEVICE_CAP_FLAGS_HAS_ROLL_AXIS. - - - Based on GIMBAL_DEVICE_CAP_FLAGS_HAS_ROLL_FOLLOW. - - - Based on GIMBAL_DEVICE_CAP_FLAGS_HAS_ROLL_LOCK. - - - Based on GIMBAL_DEVICE_CAP_FLAGS_HAS_PITCH_AXIS. - - - Based on GIMBAL_DEVICE_CAP_FLAGS_HAS_PITCH_FOLLOW. - - - Based on GIMBAL_DEVICE_CAP_FLAGS_HAS_PITCH_LOCK. - - - Based on GIMBAL_DEVICE_CAP_FLAGS_HAS_YAW_AXIS. - - - Based on GIMBAL_DEVICE_CAP_FLAGS_HAS_YAW_FOLLOW. - - - Based on GIMBAL_DEVICE_CAP_FLAGS_HAS_YAW_LOCK. - - - Based on GIMBAL_DEVICE_CAP_FLAGS_SUPPORTS_INFINITE_YAW. - - - Gimbal manager supports to point to a local position. - - - Gimbal manager supports to point to a global latitude, longitude, altitude position. - - - - Flags for gimbal device (lower level) operation. - - Set to retracted safe position (no stabilization), takes presedence over all other flags. - - - Set to neutral position (horizontal, forward looking, with stabiliziation), takes presedence over all other flags except RETRACT. - - - Lock roll angle to absolute angle relative to horizon (not relative to drone). This is generally the default with a stabilizing gimbal. - - - Lock pitch angle to absolute angle relative to horizon (not relative to drone). This is generally the default. - - - Lock yaw angle to absolute angle relative to North (not relative to drone). If this flag is set, the quaternion is in the Earth frame with the x-axis pointing North (yaw absolute). If this flag is not set, the quaternion frame is in the Earth frame rotated so that the x-axis is pointing forward (yaw relative to vehicle). - - - - Flags for high level gimbal manager operation The first 16 bytes are identical to the GIMBAL_DEVICE_FLAGS. - - Based on GIMBAL_DEVICE_FLAGS_RETRACT - - - Based on GIMBAL_DEVICE_FLAGS_NEUTRAL - - - Based on GIMBAL_DEVICE_FLAGS_ROLL_LOCK - - - Based on GIMBAL_DEVICE_FLAGS_PITCH_LOCK - - - Based on GIMBAL_DEVICE_FLAGS_YAW_LOCK - - - - Gimbal device (low level) error flags (bitmap, 0 means no error) - - Gimbal device is limited by hardware roll limit. - - - Gimbal device is limited by hardware pitch limit. - - - Gimbal device is limited by hardware yaw limit. - - - There is an error with the gimbal encoders. - - - There is an error with the gimbal power source. - - - There is an error with the gimbal motor's. - - - There is an error with the gimbal's software. - - - There is an error with the gimbal's communication. - - - Gimbal is currently calibrating. - - - - - Gripper actions. - - Gripper release cargo. - - - Gripper grab onto cargo. - - - - - Winch actions. - - Relax winch. - - - Wind or unwind specified length of cable, optionally using specified rate. - - - Wind or unwind cable at specified rate. - - - - - Generalized UAVCAN node health - - The node is functioning properly. - - - A critical parameter went out of range or the node has encountered a minor failure. - - - The node has encountered a major failure. - - - The node has suffered a fatal malfunction. - - - - - Generalized UAVCAN node mode - - The node is performing its primary functions. - - - The node is initializing; this mode is entered immediately after startup. - - - The node is under maintenance. - - - The node is in the process of updating its software. - - - The node is no longer available online. - - - - - Indicates the ESC connection type. - - Traditional PPM ESC. - - - Serial Bus connected ESC. - - - One Shot PPM ESC. - - - I2C ESC. - - - CAN-Bus ESC. - - - DShot ESC. - - - - - Flags to report ESC failures. - - No ESC failure. - - - Over current failure. - - - Over voltage failure. - - - Over temperature failure. - - - Over RPM failure. - - - Inconsistent command failure i.e. out of bounds. - - - Motor stuck failure. - - - Generic ESC failure. - - - - Flags to indicate the status of camera storage. - - Storage is missing (no microSD card loaded for example.) - - - Storage present but unformatted. - - - Storage present and ready. - - - Camera does not supply storage status information. Capacity information in STORAGE_INFORMATION fields will be ignored. - - - - Flags to indicate the type of storage. - - Storage type is not known. - - - Storage type is USB device. - - - Storage type is SD card. - - - Storage type is microSD card. - - - Storage type is CFast. - - - Storage type is CFexpress. - - - Storage type is XQD. - - - Storage type is HD mass storage type. - - - Storage type is other, not listed type. - - - - Yaw behaviour during orbit flight. - - Vehicle front points to the center (default). - - - Vehicle front holds heading when message received. - - - Yaw uncontrolled. - - - Vehicle front follows flight path (tangential to circle). - - - Yaw controlled by RC input. - - - - Possible responses from a WIFI_CONFIG_AP message. - - Undefined response. Likely an indicative of a system that doesn't support this request. - - - Changes accepted. - - - Changes rejected. - - - Invalid Mode. - - - Invalid SSID. - - - Invalid Password. - - - - Possible responses from a CELLULAR_CONFIG message. - - Changes accepted. - - - Invalid APN. - - - Invalid PIN. - - - Changes rejected. - - - PUK is required to unblock SIM card. - - - - WiFi Mode. - - WiFi mode is undefined. - - - WiFi configured as an access point. - - - WiFi configured as a station connected to an existing local WiFi network. - - - WiFi disabled. - - - - Possible values for COMPONENT_INFORMATION.comp_metadata_type. - - Version information which also includes information on other optional supported COMP_METADATA_TYPE's. Must be supported. Only downloadable from vehicle. - - - Parameter meta data. - - - Meta data which specifies the commands the vehicle supports. (WIP) - - - - Possible transport layers to set and get parameters via mavlink during a parameter transaction. - - Transaction over param transport. - - - Transaction over param_ext transport. - - - - Possible parameter transaction actions. - - Commit the current parameter transaction. - - - Commit the current parameter transaction. - - - Cancel the current parameter transaction. - - - - - - - - Commands to be executed by the MAV. They can be executed on user request, or as part of a mission script. If the action is used in a mission, the parameter mapping to the waypoint/mission message is as follows: Param 1, Param 2, Param 3, Param 4, X: Param 5, Y:Param 6, Z:Param 7. This command list is similar what ARINC 424 is for commercial aircraft: A data format how to interpret waypoint/mission data. NaN and INT32_MAX may be used in float/integer params (respectively) to indicate optional/default values (e.g. to use the component's current yaw or latitude rather than a specific value). See https://mavlink.io/en/guide/xml_schema.html#MAV_CMD for information about the structure of the MAV_CMD entries - - Navigate to waypoint. - Hold time. (ignored by fixed wing, time to stay at waypoint for rotary wing) - Acceptance radius (if the sphere with this radius is hit, the waypoint counts as reached) - 0 to pass through the WP, if > 0 radius to pass by WP. Positive value for clockwise orbit, negative value for counter-clockwise orbit. Allows trajectory control. - Desired yaw angle at waypoint (rotary wing). NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.). - Latitude - Longitude - Altitude - - - Loiter around this waypoint an unlimited amount of time - Empty - Empty - Loiter radius around waypoint for forward-only moving vehicles (not multicopters). If positive loiter clockwise, else counter-clockwise - Desired yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.). - Latitude - Longitude - Altitude - - - Loiter around this waypoint for X turns - Number of turns. - Leave loiter circle only once heading towards the next waypoint (0 = False) - Loiter radius around waypoint for forward-only moving vehicles (not multicopters). If positive loiter clockwise, else counter-clockwise - Loiter circle exit location and/or path to next waypoint ("xtrack") for forward-only moving vehicles (not multicopters). 0 for the vehicle to converge towards the center xtrack when it leaves the loiter (the line between the centers of the current and next waypoint), 1 to converge to the direct line between the location that the vehicle exits the loiter radius and the next waypoint. Otherwise the angle (in degrees) between the tangent of the loiter circle and the center xtrack at which the vehicle must leave the loiter (and converge to the center xtrack). NaN to use the current system default xtrack behaviour. - Latitude - Longitude - Altitude - - - Loiter at the specified latitude, longitude and altitude for a certain amount of time. Multicopter vehicles stop at the point (within a vehicle-specific acceptance radius). Forward-only moving vehicles (e.g. fixed-wing) circle the point with the specified radius/direction. If the Heading Required parameter (2) is non-zero forward moving aircraft will only leave the loiter circle once heading towards the next waypoint. - Loiter time (only starts once Lat, Lon and Alt is reached). - Leave loiter circle only once heading towards the next waypoint (0 = False) - Loiter radius around waypoint for forward-only moving vehicles (not multicopters). If positive loiter clockwise, else counter-clockwise. - Loiter circle exit location and/or path to next waypoint ("xtrack") for forward-only moving vehicles (not multicopters). 0 for the vehicle to converge towards the center xtrack when it leaves the loiter (the line between the centers of the current and next waypoint), 1 to converge to the direct line between the location that the vehicle exits the loiter radius and the next waypoint. Otherwise the angle (in degrees) between the tangent of the loiter circle and the center xtrack at which the vehicle must leave the loiter (and converge to the center xtrack). NaN to use the current system default xtrack behaviour. - Latitude - Longitude - Altitude - - - Return to launch location - Empty - Empty - Empty - Empty - Empty - Empty - Empty - - - Land at location. - Minimum target altitude if landing is aborted (0 = undefined/use system default). - Precision land mode. - Empty. - Desired yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.). - Latitude. - Longitude. - Landing altitude (ground level in current frame). - - - Takeoff from ground / hand. Vehicles that support multiple takeoff modes (e.g. VTOL quadplane) should take off using the currently configured mode. - Minimum pitch (if airspeed sensor present), desired pitch without sensor - Empty - Empty - Yaw angle (if magnetometer present), ignored without magnetometer. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.). - Latitude - Longitude - Altitude - - - Land at local position (local frame only) - Landing target number (if available) - Maximum accepted offset from desired landing position - computed magnitude from spherical coordinates: d = sqrt(x^2 + y^2 + z^2), which gives the maximum accepted distance between the desired landing position and the position where the vehicle is about to land - Landing descend rate - Desired yaw angle - Y-axis position - X-axis position - Z-axis / ground level position - - - Takeoff from local position (local frame only) - Minimum pitch (if airspeed sensor present), desired pitch without sensor - Empty - Takeoff ascend rate - Yaw angle (if magnetometer or another yaw estimation source present), ignored without one of these - Y-axis position - X-axis position - Z-axis position - - - Vehicle following, i.e. this waypoint represents the position of a moving vehicle - Following logic to use (e.g. loitering or sinusoidal following) - depends on specific autopilot implementation - Ground speed of vehicle to be followed - Radius around waypoint. If positive loiter clockwise, else counter-clockwise - Desired yaw angle. - Latitude - Longitude - Altitude - - - Continue on the current course and climb/descend to specified altitude. When the altitude is reached continue to the next command (i.e., don't proceed to the next command until the desired altitude is reached. - Climb or Descend (0 = Neutral, command completes when within 5m of this command's altitude, 1 = Climbing, command completes when at or above this command's altitude, 2 = Descending, command completes when at or below this command's altitude. - Empty - Empty - Empty - Empty - Empty - Desired altitude - - - Begin loiter at the specified Latitude and Longitude. If Lat=Lon=0, then loiter at the current position. Don't consider the navigation command complete (don't leave loiter) until the altitude has been reached. Additionally, if the Heading Required parameter is non-zero the aircraft will not leave the loiter until heading toward the next waypoint. - Leave loiter circle only once heading towards the next waypoint (0 = False) - Loiter radius around waypoint for forward-only moving vehicles (not multicopters). If positive loiter clockwise, negative counter-clockwise, 0 means no change to standard loiter. - Empty - Loiter circle exit location and/or path to next waypoint ("xtrack") for forward-only moving vehicles (not multicopters). 0 for the vehicle to converge towards the center xtrack when it leaves the loiter (the line between the centers of the current and next waypoint), 1 to converge to the direct line between the location that the vehicle exits the loiter radius and the next waypoint. Otherwise the angle (in degrees) between the tangent of the loiter circle and the center xtrack at which the vehicle must leave the loiter (and converge to the center xtrack). NaN to use the current system default xtrack behaviour. - Latitude - Longitude - Altitude - - - Begin following a target - System ID (of the FOLLOW_TARGET beacon). Send 0 to disable follow-me and return to the default position hold mode. - Reserved - Reserved - Altitude mode: 0: Keep current altitude, 1: keep altitude difference to target, 2: go to a fixed altitude above home. - Altitude above home. (used if mode=2) - Reserved - Time to land in which the MAV should go to the default position hold mode after a message RX timeout. - - - Reposition the MAV after a follow target command has been sent - Camera q1 (where 0 is on the ray from the camera to the tracking device) - Camera q2 - Camera q3 - Camera q4 - altitude offset from target - X offset from target - Y offset from target - - - - - Start orbiting on the circumference of a circle defined by the parameters. Setting any value NaN results in using defaults. - Radius of the circle. positive: Orbit clockwise. negative: Orbit counter-clockwise. - Tangential Velocity. NaN: Vehicle configuration default. - Yaw behavior of the vehicle. - Reserved (e.g. for dynamic center beacon options) - Center point latitude (if no MAV_FRAME specified) / X coordinate according to MAV_FRAME. NaN: Use current vehicle position or current center if already orbiting. - Center point longitude (if no MAV_FRAME specified) / Y coordinate according to MAV_FRAME. NaN: Use current vehicle position or current center if already orbiting. - Center point altitude (MSL) (if no MAV_FRAME specified) / Z coordinate according to MAV_FRAME. NaN: Use current vehicle position or current center if already orbiting. - - - - Sets the region of interest (ROI) for a sensor set or the vehicle itself. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. - Region of interest mode. - Waypoint index/ target ID. (see MAV_ROI enum) - ROI index (allows a vehicle to manage multiple ROI's) - Empty - x the location of the fixed ROI (see MAV_FRAME) - y - z - - - Control autonomous path planning on the MAV. - 0: Disable local obstacle avoidance / local path planning (without resetting map), 1: Enable local path planning, 2: Enable and reset local path planning - 0: Disable full path planning (without resetting map), 1: Enable, 2: Enable and reset map/occupancy grid, 3: Enable and reset planned route, but not occupancy grid - Empty - Yaw angle at goal - Latitude/X of goal - Longitude/Y of goal - Altitude/Z of goal - - - Navigate to waypoint using a spline path. - Hold time. (ignored by fixed wing, time to stay at waypoint for rotary wing) - Empty - Empty - Empty - Latitude/X of goal - Longitude/Y of goal - Altitude/Z of goal - - - Takeoff from ground using VTOL mode, and transition to forward flight with specified heading. The command should be ignored by vehicles that dont support both VTOL and fixed-wing flight (multicopters, boats,etc.). - Empty - Front transition heading. - Empty - Yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.). - Latitude - Longitude - Altitude - - - Land using VTOL mode - Empty - Empty - Approach altitude (with the same reference as the Altitude field). NaN if unspecified. - Yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.). - Latitude - Longitude - Altitude (ground level) - - - - hand control over to an external controller - On / Off (> 0.5f on) - Empty - Empty - Empty - Empty - Empty - Empty - - - Delay the next navigation command a number of seconds or until a specified time - Delay (-1 to enable time-of-day fields) - hour (24h format, UTC, -1 to ignore) - minute (24h format, UTC, -1 to ignore) - second (24h format, UTC, -1 to ignore) - Empty - Empty - Empty - - - Descend and place payload. Vehicle moves to specified location, descends until it detects a hanging payload has reached the ground, and then releases the payload. If ground is not detected before the reaching the maximum descent value (param1), the command will complete without releasing the payload. - Maximum distance to descend. - Empty - Empty - Empty - Latitude - Longitude - Altitude - - - NOP - This command is only used to mark the upper limit of the NAV/ACTION commands in the enumeration - Empty - Empty - Empty - Empty - Empty - Empty - Empty - - - Delay mission state machine. - Delay - Empty - Empty - Empty - Empty - Empty - Empty - - - Ascend/descend to target altitude at specified rate. Delay mission state machine until desired altitude reached. - Descent / Ascend rate. - Empty - Empty - Empty - Empty - Empty - Target Altitude - - - Delay mission state machine until within desired distance of next NAV point. - Distance. - Empty - Empty - Empty - Empty - Empty - Empty - - - Reach a certain target angle. - target angle, 0 is north - angular speed - direction: -1: counter clockwise, 1: clockwise - 0: absolute angle, 1: relative offset - Empty - Empty - Empty - - - NOP - This command is only used to mark the upper limit of the CONDITION commands in the enumeration - Empty - Empty - Empty - Empty - Empty - Empty - Empty - - - Set system mode. - Mode - Custom mode - this is system specific, please refer to the individual autopilot specifications for details. - Custom sub mode - this is system specific, please refer to the individual autopilot specifications for details. - Empty - Empty - Empty - Empty - - - Jump to the desired command in the mission list. Repeat this action only the specified number of times - Sequence number - Repeat count - Empty - Empty - Empty - Empty - Empty - - - Change speed and/or throttle set points. - Speed type (0=Airspeed, 1=Ground Speed, 2=Climb Speed, 3=Descent Speed) - Speed (-1 indicates no change) - Throttle (-1 indicates no change) - 0: absolute, 1: relative - Empty - Empty - Empty - - - Changes the home location either to the current location or a specified location. - Use current (1=use current location, 0=use specified location) - Empty - Empty - Yaw angle. NaN to use default heading - Latitude - Longitude - Altitude - - - Set a system parameter. Caution! Use of this command requires knowledge of the numeric enumeration value of the parameter. - Parameter number - Parameter value - Empty - Empty - Empty - Empty - Empty - - - Set a relay to a condition. - Relay instance number. - Setting. (1=on, 0=off, others possible depending on system hardware) - Empty - Empty - Empty - Empty - Empty - - - Cycle a relay on and off for a desired number of cycles with a desired period. - Relay instance number. - Cycle count. - Cycle time. - Empty - Empty - Empty - Empty - - - Set a servo to a desired PWM value. - Servo instance number. - Pulse Width Modulation. - Empty - Empty - Empty - Empty - Empty - - - Cycle a between its nominal setting and a desired PWM for a desired number of cycles with a desired period. - Servo instance number. - Pulse Width Modulation. - Cycle count. - Cycle time. - Empty - Empty - Empty - - - Terminate flight immediately - Flight termination activated if > 0.5 - Empty - Empty - Empty - Empty - Empty - Empty - - - Change altitude set point. - Altitude. - Frame of new altitude. - Empty - Empty - Empty - Empty - Empty - - - - - Sets actuators (e.g. servos) to a desired value. The actuator numbers are mapped to specific outputs (e.g. on any MAIN or AUX PWM or UAVCAN) using a flight-stack specific mechanism (i.e. a parameter). - Actuator 1 value, scaled from [-1 to 1]. NaN to ignore. - Actuator 2 value, scaled from [-1 to 1]. NaN to ignore. - Actuator 3 value, scaled from [-1 to 1]. NaN to ignore. - Actuator 4 value, scaled from [-1 to 1]. NaN to ignore. - Actuator 5 value, scaled from [-1 to 1]. NaN to ignore. - Actuator 6 value, scaled from [-1 to 1]. NaN to ignore. - Index of actuator set (i.e if set to 1, Actuator 1 becomes Actuator 7) - - - Mission command to perform a landing. This is used as a marker in a mission to tell the autopilot where a sequence of mission items that represents a landing starts. It may also be sent via a COMMAND_LONG to trigger a landing, in which case the nearest (geographically) landing sequence in the mission will be used. The Latitude/Longitude is optional, and may be set to 0 if not needed. If specified then it will be used to help find the closest landing sequence. - Empty - Empty - Empty - Empty - Latitude - Longitude - Empty - - - Mission command to perform a landing from a rally point. - Break altitude - Landing speed - Empty - Empty - Empty - Empty - Empty - - - Mission command to safely abort an autonomous landing. - Altitude - Empty - Empty - Empty - Empty - Empty - Empty - - - Reposition the vehicle to a specific WGS84 global position. - Ground speed, less than 0 (-1) for default - Bitmask of option flags. - Reserved - Yaw heading. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.). For planes indicates loiter direction (0: clockwise, 1: counter clockwise) - Latitude - Longitude - Altitude - - - If in a GPS controlled position mode, hold the current position or continue. - 0: Pause current mission or reposition command, hold current position. 1: Continue mission. A VTOL capable vehicle should enter hover mode (multicopter and VTOL planes). A plane should loiter with the default loiter radius. - Reserved - Reserved - Reserved - Reserved - Reserved - Reserved - - - Set moving direction to forward or reverse. - Direction (0=Forward, 1=Reverse) - Empty - Empty - Empty - Empty - Empty - Empty - - - Sets the region of interest (ROI) to a location. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. This command can be sent to a gimbal manager but not to a gimbal device. A gimbal is not to react to this message. - Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals). - Empty - Empty - Empty - Latitude of ROI location - Longitude of ROI location - Altitude of ROI location - - - Sets the region of interest (ROI) to be toward next waypoint, with optional pitch/roll/yaw offset. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. This command can be sent to a gimbal manager but not to a gimbal device. A gimbal device is not to react to this message. - Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals). - Empty - Empty - Empty - Pitch offset from next waypoint, positive pitching up - Roll offset from next waypoint, positive rolling to the right - Yaw offset from next waypoint, positive yawing to the right - - - Cancels any previous ROI command returning the vehicle/sensors to default flight characteristics. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. This command can be sent to a gimbal manager but not to a gimbal device. A gimbal device is not to react to this message. After this command the gimbal manager should go back to manual input if available, and otherwise assume a neutral position. - Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals). - Empty - Empty - Empty - Empty - Empty - Empty - - - Mount tracks system with specified system ID. Determination of target vehicle position may be done with GLOBAL_POSITION_INT or any other means. This command can be sent to a gimbal manager but not to a gimbal device. A gimbal device is not to react to this message. - System ID - Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals). - - - Control onboard camera system. - Camera ID (-1 for all) - Transmission: 0: disabled, 1: enabled compressed, 2: enabled raw - Transmission mode: 0: video stream, >0: single images every n seconds - Recording: 0: disabled, 1: enabled compressed, 2: enabled raw - Empty - Empty - Empty - - - - Sets the region of interest (ROI) for a sensor set or the vehicle itself. This can then be used by the vehicle's control system to control the vehicle attitude and the attitude of various sensors such as cameras. - Region of interest mode. - Waypoint index/ target ID (depends on param 1). - Region of interest index. (allows a vehicle to manage multiple ROI's) - Empty - MAV_ROI_WPNEXT: pitch offset from next waypoint, MAV_ROI_LOCATION: latitude - MAV_ROI_WPNEXT: roll offset from next waypoint, MAV_ROI_LOCATION: longitude - MAV_ROI_WPNEXT: yaw offset from next waypoint, MAV_ROI_LOCATION: altitude - - - - Configure digital camera. This is a fallback message for systems that have not yet implemented PARAM_EXT_XXX messages and camera definition files (see https://mavlink.io/en/services/camera_def.html ). - Modes: P, TV, AV, M, Etc. - Shutter speed: Divisor number for one second. - Aperture: F stop number. - ISO number e.g. 80, 100, 200, Etc. - Exposure type enumerator. - Command Identity. - Main engine cut-off time before camera trigger. (0 means no cut-off) - - - Control digital camera. This is a fallback message for systems that have not yet implemented PARAM_EXT_XXX messages and camera definition files (see https://mavlink.io/en/services/camera_def.html ). - Session control e.g. show/hide lens - Zoom's absolute position - Zooming step value to offset zoom from the current position - Focus Locking, Unlocking or Re-locking - Shooting Command - Command Identity - Test shot identifier. If set to 1, image will only be captured, but not counted towards internal frame count. - - - - This message has been superseded by MAV_CMD_DO_GIMBAL_MANAGER_CONFIGURE. The message can still be used to communicate with legacy gimbals implementing it. - Mission command to configure a camera or antenna mount - Mount operation mode - stabilize roll? (1 = yes, 0 = no) - stabilize pitch? (1 = yes, 0 = no) - stabilize yaw? (1 = yes, 0 = no) - roll input (0 = angle body frame, 1 = angular rate, 2 = angle absolute frame) - pitch input (0 = angle body frame, 1 = angular rate, 2 = angle absolute frame) - yaw input (0 = angle body frame, 1 = angular rate, 2 = angle absolute frame) - - - - This message is ambiguous and inconsistent. It has been superseded by MAV_CMD_DO_GIMBAL_MANAGER_PITCHYAW and MAV_CMD_DO_SET_ROI_*. The message can still be used to communicate with legacy gimbals implementing it. - Mission command to control a camera or antenna mount - pitch depending on mount mode (degrees or degrees/second depending on pitch input). - roll depending on mount mode (degrees or degrees/second depending on roll input). - yaw depending on mount mode (degrees or degrees/second depending on yaw input). - altitude depending on mount mode. - latitude, set if appropriate mount mode. - longitude, set if appropriate mount mode. - Mount mode. - - - Mission command to set camera trigger distance for this flight. The camera is triggered each time this distance is exceeded. This command can also be used to set the shutter integration time for the camera. - Camera trigger distance. 0 to stop triggering. - Camera shutter integration time. -1 or 0 to ignore - Trigger camera once immediately. (0 = no trigger, 1 = trigger) - Empty - Empty - Empty - Empty - - - Mission command to enable the geofence - enable? (0=disable, 1=enable, 2=disable_floor_only) - Empty - Empty - Empty - Empty - Empty - Empty - - - Mission item/command to release a parachute or enable/disable auto release. - Action - Empty - Empty - Empty - Empty - Empty - Empty - - - Mission command to perform motor test. - Motor instance number. (from 1 to max number of motors on the vehicle) - Throttle type. - Throttle. - Timeout. - Motor count. (number of motors to test to test in sequence, waiting for the timeout above between them; 0=1 motor, 1=1 motor, 2=2 motors...) - Motor test order. - Empty - - - Change to/from inverted flight. - Inverted flight. (0=normal, 1=inverted) - Empty - Empty - Empty - Empty - Empty - Empty - - - Mission command to operate a gripper. - Gripper instance number. - Gripper action to perform. - Empty - Empty - Empty - Empty - Empty - - - Enable/disable autotune. - Enable (1: enable, 0:disable). - Empty. - Empty. - Empty. - Empty. - Empty. - Empty. - - - Sets a desired vehicle turn angle and speed change. - Yaw angle to adjust steering by. - Speed. - Final angle. (0=absolute, 1=relative) - Empty - Empty - Empty - Empty - - - Mission command to set camera trigger interval for this flight. If triggering is enabled, the camera is triggered each time this interval expires. This command can also be used to set the shutter integration time for the camera. - Camera trigger cycle time. -1 or 0 to ignore. - Camera shutter integration time. Should be less than trigger cycle time. -1 or 0 to ignore. - Empty - Empty - Empty - Empty - Empty - - - - Mission command to control a camera or antenna mount, using a quaternion as reference. - quaternion param q1, w (1 in null-rotation) - quaternion param q2, x (0 in null-rotation) - quaternion param q3, y (0 in null-rotation) - quaternion param q4, z (0 in null-rotation) - Empty - Empty - Empty - - - set id of master controller - System ID - Component ID - Empty - Empty - Empty - Empty - Empty - - - Set limits for external control - Timeout - maximum time that external controller will be allowed to control vehicle. 0 means no timeout. - Altitude (MSL) min - if vehicle moves below this alt, the command will be aborted and the mission will continue. 0 means no lower altitude limit. - Altitude (MSL) max - if vehicle moves above this alt, the command will be aborted and the mission will continue. 0 means no upper altitude limit. - Horizontal move limit - if vehicle moves more than this distance from its location at the moment the command was executed, the command will be aborted and the mission will continue. 0 means no horizontal move limit. - Empty - Empty - Empty - - - Control vehicle engine. This is interpreted by the vehicles engine controller to change the target engine state. It is intended for vehicles with internal combustion engines - 0: Stop engine, 1:Start Engine - 0: Warm start, 1:Cold start. Controls use of choke where applicable - Height delay. This is for commanding engine start only after the vehicle has gained the specified height. Used in VTOL vehicles during takeoff to start engine after the aircraft is off the ground. Zero for no delay. - Empty - Empty - Empty - Empty - Empty - - - Set the mission item with sequence number seq as current item. This means that the MAV will continue to this mission item on the shortest path (not following the mission items in-between). - Mission sequence value to set - Empty - Empty - Empty - Empty - Empty - Empty - Empty - - - NOP - This command is only used to mark the upper limit of the DO commands in the enumeration - Empty - Empty - Empty - Empty - Empty - Empty - Empty - - - Trigger calibration. This command will be only accepted if in pre-flight mode. Except for Temperature Calibration, only one sensor should be set in a single message and all others should be zero. - 1: gyro calibration, 3: gyro temperature calibration - 1: magnetometer calibration - 1: ground pressure calibration - 1: radio RC calibration, 2: RC trim calibration - 1: accelerometer calibration, 2: board level calibration, 3: accelerometer temperature calibration, 4: simple accelerometer calibration - 1: APM: compass/motor interference calibration (PX4: airspeed calibration, deprecated), 2: airspeed calibration - 1: ESC calibration, 3: barometer temperature calibration - - - Set sensor offsets. This command will be only accepted if in pre-flight mode. - Sensor to adjust the offsets for: 0: gyros, 1: accelerometer, 2: magnetometer, 3: barometer, 4: optical flow, 5: second magnetometer, 6: third magnetometer - X axis offset (or generic dimension 1), in the sensor's raw units - Y axis offset (or generic dimension 2), in the sensor's raw units - Z axis offset (or generic dimension 3), in the sensor's raw units - Generic dimension 4, in the sensor's raw units - Generic dimension 5, in the sensor's raw units - Generic dimension 6, in the sensor's raw units - - - Trigger UAVCAN configuration (actuator ID assignment and direction mapping). Note that this maps to the legacy UAVCAN v0 function UAVCAN_ENUMERATE, which is intended to be executed just once during initial vehicle configuration (it is not a normal pre-flight command and has been poorly named). - 1: Trigger actuator ID assignment and direction mapping. 0: Cancel command. - Reserved - Reserved - Reserved - Reserved - Reserved - Reserved - - - Request storage of different parameter values and logs. This command will be only accepted if in pre-flight mode. - Parameter storage: 0: READ FROM FLASH/EEPROM, 1: WRITE CURRENT TO FLASH/EEPROM, 2: Reset to defaults - Mission storage: 0: READ FROM FLASH/EEPROM, 1: WRITE CURRENT TO FLASH/EEPROM, 2: Reset to defaults - Onboard logging: 0: Ignore, 1: Start default rate logging, -1: Stop logging, > 1: logging rate (e.g. set to 1000 for 1000 Hz logging) - Reserved - Empty - Empty - Empty - - - Request the reboot or shutdown of system components. - 0: Do nothing for autopilot, 1: Reboot autopilot, 2: Shutdown autopilot, 3: Reboot autopilot and keep it in the bootloader until upgraded. - 0: Do nothing for onboard computer, 1: Reboot onboard computer, 2: Shutdown onboard computer, 3: Reboot onboard computer and keep it in the bootloader until upgraded. - WIP: 0: Do nothing for camera, 1: Reboot onboard camera, 2: Shutdown onboard camera, 3: Reboot onboard camera and keep it in the bootloader until upgraded - WIP: 0: Do nothing for mount (e.g. gimbal), 1: Reboot mount, 2: Shutdown mount, 3: Reboot mount and keep it in the bootloader until upgraded - Reserved (set to 0) - Reserved (set to 0) - WIP: ID (e.g. camera ID -1 for all IDs) - - - - - Request a target system to start an upgrade of one (or all) of its components. For example, the command might be sent to a companion computer to cause it to upgrade a connected flight controller. The system doing the upgrade will report progress using the normal command protocol sequence for a long running operation. Command protocol information: https://mavlink.io/en/services/command.html. - Component id of the component to be upgraded. If set to 0, all components should be upgraded. - 0: Do not reboot component after the action is executed, 1: Reboot component after the action is executed. - Reserved - Reserved - Reserved - Reserved - WIP: upgrade progress report rate (can be used for more granular control). - - - Override current mission with command to pause mission, pause mission and move to position, continue/resume mission. When param 1 indicates that the mission is paused (MAV_GOTO_DO_HOLD), param 2 defines whether it holds in place or moves to another position. - MAV_GOTO_DO_HOLD: pause mission and either hold or move to specified position (depending on param2), MAV_GOTO_DO_CONTINUE: resume mission. - MAV_GOTO_HOLD_AT_CURRENT_POSITION: hold at current position, MAV_GOTO_HOLD_AT_SPECIFIED_POSITION: hold at specified position. - Coordinate frame of hold point. - Desired yaw angle. - Latitude/X position. - Longitude/Y position. - Altitude/Z position. - - - - - Mission command to set a Camera Auto Mount Pivoting Oblique Survey (Replaces CAM_TRIGG_DIST for this purpose). The camera is triggered each time this distance is exceeded, then the mount moves to the next position. Params 4~6 set-up the angle limits and number of positions for oblique survey, where mount-enabled vehicles automatically roll the camera between shots to emulate an oblique camera setup (providing an increased HFOV). This command can also be used to set the shutter integration time for the camera. - Camera trigger distance. 0 to stop triggering. - Camera shutter integration time. 0 to ignore - The minimum interval in which the camera is capable of taking subsequent pictures repeatedly. 0 to ignore. - Total number of roll positions at which the camera will capture photos (images captures spread evenly across the limits defined by param5). - Angle limits that the camera can be rolled to left and right of center. - Fixed pitch angle that the camera will hold in oblique mode if the mount is actuated in the pitch axis. - Empty - - - start running a mission - first_item: the first mission item to run - last_item: the last mission item to run (after this item is run, the mission ends) - - - Arms / Disarms a component - 0: disarm, 1: arm - 0: arm-disarm unless prevented by safety checks (i.e. when landed), 21196: force arming/disarming (e.g. allow arming to override preflight checks and disarming in flight) - - - - - Turns illuminators ON/OFF. An illuminator is a light source that is used for lighting up dark areas external to the sytstem: e.g. a torch or searchlight (as opposed to a light source for illuminating the system itself, e.g. an indicator light). - 0: Illuminators OFF, 1: Illuminators ON - - - Request the home position from the vehicle. - Reserved - Reserved - Reserved - Reserved - Reserved - Reserved - Reserved - - - - - Inject artificial failure for testing purposes. Note that autopilots should implement an additional protection before accepting this command such as a specific param setting. - The unit which is affected by the failure. - The type how the failure manifests itself. - Instance affected by failure (0 to signal all). - - - Starts receiver pairing. - 0:Spektrum. - RC type. - - - Request the interval between messages for a particular MAVLink message ID. The receiver should ACK the command and then emit its response in a MESSAGE_INTERVAL message. - The MAVLink message ID - - - Set the interval between messages for a particular MAVLink message ID. This interface replaces REQUEST_DATA_STREAM. - The MAVLink message ID - The interval between two messages. Set to -1 to disable and 0 to request default rate. - Target address of message stream (if message has target address fields). 0: Flight-stack default (recommended), 1: address of requestor, 2: broadcast. - - - Request the target system(s) emit a single instance of a specified message (i.e. a "one-shot" version of MAV_CMD_SET_MESSAGE_INTERVAL). - The MAVLink message ID of the requested message. - Use for index ID, if required. Otherwise, the use of this parameter (if any) must be defined in the requested message. By default assumed not used (0). - The use of this parameter (if any), must be defined in the requested message. By default assumed not used (0). - The use of this parameter (if any), must be defined in the requested message. By default assumed not used (0). - The use of this parameter (if any), must be defined in the requested message. By default assumed not used (0). - The use of this parameter (if any), must be defined in the requested message. By default assumed not used (0). - Target address for requested message (if message has target address fields). 0: Flight-stack default, 1: address of requestor, 2: broadcast. - - - - Request MAVLink protocol version compatibility. All receivers should ACK the command and then emit their capabilities in an PROTOCOL_VERSION message - 1: Request supported protocol versions by all nodes on the network - Reserved (all remaining params) - - - - Request autopilot capabilities. The receiver should ACK the command and then emit its capabilities in an AUTOPILOT_VERSION message - 1: Request autopilot version - Reserved (all remaining params) - - - - Request camera information (CAMERA_INFORMATION). - 0: No action 1: Request camera capabilities - Reserved (all remaining params) - - - - Request camera settings (CAMERA_SETTINGS). - 0: No Action 1: Request camera settings - Reserved (all remaining params) - - - - Request storage information (STORAGE_INFORMATION). Use the command's target_component to target a specific component's storage. - Storage ID (0 for all, 1 for first, 2 for second, etc.) - 0: No Action 1: Request storage information - Reserved (all remaining params) - - - Format a storage medium. Once format is complete, a STORAGE_INFORMATION message is sent. Use the command's target_component to target a specific component's storage. - Storage ID (1 for first, 2 for second, etc.) - Format storage (and reset image log). 0: No action 1: Format storage - Reset Image Log (without formatting storage medium). This will reset CAMERA_CAPTURE_STATUS.image_count and CAMERA_IMAGE_CAPTURED.image_index. 0: No action 1: Reset Image Log - Reserved (all remaining params) - - - - Request camera capture status (CAMERA_CAPTURE_STATUS) - 0: No Action 1: Request camera capture status - Reserved (all remaining params) - - - - Request flight information (FLIGHT_INFORMATION) - 1: Request flight information - Reserved (all remaining params) - - - Reset all camera settings to Factory Default - 0: No Action 1: Reset all settings - Reserved (all remaining params) - - - Set camera running mode. Use NaN for reserved values. GCS will send a MAV_CMD_REQUEST_VIDEO_STREAM_STATUS command after a mode change if the camera supports video streaming. - Reserved (Set to 0) - Camera mode - - - - - - - - Set camera zoom. Camera must respond with a CAMERA_SETTINGS message (on success). - Zoom type - Zoom value. The range of valid values depend on the zoom type. - - - - - - - - Set camera focus. Camera must respond with a CAMERA_SETTINGS message (on success). - Focus type - Focus value - - - - - - Tagged jump target. Can be jumped to with MAV_CMD_DO_JUMP_TAG. - Tag. - - - Jump to the matching tag in the mission list. Repeat this action for the specified number of times. A mission should contain a single matching tag for each jump. If this is not the case then a jump to a missing tag should complete the mission, and a jump where there are multiple matching tags should always select the one with the lowest mission sequence number. - Target tag to jump to. - Repeat count. - - - - - Request to start or end a parameter transaction. Multiple kinds of transport layers can be used to exchange parameters in the transaction (param, param_ext and mavftp). The command response can either be a success/failure or an in progress in case the receiving side takes some time to apply the parameters. - Action to be performed (start, commit, cancel, etc.) - Possible transport layers to set and get parameters via mavlink during a parameter transaction. - Identifier for a specific transaction. - - - - - High level setpoint to be sent to a gimbal manager to set a gimbal attitude. It is possible to set combinations of the values below. E.g. an angle as well as a desired angular rate can be used to get to this angle at a certain angular rate, or an angular rate only will result in continuous turning. NaN is to be used to signal unset. Note: a gimbal is never to react to this command but only the gimbal manager. - Pitch angle (positive to pitch up, relative to vehicle for FOLLOW mode, relative to world horizon for LOCK mode). - Yaw angle (positive to yaw to the right, relative to vehicle for FOLLOW mode, absolute to North for LOCK mode). - Pitch rate (positive to pitch up). - Yaw rate (positive to yaw to the right). - Gimbal manager flags to use. - Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals). - - - - - Gimbal configuration to set which sysid/compid is in primary and secondary control. - Sysid for primary control (0: no one in control, -1: leave unchanged, -2: set itself in control (for missions where the own sysid is still unknown), -3: remove control if currently in control). - Compid for primary control (0: no one in control, -1: leave unchanged, -2: set itself in control (for missions where the own sysid is still unknown), -3: remove control if currently in control). - Sysid for secondary control (0: no one in control, -1: leave unchanged, -2: set itself in control (for missions where the own sysid is still unknown), -3: remove control if currently in control). - Compid for secondary control (0: no one in control, -1: leave unchanged, -2: set itself in control (for missions where the own sysid is still unknown), -3: remove control if currently in control). - Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals). - - - Start image capture sequence. Sends CAMERA_IMAGE_CAPTURED after each capture. Use NaN for reserved values. - Reserved (Set to 0) - Desired elapsed time between two consecutive pictures (in seconds). Minimum values depend on hardware (typically greater than 2 seconds). - Total number of images to capture. 0 to capture forever/until MAV_CMD_IMAGE_STOP_CAPTURE. - Capture sequence number starting from 1. This is only valid for single-capture (param3 == 1), otherwise set to 0. Increment the capture ID for each capture command to prevent double captures when a command is re-transmitted. - - - - - - Stop image capture sequence Use NaN for reserved values. - Reserved (Set to 0) - - - - - - - - Re-request a CAMERA_IMAGE_CAPTURED message. - Sequence number for missing CAMERA_IMAGE_CAPTURED message - - - - - - - Enable or disable on-board camera triggering system. - Trigger enable/disable (0 for disable, 1 for start), -1 to ignore - 1 to reset the trigger sequence, -1 or 0 to ignore - 1 to pause triggering, but without switching the camera off or retracting it. -1 to ignore - - - - - If the camera supports point visual tracking (CAMERA_CAP_FLAGS_HAS_TRACKING_POINT is set), this command allows to initiate the tracking. - Point to track x value (normalized 0..1, 0 is left, 1 is right). - Point to track y value (normalized 0..1, 0 is top, 1 is bottom). - Point radius (normalized 0..1, 0 is image left, 1 is image right). - - - - - If the camera supports rectangle visual tracking (CAMERA_CAP_FLAGS_HAS_TRACKING_RECTANGLE is set), this command allows to initiate the tracking. - Top left corner of rectangle x value (normalized 0..1, 0 is left, 1 is right). - Top left corner of rectangle y value (normalized 0..1, 0 is top, 1 is bottom). - Bottom right corner of rectangle x value (normalized 0..1, 0 is left, 1 is right). - Bottom right corner of rectangle y value (normalized 0..1, 0 is top, 1 is bottom). - - - - - Stops ongoing tracking. - - - Starts video capture (recording). - Video Stream ID (0 for all streams) - Frequency CAMERA_CAPTURE_STATUS messages should be sent while recording (0 for no messages, otherwise frequency) - - - - - - - - Stop the current video capture (recording). - Video Stream ID (0 for all streams) - - - - - - - - - Start video streaming - Video Stream ID (0 for all streams, 1 for first, 2 for second, etc.) - - - Stop the given video stream - Video Stream ID (0 for all streams, 1 for first, 2 for second, etc.) - - - - Request video stream information (VIDEO_STREAM_INFORMATION) - Video Stream ID (0 for all streams, 1 for first, 2 for second, etc.) - - - - Request video stream status (VIDEO_STREAM_STATUS) - Video Stream ID (0 for all streams, 1 for first, 2 for second, etc.) - - - Request to start streaming logging data over MAVLink (see also LOGGING_DATA message) - Format: 0: ULog - Reserved (set to 0) - Reserved (set to 0) - Reserved (set to 0) - Reserved (set to 0) - Reserved (set to 0) - Reserved (set to 0) - - - Request to stop streaming log data over MAVLink - Reserved (set to 0) - Reserved (set to 0) - Reserved (set to 0) - Reserved (set to 0) - Reserved (set to 0) - Reserved (set to 0) - Reserved (set to 0) - - - - Landing gear ID (default: 0, -1 for all) - Landing gear position (Down: 0, Up: 1, NaN for no change) - - - - - - - - Request to start/stop transmitting over the high latency telemetry - Control transmission over high latency telemetry (0: stop, 1: start) - Empty - Empty - Empty - Empty - Empty - Empty - - - Create a panorama at the current position - Viewing angle horizontal of the panorama (+- 0.5 the total angle) - Viewing angle vertical of panorama. - Speed of the horizontal rotation. - Speed of the vertical rotation. - - - Request VTOL transition - The target VTOL state. Only MAV_VTOL_STATE_MC and MAV_VTOL_STATE_FW can be used. - - - Request authorization to arm the vehicle to a external entity, the arm authorizer is responsible to request all data that is needs from the vehicle before authorize or deny the request. If approved the progress of command_ack message should be set with period of time that this authorization is valid in seconds or in case it was denied it should be set with one of the reasons in ARM_AUTH_DENIED_REASON. - - Vehicle system id, this way ground station can request arm authorization on behalf of any vehicle - - - This command sets the submode to standard guided when vehicle is in guided mode. The vehicle holds position and altitude and the user can input the desired velocities along all three axes. - - - - This command sets submode circle when vehicle is in guided mode. Vehicle flies along a circle facing the center of the circle. The user can input the velocity along the circle and change the radius. If no input is given the vehicle will hold position. - - Radius of desired circle in CIRCLE_MODE - User defined - User defined - User defined - Target latitude of center of circle in CIRCLE_MODE - Target longitude of center of circle in CIRCLE_MODE - - - - - Delay mission state machine until gate has been reached. - Geometry: 0: orthogonal to path between previous and next waypoint. - Altitude: 0: ignore altitude - Empty - Empty - Latitude - Longitude - Altitude - - - Fence return point. There can only be one fence return point. - - Reserved - Reserved - Reserved - Reserved - Latitude - Longitude - Altitude - - - Fence vertex for an inclusion polygon (the polygon must not be self-intersecting). The vehicle must stay within this area. Minimum of 3 vertices required. - - Polygon vertex count - Vehicle must be inside ALL inclusion zones in a single group, vehicle must be inside at least one group, must be the same for all points in each polygon - Reserved - Reserved - Latitude - Longitude - Reserved - - - Fence vertex for an exclusion polygon (the polygon must not be self-intersecting). The vehicle must stay outside this area. Minimum of 3 vertices required. - - Polygon vertex count - Reserved - Reserved - Reserved - Latitude - Longitude - Reserved - - - Circular fence area. The vehicle must stay inside this area. - - Radius. - Vehicle must be inside ALL inclusion zones in a single group, vehicle must be inside at least one group - Reserved - Reserved - Latitude - Longitude - Reserved - - - Circular fence area. The vehicle must stay outside this area. - - Radius. - Reserved - Reserved - Reserved - Latitude - Longitude - Reserved - - - Rally point. You can have multiple rally points defined. - - Reserved - Reserved - Reserved - Reserved - Latitude - Longitude - Altitude - - - - - Commands the vehicle to respond with a sequence of messages UAVCAN_NODE_INFO, one message per every UAVCAN node that is online. Note that some of the response messages can be lost, which the receiver can detect easily by checking whether every received UAVCAN_NODE_STATUS has a matching message UAVCAN_NODE_INFO received earlier; if not, this command should be sent again in order to request re-transmission of the node information messages. - Reserved (set to 0) - Reserved (set to 0) - Reserved (set to 0) - Reserved (set to 0) - Reserved (set to 0) - Reserved (set to 0) - Reserved (set to 0) - - - - - - Deploy payload on a Lat / Lon / Alt position. This includes the navigation to reach the required release position and velocity. - Operation mode. 0: prepare single payload deploy (overwriting previous requests), but do not execute it. 1: execute payload deploy immediately (rejecting further deploy commands during execution, but allowing abort). 2: add payload deploy to existing deployment list. - Desired approach vector in compass heading. A negative value indicates the system can define the approach vector at will. - Desired ground speed at release time. This can be overridden by the airframe in case it needs to meet minimum airspeed. A negative value indicates the system can define the ground speed at will. - Minimum altitude clearance to the release position. A negative value indicates the system can define the clearance at will. - Latitude. Note, if used in MISSION_ITEM (deprecated) the units are degrees (unscaled) - Longitude. Note, if used in MISSION_ITEM (deprecated) the units are degrees (unscaled) - Altitude (MSL) - - - Control the payload deployment. - Operation mode. 0: Abort deployment, continue normal mission. 1: switch to payload deployment mode. 100: delete first payload deployment request. 101: delete all payload deployment requests. - Reserved - Reserved - Reserved - Reserved - Reserved - Reserved - - - - Magnetometer calibration based on provided known yaw. This allows for fast calibration using WMM field tables in the vehicle, given only the known yaw of the vehicle. If Latitude and longitude are both zero then use the current vehicle location. - Yaw of vehicle in earth frame. - CompassMask, 0 for all. - Latitude. - Longitude. - Empty. - Empty. - Empty. - - - Command to operate winch. - Winch instance number. - Action to perform. - Length of cable to release (negative to wind). - Release rate (negative to wind). - Empty. - Empty. - Empty. - - - - - User defined waypoint item. Ground Station will show the Vehicle as flying through this item. - User defined - User defined - User defined - User defined - Latitude unscaled - Longitude unscaled - Altitude (MSL) - - - User defined waypoint item. Ground Station will show the Vehicle as flying through this item. - User defined - User defined - User defined - User defined - Latitude unscaled - Longitude unscaled - Altitude (MSL) - - - User defined waypoint item. Ground Station will show the Vehicle as flying through this item. - User defined - User defined - User defined - User defined - Latitude unscaled - Longitude unscaled - Altitude (MSL) - - - User defined waypoint item. Ground Station will show the Vehicle as flying through this item. - User defined - User defined - User defined - User defined - Latitude unscaled - Longitude unscaled - Altitude (MSL) - - - User defined waypoint item. Ground Station will show the Vehicle as flying through this item. - User defined - User defined - User defined - User defined - Latitude unscaled - Longitude unscaled - Altitude (MSL) - - - User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. - User defined - User defined - User defined - User defined - Latitude unscaled - Longitude unscaled - Altitude (MSL) - - - User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. - User defined - User defined - User defined - User defined - Latitude unscaled - Longitude unscaled - Altitude (MSL) - - - User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. - User defined - User defined - User defined - User defined - Latitude unscaled - Longitude unscaled - Altitude (MSL) - - - User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. - User defined - User defined - User defined - User defined - Latitude unscaled - Longitude unscaled - Altitude (MSL) - - - User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. - User defined - User defined - User defined - User defined - Latitude unscaled - Longitude unscaled - Altitude (MSL) - - - User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. - User defined - User defined - User defined - User defined - User defined - User defined - User defined - - - User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. - User defined - User defined - User defined - User defined - User defined - User defined - User defined - - - User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. - User defined - User defined - User defined - User defined - User defined - User defined - User defined - - - User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. - User defined - User defined - User defined - User defined - User defined - User defined - User defined - - - User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. - User defined - User defined - User defined - User defined - User defined - User defined - User defined - - - - - - A data stream is not a fixed set of messages, but rather a - recommendation to the autopilot software. Individual autopilots may or may not obey - the recommended messages. - - Enable all data streams - - - Enable IMU_RAW, GPS_RAW, GPS_STATUS packets. - - - Enable GPS_STATUS, CONTROL_STATUS, AUX_STATUS - - - Enable RC_CHANNELS_SCALED, RC_CHANNELS_RAW, SERVO_OUTPUT_RAW - - - Enable ATTITUDE_CONTROLLER_OUTPUT, POSITION_CONTROLLER_OUTPUT, NAV_CONTROLLER_OUTPUT. - - - Enable LOCAL_POSITION, GLOBAL_POSITION/GLOBAL_POSITION_INT messages. - - - Dependent on the autopilot - - - Dependent on the autopilot - - - Dependent on the autopilot - - - - - The ROI (region of interest) for the vehicle. This can be - be used by the vehicle for camera/vehicle attitude alignment (see - MAV_CMD_NAV_ROI). - - No region of interest. - - - Point toward next waypoint, with optional pitch/roll/yaw offset. - - - Point toward given waypoint. - - - Point toward fixed location. - - - Point toward of given id. - - - - ACK / NACK / ERROR values as a result of MAV_CMDs and for mission item transmission. - - Command / mission item is ok. - - - Generic error message if none of the other reasons fails or if no detailed error reporting is implemented. - - - The system is refusing to accept this command from this source / communication partner. - - - Command or mission item is not supported, other commands would be accepted. - - - The coordinate frame of this command / mission item is not supported. - - - The coordinate frame of this command is ok, but he coordinate values exceed the safety limits of this system. This is a generic error, please use the more specific error messages below if possible. - - - The X or latitude value is out of range. - - - The Y or longitude value is out of range. - - - The Z or altitude value is out of range. - - - - Specifies the datatype of a MAVLink parameter. - - 8-bit unsigned integer - - - 8-bit signed integer - - - 16-bit unsigned integer - - - 16-bit signed integer - - - 32-bit unsigned integer - - - 32-bit signed integer - - - 64-bit unsigned integer - - - 64-bit signed integer - - - 32-bit floating-point - - - 64-bit floating-point - - - - Specifies the datatype of a MAVLink extended parameter. - - 8-bit unsigned integer - - - 8-bit signed integer - - - 16-bit unsigned integer - - - 16-bit signed integer - - - 32-bit unsigned integer - - - 32-bit signed integer - - - 64-bit unsigned integer - - - 64-bit signed integer - - - 32-bit floating-point - - - 64-bit floating-point - - - Custom Type - - - - Result from a MAVLink command (MAV_CMD) - - Command is valid (is supported and has valid parameters), and was executed. - - - Command is valid, but cannot be executed at this time. This is used to indicate a problem that should be fixed just by waiting (e.g. a state machine is busy, can't arm because have not got GPS lock, etc.). Retrying later should work. - - - Command is invalid (is supported but has invalid parameters). Retrying same command and parameters will not work. - - - Command is not supported (unknown). - - - Command is valid, but execution has failed. This is used to indicate any non-temporary or unexpected problem, i.e. any problem that must be fixed before the command can succeed/be retried. For example, attempting to write a file when out of memory, attempting to arm when sensors are not calibrated, etc. - - - Command is valid and is being executed. This will be followed by further progress updates, i.e. the component may send further COMMAND_ACK messages with result MAV_RESULT_IN_PROGRESS (at a rate decided by the implementation), and must terminate by sending a COMMAND_ACK message with final result of the operation. The COMMAND_ACK.progress field can be used to indicate the progress of the operation. - - - Command has been cancelled (as a result of receiving a COMMAND_CANCEL message). - - - - Result of mission operation (in a MISSION_ACK message). - - mission accepted OK - - - Generic error / not accepting mission commands at all right now. - - - Coordinate frame is not supported. - - - Command is not supported. - - - Mission items exceed storage space. - - - One of the parameters has an invalid value. - - - param1 has an invalid value. - - - param2 has an invalid value. - - - param3 has an invalid value. - - - param4 has an invalid value. - - - x / param5 has an invalid value. - - - y / param6 has an invalid value. - - - z / param7 has an invalid value. - - - Mission item received out of sequence - - - Not accepting any mission commands from this communication partner. - - - Current mission operation cancelled (e.g. mission upload, mission download). - - - - Indicates the severity level, generally used for status messages to indicate their relative urgency. Based on RFC-5424 using expanded definitions at: http://www.kiwisyslog.com/kb/info:-syslog-message-levels/. - - System is unusable. This is a "panic" condition. - - - Action should be taken immediately. Indicates error in non-critical systems. - - - Action must be taken immediately. Indicates failure in a primary system. - - - Indicates an error in secondary/redundant systems. - - - Indicates about a possible future error if this is not resolved within a given timeframe. Example would be a low battery warning. - - - An unusual event has occurred, though not an error condition. This should be investigated for the root cause. - - - Normal operational messages. Useful for logging. No action is required for these messages. - - - Useful non-operational messages that can assist in debugging. These should not occur during normal operation. - - - - Power supply status flags (bitmask) - - main brick power supply valid - - - main servo power supply valid for FMU - - - USB power is connected - - - peripheral supply is in over-current state - - - hi-power peripheral supply is in over-current state - - - Power status has changed since boot - - - - SERIAL_CONTROL device types - - First telemetry port - - - Second telemetry port - - - First GPS port - - - Second GPS port - - - system shell - - - SERIAL0 - - - SERIAL1 - - - SERIAL2 - - - SERIAL3 - - - SERIAL4 - - - SERIAL5 - - - SERIAL6 - - - SERIAL7 - - - SERIAL8 - - - SERIAL9 - - - - SERIAL_CONTROL flags (bitmask) - - Set if this is a reply - - - Set if the sender wants the receiver to send a response as another SERIAL_CONTROL message - - - Set if access to the serial port should be removed from whatever driver is currently using it, giving exclusive access to the SERIAL_CONTROL protocol. The port can be handed back by sending a request without this flag set - - - Block on writes to the serial port - - - Send multiple replies until port is drained - - - - Enumeration of distance sensor types - - Laser rangefinder, e.g. LightWare SF02/F or PulsedLight units - - - Ultrasound rangefinder, e.g. MaxBotix units - - - Infrared rangefinder, e.g. Sharp units - - - Radar type, e.g. uLanding units - - - Broken or unknown type, e.g. analog units - - - - Enumeration of sensor orientation, according to its rotations - - Roll: 0, Pitch: 0, Yaw: 0 - - - Roll: 0, Pitch: 0, Yaw: 45 - - - Roll: 0, Pitch: 0, Yaw: 90 - - - Roll: 0, Pitch: 0, Yaw: 135 - - - Roll: 0, Pitch: 0, Yaw: 180 - - - Roll: 0, Pitch: 0, Yaw: 225 - - - Roll: 0, Pitch: 0, Yaw: 270 - - - Roll: 0, Pitch: 0, Yaw: 315 - - - Roll: 180, Pitch: 0, Yaw: 0 - - - Roll: 180, Pitch: 0, Yaw: 45 - - - Roll: 180, Pitch: 0, Yaw: 90 - - - Roll: 180, Pitch: 0, Yaw: 135 - - - Roll: 0, Pitch: 180, Yaw: 0 - - - Roll: 180, Pitch: 0, Yaw: 225 - - - Roll: 180, Pitch: 0, Yaw: 270 - - - Roll: 180, Pitch: 0, Yaw: 315 - - - Roll: 90, Pitch: 0, Yaw: 0 - - - Roll: 90, Pitch: 0, Yaw: 45 - - - Roll: 90, Pitch: 0, Yaw: 90 - - - Roll: 90, Pitch: 0, Yaw: 135 - - - Roll: 270, Pitch: 0, Yaw: 0 - - - Roll: 270, Pitch: 0, Yaw: 45 - - - Roll: 270, Pitch: 0, Yaw: 90 - - - Roll: 270, Pitch: 0, Yaw: 135 - - - Roll: 0, Pitch: 90, Yaw: 0 - - - Roll: 0, Pitch: 270, Yaw: 0 - - - Roll: 0, Pitch: 180, Yaw: 90 - - - Roll: 0, Pitch: 180, Yaw: 270 - - - Roll: 90, Pitch: 90, Yaw: 0 - - - Roll: 180, Pitch: 90, Yaw: 0 - - - Roll: 270, Pitch: 90, Yaw: 0 - - - Roll: 90, Pitch: 180, Yaw: 0 - - - Roll: 270, Pitch: 180, Yaw: 0 - - - Roll: 90, Pitch: 270, Yaw: 0 - - - Roll: 180, Pitch: 270, Yaw: 0 - - - Roll: 270, Pitch: 270, Yaw: 0 - - - Roll: 90, Pitch: 180, Yaw: 90 - - - Roll: 90, Pitch: 0, Yaw: 270 - - - Roll: 90, Pitch: 68, Yaw: 293 - - - Pitch: 315 - - - Roll: 90, Pitch: 315 - - - Custom orientation - - - - Bitmask of (optional) autopilot capabilities (64 bit). If a bit is set, the autopilot supports this capability. - - Autopilot supports MISSION float message type. - - - Autopilot supports the new param float message type. - - - This flag must always be set if missions are supported, because missions must always use MISSION_ITEM_INT (rather than MISSION_ITEM, which is deprecated). - Autopilot supports MISSION_ITEM_INT scaled integer message type. - - - Autopilot supports COMMAND_INT scaled integer message type. - - - Autopilot supports the new param union message type. - - - Autopilot supports the new FILE_TRANSFER_PROTOCOL message type. - - - Autopilot supports commanding attitude offboard. - - - Autopilot supports commanding position and velocity targets in local NED frame. - - - Autopilot supports commanding position and velocity targets in global scaled integers. - - - Autopilot supports terrain protocol / data handling. - - - Autopilot supports direct actuator control. - - - Autopilot supports the flight termination command. - - - Autopilot supports onboard compass calibration. - - - Autopilot supports MAVLink version 2. - - - Autopilot supports mission fence protocol. - - - Autopilot supports mission rally point protocol. - - - Autopilot supports the flight information protocol. - - - - Type of mission items being requested/sent in mission protocol. - - Items are mission commands for main mission. - - - Specifies GeoFence area(s). Items are MAV_CMD_NAV_FENCE_ GeoFence items. - - - Specifies the rally points for the vehicle. Rally points are alternative RTL points. Items are MAV_CMD_NAV_RALLY_POINT rally point items. - - - Only used in MISSION_CLEAR_ALL to clear all mission types. - - - - Enumeration of estimator types - - Unknown type of the estimator. - - - This is a naive estimator without any real covariance feedback. - - - Computer vision based estimate. Might be up to scale. - - - Visual-inertial estimate. - - - Plain GPS estimate. - - - Estimator integrating GPS and inertial sensing. - - - Estimate from external motion capturing system. - - - Estimator based on lidar sensor input. - - - Estimator on autopilot. - - - - Enumeration of battery types - - Not specified. - - - Lithium polymer battery - - - Lithium-iron-phosphate battery - - - Lithium-ION battery - - - Nickel metal hydride battery - - - - Enumeration of battery functions - - Battery function is unknown - - - Battery supports all flight systems - - - Battery for the propulsion system - - - Avionics battery - - - Payload battery - - - - Enumeration for battery charge states. - - Low battery state is not provided - - - Battery is not in low state. Normal operation. - - - Battery state is low, warn and monitor close. - - - Battery state is critical, return or abort immediately. - - - Battery state is too low for ordinary abort sequence. Perform fastest possible emergency stop to prevent damage. - - - Battery failed, damage unavoidable. Possible causes (faults) are listed in MAV_BATTERY_FAULT. - - - Battery is diagnosed to be defective or an error occurred, usage is discouraged / prohibited. Possible causes (faults) are listed in MAV_BATTERY_FAULT. - - - Battery is charging. - - - - Battery mode. Note, the normal operation mode (i.e. when flying) should be reported as MAV_BATTERY_MODE_UNKNOWN to allow message trimming in normal flight. - - Battery mode not supported/unknown battery mode/normal operation. - - - Battery is auto discharging (towards storage level). - - - Battery in hot-swap mode (current limited to prevent spikes that might damage sensitive electrical circuits). - - - - Smart battery supply status/fault flags (bitmask) for health indication. The battery must also report either MAV_BATTERY_CHARGE_STATE_FAILED or MAV_BATTERY_CHARGE_STATE_UNHEALTHY if any of these are set. - - Battery has deep discharged. - - - Voltage spikes. - - - One or more cells have failed. Battery should also report MAV_BATTERY_CHARGE_STATE_FAILE (and should not be used). - - - Over-current fault. - - - Over-temperature fault. - - - Under-temperature fault. - - - Vehicle voltage is not compatible with this battery (batteries on same power rail should have similar voltage). - - - - Flags to report status/failure cases for a power generator (used in GENERATOR_STATUS). Note that FAULTS are conditions that cause the generator to fail. Warnings are conditions that require attention before the next use (they indicate the system is not operating properly). - - Generator is off. - - - Generator is ready to start generating power. - - - Generator is generating power. - - - Generator is charging the batteries (generating enough power to charge and provide the load). - - - Generator is operating at a reduced maximum power. - - - Generator is providing the maximum output. - - - Generator is near the maximum operating temperature, cooling is insufficient. - - - Generator hit the maximum operating temperature and shutdown. - - - Power electronics are near the maximum operating temperature, cooling is insufficient. - - - Power electronics hit the maximum operating temperature and shutdown. - - - Power electronics experienced a fault and shutdown. - - - The power source supplying the generator failed e.g. mechanical generator stopped, tether is no longer providing power, solar cell is in shade, hydrogen reaction no longer happening. - - - Generator controller having communication problems. - - - Power electronic or generator cooling system error. - - - Generator controller power rail experienced a fault. - - - Generator controller exceeded the overcurrent threshold and shutdown to prevent damage. - - - Generator controller detected a high current going into the batteries and shutdown to prevent battery damage. - - - Generator controller exceeded it's overvoltage threshold and shutdown to prevent it exceeding the voltage rating. - - - Batteries are under voltage (generator will not start). - - - Generator start is inhibited by e.g. a safety switch. - - - Generator requires maintenance. - - - Generator is not ready to generate yet. - - - Generator is idle. - - - - Enumeration of VTOL states - - MAV is not configured as VTOL - - - VTOL is in transition from multicopter to fixed-wing - - - VTOL is in transition from fixed-wing to multicopter - - - VTOL is in multicopter state - - - VTOL is in fixed-wing state - - - - Enumeration of landed detector states - - MAV landed state is unknown - - - MAV is landed (on ground) - - - MAV is in air - - - MAV currently taking off - - - MAV currently landing - - - - Enumeration of the ADSB altimeter types - - Altitude reported from a Baro source using QNH reference - - - Altitude reported from a GNSS source - - - - ADSB classification for the type of vehicle emitting the transponder signal - - - - - - - - - - - - - - - - - - - - - - - These flags indicate status such as data validity of each data source. Set = data valid - - - - - - - - - - - - - Bitmap of options for the MAV_CMD_DO_REPOSITION - - The aircraft should immediately transition into guided. This should not be set for follow me applications - - - - - Flags in ESTIMATOR_STATUS message - - True if the attitude estimate is good - - - True if the horizontal velocity estimate is good - - - True if the vertical velocity estimate is good - - - True if the horizontal position (relative) estimate is good - - - True if the horizontal position (absolute) estimate is good - - - True if the vertical position (absolute) estimate is good - - - True if the vertical position (above ground) estimate is good - - - True if the EKF is in a constant position mode and is not using external measurements (eg GPS or optical flow) - - - True if the EKF has sufficient data to enter a mode that will provide a (relative) position estimate - - - True if the EKF has sufficient data to enter a mode that will provide a (absolute) position estimate - - - True if the EKF has detected a GPS glitch - - - True if the EKF has detected bad accelerometer data - - - - - - default autopilot motor test method - - - motor numbers are specified as their index in a predefined vehicle-specific sequence - - - motor numbers are specified as the output as labeled on the board - - - - - - throttle as a percentage from 0 ~ 100 - - - throttle as an absolute PWM value (normally in range of 1000~2000) - - - throttle pass-through from pilot's transmitter - - - per-motor compass calibration test - - - - - - ignore altitude field - - - ignore hdop field - - - ignore vdop field - - - ignore horizontal velocity field (vn and ve) - - - ignore vertical velocity field (vd) - - - ignore speed accuracy field - - - ignore horizontal accuracy field - - - ignore vertical accuracy field - - - - Possible actions an aircraft can take to avoid a collision. - - Ignore any potential collisions - - - Report potential collision - - - Ascend or Descend to avoid threat - - - Move horizontally to avoid threat - - - Aircraft to move perpendicular to the collision's velocity vector - - - Aircraft to fly directly back to its launch point - - - Aircraft to stop in place - - - - Aircraft-rated danger from this threat. - - Not a threat - - - Craft is mildly concerned about this threat - - - Craft is panicking, and may take actions to avoid threat - - - - Source of information about this collision. - - ID field references ADSB_VEHICLE packets - - - ID field references MAVLink SRC ID - - - - Type of GPS fix - - No GPS connected - - - No position information, GPS is connected - - - 2D position - - - 3D position - - - DGPS/SBAS aided 3D position - - - RTK float, 3D position - - - RTK Fixed, 3D position - - - Static fixed, typically used for base stations - - - PPP, 3D position. - - - - RTK GPS baseline coordinate system, used for RTK corrections - - Earth-centered, Earth-fixed - - - RTK basestation centered, north, east, down - - - - Type of landing target - - Landing target signaled by light beacon (ex: IR-LOCK) - - - Landing target signaled by radio beacon (ex: ILS, NDB) - - - Landing target represented by a fiducial marker (ex: ARTag) - - - Landing target represented by a pre-defined visual shape/feature (ex: X-marker, H-marker, square) - - - - Direction of VTOL transition - - Respect the heading configuration of the vehicle. - - - Use the heading pointing towards the next waypoint. - - - Use the heading on takeoff (while sitting on the ground). - - - Use the specified heading in parameter 4. - - - Use the current heading when reaching takeoff altitude (potentially facing the wind when weather-vaning is active). - - - - Camera capability flags (Bitmap) - - Camera is able to record video - - - Camera is able to capture images - - - Camera has separate Video and Image/Photo modes (MAV_CMD_SET_CAMERA_MODE) - - - Camera can capture images while in video mode - - - Camera can capture videos while in Photo/Image mode - - - Camera has image survey mode (MAV_CMD_SET_CAMERA_MODE) - - - Camera has basic zoom control (MAV_CMD_SET_CAMERA_ZOOM) - - - Camera has basic focus control (MAV_CMD_SET_CAMERA_FOCUS) - - - Camera has video streaming capabilities (request VIDEO_STREAM_INFORMATION with MAV_CMD_REQUEST_MESSAGE for video streaming info) - - - Camera supports tracking of a point on the camera view. - - - Camera supports tracking of a selection rectangle on the camera view. - - - Camera supports tracking geo status (CAMERA_TRACKING_GEO_STATUS). - - - - Stream status flags (Bitmap) - - Stream is active (running) - - - Stream is thermal imaging - - - - Video stream types - - Stream is RTSP - - - Stream is RTP UDP (URI gives the port number) - - - Stream is MPEG on TCP - - - Stream is h.264 on MPEG TS (URI gives the port number) - - - - Camera tracking status flags - - Camera is not tracking - - - Camera is tracking - - - Camera tracking in error state - - - - Camera tracking modes - - Not tracking - - - Target is a point - - - Target is a rectangle - - - - Camera tracking target data (shows where tracked target is within image) - - No target data - - - Target data embedded in image data (proprietary) - - - Target data rendered in image - - - Target data within status message (Point or Rectangle) - - - - Zoom types for MAV_CMD_SET_CAMERA_ZOOM - - Zoom one step increment (-1 for wide, 1 for tele) - - - Continuous zoom up/down until stopped (-1 for wide, 1 for tele, 0 to stop zooming) - - - Zoom value as proportion of full camera range (a value between 0.0 and 100.0) - - - Zoom value/variable focal length in milimetres. Note that there is no message to get the valid zoom range of the camera, so this can type can only be used for cameras where the zoom range is known (implying that this cannot reliably be used in a GCS for an arbitrary camera) - - - - Focus types for MAV_CMD_SET_CAMERA_FOCUS - - Focus one step increment (-1 for focusing in, 1 for focusing out towards infinity). - - - Continuous focus up/down until stopped (-1 for focusing in, 1 for focusing out towards infinity, 0 to stop focusing) - - - Focus value as proportion of full camera focus range (a value between 0.0 and 100.0) - - - Focus value in metres. Note that there is no message to get the valid focus range of the camera, so this can type can only be used for cameras where the range is known (implying that this cannot reliably be used in a GCS for an arbitrary camera). - - - - Result from PARAM_EXT_SET message (or a PARAM_SET within a transaction). - - Parameter value ACCEPTED and SET - - - Parameter value UNKNOWN/UNSUPPORTED - - - Parameter failed to set - - - Parameter value received but not yet set/accepted. A subsequent PARAM_ACK_TRANSACTION or PARAM_EXT_ACK with the final result will follow once operation is completed. This is returned immediately for parameters that take longer to set, indicating taht the the parameter was recieved and does not need to be resent. - - - - Camera Modes. - - Camera is in image/photo capture mode. - - - Camera is in video capture mode. - - - Camera is in image survey capture mode. It allows for camera controller to do specific settings for surveys. - - - - - Not a specific reason - - - Authorizer will send the error as string to GCS - - - At least one waypoint have a invalid value - - - Timeout in the authorizer process(in case it depends on network) - - - Airspace of the mission in use by another vehicle, second result parameter can have the waypoint id that caused it to be denied. - - - Weather is not good to fly - - - - RC type - - Spektrum DSM2 - - - Spektrum DSMX - - - - Bitmap to indicate which dimensions should be ignored by the vehicle: a value of 0b0000000000000000 or 0b0000001000000000 indicates that none of the setpoint dimensions should be ignored. If bit 9 is set the floats afx afy afz should be interpreted as force instead of acceleration. - - Ignore position x - - - Ignore position y - - - Ignore position z - - - Ignore velocity x - - - Ignore velocity y - - - Ignore velocity z - - - Ignore acceleration x - - - Ignore acceleration y - - - Ignore acceleration z - - - Use force instead of acceleration - - - Ignore yaw - - - Ignore yaw rate - - - - Bitmap to indicate which dimensions should be ignored by the vehicle: a value of 0b00000000 indicates that none of the setpoint dimensions should be ignored. - - Ignore body roll rate - - - Ignore body pitch rate - - - Ignore body yaw rate - - - Ignore throttle - - - Ignore attitude - - - - Airborne status of UAS. - - The flight state can't be determined. - - - UAS on ground. - - - UAS airborne. - - - UAS is in an emergency flight state. - - - UAS has no active controls. - - - - Flags for the global position report. - - The field time contains valid data. - - - The field uas_id contains valid data. - - - The fields lat, lon and h_acc contain valid data. - - - The fields alt and v_acc contain valid data. - - - The field relative_alt contains valid data. - - - The fields vx and vy contain valid data. - - - The field vz contains valid data. - - - The fields next_lat, next_lon and next_alt contain valid data. - - - - Cellular network radio type - - - - - - - - These flags encode the cellular network status - - State unknown or not reportable. - - - Modem is unusable - - - Modem is being initialized - - - Modem is locked - - - Modem is not enabled and is powered down - - - Modem is currently transitioning to the CELLULAR_STATUS_FLAG_DISABLED state - - - Modem is currently transitioning to the CELLULAR_STATUS_FLAG_ENABLED state - - - Modem is enabled and powered on but not registered with a network provider and not available for data connections - - - Modem is searching for a network provider to register - - - Modem is registered with a network provider, and data connections and messaging may be available for use - - - Modem is disconnecting and deactivating the last active packet data bearer. This state will not be entered if more than one packet data bearer is active and one of the active bearers is deactivated - - - Modem is activating and connecting the first packet data bearer. Subsequent bearer activations when another bearer is already active do not cause this state to be entered - - - One or more packet data bearers is active and connected - - - - These flags are used to diagnose the failure state of CELLULAR_STATUS - - No error - - - Error state is unknown - - - SIM is required for the modem but missing - - - SIM is available, but not usuable for connection - - - - Precision land modes (used in MAV_CMD_NAV_LAND). - - Normal (non-precision) landing. - - - Use precision landing if beacon detected when land command accepted, otherwise land normally. - - - Use precision landing, searching for beacon if not found when land command accepted (land normally if beacon cannot be found). - - - - - Parachute actions. Trigger release and enable/disable auto-release. - - Disable auto-release of parachute (i.e. release triggered by crash detectors). - - - Enable auto-release of parachute. - - - Release parachute and kill motors. - - - - - Encoding of payload unknown. - - - Registered for STorM32 gimbal controller. - - - Registered for STorM32 gimbal controller. - - - Registered for STorM32 gimbal controller. - - - Registered for STorM32 gimbal controller. - - - Registered for STorM32 gimbal controller. - - - Registered for STorM32 gimbal controller. - - - Registered for STorM32 gimbal controller. - - - Registered for STorM32 gimbal controller. - - - Registered for STorM32 gimbal controller. - - - Registered for STorM32 gimbal controller. - - - - - No type defined. - - - Manufacturer Serial Number (ANSI/CTA-2063 format). - - - CAA (Civil Aviation Authority) registered ID. Format: [ICAO Country Code].[CAA Assigned ID]. - - - UTM (Unmanned Traffic Management) assigned UUID (RFC4122). - - - - - No UA (Unmanned Aircraft) type defined. - - - Aeroplane/Airplane. Fixed wing. - - - Helicopter or multirotor. - - - Gyroplane. - - - VTOL (Vertical Take-Off and Landing). Fixed wing aircraft that can take off vertically. - - - Ornithopter. - - - Glider. - - - Kite. - - - Free Balloon. - - - Captive Balloon. - - - Airship. E.g. a blimp. - - - Free Fall/Parachute (unpowered). - - - Rocket. - - - Tethered powered aircraft. - - - Ground Obstacle. - - - Other type of aircraft not listed earlier. - - - - - The status of the (UA) Unmanned Aircraft is undefined. - - - The UA is on the ground. - - - The UA is in the air. - - - The UA is having an emergency. - - - - - The height field is relative to the take-off location. - - - The height field is relative to ground. - - - - - The horizontal accuracy is unknown. - - - The horizontal accuracy is smaller than 10 Nautical Miles. 18.52 km. - - - The horizontal accuracy is smaller than 4 Nautical Miles. 7.408 km. - - - The horizontal accuracy is smaller than 2 Nautical Miles. 3.704 km. - - - The horizontal accuracy is smaller than 1 Nautical Miles. 1.852 km. - - - The horizontal accuracy is smaller than 0.5 Nautical Miles. 926 m. - - - The horizontal accuracy is smaller than 0.3 Nautical Miles. 555.6 m. - - - The horizontal accuracy is smaller than 0.1 Nautical Miles. 185.2 m. - - - The horizontal accuracy is smaller than 0.05 Nautical Miles. 92.6 m. - - - The horizontal accuracy is smaller than 30 meter. - - - The horizontal accuracy is smaller than 10 meter. - - - The horizontal accuracy is smaller than 3 meter. - - - The horizontal accuracy is smaller than 1 meter. - - - - - The vertical accuracy is unknown. - - - The vertical accuracy is smaller than 150 meter. - - - The vertical accuracy is smaller than 45 meter. - - - The vertical accuracy is smaller than 25 meter. - - - The vertical accuracy is smaller than 10 meter. - - - The vertical accuracy is smaller than 3 meter. - - - The vertical accuracy is smaller than 1 meter. - - - - - The speed accuracy is unknown. - - - The speed accuracy is smaller than 10 meters per second. - - - The speed accuracy is smaller than 3 meters per second. - - - The speed accuracy is smaller than 1 meters per second. - - - The speed accuracy is smaller than 0.3 meters per second. - - - - - The timestamp accuracy is unknown. - - - The timestamp accuracy is smaller than or equal to 0.1 second. - - - The timestamp accuracy is smaller than or equal to 0.2 second. - - - The timestamp accuracy is smaller than or equal to 0.3 second. - - - The timestamp accuracy is smaller than or equal to 0.4 second. - - - The timestamp accuracy is smaller than or equal to 0.5 second. - - - The timestamp accuracy is smaller than or equal to 0.6 second. - - - The timestamp accuracy is smaller than or equal to 0.7 second. - - - The timestamp accuracy is smaller than or equal to 0.8 second. - - - The timestamp accuracy is smaller than or equal to 0.9 second. - - - The timestamp accuracy is smaller than or equal to 1.0 second. - - - The timestamp accuracy is smaller than or equal to 1.1 second. - - - The timestamp accuracy is smaller than or equal to 1.2 second. - - - The timestamp accuracy is smaller than or equal to 1.3 second. - - - The timestamp accuracy is smaller than or equal to 1.4 second. - - - The timestamp accuracy is smaller than or equal to 1.5 second. - - - - - No authentication type is specified. - - - Signature for the UAS (Unmanned Aircraft System) ID. - - - Signature for the Operator ID. - - - Signature for the entire message set. - - - Authentication is provided by Network Remote ID. - - - - - Free-form text description of the purpose of the flight. - - - - - The location of the operator is the same as the take-off location. - - - The location of the operator is based on live GNSS data. - - - The location of the operator is a fixed location. - - - - - The classification type for the UA is undeclared. - - - The classification type for the UA follows EU (European Union) specifications. - - - - - The category for the UA, according to the EU specification, is undeclared. - - - The category for the UA, according to the EU specification, is the Open category. - - - The category for the UA, according to the EU specification, is the Specific category. - - - The category for the UA, according to the EU specification, is the Certified category. - - - - - The class for the UA, according to the EU specification, is undeclared. - - - The class for the UA, according to the EU specification, is Class 0. - - - The class for the UA, according to the EU specification, is Class 1. - - - The class for the UA, according to the EU specification, is Class 2. - - - The class for the UA, according to the EU specification, is Class 3. - - - The class for the UA, according to the EU specification, is Class 4. - - - The class for the UA, according to the EU specification, is Class 5. - - - The class for the UA, according to the EU specification, is Class 6. - - - - - CAA (Civil Aviation Authority) registered operator ID. - - - - Tune formats (used for vehicle buzzer/tone generation). - - Format is QBasic 1.1 Play: https://www.qbasic.net/en/reference/qb11/Statement/PLAY-006.htm. - - - Format is Modern Music Markup Language (MML): https://en.wikipedia.org/wiki/Music_Macro_Language#Modern_MML. - - - - Component capability flags (Bitmap) - - Component has parameters, and supports the parameter protocol (PARAM messages). - - - Component has parameters, and supports the extended parameter protocol (PARAM_EXT messages). - - - - - Type of AIS vessel, enum duplicated from AIS standard, https://gpsd.gitlab.io/gpsd/AIVDM.html - - Not available (default). - - - - - - - - - - - - - - - - - - - - - - Wing In Ground effect. - - - - - - - - - - - - - - Towing: length exceeds 200m or breadth exceeds 25m. - - - Dredging or other underwater ops. - - - - - - - - - High Speed Craft. - - - - - - - - - - - - - Search And Rescue vessel. - - - - - Anti-pollution equipment. - - - - - - - Noncombatant ship according to RR Resolution No. 18. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Navigational status of AIS vessel, enum duplicated from AIS standard, https://gpsd.gitlab.io/gpsd/AIVDM.html - - Under way using engine. - - - - - - - - - - - - - - - - Search And Rescue Transponder. - - - Not available (default). - - - - - These flags are used in the AIS_VESSEL.fields bitmask to indicate validity of data in the other message fields. When set, the data is valid. - - 1 = Position accuracy less than 10m, 0 = position accuracy greater than 10m. - - - - - 1 = Velocity over 52.5765m/s (102.2 knots) - - - - Only the sign of the returned turn rate value is valid, either greater than 5deg/30s or less than -5deg/30s - - - - Distance to bow is larger than 511m - - - Distance to stern is larger than 511m - - - Distance to port side is larger than 63m - - - Distance to starboard side is larger than 63m - - - - - - - List of possible units where failures can be injected. - - - - - - - - - - - - - - - - - - - List of possible failure type to inject. - - No failure injected, used to reset a previous failure. - - - Sets unit off, so completely non-responsive. - - - Unit is stuck e.g. keeps reporting the same value. - - - Unit is reporting complete garbage. - - - Unit is consistently wrong. - - - Unit is slow, so e.g. reporting at slower than expected rate. - - - Data of unit is delayed in time. - - - Unit is sometimes working, sometimes not. - - - - Winch status flags used in WINCH_STATUS - - Winch is healthy - - - Winch thread is fully retracted - - - Winch motor is moving - - - Winch clutch is engaged allowing motor to move freely - - - - - - - - - - - - - - - - The general system state. If the system is following the MAVLink standard, the system state is mainly defined by three orthogonal states/modes: The system mode, which is either LOCKED (motors shut down and locked), MANUAL (system under RC control), GUIDED (system with autonomous position control, position setpoint controlled manually) or AUTO (system guided by path/waypoint planner). The NAV_MODE defined the current flight state: LIFTOFF (often an open-loop maneuver), LANDING, WAYPOINTS or VECTOR. This represents the internal navigation state machine. The system status shows whether the system is currently active or not and if an emergency occurred. During the CRITICAL and EMERGENCY states the MAV is still considered to be active, but should start emergency procedures autonomously. After a failure occurred it should first move from active to critical to allow manual intervention and then move to emergency after a certain timeout. - Bitmap showing which onboard controllers and sensors are present. Value of 0: not present. Value of 1: present. - Bitmap showing which onboard controllers and sensors are enabled: Value of 0: not enabled. Value of 1: enabled. - Bitmap showing which onboard controllers and sensors have an error (or are operational). Value of 0: error. Value of 1: healthy. - Maximum usage in percent of the mainloop time. Values: [0-1000] - should always be below 1000 - Battery voltage, UINT16_MAX: Voltage not sent by autopilot - Battery current, -1: Current not sent by autopilot - Battery energy remaining, -1: Battery remaining energy not sent by autopilot - Communication drop rate, (UART, I2C, SPI, CAN), dropped packets on all links (packets that were corrupted on reception on the MAV) - Communication errors (UART, I2C, SPI, CAN), dropped packets on all links (packets that were corrupted on reception on the MAV) - Autopilot-specific errors - Autopilot-specific errors - Autopilot-specific errors - Autopilot-specific errors - - - The system time is the time of the master clock, typically the computer clock of the main onboard computer. - Timestamp (UNIX epoch time). - Timestamp (time since system boot). - - - to be removed / merged with SYSTEM_TIME - A ping message either requesting or responding to a ping. This allows to measure the system latencies, including serial port, radio modem and UDP connections. The ping microservice is documented at https://mavlink.io/en/services/ping.html - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - PING sequence - 0: request ping from all receiving systems. If greater than 0: message is a ping response and number is the system id of the requesting system - 0: request ping from all receiving components. If greater than 0: message is a ping response and number is the component id of the requesting component. - - - Request to control this MAV - System the GCS requests control for - 0: request control of this MAV, 1: Release control of this MAV - 0: key as plaintext, 1-255: future, different hashing/encryption variants. The GCS should in general use the safest mode possible initially and then gradually move down the encryption level if it gets a NACK message indicating an encryption mismatch. - Password / Key, depending on version plaintext or encrypted. 25 or less characters, NULL terminated. The characters may involve A-Z, a-z, 0-9, and "!?,.-" - - - Accept / deny control of this MAV - ID of the GCS this message - 0: request control of this MAV, 1: Release control of this MAV - 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control - - - Emit an encrypted signature / key identifying this system. PLEASE NOTE: This protocol has been kept simple, so transmitting the key requires an encrypted channel for true safety. - key - - - - - Status generated in each node in the communication chain and injected into MAVLink stream. - Timestamp (time since system boot). - Remaining free transmit buffer space - Remaining free receive buffer space - Transmit rate - Receive rate - Number of bytes that could not be parsed correctly. - Transmit buffer overflows. This number wraps around as it reaches UINT16_MAX - Receive buffer overflows. This number wraps around as it reaches UINT16_MAX - Messages sent - Messages received (estimated from counting seq) - Messages lost (estimated from counting seq) - - - Use COMMAND_LONG with MAV_CMD_DO_SET_MODE instead - Set the system mode, as defined by enum MAV_MODE. There is no target component id as the mode is by definition for the overall aircraft, not only for one component. - The system setting the mode - The new base mode. - The new autopilot-specific mode. This field can be ignored by an autopilot. - - - - - - Response from a PARAM_SET message when it is used in a transaction. - Id of system that sent PARAM_SET message. - Id of system that sent PARAM_SET message. - Parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string - Parameter value (new value if PARAM_ACCEPTED, current value otherwise) - Parameter type. - Result code. - - - Request to read the onboard parameter with the param_id string id. Onboard parameters are stored as key[const char*] -> value[float]. This allows to send a parameter to any other component (such as the GCS) without the need of previous knowledge of possible parameter names. Thus the same GCS can store different parameters for different autopilots. See also https://mavlink.io/en/services/parameter.html for a full documentation of QGroundControl and IMU code. - System ID - Component ID - Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string - Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored) - - - Request all parameters of this component. After this request, all parameters are emitted. The parameter microservice is documented at https://mavlink.io/en/services/parameter.html - System ID - Component ID - - - Emit the value of a onboard parameter. The inclusion of param_count and param_index in the message allows the recipient to keep track of received parameters and allows him to re-request missing parameters after a loss or timeout. The parameter microservice is documented at https://mavlink.io/en/services/parameter.html - Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string - Onboard parameter value - Onboard parameter type. - Total number of onboard parameters - Index of this onboard parameter - - - Set a parameter value (write new value to permanent storage). - The receiving component should acknowledge the new parameter value by broadcasting a PARAM_VALUE message (broadcasting ensures that multiple GCS all have an up-to-date list of all parameters). If the sending GCS did not receive a PARAM_VALUE within its timeout time, it should re-send the PARAM_SET message. The parameter microservice is documented at https://mavlink.io/en/services/parameter.html. - PARAM_SET may also be called within the context of a transaction (started with MAV_CMD_PARAM_TRANSACTION). Within a transaction the receiving component should respond with PARAM_ACK_TRANSACTION to the setter component (instead of broadcasting PARAM_VALUE), and PARAM_SET should be re-sent if this is ACK not received. - System ID - Component ID - Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string - Onboard parameter value - Onboard parameter type. - - - The global position, as returned by the Global Positioning System (GPS). This is - NOT the global position estimate of the system, but rather a RAW sensor value. See message GLOBAL_POSITION for the global position estimate. - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - GPS fix type. - Latitude (WGS84, EGM96 ellipsoid) - Longitude (WGS84, EGM96 ellipsoid) - Altitude (MSL). Positive for up. Note that virtually all GPS modules provide the MSL altitude in addition to the WGS84 altitude. - GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX - GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX - GPS ground speed. If unknown, set to: UINT16_MAX - Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX - Number of satellites visible. If unknown, set to 255 - - Altitude (above WGS84, EGM96 ellipsoid). Positive for up. - Position uncertainty. - Altitude uncertainty. - Speed uncertainty. - Heading / track uncertainty - Yaw in earth frame from north. Use 0 if this GPS does not provide yaw. Use 65535 if this GPS is configured to provide yaw and is currently unable to provide it. Use 36000 for north. - - - The positioning status, as reported by GPS. This message is intended to display status information about each satellite visible to the receiver. See message GLOBAL_POSITION for the global position estimate. This message can contain information for up to 20 satellites. - Number of satellites visible - Global satellite ID - 0: Satellite not used, 1: used for localization - Elevation (0: right on top of receiver, 90: on the horizon) of satellite - Direction of satellite, 0: 0 deg, 255: 360 deg. - Signal to noise ratio of satellite - - - The RAW IMU readings for the usual 9DOF sensor setup. This message should contain the scaled values to the described units - Timestamp (time since system boot). - X acceleration - Y acceleration - Z acceleration - Angular speed around X axis - Angular speed around Y axis - Angular speed around Z axis - X Magnetic field - Y Magnetic field - Z Magnetic field - - Temperature, 0: IMU does not provide temperature values. If the IMU is at 0C it must send 1 (0.01C). - - - The RAW IMU readings for a 9DOF sensor, which is identified by the id (default IMU1). This message should always contain the true raw values without any scaling to allow data capture and system debugging. - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - X acceleration (raw) - Y acceleration (raw) - Z acceleration (raw) - Angular speed around X axis (raw) - Angular speed around Y axis (raw) - Angular speed around Z axis (raw) - X Magnetic field (raw) - Y Magnetic field (raw) - Z Magnetic field (raw) - - Id. Ids are numbered from 0 and map to IMUs numbered from 1 (e.g. IMU1 will have a message with id=0) - Temperature, 0: IMU does not provide temperature values. If the IMU is at 0C it must send 1 (0.01C). - - - The RAW pressure readings for the typical setup of one absolute pressure and one differential pressure sensor. The sensor values should be the raw, UNSCALED ADC values. - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - Absolute pressure (raw) - Differential pressure 1 (raw, 0 if nonexistent) - Differential pressure 2 (raw, 0 if nonexistent) - Raw Temperature measurement (raw) - - - The pressure readings for the typical setup of one absolute and differential pressure sensor. The units are as specified in each field. - Timestamp (time since system boot). - Absolute pressure - Differential pressure 1 - Absolute pressure temperature - - Differential pressure temperature (0, if not available). Report values of 0 (or 1) as 1 cdegC. - - - The attitude in the aeronautical frame (right-handed, Z-down, X-front, Y-right). - Timestamp (time since system boot). - Roll angle (-pi..+pi) - Pitch angle (-pi..+pi) - Yaw angle (-pi..+pi) - Roll angular speed - Pitch angular speed - Yaw angular speed - - - The attitude in the aeronautical frame (right-handed, Z-down, X-front, Y-right), expressed as quaternion. Quaternion order is w, x, y, z and a zero rotation would be expressed as (1 0 0 0). - Timestamp (time since system boot). - Quaternion component 1, w (1 in null-rotation) - Quaternion component 2, x (0 in null-rotation) - Quaternion component 3, y (0 in null-rotation) - Quaternion component 4, z (0 in null-rotation) - Roll angular speed - Pitch angular speed - Yaw angular speed - - Rotation offset by which the attitude quaternion and angular speed vector should be rotated for user display (quaternion with [w, x, y, z] order, zero-rotation is [1, 0, 0, 0], send [0, 0, 0, 0] if field not supported). This field is intended for systems in which the reference attitude may change during flight. For example, tailsitters VTOLs rotate their reference attitude by 90 degrees between hover mode and fixed wing mode, thus repr_offset_q is equal to [1, 0, 0, 0] in hover mode and equal to [0.7071, 0, 0.7071, 0] in fixed wing mode. - - - The filtered local position (e.g. fused computer vision and accelerometers). Coordinate frame is right-handed, Z-axis down (aeronautical frame, NED / north-east-down convention) - Timestamp (time since system boot). - X Position - Y Position - Z Position - X Speed - Y Speed - Z Speed - - - The filtered global position (e.g. fused GPS and accelerometers). The position is in GPS-frame (right-handed, Z-up). It - is designed as scaled integer message since the resolution of float is not sufficient. - Timestamp (time since system boot). - Latitude, expressed - Longitude, expressed - Altitude (MSL). Note that virtually all GPS modules provide both WGS84 and MSL. - Altitude above ground - Ground X Speed (Latitude, positive north) - Ground Y Speed (Longitude, positive east) - Ground Z Speed (Altitude, positive down) - Vehicle heading (yaw angle), 0.0..359.99 degrees. If unknown, set to: UINT16_MAX - - - The scaled values of the RC channels received: (-100%) -10000, (0%) 0, (100%) 10000. Channels that are inactive should be set to UINT16_MAX. - Timestamp (time since system boot). - Servo output port (set of 8 outputs = 1 port). Flight stacks running on Pixhawk should use: 0 = MAIN, 1 = AUX. - RC channel 1 value scaled. - RC channel 2 value scaled. - RC channel 3 value scaled. - RC channel 4 value scaled. - RC channel 5 value scaled. - RC channel 6 value scaled. - RC channel 7 value scaled. - RC channel 8 value scaled. - Receive signal strength indicator in device-dependent units/scale. Values: [0-254], 255: invalid/unknown. - - - The RAW values of the RC channels received. The standard PPM modulation is as follows: 1000 microseconds: 0%, 2000 microseconds: 100%. A value of UINT16_MAX implies the channel is unused. Individual receivers/transmitters might violate this specification. - Timestamp (time since system boot). - Servo output port (set of 8 outputs = 1 port). Flight stacks running on Pixhawk should use: 0 = MAIN, 1 = AUX. - RC channel 1 value. - RC channel 2 value. - RC channel 3 value. - RC channel 4 value. - RC channel 5 value. - RC channel 6 value. - RC channel 7 value. - RC channel 8 value. - Receive signal strength indicator in device-dependent units/scale. Values: [0-254], 255: invalid/unknown. - - - Superseded by ACTUATOR_OUTPUT_STATUS. The RAW values of the servo outputs (for RC input from the remote, use the RC_CHANNELS messages). The standard PPM modulation is as follows: 1000 microseconds: 0%, 2000 microseconds: 100%. - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - Servo output port (set of 8 outputs = 1 port). Flight stacks running on Pixhawk should use: 0 = MAIN, 1 = AUX. - Servo output 1 value - Servo output 2 value - Servo output 3 value - Servo output 4 value - Servo output 5 value - Servo output 6 value - Servo output 7 value - Servo output 8 value - - Servo output 9 value - Servo output 10 value - Servo output 11 value - Servo output 12 value - Servo output 13 value - Servo output 14 value - Servo output 15 value - Servo output 16 value - - - Request a partial list of mission items from the system/component. https://mavlink.io/en/services/mission.html. If start and end index are the same, just send one waypoint. - System ID - Component ID - Start index - End index, -1 by default (-1: send list to end). Else a valid index of the list - - Mission type. - - - This message is sent to the MAV to write a partial list. If start index == end index, only one item will be transmitted / updated. If the start index is NOT 0 and above the current list size, this request should be REJECTED! - System ID - Component ID - Start index. Must be smaller / equal to the largest index of the current onboard list. - End index, equal or greater than start index. - - Mission type. - - - - Message encoding a mission item. This message is emitted to announce - the presence of a mission item and to set a mission item on the system. The mission item can be either in x, y, z meters (type: LOCAL) or x:lat, y:lon, z:altitude. Local frame is Z-down, right handed (NED), global frame is Z-up, right handed (ENU). NaN may be used to indicate an optional/default value (e.g. to use the system's current latitude or yaw rather than a specific value). See also https://mavlink.io/en/services/mission.html. - System ID - Component ID - Sequence - The coordinate system of the waypoint. - The scheduled action for the waypoint. - false:0, true:1 - Autocontinue to next waypoint - PARAM1, see MAV_CMD enum - PARAM2, see MAV_CMD enum - PARAM3, see MAV_CMD enum - PARAM4, see MAV_CMD enum - PARAM5 / local: X coordinate, global: latitude - PARAM6 / local: Y coordinate, global: longitude - PARAM7 / local: Z coordinate, global: altitude (relative or absolute, depending on frame). - - Mission type. - - - A system that gets this request should respond with MISSION_ITEM_INT (as though MISSION_REQUEST_INT was received). - Request the information of the mission item with the sequence number seq. The response of the system to this message should be a MISSION_ITEM message. https://mavlink.io/en/services/mission.html - System ID - Component ID - Sequence - - Mission type. - - - Set the mission item with sequence number seq as current item. This means that the MAV will continue to this mission item on the shortest path (not following the mission items in-between). - System ID - Component ID - Sequence - - - Message that announces the sequence number of the current active mission item. The MAV will fly towards this mission item. - Sequence - - - Request the overall list of mission items from the system/component. - System ID - Component ID - - Mission type. - - - This message is emitted as response to MISSION_REQUEST_LIST by the MAV and to initiate a write transaction. The GCS can then request the individual mission item based on the knowledge of the total number of waypoints. - System ID - Component ID - Number of mission items in the sequence - - Mission type. - - - Delete all mission items at once. - System ID - Component ID - - Mission type. - - - A certain mission item has been reached. The system will either hold this position (or circle on the orbit) or (if the autocontinue on the WP was set) continue to the next waypoint. - Sequence - - - Acknowledgment message during waypoint handling. The type field states if this message is a positive ack (type=0) or if an error happened (type=non-zero). - System ID - Component ID - Mission result. - - Mission type. - - - Sets the GPS co-ordinates of the vehicle local origin (0,0,0) position. Vehicle should emit GPS_GLOBAL_ORIGIN irrespective of whether the origin is changed. This enables transform between the local coordinate frame and the global (GPS) coordinate frame, which may be necessary when (for example) indoor and outdoor settings are connected and the MAV should move from in- to outdoor. - System ID - Latitude (WGS84) - Longitude (WGS84) - Altitude (MSL). Positive for up. - - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - - - Publishes the GPS co-ordinates of the vehicle local origin (0,0,0) position. Emitted whenever a new GPS-Local position mapping is requested or set - e.g. following SET_GPS_GLOBAL_ORIGIN message. - Latitude (WGS84) - Longitude (WGS84) - Altitude (MSL). Positive for up. - - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - - - Bind a RC channel to a parameter. The parameter should change according to the RC channel value. - System ID - Component ID - Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string - Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored), send -2 to disable any existing map for this rc_channel_index. - Index of parameter RC channel. Not equal to the RC channel id. Typically corresponds to a potentiometer-knob on the RC. - Initial parameter value - Scale, maps the RC range [-1, 1] to a parameter value - Minimum param value. The protocol does not define if this overwrites an onboard minimum value. (Depends on implementation) - Maximum param value. The protocol does not define if this overwrites an onboard maximum value. (Depends on implementation) - - - Request the information of the mission item with the sequence number seq. The response of the system to this message should be a MISSION_ITEM_INT message. https://mavlink.io/en/services/mission.html - System ID - Component ID - Sequence - - Mission type. - - - - - A broadcast message to notify any ground station or SDK if a mission, geofence or safe points have changed on the vehicle. - Start index for partial mission change (-1 for all items). - End index of a partial mission change. -1 is a synonym for the last mission item (i.e. selects all items from start_index). Ignore field if start_index=-1. - System ID of the author of the new mission. - Compnent ID of the author of the new mission. - Mission type. - - - Set a safety zone (volume), which is defined by two corners of a cube. This message can be used to tell the MAV which setpoints/waypoints to accept and which to reject. Safety areas are often enforced by national or competition regulations. - System ID - Component ID - Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down. - x position 1 / Latitude 1 - y position 1 / Longitude 1 - z position 1 / Altitude 1 - x position 2 / Latitude 2 - y position 2 / Longitude 2 - z position 2 / Altitude 2 - - - Read out the safety zone the MAV currently assumes. - Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down. - x position 1 / Latitude 1 - y position 1 / Longitude 1 - z position 1 / Altitude 1 - x position 2 / Latitude 2 - y position 2 / Longitude 2 - z position 2 / Altitude 2 - - - The attitude in the aeronautical frame (right-handed, Z-down, X-front, Y-right), expressed as quaternion. Quaternion order is w, x, y, z and a zero rotation would be expressed as (1 0 0 0). - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation) - Roll angular speed - Pitch angular speed - Yaw angular speed - Row-major representation of a 3x3 attitude covariance matrix (states: roll, pitch, yaw; first three entries are the first ROW, next three entries are the second row, etc.). If unknown, assign NaN value to first element in the array. - - - The state of the fixed wing navigation and position controller. - Current desired roll - Current desired pitch - Current desired heading - Bearing to current waypoint/target - Distance to active waypoint - Current altitude error - Current airspeed error - Current crosstrack error on x-y plane - - - The filtered global position (e.g. fused GPS and accelerometers). The position is in GPS-frame (right-handed, Z-up). It is designed as scaled integer message since the resolution of float is not sufficient. NOTE: This message is intended for onboard networks / companion computers and higher-bandwidth links and optimized for accuracy and completeness. Please use the GLOBAL_POSITION_INT message for a minimal subset. - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - Class id of the estimator this estimate originated from. - Latitude - Longitude - Altitude in meters above MSL - Altitude above ground - Ground X Speed (Latitude) - Ground Y Speed (Longitude) - Ground Z Speed (Altitude) - Row-major representation of a 6x6 position and velocity 6x6 cross-covariance matrix (states: lat, lon, alt, vx, vy, vz; first six entries are the first ROW, next six entries are the second row, etc.). If unknown, assign NaN value to first element in the array. - - - The filtered local position (e.g. fused computer vision and accelerometers). Coordinate frame is right-handed, Z-axis down (aeronautical frame, NED / north-east-down convention) - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - Class id of the estimator this estimate originated from. - X Position - Y Position - Z Position - X Speed - Y Speed - Z Speed - X Acceleration - Y Acceleration - Z Acceleration - Row-major representation of position, velocity and acceleration 9x9 cross-covariance matrix upper right triangle (states: x, y, z, vx, vy, vz, ax, ay, az; first nine entries are the first ROW, next eight entries are the second row, etc.). If unknown, assign NaN value to first element in the array. - - - The PPM values of the RC channels received. The standard PPM modulation is as follows: 1000 microseconds: 0%, 2000 microseconds: 100%. A value of UINT16_MAX implies the channel is unused. Individual receivers/transmitters might violate this specification. - Timestamp (time since system boot). - Total number of RC channels being received. This can be larger than 18, indicating that more channels are available but not given in this message. This value should be 0 when no RC channels are available. - RC channel 1 value. - RC channel 2 value. - RC channel 3 value. - RC channel 4 value. - RC channel 5 value. - RC channel 6 value. - RC channel 7 value. - RC channel 8 value. - RC channel 9 value. - RC channel 10 value. - RC channel 11 value. - RC channel 12 value. - RC channel 13 value. - RC channel 14 value. - RC channel 15 value. - RC channel 16 value. - RC channel 17 value. - RC channel 18 value. - Receive signal strength indicator in device-dependent units/scale. Values: [0-254], 255: invalid/unknown. - - - - Request a data stream. - The target requested to send the message stream. - The target requested to send the message stream. - The ID of the requested data stream - The requested message rate - 1 to start sending, 0 to stop sending. - - - - Data stream status information. - The ID of the requested data stream - The message rate - 1 stream is enabled, 0 stream is stopped. - - - This message provides an API for manually controlling the vehicle using standard joystick axes nomenclature, along with a joystick-like input device. Unused axes can be disabled an buttons are also transmit as boolean values of their - The system to be controlled. - X-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to forward(1000)-backward(-1000) movement on a joystick and the pitch of a vehicle. - Y-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to left(-1000)-right(1000) movement on a joystick and the roll of a vehicle. - Z-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to a separate slider movement with maximum being 1000 and minimum being -1000 on a joystick and the thrust of a vehicle. Positive values are positive thrust, negative values are negative thrust. - R-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to a twisting of the joystick, with counter-clockwise being 1000 and clockwise being -1000, and the yaw of a vehicle. - A bitfield corresponding to the joystick buttons' current state, 1 for pressed, 0 for released. The lowest bit corresponds to Button 1. - - - The RAW values of the RC channels sent to the MAV to override info received from the RC radio. The standard PPM modulation is as follows: 1000 microseconds: 0%, 2000 microseconds: 100%. Individual receivers/transmitters might violate this specification. Note carefully the semantic differences between the first 8 channels and the subsequent channels - System ID - Component ID - RC channel 1 value. A value of UINT16_MAX means to ignore this field. A value of 0 means to release this channel back to the RC radio. - RC channel 2 value. A value of UINT16_MAX means to ignore this field. A value of 0 means to release this channel back to the RC radio. - RC channel 3 value. A value of UINT16_MAX means to ignore this field. A value of 0 means to release this channel back to the RC radio. - RC channel 4 value. A value of UINT16_MAX means to ignore this field. A value of 0 means to release this channel back to the RC radio. - RC channel 5 value. A value of UINT16_MAX means to ignore this field. A value of 0 means to release this channel back to the RC radio. - RC channel 6 value. A value of UINT16_MAX means to ignore this field. A value of 0 means to release this channel back to the RC radio. - RC channel 7 value. A value of UINT16_MAX means to ignore this field. A value of 0 means to release this channel back to the RC radio. - RC channel 8 value. A value of UINT16_MAX means to ignore this field. A value of 0 means to release this channel back to the RC radio. - - RC channel 9 value. A value of 0 or UINT16_MAX means to ignore this field. A value of UINT16_MAX-1 means to release this channel back to the RC radio. - RC channel 10 value. A value of 0 or UINT16_MAX means to ignore this field. A value of UINT16_MAX-1 means to release this channel back to the RC radio. - RC channel 11 value. A value of 0 or UINT16_MAX means to ignore this field. A value of UINT16_MAX-1 means to release this channel back to the RC radio. - RC channel 12 value. A value of 0 or UINT16_MAX means to ignore this field. A value of UINT16_MAX-1 means to release this channel back to the RC radio. - RC channel 13 value. A value of 0 or UINT16_MAX means to ignore this field. A value of UINT16_MAX-1 means to release this channel back to the RC radio. - RC channel 14 value. A value of 0 or UINT16_MAX means to ignore this field. A value of UINT16_MAX-1 means to release this channel back to the RC radio. - RC channel 15 value. A value of 0 or UINT16_MAX means to ignore this field. A value of UINT16_MAX-1 means to release this channel back to the RC radio. - RC channel 16 value. A value of 0 or UINT16_MAX means to ignore this field. A value of UINT16_MAX-1 means to release this channel back to the RC radio. - RC channel 17 value. A value of 0 or UINT16_MAX means to ignore this field. A value of UINT16_MAX-1 means to release this channel back to the RC radio. - RC channel 18 value. A value of 0 or UINT16_MAX means to ignore this field. A value of UINT16_MAX-1 means to release this channel back to the RC radio. - - - Message encoding a mission item. This message is emitted to announce - the presence of a mission item and to set a mission item on the system. The mission item can be either in x, y, z meters (type: LOCAL) or x:lat, y:lon, z:altitude. Local frame is Z-down, right handed (NED), global frame is Z-up, right handed (ENU). NaN or INT32_MAX may be used in float/integer params (respectively) to indicate optional/default values (e.g. to use the component's current latitude, yaw rather than a specific value). See also https://mavlink.io/en/services/mission.html. - System ID - Component ID - Waypoint ID (sequence number). Starts at zero. Increases monotonically for each waypoint, no gaps in the sequence (0,1,2,3,4). - The coordinate system of the waypoint. - The scheduled action for the waypoint. - false:0, true:1 - Autocontinue to next waypoint - PARAM1, see MAV_CMD enum - PARAM2, see MAV_CMD enum - PARAM3, see MAV_CMD enum - PARAM4, see MAV_CMD enum - PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7 - PARAM6 / y position: local: x position in meters * 1e4, global: longitude in degrees *10^7 - PARAM7 / z position: global: altitude in meters (relative or absolute, depending on frame. - - Mission type. - - - Metrics typically displayed on a HUD for fixed wing aircraft. - Vehicle speed in form appropriate for vehicle type. For standard aircraft this is typically calibrated airspeed (CAS) or indicated airspeed (IAS) - either of which can be used by a pilot to estimate stall speed. - Current ground speed. - Current heading in compass units (0-360, 0=north). - Current throttle setting (0 to 100). - Current altitude (MSL). - Current climb rate. - - - Message encoding a command with parameters as scaled integers. Scaling depends on the actual command value. The command microservice is documented at https://mavlink.io/en/services/command.html - System ID - Component ID - The coordinate system of the COMMAND. - The scheduled action for the mission item. - Not used. - Not used (set 0). - PARAM1, see MAV_CMD enum - PARAM2, see MAV_CMD enum - PARAM3, see MAV_CMD enum - PARAM4, see MAV_CMD enum - PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7 - PARAM6 / local: y position in meters * 1e4, global: longitude in degrees * 10^7 - PARAM7 / z position: global: altitude in meters (relative or absolute, depending on frame). - - - Send a command with up to seven parameters to the MAV. The command microservice is documented at https://mavlink.io/en/services/command.html - System which should execute the command - Component which should execute the command, 0 for all components - Command ID (of command to send). - 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command) - Parameter 1 (for the specific command). - Parameter 2 (for the specific command). - Parameter 3 (for the specific command). - Parameter 4 (for the specific command). - Parameter 5 (for the specific command). - Parameter 6 (for the specific command). - Parameter 7 (for the specific command). - - - Report status of a command. Includes feedback whether the command was executed. The command microservice is documented at https://mavlink.io/en/services/command.html - Command ID (of acknowledged command). - Result of command. - - WIP: Also used as result_param1, it can be set with an enum containing the errors reasons of why the command was denied, or the progress percentage when result is MAV_RESULT_IN_PROGRESS (255 if the progress is unknown). - WIP: Additional parameter of the result, example: which parameter of MAV_CMD_NAV_WAYPOINT caused it to be denied. - WIP: System ID of the target recipient. This is the ID of the system that sent the command for which this COMMAND_ACK is an acknowledgement. - WIP: Component ID of the target recipient. This is the ID of the system that sent the command for which this COMMAND_ACK is an acknowledgement. - - - - - Cancel a long running command. The target system should respond with a COMMAND_ACK to the original command with result=MAV_RESULT_CANCELLED if the long running process was cancelled. If it has already completed, the cancel action can be ignored. The cancel action can be retried until some sort of acknowledgement to the original command has been received. The command microservice is documented at https://mavlink.io/en/services/command.html - System executing long running command. Should not be broadcast (0). - Component executing long running command. - Command ID (of command to cancel). - - - Setpoint in roll, pitch, yaw and thrust from the operator - Timestamp (time since system boot). - Desired roll rate - Desired pitch rate - Desired yaw rate - Collective thrust, normalized to 0 .. 1 - Flight mode switch position, 0.. 255 - Override mode switch position, 0.. 255 - - - Sets a desired vehicle attitude. Used by an external controller to command the vehicle (manual controller or other system). - Timestamp (time since system boot). - System ID - Component ID - Bitmap to indicate which dimensions should be ignored by the vehicle. - Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) - Body roll rate - Body pitch rate - Body yaw rate - Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse trust) - - - Reports the current commanded attitude of the vehicle as specified by the autopilot. This should match the commands sent in a SET_ATTITUDE_TARGET message if the vehicle is being controlled this way. - Timestamp (time since system boot). - Bitmap to indicate which dimensions should be ignored by the vehicle. - Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) - Body roll rate - Body pitch rate - Body yaw rate - Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse trust) - - - Sets a desired vehicle position in a local north-east-down coordinate frame. Used by an external controller to command the vehicle (manual controller or other system). - Timestamp (time since system boot). - System ID - Component ID - Valid options are: MAV_FRAME_LOCAL_NED = 1, MAV_FRAME_LOCAL_OFFSET_NED = 7, MAV_FRAME_BODY_NED = 8, MAV_FRAME_BODY_OFFSET_NED = 9 - Bitmap to indicate which dimensions should be ignored by the vehicle. - X Position in NED frame - Y Position in NED frame - Z Position in NED frame (note, altitude is negative in NED) - X velocity in NED frame - Y velocity in NED frame - Z velocity in NED frame - X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N - Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N - Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N - yaw setpoint - yaw rate setpoint - - - Reports the current commanded vehicle position, velocity, and acceleration as specified by the autopilot. This should match the commands sent in SET_POSITION_TARGET_LOCAL_NED if the vehicle is being controlled this way. - Timestamp (time since system boot). - Valid options are: MAV_FRAME_LOCAL_NED = 1, MAV_FRAME_LOCAL_OFFSET_NED = 7, MAV_FRAME_BODY_NED = 8, MAV_FRAME_BODY_OFFSET_NED = 9 - Bitmap to indicate which dimensions should be ignored by the vehicle. - X Position in NED frame - Y Position in NED frame - Z Position in NED frame (note, altitude is negative in NED) - X velocity in NED frame - Y velocity in NED frame - Z velocity in NED frame - X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N - Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N - Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N - yaw setpoint - yaw rate setpoint - - - Sets a desired vehicle position, velocity, and/or acceleration in a global coordinate system (WGS84). Used by an external controller to command the vehicle (manual controller or other system). - Timestamp (time since system boot). The rationale for the timestamp in the setpoint is to allow the system to compensate for the transport delay of the setpoint. This allows the system to compensate processing latency. - System ID - Component ID - Valid options are: MAV_FRAME_GLOBAL_INT = 5, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT = 6, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT = 11 - Bitmap to indicate which dimensions should be ignored by the vehicle. - X Position in WGS84 frame - Y Position in WGS84 frame - Altitude (MSL, Relative to home, or AGL - depending on frame) - X velocity in NED frame - Y velocity in NED frame - Z velocity in NED frame - X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N - Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N - Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N - yaw setpoint - yaw rate setpoint - - - Reports the current commanded vehicle position, velocity, and acceleration as specified by the autopilot. This should match the commands sent in SET_POSITION_TARGET_GLOBAL_INT if the vehicle is being controlled this way. - Timestamp (time since system boot). The rationale for the timestamp in the setpoint is to allow the system to compensate for the transport delay of the setpoint. This allows the system to compensate processing latency. - Valid options are: MAV_FRAME_GLOBAL_INT = 5, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT = 6, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT = 11 - Bitmap to indicate which dimensions should be ignored by the vehicle. - X Position in WGS84 frame - Y Position in WGS84 frame - Altitude (MSL, AGL or relative to home altitude, depending on frame) - X velocity in NED frame - Y velocity in NED frame - Z velocity in NED frame - X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N - Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N - Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N - yaw setpoint - yaw rate setpoint - - - The offset in X, Y, Z and yaw between the LOCAL_POSITION_NED messages of MAV X and the global coordinate frame in NED coordinates. Coordinate frame is right-handed, Z-axis down (aeronautical frame, NED / north-east-down convention) - Timestamp (time since system boot). - X Position - Y Position - Z Position - Roll - Pitch - Yaw - - - Suffers from missing airspeed fields and singularities due to Euler angles - Sent from simulation to autopilot. This packet is useful for high throughput applications such as hardware in the loop simulations. - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - Roll angle - Pitch angle - Yaw angle - Body frame roll / phi angular speed - Body frame pitch / theta angular speed - Body frame yaw / psi angular speed - Latitude - Longitude - Altitude - Ground X Speed (Latitude) - Ground Y Speed (Longitude) - Ground Z Speed (Altitude) - X acceleration - Y acceleration - Z acceleration - - - Sent from autopilot to simulation. Hardware in the loop control outputs - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - Control output -1 .. 1 - Control output -1 .. 1 - Control output -1 .. 1 - Throttle 0 .. 1 - Aux 1, -1 .. 1 - Aux 2, -1 .. 1 - Aux 3, -1 .. 1 - Aux 4, -1 .. 1 - System mode. - Navigation mode (MAV_NAV_MODE) - - - Sent from simulation to autopilot. The RAW values of the RC channels received. The standard PPM modulation is as follows: 1000 microseconds: 0%, 2000 microseconds: 100%. Individual receivers/transmitters might violate this specification. - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - RC channel 1 value - RC channel 2 value - RC channel 3 value - RC channel 4 value - RC channel 5 value - RC channel 6 value - RC channel 7 value - RC channel 8 value - RC channel 9 value - RC channel 10 value - RC channel 11 value - RC channel 12 value - Receive signal strength indicator in device-dependent units/scale. Values: [0-254], 255: invalid/unknown. - - - Sent from autopilot to simulation. Hardware in the loop control outputs (replacement for HIL_CONTROLS) - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - Control outputs -1 .. 1. Channel assignment depends on the simulated hardware. - System mode. Includes arming state. - Flags as bitfield, 1: indicate simulation using lockstep. - - - Optical flow from a flow sensor (e.g. optical mouse sensor) - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - Sensor ID - Flow in x-sensor direction - Flow in y-sensor direction - Flow in x-sensor direction, angular-speed compensated - Flow in y-sensor direction, angular-speed compensated - Optical flow quality / confidence. 0: bad, 255: maximum quality - Ground distance. Positive value: distance known. Negative value: Unknown distance - - Flow rate about X axis - Flow rate about Y axis - - - Global position/attitude estimate from a vision source. - Timestamp (UNIX time or since system boot) - Global X position - Global Y position - Global Z position - Roll angle - Pitch angle - Yaw angle - - Row-major representation of pose 6x6 cross-covariance matrix upper right triangle (states: x_global, y_global, z_global, roll, pitch, yaw; first six entries are the first ROW, next five entries are the second ROW, etc.). If unknown, assign NaN value to first element in the array. - Estimate reset counter. This should be incremented when the estimate resets in any of the dimensions (position, velocity, attitude, angular speed). This is designed to be used when e.g an external SLAM system detects a loop-closure and the estimate jumps. - - - Local position/attitude estimate from a vision source. - Timestamp (UNIX time or time since system boot) - Local X position - Local Y position - Local Z position - Roll angle - Pitch angle - Yaw angle - - Row-major representation of pose 6x6 cross-covariance matrix upper right triangle (states: x, y, z, roll, pitch, yaw; first six entries are the first ROW, next five entries are the second ROW, etc.). If unknown, assign NaN value to first element in the array. - Estimate reset counter. This should be incremented when the estimate resets in any of the dimensions (position, velocity, attitude, angular speed). This is designed to be used when e.g an external SLAM system detects a loop-closure and the estimate jumps. - - - Speed estimate from a vision source. - Timestamp (UNIX time or time since system boot) - Global X speed - Global Y speed - Global Z speed - - Row-major representation of 3x3 linear velocity covariance matrix (states: vx, vy, vz; 1st three entries - 1st row, etc.). If unknown, assign NaN value to first element in the array. - Estimate reset counter. This should be incremented when the estimate resets in any of the dimensions (position, velocity, attitude, angular speed). This is designed to be used when e.g an external SLAM system detects a loop-closure and the estimate jumps. - - - Global position estimate from a Vicon motion system source. - Timestamp (UNIX time or time since system boot) - Global X position - Global Y position - Global Z position - Roll angle - Pitch angle - Yaw angle - - Row-major representation of 6x6 pose cross-covariance matrix upper right triangle (states: x, y, z, roll, pitch, yaw; first six entries are the first ROW, next five entries are the second ROW, etc.). If unknown, assign NaN value to first element in the array. - - - The IMU readings in SI units in NED body frame - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - X acceleration - Y acceleration - Z acceleration - Angular speed around X axis - Angular speed around Y axis - Angular speed around Z axis - X Magnetic field - Y Magnetic field - Z Magnetic field - Absolute pressure - Differential pressure - Altitude calculated from pressure - Temperature - Bitmap for fields that have updated since last message, bit 0 = xacc, bit 12: temperature - - Id. Ids are numbered from 0 and map to IMUs numbered from 1 (e.g. IMU1 will have a message with id=0) - - - Optical flow from an angular rate flow sensor (e.g. PX4FLOW or mouse sensor) - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - Sensor ID - Integration time. Divide integrated_x and integrated_y by the integration time to obtain average flow. The integration time also indicates the. - Flow around X axis (Sensor RH rotation about the X axis induces a positive flow. Sensor linear motion along the positive Y axis induces a negative flow.) - Flow around Y axis (Sensor RH rotation about the Y axis induces a positive flow. Sensor linear motion along the positive X axis induces a positive flow.) - RH rotation around X axis - RH rotation around Y axis - RH rotation around Z axis - Temperature - Optical flow quality / confidence. 0: no valid flow, 255: maximum quality - Time since the distance was sampled. - Distance to the center of the flow field. Positive value (including zero): distance known. Negative value: Unknown distance. - - - The IMU readings in SI units in NED body frame - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - X acceleration - Y acceleration - Z acceleration - Angular speed around X axis in body frame - Angular speed around Y axis in body frame - Angular speed around Z axis in body frame - X Magnetic field - Y Magnetic field - Z Magnetic field - Absolute pressure - Differential pressure (airspeed) - Altitude calculated from pressure - Temperature - Bitmap for fields that have updated since last message, bit 0 = xacc, bit 12: temperature, bit 31: full reset of attitude/position/velocities/etc was performed in sim. - - Sensor ID (zero indexed). Used for multiple sensor inputs - - - Status of simulation environment, if used - True attitude quaternion component 1, w (1 in null-rotation) - True attitude quaternion component 2, x (0 in null-rotation) - True attitude quaternion component 3, y (0 in null-rotation) - True attitude quaternion component 4, z (0 in null-rotation) - Attitude roll expressed as Euler angles, not recommended except for human-readable outputs - Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs - Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs - X acceleration - Y acceleration - Z acceleration - Angular speed around X axis - Angular speed around Y axis - Angular speed around Z axis - Latitude - Longitude - Altitude - Horizontal position standard deviation - Vertical position standard deviation - True velocity in north direction in earth-fixed NED frame - True velocity in east direction in earth-fixed NED frame - True velocity in down direction in earth-fixed NED frame - - - Status generated by radio and injected into MAVLink stream. - Local (message sender) recieved signal strength indication in device-dependent units/scale. Values: [0-254], 255: invalid/unknown. - Remote (message receiver) signal strength indication in device-dependent units/scale. Values: [0-254], 255: invalid/unknown. - Remaining free transmitter buffer space. - Local background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], 255: invalid/unknown. - Remote background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], 255: invalid/unknown. - Count of radio packet receive errors (since boot). - Count of error corrected radio packets (since boot). - - - File transfer message - Network ID (0 for broadcast) - System ID (0 for broadcast) - Component ID (0 for broadcast) - Variable length payload. The length is defined by the remaining message length when subtracting the header and other fields. The entire content of this block is opaque unless you understand any the encoding message_type. The particular encoding used can be extension specific and might not always be documented as part of the mavlink specification. - - - Time synchronization message. - Time sync timestamp 1 - Time sync timestamp 2 - - - Camera-IMU triggering and synchronisation message. - Timestamp for image frame (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - Image frame sequence - - - The global position, as returned by the Global Positioning System (GPS). This is - NOT the global position estimate of the sytem, but rather a RAW sensor value. See message GLOBAL_POSITION for the global position estimate. - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix. - Latitude (WGS84) - Longitude (WGS84) - Altitude (MSL). Positive for up. - GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX - GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX - GPS ground speed. If unknown, set to: 65535 - GPS velocity in north direction in earth-fixed NED frame - GPS velocity in east direction in earth-fixed NED frame - GPS velocity in down direction in earth-fixed NED frame - Course over ground (NOT heading, but direction of movement), 0.0..359.99 degrees. If unknown, set to: 65535 - Number of satellites visible. If unknown, set to 255 - - GPS ID (zero indexed). Used for multiple GPS inputs - Yaw of vehicle relative to Earth's North, zero means not available, use 36000 for north - - - Simulated optical flow from a flow sensor (e.g. PX4FLOW or optical mouse sensor) - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - Sensor ID - Integration time. Divide integrated_x and integrated_y by the integration time to obtain average flow. The integration time also indicates the. - Flow in radians around X axis (Sensor RH rotation about the X axis induces a positive flow. Sensor linear motion along the positive Y axis induces a negative flow.) - Flow in radians around Y axis (Sensor RH rotation about the Y axis induces a positive flow. Sensor linear motion along the positive X axis induces a positive flow.) - RH rotation around X axis - RH rotation around Y axis - RH rotation around Z axis - Temperature - Optical flow quality / confidence. 0: no valid flow, 255: maximum quality - Time since the distance was sampled. - Distance to the center of the flow field. Positive value (including zero): distance known. Negative value: Unknown distance. - - - Sent from simulation to autopilot, avoids in contrast to HIL_STATE singularities. This packet is useful for high throughput applications such as hardware in the loop simulations. - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - Vehicle attitude expressed as normalized quaternion in w, x, y, z order (with 1 0 0 0 being the null-rotation) - Body frame roll / phi angular speed - Body frame pitch / theta angular speed - Body frame yaw / psi angular speed - Latitude - Longitude - Altitude - Ground X Speed (Latitude) - Ground Y Speed (Longitude) - Ground Z Speed (Altitude) - Indicated airspeed - True airspeed - X acceleration - Y acceleration - Z acceleration - - - The RAW IMU readings for secondary 9DOF sensor setup. This message should contain the scaled values to the described units - Timestamp (time since system boot). - X acceleration - Y acceleration - Z acceleration - Angular speed around X axis - Angular speed around Y axis - Angular speed around Z axis - X Magnetic field - Y Magnetic field - Z Magnetic field - - Temperature, 0: IMU does not provide temperature values. If the IMU is at 0C it must send 1 (0.01C). - - - Request a list of available logs. On some systems calling this may stop on-board logging until LOG_REQUEST_END is called. If there are no log files available this request shall be answered with one LOG_ENTRY message with id = 0 and num_logs = 0. - System ID - Component ID - First log id (0 for first available) - Last log id (0xffff for last available) - - - Reply to LOG_REQUEST_LIST - Log id - Total number of logs - High log number - UTC timestamp of log since 1970, or 0 if not available - Size of the log (may be approximate) - - - Request a chunk of a log - System ID - Component ID - Log id (from LOG_ENTRY reply) - Offset into the log - Number of bytes - - - Reply to LOG_REQUEST_DATA - Log id (from LOG_ENTRY reply) - Offset into the log - Number of bytes (zero for end of log) - log data - - - Erase all logs - System ID - Component ID - - - Stop log transfer and resume normal logging - System ID - Component ID - - - Data for injecting into the onboard GPS (used for DGPS) - System ID - Component ID - Data length - Raw data (110 is enough for 12 satellites of RTCMv2) - - - Second GPS data. - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - GPS fix type. - Latitude (WGS84) - Longitude (WGS84) - Altitude (MSL). Positive for up. - GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX - GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX - GPS ground speed. If unknown, set to: UINT16_MAX - Course over ground (NOT heading, but direction of movement): 0.0..359.99 degrees. If unknown, set to: UINT16_MAX - Number of satellites visible. If unknown, set to 255 - Number of DGPS satellites - Age of DGPS info - - Yaw in earth frame from north. Use 0 if this GPS does not provide yaw. Use 65535 if this GPS is configured to provide yaw and is currently unable to provide it. Use 36000 for north. - - - Power supply status - 5V rail voltage. - Servo rail voltage. - Bitmap of power supply status flags. - - - Control a serial port. This can be used for raw access to an onboard serial peripheral such as a GPS or telemetry radio. It is designed to make it possible to update the devices firmware via MAVLink messages or change the devices settings. A message with zero bytes can be used to change just the baudrate. - Serial control device type. - Bitmap of serial control flags. - Timeout for reply data - Baudrate of transfer. Zero means no change. - how many bytes in this transfer - serial data - - - RTK GPS data. Gives information on the relative baseline calculation the GPS is reporting - Time since boot of last baseline message received. - Identification of connected RTK receiver. - GPS Week Number of last baseline - GPS Time of Week of last baseline - GPS-specific health report for RTK data. - Rate of baseline messages being received by GPS - Current number of sats used for RTK calculation. - Coordinate system of baseline - Current baseline in ECEF x or NED north component. - Current baseline in ECEF y or NED east component. - Current baseline in ECEF z or NED down component. - Current estimate of baseline accuracy. - Current number of integer ambiguity hypotheses. - - - RTK GPS data. Gives information on the relative baseline calculation the GPS is reporting - Time since boot of last baseline message received. - Identification of connected RTK receiver. - GPS Week Number of last baseline - GPS Time of Week of last baseline - GPS-specific health report for RTK data. - Rate of baseline messages being received by GPS - Current number of sats used for RTK calculation. - Coordinate system of baseline - Current baseline in ECEF x or NED north component. - Current baseline in ECEF y or NED east component. - Current baseline in ECEF z or NED down component. - Current estimate of baseline accuracy. - Current number of integer ambiguity hypotheses. - - - The RAW IMU readings for 3rd 9DOF sensor setup. This message should contain the scaled values to the described units - Timestamp (time since system boot). - X acceleration - Y acceleration - Z acceleration - Angular speed around X axis - Angular speed around Y axis - Angular speed around Z axis - X Magnetic field - Y Magnetic field - Z Magnetic field - - Temperature, 0: IMU does not provide temperature values. If the IMU is at 0C it must send 1 (0.01C). - - - Handshake message to initiate, control and stop image streaming when using the Image Transmission Protocol: https://mavlink.io/en/services/image_transmission.html. - Type of requested/acknowledged data. - total data size (set on ACK only). - Width of a matrix or image. - Height of a matrix or image. - Number of packets being sent (set on ACK only). - Payload size per packet (normally 253 byte, see DATA field size in message ENCAPSULATED_DATA) (set on ACK only). - JPEG quality. Values: [1-100]. - - - Data packet for images sent using the Image Transmission Protocol: https://mavlink.io/en/services/image_transmission.html. - sequence number (starting with 0 on every transmission) - image data bytes - - - Distance sensor information for an onboard rangefinder. - Timestamp (time since system boot). - Minimum distance the sensor can measure - Maximum distance the sensor can measure - Current distance reading - Type of distance sensor. - Onboard ID of the sensor - Direction the sensor faces. downward-facing: ROTATION_PITCH_270, upward-facing: ROTATION_PITCH_90, backward-facing: ROTATION_PITCH_180, forward-facing: ROTATION_NONE, left-facing: ROTATION_YAW_90, right-facing: ROTATION_YAW_270 - Measurement variance. Max standard deviation is 6cm. 255 if unknown. - - Horizontal Field of View (angle) where the distance measurement is valid and the field of view is known. Otherwise this is set to 0. - Vertical Field of View (angle) where the distance measurement is valid and the field of view is known. Otherwise this is set to 0. - Quaternion of the sensor orientation in vehicle body frame (w, x, y, z order, zero-rotation is 1, 0, 0, 0). Zero-rotation is along the vehicle body x-axis. This field is required if the orientation is set to MAV_SENSOR_ROTATION_CUSTOM. Set it to 0 if invalid." - Signal quality of the sensor. Specific to each sensor type, representing the relation of the signal strength with the target reflectivity, distance, size or aspect, but normalised as a percentage. 0 = unknown/unset signal quality, 1 = invalid signal, 100 = perfect signal. - - - Request for terrain data and terrain status. See terrain protocol docs: https://mavlink.io/en/services/terrain.html - Latitude of SW corner of first grid - Longitude of SW corner of first grid - Grid spacing - Bitmask of requested 4x4 grids (row major 8x7 array of grids, 56 bits) - - - Terrain data sent from GCS. The lat/lon and grid_spacing must be the same as a lat/lon from a TERRAIN_REQUEST. See terrain protocol docs: https://mavlink.io/en/services/terrain.html - Latitude of SW corner of first grid - Longitude of SW corner of first grid - Grid spacing - bit within the terrain request mask - Terrain data MSL - - - Request that the vehicle report terrain height at the given location (expected response is a TERRAIN_REPORT). Used by GCS to check if vehicle has all terrain data needed for a mission. - Latitude - Longitude - - - Streamed from drone to report progress of terrain map download (initiated by TERRAIN_REQUEST), or sent as a response to a TERRAIN_CHECK request. See terrain protocol docs: https://mavlink.io/en/services/terrain.html - Latitude - Longitude - grid spacing (zero if terrain at this location unavailable) - Terrain height MSL - Current vehicle height above lat/lon terrain height - Number of 4x4 terrain blocks waiting to be received or read from disk - Number of 4x4 terrain blocks in memory - - - Barometer readings for 2nd barometer - Timestamp (time since system boot). - Absolute pressure - Differential pressure - Absolute pressure temperature - - Differential pressure temperature (0, if not available). Report values of 0 (or 1) as 1 cdegC. - - - Motion capture attitude and position - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) - X position (NED) - Y position (NED) - Z position (NED) - - Row-major representation of a pose 6x6 cross-covariance matrix upper right triangle (states: x, y, z, roll, pitch, yaw; first six entries are the first ROW, next five entries are the second ROW, etc.). If unknown, assign NaN value to first element in the array. - - - Set the vehicle attitude and body angular rates. - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - Actuator group. The "_mlx" indicates this is a multi-instance message and a MAVLink parser should use this field to difference between instances. - System ID - Component ID - Actuator controls. Normed to -1..+1 where 0 is neutral position. Throttle for single rotation direction motors is 0..1, negative range for reverse direction. Standard mapping for attitude controls (group 0): (index 0-7): roll, pitch, yaw, throttle, flaps, spoilers, airbrakes, landing gear. Load a pass-through mixer to repurpose them as generic outputs. - - - Set the vehicle attitude and body angular rates. - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - Actuator group. The "_mlx" indicates this is a multi-instance message and a MAVLink parser should use this field to difference between instances. - Actuator controls. Normed to -1..+1 where 0 is neutral position. Throttle for single rotation direction motors is 0..1, negative range for reverse direction. Standard mapping for attitude controls (group 0): (index 0-7): roll, pitch, yaw, throttle, flaps, spoilers, airbrakes, landing gear. Load a pass-through mixer to repurpose them as generic outputs. - - - The current system altitude. - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - This altitude measure is initialized on system boot and monotonic (it is never reset, but represents the local altitude change). The only guarantee on this field is that it will never be reset and is consistent within a flight. The recommended value for this field is the uncorrected barometric altitude at boot time. This altitude will also drift and vary between flights. - This altitude measure is strictly above mean sea level and might be non-monotonic (it might reset on events like GPS lock or when a new QNH value is set). It should be the altitude to which global altitude waypoints are compared to. Note that it is *not* the GPS altitude, however, most GPS modules already output MSL by default and not the WGS84 altitude. - This is the local altitude in the local coordinate frame. It is not the altitude above home, but in reference to the coordinate origin (0, 0, 0). It is up-positive. - This is the altitude above the home position. It resets on each change of the current home position. - This is the altitude above terrain. It might be fed by a terrain database or an altimeter. Values smaller than -1000 should be interpreted as unknown. - This is not the altitude, but the clear space below the system according to the fused clearance estimate. It generally should max out at the maximum range of e.g. the laser altimeter. It is generally a moving target. A negative value indicates no measurement available. - - - The autopilot is requesting a resource (file, binary, other type of data) - Request ID. This ID should be re-used when sending back URI contents - The type of requested URI. 0 = a file via URL. 1 = a UAVCAN binary - The requested unique resource identifier (URI). It is not necessarily a straight domain name (depends on the URI type enum) - The way the autopilot wants to receive the URI. 0 = MAVLink FTP. 1 = binary stream. - The storage path the autopilot wants the URI to be stored in. Will only be valid if the transfer_type has a storage associated (e.g. MAVLink FTP). - - - Barometer readings for 3rd barometer - Timestamp (time since system boot). - Absolute pressure - Differential pressure - Absolute pressure temperature - - Differential pressure temperature (0, if not available). Report values of 0 (or 1) as 1 cdegC. - - - Current motion information from a designated system - Timestamp (time since system boot). - bit positions for tracker reporting capabilities (POS = 0, VEL = 1, ACCEL = 2, ATT + RATES = 3) - Latitude (WGS84) - Longitude (WGS84) - Altitude (MSL) - target velocity (0,0,0) for unknown - linear target acceleration (0,0,0) for unknown - (1 0 0 0 for unknown) - (0 0 0 for unknown) - eph epv - button states or switches of a tracker device - - - The smoothed, monotonic system state used to feed the control loops of the system. - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - X acceleration in body frame - Y acceleration in body frame - Z acceleration in body frame - X velocity in body frame - Y velocity in body frame - Z velocity in body frame - X position in local frame - Y position in local frame - Z position in local frame - Airspeed, set to -1 if unknown - Variance of body velocity estimate - Variance in local position - The attitude, represented as Quaternion - Angular rate in roll axis - Angular rate in pitch axis - Angular rate in yaw axis - - - Battery information. Updates GCS with flight controller battery status. Smart batteries also use this message, but may additionally send SMART_BATTERY_INFO. - Battery ID - Function of the battery - Type (chemistry) of the battery - Temperature of the battery. INT16_MAX for unknown temperature. - Battery voltage of cells 1 to 10 (see voltages_ext for cells 11-14). Cells in this field above the valid cell count for this battery should have the UINT16_MAX value. If individual cell voltages are unknown or not measured for this battery, then the overall battery voltage should be filled in cell 0, with all others set to UINT16_MAX. If the voltage of the battery is greater than (UINT16_MAX - 1), then cell 0 should be set to (UINT16_MAX - 1), and cell 1 to the remaining voltage. This can be extended to multiple cells if the total voltage is greater than 2 * (UINT16_MAX - 1). - Battery current, -1: autopilot does not measure the current - Consumed charge, -1: autopilot does not provide consumption estimate - Consumed energy, -1: autopilot does not provide energy consumption estimate - Remaining battery energy. Values: [0-100], -1: autopilot does not estimate the remaining battery. - - Remaining battery time, 0: autopilot does not provide remaining battery time estimate - State for extent of discharge, provided by autopilot for warning or external reactions - Battery voltages for cells 11 to 14. Cells above the valid cell count for this battery should have a value of 0, where zero indicates not supported (note, this is different than for the voltages field and allows empty byte truncation). If the measured value is 0 then 1 should be sent instead. - Battery mode. Default (0) is that battery mode reporting is not supported or battery is in normal-use mode. - Fault/health indications. These should be set when charge_state is MAV_BATTERY_CHARGE_STATE_FAILED or MAV_BATTERY_CHARGE_STATE_UNHEALTHY (if not, fault reporting is not supported). - - - Version and capability of autopilot software. This should be emitted in response to a request with MAV_CMD_REQUEST_MESSAGE. - Bitmap of capabilities - Firmware version number - Middleware version number - Operating system version number - HW / board version (last 8 bytes should be silicon ID, if any) - Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. - Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. - Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. - ID of the board vendor - ID of the product - UID if provided by hardware (see uid2) - - UID if provided by hardware (supersedes the uid field. If this is non-zero, use this field, otherwise use uid) - - - The location of a landing target. See: https://mavlink.io/en/services/landing_target.html - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - The ID of the target if multiple targets are present - Coordinate frame used for following fields. - X-axis angular offset of the target from the center of the image - Y-axis angular offset of the target from the center of the image - Distance to the target from the vehicle - Size of target along x-axis - Size of target along y-axis - - X Position of the landing target in MAV_FRAME - Y Position of the landing target in MAV_FRAME - Z Position of the landing target in MAV_FRAME - Quaternion of landing target orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0) - Type of landing target - Boolean indicating whether the position fields (x, y, z, q, type) contain valid target position information (valid: 1, invalid: 0). Default is 0 (invalid). - - - - Status of geo-fencing. Sent in extended status stream when fencing enabled. - Breach status (0 if currently inside fence, 1 if outside). - Number of fence breaches. - Last breach type. - Time (since boot) of last breach. - - Active action to prevent fence breach - - - - - Reports results of completed compass calibration. Sent until MAG_CAL_ACK received. - Compass being calibrated. - Bitmask of compasses being calibrated. - Calibration Status. - 0=requires a MAV_CMD_DO_ACCEPT_MAG_CAL, 1=saved to parameters. - RMS milligauss residuals. - X offset. - Y offset. - Z offset. - X diagonal (matrix 11). - Y diagonal (matrix 22). - Z diagonal (matrix 33). - X off-diagonal (matrix 12 and 21). - Y off-diagonal (matrix 13 and 31). - Z off-diagonal (matrix 32 and 23). - - Confidence in orientation (higher is better). - orientation before calibration. - orientation after calibration. - field radius correction factor - - - - EFI status output - EFI health status - ECU index - RPM - Fuel consumed - Fuel flow rate - Engine load - Throttle position - Spark dwell time - Barometric pressure - Intake manifold pressure( - Intake manifold temperature - Cylinder head temperature - Ignition timing (Crank angle degrees) - Injection time - Exhaust gas temperature - Output throttle - Pressure/temperature compensation - - - - Estimator status message including flags, innovation test ratios and estimated accuracies. The flags message is an integer bitmask containing information on which EKF outputs are valid. See the ESTIMATOR_STATUS_FLAGS enum definition for further information. The innovation test ratios show the magnitude of the sensor innovation divided by the innovation check threshold. Under normal operation the innovation test ratios should be below 0.5 with occasional values up to 1.0. Values greater than 1.0 should be rare under normal operation and indicate that a measurement has been rejected by the filter. The user should be notified if an innovation test ratio greater than 1.0 is recorded. Notifications for values in the range between 0.5 and 1.0 should be optional and controllable by the user. - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - Bitmap indicating which EKF outputs are valid. - Velocity innovation test ratio - Horizontal position innovation test ratio - Vertical position innovation test ratio - Magnetometer innovation test ratio - Height above terrain innovation test ratio - True airspeed innovation test ratio - Horizontal position 1-STD accuracy relative to the EKF local origin - Vertical position 1-STD accuracy relative to the EKF local origin - - - Wind covariance estimate from vehicle. - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - Wind in X (NED) direction - Wind in Y (NED) direction - Wind in Z (NED) direction - Variability of the wind in XY. RMS of a 1 Hz lowpassed wind estimate. - Variability of the wind in Z. RMS of a 1 Hz lowpassed wind estimate. - Altitude (MSL) that this measurement was taken at - Horizontal speed 1-STD accuracy - Vertical speed 1-STD accuracy - - - GPS sensor input message. This is a raw sensor value sent by the GPS. This is NOT the global position estimate of the system. - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - ID of the GPS for multiple GPS inputs - Bitmap indicating which GPS input flags fields to ignore. All other fields must be provided. - GPS time (from start of GPS week) - GPS week number - 0-1: no fix, 2: 2D fix, 3: 3D fix. 4: 3D with DGPS. 5: 3D with RTK - Latitude (WGS84) - Longitude (WGS84) - Altitude (MSL). Positive for up. - GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX - GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX - GPS velocity in north direction in earth-fixed NED frame - GPS velocity in east direction in earth-fixed NED frame - GPS velocity in down direction in earth-fixed NED frame - GPS speed accuracy - GPS horizontal accuracy - GPS vertical accuracy - Number of satellites visible. - - Yaw of vehicle relative to Earth's North, zero means not available, use 36000 for north - - - RTCM message for injecting into the onboard GPS (used for DGPS) - LSB: 1 means message is fragmented, next 2 bits are the fragment ID, the remaining 5 bits are used for the sequence ID. Messages are only to be flushed to the GPS when the entire message has been reconstructed on the autopilot. The fragment ID specifies which order the fragments should be assembled into a buffer, while the sequence ID is used to detect a mismatch between different buffers. The buffer is considered fully reconstructed when either all 4 fragments are present, or all the fragments before the first fragment with a non full payload is received. This management is used to ensure that normal GPS operation doesn't corrupt RTCM data, and to recover from a unreliable transport delivery order. - data length - RTCM message (may be fragmented) - - - - Message appropriate for high latency connections like Iridium - Bitmap of enabled system modes. - A bitfield for use for autopilot-specific flags. - The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown. - roll - pitch - heading - throttle (percentage) - heading setpoint - Latitude - Longitude - Altitude above mean sea level - Altitude setpoint relative to the home position - airspeed - airspeed setpoint - groundspeed - climb rate - Number of satellites visible. If unknown, set to 255 - GPS Fix type. - Remaining battery (percentage) - Autopilot temperature (degrees C) - Air temperature (degrees C) from airspeed sensor - failsafe (each bit represents a failsafe where 0=ok, 1=failsafe active (bit0:RC, bit1:batt, bit2:GPS, bit3:GCS, bit4:fence) - current waypoint number - distance to target - - - Message appropriate for high latency connections like Iridium (version 2) - Timestamp (milliseconds since boot or Unix epoch) - Type of the MAV (quadrotor, helicopter, etc.) - Autopilot type / class. Use MAV_AUTOPILOT_INVALID for components that are not flight controllers. - A bitfield for use for autopilot-specific flags (2 byte version). - Latitude - Longitude - Altitude above mean sea level - Altitude setpoint - Heading - Heading setpoint - Distance to target waypoint or position - Throttle - Airspeed - Airspeed setpoint - Groundspeed - Windspeed - Wind heading - Maximum error horizontal position since last message - Maximum error vertical position since last message - Air temperature from airspeed sensor - Maximum climb rate magnitude since last message - Battery level (-1 if field not provided). - Current waypoint number - Bitmap of failure flags. - Field for custom payload. - Field for custom payload. - Field for custom payload. - - - Vibration levels and accelerometer clipping - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - Vibration levels on X-axis - Vibration levels on Y-axis - Vibration levels on Z-axis - first accelerometer clipping count - second accelerometer clipping count - third accelerometer clipping count - - - This message can be requested by sending the MAV_CMD_GET_HOME_POSITION command. The position the system will return to and land on. The position is set automatically by the system during the takeoff in case it was not explicitly set by the operator before or after. The global and local positions encode the position in the respective coordinate frames, while the q parameter encodes the orientation of the surface. Under normal conditions it describes the heading and terrain slope, which can be used by the aircraft to adjust the approach. The approach 3D vector describes the point to which the system should fly in normal flight mode and then perform a landing sequence along the vector. - Latitude (WGS84) - Longitude (WGS84) - Altitude (MSL). Positive for up. - Local X position of this position in the local coordinate frame - Local Y position of this position in the local coordinate frame - Local Z position of this position in the local coordinate frame - World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground - Local X position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. - Local Y position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. - Local Z position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. - - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - - - The position the system will return to and land on. The position is set automatically by the system during the takeoff in case it was not explicitly set by the operator before or after. The global and local positions encode the position in the respective coordinate frames, while the q parameter encodes the orientation of the surface. Under normal conditions it describes the heading and terrain slope, which can be used by the aircraft to adjust the approach. The approach 3D vector describes the point to which the system should fly in normal flight mode and then perform a landing sequence along the vector. - System ID. - Latitude (WGS84) - Longitude (WGS84) - Altitude (MSL). Positive for up. - Local X position of this position in the local coordinate frame - Local Y position of this position in the local coordinate frame - Local Z position of this position in the local coordinate frame - World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground - Local X position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. - Local Y position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. - Local Z position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. - - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - - - The interval between messages for a particular MAVLink message ID. This message is the response to the MAV_CMD_GET_MESSAGE_INTERVAL command. This interface replaces DATA_STREAM. - The ID of the requested MAVLink message. v1.0 is limited to 254 messages. - The interval between two messages. A value of -1 indicates this stream is disabled, 0 indicates it is not available, > 0 indicates the interval at which it is sent. - - - Provides state for additional features - The VTOL state if applicable. Is set to MAV_VTOL_STATE_UNDEFINED if UAV is not in VTOL configuration. - The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown. - - - The location and information of an ADSB vehicle - ICAO address - Latitude - Longitude - ADSB altitude type. - Altitude(ASL) - Course over ground - The horizontal velocity - The vertical velocity. Positive is up - The callsign, 8+null - ADSB emitter type. - Time since last communication in seconds - Bitmap to indicate various statuses including valid data fields - Squawk code - - - Information about a potential collision - Collision data source - Unique identifier, domain based on src field - Action that is being taken to avoid this collision - How concerned the aircraft is about this collision - Estimated time until collision occurs - Closest vertical distance between vehicle and object - Closest horizontal distance between vehicle and object - - - Message implementing parts of the V2 payload specs in V1 frames for transitional support. - Network ID (0 for broadcast) - System ID (0 for broadcast) - Component ID (0 for broadcast) - A code that identifies the software component that understands this message (analogous to USB device classes or mime type strings). If this code is less than 32768, it is considered a 'registered' protocol extension and the corresponding entry should be added to https://github.com/mavlink/mavlink/definition_files/extension_message_ids.xml. Software creators can register blocks of message IDs as needed (useful for GCS specific metadata, etc...). Message_types greater than 32767 are considered local experiments and should not be checked in to any widely distributed codebase. - Variable length payload. The length must be encoded in the payload as part of the message_type protocol, e.g. by including the length as payload data, or by terminating the payload data with a non-zero marker. This is required in order to reconstruct zero-terminated payloads that are (or otherwise would be) trimmed by MAVLink 2 empty-byte truncation. The entire content of the payload block is opaque unless you understand the encoding message_type. The particular encoding used can be extension specific and might not always be documented as part of the MAVLink specification. - - - Send raw controller memory. The use of this message is discouraged for normal packets, but a quite efficient way for testing new messages and getting experimental debug output. - Starting address of the debug variables - Version code of the type variable. 0=unknown, type ignored and assumed int16_t. 1=as below - Type code of the memory variables. for ver = 1: 0=16 x int16_t, 1=16 x uint16_t, 2=16 x Q15, 3=16 x 1Q14 - Memory contents at specified address - - - To debug something using a named 3D vector. - Name - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - x - y - z - - - Send a key-value pair as float. The use of this message is discouraged for normal packets, but a quite efficient way for testing new messages and getting experimental debug output. - Timestamp (time since system boot). - Name of the debug variable - Floating point value - - - Send a key-value pair as integer. The use of this message is discouraged for normal packets, but a quite efficient way for testing new messages and getting experimental debug output. - Timestamp (time since system boot). - Name of the debug variable - Signed integer value - - - Status text message. These messages are printed in yellow in the COMM console of QGroundControl. WARNING: They consume quite some bandwidth, so use only for important status and error messages. If implemented wisely, these messages are buffered on the MCU and sent only at a limited rate (e.g. 10 Hz). - Severity of status. Relies on the definitions within RFC-5424. - Status text message, without null termination character - - Unique (opaque) identifier for this statustext message. May be used to reassemble a logical long-statustext message from a sequence of chunks. A value of zero indicates this is the only chunk in the sequence and the message can be emitted immediately. - This chunk's sequence number; indexing is from zero. Any null character in the text field is taken to mean this was the last chunk. - - - Send a debug value. The index is used to discriminate between values. These values show up in the plot of QGroundControl as DEBUG N. - Timestamp (time since system boot). - index of debug variable - DEBUG value - - - - Setup a MAVLink2 signing key. If called with secret_key of all zero and zero initial_timestamp will disable signing - system id of the target - component ID of the target - signing key - initial timestamp - - - Report button state change. - Timestamp (time since system boot). - Time of last change of button state. - Bitmap for state of buttons. - - - New version explicitly defines format. More interoperable. - Control vehicle tone generation (buzzer). - System ID - Component ID - tune in board specific format - - tune extension (appended to tune) - - - Information about a camera. Can be requested with a MAV_CMD_REQUEST_MESSAGE command. - Timestamp (time since system boot). - Name of the camera vendor - Name of the camera model - Version of the camera firmware, encoded as: (Dev & 0xff) << 24 | (Patch & 0xff) << 16 | (Minor & 0xff) << 8 | (Major & 0xff) - Focal length - Image sensor size horizontal - Image sensor size vertical - Horizontal image resolution - Vertical image resolution - Reserved for a lens ID - Bitmap of camera capability flags. - Camera definition version (iteration) - Camera definition URI (if any, otherwise only basic functions will be available). HTTP- (http://) and MAVLink FTP- (mavlinkftp://) formatted URIs are allowed (and both must be supported by any GCS that implements the Camera Protocol). - - - Settings of a camera. Can be requested with a MAV_CMD_REQUEST_MESSAGE command. - Timestamp (time since system boot). - Camera mode - - Current zoom level (0.0 to 100.0, NaN if not known) - Current focus level (0.0 to 100.0, NaN if not known) - - - Information about a storage medium. This message is sent in response to a request with MAV_CMD_REQUEST_MESSAGE and whenever the status of the storage changes (STORAGE_STATUS). Use MAV_CMD_REQUEST_MESSAGE.param2 to indicate the index/id of requested storage: 0 for all, 1 for first, 2 for second, etc. - Timestamp (time since system boot). - Storage ID (1 for first, 2 for second, etc.) - Number of storage devices - Status of storage - Total capacity. If storage is not ready (STORAGE_STATUS_READY) value will be ignored. - Used capacity. If storage is not ready (STORAGE_STATUS_READY) value will be ignored. - Available storage capacity. If storage is not ready (STORAGE_STATUS_READY) value will be ignored. - Read speed. - Write speed. - - Type of storage - Textual storage name to be used in UI (microSD 1, Internal Memory, etc.) This is a NULL terminated string. If it is exactly 32 characters long, add a terminating NULL. If this string is empty, the generic type is shown to the user. - - - Information about the status of a capture. Can be requested with a MAV_CMD_REQUEST_MESSAGE command. - Timestamp (time since system boot). - Current status of image capturing (0: idle, 1: capture in progress, 2: interval set but idle, 3: interval set and capture in progress) - Current status of video capturing (0: idle, 1: capture in progress) - Image capture interval - Time since recording started - Available storage capacity. - - Total number of images captured ('forever', or until reset using MAV_CMD_STORAGE_FORMAT). - - - Information about a captured image. This is emitted every time a message is captured. It may be re-requested using MAV_CMD_REQUEST_MESSAGE, using param2 to indicate the sequence number for the missing image. - Timestamp (time since system boot). - Timestamp (time since UNIX epoch) in UTC. 0 for unknown. - Deprecated/unused. Component IDs are used to differentiate multiple cameras. - Latitude where image was taken - Longitude where capture was taken - Altitude (MSL) where image was taken - Altitude above ground - Quaternion of camera orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0) - Zero based index of this image (i.e. a new image will have index CAMERA_CAPTURE_STATUS.image count -1) - Boolean indicating success (1) or failure (0) while capturing this image. - URL of image taken. Either local storage or http://foo.jpg if camera provides an HTTP interface. - - - Information about flight since last arming. - Timestamp (time since system boot). - Timestamp at arming (time since UNIX epoch) in UTC, 0 for unknown - Timestamp at takeoff (time since UNIX epoch) in UTC, 0 for unknown - Universally unique identifier (UUID) of flight, should correspond to name of log files - - - This message is being superseded by MAV_CMD_DO_GIMBAL_MANAGER_PITCHYAW. The message can still be used to communicate with legacy gimbals implementing it. - Orientation of a mount - Timestamp (time since system boot). - Roll in global frame (set to NaN for invalid). - Pitch in global frame (set to NaN for invalid). - Yaw relative to vehicle (set to NaN for invalid). - - Yaw in absolute frame relative to Earth's North, north is 0 (set to NaN for invalid). - - - A message containing logged data (see also MAV_CMD_LOGGING_START) - system ID of the target - component ID of the target - sequence number (can wrap) - data length - offset into data where first message starts. This can be used for recovery, when a previous message got lost (set to 255 if no start exists). - logged data - - - A message containing logged data which requires a LOGGING_ACK to be sent back - system ID of the target - component ID of the target - sequence number (can wrap) - data length - offset into data where first message starts. This can be used for recovery, when a previous message got lost (set to 255 if no start exists). - logged data - - - An ack for a LOGGING_DATA_ACKED message - system ID of the target - component ID of the target - sequence number (must match the one in LOGGING_DATA_ACKED) - - - Information about video stream. It may be requested using MAV_CMD_REQUEST_MESSAGE, where param2 indicates the video stream id: 0 for all streams, 1 for first, 2 for second, etc. - Video Stream ID (1 for first, 2 for second, etc.) - Number of streams available. - Type of stream. - Bitmap of stream status flags. - Frame rate. - Horizontal resolution. - Vertical resolution. - Bit rate. - Video image rotation clockwise. - Horizontal Field of view. - Stream name. - Video stream URI (TCP or RTSP URI ground station should connect to) or port number (UDP port ground station should listen to). - - - Information about the status of a video stream. It may be requested using MAV_CMD_REQUEST_MESSAGE. - Video Stream ID (1 for first, 2 for second, etc.) - Bitmap of stream status flags - Frame rate - Horizontal resolution - Vertical resolution - Bit rate - Video image rotation clockwise - Horizontal Field of view - - - - - Information about the field of view of a camera. Can be requested with a MAV_CMD_REQUEST_MESSAGE command. - Timestamp (time since system boot). - Latitude of camera (INT32_MAX if unknown). - Longitude of camera (INT32_MAX if unknown). - Altitude (MSL) of camera (INT32_MAX if unknown). - Latitude of center of image (INT32_MAX if unknown, INT32_MIN if at infinity, not intersecting with horizon). - Longitude of center of image (INT32_MAX if unknown, INT32_MIN if at infinity, not intersecting with horizon). - Altitude (MSL) of center of image (INT32_MAX if unknown, INT32_MIN if at infinity, not intersecting with horizon). - Quaternion of camera orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0) - Horizontal field of view (NaN if unknown). - Vertical field of view (NaN if unknown). - - - - - Camera tracking status, sent while in active tracking. Use MAV_CMD_SET_MESSAGE_INTERVAL to define message interval. - Current tracking status - Current tracking mode - Defines location of target data - Current tracked point x value if CAMERA_TRACKING_MODE_POINT (normalized 0..1, 0 is left, 1 is right), NAN if unknown - Current tracked point y value if CAMERA_TRACKING_MODE_POINT (normalized 0..1, 0 is top, 1 is bottom), NAN if unknown - Current tracked radius if CAMERA_TRACKING_MODE_POINT (normalized 0..1, 0 is image left, 1 is image right), NAN if unknown - Current tracked rectangle top x value if CAMERA_TRACKING_MODE_RECTANGLE (normalized 0..1, 0 is left, 1 is right), NAN if unknown - Current tracked rectangle top y value if CAMERA_TRACKING_MODE_RECTANGLE (normalized 0..1, 0 is top, 1 is bottom), NAN if unknown - Current tracked rectangle bottom x value if CAMERA_TRACKING_MODE_RECTANGLE (normalized 0..1, 0 is left, 1 is right), NAN if unknown - Current tracked rectangle bottom y value if CAMERA_TRACKING_MODE_RECTANGLE (normalized 0..1, 0 is top, 1 is bottom), NAN if unknown - - - - - Camera tracking status, sent while in active tracking. Use MAV_CMD_SET_MESSAGE_INTERVAL to define message interval. - Current tracking status - Latitude of tracked object - Longitude of tracked object - Altitude of tracked object(AMSL, WGS84) - Horizontal accuracy. NAN if unknown - Vertical accuracy. NAN if unknown - North velocity of tracked object. NAN if unknown - East velocity of tracked object. NAN if unknown - Down velocity of tracked object. NAN if unknown - Velocity accuracy. NAN if unknown - Distance between camera and tracked object. NAN if unknown - Heading in radians, in NED. NAN if unknown - Accuracy of heading, in NED. NAN if unknown - - - - - Information about a high level gimbal manager. This message should be requested by a ground station using MAV_CMD_REQUEST_MESSAGE. - Timestamp (time since system boot). - Bitmap of gimbal capability flags. - Gimbal device ID that this gimbal manager is responsible for. - Minimum hardware roll angle (positive: rolling to the right, negative: rolling to the left) - Maximum hardware roll angle (positive: rolling to the right, negative: rolling to the left) - Minimum pitch angle (positive: up, negative: down) - Maximum pitch angle (positive: up, negative: down) - Minimum yaw angle (positive: to the right, negative: to the left) - Maximum yaw angle (positive: to the right, negative: to the left) - - - - - Current status about a high level gimbal manager. This message should be broadcast at a low regular rate (e.g. 5Hz). - Timestamp (time since system boot). - High level gimbal manager flags currently applied. - Gimbal device ID that this gimbal manager is responsible for. - System ID of MAVLink component with primary control, 0 for none. - Component ID of MAVLink component with primary control, 0 for none. - System ID of MAVLink component with secondary control, 0 for none. - Component ID of MAVLink component with secondary control, 0 for none. - - - - - High level message to control a gimbal's attitude. This message is to be sent to the gimbal manager (e.g. from a ground station). Angles and rates can be set to NaN according to use case. - System ID - Component ID - High level gimbal manager flags to use. - Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals). - Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation, the frame is depends on whether the flag GIMBAL_MANAGER_FLAGS_YAW_LOCK is set) - X component of angular velocity, positive is rolling to the right, NaN to be ignored. - Y component of angular velocity, positive is pitching up, NaN to be ignored. - Z component of angular velocity, positive is yawing to the right, NaN to be ignored. - - - - - Information about a low level gimbal. This message should be requested by the gimbal manager or a ground station using MAV_CMD_REQUEST_MESSAGE. The maximum angles and rates are the limits by hardware. However, the limits by software used are likely different/smaller and dependent on mode/settings/etc.. - Timestamp (time since system boot). - Name of the gimbal vendor. - Name of the gimbal model. - Custom name of the gimbal given to it by the user. - Version of the gimbal firmware, encoded as: (Dev & 0xff) << 24 | (Patch & 0xff) << 16 | (Minor & 0xff) << 8 | (Major & 0xff). - Version of the gimbal hardware, encoded as: (Dev & 0xff) << 24 | (Patch & 0xff) << 16 | (Minor & 0xff) << 8 | (Major & 0xff). - UID of gimbal hardware (0 if unknown). - Bitmap of gimbal capability flags. - Bitmap for use for gimbal-specific capability flags. - Minimum hardware roll angle (positive: rolling to the right, negative: rolling to the left) - Maximum hardware roll angle (positive: rolling to the right, negative: rolling to the left) - Minimum hardware pitch angle (positive: up, negative: down) - Maximum hardware pitch angle (positive: up, negative: down) - Minimum hardware yaw angle (positive: to the right, negative: to the left) - Maximum hardware yaw angle (positive: to the right, negative: to the left) - - - - - Low level message to control a gimbal device's attitude. This message is to be sent from the gimbal manager to the gimbal device component. Angles and rates can be set to NaN according to use case. - System ID - Component ID - Low level gimbal flags. - Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation, the frame is depends on whether the flag GIMBAL_DEVICE_FLAGS_YAW_LOCK is set, set all fields to NaN if only angular velocity should be used) - X component of angular velocity, positive is rolling to the right, NaN to be ignored. - Y component of angular velocity, positive is pitching up, NaN to be ignored. - Z component of angular velocity, positive is yawing to the right, NaN to be ignored. - - - - - Message reporting the status of a gimbal device. This message should be broadcasted by a gimbal device component. The angles encoded in the quaternion are in the global frame (roll: positive is rolling to the right, pitch: positive is pitching up, yaw is turn to the right). This message should be broadcast at a low regular rate (e.g. 10Hz). - System ID - Component ID - Timestamp (time since system boot). - Current gimbal flags set. - Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation, the frame is depends on whether the flag GIMBAL_DEVICE_FLAGS_YAW_LOCK is set) - X component of angular velocity (NaN if unknown) - Y component of angular velocity (NaN if unknown) - Z component of angular velocity (NaN if unknown) - Failure flags (0 for no failure) - - - - - Low level message containing autopilot state relevant for a gimbal device. This message is to be sent from the gimbal manager to the gimbal device component. The data of this message server for the gimbal's estimator corrections in particular horizon compensation, as well as the autopilot's control intention e.g. feed forward angular control in z-axis. - System ID - Component ID - Timestamp (time since system boot). - Quaternion components of autopilot attitude: w, x, y, z (1 0 0 0 is the null-rotation, Hamilton convention). - Estimated delay of the attitude data. - X Speed in NED (North, East, Down). - Y Speed in NED (North, East, Down). - Z Speed in NED (North, East, Down). - Estimated delay of the speed data. - Feed forward Z component of angular velocity, positive is yawing to the right, NaN to be ignored. This is to indicate if the autopilot is actively yawing. - Bitmap indicating which estimator outputs are valid. - The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown. - - - - - High level message to control a gimbal's pitch and yaw angles. This message is to be sent to the gimbal manager (e.g. from a ground station). Angles and rates can be set to NaN according to use case. - System ID - Component ID - High level gimbal manager flags to use. - Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals). - Pitch angle (positive: up, negative: down, NaN to be ignored). - Yaw angle (positive: to the right, negative: to the left, NaN to be ignored). - Pitch angular rate (positive: up, negative: down, NaN to be ignored). - Yaw angular rate (positive: to the right, negative: to the left, NaN to be ignored). - - - - - High level message to control a gimbal manually. The angles or angular rates are unitless; the actual rates will depend on internal gimbal manager settings/configuration (e.g. set by parameters). This message is to be sent to the gimbal manager (e.g. from a ground station). Angles and rates can be set to NaN according to use case. - System ID - Component ID - High level gimbal manager flags. - Component ID of gimbal device to address (or 1-6 for non-MAVLink gimbal), 0 for all gimbal device components. Send command multiple times for more than one gimbal (but not all gimbals). - Pitch angle unitless (-1..1, positive: up, negative: down, NaN to be ignored). - Yaw angle unitless (-1..1, positive: to the right, negative: to the left, NaN to be ignored). - Pitch angular rate unitless (-1..1, positive: up, negative: down, NaN to be ignored). - Yaw angular rate unitless (-1..1, positive: to the right, negative: to the left, NaN to be ignored). - - - - - ESC information for lower rate streaming. Recommended streaming rate 1Hz. See ESC_STATUS for higher-rate ESC data. - Index of the first ESC in this message. minValue = 0, maxValue = 60, increment = 4. - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude the number. - Counter of data packets received. - Total number of ESCs in all messages of this type. Message fields with an index higher than this should be ignored because they contain invalid data. - Connection type protocol for all ESC. - Information regarding online/offline status of each ESC. - Bitmap of ESC failure flags. - Number of reported errors by each ESC since boot. - Temperature measured by each ESC. UINT8_MAX if data not supplied by ESC. - - - - - ESC information for higher rate streaming. Recommended streaming rate is ~10 Hz. Information that changes more slowly is sent in ESC_INFO. It should typically only be streamed on high-bandwidth links (i.e. to a companion computer). - Index of the first ESC in this message. minValue = 0, maxValue = 60, increment = 4. - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude the number. - Reported motor RPM from each ESC (negative for reverse rotation). - Voltage measured from each ESC. - Current measured from each ESC. - - - Configure WiFi AP SSID, password, and mode. This message is re-emitted as an acknowledgement by the AP. The message may also be explicitly requested using MAV_CMD_REQUEST_MESSAGE - Name of Wi-Fi network (SSID). Blank to leave it unchanged when setting. Current SSID when sent back as a response. - Password. Blank for an open AP. MD5 hash when message is sent back as a response. - - WiFi Mode. - Message acceptance response (sent back to GS). - - - - - The location and information of an AIS vessel - Mobile Marine Service Identifier, 9 decimal digits - Latitude - Longitude - Course over ground - True heading - Speed over ground - Turn rate - Navigational status - Type of vessels - Distance from lat/lon location to bow - Distance from lat/lon location to stern - Distance from lat/lon location to port side - Distance from lat/lon location to starboard side - The vessel callsign - The vessel name - Time since last communication in seconds - Bitmask to indicate various statuses including valid data fields - - - - General status information of an UAVCAN node. Please refer to the definition of the UAVCAN message "uavcan.protocol.NodeStatus" for the background information. The UAVCAN specification is available at http://uavcan.org. - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - Time since the start-up of the node. - Generalized node health status. - Generalized operating mode. - Not used currently. - Vendor-specific status information. - - - General information describing a particular UAVCAN node. Please refer to the definition of the UAVCAN service "uavcan.protocol.GetNodeInfo" for the background information. This message should be emitted by the system whenever a new node appears online, or an existing node reboots. Additionally, it can be emitted upon request from the other end of the MAVLink channel (see MAV_CMD_UAVCAN_GET_NODE_INFO). It is also not prohibited to emit this message unconditionally at a low frequency. The UAVCAN specification is available at http://uavcan.org. - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - Time since the start-up of the node. - Node name string. For example, "sapog.px4.io". - Hardware major version number. - Hardware minor version number. - Hardware unique 128-bit ID. - Software major version number. - Software minor version number. - Version control system (VCS) revision identifier (e.g. git short commit hash). Zero if unknown. - - - Request to read the value of a parameter with either the param_id string id or param_index. PARAM_EXT_VALUE should be emitted in response. - System ID - Component ID - Parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string - Parameter index. Set to -1 to use the Parameter ID field as identifier (else param_id will be ignored) - - - Request all parameters of this component. All parameters should be emitted in response as PARAM_EXT_VALUE. - System ID - Component ID - - - Emit the value of a parameter. The inclusion of param_count and param_index in the message allows the recipient to keep track of received parameters and allows them to re-request missing parameters after a loss or timeout. - Parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string - Parameter value - Parameter type. - Total number of parameters - Index of this parameter - - - Set a parameter value. In order to deal with message loss (and retransmission of PARAM_EXT_SET), when setting a parameter value and the new value is the same as the current value, you will immediately get a PARAM_ACK_ACCEPTED response. If the current state is PARAM_ACK_IN_PROGRESS, you will accordingly receive a PARAM_ACK_IN_PROGRESS in response. - System ID - Component ID - Parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string - Parameter value - Parameter type. - - - Response from a PARAM_EXT_SET message. - Parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string - Parameter value (new value if PARAM_ACK_ACCEPTED, current value otherwise) - Parameter type. - Result code. - - - Obstacle distances in front of the sensor, starting from the left in increment degrees to the right - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - Class id of the distance sensor type. - Distance of obstacles around the vehicle with index 0 corresponding to north + angle_offset, unless otherwise specified in the frame. A value of 0 is valid and means that the obstacle is practically touching the sensor. A value of max_distance +1 means no obstacle is present. A value of UINT16_MAX for unknown/not used. In a array element, one unit corresponds to 1cm. - Angular width in degrees of each array element. Increment direction is clockwise. This field is ignored if increment_f is non-zero. - Minimum distance the sensor can measure. - Maximum distance the sensor can measure. - - Angular width in degrees of each array element as a float. If non-zero then this value is used instead of the uint8_t increment field. Positive is clockwise direction, negative is counter-clockwise. - Relative angle offset of the 0-index element in the distances array. Value of 0 corresponds to forward. Positive is clockwise direction, negative is counter-clockwise. - Coordinate frame of reference for the yaw rotation and offset of the sensor data. Defaults to MAV_FRAME_GLOBAL, which is north aligned. For body-mounted sensors use MAV_FRAME_BODY_FRD, which is vehicle front aligned. - - - Odometry message to communicate odometry information with an external interface. Fits ROS REP 147 standard for aerial vehicles (http://www.ros.org/reps/rep-0147.html). - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - Coordinate frame of reference for the pose data. - Coordinate frame of reference for the velocity in free space (twist) data. - X Position - Y Position - Z Position - Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation) - X linear speed - Y linear speed - Z linear speed - Roll angular speed - Pitch angular speed - Yaw angular speed - Row-major representation of a 6x6 pose cross-covariance matrix upper right triangle (states: x, y, z, roll, pitch, yaw; first six entries are the first ROW, next five entries are the second ROW, etc.). If unknown, assign NaN value to first element in the array. - Row-major representation of a 6x6 velocity cross-covariance matrix upper right triangle (states: vx, vy, vz, rollspeed, pitchspeed, yawspeed; first six entries are the first ROW, next five entries are the second ROW, etc.). If unknown, assign NaN value to first element in the array. - - Estimate reset counter. This should be incremented when the estimate resets in any of the dimensions (position, velocity, attitude, angular speed). This is designed to be used when e.g an external SLAM system detects a loop-closure and the estimate jumps. - Type of estimator that is providing the odometry. - - - Describe a trajectory using an array of up-to 5 waypoints in the local frame (MAV_FRAME_LOCAL_NED). - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - Number of valid points (up-to 5 waypoints are possible) - X-coordinate of waypoint, set to NaN if not being used - Y-coordinate of waypoint, set to NaN if not being used - Z-coordinate of waypoint, set to NaN if not being used - X-velocity of waypoint, set to NaN if not being used - Y-velocity of waypoint, set to NaN if not being used - Z-velocity of waypoint, set to NaN if not being used - X-acceleration of waypoint, set to NaN if not being used - Y-acceleration of waypoint, set to NaN if not being used - Z-acceleration of waypoint, set to NaN if not being used - Yaw angle, set to NaN if not being used - Yaw rate, set to NaN if not being used - Scheduled action for each waypoint, UINT16_MAX if not being used. - - - Describe a trajectory using an array of up-to 5 bezier control points in the local frame (MAV_FRAME_LOCAL_NED). - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - Number of valid control points (up-to 5 points are possible) - X-coordinate of bezier control points. Set to NaN if not being used - Y-coordinate of bezier control points. Set to NaN if not being used - Z-coordinate of bezier control points. Set to NaN if not being used - Bezier time horizon. Set to NaN if velocity/acceleration should not be incorporated - Yaw. Set to NaN for unchanged - - - - - Report current used cellular network status - Cellular modem status - Failure reason when status in in CELLUAR_STATUS_FAILED - Cellular network radio type: gsm, cdma, lte... - Signal quality in percent. If unknown, set to UINT8_MAX - Mobile country code. If unknown, set to UINT16_MAX - Mobile network code. If unknown, set to UINT16_MAX - Location area code. If unknown, set to 0 - - - Status of the Iridium SBD link. - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - Timestamp of the last successful sbd session. The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - Number of failed SBD sessions. - Number of successful SBD sessions. - Signal quality equal to the number of bars displayed on the ISU signal strength indicator. Range is 0 to 5, where 0 indicates no signal and 5 indicates maximum signal strength. - 1: Ring call pending, 0: No call pending. - 1: Transmission session pending, 0: No transmission session pending. - 1: Receiving session pending, 0: No receiving session pending. - - - - - Configure cellular modems. This message is re-emitted as an acknowledgement by the modem. The message may also be explicitly requested using MAV_CMD_REQUEST_MESSAGE. - Enable/disable LTE. 0: setting unchanged, 1: disabled, 2: enabled. Current setting when sent back as a response. - Enable/disable PIN on the SIM card. 0: setting unchanged, 1: disabled, 2: enabled. Current setting when sent back as a response. - PIN sent to the SIM card. Blank when PIN is disabled. Empty when message is sent back as a response. - New PIN when changing the PIN. Blank to leave it unchanged. Empty when message is sent back as a response. - Name of the cellular APN. Blank to leave it unchanged. Current APN when sent back as a response. - Required PUK code in case the user failed to authenticate 3 times with the PIN. Empty when message is sent back as a response. - Enable/disable roaming. 0: setting unchanged, 1: disabled, 2: enabled. Current setting when sent back as a response. - Message acceptance response (sent back to GS). - - - - - RPM sensor data message. - Index of this RPM sensor (0-indexed) - Indicated rate - - - The global position resulting from GPS and sensor fusion. - Time of applicability of position (microseconds since UNIX epoch). - Unique UAS ID. - Latitude (WGS84) - Longitude (WGS84) - Altitude (WGS84) - Altitude above ground - Ground X speed (latitude, positive north) - Ground Y speed (longitude, positive east) - Ground Z speed (altitude, positive down) - Horizontal position uncertainty (standard deviation) - Altitude uncertainty (standard deviation) - Speed uncertainty (standard deviation) - Next waypoint, latitude (WGS84) - Next waypoint, longitude (WGS84) - Next waypoint, altitude (WGS84) - Time until next update. Set to 0 if unknown or in data driven mode. - Flight state - Bitwise OR combination of the data available flags. - - - Large debug/prototyping array. The message uses the maximum available payload for data. The array_id and name fields are used to discriminate between messages in code and in user interfaces (respectively). Do not use in production code. - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - Name, for human-friendly display in a Ground Control Station - Unique ID used to discriminate between arrays - - data - - - - - Vehicle status report that is sent out while orbit execution is in progress (see MAV_CMD_DO_ORBIT). - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - Radius of the orbit circle. Positive values orbit clockwise, negative values orbit counter-clockwise. - The coordinate system of the fields: x, y, z. - X coordinate of center point. Coordinate system depends on frame field: local = x position in meters * 1e4, global = latitude in degrees * 1e7. - Y coordinate of center point. Coordinate system depends on frame field: local = x position in meters * 1e4, global = latitude in degrees * 1e7. - Altitude of center point. Coordinate system depends on frame field. - - - - - - Smart Battery information (static/infrequent update). Use for updates from: smart battery to flight stack, flight stack to GCS. Use BATTERY_STATUS for smart battery frequent updates. - Battery ID - Function of the battery - Type (chemistry) of the battery - Capacity when full according to manufacturer, -1: field not provided. - Capacity when full (accounting for battery degradation), -1: field not provided. - Charge/discharge cycle count. UINT16_MAX: field not provided. - Serial number in ASCII characters, 0 terminated. All 0: field not provided. - Static device name. Encode as manufacturer and product names separated using an underscore. - Battery weight. 0: field not provided. - Minimum per-cell voltage when discharging. If not supplied set to UINT16_MAX value. - Minimum per-cell voltage when charging. If not supplied set to UINT16_MAX value. - Minimum per-cell voltage when resting. If not supplied set to UINT16_MAX value. - - - Telemetry of power generation system. Alternator or mechanical generator. - Status flags. - Speed of electrical generator or alternator. UINT16_MAX: field not provided. - Current into/out of battery. Positive for out. Negative for in. NaN: field not provided. - Current going to the UAV. If battery current not available this is the DC current from the generator. Positive for out. Negative for in. NaN: field not provided - The power being generated. NaN: field not provided - Voltage of the bus seen at the generator, or battery bus if battery bus is controlled by generator and at a different voltage to main bus. - The temperature of the rectifier or power converter. INT16_MAX: field not provided. - The target battery current. Positive for out. Negative for in. NaN: field not provided - The temperature of the mechanical motor, fuel cell core or generator. INT16_MAX: field not provided. - Seconds this generator has run since it was rebooted. UINT32_MAX: field not provided. - Seconds until this generator requires maintenance. A negative value indicates maintenance is past-due. INT32_MAX: field not provided. - - - The raw values of the actuator outputs (e.g. on Pixhawk, from MAIN, AUX ports). This message supersedes SERVO_OUTPUT_RAW. - Timestamp (since system boot). - Active outputs - Servo / motor output array values. Zero values indicate unused channels. - - - - - Time/duration estimates for various events and actions given the current vehicle state and position. - Estimated time to complete the vehicle's configured "safe return" action from its current position (e.g. RTL, Smart RTL, etc.). -1 indicates that the vehicle is landed, or that no time estimate available. - Estimated time for vehicle to complete the LAND action from its current position. -1 indicates that the vehicle is landed, or that no time estimate available. - Estimated time for reaching/completing the currently active mission item. -1 means no time estimate available. - Estimated time for completing the current mission. -1 means no mission active and/or no estimate available. - Estimated time for completing the current commanded action (i.e. Go To, Takeoff, Land, etc.). -1 means no action active and/or no estimate available. - - - - - Message for transporting "arbitrary" variable-length data from one component to another (broadcast is not forbidden, but discouraged). The encoding of the data is usually extension specific, i.e. determined by the source, and is usually not documented as part of the MAVLink specification. - System ID (can be 0 for broadcast, but this is discouraged) - Component ID (can be 0 for broadcast, but this is discouraged) - A code that identifies the content of the payload (0 for unknown, which is the default). If this code is less than 32768, it is a 'registered' payload type and the corresponding code should be added to the MAV_TUNNEL_PAYLOAD_TYPE enum. Software creators can register blocks of types as needed. Codes greater than 32767 are considered local experiments and should not be checked in to any widely distributed codebase. - Length of the data transported in payload - Variable length payload. The payload length is defined by payload_length. The entire content of this block is opaque unless you understand the encoding specified by payload_type. - - - - - Hardware status sent by an onboard computer. - Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. - Time since system boot. - Type of the onboard computer: 0: Mission computer primary, 1: Mission computer backup 1, 2: Mission computer backup 2, 3: Compute node, 4-5: Compute spares, 6-9: Payload computers. - CPU usage on the component in percent (100 - idle). A value of UINT8_MAX implies the field is unused. - Combined CPU usage as the last 10 slices of 100 MS (a histogram). This allows to identify spikes in load that max out the system, but only for a short amount of time. A value of UINT8_MAX implies the field is unused. - GPU usage on the component in percent (100 - idle). A value of UINT8_MAX implies the field is unused. - Combined GPU usage as the last 10 slices of 100 MS (a histogram). This allows to identify spikes in load that max out the system, but only for a short amount of time. A value of UINT8_MAX implies the field is unused. - Temperature of the board. A value of INT8_MAX implies the field is unused. - Temperature of the CPU core. A value of INT8_MAX implies the field is unused. - Fan speeds. A value of INT16_MAX implies the field is unused. - Amount of used RAM on the component system. A value of UINT32_MAX implies the field is unused. - Total amount of RAM on the component system. A value of UINT32_MAX implies the field is unused. - Storage type: 0: HDD, 1: SSD, 2: EMMC, 3: SD card (non-removable), 4: SD card (removable). A value of UINT32_MAX implies the field is unused. - Amount of used storage space on the component system. A value of UINT32_MAX implies the field is unused. - Total amount of storage space on the component system. A value of UINT32_MAX implies the field is unused. - Link type: 0-9: UART, 10-19: Wired network, 20-29: Wifi, 30-39: Point-to-point proprietary, 40-49: Mesh proprietary - Network traffic from the component system. A value of UINT32_MAX implies the field is unused. - Network traffic to the component system. A value of UINT32_MAX implies the field is unused. - Network capacity from the component system. A value of UINT32_MAX implies the field is unused. - Network capacity to the component system. A value of UINT32_MAX implies the field is unused. - - - - - Information about a component. For camera components instead use CAMERA_INFORMATION, and for autopilots use AUTOPILOT_VERSION. Components including GCSes should consider supporting requests of this message via MAV_CMD_REQUEST_MESSAGE. - Timestamp (time since system boot). - The type of metadata being requested. - Unique uid for this metadata which a gcs can use for created cached metadata and understanding whether it's cache it up to date or whether it needs to download new data. - Component definition URI. If prefix mavlinkftp:// file is downloaded from vehicle over mavlink ftp protocol. If prefix http[s]:// file is downloaded over internet. Files are json format. They can end in .gz to indicate file is in gzip format. - Unique uid for the translation file associated with the metadata. - The translations for strings within the metadata file. If null the either do not exist or may be included in the metadata file itself. The translations specified here supercede any which may be in the metadata file itself. The uri format is the same as component_metadata_uri . Files are in Json Translation spec format. Empty string indicates no tranlsation file. - - - Play vehicle tone/tune (buzzer). Supersedes message PLAY_TUNE. - System ID - Component ID - Tune format - Tune definition as a NULL-terminated string. - - - - - Tune formats supported by vehicle. This should be emitted as response to MAV_CMD_REQUEST_MESSAGE. - System ID - Component ID - Bitfield of supported tune formats. - - - - Cumulative distance traveled for each reported wheel. - Timestamp (synced to UNIX time or since system boot). - Number of wheels reported. - Distance reported by individual wheel encoders. Forward rotations increase values, reverse rotations decrease them. Not all wheels will necessarily have wheel encoders; the mapping of encoders to wheel positions must be agreed/understood by the endpoints. - - - - - Winch status. - Timestamp (synced to UNIX time or since system boot). - Length of line released. NaN if unknown - Speed line is being released or retracted. Positive values if being released, negative values if being retracted, NaN if unknown - Tension on the line. NaN if unknown - Voltage of the battery supplying the winch. NaN if unknown - Current draw from the winch. NaN if unknown - Temperature of the motor. INT16_MAX if unknown - Status flags - - - - - Data for filling the OpenDroneID Basic ID message. This and the below messages are primarily meant for feeding data to/from an OpenDroneID implementation. E.g. https://github.com/opendroneid/opendroneid-core-c. These messages are compatible with the ASTM Remote ID standard at https://www.astm.org/Standards/F3411.htm and the ASD-STAN Direct Remote ID standard. The usage of these messages is documented at https://mavlink.io/en/services/opendroneid.html. - System ID (0 for broadcast). - Component ID (0 for broadcast). - Only used for drone ID data received from other UAs. See detailed description at https://mavlink.io/en/services/opendroneid.html. - Indicates the format for the uas_id field of this message. - Indicates the type of UA (Unmanned Aircraft). - UAS (Unmanned Aircraft System) ID following the format specified by id_type. Shall be filled with nulls in the unused portion of the field. - - - - - Data for filling the OpenDroneID Location message. The float data types are 32-bit IEEE 754. The Location message provides the location, altitude, direction and speed of the aircraft. - System ID (0 for broadcast). - Component ID (0 for broadcast). - Only used for drone ID data received from other UAs. See detailed description at https://mavlink.io/en/services/opendroneid.html. - Indicates whether the unmanned aircraft is on the ground or in the air. - Direction over ground (not heading, but direction of movement) measured clockwise from true North: 0 - 35999 centi-degrees. If unknown: 36100 centi-degrees. - Ground speed. Positive only. If unknown: 25500 cm/s. If speed is larger than 25425 cm/s, use 25425 cm/s. - The vertical speed. Up is positive. If unknown: 6300 cm/s. If speed is larger than 6200 cm/s, use 6200 cm/s. If lower than -6200 cm/s, use -6200 cm/s. - Current latitude of the unmanned aircraft. If unknown: 0 (both Lat/Lon). - Current longitude of the unmanned aircraft. If unknown: 0 (both Lat/Lon). - The altitude calculated from the barometric pressue. Reference is against 29.92inHg or 1013.2mb. If unknown: -1000 m. - The geodetic altitude as defined by WGS84. If unknown: -1000 m. - Indicates the reference point for the height field. - The current height of the unmanned aircraft above the take-off location or the ground as indicated by height_reference. If unknown: -1000 m. - The accuracy of the horizontal position. - The accuracy of the vertical position. - The accuracy of the barometric altitude. - The accuracy of the horizontal and vertical speed. - Seconds after the full hour with reference to UTC time. Typically the GPS outputs a time-of-week value in milliseconds. First convert that to UTC and then convert for this field using ((float) (time_week_ms % (60*60*1000))) / 1000. - The accuracy of the timestamps. - - - - - Data for filling the OpenDroneID Authentication message. The Authentication Message defines a field that can provide a means of authenticity for the identity of the UAS (Unmanned Aircraft System). The Authentication message can have two different formats. Five data pages are supported. For data page 0, the fields PageCount, Length and TimeStamp are present and AuthData is only 17 bytes. For data page 1 through 4, PageCount, Length and TimeStamp are not present and the size of AuthData is 23 bytes. - System ID (0 for broadcast). - Component ID (0 for broadcast). - Only used for drone ID data received from other UAs. See detailed description at https://mavlink.io/en/services/opendroneid.html. - Indicates the type of authentication. - Allowed range is 0 - 4. - This field is only present for page 0. Allowed range is 0 - 5. - This field is only present for page 0. Total bytes of authentication_data from all data pages. Allowed range is 0 - 109 (17 + 23*4). - This field is only present for page 0. 32 bit Unix Timestamp in seconds since 00:00:00 01/01/2019. - Opaque authentication data. For page 0, the size is only 17 bytes. For other pages, the size is 23 bytes. Shall be filled with nulls in the unused portion of the field. - - - - - Data for filling the OpenDroneID Self ID message. The Self ID Message is an opportunity for the operator to (optionally) declare their identity and purpose of the flight. This message can provide additional information that could reduce the threat profile of a UA (Unmanned Aircraft) flying in a particular area or manner. - System ID (0 for broadcast). - Component ID (0 for broadcast). - Only used for drone ID data received from other UAs. See detailed description at https://mavlink.io/en/services/opendroneid.html. - Indicates the type of the description field. - Text description or numeric value expressed as ASCII characters. Shall be filled with nulls in the unused portion of the field. - - - - - Data for filling the OpenDroneID System message. The System Message contains general system information including the operator location and possible aircraft group information. - System ID (0 for broadcast). - Component ID (0 for broadcast). - Only used for drone ID data received from other UAs. See detailed description at https://mavlink.io/en/services/opendroneid.html. - Specifies the operator location type. - Specifies the classification type of the UA. - Latitude of the operator. If unknown: 0 (both Lat/Lon). - Longitude of the operator. If unknown: 0 (both Lat/Lon). - Number of aircraft in the area, group or formation (default 1). - Radius of the cylindrical area of the group or formation (default 0). - Area Operations Ceiling relative to WGS84. If unknown: -1000 m. - Area Operations Floor relative to WGS84. If unknown: -1000 m. - When classification_type is MAV_ODID_CLASSIFICATION_TYPE_EU, specifies the category of the UA. - When classification_type is MAV_ODID_CLASSIFICATION_TYPE_EU, specifies the class of the UA. - - - - - Data for filling the OpenDroneID Operator ID message, which contains the CAA (Civil Aviation Authority) issued operator ID. - System ID (0 for broadcast). - Component ID (0 for broadcast). - Only used for drone ID data received from other UAs. See detailed description at https://mavlink.io/en/services/opendroneid.html. - Indicates the type of the operator_id field. - Text description or numeric value expressed as ASCII characters. Shall be filled with nulls in the unused portion of the field. - - - - - - An OpenDroneID message pack is a container for multiple encoded OpenDroneID messages (i.e. not in the format given for the above messages descriptions but after encoding into the compressed OpenDroneID byte format). Used e.g. when transmitting on Bluetooth 5.0 Long Range/Extended Advertising or on WiFi Neighbor Aware Networking. - System ID (0 for broadcast). - Component ID (0 for broadcast). - This field must currently always be equal to 25 (bytes), since all encoded OpenDroneID messages are specificed to have this length. - Number of encoded messages in the pack (not the number of bytes). Allowed range is 1 - 10. - Concatenation of encoded OpenDroneID messages. Shall be filled with nulls in the unused portion of the field. - - - diff --git a/message_definitions/icarous.xml b/message_definitions/icarous.xml deleted file mode 100644 index 7dbdb95eb..000000000 --- a/message_definitions/icarous.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - ICAROUS heartbeat - See the FMS_STATE enum. - - - Kinematic multi bands (track) output from Daidalus - Number of track bands - See the TRACK_BAND_TYPES enum. - min angle (degrees) - max angle (degrees) - See the TRACK_BAND_TYPES enum. - min angle (degrees) - max angle (degrees) - See the TRACK_BAND_TYPES enum. - min angle (degrees) - max angle (degrees) - See the TRACK_BAND_TYPES enum. - min angle (degrees) - max angle (degrees) - See the TRACK_BAND_TYPES enum. - min angle (degrees) - max angle (degrees) - - - diff --git a/message_definitions/matrixpilot.xml b/message_definitions/matrixpilot.xml deleted file mode 100644 index e3c4996c6..000000000 --- a/message_definitions/matrixpilot.xml +++ /dev/null @@ -1,349 +0,0 @@ - - - common.xml - - - - Action required when performing CMD_PREFLIGHT_STORAGE - - Read all parameters from storage - - - Write all parameters to storage - - - Clear all parameters in storage - - - Read specific parameters from storage - - - Write specific parameters to storage - - - Clear specific parameters in storage - - - do nothing - - - - - Request storage of different parameter values and logs. This command will be only accepted if in pre-flight mode. - Storage action: Action defined by MAV_PREFLIGHT_STORAGE_ACTION_ADVANCED - Storage area as defined by parameter database - Storage flags as defined by parameter database - Empty - Empty - Empty - Empty - - - - - - Depreciated but used as a compiler flag. Do not remove - System ID - Component ID - - - Reqest reading of flexifunction data - System ID - Component ID - Type of flexifunction data requested - index into data where needed - - - Flexifunction type and parameters for component at function index from buffer - System ID - Component ID - Function index - Total count of functions - Address in the flexifunction data, Set to 0xFFFF to use address in target memory - Size of the - Settings data - - - Flexifunction type and parameters for component at function index from buffer - System ID - Component ID - Function index - result of acknowledge, 0=fail, 1=good - - - Acknowldge sucess or failure of a flexifunction command - System ID - Component ID - 0=inputs, 1=outputs - index of first directory entry to write - count of directory entries to write - Settings data - - - Acknowldge sucess or failure of a flexifunction command - System ID - Component ID - 0=inputs, 1=outputs - index of first directory entry to write - count of directory entries to write - result of acknowledge, 0=fail, 1=good - - - Acknowldge sucess or failure of a flexifunction command - System ID - Component ID - Flexifunction command type - - - Acknowldge sucess or failure of a flexifunction command - Command acknowledged - result of acknowledge - - - Backwards compatible MAVLink version of SERIAL_UDB_EXTRA - F2: Format Part A - Serial UDB Extra Time - Serial UDB Extra Status - Serial UDB Extra Latitude - Serial UDB Extra Longitude - Serial UDB Extra Altitude - Serial UDB Extra Waypoint Index - Serial UDB Extra Rmat 0 - Serial UDB Extra Rmat 1 - Serial UDB Extra Rmat 2 - Serial UDB Extra Rmat 3 - Serial UDB Extra Rmat 4 - Serial UDB Extra Rmat 5 - Serial UDB Extra Rmat 6 - Serial UDB Extra Rmat 7 - Serial UDB Extra Rmat 8 - Serial UDB Extra GPS Course Over Ground - Serial UDB Extra Speed Over Ground - Serial UDB Extra CPU Load - Serial UDB Extra 3D IMU Air Speed - Serial UDB Extra Estimated Wind 0 - Serial UDB Extra Estimated Wind 1 - Serial UDB Extra Estimated Wind 2 - Serial UDB Extra Magnetic Field Earth 0 - Serial UDB Extra Magnetic Field Earth 1 - Serial UDB Extra Magnetic Field Earth 2 - Serial UDB Extra Number of Sattelites in View - Serial UDB Extra GPS Horizontal Dilution of Precision - - - Backwards compatible version of SERIAL_UDB_EXTRA - F2: Part B - Serial UDB Extra Time - Serial UDB Extra PWM Input Channel 1 - Serial UDB Extra PWM Input Channel 2 - Serial UDB Extra PWM Input Channel 3 - Serial UDB Extra PWM Input Channel 4 - Serial UDB Extra PWM Input Channel 5 - Serial UDB Extra PWM Input Channel 6 - Serial UDB Extra PWM Input Channel 7 - Serial UDB Extra PWM Input Channel 8 - Serial UDB Extra PWM Input Channel 9 - Serial UDB Extra PWM Input Channel 10 - Serial UDB Extra PWM Input Channel 11 - Serial UDB Extra PWM Input Channel 12 - Serial UDB Extra PWM Output Channel 1 - Serial UDB Extra PWM Output Channel 2 - Serial UDB Extra PWM Output Channel 3 - Serial UDB Extra PWM Output Channel 4 - Serial UDB Extra PWM Output Channel 5 - Serial UDB Extra PWM Output Channel 6 - Serial UDB Extra PWM Output Channel 7 - Serial UDB Extra PWM Output Channel 8 - Serial UDB Extra PWM Output Channel 9 - Serial UDB Extra PWM Output Channel 10 - Serial UDB Extra PWM Output Channel 11 - Serial UDB Extra PWM Output Channel 12 - Serial UDB Extra IMU Location X - Serial UDB Extra IMU Location Y - Serial UDB Extra IMU Location Z - Serial UDB Location Error Earth X - Serial UDB Location Error Earth Y - Serial UDB Location Error Earth Z - Serial UDB Extra Status Flags - Serial UDB Extra Oscillator Failure Count - Serial UDB Extra IMU Velocity X - Serial UDB Extra IMU Velocity Y - Serial UDB Extra IMU Velocity Z - Serial UDB Extra Current Waypoint Goal X - Serial UDB Extra Current Waypoint Goal Y - Serial UDB Extra Current Waypoint Goal Z - Aeroforce in UDB X Axis - Aeroforce in UDB Y Axis - Aeroforce in UDB Z axis - SUE barometer temperature - SUE barometer pressure - SUE barometer altitude - SUE battery voltage - SUE battery current - SUE battery milli amp hours used - Sue autopilot desired height - Serial UDB Extra Stack Memory Free - - - Backwards compatible version of SERIAL_UDB_EXTRA F4: format - Serial UDB Extra Roll Stabilization with Ailerons Enabled - Serial UDB Extra Roll Stabilization with Rudder Enabled - Serial UDB Extra Pitch Stabilization Enabled - Serial UDB Extra Yaw Stabilization using Rudder Enabled - Serial UDB Extra Yaw Stabilization using Ailerons Enabled - Serial UDB Extra Navigation with Ailerons Enabled - Serial UDB Extra Navigation with Rudder Enabled - Serial UDB Extra Type of Alitude Hold when in Stabilized Mode - Serial UDB Extra Type of Alitude Hold when in Waypoint Mode - Serial UDB Extra Firmware racing mode enabled - - - Backwards compatible version of SERIAL_UDB_EXTRA F5: format - Serial UDB YAWKP_AILERON Gain for Proporional control of navigation - Serial UDB YAWKD_AILERON Gain for Rate control of navigation - Serial UDB Extra ROLLKP Gain for Proportional control of roll stabilization - Serial UDB Extra ROLLKD Gain for Rate control of roll stabilization - - - Backwards compatible version of SERIAL_UDB_EXTRA F6: format - Serial UDB Extra PITCHGAIN Proportional Control - Serial UDB Extra Pitch Rate Control - Serial UDB Extra Rudder to Elevator Mix - Serial UDB Extra Roll to Elevator Mix - Gain For Boosting Manual Elevator control When Plane Stabilized - - - Backwards compatible version of SERIAL_UDB_EXTRA F7: format - Serial UDB YAWKP_RUDDER Gain for Proporional control of navigation - Serial UDB YAWKD_RUDDER Gain for Rate control of navigation - Serial UDB Extra ROLLKP_RUDDER Gain for Proportional control of roll stabilization - Serial UDB Extra ROLLKD_RUDDER Gain for Rate control of roll stabilization - SERIAL UDB EXTRA Rudder Boost Gain to Manual Control when stabilized - Serial UDB Extra Return To Landing - Angle to Pitch Plane Down - - - Backwards compatible version of SERIAL_UDB_EXTRA F8: format - Serial UDB Extra HEIGHT_TARGET_MAX - Serial UDB Extra HEIGHT_TARGET_MIN - Serial UDB Extra ALT_HOLD_THROTTLE_MIN - Serial UDB Extra ALT_HOLD_THROTTLE_MAX - Serial UDB Extra ALT_HOLD_PITCH_MIN - Serial UDB Extra ALT_HOLD_PITCH_MAX - Serial UDB Extra ALT_HOLD_PITCH_HIGH - - - Backwards compatible version of SERIAL_UDB_EXTRA F13: format - Serial UDB Extra GPS Week Number - Serial UDB Extra MP Origin Latitude - Serial UDB Extra MP Origin Longitude - Serial UDB Extra MP Origin Altitude Above Sea Level - - - Backwards compatible version of SERIAL_UDB_EXTRA F14: format - Serial UDB Extra Wind Estimation Enabled - Serial UDB Extra Type of GPS Unit - Serial UDB Extra Dead Reckoning Enabled - Serial UDB Extra Type of UDB Hardware - Serial UDB Extra Type of Airframe - Serial UDB Extra Reboot Register of DSPIC - Serial UDB Extra Last dspic Trap Flags - Serial UDB Extra Type Program Address of Last Trap - Serial UDB Extra Number of Ocillator Failures - Serial UDB Extra UDB Internal Clock Configuration - Serial UDB Extra Type of Flight Plan - - - Backwards compatible version of SERIAL_UDB_EXTRA F15 format - Serial UDB Extra Model Name Of Vehicle - Serial UDB Extra Registraton Number of Vehicle - - - Backwards compatible version of SERIAL_UDB_EXTRA F16 format - Serial UDB Extra Name of Expected Lead Pilot - Serial UDB Extra URL of Lead Pilot or Team - - - The altitude measured by sensors and IMU - Timestamp (milliseconds since system boot) - GPS altitude (MSL) in meters, expressed as * 1000 (millimeters) - IMU altitude above ground in meters, expressed as * 1000 (millimeters) - barometeric altitude above ground in meters, expressed as * 1000 (millimeters) - Optical flow altitude above ground in meters, expressed as * 1000 (millimeters) - Rangefinder Altitude above ground in meters, expressed as * 1000 (millimeters) - Extra altitude above ground in meters, expressed as * 1000 (millimeters) - - - The airspeed measured by sensors and IMU - Timestamp (milliseconds since system boot) - Airspeed estimate from IMU, cm/s - Pitot measured forward airpseed, cm/s - Hot wire anenometer measured airspeed, cm/s - Ultrasonic measured airspeed, cm/s - Angle of attack sensor, degrees * 10 - Yaw angle sensor, degrees * 10 - - - Backwards compatible version of SERIAL_UDB_EXTRA F17 format - SUE Feed Forward Gain - SUE Max Turn Rate when Navigating - SUE Max Turn Rate in Fly By Wire Mode - - - Backwards compatible version of SERIAL_UDB_EXTRA F18 format - SUE Angle of Attack Normal - SUE Angle of Attack Inverted - SUE Elevator Trim Normal - SUE Elevator Trim Inverted - SUE reference_speed - - - Backwards compatible version of SERIAL_UDB_EXTRA F19 format - SUE aileron output channel - SUE aileron reversed - SUE elevator output channel - SUE elevator reversed - SUE throttle output channel - SUE throttle reversed - SUE rudder output channel - SUE rudder reversed - - - Backwards compatible version of SERIAL_UDB_EXTRA F20 format - SUE Number of Input Channels - SUE UDB PWM Trim Value on Input 1 - SUE UDB PWM Trim Value on Input 2 - SUE UDB PWM Trim Value on Input 3 - SUE UDB PWM Trim Value on Input 4 - SUE UDB PWM Trim Value on Input 5 - SUE UDB PWM Trim Value on Input 6 - SUE UDB PWM Trim Value on Input 7 - SUE UDB PWM Trim Value on Input 8 - SUE UDB PWM Trim Value on Input 9 - SUE UDB PWM Trim Value on Input 10 - SUE UDB PWM Trim Value on Input 11 - SUE UDB PWM Trim Value on Input 12 - - - Backwards compatible version of SERIAL_UDB_EXTRA F21 format - SUE X accelerometer offset - SUE Y accelerometer offset - SUE Z accelerometer offset - SUE X gyro offset - SUE Y gyro offset - SUE Z gyro offset - - - Backwards compatible version of SERIAL_UDB_EXTRA F22 format - SUE X accelerometer at calibration time - SUE Y accelerometer at calibration time - SUE Z accelerometer at calibration time - SUE X gyro at calibration time - SUE Y gyro at calibration time - SUE Z gyro at calibration time - - - diff --git a/message_definitions/minimal.xml b/message_definitions/minimal.xml deleted file mode 100644 index df935fe58..000000000 --- a/message_definitions/minimal.xml +++ /dev/null @@ -1,675 +0,0 @@ - - - 3 - - - Micro air vehicle / autopilot classes. This identifies the individual model. - - Generic autopilot, full support for everything - - - Reserved for future use. - - - SLUGS autopilot, http://slugsuav.soe.ucsc.edu - - - ArduPilot - Plane/Copter/Rover/Sub/Tracker, https://ardupilot.org - - - OpenPilot, http://openpilot.org - - - Generic autopilot only supporting simple waypoints - - - Generic autopilot supporting waypoints and other simple navigation commands - - - Generic autopilot supporting the full mission command set - - - No valid autopilot, e.g. a GCS or other MAVLink component - - - PPZ UAV - http://nongnu.org/paparazzi - - - UAV Dev Board - - - FlexiPilot - - - PX4 Autopilot - http://px4.io/ - - - SMACCMPilot - http://smaccmpilot.org - - - AutoQuad -- http://autoquad.org - - - Armazila -- http://armazila.com - - - Aerob -- http://aerob.ru - - - ASLUAV autopilot -- http://www.asl.ethz.ch - - - SmartAP Autopilot - http://sky-drones.com - - - AirRails - http://uaventure.com - - - - MAVLINK component type reported in HEARTBEAT message. Flight controllers must report the type of the vehicle on which they are mounted (e.g. MAV_TYPE_OCTOROTOR). All other components must report a value appropriate for their type (e.g. a camera must use MAV_TYPE_CAMERA). - - Generic micro air vehicle - - - Fixed wing aircraft. - - - Quadrotor - - - Coaxial helicopter - - - Normal helicopter with tail rotor. - - - Ground installation - - - Operator control unit / ground control station - - - Airship, controlled - - - Free balloon, uncontrolled - - - Rocket - - - Ground rover - - - Surface vessel, boat, ship - - - Submarine - - - Hexarotor - - - Octorotor - - - Tricopter - - - Flapping wing - - - Kite - - - Onboard companion controller - - - Two-rotor VTOL using control surfaces in vertical operation in addition. Tailsitter. - - - Quad-rotor VTOL using a V-shaped quad config in vertical operation. Tailsitter. - - - Tiltrotor VTOL - - - - VTOL reserved 2 - - - VTOL reserved 3 - - - VTOL reserved 4 - - - VTOL reserved 5 - - - Gimbal - - - ADSB system - - - Steerable, nonrigid airfoil - - - Dodecarotor - - - Camera - - - Charging station - - - FLARM collision avoidance system - - - Servo - - - Open Drone ID. See https://mavlink.io/en/services/opendroneid.html. - - - Decarotor - - - - These flags encode the MAV mode. - - 0b10000000 MAV safety set to armed. Motors are enabled / running / can start. Ready to fly. Additional note: this flag is to be ignore when sent in the command MAV_CMD_DO_SET_MODE and MAV_CMD_COMPONENT_ARM_DISARM shall be used instead. The flag can still be used to report the armed state. - - - 0b01000000 remote control input is enabled. - - - 0b00100000 hardware in the loop simulation. All motors / actuators are blocked, but internal software is full operational. - - - 0b00010000 system stabilizes electronically its attitude (and optionally position). It needs however further control inputs to move around. - - - 0b00001000 guided mode enabled, system flies waypoints / mission items. - - - 0b00000100 autonomous mode enabled, system finds its own goal positions. Guided flag can be set or not, depends on the actual implementation. - - - 0b00000010 system has a test mode enabled. This flag is intended for temporary system tests and should not be used for stable implementations. - - - 0b00000001 Reserved for future use. - - - - These values encode the bit positions of the decode position. These values can be used to read the value of a flag bit by combining the base_mode variable with AND with the flag position value. The result will be either 0 or 1, depending on if the flag is set or not. - - First bit: 10000000 - - - Second bit: 01000000 - - - Third bit: 00100000 - - - Fourth bit: 00010000 - - - Fifth bit: 00001000 - - - Sixth bit: 00000100 - - - Seventh bit: 00000010 - - - Eighth bit: 00000001 - - - - - Uninitialized system, state is unknown. - - - System is booting up. - - - System is calibrating and not flight-ready. - - - System is grounded and on standby. It can be launched any time. - - - System is active and might be already airborne. Motors are engaged. - - - System is in a non-normal flight mode. It can however still navigate. - - - System is in a non-normal flight mode. It lost control over parts or over the whole airframe. It is in mayday and going down. - - - System just initialized its power-down sequence, will shut down now. - - - System is terminating itself. - - - - Component ids (values) for the different types and instances of onboard hardware/software that might make up a MAVLink system (autopilot, cameras, servos, GPS systems, avoidance systems etc.). - Components must use the appropriate ID in their source address when sending messages. Components can also use IDs to determine if they are the intended recipient of an incoming message. The MAV_COMP_ID_ALL value is used to indicate messages that must be processed by all components. - When creating new entries, components that can have multiple instances (e.g. cameras, servos etc.) should be allocated sequential values. An appropriate number of values should be left free after these components to allow the number of instances to be expanded. - - Target id (target_component) used to broadcast messages to all components of the receiving system. Components should attempt to process messages with this component ID and forward to components on any other interfaces. Note: This is not a valid *source* component id for a message. - - - System flight controller component ("autopilot"). Only one autopilot is expected in a particular system. - - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Telemetry radio (e.g. SiK radio, or other component that emits RADIO_STATUS messages). - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network. - - - Camera #1. - - - Camera #2. - - - Camera #3. - - - Camera #4. - - - Camera #5. - - - Camera #6. - - - Servo #1. - - - Servo #2. - - - Servo #3. - - - Servo #4. - - - Servo #5. - - - Servo #6. - - - Servo #7. - - - Servo #8. - - - Servo #9. - - - Servo #10. - - - Servo #11. - - - Servo #12. - - - Servo #13. - - - Servo #14. - - - Gimbal #1. - - - Logging component. - - - Automatic Dependent Surveillance-Broadcast (ADS-B) component. - - - On Screen Display (OSD) devices for video links. - - - Generic autopilot peripheral component ID. Meant for devices that do not implement the parameter microservice. - - - All gimbals should use MAV_COMP_ID_GIMBAL. - Gimbal ID for QX1. - - - FLARM collision alert component. - - - Gimbal #2. - - - Gimbal #3. - - - Gimbal #4 - - - Gimbal #5. - - - Gimbal #6. - - - Component that can generate/supply a mission flight plan (e.g. GCS or developer API). - - - Component that lives on the onboard computer (companion computer) and has some generic functionalities, such as settings system parameters and monitoring the status of some processes that don't directly speak mavlink and so on. - - - - Component that finds an optimal path between points based on a certain constraint (e.g. minimum snap, shortest path, cost, etc.). - - - Component that plans a collision free path between two points. - - - Component that provides position estimates using VIO techniques. - - - Component that manages pairing of vehicle and GCS. - - - Inertial Measurement Unit (IMU) #1. - - - Inertial Measurement Unit (IMU) #2. - - - Inertial Measurement Unit (IMU) #3. - - - GPS #1. - - - GPS #2. - - - Open Drone ID transmitter/receiver (Bluetooth/WiFi/Internet). - - - Open Drone ID transmitter/receiver (Bluetooth/WiFi/Internet). - - - Open Drone ID transmitter/receiver (Bluetooth/WiFi/Internet). - - - Component to bridge MAVLink to UDP (i.e. from a UART). - - - Component to bridge to UART (i.e. from UDP). - - - Component handling TUNNEL messages (e.g. vendor specific GUI of a component). - - - System control does not require a separate component ID. - Component for handling system messages (e.g. to ARM, takeoff, etc.). - - - - - - The heartbeat message shows that a system or component is present and responding. The type and autopilot fields (along with the message component id), allow the receiving system to treat further messages from this system appropriately (e.g. by laying out the user interface based on the autopilot). This microservice is documented at https://mavlink.io/en/services/heartbeat.html - Vehicle or component type. For a flight controller component the vehicle type (quadrotor, helicopter, etc.). For other components the component type (e.g. camera, gimbal, etc.). This should be used in preference to component id for identifying the component type. - Autopilot type / class. Use MAV_AUTOPILOT_INVALID for components that are not flight controllers. - System mode bitmap. - A bitfield for use for autopilot-specific flags - System status flag. - MAVLink version, not writable by user, gets added by protocol because of magic data type: uint8_t_mavlink_version - - - - - Version and capability of protocol version. This message can be requested with MAV_CMD_REQUEST_MESSAGE and is used as part of the handshaking to establish which MAVLink version should be used on the network. Every node should respond to a request for PROTOCOL_VERSION to enable the handshaking. Library implementers should consider adding this into the default decoding state machine to allow the protocol core to respond directly. - Currently active MAVLink version number * 100: v1.0 is 100, v2.0 is 200, etc. - Minimum MAVLink version supported - Maximum MAVLink version supported (set to the same value as version by default) - The first 8 bytes (not characters printed in hex!) of the git hash. - The first 8 bytes (not characters printed in hex!) of the git hash. - - - diff --git a/message_definitions/paparazzi.xml b/message_definitions/paparazzi.xml deleted file mode 100755 index 45c9ec554..000000000 --- a/message_definitions/paparazzi.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - common.xml - 3 - - - - - - Message encoding a mission script item. This message is emitted upon a request for the next script item. - System ID - Component ID - Sequence - The name of the mission script, NULL terminated. - - - Request script item with the sequence number seq. The response of the system to this message should be a SCRIPT_ITEM message. - System ID - Component ID - Sequence - - - Request the overall list of mission items from the system/component. - System ID - Component ID - - - This message is emitted as response to SCRIPT_REQUEST_LIST by the MAV to get the number of mission scripts. - System ID - Component ID - Number of script items in the sequence - - - This message informs about the currently active SCRIPT. - Active Sequence - - - diff --git a/message_definitions/python_array_test.xml b/message_definitions/python_array_test.xml deleted file mode 100644 index 7e4b72e14..000000000 --- a/message_definitions/python_array_test.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - common.xml - - - Array test #0. - Stub field - Value array - Value array - Value array - Value array - - - Array test #1. - Value array - - - Array test #3. - Stub field - Value array - - - Array test #4. - Value array - Stub field - - - Array test #5. - Value array - Value array - - - Array test #6. - Stub field - Stub field - Stub field - Value array - Value array - Value array - Value array - Value array - Value array - Value array - Value array - Value array - - - Array test #7. - Value array - Value array - Value array - Value array - Value array - Value array - Value array - Value array - Value array - - - Array test #8. - Stub field - Value array - Value array - - - diff --git a/message_definitions/standard.xml b/message_definitions/standard.xml deleted file mode 100644 index 4ca39607a..000000000 --- a/message_definitions/standard.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - common.xml - 0 - - - - - diff --git a/message_definitions/test.xml b/message_definitions/test.xml deleted file mode 100644 index c68020746..000000000 --- a/message_definitions/test.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - 3 - - - Test all field types - char - string - uint8_t - uint16_t - uint32_t - uint64_t - int8_t - int16_t - int32_t - int64_t - float - double - uint8_t_array - uint16_t_array - uint32_t_array - uint64_t_array - int8_t_array - int16_t_array - int32_t_array - int64_t_array - float_array - double_array - - - diff --git a/message_definitions/uAvionix.xml b/message_definitions/uAvionix.xml deleted file mode 100644 index 95d9d9808..000000000 --- a/message_definitions/uAvionix.xml +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - common.xml - - - State flags for ADS-B transponder dynamic report - - - - - - - - Transceiver RF control flags for ADS-B transponder dynamic reports - - - - - - Status for ADS-B transponder dynamic input - - - - - - - - - Status flags for ADS-B transponder dynamic output - - - - - - - Definitions for aircraft size - - - - - - - - - - - - - - - - - - - GPS lataral offset encoding - - - - - - - - - - - GPS longitudinal offset encoding - - - - - Emergency status encoding - - - - - - - - - - - - - Static data to configure the ADS-B transponder (send within 10 sec of a POR and every 10 sec thereafter) - Vehicle address (24 bit) - Vehicle identifier (8 characters, null terminated, valid characters are A-Z, 0-9, " " only) - Transmitting vehicle type. See ADSB_EMITTER_TYPE enum - Aircraft length and width encoding (table 2-35 of DO-282B) - GPS antenna lateral offset (table 2-36 of DO-282B) - GPS antenna longitudinal offset from nose [if non-zero, take position (in meters) divide by 2 and add one] (table 2-37 DO-282B) - Aircraft stall speed in cm/s - ADS-B transponder reciever and transmit enable flags - - - Dynamic data used to generate ADS-B out transponder data (send at 5Hz) - UTC time in seconds since GPS epoch (Jan 6, 1980). If unknown set to UINT32_MAX - Latitude WGS84 (deg * 1E7). If unknown set to INT32_MAX - Longitude WGS84 (deg * 1E7). If unknown set to INT32_MAX - Altitude (WGS84). UP +ve. If unknown set to INT32_MAX - 0-1: no fix, 2: 2D fix, 3: 3D fix, 4: DGPS, 5: RTK - Number of satellites visible. If unknown set to UINT8_MAX - Barometric pressure altitude (MSL) relative to a standard atmosphere of 1013.2 mBar and NOT bar corrected altitude (m * 1E-3). (up +ve). If unknown set to INT32_MAX - Horizontal accuracy in mm (m * 1E-3). If unknown set to UINT32_MAX - Vertical accuracy in cm. If unknown set to UINT16_MAX - Velocity accuracy in mm/s (m * 1E-3). If unknown set to UINT16_MAX - GPS vertical speed in cm/s. If unknown set to INT16_MAX - North-South velocity over ground in cm/s North +ve. If unknown set to INT16_MAX - East-West velocity over ground in cm/s East +ve. If unknown set to INT16_MAX - Emergency status - ADS-B transponder dynamic input state flags - Mode A code (typically 1200 [0x04B0] for VFR) - - - Transceiver heartbeat with health report (updated every 10s) - ADS-B transponder messages - - - diff --git a/message_definitions/ualberta.xml b/message_definitions/ualberta.xml deleted file mode 100644 index e0a6214a5..000000000 --- a/message_definitions/ualberta.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - common.xml - - - Available autopilot modes for ualberta uav - - Raw input pulse widts sent to output - - - Inputs are normalized using calibration, the converted back to raw pulse widths for output - - - dfsdfs - - - dfsfds - - - dfsdfsdfs - - - - Navigation filter mode - - - AHRS mode - - - INS/GPS initialization mode - - - INS/GPS mode - - - - Mode currently commanded by pilot - - sdf - - - dfs - - - Rotomotion mode - - - - - - Accelerometer and Gyro biases from the navigation filter - Timestamp (microseconds) - b_f[0] - b_f[1] - b_f[2] - b_f[0] - b_f[1] - b_f[2] - - - Complete set of calibration parameters for the radio - Aileron setpoints: left, center, right - Elevator setpoints: nose down, center, nose up - Rudder setpoints: nose left, center, nose right - Tail gyro mode/gain setpoints: heading hold, rate mode - Pitch curve setpoints (every 25%) - Throttle curve setpoints (every 25%) - - - System status specific to ualberta uav - System mode, see UALBERTA_AUTOPILOT_MODE ENUM - Navigation mode, see UALBERTA_NAV_MODE ENUM - Pilot mode, see UALBERTA_PILOT_MODE - - - diff --git a/minimal/mavlink.h b/minimal/mavlink.h index 2a8ac1fbc..e4038b0f1 100644 --- a/minimal/mavlink.h +++ b/minimal/mavlink.h @@ -6,7 +6,7 @@ #ifndef MAVLINK_H #define MAVLINK_H -#define MAVLINK_PRIMARY_XML_IDX 2 +#define MAVLINK_PRIMARY_XML_HASH 5404184756630315846 #ifndef MAVLINK_STX #define MAVLINK_STX 253 diff --git a/minimal/mavlink_msg_heartbeat.h b/minimal/mavlink_msg_heartbeat.h index 7774a1006..cf527aa51 100644 --- a/minimal/mavlink_msg_heartbeat.h +++ b/minimal/mavlink_msg_heartbeat.h @@ -92,6 +92,53 @@ static inline uint16_t mavlink_msg_heartbeat_pack(uint8_t system_id, uint8_t com return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HEARTBEAT_MIN_LEN, MAVLINK_MSG_ID_HEARTBEAT_LEN, MAVLINK_MSG_ID_HEARTBEAT_CRC); } +/** + * @brief Pack a heartbeat message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param type Vehicle or component type. For a flight controller component the vehicle type (quadrotor, helicopter, etc.). For other components the component type (e.g. camera, gimbal, etc.). This should be used in preference to component id for identifying the component type. + * @param autopilot Autopilot type / class. Use MAV_AUTOPILOT_INVALID for components that are not flight controllers. + * @param base_mode System mode bitmap. + * @param custom_mode A bitfield for use for autopilot-specific flags + * @param system_status System status flag. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_heartbeat_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint8_t type, uint8_t autopilot, uint8_t base_mode, uint32_t custom_mode, uint8_t system_status) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_HEARTBEAT_LEN]; + _mav_put_uint32_t(buf, 0, custom_mode); + _mav_put_uint8_t(buf, 4, type); + _mav_put_uint8_t(buf, 5, autopilot); + _mav_put_uint8_t(buf, 6, base_mode); + _mav_put_uint8_t(buf, 7, system_status); + _mav_put_uint8_t(buf, 8, 3); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HEARTBEAT_LEN); +#else + mavlink_heartbeat_t packet; + packet.custom_mode = custom_mode; + packet.type = type; + packet.autopilot = autopilot; + packet.base_mode = base_mode; + packet.system_status = system_status; + packet.mavlink_version = 3; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HEARTBEAT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_HEARTBEAT; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HEARTBEAT_MIN_LEN, MAVLINK_MSG_ID_HEARTBEAT_LEN, MAVLINK_MSG_ID_HEARTBEAT_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HEARTBEAT_MIN_LEN, MAVLINK_MSG_ID_HEARTBEAT_LEN); +#endif +} + /** * @brief Pack a heartbeat message on a channel * @param system_id ID of this system @@ -162,6 +209,20 @@ static inline uint16_t mavlink_msg_heartbeat_encode_chan(uint8_t system_id, uint return mavlink_msg_heartbeat_pack_chan(system_id, component_id, chan, msg, heartbeat->type, heartbeat->autopilot, heartbeat->base_mode, heartbeat->custom_mode, heartbeat->system_status); } +/** + * @brief Encode a heartbeat struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param heartbeat C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_heartbeat_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_heartbeat_t* heartbeat) +{ + return mavlink_msg_heartbeat_pack_status(system_id, component_id, _status, msg, heartbeat->type, heartbeat->autopilot, heartbeat->base_mode, heartbeat->custom_mode, heartbeat->system_status); +} + /** * @brief Send a heartbeat message * @param chan MAVLink channel to send the message @@ -215,7 +276,7 @@ static inline void mavlink_msg_heartbeat_send_struct(mavlink_channel_t chan, con #if MAVLINK_MSG_ID_HEARTBEAT_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an diff --git a/minimal/mavlink_msg_protocol_version.h b/minimal/mavlink_msg_protocol_version.h index d795ff28c..efc35ab8e 100644 --- a/minimal/mavlink_msg_protocol_version.h +++ b/minimal/mavlink_msg_protocol_version.h @@ -64,6 +64,45 @@ typedef struct __mavlink_protocol_version_t { static inline uint16_t mavlink_msg_protocol_version_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint16_t version, uint16_t min_version, uint16_t max_version, const uint8_t *spec_version_hash, const uint8_t *library_version_hash) { +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_PROTOCOL_VERSION_LEN]; + _mav_put_uint16_t(buf, 0, version); + _mav_put_uint16_t(buf, 2, min_version); + _mav_put_uint16_t(buf, 4, max_version); + _mav_put_uint8_t_array(buf, 6, spec_version_hash, 8); + _mav_put_uint8_t_array(buf, 14, library_version_hash, 8); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PROTOCOL_VERSION_LEN); +#else + mavlink_protocol_version_t packet; + packet.version = version; + packet.min_version = min_version; + packet.max_version = max_version; + mav_array_assign_uint8_t(packet.spec_version_hash, spec_version_hash, 8); + mav_array_assign_uint8_t(packet.library_version_hash, library_version_hash, 8); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PROTOCOL_VERSION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_PROTOCOL_VERSION; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PROTOCOL_VERSION_MIN_LEN, MAVLINK_MSG_ID_PROTOCOL_VERSION_LEN, MAVLINK_MSG_ID_PROTOCOL_VERSION_CRC); +} + +/** + * @brief Pack a protocol_version message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param version Currently active MAVLink version number * 100: v1.0 is 100, v2.0 is 200, etc. + * @param min_version Minimum MAVLink version supported + * @param max_version Maximum MAVLink version supported (set to the same value as version by default) + * @param spec_version_hash The first 8 bytes (not characters printed in hex!) of the git hash. + * @param library_version_hash The first 8 bytes (not characters printed in hex!) of the git hash. + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_protocol_version_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint16_t version, uint16_t min_version, uint16_t max_version, const uint8_t *spec_version_hash, const uint8_t *library_version_hash) +{ #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_PROTOCOL_VERSION_LEN]; _mav_put_uint16_t(buf, 0, version); @@ -83,7 +122,11 @@ static inline uint16_t mavlink_msg_protocol_version_pack(uint8_t system_id, uint #endif msg->msgid = MAVLINK_MSG_ID_PROTOCOL_VERSION; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PROTOCOL_VERSION_MIN_LEN, MAVLINK_MSG_ID_PROTOCOL_VERSION_LEN, MAVLINK_MSG_ID_PROTOCOL_VERSION_CRC); +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PROTOCOL_VERSION_MIN_LEN, MAVLINK_MSG_ID_PROTOCOL_VERSION_LEN, MAVLINK_MSG_ID_PROTOCOL_VERSION_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PROTOCOL_VERSION_MIN_LEN, MAVLINK_MSG_ID_PROTOCOL_VERSION_LEN); +#endif } /** @@ -116,8 +159,8 @@ static inline uint16_t mavlink_msg_protocol_version_pack_chan(uint8_t system_id, packet.version = version; packet.min_version = min_version; packet.max_version = max_version; - mav_array_memcpy(packet.spec_version_hash, spec_version_hash, sizeof(uint8_t)*8); - mav_array_memcpy(packet.library_version_hash, library_version_hash, sizeof(uint8_t)*8); + mav_array_assign_uint8_t(packet.spec_version_hash, spec_version_hash, 8); + mav_array_assign_uint8_t(packet.library_version_hash, library_version_hash, 8); memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PROTOCOL_VERSION_LEN); #endif @@ -152,6 +195,20 @@ static inline uint16_t mavlink_msg_protocol_version_encode_chan(uint8_t system_i return mavlink_msg_protocol_version_pack_chan(system_id, component_id, chan, msg, protocol_version->version, protocol_version->min_version, protocol_version->max_version, protocol_version->spec_version_hash, protocol_version->library_version_hash); } +/** + * @brief Encode a protocol_version struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param protocol_version C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_protocol_version_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_protocol_version_t* protocol_version) +{ + return mavlink_msg_protocol_version_pack_status(system_id, component_id, _status, msg, protocol_version->version, protocol_version->min_version, protocol_version->max_version, protocol_version->spec_version_hash, protocol_version->library_version_hash); +} + /** * @brief Send a protocol_version message * @param chan MAVLink channel to send the message @@ -179,8 +236,8 @@ static inline void mavlink_msg_protocol_version_send(mavlink_channel_t chan, uin packet.version = version; packet.min_version = min_version; packet.max_version = max_version; - mav_array_memcpy(packet.spec_version_hash, spec_version_hash, sizeof(uint8_t)*8); - mav_array_memcpy(packet.library_version_hash, library_version_hash, sizeof(uint8_t)*8); + mav_array_assign_uint8_t(packet.spec_version_hash, spec_version_hash, 8); + mav_array_assign_uint8_t(packet.library_version_hash, library_version_hash, 8); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PROTOCOL_VERSION, (const char *)&packet, MAVLINK_MSG_ID_PROTOCOL_VERSION_MIN_LEN, MAVLINK_MSG_ID_PROTOCOL_VERSION_LEN, MAVLINK_MSG_ID_PROTOCOL_VERSION_CRC); #endif } @@ -201,7 +258,7 @@ static inline void mavlink_msg_protocol_version_send_struct(mavlink_channel_t ch #if MAVLINK_MSG_ID_PROTOCOL_VERSION_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* - This varient of _send() can be used to save stack space by re-using + This variant of _send() can be used to save stack space by reusing memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an @@ -222,8 +279,8 @@ static inline void mavlink_msg_protocol_version_send_buf(mavlink_message_t *msgb packet->version = version; packet->min_version = min_version; packet->max_version = max_version; - mav_array_memcpy(packet->spec_version_hash, spec_version_hash, sizeof(uint8_t)*8); - mav_array_memcpy(packet->library_version_hash, library_version_hash, sizeof(uint8_t)*8); + mav_array_assign_uint8_t(packet->spec_version_hash, spec_version_hash, 8); + mav_array_assign_uint8_t(packet->library_version_hash, library_version_hash, 8); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PROTOCOL_VERSION, (const char *)packet, MAVLINK_MSG_ID_PROTOCOL_VERSION_MIN_LEN, MAVLINK_MSG_ID_PROTOCOL_VERSION_LEN, MAVLINK_MSG_ID_PROTOCOL_VERSION_CRC); #endif } diff --git a/minimal/minimal.h b/minimal/minimal.h index 31c90f6d2..9b041d84a 100644 --- a/minimal/minimal.h +++ b/minimal/minimal.h @@ -10,8 +10,7 @@ #error Wrong include order: MAVLINK_MINIMAL.H MUST NOT BE DIRECTLY USED. Include mavlink.h from the same directory instead or set ALL AND EVERY defines from MAVLINK.H manually accordingly, including the #define MAVLINK_H call. #endif -#undef MAVLINK_THIS_XML_IDX -#define MAVLINK_THIS_XML_IDX 2 +#define MAVLINK_MINIMAL_XML_HASH 5404184756630315846 #ifdef __cplusplus extern "C" { @@ -59,7 +58,8 @@ typedef enum MAV_AUTOPILOT MAV_AUTOPILOT_ASLUAV=17, /* ASLUAV autopilot -- http://www.asl.ethz.ch | */ MAV_AUTOPILOT_SMARTAP=18, /* SmartAP Autopilot - http://sky-drones.com | */ MAV_AUTOPILOT_AIRRAILS=19, /* AirRails - http://uaventure.com | */ - MAV_AUTOPILOT_ENUM_END=20, /* | */ + MAV_AUTOPILOT_REFLEX=20, /* Fusion Reflex - https://fusion.engineering | */ + MAV_AUTOPILOT_ENUM_END=21, /* | */ } MAV_AUTOPILOT; #endif @@ -87,12 +87,12 @@ typedef enum MAV_TYPE MAV_TYPE_FLAPPING_WING=16, /* Flapping wing | */ MAV_TYPE_KITE=17, /* Kite | */ MAV_TYPE_ONBOARD_CONTROLLER=18, /* Onboard companion controller | */ - MAV_TYPE_VTOL_DUOROTOR=19, /* Two-rotor VTOL using control surfaces in vertical operation in addition. Tailsitter. | */ - MAV_TYPE_VTOL_QUADROTOR=20, /* Quad-rotor VTOL using a V-shaped quad config in vertical operation. Tailsitter. | */ - MAV_TYPE_VTOL_TILTROTOR=21, /* Tiltrotor VTOL | */ - MAV_TYPE_VTOL_RESERVED2=22, /* VTOL reserved 2 | */ - MAV_TYPE_VTOL_RESERVED3=23, /* VTOL reserved 3 | */ - MAV_TYPE_VTOL_RESERVED4=24, /* VTOL reserved 4 | */ + MAV_TYPE_VTOL_TAILSITTER_DUOROTOR=19, /* Two-rotor Tailsitter VTOL that additionally uses control surfaces in vertical operation. Note, value previously named MAV_TYPE_VTOL_DUOROTOR. | */ + MAV_TYPE_VTOL_TAILSITTER_QUADROTOR=20, /* Quad-rotor Tailsitter VTOL using a V-shaped quad config in vertical operation. Note: value previously named MAV_TYPE_VTOL_QUADROTOR. | */ + MAV_TYPE_VTOL_TILTROTOR=21, /* Tiltrotor VTOL. Fuselage and wings stay (nominally) horizontal in all flight phases. It able to tilt (some) rotors to provide thrust in cruise flight. | */ + MAV_TYPE_VTOL_FIXEDROTOR=22, /* VTOL with separate fixed rotors for hover and cruise flight. Fuselage and wings stay (nominally) horizontal in all flight phases. | */ + MAV_TYPE_VTOL_TAILSITTER=23, /* Tailsitter VTOL. Fuselage and wings orientation changes depending on flight phase: vertical for hover, horizontal for cruise. Use more specific VTOL MAV_TYPE_VTOL_TAILSITTER_DUOROTOR or MAV_TYPE_VTOL_TAILSITTER_QUADROTOR if appropriate. | */ + MAV_TYPE_VTOL_TILTWING=24, /* Tiltwing VTOL. Fuselage stays horizontal in all flight phases. The whole wing, along with any attached engine, can tilt between vertical and horizontal mode. | */ MAV_TYPE_VTOL_RESERVED5=25, /* VTOL reserved 5 | */ MAV_TYPE_GIMBAL=26, /* Gimbal | */ MAV_TYPE_ADSB=27, /* ADSB system | */ @@ -104,16 +104,30 @@ typedef enum MAV_TYPE MAV_TYPE_SERVO=33, /* Servo | */ MAV_TYPE_ODID=34, /* Open Drone ID. See https://mavlink.io/en/services/opendroneid.html. | */ MAV_TYPE_DECAROTOR=35, /* Decarotor | */ - MAV_TYPE_ENUM_END=36, /* | */ + MAV_TYPE_BATTERY=36, /* Battery | */ + MAV_TYPE_PARACHUTE=37, /* Parachute | */ + MAV_TYPE_LOG=38, /* Log | */ + MAV_TYPE_OSD=39, /* OSD | */ + MAV_TYPE_IMU=40, /* IMU | */ + MAV_TYPE_GPS=41, /* GPS | */ + MAV_TYPE_WINCH=42, /* Winch | */ + MAV_TYPE_GENERIC_MULTIROTOR=43, /* Generic multirotor that does not fit into a specific type or whose type is unknown | */ + MAV_TYPE_ILLUMINATOR=44, /* Illuminator. An illuminator is a light source that is used for lighting up dark areas external to the system: e.g. a torch or searchlight (as opposed to a light source for illuminating the system itself, e.g. an indicator light). | */ + MAV_TYPE_SPACECRAFT_ORBITER=45, /* Orbiter spacecraft. Includes satellites orbiting terrestrial and extra-terrestrial bodies. Follows NASA Spacecraft Classification. | */ + MAV_TYPE_GROUND_QUADRUPED=46, /* A generic four-legged ground vehicle (e.g., a robot dog). | */ + MAV_TYPE_VTOL_GYRODYNE=47, /* VTOL hybrid of helicopter and autogyro. It has a main rotor for lift and separate propellers for forward flight. The rotor must be powered for hover but can autorotate in cruise flight. See: https://en.wikipedia.org/wiki/Gyrodyne | */ + MAV_TYPE_GRIPPER=48, /* Gripper | */ + MAV_TYPE_RADIO=49, /* Radio | */ + MAV_TYPE_ENUM_END=50, /* | */ } MAV_TYPE; #endif -/** @brief These flags encode the MAV mode. */ +/** @brief These flags encode the MAV mode, see MAV_MODE enum for useful combinations. */ #ifndef HAVE_ENUM_MAV_MODE_FLAG #define HAVE_ENUM_MAV_MODE_FLAG typedef enum MAV_MODE_FLAG { - MAV_MODE_FLAG_CUSTOM_MODE_ENABLED=1, /* 0b00000001 Reserved for future use. | */ + MAV_MODE_FLAG_CUSTOM_MODE_ENABLED=1, /* 0b00000001 system-specific custom mode is enabled. When using this flag to enable a custom mode all other flags should be ignored. | */ MAV_MODE_FLAG_TEST_ENABLED=2, /* 0b00000010 system has a test mode enabled. This flag is intended for temporary system tests and should not be used for stable implementations. | */ MAV_MODE_FLAG_AUTO_ENABLED=4, /* 0b00000100 autonomous mode enabled, system finds its own goal positions. Guided flag can be set or not, depends on the actual implementation. | */ MAV_MODE_FLAG_GUIDED_ENABLED=8, /* 0b00001000 guided mode enabled, system flies waypoints / mission items. | */ @@ -152,17 +166,26 @@ typedef enum MAV_STATE MAV_STATE_CALIBRATING=2, /* System is calibrating and not flight-ready. | */ MAV_STATE_STANDBY=3, /* System is grounded and on standby. It can be launched any time. | */ MAV_STATE_ACTIVE=4, /* System is active and might be already airborne. Motors are engaged. | */ - MAV_STATE_CRITICAL=5, /* System is in a non-normal flight mode. It can however still navigate. | */ - MAV_STATE_EMERGENCY=6, /* System is in a non-normal flight mode. It lost control over parts or over the whole airframe. It is in mayday and going down. | */ + MAV_STATE_CRITICAL=5, /* System is in a non-normal flight mode (failsafe). It can however still navigate. | */ + MAV_STATE_EMERGENCY=6, /* System is in a non-normal flight mode (failsafe). It lost control over parts or over the whole airframe. It is in mayday and going down. | */ MAV_STATE_POWEROFF=7, /* System just initialized its power-down sequence, will shut down now. | */ - MAV_STATE_FLIGHT_TERMINATION=8, /* System is terminating itself. | */ + MAV_STATE_FLIGHT_TERMINATION=8, /* System is terminating itself (failsafe or commanded). | */ MAV_STATE_ENUM_END=9, /* | */ } MAV_STATE; #endif -/** @brief Component ids (values) for the different types and instances of onboard hardware/software that might make up a MAVLink system (autopilot, cameras, servos, GPS systems, avoidance systems etc.). - Components must use the appropriate ID in their source address when sending messages. Components can also use IDs to determine if they are the intended recipient of an incoming message. The MAV_COMP_ID_ALL value is used to indicate messages that must be processed by all components. - When creating new entries, components that can have multiple instances (e.g. cameras, servos etc.) should be allocated sequential values. An appropriate number of values should be left free after these components to allow the number of instances to be expanded. */ +/** @brief Legacy component ID values for particular types of hardware/software that might make up a MAVLink system (autopilot, cameras, servos, avoidance systems etc.). + + Components are not required or expected to use IDs with names that correspond to their type or function, but may choose to do so. + Using an ID that matches the type may slightly reduce the chances of component id clashes, as, for historical reasons, it is less likely to be used by some other type of component. + System integration will still need to ensure that all components have unique IDs. + + Component IDs are used for addressing messages to a particular component within a system. + A component can use any unique ID between 1 and 255 (MAV_COMP_ID_ALL value is the broadcast address, used to send to all components). + + Historically component ID were also used for identifying the type of component. + New code must not use component IDs to infer the component type, but instead check the MAV_TYPE in the HEARTBEAT message! + */ #ifndef HAVE_ENUM_MAV_COMPONENT #define HAVE_ENUM_MAV_COMPONENT typedef enum MAV_COMPONENT @@ -250,6 +273,9 @@ typedef enum MAV_COMPONENT MAV_COMP_ID_CAMERA4=103, /* Camera #4. | */ MAV_COMP_ID_CAMERA5=104, /* Camera #5. | */ MAV_COMP_ID_CAMERA6=105, /* Camera #6. | */ + MAV_COMP_ID_RADIO=110, /* Radio #1. | */ + MAV_COMP_ID_RADIO2=111, /* Radio #2. | */ + MAV_COMP_ID_RADIO3=112, /* Radio #3. | */ MAV_COMP_ID_SERVO1=140, /* Servo #1. | */ MAV_COMP_ID_SERVO2=141, /* Servo #2. | */ MAV_COMP_ID_SERVO3=142, /* Servo #3. | */ @@ -271,13 +297,21 @@ typedef enum MAV_COMPONENT MAV_COMP_ID_PERIPHERAL=158, /* Generic autopilot peripheral component ID. Meant for devices that do not implement the parameter microservice. | */ MAV_COMP_ID_QX1_GIMBAL=159, /* Gimbal ID for QX1. | */ MAV_COMP_ID_FLARM=160, /* FLARM collision alert component. | */ + MAV_COMP_ID_PARACHUTE=161, /* Parachute component. | */ + MAV_COMP_ID_WINCH=169, /* Winch component. | */ MAV_COMP_ID_GIMBAL2=171, /* Gimbal #2. | */ MAV_COMP_ID_GIMBAL3=172, /* Gimbal #3. | */ MAV_COMP_ID_GIMBAL4=173, /* Gimbal #4 | */ MAV_COMP_ID_GIMBAL5=174, /* Gimbal #5. | */ MAV_COMP_ID_GIMBAL6=175, /* Gimbal #6. | */ + MAV_COMP_ID_BATTERY=180, /* Battery #1. | */ + MAV_COMP_ID_BATTERY2=181, /* Battery #2. | */ + MAV_COMP_ID_MAVCAN=189, /* CAN over MAVLink client. | */ MAV_COMP_ID_MISSIONPLANNER=190, /* Component that can generate/supply a mission flight plan (e.g. GCS or developer API). | */ MAV_COMP_ID_ONBOARD_COMPUTER=191, /* Component that lives on the onboard computer (companion computer) and has some generic functionalities, such as settings system parameters and monitoring the status of some processes that don't directly speak mavlink and so on. | */ + MAV_COMP_ID_ONBOARD_COMPUTER2=192, /* Component that lives on the onboard computer (companion computer) and has some generic functionalities, such as settings system parameters and monitoring the status of some processes that don't directly speak mavlink and so on. | */ + MAV_COMP_ID_ONBOARD_COMPUTER3=193, /* Component that lives on the onboard computer (companion computer) and has some generic functionalities, such as settings system parameters and monitoring the status of some processes that don't directly speak mavlink and so on. | */ + MAV_COMP_ID_ONBOARD_COMPUTER4=194, /* Component that lives on the onboard computer (companion computer) and has some generic functionalities, such as settings system parameters and monitoring the status of some processes that don't directly speak mavlink and so on. | */ MAV_COMP_ID_PATHPLANNER=195, /* Component that finds an optimal path between points based on a certain constraint (e.g. minimum snap, shortest path, cost, etc.). | */ MAV_COMP_ID_OBSTACLE_AVOIDANCE=196, /* Component that plans a collision free path between two points. | */ MAV_COMP_ID_VISUAL_INERTIAL_ODOMETRY=197, /* Component that provides position estimates using VIO techniques. | */ @@ -293,7 +327,8 @@ typedef enum MAV_COMPONENT MAV_COMP_ID_UDP_BRIDGE=240, /* Component to bridge MAVLink to UDP (i.e. from a UART). | */ MAV_COMP_ID_UART_BRIDGE=241, /* Component to bridge to UART (i.e. from UDP). | */ MAV_COMP_ID_TUNNEL_NODE=242, /* Component handling TUNNEL messages (e.g. vendor specific GUI of a component). | */ - MAV_COMP_ID_SYSTEM_CONTROL=250, /* Component for handling system messages (e.g. to ARM, takeoff, etc.). | */ + MAV_COMP_ID_ILLUMINATOR=243, /* Illuminator | */ + MAV_COMP_ID_SYSTEM_CONTROL=250, /* Deprecated, don't use. Component for handling system messages (e.g. to ARM, takeoff, etc.). | */ MAV_COMPONENT_ENUM_END=251, /* | */ } MAV_COMPONENT; #endif @@ -316,10 +351,8 @@ typedef enum MAV_COMPONENT // base include -#undef MAVLINK_THIS_XML_IDX -#define MAVLINK_THIS_XML_IDX 2 -#if MAVLINK_THIS_XML_IDX == MAVLINK_PRIMARY_XML_IDX +#if MAVLINK_MINIMAL_XML_HASH == MAVLINK_PRIMARY_XML_HASH # define MAVLINK_MESSAGE_INFO {MAVLINK_MESSAGE_INFO_HEARTBEAT, MAVLINK_MESSAGE_INFO_PROTOCOL_VERSION} # define MAVLINK_MESSAGE_NAMES {{ "HEARTBEAT", 0 }, { "PROTOCOL_VERSION", 300 }} # if MAVLINK_COMMAND_24BIT diff --git a/minimal/testsuite.h b/minimal/testsuite.h index fd9c37f41..ad2471cd3 100644 --- a/minimal/testsuite.h +++ b/minimal/testsuite.h @@ -1,6 +1,6 @@ /** @file * @brief MAVLink comm protocol testsuite generated from minimal.xml - * @see http://qgroundcontrol.org/mavlink/ + * @see https://mavlink.io/en/ */ #pragma once #ifndef MINIMAL_TESTSUITE_H @@ -82,6 +82,11 @@ static void mavlink_test_heartbeat(uint8_t system_id, uint8_t component_id, mavl mavlink_msg_heartbeat_send(MAVLINK_COMM_1 , packet1.type , packet1.autopilot , packet1.base_mode , packet1.custom_mode , packet1.system_status ); mavlink_msg_heartbeat_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("HEARTBEAT") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_HEARTBEAT) != NULL); +#endif } static void mavlink_test_protocol_version(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) @@ -140,6 +145,11 @@ static void mavlink_test_protocol_version(uint8_t system_id, uint8_t component_i mavlink_msg_protocol_version_send(MAVLINK_COMM_1 , packet1.version , packet1.min_version , packet1.max_version , packet1.spec_version_hash , packet1.library_version_hash ); mavlink_msg_protocol_version_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + +#ifdef MAVLINK_HAVE_GET_MESSAGE_INFO + MAVLINK_ASSERT(mavlink_get_message_info_by_name("PROTOCOL_VERSION") != NULL); + MAVLINK_ASSERT(mavlink_get_message_info_by_id(MAVLINK_MSG_ID_PROTOCOL_VERSION) != NULL); +#endif } static void mavlink_test_minimal(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) diff --git a/minimal/version.h b/minimal/version.h index c1d4b8629..50a886689 100644 --- a/minimal/version.h +++ b/minimal/version.h @@ -7,7 +7,7 @@ #ifndef MAVLINK_VERSION_H #define MAVLINK_VERSION_H -#define MAVLINK_BUILD_DATE "Fri Feb 12 2021" +#define MAVLINK_BUILD_DATE "Mon Oct 20 2025" #define MAVLINK_WIRE_PROTOCOL_VERSION "2.0" #define MAVLINK_MAX_DIALECT_PAYLOAD_SIZE 22 diff --git a/protocol.h b/protocol.h index d9227303f..e14b979e7 100644 --- a/protocol.h +++ b/protocol.h @@ -43,6 +43,8 @@ MAVLINK_HELPER mavlink_status_t* mavlink_get_channel_status(uint8_t chan); #endif MAVLINK_HELPER void mavlink_reset_channel_status(uint8_t chan); + MAVLINK_HELPER uint16_t mavlink_finalize_message_buffer(mavlink_message_t* msg, uint8_t system_id, uint8_t component_id, + mavlink_status_t* status, uint8_t min_length, uint8_t length, uint8_t crc_extra); MAVLINK_HELPER uint16_t mavlink_finalize_message_chan(mavlink_message_t* msg, uint8_t system_id, uint8_t component_id, uint8_t chan, uint8_t min_length, uint8_t length, uint8_t crc_extra); MAVLINK_HELPER uint16_t mavlink_finalize_message(mavlink_message_t* msg, uint8_t system_id, uint8_t component_id, @@ -177,13 +179,43 @@ static inline void mav_array_memcpy(void *dest, const void *src, size_t n) } } +/* + * Array direct assignment, for use when fields align and no byte swapping + * is required. Most are directly #defined to mav_array_memcpy, except for + * mav_array_assign_char, which uses strncpy instead. + */ +#if !MAVLINK_NEED_BYTE_SWAP && MAVLINK_ALIGNED_FIELDS +static inline void mav_array_assign_char(char *dest, const char *src, size_t n) +{ + if (src == NULL) { + memset(dest, 0, n); + } else { + /* strncpy will zero pad dest array up to n bytes */ + strncpy(dest, src, n); + } +} +#define mav_array_assign_uint8_t(DEST,SRC,N) mav_array_memcpy(DEST,SRC,N*sizeof(uint8_t)) +#define mav_array_assign_int8_t(DEST,SRC,N) mav_array_memcpy(DEST,SRC,N*sizeof(int8_t)) +#define mav_array_assign_uint16_t(DEST,SRC,N) mav_array_memcpy(DEST,SRC,N*sizeof(uint16_t)) +#define mav_array_assign_int16_t(DEST,SRC,N) mav_array_memcpy(DEST,SRC,N*sizeof(int16_t)) +#define mav_array_assign_uint32_t(DEST,SRC,N) mav_array_memcpy(DEST,SRC,N*sizeof(uint32_t)) +#define mav_array_assign_int32_t(DEST,SRC,N) mav_array_memcpy(DEST,SRC,N*sizeof(int32_t)) +#define mav_array_assign_uint64_t(DEST,SRC,N) mav_array_memcpy(DEST,SRC,N*sizeof(uint64_t)) +#define mav_array_assign_int64_t(DEST,SRC,N) mav_array_memcpy(DEST,SRC,N*sizeof(int64_t)) +#define mav_array_assign_float(DEST,SRC,N) mav_array_memcpy(DEST,SRC,N*sizeof(float)) +#define mav_array_assign_double(DEST,SRC,N) mav_array_memcpy(DEST,SRC,N*sizeof(double)) +#endif + /* * Place a char array into a buffer */ static inline void _mav_put_char_array(char *buf, uint8_t wire_offset, const char *b, uint8_t array_length) { - mav_array_memcpy(&buf[wire_offset], b, array_length); - + if (b == NULL) { + memset(&buf[wire_offset], 0, array_length); + } else { + strncpy(&buf[wire_offset], b, array_length); + } } /* diff --git a/standard/mavlink.h b/standard/mavlink.h index e5d78b0dc..72ef2c6f6 100644 --- a/standard/mavlink.h +++ b/standard/mavlink.h @@ -6,7 +6,7 @@ #ifndef MAVLINK_H #define MAVLINK_H -#define MAVLINK_PRIMARY_XML_IDX 0 +#define MAVLINK_PRIMARY_XML_HASH 8124567457273401992 #ifndef MAVLINK_STX #define MAVLINK_STX 253 diff --git a/standard/mavlink_msg_autopilot_version.h b/standard/mavlink_msg_autopilot_version.h new file mode 100644 index 000000000..784079317 --- /dev/null +++ b/standard/mavlink_msg_autopilot_version.h @@ -0,0 +1,573 @@ +#pragma once +// MESSAGE AUTOPILOT_VERSION PACKING + +#define MAVLINK_MSG_ID_AUTOPILOT_VERSION 148 + + +typedef struct __mavlink_autopilot_version_t { + uint64_t capabilities; /*< Bitmap of capabilities*/ + uint64_t uid; /*< UID if provided by hardware (see uid2)*/ + uint32_t flight_sw_version; /*< Firmware version number. + The field must be encoded as 4 bytes, where each byte (shown from MSB to LSB) is part of a semantic version: (major) (minor) (patch) (FIRMWARE_VERSION_TYPE). + */ + uint32_t middleware_sw_version; /*< Middleware version number*/ + uint32_t os_sw_version; /*< Operating system version number*/ + uint32_t board_version; /*< HW / board version (last 8 bits should be silicon ID, if any). The first 16 bits of this field specify a board type from an enumeration stored at https://github.com/PX4/PX4-Bootloader/blob/master/board_types.txt and with extensive additions at https://github.com/ArduPilot/ardupilot/blob/master/Tools/AP_Bootloader/board_types.txt*/ + uint16_t vendor_id; /*< ID of the board vendor*/ + uint16_t product_id; /*< ID of the product*/ + uint8_t flight_custom_version[8]; /*< Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases.*/ + uint8_t middleware_custom_version[8]; /*< Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases.*/ + uint8_t os_custom_version[8]; /*< Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases.*/ + uint8_t uid2[18]; /*< UID if provided by hardware (supersedes the uid field. If this is non-zero, use this field, otherwise use uid)*/ +} mavlink_autopilot_version_t; + +#define MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN 78 +#define MAVLINK_MSG_ID_AUTOPILOT_VERSION_MIN_LEN 60 +#define MAVLINK_MSG_ID_148_LEN 78 +#define MAVLINK_MSG_ID_148_MIN_LEN 60 + +#define MAVLINK_MSG_ID_AUTOPILOT_VERSION_CRC 178 +#define MAVLINK_MSG_ID_148_CRC 178 + +#define MAVLINK_MSG_AUTOPILOT_VERSION_FIELD_FLIGHT_CUSTOM_VERSION_LEN 8 +#define MAVLINK_MSG_AUTOPILOT_VERSION_FIELD_MIDDLEWARE_CUSTOM_VERSION_LEN 8 +#define MAVLINK_MSG_AUTOPILOT_VERSION_FIELD_OS_CUSTOM_VERSION_LEN 8 +#define MAVLINK_MSG_AUTOPILOT_VERSION_FIELD_UID2_LEN 18 + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_AUTOPILOT_VERSION { \ + 148, \ + "AUTOPILOT_VERSION", \ + 12, \ + { { "capabilities", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_autopilot_version_t, capabilities) }, \ + { "flight_sw_version", NULL, MAVLINK_TYPE_UINT32_T, 0, 16, offsetof(mavlink_autopilot_version_t, flight_sw_version) }, \ + { "middleware_sw_version", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_autopilot_version_t, middleware_sw_version) }, \ + { "os_sw_version", NULL, MAVLINK_TYPE_UINT32_T, 0, 24, offsetof(mavlink_autopilot_version_t, os_sw_version) }, \ + { "board_version", NULL, MAVLINK_TYPE_UINT32_T, 0, 28, offsetof(mavlink_autopilot_version_t, board_version) }, \ + { "flight_custom_version", NULL, MAVLINK_TYPE_UINT8_T, 8, 36, offsetof(mavlink_autopilot_version_t, flight_custom_version) }, \ + { "middleware_custom_version", NULL, MAVLINK_TYPE_UINT8_T, 8, 44, offsetof(mavlink_autopilot_version_t, middleware_custom_version) }, \ + { "os_custom_version", NULL, MAVLINK_TYPE_UINT8_T, 8, 52, offsetof(mavlink_autopilot_version_t, os_custom_version) }, \ + { "vendor_id", NULL, MAVLINK_TYPE_UINT16_T, 0, 32, offsetof(mavlink_autopilot_version_t, vendor_id) }, \ + { "product_id", NULL, MAVLINK_TYPE_UINT16_T, 0, 34, offsetof(mavlink_autopilot_version_t, product_id) }, \ + { "uid", NULL, MAVLINK_TYPE_UINT64_T, 0, 8, offsetof(mavlink_autopilot_version_t, uid) }, \ + { "uid2", NULL, MAVLINK_TYPE_UINT8_T, 18, 60, offsetof(mavlink_autopilot_version_t, uid2) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_AUTOPILOT_VERSION { \ + "AUTOPILOT_VERSION", \ + 12, \ + { { "capabilities", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_autopilot_version_t, capabilities) }, \ + { "flight_sw_version", NULL, MAVLINK_TYPE_UINT32_T, 0, 16, offsetof(mavlink_autopilot_version_t, flight_sw_version) }, \ + { "middleware_sw_version", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_autopilot_version_t, middleware_sw_version) }, \ + { "os_sw_version", NULL, MAVLINK_TYPE_UINT32_T, 0, 24, offsetof(mavlink_autopilot_version_t, os_sw_version) }, \ + { "board_version", NULL, MAVLINK_TYPE_UINT32_T, 0, 28, offsetof(mavlink_autopilot_version_t, board_version) }, \ + { "flight_custom_version", NULL, MAVLINK_TYPE_UINT8_T, 8, 36, offsetof(mavlink_autopilot_version_t, flight_custom_version) }, \ + { "middleware_custom_version", NULL, MAVLINK_TYPE_UINT8_T, 8, 44, offsetof(mavlink_autopilot_version_t, middleware_custom_version) }, \ + { "os_custom_version", NULL, MAVLINK_TYPE_UINT8_T, 8, 52, offsetof(mavlink_autopilot_version_t, os_custom_version) }, \ + { "vendor_id", NULL, MAVLINK_TYPE_UINT16_T, 0, 32, offsetof(mavlink_autopilot_version_t, vendor_id) }, \ + { "product_id", NULL, MAVLINK_TYPE_UINT16_T, 0, 34, offsetof(mavlink_autopilot_version_t, product_id) }, \ + { "uid", NULL, MAVLINK_TYPE_UINT64_T, 0, 8, offsetof(mavlink_autopilot_version_t, uid) }, \ + { "uid2", NULL, MAVLINK_TYPE_UINT8_T, 18, 60, offsetof(mavlink_autopilot_version_t, uid2) }, \ + } \ +} +#endif + +/** + * @brief Pack a autopilot_version message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param capabilities Bitmap of capabilities + * @param flight_sw_version Firmware version number. + The field must be encoded as 4 bytes, where each byte (shown from MSB to LSB) is part of a semantic version: (major) (minor) (patch) (FIRMWARE_VERSION_TYPE). + + * @param middleware_sw_version Middleware version number + * @param os_sw_version Operating system version number + * @param board_version HW / board version (last 8 bits should be silicon ID, if any). The first 16 bits of this field specify a board type from an enumeration stored at https://github.com/PX4/PX4-Bootloader/blob/master/board_types.txt and with extensive additions at https://github.com/ArduPilot/ardupilot/blob/master/Tools/AP_Bootloader/board_types.txt + * @param flight_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. + * @param middleware_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. + * @param os_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. + * @param vendor_id ID of the board vendor + * @param product_id ID of the product + * @param uid UID if provided by hardware (see uid2) + * @param uid2 UID if provided by hardware (supersedes the uid field. If this is non-zero, use this field, otherwise use uid) + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_autopilot_version_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint64_t capabilities, uint32_t flight_sw_version, uint32_t middleware_sw_version, uint32_t os_sw_version, uint32_t board_version, const uint8_t *flight_custom_version, const uint8_t *middleware_custom_version, const uint8_t *os_custom_version, uint16_t vendor_id, uint16_t product_id, uint64_t uid, const uint8_t *uid2) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN]; + _mav_put_uint64_t(buf, 0, capabilities); + _mav_put_uint64_t(buf, 8, uid); + _mav_put_uint32_t(buf, 16, flight_sw_version); + _mav_put_uint32_t(buf, 20, middleware_sw_version); + _mav_put_uint32_t(buf, 24, os_sw_version); + _mav_put_uint32_t(buf, 28, board_version); + _mav_put_uint16_t(buf, 32, vendor_id); + _mav_put_uint16_t(buf, 34, product_id); + _mav_put_uint8_t_array(buf, 36, flight_custom_version, 8); + _mav_put_uint8_t_array(buf, 44, middleware_custom_version, 8); + _mav_put_uint8_t_array(buf, 52, os_custom_version, 8); + _mav_put_uint8_t_array(buf, 60, uid2, 18); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN); +#else + mavlink_autopilot_version_t packet; + packet.capabilities = capabilities; + packet.uid = uid; + packet.flight_sw_version = flight_sw_version; + packet.middleware_sw_version = middleware_sw_version; + packet.os_sw_version = os_sw_version; + packet.board_version = board_version; + packet.vendor_id = vendor_id; + packet.product_id = product_id; + mav_array_assign_uint8_t(packet.flight_custom_version, flight_custom_version, 8); + mav_array_assign_uint8_t(packet.middleware_custom_version, middleware_custom_version, 8); + mav_array_assign_uint8_t(packet.os_custom_version, os_custom_version, 8); + mav_array_assign_uint8_t(packet.uid2, uid2, 18); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_AUTOPILOT_VERSION; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AUTOPILOT_VERSION_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_CRC); +} + +/** + * @brief Pack a autopilot_version message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param capabilities Bitmap of capabilities + * @param flight_sw_version Firmware version number. + The field must be encoded as 4 bytes, where each byte (shown from MSB to LSB) is part of a semantic version: (major) (minor) (patch) (FIRMWARE_VERSION_TYPE). + + * @param middleware_sw_version Middleware version number + * @param os_sw_version Operating system version number + * @param board_version HW / board version (last 8 bits should be silicon ID, if any). The first 16 bits of this field specify a board type from an enumeration stored at https://github.com/PX4/PX4-Bootloader/blob/master/board_types.txt and with extensive additions at https://github.com/ArduPilot/ardupilot/blob/master/Tools/AP_Bootloader/board_types.txt + * @param flight_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. + * @param middleware_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. + * @param os_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. + * @param vendor_id ID of the board vendor + * @param product_id ID of the product + * @param uid UID if provided by hardware (see uid2) + * @param uid2 UID if provided by hardware (supersedes the uid field. If this is non-zero, use this field, otherwise use uid) + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_autopilot_version_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint64_t capabilities, uint32_t flight_sw_version, uint32_t middleware_sw_version, uint32_t os_sw_version, uint32_t board_version, const uint8_t *flight_custom_version, const uint8_t *middleware_custom_version, const uint8_t *os_custom_version, uint16_t vendor_id, uint16_t product_id, uint64_t uid, const uint8_t *uid2) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN]; + _mav_put_uint64_t(buf, 0, capabilities); + _mav_put_uint64_t(buf, 8, uid); + _mav_put_uint32_t(buf, 16, flight_sw_version); + _mav_put_uint32_t(buf, 20, middleware_sw_version); + _mav_put_uint32_t(buf, 24, os_sw_version); + _mav_put_uint32_t(buf, 28, board_version); + _mav_put_uint16_t(buf, 32, vendor_id); + _mav_put_uint16_t(buf, 34, product_id); + _mav_put_uint8_t_array(buf, 36, flight_custom_version, 8); + _mav_put_uint8_t_array(buf, 44, middleware_custom_version, 8); + _mav_put_uint8_t_array(buf, 52, os_custom_version, 8); + _mav_put_uint8_t_array(buf, 60, uid2, 18); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN); +#else + mavlink_autopilot_version_t packet; + packet.capabilities = capabilities; + packet.uid = uid; + packet.flight_sw_version = flight_sw_version; + packet.middleware_sw_version = middleware_sw_version; + packet.os_sw_version = os_sw_version; + packet.board_version = board_version; + packet.vendor_id = vendor_id; + packet.product_id = product_id; + mav_array_memcpy(packet.flight_custom_version, flight_custom_version, sizeof(uint8_t)*8); + mav_array_memcpy(packet.middleware_custom_version, middleware_custom_version, sizeof(uint8_t)*8); + mav_array_memcpy(packet.os_custom_version, os_custom_version, sizeof(uint8_t)*8); + mav_array_memcpy(packet.uid2, uid2, sizeof(uint8_t)*18); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_AUTOPILOT_VERSION; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_AUTOPILOT_VERSION_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_AUTOPILOT_VERSION_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN); +#endif +} + +/** + * @brief Pack a autopilot_version message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param capabilities Bitmap of capabilities + * @param flight_sw_version Firmware version number. + The field must be encoded as 4 bytes, where each byte (shown from MSB to LSB) is part of a semantic version: (major) (minor) (patch) (FIRMWARE_VERSION_TYPE). + + * @param middleware_sw_version Middleware version number + * @param os_sw_version Operating system version number + * @param board_version HW / board version (last 8 bits should be silicon ID, if any). The first 16 bits of this field specify a board type from an enumeration stored at https://github.com/PX4/PX4-Bootloader/blob/master/board_types.txt and with extensive additions at https://github.com/ArduPilot/ardupilot/blob/master/Tools/AP_Bootloader/board_types.txt + * @param flight_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. + * @param middleware_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. + * @param os_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. + * @param vendor_id ID of the board vendor + * @param product_id ID of the product + * @param uid UID if provided by hardware (see uid2) + * @param uid2 UID if provided by hardware (supersedes the uid field. If this is non-zero, use this field, otherwise use uid) + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_autopilot_version_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint64_t capabilities,uint32_t flight_sw_version,uint32_t middleware_sw_version,uint32_t os_sw_version,uint32_t board_version,const uint8_t *flight_custom_version,const uint8_t *middleware_custom_version,const uint8_t *os_custom_version,uint16_t vendor_id,uint16_t product_id,uint64_t uid,const uint8_t *uid2) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN]; + _mav_put_uint64_t(buf, 0, capabilities); + _mav_put_uint64_t(buf, 8, uid); + _mav_put_uint32_t(buf, 16, flight_sw_version); + _mav_put_uint32_t(buf, 20, middleware_sw_version); + _mav_put_uint32_t(buf, 24, os_sw_version); + _mav_put_uint32_t(buf, 28, board_version); + _mav_put_uint16_t(buf, 32, vendor_id); + _mav_put_uint16_t(buf, 34, product_id); + _mav_put_uint8_t_array(buf, 36, flight_custom_version, 8); + _mav_put_uint8_t_array(buf, 44, middleware_custom_version, 8); + _mav_put_uint8_t_array(buf, 52, os_custom_version, 8); + _mav_put_uint8_t_array(buf, 60, uid2, 18); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN); +#else + mavlink_autopilot_version_t packet; + packet.capabilities = capabilities; + packet.uid = uid; + packet.flight_sw_version = flight_sw_version; + packet.middleware_sw_version = middleware_sw_version; + packet.os_sw_version = os_sw_version; + packet.board_version = board_version; + packet.vendor_id = vendor_id; + packet.product_id = product_id; + mav_array_assign_uint8_t(packet.flight_custom_version, flight_custom_version, 8); + mav_array_assign_uint8_t(packet.middleware_custom_version, middleware_custom_version, 8); + mav_array_assign_uint8_t(packet.os_custom_version, os_custom_version, 8); + mav_array_assign_uint8_t(packet.uid2, uid2, 18); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_AUTOPILOT_VERSION; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AUTOPILOT_VERSION_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_CRC); +} + +/** + * @brief Encode a autopilot_version struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param autopilot_version C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_autopilot_version_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_autopilot_version_t* autopilot_version) +{ + return mavlink_msg_autopilot_version_pack(system_id, component_id, msg, autopilot_version->capabilities, autopilot_version->flight_sw_version, autopilot_version->middleware_sw_version, autopilot_version->os_sw_version, autopilot_version->board_version, autopilot_version->flight_custom_version, autopilot_version->middleware_custom_version, autopilot_version->os_custom_version, autopilot_version->vendor_id, autopilot_version->product_id, autopilot_version->uid, autopilot_version->uid2); +} + +/** + * @brief Encode a autopilot_version struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param autopilot_version C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_autopilot_version_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_autopilot_version_t* autopilot_version) +{ + return mavlink_msg_autopilot_version_pack_chan(system_id, component_id, chan, msg, autopilot_version->capabilities, autopilot_version->flight_sw_version, autopilot_version->middleware_sw_version, autopilot_version->os_sw_version, autopilot_version->board_version, autopilot_version->flight_custom_version, autopilot_version->middleware_custom_version, autopilot_version->os_custom_version, autopilot_version->vendor_id, autopilot_version->product_id, autopilot_version->uid, autopilot_version->uid2); +} + +/** + * @brief Encode a autopilot_version struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param autopilot_version C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_autopilot_version_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_autopilot_version_t* autopilot_version) +{ + return mavlink_msg_autopilot_version_pack_status(system_id, component_id, _status, msg, autopilot_version->capabilities, autopilot_version->flight_sw_version, autopilot_version->middleware_sw_version, autopilot_version->os_sw_version, autopilot_version->board_version, autopilot_version->flight_custom_version, autopilot_version->middleware_custom_version, autopilot_version->os_custom_version, autopilot_version->vendor_id, autopilot_version->product_id, autopilot_version->uid, autopilot_version->uid2); +} + +/** + * @brief Send a autopilot_version message + * @param chan MAVLink channel to send the message + * + * @param capabilities Bitmap of capabilities + * @param flight_sw_version Firmware version number. + The field must be encoded as 4 bytes, where each byte (shown from MSB to LSB) is part of a semantic version: (major) (minor) (patch) (FIRMWARE_VERSION_TYPE). + + * @param middleware_sw_version Middleware version number + * @param os_sw_version Operating system version number + * @param board_version HW / board version (last 8 bits should be silicon ID, if any). The first 16 bits of this field specify a board type from an enumeration stored at https://github.com/PX4/PX4-Bootloader/blob/master/board_types.txt and with extensive additions at https://github.com/ArduPilot/ardupilot/blob/master/Tools/AP_Bootloader/board_types.txt + * @param flight_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. + * @param middleware_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. + * @param os_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. + * @param vendor_id ID of the board vendor + * @param product_id ID of the product + * @param uid UID if provided by hardware (see uid2) + * @param uid2 UID if provided by hardware (supersedes the uid field. If this is non-zero, use this field, otherwise use uid) + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_autopilot_version_send(mavlink_channel_t chan, uint64_t capabilities, uint32_t flight_sw_version, uint32_t middleware_sw_version, uint32_t os_sw_version, uint32_t board_version, const uint8_t *flight_custom_version, const uint8_t *middleware_custom_version, const uint8_t *os_custom_version, uint16_t vendor_id, uint16_t product_id, uint64_t uid, const uint8_t *uid2) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN]; + _mav_put_uint64_t(buf, 0, capabilities); + _mav_put_uint64_t(buf, 8, uid); + _mav_put_uint32_t(buf, 16, flight_sw_version); + _mav_put_uint32_t(buf, 20, middleware_sw_version); + _mav_put_uint32_t(buf, 24, os_sw_version); + _mav_put_uint32_t(buf, 28, board_version); + _mav_put_uint16_t(buf, 32, vendor_id); + _mav_put_uint16_t(buf, 34, product_id); + _mav_put_uint8_t_array(buf, 36, flight_custom_version, 8); + _mav_put_uint8_t_array(buf, 44, middleware_custom_version, 8); + _mav_put_uint8_t_array(buf, 52, os_custom_version, 8); + _mav_put_uint8_t_array(buf, 60, uid2, 18); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTOPILOT_VERSION, buf, MAVLINK_MSG_ID_AUTOPILOT_VERSION_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_CRC); +#else + mavlink_autopilot_version_t packet; + packet.capabilities = capabilities; + packet.uid = uid; + packet.flight_sw_version = flight_sw_version; + packet.middleware_sw_version = middleware_sw_version; + packet.os_sw_version = os_sw_version; + packet.board_version = board_version; + packet.vendor_id = vendor_id; + packet.product_id = product_id; + mav_array_assign_uint8_t(packet.flight_custom_version, flight_custom_version, 8); + mav_array_assign_uint8_t(packet.middleware_custom_version, middleware_custom_version, 8); + mav_array_assign_uint8_t(packet.os_custom_version, os_custom_version, 8); + mav_array_assign_uint8_t(packet.uid2, uid2, 18); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTOPILOT_VERSION, (const char *)&packet, MAVLINK_MSG_ID_AUTOPILOT_VERSION_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_CRC); +#endif +} + +/** + * @brief Send a autopilot_version message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_autopilot_version_send_struct(mavlink_channel_t chan, const mavlink_autopilot_version_t* autopilot_version) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_autopilot_version_send(chan, autopilot_version->capabilities, autopilot_version->flight_sw_version, autopilot_version->middleware_sw_version, autopilot_version->os_sw_version, autopilot_version->board_version, autopilot_version->flight_custom_version, autopilot_version->middleware_custom_version, autopilot_version->os_custom_version, autopilot_version->vendor_id, autopilot_version->product_id, autopilot_version->uid, autopilot_version->uid2); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTOPILOT_VERSION, (const char *)autopilot_version, MAVLINK_MSG_ID_AUTOPILOT_VERSION_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_CRC); +#endif +} + +#if MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_autopilot_version_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t capabilities, uint32_t flight_sw_version, uint32_t middleware_sw_version, uint32_t os_sw_version, uint32_t board_version, const uint8_t *flight_custom_version, const uint8_t *middleware_custom_version, const uint8_t *os_custom_version, uint16_t vendor_id, uint16_t product_id, uint64_t uid, const uint8_t *uid2) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint64_t(buf, 0, capabilities); + _mav_put_uint64_t(buf, 8, uid); + _mav_put_uint32_t(buf, 16, flight_sw_version); + _mav_put_uint32_t(buf, 20, middleware_sw_version); + _mav_put_uint32_t(buf, 24, os_sw_version); + _mav_put_uint32_t(buf, 28, board_version); + _mav_put_uint16_t(buf, 32, vendor_id); + _mav_put_uint16_t(buf, 34, product_id); + _mav_put_uint8_t_array(buf, 36, flight_custom_version, 8); + _mav_put_uint8_t_array(buf, 44, middleware_custom_version, 8); + _mav_put_uint8_t_array(buf, 52, os_custom_version, 8); + _mav_put_uint8_t_array(buf, 60, uid2, 18); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTOPILOT_VERSION, buf, MAVLINK_MSG_ID_AUTOPILOT_VERSION_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_CRC); +#else + mavlink_autopilot_version_t *packet = (mavlink_autopilot_version_t *)msgbuf; + packet->capabilities = capabilities; + packet->uid = uid; + packet->flight_sw_version = flight_sw_version; + packet->middleware_sw_version = middleware_sw_version; + packet->os_sw_version = os_sw_version; + packet->board_version = board_version; + packet->vendor_id = vendor_id; + packet->product_id = product_id; + mav_array_assign_uint8_t(packet->flight_custom_version, flight_custom_version, 8); + mav_array_assign_uint8_t(packet->middleware_custom_version, middleware_custom_version, 8); + mav_array_assign_uint8_t(packet->os_custom_version, os_custom_version, 8); + mav_array_assign_uint8_t(packet->uid2, uid2, 18); + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTOPILOT_VERSION, (const char *)packet, MAVLINK_MSG_ID_AUTOPILOT_VERSION_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_CRC); +#endif +} +#endif + +#endif + +// MESSAGE AUTOPILOT_VERSION UNPACKING + + +/** + * @brief Get field capabilities from autopilot_version message + * + * @return Bitmap of capabilities + */ +static inline uint64_t mavlink_msg_autopilot_version_get_capabilities(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 0); +} + +/** + * @brief Get field flight_sw_version from autopilot_version message + * + * @return Firmware version number. + The field must be encoded as 4 bytes, where each byte (shown from MSB to LSB) is part of a semantic version: (major) (minor) (patch) (FIRMWARE_VERSION_TYPE). + + */ +static inline uint32_t mavlink_msg_autopilot_version_get_flight_sw_version(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 16); +} + +/** + * @brief Get field middleware_sw_version from autopilot_version message + * + * @return Middleware version number + */ +static inline uint32_t mavlink_msg_autopilot_version_get_middleware_sw_version(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 20); +} + +/** + * @brief Get field os_sw_version from autopilot_version message + * + * @return Operating system version number + */ +static inline uint32_t mavlink_msg_autopilot_version_get_os_sw_version(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 24); +} + +/** + * @brief Get field board_version from autopilot_version message + * + * @return HW / board version (last 8 bits should be silicon ID, if any). The first 16 bits of this field specify a board type from an enumeration stored at https://github.com/PX4/PX4-Bootloader/blob/master/board_types.txt and with extensive additions at https://github.com/ArduPilot/ardupilot/blob/master/Tools/AP_Bootloader/board_types.txt + */ +static inline uint32_t mavlink_msg_autopilot_version_get_board_version(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 28); +} + +/** + * @brief Get field flight_custom_version from autopilot_version message + * + * @return Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. + */ +static inline uint16_t mavlink_msg_autopilot_version_get_flight_custom_version(const mavlink_message_t* msg, uint8_t *flight_custom_version) +{ + return _MAV_RETURN_uint8_t_array(msg, flight_custom_version, 8, 36); +} + +/** + * @brief Get field middleware_custom_version from autopilot_version message + * + * @return Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. + */ +static inline uint16_t mavlink_msg_autopilot_version_get_middleware_custom_version(const mavlink_message_t* msg, uint8_t *middleware_custom_version) +{ + return _MAV_RETURN_uint8_t_array(msg, middleware_custom_version, 8, 44); +} + +/** + * @brief Get field os_custom_version from autopilot_version message + * + * @return Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. + */ +static inline uint16_t mavlink_msg_autopilot_version_get_os_custom_version(const mavlink_message_t* msg, uint8_t *os_custom_version) +{ + return _MAV_RETURN_uint8_t_array(msg, os_custom_version, 8, 52); +} + +/** + * @brief Get field vendor_id from autopilot_version message + * + * @return ID of the board vendor + */ +static inline uint16_t mavlink_msg_autopilot_version_get_vendor_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 32); +} + +/** + * @brief Get field product_id from autopilot_version message + * + * @return ID of the product + */ +static inline uint16_t mavlink_msg_autopilot_version_get_product_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 34); +} + +/** + * @brief Get field uid from autopilot_version message + * + * @return UID if provided by hardware (see uid2) + */ +static inline uint64_t mavlink_msg_autopilot_version_get_uid(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 8); +} + +/** + * @brief Get field uid2 from autopilot_version message + * + * @return UID if provided by hardware (supersedes the uid field. If this is non-zero, use this field, otherwise use uid) + */ +static inline uint16_t mavlink_msg_autopilot_version_get_uid2(const mavlink_message_t* msg, uint8_t *uid2) +{ + return _MAV_RETURN_uint8_t_array(msg, uid2, 18, 60); +} + +/** + * @brief Decode a autopilot_version message into a struct + * + * @param msg The message to decode + * @param autopilot_version C-struct to decode the message contents into + */ +static inline void mavlink_msg_autopilot_version_decode(const mavlink_message_t* msg, mavlink_autopilot_version_t* autopilot_version) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + autopilot_version->capabilities = mavlink_msg_autopilot_version_get_capabilities(msg); + autopilot_version->uid = mavlink_msg_autopilot_version_get_uid(msg); + autopilot_version->flight_sw_version = mavlink_msg_autopilot_version_get_flight_sw_version(msg); + autopilot_version->middleware_sw_version = mavlink_msg_autopilot_version_get_middleware_sw_version(msg); + autopilot_version->os_sw_version = mavlink_msg_autopilot_version_get_os_sw_version(msg); + autopilot_version->board_version = mavlink_msg_autopilot_version_get_board_version(msg); + autopilot_version->vendor_id = mavlink_msg_autopilot_version_get_vendor_id(msg); + autopilot_version->product_id = mavlink_msg_autopilot_version_get_product_id(msg); + mavlink_msg_autopilot_version_get_flight_custom_version(msg, autopilot_version->flight_custom_version); + mavlink_msg_autopilot_version_get_middleware_custom_version(msg, autopilot_version->middleware_custom_version); + mavlink_msg_autopilot_version_get_os_custom_version(msg, autopilot_version->os_custom_version); + mavlink_msg_autopilot_version_get_uid2(msg, autopilot_version->uid2); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN? msg->len : MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN; + memset(autopilot_version, 0, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN); + memcpy(autopilot_version, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/standard/mavlink_msg_global_position_int.h b/standard/mavlink_msg_global_position_int.h new file mode 100644 index 000000000..844827004 --- /dev/null +++ b/standard/mavlink_msg_global_position_int.h @@ -0,0 +1,484 @@ +#pragma once +// MESSAGE GLOBAL_POSITION_INT PACKING + +#define MAVLINK_MSG_ID_GLOBAL_POSITION_INT 33 + + +typedef struct __mavlink_global_position_int_t { + uint32_t time_boot_ms; /*< [ms] Timestamp (time since system boot).*/ + int32_t lat; /*< [degE7] Latitude, expressed*/ + int32_t lon; /*< [degE7] Longitude, expressed*/ + int32_t alt; /*< [mm] Altitude (MSL). Note that virtually all GPS modules provide both WGS84 and MSL.*/ + int32_t relative_alt; /*< [mm] Altitude above home*/ + int16_t vx; /*< [cm/s] Ground X Speed (Latitude, positive north)*/ + int16_t vy; /*< [cm/s] Ground Y Speed (Longitude, positive east)*/ + int16_t vz; /*< [cm/s] Ground Z Speed (Altitude, positive down)*/ + uint16_t hdg; /*< [cdeg] Vehicle heading (yaw angle), 0.0..359.99 degrees. If unknown, set to: UINT16_MAX*/ +} mavlink_global_position_int_t; + +#define MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN 28 +#define MAVLINK_MSG_ID_GLOBAL_POSITION_INT_MIN_LEN 28 +#define MAVLINK_MSG_ID_33_LEN 28 +#define MAVLINK_MSG_ID_33_MIN_LEN 28 + +#define MAVLINK_MSG_ID_GLOBAL_POSITION_INT_CRC 104 +#define MAVLINK_MSG_ID_33_CRC 104 + + + +#if MAVLINK_COMMAND_24BIT +#define MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT { \ + 33, \ + "GLOBAL_POSITION_INT", \ + 9, \ + { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_global_position_int_t, time_boot_ms) }, \ + { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_global_position_int_t, lat) }, \ + { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_global_position_int_t, lon) }, \ + { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_global_position_int_t, alt) }, \ + { "relative_alt", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_global_position_int_t, relative_alt) }, \ + { "vx", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_global_position_int_t, vx) }, \ + { "vy", NULL, MAVLINK_TYPE_INT16_T, 0, 22, offsetof(mavlink_global_position_int_t, vy) }, \ + { "vz", NULL, MAVLINK_TYPE_INT16_T, 0, 24, offsetof(mavlink_global_position_int_t, vz) }, \ + { "hdg", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_global_position_int_t, hdg) }, \ + } \ +} +#else +#define MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT { \ + "GLOBAL_POSITION_INT", \ + 9, \ + { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_global_position_int_t, time_boot_ms) }, \ + { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_global_position_int_t, lat) }, \ + { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_global_position_int_t, lon) }, \ + { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_global_position_int_t, alt) }, \ + { "relative_alt", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_global_position_int_t, relative_alt) }, \ + { "vx", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_global_position_int_t, vx) }, \ + { "vy", NULL, MAVLINK_TYPE_INT16_T, 0, 22, offsetof(mavlink_global_position_int_t, vy) }, \ + { "vz", NULL, MAVLINK_TYPE_INT16_T, 0, 24, offsetof(mavlink_global_position_int_t, vz) }, \ + { "hdg", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_global_position_int_t, hdg) }, \ + } \ +} +#endif + +/** + * @brief Pack a global_position_int message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param lat [degE7] Latitude, expressed + * @param lon [degE7] Longitude, expressed + * @param alt [mm] Altitude (MSL). Note that virtually all GPS modules provide both WGS84 and MSL. + * @param relative_alt [mm] Altitude above home + * @param vx [cm/s] Ground X Speed (Latitude, positive north) + * @param vy [cm/s] Ground Y Speed (Longitude, positive east) + * @param vz [cm/s] Ground Z Speed (Altitude, positive down) + * @param hdg [cdeg] Vehicle heading (yaw angle), 0.0..359.99 degrees. If unknown, set to: UINT16_MAX + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_global_position_int_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint32_t time_boot_ms, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, int16_t vx, int16_t vy, int16_t vz, uint16_t hdg) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_int32_t(buf, 4, lat); + _mav_put_int32_t(buf, 8, lon); + _mav_put_int32_t(buf, 12, alt); + _mav_put_int32_t(buf, 16, relative_alt); + _mav_put_int16_t(buf, 20, vx); + _mav_put_int16_t(buf, 22, vy); + _mav_put_int16_t(buf, 24, vz); + _mav_put_uint16_t(buf, 26, hdg); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN); +#else + mavlink_global_position_int_t packet; + packet.time_boot_ms = time_boot_ms; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.relative_alt = relative_alt; + packet.vx = vx; + packet.vy = vy; + packet.vz = vz; + packet.hdg = hdg; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GLOBAL_POSITION_INT; + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_CRC); +} + +/** + * @brief Pack a global_position_int message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param lat [degE7] Latitude, expressed + * @param lon [degE7] Longitude, expressed + * @param alt [mm] Altitude (MSL). Note that virtually all GPS modules provide both WGS84 and MSL. + * @param relative_alt [mm] Altitude above home + * @param vx [cm/s] Ground X Speed (Latitude, positive north) + * @param vy [cm/s] Ground Y Speed (Longitude, positive east) + * @param vz [cm/s] Ground Z Speed (Altitude, positive down) + * @param hdg [cdeg] Vehicle heading (yaw angle), 0.0..359.99 degrees. If unknown, set to: UINT16_MAX + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_global_position_int_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg, + uint32_t time_boot_ms, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, int16_t vx, int16_t vy, int16_t vz, uint16_t hdg) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_int32_t(buf, 4, lat); + _mav_put_int32_t(buf, 8, lon); + _mav_put_int32_t(buf, 12, alt); + _mav_put_int32_t(buf, 16, relative_alt); + _mav_put_int16_t(buf, 20, vx); + _mav_put_int16_t(buf, 22, vy); + _mav_put_int16_t(buf, 24, vz); + _mav_put_uint16_t(buf, 26, hdg); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN); +#else + mavlink_global_position_int_t packet; + packet.time_boot_ms = time_boot_ms; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.relative_alt = relative_alt; + packet.vx = vx; + packet.vy = vy; + packet.vz = vz; + packet.hdg = hdg; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GLOBAL_POSITION_INT; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_CRC); +#else + return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN); +#endif +} + +/** + * @brief Pack a global_position_int message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param lat [degE7] Latitude, expressed + * @param lon [degE7] Longitude, expressed + * @param alt [mm] Altitude (MSL). Note that virtually all GPS modules provide both WGS84 and MSL. + * @param relative_alt [mm] Altitude above home + * @param vx [cm/s] Ground X Speed (Latitude, positive north) + * @param vy [cm/s] Ground Y Speed (Longitude, positive east) + * @param vz [cm/s] Ground Z Speed (Altitude, positive down) + * @param hdg [cdeg] Vehicle heading (yaw angle), 0.0..359.99 degrees. If unknown, set to: UINT16_MAX + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_global_position_int_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint32_t time_boot_ms,int32_t lat,int32_t lon,int32_t alt,int32_t relative_alt,int16_t vx,int16_t vy,int16_t vz,uint16_t hdg) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_int32_t(buf, 4, lat); + _mav_put_int32_t(buf, 8, lon); + _mav_put_int32_t(buf, 12, alt); + _mav_put_int32_t(buf, 16, relative_alt); + _mav_put_int16_t(buf, 20, vx); + _mav_put_int16_t(buf, 22, vy); + _mav_put_int16_t(buf, 24, vz); + _mav_put_uint16_t(buf, 26, hdg); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN); +#else + mavlink_global_position_int_t packet; + packet.time_boot_ms = time_boot_ms; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.relative_alt = relative_alt; + packet.vx = vx; + packet.vy = vy; + packet.vz = vz; + packet.hdg = hdg; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_GLOBAL_POSITION_INT; + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_CRC); +} + +/** + * @brief Encode a global_position_int struct + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param global_position_int C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_global_position_int_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_global_position_int_t* global_position_int) +{ + return mavlink_msg_global_position_int_pack(system_id, component_id, msg, global_position_int->time_boot_ms, global_position_int->lat, global_position_int->lon, global_position_int->alt, global_position_int->relative_alt, global_position_int->vx, global_position_int->vy, global_position_int->vz, global_position_int->hdg); +} + +/** + * @brief Encode a global_position_int struct on a channel + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message will be sent over + * @param msg The MAVLink message to compress the data into + * @param global_position_int C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_global_position_int_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_global_position_int_t* global_position_int) +{ + return mavlink_msg_global_position_int_pack_chan(system_id, component_id, chan, msg, global_position_int->time_boot_ms, global_position_int->lat, global_position_int->lon, global_position_int->alt, global_position_int->relative_alt, global_position_int->vx, global_position_int->vy, global_position_int->vz, global_position_int->hdg); +} + +/** + * @brief Encode a global_position_int struct with provided status structure + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param status MAVLink status structure + * @param msg The MAVLink message to compress the data into + * @param global_position_int C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_global_position_int_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_global_position_int_t* global_position_int) +{ + return mavlink_msg_global_position_int_pack_status(system_id, component_id, _status, msg, global_position_int->time_boot_ms, global_position_int->lat, global_position_int->lon, global_position_int->alt, global_position_int->relative_alt, global_position_int->vx, global_position_int->vy, global_position_int->vz, global_position_int->hdg); +} + +/** + * @brief Send a global_position_int message + * @param chan MAVLink channel to send the message + * + * @param time_boot_ms [ms] Timestamp (time since system boot). + * @param lat [degE7] Latitude, expressed + * @param lon [degE7] Longitude, expressed + * @param alt [mm] Altitude (MSL). Note that virtually all GPS modules provide both WGS84 and MSL. + * @param relative_alt [mm] Altitude above home + * @param vx [cm/s] Ground X Speed (Latitude, positive north) + * @param vy [cm/s] Ground Y Speed (Longitude, positive east) + * @param vz [cm/s] Ground Z Speed (Altitude, positive down) + * @param hdg [cdeg] Vehicle heading (yaw angle), 0.0..359.99 degrees. If unknown, set to: UINT16_MAX + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_global_position_int_send(mavlink_channel_t chan, uint32_t time_boot_ms, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, int16_t vx, int16_t vy, int16_t vz, uint16_t hdg) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN]; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_int32_t(buf, 4, lat); + _mav_put_int32_t(buf, 8, lon); + _mav_put_int32_t(buf, 12, alt); + _mav_put_int32_t(buf, 16, relative_alt); + _mav_put_int16_t(buf, 20, vx); + _mav_put_int16_t(buf, 22, vy); + _mav_put_int16_t(buf, 24, vz); + _mav_put_uint16_t(buf, 26, hdg); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT, buf, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_CRC); +#else + mavlink_global_position_int_t packet; + packet.time_boot_ms = time_boot_ms; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.relative_alt = relative_alt; + packet.vx = vx; + packet.vy = vy; + packet.vz = vz; + packet.hdg = hdg; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT, (const char *)&packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_CRC); +#endif +} + +/** + * @brief Send a global_position_int message + * @param chan MAVLink channel to send the message + * @param struct The MAVLink struct to serialize + */ +static inline void mavlink_msg_global_position_int_send_struct(mavlink_channel_t chan, const mavlink_global_position_int_t* global_position_int) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + mavlink_msg_global_position_int_send(chan, global_position_int->time_boot_ms, global_position_int->lat, global_position_int->lon, global_position_int->alt, global_position_int->relative_alt, global_position_int->vx, global_position_int->vy, global_position_int->vz, global_position_int->hdg); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT, (const char *)global_position_int, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_CRC); +#endif +} + +#if MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN <= MAVLINK_MAX_PAYLOAD_LEN +/* + This variant of _send() can be used to save stack space by reusing + memory from the receive buffer. The caller provides a + mavlink_message_t which is the size of a full mavlink message. This + is usually the receive buffer for the channel, and allows a reply to an + incoming message with minimum stack space usage. + */ +static inline void mavlink_msg_global_position_int_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, int16_t vx, int16_t vy, int16_t vz, uint16_t hdg) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char *buf = (char *)msgbuf; + _mav_put_uint32_t(buf, 0, time_boot_ms); + _mav_put_int32_t(buf, 4, lat); + _mav_put_int32_t(buf, 8, lon); + _mav_put_int32_t(buf, 12, alt); + _mav_put_int32_t(buf, 16, relative_alt); + _mav_put_int16_t(buf, 20, vx); + _mav_put_int16_t(buf, 22, vy); + _mav_put_int16_t(buf, 24, vz); + _mav_put_uint16_t(buf, 26, hdg); + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT, buf, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_CRC); +#else + mavlink_global_position_int_t *packet = (mavlink_global_position_int_t *)msgbuf; + packet->time_boot_ms = time_boot_ms; + packet->lat = lat; + packet->lon = lon; + packet->alt = alt; + packet->relative_alt = relative_alt; + packet->vx = vx; + packet->vy = vy; + packet->vz = vz; + packet->hdg = hdg; + + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT, (const char *)packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_CRC); +#endif +} +#endif + +#endif + +// MESSAGE GLOBAL_POSITION_INT UNPACKING + + +/** + * @brief Get field time_boot_ms from global_position_int message + * + * @return [ms] Timestamp (time since system boot). + */ +static inline uint32_t mavlink_msg_global_position_int_get_time_boot_ms(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint32_t(msg, 0); +} + +/** + * @brief Get field lat from global_position_int message + * + * @return [degE7] Latitude, expressed + */ +static inline int32_t mavlink_msg_global_position_int_get_lat(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 4); +} + +/** + * @brief Get field lon from global_position_int message + * + * @return [degE7] Longitude, expressed + */ +static inline int32_t mavlink_msg_global_position_int_get_lon(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 8); +} + +/** + * @brief Get field alt from global_position_int message + * + * @return [mm] Altitude (MSL). Note that virtually all GPS modules provide both WGS84 and MSL. + */ +static inline int32_t mavlink_msg_global_position_int_get_alt(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 12); +} + +/** + * @brief Get field relative_alt from global_position_int message + * + * @return [mm] Altitude above home + */ +static inline int32_t mavlink_msg_global_position_int_get_relative_alt(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 16); +} + +/** + * @brief Get field vx from global_position_int message + * + * @return [cm/s] Ground X Speed (Latitude, positive north) + */ +static inline int16_t mavlink_msg_global_position_int_get_vx(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int16_t(msg, 20); +} + +/** + * @brief Get field vy from global_position_int message + * + * @return [cm/s] Ground Y Speed (Longitude, positive east) + */ +static inline int16_t mavlink_msg_global_position_int_get_vy(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int16_t(msg, 22); +} + +/** + * @brief Get field vz from global_position_int message + * + * @return [cm/s] Ground Z Speed (Altitude, positive down) + */ +static inline int16_t mavlink_msg_global_position_int_get_vz(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int16_t(msg, 24); +} + +/** + * @brief Get field hdg from global_position_int message + * + * @return [cdeg] Vehicle heading (yaw angle), 0.0..359.99 degrees. If unknown, set to: UINT16_MAX + */ +static inline uint16_t mavlink_msg_global_position_int_get_hdg(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 26); +} + +/** + * @brief Decode a global_position_int message into a struct + * + * @param msg The message to decode + * @param global_position_int C-struct to decode the message contents into + */ +static inline void mavlink_msg_global_position_int_decode(const mavlink_message_t* msg, mavlink_global_position_int_t* global_position_int) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + global_position_int->time_boot_ms = mavlink_msg_global_position_int_get_time_boot_ms(msg); + global_position_int->lat = mavlink_msg_global_position_int_get_lat(msg); + global_position_int->lon = mavlink_msg_global_position_int_get_lon(msg); + global_position_int->alt = mavlink_msg_global_position_int_get_alt(msg); + global_position_int->relative_alt = mavlink_msg_global_position_int_get_relative_alt(msg); + global_position_int->vx = mavlink_msg_global_position_int_get_vx(msg); + global_position_int->vy = mavlink_msg_global_position_int_get_vy(msg); + global_position_int->vz = mavlink_msg_global_position_int_get_vz(msg); + global_position_int->hdg = mavlink_msg_global_position_int_get_hdg(msg); +#else + uint8_t len = msg->len < MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN? msg->len : MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN; + memset(global_position_int, 0, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN); + memcpy(global_position_int, _MAV_PAYLOAD(msg), len); +#endif +} diff --git a/standard/standard.h b/standard/standard.h index f81d6684b..82c4e92e4 100644 --- a/standard/standard.h +++ b/standard/standard.h @@ -10,8 +10,7 @@ #error Wrong include order: MAVLINK_STANDARD.H MUST NOT BE DIRECTLY USED. Include mavlink.h from the same directory instead or set ALL AND EVERY defines from MAVLINK.H manually accordingly, including the #define MAVLINK_H call. #endif -#undef MAVLINK_THIS_XML_IDX -#define MAVLINK_THIS_XML_IDX 0 +#define MAVLINK_STANDARD_XML_HASH 8124567457273401992 #ifdef __cplusplus extern "C" { @@ -24,7 +23,7 @@ extern "C" { #endif #ifndef MAVLINK_MESSAGE_CRCS -#define MAVLINK_MESSAGE_CRCS {{0, 50, 9, 9, 0, 0, 0}, {1, 124, 31, 31, 0, 0, 0}, {2, 137, 12, 12, 0, 0, 0}, {4, 237, 14, 14, 3, 12, 13}, {5, 217, 28, 28, 1, 0, 0}, {6, 104, 3, 3, 0, 0, 0}, {7, 119, 32, 32, 0, 0, 0}, {8, 117, 36, 36, 0, 0, 0}, {11, 89, 6, 6, 1, 4, 0}, {19, 137, 24, 24, 3, 4, 5}, {20, 214, 20, 20, 3, 2, 3}, {21, 159, 2, 2, 3, 0, 1}, {22, 220, 25, 25, 0, 0, 0}, {23, 168, 23, 23, 3, 4, 5}, {24, 24, 30, 52, 0, 0, 0}, {25, 23, 101, 101, 0, 0, 0}, {26, 170, 22, 24, 0, 0, 0}, {27, 144, 26, 29, 0, 0, 0}, {28, 67, 16, 16, 0, 0, 0}, {29, 115, 14, 16, 0, 0, 0}, {30, 39, 28, 28, 0, 0, 0}, {31, 246, 32, 48, 0, 0, 0}, {32, 185, 28, 28, 0, 0, 0}, {33, 104, 28, 28, 0, 0, 0}, {34, 237, 22, 22, 0, 0, 0}, {35, 244, 22, 22, 0, 0, 0}, {36, 222, 21, 37, 0, 0, 0}, {37, 212, 6, 7, 3, 4, 5}, {38, 9, 6, 7, 3, 4, 5}, {39, 254, 37, 38, 3, 32, 33}, {40, 230, 4, 5, 3, 2, 3}, {41, 28, 4, 4, 3, 2, 3}, {42, 28, 2, 2, 0, 0, 0}, {43, 132, 2, 3, 3, 0, 1}, {44, 221, 4, 5, 3, 2, 3}, {45, 232, 2, 3, 3, 0, 1}, {46, 11, 2, 2, 0, 0, 0}, {47, 153, 3, 4, 3, 0, 1}, {48, 41, 13, 21, 1, 12, 0}, {49, 39, 12, 20, 0, 0, 0}, {50, 78, 37, 37, 3, 18, 19}, {51, 196, 4, 5, 3, 2, 3}, {52, 132, 7, 7, 0, 0, 0}, {54, 15, 27, 27, 3, 24, 25}, {55, 3, 25, 25, 0, 0, 0}, {61, 167, 72, 72, 0, 0, 0}, {62, 183, 26, 26, 0, 0, 0}, {63, 119, 181, 181, 0, 0, 0}, {64, 191, 225, 225, 0, 0, 0}, {65, 118, 42, 42, 0, 0, 0}, {66, 148, 6, 6, 3, 2, 3}, {67, 21, 4, 4, 0, 0, 0}, {69, 243, 11, 11, 1, 10, 0}, {70, 124, 18, 38, 3, 16, 17}, {73, 38, 37, 38, 3, 32, 33}, {74, 20, 20, 20, 0, 0, 0}, {75, 158, 35, 35, 3, 30, 31}, {76, 152, 33, 33, 3, 30, 31}, {77, 143, 3, 10, 3, 8, 9}, {80, 14, 4, 4, 3, 2, 3}, {81, 106, 22, 22, 0, 0, 0}, {82, 49, 39, 39, 3, 36, 37}, {83, 22, 37, 37, 0, 0, 0}, {84, 143, 53, 53, 3, 50, 51}, {85, 140, 51, 51, 0, 0, 0}, {86, 5, 53, 53, 3, 50, 51}, {87, 150, 51, 51, 0, 0, 0}, {89, 231, 28, 28, 0, 0, 0}, {90, 183, 56, 56, 0, 0, 0}, {91, 63, 42, 42, 0, 0, 0}, {92, 54, 33, 33, 0, 0, 0}, {93, 47, 81, 81, 0, 0, 0}, {100, 175, 26, 34, 0, 0, 0}, {101, 102, 32, 117, 0, 0, 0}, {102, 158, 32, 117, 0, 0, 0}, {103, 208, 20, 57, 0, 0, 0}, {104, 56, 32, 116, 0, 0, 0}, {105, 93, 62, 63, 0, 0, 0}, {106, 138, 44, 44, 0, 0, 0}, {107, 108, 64, 65, 0, 0, 0}, {108, 32, 84, 84, 0, 0, 0}, {109, 185, 9, 9, 0, 0, 0}, {110, 84, 254, 254, 3, 1, 2}, {111, 34, 16, 16, 0, 0, 0}, {112, 174, 12, 12, 0, 0, 0}, {113, 124, 36, 39, 0, 0, 0}, {114, 237, 44, 44, 0, 0, 0}, {115, 4, 64, 64, 0, 0, 0}, {116, 76, 22, 24, 0, 0, 0}, {117, 128, 6, 6, 3, 4, 5}, {118, 56, 14, 14, 0, 0, 0}, {119, 116, 12, 12, 3, 10, 11}, {120, 134, 97, 97, 0, 0, 0}, {121, 237, 2, 2, 3, 0, 1}, {122, 203, 2, 2, 3, 0, 1}, {123, 250, 113, 113, 3, 0, 1}, {124, 87, 35, 37, 0, 0, 0}, {125, 203, 6, 6, 0, 0, 0}, {126, 220, 79, 79, 0, 0, 0}, {127, 25, 35, 35, 0, 0, 0}, {128, 226, 35, 35, 0, 0, 0}, {129, 46, 22, 24, 0, 0, 0}, {130, 29, 13, 13, 0, 0, 0}, {131, 223, 255, 255, 0, 0, 0}, {132, 85, 14, 39, 0, 0, 0}, {133, 6, 18, 18, 0, 0, 0}, {134, 229, 43, 43, 0, 0, 0}, {135, 203, 8, 8, 0, 0, 0}, {136, 1, 22, 22, 0, 0, 0}, {137, 195, 14, 16, 0, 0, 0}, {138, 109, 36, 120, 0, 0, 0}, {139, 168, 43, 43, 3, 41, 42}, {140, 181, 41, 41, 0, 0, 0}, {141, 47, 32, 32, 0, 0, 0}, {142, 72, 243, 243, 0, 0, 0}, {143, 131, 14, 16, 0, 0, 0}, {144, 127, 93, 93, 0, 0, 0}, {146, 103, 100, 100, 0, 0, 0}, {147, 154, 36, 54, 0, 0, 0}, {148, 178, 60, 78, 0, 0, 0}, {149, 200, 30, 60, 0, 0, 0}, {162, 189, 8, 9, 0, 0, 0}, {192, 36, 44, 54, 0, 0, 0}, {225, 208, 65, 65, 0, 0, 0}, {230, 163, 42, 42, 0, 0, 0}, {231, 105, 40, 40, 0, 0, 0}, {232, 151, 63, 65, 0, 0, 0}, {233, 35, 182, 182, 0, 0, 0}, {234, 150, 40, 40, 0, 0, 0}, {235, 179, 42, 42, 0, 0, 0}, {241, 90, 32, 32, 0, 0, 0}, {242, 104, 52, 60, 0, 0, 0}, {243, 85, 53, 61, 1, 52, 0}, {244, 95, 6, 6, 0, 0, 0}, {245, 130, 2, 2, 0, 0, 0}, {246, 184, 38, 38, 0, 0, 0}, {247, 81, 19, 19, 0, 0, 0}, {248, 8, 254, 254, 3, 3, 4}, {249, 204, 36, 36, 0, 0, 0}, {250, 49, 30, 30, 0, 0, 0}, {251, 170, 18, 18, 0, 0, 0}, {252, 44, 18, 18, 0, 0, 0}, {253, 83, 51, 54, 0, 0, 0}, {254, 46, 9, 9, 0, 0, 0}, {256, 71, 42, 42, 3, 8, 9}, {257, 131, 9, 9, 0, 0, 0}, {258, 187, 32, 232, 3, 0, 1}, {259, 92, 235, 235, 0, 0, 0}, {260, 146, 5, 13, 0, 0, 0}, {261, 179, 27, 60, 0, 0, 0}, {262, 12, 18, 22, 0, 0, 0}, {263, 133, 255, 255, 0, 0, 0}, {264, 49, 28, 28, 0, 0, 0}, {265, 26, 16, 20, 0, 0, 0}, {266, 193, 255, 255, 3, 2, 3}, {267, 35, 255, 255, 3, 2, 3}, {268, 14, 4, 4, 3, 2, 3}, {269, 109, 213, 213, 0, 0, 0}, {270, 59, 19, 19, 0, 0, 0}, {271, 22, 52, 52, 0, 0, 0}, {275, 126, 31, 31, 0, 0, 0}, {276, 18, 49, 49, 0, 0, 0}, {280, 70, 33, 33, 0, 0, 0}, {281, 48, 13, 13, 0, 0, 0}, {282, 123, 35, 35, 3, 32, 33}, {283, 74, 144, 144, 0, 0, 0}, {284, 99, 32, 32, 3, 30, 31}, {285, 137, 40, 40, 3, 38, 39}, {286, 210, 53, 53, 3, 50, 51}, {287, 1, 23, 23, 3, 20, 21}, {288, 20, 23, 23, 3, 20, 21}, {290, 221, 42, 42, 0, 0, 0}, {291, 10, 57, 57, 0, 0, 0}, {299, 19, 96, 98, 0, 0, 0}, {300, 217, 22, 22, 0, 0, 0}, {301, 243, 58, 58, 0, 0, 0}, {310, 28, 17, 17, 0, 0, 0}, {311, 95, 116, 116, 0, 0, 0}, {320, 243, 20, 20, 3, 2, 3}, {321, 88, 2, 2, 3, 0, 1}, {322, 243, 149, 149, 0, 0, 0}, {323, 78, 147, 147, 3, 0, 1}, {324, 132, 146, 146, 0, 0, 0}, {330, 23, 158, 167, 0, 0, 0}, {331, 91, 230, 232, 0, 0, 0}, {332, 236, 239, 239, 0, 0, 0}, {333, 231, 109, 109, 0, 0, 0}, {334, 72, 10, 10, 0, 0, 0}, {335, 225, 24, 24, 0, 0, 0}, {336, 245, 84, 84, 0, 0, 0}, {339, 199, 5, 5, 0, 0, 0}, {340, 99, 70, 70, 0, 0, 0}, {350, 232, 20, 252, 0, 0, 0}, {360, 11, 25, 25, 0, 0, 0}, {370, 75, 87, 87, 0, 0, 0}, {373, 117, 42, 42, 0, 0, 0}, {375, 251, 140, 140, 0, 0, 0}, {380, 232, 20, 20, 0, 0, 0}, {385, 147, 133, 133, 3, 2, 3}, {390, 156, 238, 238, 0, 0, 0}, {395, 163, 156, 156, 0, 0, 0}, {400, 110, 254, 254, 3, 4, 5}, {401, 183, 6, 6, 3, 4, 5}, {9000, 113, 137, 137, 0, 0, 0}, {9005, 117, 34, 34, 0, 0, 0}, {12900, 114, 44, 44, 3, 0, 1}, {12901, 254, 59, 59, 3, 30, 31}, {12902, 49, 53, 53, 3, 4, 5}, {12903, 249, 46, 46, 3, 0, 1}, {12904, 203, 46, 46, 3, 20, 21}, {12905, 49, 43, 43, 3, 0, 1}, {12915, 62, 254, 254, 3, 0, 1}} +#define MAVLINK_MESSAGE_CRCS {{0, 50, 9, 9, 0, 0, 0}, {33, 104, 28, 28, 0, 0, 0}, {148, 178, 60, 78, 0, 0, 0}, {300, 217, 22, 22, 0, 0, 0}} #endif #include "../protocol.h" @@ -34,6 +33,69 @@ extern "C" { // ENUM DEFINITIONS +/** @brief Enum used to indicate true or false (also: success or failure, enabled or disabled, active or inactive). */ +#ifndef HAVE_ENUM_MAV_BOOL +#define HAVE_ENUM_MAV_BOOL +typedef enum MAV_BOOL +{ + MAV_BOOL_FALSE=0, /* False. | */ + MAV_BOOL_TRUE=1, /* True. | */ + MAV_BOOL_ENUM_END=2, /* | */ +} MAV_BOOL; +#endif + +/** @brief Bitmask of (optional) autopilot capabilities (64 bit). If a bit is set, the autopilot supports this capability. */ +#ifndef HAVE_ENUM_MAV_PROTOCOL_CAPABILITY +#define HAVE_ENUM_MAV_PROTOCOL_CAPABILITY +typedef enum MAV_PROTOCOL_CAPABILITY +{ + MAV_PROTOCOL_CAPABILITY_MISSION_FLOAT=1, /* Autopilot supports the MISSION_ITEM float message type. + Note that MISSION_ITEM is deprecated, and autopilots should use MISSION_INT instead. + | */ + MAV_PROTOCOL_CAPABILITY_PARAM_FLOAT=2, /* Autopilot supports the new param float message type. | */ + MAV_PROTOCOL_CAPABILITY_MISSION_INT=4, /* Autopilot supports MISSION_ITEM_INT scaled integer message type. + Note that this flag must always be set if missions are supported, because missions must always use MISSION_ITEM_INT (rather than MISSION_ITEM, which is deprecated). + | */ + MAV_PROTOCOL_CAPABILITY_COMMAND_INT=8, /* Autopilot supports COMMAND_INT scaled integer message type. | */ + MAV_PROTOCOL_CAPABILITY_PARAM_ENCODE_BYTEWISE=16, /* Parameter protocol uses byte-wise encoding of parameter values into param_value (float) fields: https://mavlink.io/en/services/parameter.html#parameter-encoding. + Note that either this flag or MAV_PROTOCOL_CAPABILITY_PARAM_ENCODE_C_CAST should be set if the parameter protocol is supported. + | */ + MAV_PROTOCOL_CAPABILITY_FTP=32, /* Autopilot supports the File Transfer Protocol v1: https://mavlink.io/en/services/ftp.html. | */ + MAV_PROTOCOL_CAPABILITY_SET_ATTITUDE_TARGET=64, /* Autopilot supports commanding attitude offboard. | */ + MAV_PROTOCOL_CAPABILITY_SET_POSITION_TARGET_LOCAL_NED=128, /* Autopilot supports commanding position and velocity targets in local NED frame. | */ + MAV_PROTOCOL_CAPABILITY_SET_POSITION_TARGET_GLOBAL_INT=256, /* Autopilot supports commanding position and velocity targets in global scaled integers. | */ + MAV_PROTOCOL_CAPABILITY_TERRAIN=512, /* Autopilot supports terrain protocol / data handling. | */ + MAV_PROTOCOL_CAPABILITY_RESERVED3=1024, /* Reserved for future use. | */ + MAV_PROTOCOL_CAPABILITY_FLIGHT_TERMINATION=2048, /* Autopilot supports the MAV_CMD_DO_FLIGHTTERMINATION command (flight termination). | */ + MAV_PROTOCOL_CAPABILITY_COMPASS_CALIBRATION=4096, /* Autopilot supports onboard compass calibration. | */ + MAV_PROTOCOL_CAPABILITY_MAVLINK2=8192, /* Autopilot supports MAVLink version 2. | */ + MAV_PROTOCOL_CAPABILITY_MISSION_FENCE=16384, /* Autopilot supports mission fence protocol. | */ + MAV_PROTOCOL_CAPABILITY_MISSION_RALLY=32768, /* Autopilot supports mission rally point protocol. | */ + MAV_PROTOCOL_CAPABILITY_RESERVED2=65536, /* Reserved for future use. | */ + MAV_PROTOCOL_CAPABILITY_PARAM_ENCODE_C_CAST=131072, /* Parameter protocol uses C-cast of parameter values to set the param_value (float) fields: https://mavlink.io/en/services/parameter.html#parameter-encoding. + Note that either this flag or MAV_PROTOCOL_CAPABILITY_PARAM_ENCODE_BYTEWISE should be set if the parameter protocol is supported. + | */ + MAV_PROTOCOL_CAPABILITY_COMPONENT_IMPLEMENTS_GIMBAL_MANAGER=262144, /* This component implements/is a gimbal manager. This means the GIMBAL_MANAGER_INFORMATION, and other messages can be requested. + | */ + MAV_PROTOCOL_CAPABILITY_COMPONENT_ACCEPTS_GCS_CONTROL=524288, /* Component supports locking control to a particular GCS independent of its system (via MAV_CMD_REQUEST_OPERATOR_CONTROL). | */ + MAV_PROTOCOL_CAPABILITY_GRIPPER=1048576, /* Autopilot has a connected gripper. MAVLink Grippers would set MAV_TYPE_GRIPPER instead. | */ + MAV_PROTOCOL_CAPABILITY_ENUM_END=1048577, /* | */ +} MAV_PROTOCOL_CAPABILITY; +#endif + +/** @brief These values define the type of firmware release. These values indicate the first version or release of this type. For example the first alpha release would be 64, the second would be 65. */ +#ifndef HAVE_ENUM_FIRMWARE_VERSION_TYPE +#define HAVE_ENUM_FIRMWARE_VERSION_TYPE +typedef enum FIRMWARE_VERSION_TYPE +{ + FIRMWARE_VERSION_TYPE_DEV=0, /* development release | */ + FIRMWARE_VERSION_TYPE_ALPHA=64, /* alpha release | */ + FIRMWARE_VERSION_TYPE_BETA=128, /* beta release | */ + FIRMWARE_VERSION_TYPE_RC=192, /* release candidate | */ + FIRMWARE_VERSION_TYPE_OFFICIAL=255, /* official stable release | */ + FIRMWARE_VERSION_TYPE_ENUM_END=256, /* | */ +} FIRMWARE_VERSION_TYPE; +#endif // MAVLINK VERSION @@ -47,17 +109,16 @@ extern "C" { #endif // MESSAGE DEFINITIONS - +#include "./mavlink_msg_global_position_int.h" +#include "./mavlink_msg_autopilot_version.h" // base include -#include "../common/common.h" +#include "../minimal/minimal.h" -#undef MAVLINK_THIS_XML_IDX -#define MAVLINK_THIS_XML_IDX 0 -#if MAVLINK_THIS_XML_IDX == MAVLINK_PRIMARY_XML_IDX -# define MAVLINK_MESSAGE_INFO {MAVLINK_MESSAGE_INFO_HEARTBEAT, MAVLINK_MESSAGE_INFO_SYS_STATUS, MAVLINK_MESSAGE_INFO_SYSTEM_TIME, MAVLINK_MESSAGE_INFO_PING, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL_ACK, MAVLINK_MESSAGE_INFO_AUTH_KEY, MAVLINK_MESSAGE_INFO_LINK_NODE_STATUS, MAVLINK_MESSAGE_INFO_SET_MODE, MAVLINK_MESSAGE_INFO_PARAM_ACK_TRANSACTION, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_READ, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_LIST, MAVLINK_MESSAGE_INFO_PARAM_VALUE, MAVLINK_MESSAGE_INFO_PARAM_SET, MAVLINK_MESSAGE_INFO_GPS_RAW_INT, MAVLINK_MESSAGE_INFO_GPS_STATUS, MAVLINK_MESSAGE_INFO_SCALED_IMU, MAVLINK_MESSAGE_INFO_RAW_IMU, MAVLINK_MESSAGE_INFO_RAW_PRESSURE, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE, MAVLINK_MESSAGE_INFO_ATTITUDE, MAVLINK_MESSAGE_INFO_ATTITUDE_QUATERNION, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT, MAVLINK_MESSAGE_INFO_RC_CHANNELS_SCALED, MAVLINK_MESSAGE_INFO_RC_CHANNELS_RAW, MAVLINK_MESSAGE_INFO_SERVO_OUTPUT_RAW, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_PARTIAL_LIST, MAVLINK_MESSAGE_INFO_MISSION_WRITE_PARTIAL_LIST, MAVLINK_MESSAGE_INFO_MISSION_ITEM, MAVLINK_MESSAGE_INFO_MISSION_REQUEST, MAVLINK_MESSAGE_INFO_MISSION_SET_CURRENT, MAVLINK_MESSAGE_INFO_MISSION_CURRENT, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_LIST, MAVLINK_MESSAGE_INFO_MISSION_COUNT, MAVLINK_MESSAGE_INFO_MISSION_CLEAR_ALL, MAVLINK_MESSAGE_INFO_MISSION_ITEM_REACHED, MAVLINK_MESSAGE_INFO_MISSION_ACK, MAVLINK_MESSAGE_INFO_SET_GPS_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_GPS_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_PARAM_MAP_RC, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_INT, MAVLINK_MESSAGE_INFO_MISSION_CHANGED, MAVLINK_MESSAGE_INFO_SAFETY_SET_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_SAFETY_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_ATTITUDE_QUATERNION_COV, MAVLINK_MESSAGE_INFO_NAV_CONTROLLER_OUTPUT, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT_COV, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED_COV, MAVLINK_MESSAGE_INFO_RC_CHANNELS, MAVLINK_MESSAGE_INFO_REQUEST_DATA_STREAM, MAVLINK_MESSAGE_INFO_DATA_STREAM, MAVLINK_MESSAGE_INFO_MANUAL_CONTROL, MAVLINK_MESSAGE_INFO_RC_CHANNELS_OVERRIDE, MAVLINK_MESSAGE_INFO_MISSION_ITEM_INT, MAVLINK_MESSAGE_INFO_VFR_HUD, MAVLINK_MESSAGE_INFO_COMMAND_INT, MAVLINK_MESSAGE_INFO_COMMAND_LONG, MAVLINK_MESSAGE_INFO_COMMAND_ACK, MAVLINK_MESSAGE_INFO_COMMAND_CANCEL, MAVLINK_MESSAGE_INFO_MANUAL_SETPOINT, MAVLINK_MESSAGE_INFO_SET_ATTITUDE_TARGET, MAVLINK_MESSAGE_INFO_ATTITUDE_TARGET, MAVLINK_MESSAGE_INFO_SET_POSITION_TARGET_LOCAL_NED, MAVLINK_MESSAGE_INFO_POSITION_TARGET_LOCAL_NED, MAVLINK_MESSAGE_INFO_SET_POSITION_TARGET_GLOBAL_INT, MAVLINK_MESSAGE_INFO_POSITION_TARGET_GLOBAL_INT, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET, MAVLINK_MESSAGE_INFO_HIL_STATE, MAVLINK_MESSAGE_INFO_HIL_CONTROLS, MAVLINK_MESSAGE_INFO_HIL_RC_INPUTS_RAW, MAVLINK_MESSAGE_INFO_HIL_ACTUATOR_CONTROLS, MAVLINK_MESSAGE_INFO_OPTICAL_FLOW, MAVLINK_MESSAGE_INFO_GLOBAL_VISION_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_VISION_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_VISION_SPEED_ESTIMATE, MAVLINK_MESSAGE_INFO_VICON_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_HIGHRES_IMU, MAVLINK_MESSAGE_INFO_OPTICAL_FLOW_RAD, MAVLINK_MESSAGE_INFO_HIL_SENSOR, MAVLINK_MESSAGE_INFO_SIM_STATE, MAVLINK_MESSAGE_INFO_RADIO_STATUS, MAVLINK_MESSAGE_INFO_FILE_TRANSFER_PROTOCOL, MAVLINK_MESSAGE_INFO_TIMESYNC, MAVLINK_MESSAGE_INFO_CAMERA_TRIGGER, MAVLINK_MESSAGE_INFO_HIL_GPS, MAVLINK_MESSAGE_INFO_HIL_OPTICAL_FLOW, MAVLINK_MESSAGE_INFO_HIL_STATE_QUATERNION, MAVLINK_MESSAGE_INFO_SCALED_IMU2, MAVLINK_MESSAGE_INFO_LOG_REQUEST_LIST, MAVLINK_MESSAGE_INFO_LOG_ENTRY, MAVLINK_MESSAGE_INFO_LOG_REQUEST_DATA, MAVLINK_MESSAGE_INFO_LOG_DATA, MAVLINK_MESSAGE_INFO_LOG_ERASE, MAVLINK_MESSAGE_INFO_LOG_REQUEST_END, MAVLINK_MESSAGE_INFO_GPS_INJECT_DATA, MAVLINK_MESSAGE_INFO_GPS2_RAW, MAVLINK_MESSAGE_INFO_POWER_STATUS, MAVLINK_MESSAGE_INFO_SERIAL_CONTROL, MAVLINK_MESSAGE_INFO_GPS_RTK, MAVLINK_MESSAGE_INFO_GPS2_RTK, MAVLINK_MESSAGE_INFO_SCALED_IMU3, MAVLINK_MESSAGE_INFO_DATA_TRANSMISSION_HANDSHAKE, MAVLINK_MESSAGE_INFO_ENCAPSULATED_DATA, MAVLINK_MESSAGE_INFO_DISTANCE_SENSOR, MAVLINK_MESSAGE_INFO_TERRAIN_REQUEST, MAVLINK_MESSAGE_INFO_TERRAIN_DATA, MAVLINK_MESSAGE_INFO_TERRAIN_CHECK, MAVLINK_MESSAGE_INFO_TERRAIN_REPORT, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE2, MAVLINK_MESSAGE_INFO_ATT_POS_MOCAP, MAVLINK_MESSAGE_INFO_SET_ACTUATOR_CONTROL_TARGET, MAVLINK_MESSAGE_INFO_ACTUATOR_CONTROL_TARGET, MAVLINK_MESSAGE_INFO_ALTITUDE, MAVLINK_MESSAGE_INFO_RESOURCE_REQUEST, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE3, MAVLINK_MESSAGE_INFO_FOLLOW_TARGET, MAVLINK_MESSAGE_INFO_CONTROL_SYSTEM_STATE, MAVLINK_MESSAGE_INFO_BATTERY_STATUS, MAVLINK_MESSAGE_INFO_AUTOPILOT_VERSION, MAVLINK_MESSAGE_INFO_LANDING_TARGET, MAVLINK_MESSAGE_INFO_FENCE_STATUS, MAVLINK_MESSAGE_INFO_MAG_CAL_REPORT, MAVLINK_MESSAGE_INFO_EFI_STATUS, MAVLINK_MESSAGE_INFO_ESTIMATOR_STATUS, MAVLINK_MESSAGE_INFO_WIND_COV, MAVLINK_MESSAGE_INFO_GPS_INPUT, MAVLINK_MESSAGE_INFO_GPS_RTCM_DATA, MAVLINK_MESSAGE_INFO_HIGH_LATENCY, MAVLINK_MESSAGE_INFO_HIGH_LATENCY2, MAVLINK_MESSAGE_INFO_VIBRATION, MAVLINK_MESSAGE_INFO_HOME_POSITION, MAVLINK_MESSAGE_INFO_SET_HOME_POSITION, MAVLINK_MESSAGE_INFO_MESSAGE_INTERVAL, MAVLINK_MESSAGE_INFO_EXTENDED_SYS_STATE, MAVLINK_MESSAGE_INFO_ADSB_VEHICLE, MAVLINK_MESSAGE_INFO_COLLISION, MAVLINK_MESSAGE_INFO_V2_EXTENSION, MAVLINK_MESSAGE_INFO_MEMORY_VECT, MAVLINK_MESSAGE_INFO_DEBUG_VECT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_FLOAT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_INT, MAVLINK_MESSAGE_INFO_STATUSTEXT, MAVLINK_MESSAGE_INFO_DEBUG, MAVLINK_MESSAGE_INFO_SETUP_SIGNING, MAVLINK_MESSAGE_INFO_BUTTON_CHANGE, MAVLINK_MESSAGE_INFO_PLAY_TUNE, MAVLINK_MESSAGE_INFO_CAMERA_INFORMATION, MAVLINK_MESSAGE_INFO_CAMERA_SETTINGS, MAVLINK_MESSAGE_INFO_STORAGE_INFORMATION, MAVLINK_MESSAGE_INFO_CAMERA_CAPTURE_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_IMAGE_CAPTURED, MAVLINK_MESSAGE_INFO_FLIGHT_INFORMATION, MAVLINK_MESSAGE_INFO_MOUNT_ORIENTATION, MAVLINK_MESSAGE_INFO_LOGGING_DATA, MAVLINK_MESSAGE_INFO_LOGGING_DATA_ACKED, MAVLINK_MESSAGE_INFO_LOGGING_ACK, MAVLINK_MESSAGE_INFO_VIDEO_STREAM_INFORMATION, MAVLINK_MESSAGE_INFO_VIDEO_STREAM_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_FOV_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_TRACKING_IMAGE_STATUS, MAVLINK_MESSAGE_INFO_CAMERA_TRACKING_GEO_STATUS, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_INFORMATION, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_STATUS, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_SET_ATTITUDE, MAVLINK_MESSAGE_INFO_GIMBAL_DEVICE_INFORMATION, MAVLINK_MESSAGE_INFO_GIMBAL_DEVICE_SET_ATTITUDE, MAVLINK_MESSAGE_INFO_GIMBAL_DEVICE_ATTITUDE_STATUS, MAVLINK_MESSAGE_INFO_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_SET_PITCHYAW, MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_SET_MANUAL_CONTROL, MAVLINK_MESSAGE_INFO_ESC_INFO, MAVLINK_MESSAGE_INFO_ESC_STATUS, MAVLINK_MESSAGE_INFO_WIFI_CONFIG_AP, MAVLINK_MESSAGE_INFO_PROTOCOL_VERSION, MAVLINK_MESSAGE_INFO_AIS_VESSEL, MAVLINK_MESSAGE_INFO_UAVCAN_NODE_STATUS, MAVLINK_MESSAGE_INFO_UAVCAN_NODE_INFO, MAVLINK_MESSAGE_INFO_PARAM_EXT_REQUEST_READ, MAVLINK_MESSAGE_INFO_PARAM_EXT_REQUEST_LIST, MAVLINK_MESSAGE_INFO_PARAM_EXT_VALUE, MAVLINK_MESSAGE_INFO_PARAM_EXT_SET, MAVLINK_MESSAGE_INFO_PARAM_EXT_ACK, MAVLINK_MESSAGE_INFO_OBSTACLE_DISTANCE, MAVLINK_MESSAGE_INFO_ODOMETRY, MAVLINK_MESSAGE_INFO_TRAJECTORY_REPRESENTATION_WAYPOINTS, MAVLINK_MESSAGE_INFO_TRAJECTORY_REPRESENTATION_BEZIER, MAVLINK_MESSAGE_INFO_CELLULAR_STATUS, MAVLINK_MESSAGE_INFO_ISBD_LINK_STATUS, MAVLINK_MESSAGE_INFO_CELLULAR_CONFIG, MAVLINK_MESSAGE_INFO_RAW_RPM, MAVLINK_MESSAGE_INFO_UTM_GLOBAL_POSITION, MAVLINK_MESSAGE_INFO_DEBUG_FLOAT_ARRAY, MAVLINK_MESSAGE_INFO_ORBIT_EXECUTION_STATUS, MAVLINK_MESSAGE_INFO_SMART_BATTERY_INFO, MAVLINK_MESSAGE_INFO_GENERATOR_STATUS, MAVLINK_MESSAGE_INFO_ACTUATOR_OUTPUT_STATUS, MAVLINK_MESSAGE_INFO_TIME_ESTIMATE_TO_TARGET, MAVLINK_MESSAGE_INFO_TUNNEL, MAVLINK_MESSAGE_INFO_ONBOARD_COMPUTER_STATUS, MAVLINK_MESSAGE_INFO_COMPONENT_INFORMATION, MAVLINK_MESSAGE_INFO_PLAY_TUNE_V2, MAVLINK_MESSAGE_INFO_SUPPORTED_TUNES, MAVLINK_MESSAGE_INFO_WHEEL_DISTANCE, MAVLINK_MESSAGE_INFO_WINCH_STATUS, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_BASIC_ID, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_LOCATION, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_AUTHENTICATION, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_SELF_ID, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_SYSTEM, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_OPERATOR_ID, MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_MESSAGE_PACK} -# define MAVLINK_MESSAGE_NAMES {{ "ACTUATOR_CONTROL_TARGET", 140 }, { "ACTUATOR_OUTPUT_STATUS", 375 }, { "ADSB_VEHICLE", 246 }, { "AIS_VESSEL", 301 }, { "ALTITUDE", 141 }, { "ATTITUDE", 30 }, { "ATTITUDE_QUATERNION", 31 }, { "ATTITUDE_QUATERNION_COV", 61 }, { "ATTITUDE_TARGET", 83 }, { "ATT_POS_MOCAP", 138 }, { "AUTH_KEY", 7 }, { "AUTOPILOT_STATE_FOR_GIMBAL_DEVICE", 286 }, { "AUTOPILOT_VERSION", 148 }, { "BATTERY_STATUS", 147 }, { "BUTTON_CHANGE", 257 }, { "CAMERA_CAPTURE_STATUS", 262 }, { "CAMERA_FOV_STATUS", 271 }, { "CAMERA_IMAGE_CAPTURED", 263 }, { "CAMERA_INFORMATION", 259 }, { "CAMERA_SETTINGS", 260 }, { "CAMERA_TRACKING_GEO_STATUS", 276 }, { "CAMERA_TRACKING_IMAGE_STATUS", 275 }, { "CAMERA_TRIGGER", 112 }, { "CELLULAR_CONFIG", 336 }, { "CELLULAR_STATUS", 334 }, { "CHANGE_OPERATOR_CONTROL", 5 }, { "CHANGE_OPERATOR_CONTROL_ACK", 6 }, { "COLLISION", 247 }, { "COMMAND_ACK", 77 }, { "COMMAND_CANCEL", 80 }, { "COMMAND_INT", 75 }, { "COMMAND_LONG", 76 }, { "COMPONENT_INFORMATION", 395 }, { "CONTROL_SYSTEM_STATE", 146 }, { "DATA_STREAM", 67 }, { "DATA_TRANSMISSION_HANDSHAKE", 130 }, { "DEBUG", 254 }, { "DEBUG_FLOAT_ARRAY", 350 }, { "DEBUG_VECT", 250 }, { "DISTANCE_SENSOR", 132 }, { "EFI_STATUS", 225 }, { "ENCAPSULATED_DATA", 131 }, { "ESC_INFO", 290 }, { "ESC_STATUS", 291 }, { "ESTIMATOR_STATUS", 230 }, { "EXTENDED_SYS_STATE", 245 }, { "FENCE_STATUS", 162 }, { "FILE_TRANSFER_PROTOCOL", 110 }, { "FLIGHT_INFORMATION", 264 }, { "FOLLOW_TARGET", 144 }, { "GENERATOR_STATUS", 373 }, { "GIMBAL_DEVICE_ATTITUDE_STATUS", 285 }, { "GIMBAL_DEVICE_INFORMATION", 283 }, { "GIMBAL_DEVICE_SET_ATTITUDE", 284 }, { "GIMBAL_MANAGER_INFORMATION", 280 }, { "GIMBAL_MANAGER_SET_ATTITUDE", 282 }, { "GIMBAL_MANAGER_SET_MANUAL_CONTROL", 288 }, { "GIMBAL_MANAGER_SET_PITCHYAW", 287 }, { "GIMBAL_MANAGER_STATUS", 281 }, { "GLOBAL_POSITION_INT", 33 }, { "GLOBAL_POSITION_INT_COV", 63 }, { "GLOBAL_VISION_POSITION_ESTIMATE", 101 }, { "GPS2_RAW", 124 }, { "GPS2_RTK", 128 }, { "GPS_GLOBAL_ORIGIN", 49 }, { "GPS_INJECT_DATA", 123 }, { "GPS_INPUT", 232 }, { "GPS_RAW_INT", 24 }, { "GPS_RTCM_DATA", 233 }, { "GPS_RTK", 127 }, { "GPS_STATUS", 25 }, { "HEARTBEAT", 0 }, { "HIGHRES_IMU", 105 }, { "HIGH_LATENCY", 234 }, { "HIGH_LATENCY2", 235 }, { "HIL_ACTUATOR_CONTROLS", 93 }, { "HIL_CONTROLS", 91 }, { "HIL_GPS", 113 }, { "HIL_OPTICAL_FLOW", 114 }, { "HIL_RC_INPUTS_RAW", 92 }, { "HIL_SENSOR", 107 }, { "HIL_STATE", 90 }, { "HIL_STATE_QUATERNION", 115 }, { "HOME_POSITION", 242 }, { "ISBD_LINK_STATUS", 335 }, { "LANDING_TARGET", 149 }, { "LINK_NODE_STATUS", 8 }, { "LOCAL_POSITION_NED", 32 }, { "LOCAL_POSITION_NED_COV", 64 }, { "LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET", 89 }, { "LOGGING_ACK", 268 }, { "LOGGING_DATA", 266 }, { "LOGGING_DATA_ACKED", 267 }, { "LOG_DATA", 120 }, { "LOG_ENTRY", 118 }, { "LOG_ERASE", 121 }, { "LOG_REQUEST_DATA", 119 }, { "LOG_REQUEST_END", 122 }, { "LOG_REQUEST_LIST", 117 }, { "MAG_CAL_REPORT", 192 }, { "MANUAL_CONTROL", 69 }, { "MANUAL_SETPOINT", 81 }, { "MEMORY_VECT", 249 }, { "MESSAGE_INTERVAL", 244 }, { "MISSION_ACK", 47 }, { "MISSION_CHANGED", 52 }, { "MISSION_CLEAR_ALL", 45 }, { "MISSION_COUNT", 44 }, { "MISSION_CURRENT", 42 }, { "MISSION_ITEM", 39 }, { "MISSION_ITEM_INT", 73 }, { "MISSION_ITEM_REACHED", 46 }, { "MISSION_REQUEST", 40 }, { "MISSION_REQUEST_INT", 51 }, { "MISSION_REQUEST_LIST", 43 }, { "MISSION_REQUEST_PARTIAL_LIST", 37 }, { "MISSION_SET_CURRENT", 41 }, { "MISSION_WRITE_PARTIAL_LIST", 38 }, { "MOUNT_ORIENTATION", 265 }, { "NAMED_VALUE_FLOAT", 251 }, { "NAMED_VALUE_INT", 252 }, { "NAV_CONTROLLER_OUTPUT", 62 }, { "OBSTACLE_DISTANCE", 330 }, { "ODOMETRY", 331 }, { "ONBOARD_COMPUTER_STATUS", 390 }, { "OPEN_DRONE_ID_AUTHENTICATION", 12902 }, { "OPEN_DRONE_ID_BASIC_ID", 12900 }, { "OPEN_DRONE_ID_LOCATION", 12901 }, { "OPEN_DRONE_ID_MESSAGE_PACK", 12915 }, { "OPEN_DRONE_ID_OPERATOR_ID", 12905 }, { "OPEN_DRONE_ID_SELF_ID", 12903 }, { "OPEN_DRONE_ID_SYSTEM", 12904 }, { "OPTICAL_FLOW", 100 }, { "OPTICAL_FLOW_RAD", 106 }, { "ORBIT_EXECUTION_STATUS", 360 }, { "PARAM_ACK_TRANSACTION", 19 }, { "PARAM_EXT_ACK", 324 }, { "PARAM_EXT_REQUEST_LIST", 321 }, { "PARAM_EXT_REQUEST_READ", 320 }, { "PARAM_EXT_SET", 323 }, { "PARAM_EXT_VALUE", 322 }, { "PARAM_MAP_RC", 50 }, { "PARAM_REQUEST_LIST", 21 }, { "PARAM_REQUEST_READ", 20 }, { "PARAM_SET", 23 }, { "PARAM_VALUE", 22 }, { "PING", 4 }, { "PLAY_TUNE", 258 }, { "PLAY_TUNE_V2", 400 }, { "POSITION_TARGET_GLOBAL_INT", 87 }, { "POSITION_TARGET_LOCAL_NED", 85 }, { "POWER_STATUS", 125 }, { "PROTOCOL_VERSION", 300 }, { "RADIO_STATUS", 109 }, { "RAW_IMU", 27 }, { "RAW_PRESSURE", 28 }, { "RAW_RPM", 339 }, { "RC_CHANNELS", 65 }, { "RC_CHANNELS_OVERRIDE", 70 }, { "RC_CHANNELS_RAW", 35 }, { "RC_CHANNELS_SCALED", 34 }, { "REQUEST_DATA_STREAM", 66 }, { "RESOURCE_REQUEST", 142 }, { "SAFETY_ALLOWED_AREA", 55 }, { "SAFETY_SET_ALLOWED_AREA", 54 }, { "SCALED_IMU", 26 }, { "SCALED_IMU2", 116 }, { "SCALED_IMU3", 129 }, { "SCALED_PRESSURE", 29 }, { "SCALED_PRESSURE2", 137 }, { "SCALED_PRESSURE3", 143 }, { "SERIAL_CONTROL", 126 }, { "SERVO_OUTPUT_RAW", 36 }, { "SETUP_SIGNING", 256 }, { "SET_ACTUATOR_CONTROL_TARGET", 139 }, { "SET_ATTITUDE_TARGET", 82 }, { "SET_GPS_GLOBAL_ORIGIN", 48 }, { "SET_HOME_POSITION", 243 }, { "SET_MODE", 11 }, { "SET_POSITION_TARGET_GLOBAL_INT", 86 }, { "SET_POSITION_TARGET_LOCAL_NED", 84 }, { "SIM_STATE", 108 }, { "SMART_BATTERY_INFO", 370 }, { "STATUSTEXT", 253 }, { "STORAGE_INFORMATION", 261 }, { "SUPPORTED_TUNES", 401 }, { "SYSTEM_TIME", 2 }, { "SYS_STATUS", 1 }, { "TERRAIN_CHECK", 135 }, { "TERRAIN_DATA", 134 }, { "TERRAIN_REPORT", 136 }, { "TERRAIN_REQUEST", 133 }, { "TIMESYNC", 111 }, { "TIME_ESTIMATE_TO_TARGET", 380 }, { "TRAJECTORY_REPRESENTATION_BEZIER", 333 }, { "TRAJECTORY_REPRESENTATION_WAYPOINTS", 332 }, { "TUNNEL", 385 }, { "UAVCAN_NODE_INFO", 311 }, { "UAVCAN_NODE_STATUS", 310 }, { "UTM_GLOBAL_POSITION", 340 }, { "V2_EXTENSION", 248 }, { "VFR_HUD", 74 }, { "VIBRATION", 241 }, { "VICON_POSITION_ESTIMATE", 104 }, { "VIDEO_STREAM_INFORMATION", 269 }, { "VIDEO_STREAM_STATUS", 270 }, { "VISION_POSITION_ESTIMATE", 102 }, { "VISION_SPEED_ESTIMATE", 103 }, { "WHEEL_DISTANCE", 9000 }, { "WIFI_CONFIG_AP", 299 }, { "WINCH_STATUS", 9005 }, { "WIND_COV", 231 }} +#if MAVLINK_STANDARD_XML_HASH == MAVLINK_PRIMARY_XML_HASH +# define MAVLINK_MESSAGE_INFO {MAVLINK_MESSAGE_INFO_HEARTBEAT, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT, MAVLINK_MESSAGE_INFO_AUTOPILOT_VERSION, MAVLINK_MESSAGE_INFO_PROTOCOL_VERSION} +# define MAVLINK_MESSAGE_NAMES {{ "AUTOPILOT_VERSION", 148 }, { "GLOBAL_POSITION_INT", 33 }, { "HEARTBEAT", 0 }, { "PROTOCOL_VERSION", 300 }} # if MAVLINK_COMMAND_24BIT # include "../mavlink_get_info.h" # endif diff --git a/standard/testsuite.h b/standard/testsuite.h index 86b579c19..5deb7d449 100644 --- a/standard/testsuite.h +++ b/standard/testsuite.h @@ -1,6 +1,6 @@ /** @file * @brief MAVLink comm protocol testsuite generated from standard.xml - * @see http://qgroundcontrol.org/mavlink/ + * @see https://mavlink.io/en/ */ #pragma once #ifndef STANDARD_TESTSUITE_H @@ -12,23 +12,160 @@ extern "C" { #ifndef MAVLINK_TEST_ALL #define MAVLINK_TEST_ALL -static void mavlink_test_common(uint8_t, uint8_t, mavlink_message_t *last_msg); +static void mavlink_test_minimal(uint8_t, uint8_t, mavlink_message_t *last_msg); static void mavlink_test_standard(uint8_t, uint8_t, mavlink_message_t *last_msg); static void mavlink_test_all(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) { - mavlink_test_common(system_id, component_id, last_msg); + mavlink_test_minimal(system_id, component_id, last_msg); mavlink_test_standard(system_id, component_id, last_msg); } #endif -#include "../common/testsuite.h" +#include "../minimal/testsuite.h" +static void mavlink_test_global_position_int(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) +{ +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); + if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GLOBAL_POSITION_INT >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_global_position_int_t packet_in = { + 963497464,963497672,963497880,963498088,963498296,18275,18379,18483,18587 + }; + mavlink_global_position_int_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.time_boot_ms = packet_in.time_boot_ms; + packet1.lat = packet_in.lat; + packet1.lon = packet_in.lon; + packet1.alt = packet_in.alt; + packet1.relative_alt = packet_in.relative_alt; + packet1.vx = packet_in.vx; + packet1.vy = packet_in.vy; + packet1.vz = packet_in.vz; + packet1.hdg = packet_in.hdg; + + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_GLOBAL_POSITION_INT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GLOBAL_POSITION_INT_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_global_position_int_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_global_position_int_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); -static void mavlink_test_standard(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_global_position_int_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.lat , packet1.lon , packet1.alt , packet1.relative_alt , packet1.vx , packet1.vy , packet1.vz , packet1.hdg ); + mavlink_msg_global_position_int_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_global_position_int_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.lat , packet1.lon , packet1.alt , packet1.relative_alt , packet1.vx , packet1.vy , packet1.vz , packet1.hdg ); + mavlink_msg_global_position_int_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_AUTOPILOT_VERSION >= 256) { + return; + } +#endif + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_autopilot_version_t packet_in = { + 93372036854775807ULL,93372036854776311ULL,963498296,963498504,963498712,963498920,18899,19003,{ 113, 114, 115, 116, 117, 118, 119, 120 },{ 137, 138, 139, 140, 141, 142, 143, 144 },{ 161, 162, 163, 164, 165, 166, 167, 168 },{ 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202 } + }; + mavlink_autopilot_version_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.capabilities = packet_in.capabilities; + packet1.uid = packet_in.uid; + packet1.flight_sw_version = packet_in.flight_sw_version; + packet1.middleware_sw_version = packet_in.middleware_sw_version; + packet1.os_sw_version = packet_in.os_sw_version; + packet1.board_version = packet_in.board_version; + packet1.vendor_id = packet_in.vendor_id; + packet1.product_id = packet_in.product_id; + + mav_array_memcpy(packet1.flight_custom_version, packet_in.flight_custom_version, sizeof(uint8_t)*8); + mav_array_memcpy(packet1.middleware_custom_version, packet_in.middleware_custom_version, sizeof(uint8_t)*8); + mav_array_memcpy(packet1.os_custom_version, packet_in.os_custom_version, sizeof(uint8_t)*8); + mav_array_memcpy(packet1.uid2, packet_in.uid2, sizeof(uint8_t)*18); + +#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 + if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { + // cope with extensions + memset(MAVLINK_MSG_ID_AUTOPILOT_VERSION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_AUTOPILOT_VERSION_MIN_LEN); + } +#endif + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_autopilot_version_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_autopilot_version_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_autopilot_version_pack(system_id, component_id, &msg , packet1.capabilities , packet1.flight_sw_version , packet1.middleware_sw_version , packet1.os_sw_version , packet1.board_version , packet1.flight_custom_version , packet1.middleware_custom_version , packet1.os_custom_version , packet1.vendor_id , packet1.product_id , packet1.uid , packet1.uid2 ); + mavlink_msg_autopilot_version_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_autopilot_version_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.capabilities , packet1.flight_sw_version , packet1.middleware_sw_version , packet1.os_sw_version , packet1.board_version , packet1.flight_custom_version , packet1.middleware_custom_version , packet1.os_custom_version , packet1.vendor_id , packet1.product_id , packet1.uid , packet1.uid2 ); + mavlink_msg_autopilot_version_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; imsgid = MAVLINK_MSG_ID_TEST_TYPES; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_TEST_TYPES_MIN_LEN, MAVLINK_MSG_ID_TEST_TYPES_LEN, MAVLINK_MSG_ID_TEST_TYPES_CRC); -} - -/** - * @brief Pack a test_types message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param c char - * @param s string - * @param u8 uint8_t - * @param u16 uint16_t - * @param u32 uint32_t - * @param u64 uint64_t - * @param s8 int8_t - * @param s16 int16_t - * @param s32 int32_t - * @param s64 int64_t - * @param f float - * @param d double - * @param u8_array uint8_t_array - * @param u16_array uint16_t_array - * @param u32_array uint32_t_array - * @param u64_array uint64_t_array - * @param s8_array int8_t_array - * @param s16_array int16_t_array - * @param s32_array int32_t_array - * @param s64_array int64_t_array - * @param f_array float_array - * @param d_array double_array - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_test_types_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - char c,const char *s,uint8_t u8,uint16_t u16,uint32_t u32,uint64_t u64,int8_t s8,int16_t s16,int32_t s32,int64_t s64,float f,double d,const uint8_t *u8_array,const uint16_t *u16_array,const uint32_t *u32_array,const uint64_t *u64_array,const int8_t *s8_array,const int16_t *s16_array,const int32_t *s32_array,const int64_t *s64_array,const float *f_array,const double *d_array) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_TEST_TYPES_LEN]; - _mav_put_uint64_t(buf, 0, u64); - _mav_put_int64_t(buf, 8, s64); - _mav_put_double(buf, 16, d); - _mav_put_uint32_t(buf, 96, u32); - _mav_put_int32_t(buf, 100, s32); - _mav_put_float(buf, 104, f); - _mav_put_uint16_t(buf, 144, u16); - _mav_put_int16_t(buf, 146, s16); - _mav_put_char(buf, 160, c); - _mav_put_uint8_t(buf, 171, u8); - _mav_put_int8_t(buf, 172, s8); - _mav_put_uint64_t_array(buf, 24, u64_array, 3); - _mav_put_int64_t_array(buf, 48, s64_array, 3); - _mav_put_double_array(buf, 72, d_array, 3); - _mav_put_uint32_t_array(buf, 108, u32_array, 3); - _mav_put_int32_t_array(buf, 120, s32_array, 3); - _mav_put_float_array(buf, 132, f_array, 3); - _mav_put_uint16_t_array(buf, 148, u16_array, 3); - _mav_put_int16_t_array(buf, 154, s16_array, 3); - _mav_put_char_array(buf, 161, s, 10); - _mav_put_uint8_t_array(buf, 173, u8_array, 3); - _mav_put_int8_t_array(buf, 176, s8_array, 3); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TEST_TYPES_LEN); -#else - mavlink_test_types_t packet; - packet.u64 = u64; - packet.s64 = s64; - packet.d = d; - packet.u32 = u32; - packet.s32 = s32; - packet.f = f; - packet.u16 = u16; - packet.s16 = s16; - packet.c = c; - packet.u8 = u8; - packet.s8 = s8; - mav_array_memcpy(packet.u64_array, u64_array, sizeof(uint64_t)*3); - mav_array_memcpy(packet.s64_array, s64_array, sizeof(int64_t)*3); - mav_array_memcpy(packet.d_array, d_array, sizeof(double)*3); - mav_array_memcpy(packet.u32_array, u32_array, sizeof(uint32_t)*3); - mav_array_memcpy(packet.s32_array, s32_array, sizeof(int32_t)*3); - mav_array_memcpy(packet.f_array, f_array, sizeof(float)*3); - mav_array_memcpy(packet.u16_array, u16_array, sizeof(uint16_t)*3); - mav_array_memcpy(packet.s16_array, s16_array, sizeof(int16_t)*3); - mav_array_memcpy(packet.s, s, sizeof(char)*10); - mav_array_memcpy(packet.u8_array, u8_array, sizeof(uint8_t)*3); - mav_array_memcpy(packet.s8_array, s8_array, sizeof(int8_t)*3); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TEST_TYPES_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_TEST_TYPES; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_TEST_TYPES_MIN_LEN, MAVLINK_MSG_ID_TEST_TYPES_LEN, MAVLINK_MSG_ID_TEST_TYPES_CRC); -} - -/** - * @brief Encode a test_types struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param test_types C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_test_types_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_test_types_t* test_types) -{ - return mavlink_msg_test_types_pack(system_id, component_id, msg, test_types->c, test_types->s, test_types->u8, test_types->u16, test_types->u32, test_types->u64, test_types->s8, test_types->s16, test_types->s32, test_types->s64, test_types->f, test_types->d, test_types->u8_array, test_types->u16_array, test_types->u32_array, test_types->u64_array, test_types->s8_array, test_types->s16_array, test_types->s32_array, test_types->s64_array, test_types->f_array, test_types->d_array); -} - -/** - * @brief Encode a test_types struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param test_types C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_test_types_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_test_types_t* test_types) -{ - return mavlink_msg_test_types_pack_chan(system_id, component_id, chan, msg, test_types->c, test_types->s, test_types->u8, test_types->u16, test_types->u32, test_types->u64, test_types->s8, test_types->s16, test_types->s32, test_types->s64, test_types->f, test_types->d, test_types->u8_array, test_types->u16_array, test_types->u32_array, test_types->u64_array, test_types->s8_array, test_types->s16_array, test_types->s32_array, test_types->s64_array, test_types->f_array, test_types->d_array); -} - -/** - * @brief Send a test_types message - * @param chan MAVLink channel to send the message - * - * @param c char - * @param s string - * @param u8 uint8_t - * @param u16 uint16_t - * @param u32 uint32_t - * @param u64 uint64_t - * @param s8 int8_t - * @param s16 int16_t - * @param s32 int32_t - * @param s64 int64_t - * @param f float - * @param d double - * @param u8_array uint8_t_array - * @param u16_array uint16_t_array - * @param u32_array uint32_t_array - * @param u64_array uint64_t_array - * @param s8_array int8_t_array - * @param s16_array int16_t_array - * @param s32_array int32_t_array - * @param s64_array int64_t_array - * @param f_array float_array - * @param d_array double_array - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_test_types_send(mavlink_channel_t chan, char c, const char *s, uint8_t u8, uint16_t u16, uint32_t u32, uint64_t u64, int8_t s8, int16_t s16, int32_t s32, int64_t s64, float f, double d, const uint8_t *u8_array, const uint16_t *u16_array, const uint32_t *u32_array, const uint64_t *u64_array, const int8_t *s8_array, const int16_t *s16_array, const int32_t *s32_array, const int64_t *s64_array, const float *f_array, const double *d_array) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_TEST_TYPES_LEN]; - _mav_put_uint64_t(buf, 0, u64); - _mav_put_int64_t(buf, 8, s64); - _mav_put_double(buf, 16, d); - _mav_put_uint32_t(buf, 96, u32); - _mav_put_int32_t(buf, 100, s32); - _mav_put_float(buf, 104, f); - _mav_put_uint16_t(buf, 144, u16); - _mav_put_int16_t(buf, 146, s16); - _mav_put_char(buf, 160, c); - _mav_put_uint8_t(buf, 171, u8); - _mav_put_int8_t(buf, 172, s8); - _mav_put_uint64_t_array(buf, 24, u64_array, 3); - _mav_put_int64_t_array(buf, 48, s64_array, 3); - _mav_put_double_array(buf, 72, d_array, 3); - _mav_put_uint32_t_array(buf, 108, u32_array, 3); - _mav_put_int32_t_array(buf, 120, s32_array, 3); - _mav_put_float_array(buf, 132, f_array, 3); - _mav_put_uint16_t_array(buf, 148, u16_array, 3); - _mav_put_int16_t_array(buf, 154, s16_array, 3); - _mav_put_char_array(buf, 161, s, 10); - _mav_put_uint8_t_array(buf, 173, u8_array, 3); - _mav_put_int8_t_array(buf, 176, s8_array, 3); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TEST_TYPES, buf, MAVLINK_MSG_ID_TEST_TYPES_MIN_LEN, MAVLINK_MSG_ID_TEST_TYPES_LEN, MAVLINK_MSG_ID_TEST_TYPES_CRC); -#else - mavlink_test_types_t packet; - packet.u64 = u64; - packet.s64 = s64; - packet.d = d; - packet.u32 = u32; - packet.s32 = s32; - packet.f = f; - packet.u16 = u16; - packet.s16 = s16; - packet.c = c; - packet.u8 = u8; - packet.s8 = s8; - mav_array_memcpy(packet.u64_array, u64_array, sizeof(uint64_t)*3); - mav_array_memcpy(packet.s64_array, s64_array, sizeof(int64_t)*3); - mav_array_memcpy(packet.d_array, d_array, sizeof(double)*3); - mav_array_memcpy(packet.u32_array, u32_array, sizeof(uint32_t)*3); - mav_array_memcpy(packet.s32_array, s32_array, sizeof(int32_t)*3); - mav_array_memcpy(packet.f_array, f_array, sizeof(float)*3); - mav_array_memcpy(packet.u16_array, u16_array, sizeof(uint16_t)*3); - mav_array_memcpy(packet.s16_array, s16_array, sizeof(int16_t)*3); - mav_array_memcpy(packet.s, s, sizeof(char)*10); - mav_array_memcpy(packet.u8_array, u8_array, sizeof(uint8_t)*3); - mav_array_memcpy(packet.s8_array, s8_array, sizeof(int8_t)*3); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TEST_TYPES, (const char *)&packet, MAVLINK_MSG_ID_TEST_TYPES_MIN_LEN, MAVLINK_MSG_ID_TEST_TYPES_LEN, MAVLINK_MSG_ID_TEST_TYPES_CRC); -#endif -} - -/** - * @brief Send a test_types message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_test_types_send_struct(mavlink_channel_t chan, const mavlink_test_types_t* test_types) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_test_types_send(chan, test_types->c, test_types->s, test_types->u8, test_types->u16, test_types->u32, test_types->u64, test_types->s8, test_types->s16, test_types->s32, test_types->s64, test_types->f, test_types->d, test_types->u8_array, test_types->u16_array, test_types->u32_array, test_types->u64_array, test_types->s8_array, test_types->s16_array, test_types->s32_array, test_types->s64_array, test_types->f_array, test_types->d_array); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TEST_TYPES, (const char *)test_types, MAVLINK_MSG_ID_TEST_TYPES_MIN_LEN, MAVLINK_MSG_ID_TEST_TYPES_LEN, MAVLINK_MSG_ID_TEST_TYPES_CRC); -#endif -} - -#if MAVLINK_MSG_ID_TEST_TYPES_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_test_types_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, char c, const char *s, uint8_t u8, uint16_t u16, uint32_t u32, uint64_t u64, int8_t s8, int16_t s16, int32_t s32, int64_t s64, float f, double d, const uint8_t *u8_array, const uint16_t *u16_array, const uint32_t *u32_array, const uint64_t *u64_array, const int8_t *s8_array, const int16_t *s16_array, const int32_t *s32_array, const int64_t *s64_array, const float *f_array, const double *d_array) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint64_t(buf, 0, u64); - _mav_put_int64_t(buf, 8, s64); - _mav_put_double(buf, 16, d); - _mav_put_uint32_t(buf, 96, u32); - _mav_put_int32_t(buf, 100, s32); - _mav_put_float(buf, 104, f); - _mav_put_uint16_t(buf, 144, u16); - _mav_put_int16_t(buf, 146, s16); - _mav_put_char(buf, 160, c); - _mav_put_uint8_t(buf, 171, u8); - _mav_put_int8_t(buf, 172, s8); - _mav_put_uint64_t_array(buf, 24, u64_array, 3); - _mav_put_int64_t_array(buf, 48, s64_array, 3); - _mav_put_double_array(buf, 72, d_array, 3); - _mav_put_uint32_t_array(buf, 108, u32_array, 3); - _mav_put_int32_t_array(buf, 120, s32_array, 3); - _mav_put_float_array(buf, 132, f_array, 3); - _mav_put_uint16_t_array(buf, 148, u16_array, 3); - _mav_put_int16_t_array(buf, 154, s16_array, 3); - _mav_put_char_array(buf, 161, s, 10); - _mav_put_uint8_t_array(buf, 173, u8_array, 3); - _mav_put_int8_t_array(buf, 176, s8_array, 3); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TEST_TYPES, buf, MAVLINK_MSG_ID_TEST_TYPES_MIN_LEN, MAVLINK_MSG_ID_TEST_TYPES_LEN, MAVLINK_MSG_ID_TEST_TYPES_CRC); -#else - mavlink_test_types_t *packet = (mavlink_test_types_t *)msgbuf; - packet->u64 = u64; - packet->s64 = s64; - packet->d = d; - packet->u32 = u32; - packet->s32 = s32; - packet->f = f; - packet->u16 = u16; - packet->s16 = s16; - packet->c = c; - packet->u8 = u8; - packet->s8 = s8; - mav_array_memcpy(packet->u64_array, u64_array, sizeof(uint64_t)*3); - mav_array_memcpy(packet->s64_array, s64_array, sizeof(int64_t)*3); - mav_array_memcpy(packet->d_array, d_array, sizeof(double)*3); - mav_array_memcpy(packet->u32_array, u32_array, sizeof(uint32_t)*3); - mav_array_memcpy(packet->s32_array, s32_array, sizeof(int32_t)*3); - mav_array_memcpy(packet->f_array, f_array, sizeof(float)*3); - mav_array_memcpy(packet->u16_array, u16_array, sizeof(uint16_t)*3); - mav_array_memcpy(packet->s16_array, s16_array, sizeof(int16_t)*3); - mav_array_memcpy(packet->s, s, sizeof(char)*10); - mav_array_memcpy(packet->u8_array, u8_array, sizeof(uint8_t)*3); - mav_array_memcpy(packet->s8_array, s8_array, sizeof(int8_t)*3); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TEST_TYPES, (const char *)packet, MAVLINK_MSG_ID_TEST_TYPES_MIN_LEN, MAVLINK_MSG_ID_TEST_TYPES_LEN, MAVLINK_MSG_ID_TEST_TYPES_CRC); -#endif -} -#endif - -#endif - -// MESSAGE TEST_TYPES UNPACKING - - -/** - * @brief Get field c from test_types message - * - * @return char - */ -static inline char mavlink_msg_test_types_get_c(const mavlink_message_t* msg) -{ - return _MAV_RETURN_char(msg, 160); -} - -/** - * @brief Get field s from test_types message - * - * @return string - */ -static inline uint16_t mavlink_msg_test_types_get_s(const mavlink_message_t* msg, char *s) -{ - return _MAV_RETURN_char_array(msg, s, 10, 161); -} - -/** - * @brief Get field u8 from test_types message - * - * @return uint8_t - */ -static inline uint8_t mavlink_msg_test_types_get_u8(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 171); -} - -/** - * @brief Get field u16 from test_types message - * - * @return uint16_t - */ -static inline uint16_t mavlink_msg_test_types_get_u16(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 144); -} - -/** - * @brief Get field u32 from test_types message - * - * @return uint32_t - */ -static inline uint32_t mavlink_msg_test_types_get_u32(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 96); -} - -/** - * @brief Get field u64 from test_types message - * - * @return uint64_t - */ -static inline uint64_t mavlink_msg_test_types_get_u64(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint64_t(msg, 0); -} - -/** - * @brief Get field s8 from test_types message - * - * @return int8_t - */ -static inline int8_t mavlink_msg_test_types_get_s8(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int8_t(msg, 172); -} - -/** - * @brief Get field s16 from test_types message - * - * @return int16_t - */ -static inline int16_t mavlink_msg_test_types_get_s16(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 146); -} - -/** - * @brief Get field s32 from test_types message - * - * @return int32_t - */ -static inline int32_t mavlink_msg_test_types_get_s32(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 100); -} - -/** - * @brief Get field s64 from test_types message - * - * @return int64_t - */ -static inline int64_t mavlink_msg_test_types_get_s64(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int64_t(msg, 8); -} - -/** - * @brief Get field f from test_types message - * - * @return float - */ -static inline float mavlink_msg_test_types_get_f(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 104); -} - -/** - * @brief Get field d from test_types message - * - * @return double - */ -static inline double mavlink_msg_test_types_get_d(const mavlink_message_t* msg) -{ - return _MAV_RETURN_double(msg, 16); -} - -/** - * @brief Get field u8_array from test_types message - * - * @return uint8_t_array - */ -static inline uint16_t mavlink_msg_test_types_get_u8_array(const mavlink_message_t* msg, uint8_t *u8_array) -{ - return _MAV_RETURN_uint8_t_array(msg, u8_array, 3, 173); -} - -/** - * @brief Get field u16_array from test_types message - * - * @return uint16_t_array - */ -static inline uint16_t mavlink_msg_test_types_get_u16_array(const mavlink_message_t* msg, uint16_t *u16_array) -{ - return _MAV_RETURN_uint16_t_array(msg, u16_array, 3, 148); -} - -/** - * @brief Get field u32_array from test_types message - * - * @return uint32_t_array - */ -static inline uint16_t mavlink_msg_test_types_get_u32_array(const mavlink_message_t* msg, uint32_t *u32_array) -{ - return _MAV_RETURN_uint32_t_array(msg, u32_array, 3, 108); -} - -/** - * @brief Get field u64_array from test_types message - * - * @return uint64_t_array - */ -static inline uint16_t mavlink_msg_test_types_get_u64_array(const mavlink_message_t* msg, uint64_t *u64_array) -{ - return _MAV_RETURN_uint64_t_array(msg, u64_array, 3, 24); -} - -/** - * @brief Get field s8_array from test_types message - * - * @return int8_t_array - */ -static inline uint16_t mavlink_msg_test_types_get_s8_array(const mavlink_message_t* msg, int8_t *s8_array) -{ - return _MAV_RETURN_int8_t_array(msg, s8_array, 3, 176); -} - -/** - * @brief Get field s16_array from test_types message - * - * @return int16_t_array - */ -static inline uint16_t mavlink_msg_test_types_get_s16_array(const mavlink_message_t* msg, int16_t *s16_array) -{ - return _MAV_RETURN_int16_t_array(msg, s16_array, 3, 154); -} - -/** - * @brief Get field s32_array from test_types message - * - * @return int32_t_array - */ -static inline uint16_t mavlink_msg_test_types_get_s32_array(const mavlink_message_t* msg, int32_t *s32_array) -{ - return _MAV_RETURN_int32_t_array(msg, s32_array, 3, 120); -} - -/** - * @brief Get field s64_array from test_types message - * - * @return int64_t_array - */ -static inline uint16_t mavlink_msg_test_types_get_s64_array(const mavlink_message_t* msg, int64_t *s64_array) -{ - return _MAV_RETURN_int64_t_array(msg, s64_array, 3, 48); -} - -/** - * @brief Get field f_array from test_types message - * - * @return float_array - */ -static inline uint16_t mavlink_msg_test_types_get_f_array(const mavlink_message_t* msg, float *f_array) -{ - return _MAV_RETURN_float_array(msg, f_array, 3, 132); -} - -/** - * @brief Get field d_array from test_types message - * - * @return double_array - */ -static inline uint16_t mavlink_msg_test_types_get_d_array(const mavlink_message_t* msg, double *d_array) -{ - return _MAV_RETURN_double_array(msg, d_array, 3, 72); -} - -/** - * @brief Decode a test_types message into a struct - * - * @param msg The message to decode - * @param test_types C-struct to decode the message contents into - */ -static inline void mavlink_msg_test_types_decode(const mavlink_message_t* msg, mavlink_test_types_t* test_types) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - test_types->u64 = mavlink_msg_test_types_get_u64(msg); - test_types->s64 = mavlink_msg_test_types_get_s64(msg); - test_types->d = mavlink_msg_test_types_get_d(msg); - mavlink_msg_test_types_get_u64_array(msg, test_types->u64_array); - mavlink_msg_test_types_get_s64_array(msg, test_types->s64_array); - mavlink_msg_test_types_get_d_array(msg, test_types->d_array); - test_types->u32 = mavlink_msg_test_types_get_u32(msg); - test_types->s32 = mavlink_msg_test_types_get_s32(msg); - test_types->f = mavlink_msg_test_types_get_f(msg); - mavlink_msg_test_types_get_u32_array(msg, test_types->u32_array); - mavlink_msg_test_types_get_s32_array(msg, test_types->s32_array); - mavlink_msg_test_types_get_f_array(msg, test_types->f_array); - test_types->u16 = mavlink_msg_test_types_get_u16(msg); - test_types->s16 = mavlink_msg_test_types_get_s16(msg); - mavlink_msg_test_types_get_u16_array(msg, test_types->u16_array); - mavlink_msg_test_types_get_s16_array(msg, test_types->s16_array); - test_types->c = mavlink_msg_test_types_get_c(msg); - mavlink_msg_test_types_get_s(msg, test_types->s); - test_types->u8 = mavlink_msg_test_types_get_u8(msg); - test_types->s8 = mavlink_msg_test_types_get_s8(msg); - mavlink_msg_test_types_get_u8_array(msg, test_types->u8_array); - mavlink_msg_test_types_get_s8_array(msg, test_types->s8_array); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_TEST_TYPES_LEN? msg->len : MAVLINK_MSG_ID_TEST_TYPES_LEN; - memset(test_types, 0, MAVLINK_MSG_ID_TEST_TYPES_LEN); - memcpy(test_types, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/test/test.h b/test/test.h deleted file mode 100644 index 5ec6b2244..000000000 --- a/test/test.h +++ /dev/null @@ -1,69 +0,0 @@ -/** @file - * @brief MAVLink comm protocol generated from test.xml - * @see http://mavlink.org - */ -#pragma once -#ifndef MAVLINK_TEST_H -#define MAVLINK_TEST_H - -#ifndef MAVLINK_H - #error Wrong include order: MAVLINK_TEST.H MUST NOT BE DIRECTLY USED. Include mavlink.h from the same directory instead or set ALL AND EVERY defines from MAVLINK.H manually accordingly, including the #define MAVLINK_H call. -#endif - -#undef MAVLINK_THIS_XML_IDX -#define MAVLINK_THIS_XML_IDX 0 - -#ifdef __cplusplus -extern "C" { -#endif - -// MESSAGE LENGTHS AND CRCS - -#ifndef MAVLINK_MESSAGE_LENGTHS -#define MAVLINK_MESSAGE_LENGTHS {} -#endif - -#ifndef MAVLINK_MESSAGE_CRCS -#define MAVLINK_MESSAGE_CRCS {{17000, 103, 179, 179, 0, 0, 0}} -#endif - -#include "../protocol.h" - -#define MAVLINK_ENABLED_TEST - -// ENUM DEFINITIONS - - - -// MAVLINK VERSION - -#ifndef MAVLINK_VERSION -#define MAVLINK_VERSION 3 -#endif - -#if (MAVLINK_VERSION == 0) -#undef MAVLINK_VERSION -#define MAVLINK_VERSION 3 -#endif - -// MESSAGE DEFINITIONS -#include "./mavlink_msg_test_types.h" - -// base include - - -#undef MAVLINK_THIS_XML_IDX -#define MAVLINK_THIS_XML_IDX 0 - -#if MAVLINK_THIS_XML_IDX == MAVLINK_PRIMARY_XML_IDX -# define MAVLINK_MESSAGE_INFO {MAVLINK_MESSAGE_INFO_TEST_TYPES} -# define MAVLINK_MESSAGE_NAMES {{ "TEST_TYPES", 17000 }} -# if MAVLINK_COMMAND_24BIT -# include "../mavlink_get_info.h" -# endif -#endif - -#ifdef __cplusplus -} -#endif // __cplusplus -#endif // MAVLINK_TEST_H diff --git a/test/testsuite.h b/test/testsuite.h deleted file mode 100644 index d8b53b47c..000000000 --- a/test/testsuite.h +++ /dev/null @@ -1,111 +0,0 @@ -/** @file - * @brief MAVLink comm protocol testsuite generated from test.xml - * @see http://qgroundcontrol.org/mavlink/ - */ -#pragma once -#ifndef TEST_TESTSUITE_H -#define TEST_TESTSUITE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef MAVLINK_TEST_ALL -#define MAVLINK_TEST_ALL - -static void mavlink_test_test(uint8_t, uint8_t, mavlink_message_t *last_msg); - -static void mavlink_test_all(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) -{ - - mavlink_test_test(system_id, component_id, last_msg); -} -#endif - - - - -static void mavlink_test_test_types(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) -{ -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); - if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_TEST_TYPES >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_test_types_t packet_in = { - 93372036854775807ULL,93372036854776311LL,235.0,{ 93372036854777319, 93372036854777320, 93372036854777321 },{ 93372036854778831, 93372036854778832, 93372036854778833 },{ 627.0, 628.0, 629.0 },963502456,963502664,745.0,{ 963503080, 963503081, 963503082 },{ 963503704, 963503705, 963503706 },{ 941.0, 942.0, 943.0 },24723,24827,{ 24931, 24932, 24933 },{ 25243, 25244, 25245 },'E',"FGHIJKLMN",198,9,{ 76, 77, 78 },{ 21, 22, 23 } - }; - mavlink_test_types_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.u64 = packet_in.u64; - packet1.s64 = packet_in.s64; - packet1.d = packet_in.d; - packet1.u32 = packet_in.u32; - packet1.s32 = packet_in.s32; - packet1.f = packet_in.f; - packet1.u16 = packet_in.u16; - packet1.s16 = packet_in.s16; - packet1.c = packet_in.c; - packet1.u8 = packet_in.u8; - packet1.s8 = packet_in.s8; - - mav_array_memcpy(packet1.u64_array, packet_in.u64_array, sizeof(uint64_t)*3); - mav_array_memcpy(packet1.s64_array, packet_in.s64_array, sizeof(int64_t)*3); - mav_array_memcpy(packet1.d_array, packet_in.d_array, sizeof(double)*3); - mav_array_memcpy(packet1.u32_array, packet_in.u32_array, sizeof(uint32_t)*3); - mav_array_memcpy(packet1.s32_array, packet_in.s32_array, sizeof(int32_t)*3); - mav_array_memcpy(packet1.f_array, packet_in.f_array, sizeof(float)*3); - mav_array_memcpy(packet1.u16_array, packet_in.u16_array, sizeof(uint16_t)*3); - mav_array_memcpy(packet1.s16_array, packet_in.s16_array, sizeof(int16_t)*3); - mav_array_memcpy(packet1.s, packet_in.s, sizeof(char)*10); - mav_array_memcpy(packet1.u8_array, packet_in.u8_array, sizeof(uint8_t)*3); - mav_array_memcpy(packet1.s8_array, packet_in.s8_array, sizeof(int8_t)*3); - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_TEST_TYPES_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_TEST_TYPES_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_test_types_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_test_types_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_test_types_pack(system_id, component_id, &msg , packet1.c , packet1.s , packet1.u8 , packet1.u16 , packet1.u32 , packet1.u64 , packet1.s8 , packet1.s16 , packet1.s32 , packet1.s64 , packet1.f , packet1.d , packet1.u8_array , packet1.u16_array , packet1.u32_array , packet1.u64_array , packet1.s8_array , packet1.s16_array , packet1.s32_array , packet1.s64_array , packet1.f_array , packet1.d_array ); - mavlink_msg_test_types_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_test_types_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.c , packet1.s , packet1.u8 , packet1.u16 , packet1.u32 , packet1.u64 , packet1.s8 , packet1.s16 , packet1.s32 , packet1.s64 , packet1.f , packet1.d , packet1.u8_array , packet1.u16_array , packet1.u32_array , packet1.u64_array , packet1.s8_array , packet1.s16_array , packet1.s32_array , packet1.s64_array , packet1.f_array , packet1.d_array ); - mavlink_msg_test_types_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; imsgid = MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG_MIN_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG_CRC); -} - -/** - * @brief Pack a uavionix_adsb_out_cfg message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param ICAO Vehicle address (24 bit) - * @param callsign Vehicle identifier (8 characters, null terminated, valid characters are A-Z, 0-9, " " only) - * @param emitterType Transmitting vehicle type. See ADSB_EMITTER_TYPE enum - * @param aircraftSize Aircraft length and width encoding (table 2-35 of DO-282B) - * @param gpsOffsetLat GPS antenna lateral offset (table 2-36 of DO-282B) - * @param gpsOffsetLon GPS antenna longitudinal offset from nose [if non-zero, take position (in meters) divide by 2 and add one] (table 2-37 DO-282B) - * @param stallSpeed [cm/s] Aircraft stall speed in cm/s - * @param rfSelect ADS-B transponder reciever and transmit enable flags - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_uavionix_adsb_out_cfg_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint32_t ICAO,const char *callsign,uint8_t emitterType,uint8_t aircraftSize,uint8_t gpsOffsetLat,uint8_t gpsOffsetLon,uint16_t stallSpeed,uint8_t rfSelect) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG_LEN]; - _mav_put_uint32_t(buf, 0, ICAO); - _mav_put_uint16_t(buf, 4, stallSpeed); - _mav_put_uint8_t(buf, 15, emitterType); - _mav_put_uint8_t(buf, 16, aircraftSize); - _mav_put_uint8_t(buf, 17, gpsOffsetLat); - _mav_put_uint8_t(buf, 18, gpsOffsetLon); - _mav_put_uint8_t(buf, 19, rfSelect); - _mav_put_char_array(buf, 6, callsign, 9); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG_LEN); -#else - mavlink_uavionix_adsb_out_cfg_t packet; - packet.ICAO = ICAO; - packet.stallSpeed = stallSpeed; - packet.emitterType = emitterType; - packet.aircraftSize = aircraftSize; - packet.gpsOffsetLat = gpsOffsetLat; - packet.gpsOffsetLon = gpsOffsetLon; - packet.rfSelect = rfSelect; - mav_array_memcpy(packet.callsign, callsign, sizeof(char)*9); - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG_MIN_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG_CRC); -} - -/** - * @brief Encode a uavionix_adsb_out_cfg struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param uavionix_adsb_out_cfg C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_uavionix_adsb_out_cfg_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_uavionix_adsb_out_cfg_t* uavionix_adsb_out_cfg) -{ - return mavlink_msg_uavionix_adsb_out_cfg_pack(system_id, component_id, msg, uavionix_adsb_out_cfg->ICAO, uavionix_adsb_out_cfg->callsign, uavionix_adsb_out_cfg->emitterType, uavionix_adsb_out_cfg->aircraftSize, uavionix_adsb_out_cfg->gpsOffsetLat, uavionix_adsb_out_cfg->gpsOffsetLon, uavionix_adsb_out_cfg->stallSpeed, uavionix_adsb_out_cfg->rfSelect); -} - -/** - * @brief Encode a uavionix_adsb_out_cfg struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param uavionix_adsb_out_cfg C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_uavionix_adsb_out_cfg_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_uavionix_adsb_out_cfg_t* uavionix_adsb_out_cfg) -{ - return mavlink_msg_uavionix_adsb_out_cfg_pack_chan(system_id, component_id, chan, msg, uavionix_adsb_out_cfg->ICAO, uavionix_adsb_out_cfg->callsign, uavionix_adsb_out_cfg->emitterType, uavionix_adsb_out_cfg->aircraftSize, uavionix_adsb_out_cfg->gpsOffsetLat, uavionix_adsb_out_cfg->gpsOffsetLon, uavionix_adsb_out_cfg->stallSpeed, uavionix_adsb_out_cfg->rfSelect); -} - -/** - * @brief Send a uavionix_adsb_out_cfg message - * @param chan MAVLink channel to send the message - * - * @param ICAO Vehicle address (24 bit) - * @param callsign Vehicle identifier (8 characters, null terminated, valid characters are A-Z, 0-9, " " only) - * @param emitterType Transmitting vehicle type. See ADSB_EMITTER_TYPE enum - * @param aircraftSize Aircraft length and width encoding (table 2-35 of DO-282B) - * @param gpsOffsetLat GPS antenna lateral offset (table 2-36 of DO-282B) - * @param gpsOffsetLon GPS antenna longitudinal offset from nose [if non-zero, take position (in meters) divide by 2 and add one] (table 2-37 DO-282B) - * @param stallSpeed [cm/s] Aircraft stall speed in cm/s - * @param rfSelect ADS-B transponder reciever and transmit enable flags - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_uavionix_adsb_out_cfg_send(mavlink_channel_t chan, uint32_t ICAO, const char *callsign, uint8_t emitterType, uint8_t aircraftSize, uint8_t gpsOffsetLat, uint8_t gpsOffsetLon, uint16_t stallSpeed, uint8_t rfSelect) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG_LEN]; - _mav_put_uint32_t(buf, 0, ICAO); - _mav_put_uint16_t(buf, 4, stallSpeed); - _mav_put_uint8_t(buf, 15, emitterType); - _mav_put_uint8_t(buf, 16, aircraftSize); - _mav_put_uint8_t(buf, 17, gpsOffsetLat); - _mav_put_uint8_t(buf, 18, gpsOffsetLon); - _mav_put_uint8_t(buf, 19, rfSelect); - _mav_put_char_array(buf, 6, callsign, 9); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG, buf, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG_MIN_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG_CRC); -#else - mavlink_uavionix_adsb_out_cfg_t packet; - packet.ICAO = ICAO; - packet.stallSpeed = stallSpeed; - packet.emitterType = emitterType; - packet.aircraftSize = aircraftSize; - packet.gpsOffsetLat = gpsOffsetLat; - packet.gpsOffsetLon = gpsOffsetLon; - packet.rfSelect = rfSelect; - mav_array_memcpy(packet.callsign, callsign, sizeof(char)*9); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG, (const char *)&packet, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG_MIN_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG_CRC); -#endif -} - -/** - * @brief Send a uavionix_adsb_out_cfg message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_uavionix_adsb_out_cfg_send_struct(mavlink_channel_t chan, const mavlink_uavionix_adsb_out_cfg_t* uavionix_adsb_out_cfg) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_uavionix_adsb_out_cfg_send(chan, uavionix_adsb_out_cfg->ICAO, uavionix_adsb_out_cfg->callsign, uavionix_adsb_out_cfg->emitterType, uavionix_adsb_out_cfg->aircraftSize, uavionix_adsb_out_cfg->gpsOffsetLat, uavionix_adsb_out_cfg->gpsOffsetLon, uavionix_adsb_out_cfg->stallSpeed, uavionix_adsb_out_cfg->rfSelect); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG, (const char *)uavionix_adsb_out_cfg, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG_MIN_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG_CRC); -#endif -} - -#if MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_uavionix_adsb_out_cfg_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t ICAO, const char *callsign, uint8_t emitterType, uint8_t aircraftSize, uint8_t gpsOffsetLat, uint8_t gpsOffsetLon, uint16_t stallSpeed, uint8_t rfSelect) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint32_t(buf, 0, ICAO); - _mav_put_uint16_t(buf, 4, stallSpeed); - _mav_put_uint8_t(buf, 15, emitterType); - _mav_put_uint8_t(buf, 16, aircraftSize); - _mav_put_uint8_t(buf, 17, gpsOffsetLat); - _mav_put_uint8_t(buf, 18, gpsOffsetLon); - _mav_put_uint8_t(buf, 19, rfSelect); - _mav_put_char_array(buf, 6, callsign, 9); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG, buf, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG_MIN_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG_CRC); -#else - mavlink_uavionix_adsb_out_cfg_t *packet = (mavlink_uavionix_adsb_out_cfg_t *)msgbuf; - packet->ICAO = ICAO; - packet->stallSpeed = stallSpeed; - packet->emitterType = emitterType; - packet->aircraftSize = aircraftSize; - packet->gpsOffsetLat = gpsOffsetLat; - packet->gpsOffsetLon = gpsOffsetLon; - packet->rfSelect = rfSelect; - mav_array_memcpy(packet->callsign, callsign, sizeof(char)*9); - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG, (const char *)packet, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG_MIN_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG_CRC); -#endif -} -#endif - -#endif - -// MESSAGE UAVIONIX_ADSB_OUT_CFG UNPACKING - - -/** - * @brief Get field ICAO from uavionix_adsb_out_cfg message - * - * @return Vehicle address (24 bit) - */ -static inline uint32_t mavlink_msg_uavionix_adsb_out_cfg_get_ICAO(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 0); -} - -/** - * @brief Get field callsign from uavionix_adsb_out_cfg message - * - * @return Vehicle identifier (8 characters, null terminated, valid characters are A-Z, 0-9, " " only) - */ -static inline uint16_t mavlink_msg_uavionix_adsb_out_cfg_get_callsign(const mavlink_message_t* msg, char *callsign) -{ - return _MAV_RETURN_char_array(msg, callsign, 9, 6); -} - -/** - * @brief Get field emitterType from uavionix_adsb_out_cfg message - * - * @return Transmitting vehicle type. See ADSB_EMITTER_TYPE enum - */ -static inline uint8_t mavlink_msg_uavionix_adsb_out_cfg_get_emitterType(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 15); -} - -/** - * @brief Get field aircraftSize from uavionix_adsb_out_cfg message - * - * @return Aircraft length and width encoding (table 2-35 of DO-282B) - */ -static inline uint8_t mavlink_msg_uavionix_adsb_out_cfg_get_aircraftSize(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 16); -} - -/** - * @brief Get field gpsOffsetLat from uavionix_adsb_out_cfg message - * - * @return GPS antenna lateral offset (table 2-36 of DO-282B) - */ -static inline uint8_t mavlink_msg_uavionix_adsb_out_cfg_get_gpsOffsetLat(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 17); -} - -/** - * @brief Get field gpsOffsetLon from uavionix_adsb_out_cfg message - * - * @return GPS antenna longitudinal offset from nose [if non-zero, take position (in meters) divide by 2 and add one] (table 2-37 DO-282B) - */ -static inline uint8_t mavlink_msg_uavionix_adsb_out_cfg_get_gpsOffsetLon(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 18); -} - -/** - * @brief Get field stallSpeed from uavionix_adsb_out_cfg message - * - * @return [cm/s] Aircraft stall speed in cm/s - */ -static inline uint16_t mavlink_msg_uavionix_adsb_out_cfg_get_stallSpeed(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 4); -} - -/** - * @brief Get field rfSelect from uavionix_adsb_out_cfg message - * - * @return ADS-B transponder reciever and transmit enable flags - */ -static inline uint8_t mavlink_msg_uavionix_adsb_out_cfg_get_rfSelect(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 19); -} - -/** - * @brief Decode a uavionix_adsb_out_cfg message into a struct - * - * @param msg The message to decode - * @param uavionix_adsb_out_cfg C-struct to decode the message contents into - */ -static inline void mavlink_msg_uavionix_adsb_out_cfg_decode(const mavlink_message_t* msg, mavlink_uavionix_adsb_out_cfg_t* uavionix_adsb_out_cfg) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - uavionix_adsb_out_cfg->ICAO = mavlink_msg_uavionix_adsb_out_cfg_get_ICAO(msg); - uavionix_adsb_out_cfg->stallSpeed = mavlink_msg_uavionix_adsb_out_cfg_get_stallSpeed(msg); - mavlink_msg_uavionix_adsb_out_cfg_get_callsign(msg, uavionix_adsb_out_cfg->callsign); - uavionix_adsb_out_cfg->emitterType = mavlink_msg_uavionix_adsb_out_cfg_get_emitterType(msg); - uavionix_adsb_out_cfg->aircraftSize = mavlink_msg_uavionix_adsb_out_cfg_get_aircraftSize(msg); - uavionix_adsb_out_cfg->gpsOffsetLat = mavlink_msg_uavionix_adsb_out_cfg_get_gpsOffsetLat(msg); - uavionix_adsb_out_cfg->gpsOffsetLon = mavlink_msg_uavionix_adsb_out_cfg_get_gpsOffsetLon(msg); - uavionix_adsb_out_cfg->rfSelect = mavlink_msg_uavionix_adsb_out_cfg_get_rfSelect(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG_LEN? msg->len : MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG_LEN; - memset(uavionix_adsb_out_cfg, 0, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG_LEN); - memcpy(uavionix_adsb_out_cfg, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/uAvionix/mavlink_msg_uavionix_adsb_out_dynamic.h b/uAvionix/mavlink_msg_uavionix_adsb_out_dynamic.h deleted file mode 100644 index 704191bba..000000000 --- a/uAvionix/mavlink_msg_uavionix_adsb_out_dynamic.h +++ /dev/null @@ -1,588 +0,0 @@ -#pragma once -// MESSAGE UAVIONIX_ADSB_OUT_DYNAMIC PACKING - -#define MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC 10002 - - -typedef struct __mavlink_uavionix_adsb_out_dynamic_t { - uint32_t utcTime; /*< [s] UTC time in seconds since GPS epoch (Jan 6, 1980). If unknown set to UINT32_MAX*/ - int32_t gpsLat; /*< [degE7] Latitude WGS84 (deg * 1E7). If unknown set to INT32_MAX*/ - int32_t gpsLon; /*< [degE7] Longitude WGS84 (deg * 1E7). If unknown set to INT32_MAX*/ - int32_t gpsAlt; /*< [mm] Altitude (WGS84). UP +ve. If unknown set to INT32_MAX*/ - int32_t baroAltMSL; /*< [mbar] Barometric pressure altitude (MSL) relative to a standard atmosphere of 1013.2 mBar and NOT bar corrected altitude (m * 1E-3). (up +ve). If unknown set to INT32_MAX*/ - uint32_t accuracyHor; /*< [mm] Horizontal accuracy in mm (m * 1E-3). If unknown set to UINT32_MAX*/ - uint16_t accuracyVert; /*< [cm] Vertical accuracy in cm. If unknown set to UINT16_MAX*/ - uint16_t accuracyVel; /*< [mm/s] Velocity accuracy in mm/s (m * 1E-3). If unknown set to UINT16_MAX*/ - int16_t velVert; /*< [cm/s] GPS vertical speed in cm/s. If unknown set to INT16_MAX*/ - int16_t velNS; /*< [cm/s] North-South velocity over ground in cm/s North +ve. If unknown set to INT16_MAX*/ - int16_t VelEW; /*< [cm/s] East-West velocity over ground in cm/s East +ve. If unknown set to INT16_MAX*/ - uint16_t state; /*< ADS-B transponder dynamic input state flags*/ - uint16_t squawk; /*< Mode A code (typically 1200 [0x04B0] for VFR)*/ - uint8_t gpsFix; /*< 0-1: no fix, 2: 2D fix, 3: 3D fix, 4: DGPS, 5: RTK*/ - uint8_t numSats; /*< Number of satellites visible. If unknown set to UINT8_MAX*/ - uint8_t emergencyStatus; /*< Emergency status*/ -} mavlink_uavionix_adsb_out_dynamic_t; - -#define MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_LEN 41 -#define MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_MIN_LEN 41 -#define MAVLINK_MSG_ID_10002_LEN 41 -#define MAVLINK_MSG_ID_10002_MIN_LEN 41 - -#define MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_CRC 186 -#define MAVLINK_MSG_ID_10002_CRC 186 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_UAVIONIX_ADSB_OUT_DYNAMIC { \ - 10002, \ - "UAVIONIX_ADSB_OUT_DYNAMIC", \ - 16, \ - { { "utcTime", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_uavionix_adsb_out_dynamic_t, utcTime) }, \ - { "gpsLat", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_uavionix_adsb_out_dynamic_t, gpsLat) }, \ - { "gpsLon", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_uavionix_adsb_out_dynamic_t, gpsLon) }, \ - { "gpsAlt", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_uavionix_adsb_out_dynamic_t, gpsAlt) }, \ - { "gpsFix", NULL, MAVLINK_TYPE_UINT8_T, 0, 38, offsetof(mavlink_uavionix_adsb_out_dynamic_t, gpsFix) }, \ - { "numSats", NULL, MAVLINK_TYPE_UINT8_T, 0, 39, offsetof(mavlink_uavionix_adsb_out_dynamic_t, numSats) }, \ - { "baroAltMSL", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_uavionix_adsb_out_dynamic_t, baroAltMSL) }, \ - { "accuracyHor", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_uavionix_adsb_out_dynamic_t, accuracyHor) }, \ - { "accuracyVert", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_uavionix_adsb_out_dynamic_t, accuracyVert) }, \ - { "accuracyVel", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_uavionix_adsb_out_dynamic_t, accuracyVel) }, \ - { "velVert", NULL, MAVLINK_TYPE_INT16_T, 0, 28, offsetof(mavlink_uavionix_adsb_out_dynamic_t, velVert) }, \ - { "velNS", NULL, MAVLINK_TYPE_INT16_T, 0, 30, offsetof(mavlink_uavionix_adsb_out_dynamic_t, velNS) }, \ - { "VelEW", NULL, MAVLINK_TYPE_INT16_T, 0, 32, offsetof(mavlink_uavionix_adsb_out_dynamic_t, VelEW) }, \ - { "emergencyStatus", NULL, MAVLINK_TYPE_UINT8_T, 0, 40, offsetof(mavlink_uavionix_adsb_out_dynamic_t, emergencyStatus) }, \ - { "state", NULL, MAVLINK_TYPE_UINT16_T, 0, 34, offsetof(mavlink_uavionix_adsb_out_dynamic_t, state) }, \ - { "squawk", NULL, MAVLINK_TYPE_UINT16_T, 0, 36, offsetof(mavlink_uavionix_adsb_out_dynamic_t, squawk) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_UAVIONIX_ADSB_OUT_DYNAMIC { \ - "UAVIONIX_ADSB_OUT_DYNAMIC", \ - 16, \ - { { "utcTime", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_uavionix_adsb_out_dynamic_t, utcTime) }, \ - { "gpsLat", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_uavionix_adsb_out_dynamic_t, gpsLat) }, \ - { "gpsLon", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_uavionix_adsb_out_dynamic_t, gpsLon) }, \ - { "gpsAlt", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_uavionix_adsb_out_dynamic_t, gpsAlt) }, \ - { "gpsFix", NULL, MAVLINK_TYPE_UINT8_T, 0, 38, offsetof(mavlink_uavionix_adsb_out_dynamic_t, gpsFix) }, \ - { "numSats", NULL, MAVLINK_TYPE_UINT8_T, 0, 39, offsetof(mavlink_uavionix_adsb_out_dynamic_t, numSats) }, \ - { "baroAltMSL", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_uavionix_adsb_out_dynamic_t, baroAltMSL) }, \ - { "accuracyHor", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_uavionix_adsb_out_dynamic_t, accuracyHor) }, \ - { "accuracyVert", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_uavionix_adsb_out_dynamic_t, accuracyVert) }, \ - { "accuracyVel", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_uavionix_adsb_out_dynamic_t, accuracyVel) }, \ - { "velVert", NULL, MAVLINK_TYPE_INT16_T, 0, 28, offsetof(mavlink_uavionix_adsb_out_dynamic_t, velVert) }, \ - { "velNS", NULL, MAVLINK_TYPE_INT16_T, 0, 30, offsetof(mavlink_uavionix_adsb_out_dynamic_t, velNS) }, \ - { "VelEW", NULL, MAVLINK_TYPE_INT16_T, 0, 32, offsetof(mavlink_uavionix_adsb_out_dynamic_t, VelEW) }, \ - { "emergencyStatus", NULL, MAVLINK_TYPE_UINT8_T, 0, 40, offsetof(mavlink_uavionix_adsb_out_dynamic_t, emergencyStatus) }, \ - { "state", NULL, MAVLINK_TYPE_UINT16_T, 0, 34, offsetof(mavlink_uavionix_adsb_out_dynamic_t, state) }, \ - { "squawk", NULL, MAVLINK_TYPE_UINT16_T, 0, 36, offsetof(mavlink_uavionix_adsb_out_dynamic_t, squawk) }, \ - } \ -} -#endif - -/** - * @brief Pack a uavionix_adsb_out_dynamic message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param utcTime [s] UTC time in seconds since GPS epoch (Jan 6, 1980). If unknown set to UINT32_MAX - * @param gpsLat [degE7] Latitude WGS84 (deg * 1E7). If unknown set to INT32_MAX - * @param gpsLon [degE7] Longitude WGS84 (deg * 1E7). If unknown set to INT32_MAX - * @param gpsAlt [mm] Altitude (WGS84). UP +ve. If unknown set to INT32_MAX - * @param gpsFix 0-1: no fix, 2: 2D fix, 3: 3D fix, 4: DGPS, 5: RTK - * @param numSats Number of satellites visible. If unknown set to UINT8_MAX - * @param baroAltMSL [mbar] Barometric pressure altitude (MSL) relative to a standard atmosphere of 1013.2 mBar and NOT bar corrected altitude (m * 1E-3). (up +ve). If unknown set to INT32_MAX - * @param accuracyHor [mm] Horizontal accuracy in mm (m * 1E-3). If unknown set to UINT32_MAX - * @param accuracyVert [cm] Vertical accuracy in cm. If unknown set to UINT16_MAX - * @param accuracyVel [mm/s] Velocity accuracy in mm/s (m * 1E-3). If unknown set to UINT16_MAX - * @param velVert [cm/s] GPS vertical speed in cm/s. If unknown set to INT16_MAX - * @param velNS [cm/s] North-South velocity over ground in cm/s North +ve. If unknown set to INT16_MAX - * @param VelEW [cm/s] East-West velocity over ground in cm/s East +ve. If unknown set to INT16_MAX - * @param emergencyStatus Emergency status - * @param state ADS-B transponder dynamic input state flags - * @param squawk Mode A code (typically 1200 [0x04B0] for VFR) - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_uavionix_adsb_out_dynamic_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint32_t utcTime, int32_t gpsLat, int32_t gpsLon, int32_t gpsAlt, uint8_t gpsFix, uint8_t numSats, int32_t baroAltMSL, uint32_t accuracyHor, uint16_t accuracyVert, uint16_t accuracyVel, int16_t velVert, int16_t velNS, int16_t VelEW, uint8_t emergencyStatus, uint16_t state, uint16_t squawk) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_LEN]; - _mav_put_uint32_t(buf, 0, utcTime); - _mav_put_int32_t(buf, 4, gpsLat); - _mav_put_int32_t(buf, 8, gpsLon); - _mav_put_int32_t(buf, 12, gpsAlt); - _mav_put_int32_t(buf, 16, baroAltMSL); - _mav_put_uint32_t(buf, 20, accuracyHor); - _mav_put_uint16_t(buf, 24, accuracyVert); - _mav_put_uint16_t(buf, 26, accuracyVel); - _mav_put_int16_t(buf, 28, velVert); - _mav_put_int16_t(buf, 30, velNS); - _mav_put_int16_t(buf, 32, VelEW); - _mav_put_uint16_t(buf, 34, state); - _mav_put_uint16_t(buf, 36, squawk); - _mav_put_uint8_t(buf, 38, gpsFix); - _mav_put_uint8_t(buf, 39, numSats); - _mav_put_uint8_t(buf, 40, emergencyStatus); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_LEN); -#else - mavlink_uavionix_adsb_out_dynamic_t packet; - packet.utcTime = utcTime; - packet.gpsLat = gpsLat; - packet.gpsLon = gpsLon; - packet.gpsAlt = gpsAlt; - packet.baroAltMSL = baroAltMSL; - packet.accuracyHor = accuracyHor; - packet.accuracyVert = accuracyVert; - packet.accuracyVel = accuracyVel; - packet.velVert = velVert; - packet.velNS = velNS; - packet.VelEW = VelEW; - packet.state = state; - packet.squawk = squawk; - packet.gpsFix = gpsFix; - packet.numSats = numSats; - packet.emergencyStatus = emergencyStatus; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_MIN_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_CRC); -} - -/** - * @brief Pack a uavionix_adsb_out_dynamic message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param utcTime [s] UTC time in seconds since GPS epoch (Jan 6, 1980). If unknown set to UINT32_MAX - * @param gpsLat [degE7] Latitude WGS84 (deg * 1E7). If unknown set to INT32_MAX - * @param gpsLon [degE7] Longitude WGS84 (deg * 1E7). If unknown set to INT32_MAX - * @param gpsAlt [mm] Altitude (WGS84). UP +ve. If unknown set to INT32_MAX - * @param gpsFix 0-1: no fix, 2: 2D fix, 3: 3D fix, 4: DGPS, 5: RTK - * @param numSats Number of satellites visible. If unknown set to UINT8_MAX - * @param baroAltMSL [mbar] Barometric pressure altitude (MSL) relative to a standard atmosphere of 1013.2 mBar and NOT bar corrected altitude (m * 1E-3). (up +ve). If unknown set to INT32_MAX - * @param accuracyHor [mm] Horizontal accuracy in mm (m * 1E-3). If unknown set to UINT32_MAX - * @param accuracyVert [cm] Vertical accuracy in cm. If unknown set to UINT16_MAX - * @param accuracyVel [mm/s] Velocity accuracy in mm/s (m * 1E-3). If unknown set to UINT16_MAX - * @param velVert [cm/s] GPS vertical speed in cm/s. If unknown set to INT16_MAX - * @param velNS [cm/s] North-South velocity over ground in cm/s North +ve. If unknown set to INT16_MAX - * @param VelEW [cm/s] East-West velocity over ground in cm/s East +ve. If unknown set to INT16_MAX - * @param emergencyStatus Emergency status - * @param state ADS-B transponder dynamic input state flags - * @param squawk Mode A code (typically 1200 [0x04B0] for VFR) - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_uavionix_adsb_out_dynamic_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint32_t utcTime,int32_t gpsLat,int32_t gpsLon,int32_t gpsAlt,uint8_t gpsFix,uint8_t numSats,int32_t baroAltMSL,uint32_t accuracyHor,uint16_t accuracyVert,uint16_t accuracyVel,int16_t velVert,int16_t velNS,int16_t VelEW,uint8_t emergencyStatus,uint16_t state,uint16_t squawk) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_LEN]; - _mav_put_uint32_t(buf, 0, utcTime); - _mav_put_int32_t(buf, 4, gpsLat); - _mav_put_int32_t(buf, 8, gpsLon); - _mav_put_int32_t(buf, 12, gpsAlt); - _mav_put_int32_t(buf, 16, baroAltMSL); - _mav_put_uint32_t(buf, 20, accuracyHor); - _mav_put_uint16_t(buf, 24, accuracyVert); - _mav_put_uint16_t(buf, 26, accuracyVel); - _mav_put_int16_t(buf, 28, velVert); - _mav_put_int16_t(buf, 30, velNS); - _mav_put_int16_t(buf, 32, VelEW); - _mav_put_uint16_t(buf, 34, state); - _mav_put_uint16_t(buf, 36, squawk); - _mav_put_uint8_t(buf, 38, gpsFix); - _mav_put_uint8_t(buf, 39, numSats); - _mav_put_uint8_t(buf, 40, emergencyStatus); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_LEN); -#else - mavlink_uavionix_adsb_out_dynamic_t packet; - packet.utcTime = utcTime; - packet.gpsLat = gpsLat; - packet.gpsLon = gpsLon; - packet.gpsAlt = gpsAlt; - packet.baroAltMSL = baroAltMSL; - packet.accuracyHor = accuracyHor; - packet.accuracyVert = accuracyVert; - packet.accuracyVel = accuracyVel; - packet.velVert = velVert; - packet.velNS = velNS; - packet.VelEW = VelEW; - packet.state = state; - packet.squawk = squawk; - packet.gpsFix = gpsFix; - packet.numSats = numSats; - packet.emergencyStatus = emergencyStatus; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_MIN_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_CRC); -} - -/** - * @brief Encode a uavionix_adsb_out_dynamic struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param uavionix_adsb_out_dynamic C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_uavionix_adsb_out_dynamic_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_uavionix_adsb_out_dynamic_t* uavionix_adsb_out_dynamic) -{ - return mavlink_msg_uavionix_adsb_out_dynamic_pack(system_id, component_id, msg, uavionix_adsb_out_dynamic->utcTime, uavionix_adsb_out_dynamic->gpsLat, uavionix_adsb_out_dynamic->gpsLon, uavionix_adsb_out_dynamic->gpsAlt, uavionix_adsb_out_dynamic->gpsFix, uavionix_adsb_out_dynamic->numSats, uavionix_adsb_out_dynamic->baroAltMSL, uavionix_adsb_out_dynamic->accuracyHor, uavionix_adsb_out_dynamic->accuracyVert, uavionix_adsb_out_dynamic->accuracyVel, uavionix_adsb_out_dynamic->velVert, uavionix_adsb_out_dynamic->velNS, uavionix_adsb_out_dynamic->VelEW, uavionix_adsb_out_dynamic->emergencyStatus, uavionix_adsb_out_dynamic->state, uavionix_adsb_out_dynamic->squawk); -} - -/** - * @brief Encode a uavionix_adsb_out_dynamic struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param uavionix_adsb_out_dynamic C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_uavionix_adsb_out_dynamic_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_uavionix_adsb_out_dynamic_t* uavionix_adsb_out_dynamic) -{ - return mavlink_msg_uavionix_adsb_out_dynamic_pack_chan(system_id, component_id, chan, msg, uavionix_adsb_out_dynamic->utcTime, uavionix_adsb_out_dynamic->gpsLat, uavionix_adsb_out_dynamic->gpsLon, uavionix_adsb_out_dynamic->gpsAlt, uavionix_adsb_out_dynamic->gpsFix, uavionix_adsb_out_dynamic->numSats, uavionix_adsb_out_dynamic->baroAltMSL, uavionix_adsb_out_dynamic->accuracyHor, uavionix_adsb_out_dynamic->accuracyVert, uavionix_adsb_out_dynamic->accuracyVel, uavionix_adsb_out_dynamic->velVert, uavionix_adsb_out_dynamic->velNS, uavionix_adsb_out_dynamic->VelEW, uavionix_adsb_out_dynamic->emergencyStatus, uavionix_adsb_out_dynamic->state, uavionix_adsb_out_dynamic->squawk); -} - -/** - * @brief Send a uavionix_adsb_out_dynamic message - * @param chan MAVLink channel to send the message - * - * @param utcTime [s] UTC time in seconds since GPS epoch (Jan 6, 1980). If unknown set to UINT32_MAX - * @param gpsLat [degE7] Latitude WGS84 (deg * 1E7). If unknown set to INT32_MAX - * @param gpsLon [degE7] Longitude WGS84 (deg * 1E7). If unknown set to INT32_MAX - * @param gpsAlt [mm] Altitude (WGS84). UP +ve. If unknown set to INT32_MAX - * @param gpsFix 0-1: no fix, 2: 2D fix, 3: 3D fix, 4: DGPS, 5: RTK - * @param numSats Number of satellites visible. If unknown set to UINT8_MAX - * @param baroAltMSL [mbar] Barometric pressure altitude (MSL) relative to a standard atmosphere of 1013.2 mBar and NOT bar corrected altitude (m * 1E-3). (up +ve). If unknown set to INT32_MAX - * @param accuracyHor [mm] Horizontal accuracy in mm (m * 1E-3). If unknown set to UINT32_MAX - * @param accuracyVert [cm] Vertical accuracy in cm. If unknown set to UINT16_MAX - * @param accuracyVel [mm/s] Velocity accuracy in mm/s (m * 1E-3). If unknown set to UINT16_MAX - * @param velVert [cm/s] GPS vertical speed in cm/s. If unknown set to INT16_MAX - * @param velNS [cm/s] North-South velocity over ground in cm/s North +ve. If unknown set to INT16_MAX - * @param VelEW [cm/s] East-West velocity over ground in cm/s East +ve. If unknown set to INT16_MAX - * @param emergencyStatus Emergency status - * @param state ADS-B transponder dynamic input state flags - * @param squawk Mode A code (typically 1200 [0x04B0] for VFR) - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_uavionix_adsb_out_dynamic_send(mavlink_channel_t chan, uint32_t utcTime, int32_t gpsLat, int32_t gpsLon, int32_t gpsAlt, uint8_t gpsFix, uint8_t numSats, int32_t baroAltMSL, uint32_t accuracyHor, uint16_t accuracyVert, uint16_t accuracyVel, int16_t velVert, int16_t velNS, int16_t VelEW, uint8_t emergencyStatus, uint16_t state, uint16_t squawk) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_LEN]; - _mav_put_uint32_t(buf, 0, utcTime); - _mav_put_int32_t(buf, 4, gpsLat); - _mav_put_int32_t(buf, 8, gpsLon); - _mav_put_int32_t(buf, 12, gpsAlt); - _mav_put_int32_t(buf, 16, baroAltMSL); - _mav_put_uint32_t(buf, 20, accuracyHor); - _mav_put_uint16_t(buf, 24, accuracyVert); - _mav_put_uint16_t(buf, 26, accuracyVel); - _mav_put_int16_t(buf, 28, velVert); - _mav_put_int16_t(buf, 30, velNS); - _mav_put_int16_t(buf, 32, VelEW); - _mav_put_uint16_t(buf, 34, state); - _mav_put_uint16_t(buf, 36, squawk); - _mav_put_uint8_t(buf, 38, gpsFix); - _mav_put_uint8_t(buf, 39, numSats); - _mav_put_uint8_t(buf, 40, emergencyStatus); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC, buf, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_MIN_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_CRC); -#else - mavlink_uavionix_adsb_out_dynamic_t packet; - packet.utcTime = utcTime; - packet.gpsLat = gpsLat; - packet.gpsLon = gpsLon; - packet.gpsAlt = gpsAlt; - packet.baroAltMSL = baroAltMSL; - packet.accuracyHor = accuracyHor; - packet.accuracyVert = accuracyVert; - packet.accuracyVel = accuracyVel; - packet.velVert = velVert; - packet.velNS = velNS; - packet.VelEW = VelEW; - packet.state = state; - packet.squawk = squawk; - packet.gpsFix = gpsFix; - packet.numSats = numSats; - packet.emergencyStatus = emergencyStatus; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC, (const char *)&packet, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_MIN_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_CRC); -#endif -} - -/** - * @brief Send a uavionix_adsb_out_dynamic message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_uavionix_adsb_out_dynamic_send_struct(mavlink_channel_t chan, const mavlink_uavionix_adsb_out_dynamic_t* uavionix_adsb_out_dynamic) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_uavionix_adsb_out_dynamic_send(chan, uavionix_adsb_out_dynamic->utcTime, uavionix_adsb_out_dynamic->gpsLat, uavionix_adsb_out_dynamic->gpsLon, uavionix_adsb_out_dynamic->gpsAlt, uavionix_adsb_out_dynamic->gpsFix, uavionix_adsb_out_dynamic->numSats, uavionix_adsb_out_dynamic->baroAltMSL, uavionix_adsb_out_dynamic->accuracyHor, uavionix_adsb_out_dynamic->accuracyVert, uavionix_adsb_out_dynamic->accuracyVel, uavionix_adsb_out_dynamic->velVert, uavionix_adsb_out_dynamic->velNS, uavionix_adsb_out_dynamic->VelEW, uavionix_adsb_out_dynamic->emergencyStatus, uavionix_adsb_out_dynamic->state, uavionix_adsb_out_dynamic->squawk); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC, (const char *)uavionix_adsb_out_dynamic, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_MIN_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_CRC); -#endif -} - -#if MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_uavionix_adsb_out_dynamic_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t utcTime, int32_t gpsLat, int32_t gpsLon, int32_t gpsAlt, uint8_t gpsFix, uint8_t numSats, int32_t baroAltMSL, uint32_t accuracyHor, uint16_t accuracyVert, uint16_t accuracyVel, int16_t velVert, int16_t velNS, int16_t VelEW, uint8_t emergencyStatus, uint16_t state, uint16_t squawk) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint32_t(buf, 0, utcTime); - _mav_put_int32_t(buf, 4, gpsLat); - _mav_put_int32_t(buf, 8, gpsLon); - _mav_put_int32_t(buf, 12, gpsAlt); - _mav_put_int32_t(buf, 16, baroAltMSL); - _mav_put_uint32_t(buf, 20, accuracyHor); - _mav_put_uint16_t(buf, 24, accuracyVert); - _mav_put_uint16_t(buf, 26, accuracyVel); - _mav_put_int16_t(buf, 28, velVert); - _mav_put_int16_t(buf, 30, velNS); - _mav_put_int16_t(buf, 32, VelEW); - _mav_put_uint16_t(buf, 34, state); - _mav_put_uint16_t(buf, 36, squawk); - _mav_put_uint8_t(buf, 38, gpsFix); - _mav_put_uint8_t(buf, 39, numSats); - _mav_put_uint8_t(buf, 40, emergencyStatus); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC, buf, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_MIN_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_CRC); -#else - mavlink_uavionix_adsb_out_dynamic_t *packet = (mavlink_uavionix_adsb_out_dynamic_t *)msgbuf; - packet->utcTime = utcTime; - packet->gpsLat = gpsLat; - packet->gpsLon = gpsLon; - packet->gpsAlt = gpsAlt; - packet->baroAltMSL = baroAltMSL; - packet->accuracyHor = accuracyHor; - packet->accuracyVert = accuracyVert; - packet->accuracyVel = accuracyVel; - packet->velVert = velVert; - packet->velNS = velNS; - packet->VelEW = VelEW; - packet->state = state; - packet->squawk = squawk; - packet->gpsFix = gpsFix; - packet->numSats = numSats; - packet->emergencyStatus = emergencyStatus; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC, (const char *)packet, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_MIN_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_CRC); -#endif -} -#endif - -#endif - -// MESSAGE UAVIONIX_ADSB_OUT_DYNAMIC UNPACKING - - -/** - * @brief Get field utcTime from uavionix_adsb_out_dynamic message - * - * @return [s] UTC time in seconds since GPS epoch (Jan 6, 1980). If unknown set to UINT32_MAX - */ -static inline uint32_t mavlink_msg_uavionix_adsb_out_dynamic_get_utcTime(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 0); -} - -/** - * @brief Get field gpsLat from uavionix_adsb_out_dynamic message - * - * @return [degE7] Latitude WGS84 (deg * 1E7). If unknown set to INT32_MAX - */ -static inline int32_t mavlink_msg_uavionix_adsb_out_dynamic_get_gpsLat(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 4); -} - -/** - * @brief Get field gpsLon from uavionix_adsb_out_dynamic message - * - * @return [degE7] Longitude WGS84 (deg * 1E7). If unknown set to INT32_MAX - */ -static inline int32_t mavlink_msg_uavionix_adsb_out_dynamic_get_gpsLon(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 8); -} - -/** - * @brief Get field gpsAlt from uavionix_adsb_out_dynamic message - * - * @return [mm] Altitude (WGS84). UP +ve. If unknown set to INT32_MAX - */ -static inline int32_t mavlink_msg_uavionix_adsb_out_dynamic_get_gpsAlt(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 12); -} - -/** - * @brief Get field gpsFix from uavionix_adsb_out_dynamic message - * - * @return 0-1: no fix, 2: 2D fix, 3: 3D fix, 4: DGPS, 5: RTK - */ -static inline uint8_t mavlink_msg_uavionix_adsb_out_dynamic_get_gpsFix(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 38); -} - -/** - * @brief Get field numSats from uavionix_adsb_out_dynamic message - * - * @return Number of satellites visible. If unknown set to UINT8_MAX - */ -static inline uint8_t mavlink_msg_uavionix_adsb_out_dynamic_get_numSats(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 39); -} - -/** - * @brief Get field baroAltMSL from uavionix_adsb_out_dynamic message - * - * @return [mbar] Barometric pressure altitude (MSL) relative to a standard atmosphere of 1013.2 mBar and NOT bar corrected altitude (m * 1E-3). (up +ve). If unknown set to INT32_MAX - */ -static inline int32_t mavlink_msg_uavionix_adsb_out_dynamic_get_baroAltMSL(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 16); -} - -/** - * @brief Get field accuracyHor from uavionix_adsb_out_dynamic message - * - * @return [mm] Horizontal accuracy in mm (m * 1E-3). If unknown set to UINT32_MAX - */ -static inline uint32_t mavlink_msg_uavionix_adsb_out_dynamic_get_accuracyHor(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint32_t(msg, 20); -} - -/** - * @brief Get field accuracyVert from uavionix_adsb_out_dynamic message - * - * @return [cm] Vertical accuracy in cm. If unknown set to UINT16_MAX - */ -static inline uint16_t mavlink_msg_uavionix_adsb_out_dynamic_get_accuracyVert(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 24); -} - -/** - * @brief Get field accuracyVel from uavionix_adsb_out_dynamic message - * - * @return [mm/s] Velocity accuracy in mm/s (m * 1E-3). If unknown set to UINT16_MAX - */ -static inline uint16_t mavlink_msg_uavionix_adsb_out_dynamic_get_accuracyVel(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 26); -} - -/** - * @brief Get field velVert from uavionix_adsb_out_dynamic message - * - * @return [cm/s] GPS vertical speed in cm/s. If unknown set to INT16_MAX - */ -static inline int16_t mavlink_msg_uavionix_adsb_out_dynamic_get_velVert(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 28); -} - -/** - * @brief Get field velNS from uavionix_adsb_out_dynamic message - * - * @return [cm/s] North-South velocity over ground in cm/s North +ve. If unknown set to INT16_MAX - */ -static inline int16_t mavlink_msg_uavionix_adsb_out_dynamic_get_velNS(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 30); -} - -/** - * @brief Get field VelEW from uavionix_adsb_out_dynamic message - * - * @return [cm/s] East-West velocity over ground in cm/s East +ve. If unknown set to INT16_MAX - */ -static inline int16_t mavlink_msg_uavionix_adsb_out_dynamic_get_VelEW(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int16_t(msg, 32); -} - -/** - * @brief Get field emergencyStatus from uavionix_adsb_out_dynamic message - * - * @return Emergency status - */ -static inline uint8_t mavlink_msg_uavionix_adsb_out_dynamic_get_emergencyStatus(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 40); -} - -/** - * @brief Get field state from uavionix_adsb_out_dynamic message - * - * @return ADS-B transponder dynamic input state flags - */ -static inline uint16_t mavlink_msg_uavionix_adsb_out_dynamic_get_state(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 34); -} - -/** - * @brief Get field squawk from uavionix_adsb_out_dynamic message - * - * @return Mode A code (typically 1200 [0x04B0] for VFR) - */ -static inline uint16_t mavlink_msg_uavionix_adsb_out_dynamic_get_squawk(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint16_t(msg, 36); -} - -/** - * @brief Decode a uavionix_adsb_out_dynamic message into a struct - * - * @param msg The message to decode - * @param uavionix_adsb_out_dynamic C-struct to decode the message contents into - */ -static inline void mavlink_msg_uavionix_adsb_out_dynamic_decode(const mavlink_message_t* msg, mavlink_uavionix_adsb_out_dynamic_t* uavionix_adsb_out_dynamic) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - uavionix_adsb_out_dynamic->utcTime = mavlink_msg_uavionix_adsb_out_dynamic_get_utcTime(msg); - uavionix_adsb_out_dynamic->gpsLat = mavlink_msg_uavionix_adsb_out_dynamic_get_gpsLat(msg); - uavionix_adsb_out_dynamic->gpsLon = mavlink_msg_uavionix_adsb_out_dynamic_get_gpsLon(msg); - uavionix_adsb_out_dynamic->gpsAlt = mavlink_msg_uavionix_adsb_out_dynamic_get_gpsAlt(msg); - uavionix_adsb_out_dynamic->baroAltMSL = mavlink_msg_uavionix_adsb_out_dynamic_get_baroAltMSL(msg); - uavionix_adsb_out_dynamic->accuracyHor = mavlink_msg_uavionix_adsb_out_dynamic_get_accuracyHor(msg); - uavionix_adsb_out_dynamic->accuracyVert = mavlink_msg_uavionix_adsb_out_dynamic_get_accuracyVert(msg); - uavionix_adsb_out_dynamic->accuracyVel = mavlink_msg_uavionix_adsb_out_dynamic_get_accuracyVel(msg); - uavionix_adsb_out_dynamic->velVert = mavlink_msg_uavionix_adsb_out_dynamic_get_velVert(msg); - uavionix_adsb_out_dynamic->velNS = mavlink_msg_uavionix_adsb_out_dynamic_get_velNS(msg); - uavionix_adsb_out_dynamic->VelEW = mavlink_msg_uavionix_adsb_out_dynamic_get_VelEW(msg); - uavionix_adsb_out_dynamic->state = mavlink_msg_uavionix_adsb_out_dynamic_get_state(msg); - uavionix_adsb_out_dynamic->squawk = mavlink_msg_uavionix_adsb_out_dynamic_get_squawk(msg); - uavionix_adsb_out_dynamic->gpsFix = mavlink_msg_uavionix_adsb_out_dynamic_get_gpsFix(msg); - uavionix_adsb_out_dynamic->numSats = mavlink_msg_uavionix_adsb_out_dynamic_get_numSats(msg); - uavionix_adsb_out_dynamic->emergencyStatus = mavlink_msg_uavionix_adsb_out_dynamic_get_emergencyStatus(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_LEN? msg->len : MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_LEN; - memset(uavionix_adsb_out_dynamic, 0, MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_LEN); - memcpy(uavionix_adsb_out_dynamic, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/uAvionix/mavlink_msg_uavionix_adsb_transceiver_health_report.h b/uAvionix/mavlink_msg_uavionix_adsb_transceiver_health_report.h deleted file mode 100644 index 12514a96a..000000000 --- a/uAvionix/mavlink_msg_uavionix_adsb_transceiver_health_report.h +++ /dev/null @@ -1,213 +0,0 @@ -#pragma once -// MESSAGE UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT PACKING - -#define MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT 10003 - - -typedef struct __mavlink_uavionix_adsb_transceiver_health_report_t { - uint8_t rfHealth; /*< ADS-B transponder messages*/ -} mavlink_uavionix_adsb_transceiver_health_report_t; - -#define MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_LEN 1 -#define MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_MIN_LEN 1 -#define MAVLINK_MSG_ID_10003_LEN 1 -#define MAVLINK_MSG_ID_10003_MIN_LEN 1 - -#define MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_CRC 4 -#define MAVLINK_MSG_ID_10003_CRC 4 - - - -#if MAVLINK_COMMAND_24BIT -#define MAVLINK_MESSAGE_INFO_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT { \ - 10003, \ - "UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT", \ - 1, \ - { { "rfHealth", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_uavionix_adsb_transceiver_health_report_t, rfHealth) }, \ - } \ -} -#else -#define MAVLINK_MESSAGE_INFO_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT { \ - "UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT", \ - 1, \ - { { "rfHealth", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_uavionix_adsb_transceiver_health_report_t, rfHealth) }, \ - } \ -} -#endif - -/** - * @brief Pack a uavionix_adsb_transceiver_health_report message - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * - * @param rfHealth ADS-B transponder messages - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_uavionix_adsb_transceiver_health_report_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint8_t rfHealth) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_LEN]; - _mav_put_uint8_t(buf, 0, rfHealth); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_LEN); -#else - mavlink_uavionix_adsb_transceiver_health_report_t packet; - packet.rfHealth = rfHealth; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT; - return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_MIN_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_CRC); -} - -/** - * @brief Pack a uavionix_adsb_transceiver_health_report message on a channel - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param rfHealth ADS-B transponder messages - * @return length of the message in bytes (excluding serial stream start sign) - */ -static inline uint16_t mavlink_msg_uavionix_adsb_transceiver_health_report_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, - mavlink_message_t* msg, - uint8_t rfHealth) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_LEN]; - _mav_put_uint8_t(buf, 0, rfHealth); - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_LEN); -#else - mavlink_uavionix_adsb_transceiver_health_report_t packet; - packet.rfHealth = rfHealth; - - memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_LEN); -#endif - - msg->msgid = MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT; - return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_MIN_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_CRC); -} - -/** - * @brief Encode a uavionix_adsb_transceiver_health_report struct - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param msg The MAVLink message to compress the data into - * @param uavionix_adsb_transceiver_health_report C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_uavionix_adsb_transceiver_health_report_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_uavionix_adsb_transceiver_health_report_t* uavionix_adsb_transceiver_health_report) -{ - return mavlink_msg_uavionix_adsb_transceiver_health_report_pack(system_id, component_id, msg, uavionix_adsb_transceiver_health_report->rfHealth); -} - -/** - * @brief Encode a uavionix_adsb_transceiver_health_report struct on a channel - * - * @param system_id ID of this system - * @param component_id ID of this component (e.g. 200 for IMU) - * @param chan The MAVLink channel this message will be sent over - * @param msg The MAVLink message to compress the data into - * @param uavionix_adsb_transceiver_health_report C-struct to read the message contents from - */ -static inline uint16_t mavlink_msg_uavionix_adsb_transceiver_health_report_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_uavionix_adsb_transceiver_health_report_t* uavionix_adsb_transceiver_health_report) -{ - return mavlink_msg_uavionix_adsb_transceiver_health_report_pack_chan(system_id, component_id, chan, msg, uavionix_adsb_transceiver_health_report->rfHealth); -} - -/** - * @brief Send a uavionix_adsb_transceiver_health_report message - * @param chan MAVLink channel to send the message - * - * @param rfHealth ADS-B transponder messages - */ -#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS - -static inline void mavlink_msg_uavionix_adsb_transceiver_health_report_send(mavlink_channel_t chan, uint8_t rfHealth) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char buf[MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_LEN]; - _mav_put_uint8_t(buf, 0, rfHealth); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT, buf, MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_MIN_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_CRC); -#else - mavlink_uavionix_adsb_transceiver_health_report_t packet; - packet.rfHealth = rfHealth; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT, (const char *)&packet, MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_MIN_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_CRC); -#endif -} - -/** - * @brief Send a uavionix_adsb_transceiver_health_report message - * @param chan MAVLink channel to send the message - * @param struct The MAVLink struct to serialize - */ -static inline void mavlink_msg_uavionix_adsb_transceiver_health_report_send_struct(mavlink_channel_t chan, const mavlink_uavionix_adsb_transceiver_health_report_t* uavionix_adsb_transceiver_health_report) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - mavlink_msg_uavionix_adsb_transceiver_health_report_send(chan, uavionix_adsb_transceiver_health_report->rfHealth); -#else - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT, (const char *)uavionix_adsb_transceiver_health_report, MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_MIN_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_CRC); -#endif -} - -#if MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_LEN <= MAVLINK_MAX_PAYLOAD_LEN -/* - This varient of _send() can be used to save stack space by re-using - memory from the receive buffer. The caller provides a - mavlink_message_t which is the size of a full mavlink message. This - is usually the receive buffer for the channel, and allows a reply to an - incoming message with minimum stack space usage. - */ -static inline void mavlink_msg_uavionix_adsb_transceiver_health_report_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t rfHealth) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - char *buf = (char *)msgbuf; - _mav_put_uint8_t(buf, 0, rfHealth); - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT, buf, MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_MIN_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_CRC); -#else - mavlink_uavionix_adsb_transceiver_health_report_t *packet = (mavlink_uavionix_adsb_transceiver_health_report_t *)msgbuf; - packet->rfHealth = rfHealth; - - _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT, (const char *)packet, MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_MIN_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_LEN, MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_CRC); -#endif -} -#endif - -#endif - -// MESSAGE UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT UNPACKING - - -/** - * @brief Get field rfHealth from uavionix_adsb_transceiver_health_report message - * - * @return ADS-B transponder messages - */ -static inline uint8_t mavlink_msg_uavionix_adsb_transceiver_health_report_get_rfHealth(const mavlink_message_t* msg) -{ - return _MAV_RETURN_uint8_t(msg, 0); -} - -/** - * @brief Decode a uavionix_adsb_transceiver_health_report message into a struct - * - * @param msg The message to decode - * @param uavionix_adsb_transceiver_health_report C-struct to decode the message contents into - */ -static inline void mavlink_msg_uavionix_adsb_transceiver_health_report_decode(const mavlink_message_t* msg, mavlink_uavionix_adsb_transceiver_health_report_t* uavionix_adsb_transceiver_health_report) -{ -#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS - uavionix_adsb_transceiver_health_report->rfHealth = mavlink_msg_uavionix_adsb_transceiver_health_report_get_rfHealth(msg); -#else - uint8_t len = msg->len < MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_LEN? msg->len : MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_LEN; - memset(uavionix_adsb_transceiver_health_report, 0, MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_LEN); - memcpy(uavionix_adsb_transceiver_health_report, _MAV_PAYLOAD(msg), len); -#endif -} diff --git a/uAvionix/testsuite.h b/uAvionix/testsuite.h deleted file mode 100644 index 0b864afde..000000000 --- a/uAvionix/testsuite.h +++ /dev/null @@ -1,222 +0,0 @@ -/** @file - * @brief MAVLink comm protocol testsuite generated from uAvionix.xml - * @see http://qgroundcontrol.org/mavlink/ - */ -#pragma once -#ifndef UAVIONIX_TESTSUITE_H -#define UAVIONIX_TESTSUITE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef MAVLINK_TEST_ALL -#define MAVLINK_TEST_ALL -static void mavlink_test_common(uint8_t, uint8_t, mavlink_message_t *last_msg); -static void mavlink_test_uAvionix(uint8_t, uint8_t, mavlink_message_t *last_msg); - -static void mavlink_test_all(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) -{ - mavlink_test_common(system_id, component_id, last_msg); - mavlink_test_uAvionix(system_id, component_id, last_msg); -} -#endif - -#include "../common/testsuite.h" - - -static void mavlink_test_uavionix_adsb_out_cfg(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) -{ -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); - if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_uavionix_adsb_out_cfg_t packet_in = { - 963497464,17443,"GHIJKLMN",242,53,120,187,254 - }; - mavlink_uavionix_adsb_out_cfg_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.ICAO = packet_in.ICAO; - packet1.stallSpeed = packet_in.stallSpeed; - packet1.emitterType = packet_in.emitterType; - packet1.aircraftSize = packet_in.aircraftSize; - packet1.gpsOffsetLat = packet_in.gpsOffsetLat; - packet1.gpsOffsetLon = packet_in.gpsOffsetLon; - packet1.rfSelect = packet_in.rfSelect; - - mav_array_memcpy(packet1.callsign, packet_in.callsign, sizeof(char)*9); - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_uavionix_adsb_out_cfg_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_uavionix_adsb_out_cfg_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_uavionix_adsb_out_cfg_pack(system_id, component_id, &msg , packet1.ICAO , packet1.callsign , packet1.emitterType , packet1.aircraftSize , packet1.gpsOffsetLat , packet1.gpsOffsetLon , packet1.stallSpeed , packet1.rfSelect ); - mavlink_msg_uavionix_adsb_out_cfg_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_uavionix_adsb_out_cfg_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.ICAO , packet1.callsign , packet1.emitterType , packet1.aircraftSize , packet1.gpsOffsetLat , packet1.gpsOffsetLon , packet1.stallSpeed , packet1.rfSelect ); - mavlink_msg_uavionix_adsb_out_cfg_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_uavionix_adsb_out_dynamic_t packet_in = { - 963497464,963497672,963497880,963498088,963498296,963498504,18483,18587,18691,18795,18899,19003,19107,247,58,125 - }; - mavlink_uavionix_adsb_out_dynamic_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.utcTime = packet_in.utcTime; - packet1.gpsLat = packet_in.gpsLat; - packet1.gpsLon = packet_in.gpsLon; - packet1.gpsAlt = packet_in.gpsAlt; - packet1.baroAltMSL = packet_in.baroAltMSL; - packet1.accuracyHor = packet_in.accuracyHor; - packet1.accuracyVert = packet_in.accuracyVert; - packet1.accuracyVel = packet_in.accuracyVel; - packet1.velVert = packet_in.velVert; - packet1.velNS = packet_in.velNS; - packet1.VelEW = packet_in.VelEW; - packet1.state = packet_in.state; - packet1.squawk = packet_in.squawk; - packet1.gpsFix = packet_in.gpsFix; - packet1.numSats = packet_in.numSats; - packet1.emergencyStatus = packet_in.emergencyStatus; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_uavionix_adsb_out_dynamic_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_uavionix_adsb_out_dynamic_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_uavionix_adsb_out_dynamic_pack(system_id, component_id, &msg , packet1.utcTime , packet1.gpsLat , packet1.gpsLon , packet1.gpsAlt , packet1.gpsFix , packet1.numSats , packet1.baroAltMSL , packet1.accuracyHor , packet1.accuracyVert , packet1.accuracyVel , packet1.velVert , packet1.velNS , packet1.VelEW , packet1.emergencyStatus , packet1.state , packet1.squawk ); - mavlink_msg_uavionix_adsb_out_dynamic_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_uavionix_adsb_out_dynamic_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.utcTime , packet1.gpsLat , packet1.gpsLon , packet1.gpsAlt , packet1.gpsFix , packet1.numSats , packet1.baroAltMSL , packet1.accuracyHor , packet1.accuracyVert , packet1.accuracyVel , packet1.velVert , packet1.velNS , packet1.VelEW , packet1.emergencyStatus , packet1.state , packet1.squawk ); - mavlink_msg_uavionix_adsb_out_dynamic_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT >= 256) { - return; - } -#endif - mavlink_message_t msg; - uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; - uint16_t i; - mavlink_uavionix_adsb_transceiver_health_report_t packet_in = { - 5 - }; - mavlink_uavionix_adsb_transceiver_health_report_t packet1, packet2; - memset(&packet1, 0, sizeof(packet1)); - packet1.rfHealth = packet_in.rfHealth; - - -#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 - if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { - // cope with extensions - memset(MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT_MIN_LEN); - } -#endif - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_uavionix_adsb_transceiver_health_report_encode(system_id, component_id, &msg, &packet1); - mavlink_msg_uavionix_adsb_transceiver_health_report_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_uavionix_adsb_transceiver_health_report_pack(system_id, component_id, &msg , packet1.rfHealth ); - mavlink_msg_uavionix_adsb_transceiver_health_report_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_uavionix_adsb_transceiver_health_report_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.rfHealth ); - mavlink_msg_uavionix_adsb_transceiver_health_report_decode(&msg, &packet2); - MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); - - memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_to_send_buffer(buffer, &msg); - for (i=0; i