Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: mavlink F429ZI_LCD_demo
Fork of mavlink_bridge by
mavlink/v10/common/mavlink_msg_hil_gps.h@11:76345550efb4, 2018-07-23 (annotated)
- Committer:
- wupinxian
- Date:
- Mon Jul 23 16:34:26 2018 +0000
- Revision:
- 11:76345550efb4
- Parent:
- 0:28183cc7963f
mavlink for stm32 Nucleo
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bhepp | 0:28183cc7963f | 1 | // MESSAGE HIL_GPS PACKING |
bhepp | 0:28183cc7963f | 2 | |
bhepp | 0:28183cc7963f | 3 | #define MAVLINK_MSG_ID_HIL_GPS 113 |
bhepp | 0:28183cc7963f | 4 | |
bhepp | 0:28183cc7963f | 5 | typedef struct __mavlink_hil_gps_t |
bhepp | 0:28183cc7963f | 6 | { |
bhepp | 0:28183cc7963f | 7 | uint64_t time_usec; /*< Timestamp (microseconds since UNIX epoch or microseconds since system boot)*/ |
bhepp | 0:28183cc7963f | 8 | int32_t lat; /*< Latitude (WGS84), in degrees * 1E7*/ |
bhepp | 0:28183cc7963f | 9 | int32_t lon; /*< Longitude (WGS84), in degrees * 1E7*/ |
bhepp | 0:28183cc7963f | 10 | int32_t alt; /*< Altitude (AMSL, not WGS84), in meters * 1000 (positive for up)*/ |
bhepp | 0:28183cc7963f | 11 | uint16_t eph; /*< GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535*/ |
bhepp | 0:28183cc7963f | 12 | uint16_t epv; /*< GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: 65535*/ |
bhepp | 0:28183cc7963f | 13 | uint16_t vel; /*< GPS ground speed (m/s * 100). If unknown, set to: 65535*/ |
bhepp | 0:28183cc7963f | 14 | int16_t vn; /*< GPS velocity in cm/s in NORTH direction in earth-fixed NED frame*/ |
bhepp | 0:28183cc7963f | 15 | int16_t ve; /*< GPS velocity in cm/s in EAST direction in earth-fixed NED frame*/ |
bhepp | 0:28183cc7963f | 16 | int16_t vd; /*< GPS velocity in cm/s in DOWN direction in earth-fixed NED frame*/ |
bhepp | 0:28183cc7963f | 17 | uint16_t cog; /*< Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535*/ |
bhepp | 0:28183cc7963f | 18 | 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.*/ |
bhepp | 0:28183cc7963f | 19 | uint8_t satellites_visible; /*< Number of satellites visible. If unknown, set to 255*/ |
bhepp | 0:28183cc7963f | 20 | } mavlink_hil_gps_t; |
bhepp | 0:28183cc7963f | 21 | |
bhepp | 0:28183cc7963f | 22 | #define MAVLINK_MSG_ID_HIL_GPS_LEN 36 |
bhepp | 0:28183cc7963f | 23 | #define MAVLINK_MSG_ID_113_LEN 36 |
bhepp | 0:28183cc7963f | 24 | |
bhepp | 0:28183cc7963f | 25 | #define MAVLINK_MSG_ID_HIL_GPS_CRC 124 |
bhepp | 0:28183cc7963f | 26 | #define MAVLINK_MSG_ID_113_CRC 124 |
bhepp | 0:28183cc7963f | 27 | |
bhepp | 0:28183cc7963f | 28 | |
bhepp | 0:28183cc7963f | 29 | |
bhepp | 0:28183cc7963f | 30 | #define MAVLINK_MESSAGE_INFO_HIL_GPS { \ |
bhepp | 0:28183cc7963f | 31 | "HIL_GPS", \ |
bhepp | 0:28183cc7963f | 32 | 13, \ |
bhepp | 0:28183cc7963f | 33 | { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_hil_gps_t, time_usec) }, \ |
bhepp | 0:28183cc7963f | 34 | { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_hil_gps_t, lat) }, \ |
bhepp | 0:28183cc7963f | 35 | { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_hil_gps_t, lon) }, \ |
bhepp | 0:28183cc7963f | 36 | { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_hil_gps_t, alt) }, \ |
bhepp | 0:28183cc7963f | 37 | { "eph", NULL, MAVLINK_TYPE_UINT16_T, 0, 20, offsetof(mavlink_hil_gps_t, eph) }, \ |
bhepp | 0:28183cc7963f | 38 | { "epv", NULL, MAVLINK_TYPE_UINT16_T, 0, 22, offsetof(mavlink_hil_gps_t, epv) }, \ |
bhepp | 0:28183cc7963f | 39 | { "vel", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_hil_gps_t, vel) }, \ |
bhepp | 0:28183cc7963f | 40 | { "vn", NULL, MAVLINK_TYPE_INT16_T, 0, 26, offsetof(mavlink_hil_gps_t, vn) }, \ |
bhepp | 0:28183cc7963f | 41 | { "ve", NULL, MAVLINK_TYPE_INT16_T, 0, 28, offsetof(mavlink_hil_gps_t, ve) }, \ |
bhepp | 0:28183cc7963f | 42 | { "vd", NULL, MAVLINK_TYPE_INT16_T, 0, 30, offsetof(mavlink_hil_gps_t, vd) }, \ |
bhepp | 0:28183cc7963f | 43 | { "cog", NULL, MAVLINK_TYPE_UINT16_T, 0, 32, offsetof(mavlink_hil_gps_t, cog) }, \ |
bhepp | 0:28183cc7963f | 44 | { "fix_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_hil_gps_t, fix_type) }, \ |
bhepp | 0:28183cc7963f | 45 | { "satellites_visible", NULL, MAVLINK_TYPE_UINT8_T, 0, 35, offsetof(mavlink_hil_gps_t, satellites_visible) }, \ |
bhepp | 0:28183cc7963f | 46 | } \ |
bhepp | 0:28183cc7963f | 47 | } |
bhepp | 0:28183cc7963f | 48 | |
bhepp | 0:28183cc7963f | 49 | |
bhepp | 0:28183cc7963f | 50 | /** |
bhepp | 0:28183cc7963f | 51 | * @brief Pack a hil_gps message |
bhepp | 0:28183cc7963f | 52 | * @param system_id ID of this system |
bhepp | 0:28183cc7963f | 53 | * @param component_id ID of this component (e.g. 200 for IMU) |
bhepp | 0:28183cc7963f | 54 | * @param msg The MAVLink message to compress the data into |
bhepp | 0:28183cc7963f | 55 | * |
bhepp | 0:28183cc7963f | 56 | * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot) |
bhepp | 0:28183cc7963f | 57 | * @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. |
bhepp | 0:28183cc7963f | 58 | * @param lat Latitude (WGS84), in degrees * 1E7 |
bhepp | 0:28183cc7963f | 59 | * @param lon Longitude (WGS84), in degrees * 1E7 |
bhepp | 0:28183cc7963f | 60 | * @param alt Altitude (AMSL, not WGS84), in meters * 1000 (positive for up) |
bhepp | 0:28183cc7963f | 61 | * @param eph GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535 |
bhepp | 0:28183cc7963f | 62 | * @param epv GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: 65535 |
bhepp | 0:28183cc7963f | 63 | * @param vel GPS ground speed (m/s * 100). If unknown, set to: 65535 |
bhepp | 0:28183cc7963f | 64 | * @param vn GPS velocity in cm/s in NORTH direction in earth-fixed NED frame |
bhepp | 0:28183cc7963f | 65 | * @param ve GPS velocity in cm/s in EAST direction in earth-fixed NED frame |
bhepp | 0:28183cc7963f | 66 | * @param vd GPS velocity in cm/s in DOWN direction in earth-fixed NED frame |
bhepp | 0:28183cc7963f | 67 | * @param cog Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535 |
bhepp | 0:28183cc7963f | 68 | * @param satellites_visible Number of satellites visible. If unknown, set to 255 |
bhepp | 0:28183cc7963f | 69 | * @return length of the message in bytes (excluding serial stream start sign) |
bhepp | 0:28183cc7963f | 70 | */ |
bhepp | 0:28183cc7963f | 71 | static inline uint16_t mavlink_msg_hil_gps_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, |
bhepp | 0:28183cc7963f | 72 | 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) |
bhepp | 0:28183cc7963f | 73 | { |
bhepp | 0:28183cc7963f | 74 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
bhepp | 0:28183cc7963f | 75 | char buf[MAVLINK_MSG_ID_HIL_GPS_LEN]; |
bhepp | 0:28183cc7963f | 76 | _mav_put_uint64_t(buf, 0, time_usec); |
bhepp | 0:28183cc7963f | 77 | _mav_put_int32_t(buf, 8, lat); |
bhepp | 0:28183cc7963f | 78 | _mav_put_int32_t(buf, 12, lon); |
bhepp | 0:28183cc7963f | 79 | _mav_put_int32_t(buf, 16, alt); |
bhepp | 0:28183cc7963f | 80 | _mav_put_uint16_t(buf, 20, eph); |
bhepp | 0:28183cc7963f | 81 | _mav_put_uint16_t(buf, 22, epv); |
bhepp | 0:28183cc7963f | 82 | _mav_put_uint16_t(buf, 24, vel); |
bhepp | 0:28183cc7963f | 83 | _mav_put_int16_t(buf, 26, vn); |
bhepp | 0:28183cc7963f | 84 | _mav_put_int16_t(buf, 28, ve); |
bhepp | 0:28183cc7963f | 85 | _mav_put_int16_t(buf, 30, vd); |
bhepp | 0:28183cc7963f | 86 | _mav_put_uint16_t(buf, 32, cog); |
bhepp | 0:28183cc7963f | 87 | _mav_put_uint8_t(buf, 34, fix_type); |
bhepp | 0:28183cc7963f | 88 | _mav_put_uint8_t(buf, 35, satellites_visible); |
bhepp | 0:28183cc7963f | 89 | |
bhepp | 0:28183cc7963f | 90 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_GPS_LEN); |
bhepp | 0:28183cc7963f | 91 | #else |
bhepp | 0:28183cc7963f | 92 | mavlink_hil_gps_t packet; |
bhepp | 0:28183cc7963f | 93 | packet.time_usec = time_usec; |
bhepp | 0:28183cc7963f | 94 | packet.lat = lat; |
bhepp | 0:28183cc7963f | 95 | packet.lon = lon; |
bhepp | 0:28183cc7963f | 96 | packet.alt = alt; |
bhepp | 0:28183cc7963f | 97 | packet.eph = eph; |
bhepp | 0:28183cc7963f | 98 | packet.epv = epv; |
bhepp | 0:28183cc7963f | 99 | packet.vel = vel; |
bhepp | 0:28183cc7963f | 100 | packet.vn = vn; |
bhepp | 0:28183cc7963f | 101 | packet.ve = ve; |
bhepp | 0:28183cc7963f | 102 | packet.vd = vd; |
bhepp | 0:28183cc7963f | 103 | packet.cog = cog; |
bhepp | 0:28183cc7963f | 104 | packet.fix_type = fix_type; |
bhepp | 0:28183cc7963f | 105 | packet.satellites_visible = satellites_visible; |
bhepp | 0:28183cc7963f | 106 | |
bhepp | 0:28183cc7963f | 107 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_GPS_LEN); |
bhepp | 0:28183cc7963f | 108 | #endif |
bhepp | 0:28183cc7963f | 109 | |
bhepp | 0:28183cc7963f | 110 | msg->msgid = MAVLINK_MSG_ID_HIL_GPS; |
bhepp | 0:28183cc7963f | 111 | #if MAVLINK_CRC_EXTRA |
bhepp | 0:28183cc7963f | 112 | return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_GPS_LEN, MAVLINK_MSG_ID_HIL_GPS_CRC); |
bhepp | 0:28183cc7963f | 113 | #else |
bhepp | 0:28183cc7963f | 114 | return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_GPS_LEN); |
bhepp | 0:28183cc7963f | 115 | #endif |
bhepp | 0:28183cc7963f | 116 | } |
bhepp | 0:28183cc7963f | 117 | |
bhepp | 0:28183cc7963f | 118 | /** |
bhepp | 0:28183cc7963f | 119 | * @brief Pack a hil_gps message on a channel |
bhepp | 0:28183cc7963f | 120 | * @param system_id ID of this system |
bhepp | 0:28183cc7963f | 121 | * @param component_id ID of this component (e.g. 200 for IMU) |
bhepp | 0:28183cc7963f | 122 | * @param chan The MAVLink channel this message will be sent over |
bhepp | 0:28183cc7963f | 123 | * @param msg The MAVLink message to compress the data into |
bhepp | 0:28183cc7963f | 124 | * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot) |
bhepp | 0:28183cc7963f | 125 | * @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. |
bhepp | 0:28183cc7963f | 126 | * @param lat Latitude (WGS84), in degrees * 1E7 |
bhepp | 0:28183cc7963f | 127 | * @param lon Longitude (WGS84), in degrees * 1E7 |
bhepp | 0:28183cc7963f | 128 | * @param alt Altitude (AMSL, not WGS84), in meters * 1000 (positive for up) |
bhepp | 0:28183cc7963f | 129 | * @param eph GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535 |
bhepp | 0:28183cc7963f | 130 | * @param epv GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: 65535 |
bhepp | 0:28183cc7963f | 131 | * @param vel GPS ground speed (m/s * 100). If unknown, set to: 65535 |
bhepp | 0:28183cc7963f | 132 | * @param vn GPS velocity in cm/s in NORTH direction in earth-fixed NED frame |
bhepp | 0:28183cc7963f | 133 | * @param ve GPS velocity in cm/s in EAST direction in earth-fixed NED frame |
bhepp | 0:28183cc7963f | 134 | * @param vd GPS velocity in cm/s in DOWN direction in earth-fixed NED frame |
bhepp | 0:28183cc7963f | 135 | * @param cog Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535 |
bhepp | 0:28183cc7963f | 136 | * @param satellites_visible Number of satellites visible. If unknown, set to 255 |
bhepp | 0:28183cc7963f | 137 | * @return length of the message in bytes (excluding serial stream start sign) |
bhepp | 0:28183cc7963f | 138 | */ |
bhepp | 0:28183cc7963f | 139 | static inline uint16_t mavlink_msg_hil_gps_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, |
bhepp | 0:28183cc7963f | 140 | mavlink_message_t* msg, |
bhepp | 0:28183cc7963f | 141 | 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) |
bhepp | 0:28183cc7963f | 142 | { |
bhepp | 0:28183cc7963f | 143 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
bhepp | 0:28183cc7963f | 144 | char buf[MAVLINK_MSG_ID_HIL_GPS_LEN]; |
bhepp | 0:28183cc7963f | 145 | _mav_put_uint64_t(buf, 0, time_usec); |
bhepp | 0:28183cc7963f | 146 | _mav_put_int32_t(buf, 8, lat); |
bhepp | 0:28183cc7963f | 147 | _mav_put_int32_t(buf, 12, lon); |
bhepp | 0:28183cc7963f | 148 | _mav_put_int32_t(buf, 16, alt); |
bhepp | 0:28183cc7963f | 149 | _mav_put_uint16_t(buf, 20, eph); |
bhepp | 0:28183cc7963f | 150 | _mav_put_uint16_t(buf, 22, epv); |
bhepp | 0:28183cc7963f | 151 | _mav_put_uint16_t(buf, 24, vel); |
bhepp | 0:28183cc7963f | 152 | _mav_put_int16_t(buf, 26, vn); |
bhepp | 0:28183cc7963f | 153 | _mav_put_int16_t(buf, 28, ve); |
bhepp | 0:28183cc7963f | 154 | _mav_put_int16_t(buf, 30, vd); |
bhepp | 0:28183cc7963f | 155 | _mav_put_uint16_t(buf, 32, cog); |
bhepp | 0:28183cc7963f | 156 | _mav_put_uint8_t(buf, 34, fix_type); |
bhepp | 0:28183cc7963f | 157 | _mav_put_uint8_t(buf, 35, satellites_visible); |
bhepp | 0:28183cc7963f | 158 | |
bhepp | 0:28183cc7963f | 159 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_GPS_LEN); |
bhepp | 0:28183cc7963f | 160 | #else |
bhepp | 0:28183cc7963f | 161 | mavlink_hil_gps_t packet; |
bhepp | 0:28183cc7963f | 162 | packet.time_usec = time_usec; |
bhepp | 0:28183cc7963f | 163 | packet.lat = lat; |
bhepp | 0:28183cc7963f | 164 | packet.lon = lon; |
bhepp | 0:28183cc7963f | 165 | packet.alt = alt; |
bhepp | 0:28183cc7963f | 166 | packet.eph = eph; |
bhepp | 0:28183cc7963f | 167 | packet.epv = epv; |
bhepp | 0:28183cc7963f | 168 | packet.vel = vel; |
bhepp | 0:28183cc7963f | 169 | packet.vn = vn; |
bhepp | 0:28183cc7963f | 170 | packet.ve = ve; |
bhepp | 0:28183cc7963f | 171 | packet.vd = vd; |
bhepp | 0:28183cc7963f | 172 | packet.cog = cog; |
bhepp | 0:28183cc7963f | 173 | packet.fix_type = fix_type; |
bhepp | 0:28183cc7963f | 174 | packet.satellites_visible = satellites_visible; |
bhepp | 0:28183cc7963f | 175 | |
bhepp | 0:28183cc7963f | 176 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_GPS_LEN); |
bhepp | 0:28183cc7963f | 177 | #endif |
bhepp | 0:28183cc7963f | 178 | |
bhepp | 0:28183cc7963f | 179 | msg->msgid = MAVLINK_MSG_ID_HIL_GPS; |
bhepp | 0:28183cc7963f | 180 | #if MAVLINK_CRC_EXTRA |
bhepp | 0:28183cc7963f | 181 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIL_GPS_LEN, MAVLINK_MSG_ID_HIL_GPS_CRC); |
bhepp | 0:28183cc7963f | 182 | #else |
bhepp | 0:28183cc7963f | 183 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIL_GPS_LEN); |
bhepp | 0:28183cc7963f | 184 | #endif |
bhepp | 0:28183cc7963f | 185 | } |
bhepp | 0:28183cc7963f | 186 | |
bhepp | 0:28183cc7963f | 187 | /** |
bhepp | 0:28183cc7963f | 188 | * @brief Encode a hil_gps struct |
bhepp | 0:28183cc7963f | 189 | * |
bhepp | 0:28183cc7963f | 190 | * @param system_id ID of this system |
bhepp | 0:28183cc7963f | 191 | * @param component_id ID of this component (e.g. 200 for IMU) |
bhepp | 0:28183cc7963f | 192 | * @param msg The MAVLink message to compress the data into |
bhepp | 0:28183cc7963f | 193 | * @param hil_gps C-struct to read the message contents from |
bhepp | 0:28183cc7963f | 194 | */ |
bhepp | 0:28183cc7963f | 195 | static inline uint16_t mavlink_msg_hil_gps_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_hil_gps_t* hil_gps) |
bhepp | 0:28183cc7963f | 196 | { |
bhepp | 0:28183cc7963f | 197 | return mavlink_msg_hil_gps_pack(system_id, component_id, 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); |
bhepp | 0:28183cc7963f | 198 | } |
bhepp | 0:28183cc7963f | 199 | |
bhepp | 0:28183cc7963f | 200 | /** |
bhepp | 0:28183cc7963f | 201 | * @brief Encode a hil_gps struct on a channel |
bhepp | 0:28183cc7963f | 202 | * |
bhepp | 0:28183cc7963f | 203 | * @param system_id ID of this system |
bhepp | 0:28183cc7963f | 204 | * @param component_id ID of this component (e.g. 200 for IMU) |
bhepp | 0:28183cc7963f | 205 | * @param chan The MAVLink channel this message will be sent over |
bhepp | 0:28183cc7963f | 206 | * @param msg The MAVLink message to compress the data into |
bhepp | 0:28183cc7963f | 207 | * @param hil_gps C-struct to read the message contents from |
bhepp | 0:28183cc7963f | 208 | */ |
bhepp | 0:28183cc7963f | 209 | static inline uint16_t mavlink_msg_hil_gps_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_hil_gps_t* hil_gps) |
bhepp | 0:28183cc7963f | 210 | { |
bhepp | 0:28183cc7963f | 211 | 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); |
bhepp | 0:28183cc7963f | 212 | } |
bhepp | 0:28183cc7963f | 213 | |
bhepp | 0:28183cc7963f | 214 | /** |
bhepp | 0:28183cc7963f | 215 | * @brief Send a hil_gps message |
bhepp | 0:28183cc7963f | 216 | * @param chan MAVLink channel to send the message |
bhepp | 0:28183cc7963f | 217 | * |
bhepp | 0:28183cc7963f | 218 | * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot) |
bhepp | 0:28183cc7963f | 219 | * @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. |
bhepp | 0:28183cc7963f | 220 | * @param lat Latitude (WGS84), in degrees * 1E7 |
bhepp | 0:28183cc7963f | 221 | * @param lon Longitude (WGS84), in degrees * 1E7 |
bhepp | 0:28183cc7963f | 222 | * @param alt Altitude (AMSL, not WGS84), in meters * 1000 (positive for up) |
bhepp | 0:28183cc7963f | 223 | * @param eph GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535 |
bhepp | 0:28183cc7963f | 224 | * @param epv GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: 65535 |
bhepp | 0:28183cc7963f | 225 | * @param vel GPS ground speed (m/s * 100). If unknown, set to: 65535 |
bhepp | 0:28183cc7963f | 226 | * @param vn GPS velocity in cm/s in NORTH direction in earth-fixed NED frame |
bhepp | 0:28183cc7963f | 227 | * @param ve GPS velocity in cm/s in EAST direction in earth-fixed NED frame |
bhepp | 0:28183cc7963f | 228 | * @param vd GPS velocity in cm/s in DOWN direction in earth-fixed NED frame |
bhepp | 0:28183cc7963f | 229 | * @param cog Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535 |
bhepp | 0:28183cc7963f | 230 | * @param satellites_visible Number of satellites visible. If unknown, set to 255 |
bhepp | 0:28183cc7963f | 231 | */ |
bhepp | 0:28183cc7963f | 232 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS |
bhepp | 0:28183cc7963f | 233 | |
bhepp | 0:28183cc7963f | 234 | static inline void mavlink_msg_hil_gps_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, int16_t vn, int16_t ve, int16_t vd, uint16_t cog, uint8_t satellites_visible) |
bhepp | 0:28183cc7963f | 235 | { |
bhepp | 0:28183cc7963f | 236 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
bhepp | 0:28183cc7963f | 237 | char buf[MAVLINK_MSG_ID_HIL_GPS_LEN]; |
bhepp | 0:28183cc7963f | 238 | _mav_put_uint64_t(buf, 0, time_usec); |
bhepp | 0:28183cc7963f | 239 | _mav_put_int32_t(buf, 8, lat); |
bhepp | 0:28183cc7963f | 240 | _mav_put_int32_t(buf, 12, lon); |
bhepp | 0:28183cc7963f | 241 | _mav_put_int32_t(buf, 16, alt); |
bhepp | 0:28183cc7963f | 242 | _mav_put_uint16_t(buf, 20, eph); |
bhepp | 0:28183cc7963f | 243 | _mav_put_uint16_t(buf, 22, epv); |
bhepp | 0:28183cc7963f | 244 | _mav_put_uint16_t(buf, 24, vel); |
bhepp | 0:28183cc7963f | 245 | _mav_put_int16_t(buf, 26, vn); |
bhepp | 0:28183cc7963f | 246 | _mav_put_int16_t(buf, 28, ve); |
bhepp | 0:28183cc7963f | 247 | _mav_put_int16_t(buf, 30, vd); |
bhepp | 0:28183cc7963f | 248 | _mav_put_uint16_t(buf, 32, cog); |
bhepp | 0:28183cc7963f | 249 | _mav_put_uint8_t(buf, 34, fix_type); |
bhepp | 0:28183cc7963f | 250 | _mav_put_uint8_t(buf, 35, satellites_visible); |
bhepp | 0:28183cc7963f | 251 | |
bhepp | 0:28183cc7963f | 252 | #if MAVLINK_CRC_EXTRA |
bhepp | 0:28183cc7963f | 253 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_GPS, buf, MAVLINK_MSG_ID_HIL_GPS_LEN, MAVLINK_MSG_ID_HIL_GPS_CRC); |
bhepp | 0:28183cc7963f | 254 | #else |
bhepp | 0:28183cc7963f | 255 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_GPS, buf, MAVLINK_MSG_ID_HIL_GPS_LEN); |
bhepp | 0:28183cc7963f | 256 | #endif |
bhepp | 0:28183cc7963f | 257 | #else |
bhepp | 0:28183cc7963f | 258 | mavlink_hil_gps_t packet; |
bhepp | 0:28183cc7963f | 259 | packet.time_usec = time_usec; |
bhepp | 0:28183cc7963f | 260 | packet.lat = lat; |
bhepp | 0:28183cc7963f | 261 | packet.lon = lon; |
bhepp | 0:28183cc7963f | 262 | packet.alt = alt; |
bhepp | 0:28183cc7963f | 263 | packet.eph = eph; |
bhepp | 0:28183cc7963f | 264 | packet.epv = epv; |
bhepp | 0:28183cc7963f | 265 | packet.vel = vel; |
bhepp | 0:28183cc7963f | 266 | packet.vn = vn; |
bhepp | 0:28183cc7963f | 267 | packet.ve = ve; |
bhepp | 0:28183cc7963f | 268 | packet.vd = vd; |
bhepp | 0:28183cc7963f | 269 | packet.cog = cog; |
bhepp | 0:28183cc7963f | 270 | packet.fix_type = fix_type; |
bhepp | 0:28183cc7963f | 271 | packet.satellites_visible = satellites_visible; |
bhepp | 0:28183cc7963f | 272 | |
bhepp | 0:28183cc7963f | 273 | #if MAVLINK_CRC_EXTRA |
bhepp | 0:28183cc7963f | 274 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_GPS, (const char *)&packet, MAVLINK_MSG_ID_HIL_GPS_LEN, MAVLINK_MSG_ID_HIL_GPS_CRC); |
bhepp | 0:28183cc7963f | 275 | #else |
bhepp | 0:28183cc7963f | 276 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_GPS, (const char *)&packet, MAVLINK_MSG_ID_HIL_GPS_LEN); |
bhepp | 0:28183cc7963f | 277 | #endif |
bhepp | 0:28183cc7963f | 278 | #endif |
bhepp | 0:28183cc7963f | 279 | } |
bhepp | 0:28183cc7963f | 280 | |
bhepp | 0:28183cc7963f | 281 | #if MAVLINK_MSG_ID_HIL_GPS_LEN <= MAVLINK_MAX_PAYLOAD_LEN |
bhepp | 0:28183cc7963f | 282 | /* |
bhepp | 0:28183cc7963f | 283 | This varient of _send() can be used to save stack space by re-using |
bhepp | 0:28183cc7963f | 284 | memory from the receive buffer. The caller provides a |
bhepp | 0:28183cc7963f | 285 | mavlink_message_t which is the size of a full mavlink message. This |
bhepp | 0:28183cc7963f | 286 | is usually the receive buffer for the channel, and allows a reply to an |
bhepp | 0:28183cc7963f | 287 | incoming message with minimum stack space usage. |
bhepp | 0:28183cc7963f | 288 | */ |
bhepp | 0:28183cc7963f | 289 | static inline void mavlink_msg_hil_gps_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, int16_t vn, int16_t ve, int16_t vd, uint16_t cog, uint8_t satellites_visible) |
bhepp | 0:28183cc7963f | 290 | { |
bhepp | 0:28183cc7963f | 291 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
bhepp | 0:28183cc7963f | 292 | char *buf = (char *)msgbuf; |
bhepp | 0:28183cc7963f | 293 | _mav_put_uint64_t(buf, 0, time_usec); |
bhepp | 0:28183cc7963f | 294 | _mav_put_int32_t(buf, 8, lat); |
bhepp | 0:28183cc7963f | 295 | _mav_put_int32_t(buf, 12, lon); |
bhepp | 0:28183cc7963f | 296 | _mav_put_int32_t(buf, 16, alt); |
bhepp | 0:28183cc7963f | 297 | _mav_put_uint16_t(buf, 20, eph); |
bhepp | 0:28183cc7963f | 298 | _mav_put_uint16_t(buf, 22, epv); |
bhepp | 0:28183cc7963f | 299 | _mav_put_uint16_t(buf, 24, vel); |
bhepp | 0:28183cc7963f | 300 | _mav_put_int16_t(buf, 26, vn); |
bhepp | 0:28183cc7963f | 301 | _mav_put_int16_t(buf, 28, ve); |
bhepp | 0:28183cc7963f | 302 | _mav_put_int16_t(buf, 30, vd); |
bhepp | 0:28183cc7963f | 303 | _mav_put_uint16_t(buf, 32, cog); |
bhepp | 0:28183cc7963f | 304 | _mav_put_uint8_t(buf, 34, fix_type); |
bhepp | 0:28183cc7963f | 305 | _mav_put_uint8_t(buf, 35, satellites_visible); |
bhepp | 0:28183cc7963f | 306 | |
bhepp | 0:28183cc7963f | 307 | #if MAVLINK_CRC_EXTRA |
bhepp | 0:28183cc7963f | 308 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_GPS, buf, MAVLINK_MSG_ID_HIL_GPS_LEN, MAVLINK_MSG_ID_HIL_GPS_CRC); |
bhepp | 0:28183cc7963f | 309 | #else |
bhepp | 0:28183cc7963f | 310 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_GPS, buf, MAVLINK_MSG_ID_HIL_GPS_LEN); |
bhepp | 0:28183cc7963f | 311 | #endif |
bhepp | 0:28183cc7963f | 312 | #else |
bhepp | 0:28183cc7963f | 313 | mavlink_hil_gps_t *packet = (mavlink_hil_gps_t *)msgbuf; |
bhepp | 0:28183cc7963f | 314 | packet->time_usec = time_usec; |
bhepp | 0:28183cc7963f | 315 | packet->lat = lat; |
bhepp | 0:28183cc7963f | 316 | packet->lon = lon; |
bhepp | 0:28183cc7963f | 317 | packet->alt = alt; |
bhepp | 0:28183cc7963f | 318 | packet->eph = eph; |
bhepp | 0:28183cc7963f | 319 | packet->epv = epv; |
bhepp | 0:28183cc7963f | 320 | packet->vel = vel; |
bhepp | 0:28183cc7963f | 321 | packet->vn = vn; |
bhepp | 0:28183cc7963f | 322 | packet->ve = ve; |
bhepp | 0:28183cc7963f | 323 | packet->vd = vd; |
bhepp | 0:28183cc7963f | 324 | packet->cog = cog; |
bhepp | 0:28183cc7963f | 325 | packet->fix_type = fix_type; |
bhepp | 0:28183cc7963f | 326 | packet->satellites_visible = satellites_visible; |
bhepp | 0:28183cc7963f | 327 | |
bhepp | 0:28183cc7963f | 328 | #if MAVLINK_CRC_EXTRA |
bhepp | 0:28183cc7963f | 329 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_GPS, (const char *)packet, MAVLINK_MSG_ID_HIL_GPS_LEN, MAVLINK_MSG_ID_HIL_GPS_CRC); |
bhepp | 0:28183cc7963f | 330 | #else |
bhepp | 0:28183cc7963f | 331 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_GPS, (const char *)packet, MAVLINK_MSG_ID_HIL_GPS_LEN); |
bhepp | 0:28183cc7963f | 332 | #endif |
bhepp | 0:28183cc7963f | 333 | #endif |
bhepp | 0:28183cc7963f | 334 | } |
bhepp | 0:28183cc7963f | 335 | #endif |
bhepp | 0:28183cc7963f | 336 | |
bhepp | 0:28183cc7963f | 337 | #endif |
bhepp | 0:28183cc7963f | 338 | |
bhepp | 0:28183cc7963f | 339 | // MESSAGE HIL_GPS UNPACKING |
bhepp | 0:28183cc7963f | 340 | |
bhepp | 0:28183cc7963f | 341 | |
bhepp | 0:28183cc7963f | 342 | /** |
bhepp | 0:28183cc7963f | 343 | * @brief Get field time_usec from hil_gps message |
bhepp | 0:28183cc7963f | 344 | * |
bhepp | 0:28183cc7963f | 345 | * @return Timestamp (microseconds since UNIX epoch or microseconds since system boot) |
bhepp | 0:28183cc7963f | 346 | */ |
bhepp | 0:28183cc7963f | 347 | static inline uint64_t mavlink_msg_hil_gps_get_time_usec(const mavlink_message_t* msg) |
bhepp | 0:28183cc7963f | 348 | { |
bhepp | 0:28183cc7963f | 349 | return _MAV_RETURN_uint64_t(msg, 0); |
bhepp | 0:28183cc7963f | 350 | } |
bhepp | 0:28183cc7963f | 351 | |
bhepp | 0:28183cc7963f | 352 | /** |
bhepp | 0:28183cc7963f | 353 | * @brief Get field fix_type from hil_gps message |
bhepp | 0:28183cc7963f | 354 | * |
bhepp | 0:28183cc7963f | 355 | * @return 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. |
bhepp | 0:28183cc7963f | 356 | */ |
bhepp | 0:28183cc7963f | 357 | static inline uint8_t mavlink_msg_hil_gps_get_fix_type(const mavlink_message_t* msg) |
bhepp | 0:28183cc7963f | 358 | { |
bhepp | 0:28183cc7963f | 359 | return _MAV_RETURN_uint8_t(msg, 34); |
bhepp | 0:28183cc7963f | 360 | } |
bhepp | 0:28183cc7963f | 361 | |
bhepp | 0:28183cc7963f | 362 | /** |
bhepp | 0:28183cc7963f | 363 | * @brief Get field lat from hil_gps message |
bhepp | 0:28183cc7963f | 364 | * |
bhepp | 0:28183cc7963f | 365 | * @return Latitude (WGS84), in degrees * 1E7 |
bhepp | 0:28183cc7963f | 366 | */ |
bhepp | 0:28183cc7963f | 367 | static inline int32_t mavlink_msg_hil_gps_get_lat(const mavlink_message_t* msg) |
bhepp | 0:28183cc7963f | 368 | { |
bhepp | 0:28183cc7963f | 369 | return _MAV_RETURN_int32_t(msg, 8); |
bhepp | 0:28183cc7963f | 370 | } |
bhepp | 0:28183cc7963f | 371 | |
bhepp | 0:28183cc7963f | 372 | /** |
bhepp | 0:28183cc7963f | 373 | * @brief Get field lon from hil_gps message |
bhepp | 0:28183cc7963f | 374 | * |
bhepp | 0:28183cc7963f | 375 | * @return Longitude (WGS84), in degrees * 1E7 |
bhepp | 0:28183cc7963f | 376 | */ |
bhepp | 0:28183cc7963f | 377 | static inline int32_t mavlink_msg_hil_gps_get_lon(const mavlink_message_t* msg) |
bhepp | 0:28183cc7963f | 378 | { |
bhepp | 0:28183cc7963f | 379 | return _MAV_RETURN_int32_t(msg, 12); |
bhepp | 0:28183cc7963f | 380 | } |
bhepp | 0:28183cc7963f | 381 | |
bhepp | 0:28183cc7963f | 382 | /** |
bhepp | 0:28183cc7963f | 383 | * @brief Get field alt from hil_gps message |
bhepp | 0:28183cc7963f | 384 | * |
bhepp | 0:28183cc7963f | 385 | * @return Altitude (AMSL, not WGS84), in meters * 1000 (positive for up) |
bhepp | 0:28183cc7963f | 386 | */ |
bhepp | 0:28183cc7963f | 387 | static inline int32_t mavlink_msg_hil_gps_get_alt(const mavlink_message_t* msg) |
bhepp | 0:28183cc7963f | 388 | { |
bhepp | 0:28183cc7963f | 389 | return _MAV_RETURN_int32_t(msg, 16); |
bhepp | 0:28183cc7963f | 390 | } |
bhepp | 0:28183cc7963f | 391 | |
bhepp | 0:28183cc7963f | 392 | /** |
bhepp | 0:28183cc7963f | 393 | * @brief Get field eph from hil_gps message |
bhepp | 0:28183cc7963f | 394 | * |
bhepp | 0:28183cc7963f | 395 | * @return GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535 |
bhepp | 0:28183cc7963f | 396 | */ |
bhepp | 0:28183cc7963f | 397 | static inline uint16_t mavlink_msg_hil_gps_get_eph(const mavlink_message_t* msg) |
bhepp | 0:28183cc7963f | 398 | { |
bhepp | 0:28183cc7963f | 399 | return _MAV_RETURN_uint16_t(msg, 20); |
bhepp | 0:28183cc7963f | 400 | } |
bhepp | 0:28183cc7963f | 401 | |
bhepp | 0:28183cc7963f | 402 | /** |
bhepp | 0:28183cc7963f | 403 | * @brief Get field epv from hil_gps message |
bhepp | 0:28183cc7963f | 404 | * |
bhepp | 0:28183cc7963f | 405 | * @return GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: 65535 |
bhepp | 0:28183cc7963f | 406 | */ |
bhepp | 0:28183cc7963f | 407 | static inline uint16_t mavlink_msg_hil_gps_get_epv(const mavlink_message_t* msg) |
bhepp | 0:28183cc7963f | 408 | { |
bhepp | 0:28183cc7963f | 409 | return _MAV_RETURN_uint16_t(msg, 22); |
bhepp | 0:28183cc7963f | 410 | } |
bhepp | 0:28183cc7963f | 411 | |
bhepp | 0:28183cc7963f | 412 | /** |
bhepp | 0:28183cc7963f | 413 | * @brief Get field vel from hil_gps message |
bhepp | 0:28183cc7963f | 414 | * |
bhepp | 0:28183cc7963f | 415 | * @return GPS ground speed (m/s * 100). If unknown, set to: 65535 |
bhepp | 0:28183cc7963f | 416 | */ |
bhepp | 0:28183cc7963f | 417 | static inline uint16_t mavlink_msg_hil_gps_get_vel(const mavlink_message_t* msg) |
bhepp | 0:28183cc7963f | 418 | { |
bhepp | 0:28183cc7963f | 419 | return _MAV_RETURN_uint16_t(msg, 24); |
bhepp | 0:28183cc7963f | 420 | } |
bhepp | 0:28183cc7963f | 421 | |
bhepp | 0:28183cc7963f | 422 | /** |
bhepp | 0:28183cc7963f | 423 | * @brief Get field vn from hil_gps message |
bhepp | 0:28183cc7963f | 424 | * |
bhepp | 0:28183cc7963f | 425 | * @return GPS velocity in cm/s in NORTH direction in earth-fixed NED frame |
bhepp | 0:28183cc7963f | 426 | */ |
bhepp | 0:28183cc7963f | 427 | static inline int16_t mavlink_msg_hil_gps_get_vn(const mavlink_message_t* msg) |
bhepp | 0:28183cc7963f | 428 | { |
bhepp | 0:28183cc7963f | 429 | return _MAV_RETURN_int16_t(msg, 26); |
bhepp | 0:28183cc7963f | 430 | } |
bhepp | 0:28183cc7963f | 431 | |
bhepp | 0:28183cc7963f | 432 | /** |
bhepp | 0:28183cc7963f | 433 | * @brief Get field ve from hil_gps message |
bhepp | 0:28183cc7963f | 434 | * |
bhepp | 0:28183cc7963f | 435 | * @return GPS velocity in cm/s in EAST direction in earth-fixed NED frame |
bhepp | 0:28183cc7963f | 436 | */ |
bhepp | 0:28183cc7963f | 437 | static inline int16_t mavlink_msg_hil_gps_get_ve(const mavlink_message_t* msg) |
bhepp | 0:28183cc7963f | 438 | { |
bhepp | 0:28183cc7963f | 439 | return _MAV_RETURN_int16_t(msg, 28); |
bhepp | 0:28183cc7963f | 440 | } |
bhepp | 0:28183cc7963f | 441 | |
bhepp | 0:28183cc7963f | 442 | /** |
bhepp | 0:28183cc7963f | 443 | * @brief Get field vd from hil_gps message |
bhepp | 0:28183cc7963f | 444 | * |
bhepp | 0:28183cc7963f | 445 | * @return GPS velocity in cm/s in DOWN direction in earth-fixed NED frame |
bhepp | 0:28183cc7963f | 446 | */ |
bhepp | 0:28183cc7963f | 447 | static inline int16_t mavlink_msg_hil_gps_get_vd(const mavlink_message_t* msg) |
bhepp | 0:28183cc7963f | 448 | { |
bhepp | 0:28183cc7963f | 449 | return _MAV_RETURN_int16_t(msg, 30); |
bhepp | 0:28183cc7963f | 450 | } |
bhepp | 0:28183cc7963f | 451 | |
bhepp | 0:28183cc7963f | 452 | /** |
bhepp | 0:28183cc7963f | 453 | * @brief Get field cog from hil_gps message |
bhepp | 0:28183cc7963f | 454 | * |
bhepp | 0:28183cc7963f | 455 | * @return Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535 |
bhepp | 0:28183cc7963f | 456 | */ |
bhepp | 0:28183cc7963f | 457 | static inline uint16_t mavlink_msg_hil_gps_get_cog(const mavlink_message_t* msg) |
bhepp | 0:28183cc7963f | 458 | { |
bhepp | 0:28183cc7963f | 459 | return _MAV_RETURN_uint16_t(msg, 32); |
bhepp | 0:28183cc7963f | 460 | } |
bhepp | 0:28183cc7963f | 461 | |
bhepp | 0:28183cc7963f | 462 | /** |
bhepp | 0:28183cc7963f | 463 | * @brief Get field satellites_visible from hil_gps message |
bhepp | 0:28183cc7963f | 464 | * |
bhepp | 0:28183cc7963f | 465 | * @return Number of satellites visible. If unknown, set to 255 |
bhepp | 0:28183cc7963f | 466 | */ |
bhepp | 0:28183cc7963f | 467 | static inline uint8_t mavlink_msg_hil_gps_get_satellites_visible(const mavlink_message_t* msg) |
bhepp | 0:28183cc7963f | 468 | { |
bhepp | 0:28183cc7963f | 469 | return _MAV_RETURN_uint8_t(msg, 35); |
bhepp | 0:28183cc7963f | 470 | } |
bhepp | 0:28183cc7963f | 471 | |
bhepp | 0:28183cc7963f | 472 | /** |
bhepp | 0:28183cc7963f | 473 | * @brief Decode a hil_gps message into a struct |
bhepp | 0:28183cc7963f | 474 | * |
bhepp | 0:28183cc7963f | 475 | * @param msg The message to decode |
bhepp | 0:28183cc7963f | 476 | * @param hil_gps C-struct to decode the message contents into |
bhepp | 0:28183cc7963f | 477 | */ |
bhepp | 0:28183cc7963f | 478 | static inline void mavlink_msg_hil_gps_decode(const mavlink_message_t* msg, mavlink_hil_gps_t* hil_gps) |
bhepp | 0:28183cc7963f | 479 | { |
bhepp | 0:28183cc7963f | 480 | #if MAVLINK_NEED_BYTE_SWAP |
bhepp | 0:28183cc7963f | 481 | hil_gps->time_usec = mavlink_msg_hil_gps_get_time_usec(msg); |
bhepp | 0:28183cc7963f | 482 | hil_gps->lat = mavlink_msg_hil_gps_get_lat(msg); |
bhepp | 0:28183cc7963f | 483 | hil_gps->lon = mavlink_msg_hil_gps_get_lon(msg); |
bhepp | 0:28183cc7963f | 484 | hil_gps->alt = mavlink_msg_hil_gps_get_alt(msg); |
bhepp | 0:28183cc7963f | 485 | hil_gps->eph = mavlink_msg_hil_gps_get_eph(msg); |
bhepp | 0:28183cc7963f | 486 | hil_gps->epv = mavlink_msg_hil_gps_get_epv(msg); |
bhepp | 0:28183cc7963f | 487 | hil_gps->vel = mavlink_msg_hil_gps_get_vel(msg); |
bhepp | 0:28183cc7963f | 488 | hil_gps->vn = mavlink_msg_hil_gps_get_vn(msg); |
bhepp | 0:28183cc7963f | 489 | hil_gps->ve = mavlink_msg_hil_gps_get_ve(msg); |
bhepp | 0:28183cc7963f | 490 | hil_gps->vd = mavlink_msg_hil_gps_get_vd(msg); |
bhepp | 0:28183cc7963f | 491 | hil_gps->cog = mavlink_msg_hil_gps_get_cog(msg); |
bhepp | 0:28183cc7963f | 492 | hil_gps->fix_type = mavlink_msg_hil_gps_get_fix_type(msg); |
bhepp | 0:28183cc7963f | 493 | hil_gps->satellites_visible = mavlink_msg_hil_gps_get_satellites_visible(msg); |
bhepp | 0:28183cc7963f | 494 | #else |
bhepp | 0:28183cc7963f | 495 | memcpy(hil_gps, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_HIL_GPS_LEN); |
bhepp | 0:28183cc7963f | 496 | #endif |
bhepp | 0:28183cc7963f | 497 | } |