Code for autonomous ground vehicle, Data Bus, 3rd place winner in 2012 Sparkfun AVC.
Dependencies: Watchdog mbed Schedule SimpleFilter LSM303DLM PinDetect DebounceIn Servo
mavlink_msg_safety_set_allowed_area.h
00001 // MESSAGE SAFETY_SET_ALLOWED_AREA PACKING 00002 00003 #define MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA 53 00004 00005 typedef struct __mavlink_safety_set_allowed_area_t 00006 { 00007 uint8_t target_system; ///< System ID 00008 uint8_t target_component; ///< Component ID 00009 uint8_t frame; ///< Coordinate frame, as defined by MAV_FRAME enum in mavlink_types.h. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down. 00010 float p1x; ///< x position 1 / Latitude 1 00011 float p1y; ///< y position 1 / Longitude 1 00012 float p1z; ///< z position 1 / Altitude 1 00013 float p2x; ///< x position 2 / Latitude 2 00014 float p2y; ///< y position 2 / Longitude 2 00015 float p2z; ///< z position 2 / Altitude 2 00016 00017 } mavlink_safety_set_allowed_area_t; 00018 00019 00020 00021 /** 00022 * @brief Pack a safety_set_allowed_area message 00023 * @param system_id ID of this system 00024 * @param component_id ID of this component (e.g. 200 for IMU) 00025 * @param msg The MAVLink message to compress the data into 00026 * 00027 * @param target_system System ID 00028 * @param target_component Component ID 00029 * @param frame Coordinate frame, as defined by MAV_FRAME enum in mavlink_types.h. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down. 00030 * @param p1x x position 1 / Latitude 1 00031 * @param p1y y position 1 / Longitude 1 00032 * @param p1z z position 1 / Altitude 1 00033 * @param p2x x position 2 / Latitude 2 00034 * @param p2y y position 2 / Longitude 2 00035 * @param p2z z position 2 / Altitude 2 00036 * @return length of the message in bytes (excluding serial stream start sign) 00037 */ 00038 static inline uint16_t mavlink_msg_safety_set_allowed_area_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t target_system, uint8_t target_component, uint8_t frame, float p1x, float p1y, float p1z, float p2x, float p2y, float p2z) 00039 { 00040 uint16_t i = 0; 00041 msg->msgid = MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA; 00042 00043 i += put_uint8_t_by_index(target_system, i, msg->payload); // System ID 00044 i += put_uint8_t_by_index(target_component, i, msg->payload); // Component ID 00045 i += put_uint8_t_by_index(frame, i, msg->payload); // Coordinate frame, as defined by MAV_FRAME enum in mavlink_types.h. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down. 00046 i += put_float_by_index(p1x, i, msg->payload); // x position 1 / Latitude 1 00047 i += put_float_by_index(p1y, i, msg->payload); // y position 1 / Longitude 1 00048 i += put_float_by_index(p1z, i, msg->payload); // z position 1 / Altitude 1 00049 i += put_float_by_index(p2x, i, msg->payload); // x position 2 / Latitude 2 00050 i += put_float_by_index(p2y, i, msg->payload); // y position 2 / Longitude 2 00051 i += put_float_by_index(p2z, i, msg->payload); // z position 2 / Altitude 2 00052 00053 return mavlink_finalize_message(msg, system_id, component_id, i); 00054 } 00055 00056 /** 00057 * @brief Pack a safety_set_allowed_area message 00058 * @param system_id ID of this system 00059 * @param component_id ID of this component (e.g. 200 for IMU) 00060 * @param chan The MAVLink channel this message was sent over 00061 * @param msg The MAVLink message to compress the data into 00062 * @param target_system System ID 00063 * @param target_component Component ID 00064 * @param frame Coordinate frame, as defined by MAV_FRAME enum in mavlink_types.h. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down. 00065 * @param p1x x position 1 / Latitude 1 00066 * @param p1y y position 1 / Longitude 1 00067 * @param p1z z position 1 / Altitude 1 00068 * @param p2x x position 2 / Latitude 2 00069 * @param p2y y position 2 / Longitude 2 00070 * @param p2z z position 2 / Altitude 2 00071 * @return length of the message in bytes (excluding serial stream start sign) 00072 */ 00073 static inline uint16_t mavlink_msg_safety_set_allowed_area_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint8_t target_system, uint8_t target_component, uint8_t frame, float p1x, float p1y, float p1z, float p2x, float p2y, float p2z) 00074 { 00075 uint16_t i = 0; 00076 msg->msgid = MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA; 00077 00078 i += put_uint8_t_by_index(target_system, i, msg->payload); // System ID 00079 i += put_uint8_t_by_index(target_component, i, msg->payload); // Component ID 00080 i += put_uint8_t_by_index(frame, i, msg->payload); // Coordinate frame, as defined by MAV_FRAME enum in mavlink_types.h. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down. 00081 i += put_float_by_index(p1x, i, msg->payload); // x position 1 / Latitude 1 00082 i += put_float_by_index(p1y, i, msg->payload); // y position 1 / Longitude 1 00083 i += put_float_by_index(p1z, i, msg->payload); // z position 1 / Altitude 1 00084 i += put_float_by_index(p2x, i, msg->payload); // x position 2 / Latitude 2 00085 i += put_float_by_index(p2y, i, msg->payload); // y position 2 / Longitude 2 00086 i += put_float_by_index(p2z, i, msg->payload); // z position 2 / Altitude 2 00087 00088 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i); 00089 } 00090 00091 /** 00092 * @brief Encode a safety_set_allowed_area struct into a message 00093 * 00094 * @param system_id ID of this system 00095 * @param component_id ID of this component (e.g. 200 for IMU) 00096 * @param msg The MAVLink message to compress the data into 00097 * @param safety_set_allowed_area C-struct to read the message contents from 00098 */ 00099 static inline uint16_t mavlink_msg_safety_set_allowed_area_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_safety_set_allowed_area_t* safety_set_allowed_area) 00100 { 00101 return mavlink_msg_safety_set_allowed_area_pack(system_id, component_id, msg, safety_set_allowed_area->target_system, safety_set_allowed_area->target_component, safety_set_allowed_area->frame, safety_set_allowed_area->p1x, safety_set_allowed_area->p1y, safety_set_allowed_area->p1z, safety_set_allowed_area->p2x, safety_set_allowed_area->p2y, safety_set_allowed_area->p2z); 00102 } 00103 00104 /** 00105 * @brief Send a safety_set_allowed_area message 00106 * @param chan MAVLink channel to send the message 00107 * 00108 * @param target_system System ID 00109 * @param target_component Component ID 00110 * @param frame Coordinate frame, as defined by MAV_FRAME enum in mavlink_types.h. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down. 00111 * @param p1x x position 1 / Latitude 1 00112 * @param p1y y position 1 / Longitude 1 00113 * @param p1z z position 1 / Altitude 1 00114 * @param p2x x position 2 / Latitude 2 00115 * @param p2y y position 2 / Longitude 2 00116 * @param p2z z position 2 / Altitude 2 00117 */ 00118 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS 00119 00120 static inline void mavlink_msg_safety_set_allowed_area_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t frame, float p1x, float p1y, float p1z, float p2x, float p2y, float p2z) 00121 { 00122 mavlink_message_t msg; 00123 mavlink_msg_safety_set_allowed_area_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, target_system, target_component, frame, p1x, p1y, p1z, p2x, p2y, p2z); 00124 mavlink_send_uart(chan, &msg); 00125 } 00126 00127 #endif 00128 // MESSAGE SAFETY_SET_ALLOWED_AREA UNPACKING 00129 00130 /** 00131 * @brief Get field target_system from safety_set_allowed_area message 00132 * 00133 * @return System ID 00134 */ 00135 static inline uint8_t mavlink_msg_safety_set_allowed_area_get_target_system(const mavlink_message_t* msg) 00136 { 00137 return (uint8_t)(msg->payload)[0]; 00138 } 00139 00140 /** 00141 * @brief Get field target_component from safety_set_allowed_area message 00142 * 00143 * @return Component ID 00144 */ 00145 static inline uint8_t mavlink_msg_safety_set_allowed_area_get_target_component(const mavlink_message_t* msg) 00146 { 00147 return (uint8_t)(msg->payload+sizeof(uint8_t))[0]; 00148 } 00149 00150 /** 00151 * @brief Get field frame from safety_set_allowed_area message 00152 * 00153 * @return Coordinate frame, as defined by MAV_FRAME enum in mavlink_types.h. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down. 00154 */ 00155 static inline uint8_t mavlink_msg_safety_set_allowed_area_get_frame(const mavlink_message_t* msg) 00156 { 00157 return (uint8_t)(msg->payload+sizeof(uint8_t)+sizeof(uint8_t))[0]; 00158 } 00159 00160 /** 00161 * @brief Get field p1x from safety_set_allowed_area message 00162 * 00163 * @return x position 1 / Latitude 1 00164 */ 00165 static inline float mavlink_msg_safety_set_allowed_area_get_p1x(const mavlink_message_t* msg) 00166 { 00167 generic_32bit r; 00168 r.b[3] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t))[0]; 00169 r.b[2] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t))[1]; 00170 r.b[1] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t))[2]; 00171 r.b[0] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t))[3]; 00172 return (float)r.f; 00173 } 00174 00175 /** 00176 * @brief Get field p1y from safety_set_allowed_area message 00177 * 00178 * @return y position 1 / Longitude 1 00179 */ 00180 static inline float mavlink_msg_safety_set_allowed_area_get_p1y(const mavlink_message_t* msg) 00181 { 00182 generic_32bit r; 00183 r.b[3] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float))[0]; 00184 r.b[2] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float))[1]; 00185 r.b[1] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float))[2]; 00186 r.b[0] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float))[3]; 00187 return (float)r.f; 00188 } 00189 00190 /** 00191 * @brief Get field p1z from safety_set_allowed_area message 00192 * 00193 * @return z position 1 / Altitude 1 00194 */ 00195 static inline float mavlink_msg_safety_set_allowed_area_get_p1z(const mavlink_message_t* msg) 00196 { 00197 generic_32bit r; 00198 r.b[3] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float))[0]; 00199 r.b[2] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float))[1]; 00200 r.b[1] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float))[2]; 00201 r.b[0] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float))[3]; 00202 return (float)r.f; 00203 } 00204 00205 /** 00206 * @brief Get field p2x from safety_set_allowed_area message 00207 * 00208 * @return x position 2 / Latitude 2 00209 */ 00210 static inline float mavlink_msg_safety_set_allowed_area_get_p2x(const mavlink_message_t* msg) 00211 { 00212 generic_32bit r; 00213 r.b[3] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float))[0]; 00214 r.b[2] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float))[1]; 00215 r.b[1] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float))[2]; 00216 r.b[0] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float))[3]; 00217 return (float)r.f; 00218 } 00219 00220 /** 00221 * @brief Get field p2y from safety_set_allowed_area message 00222 * 00223 * @return y position 2 / Longitude 2 00224 */ 00225 static inline float mavlink_msg_safety_set_allowed_area_get_p2y(const mavlink_message_t* msg) 00226 { 00227 generic_32bit r; 00228 r.b[3] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[0]; 00229 r.b[2] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[1]; 00230 r.b[1] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[2]; 00231 r.b[0] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[3]; 00232 return (float)r.f; 00233 } 00234 00235 /** 00236 * @brief Get field p2z from safety_set_allowed_area message 00237 * 00238 * @return z position 2 / Altitude 2 00239 */ 00240 static inline float mavlink_msg_safety_set_allowed_area_get_p2z(const mavlink_message_t* msg) 00241 { 00242 generic_32bit r; 00243 r.b[3] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[0]; 00244 r.b[2] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[1]; 00245 r.b[1] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[2]; 00246 r.b[0] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[3]; 00247 return (float)r.f; 00248 } 00249 00250 /** 00251 * @brief Decode a safety_set_allowed_area message into a struct 00252 * 00253 * @param msg The message to decode 00254 * @param safety_set_allowed_area C-struct to decode the message contents into 00255 */ 00256 static inline void mavlink_msg_safety_set_allowed_area_decode(const mavlink_message_t* msg, mavlink_safety_set_allowed_area_t* safety_set_allowed_area) 00257 { 00258 safety_set_allowed_area->target_system = mavlink_msg_safety_set_allowed_area_get_target_system(msg); 00259 safety_set_allowed_area->target_component = mavlink_msg_safety_set_allowed_area_get_target_component(msg); 00260 safety_set_allowed_area->frame = mavlink_msg_safety_set_allowed_area_get_frame(msg); 00261 safety_set_allowed_area->p1x = mavlink_msg_safety_set_allowed_area_get_p1x(msg); 00262 safety_set_allowed_area->p1y = mavlink_msg_safety_set_allowed_area_get_p1y(msg); 00263 safety_set_allowed_area->p1z = mavlink_msg_safety_set_allowed_area_get_p1z(msg); 00264 safety_set_allowed_area->p2x = mavlink_msg_safety_set_allowed_area_get_p2x(msg); 00265 safety_set_allowed_area->p2y = mavlink_msg_safety_set_allowed_area_get_p2y(msg); 00266 safety_set_allowed_area->p2z = mavlink_msg_safety_set_allowed_area_get_p2z(msg); 00267 }
Generated on Tue Jul 12 2022 14:09:26 by 1.7.2