Code for autonomous ground vehicle, Data Bus, 3rd place winner in 2012 Sparkfun AVC.
Dependencies: Watchdog mbed Schedule SimpleFilter LSM303DLM PinDetect DebounceIn Servo
MAVlink/include/common/mavlink_msg_nav_controller_output.h@0:826c6171fc1b, 2012-06-20 (annotated)
- Committer:
- shimniok
- Date:
- Wed Jun 20 14:57:48 2012 +0000
- Revision:
- 0:826c6171fc1b
Updated documentation
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shimniok | 0:826c6171fc1b | 1 | // MESSAGE NAV_CONTROLLER_OUTPUT PACKING |
shimniok | 0:826c6171fc1b | 2 | |
shimniok | 0:826c6171fc1b | 3 | #define MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT 62 |
shimniok | 0:826c6171fc1b | 4 | |
shimniok | 0:826c6171fc1b | 5 | typedef struct __mavlink_nav_controller_output_t |
shimniok | 0:826c6171fc1b | 6 | { |
shimniok | 0:826c6171fc1b | 7 | float nav_roll; ///< Current desired roll in degrees |
shimniok | 0:826c6171fc1b | 8 | float nav_pitch; ///< Current desired pitch in degrees |
shimniok | 0:826c6171fc1b | 9 | int16_t nav_bearing; ///< Current desired heading in degrees |
shimniok | 0:826c6171fc1b | 10 | int16_t target_bearing; ///< Bearing to current waypoint/target in degrees |
shimniok | 0:826c6171fc1b | 11 | uint16_t wp_dist; ///< Distance to active waypoint in meters |
shimniok | 0:826c6171fc1b | 12 | float alt_error; ///< Current altitude error in meters |
shimniok | 0:826c6171fc1b | 13 | float aspd_error; ///< Current airspeed error in meters/second |
shimniok | 0:826c6171fc1b | 14 | float xtrack_error; ///< Current crosstrack error on x-y plane in meters |
shimniok | 0:826c6171fc1b | 15 | |
shimniok | 0:826c6171fc1b | 16 | } mavlink_nav_controller_output_t; |
shimniok | 0:826c6171fc1b | 17 | |
shimniok | 0:826c6171fc1b | 18 | |
shimniok | 0:826c6171fc1b | 19 | |
shimniok | 0:826c6171fc1b | 20 | /** |
shimniok | 0:826c6171fc1b | 21 | * @brief Pack a nav_controller_output message |
shimniok | 0:826c6171fc1b | 22 | * @param system_id ID of this system |
shimniok | 0:826c6171fc1b | 23 | * @param component_id ID of this component (e.g. 200 for IMU) |
shimniok | 0:826c6171fc1b | 24 | * @param msg The MAVLink message to compress the data into |
shimniok | 0:826c6171fc1b | 25 | * |
shimniok | 0:826c6171fc1b | 26 | * @param nav_roll Current desired roll in degrees |
shimniok | 0:826c6171fc1b | 27 | * @param nav_pitch Current desired pitch in degrees |
shimniok | 0:826c6171fc1b | 28 | * @param nav_bearing Current desired heading in degrees |
shimniok | 0:826c6171fc1b | 29 | * @param target_bearing Bearing to current waypoint/target in degrees |
shimniok | 0:826c6171fc1b | 30 | * @param wp_dist Distance to active waypoint in meters |
shimniok | 0:826c6171fc1b | 31 | * @param alt_error Current altitude error in meters |
shimniok | 0:826c6171fc1b | 32 | * @param aspd_error Current airspeed error in meters/second |
shimniok | 0:826c6171fc1b | 33 | * @param xtrack_error Current crosstrack error on x-y plane in meters |
shimniok | 0:826c6171fc1b | 34 | * @return length of the message in bytes (excluding serial stream start sign) |
shimniok | 0:826c6171fc1b | 35 | */ |
shimniok | 0:826c6171fc1b | 36 | static inline uint16_t mavlink_msg_nav_controller_output_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, float nav_roll, float nav_pitch, int16_t nav_bearing, int16_t target_bearing, uint16_t wp_dist, float alt_error, float aspd_error, float xtrack_error) |
shimniok | 0:826c6171fc1b | 37 | { |
shimniok | 0:826c6171fc1b | 38 | uint16_t i = 0; |
shimniok | 0:826c6171fc1b | 39 | msg->msgid = MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT; |
shimniok | 0:826c6171fc1b | 40 | |
shimniok | 0:826c6171fc1b | 41 | i += put_float_by_index(nav_roll, i, msg->payload); // Current desired roll in degrees |
shimniok | 0:826c6171fc1b | 42 | i += put_float_by_index(nav_pitch, i, msg->payload); // Current desired pitch in degrees |
shimniok | 0:826c6171fc1b | 43 | i += put_int16_t_by_index(nav_bearing, i, msg->payload); // Current desired heading in degrees |
shimniok | 0:826c6171fc1b | 44 | i += put_int16_t_by_index(target_bearing, i, msg->payload); // Bearing to current waypoint/target in degrees |
shimniok | 0:826c6171fc1b | 45 | i += put_uint16_t_by_index(wp_dist, i, msg->payload); // Distance to active waypoint in meters |
shimniok | 0:826c6171fc1b | 46 | i += put_float_by_index(alt_error, i, msg->payload); // Current altitude error in meters |
shimniok | 0:826c6171fc1b | 47 | i += put_float_by_index(aspd_error, i, msg->payload); // Current airspeed error in meters/second |
shimniok | 0:826c6171fc1b | 48 | i += put_float_by_index(xtrack_error, i, msg->payload); // Current crosstrack error on x-y plane in meters |
shimniok | 0:826c6171fc1b | 49 | |
shimniok | 0:826c6171fc1b | 50 | return mavlink_finalize_message(msg, system_id, component_id, i); |
shimniok | 0:826c6171fc1b | 51 | } |
shimniok | 0:826c6171fc1b | 52 | |
shimniok | 0:826c6171fc1b | 53 | /** |
shimniok | 0:826c6171fc1b | 54 | * @brief Pack a nav_controller_output message |
shimniok | 0:826c6171fc1b | 55 | * @param system_id ID of this system |
shimniok | 0:826c6171fc1b | 56 | * @param component_id ID of this component (e.g. 200 for IMU) |
shimniok | 0:826c6171fc1b | 57 | * @param chan The MAVLink channel this message was sent over |
shimniok | 0:826c6171fc1b | 58 | * @param msg The MAVLink message to compress the data into |
shimniok | 0:826c6171fc1b | 59 | * @param nav_roll Current desired roll in degrees |
shimniok | 0:826c6171fc1b | 60 | * @param nav_pitch Current desired pitch in degrees |
shimniok | 0:826c6171fc1b | 61 | * @param nav_bearing Current desired heading in degrees |
shimniok | 0:826c6171fc1b | 62 | * @param target_bearing Bearing to current waypoint/target in degrees |
shimniok | 0:826c6171fc1b | 63 | * @param wp_dist Distance to active waypoint in meters |
shimniok | 0:826c6171fc1b | 64 | * @param alt_error Current altitude error in meters |
shimniok | 0:826c6171fc1b | 65 | * @param aspd_error Current airspeed error in meters/second |
shimniok | 0:826c6171fc1b | 66 | * @param xtrack_error Current crosstrack error on x-y plane in meters |
shimniok | 0:826c6171fc1b | 67 | * @return length of the message in bytes (excluding serial stream start sign) |
shimniok | 0:826c6171fc1b | 68 | */ |
shimniok | 0:826c6171fc1b | 69 | static inline uint16_t mavlink_msg_nav_controller_output_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, float nav_roll, float nav_pitch, int16_t nav_bearing, int16_t target_bearing, uint16_t wp_dist, float alt_error, float aspd_error, float xtrack_error) |
shimniok | 0:826c6171fc1b | 70 | { |
shimniok | 0:826c6171fc1b | 71 | uint16_t i = 0; |
shimniok | 0:826c6171fc1b | 72 | msg->msgid = MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT; |
shimniok | 0:826c6171fc1b | 73 | |
shimniok | 0:826c6171fc1b | 74 | i += put_float_by_index(nav_roll, i, msg->payload); // Current desired roll in degrees |
shimniok | 0:826c6171fc1b | 75 | i += put_float_by_index(nav_pitch, i, msg->payload); // Current desired pitch in degrees |
shimniok | 0:826c6171fc1b | 76 | i += put_int16_t_by_index(nav_bearing, i, msg->payload); // Current desired heading in degrees |
shimniok | 0:826c6171fc1b | 77 | i += put_int16_t_by_index(target_bearing, i, msg->payload); // Bearing to current waypoint/target in degrees |
shimniok | 0:826c6171fc1b | 78 | i += put_uint16_t_by_index(wp_dist, i, msg->payload); // Distance to active waypoint in meters |
shimniok | 0:826c6171fc1b | 79 | i += put_float_by_index(alt_error, i, msg->payload); // Current altitude error in meters |
shimniok | 0:826c6171fc1b | 80 | i += put_float_by_index(aspd_error, i, msg->payload); // Current airspeed error in meters/second |
shimniok | 0:826c6171fc1b | 81 | i += put_float_by_index(xtrack_error, i, msg->payload); // Current crosstrack error on x-y plane in meters |
shimniok | 0:826c6171fc1b | 82 | |
shimniok | 0:826c6171fc1b | 83 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i); |
shimniok | 0:826c6171fc1b | 84 | } |
shimniok | 0:826c6171fc1b | 85 | |
shimniok | 0:826c6171fc1b | 86 | /** |
shimniok | 0:826c6171fc1b | 87 | * @brief Encode a nav_controller_output struct into a message |
shimniok | 0:826c6171fc1b | 88 | * |
shimniok | 0:826c6171fc1b | 89 | * @param system_id ID of this system |
shimniok | 0:826c6171fc1b | 90 | * @param component_id ID of this component (e.g. 200 for IMU) |
shimniok | 0:826c6171fc1b | 91 | * @param msg The MAVLink message to compress the data into |
shimniok | 0:826c6171fc1b | 92 | * @param nav_controller_output C-struct to read the message contents from |
shimniok | 0:826c6171fc1b | 93 | */ |
shimniok | 0:826c6171fc1b | 94 | static inline uint16_t mavlink_msg_nav_controller_output_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_nav_controller_output_t* nav_controller_output) |
shimniok | 0:826c6171fc1b | 95 | { |
shimniok | 0:826c6171fc1b | 96 | return mavlink_msg_nav_controller_output_pack(system_id, component_id, msg, nav_controller_output->nav_roll, nav_controller_output->nav_pitch, nav_controller_output->nav_bearing, nav_controller_output->target_bearing, nav_controller_output->wp_dist, nav_controller_output->alt_error, nav_controller_output->aspd_error, nav_controller_output->xtrack_error); |
shimniok | 0:826c6171fc1b | 97 | } |
shimniok | 0:826c6171fc1b | 98 | |
shimniok | 0:826c6171fc1b | 99 | /** |
shimniok | 0:826c6171fc1b | 100 | * @brief Send a nav_controller_output message |
shimniok | 0:826c6171fc1b | 101 | * @param chan MAVLink channel to send the message |
shimniok | 0:826c6171fc1b | 102 | * |
shimniok | 0:826c6171fc1b | 103 | * @param nav_roll Current desired roll in degrees |
shimniok | 0:826c6171fc1b | 104 | * @param nav_pitch Current desired pitch in degrees |
shimniok | 0:826c6171fc1b | 105 | * @param nav_bearing Current desired heading in degrees |
shimniok | 0:826c6171fc1b | 106 | * @param target_bearing Bearing to current waypoint/target in degrees |
shimniok | 0:826c6171fc1b | 107 | * @param wp_dist Distance to active waypoint in meters |
shimniok | 0:826c6171fc1b | 108 | * @param alt_error Current altitude error in meters |
shimniok | 0:826c6171fc1b | 109 | * @param aspd_error Current airspeed error in meters/second |
shimniok | 0:826c6171fc1b | 110 | * @param xtrack_error Current crosstrack error on x-y plane in meters |
shimniok | 0:826c6171fc1b | 111 | */ |
shimniok | 0:826c6171fc1b | 112 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS |
shimniok | 0:826c6171fc1b | 113 | |
shimniok | 0:826c6171fc1b | 114 | static inline void mavlink_msg_nav_controller_output_send(mavlink_channel_t chan, float nav_roll, float nav_pitch, int16_t nav_bearing, int16_t target_bearing, uint16_t wp_dist, float alt_error, float aspd_error, float xtrack_error) |
shimniok | 0:826c6171fc1b | 115 | { |
shimniok | 0:826c6171fc1b | 116 | mavlink_message_t msg; |
shimniok | 0:826c6171fc1b | 117 | mavlink_msg_nav_controller_output_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, nav_roll, nav_pitch, nav_bearing, target_bearing, wp_dist, alt_error, aspd_error, xtrack_error); |
shimniok | 0:826c6171fc1b | 118 | mavlink_send_uart(chan, &msg); |
shimniok | 0:826c6171fc1b | 119 | } |
shimniok | 0:826c6171fc1b | 120 | |
shimniok | 0:826c6171fc1b | 121 | #endif |
shimniok | 0:826c6171fc1b | 122 | // MESSAGE NAV_CONTROLLER_OUTPUT UNPACKING |
shimniok | 0:826c6171fc1b | 123 | |
shimniok | 0:826c6171fc1b | 124 | /** |
shimniok | 0:826c6171fc1b | 125 | * @brief Get field nav_roll from nav_controller_output message |
shimniok | 0:826c6171fc1b | 126 | * |
shimniok | 0:826c6171fc1b | 127 | * @return Current desired roll in degrees |
shimniok | 0:826c6171fc1b | 128 | */ |
shimniok | 0:826c6171fc1b | 129 | static inline float mavlink_msg_nav_controller_output_get_nav_roll(const mavlink_message_t* msg) |
shimniok | 0:826c6171fc1b | 130 | { |
shimniok | 0:826c6171fc1b | 131 | generic_32bit r; |
shimniok | 0:826c6171fc1b | 132 | r.b[3] = (msg->payload)[0]; |
shimniok | 0:826c6171fc1b | 133 | r.b[2] = (msg->payload)[1]; |
shimniok | 0:826c6171fc1b | 134 | r.b[1] = (msg->payload)[2]; |
shimniok | 0:826c6171fc1b | 135 | r.b[0] = (msg->payload)[3]; |
shimniok | 0:826c6171fc1b | 136 | return (float)r.f; |
shimniok | 0:826c6171fc1b | 137 | } |
shimniok | 0:826c6171fc1b | 138 | |
shimniok | 0:826c6171fc1b | 139 | /** |
shimniok | 0:826c6171fc1b | 140 | * @brief Get field nav_pitch from nav_controller_output message |
shimniok | 0:826c6171fc1b | 141 | * |
shimniok | 0:826c6171fc1b | 142 | * @return Current desired pitch in degrees |
shimniok | 0:826c6171fc1b | 143 | */ |
shimniok | 0:826c6171fc1b | 144 | static inline float mavlink_msg_nav_controller_output_get_nav_pitch(const mavlink_message_t* msg) |
shimniok | 0:826c6171fc1b | 145 | { |
shimniok | 0:826c6171fc1b | 146 | generic_32bit r; |
shimniok | 0:826c6171fc1b | 147 | r.b[3] = (msg->payload+sizeof(float))[0]; |
shimniok | 0:826c6171fc1b | 148 | r.b[2] = (msg->payload+sizeof(float))[1]; |
shimniok | 0:826c6171fc1b | 149 | r.b[1] = (msg->payload+sizeof(float))[2]; |
shimniok | 0:826c6171fc1b | 150 | r.b[0] = (msg->payload+sizeof(float))[3]; |
shimniok | 0:826c6171fc1b | 151 | return (float)r.f; |
shimniok | 0:826c6171fc1b | 152 | } |
shimniok | 0:826c6171fc1b | 153 | |
shimniok | 0:826c6171fc1b | 154 | /** |
shimniok | 0:826c6171fc1b | 155 | * @brief Get field nav_bearing from nav_controller_output message |
shimniok | 0:826c6171fc1b | 156 | * |
shimniok | 0:826c6171fc1b | 157 | * @return Current desired heading in degrees |
shimniok | 0:826c6171fc1b | 158 | */ |
shimniok | 0:826c6171fc1b | 159 | static inline int16_t mavlink_msg_nav_controller_output_get_nav_bearing(const mavlink_message_t* msg) |
shimniok | 0:826c6171fc1b | 160 | { |
shimniok | 0:826c6171fc1b | 161 | generic_16bit r; |
shimniok | 0:826c6171fc1b | 162 | r.b[1] = (msg->payload+sizeof(float)+sizeof(float))[0]; |
shimniok | 0:826c6171fc1b | 163 | r.b[0] = (msg->payload+sizeof(float)+sizeof(float))[1]; |
shimniok | 0:826c6171fc1b | 164 | return (int16_t)r.s; |
shimniok | 0:826c6171fc1b | 165 | } |
shimniok | 0:826c6171fc1b | 166 | |
shimniok | 0:826c6171fc1b | 167 | /** |
shimniok | 0:826c6171fc1b | 168 | * @brief Get field target_bearing from nav_controller_output message |
shimniok | 0:826c6171fc1b | 169 | * |
shimniok | 0:826c6171fc1b | 170 | * @return Bearing to current waypoint/target in degrees |
shimniok | 0:826c6171fc1b | 171 | */ |
shimniok | 0:826c6171fc1b | 172 | static inline int16_t mavlink_msg_nav_controller_output_get_target_bearing(const mavlink_message_t* msg) |
shimniok | 0:826c6171fc1b | 173 | { |
shimniok | 0:826c6171fc1b | 174 | generic_16bit r; |
shimniok | 0:826c6171fc1b | 175 | r.b[1] = (msg->payload+sizeof(float)+sizeof(float)+sizeof(int16_t))[0]; |
shimniok | 0:826c6171fc1b | 176 | r.b[0] = (msg->payload+sizeof(float)+sizeof(float)+sizeof(int16_t))[1]; |
shimniok | 0:826c6171fc1b | 177 | return (int16_t)r.s; |
shimniok | 0:826c6171fc1b | 178 | } |
shimniok | 0:826c6171fc1b | 179 | |
shimniok | 0:826c6171fc1b | 180 | /** |
shimniok | 0:826c6171fc1b | 181 | * @brief Get field wp_dist from nav_controller_output message |
shimniok | 0:826c6171fc1b | 182 | * |
shimniok | 0:826c6171fc1b | 183 | * @return Distance to active waypoint in meters |
shimniok | 0:826c6171fc1b | 184 | */ |
shimniok | 0:826c6171fc1b | 185 | static inline uint16_t mavlink_msg_nav_controller_output_get_wp_dist(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(float)+sizeof(float)+sizeof(int16_t)+sizeof(int16_t))[0]; |
shimniok | 0:826c6171fc1b | 189 | r.b[0] = (msg->payload+sizeof(float)+sizeof(float)+sizeof(int16_t)+sizeof(int16_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 alt_error from nav_controller_output message |
shimniok | 0:826c6171fc1b | 195 | * |
shimniok | 0:826c6171fc1b | 196 | * @return Current altitude error in meters |
shimniok | 0:826c6171fc1b | 197 | */ |
shimniok | 0:826c6171fc1b | 198 | static inline float mavlink_msg_nav_controller_output_get_alt_error(const mavlink_message_t* msg) |
shimniok | 0:826c6171fc1b | 199 | { |
shimniok | 0:826c6171fc1b | 200 | generic_32bit r; |
shimniok | 0:826c6171fc1b | 201 | r.b[3] = (msg->payload+sizeof(float)+sizeof(float)+sizeof(int16_t)+sizeof(int16_t)+sizeof(uint16_t))[0]; |
shimniok | 0:826c6171fc1b | 202 | r.b[2] = (msg->payload+sizeof(float)+sizeof(float)+sizeof(int16_t)+sizeof(int16_t)+sizeof(uint16_t))[1]; |
shimniok | 0:826c6171fc1b | 203 | r.b[1] = (msg->payload+sizeof(float)+sizeof(float)+sizeof(int16_t)+sizeof(int16_t)+sizeof(uint16_t))[2]; |
shimniok | 0:826c6171fc1b | 204 | r.b[0] = (msg->payload+sizeof(float)+sizeof(float)+sizeof(int16_t)+sizeof(int16_t)+sizeof(uint16_t))[3]; |
shimniok | 0:826c6171fc1b | 205 | return (float)r.f; |
shimniok | 0:826c6171fc1b | 206 | } |
shimniok | 0:826c6171fc1b | 207 | |
shimniok | 0:826c6171fc1b | 208 | /** |
shimniok | 0:826c6171fc1b | 209 | * @brief Get field aspd_error from nav_controller_output message |
shimniok | 0:826c6171fc1b | 210 | * |
shimniok | 0:826c6171fc1b | 211 | * @return Current airspeed error in meters/second |
shimniok | 0:826c6171fc1b | 212 | */ |
shimniok | 0:826c6171fc1b | 213 | static inline float mavlink_msg_nav_controller_output_get_aspd_error(const mavlink_message_t* msg) |
shimniok | 0:826c6171fc1b | 214 | { |
shimniok | 0:826c6171fc1b | 215 | generic_32bit r; |
shimniok | 0:826c6171fc1b | 216 | r.b[3] = (msg->payload+sizeof(float)+sizeof(float)+sizeof(int16_t)+sizeof(int16_t)+sizeof(uint16_t)+sizeof(float))[0]; |
shimniok | 0:826c6171fc1b | 217 | r.b[2] = (msg->payload+sizeof(float)+sizeof(float)+sizeof(int16_t)+sizeof(int16_t)+sizeof(uint16_t)+sizeof(float))[1]; |
shimniok | 0:826c6171fc1b | 218 | r.b[1] = (msg->payload+sizeof(float)+sizeof(float)+sizeof(int16_t)+sizeof(int16_t)+sizeof(uint16_t)+sizeof(float))[2]; |
shimniok | 0:826c6171fc1b | 219 | r.b[0] = (msg->payload+sizeof(float)+sizeof(float)+sizeof(int16_t)+sizeof(int16_t)+sizeof(uint16_t)+sizeof(float))[3]; |
shimniok | 0:826c6171fc1b | 220 | return (float)r.f; |
shimniok | 0:826c6171fc1b | 221 | } |
shimniok | 0:826c6171fc1b | 222 | |
shimniok | 0:826c6171fc1b | 223 | /** |
shimniok | 0:826c6171fc1b | 224 | * @brief Get field xtrack_error from nav_controller_output message |
shimniok | 0:826c6171fc1b | 225 | * |
shimniok | 0:826c6171fc1b | 226 | * @return Current crosstrack error on x-y plane in meters |
shimniok | 0:826c6171fc1b | 227 | */ |
shimniok | 0:826c6171fc1b | 228 | static inline float mavlink_msg_nav_controller_output_get_xtrack_error(const mavlink_message_t* msg) |
shimniok | 0:826c6171fc1b | 229 | { |
shimniok | 0:826c6171fc1b | 230 | generic_32bit r; |
shimniok | 0:826c6171fc1b | 231 | r.b[3] = (msg->payload+sizeof(float)+sizeof(float)+sizeof(int16_t)+sizeof(int16_t)+sizeof(uint16_t)+sizeof(float)+sizeof(float))[0]; |
shimniok | 0:826c6171fc1b | 232 | r.b[2] = (msg->payload+sizeof(float)+sizeof(float)+sizeof(int16_t)+sizeof(int16_t)+sizeof(uint16_t)+sizeof(float)+sizeof(float))[1]; |
shimniok | 0:826c6171fc1b | 233 | r.b[1] = (msg->payload+sizeof(float)+sizeof(float)+sizeof(int16_t)+sizeof(int16_t)+sizeof(uint16_t)+sizeof(float)+sizeof(float))[2]; |
shimniok | 0:826c6171fc1b | 234 | r.b[0] = (msg->payload+sizeof(float)+sizeof(float)+sizeof(int16_t)+sizeof(int16_t)+sizeof(uint16_t)+sizeof(float)+sizeof(float))[3]; |
shimniok | 0:826c6171fc1b | 235 | return (float)r.f; |
shimniok | 0:826c6171fc1b | 236 | } |
shimniok | 0:826c6171fc1b | 237 | |
shimniok | 0:826c6171fc1b | 238 | /** |
shimniok | 0:826c6171fc1b | 239 | * @brief Decode a nav_controller_output message into a struct |
shimniok | 0:826c6171fc1b | 240 | * |
shimniok | 0:826c6171fc1b | 241 | * @param msg The message to decode |
shimniok | 0:826c6171fc1b | 242 | * @param nav_controller_output C-struct to decode the message contents into |
shimniok | 0:826c6171fc1b | 243 | */ |
shimniok | 0:826c6171fc1b | 244 | static inline void mavlink_msg_nav_controller_output_decode(const mavlink_message_t* msg, mavlink_nav_controller_output_t* nav_controller_output) |
shimniok | 0:826c6171fc1b | 245 | { |
shimniok | 0:826c6171fc1b | 246 | nav_controller_output->nav_roll = mavlink_msg_nav_controller_output_get_nav_roll(msg); |
shimniok | 0:826c6171fc1b | 247 | nav_controller_output->nav_pitch = mavlink_msg_nav_controller_output_get_nav_pitch(msg); |
shimniok | 0:826c6171fc1b | 248 | nav_controller_output->nav_bearing = mavlink_msg_nav_controller_output_get_nav_bearing(msg); |
shimniok | 0:826c6171fc1b | 249 | nav_controller_output->target_bearing = mavlink_msg_nav_controller_output_get_target_bearing(msg); |
shimniok | 0:826c6171fc1b | 250 | nav_controller_output->wp_dist = mavlink_msg_nav_controller_output_get_wp_dist(msg); |
shimniok | 0:826c6171fc1b | 251 | nav_controller_output->alt_error = mavlink_msg_nav_controller_output_get_alt_error(msg); |
shimniok | 0:826c6171fc1b | 252 | nav_controller_output->aspd_error = mavlink_msg_nav_controller_output_get_aspd_error(msg); |
shimniok | 0:826c6171fc1b | 253 | nav_controller_output->xtrack_error = mavlink_msg_nav_controller_output_get_xtrack_error(msg); |
shimniok | 0:826c6171fc1b | 254 | } |