![](/media/cache/profiles/2012_sf_avc_095.jpg.50x50_q85.jpg)
Code for autonomous rover for Sparkfun AVC. DataBus won 3rd in 2012 and the same code was used on Troubled Child, a 1986 Jeep Grand Wagoneer to win 1st in 2014.
Dependencies: mbed Watchdog SDFileSystem DigoleSerialDisp
MAVlink/include/pixhawk/mavlink_msg_brief_feature.h@0:a6a169de725f, 2013-05-27 (annotated)
- Committer:
- shimniok
- Date:
- Mon May 27 13:26:03 2013 +0000
- Revision:
- 0:a6a169de725f
Working version with priorities set and update time display
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shimniok | 0:a6a169de725f | 1 | // MESSAGE BRIEF_FEATURE PACKING |
shimniok | 0:a6a169de725f | 2 | |
shimniok | 0:a6a169de725f | 3 | #define MAVLINK_MSG_ID_BRIEF_FEATURE 172 |
shimniok | 0:a6a169de725f | 4 | |
shimniok | 0:a6a169de725f | 5 | typedef struct __mavlink_brief_feature_t |
shimniok | 0:a6a169de725f | 6 | { |
shimniok | 0:a6a169de725f | 7 | float x; ///< x position in m |
shimniok | 0:a6a169de725f | 8 | float y; ///< y position in m |
shimniok | 0:a6a169de725f | 9 | float z; ///< z position in m |
shimniok | 0:a6a169de725f | 10 | uint8_t orientation_assignment; ///< Orientation assignment 0: false, 1:true |
shimniok | 0:a6a169de725f | 11 | uint16_t size; ///< Size in pixels |
shimniok | 0:a6a169de725f | 12 | uint16_t orientation; ///< Orientation |
shimniok | 0:a6a169de725f | 13 | uint8_t descriptor[32]; ///< Descriptor |
shimniok | 0:a6a169de725f | 14 | float response; ///< Harris operator response at this location |
shimniok | 0:a6a169de725f | 15 | |
shimniok | 0:a6a169de725f | 16 | } mavlink_brief_feature_t; |
shimniok | 0:a6a169de725f | 17 | |
shimniok | 0:a6a169de725f | 18 | #define MAVLINK_MSG_BRIEF_FEATURE_FIELD_DESCRIPTOR_LEN 32 |
shimniok | 0:a6a169de725f | 19 | |
shimniok | 0:a6a169de725f | 20 | |
shimniok | 0:a6a169de725f | 21 | /** |
shimniok | 0:a6a169de725f | 22 | * @brief Pack a brief_feature message |
shimniok | 0:a6a169de725f | 23 | * @param system_id ID of this system |
shimniok | 0:a6a169de725f | 24 | * @param component_id ID of this component (e.g. 200 for IMU) |
shimniok | 0:a6a169de725f | 25 | * @param msg The MAVLink message to compress the data into |
shimniok | 0:a6a169de725f | 26 | * |
shimniok | 0:a6a169de725f | 27 | * @param x x position in m |
shimniok | 0:a6a169de725f | 28 | * @param y y position in m |
shimniok | 0:a6a169de725f | 29 | * @param z z position in m |
shimniok | 0:a6a169de725f | 30 | * @param orientation_assignment Orientation assignment 0: false, 1:true |
shimniok | 0:a6a169de725f | 31 | * @param size Size in pixels |
shimniok | 0:a6a169de725f | 32 | * @param orientation Orientation |
shimniok | 0:a6a169de725f | 33 | * @param descriptor Descriptor |
shimniok | 0:a6a169de725f | 34 | * @param response Harris operator response at this location |
shimniok | 0:a6a169de725f | 35 | * @return length of the message in bytes (excluding serial stream start sign) |
shimniok | 0:a6a169de725f | 36 | */ |
shimniok | 0:a6a169de725f | 37 | static inline uint16_t mavlink_msg_brief_feature_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, float x, float y, float z, uint8_t orientation_assignment, uint16_t size, uint16_t orientation, const uint8_t* descriptor, float response) |
shimniok | 0:a6a169de725f | 38 | { |
shimniok | 0:a6a169de725f | 39 | uint16_t i = 0; |
shimniok | 0:a6a169de725f | 40 | msg->msgid = MAVLINK_MSG_ID_BRIEF_FEATURE; |
shimniok | 0:a6a169de725f | 41 | |
shimniok | 0:a6a169de725f | 42 | i += put_float_by_index(x, i, msg->payload); // x position in m |
shimniok | 0:a6a169de725f | 43 | i += put_float_by_index(y, i, msg->payload); // y position in m |
shimniok | 0:a6a169de725f | 44 | i += put_float_by_index(z, i, msg->payload); // z position in m |
shimniok | 0:a6a169de725f | 45 | i += put_uint8_t_by_index(orientation_assignment, i, msg->payload); // Orientation assignment 0: false, 1:true |
shimniok | 0:a6a169de725f | 46 | i += put_uint16_t_by_index(size, i, msg->payload); // Size in pixels |
shimniok | 0:a6a169de725f | 47 | i += put_uint16_t_by_index(orientation, i, msg->payload); // Orientation |
shimniok | 0:a6a169de725f | 48 | i += put_array_by_index((const int8_t*)descriptor, sizeof(uint8_t)*32, i, msg->payload); // Descriptor |
shimniok | 0:a6a169de725f | 49 | i += put_float_by_index(response, i, msg->payload); // Harris operator response at this location |
shimniok | 0:a6a169de725f | 50 | |
shimniok | 0:a6a169de725f | 51 | return mavlink_finalize_message(msg, system_id, component_id, i); |
shimniok | 0:a6a169de725f | 52 | } |
shimniok | 0:a6a169de725f | 53 | |
shimniok | 0:a6a169de725f | 54 | /** |
shimniok | 0:a6a169de725f | 55 | * @brief Pack a brief_feature message |
shimniok | 0:a6a169de725f | 56 | * @param system_id ID of this system |
shimniok | 0:a6a169de725f | 57 | * @param component_id ID of this component (e.g. 200 for IMU) |
shimniok | 0:a6a169de725f | 58 | * @param chan The MAVLink channel this message was sent over |
shimniok | 0:a6a169de725f | 59 | * @param msg The MAVLink message to compress the data into |
shimniok | 0:a6a169de725f | 60 | * @param x x position in m |
shimniok | 0:a6a169de725f | 61 | * @param y y position in m |
shimniok | 0:a6a169de725f | 62 | * @param z z position in m |
shimniok | 0:a6a169de725f | 63 | * @param orientation_assignment Orientation assignment 0: false, 1:true |
shimniok | 0:a6a169de725f | 64 | * @param size Size in pixels |
shimniok | 0:a6a169de725f | 65 | * @param orientation Orientation |
shimniok | 0:a6a169de725f | 66 | * @param descriptor Descriptor |
shimniok | 0:a6a169de725f | 67 | * @param response Harris operator response at this location |
shimniok | 0:a6a169de725f | 68 | * @return length of the message in bytes (excluding serial stream start sign) |
shimniok | 0:a6a169de725f | 69 | */ |
shimniok | 0:a6a169de725f | 70 | static inline uint16_t mavlink_msg_brief_feature_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, float x, float y, float z, uint8_t orientation_assignment, uint16_t size, uint16_t orientation, const uint8_t* descriptor, float response) |
shimniok | 0:a6a169de725f | 71 | { |
shimniok | 0:a6a169de725f | 72 | uint16_t i = 0; |
shimniok | 0:a6a169de725f | 73 | msg->msgid = MAVLINK_MSG_ID_BRIEF_FEATURE; |
shimniok | 0:a6a169de725f | 74 | |
shimniok | 0:a6a169de725f | 75 | i += put_float_by_index(x, i, msg->payload); // x position in m |
shimniok | 0:a6a169de725f | 76 | i += put_float_by_index(y, i, msg->payload); // y position in m |
shimniok | 0:a6a169de725f | 77 | i += put_float_by_index(z, i, msg->payload); // z position in m |
shimniok | 0:a6a169de725f | 78 | i += put_uint8_t_by_index(orientation_assignment, i, msg->payload); // Orientation assignment 0: false, 1:true |
shimniok | 0:a6a169de725f | 79 | i += put_uint16_t_by_index(size, i, msg->payload); // Size in pixels |
shimniok | 0:a6a169de725f | 80 | i += put_uint16_t_by_index(orientation, i, msg->payload); // Orientation |
shimniok | 0:a6a169de725f | 81 | i += put_array_by_index((const int8_t*)descriptor, sizeof(uint8_t)*32, i, msg->payload); // Descriptor |
shimniok | 0:a6a169de725f | 82 | i += put_float_by_index(response, i, msg->payload); // Harris operator response at this location |
shimniok | 0:a6a169de725f | 83 | |
shimniok | 0:a6a169de725f | 84 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i); |
shimniok | 0:a6a169de725f | 85 | } |
shimniok | 0:a6a169de725f | 86 | |
shimniok | 0:a6a169de725f | 87 | /** |
shimniok | 0:a6a169de725f | 88 | * @brief Encode a brief_feature struct into a message |
shimniok | 0:a6a169de725f | 89 | * |
shimniok | 0:a6a169de725f | 90 | * @param system_id ID of this system |
shimniok | 0:a6a169de725f | 91 | * @param component_id ID of this component (e.g. 200 for IMU) |
shimniok | 0:a6a169de725f | 92 | * @param msg The MAVLink message to compress the data into |
shimniok | 0:a6a169de725f | 93 | * @param brief_feature C-struct to read the message contents from |
shimniok | 0:a6a169de725f | 94 | */ |
shimniok | 0:a6a169de725f | 95 | static inline uint16_t mavlink_msg_brief_feature_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_brief_feature_t* brief_feature) |
shimniok | 0:a6a169de725f | 96 | { |
shimniok | 0:a6a169de725f | 97 | return mavlink_msg_brief_feature_pack(system_id, component_id, msg, brief_feature->x, brief_feature->y, brief_feature->z, brief_feature->orientation_assignment, brief_feature->size, brief_feature->orientation, brief_feature->descriptor, brief_feature->response); |
shimniok | 0:a6a169de725f | 98 | } |
shimniok | 0:a6a169de725f | 99 | |
shimniok | 0:a6a169de725f | 100 | /** |
shimniok | 0:a6a169de725f | 101 | * @brief Send a brief_feature message |
shimniok | 0:a6a169de725f | 102 | * @param chan MAVLink channel to send the message |
shimniok | 0:a6a169de725f | 103 | * |
shimniok | 0:a6a169de725f | 104 | * @param x x position in m |
shimniok | 0:a6a169de725f | 105 | * @param y y position in m |
shimniok | 0:a6a169de725f | 106 | * @param z z position in m |
shimniok | 0:a6a169de725f | 107 | * @param orientation_assignment Orientation assignment 0: false, 1:true |
shimniok | 0:a6a169de725f | 108 | * @param size Size in pixels |
shimniok | 0:a6a169de725f | 109 | * @param orientation Orientation |
shimniok | 0:a6a169de725f | 110 | * @param descriptor Descriptor |
shimniok | 0:a6a169de725f | 111 | * @param response Harris operator response at this location |
shimniok | 0:a6a169de725f | 112 | */ |
shimniok | 0:a6a169de725f | 113 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS |
shimniok | 0:a6a169de725f | 114 | |
shimniok | 0:a6a169de725f | 115 | static inline void mavlink_msg_brief_feature_send(mavlink_channel_t chan, float x, float y, float z, uint8_t orientation_assignment, uint16_t size, uint16_t orientation, const uint8_t* descriptor, float response) |
shimniok | 0:a6a169de725f | 116 | { |
shimniok | 0:a6a169de725f | 117 | mavlink_message_t msg; |
shimniok | 0:a6a169de725f | 118 | mavlink_msg_brief_feature_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, x, y, z, orientation_assignment, size, orientation, descriptor, response); |
shimniok | 0:a6a169de725f | 119 | mavlink_send_uart(chan, &msg); |
shimniok | 0:a6a169de725f | 120 | } |
shimniok | 0:a6a169de725f | 121 | |
shimniok | 0:a6a169de725f | 122 | #endif |
shimniok | 0:a6a169de725f | 123 | // MESSAGE BRIEF_FEATURE UNPACKING |
shimniok | 0:a6a169de725f | 124 | |
shimniok | 0:a6a169de725f | 125 | /** |
shimniok | 0:a6a169de725f | 126 | * @brief Get field x from brief_feature message |
shimniok | 0:a6a169de725f | 127 | * |
shimniok | 0:a6a169de725f | 128 | * @return x position in m |
shimniok | 0:a6a169de725f | 129 | */ |
shimniok | 0:a6a169de725f | 130 | static inline float mavlink_msg_brief_feature_get_x(const mavlink_message_t* msg) |
shimniok | 0:a6a169de725f | 131 | { |
shimniok | 0:a6a169de725f | 132 | generic_32bit r; |
shimniok | 0:a6a169de725f | 133 | r.b[3] = (msg->payload)[0]; |
shimniok | 0:a6a169de725f | 134 | r.b[2] = (msg->payload)[1]; |
shimniok | 0:a6a169de725f | 135 | r.b[1] = (msg->payload)[2]; |
shimniok | 0:a6a169de725f | 136 | r.b[0] = (msg->payload)[3]; |
shimniok | 0:a6a169de725f | 137 | return (float)r.f; |
shimniok | 0:a6a169de725f | 138 | } |
shimniok | 0:a6a169de725f | 139 | |
shimniok | 0:a6a169de725f | 140 | /** |
shimniok | 0:a6a169de725f | 141 | * @brief Get field y from brief_feature message |
shimniok | 0:a6a169de725f | 142 | * |
shimniok | 0:a6a169de725f | 143 | * @return y position in m |
shimniok | 0:a6a169de725f | 144 | */ |
shimniok | 0:a6a169de725f | 145 | static inline float mavlink_msg_brief_feature_get_y(const mavlink_message_t* msg) |
shimniok | 0:a6a169de725f | 146 | { |
shimniok | 0:a6a169de725f | 147 | generic_32bit r; |
shimniok | 0:a6a169de725f | 148 | r.b[3] = (msg->payload+sizeof(float))[0]; |
shimniok | 0:a6a169de725f | 149 | r.b[2] = (msg->payload+sizeof(float))[1]; |
shimniok | 0:a6a169de725f | 150 | r.b[1] = (msg->payload+sizeof(float))[2]; |
shimniok | 0:a6a169de725f | 151 | r.b[0] = (msg->payload+sizeof(float))[3]; |
shimniok | 0:a6a169de725f | 152 | return (float)r.f; |
shimniok | 0:a6a169de725f | 153 | } |
shimniok | 0:a6a169de725f | 154 | |
shimniok | 0:a6a169de725f | 155 | /** |
shimniok | 0:a6a169de725f | 156 | * @brief Get field z from brief_feature message |
shimniok | 0:a6a169de725f | 157 | * |
shimniok | 0:a6a169de725f | 158 | * @return z position in m |
shimniok | 0:a6a169de725f | 159 | */ |
shimniok | 0:a6a169de725f | 160 | static inline float mavlink_msg_brief_feature_get_z(const mavlink_message_t* msg) |
shimniok | 0:a6a169de725f | 161 | { |
shimniok | 0:a6a169de725f | 162 | generic_32bit r; |
shimniok | 0:a6a169de725f | 163 | r.b[3] = (msg->payload+sizeof(float)+sizeof(float))[0]; |
shimniok | 0:a6a169de725f | 164 | r.b[2] = (msg->payload+sizeof(float)+sizeof(float))[1]; |
shimniok | 0:a6a169de725f | 165 | r.b[1] = (msg->payload+sizeof(float)+sizeof(float))[2]; |
shimniok | 0:a6a169de725f | 166 | r.b[0] = (msg->payload+sizeof(float)+sizeof(float))[3]; |
shimniok | 0:a6a169de725f | 167 | return (float)r.f; |
shimniok | 0:a6a169de725f | 168 | } |
shimniok | 0:a6a169de725f | 169 | |
shimniok | 0:a6a169de725f | 170 | /** |
shimniok | 0:a6a169de725f | 171 | * @brief Get field orientation_assignment from brief_feature message |
shimniok | 0:a6a169de725f | 172 | * |
shimniok | 0:a6a169de725f | 173 | * @return Orientation assignment 0: false, 1:true |
shimniok | 0:a6a169de725f | 174 | */ |
shimniok | 0:a6a169de725f | 175 | static inline uint8_t mavlink_msg_brief_feature_get_orientation_assignment(const mavlink_message_t* msg) |
shimniok | 0:a6a169de725f | 176 | { |
shimniok | 0:a6a169de725f | 177 | return (uint8_t)(msg->payload+sizeof(float)+sizeof(float)+sizeof(float))[0]; |
shimniok | 0:a6a169de725f | 178 | } |
shimniok | 0:a6a169de725f | 179 | |
shimniok | 0:a6a169de725f | 180 | /** |
shimniok | 0:a6a169de725f | 181 | * @brief Get field size from brief_feature message |
shimniok | 0:a6a169de725f | 182 | * |
shimniok | 0:a6a169de725f | 183 | * @return Size in pixels |
shimniok | 0:a6a169de725f | 184 | */ |
shimniok | 0:a6a169de725f | 185 | static inline uint16_t mavlink_msg_brief_feature_get_size(const mavlink_message_t* msg) |
shimniok | 0:a6a169de725f | 186 | { |
shimniok | 0:a6a169de725f | 187 | generic_16bit r; |
shimniok | 0:a6a169de725f | 188 | r.b[1] = (msg->payload+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(uint8_t))[0]; |
shimniok | 0:a6a169de725f | 189 | r.b[0] = (msg->payload+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(uint8_t))[1]; |
shimniok | 0:a6a169de725f | 190 | return (uint16_t)r.s; |
shimniok | 0:a6a169de725f | 191 | } |
shimniok | 0:a6a169de725f | 192 | |
shimniok | 0:a6a169de725f | 193 | /** |
shimniok | 0:a6a169de725f | 194 | * @brief Get field orientation from brief_feature message |
shimniok | 0:a6a169de725f | 195 | * |
shimniok | 0:a6a169de725f | 196 | * @return Orientation |
shimniok | 0:a6a169de725f | 197 | */ |
shimniok | 0:a6a169de725f | 198 | static inline uint16_t mavlink_msg_brief_feature_get_orientation(const mavlink_message_t* msg) |
shimniok | 0:a6a169de725f | 199 | { |
shimniok | 0:a6a169de725f | 200 | generic_16bit r; |
shimniok | 0:a6a169de725f | 201 | r.b[1] = (msg->payload+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(uint8_t)+sizeof(uint16_t))[0]; |
shimniok | 0:a6a169de725f | 202 | r.b[0] = (msg->payload+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(uint8_t)+sizeof(uint16_t))[1]; |
shimniok | 0:a6a169de725f | 203 | return (uint16_t)r.s; |
shimniok | 0:a6a169de725f | 204 | } |
shimniok | 0:a6a169de725f | 205 | |
shimniok | 0:a6a169de725f | 206 | /** |
shimniok | 0:a6a169de725f | 207 | * @brief Get field descriptor from brief_feature message |
shimniok | 0:a6a169de725f | 208 | * |
shimniok | 0:a6a169de725f | 209 | * @return Descriptor |
shimniok | 0:a6a169de725f | 210 | */ |
shimniok | 0:a6a169de725f | 211 | static inline uint16_t mavlink_msg_brief_feature_get_descriptor(const mavlink_message_t* msg, uint8_t* r_data) |
shimniok | 0:a6a169de725f | 212 | { |
shimniok | 0:a6a169de725f | 213 | |
shimniok | 0:a6a169de725f | 214 | memcpy(r_data, msg->payload+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint16_t), sizeof(uint8_t)*32); |
shimniok | 0:a6a169de725f | 215 | return sizeof(uint8_t)*32; |
shimniok | 0:a6a169de725f | 216 | } |
shimniok | 0:a6a169de725f | 217 | |
shimniok | 0:a6a169de725f | 218 | /** |
shimniok | 0:a6a169de725f | 219 | * @brief Get field response from brief_feature message |
shimniok | 0:a6a169de725f | 220 | * |
shimniok | 0:a6a169de725f | 221 | * @return Harris operator response at this location |
shimniok | 0:a6a169de725f | 222 | */ |
shimniok | 0:a6a169de725f | 223 | static inline float mavlink_msg_brief_feature_get_response(const mavlink_message_t* msg) |
shimniok | 0:a6a169de725f | 224 | { |
shimniok | 0:a6a169de725f | 225 | generic_32bit r; |
shimniok | 0:a6a169de725f | 226 | r.b[3] = (msg->payload+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint16_t)+sizeof(uint8_t)*32)[0]; |
shimniok | 0:a6a169de725f | 227 | r.b[2] = (msg->payload+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint16_t)+sizeof(uint8_t)*32)[1]; |
shimniok | 0:a6a169de725f | 228 | r.b[1] = (msg->payload+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint16_t)+sizeof(uint8_t)*32)[2]; |
shimniok | 0:a6a169de725f | 229 | r.b[0] = (msg->payload+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint16_t)+sizeof(uint8_t)*32)[3]; |
shimniok | 0:a6a169de725f | 230 | return (float)r.f; |
shimniok | 0:a6a169de725f | 231 | } |
shimniok | 0:a6a169de725f | 232 | |
shimniok | 0:a6a169de725f | 233 | /** |
shimniok | 0:a6a169de725f | 234 | * @brief Decode a brief_feature message into a struct |
shimniok | 0:a6a169de725f | 235 | * |
shimniok | 0:a6a169de725f | 236 | * @param msg The message to decode |
shimniok | 0:a6a169de725f | 237 | * @param brief_feature C-struct to decode the message contents into |
shimniok | 0:a6a169de725f | 238 | */ |
shimniok | 0:a6a169de725f | 239 | static inline void mavlink_msg_brief_feature_decode(const mavlink_message_t* msg, mavlink_brief_feature_t* brief_feature) |
shimniok | 0:a6a169de725f | 240 | { |
shimniok | 0:a6a169de725f | 241 | brief_feature->x = mavlink_msg_brief_feature_get_x(msg); |
shimniok | 0:a6a169de725f | 242 | brief_feature->y = mavlink_msg_brief_feature_get_y(msg); |
shimniok | 0:a6a169de725f | 243 | brief_feature->z = mavlink_msg_brief_feature_get_z(msg); |
shimniok | 0:a6a169de725f | 244 | brief_feature->orientation_assignment = mavlink_msg_brief_feature_get_orientation_assignment(msg); |
shimniok | 0:a6a169de725f | 245 | brief_feature->size = mavlink_msg_brief_feature_get_size(msg); |
shimniok | 0:a6a169de725f | 246 | brief_feature->orientation = mavlink_msg_brief_feature_get_orientation(msg); |
shimniok | 0:a6a169de725f | 247 | mavlink_msg_brief_feature_get_descriptor(msg, brief_feature->descriptor); |
shimniok | 0:a6a169de725f | 248 | brief_feature->response = mavlink_msg_brief_feature_get_response(msg); |
shimniok | 0:a6a169de725f | 249 | } |