[88] | 1 | // MESSAGE GPS_RAW_INT PACKING
|
---|
| 2 |
|
---|
| 3 | #define MAVLINK_MSG_ID_GPS_RAW_INT 24
|
---|
| 4 |
|
---|
| 5 | typedef struct MAVLINK_PACKED __mavlink_gps_raw_int_t
|
---|
| 6 | {
|
---|
| 7 | uint64_t time_usec; /*< Timestamp (microseconds since UNIX epoch or microseconds since system boot)*/
|
---|
| 8 | int32_t lat; /*< Latitude (WGS84), in degrees * 1E7*/
|
---|
| 9 | int32_t lon; /*< Longitude (WGS84), in degrees * 1E7*/
|
---|
| 10 | int32_t alt; /*< Altitude (AMSL, NOT WGS84), in meters * 1000 (positive for up). Note that virtually all GPS modules provide the AMSL altitude in addition to the WGS84 altitude.*/
|
---|
| 11 | uint16_t eph; /*< GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX*/
|
---|
| 12 | uint16_t epv; /*< GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX*/
|
---|
| 13 | uint16_t vel; /*< GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX*/
|
---|
| 14 | uint16_t cog; /*< Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX*/
|
---|
| 15 | uint8_t fix_type; /*< 0-1: no fix, 2: 2D fix, 3: 3D fix, 4: DGPS, 5: RTK. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix.*/
|
---|
| 16 | uint8_t satellites_visible; /*< Number of satellites visible. If unknown, set to 255*/
|
---|
| 17 | } mavlink_gps_raw_int_t;
|
---|
| 18 |
|
---|
| 19 | #define MAVLINK_MSG_ID_GPS_RAW_INT_LEN 30
|
---|
| 20 | #define MAVLINK_MSG_ID_GPS_RAW_INT_MIN_LEN 30
|
---|
| 21 | #define MAVLINK_MSG_ID_24_LEN 30
|
---|
| 22 | #define MAVLINK_MSG_ID_24_MIN_LEN 30
|
---|
| 23 |
|
---|
| 24 | #define MAVLINK_MSG_ID_GPS_RAW_INT_CRC 24
|
---|
| 25 | #define MAVLINK_MSG_ID_24_CRC 24
|
---|
| 26 |
|
---|
| 27 |
|
---|
| 28 |
|
---|
| 29 | #if MAVLINK_COMMAND_24BIT
|
---|
| 30 | #define MAVLINK_MESSAGE_INFO_GPS_RAW_INT { \
|
---|
| 31 | 24, \
|
---|
| 32 | "GPS_RAW_INT", \
|
---|
| 33 | 10, \
|
---|
| 34 | { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_gps_raw_int_t, time_usec) }, \
|
---|
| 35 | { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_gps_raw_int_t, lat) }, \
|
---|
| 36 | { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_gps_raw_int_t, lon) }, \
|
---|
| 37 | { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_gps_raw_int_t, alt) }, \
|
---|
| 38 | { "eph", NULL, MAVLINK_TYPE_UINT16_T, 0, 20, offsetof(mavlink_gps_raw_int_t, eph) }, \
|
---|
| 39 | { "epv", NULL, MAVLINK_TYPE_UINT16_T, 0, 22, offsetof(mavlink_gps_raw_int_t, epv) }, \
|
---|
| 40 | { "vel", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_gps_raw_int_t, vel) }, \
|
---|
| 41 | { "cog", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_gps_raw_int_t, cog) }, \
|
---|
| 42 | { "fix_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_gps_raw_int_t, fix_type) }, \
|
---|
| 43 | { "satellites_visible", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_gps_raw_int_t, satellites_visible) }, \
|
---|
| 44 | } \
|
---|
| 45 | }
|
---|
| 46 | #else
|
---|
| 47 | #define MAVLINK_MESSAGE_INFO_GPS_RAW_INT { \
|
---|
| 48 | "GPS_RAW_INT", \
|
---|
| 49 | 10, \
|
---|
| 50 | { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_gps_raw_int_t, time_usec) }, \
|
---|
| 51 | { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_gps_raw_int_t, lat) }, \
|
---|
| 52 | { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_gps_raw_int_t, lon) }, \
|
---|
| 53 | { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_gps_raw_int_t, alt) }, \
|
---|
| 54 | { "eph", NULL, MAVLINK_TYPE_UINT16_T, 0, 20, offsetof(mavlink_gps_raw_int_t, eph) }, \
|
---|
| 55 | { "epv", NULL, MAVLINK_TYPE_UINT16_T, 0, 22, offsetof(mavlink_gps_raw_int_t, epv) }, \
|
---|
| 56 | { "vel", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_gps_raw_int_t, vel) }, \
|
---|
| 57 | { "cog", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_gps_raw_int_t, cog) }, \
|
---|
| 58 | { "fix_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_gps_raw_int_t, fix_type) }, \
|
---|
| 59 | { "satellites_visible", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_gps_raw_int_t, satellites_visible) }, \
|
---|
| 60 | } \
|
---|
| 61 | }
|
---|
| 62 | #endif
|
---|
| 63 |
|
---|
| 64 | /**
|
---|
| 65 | * @brief Pack a gps_raw_int message
|
---|
| 66 | * @param system_id ID of this system
|
---|
| 67 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
| 68 | * @param msg The MAVLink message to compress the data into
|
---|
| 69 | *
|
---|
| 70 | * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
---|
| 71 | * @param fix_type 0-1: no fix, 2: 2D fix, 3: 3D fix, 4: DGPS, 5: RTK. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix.
|
---|
| 72 | * @param lat Latitude (WGS84), in degrees * 1E7
|
---|
| 73 | * @param lon Longitude (WGS84), in degrees * 1E7
|
---|
| 74 | * @param alt Altitude (AMSL, NOT WGS84), in meters * 1000 (positive for up). Note that virtually all GPS modules provide the AMSL altitude in addition to the WGS84 altitude.
|
---|
| 75 | * @param eph GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX
|
---|
| 76 | * @param epv GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX
|
---|
| 77 | * @param vel GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX
|
---|
| 78 | * @param cog Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
|
---|
| 79 | * @param satellites_visible Number of satellites visible. If unknown, set to 255
|
---|
| 80 | * @return length of the message in bytes (excluding serial stream start sign)
|
---|
| 81 | */
|
---|
| 82 | static inline uint16_t mavlink_msg_gps_raw_int_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
---|
| 83 | 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)
|
---|
| 84 | {
|
---|
| 85 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 86 | char buf[MAVLINK_MSG_ID_GPS_RAW_INT_LEN];
|
---|
| 87 | _mav_put_uint64_t(buf, 0, time_usec);
|
---|
| 88 | _mav_put_int32_t(buf, 8, lat);
|
---|
| 89 | _mav_put_int32_t(buf, 12, lon);
|
---|
| 90 | _mav_put_int32_t(buf, 16, alt);
|
---|
| 91 | _mav_put_uint16_t(buf, 20, eph);
|
---|
| 92 | _mav_put_uint16_t(buf, 22, epv);
|
---|
| 93 | _mav_put_uint16_t(buf, 24, vel);
|
---|
| 94 | _mav_put_uint16_t(buf, 26, cog);
|
---|
| 95 | _mav_put_uint8_t(buf, 28, fix_type);
|
---|
| 96 | _mav_put_uint8_t(buf, 29, satellites_visible);
|
---|
| 97 |
|
---|
| 98 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
|
---|
| 99 | #else
|
---|
| 100 | mavlink_gps_raw_int_t packet;
|
---|
| 101 | packet.time_usec = time_usec;
|
---|
| 102 | packet.lat = lat;
|
---|
| 103 | packet.lon = lon;
|
---|
| 104 | packet.alt = alt;
|
---|
| 105 | packet.eph = eph;
|
---|
| 106 | packet.epv = epv;
|
---|
| 107 | packet.vel = vel;
|
---|
| 108 | packet.cog = cog;
|
---|
| 109 | packet.fix_type = fix_type;
|
---|
| 110 | packet.satellites_visible = satellites_visible;
|
---|
| 111 |
|
---|
| 112 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
|
---|
| 113 | #endif
|
---|
| 114 |
|
---|
| 115 | msg->msgid = MAVLINK_MSG_ID_GPS_RAW_INT;
|
---|
| 116 | 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);
|
---|
| 117 | }
|
---|
| 118 |
|
---|
| 119 | /**
|
---|
| 120 | * @brief Pack a gps_raw_int message on a channel
|
---|
| 121 | * @param system_id ID of this system
|
---|
| 122 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
| 123 | * @param chan The MAVLink channel this message will be sent over
|
---|
| 124 | * @param msg The MAVLink message to compress the data into
|
---|
| 125 | * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
---|
| 126 | * @param fix_type 0-1: no fix, 2: 2D fix, 3: 3D fix, 4: DGPS, 5: RTK. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix.
|
---|
| 127 | * @param lat Latitude (WGS84), in degrees * 1E7
|
---|
| 128 | * @param lon Longitude (WGS84), in degrees * 1E7
|
---|
| 129 | * @param alt Altitude (AMSL, NOT WGS84), in meters * 1000 (positive for up). Note that virtually all GPS modules provide the AMSL altitude in addition to the WGS84 altitude.
|
---|
| 130 | * @param eph GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX
|
---|
| 131 | * @param epv GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX
|
---|
| 132 | * @param vel GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX
|
---|
| 133 | * @param cog Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
|
---|
| 134 | * @param satellites_visible Number of satellites visible. If unknown, set to 255
|
---|
| 135 | * @return length of the message in bytes (excluding serial stream start sign)
|
---|
| 136 | */
|
---|
| 137 | static inline uint16_t mavlink_msg_gps_raw_int_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
---|
| 138 | mavlink_message_t* msg,
|
---|
| 139 | 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)
|
---|
| 140 | {
|
---|
| 141 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 142 | char buf[MAVLINK_MSG_ID_GPS_RAW_INT_LEN];
|
---|
| 143 | _mav_put_uint64_t(buf, 0, time_usec);
|
---|
| 144 | _mav_put_int32_t(buf, 8, lat);
|
---|
| 145 | _mav_put_int32_t(buf, 12, lon);
|
---|
| 146 | _mav_put_int32_t(buf, 16, alt);
|
---|
| 147 | _mav_put_uint16_t(buf, 20, eph);
|
---|
| 148 | _mav_put_uint16_t(buf, 22, epv);
|
---|
| 149 | _mav_put_uint16_t(buf, 24, vel);
|
---|
| 150 | _mav_put_uint16_t(buf, 26, cog);
|
---|
| 151 | _mav_put_uint8_t(buf, 28, fix_type);
|
---|
| 152 | _mav_put_uint8_t(buf, 29, satellites_visible);
|
---|
| 153 |
|
---|
| 154 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
|
---|
| 155 | #else
|
---|
| 156 | mavlink_gps_raw_int_t packet;
|
---|
| 157 | packet.time_usec = time_usec;
|
---|
| 158 | packet.lat = lat;
|
---|
| 159 | packet.lon = lon;
|
---|
| 160 | packet.alt = alt;
|
---|
| 161 | packet.eph = eph;
|
---|
| 162 | packet.epv = epv;
|
---|
| 163 | packet.vel = vel;
|
---|
| 164 | packet.cog = cog;
|
---|
| 165 | packet.fix_type = fix_type;
|
---|
| 166 | packet.satellites_visible = satellites_visible;
|
---|
| 167 |
|
---|
| 168 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
|
---|
| 169 | #endif
|
---|
| 170 |
|
---|
| 171 | msg->msgid = MAVLINK_MSG_ID_GPS_RAW_INT;
|
---|
| 172 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GPS_RAW_INT_MIN_LEN, MAVLINK_MSG_ID_GPS_RAW_INT_LEN, MAVLINK_MSG_ID_GPS_RAW_INT_CRC);
|
---|
| 173 | }
|
---|
| 174 |
|
---|
| 175 | /**
|
---|
| 176 | * @brief Encode a gps_raw_int struct
|
---|
| 177 | *
|
---|
| 178 | * @param system_id ID of this system
|
---|
| 179 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
| 180 | * @param msg The MAVLink message to compress the data into
|
---|
| 181 | * @param gps_raw_int C-struct to read the message contents from
|
---|
| 182 | */
|
---|
| 183 | static inline uint16_t mavlink_msg_gps_raw_int_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gps_raw_int_t* gps_raw_int)
|
---|
| 184 | {
|
---|
| 185 | return mavlink_msg_gps_raw_int_pack(system_id, component_id, 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);
|
---|
| 186 | }
|
---|
| 187 |
|
---|
| 188 | /**
|
---|
| 189 | * @brief Encode a gps_raw_int struct on a channel
|
---|
| 190 | *
|
---|
| 191 | * @param system_id ID of this system
|
---|
| 192 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
| 193 | * @param chan The MAVLink channel this message will be sent over
|
---|
| 194 | * @param msg The MAVLink message to compress the data into
|
---|
| 195 | * @param gps_raw_int C-struct to read the message contents from
|
---|
| 196 | */
|
---|
| 197 | static inline uint16_t mavlink_msg_gps_raw_int_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gps_raw_int_t* gps_raw_int)
|
---|
| 198 | {
|
---|
| 199 | 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);
|
---|
| 200 | }
|
---|
| 201 |
|
---|
| 202 | /**
|
---|
| 203 | * @brief Send a gps_raw_int message
|
---|
| 204 | * @param chan MAVLink channel to send the message
|
---|
| 205 | *
|
---|
| 206 | * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
---|
| 207 | * @param fix_type 0-1: no fix, 2: 2D fix, 3: 3D fix, 4: DGPS, 5: RTK. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix.
|
---|
| 208 | * @param lat Latitude (WGS84), in degrees * 1E7
|
---|
| 209 | * @param lon Longitude (WGS84), in degrees * 1E7
|
---|
| 210 | * @param alt Altitude (AMSL, NOT WGS84), in meters * 1000 (positive for up). Note that virtually all GPS modules provide the AMSL altitude in addition to the WGS84 altitude.
|
---|
| 211 | * @param eph GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX
|
---|
| 212 | * @param epv GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX
|
---|
| 213 | * @param vel GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX
|
---|
| 214 | * @param cog Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
|
---|
| 215 | * @param satellites_visible Number of satellites visible. If unknown, set to 255
|
---|
| 216 | */
|
---|
| 217 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
---|
| 218 |
|
---|
| 219 | static inline void mavlink_msg_gps_raw_int_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)
|
---|
| 220 | {
|
---|
| 221 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 222 | char buf[MAVLINK_MSG_ID_GPS_RAW_INT_LEN];
|
---|
| 223 | _mav_put_uint64_t(buf, 0, time_usec);
|
---|
| 224 | _mav_put_int32_t(buf, 8, lat);
|
---|
| 225 | _mav_put_int32_t(buf, 12, lon);
|
---|
| 226 | _mav_put_int32_t(buf, 16, alt);
|
---|
| 227 | _mav_put_uint16_t(buf, 20, eph);
|
---|
| 228 | _mav_put_uint16_t(buf, 22, epv);
|
---|
| 229 | _mav_put_uint16_t(buf, 24, vel);
|
---|
| 230 | _mav_put_uint16_t(buf, 26, cog);
|
---|
| 231 | _mav_put_uint8_t(buf, 28, fix_type);
|
---|
| 232 | _mav_put_uint8_t(buf, 29, satellites_visible);
|
---|
| 233 |
|
---|
| 234 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RAW_INT, buf, MAVLINK_MSG_ID_GPS_RAW_INT_MIN_LEN, MAVLINK_MSG_ID_GPS_RAW_INT_LEN, MAVLINK_MSG_ID_GPS_RAW_INT_CRC);
|
---|
| 235 | #else
|
---|
| 236 | mavlink_gps_raw_int_t packet;
|
---|
| 237 | packet.time_usec = time_usec;
|
---|
| 238 | packet.lat = lat;
|
---|
| 239 | packet.lon = lon;
|
---|
| 240 | packet.alt = alt;
|
---|
| 241 | packet.eph = eph;
|
---|
| 242 | packet.epv = epv;
|
---|
| 243 | packet.vel = vel;
|
---|
| 244 | packet.cog = cog;
|
---|
| 245 | packet.fix_type = fix_type;
|
---|
| 246 | packet.satellites_visible = satellites_visible;
|
---|
| 247 |
|
---|
| 248 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RAW_INT, (const char *)&packet, MAVLINK_MSG_ID_GPS_RAW_INT_MIN_LEN, MAVLINK_MSG_ID_GPS_RAW_INT_LEN, MAVLINK_MSG_ID_GPS_RAW_INT_CRC);
|
---|
| 249 | #endif
|
---|
| 250 | }
|
---|
| 251 |
|
---|
| 252 | /**
|
---|
| 253 | * @brief Send a gps_raw_int message
|
---|
| 254 | * @param chan MAVLink channel to send the message
|
---|
| 255 | * @param struct The MAVLink struct to serialize
|
---|
| 256 | */
|
---|
| 257 | static inline void mavlink_msg_gps_raw_int_send_struct(mavlink_channel_t chan, const mavlink_gps_raw_int_t* gps_raw_int)
|
---|
| 258 | {
|
---|
| 259 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 260 | mavlink_msg_gps_raw_int_send(chan, 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);
|
---|
| 261 | #else
|
---|
| 262 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RAW_INT, (const char *)gps_raw_int, MAVLINK_MSG_ID_GPS_RAW_INT_MIN_LEN, MAVLINK_MSG_ID_GPS_RAW_INT_LEN, MAVLINK_MSG_ID_GPS_RAW_INT_CRC);
|
---|
| 263 | #endif
|
---|
| 264 | }
|
---|
| 265 |
|
---|
| 266 | #if MAVLINK_MSG_ID_GPS_RAW_INT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
|
---|
| 267 | /*
|
---|
| 268 | This varient of _send() can be used to save stack space by re-using
|
---|
| 269 | memory from the receive buffer. The caller provides a
|
---|
| 270 | mavlink_message_t which is the size of a full mavlink message. This
|
---|
| 271 | is usually the receive buffer for the channel, and allows a reply to an
|
---|
| 272 | incoming message with minimum stack space usage.
|
---|
| 273 | */
|
---|
| 274 | static inline void mavlink_msg_gps_raw_int_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)
|
---|
| 275 | {
|
---|
| 276 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 277 | char *buf = (char *)msgbuf;
|
---|
| 278 | _mav_put_uint64_t(buf, 0, time_usec);
|
---|
| 279 | _mav_put_int32_t(buf, 8, lat);
|
---|
| 280 | _mav_put_int32_t(buf, 12, lon);
|
---|
| 281 | _mav_put_int32_t(buf, 16, alt);
|
---|
| 282 | _mav_put_uint16_t(buf, 20, eph);
|
---|
| 283 | _mav_put_uint16_t(buf, 22, epv);
|
---|
| 284 | _mav_put_uint16_t(buf, 24, vel);
|
---|
| 285 | _mav_put_uint16_t(buf, 26, cog);
|
---|
| 286 | _mav_put_uint8_t(buf, 28, fix_type);
|
---|
| 287 | _mav_put_uint8_t(buf, 29, satellites_visible);
|
---|
| 288 |
|
---|
| 289 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RAW_INT, buf, MAVLINK_MSG_ID_GPS_RAW_INT_MIN_LEN, MAVLINK_MSG_ID_GPS_RAW_INT_LEN, MAVLINK_MSG_ID_GPS_RAW_INT_CRC);
|
---|
| 290 | #else
|
---|
| 291 | mavlink_gps_raw_int_t *packet = (mavlink_gps_raw_int_t *)msgbuf;
|
---|
| 292 | packet->time_usec = time_usec;
|
---|
| 293 | packet->lat = lat;
|
---|
| 294 | packet->lon = lon;
|
---|
| 295 | packet->alt = alt;
|
---|
| 296 | packet->eph = eph;
|
---|
| 297 | packet->epv = epv;
|
---|
| 298 | packet->vel = vel;
|
---|
| 299 | packet->cog = cog;
|
---|
| 300 | packet->fix_type = fix_type;
|
---|
| 301 | packet->satellites_visible = satellites_visible;
|
---|
| 302 |
|
---|
| 303 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RAW_INT, (const char *)packet, MAVLINK_MSG_ID_GPS_RAW_INT_MIN_LEN, MAVLINK_MSG_ID_GPS_RAW_INT_LEN, MAVLINK_MSG_ID_GPS_RAW_INT_CRC);
|
---|
| 304 | #endif
|
---|
| 305 | }
|
---|
| 306 | #endif
|
---|
| 307 |
|
---|
| 308 | #endif
|
---|
| 309 |
|
---|
| 310 | // MESSAGE GPS_RAW_INT UNPACKING
|
---|
| 311 |
|
---|
| 312 |
|
---|
| 313 | /**
|
---|
| 314 | * @brief Get field time_usec from gps_raw_int message
|
---|
| 315 | *
|
---|
| 316 | * @return Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
---|
| 317 | */
|
---|
| 318 | static inline uint64_t mavlink_msg_gps_raw_int_get_time_usec(const mavlink_message_t* msg)
|
---|
| 319 | {
|
---|
| 320 | return _MAV_RETURN_uint64_t(msg, 0);
|
---|
| 321 | }
|
---|
| 322 |
|
---|
| 323 | /**
|
---|
| 324 | * @brief Get field fix_type from gps_raw_int message
|
---|
| 325 | *
|
---|
| 326 | * @return 0-1: no fix, 2: 2D fix, 3: 3D fix, 4: DGPS, 5: RTK. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix.
|
---|
| 327 | */
|
---|
| 328 | static inline uint8_t mavlink_msg_gps_raw_int_get_fix_type(const mavlink_message_t* msg)
|
---|
| 329 | {
|
---|
| 330 | return _MAV_RETURN_uint8_t(msg, 28);
|
---|
| 331 | }
|
---|
| 332 |
|
---|
| 333 | /**
|
---|
| 334 | * @brief Get field lat from gps_raw_int message
|
---|
| 335 | *
|
---|
| 336 | * @return Latitude (WGS84), in degrees * 1E7
|
---|
| 337 | */
|
---|
| 338 | static inline int32_t mavlink_msg_gps_raw_int_get_lat(const mavlink_message_t* msg)
|
---|
| 339 | {
|
---|
| 340 | return _MAV_RETURN_int32_t(msg, 8);
|
---|
| 341 | }
|
---|
| 342 |
|
---|
| 343 | /**
|
---|
| 344 | * @brief Get field lon from gps_raw_int message
|
---|
| 345 | *
|
---|
| 346 | * @return Longitude (WGS84), in degrees * 1E7
|
---|
| 347 | */
|
---|
| 348 | static inline int32_t mavlink_msg_gps_raw_int_get_lon(const mavlink_message_t* msg)
|
---|
| 349 | {
|
---|
| 350 | return _MAV_RETURN_int32_t(msg, 12);
|
---|
| 351 | }
|
---|
| 352 |
|
---|
| 353 | /**
|
---|
| 354 | * @brief Get field alt from gps_raw_int message
|
---|
| 355 | *
|
---|
| 356 | * @return Altitude (AMSL, NOT WGS84), in meters * 1000 (positive for up). Note that virtually all GPS modules provide the AMSL altitude in addition to the WGS84 altitude.
|
---|
| 357 | */
|
---|
| 358 | static inline int32_t mavlink_msg_gps_raw_int_get_alt(const mavlink_message_t* msg)
|
---|
| 359 | {
|
---|
| 360 | return _MAV_RETURN_int32_t(msg, 16);
|
---|
| 361 | }
|
---|
| 362 |
|
---|
| 363 | /**
|
---|
| 364 | * @brief Get field eph from gps_raw_int message
|
---|
| 365 | *
|
---|
| 366 | * @return GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX
|
---|
| 367 | */
|
---|
| 368 | static inline uint16_t mavlink_msg_gps_raw_int_get_eph(const mavlink_message_t* msg)
|
---|
| 369 | {
|
---|
| 370 | return _MAV_RETURN_uint16_t(msg, 20);
|
---|
| 371 | }
|
---|
| 372 |
|
---|
| 373 | /**
|
---|
| 374 | * @brief Get field epv from gps_raw_int message
|
---|
| 375 | *
|
---|
| 376 | * @return GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX
|
---|
| 377 | */
|
---|
| 378 | static inline uint16_t mavlink_msg_gps_raw_int_get_epv(const mavlink_message_t* msg)
|
---|
| 379 | {
|
---|
| 380 | return _MAV_RETURN_uint16_t(msg, 22);
|
---|
| 381 | }
|
---|
| 382 |
|
---|
| 383 | /**
|
---|
| 384 | * @brief Get field vel from gps_raw_int message
|
---|
| 385 | *
|
---|
| 386 | * @return GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX
|
---|
| 387 | */
|
---|
| 388 | static inline uint16_t mavlink_msg_gps_raw_int_get_vel(const mavlink_message_t* msg)
|
---|
| 389 | {
|
---|
| 390 | return _MAV_RETURN_uint16_t(msg, 24);
|
---|
| 391 | }
|
---|
| 392 |
|
---|
| 393 | /**
|
---|
| 394 | * @brief Get field cog from gps_raw_int message
|
---|
| 395 | *
|
---|
| 396 | * @return Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
|
---|
| 397 | */
|
---|
| 398 | static inline uint16_t mavlink_msg_gps_raw_int_get_cog(const mavlink_message_t* msg)
|
---|
| 399 | {
|
---|
| 400 | return _MAV_RETURN_uint16_t(msg, 26);
|
---|
| 401 | }
|
---|
| 402 |
|
---|
| 403 | /**
|
---|
| 404 | * @brief Get field satellites_visible from gps_raw_int message
|
---|
| 405 | *
|
---|
| 406 | * @return Number of satellites visible. If unknown, set to 255
|
---|
| 407 | */
|
---|
| 408 | static inline uint8_t mavlink_msg_gps_raw_int_get_satellites_visible(const mavlink_message_t* msg)
|
---|
| 409 | {
|
---|
| 410 | return _MAV_RETURN_uint8_t(msg, 29);
|
---|
| 411 | }
|
---|
| 412 |
|
---|
| 413 | /**
|
---|
| 414 | * @brief Decode a gps_raw_int message into a struct
|
---|
| 415 | *
|
---|
| 416 | * @param msg The message to decode
|
---|
| 417 | * @param gps_raw_int C-struct to decode the message contents into
|
---|
| 418 | */
|
---|
| 419 | static inline void mavlink_msg_gps_raw_int_decode(const mavlink_message_t* msg, mavlink_gps_raw_int_t* gps_raw_int)
|
---|
| 420 | {
|
---|
| 421 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 422 | gps_raw_int->time_usec = mavlink_msg_gps_raw_int_get_time_usec(msg);
|
---|
| 423 | gps_raw_int->lat = mavlink_msg_gps_raw_int_get_lat(msg);
|
---|
| 424 | gps_raw_int->lon = mavlink_msg_gps_raw_int_get_lon(msg);
|
---|
| 425 | gps_raw_int->alt = mavlink_msg_gps_raw_int_get_alt(msg);
|
---|
| 426 | gps_raw_int->eph = mavlink_msg_gps_raw_int_get_eph(msg);
|
---|
| 427 | gps_raw_int->epv = mavlink_msg_gps_raw_int_get_epv(msg);
|
---|
| 428 | gps_raw_int->vel = mavlink_msg_gps_raw_int_get_vel(msg);
|
---|
| 429 | gps_raw_int->cog = mavlink_msg_gps_raw_int_get_cog(msg);
|
---|
| 430 | gps_raw_int->fix_type = mavlink_msg_gps_raw_int_get_fix_type(msg);
|
---|
| 431 | gps_raw_int->satellites_visible = mavlink_msg_gps_raw_int_get_satellites_visible(msg);
|
---|
| 432 | #else
|
---|
| 433 | uint8_t len = msg->len < MAVLINK_MSG_ID_GPS_RAW_INT_LEN? msg->len : MAVLINK_MSG_ID_GPS_RAW_INT_LEN;
|
---|
| 434 | memset(gps_raw_int, 0, MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
|
---|
| 435 | memcpy(gps_raw_int, _MAV_PAYLOAD(msg), len);
|
---|
| 436 | #endif
|
---|
| 437 | }
|
---|