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_gps_local_origin_set.h
00001 // MESSAGE GPS_LOCAL_ORIGIN_SET PACKING 00002 00003 #define MAVLINK_MSG_ID_GPS_LOCAL_ORIGIN_SET 49 00004 00005 typedef struct __mavlink_gps_local_origin_set_t 00006 { 00007 int32_t latitude; ///< Latitude (WGS84), expressed as * 1E7 00008 int32_t longitude; ///< Longitude (WGS84), expressed as * 1E7 00009 int32_t altitude; ///< Altitude(WGS84), expressed as * 1000 00010 00011 } mavlink_gps_local_origin_set_t; 00012 00013 00014 00015 /** 00016 * @brief Pack a gps_local_origin_set message 00017 * @param system_id ID of this system 00018 * @param component_id ID of this component (e.g. 200 for IMU) 00019 * @param msg The MAVLink message to compress the data into 00020 * 00021 * @param latitude Latitude (WGS84), expressed as * 1E7 00022 * @param longitude Longitude (WGS84), expressed as * 1E7 00023 * @param altitude Altitude(WGS84), expressed as * 1000 00024 * @return length of the message in bytes (excluding serial stream start sign) 00025 */ 00026 static inline uint16_t mavlink_msg_gps_local_origin_set_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, int32_t latitude, int32_t longitude, int32_t altitude) 00027 { 00028 uint16_t i = 0; 00029 msg->msgid = MAVLINK_MSG_ID_GPS_LOCAL_ORIGIN_SET; 00030 00031 i += put_int32_t_by_index(latitude, i, msg->payload); // Latitude (WGS84), expressed as * 1E7 00032 i += put_int32_t_by_index(longitude, i, msg->payload); // Longitude (WGS84), expressed as * 1E7 00033 i += put_int32_t_by_index(altitude, i, msg->payload); // Altitude(WGS84), expressed as * 1000 00034 00035 return mavlink_finalize_message(msg, system_id, component_id, i); 00036 } 00037 00038 /** 00039 * @brief Pack a gps_local_origin_set message 00040 * @param system_id ID of this system 00041 * @param component_id ID of this component (e.g. 200 for IMU) 00042 * @param chan The MAVLink channel this message was sent over 00043 * @param msg The MAVLink message to compress the data into 00044 * @param latitude Latitude (WGS84), expressed as * 1E7 00045 * @param longitude Longitude (WGS84), expressed as * 1E7 00046 * @param altitude Altitude(WGS84), expressed as * 1000 00047 * @return length of the message in bytes (excluding serial stream start sign) 00048 */ 00049 static inline uint16_t mavlink_msg_gps_local_origin_set_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, int32_t latitude, int32_t longitude, int32_t altitude) 00050 { 00051 uint16_t i = 0; 00052 msg->msgid = MAVLINK_MSG_ID_GPS_LOCAL_ORIGIN_SET; 00053 00054 i += put_int32_t_by_index(latitude, i, msg->payload); // Latitude (WGS84), expressed as * 1E7 00055 i += put_int32_t_by_index(longitude, i, msg->payload); // Longitude (WGS84), expressed as * 1E7 00056 i += put_int32_t_by_index(altitude, i, msg->payload); // Altitude(WGS84), expressed as * 1000 00057 00058 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i); 00059 } 00060 00061 /** 00062 * @brief Encode a gps_local_origin_set struct into a message 00063 * 00064 * @param system_id ID of this system 00065 * @param component_id ID of this component (e.g. 200 for IMU) 00066 * @param msg The MAVLink message to compress the data into 00067 * @param gps_local_origin_set C-struct to read the message contents from 00068 */ 00069 static inline uint16_t mavlink_msg_gps_local_origin_set_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gps_local_origin_set_t* gps_local_origin_set) 00070 { 00071 return mavlink_msg_gps_local_origin_set_pack(system_id, component_id, msg, gps_local_origin_set->latitude, gps_local_origin_set->longitude, gps_local_origin_set->altitude); 00072 } 00073 00074 /** 00075 * @brief Send a gps_local_origin_set message 00076 * @param chan MAVLink channel to send the message 00077 * 00078 * @param latitude Latitude (WGS84), expressed as * 1E7 00079 * @param longitude Longitude (WGS84), expressed as * 1E7 00080 * @param altitude Altitude(WGS84), expressed as * 1000 00081 */ 00082 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS 00083 00084 static inline void mavlink_msg_gps_local_origin_set_send(mavlink_channel_t chan, int32_t latitude, int32_t longitude, int32_t altitude) 00085 { 00086 mavlink_message_t msg; 00087 mavlink_msg_gps_local_origin_set_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, latitude, longitude, altitude); 00088 mavlink_send_uart(chan, &msg); 00089 } 00090 00091 #endif 00092 // MESSAGE GPS_LOCAL_ORIGIN_SET UNPACKING 00093 00094 /** 00095 * @brief Get field latitude from gps_local_origin_set message 00096 * 00097 * @return Latitude (WGS84), expressed as * 1E7 00098 */ 00099 static inline int32_t mavlink_msg_gps_local_origin_set_get_latitude(const mavlink_message_t* msg) 00100 { 00101 generic_32bit r; 00102 r.b[3] = (msg->payload)[0]; 00103 r.b[2] = (msg->payload)[1]; 00104 r.b[1] = (msg->payload)[2]; 00105 r.b[0] = (msg->payload)[3]; 00106 return (int32_t)r.i; 00107 } 00108 00109 /** 00110 * @brief Get field longitude from gps_local_origin_set message 00111 * 00112 * @return Longitude (WGS84), expressed as * 1E7 00113 */ 00114 static inline int32_t mavlink_msg_gps_local_origin_set_get_longitude(const mavlink_message_t* msg) 00115 { 00116 generic_32bit r; 00117 r.b[3] = (msg->payload+sizeof(int32_t))[0]; 00118 r.b[2] = (msg->payload+sizeof(int32_t))[1]; 00119 r.b[1] = (msg->payload+sizeof(int32_t))[2]; 00120 r.b[0] = (msg->payload+sizeof(int32_t))[3]; 00121 return (int32_t)r.i; 00122 } 00123 00124 /** 00125 * @brief Get field altitude from gps_local_origin_set message 00126 * 00127 * @return Altitude(WGS84), expressed as * 1000 00128 */ 00129 static inline int32_t mavlink_msg_gps_local_origin_set_get_altitude(const mavlink_message_t* msg) 00130 { 00131 generic_32bit r; 00132 r.b[3] = (msg->payload+sizeof(int32_t)+sizeof(int32_t))[0]; 00133 r.b[2] = (msg->payload+sizeof(int32_t)+sizeof(int32_t))[1]; 00134 r.b[1] = (msg->payload+sizeof(int32_t)+sizeof(int32_t))[2]; 00135 r.b[0] = (msg->payload+sizeof(int32_t)+sizeof(int32_t))[3]; 00136 return (int32_t)r.i; 00137 } 00138 00139 /** 00140 * @brief Decode a gps_local_origin_set message into a struct 00141 * 00142 * @param msg The message to decode 00143 * @param gps_local_origin_set C-struct to decode the message contents into 00144 */ 00145 static inline void mavlink_msg_gps_local_origin_set_decode(const mavlink_message_t* msg, mavlink_gps_local_origin_set_t* gps_local_origin_set) 00146 { 00147 gps_local_origin_set->latitude = mavlink_msg_gps_local_origin_set_get_latitude(msg); 00148 gps_local_origin_set->longitude = mavlink_msg_gps_local_origin_set_get_longitude(msg); 00149 gps_local_origin_set->altitude = mavlink_msg_gps_local_origin_set_get_altitude(msg); 00150 }
Generated on Tue Jul 12 2022 14:09:26 by 1.7.2