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_allowed_area.h
00001 // MESSAGE SAFETY_ALLOWED_AREA PACKING 00002 00003 #define MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA 54 00004 00005 typedef struct __mavlink_safety_allowed_area_t 00006 { 00007 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. 00008 float p1x; ///< x position 1 / Latitude 1 00009 float p1y; ///< y position 1 / Longitude 1 00010 float p1z; ///< z position 1 / Altitude 1 00011 float p2x; ///< x position 2 / Latitude 2 00012 float p2y; ///< y position 2 / Longitude 2 00013 float p2z; ///< z position 2 / Altitude 2 00014 00015 } mavlink_safety_allowed_area_t; 00016 00017 00018 00019 /** 00020 * @brief Pack a safety_allowed_area message 00021 * @param system_id ID of this system 00022 * @param component_id ID of this component (e.g. 200 for IMU) 00023 * @param msg The MAVLink message to compress the data into 00024 * 00025 * @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. 00026 * @param p1x x position 1 / Latitude 1 00027 * @param p1y y position 1 / Longitude 1 00028 * @param p1z z position 1 / Altitude 1 00029 * @param p2x x position 2 / Latitude 2 00030 * @param p2y y position 2 / Longitude 2 00031 * @param p2z z position 2 / Altitude 2 00032 * @return length of the message in bytes (excluding serial stream start sign) 00033 */ 00034 static inline uint16_t mavlink_msg_safety_allowed_area_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t frame, float p1x, float p1y, float p1z, float p2x, float p2y, float p2z) 00035 { 00036 uint16_t i = 0; 00037 msg->msgid = MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA; 00038 00039 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. 00040 i += put_float_by_index(p1x, i, msg->payload); // x position 1 / Latitude 1 00041 i += put_float_by_index(p1y, i, msg->payload); // y position 1 / Longitude 1 00042 i += put_float_by_index(p1z, i, msg->payload); // z position 1 / Altitude 1 00043 i += put_float_by_index(p2x, i, msg->payload); // x position 2 / Latitude 2 00044 i += put_float_by_index(p2y, i, msg->payload); // y position 2 / Longitude 2 00045 i += put_float_by_index(p2z, i, msg->payload); // z position 2 / Altitude 2 00046 00047 return mavlink_finalize_message(msg, system_id, component_id, i); 00048 } 00049 00050 /** 00051 * @brief Pack a safety_allowed_area message 00052 * @param system_id ID of this system 00053 * @param component_id ID of this component (e.g. 200 for IMU) 00054 * @param chan The MAVLink channel this message was sent over 00055 * @param msg The MAVLink message to compress the data into 00056 * @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. 00057 * @param p1x x position 1 / Latitude 1 00058 * @param p1y y position 1 / Longitude 1 00059 * @param p1z z position 1 / Altitude 1 00060 * @param p2x x position 2 / Latitude 2 00061 * @param p2y y position 2 / Longitude 2 00062 * @param p2z z position 2 / Altitude 2 00063 * @return length of the message in bytes (excluding serial stream start sign) 00064 */ 00065 static inline uint16_t mavlink_msg_safety_allowed_area_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint8_t frame, float p1x, float p1y, float p1z, float p2x, float p2y, float p2z) 00066 { 00067 uint16_t i = 0; 00068 msg->msgid = MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA; 00069 00070 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. 00071 i += put_float_by_index(p1x, i, msg->payload); // x position 1 / Latitude 1 00072 i += put_float_by_index(p1y, i, msg->payload); // y position 1 / Longitude 1 00073 i += put_float_by_index(p1z, i, msg->payload); // z position 1 / Altitude 1 00074 i += put_float_by_index(p2x, i, msg->payload); // x position 2 / Latitude 2 00075 i += put_float_by_index(p2y, i, msg->payload); // y position 2 / Longitude 2 00076 i += put_float_by_index(p2z, i, msg->payload); // z position 2 / Altitude 2 00077 00078 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i); 00079 } 00080 00081 /** 00082 * @brief Encode a safety_allowed_area struct into a message 00083 * 00084 * @param system_id ID of this system 00085 * @param component_id ID of this component (e.g. 200 for IMU) 00086 * @param msg The MAVLink message to compress the data into 00087 * @param safety_allowed_area C-struct to read the message contents from 00088 */ 00089 static inline uint16_t mavlink_msg_safety_allowed_area_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_safety_allowed_area_t* safety_allowed_area) 00090 { 00091 return mavlink_msg_safety_allowed_area_pack(system_id, component_id, msg, safety_allowed_area->frame, safety_allowed_area->p1x, safety_allowed_area->p1y, safety_allowed_area->p1z, safety_allowed_area->p2x, safety_allowed_area->p2y, safety_allowed_area->p2z); 00092 } 00093 00094 /** 00095 * @brief Send a safety_allowed_area message 00096 * @param chan MAVLink channel to send the message 00097 * 00098 * @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. 00099 * @param p1x x position 1 / Latitude 1 00100 * @param p1y y position 1 / Longitude 1 00101 * @param p1z z position 1 / Altitude 1 00102 * @param p2x x position 2 / Latitude 2 00103 * @param p2y y position 2 / Longitude 2 00104 * @param p2z z position 2 / Altitude 2 00105 */ 00106 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS 00107 00108 static inline void mavlink_msg_safety_allowed_area_send(mavlink_channel_t chan, uint8_t frame, float p1x, float p1y, float p1z, float p2x, float p2y, float p2z) 00109 { 00110 mavlink_message_t msg; 00111 mavlink_msg_safety_allowed_area_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, frame, p1x, p1y, p1z, p2x, p2y, p2z); 00112 mavlink_send_uart(chan, &msg); 00113 } 00114 00115 #endif 00116 // MESSAGE SAFETY_ALLOWED_AREA UNPACKING 00117 00118 /** 00119 * @brief Get field frame from safety_allowed_area message 00120 * 00121 * @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. 00122 */ 00123 static inline uint8_t mavlink_msg_safety_allowed_area_get_frame(const mavlink_message_t* msg) 00124 { 00125 return (uint8_t)(msg->payload)[0]; 00126 } 00127 00128 /** 00129 * @brief Get field p1x from safety_allowed_area message 00130 * 00131 * @return x position 1 / Latitude 1 00132 */ 00133 static inline float mavlink_msg_safety_allowed_area_get_p1x(const mavlink_message_t* msg) 00134 { 00135 generic_32bit r; 00136 r.b[3] = (msg->payload+sizeof(uint8_t))[0]; 00137 r.b[2] = (msg->payload+sizeof(uint8_t))[1]; 00138 r.b[1] = (msg->payload+sizeof(uint8_t))[2]; 00139 r.b[0] = (msg->payload+sizeof(uint8_t))[3]; 00140 return (float)r.f; 00141 } 00142 00143 /** 00144 * @brief Get field p1y from safety_allowed_area message 00145 * 00146 * @return y position 1 / Longitude 1 00147 */ 00148 static inline float mavlink_msg_safety_allowed_area_get_p1y(const mavlink_message_t* msg) 00149 { 00150 generic_32bit r; 00151 r.b[3] = (msg->payload+sizeof(uint8_t)+sizeof(float))[0]; 00152 r.b[2] = (msg->payload+sizeof(uint8_t)+sizeof(float))[1]; 00153 r.b[1] = (msg->payload+sizeof(uint8_t)+sizeof(float))[2]; 00154 r.b[0] = (msg->payload+sizeof(uint8_t)+sizeof(float))[3]; 00155 return (float)r.f; 00156 } 00157 00158 /** 00159 * @brief Get field p1z from safety_allowed_area message 00160 * 00161 * @return z position 1 / Altitude 1 00162 */ 00163 static inline float mavlink_msg_safety_allowed_area_get_p1z(const mavlink_message_t* msg) 00164 { 00165 generic_32bit r; 00166 r.b[3] = (msg->payload+sizeof(uint8_t)+sizeof(float)+sizeof(float))[0]; 00167 r.b[2] = (msg->payload+sizeof(uint8_t)+sizeof(float)+sizeof(float))[1]; 00168 r.b[1] = (msg->payload+sizeof(uint8_t)+sizeof(float)+sizeof(float))[2]; 00169 r.b[0] = (msg->payload+sizeof(uint8_t)+sizeof(float)+sizeof(float))[3]; 00170 return (float)r.f; 00171 } 00172 00173 /** 00174 * @brief Get field p2x from safety_allowed_area message 00175 * 00176 * @return x position 2 / Latitude 2 00177 */ 00178 static inline float mavlink_msg_safety_allowed_area_get_p2x(const mavlink_message_t* msg) 00179 { 00180 generic_32bit r; 00181 r.b[3] = (msg->payload+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float))[0]; 00182 r.b[2] = (msg->payload+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float))[1]; 00183 r.b[1] = (msg->payload+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float))[2]; 00184 r.b[0] = (msg->payload+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float))[3]; 00185 return (float)r.f; 00186 } 00187 00188 /** 00189 * @brief Get field p2y from safety_allowed_area message 00190 * 00191 * @return y position 2 / Longitude 2 00192 */ 00193 static inline float mavlink_msg_safety_allowed_area_get_p2y(const mavlink_message_t* msg) 00194 { 00195 generic_32bit r; 00196 r.b[3] = (msg->payload+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[0]; 00197 r.b[2] = (msg->payload+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[1]; 00198 r.b[1] = (msg->payload+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[2]; 00199 r.b[0] = (msg->payload+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[3]; 00200 return (float)r.f; 00201 } 00202 00203 /** 00204 * @brief Get field p2z from safety_allowed_area message 00205 * 00206 * @return z position 2 / Altitude 2 00207 */ 00208 static inline float mavlink_msg_safety_allowed_area_get_p2z(const mavlink_message_t* msg) 00209 { 00210 generic_32bit r; 00211 r.b[3] = (msg->payload+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[0]; 00212 r.b[2] = (msg->payload+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[1]; 00213 r.b[1] = (msg->payload+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[2]; 00214 r.b[0] = (msg->payload+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[3]; 00215 return (float)r.f; 00216 } 00217 00218 /** 00219 * @brief Decode a safety_allowed_area message into a struct 00220 * 00221 * @param msg The message to decode 00222 * @param safety_allowed_area C-struct to decode the message contents into 00223 */ 00224 static inline void mavlink_msg_safety_allowed_area_decode(const mavlink_message_t* msg, mavlink_safety_allowed_area_t* safety_allowed_area) 00225 { 00226 safety_allowed_area->frame = mavlink_msg_safety_allowed_area_get_frame(msg); 00227 safety_allowed_area->p1x = mavlink_msg_safety_allowed_area_get_p1x(msg); 00228 safety_allowed_area->p1y = mavlink_msg_safety_allowed_area_get_p1y(msg); 00229 safety_allowed_area->p1z = mavlink_msg_safety_allowed_area_get_p1z(msg); 00230 safety_allowed_area->p2x = mavlink_msg_safety_allowed_area_get_p2x(msg); 00231 safety_allowed_area->p2y = mavlink_msg_safety_allowed_area_get_p2y(msg); 00232 safety_allowed_area->p2z = mavlink_msg_safety_allowed_area_get_p2z(msg); 00233 }
Generated on Tue Jul 12 2022 14:09:26 by 1.7.2