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_nav_filter_bias.h
00001 // MESSAGE NAV_FILTER_BIAS PACKING 00002 00003 #define MAVLINK_MSG_ID_NAV_FILTER_BIAS 220 00004 00005 typedef struct __mavlink_nav_filter_bias_t 00006 { 00007 uint64_t usec; ///< Timestamp (microseconds) 00008 float accel_0; ///< b_f[0] 00009 float accel_1; ///< b_f[1] 00010 float accel_2; ///< b_f[2] 00011 float gyro_0; ///< b_f[0] 00012 float gyro_1; ///< b_f[1] 00013 float gyro_2; ///< b_f[2] 00014 00015 } mavlink_nav_filter_bias_t; 00016 00017 00018 00019 /** 00020 * @brief Pack a nav_filter_bias 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 usec Timestamp (microseconds) 00026 * @param accel_0 b_f[0] 00027 * @param accel_1 b_f[1] 00028 * @param accel_2 b_f[2] 00029 * @param gyro_0 b_f[0] 00030 * @param gyro_1 b_f[1] 00031 * @param gyro_2 b_f[2] 00032 * @return length of the message in bytes (excluding serial stream start sign) 00033 */ 00034 static inline uint16_t mavlink_msg_nav_filter_bias_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint64_t usec, float accel_0, float accel_1, float accel_2, float gyro_0, float gyro_1, float gyro_2) 00035 { 00036 uint16_t i = 0; 00037 msg->msgid = MAVLINK_MSG_ID_NAV_FILTER_BIAS; 00038 00039 i += put_uint64_t_by_index(usec, i, msg->payload); // Timestamp (microseconds) 00040 i += put_float_by_index(accel_0, i, msg->payload); // b_f[0] 00041 i += put_float_by_index(accel_1, i, msg->payload); // b_f[1] 00042 i += put_float_by_index(accel_2, i, msg->payload); // b_f[2] 00043 i += put_float_by_index(gyro_0, i, msg->payload); // b_f[0] 00044 i += put_float_by_index(gyro_1, i, msg->payload); // b_f[1] 00045 i += put_float_by_index(gyro_2, i, msg->payload); // b_f[2] 00046 00047 return mavlink_finalize_message(msg, system_id, component_id, i); 00048 } 00049 00050 /** 00051 * @brief Pack a nav_filter_bias 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 usec Timestamp (microseconds) 00057 * @param accel_0 b_f[0] 00058 * @param accel_1 b_f[1] 00059 * @param accel_2 b_f[2] 00060 * @param gyro_0 b_f[0] 00061 * @param gyro_1 b_f[1] 00062 * @param gyro_2 b_f[2] 00063 * @return length of the message in bytes (excluding serial stream start sign) 00064 */ 00065 static inline uint16_t mavlink_msg_nav_filter_bias_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint64_t usec, float accel_0, float accel_1, float accel_2, float gyro_0, float gyro_1, float gyro_2) 00066 { 00067 uint16_t i = 0; 00068 msg->msgid = MAVLINK_MSG_ID_NAV_FILTER_BIAS; 00069 00070 i += put_uint64_t_by_index(usec, i, msg->payload); // Timestamp (microseconds) 00071 i += put_float_by_index(accel_0, i, msg->payload); // b_f[0] 00072 i += put_float_by_index(accel_1, i, msg->payload); // b_f[1] 00073 i += put_float_by_index(accel_2, i, msg->payload); // b_f[2] 00074 i += put_float_by_index(gyro_0, i, msg->payload); // b_f[0] 00075 i += put_float_by_index(gyro_1, i, msg->payload); // b_f[1] 00076 i += put_float_by_index(gyro_2, i, msg->payload); // b_f[2] 00077 00078 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i); 00079 } 00080 00081 /** 00082 * @brief Encode a nav_filter_bias 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 nav_filter_bias C-struct to read the message contents from 00088 */ 00089 static inline uint16_t mavlink_msg_nav_filter_bias_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_nav_filter_bias_t* nav_filter_bias) 00090 { 00091 return mavlink_msg_nav_filter_bias_pack(system_id, component_id, msg, nav_filter_bias->usec, nav_filter_bias->accel_0, nav_filter_bias->accel_1, nav_filter_bias->accel_2, nav_filter_bias->gyro_0, nav_filter_bias->gyro_1, nav_filter_bias->gyro_2); 00092 } 00093 00094 /** 00095 * @brief Send a nav_filter_bias message 00096 * @param chan MAVLink channel to send the message 00097 * 00098 * @param usec Timestamp (microseconds) 00099 * @param accel_0 b_f[0] 00100 * @param accel_1 b_f[1] 00101 * @param accel_2 b_f[2] 00102 * @param gyro_0 b_f[0] 00103 * @param gyro_1 b_f[1] 00104 * @param gyro_2 b_f[2] 00105 */ 00106 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS 00107 00108 static inline void mavlink_msg_nav_filter_bias_send(mavlink_channel_t chan, uint64_t usec, float accel_0, float accel_1, float accel_2, float gyro_0, float gyro_1, float gyro_2) 00109 { 00110 mavlink_message_t msg; 00111 mavlink_msg_nav_filter_bias_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, usec, accel_0, accel_1, accel_2, gyro_0, gyro_1, gyro_2); 00112 mavlink_send_uart(chan, &msg); 00113 } 00114 00115 #endif 00116 // MESSAGE NAV_FILTER_BIAS UNPACKING 00117 00118 /** 00119 * @brief Get field usec from nav_filter_bias message 00120 * 00121 * @return Timestamp (microseconds) 00122 */ 00123 static inline uint64_t mavlink_msg_nav_filter_bias_get_usec(const mavlink_message_t* msg) 00124 { 00125 generic_64bit r; 00126 r.b[7] = (msg->payload)[0]; 00127 r.b[6] = (msg->payload)[1]; 00128 r.b[5] = (msg->payload)[2]; 00129 r.b[4] = (msg->payload)[3]; 00130 r.b[3] = (msg->payload)[4]; 00131 r.b[2] = (msg->payload)[5]; 00132 r.b[1] = (msg->payload)[6]; 00133 r.b[0] = (msg->payload)[7]; 00134 return (uint64_t)r.ll; 00135 } 00136 00137 /** 00138 * @brief Get field accel_0 from nav_filter_bias message 00139 * 00140 * @return b_f[0] 00141 */ 00142 static inline float mavlink_msg_nav_filter_bias_get_accel_0(const mavlink_message_t* msg) 00143 { 00144 generic_32bit r; 00145 r.b[3] = (msg->payload+sizeof(uint64_t))[0]; 00146 r.b[2] = (msg->payload+sizeof(uint64_t))[1]; 00147 r.b[1] = (msg->payload+sizeof(uint64_t))[2]; 00148 r.b[0] = (msg->payload+sizeof(uint64_t))[3]; 00149 return (float)r.f; 00150 } 00151 00152 /** 00153 * @brief Get field accel_1 from nav_filter_bias message 00154 * 00155 * @return b_f[1] 00156 */ 00157 static inline float mavlink_msg_nav_filter_bias_get_accel_1(const mavlink_message_t* msg) 00158 { 00159 generic_32bit r; 00160 r.b[3] = (msg->payload+sizeof(uint64_t)+sizeof(float))[0]; 00161 r.b[2] = (msg->payload+sizeof(uint64_t)+sizeof(float))[1]; 00162 r.b[1] = (msg->payload+sizeof(uint64_t)+sizeof(float))[2]; 00163 r.b[0] = (msg->payload+sizeof(uint64_t)+sizeof(float))[3]; 00164 return (float)r.f; 00165 } 00166 00167 /** 00168 * @brief Get field accel_2 from nav_filter_bias message 00169 * 00170 * @return b_f[2] 00171 */ 00172 static inline float mavlink_msg_nav_filter_bias_get_accel_2(const mavlink_message_t* msg) 00173 { 00174 generic_32bit r; 00175 r.b[3] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float))[0]; 00176 r.b[2] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float))[1]; 00177 r.b[1] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float))[2]; 00178 r.b[0] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float))[3]; 00179 return (float)r.f; 00180 } 00181 00182 /** 00183 * @brief Get field gyro_0 from nav_filter_bias message 00184 * 00185 * @return b_f[0] 00186 */ 00187 static inline float mavlink_msg_nav_filter_bias_get_gyro_0(const mavlink_message_t* msg) 00188 { 00189 generic_32bit r; 00190 r.b[3] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float)+sizeof(float))[0]; 00191 r.b[2] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float)+sizeof(float))[1]; 00192 r.b[1] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float)+sizeof(float))[2]; 00193 r.b[0] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float)+sizeof(float))[3]; 00194 return (float)r.f; 00195 } 00196 00197 /** 00198 * @brief Get field gyro_1 from nav_filter_bias message 00199 * 00200 * @return b_f[1] 00201 */ 00202 static inline float mavlink_msg_nav_filter_bias_get_gyro_1(const mavlink_message_t* msg) 00203 { 00204 generic_32bit r; 00205 r.b[3] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[0]; 00206 r.b[2] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[1]; 00207 r.b[1] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[2]; 00208 r.b[0] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[3]; 00209 return (float)r.f; 00210 } 00211 00212 /** 00213 * @brief Get field gyro_2 from nav_filter_bias message 00214 * 00215 * @return b_f[2] 00216 */ 00217 static inline float mavlink_msg_nav_filter_bias_get_gyro_2(const mavlink_message_t* msg) 00218 { 00219 generic_32bit r; 00220 r.b[3] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[0]; 00221 r.b[2] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[1]; 00222 r.b[1] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[2]; 00223 r.b[0] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[3]; 00224 return (float)r.f; 00225 } 00226 00227 /** 00228 * @brief Decode a nav_filter_bias message into a struct 00229 * 00230 * @param msg The message to decode 00231 * @param nav_filter_bias C-struct to decode the message contents into 00232 */ 00233 static inline void mavlink_msg_nav_filter_bias_decode(const mavlink_message_t* msg, mavlink_nav_filter_bias_t* nav_filter_bias) 00234 { 00235 nav_filter_bias->usec = mavlink_msg_nav_filter_bias_get_usec(msg); 00236 nav_filter_bias->accel_0 = mavlink_msg_nav_filter_bias_get_accel_0(msg); 00237 nav_filter_bias->accel_1 = mavlink_msg_nav_filter_bias_get_accel_1(msg); 00238 nav_filter_bias->accel_2 = mavlink_msg_nav_filter_bias_get_accel_2(msg); 00239 nav_filter_bias->gyro_0 = mavlink_msg_nav_filter_bias_get_gyro_0(msg); 00240 nav_filter_bias->gyro_1 = mavlink_msg_nav_filter_bias_get_gyro_1(msg); 00241 nav_filter_bias->gyro_2 = mavlink_msg_nav_filter_bias_get_gyro_2(msg); 00242 }
Generated on Tue Jul 12 2022 14:09:26 by 1.7.2