Code for autonomous ground vehicle, Data Bus, 3rd place winner in 2012 Sparkfun AVC.

Dependencies:   Watchdog mbed Schedule SimpleFilter LSM303DLM PinDetect DebounceIn Servo

Committer:
shimniok
Date:
Wed Jun 20 14:57:48 2012 +0000
Revision:
0:826c6171fc1b
Updated documentation

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shimniok 0:826c6171fc1b 1 // MESSAGE WAYPOINT PACKING
shimniok 0:826c6171fc1b 2
shimniok 0:826c6171fc1b 3 #define MAVLINK_MSG_ID_WAYPOINT 39
shimniok 0:826c6171fc1b 4
shimniok 0:826c6171fc1b 5 typedef struct __mavlink_waypoint_t
shimniok 0:826c6171fc1b 6 {
shimniok 0:826c6171fc1b 7 uint8_t target_system; ///< System ID
shimniok 0:826c6171fc1b 8 uint8_t target_component; ///< Component ID
shimniok 0:826c6171fc1b 9 uint16_t seq; ///< Sequence
shimniok 0:826c6171fc1b 10 uint8_t frame; ///< The coordinate system of the waypoint. see MAV_FRAME in mavlink_types.h
shimniok 0:826c6171fc1b 11 uint8_t command; ///< The scheduled action for the waypoint. see MAV_COMMAND in common.xml MAVLink specs
shimniok 0:826c6171fc1b 12 uint8_t current; ///< false:0, true:1
shimniok 0:826c6171fc1b 13 uint8_t autocontinue; ///< autocontinue to next wp
shimniok 0:826c6171fc1b 14 float param1; ///< PARAM1 / For NAV command waypoints: Radius in which the waypoint is accepted as reached, in meters
shimniok 0:826c6171fc1b 15 float param2; ///< PARAM2 / For NAV command waypoints: Time that the MAV should stay inside the PARAM1 radius before advancing, in milliseconds
shimniok 0:826c6171fc1b 16 float param3; ///< PARAM3 / For LOITER command waypoints: Orbit to circle around the waypoint, in meters. If positive the orbit direction should be clockwise, if negative the orbit direction should be counter-clockwise.
shimniok 0:826c6171fc1b 17 float param4; ///< PARAM4 / For NAV and LOITER command waypoints: Yaw orientation in degrees, [0..360] 0 = NORTH
shimniok 0:826c6171fc1b 18 float x; ///< PARAM5 / local: x position, global: latitude
shimniok 0:826c6171fc1b 19 float y; ///< PARAM6 / y position: global: longitude
shimniok 0:826c6171fc1b 20 float z; ///< PARAM7 / z position: global: altitude
shimniok 0:826c6171fc1b 21
shimniok 0:826c6171fc1b 22 } mavlink_waypoint_t;
shimniok 0:826c6171fc1b 23
shimniok 0:826c6171fc1b 24
shimniok 0:826c6171fc1b 25
shimniok 0:826c6171fc1b 26 /**
shimniok 0:826c6171fc1b 27 * @brief Pack a waypoint message
shimniok 0:826c6171fc1b 28 * @param system_id ID of this system
shimniok 0:826c6171fc1b 29 * @param component_id ID of this component (e.g. 200 for IMU)
shimniok 0:826c6171fc1b 30 * @param msg The MAVLink message to compress the data into
shimniok 0:826c6171fc1b 31 *
shimniok 0:826c6171fc1b 32 * @param target_system System ID
shimniok 0:826c6171fc1b 33 * @param target_component Component ID
shimniok 0:826c6171fc1b 34 * @param seq Sequence
shimniok 0:826c6171fc1b 35 * @param frame The coordinate system of the waypoint. see MAV_FRAME in mavlink_types.h
shimniok 0:826c6171fc1b 36 * @param command The scheduled action for the waypoint. see MAV_COMMAND in common.xml MAVLink specs
shimniok 0:826c6171fc1b 37 * @param current false:0, true:1
shimniok 0:826c6171fc1b 38 * @param autocontinue autocontinue to next wp
shimniok 0:826c6171fc1b 39 * @param param1 PARAM1 / For NAV command waypoints: Radius in which the waypoint is accepted as reached, in meters
shimniok 0:826c6171fc1b 40 * @param param2 PARAM2 / For NAV command waypoints: Time that the MAV should stay inside the PARAM1 radius before advancing, in milliseconds
shimniok 0:826c6171fc1b 41 * @param param3 PARAM3 / For LOITER command waypoints: Orbit to circle around the waypoint, in meters. If positive the orbit direction should be clockwise, if negative the orbit direction should be counter-clockwise.
shimniok 0:826c6171fc1b 42 * @param param4 PARAM4 / For NAV and LOITER command waypoints: Yaw orientation in degrees, [0..360] 0 = NORTH
shimniok 0:826c6171fc1b 43 * @param x PARAM5 / local: x position, global: latitude
shimniok 0:826c6171fc1b 44 * @param y PARAM6 / y position: global: longitude
shimniok 0:826c6171fc1b 45 * @param z PARAM7 / z position: global: altitude
shimniok 0:826c6171fc1b 46 * @return length of the message in bytes (excluding serial stream start sign)
shimniok 0:826c6171fc1b 47 */
shimniok 0:826c6171fc1b 48 static inline uint16_t mavlink_msg_waypoint_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t target_system, uint8_t target_component, uint16_t seq, uint8_t frame, uint8_t command, uint8_t current, uint8_t autocontinue, float param1, float param2, float param3, float param4, float x, float y, float z)
shimniok 0:826c6171fc1b 49 {
shimniok 0:826c6171fc1b 50 uint16_t i = 0;
shimniok 0:826c6171fc1b 51 msg->msgid = MAVLINK_MSG_ID_WAYPOINT;
shimniok 0:826c6171fc1b 52
shimniok 0:826c6171fc1b 53 i += put_uint8_t_by_index(target_system, i, msg->payload); // System ID
shimniok 0:826c6171fc1b 54 i += put_uint8_t_by_index(target_component, i, msg->payload); // Component ID
shimniok 0:826c6171fc1b 55 i += put_uint16_t_by_index(seq, i, msg->payload); // Sequence
shimniok 0:826c6171fc1b 56 i += put_uint8_t_by_index(frame, i, msg->payload); // The coordinate system of the waypoint. see MAV_FRAME in mavlink_types.h
shimniok 0:826c6171fc1b 57 i += put_uint8_t_by_index(command, i, msg->payload); // The scheduled action for the waypoint. see MAV_COMMAND in common.xml MAVLink specs
shimniok 0:826c6171fc1b 58 i += put_uint8_t_by_index(current, i, msg->payload); // false:0, true:1
shimniok 0:826c6171fc1b 59 i += put_uint8_t_by_index(autocontinue, i, msg->payload); // autocontinue to next wp
shimniok 0:826c6171fc1b 60 i += put_float_by_index(param1, i, msg->payload); // PARAM1 / For NAV command waypoints: Radius in which the waypoint is accepted as reached, in meters
shimniok 0:826c6171fc1b 61 i += put_float_by_index(param2, i, msg->payload); // PARAM2 / For NAV command waypoints: Time that the MAV should stay inside the PARAM1 radius before advancing, in milliseconds
shimniok 0:826c6171fc1b 62 i += put_float_by_index(param3, i, msg->payload); // PARAM3 / For LOITER command waypoints: Orbit to circle around the waypoint, in meters. If positive the orbit direction should be clockwise, if negative the orbit direction should be counter-clockwise.
shimniok 0:826c6171fc1b 63 i += put_float_by_index(param4, i, msg->payload); // PARAM4 / For NAV and LOITER command waypoints: Yaw orientation in degrees, [0..360] 0 = NORTH
shimniok 0:826c6171fc1b 64 i += put_float_by_index(x, i, msg->payload); // PARAM5 / local: x position, global: latitude
shimniok 0:826c6171fc1b 65 i += put_float_by_index(y, i, msg->payload); // PARAM6 / y position: global: longitude
shimniok 0:826c6171fc1b 66 i += put_float_by_index(z, i, msg->payload); // PARAM7 / z position: global: altitude
shimniok 0:826c6171fc1b 67
shimniok 0:826c6171fc1b 68 return mavlink_finalize_message(msg, system_id, component_id, i);
shimniok 0:826c6171fc1b 69 }
shimniok 0:826c6171fc1b 70
shimniok 0:826c6171fc1b 71 /**
shimniok 0:826c6171fc1b 72 * @brief Pack a waypoint message
shimniok 0:826c6171fc1b 73 * @param system_id ID of this system
shimniok 0:826c6171fc1b 74 * @param component_id ID of this component (e.g. 200 for IMU)
shimniok 0:826c6171fc1b 75 * @param chan The MAVLink channel this message was sent over
shimniok 0:826c6171fc1b 76 * @param msg The MAVLink message to compress the data into
shimniok 0:826c6171fc1b 77 * @param target_system System ID
shimniok 0:826c6171fc1b 78 * @param target_component Component ID
shimniok 0:826c6171fc1b 79 * @param seq Sequence
shimniok 0:826c6171fc1b 80 * @param frame The coordinate system of the waypoint. see MAV_FRAME in mavlink_types.h
shimniok 0:826c6171fc1b 81 * @param command The scheduled action for the waypoint. see MAV_COMMAND in common.xml MAVLink specs
shimniok 0:826c6171fc1b 82 * @param current false:0, true:1
shimniok 0:826c6171fc1b 83 * @param autocontinue autocontinue to next wp
shimniok 0:826c6171fc1b 84 * @param param1 PARAM1 / For NAV command waypoints: Radius in which the waypoint is accepted as reached, in meters
shimniok 0:826c6171fc1b 85 * @param param2 PARAM2 / For NAV command waypoints: Time that the MAV should stay inside the PARAM1 radius before advancing, in milliseconds
shimniok 0:826c6171fc1b 86 * @param param3 PARAM3 / For LOITER command waypoints: Orbit to circle around the waypoint, in meters. If positive the orbit direction should be clockwise, if negative the orbit direction should be counter-clockwise.
shimniok 0:826c6171fc1b 87 * @param param4 PARAM4 / For NAV and LOITER command waypoints: Yaw orientation in degrees, [0..360] 0 = NORTH
shimniok 0:826c6171fc1b 88 * @param x PARAM5 / local: x position, global: latitude
shimniok 0:826c6171fc1b 89 * @param y PARAM6 / y position: global: longitude
shimniok 0:826c6171fc1b 90 * @param z PARAM7 / z position: global: altitude
shimniok 0:826c6171fc1b 91 * @return length of the message in bytes (excluding serial stream start sign)
shimniok 0:826c6171fc1b 92 */
shimniok 0:826c6171fc1b 93 static inline uint16_t mavlink_msg_waypoint_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, uint16_t seq, uint8_t frame, uint8_t command, uint8_t current, uint8_t autocontinue, float param1, float param2, float param3, float param4, float x, float y, float z)
shimniok 0:826c6171fc1b 94 {
shimniok 0:826c6171fc1b 95 uint16_t i = 0;
shimniok 0:826c6171fc1b 96 msg->msgid = MAVLINK_MSG_ID_WAYPOINT;
shimniok 0:826c6171fc1b 97
shimniok 0:826c6171fc1b 98 i += put_uint8_t_by_index(target_system, i, msg->payload); // System ID
shimniok 0:826c6171fc1b 99 i += put_uint8_t_by_index(target_component, i, msg->payload); // Component ID
shimniok 0:826c6171fc1b 100 i += put_uint16_t_by_index(seq, i, msg->payload); // Sequence
shimniok 0:826c6171fc1b 101 i += put_uint8_t_by_index(frame, i, msg->payload); // The coordinate system of the waypoint. see MAV_FRAME in mavlink_types.h
shimniok 0:826c6171fc1b 102 i += put_uint8_t_by_index(command, i, msg->payload); // The scheduled action for the waypoint. see MAV_COMMAND in common.xml MAVLink specs
shimniok 0:826c6171fc1b 103 i += put_uint8_t_by_index(current, i, msg->payload); // false:0, true:1
shimniok 0:826c6171fc1b 104 i += put_uint8_t_by_index(autocontinue, i, msg->payload); // autocontinue to next wp
shimniok 0:826c6171fc1b 105 i += put_float_by_index(param1, i, msg->payload); // PARAM1 / For NAV command waypoints: Radius in which the waypoint is accepted as reached, in meters
shimniok 0:826c6171fc1b 106 i += put_float_by_index(param2, i, msg->payload); // PARAM2 / For NAV command waypoints: Time that the MAV should stay inside the PARAM1 radius before advancing, in milliseconds
shimniok 0:826c6171fc1b 107 i += put_float_by_index(param3, i, msg->payload); // PARAM3 / For LOITER command waypoints: Orbit to circle around the waypoint, in meters. If positive the orbit direction should be clockwise, if negative the orbit direction should be counter-clockwise.
shimniok 0:826c6171fc1b 108 i += put_float_by_index(param4, i, msg->payload); // PARAM4 / For NAV and LOITER command waypoints: Yaw orientation in degrees, [0..360] 0 = NORTH
shimniok 0:826c6171fc1b 109 i += put_float_by_index(x, i, msg->payload); // PARAM5 / local: x position, global: latitude
shimniok 0:826c6171fc1b 110 i += put_float_by_index(y, i, msg->payload); // PARAM6 / y position: global: longitude
shimniok 0:826c6171fc1b 111 i += put_float_by_index(z, i, msg->payload); // PARAM7 / z position: global: altitude
shimniok 0:826c6171fc1b 112
shimniok 0:826c6171fc1b 113 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i);
shimniok 0:826c6171fc1b 114 }
shimniok 0:826c6171fc1b 115
shimniok 0:826c6171fc1b 116 /**
shimniok 0:826c6171fc1b 117 * @brief Encode a waypoint struct into a message
shimniok 0:826c6171fc1b 118 *
shimniok 0:826c6171fc1b 119 * @param system_id ID of this system
shimniok 0:826c6171fc1b 120 * @param component_id ID of this component (e.g. 200 for IMU)
shimniok 0:826c6171fc1b 121 * @param msg The MAVLink message to compress the data into
shimniok 0:826c6171fc1b 122 * @param waypoint C-struct to read the message contents from
shimniok 0:826c6171fc1b 123 */
shimniok 0:826c6171fc1b 124 static inline uint16_t mavlink_msg_waypoint_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_waypoint_t* waypoint)
shimniok 0:826c6171fc1b 125 {
shimniok 0:826c6171fc1b 126 return mavlink_msg_waypoint_pack(system_id, component_id, msg, waypoint->target_system, waypoint->target_component, waypoint->seq, waypoint->frame, waypoint->command, waypoint->current, waypoint->autocontinue, waypoint->param1, waypoint->param2, waypoint->param3, waypoint->param4, waypoint->x, waypoint->y, waypoint->z);
shimniok 0:826c6171fc1b 127 }
shimniok 0:826c6171fc1b 128
shimniok 0:826c6171fc1b 129 /**
shimniok 0:826c6171fc1b 130 * @brief Send a waypoint message
shimniok 0:826c6171fc1b 131 * @param chan MAVLink channel to send the message
shimniok 0:826c6171fc1b 132 *
shimniok 0:826c6171fc1b 133 * @param target_system System ID
shimniok 0:826c6171fc1b 134 * @param target_component Component ID
shimniok 0:826c6171fc1b 135 * @param seq Sequence
shimniok 0:826c6171fc1b 136 * @param frame The coordinate system of the waypoint. see MAV_FRAME in mavlink_types.h
shimniok 0:826c6171fc1b 137 * @param command The scheduled action for the waypoint. see MAV_COMMAND in common.xml MAVLink specs
shimniok 0:826c6171fc1b 138 * @param current false:0, true:1
shimniok 0:826c6171fc1b 139 * @param autocontinue autocontinue to next wp
shimniok 0:826c6171fc1b 140 * @param param1 PARAM1 / For NAV command waypoints: Radius in which the waypoint is accepted as reached, in meters
shimniok 0:826c6171fc1b 141 * @param param2 PARAM2 / For NAV command waypoints: Time that the MAV should stay inside the PARAM1 radius before advancing, in milliseconds
shimniok 0:826c6171fc1b 142 * @param param3 PARAM3 / For LOITER command waypoints: Orbit to circle around the waypoint, in meters. If positive the orbit direction should be clockwise, if negative the orbit direction should be counter-clockwise.
shimniok 0:826c6171fc1b 143 * @param param4 PARAM4 / For NAV and LOITER command waypoints: Yaw orientation in degrees, [0..360] 0 = NORTH
shimniok 0:826c6171fc1b 144 * @param x PARAM5 / local: x position, global: latitude
shimniok 0:826c6171fc1b 145 * @param y PARAM6 / y position: global: longitude
shimniok 0:826c6171fc1b 146 * @param z PARAM7 / z position: global: altitude
shimniok 0:826c6171fc1b 147 */
shimniok 0:826c6171fc1b 148 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
shimniok 0:826c6171fc1b 149
shimniok 0:826c6171fc1b 150 static inline void mavlink_msg_waypoint_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint16_t seq, uint8_t frame, uint8_t command, uint8_t current, uint8_t autocontinue, float param1, float param2, float param3, float param4, float x, float y, float z)
shimniok 0:826c6171fc1b 151 {
shimniok 0:826c6171fc1b 152 mavlink_message_t msg;
shimniok 0:826c6171fc1b 153 mavlink_msg_waypoint_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, target_system, target_component, seq, frame, command, current, autocontinue, param1, param2, param3, param4, x, y, z);
shimniok 0:826c6171fc1b 154 mavlink_send_uart(chan, &msg);
shimniok 0:826c6171fc1b 155 }
shimniok 0:826c6171fc1b 156
shimniok 0:826c6171fc1b 157 #endif
shimniok 0:826c6171fc1b 158 // MESSAGE WAYPOINT UNPACKING
shimniok 0:826c6171fc1b 159
shimniok 0:826c6171fc1b 160 /**
shimniok 0:826c6171fc1b 161 * @brief Get field target_system from waypoint message
shimniok 0:826c6171fc1b 162 *
shimniok 0:826c6171fc1b 163 * @return System ID
shimniok 0:826c6171fc1b 164 */
shimniok 0:826c6171fc1b 165 static inline uint8_t mavlink_msg_waypoint_get_target_system(const mavlink_message_t* msg)
shimniok 0:826c6171fc1b 166 {
shimniok 0:826c6171fc1b 167 return (uint8_t)(msg->payload)[0];
shimniok 0:826c6171fc1b 168 }
shimniok 0:826c6171fc1b 169
shimniok 0:826c6171fc1b 170 /**
shimniok 0:826c6171fc1b 171 * @brief Get field target_component from waypoint message
shimniok 0:826c6171fc1b 172 *
shimniok 0:826c6171fc1b 173 * @return Component ID
shimniok 0:826c6171fc1b 174 */
shimniok 0:826c6171fc1b 175 static inline uint8_t mavlink_msg_waypoint_get_target_component(const mavlink_message_t* msg)
shimniok 0:826c6171fc1b 176 {
shimniok 0:826c6171fc1b 177 return (uint8_t)(msg->payload+sizeof(uint8_t))[0];
shimniok 0:826c6171fc1b 178 }
shimniok 0:826c6171fc1b 179
shimniok 0:826c6171fc1b 180 /**
shimniok 0:826c6171fc1b 181 * @brief Get field seq from waypoint message
shimniok 0:826c6171fc1b 182 *
shimniok 0:826c6171fc1b 183 * @return Sequence
shimniok 0:826c6171fc1b 184 */
shimniok 0:826c6171fc1b 185 static inline uint16_t mavlink_msg_waypoint_get_seq(const mavlink_message_t* msg)
shimniok 0:826c6171fc1b 186 {
shimniok 0:826c6171fc1b 187 generic_16bit r;
shimniok 0:826c6171fc1b 188 r.b[1] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t))[0];
shimniok 0:826c6171fc1b 189 r.b[0] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t))[1];
shimniok 0:826c6171fc1b 190 return (uint16_t)r.s;
shimniok 0:826c6171fc1b 191 }
shimniok 0:826c6171fc1b 192
shimniok 0:826c6171fc1b 193 /**
shimniok 0:826c6171fc1b 194 * @brief Get field frame from waypoint message
shimniok 0:826c6171fc1b 195 *
shimniok 0:826c6171fc1b 196 * @return The coordinate system of the waypoint. see MAV_FRAME in mavlink_types.h
shimniok 0:826c6171fc1b 197 */
shimniok 0:826c6171fc1b 198 static inline uint8_t mavlink_msg_waypoint_get_frame(const mavlink_message_t* msg)
shimniok 0:826c6171fc1b 199 {
shimniok 0:826c6171fc1b 200 return (uint8_t)(msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t))[0];
shimniok 0:826c6171fc1b 201 }
shimniok 0:826c6171fc1b 202
shimniok 0:826c6171fc1b 203 /**
shimniok 0:826c6171fc1b 204 * @brief Get field command from waypoint message
shimniok 0:826c6171fc1b 205 *
shimniok 0:826c6171fc1b 206 * @return The scheduled action for the waypoint. see MAV_COMMAND in common.xml MAVLink specs
shimniok 0:826c6171fc1b 207 */
shimniok 0:826c6171fc1b 208 static inline uint8_t mavlink_msg_waypoint_get_command(const mavlink_message_t* msg)
shimniok 0:826c6171fc1b 209 {
shimniok 0:826c6171fc1b 210 return (uint8_t)(msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint8_t))[0];
shimniok 0:826c6171fc1b 211 }
shimniok 0:826c6171fc1b 212
shimniok 0:826c6171fc1b 213 /**
shimniok 0:826c6171fc1b 214 * @brief Get field current from waypoint message
shimniok 0:826c6171fc1b 215 *
shimniok 0:826c6171fc1b 216 * @return false:0, true:1
shimniok 0:826c6171fc1b 217 */
shimniok 0:826c6171fc1b 218 static inline uint8_t mavlink_msg_waypoint_get_current(const mavlink_message_t* msg)
shimniok 0:826c6171fc1b 219 {
shimniok 0:826c6171fc1b 220 return (uint8_t)(msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint8_t))[0];
shimniok 0:826c6171fc1b 221 }
shimniok 0:826c6171fc1b 222
shimniok 0:826c6171fc1b 223 /**
shimniok 0:826c6171fc1b 224 * @brief Get field autocontinue from waypoint message
shimniok 0:826c6171fc1b 225 *
shimniok 0:826c6171fc1b 226 * @return autocontinue to next wp
shimniok 0:826c6171fc1b 227 */
shimniok 0:826c6171fc1b 228 static inline uint8_t mavlink_msg_waypoint_get_autocontinue(const mavlink_message_t* msg)
shimniok 0:826c6171fc1b 229 {
shimniok 0:826c6171fc1b 230 return (uint8_t)(msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t))[0];
shimniok 0:826c6171fc1b 231 }
shimniok 0:826c6171fc1b 232
shimniok 0:826c6171fc1b 233 /**
shimniok 0:826c6171fc1b 234 * @brief Get field param1 from waypoint message
shimniok 0:826c6171fc1b 235 *
shimniok 0:826c6171fc1b 236 * @return PARAM1 / For NAV command waypoints: Radius in which the waypoint is accepted as reached, in meters
shimniok 0:826c6171fc1b 237 */
shimniok 0:826c6171fc1b 238 static inline float mavlink_msg_waypoint_get_param1(const mavlink_message_t* msg)
shimniok 0:826c6171fc1b 239 {
shimniok 0:826c6171fc1b 240 generic_32bit r;
shimniok 0:826c6171fc1b 241 r.b[3] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t))[0];
shimniok 0:826c6171fc1b 242 r.b[2] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t))[1];
shimniok 0:826c6171fc1b 243 r.b[1] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t))[2];
shimniok 0:826c6171fc1b 244 r.b[0] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t))[3];
shimniok 0:826c6171fc1b 245 return (float)r.f;
shimniok 0:826c6171fc1b 246 }
shimniok 0:826c6171fc1b 247
shimniok 0:826c6171fc1b 248 /**
shimniok 0:826c6171fc1b 249 * @brief Get field param2 from waypoint message
shimniok 0:826c6171fc1b 250 *
shimniok 0:826c6171fc1b 251 * @return PARAM2 / For NAV command waypoints: Time that the MAV should stay inside the PARAM1 radius before advancing, in milliseconds
shimniok 0:826c6171fc1b 252 */
shimniok 0:826c6171fc1b 253 static inline float mavlink_msg_waypoint_get_param2(const mavlink_message_t* msg)
shimniok 0:826c6171fc1b 254 {
shimniok 0:826c6171fc1b 255 generic_32bit r;
shimniok 0:826c6171fc1b 256 r.b[3] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float))[0];
shimniok 0:826c6171fc1b 257 r.b[2] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float))[1];
shimniok 0:826c6171fc1b 258 r.b[1] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float))[2];
shimniok 0:826c6171fc1b 259 r.b[0] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float))[3];
shimniok 0:826c6171fc1b 260 return (float)r.f;
shimniok 0:826c6171fc1b 261 }
shimniok 0:826c6171fc1b 262
shimniok 0:826c6171fc1b 263 /**
shimniok 0:826c6171fc1b 264 * @brief Get field param3 from waypoint message
shimniok 0:826c6171fc1b 265 *
shimniok 0:826c6171fc1b 266 * @return PARAM3 / For LOITER command waypoints: Orbit to circle around the waypoint, in meters. If positive the orbit direction should be clockwise, if negative the orbit direction should be counter-clockwise.
shimniok 0:826c6171fc1b 267 */
shimniok 0:826c6171fc1b 268 static inline float mavlink_msg_waypoint_get_param3(const mavlink_message_t* msg)
shimniok 0:826c6171fc1b 269 {
shimniok 0:826c6171fc1b 270 generic_32bit r;
shimniok 0:826c6171fc1b 271 r.b[3] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float))[0];
shimniok 0:826c6171fc1b 272 r.b[2] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float))[1];
shimniok 0:826c6171fc1b 273 r.b[1] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float))[2];
shimniok 0:826c6171fc1b 274 r.b[0] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float))[3];
shimniok 0:826c6171fc1b 275 return (float)r.f;
shimniok 0:826c6171fc1b 276 }
shimniok 0:826c6171fc1b 277
shimniok 0:826c6171fc1b 278 /**
shimniok 0:826c6171fc1b 279 * @brief Get field param4 from waypoint message
shimniok 0:826c6171fc1b 280 *
shimniok 0:826c6171fc1b 281 * @return PARAM4 / For NAV and LOITER command waypoints: Yaw orientation in degrees, [0..360] 0 = NORTH
shimniok 0:826c6171fc1b 282 */
shimniok 0:826c6171fc1b 283 static inline float mavlink_msg_waypoint_get_param4(const mavlink_message_t* msg)
shimniok 0:826c6171fc1b 284 {
shimniok 0:826c6171fc1b 285 generic_32bit r;
shimniok 0:826c6171fc1b 286 r.b[3] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float))[0];
shimniok 0:826c6171fc1b 287 r.b[2] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float))[1];
shimniok 0:826c6171fc1b 288 r.b[1] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float))[2];
shimniok 0:826c6171fc1b 289 r.b[0] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float))[3];
shimniok 0:826c6171fc1b 290 return (float)r.f;
shimniok 0:826c6171fc1b 291 }
shimniok 0:826c6171fc1b 292
shimniok 0:826c6171fc1b 293 /**
shimniok 0:826c6171fc1b 294 * @brief Get field x from waypoint message
shimniok 0:826c6171fc1b 295 *
shimniok 0:826c6171fc1b 296 * @return PARAM5 / local: x position, global: latitude
shimniok 0:826c6171fc1b 297 */
shimniok 0:826c6171fc1b 298 static inline float mavlink_msg_waypoint_get_x(const mavlink_message_t* msg)
shimniok 0:826c6171fc1b 299 {
shimniok 0:826c6171fc1b 300 generic_32bit r;
shimniok 0:826c6171fc1b 301 r.b[3] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[0];
shimniok 0:826c6171fc1b 302 r.b[2] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[1];
shimniok 0:826c6171fc1b 303 r.b[1] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[2];
shimniok 0:826c6171fc1b 304 r.b[0] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[3];
shimniok 0:826c6171fc1b 305 return (float)r.f;
shimniok 0:826c6171fc1b 306 }
shimniok 0:826c6171fc1b 307
shimniok 0:826c6171fc1b 308 /**
shimniok 0:826c6171fc1b 309 * @brief Get field y from waypoint message
shimniok 0:826c6171fc1b 310 *
shimniok 0:826c6171fc1b 311 * @return PARAM6 / y position: global: longitude
shimniok 0:826c6171fc1b 312 */
shimniok 0:826c6171fc1b 313 static inline float mavlink_msg_waypoint_get_y(const mavlink_message_t* msg)
shimniok 0:826c6171fc1b 314 {
shimniok 0:826c6171fc1b 315 generic_32bit r;
shimniok 0:826c6171fc1b 316 r.b[3] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[0];
shimniok 0:826c6171fc1b 317 r.b[2] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[1];
shimniok 0:826c6171fc1b 318 r.b[1] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[2];
shimniok 0:826c6171fc1b 319 r.b[0] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[3];
shimniok 0:826c6171fc1b 320 return (float)r.f;
shimniok 0:826c6171fc1b 321 }
shimniok 0:826c6171fc1b 322
shimniok 0:826c6171fc1b 323 /**
shimniok 0:826c6171fc1b 324 * @brief Get field z from waypoint message
shimniok 0:826c6171fc1b 325 *
shimniok 0:826c6171fc1b 326 * @return PARAM7 / z position: global: altitude
shimniok 0:826c6171fc1b 327 */
shimniok 0:826c6171fc1b 328 static inline float mavlink_msg_waypoint_get_z(const mavlink_message_t* msg)
shimniok 0:826c6171fc1b 329 {
shimniok 0:826c6171fc1b 330 generic_32bit r;
shimniok 0:826c6171fc1b 331 r.b[3] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[0];
shimniok 0:826c6171fc1b 332 r.b[2] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[1];
shimniok 0:826c6171fc1b 333 r.b[1] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[2];
shimniok 0:826c6171fc1b 334 r.b[0] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[3];
shimniok 0:826c6171fc1b 335 return (float)r.f;
shimniok 0:826c6171fc1b 336 }
shimniok 0:826c6171fc1b 337
shimniok 0:826c6171fc1b 338 /**
shimniok 0:826c6171fc1b 339 * @brief Decode a waypoint message into a struct
shimniok 0:826c6171fc1b 340 *
shimniok 0:826c6171fc1b 341 * @param msg The message to decode
shimniok 0:826c6171fc1b 342 * @param waypoint C-struct to decode the message contents into
shimniok 0:826c6171fc1b 343 */
shimniok 0:826c6171fc1b 344 static inline void mavlink_msg_waypoint_decode(const mavlink_message_t* msg, mavlink_waypoint_t* waypoint)
shimniok 0:826c6171fc1b 345 {
shimniok 0:826c6171fc1b 346 waypoint->target_system = mavlink_msg_waypoint_get_target_system(msg);
shimniok 0:826c6171fc1b 347 waypoint->target_component = mavlink_msg_waypoint_get_target_component(msg);
shimniok 0:826c6171fc1b 348 waypoint->seq = mavlink_msg_waypoint_get_seq(msg);
shimniok 0:826c6171fc1b 349 waypoint->frame = mavlink_msg_waypoint_get_frame(msg);
shimniok 0:826c6171fc1b 350 waypoint->command = mavlink_msg_waypoint_get_command(msg);
shimniok 0:826c6171fc1b 351 waypoint->current = mavlink_msg_waypoint_get_current(msg);
shimniok 0:826c6171fc1b 352 waypoint->autocontinue = mavlink_msg_waypoint_get_autocontinue(msg);
shimniok 0:826c6171fc1b 353 waypoint->param1 = mavlink_msg_waypoint_get_param1(msg);
shimniok 0:826c6171fc1b 354 waypoint->param2 = mavlink_msg_waypoint_get_param2(msg);
shimniok 0:826c6171fc1b 355 waypoint->param3 = mavlink_msg_waypoint_get_param3(msg);
shimniok 0:826c6171fc1b 356 waypoint->param4 = mavlink_msg_waypoint_get_param4(msg);
shimniok 0:826c6171fc1b 357 waypoint->x = mavlink_msg_waypoint_get_x(msg);
shimniok 0:826c6171fc1b 358 waypoint->y = mavlink_msg_waypoint_get_y(msg);
shimniok 0:826c6171fc1b 359 waypoint->z = mavlink_msg_waypoint_get_z(msg);
shimniok 0:826c6171fc1b 360 }