Code for autonomous ground vehicle, Data Bus, 3rd place winner in 2012 Sparkfun AVC.
Dependencies: Watchdog mbed Schedule SimpleFilter LSM303DLM PinDetect DebounceIn Servo
MAVlink/include/common/mavlink_msg_gps_status.h@0:826c6171fc1b, 2012-06-20 (annotated)
- Committer:
- shimniok
- Date:
- Wed Jun 20 14:57:48 2012 +0000
- Revision:
- 0:826c6171fc1b
Updated documentation
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shimniok | 0:826c6171fc1b | 1 | // MESSAGE GPS_STATUS PACKING |
shimniok | 0:826c6171fc1b | 2 | |
shimniok | 0:826c6171fc1b | 3 | #define MAVLINK_MSG_ID_GPS_STATUS 27 |
shimniok | 0:826c6171fc1b | 4 | |
shimniok | 0:826c6171fc1b | 5 | typedef struct __mavlink_gps_status_t |
shimniok | 0:826c6171fc1b | 6 | { |
shimniok | 0:826c6171fc1b | 7 | uint8_t satellites_visible; ///< Number of satellites visible |
shimniok | 0:826c6171fc1b | 8 | int8_t satellite_prn[20]; ///< Global satellite ID |
shimniok | 0:826c6171fc1b | 9 | int8_t satellite_used[20]; ///< 0: Satellite not used, 1: used for localization |
shimniok | 0:826c6171fc1b | 10 | int8_t satellite_elevation[20]; ///< Elevation (0: right on top of receiver, 90: on the horizon) of satellite |
shimniok | 0:826c6171fc1b | 11 | int8_t satellite_azimuth[20]; ///< Direction of satellite, 0: 0 deg, 255: 360 deg. |
shimniok | 0:826c6171fc1b | 12 | int8_t satellite_snr[20]; ///< Signal to noise ratio of satellite |
shimniok | 0:826c6171fc1b | 13 | |
shimniok | 0:826c6171fc1b | 14 | } mavlink_gps_status_t; |
shimniok | 0:826c6171fc1b | 15 | |
shimniok | 0:826c6171fc1b | 16 | #define MAVLINK_MSG_GPS_STATUS_FIELD_SATELLITE_PRN_LEN 20 |
shimniok | 0:826c6171fc1b | 17 | #define MAVLINK_MSG_GPS_STATUS_FIELD_SATELLITE_USED_LEN 20 |
shimniok | 0:826c6171fc1b | 18 | #define MAVLINK_MSG_GPS_STATUS_FIELD_SATELLITE_ELEVATION_LEN 20 |
shimniok | 0:826c6171fc1b | 19 | #define MAVLINK_MSG_GPS_STATUS_FIELD_SATELLITE_AZIMUTH_LEN 20 |
shimniok | 0:826c6171fc1b | 20 | #define MAVLINK_MSG_GPS_STATUS_FIELD_SATELLITE_SNR_LEN 20 |
shimniok | 0:826c6171fc1b | 21 | |
shimniok | 0:826c6171fc1b | 22 | |
shimniok | 0:826c6171fc1b | 23 | /** |
shimniok | 0:826c6171fc1b | 24 | * @brief Pack a gps_status message |
shimniok | 0:826c6171fc1b | 25 | * @param system_id ID of this system |
shimniok | 0:826c6171fc1b | 26 | * @param component_id ID of this component (e.g. 200 for IMU) |
shimniok | 0:826c6171fc1b | 27 | * @param msg The MAVLink message to compress the data into |
shimniok | 0:826c6171fc1b | 28 | * |
shimniok | 0:826c6171fc1b | 29 | * @param satellites_visible Number of satellites visible |
shimniok | 0:826c6171fc1b | 30 | * @param satellite_prn Global satellite ID |
shimniok | 0:826c6171fc1b | 31 | * @param satellite_used 0: Satellite not used, 1: used for localization |
shimniok | 0:826c6171fc1b | 32 | * @param satellite_elevation Elevation (0: right on top of receiver, 90: on the horizon) of satellite |
shimniok | 0:826c6171fc1b | 33 | * @param satellite_azimuth Direction of satellite, 0: 0 deg, 255: 360 deg. |
shimniok | 0:826c6171fc1b | 34 | * @param satellite_snr Signal to noise ratio of satellite |
shimniok | 0:826c6171fc1b | 35 | * @return length of the message in bytes (excluding serial stream start sign) |
shimniok | 0:826c6171fc1b | 36 | */ |
shimniok | 0:826c6171fc1b | 37 | 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 int8_t* satellite_prn, const int8_t* satellite_used, const int8_t* satellite_elevation, const int8_t* satellite_azimuth, const int8_t* satellite_snr) |
shimniok | 0:826c6171fc1b | 38 | { |
shimniok | 0:826c6171fc1b | 39 | uint16_t i = 0; |
shimniok | 0:826c6171fc1b | 40 | msg->msgid = MAVLINK_MSG_ID_GPS_STATUS; |
shimniok | 0:826c6171fc1b | 41 | |
shimniok | 0:826c6171fc1b | 42 | i += put_uint8_t_by_index(satellites_visible, i, msg->payload); // Number of satellites visible |
shimniok | 0:826c6171fc1b | 43 | i += put_array_by_index(satellite_prn, 20, i, msg->payload); // Global satellite ID |
shimniok | 0:826c6171fc1b | 44 | i += put_array_by_index(satellite_used, 20, i, msg->payload); // 0: Satellite not used, 1: used for localization |
shimniok | 0:826c6171fc1b | 45 | i += put_array_by_index(satellite_elevation, 20, i, msg->payload); // Elevation (0: right on top of receiver, 90: on the horizon) of satellite |
shimniok | 0:826c6171fc1b | 46 | i += put_array_by_index(satellite_azimuth, 20, i, msg->payload); // Direction of satellite, 0: 0 deg, 255: 360 deg. |
shimniok | 0:826c6171fc1b | 47 | i += put_array_by_index(satellite_snr, 20, i, msg->payload); // Signal to noise ratio of satellite |
shimniok | 0:826c6171fc1b | 48 | |
shimniok | 0:826c6171fc1b | 49 | return mavlink_finalize_message(msg, system_id, component_id, i); |
shimniok | 0:826c6171fc1b | 50 | } |
shimniok | 0:826c6171fc1b | 51 | |
shimniok | 0:826c6171fc1b | 52 | /** |
shimniok | 0:826c6171fc1b | 53 | * @brief Pack a gps_status message |
shimniok | 0:826c6171fc1b | 54 | * @param system_id ID of this system |
shimniok | 0:826c6171fc1b | 55 | * @param component_id ID of this component (e.g. 200 for IMU) |
shimniok | 0:826c6171fc1b | 56 | * @param chan The MAVLink channel this message was sent over |
shimniok | 0:826c6171fc1b | 57 | * @param msg The MAVLink message to compress the data into |
shimniok | 0:826c6171fc1b | 58 | * @param satellites_visible Number of satellites visible |
shimniok | 0:826c6171fc1b | 59 | * @param satellite_prn Global satellite ID |
shimniok | 0:826c6171fc1b | 60 | * @param satellite_used 0: Satellite not used, 1: used for localization |
shimniok | 0:826c6171fc1b | 61 | * @param satellite_elevation Elevation (0: right on top of receiver, 90: on the horizon) of satellite |
shimniok | 0:826c6171fc1b | 62 | * @param satellite_azimuth Direction of satellite, 0: 0 deg, 255: 360 deg. |
shimniok | 0:826c6171fc1b | 63 | * @param satellite_snr Signal to noise ratio of satellite |
shimniok | 0:826c6171fc1b | 64 | * @return length of the message in bytes (excluding serial stream start sign) |
shimniok | 0:826c6171fc1b | 65 | */ |
shimniok | 0:826c6171fc1b | 66 | static inline uint16_t mavlink_msg_gps_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint8_t satellites_visible, const int8_t* satellite_prn, const int8_t* satellite_used, const int8_t* satellite_elevation, const int8_t* satellite_azimuth, const int8_t* satellite_snr) |
shimniok | 0:826c6171fc1b | 67 | { |
shimniok | 0:826c6171fc1b | 68 | uint16_t i = 0; |
shimniok | 0:826c6171fc1b | 69 | msg->msgid = MAVLINK_MSG_ID_GPS_STATUS; |
shimniok | 0:826c6171fc1b | 70 | |
shimniok | 0:826c6171fc1b | 71 | i += put_uint8_t_by_index(satellites_visible, i, msg->payload); // Number of satellites visible |
shimniok | 0:826c6171fc1b | 72 | i += put_array_by_index(satellite_prn, 20, i, msg->payload); // Global satellite ID |
shimniok | 0:826c6171fc1b | 73 | i += put_array_by_index(satellite_used, 20, i, msg->payload); // 0: Satellite not used, 1: used for localization |
shimniok | 0:826c6171fc1b | 74 | i += put_array_by_index(satellite_elevation, 20, i, msg->payload); // Elevation (0: right on top of receiver, 90: on the horizon) of satellite |
shimniok | 0:826c6171fc1b | 75 | i += put_array_by_index(satellite_azimuth, 20, i, msg->payload); // Direction of satellite, 0: 0 deg, 255: 360 deg. |
shimniok | 0:826c6171fc1b | 76 | i += put_array_by_index(satellite_snr, 20, i, msg->payload); // Signal to noise ratio of satellite |
shimniok | 0:826c6171fc1b | 77 | |
shimniok | 0:826c6171fc1b | 78 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i); |
shimniok | 0:826c6171fc1b | 79 | } |
shimniok | 0:826c6171fc1b | 80 | |
shimniok | 0:826c6171fc1b | 81 | /** |
shimniok | 0:826c6171fc1b | 82 | * @brief Encode a gps_status struct into a message |
shimniok | 0:826c6171fc1b | 83 | * |
shimniok | 0:826c6171fc1b | 84 | * @param system_id ID of this system |
shimniok | 0:826c6171fc1b | 85 | * @param component_id ID of this component (e.g. 200 for IMU) |
shimniok | 0:826c6171fc1b | 86 | * @param msg The MAVLink message to compress the data into |
shimniok | 0:826c6171fc1b | 87 | * @param gps_status C-struct to read the message contents from |
shimniok | 0:826c6171fc1b | 88 | */ |
shimniok | 0:826c6171fc1b | 89 | static inline uint16_t mavlink_msg_gps_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gps_status_t* gps_status) |
shimniok | 0:826c6171fc1b | 90 | { |
shimniok | 0:826c6171fc1b | 91 | return mavlink_msg_gps_status_pack(system_id, component_id, 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); |
shimniok | 0:826c6171fc1b | 92 | } |
shimniok | 0:826c6171fc1b | 93 | |
shimniok | 0:826c6171fc1b | 94 | /** |
shimniok | 0:826c6171fc1b | 95 | * @brief Send a gps_status message |
shimniok | 0:826c6171fc1b | 96 | * @param chan MAVLink channel to send the message |
shimniok | 0:826c6171fc1b | 97 | * |
shimniok | 0:826c6171fc1b | 98 | * @param satellites_visible Number of satellites visible |
shimniok | 0:826c6171fc1b | 99 | * @param satellite_prn Global satellite ID |
shimniok | 0:826c6171fc1b | 100 | * @param satellite_used 0: Satellite not used, 1: used for localization |
shimniok | 0:826c6171fc1b | 101 | * @param satellite_elevation Elevation (0: right on top of receiver, 90: on the horizon) of satellite |
shimniok | 0:826c6171fc1b | 102 | * @param satellite_azimuth Direction of satellite, 0: 0 deg, 255: 360 deg. |
shimniok | 0:826c6171fc1b | 103 | * @param satellite_snr Signal to noise ratio of satellite |
shimniok | 0:826c6171fc1b | 104 | */ |
shimniok | 0:826c6171fc1b | 105 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS |
shimniok | 0:826c6171fc1b | 106 | |
shimniok | 0:826c6171fc1b | 107 | static inline void mavlink_msg_gps_status_send(mavlink_channel_t chan, uint8_t satellites_visible, const int8_t* satellite_prn, const int8_t* satellite_used, const int8_t* satellite_elevation, const int8_t* satellite_azimuth, const int8_t* satellite_snr) |
shimniok | 0:826c6171fc1b | 108 | { |
shimniok | 0:826c6171fc1b | 109 | mavlink_message_t msg; |
shimniok | 0:826c6171fc1b | 110 | mavlink_msg_gps_status_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, satellites_visible, satellite_prn, satellite_used, satellite_elevation, satellite_azimuth, satellite_snr); |
shimniok | 0:826c6171fc1b | 111 | mavlink_send_uart(chan, &msg); |
shimniok | 0:826c6171fc1b | 112 | } |
shimniok | 0:826c6171fc1b | 113 | |
shimniok | 0:826c6171fc1b | 114 | #endif |
shimniok | 0:826c6171fc1b | 115 | // MESSAGE GPS_STATUS UNPACKING |
shimniok | 0:826c6171fc1b | 116 | |
shimniok | 0:826c6171fc1b | 117 | /** |
shimniok | 0:826c6171fc1b | 118 | * @brief Get field satellites_visible from gps_status message |
shimniok | 0:826c6171fc1b | 119 | * |
shimniok | 0:826c6171fc1b | 120 | * @return Number of satellites visible |
shimniok | 0:826c6171fc1b | 121 | */ |
shimniok | 0:826c6171fc1b | 122 | static inline uint8_t mavlink_msg_gps_status_get_satellites_visible(const mavlink_message_t* msg) |
shimniok | 0:826c6171fc1b | 123 | { |
shimniok | 0:826c6171fc1b | 124 | return (uint8_t)(msg->payload)[0]; |
shimniok | 0:826c6171fc1b | 125 | } |
shimniok | 0:826c6171fc1b | 126 | |
shimniok | 0:826c6171fc1b | 127 | /** |
shimniok | 0:826c6171fc1b | 128 | * @brief Get field satellite_prn from gps_status message |
shimniok | 0:826c6171fc1b | 129 | * |
shimniok | 0:826c6171fc1b | 130 | * @return Global satellite ID |
shimniok | 0:826c6171fc1b | 131 | */ |
shimniok | 0:826c6171fc1b | 132 | static inline uint16_t mavlink_msg_gps_status_get_satellite_prn(const mavlink_message_t* msg, int8_t* r_data) |
shimniok | 0:826c6171fc1b | 133 | { |
shimniok | 0:826c6171fc1b | 134 | |
shimniok | 0:826c6171fc1b | 135 | memcpy(r_data, msg->payload+sizeof(uint8_t), 20); |
shimniok | 0:826c6171fc1b | 136 | return 20; |
shimniok | 0:826c6171fc1b | 137 | } |
shimniok | 0:826c6171fc1b | 138 | |
shimniok | 0:826c6171fc1b | 139 | /** |
shimniok | 0:826c6171fc1b | 140 | * @brief Get field satellite_used from gps_status message |
shimniok | 0:826c6171fc1b | 141 | * |
shimniok | 0:826c6171fc1b | 142 | * @return 0: Satellite not used, 1: used for localization |
shimniok | 0:826c6171fc1b | 143 | */ |
shimniok | 0:826c6171fc1b | 144 | static inline uint16_t mavlink_msg_gps_status_get_satellite_used(const mavlink_message_t* msg, int8_t* r_data) |
shimniok | 0:826c6171fc1b | 145 | { |
shimniok | 0:826c6171fc1b | 146 | |
shimniok | 0:826c6171fc1b | 147 | memcpy(r_data, msg->payload+sizeof(uint8_t)+20, 20); |
shimniok | 0:826c6171fc1b | 148 | return 20; |
shimniok | 0:826c6171fc1b | 149 | } |
shimniok | 0:826c6171fc1b | 150 | |
shimniok | 0:826c6171fc1b | 151 | /** |
shimniok | 0:826c6171fc1b | 152 | * @brief Get field satellite_elevation from gps_status message |
shimniok | 0:826c6171fc1b | 153 | * |
shimniok | 0:826c6171fc1b | 154 | * @return Elevation (0: right on top of receiver, 90: on the horizon) of satellite |
shimniok | 0:826c6171fc1b | 155 | */ |
shimniok | 0:826c6171fc1b | 156 | static inline uint16_t mavlink_msg_gps_status_get_satellite_elevation(const mavlink_message_t* msg, int8_t* r_data) |
shimniok | 0:826c6171fc1b | 157 | { |
shimniok | 0:826c6171fc1b | 158 | |
shimniok | 0:826c6171fc1b | 159 | memcpy(r_data, msg->payload+sizeof(uint8_t)+20+20, 20); |
shimniok | 0:826c6171fc1b | 160 | return 20; |
shimniok | 0:826c6171fc1b | 161 | } |
shimniok | 0:826c6171fc1b | 162 | |
shimniok | 0:826c6171fc1b | 163 | /** |
shimniok | 0:826c6171fc1b | 164 | * @brief Get field satellite_azimuth from gps_status message |
shimniok | 0:826c6171fc1b | 165 | * |
shimniok | 0:826c6171fc1b | 166 | * @return Direction of satellite, 0: 0 deg, 255: 360 deg. |
shimniok | 0:826c6171fc1b | 167 | */ |
shimniok | 0:826c6171fc1b | 168 | static inline uint16_t mavlink_msg_gps_status_get_satellite_azimuth(const mavlink_message_t* msg, int8_t* r_data) |
shimniok | 0:826c6171fc1b | 169 | { |
shimniok | 0:826c6171fc1b | 170 | |
shimniok | 0:826c6171fc1b | 171 | memcpy(r_data, msg->payload+sizeof(uint8_t)+20+20+20, 20); |
shimniok | 0:826c6171fc1b | 172 | return 20; |
shimniok | 0:826c6171fc1b | 173 | } |
shimniok | 0:826c6171fc1b | 174 | |
shimniok | 0:826c6171fc1b | 175 | /** |
shimniok | 0:826c6171fc1b | 176 | * @brief Get field satellite_snr from gps_status message |
shimniok | 0:826c6171fc1b | 177 | * |
shimniok | 0:826c6171fc1b | 178 | * @return Signal to noise ratio of satellite |
shimniok | 0:826c6171fc1b | 179 | */ |
shimniok | 0:826c6171fc1b | 180 | static inline uint16_t mavlink_msg_gps_status_get_satellite_snr(const mavlink_message_t* msg, int8_t* r_data) |
shimniok | 0:826c6171fc1b | 181 | { |
shimniok | 0:826c6171fc1b | 182 | |
shimniok | 0:826c6171fc1b | 183 | memcpy(r_data, msg->payload+sizeof(uint8_t)+20+20+20+20, 20); |
shimniok | 0:826c6171fc1b | 184 | return 20; |
shimniok | 0:826c6171fc1b | 185 | } |
shimniok | 0:826c6171fc1b | 186 | |
shimniok | 0:826c6171fc1b | 187 | /** |
shimniok | 0:826c6171fc1b | 188 | * @brief Decode a gps_status message into a struct |
shimniok | 0:826c6171fc1b | 189 | * |
shimniok | 0:826c6171fc1b | 190 | * @param msg The message to decode |
shimniok | 0:826c6171fc1b | 191 | * @param gps_status C-struct to decode the message contents into |
shimniok | 0:826c6171fc1b | 192 | */ |
shimniok | 0:826c6171fc1b | 193 | static inline void mavlink_msg_gps_status_decode(const mavlink_message_t* msg, mavlink_gps_status_t* gps_status) |
shimniok | 0:826c6171fc1b | 194 | { |
shimniok | 0:826c6171fc1b | 195 | gps_status->satellites_visible = mavlink_msg_gps_status_get_satellites_visible(msg); |
shimniok | 0:826c6171fc1b | 196 | mavlink_msg_gps_status_get_satellite_prn(msg, gps_status->satellite_prn); |
shimniok | 0:826c6171fc1b | 197 | mavlink_msg_gps_status_get_satellite_used(msg, gps_status->satellite_used); |
shimniok | 0:826c6171fc1b | 198 | mavlink_msg_gps_status_get_satellite_elevation(msg, gps_status->satellite_elevation); |
shimniok | 0:826c6171fc1b | 199 | mavlink_msg_gps_status_get_satellite_azimuth(msg, gps_status->satellite_azimuth); |
shimniok | 0:826c6171fc1b | 200 | mavlink_msg_gps_status_get_satellite_snr(msg, gps_status->satellite_snr); |
shimniok | 0:826c6171fc1b | 201 | } |